Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80caf435 authored by Gen Zhang's avatar Gen Zhang Committed by David S. Miller
Browse files

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: default avatarGen Zhang <blackgod016574@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3c976c1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;