Skip to contentSkip to conversation

tty: ipwireless: fix possible NULL dereference

PATCH In review Sudip Mukherjee 3 participants 3 messages Apr 6, 2016 – Apr 7, 2016 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/tty/ipwireless/hardware.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/tty/ipwireless/hardware.c +5 -0
index ad7031a..df0204b 100644
@@ -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);
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Sudip Mukherjee

The function alloc_ctrl_packet() can fail and return NULL. Incase it fails print an error message and exit.

I don't have the git tree for this driver any more ... Greg, would you mind taking this through your misc driver tree?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 11 lines · Jiri Kosina
Quoted 4 lines · Sudip Mukherjee

The function alloc_ctrl_packet() can fail and return NULL. Incase it fails print an error message and exit.

I don't have the git tree for this driver any more ... Greg, would you mind taking this through your misc driver tree?

Yes, I'll take it.

thanks,

greg k-h