From patchwork Tue Dec 6 19:49:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 9463275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 936F46022E for ; Tue, 6 Dec 2016 21:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84DE5284C3 for ; Tue, 6 Dec 2016 21:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7959B284E4; Tue, 6 Dec 2016 21:04:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEDA3284C3 for ; Tue, 6 Dec 2016 21:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbcLFVEF (ORCPT ); Tue, 6 Dec 2016 16:04:05 -0500 Received: from smtp.opengridcomputing.com ([72.48.136.20]:55662 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbcLFVEE (ORCPT ); Tue, 6 Dec 2016 16:04:04 -0500 Received: from smtp.ogc.us (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id 9AA7722EB5; Tue, 6 Dec 2016 15:04:03 -0600 (CST) Received: by smtp.ogc.us (Postfix, from userid 503) id 71E59E08C5; Tue, 6 Dec 2016 15:04:03 -0600 (CST) From: Steve Wise Date: Tue, 6 Dec 2016 11:49:32 -0800 Subject: [PATCH] libcxgb4: set *bad_wr in post_send/recv error paths To: dledford@redhat.com, leon@kernel.org Cc: linux-rdma@vger.kernel.org Message-Id: <20161206210403.71E59E08C5@smtp.ogc.us> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Steve Wise Reviewed-by: Yuval Shaia --- providers/cxgb4/qp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/providers/cxgb4/qp.c b/providers/cxgb4/qp.c index 376a00a..3b448dd 100644 --- a/providers/cxgb4/qp.c +++ b/providers/cxgb4/qp.c @@ -303,11 +303,13 @@ int c4iw_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, pthread_spin_lock(&qhp->lock); if (t4_wq_in_error(&qhp->wq)) { pthread_spin_unlock(&qhp->lock); + *bad_wr = wr; return -EINVAL; } num_wrs = t4_sq_avail(&qhp->wq); if (num_wrs == 0) { pthread_spin_unlock(&qhp->lock); + *bad_wr = wr; return -ENOMEM; } while (wr) { @@ -403,12 +405,14 @@ int c4iw_post_receive(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, pthread_spin_lock(&qhp->lock); if (t4_wq_in_error(&qhp->wq)) { pthread_spin_unlock(&qhp->lock); + *bad_wr = wr; return -EINVAL; } INC_STAT(recv); num_wrs = t4_rq_avail(&qhp->wq); if (num_wrs == 0) { pthread_spin_unlock(&qhp->lock); + *bad_wr = wr; return -ENOMEM; } while (wr) {