]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
usb: mtu3: fix memory corruption in mtu3_debugfs_regset()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 3 Dec 2020 08:41:13 +0000 (11:41 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Jan 2021 13:25:28 +0000 (14:25 +0100)
BugLink: https://bugs.launchpad.net/bugs/1910822
commit 3f6f6343a29d9ea7429306b83b18e66dc1331d5c 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: ae07809255d3 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/usb/mtu3/mtu3_debugfs.c

index c96e5dab0a480fea8a8fb8e6ad17c69e50b71a6d..25b9635b60bb7f71f3504c45fd1249c33cebf6ae 100644 (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;