[patch 9/9] compat_ioctl: fix compat_fd_ioctl pointer access

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jens Axboe <jens.axboe@...>
Cc: <linux-kernel@...>, <davem@...>, <hch@...>, Al Viro <viro@...>
Date: Saturday, October 6, 2007 - 2:19 pm

As found by sparse, a user space pointer is assigned to a kernel
data structure while calling other code with set_fs(KERNEL_DS),
which could lead to leaking kernel data if that pointer is
ever accessed.

I could not find any place in the floppy drivers that actually
uses that pointer, but assigning it to an empty string is
a safer choice and gets rid of the sparse warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Index: linux-2.6/block/compat_ioctl.c
===================================================================
--- linux-2.6.orig/block/compat_ioctl.c
+++ linux-2.6/block/compat_ioctl.c
@@ -349,7 +349,7 @@ static int compat_fd_ioctl(struct inode 
 		err |= __get_user(f->spec1, &uf->spec1);
 		err |= __get_user(f->fmt_gap, &uf->fmt_gap);
 		err |= __get_user(name, &uf->name);
-		f->name = compat_ptr(name);
+		f->name = "";
 		if (err) {
 			err = -EFAULT;
 			goto out;

-- 

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 9/9] compat_ioctl: fix compat_fd_ioctl pointer access, Arnd Bergmann, (Sat Oct 6, 2:19 pm)