Received: by 10.192.165.156 with SMTP id m28csp261167imm; Tue, 17 Apr 2018 09:42:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx48m8KR0kRtcX1drTn8DwbKJ0B4KtPOPsQxEQwGXB9qBmuVAMiDCeptbJwqP9celT4y/bPHf X-Received: by 2002:a17:902:76c7:: with SMTP id j7-v6mr2728789plt.108.1523983338972; Tue, 17 Apr 2018 09:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983338; cv=none; d=google.com; s=arc-20160816; b=k9STHpC8BAnxbU8gxeK8HYkmjBBWWDVNfHQGwsz4dIwr01oPiXFEUMWl10ZEt2rxnM Tf/WkZLDZVtS3i/VKLH1vTrYjMu2hKAyiSJG9z4za1wotVAc6AuxtXirySjicVwuGxfQ bZX6WSuRN0t5FAKechyhrqBbyvM0jZcKXaEQeJ4/N9hZm9PK9ipvVvpDqmvwfkJONOkp kBwrdT+CdDbmGzcY0MOwKr8rKA2EEePfxRBVqMPHEbs7I1X877yQHDu0VP4tnkPAQDYV 7h+HFcoVEVucVdIwiFdHVi14qMnKZiONHlOnDdrBxmUqIozfdvQQPFMZWjmH7Lxl/TQK ejNg== 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=5r7Vc9UhtVpRnQ2jrnh9Xv1+TTjz0HEPmskczH/649o=; b=db4msBgw6TlRyv9o2ouiY1jnOlyl7RN8e8OyF6q4WpkDWiCkWevYvkuZcYmxhy2zLk 2Ezkk2n4FJ85EFMGzOf6muYmJzbhDEA6dZq41HVvTN3hJJHkANqUltrbwkCIBy9XUdVS SgikKfPVeRggrnIDx2jdHzyysIj+Fiqc/UOJD222ONu06RvjxCqfMSJjlRxqKsnLd0Hh u9eLHIti+UTiSsuA1Za3DEVHh17FAVn/Nw5nj9iJDL0POlPDwFq67zpbI5tFfZcxefsv QOuSLCP14CQ2zq2W5jVmw3hR4eTImTki2pUEAPw8Z/f01ja3wiGh6CpjBXnMUfN+CWNc bD/w== 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 s10si12094790pge.41.2018.04.17.09.42.04; Tue, 17 Apr 2018 09:42:18 -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 S1755007AbeDQQGe (ORCPT + 99 others); Tue, 17 Apr 2018 12:06:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34822 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754992AbeDQQGb (ORCPT ); Tue, 17 Apr 2018 12:06:31 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E9719C98; Tue, 17 Apr 2018 16:06:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ka-Cheong Poon , Santosh Shilimkar , "David S. Miller" Subject: [PATCH 4.14 03/49] rds: MP-RDS may use an invalid c_path Date: Tue, 17 Apr 2018 17:58:42 +0200 Message-Id: <20180417155715.190382158@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@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: Ka-Cheong Poon [ Upstream commit a43cced9a348901f9015f4730b70b69e7c41a9c9 ] rds_sendmsg() calls rds_send_mprds_hash() to find a c_path to use to send a message. Suppose the RDS connection is not yet up. In rds_send_mprds_hash(), it does if (conn->c_npaths == 0) wait_event_interruptible(conn->c_hs_waitq, (conn->c_npaths != 0)); If it is interrupted before the connection is set up, rds_send_mprds_hash() will return a non-zero hash value. Hence rds_sendmsg() will use a non-zero c_path to send the message. But if the RDS connection ends up to be non-MP capable, the message will be lost as only the zero c_path can be used. Signed-off-by: Ka-Cheong Poon Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/rds/send.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/net/rds/send.c +++ b/net/rds/send.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Oracle. All rights reserved. + * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -986,10 +986,15 @@ static int rds_send_mprds_hash(struct rd if (conn->c_npaths == 0 && hash != 0) { rds_send_ping(conn, 0); - if (conn->c_npaths == 0) { - wait_event_interruptible(conn->c_hs_waitq, - (conn->c_npaths != 0)); - } + /* The underlying connection is not up yet. Need to wait + * until it is up to be sure that the non-zero c_path can be + * used. But if we are interrupted, we have to use the zero + * c_path in case the connection ends up being non-MP capable. + */ + if (conn->c_npaths == 0) + if (wait_event_interruptible(conn->c_hs_waitq, + conn->c_npaths != 0)) + hash = 0; if (conn->c_npaths == 1) hash = 0; }