Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp642065pxb; Wed, 13 Apr 2022 09:16:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgDSz52pgud/zO/HoEh2vvtNyjFzWJx4QvqgJwqw4BYllkRjZ6gqU/bHTOzlmpkemgid7A X-Received: by 2002:a17:902:e84c:b0:158:6bd9:8591 with SMTP id t12-20020a170902e84c00b001586bd98591mr14695748plg.170.1649866594129; Wed, 13 Apr 2022 09:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649866594; cv=none; d=google.com; s=arc-20160816; b=zVpjjctTY1bAd0lSNNA0BueEbV5R1gtxbMttdz+rJvfJfPYYrTCHR2YLL/V0DTcVMA MV7oZ0CTaUoe5LRuAhIVQ6440hFYzBqIabWRpDa+8mzvliZfZUm8grIAQmgnsHQIBBju LV+Zc0s8UIZ0A8jum0eh51CnNe8arTtnqSePpcEZnwZVaV7Y7ceN41t7Z7sDoRbD3ugV TynrzpXpimal3MrhX0QnLrY9OzN7WiNrlG/6jHjv4jO4fWtzSmBlexlHeHGA9mmwNTEA pxLFaD3EmW3OOP/Jo6iKAwmCHIe3qS3oQRcjmrU6nErDWgAf8ImyNcSu4LkFxQ+7SNrq ehcg== 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:message-id:date:cc:to:from:subject:organization :dkim-signature; bh=uYhtOyCqLPQb8ZNiEUNP5JqgsDoqYOBvlHSfSfuPAWQ=; b=jCM42eNAs7P2Lp9+WAoFo0TJraqENmRZo0o3KftJyrGO3r492YDve83AqX5gY4/P/I hbdLY7FCUmhF2Kd0gudyUfPm1VzIpZorjccz7BNyM1sH7jxRxSUU75tscW+KyAnsKEjn pLXkoz8bGW+xl8/yjLDH4hfG1GNnDHfZHuiu5EqjY5CJwnQu5+M2fMxI9QcTBhxO+Mxk 38romrJ0lLOOwsPt0CKvQA9KKblN33YRr/n342PWSvZFL3RF4LxgXX3w+i1hpzpXxcF2 9iWy/2HxRZqDJkwg7RFoZrzJQxGVo0Cc1g3wSCA3Zjffw4m6tw1mkYLklnk5vTFlKqtX 5zpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bE24tTU4; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a056a00198a00b004fac017a5b1si15634856pfl.95.2022.04.13.09.16.12; Wed, 13 Apr 2022 09:16:34 -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=@redhat.com header.s=mimecast20190719 header.b=bE24tTU4; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbiDMKSx (ORCPT + 99 others); Wed, 13 Apr 2022 06:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231205AbiDMKSw (ORCPT ); Wed, 13 Apr 2022 06:18:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEB654BB94 for ; Wed, 13 Apr 2022 03:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649844990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uYhtOyCqLPQb8ZNiEUNP5JqgsDoqYOBvlHSfSfuPAWQ=; b=bE24tTU46bdOHpSg4mVoDvFAP78th6BXiZv4464UbY5OrlBuxJE1lNinXTvFDv9+kvoHBH Wt/b4n/B8hhU6LvUmnaS4fD75i9TaYLEkrrv9icksJzabM2WRD3fb55VzpJSlEUBEhXuZp +Su712PirsAkx+XB1uQEbEdCVaU6cZ4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-47rtHhcFPf6Fnr4rk0PFxg-1; Wed, 13 Apr 2022 06:16:27 -0400 X-MC-Unique: 47rtHhcFPf6Fnr4rk0PFxg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C1403820F68; Wed, 13 Apr 2022 10:16:27 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.37.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75CBF9D7E; Wed, 13 Apr 2022 10:16:26 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH net] rxrpc: Restore removed timer deletion From: David Howells To: netdev@vger.kernel.org Cc: Eric Dumazet , Marc Dionne , linux-afs@lists.infradead.org, dhowells@redhat.com, linux-kernel@vger.kernel.org Date: Wed, 13 Apr 2022 11:16:25 +0100 Message-ID: <164984498582.2000115.4023190177137486137.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 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] --- 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);