From 83ae1b79c898838e16ac8cde69b39d22d36fb035 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 8 May 2007 00:31:38 -0700 Subject: 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 --- fs/compat_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/compat_ioctl.c') diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6972d242fbd..d92bc3eb7af 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) -- cgit v1.2.3-18-g5258