]> git.baikalelectronics.ru Git - kernel.git/commit
iwlwifi: mei: fix the pskb_may_pull check in ipv4
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 28 Jan 2022 12:30:54 +0000 (14:30 +0200)
committerKalle Valo <kvalo@kernel.org>
Thu, 3 Feb 2022 08:24:49 +0000 (10:24 +0200)
commit6c00135dd2a5d1e55f45c8bf1c0b9c12ba4ee935
tree3ad3c5e3e2167ee330b42c4987b4d18d31b1838a
parent054337bd60d1074e066ac5657a42c52a515698c7
iwlwifi: mei: fix the pskb_may_pull check in ipv4

The check makes sure that we can look at the ip header.
We first need to check that the basic ip header (20 bytes)
can be pulled before we look at the field that will teach
us how long is the ip header. This is why there are two
checks.

The second check was wrong and smatch pointed that
sizeof(ip_hdrlen(skb) - sizeof(*iphdr)) can't be right.

Looking at the code again made me think that we really
need ip_hdrlen(skb) since we want to make sure all the
IP header is in the buffer header. This will allow us
to set the transport offset and from there to look
at the transport header (TCP / UDP).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Fixes: 146430904911 ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/iwlwifi.20220128142706.6d9fcf82691e.I449b1e21c5b5478f2ac218522570479918f49f9d@changeid
drivers/net/wireless/intel/iwlwifi/mei/net.c