Skip to content

Commit 1b03d85

Browse files
djwonggregkh
authored andcommitted
xfs: in _attrlist_by_handle, copy the cursor back to userspace
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.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> Cc: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c56605c commit 1b03d85

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fs/xfs/xfs_ioctl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ xfs_attrlist_by_handle(
403403
{
404404
int error = -ENOMEM;
405405
attrlist_cursor_kern_t *cursor;
406+
struct xfs_fsop_attrlist_handlereq __user *p = arg;
406407
xfs_fsop_attrlist_handlereq_t al_hreq;
407408
struct dentry *dentry;
408409
char *kbuf;
@@ -435,6 +436,11 @@ xfs_attrlist_by_handle(
435436
if (error)
436437
goto out_kfree;
437438

439+
if (copy_to_user(&p->pos, cursor, sizeof(attrlist_cursor_kern_t))) {
440+
error = -EFAULT;
441+
goto out_kfree;
442+
}
443+
438444
if (copy_to_user(al_hreq.buffer, kbuf, al_hreq.buflen))
439445
error = -EFAULT;
440446

0 commit comments

Comments
 (0)