netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation
@ 2023-05-25 19:42 Foster Snowhill
  2023-05-25 19:42 ` [PATCH net-next v2 2/2] usbnet: ipheth: add CDC NCM support Foster Snowhill
  2023-05-26  7:52 ` [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation Simon Horman
  0 siblings, 2 replies; 5+ messages in thread
From: Foster Snowhill @ 2023-05-25 19:42 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Georgi Valkov, Simon Horman, linux-usb, netdev

From: Georgi Valkov <gvalkov@gmail.com>

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. Rearrange the goto labels to
avoid this risk.

Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
---
 drivers/net/usb/ipheth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 6a769df0b..8875a3d0e 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -510,8 +510,8 @@ static int ipheth_probe(struct usb_interface *intf,
 	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;
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-26  8:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-25 19:42 [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation Foster Snowhill
2023-05-25 19:42 ` [PATCH net-next v2 2/2] usbnet: ipheth: add CDC NCM support Foster Snowhill
2023-05-26  7:52 ` [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation Simon Horman
2023-05-26  8:33   ` George Valkov
2023-05-26  8:41     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).