Commit d3df49dd authored by Johannes Berg's avatar Johannes Berg Committed by Gregory Greenman

wifi: iwlwifi: mei: fix potential NULL-ptr deref after clone

If cloning the SKB fails, don't try to use it, but rather return
as if we should pass it.

Coverity CID: 1503456

Fixes: 2da4366f ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221030191011.0ce03ba99601.I87960b7cb0a3d16b9fd8d9144027e7e2587f5a58@changeid
parent d288067e
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (C) 2021 Intel Corporation * Copyright (C) 2021-2022 Intel Corporation
*/ */
#include <uapi/linux/if_ether.h> #include <uapi/linux/if_ether.h>
...@@ -337,10 +337,14 @@ rx_handler_result_t iwl_mei_rx_filter(struct sk_buff *orig_skb, ...@@ -337,10 +337,14 @@ rx_handler_result_t iwl_mei_rx_filter(struct sk_buff *orig_skb,
if (!*pass_to_csme) if (!*pass_to_csme)
return RX_HANDLER_PASS; return RX_HANDLER_PASS;
if (ret == RX_HANDLER_PASS) if (ret == RX_HANDLER_PASS) {
skb = skb_copy(orig_skb, GFP_ATOMIC); skb = skb_copy(orig_skb, GFP_ATOMIC);
else
if (!skb)
return RX_HANDLER_PASS;
} else {
skb = orig_skb; skb = orig_skb;
}
/* CSME wants the MAC header as well, push it back */ /* CSME wants the MAC header as well, push it back */
skb_push(skb, skb->data - skb_mac_header(skb)); skb_push(skb, skb->data - skb_mac_header(skb));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment