aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2007-03-19 06:39:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 16:28:36 -0400
commitf81ee4d52880b08c213982df5041217212689960 (patch)
treebc19b31b57939783234568843a815a8584a1f3d2
parent686149f488e1912f29bcfc593fad4c18f0f75397 (diff)
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>
-rw-r--r--drivers/usb/misc/iowarrior.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index d69665c8de02..de97ed7b0b95 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -417,14 +417,14 @@ static ssize_t iowarrior_write(struct file *file,
417 if (!int_out_urb) { 417 if (!int_out_urb) {
418 retval = -ENOMEM; 418 retval = -ENOMEM;
419 dbg("%s Unable to allocate urb ", __func__); 419 dbg("%s Unable to allocate urb ", __func__);
420 goto error; 420 goto error_no_urb;
421 } 421 }
422 buf = usb_buffer_alloc(dev->udev, dev->report_size, 422 buf = usb_buffer_alloc(dev->udev, dev->report_size,
423 GFP_KERNEL, &int_out_urb->transfer_dma); 423 GFP_KERNEL, &int_out_urb->transfer_dma);
424 if (!buf) { 424 if (!buf) {
425 retval = -ENOMEM; 425 retval = -ENOMEM;
426 dbg("%s Unable to allocate buffer ", __func__); 426 dbg("%s Unable to allocate buffer ", __func__);
427 goto error; 427 goto error_no_buffer;
428 } 428 }
429 usb_fill_int_urb(int_out_urb, dev->udev, 429 usb_fill_int_urb(int_out_urb, dev->udev,
430 usb_sndintpipe(dev->udev, 430 usb_sndintpipe(dev->udev,
@@ -459,7 +459,9 @@ static ssize_t iowarrior_write(struct file *file,
459error: 459error:
460 usb_buffer_free(dev->udev, dev->report_size, buf, 460 usb_buffer_free(dev->udev, dev->report_size, buf,
461 int_out_urb->transfer_dma); 461 int_out_urb->transfer_dma);
462error_no_buffer:
462 usb_free_urb(int_out_urb); 463 usb_free_urb(int_out_urb);
464error_no_urb:
463 atomic_dec(&dev->write_busy); 465 atomic_dec(&dev->write_busy);
464 wake_up_interruptible(&dev->write_wait); 466 wake_up_interruptible(&dev->write_wait);
465exit: 467exit: