]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sif: sif_eq: fix missing qp->refcnt decrement for COMM_EST events
authorFrancisco Triviño <francisco.trivino@oracle.com>
Wed, 13 Jul 2016 15:23:40 +0000 (17:23 +0200)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 27 Jul 2016 17:24:21 +0000 (10:24 -0700)
qp->refcnt is increased by 1 when event_status_communication_established
is dispatched but later it is not decremented when handling the event
work for IB_EVENT_COMM_EST for UD & RAW QP types.

This commit decrements qp->refcnt for those cases too and fixes another
potential bug by moving the sif_log line up before the qp->refcnt
decrement.

Orabug: 24288467

Signed-off-by: Francisco Triviño <francisco.trivino@oracle.com>
Reviewed-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Knut Omang <knut.omang@oracle.com>
drivers/infiniband/hw/sif/sif_eq.c

index 3c0f05c4537f75006102bf55b160b974df2c3474..b8fe6723776c88266a1f515381fef133f2d9ab33 100644 (file)
@@ -666,19 +666,23 @@ static void handle_event_work(struct work_struct *work)
                        || (ibqp->qp_type == IB_QPT_UD)
                        || (ibqp->qp_type == IB_QPT_RAW_IPV6)
                        || (ibqp->qp_type == IB_QPT_RAW_ETHERTYPE)
-                       || (ibqp->qp_type == IB_QPT_RAW_PACKET)))
+                       || (ibqp->qp_type == IB_QPT_RAW_PACKET))) {
+                       if (atomic_dec_and_test(&qp->refcnt))
+                               complete(&qp->can_destroy);
                        break;
+               }
 
-               if (ibqp->event_handler)
+               if (ibqp->event_handler) {
                        ibqp->event_handler(&ew->ibe, ibqp->qp_context);
+               } else {
+                       sif_log(sdev, SIF_INFO,
+                               "Unhandled event of type %s received, qp %d",
+                               ib_event2str(ew->ibe.event), qp->qp_idx);
+               }
 
                if (atomic_dec_and_test(&qp->refcnt))
                        complete(&qp->can_destroy);
 
-               if (!ibqp->event_handler)
-                       sif_log(sdev, SIF_INFO,
-                               "Unhandled event of type %s received, qp %d",
-                               ib_event2str(ew->ibe.event), qp->qp_idx);
                break;
        }
        case IB_EVENT_LID_CHANGE: