Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2828974pxu; Mon, 7 Dec 2020 17:30:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJznfpaCzyopp/njgVq3RC1QhYDlVbV2trSWl5lawXwzDGa2bVeTPz1CwsoK0SQwmhpFr8dJ X-Received: by 2002:a50:e68a:: with SMTP id z10mr22339391edm.28.1607391016169; Mon, 07 Dec 2020 17:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607391016; cv=none; d=google.com; s=arc-20160816; b=qUllLcENMUtYXFHlk1Tu2wlx1RxuU3nk4nIKI2d67B/waUB1LuB8Jbjrv+T0+Aw5P3 Rmts8bBXVAMZLBsuJQvZ10HzlJT4CFvlRrDDCauBYLJV27MXlkLvozNhA3LctlxUZeV8 zmb2gZfsOyt7RpAnfvlXLL4gRX3HWwdN26beZNzJp7LVvVzgwo3KFRrUskrgyqIuwZcC gRHw41Rusg+MkZVM0duBmPDSkjw3oP6wM5zzRZGRvkzIWzKelYjKBHeTXx/1I2heTpIr Jz5Kg8xZocFFX9BuZGBEJGluBlu2Bq11zL3AyRbfsHqL2WbbomREXZ4oVrx7RdlUsjFZ aYhQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:dkim-signature :date; bh=I+d8bwifUHnLI+ravRU5T85qDQtszo2LiPUlPGDyBAg=; b=OMUsjkxgI2faFeivwJnOd3ratQhRBzU+/DYkRGgIi0+r/CpSLFyMbJ8pi8TXNWQFM0 MhjbgzPxN15PFvbJZmVHfntOcMahbFAmdBCUbmOc2GZTMPqzrqDOLUWtEkmNnwAqWV/H YPeBP9x0O93WL8u4xdHVjANiwB+8AJ+5LuhxcIBZ6gZ217yU9NDHo/3K2HtNBpdOSz8m supOvKZXWUnmBnHHXJiPDF6T/929v9E/RH5hF5Pm7GJttODW4Kuw182np4DQchpBuStP Ipg1jr5qRa2iblw7WOvpcvS86j2ytoTNlhO6IuqqbrD6tA/1ZBsROI4hfka++L1EIKTf BIsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BhqtjXk6; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nx22si7448126ejb.503.2020.12.07.17.29.53; Mon, 07 Dec 2020 17:30:16 -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=@kernel.org header.s=k20201202 header.b=BhqtjXk6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbgLHBU6 (ORCPT + 99 others); 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!