aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-ref.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2011-10-03 23:23:23 -0400
committerDavid Sterba <dsterba@suse.cz>2012-03-21 20:45:30 -0400
commitcddcd800189bc03745d576f913dc57692c6f439a (patch)
tree361ed5f8c26a9820608de6d0a74f546729c90970 /fs/btrfs/delayed-ref.c
parent43c04fb1b8c9f45d971bb53d7cbbcda8ee85716b (diff)
btrfs: Fix kfree of member instead of structure
Correctness fix: The kfree calls in the add_delayed_* functions free the node that's passed into it, but the node is a member of another structure. It works because it's always the first member of the containing structure, but it should really be using the containing structure itself. Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
-rw-r--r--fs/btrfs/delayed-ref.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 66e4f29505a3..29ecd543d807 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -487,7 +487,7 @@ static noinline int add_delayed_ref_head(struct btrfs_fs_info *fs_info,
487 * we've updated the existing ref, free the newly 487 * we've updated the existing ref, free the newly
488 * allocated ref 488 * allocated ref
489 */ 489 */
490 kfree(ref); 490 kfree(head_ref);
491 } else { 491 } else {
492 delayed_refs->num_heads++; 492 delayed_refs->num_heads++;
493 delayed_refs->num_heads_ready++; 493 delayed_refs->num_heads_ready++;
@@ -549,7 +549,7 @@ static noinline int add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
549 * we've updated the existing ref, free the newly 549 * we've updated the existing ref, free the newly
550 * allocated ref 550 * allocated ref
551 */ 551 */
552 kfree(ref); 552 kfree(full_ref);
553 } else { 553 } else {
554 delayed_refs->num_entries++; 554 delayed_refs->num_entries++;
555 trans->delayed_ref_updates++; 555 trans->delayed_ref_updates++;
@@ -611,7 +611,7 @@ static noinline int add_delayed_data_ref(struct btrfs_fs_info *fs_info,
611 * we've updated the existing ref, free the newly 611 * we've updated the existing ref, free the newly
612 * allocated ref 612 * allocated ref
613 */ 613 */
614 kfree(ref); 614 kfree(full_ref);
615 } else { 615 } else {
616 delayed_refs->num_entries++; 616 delayed_refs->num_entries++;
617 trans->delayed_ref_updates++; 617 trans->delayed_ref_updates++;