]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i40e: Fix potential invalid access when MAC list is empty
authorZhen Ni <zhen.ni@easystack.cn>
Wed, 27 Aug 2025 11:56:31 +0000 (19:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:54:14 +0000 (18:54 +0200)
commite2a5e74879f9b494bbd66fa93f355feacde450c7
tree4648f6c295fd5d1518f80e93a47e3f25e7c9755e
parent0cdf1fd8fc59d44a48c694324611136910301ef9
i40e: Fix potential invalid access when MAC list is empty

[ Upstream commit a556f06338e1d5a85af0e32ecb46e365547f92b9 ]

list_first_entry() never returns NULL - if the list is empty, it still
returns a pointer to an invalid object, leading to potential invalid
memory access when dereferenced.

Fix this by using list_first_entry_or_null instead of list_first_entry.

Fixes: e3219ce6a775 ("i40e: Add support for client interface for IWARP driver")
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_client.c