[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1459941939-6427-1-git-send-email-sudipm.mukherjee@gmail.com>
Date: Wed, 6 Apr 2016 12:25:39 +0100
From: Sudip Mukherjee <sudipm.mukherjee@...il.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,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] tty: ipwireless: fix possible NULL dereference
The function alloc_ctrl_packet() can fail and return NULL. Incase it
fails print an error message and exit.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
---
drivers/tty/ipwireless/hardware.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index ad7031a..df0204b 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1572,6 +1572,11 @@ static void handle_received_SETUP_packet(struct ipw_hardware *hw,
sizeof(struct ipw_setup_reboot_msg_ack),
ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
TL_SETUP_SIGNO_REBOOT_MSG_ACK);
+ if (!packet) {
+ pr_err(IPWIRELESS_PCCARD_NAME
+ ": Not enough memory to send reboot packet");
+ break;
+ }
packet->header.length =
sizeof(struct TlSetupRebootMsgAck);
send_packet(hw, PRIO_SETUP, &packet->header);
--
2.1.4
Powered by blists - more mailing lists