Skip to content

Commit 843efca

Browse files
jhovoldgregkh
authored andcommitted
ipack: ipoctal: fix missing allocation-failure check
commit 445c813 upstream. 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: stable@vger.kernel.org # 3.5 Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20210917114622.5412-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 67d1df6 commit 843efca

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
@@ -388,7 +388,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
388388

389389
channel = &ipoctal->channel[i];
390390
tty_port_init(&channel->tty_port);
391-
tty_port_alloc_xmit_buf(&channel->tty_port);
391+
res = tty_port_alloc_xmit_buf(&channel->tty_port);
392+
if (res)
393+
continue;
392394
channel->tty_port.ops = &ipoctal_tty_port_ops;
393395

394396
ipoctal_reset_stats(&channel->stats);

0 commit comments

Comments
 (0)