1
0
Fork 0

usb: mtu3: fix memory corruption in mtu3_debugfs_regset()

commit 3f6f6343a2 upstream.

This code is using the wrong sizeof() so it does not allocate enough
memory.  It allocates 32 bytes but 72 are required.  That will lead to
memory corruption.

Fixes: ae07809255 ("usb: mtu3: add debugfs interface files")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X8ikqc4Mo2/0G72j@mwanda
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5.4-rM2-2.2.x-imx-squashed
Dan Carpenter 2020-12-03 11:41:13 +03:00 committed by Greg Kroah-Hartman
parent 80cb945070
commit 57e22590c4
1 changed files with 1 additions and 1 deletions

View File

@ -127,7 +127,7 @@ static void mtu3_debugfs_regset(struct mtu3 *mtu, void __iomem *base,
struct debugfs_regset32 *regset;
struct mtu3_regset *mregs;
mregs = devm_kzalloc(mtu->dev, sizeof(*regset), GFP_KERNEL);
mregs = devm_kzalloc(mtu->dev, sizeof(*mregs), GFP_KERNEL);
if (!mregs)
return;