[IB] uverbs: Avoid NULL pointer deref on CQ async event
[deliverable/linux.git] / drivers / infiniband / core / uverbs_main.c
index ac08d2c93ea18c2266c1ce0b089f47f2eb0a8395..e58a7b278a00bf0ae47af52000286b743688e794 100644 (file)
@@ -442,13 +442,10 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
 
 void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr)
 {
-       struct ib_uverbs_event_file *ev_file = context_ptr;
-       struct ib_ucq_object *uobj;
+       struct ib_ucq_object *uobj = container_of(event->element.cq->uobject,
+                                                 struct ib_ucq_object, uobject);
 
-       uobj = container_of(event->element.cq->uobject,
-                           struct ib_ucq_object, uobject);
-
-       ib_uverbs_async_handler(ev_file->uverbs_file, uobj->uobject.user_handle,
+       ib_uverbs_async_handler(uobj->uverbs_file, uobj->uobject.user_handle,
                                event->event, &uobj->async_list,
                                &uobj->async_events_reported);
                                
@@ -757,7 +754,8 @@ static void ib_uverbs_add_one(struct ib_device *device)
        if (cdev_add(uverbs_dev->dev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1))
                goto err_cdev;
 
-       uverbs_dev->class_dev = class_device_create(uverbs_class, uverbs_dev->dev->dev,
+       uverbs_dev->class_dev = class_device_create(uverbs_class, NULL,
+                                                   uverbs_dev->dev->dev,
                                                    device->dma_device,
                                                    "uverbs%d", uverbs_dev->devnum);
        if (IS_ERR(uverbs_dev->class_dev))
This page took 0.028422 seconds and 5 git commands to generate.