summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorGeorgi Valkov <gvalkov@gmail.com>2023-06-07 15:56:59 +0200
committerDavid S. Miller <davem@davemloft.net>2023-06-09 10:26:57 +0100
commit2203718c2f59ffdd6c78d54e5add594aebb4461e (patch)
tree8e909ff2119179b861f0ad8d6132d2f099b7ad8a /drivers/net/usb
parentfd5f4d7da29218485153fd8b4c08da7fc130c79f (diff)
downloadlinux-stable-2203718c2f59ffdd6c78d54e5add594aebb4461e.tar.gz
linux-stable-2203718c2f59ffdd6c78d54e5add594aebb4461e.tar.bz2
linux-stable-2203718c2f59ffdd6c78d54e5add594aebb4461e.zip
usbnet: ipheth: fix risk of NULL pointer deallocation
The cleanup precedure in ipheth_probe will attempt to free a NULL pointer in dev->ctrl_buf if the memory allocation for this buffer is not successful. While kfree ignores NULL pointers, and the existing code is safe, it is a better design to rearrange the goto labels and avoid this. Signed-off-by: Georgi Valkov <gvalkov@gmail.com> Signed-off-by: Foster Snowhill <forst@pen.gy> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/ipheth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 6a769df0b421..8875a3d0e6d9 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -510,8 +510,8 @@ err_register_netdev:
ipheth_free_urbs(dev);
err_alloc_urbs:
err_get_macaddr:
-err_alloc_ctrl_buf:
kfree(dev->ctrl_buf);
+err_alloc_ctrl_buf:
err_endpoints:
free_netdev(netdev);
return retval;