Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1527414pxb; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNv29M7P6Sbn5gWI0UDq7sk9pnaUV+daEy19551xXfSV83uWCU8i80Zse3luClZISI5v/S X-Received: by 2002:a17:906:658:: with SMTP id t24mr6891008ejb.358.1631808966506; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808966; cv=none; d=google.com; s=arc-20160816; b=rld7PJz4PAGrrcZFMcCppdZtLJaau+VF73jKwFf7SC94jmlmi1WNYoxfxO6/roEr3b l3sx1V+Xg24wuxwC1AlVLlMWhlBHnhZb/dPpc4yrWpspebr9P4GaNlrxhn6wTdr0Dmp2 X2CZNj0gL6Dyl1hFqNgcIcvfIV9C43P1LWRhHUgItahfkqt6PUNS6PEr/qyQX63DlM88 D+1aXhhIkN5xBqsmp146G2EcJjRKQfpJZMvHQwgcHeaRBrg8S0a/YbUfw7npD7S4y24q Uwwem6Cj4Ur1nlBiD26KNV//TGPGELXPr+8VDTJjeTk6lA5haB+5OFEJSI7hNGY7nDy2 C0kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AqjrFxRjHICI0owJgJcbCB3ryWMfV7eo4+y2D0k9fsc=; b=JztGYTMzzLzF8zkff8mFe+gr0c05nH5/bUNro/hsSRO1DOpBXCqCNAoh3JIATIQzDo ii+MdnjGwTUdj7u5yTUuzvldsYbR04ommQmosN0EG4R0/+Hqnwq13y7DTkyFE0RE4bpe zC68RzlGjKWUoHganIx7LTGiX0wz+oiBZsnXbzYGaA3Ke8PAKW1DwprzVIb4AeLA71ok XzgoqXcuklqWJcrl2Nn2eIntXjMFfw2uakSr0nWDmFYiJmAoBHkuMJ2EhMe/Blr5SzU6 qvIa67e7DrxuU1bnaPcsTPjaXG0BRI4I4dSeyrdio2MosoPUn+zPXdM+XWxIAFIMalzO FaAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQFv0soP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb44si3402278ejc.174.2021.09.16.09.15.40; Thu, 16 Sep 2021 09:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQFv0soP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238889AbhIPQNY (ORCPT + 99 others); Thu, 16 Sep 2021 12:13:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:48410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234410AbhIPQIK (ORCPT ); Thu, 16 Sep 2021 12:08:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B221F60232; Thu, 16 Sep 2021 16:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808410; bh=IacLRNOYMI8SqT0DcdKhrMVyP5qC88k37WGxZ7t0bZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQFv0soP5jq0C4LmGqresEKHxdcSo49ecSanACP7fRQAOebivUdogWH03pTrZr+p1 RQMhh0TO58oK7nlmgJm00+LYe3n7TmXxGSuON+3M+Tp3v77WEhWBBpW5fgNKc88g9z RcU/2tE1rwgMsqnMVVq9x1ZAiqnNLJqOrjT5MHoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anna Schumaker , Sasha Levin Subject: [PATCH 5.10 081/306] sunrpc: Fix return value of get_srcport() Date: Thu, 16 Sep 2021 17:57:06 +0200 Message-Id: <20210916155756.813372821@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anna Schumaker [ Upstream commit 5d46dd04cb68771f77ba66dbf6fd323a4a2ce00d ] Since bc1c56e9bbe9 transport->srcport may by unset, causing get_srcport() to return 0 when called. Fix this by querying the port from the underlying socket instead of the transport. Fixes: bc1c56e9bbe9 (SUNRPC: prevent port reuse on transports which don't request it) Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/xprtsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 7d7c08af54de..16c7758e7bf3 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1642,7 +1642,7 @@ static int xs_get_srcport(struct sock_xprt *transport) unsigned short get_srcport(struct rpc_xprt *xprt) { struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); - return sock->srcport; + return xs_sock_getport(sock->sock); } EXPORT_SYMBOL(get_srcport); -- 2.30.2