Received: by 10.223.185.116 with SMTP id b49csp1010261wrg; Wed, 21 Feb 2018 10:30:48 -0800 (PST) X-Google-Smtp-Source: AH8x226mTdkklMUmH8JLYh6aMGV/McVySWLT/ugJjZGAYb21nIHowT4akr9hqOtzRCn6vF78Qu7V X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr3970526plz.287.1519237848290; Wed, 21 Feb 2018 10:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519237848; cv=none; d=google.com; s=arc-20160816; b=BC81Dv+gyyqVvp8qXjm3RhItPZULJMOK+kLxokBZJSmiylIIhedntHhvB1Nc9Q8MiS wICJkf3d0rDMOfr4juXohkO5NBt2X56UOaZPp2ks90scTUtBof9TfNE5dGNJmqRpi5eE l+RNCyH9mU21rLd38kZ+NLNA8gKhP3lrmtGixIyTUxeB/7pLBQRwW3G3U9GnBjhRMTfy WAWSkdMYGR8BynDWyd9eKATeL52mJ0JqLVwQskpLu3vRfVKVRCRcNs7gYaFVZMF3j0v6 H4OP02dGwKXl5BrjlEcYN8sKV8WzdlMuYl9y6Y1E6u+OvQCOZqm5Ri4tbibePPZp0iu0 Lf5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GHypiwLnCgPFOT46eCdHFttLU8IfJYMh0nQz3q5Iohg=; b=GIvjndVH+bA9ulVOBhH32d+96jJFYpXnBzuEF1VKxdu5AhvkS+X13cIkFAQWf7dZBs uv1oZqEZyMHUSCiKBUsbaa+GoMDrG/Z72Prk5D0Wjr1VeEJoYYZcTX52J7YEocRTA3Tp LszZSIF1LBya/WMZ9YPrvUkAwzKiqbEleP65YOXVsl8fmgcJd7r3CqYK28zfERRJk9ct qsElw8Jf31nvtOu8MbscI+u7bgGXCsGhZ7xhvFUO0BzaBMVBQX1BaCwY25Lg5nr9pIQy YyRvgFyPhtKoWW8L+d6vHOt+kia6ydvt6Fx0axNOSGgdZU5TSUHSWfZsaaIikUyhmAHc bJZw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v186si3271097pfb.284.2018.02.21.10.30.33; Wed, 21 Feb 2018 10:30:48 -0800 (PST) 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 S964909AbeBUNFz (ORCPT + 99 others); Wed, 21 Feb 2018 08:05:55 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40472 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964883AbeBUNFx (ORCPT ); Wed, 21 Feb 2018 08:05:53 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 14AA211CE; Wed, 21 Feb 2018 13:05:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Moni Shoua , Doug Ledford Subject: [PATCH 4.15 010/163] RDMA/rxe: Fix a race condition related to the QP error state Date: Wed, 21 Feb 2018 13:47:19 +0100 Message-Id: <20180221124530.563520274@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche commit 6f301e06de4cf9ab7303f5acd43e64fcd4aa04be upstream. The following sequence: * Change queue pair state into IB_QPS_ERR. * Post a work request on the queue pair. Triggers the following race condition in the rdma_rxe driver: * rxe_qp_error() triggers an asynchronous call of rxe_completer(), the function that examines the QP send queue. * rxe_post_send() posts a work request on the QP send queue. If rxe_completer() runs prior to rxe_post_send(), it will drain the send queue and the driver will assume no further action is necessary. However, once we post the send to the send queue, because the queue is in error, no send completion will ever happen and the send will get stuck. In order to process the send, we need to make sure that rxe_completer() gets run after a send is posted to a queue pair in an error state. This patch ensures that happens. Signed-off-by: Bart Van Assche Cc: Moni Shoua Cc: # v4.8 Signed-off-by: Doug Ledford Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -814,6 +814,8 @@ static int rxe_post_send_kernel(struct r (queue_count(qp->sq.queue) > 1); rxe_run_task(&qp->req.task, must_sched); + if (unlikely(qp->req.state == QP_STATE_ERROR)) + rxe_run_task(&qp->comp.task, 1); return err; }