Received: by 10.223.185.116 with SMTP id b49csp972551wrg; Wed, 21 Feb 2018 09:54:36 -0800 (PST) X-Google-Smtp-Source: AH8x2246FHCgpx2/lh17laLjQzSYo1LU8lPObzKLz5QJVSLhHko9f0JJgH7x5vPTYQN5p1rBhzMs X-Received: by 2002:a17:902:d20a:: with SMTP id t10-v6mr790025ply.257.1519235676113; Wed, 21 Feb 2018 09:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519235676; cv=none; d=google.com; s=arc-20160816; b=kpMhIGCBx+DeSYHlicH4xkP9Q3OkgS4HKDyYSy137KNll9Co1oviDLvo6//KXGTm3y 6vB1a6wsRo9s22koWGx+9qpGv3IKQzd96MMPgGs9/m2thOne0MJVYvNVBCLFW3in9aHL oZvTyXJOdanjYCxDsyz958iYk6wwBMnRMAKRhgd/5Hysvt4Hk2W5cq709+G3N2T2i1g8 e20DZm8SpwFSKxKDhM/4cxrOgKCrX/6FsRmXf/BYopJfSd5cGbcrz8PG/g3/69I0Y+sb SaerQQvR6GgiKJ8Fee3cpMBr+OvaBQdvL19FnuEkqc3hFlYj9h6Y3t4gAi5yRsGYonoK FFWw== 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=wj1Vy4FBQahwvnhyqEn5pBg4WyLq8uaXNJFzK5NWjj4=; b=NutfWYbpyeJSf4MRS+zYyoJC2QUD8Ij8ckpvelQDUQ6FMh7UlBRI2S8Pg/+83rinEj vpAEMIrXx4EkY/u/Jf2AQANy5Y+GtkpJ2AZIPkm04ccL8yg7P1gvugTik3XFjH5g/JlZ BCngv8hBn7slzttn57PzigJCxuKQBm8HmMy+TvcnwRGhlUOq47/DIVH60PLyUzUpPwar U/MQA8de8Q+3CF6WoPWWw0+CVTg7mD1Y/QhaOGfdl+pFNL75pwyuBO7CTEXYXcumEFfk 00o1a0VhYZiHJ0Sf7gQcDZIWUb19Hbw1XF+V3LW9fX0Xv2Xi7Lck/NEuGVZue+tXJVS5 2xzg== 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 a10si74964pgq.154.2018.02.21.09.54.21; Wed, 21 Feb 2018 09:54:36 -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 S934357AbeBUMzq (ORCPT + 99 others); Wed, 21 Feb 2018 07:55:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34520 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934341AbeBUMzn (ORCPT ); Wed, 21 Feb 2018 07:55:43 -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 E49A51180; Wed, 21 Feb 2018 12:55:42 +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.9 38/77] RDMA/rxe: Fix a race condition related to the QP error state Date: Wed, 21 Feb 2018 13:48:47 +0100 Message-Id: <20180221124433.780975956@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@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.9-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 @@ -848,6 +848,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; }