]> www.infradead.org Git - users/willy/linux.git/commitdiff
xfs: fix transaction leak on remote attr set/remove failure
authorBrian Foster <bfoster@redhat.com>
Tue, 24 Jul 2018 20:43:08 +0000 (13:43 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Jul 2018 17:15:12 +0000 (10:15 -0700)
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>
fs/xfs/libxfs/xfs_attr_remote.c

index 7841e6255129d8d8738669472258e21ccf4da106..829ab20f0cd7a5ff910a94336aa9145fc963907f 100644 (file)
@@ -558,7 +558,6 @@ xfs_attr_rmtval_set(
        return 0;
 out_defer_cancel:
        xfs_defer_cancel(args->trans->t_dfops);
-       args->trans = NULL;
        return error;
 }
 
@@ -646,6 +645,5 @@ xfs_attr_rmtval_remove(
        return 0;
 out_defer_cancel:
        xfs_defer_cancel(args->trans->t_dfops);
-       args->trans = NULL;
        return error;
 }