summaryrefslogtreecommitdiff
path: root/drivers/ipack/devices
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-09-17 14:46:20 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-27 18:38:49 +0300
commit445c8132727728dc297492a7d9fc074af3e94ba3 (patch)
treeb0f1cfb50ae42f2569fcce6097772d5a45d383eb /drivers/ipack/devices
parentcd20d59291d1790dc74248476e928f57fc455189 (diff)
downloadlinux-445c8132727728dc297492a7d9fc074af3e94ba3.tar.xz
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: ba4dc61fe8c5 ("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>
Diffstat (limited to 'drivers/ipack/devices')
-rw-r--r--drivers/ipack/devices/ipoctal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index d6875aa6a295..61c41f535510 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -385,7 +385,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
channel = &ipoctal->channel[i];
tty_port_init(&channel->tty_port);
- tty_port_alloc_xmit_buf(&channel->tty_port);
+ res = tty_port_alloc_xmit_buf(&channel->tty_port);
+ if (res)
+ continue;
channel->tty_port.ops = &ipoctal_tty_port_ops;
ipoctal_reset_stats(&channel->stats);