[MTHCA] mthca_provider.c - prevent dereference of <NULL> mdev or mdev->ext
[mirror/winof/.git] / hw / mthca / kernel / mthca_provider.c
index 817ccec..7332bf9 100644 (file)
@@ -71,6 +71,8 @@ int mthca_query_device(struct ib_device *ibdev,
 \r
        if (mthca_is_livefish(mdev)) {\r
                props->max_pd = 1;\r
+               if ( !mdev || !mdev->ext )\r
+                       return err;\r
                props->vendor_id = mdev->ext->hcaConfig.VendorID;\r
                props->vendor_part_id = mdev->ext->hcaConfig.DeviceID;\r
                return 0;\r