Skip to content

Commit ee76746

Browse files
edumazetkuba-moo
authored andcommitted
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: 82c93a8 ("netdevsim: implement couple of testing devlink health reporters") Reported-by: syzbot+ea40e4294e58b0292f74@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/675c6862.050a0220.37aaf.00b1.GAE@google.com/T/#u Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Joe Damato <jdamato@fastly.com> Link: https://patch.msgid.link/20241213172518.2415666-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2d5df3a commit ee76746

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/netdevsim/health.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ static ssize_t nsim_dev_health_break_write(struct file *file,
149149
char *break_msg;
150150
int err;
151151

152+
if (count == 0 || count > PAGE_SIZE)
153+
return -EINVAL;
152154
break_msg = memdup_user_nul(data, count);
153155
if (IS_ERR(break_msg))
154156
return PTR_ERR(break_msg);

0 commit comments

Comments
 (0)