All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <samuel@sortiz.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: irda-users@lists.sourceforge.net, netdev@vger.kernel.org,
	"Alex Villacís Lasso" <a_villacis@palosanto.com>
Subject: [PATCH] IrDA: Oops fix for ksdazzle
Date: Mon, 1 Oct 2007 02:21:38 +0300	[thread overview]
Message-ID: <20070930232138.GA5669@sortiz.org> (raw)

Hi Dave,

This is the last remaining patch for IrDA, against net-2.6.24.

It fixes a kernel oops triggered by the ksdazzle SIR driver.
We need more space for input frames, and 2048 should be plenty of it.

Signed-off-by: Alex Villacís Lasso <a_villacis@palosanto.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>

---
 drivers/net/irda/ksdazzle-sir.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Index: net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c
===================================================================
--- net-2.6.24-quilt.orig/drivers/net/irda/ksdazzle-sir.c	2007-10-01 01:53:56.000000000 +0300
+++ net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c	2007-10-01 01:53:58.000000000 +0300
@@ -1,7 +1,7 @@
 /*****************************************************************************
 *
 * Filename:      ksdazzle.c
-* Version:       0.1.1
+* Version:       0.1.2
 * Description:   Irda KingSun Dazzle USB Dongle
 * Status:        Experimental
 * Author:        Alex Villacís Lasso <a_villacis@palosanto.com>
@@ -113,6 +113,7 @@
 #define KINGSUN_REQ_SEND 0x09
 
 #define KINGSUN_SND_FIFO_SIZE    2048	/* Max packet we can send */
+#define KINGSUN_RCV_MAX 2048	/* Max transfer we can receive */
 
 struct ksdazzle_speedparams {
 	__le32 baudrate;	/* baud rate, little endian */
@@ -150,7 +151,7 @@
 	__u8 tx_payload[8];
 
 	struct urb *rx_urb;
-	__u8 rx_payload[8];
+	__u8 *rx_buf;
 	iobuff_t rx_unwrap_buff;
 
 	struct usb_ctrlrequest *speed_setuprequest;
@@ -440,7 +441,8 @@
 	/* Start reception. */
 	usb_fill_int_urb(kingsun->rx_urb, kingsun->usbdev,
 			 usb_rcvintpipe(kingsun->usbdev, kingsun->ep_in),
-			 kingsun->rx_payload, 8, ksdazzle_rcv_irq, kingsun, 1);
+			 kingsun->rx_buf, KINGSUN_RCV_MAX, ksdazzle_rcv_irq,
+			 kingsun, 1);
 	kingsun->rx_urb->status = 0;
 	err = usb_submit_urb(kingsun->rx_urb, GFP_KERNEL);
 	if (err) {
@@ -641,6 +643,7 @@
 	kingsun->tx_buf_clear_sent = 0;
 
 	kingsun->rx_urb = NULL;
+	kingsun->rx_buf = NULL;
 	kingsun->rx_unwrap_buff.in_frame = FALSE;
 	kingsun->rx_unwrap_buff.state = OUTSIDE_FRAME;
 	kingsun->rx_unwrap_buff.skb = NULL;
@@ -651,6 +654,11 @@
 	kingsun->speed_urb = NULL;
 	kingsun->speedparams.baudrate = 0;
 
+	/* Allocate input buffer */
+	kingsun->rx_buf = kmalloc(KINGSUN_RCV_MAX, GFP_KERNEL);
+	if (!kingsun->rx_buf)
+		goto free_mem;
+
 	/* Allocate output buffer */
 	kingsun->tx_buf_clear = kmalloc(KINGSUN_SND_FIFO_SIZE, GFP_KERNEL);
 	if (!kingsun->tx_buf_clear)
@@ -714,6 +722,7 @@
       free_mem:
 	kfree(kingsun->speed_setuprequest);
 	kfree(kingsun->tx_buf_clear);
+	kfree(kingsun->rx_buf);
 	free_netdev(net);
       err_out1:
 	return ret;
@@ -746,6 +755,7 @@
 
 	kfree(kingsun->speed_setuprequest);
 	kfree(kingsun->tx_buf_clear);
+	kfree(kingsun->rx_buf);
 	free_netdev(kingsun->netdev);
 
 	usb_set_intfdata(intf, NULL);


             reply	other threads:[~2007-09-30 23:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30 23:21 Samuel Ortiz [this message]
     [not found] ` <20070930232138.GA5669-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-10-08  8:07   ` [PATCH] IrDA: Oops fix for ksdazzle David Miller

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=20070930232138.GA5669@sortiz.org \
    --to=samuel@sortiz.org \
    --cc=a_villacis@palosanto.com \
    --cc=davem@davemloft.net \
    --cc=irda-users@lists.sourceforge.net \
    --cc=netdev@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.