]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: fix transaction leak on remote attr set/remove failure
authorBrian Foster <bfoster@redhat.com>
Fri, 5 Oct 2018 02:36:10 +0000 (21:36 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 5 Oct 2018 02:36:10 +0000 (21:36 -0500)
Source kernel commit: dcbd44f79986e55691600b969c14db004d741883

The xattr remote value set/remove handlers both clear args.trans in
the error path without having cancelled the transaction. This leaks
the transaction, causes warnings around returning to userspace with
locks held and leads to system lockups or other general problems.

The higher level xfs_attr_[set|remove]() functions already detect
and cancel args.trans when set in the error path. Drop the NULL
assignments from the rmtval handlers and allow the callers to clean
up the transaction correctly.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr_remote.c

index 5841ac3a65dc4be97100c28bd9e7b703946aca3e..d05b86672e7bb2b2a758e1edc378bb6d2e6cf6ae 100644 (file)
@@ -553,7 +553,6 @@ xfs_attr_rmtval_set(
        return 0;
 out_defer_cancel:
        xfs_defer_cancel(args->trans->t_dfops);
-       args->trans = NULL;
        return error;
 }
 
@@ -641,6 +640,5 @@ xfs_attr_rmtval_remove(
        return 0;
 out_defer_cancel:
        xfs_defer_cancel(args->trans->t_dfops);
-       args->trans = NULL;
        return error;
 }