netdevsim: prevent bad user input in nsim_dev_health_break_write()
Subsystems (3)
PATCH 1/1 netdevsim: prevent bad user input in nsim_dev_health_break_write()
If either a zero count or a large one is provided, kernel can crash.
Fixes 82c93a87bf8b ("netdevsim: implement couple of testing devlink health reporters")
Reported-by [email protected]
Signed-off-by Eric Dumazet <[email protected]>
Cc Jiri Pirko <[email protected]>
--- drivers/net/netdevsim/health.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/netdevsim/health.c +2 -0
@@ -149,6 +149,8 @@ static ssize_t nsim_dev_health_break_write(struct file *file,char *break_msg;int err; +if (count ==0 || count >PAGE_SIZE ) +return -EINVAL ; break_msg =memdup_user_nul (data, count);if (IS_ERR (break_msg))return PTR_ERR (break_msg);
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
Quoted 17 lines · Eric Dumazet
If either a zero count or a large one is provided, kernel can crash.
Fixes 82c93a87bf8b ("netdevsim: implement couple of testing devlink health reporters")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>Cc Jiri Pirko <[email protected]>--- drivers/net/netdevsim/health.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/netdevsim/health.c +0
-0
drivers/net/netdevsim/health.c static ssize_t nsim_dev_health_break_write(struct file *file, · line 156
Quoted 8 lines
drivers/net/netdevsim/health.c +2
-0@@ -149,6 +149,8 @@ static ssize_t nsim_dev_health_break_write(struct file *file,char *break_msg;int err; +if (count ==0 || count >PAGE_SIZE ) +return -EINVAL ; break_msg =memdup_user_nul (data, count);if (IS_ERR (break_msg))return PTR_ERR (break_msg);
Reviewed-by Joe Damato <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 13 Dec 2024 17:25:18 +0000 you wrote:
If either a zero count or a large one is provided, kernel can crash.
Fixes 82c93a87bf8b ("netdevsim: implement couple of testing devlink health reporters")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>Cc Jiri Pirko <[email protected]>[...]
Here is the summary with links:
- [net] netdevsim: prevent bad user input in nsim_dev_health_break_write()
https://git.kernel.org/netdev/net/c/ee76746387f6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html