diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-07-31 21:18:54 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-13 16:48:01 -0400 |
commit | 6dd93e9e5eb19e81a74b3df8426a945a08ad8a1f (patch) | |
tree | 75ff24b7d369bacc7d15be86338badb37da5f07a /fs/xfs/xfs_attr.c | |
parent | 2c2bcc0735f4ab052559b539f3fcab4087187232 (diff) |
xfs: avoid double-free in xfs_attr_node_addname
xfs_attr_node_addname()'s error handling tests whether it
should free "state" in the out: error handling label:
out:
if (state)
xfs_da_state_free(state);
but an earlier free doesn't set state to NULL afterwards; this
could lead to a double free. Fix it by setting state to NULL
after it's freed.
This was found by Coverity.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 176dbb66282d..ddcf2267ffa6 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1014,6 +1014,7 @@ restart: | |||
1014 | * have been a b-tree. | 1014 | * have been a b-tree. |
1015 | */ | 1015 | */ |
1016 | xfs_da_state_free(state); | 1016 | xfs_da_state_free(state); |
1017 | state = NULL; | ||
1017 | xfs_bmap_init(args->flist, args->firstblock); | 1018 | xfs_bmap_init(args->flist, args->firstblock); |
1018 | error = xfs_attr3_leaf_to_node(args); | 1019 | error = xfs_attr3_leaf_to_node(args); |
1019 | if (!error) { | 1020 | if (!error) { |