]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: don't leak the retained da state when doing a leaf to node conversion
authorDarrick J. Wong <djwong@kernel.org>
Fri, 20 May 2022 04:41:42 +0000 (14:41 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 20 May 2022 04:41:42 +0000 (14:41 +1000)
commit222c557b75817bdb168d6972e9a9e6981c000fa9
tree676dc1f9ab0fe71e9aa64443ea6050558163601a
parent3f9b0bc6e4c3c628dc908a12f4a2732cd0ec9a25
xfs: don't leak the retained da state when doing a leaf to node conversion

If a setxattr operation finds an xattr structure in leaf format, adding
the attr can fail due to lack of space and hence requires an upgrade to
node format.  After this happens, we'll roll the transaction and
re-enter the state machine, at which time we need to perform a second
lookup of the attribute name to find its new location.  This lookup
attaches a new da state structure to the xfs_attr_item but doesn't free
the old one (from the leaf lookup) and leaks it.  Fix that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_attr.c