diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index fa1bf8b069fd..f032d5b0e985 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -325,6 +325,12 @@ static int submit_rx_urb(struct hfa384x *hw, gfp_t memflags) struct sk_buff *skb; int result; + result = usb_urb_ep_type_check(&hw->rx_urb); + if (result) { + netdev_warn(hw->wlandev->netdev, "invalid rx endpoint"); + goto done; + } + skb = dev_alloc_skb(sizeof(union hfa384x_usbin)); if (!skb) { result = -ENOMEM; @@ -388,6 +394,12 @@ static int submit_tx_urb(struct hfa384x *hw, struct urb *tx_urb, gfp_t memflags) struct net_device *netdev = hw->wlandev->netdev; int result; + result = usb_urb_ep_type_check(&hw->tx_urb); + if (result) { + netdev_warn(hw->wlandev->netdev, "invalid tx endpoint"); + goto done; + } + result = -ENOLINK; if (netif_running(netdev)) { if (!hw->wlandev->hwremoved && @@ -407,6 +419,7 @@ static int submit_tx_urb(struct hfa384x *hw, struct urb *tx_urb, gfp_t memflags) } } +done: return result; }