From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30783C4361B for ; Tue, 8 Dec 2020 01:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E871823A3C for ; Tue, 8 Dec 2020 01:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbgLHBU6 (ORCPT ); Mon, 7 Dec 2020 20:20:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:42744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbgLHBU5 (ORCPT ); Mon, 7 Dec 2020 20:20:57 -0500 Date: Mon, 7 Dec 2020 17:20:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607390416; bh=PBUakZSI/8fHqIXDH5E3y18maLAa5mtKjoEIZuFHY+M=; h=From:To:Cc:Subject:In-Reply-To:References:From; b=BhqtjXk6xWeLrCwKwGYXVkfULXcIt3S2h/OvxHAJZUNY7uVskIk3frX3CFUWK/Sgx 51oR0fz61/NPW4KE3Fe61xV00FzipnOi4sJG6Uogltxs+N8ANiOzgGwHam/C/6qL5e 5k88Lrs8gunDw81G3XlDFuRu5aNjU79iv6xnL9sdDEczeVcuAGHb9R9xtYWdocksjS zFHcswSpXza05xnRa2uM+Uj7wEi8mUIGOzP91CtMHlFCigkKpyftX5AztJI7dKOizx yw2YJU3wjtgpiD1G5Iv9NXgjblUqQDNyn6niCGuZ5b/4Is0g0ZInjB0Moems87kYth 3lx2KTvxiDw3w== From: Jakub Kicinski To: Nikolay Aleksandrov , Joseph Huang Cc: Roopa Prabhu , "David S. Miller" , , , Subject: Re: [PATCH v3] bridge: Fix a deadlock when enabling multicast snooping Message-ID: <20201207172015.1f5a70b0@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> In-Reply-To: References: <20201201214047.128948-1-Joseph.Huang@garmin.com> <20201204235628.50653-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 5 Dec 2020 10:56:45 +0200 Nikolay Aleksandrov wrote: > On 05/12/2020 01:56, Joseph Huang wrote: > > When enabling multicast snooping, bridge module deadlocks on multicast_lock > > if 1) IPv6 is enabled, and 2) there is an existing querier on the same L2 > > network. > > > > The deadlock was caused by the following sequence: While holding the lock, > > br_multicast_open calls br_multicast_join_snoopers, which eventually causes > > IP stack to (attempt to) send out a Listener Report (in igmp6_join_group). > > Since the destination Ethernet address is a multicast address, br_dev_xmit > > feeds the packet back to the bridge via br_multicast_rcv, which in turn > > calls br_multicast_add_group, which then deadlocks on multicast_lock. > > > > The fix is to move the call br_multicast_join_snoopers outside of the > > critical section. This works since br_multicast_join_snoopers only deals > > with IP and does not modify any multicast data structures of the bridge, > > so there's no need to hold the lock. > > > > Steps to reproduce: > > 1. sysctl net.ipv6.conf.all.force_mld_version=1 > > 2. have another querier > > 3. ip link set dev bridge type bridge mcast_snooping 0 && \ > > ip link set dev bridge type bridge mcast_snooping 1 < deadlock > > > > > A typical call trace looks like the following: > > Fixes: 4effd28c1245 ("bridge: join all-snoopers multicast address") > > Signed-off-by: Joseph Huang > > LGTM, thanks! > Acked-by: Nikolay Aleksandrov Applied, thank you!