net: lapbether: fix double free
authorPan Bian <bianpan2016@163.com>
Sun, 29 Oct 2017 13:57:22 +0000 (21:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Nov 2017 03:11:02 +0000 (12:11 +0900)
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>
drivers/net/wan/lapbether.c

index 63f7490..0e3f8ed 100644 (file)
@@ -346,7 +346,6 @@ out:
 fail:
        dev_put(dev);
        free_netdev(ndev);
-       kfree(lapbeth);
        goto out;
 }