i40e: Add checking for null for nlmsg_find_attr()
authorNatalia Petrova <n.petrova@fintech.ru>
Thu, 9 Feb 2023 17:28:33 +0000 (09:28 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 11 Feb 2023 03:51:35 +0000 (19:51 -0800)
commit7fa0b526f865cb42aa33917fd02a92cb03746f4d
tree42b25d361be5f7e8a8a4d10a64043b82be232695
parent1f090494170ea298530cf1285fb8d078e355b4c0
i40e: Add checking for null for nlmsg_find_attr()

The result of nlmsg_find_attr() 'br_spec' is dereferenced in
nla_for_each_nested(), but it can take NULL value in nla_find() function,
which will result in an error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 51616018dd1b ("i40e: Add support for getlink, setlink ndo ops")
Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20230209172833.3596034-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_main.c