Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1265261pxb; Fri, 22 Jan 2021 10:58:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSysc/wzKiLOGboHFqRBc3MnNGYQ5BPj8u6y5D1Z6oNrGU0TlsIj/VR0Wm5DA0o54cxptN X-Received: by 2002:a17:906:9342:: with SMTP id p2mr4021822ejw.300.1611341894244; Fri, 22 Jan 2021 10:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611341894; cv=none; d=google.com; s=arc-20160816; b=MYop6m2D7VXVF3QkpYJ8UkHtY3lLkuS9UncCTipSNG35Af73Ooiw4juWX2hZQZbzoX acG7pXky68KoKpiio6Rf3lC8dAUxoJenzeByV6pXjMmyj5RIJ0YNvvESJppIOEQNo/mC Jzt0pmElLflJkyhS/8ozLqH6zncvHFbrSO1ICC46Hddwl8kn23+TAyJESUtMc4KDgDek RdElKUXupGvZcOetCRak7CER1vwaawU7MjVDdMmxejriPEp/2Z94kt0DIi7ttSMar5R5 y+OYQrv+1Y80X8uJR8Ig1IA/LDVvC3WuCcYET78MFzaP/9TdxqXHwmQU7HkC48D3TFJc vTqw== 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=dS2VlSCfCjAiFLA0yot4ldNXE+S4cPfSycxF/gFYNqQ=; b=r7GIA+B961ui8yRlrdq71DBBMyGvoFCfXpScB+NGm2MslUc1MyIjlXkov6cDSu+IO8 924VQLLfpnDRoOP2tyjk9yRc1wQlHMveeiojlz1qErcszcZqCYOVNbjzJDgdVV23kYiT d+noNfyBHMdIfPvSSLNKgRaFNUz22Bu4D0HMZ6iuqVl2Q1r1p4JES+f+xYGyBKdRJqVW GIXnPBqsJ6fXp/E/btOyKucI91zSgNMLo/hueznqpNOGGemN0opFpKYzOI1jfYyEOEXU Qfq/vMvrnkx2K4vL3NDJrb8Lq6tGY9Wv2nqXyZd0SjhN0461M74l2dvyDqY7GoS6wkHG Zubg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LJZecCBn; 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 u20si3678565edv.129.2021.01.22.10.57.49; Fri, 22 Jan 2021 10:58:14 -0800 (PST) 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=LJZecCBn; 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 S1730319AbhAVSyC (ORCPT + 99 others); Fri, 22 Jan 2021 13:54:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:40014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728535AbhAVOWM (ORCPT ); Fri, 22 Jan 2021 09:22:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DB8223B42; Fri, 22 Jan 2021 14:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324941; bh=XpBnyEUptyfE2ExswyYaLSI3gqyrWtLEBZ9yTV9nTWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJZecCBn9LTUTL54TWArqjk5+HDiKjRxpqCerVNXsjQmLnemppZQix5IjojWSqkW/ W/O4mNhnoPE//6LyIN4RqG+OuF6XWtpbSi1S5+qjgDj+J1M/72cVKho5VSckCnYIqZ ZfzUKt7uXuVcAL8NaSuYm0NUj00kdLtwcsWn+mL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baptiste Lepers , David Howells , Jakub Kicinski Subject: [PATCH 4.19 13/22] rxrpc: Call state should be read with READ_ONCE() under some circumstances Date: Fri, 22 Jan 2021 15:12:31 +0100 Message-Id: <20210122135732.441893605@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135731.921636245@linuxfoundation.org> References: <20210122135731.921636245@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: Baptiste Lepers [ Upstream commit a95d25dd7b94a5ba18246da09b4218f132fed60e ] The call state may be changed at any time by the data-ready routine in response to received packets, so if the call state is to be read and acted upon several times in a function, READ_ONCE() must be used unless the call state lock is held. As it happens, we used READ_ONCE() to read the state a few lines above the unmarked read in rxrpc_input_data(), so use that value rather than re-reading it. Fixes: a158bdd3247b ("rxrpc: Fix call timeouts") Signed-off-by: Baptiste Lepers Signed-off-by: David Howells Link: https://lore.kernel.org/r/161046715522.2450566.488819910256264150.stgit@warthog.procyon.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -446,7 +446,7 @@ static void rxrpc_input_data(struct rxrp if (state >= RXRPC_CALL_COMPLETE) return; - if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) { + if (state == RXRPC_CALL_SERVER_RECV_REQUEST) { unsigned long timo = READ_ONCE(call->next_req_timo); unsigned long now, expect_req_by;