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

Commit 674fce59 authored by Liang He's avatar Liang He Committed by Greg Kroah-Hartman
Browse files

ethernet: sun: add check for the mdesc_grab()



[ Upstream commit 90de546d9a0b3c771667af18bb3f80567eabb89b ]

In vnet_port_probe() and vsw_port_probe(), we should
check the return value of mdesc_grab() as it may
return NULL which can caused NPD bugs.

Fixes: 5d01fa0c ("ldmvsw: Add ldmvsw.c driver code")
Fixes: 43fdf274 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.")
Signed-off-by: default avatarLiang He <windhl@126.com>
Reviewed-by: default avatarPiotr Raczynski <piotr.raczynski@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 71da5991
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -290,6 +290,9 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)

	hp = mdesc_grab();

	if (!hp)
		return -ENODEV;

	rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len);
	err = -ENODEV;
	if (!rmac) {
+3 −0
Original line number Diff line number Diff line
@@ -431,6 +431,9 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)

	hp = mdesc_grab();

	if (!hp)
		return -ENODEV;

	vp = vnet_find_parent(hp, vdev->mp, vdev);
	if (IS_ERR(vp)) {
		pr_err("Cannot find port parent vnet\n");