Skip to content

Commit b0c9a26

Browse files
Aleksandr MishinPaolo Abeni
authored andcommitted
net: wwan: iosm: Fix tainted pointer delete is case of region creation fail
In case of region creation fail in ipc_devlink_create_region(), previously created regions delete process starts from tainted pointer which actually holds error code value. Fix this bug by decreasing region index before delete. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 4dcd183 ("net: wwan: iosm: devlink registration") Signed-off-by: Aleksandr Mishin <[email protected]> Acked-by: Sergey Ryazanov <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5899c88 commit b0c9a26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/wwan/iosm/iosm_ipc_devlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink)
211211
rc = PTR_ERR(devlink->cd_regions[i]);
212212
dev_err(devlink->dev, "Devlink region fail,err %d", rc);
213213
/* Delete previously created regions */
214-
for ( ; i >= 0; i--)
214+
for (i--; i >= 0; i--)
215215
devlink_region_destroy(devlink->cd_regions[i]);
216216
goto region_create_fail;
217217
}

0 commit comments

Comments
 (0)