2.5.43 futex, error in error path

2.5.43 futex, error in error path

Post by Peter W?chtle » Fri, 18 Oct 2002 19:00:15



There's an error when the f_setown() call fails.
Not the FD but the return code of f_setown() is free'ed. Oops.
I fixed that by renaming the outer variable "ret" to "fd" - of
course you could rename the inner one to rc or similar.

--- futex.c.orig        2002-10-17 17:29:39.000000000 +0200

        struct page *page = NULL;
        struct futex_q *q;
        struct file *filp;
-       int ret;
+       int fd;

-       ret = -EINVAL;
+       fd = -EINVAL;
        if (signal < 0 || signal > _NSIG)
                goto out;

-       ret = get_unused_fd();
-       if (ret < 0)
+       fd = get_unused_fd();
+       if (fd < 0)
                goto out;
        filp = get_empty_filp();
        if (!filp) {
-               put_unused_fd(ret);
-               ret = -ENFILE;
+               put_unused_fd(fd);
+               fd = -ENFILE;
                goto out;
        }

                ret = f_setown(filp, current->tgid, 1);
                if (ret) {
-                       put_unused_fd(ret);
+                       put_unused_fd(fd);
                        put_filp(filp);
                        goto out;

        q = kmalloc(sizeof(*q), GFP_KERNEL);
        if (!q) {
-               put_unused_fd(ret);
+               put_unused_fd(fd);
                put_filp(filp);
-               ret = -ENOMEM;
+               fd = -ENOMEM;
                goto out;
        }

        if (!page) {
                unlock_futex_mm();

-               put_unused_fd(ret);
+               put_unused_fd(fd);
                put_filp(filp);
                kfree(q);

        init_waitqueue_head(&q->waiters);
        filp->private_data = q;

-       __queue_me(q, page, uaddr, offset, ret, filp);
+       __queue_me(q, page, uaddr, offset, fd, filp);

        unlock_futex_mm();

        /* Now we map fd to filp, so userspace can access it */
-       fd_install(ret, filp);
+       fd_install(fd, filp);
        page = NULL;
 out:
        if (page)
                unpin_page(page);
-       return ret;
+       return fd;
 }

 asmlinkage int sys_futex(unsigned long uaddr, int op, int val, struct timespec *utime)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. i2c-elektor (2.5.43) non-fatal error: unresolved symbol cli, sti

I didn't see this, so I'm reporting it:
make -f arch/i386/lib/Makefile modules_install
if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.5.43; fi
depmod: *** Unresolved symbols in /lib/modules/2.5.43/kernel/drivers/i2c/i2c-elektor.o
depmod:         cli
depmod:         sti

Looks like a problem in the i2c-elektor driver.

-Joseph
--

"Alt text doesn't pop up unless you use an ancient browser from the days of
 yore. The relevant standards clearly indicate that it should not, and I
 only know about one browser released in the last two years that violates
 this, and it's still claiming compatibility with Mozilla 4 (which was
 obsolete quite long ago), so it really can't be considered a modern
 browser."  --jonadab, in a slashdot.org comment.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. nmh can't send without ppp connection

3. 2.5.43 : net/ipv4/ip_forward.c compile error

4. Best way to enable SSI with MAX of security

5. XFS build error on m68k in 2.5.43

6. pstrerror problem

7. 2.5.43 : drivers/ieee1394/sbp2.c compile error

8. [PATCH] 2.5.46: access permission filesystem 0.11

9. Problems in the sk98lin driver (2.5.43)

10. 2.5.43-menuconfig

11. 2.5.43 oops in adaptec driver

12. LSM changes for 2.5.43

13. 2.5.43-mm1 Oops (nfs)