From 8f469e0270dcc4ae1cee5ad4d209bd7276a9326b Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 10 Nov 2003 02:39:41 +0000 Subject: [PATCH] b=2005 r=Peter Add a check for current->fsuid == 0, to protect portals device from non-root usage. --- lnet/libcfs/module.c | 3 +++ lustre/portals/libcfs/module.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lnet/libcfs/module.c b/lnet/libcfs/module.c index 10e4060..05cc589 100644 --- a/lnet/libcfs/module.c +++ b/lnet/libcfs/module.c @@ -413,6 +413,9 @@ static int kportal_ioctl(struct inode *inode, struct file *file, ENTRY; + if (current->fsuid != 0) + RETURN(err = -EACCES); + if ( _IOC_TYPE(cmd) != IOC_PORTAL_TYPE || _IOC_NR(cmd) < IOC_PORTAL_MIN_NR || _IOC_NR(cmd) > IOC_PORTAL_MAX_NR ) { diff --git a/lustre/portals/libcfs/module.c b/lustre/portals/libcfs/module.c index 10e4060..05cc589 100644 --- a/lustre/portals/libcfs/module.c +++ b/lustre/portals/libcfs/module.c @@ -413,6 +413,9 @@ static int kportal_ioctl(struct inode *inode, struct file *file, ENTRY; + if (current->fsuid != 0) + RETURN(err = -EACCES); + if ( _IOC_TYPE(cmd) != IOC_PORTAL_TYPE || _IOC_NR(cmd) < IOC_PORTAL_MIN_NR || _IOC_NR(cmd) > IOC_PORTAL_MAX_NR ) { -- 1.8.3.1