Commit ff2923ac authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds

[PATCH] ethtool_get_regs copy right number of bytes to user

If regs.len is smaller than reglen it's possible to copy more bytes out
than the user asked for.
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
parent f9c235e6
......@@ -157,7 +157,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
if (copy_to_user(useraddr, &regs, sizeof(regs)))
goto out;
useraddr += offsetof(struct ethtool_regs, data);
if (copy_to_user(useraddr, regbuf, reglen))
if (copy_to_user(useraddr, regbuf, regs.len))
goto out;
ret = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment