]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.44 1.1.44
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:38 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:38 +0000 (15:09 -0500)
46 files changed:
Makefile
drivers/block/floppy.c
drivers/block/hd.c
drivers/char/console.c
drivers/char/serial.c
drivers/char/tpqic02.c
drivers/char/tty_io.c
drivers/char/vt.c
drivers/net/8390.c
drivers/net/plip.c
drivers/net/ppp.c
drivers/net/slip.c
drivers/scsi/hosts.c
drivers/scsi/scsicam.c
drivers/sound/soundcard.c
fs/buffer.c
fs/exec.c
fs/ext/freelists.c
fs/ext/namei.c
fs/ext2/acl.c
fs/ext2/balloc.c
fs/ext2/ialloc.c
fs/ext2/ioctl.c
fs/ext2/namei.c
fs/inode.c
fs/minix/bitmap.c
fs/minix/namei.c
fs/namei.c
fs/nfs/proc.c
fs/open.c
fs/sysv/ialloc.c
fs/sysv/namei.c
fs/umsdos/namei.c
fs/xiafs/bitmap.c
fs/xiafs/namei.c
include/asm/segment.h
include/linux/kernel.h
include/linux/sched.h
include/linux/skbuff.h
include/linux/string.h
include/linux/unistd.h
kernel/sys.c
kernel/sys_call.S
mm/mmap.c
mm/mprotect.c
net/inet/eth.c

index e7943d4edbebe6a3455adad9ef4ed0bc13bb33a1..605f7d2550a07155b20a9cf8b27b88507db81cbd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 43
+SUBLEVEL = 44
 
 all:   Version zImage
 
index adadc829ccb3062964180af04f20cd40ba2d6ee4..01e48216468e59a2615f70c28e399d1bef3b2938 100644 (file)
@@ -1523,7 +1523,7 @@ static void setup_format_params(void)
 {
        struct fparm {
                unsigned char track,head,sect,size;
-       } *here = (void *)floppy_track_buffer;
+       } *here = (struct fparm *)floppy_track_buffer;
        int ssize,il,n;
        int count,head_shift,track_shift;
 
index 4064c32369afcf51d4c3bca77a27dbaecf73686f..ee25e9b243659753290a4830b98bb6d945fc4e8e 100644 (file)
@@ -278,7 +278,7 @@ static void identify_intr(void)
                        id.cyls*id.heads*id.sectors/2048, id.buf_size/2,
                        hd_info[dev].cyl, hd_info[dev].head, hd_info[dev].sect, id.max_multsect);
                /* save drive info for later query via HDIO_GETIDENTITY */
-               if (NULL != (hd_ident_info[dev] = kmalloc(sizeof(id),GFP_ATOMIC)))
+               if (NULL != (hd_ident_info[dev] = (struct hd_driveid *)kmalloc(sizeof(id),GFP_ATOMIC)))
                        *hd_ident_info[dev] = id;
                
                /* flush remaining 384 (reserved/undefined) ID bytes: */
index abe9af4ad74e43d4a0d28c486cfe26d4291b25cd..213daad3c84219bd788311cb25dce477e0342b0c 100644 (file)
@@ -1103,7 +1103,7 @@ static int con_write(struct tty_struct * tty, int from_user,
 {
        int c, n = 0;
        unsigned int currcons;
-       struct vt_struct *vt = tty->driver_data;
+       struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
 
        currcons = vt->vc_num;
        if (currcons >= NR_CONSOLES) {
@@ -1834,7 +1834,7 @@ static void highlight(const int currcons, const int s, const int e)
 static void highlight_pointer(const int currcons, const int where)
 {
         unsigned char *p;
-       static char *prev=NULL;
+       static unsigned char *prev=NULL;
 
        if (where==-1) /* remove the pointer */
        {
index 4aaa21d40dfd55366a4e5f1a98e08e5c33ff38e4..e5dfea2a0153cee7f42f661a7781775e077dfbe1 100644 (file)
@@ -290,7 +290,7 @@ static inline void serial_outp(struct async_struct *info, int offset,
  */
 static void rs_stop(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
 
        if (serial_paranoia_check(info, tty->device, "rs_stop"))
@@ -306,7 +306,7 @@ static void rs_stop(struct tty_struct *tty)
 
 static void rs_start(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
        
        if (serial_paranoia_check(info, tty->device, "rs_start"))
@@ -694,9 +694,9 @@ static void do_serial_bh(void *unused)
        run_task_queue(&tq_serial);
 }
 
-static void do_softint(void *private)
+static void do_softint(void *private_)
 {
-       struct async_struct     *info = (struct async_struct *) private;
+       struct async_struct     *info = (struct async_struct *) private_;
        struct tty_struct       *tty;
        
        tty = info->tty;
@@ -1185,7 +1185,7 @@ static void change_speed(struct async_struct *info)
 
 static void rs_put_char(struct tty_struct *tty, unsigned char ch)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
 
        if (serial_paranoia_check(info, tty->device, "rs_put_char"))
@@ -1208,7 +1208,7 @@ static void rs_put_char(struct tty_struct *tty, unsigned char ch)
 
 static void rs_flush_chars(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
                                
        if (serial_paranoia_check(info, tty->device, "rs_flush_chars"))
@@ -1228,7 +1228,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
                    unsigned char *buf, int count)
 {
        int     c, total = 0;
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        unsigned long flags;
                                
        if (serial_paranoia_check(info, tty->device, "rs_write"))
@@ -1272,7 +1272,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
 
 static int rs_write_room(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
        int     ret;
                                
        if (serial_paranoia_check(info, tty->device, "rs_write_room"))
@@ -1285,7 +1285,7 @@ static int rs_write_room(struct tty_struct *tty)
 
 static int rs_chars_in_buffer(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
                                
        if (serial_paranoia_check(info, tty->device, "rs_chars_in_buffer"))
                return 0;
@@ -1294,7 +1294,7 @@ static int rs_chars_in_buffer(struct tty_struct *tty)
 
 static void rs_flush_buffer(struct tty_struct *tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
                                
        if (serial_paranoia_check(info, tty->device, "rs_flush_buffer"))
                return;
@@ -1317,7 +1317,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
  */
 static void rs_throttle(struct tty_struct * tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
        char    buf[64];
        
@@ -1340,7 +1340,7 @@ static void rs_throttle(struct tty_struct * tty)
 
 static void rs_unthrottle(struct tty_struct * tty)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
 #ifdef SERIAL_DEBUG_THROTTLE
        char    buf[64];
        
@@ -1627,7 +1627,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                    unsigned int cmd, unsigned long arg)
 {
        int error;
-       struct async_struct * info = tty->driver_data;
+       struct async_struct * info = (struct async_struct *)tty->driver_data;
        int retval;
 
        if (serial_paranoia_check(info, tty->device, "rs_ioctl"))
@@ -1718,7 +1718,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
 
 static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
 {
-       struct async_struct *info = tty->driver_data;
+       struct async_struct *info = (struct async_struct *)tty->driver_data;
 
        if (tty->termios->c_cflag == old_termios->c_cflag)
                return;
@@ -1748,7 +1748,7 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
  */
 static void rs_close(struct tty_struct *tty, struct file * filp)
 {
-       struct async_struct * info = tty->driver_data;
+       struct async_struct * info = (struct async_struct *)tty->driver_data;
 
        if (!info || serial_paranoia_check(info, tty->device, "rs_close"))
                return;
@@ -1822,7 +1822,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
  */
 void rs_hangup(struct tty_struct *tty)
 {
-       struct async_struct * info = tty->driver_data;
+       struct async_struct * info = (struct async_struct *)tty->driver_data;
        
        if (serial_paranoia_check(info, tty->device, "rs_hangup"))
                return;
index 0b0120004e00dbdee9d6ba50f7421b98d3b70e67..67aadf74b9246d1c263d41cbf3b612338dd688cb 100644 (file)
@@ -2832,7 +2832,7 @@ static int qic02_get_resources(void)
         */
 
        /* get IRQ */
-       if (request_irq(QIC02_TAPE_IRQ, qic02_tape_interrupt, SA_INTERRUP, "QIC-02")) {
+       if (request_irq(QIC02_TAPE_IRQ, qic02_tape_interrupt, SA_INTERRUPT, "QIC-02")) {
                printk(TPQIC02_NAME ": can't allocate IRQ%d for QIC-02 tape\n",
                        QIC02_TAPE_IRQ);
                status_zombie = YES;
index 6c670c37660712b494488ba3562c3c2ee8d699b4..1cdaf1de996a2f2387cd1cf0efb474523f843fc5 100644 (file)
@@ -634,7 +634,7 @@ static int tty_read(struct inode * inode, struct file * file, char * buf, int co
        int i;
        struct tty_struct * tty;
 
-       tty = file->private_data;
+       tty = (struct tty_struct *)file->private_data;
        if (tty_paranoia_check(tty, inode->i_rdev, "tty_read"))
                return -EIO;
        if (!tty || (tty->flags & (1 << TTY_IO_ERROR)))
@@ -676,7 +676,7 @@ static int tty_write(struct inode * inode, struct file * file, char * buf, int c
        if (is_console && redirect)
                tty = redirect;
        else
-               tty = file->private_data;
+               tty = (struct tty_struct *)file->private_data;
        if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))
                return -EIO;
        if (!tty || !tty->driver.write || (tty->flags & (1 << TTY_IO_ERROR)))
@@ -886,7 +886,7 @@ static void release_dev(struct file * filp)
        int     idx;
        
 
-       tty = filp->private_data;
+       tty = (struct tty_struct *)filp->private_data;
        if (tty_paranoia_check(tty, filp->f_inode->i_rdev, "release_dev"))
                return;
 
@@ -1136,7 +1136,7 @@ static int tty_select(struct inode * inode, struct file * filp, int sel_type, se
 {
        struct tty_struct * tty;
 
-       tty = filp->private_data;
+       tty = (struct tty_struct *)filp->private_data;
        if (tty_paranoia_check(tty, inode->i_rdev, "tty_select"))
                return 0;
 
@@ -1150,7 +1150,7 @@ static int tty_fasync(struct inode * inode, struct file * filp, int on)
        struct tty_struct * tty;
        struct fasync_struct *fa, *prev;
 
-       tty = filp->private_data;
+       tty = (struct tty_struct *)filp->private_data;
        if (tty_paranoia_check(tty, inode->i_rdev, "tty_fasync"))
                return 0;
 
@@ -1162,7 +1162,7 @@ static int tty_fasync(struct inode * inode, struct file * filp, int on)
        if (on) {
                if (fa)
                        return 0;
-               fa = kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
+               fa = (struct fasync_struct *)kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
                if (!fa)
                        return -ENOMEM;
                fa->magic = FASYNC_MAGIC;
@@ -1228,7 +1228,7 @@ static int tty_ioctl(struct inode * inode, struct file * file,
        unsigned char   ch;
        char    mbz = 0;
        
-       tty = file->private_data;
+       tty = (struct tty_struct *)file->private_data;
        if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
                return -EINVAL;
 
@@ -1466,9 +1466,9 @@ void do_SAK( struct tty_struct *tty)
  * This routine is called out of the software interrupt to flush data
  * from the flip buffer to the line discipline.
  */
-static void flush_to_ldisc(void *private)
+static void flush_to_ldisc(void *private_)
 {
-       struct tty_struct *tty = private;
+       struct tty_struct *tty = (struct tty_struct *) private_;
        unsigned char   *cp;
        char            *fp;
        int             count;
index cdc60b09bd001285dfdb9f2af7c86b70c124caf8..107eb727824fe55a479eec55fabe9c8204b48638 100644 (file)
@@ -121,7 +121,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
        int console, i;
        unsigned char ucval;
        struct kbd_struct * kbd;
-       struct vt_struct *vt = tty->driver_data;
+       struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
 
        console = vt->vc_num;
 
index aae2bdd32035f577b802bbd3b770b46356da2712..e811fd1c61354d987fccabe4bade6b029fe4f160 100644 (file)
@@ -134,15 +134,12 @@ static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
           the board has died and kick it. */
 
     if (dev->tbusy) {  /* Do timeouts, just like the 8003 driver. */
-               int txsr = inb(e8390_base+EN0_TSR), isr, cmd;
+               int txsr = inb(e8390_base+EN0_TSR), isr;
                int tickssofar = jiffies - dev->trans_start;
                if (tickssofar < 10     ||      (tickssofar < 15 && ! (txsr & ENTSR_PTX))) {
                        return 1;
                }
                isr = inb(e8390_base+EN0_ISR);
-               cmd = inb(e8390_base+E8390_CMD) & (E8390_STOP|E8390_START);
-               if ((cmd == 0) || (cmd == (E8390_STOP|E8390_START)))
-                       return 1;
                printk(KERN_DEBUG "%s: transmit timed out, TX status %#2x, ISR %#2x.\n",
                           dev->name, txsr, isr);
                /* Does the 8390 thinks it has posted an interrupt? */
@@ -245,7 +242,7 @@ void ei_interrupt(int reg_ptr)
     int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
     struct device *dev = (struct device *)(irq2dev_map[irq]);
     int e8390_base;
-    int interrupts, cmd, boguscount = 0;
+    int interrupts, boguscount = 0;
     struct ei_device *ei_local;
     
     if (dev == NULL) {
@@ -277,12 +274,6 @@ void ei_interrupt(int reg_ptr)
     /* !!Assumption!! -- we stay in page 0.     Don't break this. */
     while ((interrupts = inb_p(e8390_base + EN0_ISR)) != 0
                   && ++boguscount < 9) {
-               cmd = inb(e8390_base+E8390_CMD) & (E8390_STOP|E8390_START);
-               if ((cmd == 0) || (cmd == (E8390_STOP|E8390_START))) {
-                       printk("%s: card not present\n", dev->name);
-                       interrupts = 0;
-                       break;
-                       }
                if (interrupts & ENISR_RDC) {
                        /* Ack meaningless DMA complete. */
                        outb_p(ENISR_RDC, e8390_base + EN0_ISR);
index 7b3d10550a959fafd9654a1ca7372d3b798ccf21..3cb276b64ee9edc6c01efbcef7c1218fa4e69077 100644 (file)
@@ -232,7 +232,7 @@ plip_init(struct device *dev)
 
     dev->priv = kmalloc(sizeof (struct net_local), GFP_KERNEL);
     memset(dev->priv, 0, sizeof(struct net_local));
-    pl=dev->priv;
+    pl = (struct net_local *) dev->priv;
     
     pl->trigger_us     =       PLIP_TRIGGER_WAIT;
     pl->nibble_us      =       PLIP_NIBBLE_WAIT;
@@ -693,7 +693,7 @@ static void
 plip_interrupt(int reg_ptr)
 {
     int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
-    struct device *dev = irq2dev_map[irq];
+    struct device *dev = (struct device *) irq2dev_map[irq];
     struct net_local *lp = (struct net_local *)dev->priv;
     struct plip_local *rcv = &lp->rcv_data;
     struct plip_local *snd = &lp->snd_data;
index 0bfdd719c113f907183fcfe30b822ac98eef29cb..7e57d304e8312181b9f02cc77274f3883807e7c6 100644 (file)
@@ -550,7 +550,7 @@ ppp_open(struct tty_struct *tty)
   }
 
   /* Allocate a user-level receive buffer */
-  ppp->us_rbuff = kmalloc (RBUFSIZE, GFP_KERNEL);
+  ppp->us_rbuff = (unsigned char *) kmalloc (RBUFSIZE, GFP_KERNEL);
   if (ppp->us_rbuff == NULL) {
     PRINTKN (1,(KERN_ERR "ppp: no space for user receive buffer\n"));
     ppp_release (ppp);
@@ -2013,7 +2013,7 @@ static void ppp_print_buffer(const char *name, char *buf, int count, int seg)
 
   set_fs (seg);
 
-  if (name != (char *) NULL)
+  if (name != NULL)
     PRINTK ((KERN_DEBUG "ppp: %s, count = %d\n", name, count));
 
   while (count > 8) {
index 0237b5694d127cc0293ebc044a4cf01e2dfbb29a..e845698368868815bf31d13ffc8043459363cd36 100644 (file)
@@ -986,7 +986,7 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
        /* Allow stty to read, but not set, the serial port */
        case TCGETS:
        case TCGETA:
-               return n_tty_ioctl(tty, file, cmd, (unsigned long) arg);
+               return n_tty_ioctl(tty, (struct file *) file, cmd, (unsigned long) arg);
                
        default:
                return -ENOIOCTLCMD;
index a926d2b243b5473d888e9d874772af677dbf7d0a..dc1a936f2225d7e5c62687bb6ad3e10e6420d2a5 100644 (file)
@@ -197,7 +197,7 @@ scsi_unregister(struct Scsi_Host * sh){
 
 struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
        struct Scsi_Host * retval, *shpnt;
-       retval = scsi_init_malloc(sizeof(struct Scsi_Host) + j);
+       retval = (struct Scsi_Host *)scsi_init_malloc(sizeof(struct Scsi_Host) + j);
        retval->host_busy = 0;
        if(j > 0xffff) panic("Too many extra bytes requested\n");
        retval->extra_bytes = j;
index 3ae85e92d83aff3cb6e0c75198c67f535df6c22e..2b0e3cdf62c8f0321d23afbbb0b4288427481280 100644 (file)
@@ -182,7 +182,7 @@ static int setsize(unsigned long capacity,unsigned int *cyls,unsigned int *hds,
            cylinders = capacity / temp;/* Compute number of cylinders */ 
        } 
     } 
-    if (cylinders == 0) rv=-1;                 /* Give error if 0 cylinders */ 
+    if (cylinders == 0) rv=(unsigned)-1;/* Give error if 0 cylinders */ 
 
     *cyls = (unsigned int) cylinders;  /* Stuff return values */ 
     *secs = (unsigned int) sectors; 
index 15eeca8ce56fea6fa729b0c5a51a13b69422ff31..aa87c3eba43073a3fa8dc56d0d87b645da0961f8 100644 (file)
@@ -219,7 +219,7 @@ snd_set_irq_handler (int interrupt_level, void (*hndlr) (int))
 {
   int             retcode;
 
-  retcode = request_irq(interrupt_level, &hndlr,
+  retcode = request_irq(interrupt_level, hndlr,
 #ifdef SND_SA_INTERRUPT
        SA_INTERRUPT,
 #else
index b19070a379ec81e771a7db0b7a293554e5cf6537..bcabae8f7b1b06a7b7e57e6cce3ca5d05ff47941 100644 (file)
@@ -880,7 +880,7 @@ static void put_unused_buffer_head(struct buffer_head * bh)
        struct wait_queue * wait;
 
        wait = ((volatile struct buffer_head *) bh)->b_wait;
-       memset((void *) bh,0,sizeof(*bh));
+       memset(bh,0,sizeof(*bh));
        ((volatile struct buffer_head *) bh)->b_wait = wait;
        bh->b_next_free = unused_list;
        unused_list = bh;
index ec78844cacf914b2f89c753e2cab457a932b79a8..f116788777822807b93eb88caf9faf42ee7153a1 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -612,8 +612,7 @@ restart_interp:
        }
        i = bprm.inode->i_mode;
        if (IS_NOSUID(bprm.inode) && (((i & S_ISUID) && bprm.inode->i_uid != current->
-           euid) || ((i & S_ISGID) && !in_group_p(bprm.inode->i_gid))) &&
-           !suser()) {
+           euid) || ((i & S_ISGID) && !in_group_p(bprm.inode->i_gid))) && !suser()) {
                retval = -EPERM;
                goto exec_error2;
        }
@@ -816,8 +815,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                (current->mm->start_code = N_TXTADDR(ex)))));
        current->mm->rss = 0;
        current->mm->mmap = NULL;
-       current->suid = current->euid = bprm->e_uid;
-       current->sgid = current->egid = bprm->e_gid;
+       current->suid = current->euid = current->fsuid = bprm->e_uid;
+       current->sgid = current->egid = current->fsgid = bprm->e_gid;
        if (N_MAGIC(ex) == OMAGIC) {
                do_mmap(NULL, 0, ex.a_text+ex.a_data,
                        PROT_READ|PROT_WRITE|PROT_EXEC,
index 8d9fe7acf2802947a48ec43436a43483d02dfb67..8bc8e67e340546531b139176d54028af408bdf6a 100644 (file)
@@ -289,8 +289,8 @@ printk("ext_free_inode: inode empty, skipping to %d\n", efi->next);
        inode->i_count = 1;
        inode->i_nlink = 1;
        inode->i_dev = sb->s_dev;
-       inode->i_uid = current->euid;
-       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+       inode->i_uid = current->fsuid;
+       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
        inode->i_dirt = 1;
        inode->i_ino = j;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
index 2b54034de0c315ae56fecfec21d6d5ce6600fbdb..324af160b5e4774f5cdc5452f843a997c5da817a 100644 (file)
@@ -361,7 +361,7 @@ int ext_mknod(struct inode * dir, const char * name, int len, int mode, int rdev
                iput(dir);
                return -ENOSPC;
        }
-       inode->i_uid = current->euid;
+       inode->i_uid = current->fsuid;
        inode->i_mode = mode;
        inode->i_op = NULL;
        if (S_ISREG(inode->i_mode))
@@ -544,9 +544,9 @@ int ext_rmdir(struct inode * dir, const char * name, int len)
        retval = -EPERM;
        if (!(inode = iget(dir->i_sb, de->inode)))
                goto end_rmdir;
-        if ((dir->i_mode & S_ISVTX) && !suser() &&
-            current->euid != inode->i_uid &&
-            current->euid != dir->i_uid)
+        if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+            current->fsuid != inode->i_uid &&
+            current->fsuid != dir->i_uid)
                goto end_rmdir;
        if (inode->i_dev != dir->i_dev)
                goto end_rmdir;
@@ -598,9 +598,9 @@ int ext_unlink(struct inode * dir, const char * name, int len)
        if (!(inode = iget(dir->i_sb, de->inode)))
                goto end_unlink;
        retval = -EPERM;
-       if ((dir->i_mode & S_ISVTX) && !suser() &&
-           current->euid != inode->i_uid &&
-           current->euid != dir->i_uid)
+       if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+           current->fsuid != inode->i_uid &&
+           current->fsuid != dir->i_uid)
                goto end_unlink;
        if (S_ISDIR(inode->i_mode))
                goto end_unlink;
@@ -791,8 +791,8 @@ start_up:
                goto end_rename;
        retval = -EPERM;
        if ((old_dir->i_mode & S_ISVTX) && 
-           current->euid != old_inode->i_uid &&
-           current->euid != old_dir->i_uid && !suser())
+           current->fsuid != old_inode->i_uid &&
+           current->fsuid != old_dir->i_uid && !fsuser())
                goto end_rename;
        new_bh = ext_find_entry(new_dir,new_name,new_len,&new_de,NULL,NULL);
        if (new_bh) {
@@ -812,8 +812,8 @@ start_up:
        }
        retval = -EPERM;
        if (new_inode && (new_dir->i_mode & S_ISVTX) && 
-           current->euid != new_inode->i_uid &&
-           current->euid != new_dir->i_uid && !suser())
+           current->fsuid != new_inode->i_uid &&
+           current->fsuid != new_dir->i_uid && !fsuser())
                goto end_rename;
        if (S_ISDIR(old_inode->i_mode)) {
                retval = -EEXIST;
index 421fc11fc88d56c636634554a44b16e4e20d6d07..80a112845ae0a94545b8c614baab203beec9c553 100644 (file)
@@ -29,12 +29,12 @@ int ext2_permission (struct inode * inode, int mask)
        /*
         * Special case, access is always granted for root
         */
-       if (suser ())
+       if (fsuser())
                return 1;
        /*
         * If no ACL, checks using the file mode
         */
-       else if (current->euid == inode->i_uid)
+       else if (current->fsuid == inode->i_uid)
                mode >>= 6;
        else if (in_group_p (inode->i_gid))
                mode >>= 3;
index 67b10c4b95c2394d78d5d9b2b970867fd9d1f1fc..626ae9c68e95131bc8edd54a9d24a1c65a7e92fc 100644 (file)
@@ -352,7 +352,7 @@ int ext2_new_block (struct super_block * sb, unsigned long goal,
        }
        lock_super (sb);
        es = sb->u.ext2_sb.s_es;
-       if (es->s_free_blocks_count <= es->s_r_blocks_count && !suser()) {
+       if (es->s_free_blocks_count <= es->s_r_blocks_count && !fsuser()) {
                unlock_super (sb);
                return 0;
        }
index 561a7b5465bc233ebe16b2287c051e5b7d6a3282..f598fdecafbf44cded5e6291d71c73e8bdf4fda4 100644 (file)
@@ -475,7 +475,7 @@ repeat:
        inode->i_count = 1;
        inode->i_nlink = 1;
        inode->i_dev = sb->s_dev;
-       inode->i_uid = current->euid;
+       inode->i_uid = current->fsuid;
        if (test_opt (sb, GRPID))
                inode->i_gid = dir->i_gid;
        else if (dir->i_mode & S_ISGID) {
@@ -483,7 +483,7 @@ repeat:
                if (S_ISDIR(mode))
                        mode |= S_ISGID;
        } else
-               inode->i_gid = current->egid;
+               inode->i_gid = current->fsgid;
        inode->i_dirt = 1;
        inode->i_ino = j;
        inode->i_blksize = sb->s_blocksize;
index 871af332442022c5a80b54aed497aae0f3c1e02a..c562f333dab032accb70532745cce4c5482adec6 100644 (file)
@@ -28,7 +28,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                put_fs_long (inode->u.ext2_i.i_flags, (long *) arg);
                return 0;
        case EXT2_IOC_SETFLAGS:
-               if ((current->euid != inode->i_uid) && !suser())
+               if ((current->fsuid != inode->i_uid) && !fsuser())
                        return -EPERM;
                if (IS_RDONLY(inode))
                        return -EROFS;
@@ -42,7 +42,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                put_fs_long (inode->u.ext2_i.i_version, (long *) arg);
                return 0;
        case EXT2_IOC_SETVERSION:
-               if ((current->euid != inode->i_uid) && !suser())
+               if ((current->fsuid != inode->i_uid) && !fsuser())
                        return -EPERM;
                if (IS_RDONLY(inode))
                        return -EROFS;
index a2f35d2f4930e72cf5e428fd53dcdaaf4cac71c8..06c5457f735d59f6df352313f11f0ed1cf2a81ec 100644 (file)
@@ -430,7 +430,7 @@ int ext2_mknod (struct inode * dir, const char * name, int len, int mode,
                iput (dir);
                return -ENOSPC;
        }
-       inode->i_uid = current->euid;
+       inode->i_uid = current->fsuid;
        inode->i_mode = mode;
        inode->i_op = NULL;
        if (S_ISREG(inode->i_mode))
@@ -630,9 +630,9 @@ repeat:
                schedule();
                goto repeat;
        }
-        if ((dir->i_mode & S_ISVTX) && !suser() &&
-            current->euid != inode->i_uid &&
-            current->euid != dir->i_uid)
+        if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+            current->fsuid != inode->i_uid &&
+            current->fsuid != dir->i_uid)
                goto end_rmdir;
        if (inode == dir)       /* we may not delete ".", but "../dir" is ok */
                goto end_rmdir;
@@ -711,9 +711,9 @@ repeat:
                schedule();
                goto repeat;
        }
-       if ((dir->i_mode & S_ISVTX) && !suser() &&
-           current->euid != inode->i_uid &&
-           current->euid != dir->i_uid)
+       if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+           current->fsuid != inode->i_uid &&
+           current->fsuid != dir->i_uid)
                goto end_unlink;
        if (!inode->i_nlink) {
                ext2_warning (inode->i_sb, "ext2_unlink",
@@ -946,8 +946,8 @@ start_up:
                goto end_rename;
        retval = -EPERM;
        if ((old_dir->i_mode & S_ISVTX) && 
-           current->euid != old_inode->i_uid &&
-           current->euid != old_dir->i_uid && !suser())
+           current->fsuid != old_inode->i_uid &&
+           current->fsuid != old_dir->i_uid && !fsuser())
                goto end_rename;
        new_bh = ext2_find_entry (new_dir, new_name, new_len, &new_de);
        if (new_bh) {
@@ -977,8 +977,8 @@ start_up:
        }
        retval = -EPERM;
        if (new_inode && (new_dir->i_mode & S_ISVTX) &&
-           current->euid != new_inode->i_uid &&
-           current->euid != new_dir->i_uid && !suser())
+           current->fsuid != new_inode->i_uid &&
+           current->fsuid != new_dir->i_uid && !fsuser())
                goto end_rename;
        if (S_ISDIR(old_inode->i_mode)) {
                retval = -ENOTDIR;
index 9f4e9abc8f1d07b73782af3401a074210e896e93..535318f498dde1932150ea87e2c24845bc8d63bd 100644 (file)
@@ -414,8 +414,8 @@ struct inode * get_pipe_inode(void)
        PIPE_LOCK(*inode) = 0;
        inode->i_pipe = 1;
        inode->i_mode |= S_IFIFO | S_IRUSR | S_IWUSR;
-       inode->i_uid = current->euid;
-       inode->i_gid = current->egid;
+       inode->i_uid = current->fsuid;
+       inode->i_gid = current->fsgid;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        return inode;
 }
index 1502e1bc06b57c98de8a99c7cfa6217a18d85bf7..53ff26cecb12c5aa0a13f19949fe8d9d4b94aac5 100644 (file)
@@ -213,8 +213,8 @@ struct inode * minix_new_inode(const struct inode * dir)
        inode->i_count = 1;
        inode->i_nlink = 1;
        inode->i_dev = sb->s_dev;
-       inode->i_uid = current->euid;
-       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+       inode->i_uid = current->fsuid;
+       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
        inode->i_dirt = 1;
        inode->i_ino = j;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
index fe2e7fb642694d76b55deaf50c44f8791f0df9ff..dcd32db29be9e6ca0d51ae87d6442c3ffab4f7e6 100644 (file)
@@ -265,7 +265,7 @@ int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rd
                iput(dir);
                return -ENOSPC;
        }
-       inode->i_uid = current->euid;
+       inode->i_uid = current->fsuid;
        inode->i_mode = mode;
        inode->i_op = NULL;
        if (S_ISREG(inode->i_mode))
@@ -443,9 +443,9 @@ int minix_rmdir(struct inode * dir, const char * name, int len)
        retval = -EPERM;
        if (!(inode = iget(dir->i_sb, de->inode)))
                goto end_rmdir;
-        if ((dir->i_mode & S_ISVTX) && !suser() &&
-            current->euid != inode->i_uid &&
-            current->euid != dir->i_uid)
+        if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+            current->fsuid != inode->i_uid &&
+            current->fsuid != dir->i_uid)
                goto end_rmdir;
        if (inode->i_dev != dir->i_dev)
                goto end_rmdir;
@@ -509,9 +509,9 @@ repeat:
                schedule();
                goto repeat;
        }
-       if ((dir->i_mode & S_ISVTX) && !suser() &&
-           current->euid != inode->i_uid &&
-           current->euid != dir->i_uid)
+       if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+           current->fsuid != inode->i_uid &&
+           current->fsuid != dir->i_uid)
                goto end_unlink;
        if (de->inode != inode->i_ino) {
                retval = -ENOENT;
@@ -700,8 +700,8 @@ start_up:
                goto end_rename;
        retval = -EPERM;
        if ((old_dir->i_mode & S_ISVTX) && 
-           current->euid != old_inode->i_uid &&
-           current->euid != old_dir->i_uid && !suser())
+           current->fsuid != old_inode->i_uid &&
+           current->fsuid != old_dir->i_uid && !fsuser())
                goto end_rename;
        new_bh = minix_find_entry(new_dir,new_name,new_len,&new_de);
        if (new_bh) {
@@ -731,8 +731,8 @@ start_up:
        }
        retval = -EPERM;
        if (new_inode && (new_dir->i_mode & S_ISVTX) && 
-           current->euid != new_inode->i_uid &&
-           current->euid != new_dir->i_uid && !suser())
+           current->fsuid != new_inode->i_uid &&
+           current->fsuid != new_dir->i_uid && !fsuser())
                goto end_rename;
        if (S_ISDIR(old_inode->i_mode)) {
                retval = -ENOTDIR;
index fc0f1732ae8b403711b8b1e5200f90a771fe9b12..9dc66a77a6279dd85a9914d11c3d5d20da87e7f2 100644 (file)
@@ -68,8 +68,9 @@ void putname(char * name)
  *     permission()
  *
  * is used to check for read/write/execute permissions on a file.
- * I don't know if we should look at just the euid or both euid and
- * uid, but that should be easily changed.
+ * We use "fsuid" for this, letting us set arbitrary permissions
+ * permissions for filesystem access without changing the "normal"
+ * uids which are used for other things..
  */
 int permission(struct inode * inode,int mask)
 {
@@ -77,11 +78,11 @@ int permission(struct inode * inode,int mask)
 
        if (inode->i_op && inode->i_op->permission)
                return inode->i_op->permission(inode, mask);
-       else if (current->euid == inode->i_uid)
+       else if (current->fsuid == inode->i_uid)
                mode >>= 6;
        else if (in_group_p(inode->i_gid))
                mode >>= 3;
-       if (((mode & mask & 0007) == mask) || suser())
+       if (((mode & mask & 0007) == mask) || fsuser())
                return 1;
        return 0;
 }
@@ -418,7 +419,7 @@ asmlinkage int sys_mknod(const char * filename, int mode, dev_t dev)
        int error;
        char * tmp;
 
-       if (S_ISDIR(mode) || (!S_ISFIFO(mode) && !suser()))
+       if (S_ISDIR(mode) || (!S_ISFIFO(mode) && !fsuser()))
                return -EPERM;
        switch (mode & S_IFMT) {
        case 0:
index c6335e76629216f86a8b43578a5746d732ae10b4..f49963aa210440df9b02041365f065a05cc2967e 100644 (file)
@@ -225,7 +225,7 @@ retry:
                PRINTK("NFS reply getattr\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -260,7 +260,7 @@ retry:
                PRINTK("NFS reply setattr\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -300,7 +300,7 @@ retry:
                PRINTK("NFS reply lookup\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -338,7 +338,7 @@ retry:
                        PRINTK("NFS reply readlink %s\n", res);
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -381,7 +381,7 @@ retry:
                        PRINTK("NFS reply read %d\n", len);
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -419,7 +419,7 @@ retry:
                PRINTK("NFS reply write\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -457,7 +457,7 @@ retry:
                PRINTK("NFS reply create\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -490,7 +490,7 @@ retry:
                PRINTK("NFS reply remove\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -527,7 +527,7 @@ retry:
                PRINTK("NFS reply rename\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -562,7 +562,7 @@ retry:
                PRINTK("NFS reply link\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -598,7 +598,7 @@ retry:
                PRINTK("NFS reply symlink\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -636,7 +636,7 @@ retry:
                PRINTK("NFS reply mkdir\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -669,7 +669,7 @@ retry:
                PRINTK("NFS reply rmdir\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -723,7 +723,7 @@ retry:
                }
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -757,7 +757,7 @@ retry:
                PRINTK("NFS reply statfs\n");
        }
        else {
-               if (!ruid && current->euid == 0 && current->uid != 0) {
+               if (!ruid && current->fsuid == 0 && current->uid != 0) {
                        ruid = 1;
                        goto retry;
                }
@@ -792,7 +792,7 @@ static int *nfs_rpc_header(int *p, int procedure, int ruid)
        p1 = p++;
        *p++ = htonl(CURRENT_TIME); /* traditional, could be anything */
        p = xdr_encode_string(p, (char *) sys);
-       *p++ = htonl(ruid ? current->uid : current->euid);
+       *p++ = htonl(ruid ? current->uid : current->fsuid);
        *p++ = htonl(current->egid);
        p2 = p++;
        for (i = 0; i < 16 && i < NGROUPS && current->groups[i] != NOGROUP; i++)
index 893af39a96d71f03a10dd93da27b4529d61600a5..227abce548e407e0894211840a5062aa7885b4f9 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -128,7 +128,7 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
                return -EROFS;
        }
        if (times) {
-               if ((current->euid != inode->i_uid) && !suser()) {
+               if ((current->fsuid != inode->i_uid) && !fsuser()) {
                        iput(inode);
                        return -EPERM;
                }
@@ -136,7 +136,7 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
                modtime = get_fs_long((unsigned long *) &times->modtime);
                inode->i_ctime = CURRENT_TIME;
        } else {
-               if ((current->euid != inode->i_uid) &&
+               if ((current->fsuid != inode->i_uid) &&
                    !permission(inode,MAY_WRITE)) {
                        iput(inode);
                        return -EACCES;
@@ -152,41 +152,30 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
 }
 
 /*
- * XXX we should use the real ids for checking _all_ components of the
- * path.  Now we only use them for the final component of the path.
+ * access() needs to use the real uid/gid, not the effective uid/gid.
+ * We do this by temporarily setting fsuid/fsgid to the wanted values
  */
-asmlinkage int sys_access(const char * filename,int mode)
+asmlinkage int sys_access(const char * filename, int mode)
 {
        struct inode * inode;
-       int res, i_mode;
+       int old_fsuid, old_fsgid;
+       int res;
 
        if (mode != (mode & S_IRWXO))   /* where's F_OK, X_OK, W_OK, R_OK? */
                return -EINVAL;
+       old_fsuid = current->fsuid;
+       old_fsgid = current->fsgid;
+       current->fsuid = current->uid;
+       current->fsgid = current->gid;
        res = namei(filename,&inode);
-       if (res)
-               return res;
-       i_mode = inode->i_mode;
-       res = i_mode & S_IRWXUGO;
-       if (current->uid == inode->i_uid)
-               res >>= 6;              /* needs cleaning? */
-       else if (in_group_p(inode->i_gid))
-               res >>= 3;              /* needs cleaning? */
-       iput(inode);
-       if ((res & mode) == mode)
-               return 0;
-       /*
-        * XXX we are doing this test last because we really should be
-        * swapping the effective with the real user id (temporarily),
-        * and then calling suser() routine.  If we do call the
-        * suser() routine, it needs to be called last. 
-        *
-        * XXX nope.  suser() is inappropriate and swapping the ids while
-        * decomposing the path would be racy.
-        */
-       if ((!current->uid) &&
-           (S_ISDIR(i_mode) || !(mode & S_IXOTH) || (i_mode & S_IXUGO)))
-               return 0;
-       return -EACCES;
+       if (!res) {
+               if (!permission(inode, mode))
+                       res = -EACCES;
+               iput(inode);
+       }
+       current->fsuid = old_fsuid;
+       current->fsgid = old_fsgid;
+       return res;
 }
 
 asmlinkage int sys_chdir(const char * filename)
@@ -241,7 +230,7 @@ asmlinkage int sys_chroot(const char * filename)
                iput(inode);
                return -ENOTDIR;
        }
-       if (!suser()) {
+       if (!fsuser()) {
                iput(inode);
                return -EPERM;
        }
@@ -259,14 +248,14 @@ asmlinkage int sys_fchmod(unsigned int fd, mode_t mode)
                return -EBADF;
        if (!(inode = file->f_inode))
                return -ENOENT;
-       if ((current->euid != inode->i_uid) && !suser())
+       if ((current->fsuid != inode->i_uid) && !fsuser())
                return -EPERM;
        if (IS_RDONLY(inode))
                return -EROFS;
        if (mode == (mode_t) -1)
                mode = inode->i_mode;
        inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
-       if (!suser() && !in_group_p(inode->i_gid))
+       if (!fsuser() && !in_group_p(inode->i_gid))
                inode->i_mode &= ~S_ISGID;
        inode->i_ctime = CURRENT_TIME;
        inode->i_dirt = 1;
@@ -281,7 +270,7 @@ asmlinkage int sys_chmod(const char * filename, mode_t mode)
        error = namei(filename,&inode);
        if (error)
                return error;
-       if ((current->euid != inode->i_uid) && !suser()) {
+       if ((current->fsuid != inode->i_uid) && !fsuser()) {
                iput(inode);
                return -EPERM;
        }
@@ -292,7 +281,7 @@ asmlinkage int sys_chmod(const char * filename, mode_t mode)
        if (mode == (mode_t) -1)
                mode = inode->i_mode;
        inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
-       if (!suser() && !in_group_p(inode->i_gid))
+       if (!fsuser() && !in_group_p(inode->i_gid))
                inode->i_mode &= ~S_ISGID;
        inode->i_ctime = CURRENT_TIME;
        inode->i_dirt = 1;
@@ -316,9 +305,9 @@ asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
                user = inode->i_uid;
        if (group == (gid_t) -1)
                group = inode->i_gid;
-       if ((current->euid == inode->i_uid && user == inode->i_uid &&
+       if ((current->fsuid == inode->i_uid && user == inode->i_uid &&
             (in_group_p(group) || group == inode->i_gid)) ||
-           suser()) {
+           fsuser()) {
                inode->i_uid = user;
                inode->i_gid = group;
                inode->i_ctime = CURRENT_TIME;
@@ -344,9 +333,9 @@ asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
                user = inode->i_uid;
        if (group == (gid_t) -1)
                group = inode->i_gid;
-       if ((current->euid == inode->i_uid && user == inode->i_uid &&
+       if ((current->fsuid == inode->i_uid && user == inode->i_uid &&
             (in_group_p(group) || group == inode->i_gid)) ||
-           suser()) {
+           fsuser()) {
                inode->i_uid = user;
                inode->i_gid = group;
                inode->i_ctime = CURRENT_TIME;
index b0e3894415663884c20b2b57fde1b7e7b05eeb7c..8fd5b4a4a00afe424f93c7d79f658ca028852e9e 100644 (file)
@@ -135,8 +135,8 @@ struct inode * sysv_new_inode(const struct inode * dir)
        inode->i_count = 1;
        inode->i_nlink = 1;
        inode->i_dev = sb->s_dev;
-       inode->i_uid = current->euid;
-       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+       inode->i_uid = current->fsuid;
+       inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
        inode->i_dirt = 1;
        inode->i_ino = ino;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
index 56d148bdab33569a8b47a684e5520be0e5424ee1..2bf21afdd8fd8f5efabfb4a377f5a7d54c9fb04c 100644 (file)
@@ -265,7 +265,7 @@ int sysv_mknod(struct inode * dir, const char * name, int len, int mode, int rde
                iput(dir);
                return -ENOSPC;
        }
-       inode->i_uid = current->euid;
+       inode->i_uid = current->fsuid;
        inode->i_mode = mode;
        inode->i_op = NULL;
        if (S_ISREG(inode->i_mode))
@@ -447,9 +447,9 @@ int sysv_rmdir(struct inode * dir, const char * name, int len)
        retval = -EPERM;
        if (!(inode = iget(dir->i_sb, de->inode)))
                goto end_rmdir;
-        if ((dir->i_mode & S_ISVTX) && !suser() &&
-            current->euid != inode->i_uid &&
-            current->euid != dir->i_uid)
+        if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+            current->fsuid != inode->i_uid &&
+            current->fsuid != dir->i_uid)
                goto end_rmdir;
        if (inode->i_dev != dir->i_dev)
                goto end_rmdir;
@@ -513,9 +513,9 @@ repeat:
                schedule();
                goto repeat;
        }
-       if ((dir->i_mode & S_ISVTX) && !suser() &&
-           current->euid != inode->i_uid &&
-           current->euid != dir->i_uid)
+       if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+           current->fsuid != inode->i_uid &&
+           current->fsuid != dir->i_uid)
                goto end_unlink;
        if (de->inode != inode->i_ino) {
                retval = -ENOENT;
@@ -708,8 +708,8 @@ start_up:
                goto end_rename;
        retval = -EPERM;
        if ((old_dir->i_mode & S_ISVTX) && 
-           current->euid != old_inode->i_uid &&
-           current->euid != old_dir->i_uid && !suser())
+           current->fsuid != old_inode->i_uid &&
+           current->fsuid != old_dir->i_uid && !fsuser())
                goto end_rename;
        new_bh = sysv_find_entry(new_dir,new_name,new_len,&new_de);
        if (new_bh) {
@@ -739,8 +739,8 @@ start_up:
        }
        retval = -EPERM;
        if (new_inode && (new_dir->i_mode & S_ISVTX) && 
-           current->euid != new_inode->i_uid &&
-           current->euid != new_dir->i_uid && !suser())
+           current->fsuid != new_inode->i_uid &&
+           current->fsuid != new_dir->i_uid && !fsuser())
                goto end_rename;
        if (S_ISDIR(old_inode->i_mode)) {
                retval = -ENOTDIR;
index 7cfac9efb89ac3f60ba4774c5e249bac94400ffa..3ec2ff6178bea886d070319e877bd5ee5caaca1d 100644 (file)
@@ -216,9 +216,9 @@ static int umsdos_create_any (
                        info.entry.mode = mode;
                        info.entry.rdev = rdev;
                        info.entry.flags = flags;
-                       info.entry.uid = current->euid;
+                       info.entry.uid = current->fsuid;
                        info.entry.gid = (dir->i_mode & S_ISGID)
-                               ? dir->i_gid : current->egid;
+                               ? dir->i_gid : current->fsgid;
                        info.entry.ctime = info.entry.atime = info.entry.mtime
                                = CURRENT_TIME;
                        info.entry.nlink = 1;
@@ -659,9 +659,9 @@ int UMSDOS_mkdir(
                if (ret == 0){
                        info.entry.mode = mode | S_IFDIR;
                        info.entry.rdev = 0;
-                       info.entry.uid = current->euid;
+                       info.entry.uid = current->fsuid;
                        info.entry.gid = (dir->i_mode & S_ISGID)
-                               ? dir->i_gid : current->egid;
+                               ? dir->i_gid : current->fsgid;
                        info.entry.ctime = info.entry.atime = info.entry.mtime
                                = CURRENT_TIME;
                        info.entry.flags = 0;
index d3735621f2ee7ee1a0d1fc5e16d99c5e842bb394..e91f63cd368277445670a476903c3cb67e4422bb 100644 (file)
@@ -329,8 +329,8 @@ struct inode * xiafs_new_inode(struct inode * dir)
     inode->i_count = 1;
     inode->i_nlink = 1;
     inode->i_dev = sb->s_dev;
-    inode->i_uid = current->euid;
-    inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+    inode->i_uid = current->fsuid;
+    inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
     inode->i_dirt = 1;
     inode->i_ino = tmp;
     inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
index 0cd7c0835b83a9ddebf06550b7a33465d92324c6..0532b17545f8c38ed8d40ea0da2383c202c6bf31 100644 (file)
@@ -294,7 +294,7 @@ int xiafs_mknod(struct inode *dir, const char *name, int len, int mode, int rdev
         iput(dir);
        return -ENOSPC;
     }
-    inode->i_uid = current->euid;
+    inode->i_uid = current->fsuid;
     inode->i_mode = mode;
     inode->i_op = NULL;
     if (S_ISREG(inode->i_mode))
@@ -496,9 +496,9 @@ int xiafs_rmdir(struct inode * dir, const char * name, int len)
     retval = -EPERM;
     if (!(inode = iget(dir->i_sb, de->d_ino)))
         goto end_rmdir;
-    if ((dir->i_mode & S_ISVTX) && !suser() &&
-            current->euid != inode->i_uid &&
-            current->euid != dir->i_uid)
+    if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+            current->fsuid != inode->i_uid &&
+            current->fsuid != dir->i_uid)
         goto end_rmdir;
     if (inode->i_dev != dir->i_dev)
         goto end_rmdir;
@@ -558,9 +558,9 @@ repeat:
        schedule();
        goto repeat;
     }
-    if ((dir->i_mode & S_ISVTX) && !suser() &&
-           current->euid != inode->i_uid &&
-           current->euid != dir->i_uid)
+    if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+           current->fsuid != inode->i_uid &&
+           current->fsuid != dir->i_uid)
         goto end_unlink;
     if (!inode->i_nlink) {
         printk("XIA-FS: Deleting nonexistent file (%s %d)\n", WHERE_ERR);
@@ -730,8 +730,8 @@ try_again:
         goto end_rename;
     retval = -EPERM;
     if ((old_dir->i_mode & S_ISVTX) && 
-           current->euid != old_inode->i_uid &&
-           current->euid != old_dir->i_uid && !suser())
+           current->fsuid != old_inode->i_uid &&
+           current->fsuid != old_dir->i_uid && !fsuser())
         goto end_rename;
     new_bh = xiafs_find_entry(new_dir, new_name, new_len, &new_de, NULL);
     if (new_bh) {
@@ -751,8 +751,8 @@ try_again:
     }
     retval = -EPERM;
     if (new_inode && (new_dir->i_mode & S_ISVTX) && 
-           current->euid != new_inode->i_uid &&
-           current->euid != new_dir->i_uid && !suser())
+           current->fsuid != new_inode->i_uid &&
+           current->fsuid != new_dir->i_uid && !fsuser())
         goto end_rename;
     if (S_ISDIR(old_inode->i_mode)) {
         retval = -EEXIST;
index 76dfe64016822f9fa9ba4ad195599600d7ad9164..f5f98123490405cee612240fa40354eafd3001bb 100644 (file)
@@ -149,7 +149,7 @@ static inline void __constant_memcpy_fromfs(void * to, const void * from, unsign
                        return;
                case 3:
                        *(short *) to = get_user_word((const short *) from);
-                       *(char *) to = get_user_byte(2+(const char *) from);
+                       *((char *) to + 2) = get_user_byte(2+(const char *) from);
                        return;
                case 4:
                        *(int *) to = get_user_long((const int *) from);
index e64cb78eff721333060a933cf3a2a538529a45ad..f4d1d496313800ee7f179aa228deecc87269c19c 100644 (file)
@@ -60,8 +60,13 @@ asmlinkage int printk(const char * fmt, ...)
  * BSD-style accounting where the process is flagged if it uses root
  * privs).  The implication of this is that you should do normal
  * permissions checks first, and check suser() last.
+ *
+ * "suser()" checks against the effective user id, while "fsuser()"
+ * is used for file permission checking and checks against the fsuid..
  */
 #define suser() (current->euid == 0)
+#define fsuser() (current->fsuid == 0)
+
 extern int splx (int new_ipl);
 #endif /* __KERNEL__ */
 
index 8a703211546e517d79e52bddd71c934873c8b0b0..d565d506ca7267d6e125b37ce41b4e837b3a864e 100644 (file)
@@ -270,8 +270,8 @@ struct task_struct {
         */
        struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
        struct wait_queue *wait_chldexit;       /* for wait4() */
-       unsigned short uid,euid,suid;
-       unsigned short gid,egid,sgid;
+       unsigned short uid,euid,suid,fsuid;
+       unsigned short gid,egid,sgid,fsgid;
        unsigned long timeout;
        unsigned long it_real_value, it_prof_value, it_virt_value;
        unsigned long it_real_incr, it_prof_incr, it_virt_incr;
@@ -332,7 +332,7 @@ struct task_struct {
 /* pid etc.. */        0,0,0,0, \
 /* suppl grps*/ {NOGROUP,}, \
 /* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \
-/* uid etc */  0,0,0,0,0,0, \
+/* uid etc */  0,0,0,0,0,0,0,0, \
 /* timeout */  0,0,0,0,0,0,0,0,0,0,0,0, \
 /* rlimits */   { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX},  \
                  {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX},  \
index e1256bb464c2eba64e143ec8e1f8083204edc931..fca7ba7cdc78c1bb18e072dfdcd50de26bc8fdca 100644 (file)
@@ -46,7 +46,7 @@ struct sk_buff {
   volatile unsigned long       when;   /* used to compute rtt's        */
   struct timeval               stamp;
   struct device                        *dev;
-  void                         *mem_addr;
+  struct sk_buff               *mem_addr;
   union {
        struct tcphdr   *th;
        struct ethhdr   *eth;
index 6eeb71a7105a845fcb8d9031dc6fd535f468bc1e..f493bb0f29a3ade86628a64ea91c56439d10be5d 100644 (file)
 extern "C" {
 #endif
 
+#ifdef i386
+
 #include <asm/string.h>                /* inline functions for i386.. */
 
+#else
+
 extern char * strcpy(char *, const char *);
 extern char * strncpy(char *, const char *, size_t);
 extern char * strcat(char *, const char *);
@@ -33,6 +37,8 @@ extern int memcmp(const void *, const void *, size_t);
 extern void * memchr(const void *, char, size_t);
 extern void * memset(void *, char, size_t);
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index c17a1aed54dbde4b31ebb6da480f510c3f616f0d..c2ab1293475456ae5c2300a005f293f443fddb43 100644 (file)
 #define __NR_sysfs             135
 #define __NR_personality       136
 #define __NR_afs_syscall       137 /* Syscall for Andrew File System */
+#define __NR_setfsuid          138
+#define __NR_setfsgid          139
 
 extern int errno;
 
index e9c6a85836db0e1cb858c8723d33d83627201c9a..f76f5b98f7961bc8d49460cc1c5e470e22473c54 100644 (file)
@@ -233,6 +233,7 @@ asmlinkage int sys_setregid(gid_t rgid, gid_t egid)
        if (rgid != (gid_t) -1 ||
            (egid != (gid_t) -1 && egid != old_rgid))
                current->sgid = current->egid;
+       current->fsgid = current->egid;
        return 0;
 }
 
@@ -242,9 +243,9 @@ asmlinkage int sys_setregid(gid_t rgid, gid_t egid)
 asmlinkage int sys_setgid(gid_t gid)
 {
        if (suser())
-               current->gid = current->egid = current->sgid = gid;
+               current->gid = current->egid = current->sgid = current->fsgid = gid;
        else if ((gid == current->gid) || (gid == current->sgid))
-               current->egid = gid;
+               current->egid = current->fsgid = gid;
        else
                return -EPERM;
        return 0;
@@ -321,6 +322,7 @@ asmlinkage int sys_setreuid(uid_t ruid, uid_t euid)
        if (ruid != (uid_t) -1 ||
            (euid != (uid_t) -1 && euid != old_ruid))
                current->suid = current->euid;
+       current->fsuid = euid;
        return 0;
 }
 
@@ -338,14 +340,43 @@ asmlinkage int sys_setreuid(uid_t ruid, uid_t euid)
 asmlinkage int sys_setuid(uid_t uid)
 {
        if (suser())
-               current->uid = current->euid = current->suid = uid;
+               current->uid = current->euid = current->suid = current->fsuid = uid;
        else if ((uid == current->uid) || (uid == current->suid))
-               current->euid = uid;
+               current->fsuid = current->euid = uid;
        else
                return -EPERM;
        return(0);
 }
 
+/*
+ * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
+ * is used for "access()" and for the NFS deamon (letting nfsd stay at
+ * whatever uid it wants to). It normally shadows "euid", except when
+ * explicitly set by setfsuid() or for access..
+ */
+asmlinkage int sys_setfsuid(uid_t uid)
+{
+       int old_fsuid = current->fsuid;
+
+       if (uid == current->uid || uid == current->euid ||
+           uid == current->suid || uid == current->fsuid || suser())
+               current->fsuid = uid;
+       return old_fsuid;
+}
+
+/*
+ * Samma på svenska..
+ */
+asmlinkage int sys_setfsgid(gid_t gid)
+{
+       int old_fsgid = current->fsgid;
+
+       if (gid == current->gid || gid == current->egid ||
+           gid == current->sgid || gid == current->fsgid || suser())
+               current->fsgid = gid;
+       return old_fsgid;
+}
+
 asmlinkage int sys_times(struct tms * tbuf)
 {
        if (tbuf) {
@@ -542,7 +573,7 @@ int in_group_p(gid_t grp)
 {
        int     i;
 
-       if (grp == current->egid)
+       if (grp == current->fsgid)
                return 1;
 
        for (i = 0; i < NGROUPS; i++) {
index 587ccd4af74179958542ae365a7aa38b204e879c..ae1102c4ed67c9f8cd06d33bcd0624301016f534 100644 (file)
@@ -538,5 +538,7 @@ _sys_call_table:
        .long _sys_sysfs                /* 135 */
        .long _sys_personality
        .long 0                         /* for afs_syscall */
+       .long _sys_setfsuid
+       .long _sys_setfsgid
 
        .space (NR_syscalls-137)*4
index 3a4005b9faad4bfbd4595e18a326265446b0e051..605eb33706b5dacdd5e7d4fb487edefb55ab7844 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -121,7 +121,8 @@ int do_mmap(struct file * file, unsigned long addr, unsigned long len,
                else
                        mask |= PAGE_SHARED;
 
-       vma = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+       vma = (struct vm_area_struct *)kmalloc(sizeof(struct vm_area_struct),
+               GFP_KERNEL);
        if (!vma)
                return -ENOMEM;
 
index 472a799adabbb0b08538d4b1e15d2b602064c82e..b539c41f0610b56827edf94542445f15eda3a422 100644 (file)
@@ -63,20 +63,20 @@ static inline int mprotect_fixup_start(struct vm_area_struct * vma,
        unsigned long end,
        int newflags, int prot)
 {
-       struct vm_area_struct * new;
+       struct vm_area_struct * n;
 
-       new = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
-       if (!new)
+       n = (struct vm_area_struct *) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+       if (!n)
                return -ENOMEM;
-       *new = *vma;
+       *n = *vma;
        vma->vm_start = end;
-       new->vm_end = end;
-       vma->vm_offset += vma->vm_start - new->vm_start;
-       new->vm_flags = newflags;
-       new->vm_page_prot = prot;
-       if (new->vm_inode)
-               new->vm_inode->i_count++;
-       insert_vm_struct(current, new);
+       n->vm_end = end;
+       vma->vm_offset += vma->vm_start - n->vm_start;
+       n->vm_flags = newflags;
+       n->vm_page_prot = prot;
+       if (n->vm_inode)
+               n->vm_inode->i_count++;
+       insert_vm_struct(current, n);
        merge_segments(current->mm->mmap);
        return 0;
 }
@@ -85,20 +85,20 @@ static inline int mprotect_fixup_end(struct vm_area_struct * vma,
        unsigned long start,
        int newflags, int prot)
 {
-       struct vm_area_struct * new;
+       struct vm_area_struct * n;
 
-       new = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
-       if (!new)
+       n = (struct vm_area_struct *) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+       if (!n)
                return -ENOMEM;
-       *new = *vma;
+       *n = *vma;
        vma->vm_end = start;
-       new->vm_start = start;
-       new->vm_offset += new->vm_start - vma->vm_start;
-       new->vm_flags = newflags;
-       new->vm_page_prot = prot;
-       if (new->vm_inode)
-               new->vm_inode->i_count++;
-       insert_vm_struct(current, new);
+       n->vm_start = start;
+       n->vm_offset += n->vm_start - vma->vm_start;
+       n->vm_flags = newflags;
+       n->vm_page_prot = prot;
+       if (n->vm_inode)
+               n->vm_inode->i_count++;
+       insert_vm_struct(current, n);
        merge_segments(current->mm->mmap);
        return 0;
 }
index cd7ca1ef6affaccb3bd0f8960b1d2bd90f60b06e..550e0f8f0cc269d76975980effda8206b9444726 100644 (file)
@@ -166,7 +166,7 @@ int eth_rebuild_header(void *buff, struct device *dev, unsigned long dst,
 unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
 {
        struct ethhdr *eth = (struct ethhdr *) skb->data;
-       char *rawp;
+       unsigned char *rawp;
        
        if(*eth->h_dest&1)
        {