diff options
author | Alex Villacís Lasso <a_villacis@palosanto.com> | 2007-10-08 04:07:28 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:50 -0400 |
commit | 630e499724bda4ecb62b1f6652656e886f04197f (patch) | |
tree | 25ea15b9db1d0525af8f0566dfaad45b2a02b0c9 | |
parent | 14e3e07979c4384e45e751882292d3b38477e855 (diff) |
[IRDA]: Oops fix for ksdazzle
This 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/irda/ksdazzle-sir.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c index af60f2435a38..d01a28593ce2 100644 --- a/drivers/net/irda/ksdazzle-sir.c +++ b/drivers/net/irda/ksdazzle-sir.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Filename: ksdazzle.c | 3 | * Filename: ksdazzle.c |
4 | * Version: 0.1.1 | 4 | * Version: 0.1.2 |
5 | * Description: Irda KingSun Dazzle USB Dongle | 5 | * Description: Irda KingSun Dazzle USB Dongle |
6 | * Status: Experimental | 6 | * Status: Experimental |
7 | * Author: Alex Villacís Lasso <a_villacis@palosanto.com> | 7 | * Author: Alex Villacís Lasso <a_villacis@palosanto.com> |
@@ -113,6 +113,7 @@ MODULE_DEVICE_TABLE(usb, dongles); | |||
113 | #define KINGSUN_REQ_SEND 0x09 | 113 | #define KINGSUN_REQ_SEND 0x09 |
114 | 114 | ||
115 | #define KINGSUN_SND_FIFO_SIZE 2048 /* Max packet we can send */ | 115 | #define KINGSUN_SND_FIFO_SIZE 2048 /* Max packet we can send */ |
116 | #define KINGSUN_RCV_MAX 2048 /* Max transfer we can receive */ | ||
116 | 117 | ||
117 | struct ksdazzle_speedparams { | 118 | struct ksdazzle_speedparams { |
118 | __le32 baudrate; /* baud rate, little endian */ | 119 | __le32 baudrate; /* baud rate, little endian */ |
@@ -150,7 +151,7 @@ struct ksdazzle_cb { | |||
150 | __u8 tx_payload[8]; | 151 | __u8 tx_payload[8]; |
151 | 152 | ||
152 | struct urb *rx_urb; | 153 | struct urb *rx_urb; |
153 | __u8 rx_payload[8]; | 154 | __u8 *rx_buf; |
154 | iobuff_t rx_unwrap_buff; | 155 | iobuff_t rx_unwrap_buff; |
155 | 156 | ||
156 | struct usb_ctrlrequest *speed_setuprequest; | 157 | struct usb_ctrlrequest *speed_setuprequest; |
@@ -440,7 +441,8 @@ static int ksdazzle_net_open(struct net_device *netdev) | |||
440 | /* Start reception. */ | 441 | /* Start reception. */ |
441 | usb_fill_int_urb(kingsun->rx_urb, kingsun->usbdev, | 442 | usb_fill_int_urb(kingsun->rx_urb, kingsun->usbdev, |
442 | usb_rcvintpipe(kingsun->usbdev, kingsun->ep_in), | 443 | usb_rcvintpipe(kingsun->usbdev, kingsun->ep_in), |
443 | kingsun->rx_payload, 8, ksdazzle_rcv_irq, kingsun, 1); | 444 | kingsun->rx_buf, KINGSUN_RCV_MAX, ksdazzle_rcv_irq, |
445 | kingsun, 1); | ||
444 | kingsun->rx_urb->status = 0; | 446 | kingsun->rx_urb->status = 0; |
445 | err = usb_submit_urb(kingsun->rx_urb, GFP_KERNEL); | 447 | err = usb_submit_urb(kingsun->rx_urb, GFP_KERNEL); |
446 | if (err) { | 448 | if (err) { |
@@ -641,6 +643,7 @@ static int ksdazzle_probe(struct usb_interface *intf, | |||
641 | kingsun->tx_buf_clear_sent = 0; | 643 | kingsun->tx_buf_clear_sent = 0; |
642 | 644 | ||
643 | kingsun->rx_urb = NULL; | 645 | kingsun->rx_urb = NULL; |
646 | kingsun->rx_buf = NULL; | ||
644 | kingsun->rx_unwrap_buff.in_frame = FALSE; | 647 | kingsun->rx_unwrap_buff.in_frame = FALSE; |
645 | kingsun->rx_unwrap_buff.state = OUTSIDE_FRAME; | 648 | kingsun->rx_unwrap_buff.state = OUTSIDE_FRAME; |
646 | kingsun->rx_unwrap_buff.skb = NULL; | 649 | kingsun->rx_unwrap_buff.skb = NULL; |
@@ -651,6 +654,11 @@ static int ksdazzle_probe(struct usb_interface *intf, | |||
651 | kingsun->speed_urb = NULL; | 654 | kingsun->speed_urb = NULL; |
652 | kingsun->speedparams.baudrate = 0; | 655 | kingsun->speedparams.baudrate = 0; |
653 | 656 | ||
657 | /* Allocate input buffer */ | ||
658 | kingsun->rx_buf = kmalloc(KINGSUN_RCV_MAX, GFP_KERNEL); | ||
659 | if (!kingsun->rx_buf) | ||
660 | goto free_mem; | ||
661 | |||
654 | /* Allocate output buffer */ | 662 | /* Allocate output buffer */ |
655 | kingsun->tx_buf_clear = kmalloc(KINGSUN_SND_FIFO_SIZE, GFP_KERNEL); | 663 | kingsun->tx_buf_clear = kmalloc(KINGSUN_SND_FIFO_SIZE, GFP_KERNEL); |
656 | if (!kingsun->tx_buf_clear) | 664 | if (!kingsun->tx_buf_clear) |
@@ -714,6 +722,7 @@ static int ksdazzle_probe(struct usb_interface *intf, | |||
714 | free_mem: | 722 | free_mem: |
715 | kfree(kingsun->speed_setuprequest); | 723 | kfree(kingsun->speed_setuprequest); |
716 | kfree(kingsun->tx_buf_clear); | 724 | kfree(kingsun->tx_buf_clear); |
725 | kfree(kingsun->rx_buf); | ||
717 | free_netdev(net); | 726 | free_netdev(net); |
718 | err_out1: | 727 | err_out1: |
719 | return ret; | 728 | return ret; |
@@ -746,6 +755,7 @@ static void ksdazzle_disconnect(struct usb_interface *intf) | |||
746 | 755 | ||
747 | kfree(kingsun->speed_setuprequest); | 756 | kfree(kingsun->speed_setuprequest); |
748 | kfree(kingsun->tx_buf_clear); | 757 | kfree(kingsun->tx_buf_clear); |
758 | kfree(kingsun->rx_buf); | ||
749 | free_netdev(kingsun->netdev); | 759 | free_netdev(kingsun->netdev); |
750 | 760 | ||
751 | usb_set_intfdata(intf, NULL); | 761 | usb_set_intfdata(intf, NULL); |