Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd8e899

Browse files
RustamSubkhankulovkuba-moo
authored andcommitted
net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
If an error occurs in dsa_devlink_region_create(), then 'priv->regions' array will be accessed by negative index '-1'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov <[email protected]> Fixes: bf425b8 ("net: dsa: sja1105: expose static config as devlink region") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bec13ba commit fd8e899

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/sja1105/sja1105_devlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds)
9393

9494
region = dsa_devlink_region_create(ds, ops, 1, size);
9595
if (IS_ERR(region)) {
96-
while (i-- >= 0)
96+
while (--i >= 0)
9797
dsa_devlink_region_destroy(priv->regions[i]);
9898
return PTR_ERR(region);
9999
}

0 commit comments

Comments
 (0)