diff options
author | Steve French <sfrench@us.ibm.com> | 2006-01-17 22:49:59 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-01-17 22:49:59 -0500 |
commit | d65177c1ae7f085723154105c5dc8d9e16ae8265 (patch) | |
tree | 14408129d880d89cc5e937f2810f243ed1e6fcde /ipc | |
parent | d41f084a74de860fe879403fbbad13abdf7aea8e (diff) | |
parent | 15578eeb6cd4b74492f26e60624aa1a9a52ddd7b (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mqueue.c | 59 | ||||
-rw-r--r-- | ipc/msg.c | 2 | ||||
-rw-r--r-- | ipc/sem.c | 2 | ||||
-rw-r--r-- | ipc/util.c | 2 | ||||
-rw-r--r-- | ipc/util.h | 2 |
5 files changed, 37 insertions, 30 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 4e776f9c80e7..59302fc3643b 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -599,15 +599,16 @@ static int mq_attr_ok(struct mq_attr *attr) | |||
599 | static struct file *do_create(struct dentry *dir, struct dentry *dentry, | 599 | static struct file *do_create(struct dentry *dir, struct dentry *dentry, |
600 | int oflag, mode_t mode, struct mq_attr __user *u_attr) | 600 | int oflag, mode_t mode, struct mq_attr __user *u_attr) |
601 | { | 601 | { |
602 | struct file *filp; | ||
603 | struct mq_attr attr; | 602 | struct mq_attr attr; |
604 | int ret; | 603 | int ret; |
605 | 604 | ||
606 | if (u_attr != NULL) { | 605 | if (u_attr) { |
606 | ret = -EFAULT; | ||
607 | if (copy_from_user(&attr, u_attr, sizeof(attr))) | 607 | if (copy_from_user(&attr, u_attr, sizeof(attr))) |
608 | return ERR_PTR(-EFAULT); | 608 | goto out; |
609 | ret = -EINVAL; | ||
609 | if (!mq_attr_ok(&attr)) | 610 | if (!mq_attr_ok(&attr)) |
610 | return ERR_PTR(-EINVAL); | 611 | goto out; |
611 | /* store for use during create */ | 612 | /* store for use during create */ |
612 | dentry->d_fsdata = &attr; | 613 | dentry->d_fsdata = &attr; |
613 | } | 614 | } |
@@ -616,13 +617,14 @@ static struct file *do_create(struct dentry *dir, struct dentry *dentry, | |||
616 | ret = vfs_create(dir->d_inode, dentry, mode, NULL); | 617 | ret = vfs_create(dir->d_inode, dentry, mode, NULL); |
617 | dentry->d_fsdata = NULL; | 618 | dentry->d_fsdata = NULL; |
618 | if (ret) | 619 | if (ret) |
619 | return ERR_PTR(ret); | 620 | goto out; |
620 | 621 | ||
621 | filp = dentry_open(dentry, mqueue_mnt, oflag); | 622 | return dentry_open(dentry, mqueue_mnt, oflag); |
622 | if (!IS_ERR(filp)) | ||
623 | dget(dentry); | ||
624 | 623 | ||
625 | return filp; | 624 | out: |
625 | dput(dentry); | ||
626 | mntput(mqueue_mnt); | ||
627 | return ERR_PTR(ret); | ||
626 | } | 628 | } |
627 | 629 | ||
628 | /* Opens existing queue */ | 630 | /* Opens existing queue */ |
@@ -630,20 +632,20 @@ static struct file *do_open(struct dentry *dentry, int oflag) | |||
630 | { | 632 | { |
631 | static int oflag2acc[O_ACCMODE] = { MAY_READ, MAY_WRITE, | 633 | static int oflag2acc[O_ACCMODE] = { MAY_READ, MAY_WRITE, |
632 | MAY_READ | MAY_WRITE }; | 634 | MAY_READ | MAY_WRITE }; |
633 | struct file *filp; | ||
634 | 635 | ||
635 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) | 636 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) { |
637 | dput(dentry); | ||
638 | mntput(mqueue_mnt); | ||
636 | return ERR_PTR(-EINVAL); | 639 | return ERR_PTR(-EINVAL); |
640 | } | ||
637 | 641 | ||
638 | if (permission(dentry->d_inode, oflag2acc[oflag & O_ACCMODE], NULL)) | 642 | if (permission(dentry->d_inode, oflag2acc[oflag & O_ACCMODE], NULL)) { |
643 | dput(dentry); | ||
644 | mntput(mqueue_mnt); | ||
639 | return ERR_PTR(-EACCES); | 645 | return ERR_PTR(-EACCES); |
646 | } | ||
640 | 647 | ||
641 | filp = dentry_open(dentry, mqueue_mnt, oflag); | 648 | return dentry_open(dentry, mqueue_mnt, oflag); |
642 | |||
643 | if (!IS_ERR(filp)) | ||
644 | dget(dentry); | ||
645 | |||
646 | return filp; | ||
647 | } | 649 | } |
648 | 650 | ||
649 | asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, | 651 | asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, |
@@ -671,17 +673,20 @@ asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, | |||
671 | 673 | ||
672 | if (oflag & O_CREAT) { | 674 | if (oflag & O_CREAT) { |
673 | if (dentry->d_inode) { /* entry already exists */ | 675 | if (dentry->d_inode) { /* entry already exists */ |
674 | filp = (oflag & O_EXCL) ? ERR_PTR(-EEXIST) : | 676 | error = -EEXIST; |
675 | do_open(dentry, oflag); | 677 | if (oflag & O_EXCL) |
678 | goto out; | ||
679 | filp = do_open(dentry, oflag); | ||
676 | } else { | 680 | } else { |
677 | filp = do_create(mqueue_mnt->mnt_root, dentry, | 681 | filp = do_create(mqueue_mnt->mnt_root, dentry, |
678 | oflag, mode, u_attr); | 682 | oflag, mode, u_attr); |
679 | } | 683 | } |
680 | } else | 684 | } else { |
681 | filp = (dentry->d_inode) ? do_open(dentry, oflag) : | 685 | error = -ENOENT; |
682 | ERR_PTR(-ENOENT); | 686 | if (!dentry->d_inode) |
683 | 687 | goto out; | |
684 | dput(dentry); | 688 | filp = do_open(dentry, oflag); |
689 | } | ||
685 | 690 | ||
686 | if (IS_ERR(filp)) { | 691 | if (IS_ERR(filp)) { |
687 | error = PTR_ERR(filp); | 692 | error = PTR_ERR(filp); |
@@ -692,8 +697,10 @@ asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, | |||
692 | fd_install(fd, filp); | 697 | fd_install(fd, filp); |
693 | goto out_upsem; | 698 | goto out_upsem; |
694 | 699 | ||
695 | out_putfd: | 700 | out: |
701 | dput(dentry); | ||
696 | mntput(mqueue_mnt); | 702 | mntput(mqueue_mnt); |
703 | out_putfd: | ||
697 | put_unused_fd(fd); | 704 | put_unused_fd(fd); |
698 | out_err: | 705 | out_err: |
699 | fd = error; | 706 | fd = error; |
@@ -12,7 +12,7 @@ | |||
12 | * | 12 | * |
13 | * mostly rewritten, threaded and wake-one semantics added | 13 | * mostly rewritten, threaded and wake-one semantics added |
14 | * MSGMAX limit removed, sysctl's added | 14 | * MSGMAX limit removed, sysctl's added |
15 | * (c) 1999 Manfred Spraul <manfreds@colorfullife.com> | 15 | * (c) 1999 Manfred Spraul <manfred@colorfullife.com> |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/capability.h> | 18 | #include <linux/capability.h> |
@@ -56,7 +56,7 @@ | |||
56 | * /proc/sysvipc/sem support (c) 1999 Dragos Acostachioaie <dragos@iname.com> | 56 | * /proc/sysvipc/sem support (c) 1999 Dragos Acostachioaie <dragos@iname.com> |
57 | * | 57 | * |
58 | * SMP-threaded, sysctl's added | 58 | * SMP-threaded, sysctl's added |
59 | * (c) 1999 Manfred Spraul <manfreds@colorfullife.com> | 59 | * (c) 1999 Manfred Spraul <manfred@colorfullife.com> |
60 | * Enforced range limit on SEM_UNDO | 60 | * Enforced range limit on SEM_UNDO |
61 | * (c) 2001 Red Hat Inc <alan@redhat.com> | 61 | * (c) 2001 Red Hat Inc <alan@redhat.com> |
62 | * Lockless wakeup | 62 | * Lockless wakeup |
diff --git a/ipc/util.c b/ipc/util.c index 38b9a0af3bd8..862621980b01 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Occurs in several places in the IPC code. | 7 | * Occurs in several places in the IPC code. |
8 | * Chris Evans, <chris@ferret.lmh.ox.ac.uk> | 8 | * Chris Evans, <chris@ferret.lmh.ox.ac.uk> |
9 | * Nov 1999 - ipc helper functions, unified SMP locking | 9 | * Nov 1999 - ipc helper functions, unified SMP locking |
10 | * Manfred Spraul <manfreds@colorfullife.com> | 10 | * Manfred Spraul <manfred@colorfullife.com> |
11 | * Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary(). | 11 | * Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary(). |
12 | * Mingming Cao <cmm@us.ibm.com> | 12 | * Mingming Cao <cmm@us.ibm.com> |
13 | */ | 13 | */ |
diff --git a/ipc/util.h b/ipc/util.h index fc9a28be0797..efaff3ee7de7 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * linux/ipc/util.h | 2 | * linux/ipc/util.h |
3 | * Copyright (C) 1999 Christoph Rohland | 3 | * Copyright (C) 1999 Christoph Rohland |
4 | * | 4 | * |
5 | * ipc helper functions (c) 1999 Manfred Spraul <manfreds@colorfullife.com> | 5 | * ipc helper functions (c) 1999 Manfred Spraul <manfred@colorfullife.com> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef _IPC_UTIL_H | 8 | #ifndef _IPC_UTIL_H |