[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJupQPb+Y4vw3rDk@mwanda>
Date: Wed, 12 May 2021 13:09:04 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "David S. Miller" <davem@...emloft.net>,
Denis Joseph Barrow <D.Barow@...ion.com>
Cc: Jakub Kicinski <kuba@...nel.org>, Oliver Neukum <oneukum@...e.com>,
Anirudh Rayabharam <mail@...rudhrb.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Johan Hovold <johan@...nel.org>,
Rustam Kovhaev <rkovhaev@...il.com>,
Zheng Yongjun <zhengyongjun3@...wei.com>,
Emil Renner Berthing <kernel@...il.dk>,
linux-usb@...r.kernel.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net] net: hso: check for allocation failure in
hso_create_bulk_serial_device()
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@...cle.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
Powered by blists - more mailing lists