All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl
@ 2009-11-03 10:45 Heiko Carstens
  2009-11-03 11:32 ` Arnd Bergmann
  2009-11-03 14:36 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Carstens @ 2009-11-03 10:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Ankit Jain, Christoph Hellwig, Al Viro,
	Arnd Bergmann, David S. Miller

From: Heiko Carstens <heiko.carstens@de.ibm.com>

For FS_IOC_RESVSP and FS_IOC_RESVSP64 compat_sys_ioctl() uses its
arg argument as a pointer to userspace. However it is missing a
a call to compat_ptr() which will do a proper pointer conversion.

This was introduced with 3e63cbb1 "fs: Add new pre-allocation ioctls
to vfs for compatibility with legacy xfs ioctls".

Cc: Ankit Jain <me@ankitjain.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arndbergmann@googlemail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 fs/compat_ioctl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index f91fd51..d84e705 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1800,7 +1800,7 @@ struct space_resv_32 {
 /* just account for different alignment */
 static int compat_ioctl_preallocate(struct file *file, unsigned long arg)
 {
-	struct space_resv_32	__user *p32 = (void __user *)arg;
+	struct space_resv_32	__user *p32 = compat_ptr(arg);
 	struct space_resv	__user *p = compat_alloc_user_space(sizeof(*p));

 	if (copy_in_user(&p->l_type,	&p32->l_type,	sizeof(s16)) ||
@@ -2802,7 +2802,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
 #else
 	case FS_IOC_RESVSP:
 	case FS_IOC_RESVSP64:
-		error = ioctl_preallocate(filp, (void __user *)arg);
+		error = ioctl_preallocate(filp, compat_ptr(arg));
 		goto out_fput;
 #endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl
  2009-11-03 10:45 [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl Heiko Carstens
@ 2009-11-03 11:32 ` Arnd Bergmann
  2009-11-03 14:36 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2009-11-03 11:32 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andrew Morton, linux-kernel, Ankit Jain, Christoph Hellwig,
	Al Viro, Arnd Bergmann, David S. Miller

On Tuesday 03 November 2009, Heiko Carstens wrote:
> 
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> For FS_IOC_RESVSP and FS_IOC_RESVSP64 compat_sys_ioctl() uses its
> arg argument as a pointer to userspace. However it is missing a
> a call to compat_ptr() which will do a proper pointer conversion.
> 
> This was introduced with 3e63cbb1 "fs: Add new pre-allocation ioctls
> to vfs for compatibility with legacy xfs ioctls".
> 
> Cc: Ankit Jain <me@ankitjain.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arndbergmann@googlemail.com>
> Acked-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl
  2009-11-03 10:45 [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl Heiko Carstens
  2009-11-03 11:32 ` Arnd Bergmann
@ 2009-11-03 14:36 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2009-11-03 14:36 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andrew Morton, linux-kernel, Ankit Jain, Christoph Hellwig,
	Al Viro, Arnd Bergmann, David S. Miller

Looks good.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-03 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 10:45 [PATCH] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl Heiko Carstens
2009-11-03 11:32 ` Arnd Bergmann
2009-11-03 14:36 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.