net: wwan: iosm: Fix tainted pointer delete is case of region creation fail
Subsystems (4)
PATCH 1/1 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.
--- drivers/net/wwan/iosm/iosm_ipc_devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wwan/iosm/iosm_ipc_devlink.c +1 -1
@@ -211,7 +211,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink) rc =PTR_ERR (devlink->cd_regions[i]);dev_err (devlink->dev,"Devlink region fail,err %d" , rc);/* Delete previously created regions */ -for ( ; i >=0 ; i--) +for (i--; i >=0 ; i--)devlink_region_destroy (devlink->cd_regions[i]); goto region_create_fail; }
Signature · 1 line
2.30.2
Quoted 9 lines · Aleksandr Mishin
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 4dcd183fbd67 ("net: wwan: iosm: devlink registration")Signed-off-by Aleksandr Mishin <[email protected]>
Nice catch!
Quoted 9 lines · Aleksandr Mishin
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 4dcd183fbd67 ("net: wwan: iosm: devlink registration")Signed-off-by Aleksandr Mishin <[email protected]>
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Tue, 4 Jun 2024 11:25:00 +0300 you wrote:
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.
[...]
Here is the summary with links:
- [net] net: wwan: iosm: Fix tainted pointer delete is case of region creation fail
https://git.kernel.org/netdev/net/c/b0c9a2643541
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html