Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ax25: Replace kfree() in ax25_dev_free() with ax25_dev_put()

The object "ax25_dev" is managed by reference counting. Thus it should
not be directly released by kfree(), replace with ax25_dev_put().

Fixes: d01ffb9eee4a ("ax25: add refcount in ax25_dev to avoid UAF bugs")
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240530051733.11416-1-duoming@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Duoming Zhou and committed by
Jakub Kicinski
166fcf86 3c34fb0b

+1 -1
+1 -1
net/ax25/ax25_dev.c
··· 196 196 list_for_each_entry_safe(s, n, &ax25_dev_list, list) { 197 197 netdev_put(s->dev, &s->dev_tracker); 198 198 list_del(&s->list); 199 - kfree(s); 199 + ax25_dev_put(s); 200 200 } 201 201 spin_unlock_bh(&ax25_dev_lock); 202 202 }