mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 14:53:11 +01:00
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: 82c93a87bf ("netdevsim: implement couple of testing devlink health reporters")
Reported-by: [email protected]
Closes: https://lore.kernel.org/netdev/[email protected]/T/#u
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Jiri Pirko <[email protected]>
Reviewed-by: Joe Damato <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
1 parent
2d5df3a680
commit
ee76746387
1 file changed
+2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user