Commit c5540a01 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/rxe: Fix an skb leak

Additionally, make it easier to detect skb leaks by issuing a warning
if a leak occurs.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Cc: Andrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 839f5ac0
...@@ -630,6 +630,7 @@ int rxe_completer(void *arg) ...@@ -630,6 +630,7 @@ int rxe_completer(void *arg)
if (pkt) { if (pkt) {
rxe_drop_ref(pkt->qp); rxe_drop_ref(pkt->qp);
kfree_skb(skb); kfree_skb(skb);
skb = NULL;
} }
goto done; goto done;
...@@ -653,6 +654,7 @@ int rxe_completer(void *arg) ...@@ -653,6 +654,7 @@ int rxe_completer(void *arg)
qp->qp_timeout_jiffies) qp->qp_timeout_jiffies)
mod_timer(&qp->retrans_timer, mod_timer(&qp->retrans_timer,
jiffies + qp->qp_timeout_jiffies); jiffies + qp->qp_timeout_jiffies);
WARN_ON_ONCE(skb);
goto exit; goto exit;
case COMPST_ERROR_RETRY: case COMPST_ERROR_RETRY:
...@@ -665,8 +667,10 @@ int rxe_completer(void *arg) ...@@ -665,8 +667,10 @@ int rxe_completer(void *arg)
*/ */
/* there is nothing to retry in this case */ /* there is nothing to retry in this case */
if (!wqe || (wqe->state == wqe_state_posted)) if (!wqe || (wqe->state == wqe_state_posted)) {
WARN_ON_ONCE(skb);
goto exit; goto exit;
}
if (qp->comp.retry_cnt > 0) { if (qp->comp.retry_cnt > 0) {
if (qp->comp.retry_cnt != 7) if (qp->comp.retry_cnt != 7)
...@@ -688,8 +692,10 @@ int rxe_completer(void *arg) ...@@ -688,8 +692,10 @@ int rxe_completer(void *arg)
if (pkt) { if (pkt) {
rxe_drop_ref(pkt->qp); rxe_drop_ref(pkt->qp);
kfree_skb(skb); kfree_skb(skb);
skb = NULL;
} }
WARN_ON_ONCE(skb);
goto exit; goto exit;
} else { } else {
...@@ -709,6 +715,9 @@ int rxe_completer(void *arg) ...@@ -709,6 +715,9 @@ int rxe_completer(void *arg)
mod_timer(&qp->rnr_nak_timer, mod_timer(&qp->rnr_nak_timer,
jiffies + rnrnak_jiffies(aeth_syn(pkt) jiffies + rnrnak_jiffies(aeth_syn(pkt)
& ~AETH_TYPE_MASK)); & ~AETH_TYPE_MASK));
rxe_drop_ref(pkt->qp);
kfree_skb(skb);
skb = NULL;
goto exit; goto exit;
} else { } else {
wqe->status = IB_WC_RNR_RETRY_EXC_ERR; wqe->status = IB_WC_RNR_RETRY_EXC_ERR;
...@@ -724,8 +733,10 @@ int rxe_completer(void *arg) ...@@ -724,8 +733,10 @@ int rxe_completer(void *arg)
if (pkt) { if (pkt) {
rxe_drop_ref(pkt->qp); rxe_drop_ref(pkt->qp);
kfree_skb(skb); kfree_skb(skb);
skb = NULL;
} }
WARN_ON_ONCE(skb);
goto exit; goto exit;
} }
} }
...@@ -734,6 +745,7 @@ int rxe_completer(void *arg) ...@@ -734,6 +745,7 @@ int rxe_completer(void *arg)
/* we come here if we are done with processing and want the task to /* we come here if we are done with processing and want the task to
* exit from the loop calling us * exit from the loop calling us
*/ */
WARN_ON_ONCE(skb);
rxe_drop_ref(qp); rxe_drop_ref(qp);
return -EAGAIN; return -EAGAIN;
...@@ -741,6 +753,7 @@ int rxe_completer(void *arg) ...@@ -741,6 +753,7 @@ int rxe_completer(void *arg)
/* we come here if we have processed a packet we want the task to call /* we come here if we have processed a packet we want the task to call
* us again to see if there is anything else to do * us again to see if there is anything else to do
*/ */
WARN_ON_ONCE(skb);
rxe_drop_ref(qp); rxe_drop_ref(qp);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment