libertas: Fix memory leak of RX skbs
authorDavid Woodhouse <dwmw2@infradead.org>
Wed, 28 Nov 2007 16:20:51 +0000 (16:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:05:59 +0000 (15:05 -0800)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/if_usb.c

index 4fce0baa0711e158d02245fb5a65f81628ee1336..c27ffcfdbe88d67107a3aa141d13541715ccd3c3 100644 (file)
@@ -460,6 +460,8 @@ static int __if_usb_submit_rx_urb(struct usb_card_rec *cardp,
        if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
                /* handle failure conditions */
                lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
+               kfree_skb(skb);
+               rinfo->skb = NULL;
                ret = -1;
        } else {
                /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
@@ -667,8 +669,10 @@ static void if_usb_receive(struct urb *urb)
                lbs_deb_usbd(&cardp->udev->dev,
                            "Recv length = 0x%x, Recv type = 0x%X\n",
                            recvlength, recvtype);
-       } else if (urb->status)
+       } else if (urb->status) {
+               kfree_skb(skb);
                goto rx_exit;
+       }
 
        switch (recvtype) {
        case CMD_TYPE_DATA: