summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/iowarrior.c
diff options
context:
space:
mode:
authorOliver Neukum2007-03-19 11:39:13 +0100
committerGreg Kroah-Hartman2007-04-27 22:28:36 +0200
commitf81ee4d52880b08c213982df5041217212689960 (patch)
treebc19b31b57939783234568843a815a8584a1f3d2 /drivers/usb/misc/iowarrior.c
parentUSB: dm9601: fix sparse NULL warnings (diff)
downloadkernel-qcow2-linux-f81ee4d52880b08c213982df5041217212689960.tar.gz
kernel-qcow2-linux-f81ee4d52880b08c213982df5041217212689960.tar.xz
kernel-qcow2-linux-f81ee4d52880b08c213982df5041217212689960.zip
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>
Diffstat (limited to 'drivers/usb/misc/iowarrior.c')
-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,
if (!int_out_urb) {
retval = -ENOMEM;
dbg("%s Unable to allocate urb ", __func__);
- goto error;
+ goto error_no_urb;
}
buf = usb_buffer_alloc(dev->udev, dev->report_size,
GFP_KERNEL, &int_out_urb->transfer_dma);
if (!buf) {
retval = -ENOMEM;
dbg("%s Unable to allocate buffer ", __func__);
- goto error;
+ goto error_no_buffer;
}
usb_fill_int_urb(int_out_urb, dev->udev,
usb_sndintpipe(dev->udev,
@@ -459,7 +459,9 @@ static ssize_t iowarrior_write(struct file *file,
error:
usb_buffer_free(dev->udev, dev->report_size, buf,
int_out_urb->transfer_dma);
+error_no_buffer:
usb_free_urb(int_out_urb);
+error_no_urb:
atomic_dec(&dev->write_busy);
wake_up_interruptible(&dev->write_wait);
exit: