]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cw1200: Fix potential memory leak in cw1200_bh_rx_helper()
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>
Mon, 10 Nov 2025 17:53:15 +0000 (23:23 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Nov 2025 10:11:24 +0000 (11:11 +0100)
In one of the error paths, the memory allocated for skb_rx is not freed.
Fix that by freeing it before returning.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Link: https://patch.msgid.link/20251110175316.106591-1-nihaal@cse.iitm.ac.in
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/st/cw1200/bh.c

index 3b4ded2ac801cc57b2b3050198c931e6cf4f08ca..37232ee2203755756e0bc2b0dcd9bf6975f9ad3c 100644 (file)
@@ -317,10 +317,12 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,
 
        if (wsm_id & 0x0400) {
                int rc = wsm_release_tx_buffer(priv, 1);
-               if (WARN_ON(rc < 0))
+               if (WARN_ON(rc < 0)) {
+                       dev_kfree_skb(skb_rx);
                        return rc;
-               else if (rc > 0)
+               } else if (rc > 0) {
                        *tx = 1;
+               }
        }
 
        /* cw1200_wsm_rx takes care on SKB livetime */