]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mdesc: fix a missing-check bug in get_vdev_port_node_info()
authorGen Zhang <blackgod016574@gmail.com>
Fri, 31 May 2019 01:24:18 +0000 (09:24 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838824
[ Upstream commit 80caf43549e7e41a695c6d1e11066286538b336f ]

In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated
by kstrdup_const(), and it returns NULL when fails. So
'node_info->vdev_port.name' should be checked.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/sparc/kernel/mdesc.c

index 418592a09b411f6cac770ef8f16d807d81d3c3b6..0a7ce252aadd52a9e44210893e64b25ca6619c85 100644 (file)
@@ -356,6 +356,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node,
 
        node_info->vdev_port.id = *idp;
        node_info->vdev_port.name = kstrdup_const(name, GFP_KERNEL);
+       if (!node_info->vdev_port.name)
+               return -1;
        node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp;
 
        return 0;