Skip to content

Commit 7fa0b52

Browse files
Natalia Petrovakuba-moo
authored andcommitted
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: 5161601 ("i40e: Add support for getlink, setlink ndo ops") Signed-off-by: Natalia Petrova <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Tested-by: Gurucharan G <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1f09049 commit 7fa0b52

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13167,6 +13167,8 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
1316713167
}
1316813168

1316913169
br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
13170+
if (!br_spec)
13171+
return -EINVAL;
1317013172

1317113173
nla_for_each_nested(attr, br_spec, rem) {
1317213174
__u16 mode;

0 commit comments

Comments
 (0)