4.4-stable review patch. If anyone has any objections, please let me know.
------------------ From: Darrick J. Wong <darrick.w...@oracle.com> commit 0facef7fb053be4353c0a48c2f48c9dbee91cb19 upstream. When we're iterating inode xattrs by handle, we have to copy the cursor back to userspace so that a subsequent invocation actually retrieves subsequent contents. Signed-off-by: Darrick J. Wong <darrick.w...@oracle.com> Reviewed-by: Christoph Hellwig <h...@lst.de> Signed-off-by: Dave Chinner <da...@fromorbit.com> Cc: Nikolay Borisov <nbori...@suse.com> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- fs/xfs/xfs_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -403,6 +403,7 @@ xfs_attrlist_by_handle( { int error = -ENOMEM; attrlist_cursor_kern_t *cursor; + struct xfs_fsop_attrlist_handlereq __user *p = arg; xfs_fsop_attrlist_handlereq_t al_hreq; struct dentry *dentry; char *kbuf; @@ -435,6 +436,11 @@ xfs_attrlist_by_handle( if (error) goto out_kfree; + if (copy_to_user(&p->pos, cursor, sizeof(attrlist_cursor_kern_t))) { + error = -EFAULT; + goto out_kfree; + } + if (copy_to_user(al_hreq.buffer, kbuf, al_hreq.buflen)) error = -EFAULT;