diff options
author | 2021-09-17 13:46:20 +0200 | |
---|---|---|
committer | 2021-10-07 07:53:17 +0200 | |
commit | 382ef7ff1854d527f5ff394d337f5f4f4952ec18 (patch) | |
tree | 1a8e094d2bc6128a9b886b75d45eb52956aee554 | |
parent | fcd28f229175aa644511d64250461fa315c4c90e (diff) | |
download | linux-yocto-382ef7ff1854d527f5ff394d337f5f4f4952ec18.tar.gz linux-yocto-382ef7ff1854d527f5ff394d337f5f4f4952ec18.tar.bz2 linux-yocto-382ef7ff1854d527f5ff394d337f5f4f4952ec18.zip |
ipack: ipoctal: fix missing allocation-failure check
commit 445c8132727728dc297492a7d9fc074af3e94ba3 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: 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>
-rw-r--r-- | drivers/ipack/devices/ipoctal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index 35a8ed34c0ca..64b67f0d5c04 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -386,7 +386,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); |