Skip to content

Commit 90de546

Browse files
windhldavem330
authored andcommitted
ethernet: sun: add check for the mdesc_grab()
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: 5d01fa0 ("ldmvsw: Add ldmvsw.c driver code") Fixes: 43fdf27 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.") Signed-off-by: Liang He <[email protected]> Reviewed-by: Piotr Raczynski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0c98b8b commit 90de546

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/net/ethernet/sun/ldmvsw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
287287

288288
hp = mdesc_grab();
289289

290+
if (!hp)
291+
return -ENODEV;
292+
290293
rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len);
291294
err = -ENODEV;
292295
if (!rmac) {

drivers/net/ethernet/sun/sunvnet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
433433

434434
hp = mdesc_grab();
435435

436+
if (!hp)
437+
return -ENODEV;
438+
436439
vp = vnet_find_parent(hp, vdev->mp, vdev);
437440
if (IS_ERR(vp)) {
438441
pr_err("Cannot find port parent vnet\n");

0 commit comments

Comments
 (0)