• Dan Carpenter's avatar
    net: hso: check for allocation failure in hso_create_bulk_serial_device() · 31db0dbd
    Dan Carpenter authored
    In current kernels, small allocations never actually fail so this
    patch shouldn't affect runtime.
    
    Originally this error handling code written with the idea that if
    the "serial->tiocmget" allocation failed, then we would continue
    operating instead of bailing out early.  But in later years we added
    an unchecked dereference on the next line.
    
    	serial->tiocmget->serial_state_notification = kzalloc();
            ^^^^^^^^^^^^^^^^^^
    
    Since these allocations are never going fail in real life, this is
    mostly a philosophical debate, but I think bailing out early is the
    correct behavior that the user would want.  And generally it's safer to
    bail as soon an error happens.
    
    Fixes: af0de130 ("usb: hso: obey DMA rules in tiocmget")
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    31db0dbd
hso.c 82.9 KB