From: Andreas Schwab Date: Tue, 8 May 2007 07:31:38 +0000 (-0700) Subject: Fix error handling in HDIO_GETGEO compat wrapper X-Git-Tag: v2.6.22-rc1~610 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83ae1b79c898838e16ac8cde69b39d22d36fb035;p=linux-2.6 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 6972d242fb..d92bc3eb7a 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)