ibcore: Fix for accessing invalid network device.
Sponsored by: Mellanox Technologies
This commit is contained in:
parent
ddc6ee3792
commit
0faccd643c
@ -455,8 +455,13 @@ static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
|
|||||||
memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
|
memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
|
||||||
if (attr) {
|
if (attr) {
|
||||||
memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
|
memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
|
||||||
if (attr->ndev)
|
/* make sure network device is valid and attached */
|
||||||
|
if (attr->ndev != NULL &&
|
||||||
|
(attr->ndev->if_flags & IFF_DYING) == 0 &&
|
||||||
|
attr->ndev->if_addr != NULL)
|
||||||
dev_hold(attr->ndev);
|
dev_hold(attr->ndev);
|
||||||
|
else
|
||||||
|
attr->ndev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user