diff mbox series

[2/2] xfs: compat_ioctl: use compat_ptr()

Message ID 20190816063547.1592-3-hch@lst.de (mailing list archive)
State Accepted
Headers show
Series [1/2] xfs: fall back to native ioctls for unhandled compat ones | expand

Commit Message

Christoph Hellwig Aug. 16, 2019, 6:35 a.m. UTC
For 31-bit s390 user space, we have to pass pointer arguments through
compat_ptr() in the compat_ioctl handler.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_ioctl32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Sandeen Aug. 16, 2019, 2:05 p.m. UTC | #1
On 8/16/19 1:35 AM, Christoph Hellwig wrote:
> For 31-bit s390 user space, we have to pass pointer arguments through
> compat_ptr() in the compat_ioctl handler.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Seems fine

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  fs/xfs/xfs_ioctl32.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
> index bae08ef92ac3..7bd7534f5051 100644
> --- a/fs/xfs/xfs_ioctl32.c
> +++ b/fs/xfs/xfs_ioctl32.c
> @@ -547,7 +547,7 @@ xfs_file_compat_ioctl(
>  	struct inode		*inode = file_inode(filp);
>  	struct xfs_inode	*ip = XFS_I(inode);
>  	struct xfs_mount	*mp = ip->i_mount;
> -	void			__user *arg = (void __user *)p;
> +	void			__user *arg = compat_ptr(p);
>  	int			error;
>  
>  	trace_xfs_file_compat_ioctl(ip);
> @@ -655,6 +655,6 @@ xfs_file_compat_ioctl(
>  		return xfs_compat_fssetdm_by_handle(filp, arg);
>  	default:
>  		/* try the native version */
> -		return xfs_file_ioctl(filp, cmd, p);
> +		return xfs_file_ioctl(filp, cmd, (unsigned long)arg);
>  	}
>  }
>
Darrick J. Wong Aug. 17, 2019, 1:42 a.m. UTC | #2
On Fri, Aug 16, 2019 at 08:35:47AM +0200, Christoph Hellwig wrote:
> For 31-bit s390 user space, we have to pass pointer arguments through
> compat_ptr() in the compat_ioctl handler.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_ioctl32.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
> index bae08ef92ac3..7bd7534f5051 100644
> --- a/fs/xfs/xfs_ioctl32.c
> +++ b/fs/xfs/xfs_ioctl32.c
> @@ -547,7 +547,7 @@ xfs_file_compat_ioctl(
>  	struct inode		*inode = file_inode(filp);
>  	struct xfs_inode	*ip = XFS_I(inode);
>  	struct xfs_mount	*mp = ip->i_mount;
> -	void			__user *arg = (void __user *)p;
> +	void			__user *arg = compat_ptr(p);
>  	int			error;
>  
>  	trace_xfs_file_compat_ioctl(ip);
> @@ -655,6 +655,6 @@ xfs_file_compat_ioctl(
>  		return xfs_compat_fssetdm_by_handle(filp, arg);
>  	default:
>  		/* try the native version */
> -		return xfs_file_ioctl(filp, cmd, p);
> +		return xfs_file_ioctl(filp, cmd, (unsigned long)arg);
>  	}
>  }
> -- 
> 2.20.1
>
Christoph Hellwig Aug. 18, 2019, 8:35 a.m. UTC | #3
On Fri, Aug 16, 2019 at 06:42:18PM -0700, Darrick J. Wong wrote:
> On Fri, Aug 16, 2019 at 08:35:47AM +0200, Christoph Hellwig wrote:
> > For 31-bit s390 user space, we have to pass pointer arguments through
> > compat_ptr() in the compat_ioctl handler.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Looks ok,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

So, what is the plan?  Do you think they are worth including for 5.3,
or do you want to pass them off to Arnd for his series that is targeted
at 5.4?
Darrick J. Wong Aug. 19, 2019, 4:42 p.m. UTC | #4
On Sun, Aug 18, 2019 at 01:35:53AM -0700, Christoph Hellwig wrote:
> On Fri, Aug 16, 2019 at 06:42:18PM -0700, Darrick J. Wong wrote:
> > On Fri, Aug 16, 2019 at 08:35:47AM +0200, Christoph Hellwig wrote:
> > > For 31-bit s390 user space, we have to pass pointer arguments through
> > > compat_ptr() in the compat_ioctl handler.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > 
> > Looks ok,
> > Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> So, what is the plan?  Do you think they are worth including for 5.3,
> or do you want to pass them off to Arnd for his series that is targeted
> at 5.4?

I'll combine these two with the reflink/dedupe locking fixes and push
all four out this week.

--D
diff mbox series

Patch

diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index bae08ef92ac3..7bd7534f5051 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -547,7 +547,7 @@  xfs_file_compat_ioctl(
 	struct inode		*inode = file_inode(filp);
 	struct xfs_inode	*ip = XFS_I(inode);
 	struct xfs_mount	*mp = ip->i_mount;
-	void			__user *arg = (void __user *)p;
+	void			__user *arg = compat_ptr(p);
 	int			error;
 
 	trace_xfs_file_compat_ioctl(ip);
@@ -655,6 +655,6 @@  xfs_file_compat_ioctl(
 		return xfs_compat_fssetdm_by_handle(filp, arg);
 	default:
 		/* try the native version */
-		return xfs_file_ioctl(filp, cmd, p);
+		return xfs_file_ioctl(filp, cmd, (unsigned long)arg);
 	}
 }