From: J. Bruce Fields Date: Mon, 16 Mar 2009 22:34:20 +0000 (-0400) Subject: nfsd: nfsd should drop CAP_MKNOD for non-root X-Git-Tag: v2.6.27.21~29 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f2b10ab15c8d062ccbfd1913a8261bc475a2fb59;p=karo-tx-linux.git nfsd: nfsd should drop CAP_MKNOD for non-root commit 76a67ec6fb79ff3570dcb5342142c16098299911 upstream. Since creating a device node is normally an operation requiring special privilege, Igor Zhbanov points out that it is surprising (to say the least) that a client can, for example, create a device node on a filesystem exported with root_squash. So, make sure CAP_MKNOD is among the capabilities dropped when an nfsd thread handles a request from a non-root user. Reported-by: Igor Zhbanov Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/capability.h b/include/linux/capability.h index 9d1fe30b6f6c..28863f4cc3d6 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -382,8 +382,10 @@ typedef struct kernel_cap_struct { # define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) # define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }}) # define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } }) -# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ - CAP_FS_MASK_B1 } }) +# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ + | CAP_TO_MASK(CAP_SYS_RESOURCE) \ + | CAP_TO_MASK(CAP_MKNOD), \ + CAP_FS_MASK_B1 } }) #endif /* _KERNEL_CAPABILITY_U32S != 2 */