Skip to content

Commit

Permalink
Fix -Wuse-after-free warning in dbuf_issue_final_prefetch_done()
Browse files Browse the repository at this point in the history
Move the use of the private pointer after it is freed.  It's only
used as a tag so a dereference would never occur, but there's no
harm in inverting the order to resolve the warning.

    module/zfs/dbuf.c: In function 'dbuf_issue_final_prefetch_done':
    module/zfs/dbuf.c:3204:17: error:
    pointer 'private' may be used after 'free' [-Werror=use-after-free]

Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#13528
Closes openzfs#13575
  • Loading branch information
behlendorf authored and andrewc12 committed Sep 23, 2022
1 parent b2fe644 commit 28e3b67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3199,9 +3199,10 @@ dbuf_issue_final_prefetch_done(zio_t *zio, const zbookmark_phys_t *zb,
(void) zio, (void) zb, (void) iobp;
dbuf_prefetch_arg_t *dpa = private;

dbuf_prefetch_fini(dpa, B_TRUE);
if (abuf != NULL)
arc_buf_destroy(abuf, private);

dbuf_prefetch_fini(dpa, B_TRUE);
}

/*
Expand Down

0 comments on commit 28e3b67

Please sign in to comment.