]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
authorXiaolong Huang <butterflyhuangxx@gmail.com>
Sat, 7 Dec 2019 14:40:24 +0000 (22:40 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 14:16:54 +0000 (08:16 -0600)
BugLink: https://bugs.launchpad.net/bugs/1858428
commit da2311a6385c3b499da2ed5d9be59ce331fa93e9 upstream.

Uninitialized Kernel memory can leak to USB devices.

Fix this by using kzalloc() instead of kmalloc().

Signed-off-by: Xiaolong Huang <butterflyhuangxx@gmail.com>
Fixes: 7259124eac7d ("can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c")
Cc: linux-stable <stable@vger.kernel.org> # >= v4.19
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c

index 07d2f3aa2c026c99e0358266ff781e8d893c75a5..ae4c37e1bb753ecd8e2cc01320c9f7797f7868c9 100644 (file)
@@ -608,7 +608,7 @@ static int kvaser_usb_leaf_simple_cmd_async(struct kvaser_usb_net_priv *priv,
        struct kvaser_cmd *cmd;
        int err;
 
-       cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+       cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
        if (!cmd)
                return -ENOMEM;
 
@@ -1140,7 +1140,7 @@ static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv)
        struct kvaser_cmd *cmd;
        int rc;
 
-       cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
        if (!cmd)
                return -ENOMEM;
 
@@ -1206,7 +1206,7 @@ static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv)
        struct kvaser_cmd *cmd;
        int rc;
 
-       cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
        if (!cmd)
                return -ENOMEM;