From: Andreas Schwab Date: Tue, 8 May 2007 07:31:38 +0000 (-0700) Subject: Fix error handling in HDIO_GETGEO compat wrapper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=83ae1b79c898838e16ac8cde69b39d22d36fb035;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Fix error handling in HDIO_GETGEO compat wrapper Don't clobber error from sys_ioctl in HDIO_GETGEO compat wrapper. Signed-off-by: Andreas Schwab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6972d242fbdf..d92bc3eb7afc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -684,8 +684,10 @@ static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg) if (!err) { err = copy_to_user (ugeo, &geo, 4); err |= __put_user (geo.start, &ugeo->start); + if (err) + err = -EFAULT; } - return err ? -EFAULT : 0; + return err; } static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)