From: Peter Staubach Date: Sat, 25 Mar 2006 11:08:04 +0000 (-0800) Subject: [PATCH] compat_sys_nfsservctl(): handle errors correctly X-Git-Tag: v2.6.17-rc1~770 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57070d012cd425c3a71663528c56a436abd2d9da;p=linux-2.6 [PATCH] compat_sys_nfsservctl(): handle errors correctly Correct some error handling on the compat version of the nfsservctl() system. It was detecting errors while copying in the arguments from user space, but then attempting to use the arguments anyway. This didn't seem so good. Signed-off-by: Peter Staubach Cc: Trond Myklebust Cc: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/compat.c b/fs/compat.c index 2a88477330..263990ae40 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -2170,9 +2170,12 @@ asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user * default: err = -EINVAL; - goto done; + break; } + if (err) + goto done; + oldfs = get_fs(); set_fs(KERNEL_DS); /* The __user pointer casts are valid because of the set_fs() */