linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: linux-usb-devel@lists.sourceforge.net
Cc: Adrian Bunk <bunk@stusta.de>,
	Christian Lucht <lucht@codemercs.com>,
	Robert Marquardt <marquardt@codemercs.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH]Re: [linux-usb-devel] drivers/usb/misc/iowarrior.c: NULL dereference
Date: Mon, 19 Mar 2007 11:39:13 +0100	[thread overview]
Message-ID: <200703191139.14026.oneukum@suse.de> (raw)
In-Reply-To: <20070319092533.GN752@stusta.de>

Am Montag, 19. März 2007 10:25 schrieb Adrian Bunk:
> The Coverity checker spotted the following NULL dereference:

And this fixes an oops upon allocation failures.

	Regards
		Oliver

Signed-off-by: Oliver Neukum <oneukum@suse.de>
-----

--- linux-2.6.21-rc4/drivers/usb/misc/iowarrior.c.alt	2007-03-19 11:05:37.000000000 +0100
+++ linux-2.6.21-rc4/drivers/usb/misc/iowarrior.c	2007-03-19 11:07:30.000000000 +0100
@@ -417,14 +417,14 @@
 		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 @@
 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:

      parent reply	other threads:[~2007-03-19 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19  9:25 drivers/usb/misc/iowarrior.c: NULL dereference Adrian Bunk
2007-03-19 10:17 ` [linux-usb-devel] " Oliver Neukum
2007-03-19 10:39 ` Oliver Neukum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200703191139.14026.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=bunk@stusta.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=lucht@codemercs.com \
    --cc=marquardt@codemercs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).