From patchwork Mon Sep 19 11:57:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101767 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp920575qgf; Mon, 19 Sep 2016 04:59:03 -0700 (PDT) X-Received: by 10.66.190.161 with SMTP id gr1mr45669502pac.156.1474286343625; Mon, 19 Sep 2016 04:59:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q68si63782310pfq.104.2016.09.19.04.59.03; Mon, 19 Sep 2016 04:59:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756905AbcISL7A (ORCPT + 27 others); Mon, 19 Sep 2016 07:59:00 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:50608 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbcISL6u (ORCPT ); Mon, 19 Sep 2016 07:58:50 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0M09s4-1arfCb1Tci-00uLDn; Mon, 19 Sep 2016 13:58:29 +0200 From: Arnd Bergmann To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Arnd Bergmann , Moni Shoua , Yonatan Cohen , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/rxe: avoid putting a large struct rxe_qp on stack Date: Mon, 19 Sep 2016 13:57:26 +0200 Message-Id: <20160919115826.553858-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:2jaO6kJn/dKuTYRs5vrSuz+sxjesz27sXda8zMNXtD+tlMu7STa 5H7blhWqELg3CqnARFabtlTIPW/A0+r8SBSN/QI7Vd3qa9i1MSLkK9bZf9oJpbIq+PRUvrV QN3SK7jMrVN0KpFXMmT23k5Z8J0Se9tnthE889tIGt5aIaUorduhz4b1CF97/NP7wesxwA6 f26NeKCefvCdlhhmTMNcQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:e02GWVG2wlw=:e8iT82Uh8BBp0e7YPMjEJ4 kRLrEZnCLWGOwrIZWkQ4MeIVJE7xHC/lF9Ytsq05JOJsDUx0KYx6hjNq/UMu29X69yyf9K7Lx 2wj8XSqIM1CprQt0YPAGTwiZG1/WP3LxXofpr5WwMkWRxtDp94FNqMi65zi8CTxhgKdYb/eOX qm92oKqDd85qCeBNHCRFoCnObiDGYHAEskcEO1ou1RiPUvDOF9TlEORtQp/XUfc2QSlRXnp3S GICL+3a+8/n7LTVfmSqe3UadnD73sMKIteUABlCBg3yYC8OdHK336JgmVxNOxmpprhGUVSJJb SJMTmcInsKIcq58zNVbKtV7sD4qbym88UuOFu5qBxeBvZkPoVaeQilzt7DK5w+Jlm8l24F0Xr W5UdTxo2GXTzBBli4v5Z3UaOxJhX2CZp8eu/hJfNZkinh1krUNml7d7lbK3l2TiXFIxXK7Pi9 p26sk9H0FzExZdbBaHs5mCEI+/ym+720/07Yo572oCgjYN897ujNhVPR09a1/aoMiONoVDXi6 eRqumCM6X5sCKgaP4QCs7i0cb4QlUKCHaEVWwJrfTgXR42HLxpIkJ4zO30/a/SX+5dJBVMwNn c6XpTlBkjwI6Q8r3EXHPT5PZMvEo1Y6AxqQciwWRdkQ2QaT2WRZNiI6las0t0lU7/rhW692hs HNWbW1OnoU3BFlbfxlVTe+Vze25A8VohGcQueE7s/fiY5BvKrTQLM690Zl9F5vBAQ/cM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A race condition fix added an rxe_qp structure to the stack in order to be able to perform rollback in rxe_requester(), but the structure is large enough to trigger the warning for possible stack overflow: drivers/infiniband/sw/rxe/rxe_req.c: In function 'rxe_requester': drivers/infiniband/sw/rxe/rxe_req.c:757:1: error: the frame size of 2064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] This changes the rollback function to only save the psn inside the qp, which is the only field we access in the rollback_qp anyway. Fixes: 3050b9985024 ("IB/rxe: Fix race condition between requester and completer") Signed-off-by: Arnd Bergmann --- drivers/infiniband/sw/rxe/rxe_req.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.9.0 diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 13a848a518e8..cf1ffac25585 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -548,23 +548,23 @@ static void update_wqe_psn(struct rxe_qp *qp, static void save_state(struct rxe_send_wqe *wqe, struct rxe_qp *qp, struct rxe_send_wqe *rollback_wqe, - struct rxe_qp *rollback_qp) + u32 *rollback_psn) { rollback_wqe->state = wqe->state; rollback_wqe->first_psn = wqe->first_psn; rollback_wqe->last_psn = wqe->last_psn; - rollback_qp->req.psn = qp->req.psn; + *rollback_psn = qp->req.psn; } static void rollback_state(struct rxe_send_wqe *wqe, struct rxe_qp *qp, struct rxe_send_wqe *rollback_wqe, - struct rxe_qp *rollback_qp) + u32 rollback_psn) { wqe->state = rollback_wqe->state; wqe->first_psn = rollback_wqe->first_psn; wqe->last_psn = rollback_wqe->last_psn; - qp->req.psn = rollback_qp->req.psn; + qp->req.psn = rollback_psn; } static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, @@ -593,8 +593,8 @@ int rxe_requester(void *arg) int mtu; int opcode; int ret; - struct rxe_qp rollback_qp; struct rxe_send_wqe rollback_wqe; + u32 rollback_psn; next_wqe: if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) @@ -717,7 +717,7 @@ int rxe_requester(void *arg) * rxe_xmit_packet(). * Otherwise, completer might initiate an unjustified retry flow. */ - save_state(wqe, qp, &rollback_wqe, &rollback_qp); + save_state(wqe, qp, &rollback_wqe, &rollback_psn); update_wqe_state(qp, wqe, &pkt); update_wqe_psn(qp, wqe, &pkt, payload); ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); @@ -725,7 +725,7 @@ int rxe_requester(void *arg) qp->need_req_skb = 1; kfree_skb(skb); - rollback_state(wqe, qp, &rollback_wqe, &rollback_qp); + rollback_state(wqe, qp, &rollback_wqe, rollback_psn); if (ret == -EAGAIN) { rxe_run_task(&qp->req.task, 1);