Skip to content

Commit 2203718

Browse files
httpstormdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Foster Snowhill <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fd5f4d7 commit 2203718

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/usb/ipheth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ static int ipheth_probe(struct usb_interface *intf,
510510
ipheth_free_urbs(dev);
511511
err_alloc_urbs:
512512
err_get_macaddr:
513-
err_alloc_ctrl_buf:
514513
kfree(dev->ctrl_buf);
514+
err_alloc_ctrl_buf:
515515
err_endpoints:
516516
free_netdev(netdev);
517517
return retval;

0 commit comments

Comments
 (0)