]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iw_cxgb4: set *bad_wr for post_send/post_recv errors
authorSteve Wise <swise@opengridcomputing.com>
Tue, 18 Oct 2016 21:04:39 +0000 (14:04 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 17 Nov 2016 01:10:36 +0000 (20:10 -0500)
There are a few cases in c4iw_post_send() and c4iw_post_receive()
where *bad_wr is not set when an error is returned.  This can
cause a crash if the application tries to use bad_wr.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/cxgb4/qp.c

index f57deba6717ce69d08b12842ea7ff5fa8514c67a..5790e1dbd618cb9530cabf82855e5f7ff1b80b1a 100644 (file)
@@ -797,11 +797,13 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
        spin_lock_irqsave(&qhp->lock, flag);
        if (t4_wq_in_error(&qhp->wq)) {
                spin_unlock_irqrestore(&qhp->lock, flag);
+               *bad_wr = wr;
                return -EINVAL;
        }
        num_wrs = t4_sq_avail(&qhp->wq);
        if (num_wrs == 0) {
                spin_unlock_irqrestore(&qhp->lock, flag);
+               *bad_wr = wr;
                return -ENOMEM;
        }
        while (wr) {
@@ -934,11 +936,13 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
        spin_lock_irqsave(&qhp->lock, flag);
        if (t4_wq_in_error(&qhp->wq)) {
                spin_unlock_irqrestore(&qhp->lock, flag);
+               *bad_wr = wr;
                return -EINVAL;
        }
        num_wrs = t4_rq_avail(&qhp->wq);
        if (num_wrs == 0) {
                spin_unlock_irqrestore(&qhp->lock, flag);
+               *bad_wr = wr;
                return -ENOMEM;
        }
        while (wr) {