Skip to content

Commit 80caf43

Browse files
zhanggenexdavem330
authored andcommitted
mdesc: fix a missing-check bug in get_vdev_port_node_info()
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>
1 parent d3c976c commit 80caf43

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/sparc/kernel/mdesc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node,
356356

357357
node_info->vdev_port.id = *idp;
358358
node_info->vdev_port.name = kstrdup_const(name, GFP_KERNEL);
359+
if (!node_info->vdev_port.name)
360+
return -1;
359361
node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp;
360362

361363
return 0;

0 commit comments

Comments
 (0)