USB: iowarrior.c: fix NULL dereference
Am Montag, 19. 2007 10:25 schrieb Adrian Bunk: > The Coverity checker spotted the following NULL dereference: And this fixes an oops upon allocation failures. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
686149f488
commit
f81ee4d528
@@ -417,14 +417,14 @@ static ssize_t iowarrior_write(struct file *file,
|
|||||||
if (!int_out_urb) {
|
if (!int_out_urb) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
dbg("%s Unable to allocate urb ", __func__);
|
dbg("%s Unable to allocate urb ", __func__);
|
||||||
goto error;
|
goto error_no_urb;
|
||||||
}
|
}
|
||||||
buf = usb_buffer_alloc(dev->udev, dev->report_size,
|
buf = usb_buffer_alloc(dev->udev, dev->report_size,
|
||||||
GFP_KERNEL, &int_out_urb->transfer_dma);
|
GFP_KERNEL, &int_out_urb->transfer_dma);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
dbg("%s Unable to allocate buffer ", __func__);
|
dbg("%s Unable to allocate buffer ", __func__);
|
||||||
goto error;
|
goto error_no_buffer;
|
||||||
}
|
}
|
||||||
usb_fill_int_urb(int_out_urb, dev->udev,
|
usb_fill_int_urb(int_out_urb, dev->udev,
|
||||||
usb_sndintpipe(dev->udev,
|
usb_sndintpipe(dev->udev,
|
||||||
@@ -459,7 +459,9 @@ static ssize_t iowarrior_write(struct file *file,
|
|||||||
error:
|
error:
|
||||||
usb_buffer_free(dev->udev, dev->report_size, buf,
|
usb_buffer_free(dev->udev, dev->report_size, buf,
|
||||||
int_out_urb->transfer_dma);
|
int_out_urb->transfer_dma);
|
||||||
|
error_no_buffer:
|
||||||
usb_free_urb(int_out_urb);
|
usb_free_urb(int_out_urb);
|
||||||
|
error_no_urb:
|
||||||
atomic_dec(&dev->write_busy);
|
atomic_dec(&dev->write_busy);
|
||||||
wake_up_interruptible(&dev->write_wait);
|
wake_up_interruptible(&dev->write_wait);
|
||||||
exit:
|
exit:
|
||||||
|
Reference in New Issue
Block a user