提交 90de546d 编写于 作者: L Liang He 提交者: David S. Miller

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: 5d01fa0c ("ldmvsw: Add ldmvsw.c driver code")
Fixes: 43fdf274 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.")
Signed-off-by: NLiang He <windhl@126.com>
Reviewed-by: NPiotr Raczynski <piotr.raczynski@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0c98b8bc
...@@ -287,6 +287,9 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) ...@@ -287,6 +287,9 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
hp = mdesc_grab(); hp = mdesc_grab();
if (!hp)
return -ENODEV;
rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len); rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len);
err = -ENODEV; err = -ENODEV;
if (!rmac) { if (!rmac) {
......
...@@ -433,6 +433,9 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) ...@@ -433,6 +433,9 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
hp = mdesc_grab(); hp = mdesc_grab();
if (!hp)
return -ENODEV;
vp = vnet_find_parent(hp, vdev->mp, vdev); vp = vnet_find_parent(hp, vdev->mp, vdev);
if (IS_ERR(vp)) { if (IS_ERR(vp)) {
pr_err("Cannot find port parent vnet\n"); pr_err("Cannot find port parent vnet\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册