]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iwlwifi: mei: fix potential NULL-ptr deref
authorJohannes Berg <johannes.berg@intel.com>
Tue, 17 May 2022 09:05:14 +0000 (12:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:26:17 +0000 (10:26 +0200)
commit 78488a64aea94a3336ee97f345c1496e9bc5ebdf upstream.

If SKB allocation fails, continue rather than using the NULL
pointer.

Coverity CID: 1497650

Cc: stable@vger.kernel.org
Fixes: 2da4366f9e2c ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220517120045.90c1b1fd534e.Ibb42463e74d0ec7d36ec81df22e171ae1f6268b0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/intel/iwlwifi/mei/main.c

index 506fe5f2573bc63c4c6b3eec5541bb0be2fc5bee..208c4373f07d74ea63b334a6a79475c0f7179c6f 100644 (file)
@@ -1020,6 +1020,8 @@ static void iwl_mei_handle_sap_data(struct mei_cl_device *cldev,
 
                /* We need enough room for the WiFi header + SNAP + IV */
                skb = netdev_alloc_skb(netdev, len + QOS_HDR_IV_SNAP_LEN);
+               if (!skb)
+                       continue;
 
                skb_reserve(skb, QOS_HDR_IV_SNAP_LEN);
                ethhdr = skb_push(skb, sizeof(*ethhdr));