OSDN Git Service

RDMA/ucma: Check that device is connected prior to access it
[uclinux-h8/linux.git] / drivers / infiniband / core / ucma.c
index 60449d6..0811f58 100644 (file)
@@ -1166,6 +1166,11 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
        if (IS_ERR(ctx))
                return PTR_ERR(ctx);
 
+       if (!ctx->cm_id->device) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        resp.qp_attr_mask = 0;
        memset(&qp_attr, 0, sizeof qp_attr);
        qp_attr.qp_state = cmd.qp_state;