netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: hso: check for allocation failure in hso_create_bulk_serial_device()
@ 2021-05-12 10:09 Dan Carpenter
  2021-05-12 10:19 ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2021-05-12 10:09 UTC (permalink / raw)
  To: David S. Miller, Denis Joseph Barrow
  Cc: Jakub Kicinski, Oliver Neukum, Anirudh Rayabharam,
	Greg Kroah-Hartman, Johan Hovold, Rustam Kovhaev, Zheng Yongjun,
	Emil Renner Berthing, linux-usb, netdev, kernel-janitors

Add a couple checks for if these allocations fail.

Fixes: 542f54823614 ("tty: Modem functions for the HSO driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/usb/hso.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 3ef4b2841402..3b2a868d7a72 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2618,9 +2618,13 @@ static struct hso_device *hso_create_bulk_serial_device(
 		num_urbs = 2;
 		serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
 					   GFP_KERNEL);
+		if (!serial->tiocmget)
+			goto exit;
 		serial->tiocmget->serial_state_notification
 			= kzalloc(sizeof(struct hso_serial_state_notification),
 					   GFP_KERNEL);
+		if (!serial->tiocmget->serial_state_notification)
+			goto exit;
 		/* it isn't going to break our heart if serial->tiocmget
 		 *  allocation fails don't bother checking this.
 		 */
-- 
2.30.2


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

end of thread, other threads:[~2021-05-17 21:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 10:09 [PATCH net] net: hso: check for allocation failure in hso_create_bulk_serial_device() Dan Carpenter
2021-05-12 10:19 ` Johan Hovold
2021-05-12 13:12   ` Dan Carpenter
2021-05-14 14:24   ` [PATCH v2 " Dan Carpenter
2021-05-17  8:07     ` Johan Hovold
2021-05-17 21:00     ` patchwork-bot+netdevbpf

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).