ath6kl: Check for valid endpoint ID values in ath6kl_control_tx()
authorRaja Mani <rmani@qca.qualcomm.com>
Fri, 21 Sep 2012 09:38:55 +0000 (15:08 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 24 Oct 2012 08:49:50 +0000 (11:49 +0300)
It's safe to check endpoint id values before it get
really used. Found this on code review.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/txrx.c

index efee590a234a2f9d3aed6fe5c0674e61925e50c4..cf4380d573c4a47b05320f7ae5958577e2a7a821 100644 (file)
@@ -293,6 +293,12 @@ int ath6kl_control_tx(void *devt, struct sk_buff *skb,
                return -EACCES;
        }
 
+       if (WARN_ON_ONCE(eid == ENDPOINT_UNUSED ||
+                        eid >= ENDPOINT_MAX)) {
+               status = -EINVAL;
+               goto fail_ctrl_tx;
+       }
+
        spin_lock_bh(&ar->lock);
 
        ath6kl_dbg(ATH6KL_DBG_WLAN_TX,