Skip to content

Commit 06e456a

Browse files
RandDeebanguy11
authored andcommitted
net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink()
The function ice_bridge_setlink() may encounter a NULL pointer dereference if nlmsg_find_attr() returns NULL and br_spec is dereferenced subsequently in nla_for_each_nested(). To address this issue, add a check to ensure that br_spec is not NULL before proceeding with the nested attribute iteration. Fixes: b1edc14 ("ice: Implement ice_bridge_getlink and ice_bridge_setlink") Signed-off-by: Rand Deeb <rand.sec96@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 2652b99 commit 06e456a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8013,6 +8013,8 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
80138013
pf_sw = pf->first_sw;
80148014
/* find the attribute in the netlink message */
80158015
br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);
8016+
if (!br_spec)
8017+
return -EINVAL;
80168018

80178019
nla_for_each_nested(attr, br_spec, rem) {
80188020
__u16 mode;

0 commit comments

Comments
 (0)