netdevsim: prevent bad user input in nsim_dev_health_break_write()
[ Upstream commitee76746387] 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: 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a8836eae32
commit
8e9ef6bdf7
@@ -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