aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGen Zhang <blackgod016574@gmail.com>2019-05-31 09:24:18 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-25 11:35:57 +0800
commit7b460a9bb13db3f442f153c2ab8a9ff8520c368c (patch)
tree2db7554e865799641034e78a2b4332249ef6060e
parent6bf97a6cb6ce3903ab50f072ff3552a80a5b32da (diff)
downloadlinux-yocto-7b460a9bb13db3f442f153c2ab8a9ff8520c368c.tar.gz
linux-yocto-7b460a9bb13db3f442f153c2ab8a9ff8520c368c.tar.bz2
linux-yocto-7b460a9bb13db3f442f153c2ab8a9ff8520c368c.zip
mdesc: fix a missing-check bug in get_vdev_port_node_info()
[ 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>
-rw-r--r--arch/sparc/kernel/mdesc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 39a2503fa3e1..51028abe5e90 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -357,6 +357,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;