svn commit: r320590 - projects/bsd_rdma_4_9/sys/ofed/drivers/infiniband/core

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jul 3 08:29:51 UTC 2017


Author: hselasky
Date: Mon Jul  3 08:29:49 2017
New Revision: 320590
URL: https://svnweb.freebsd.org/changeset/base/320590

Log:
  ibcore: Fix for accessing invalid network device.
  
  Sponsored by:	Mellanox Technologies

Modified:
  projects/bsd_rdma_4_9/sys/ofed/drivers/infiniband/core/ib_cache.c

Modified: projects/bsd_rdma_4_9/sys/ofed/drivers/infiniband/core/ib_cache.c
==============================================================================
--- projects/bsd_rdma_4_9/sys/ofed/drivers/infiniband/core/ib_cache.c	Mon Jul  3 08:28:35 2017	(r320589)
+++ projects/bsd_rdma_4_9/sys/ofed/drivers/infiniband/core/ib_cache.c	Mon Jul  3 08:29:49 2017	(r320590)
@@ -455,8 +455,13 @@ static int __ib_cache_gid_get(struct ib_device *ib_dev
 	memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
 	if (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);
+		else
+			attr->ndev = NULL;
 	}
 
 	return 0;


More information about the svn-src-projects mailing list