On Wed, May 12, 2021 at 12:19:03PM +0200, Johan Hovold wrote: > On Wed, May 12, 2021 at 01:09:04PM +0300, Dan Carpenter wrote: > > Add a couple checks for if these allocations fail. > > > > Fixes: 542f54823614 ("tty: Modem functions for the HSO driver") > > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > > --- > > drivers/net/usb/hso.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c > > index 3ef4b2841402..3b2a868d7a72 100644 > > --- a/drivers/net/usb/hso.c > > +++ b/drivers/net/usb/hso.c > > @@ -2618,9 +2618,13 @@ static struct hso_device *hso_create_bulk_serial_device( > > num_urbs = 2; > > serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget), > > GFP_KERNEL); > > + if (!serial->tiocmget) > > + goto exit; > > Nice catch; the next assignment would go boom if this ever failed. > > This appears to have been introduced by > > af0de1303c4e ("usb: hso: obey DMA rules in tiocmget") > > > serial->tiocmget->serial_state_notification > > = kzalloc(sizeof(struct hso_serial_state_notification), > > GFP_KERNEL); > > + if (!serial->tiocmget->serial_state_notification) > > + goto exit; > > /* it isn't going to break our heart if serial->tiocmget > > * allocation fails don't bother checking this. > > */ > > You should remove this comment and drop the conditional on the following > line as well now, though. Ah, good catch. I'll resend. Thanks! regards, dan carpenter