Skip to content

Commit 81b1d54

Browse files
f0rm2l1nkuba-moo
authored andcommitted
hamradio: remove needs_free_netdev to avoid UAF
The former patch "defer 6pack kfree after unregister_netdev" reorders the kfree of two buffer after the unregister_netdev to prevent the race condition. It also adds free_netdev() function in sixpack_close(), which is a direct copy from the similar code in mkiss_close(). However, in sixpack driver, the flag needs_free_netdev is set to true in sp_setup(), hence the unregister_netdev() will free the netdev automatically. Therefore, as the sp is netdev_priv, use-after-free occurs. This patch removes the needs_free_netdev = true and just let the free_netdev to finish this deallocation task. Fixes: 0b91119 ("hamradio: defer 6pack kfree after unregister_netdev") Signed-off-by: Lin Ma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 66f4bea commit 81b1d54

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/net/hamradio/6pack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ static void sp_setup(struct net_device *dev)
306306
{
307307
/* Finish setting up the DEVICE info. */
308308
dev->netdev_ops = &sp_netdev_ops;
309-
dev->needs_free_netdev = true;
310309
dev->mtu = SIXP_MTU;
311310
dev->hard_header_len = AX25_MAX_HEADER_LEN;
312311
dev->header_ops = &ax25_header_ops;

0 commit comments

Comments
 (0)