Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@codethink.co.uk>
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sudip Mukherjee and committed by
Greg Kroah-Hartman
76bbdcb3 9c589505

+5
+5
drivers/tty/ipwireless/hardware.c
··· 1572 1572 sizeof(struct ipw_setup_reboot_msg_ack), 1573 1573 ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP, 1574 1574 TL_SETUP_SIGNO_REBOOT_MSG_ACK); 1575 + if (!packet) { 1576 + pr_err(IPWIRELESS_PCCARD_NAME 1577 + ": Not enough memory to send reboot packet"); 1578 + break; 1579 + } 1575 1580 packet->header.length = 1576 1581 sizeof(struct TlSetupRebootMsgAck); 1577 1582 send_packet(hw, PRIO_SETUP, &packet->header);