Received: by 10.223.185.116 with SMTP id b49csp973499wrg; Wed, 21 Feb 2018 09:55:43 -0800 (PST) X-Google-Smtp-Source: AH8x226aUGwBOUXp7Axya6CLtMManwxQVKTuZ8yBF1/gpotSPOMzoPCtecIIb9cKxzswtSv7kb5x X-Received: by 2002:a17:902:7486:: with SMTP id h6-v6mr3845102pll.216.1519235743861; Wed, 21 Feb 2018 09:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519235743; cv=none; d=google.com; s=arc-20160816; b=BQY/MfBJZa6uASLXaPRZbClhXlCVyPRJbRe7uE7arbV1Gha086ipGLUNmYqT5qjTjD 7CiIqWrVVrF5qRoXMWlbmUElRnaS6PVjmv77QOCBGNoZFZZhePhBM7FO6iCSO1ohS/N4 Ua5aQPE+uLSDscsXL1RWnk+pxPlz4lVXCKnSyb2W91uSvIXVwdVO+Nd0rOeTL4/VfSYi /CFwLGELjeZCJ2ZkjiZWa5ZtwetbpY54Sj82zFGGjzLQCpj7qcIJ7Y+0oC66k/flhZ3v 6i1rdtnC62wvO6sNWSESRmuXapHPJrMteOnqJySsHCzq0CaEskeQ/YBgzu7nPfB+zN3w 8TOA== 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=GuVvlr9w7oxZ/d619Jg1gzqBgfg2J3sSYuLnsnuoFrY=; b=ni53Wg9NcSjo3QWyylN1X889GMWjISqM2MKoEFfc6RxDdOjoD4YCTaph9JFPyiNo/Y AMwm/6CjJWr1/M8q/i4/8Gu1OK9u75YpSQHV9Y+0tlYIw5ubishC98smdx6kGBDVvWG0 2Z/xxjKiBb62QY+PjLfisJVv40H6Q+sAH3tes+ZSYIEF/l8lqhgk1XeKxcAWXAitknbw yo/vdL8FOyGpoKLydOcYXk//Oyy0LWetcVWFneRk36ju4bmX1xNvQcg59sTyKFvBVXrM YQBGBeLq4+cYDcjwaZ0ISJjjERu1zWgfiWubtk9bb7zNIPGJgIOEOtlvEnC7toXHgtEx Y36g== 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 k6-v6si9237151pla.333.2018.02.21.09.55.29; Wed, 21 Feb 2018 09:55:43 -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 S934826AbeBUM6D (ORCPT + 99 others); Wed, 21 Feb 2018 07:58:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35988 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934770AbeBUM57 (ORCPT ); Wed, 21 Feb 2018 07:57:59 -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 121B9F64; Wed, 21 Feb 2018 12:57:58 +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.14 011/167] RDMA/rxe: Fix a race condition related to the QP error state Date: Wed, 21 Feb 2018 13:47:02 +0100 Message-Id: <20180221124525.220543030@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@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.14-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 @@ -813,6 +813,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; }