Skip to content

Commit

Permalink
ax25: Replace kfree() in ax25_dev_free() with ax25_dev_put()
Browse files Browse the repository at this point in the history
The object "ax25_dev" is managed by reference counting. Thus it should
not be directly released by kfree(), replace with ax25_dev_put().

Fixes: d01ffb9 ("ax25: add refcount in ax25_dev to avoid UAF bugs")
Suggested-by: Dan Carpenter <[email protected]>
Signed-off-by: Duoming Zhou <[email protected]>
Reviewed-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
stonezdm authored and kuba-moo committed Jun 1, 2024
1 parent 3c34fb0 commit 166fcf8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ax25/ax25_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void __exit ax25_dev_free(void)
list_for_each_entry_safe(s, n, &ax25_dev_list, list) {
netdev_put(s->dev, &s->dev_tracker);
list_del(&s->list);
kfree(s);
ax25_dev_put(s);
}
spin_unlock_bh(&ax25_dev_lock);
}

0 comments on commit 166fcf8

Please sign in to comment.