lkml.org 
[lkml]   [2021]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 44/57] ipack: ipoctal: fix missing allocation-failure check
    Date
    From: Johan Hovold <johan@kernel.org>

    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>
    ---
    drivers/ipack/devices/ipoctal.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    --- a/drivers/ipack/devices/ipoctal.c
    +++ b/drivers/ipack/devices/ipoctal.c
    @@ -391,7 +391,9 @@ static int ipoctal_inst_slot(struct ipoc

    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);

    \
     
     \ /
      Last update: 2021-10-04 15:00    [W:4.222 / U:0.928 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site