Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3926957ioa; Tue, 26 Apr 2022 12:35:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhbEKLXrW9pgAMjYdWy4VaaTrqX1Li7KfQqABb2EqcpbhNOCckoe5jgzoqKkpo1ivxlQLw X-Received: by 2002:a17:902:b106:b0:159:5c6:cb53 with SMTP id q6-20020a170902b10600b0015905c6cb53mr25076723plr.99.1651001715816; Tue, 26 Apr 2022 12:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651001715; cv=none; d=google.com; s=arc-20160816; b=dipn5aYEuA0WXj2lrRYGUYxiUpFVAh3BiqGowiFmzul244RQ/RxUJcHWNxMZYZiIic pTJ5CJ2nmVsvyrhC9tqVy9NiU9x1muGz8y6XYQT4qveDtVG3DVvNsiFpBN4YlPmvoE/N LfnGd7xs/GY8kV7ZnyyldibcDNBWtGfjLgG6ClKkFYospW/KE5QMvVx3slJ8Cqs94WNU hzDsI64hITDw2p7z5bO5AF9kERo1cIksSR0hT1bgaejIurxKaGTJVf/Pmtb1JkeN2+dM TAdGCAvjpMpzlSBgqNGGQoW8AIiJwRSnq5eCCgRrX6vH+3nPHsR/gR+aLk2fwiDkt784 Xddw== 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=jDOtnYpfWADxpcAY1KyzGIsLgNNPkCx9BClG1rBMjJc=; b=PJVJ/VpFq+B5Pc0Nesybwd5JZRocy/90IJOXXSlnRah4Gu09/viHlwSisvTXrFAvju Z8ASa5/xbpV4OdrECPgutQGjJWCS/QnGXLtXPaB6ku029yPnRjo26fZiJLoo9lWUL1ec AYu+4Ca3jnDmomWafDi23GYuOnk4KkPilQqSoUjzv2OyhqlVD78P6wBubsfj8kUEPRxd l9S4VGDk5ZLC9ylzecXAwDNPpByQJu7CjdlWn+p8otIclyEZ1LSFHWeFgn3RSAlcIw6D GKAh2vGjtx4246LsyXHkqmJrwV7k5P6hyCvgaLwBtBjQNR9UIzRjlPkkdSZ/Ier+1VWm opbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w1G5o8NQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m20-20020a056a00165400b0050609efc350si19252185pfc.374.2022.04.26.12.34.59; Tue, 26 Apr 2022 12:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w1G5o8NQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1345896AbiDZIxd (ORCPT + 99 others); Tue, 26 Apr 2022 04:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345914AbiDZIjn (ORCPT ); Tue, 26 Apr 2022 04:39:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C45A07F21B; Tue, 26 Apr 2022 01:32:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47C46B81CFE; Tue, 26 Apr 2022 08:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D363C385A4; Tue, 26 Apr 2022 08:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961938; bh=nDv3ZUX4ndQ8MpYE3JNAFqkJacWDpguWL47ft7pczH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w1G5o8NQN7XrHzTyguQ3tTQ3vNhxjM/BvyuaOP0n166fhYFQ/ymLyX/q+jXLPGUgQ iZLFPgk+OZSOxk2ccGQWSlzE2dOMyP9Eo+keMyAiY1qns0l03pcUWmIr22o1f5T48l CxiXmsGWA9DcP//1TSf407eN09iVmAJ2xzwp1s64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Eric Dumazet , Marc Dionne , linux-afs@lists.infradead.org, "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 19/86] rxrpc: Restore removed timer deletion Date: Tue, 26 Apr 2022 10:20:47 +0200 Message-Id: <20220426081741.760370156@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081741.202366502@linuxfoundation.org> References: <20220426081741.202366502@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells [ Upstream commit ee3b0826b4764f6c13ad6db67495c5a1c38e9025 ] A recent patch[1] from Eric Dumazet flipped the order in which the keepalive timer and the keepalive worker were cancelled in order to fix a syzbot reported issue[2]. Unfortunately, this enables the mirror image bug whereby the timer races with rxrpc_exit_net(), restarting the worker after it has been cancelled: CPU 1 CPU 2 =============== ===================== if (rxnet->live) rxnet->live = false; cancel_work_sync(&rxnet->peer_keepalive_work); rxrpc_queue_work(&rxnet->peer_keepalive_work); del_timer_sync(&rxnet->peer_keepalive_timer); Fix this by restoring the removed del_timer_sync() so that we try to remove the timer twice. If the timer runs again, it should see ->live == false and not restart the worker. Fixes: 1946014ca3b1 ("rxrpc: fix a race in rxrpc_exit_net()") Signed-off-by: David Howells cc: Eric Dumazet cc: Marc Dionne cc: linux-afs@lists.infradead.org Link: https://lore.kernel.org/r/20220404183439.3537837-1-eric.dumazet@gmail.com/ [1] Link: https://syzkaller.appspot.com/bug?extid=724378c4bb58f703b09a [2] Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rxrpc/net_ns.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/rxrpc/net_ns.c b/net/rxrpc/net_ns.c index f15d6942da45..cc7e30733feb 100644 --- a/net/rxrpc/net_ns.c +++ b/net/rxrpc/net_ns.c @@ -113,7 +113,9 @@ static __net_exit void rxrpc_exit_net(struct net *net) struct rxrpc_net *rxnet = rxrpc_net(net); rxnet->live = false; + del_timer_sync(&rxnet->peer_keepalive_timer); cancel_work_sync(&rxnet->peer_keepalive_work); + /* Remove the timer again as the worker may have restarted it. */ del_timer_sync(&rxnet->peer_keepalive_timer); rxrpc_destroy_all_calls(rxnet); rxrpc_destroy_all_connections(rxnet); -- 2.35.1