[PATCH 3.16 040/129] tty: ipwireless: Fix potential NULL pointer dereference
From: Ben Hutchings
Date: Sun Jul 07 2019 - 15:45:40 EST
3.16.70-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <yuehaibing@xxxxxxxxxx>
commit 7dd50e205b3348dc7784efbdf85723551de64a25 upstream.
There is a potential NULL pointer dereference in case
alloc_ctrl_packet() fails and returns NULL.
Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/tty/ipwireless/hardware.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1515,6 +1515,8 @@ static void ipw_send_setup_packet(struct
sizeof(struct ipw_setup_get_version_query_packet),
ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
TL_SETUP_SIGNO_GET_VERSION_QRY);
+ if (!ver_packet)
+ return;
ver_packet->header.length = sizeof(struct tl_setup_get_version_qry);
/*