All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <jhovold@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <jhovold@gmail.com>
Subject: [PATCH 12/13] USB: visor: fix DMA buffers on stack
Date: Thu, 31 Dec 2009 16:48:08 +0100	[thread overview]
Message-ID: <1262274489-12447-13-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1262037718-31424-1-git-send-email-jhovold@gmail.com>


Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
 drivers/usb/serial/visor.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index ad1f923..178e4d9 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -807,10 +807,14 @@ static int clie_3_5_startup(struct usb_serial *serial)
 {
 	struct device *dev = &serial->dev->dev;
 	int result;
-	u8 data;
+	u8 *data;
 
 	dbg("%s", __func__);
 
+	data = kmalloc(1, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
 	/*
 	 * Note that PEG-300 series devices expect the following two calls.
 	 */
@@ -818,36 +822,42 @@ static int clie_3_5_startup(struct usb_serial *serial)
 	/* get the config number */
 	result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 				  USB_REQ_GET_CONFIGURATION, USB_DIR_IN,
-				  0, 0, &data, 1, 3000);
+				  0, 0, data, 1, 3000);
 	if (result < 0) {
 		dev_err(dev, "%s: get config number failed: %d\n",
 							__func__, result);
-		return result;
+		goto out;
 	}
 	if (result != 1) {
 		dev_err(dev, "%s: get config number bad return length: %d\n",
 							__func__, result);
-		return -EIO;
+		result = -EIO;
+		goto out;
 	}
 
 	/* get the interface number */
 	result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 				  USB_REQ_GET_INTERFACE,
 				  USB_DIR_IN | USB_RECIP_INTERFACE,
-				  0, 0, &data, 1, 3000);
+				  0, 0, data, 1, 3000);
 	if (result < 0) {
 		dev_err(dev, "%s: get interface number failed: %d\n",
 							__func__, result);
-		return result;
+		goto out;
 	}
 	if (result != 1) {
 		dev_err(dev,
 			"%s: get interface number bad return length: %d\n",
 							__func__, result);
-		return -EIO;
+		result = -EIO;
+		goto out;
 	}
 
-	return generic_startup(serial);
+	result = generic_startup(serial);
+out:
+	kfree(data);
+
+	return result;
 }
 
 static int treo_attach(struct usb_serial *serial)
-- 
1.6.6


  parent reply	other threads:[~2009-12-31 15:49 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 22:01 [PATCH 00/14] USB: serial: fix DMA buffers on stack and endianess bugs Johan Hovold
2009-12-28 22:01 ` [PATCH 01/14] USB: ch341: replace printk warnings with dev_err Johan Hovold
2009-12-28 22:01 ` [PATCH 02/14] USB: ch341: fix DMA buffer on stack Johan Hovold
2009-12-28 22:01 ` [PATCH 03/14] USB: ch341: use le16_to_cpup to be explicit about endianess Johan Hovold
2009-12-28 22:01 ` [PATCH 04/14] USB: cypress_m8: fix DMA buffer on stack Johan Hovold
2009-12-28 22:01 ` [PATCH 05/14] USB: cypress_m8: fix endianess bug Johan Hovold
2009-12-28 22:01 ` [PATCH 06/14] USB: io_ti: fix DMA buffers on stack Johan Hovold
2009-12-28 22:01 ` [PATCH 07/14] USB: keyspan_pda: " Johan Hovold
2009-12-28 22:01 ` [PATCH 08/14] USB: kl5kusb105: " Johan Hovold
2009-12-28 22:01 ` [PATCH 09/14] USB: mct_u232: " Johan Hovold
2009-12-31 11:40   ` Johan Hovold
2010-01-15 18:43     ` Greg KH
2009-12-28 22:01 ` [PATCH 10/14] USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd Johan Hovold
2009-12-28 22:01 ` [PATCH 11/14] USB: mos7840: fix DMA buffers on stack and endianess bugs Johan Hovold
2009-12-28 22:01 ` [PATCH 12/14] USB: oti6858: fix DMA buffer on stack Johan Hovold
2009-12-28 22:46   ` Andres Salomon
2009-12-28 22:51     ` Andres Salomon
2009-12-28 22:01 ` [PATCH 13/14] USB: visor: fix DMA buffers " Johan Hovold
2009-12-28 22:01 ` [PATCH 14/14] USB: kobil_sct: clean up kobil_set_termios Johan Hovold
2009-12-30 16:06 ` [PATCH 00/14] USB: serial: fix DMA buffers on stack and endianess bugs Dan Carpenter
2009-12-30 17:33   ` Johan Hovold
2009-12-30 16:06 ` [patch] USB: serial: fix DMA buffers on stack for io_edgeport.c Dan Carpenter
2009-12-30 17:14   ` Johan Hovold
2009-12-30 17:50     ` Dan Carpenter
2009-12-31 15:42     ` [patch v2] " Dan Carpenter
2009-12-31 15:47 ` [PATCH 00/13][v2] USB: serial: fix DMA buffers on stack and endianess bugs Johan Hovold
2010-01-15 18:50   ` Greg KH
2010-01-16 12:45     ` Johan Hovold
2009-12-31 15:47 ` [PATCH 01/13] USB: ch341: replace printk warnings with dev_err Johan Hovold
2009-12-31 15:47 ` [PATCH 02/13] USB: ch341: fix DMA buffer on stack Johan Hovold
2009-12-31 15:47 ` [PATCH 03/13] USB: ch341: use get_unaligned_le16 in break_ctl Johan Hovold
2009-12-31 15:48 ` [PATCH 04/13] USB: cypress_m8: fix DMA buffer on stack Johan Hovold
2009-12-31 15:48 ` [PATCH 05/13] USB: cypress_m8: fix endianess bug and alignment Johan Hovold
2009-12-31 15:48 ` [PATCH 06/13] USB: io_ti: fix DMA buffers on stack Johan Hovold
2009-12-31 15:48 ` [PATCH 07/13] USB: keyspan_pda: " Johan Hovold
2009-12-31 15:48 ` [PATCH 08/13] USB: kl5kusb105: " Johan Hovold
2009-12-31 15:48 ` [PATCH 09/13] USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd Johan Hovold
2009-12-31 15:48 ` [PATCH 10/13] USB: mos7840: fix DMA buffers on stack and endianess bugs Johan Hovold
2009-12-31 15:48 ` [PATCH 11/13] USB: oti6858: fix DMA buffer on stack Johan Hovold
2009-12-31 15:48 ` Johan Hovold [this message]
2009-12-31 15:48 ` [PATCH 13/13] USB: kobil_sct: clean up kobil_set_termios Johan Hovold

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=1262274489-12447-13-git-send-email-jhovold@gmail.com \
    --to=jhovold@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.