From: Eric Sandeen <sandeen@redhat.com> Date: Tue, 29 Jul 2008 16:46:23 -0500 Subject: [fs] ecryptfs: discard ecryptfsd registration messages Message-id: 488F8FAF.30000@redhat.com O-Subject: [RHEL5.3 PATCH 2/5] ecryptfs: discard ecryptfsd registration messages in miscdev Bugzilla: 457143 RH-Acked-by: Jarod Wilson <jwilson@redhat.com> Addresses [Bug 457143] RHEL5.3: misc ecryptfs fixes from 2.6.27 From: Tyler Hicks <tyhicks@linux.vnet.ibm.com> Date: Thu, 24 Jul 2008 04:30:04 +0000 (-0700) Subject: ecryptfs: discard ecryptfsd registration messages in miscdev X-Git-Tag: v2.6.27-rc1~649 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=6c4c17b073cd4a5a61bc04329561632870bb21fc ecryptfs: discard ecryptfsd registration messages in miscdev The userspace eCryptfs daemon sends HELO and QUIT messages to the kernel for per-user daemon (un)registration. These messages are required when netlink is used as the transport, but (un)registration is handled by opening and closing the device file when miscdev is the transport. These messages should be discarded in the miscdev transport so that a daemon isn't registered twice. Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 41938af..3bdce69 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c @@ -352,41 +352,6 @@ out_unlock_daemon: } /** - * ecryptfs_miscdev_helo - * @euid: effective user id of miscdevess sending helo packet - * @pid: miscdevess id of miscdevess sending helo packet - * - * Returns zero on success; non-zero otherwise - */ -static int ecryptfs_miscdev_helo(uid_t uid, pid_t pid) -{ - int rc; - - rc = ecryptfs_process_helo(ECRYPTFS_TRANSPORT_MISCDEV, uid, pid); - if (rc) - printk(KERN_WARNING "Error processing HELO; rc = [%d]\n", rc); - return rc; -} - -/** - * ecryptfs_miscdev_quit - * @euid: effective user id of miscdevess sending quit packet - * @pid: miscdevess id of miscdevess sending quit packet - * - * Returns zero on success; non-zero otherwise - */ -static int ecryptfs_miscdev_quit(uid_t euid, pid_t pid) -{ - int rc; - - rc = ecryptfs_process_quit(euid, pid); - if (rc) - printk(KERN_WARNING - "Error processing QUIT message; rc = [%d]\n", rc); - return rc; -} - -/** * ecryptfs_miscdev_response - miscdevess response to message previously sent to daemon * @data: Bytes comprising struct ecryptfs_message * @data_size: sizeof(struct ecryptfs_message) + data len @@ -498,22 +463,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, __func__, rc); break; case ECRYPTFS_MSG_HELO: - rc = ecryptfs_miscdev_helo(current->euid, current->pid); - if (rc) { - printk(KERN_ERR "%s: Error attempting to process " - "helo from pid [%d]; rc = [%d]\n", __func__, - current->pid, rc); - goto out_free; - } - break; case ECRYPTFS_MSG_QUIT: - rc = ecryptfs_miscdev_quit(current->euid, current->pid); - if (rc) { - printk(KERN_ERR "%s: Error attempting to process " - "quit from pid [%d]; rc = [%d]\n", __func__, - current->pid, rc); - goto out_free; - } break; default: ecryptfs_printk(KERN_WARNING, "Dropping miscdev "