mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
bna: integer overflow bug in debugfs
[ Upstream commit13e2d5187f] We could allocate less memory than intended because we do: bnad->regdata = kzalloc(len << 2, GFP_KERNEL); The shift can overflow leading to a crash. This is debugfs code so the impact is very small. Fixes:7afc5dbde0("bna: Add debugfs interface.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Rasesh Mody <rasesh.mody@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b3f662ccd3
commit
b4cf187a1b
@@ -325,7 +325,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
|
||||
return PTR_ERR(kern_buf);
|
||||
|
||||
rc = sscanf(kern_buf, "%x:%x", &addr, &len);
|
||||
if (rc < 2) {
|
||||
if (rc < 2 || len > UINT_MAX >> 2) {
|
||||
netdev_warn(bnad->netdev, "failed to read user buffer\n");
|
||||
kfree(kern_buf);
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user