[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170605205002.GA4896@embeddedgus>
Date: Mon, 5 Jun 2017 15:50:02 -0500
From: "Gustavo A. R. Silva" <garsilva@...eddedor.com>
To: Jiri Kosina <jikos@...nel.org>, David Sterba <dsterba@...e.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>
Cc: linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <garsilva@...eddedor.com>
Subject: [PATCH] tty: ipwireless: fix potential NULL pointer dereference
Add null check before dereferencing pointer ver_packet.
Print error message and exit in case pointer ver_packet
is NULL.
Addresses-Coverity-ID: 1362295
Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
---
drivers/tty/ipwireless/hardware.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index df0204b..20db99d 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1515,6 +1515,13 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
sizeof(struct ipw_setup_get_version_query_packet),
ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
TL_SETUP_SIGNO_GET_VERSION_QRY);
+
+ if (!ver_packet) {
+ pr_err(IPWIRELESS_PCCARD_NAME
+ ": Not enough memory to send packet\n");
+ return;
+ }
+
ver_packet->header.length = sizeof(struct tl_setup_get_version_qry);
/*
--
2.5.0
Powered by blists - more mailing lists