Skip to content

Commit 445c813

Browse files
jhovoldgregkh
authored andcommitted
ipack: ipoctal: fix missing allocation-failure check
Add the missing error handling when allocating the transmit buffer to avoid dereferencing a NULL pointer in write() should the allocation ever fail. Fixes: ba4dc61 ("Staging: ipack: add support for IP-OCTAL mezzanine board") Cc: [email protected] # 3.5 Acked-by: Samuel Iglesias Gonsalvez <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cd20d59 commit 445c813

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/ipack/devices/ipoctal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
385385

386386
channel = &ipoctal->channel[i];
387387
tty_port_init(&channel->tty_port);
388-
tty_port_alloc_xmit_buf(&channel->tty_port);
388+
res = tty_port_alloc_xmit_buf(&channel->tty_port);
389+
if (res)
390+
continue;
389391
channel->tty_port.ops = &ipoctal_tty_port_ops;
390392

391393
ipoctal_reset_stats(&channel->stats);

0 commit comments

Comments
 (0)