From patchwork Sat Oct 22 07:22:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095636wrr; Sat, 22 Oct 2022 01:03:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IgO2WvG25+up/5JpuBWXdQwUD8NVzQz54MjiHrsi6Ci1fTJn7f+clXC69azI8M9ij2iCg X-Received: by 2002:a17:902:ccc4:b0:186:6fcb:3fcf with SMTP id z4-20020a170902ccc400b001866fcb3fcfmr10016401ple.100.1666425792089; Sat, 22 Oct 2022 01:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425792; cv=none; d=google.com; s=arc-20160816; b=sCQfck6yKczgqmhCzWmgp3K0++SfaLnxptZ7G/P9UCB4pK5iRFLuENSy5awtl/JEXn SizVWBd5VPkk/W5jcfPJVn2VWSFLKJP35DVFII6Vk0JCQsfMoSPZ0t2JAY8lXTC2CaFr 6V9mkUL+YjM6D5dLIoEPkxyqvh8hniivQ4NFJPfpLDhIFpqI7bRLKEkYGiZcSLCBZ0EE T3L6Sxo0DFamBpr56kz//HAyEBaclsACvthb6Y15hkO2pul2kpaj7t+d/yXkIF+7SY4l 54Oua3EePexYoc6qsQmvR4flE7mw4n1bkqHKwNZmMPXRc15asYFkBoQv3tTzG0tC2WVL D9aQ== 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=x49Iyp1n8uAaMK7VPCIDJHRf1Fld/cAWjRw6nf6Gsl4=; b=QDAceMy5nMtO6UihTTMEZsEHqqQ6e18aeVGNyudAHTRY27/lphI/2wKlfqYWWXowAK GOgNsehidfTWX80Aak3mlVmC92+TjeaBIU9IoXsa0Kc8uiOJ/Vc12YtEHYqWb6Jw4T6r lt5sIVitFuO5W/7SP/gvuDtjS59M2NwEZJCy/R3RfdwXXEy7PHBKukGCCzu8JvS7PGGW x5CwHYTDHZvwiEbwNDSmurwj5pTqyVACrRD3kFfWiMP58M4t2jxOSZKcJaBJAm7oHD9e pVGvlLoe/m2TEEuaKK0nCNrAv47MTmcf9Y6ee09pBNIS7P02yZs4sUscXNYYrLSQR7GZ +w4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ywPS4zMZ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a656085000000b004594e9f9b10si28799298pgu.188.2022.10.22.01.02.58; Sat, 22 Oct 2022 01:03:12 -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=ywPS4zMZ; 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 S232557AbiJVICZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbiJVHyc (ORCPT ); Sat, 22 Oct 2022 03:54:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56898951DD; Sat, 22 Oct 2022 00:47:48 -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 D01BEB82E26; Sat, 22 Oct 2022 07:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C244C433D6; Sat, 22 Oct 2022 07:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424811; bh=epD93SGW1hEwjy9oseb8+CuhtM2ecZygpN9U7N9We9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywPS4zMZ/6X4YWGwM2IrX3BTE3NIcg11AHLA0sPpcIYBqZ/8Hsmr41wen4RxM1f23 2lGm58BGggot5DkkAWl3MN2B1PxOjyTkxfYTzGy0bZCpzkEwbEhIUhybLyBmEgdIiL CvSrn/AnhK+jzGKgA9FPUj7uYfV/XG3Qi3f35z90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Hillf Danton , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 285/717] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Sat, 22 Oct 2022 09:22:44 +0200 Message-Id: <20221022072504.078542538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747374091288907633?= X-GMAIL-MSGID: =?utf-8?q?1747374091288907633?= From: Tetsuo Handa [ Upstream commit a91b750fd6629354460282bbf5146c01b05c4859 ] syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for commit ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") added cancel_delayed_work_sync() into a section protected by lock_sock() without realizing that rds_send_xmit() might call lock_sock(). We don't need to protect cancel_delayed_work_sync() using lock_sock(), for even if rds_{send,recv}_worker() re-queued this work while __flush_work() from cancel_delayed_work_sync() was waiting for this work to complete, retried rds_{send,recv}_worker() is no-op due to the absence of RDS_CONN_UP bit. Link: https://syzkaller.appspot.com/bug?extid=78c55c7bc6f66e53dce2 [1] Reported-by: syzbot Co-developed-by: Hillf Danton Signed-off-by: Hillf Danton Signed-off-by: Tetsuo Handa Tested-by: syzbot Fixes: ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rds/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 73ee2771093d..d0ff413f697c 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -166,10 +166,10 @@ void rds_tcp_reset_callbacks(struct socket *sock, */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL;