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

net: lapbether: fix double free

The function netdev_priv() returns the private data of the device. The
memory to store the private data is allocated in alloc_netdev() and is
released in netdev_free(). Calling kfree() on the return value of
netdev_priv() after netdev_free() results in a double free bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pan Bian and committed by
David S. Miller
7db8874a 04686ef2

-1
-1
drivers/net/wan/lapbether.c
··· 346 346 fail: 347 347 dev_put(dev); 348 348 free_netdev(ndev); 349 - kfree(lapbeth); 350 349 goto out; 351 350 } 352 351