From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2107136895C; Thu, 19 Mar 2026 03:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773890811; cv=none; b=HspWslGhj8+6pTBOkjXcix/20SjbESJP0zl5M46A69qY52/cCZE+CrgMqPlFQdYhoSmhV2nwkZES2lfqEljUQlIGxsX2oR7UXCggz8HtnOiHk0+i26jDFM08r1jxIadVrJ5KwwqvGzIf1zvJc2i28omnVvixCBkDpB6pdPsxisc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773890811; c=relaxed/simple; bh=Rtlq0JUZpyBPhjiv3ICVwtSl7cpISD31cuAaRsBhrBE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ktmcA5TW2Czj7vCbj48QzGBGq4AidfAh2lulbHnfpwFIcjIapjEhDEGrW/kzW17zW1veR82GqQXr6BuqrGyRfLb91+JDK2k2DPilZmPZRSs55YA9UBfB82f0KlebC6eUMybs6Tw/lWEkCQyTGZe1uwrWRDoWgTkJTqDAaRXtq4Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LDhxGOaC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LDhxGOaC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45B2BC19421; Thu, 19 Mar 2026 03:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773890810; bh=Rtlq0JUZpyBPhjiv3ICVwtSl7cpISD31cuAaRsBhrBE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LDhxGOaCZGaL2Y59/Lzuv/FJ3JjSsKJ4ioxyP905byxA2H62pFxNrxlnWtnqPiEgd NY5cOViSrcQLRJsqmKuD7pQhGidubOth4Knxy2Jfzr3iJReAL0gJmeacKHe5dCNqq0 lP3kOvH3Z3BkuWdqNQLYKeBMUOECj2atDalYcPsN4OAA54z0vVxt/3a0sKIuiFTZlj rIOQVzC8ElzqO0lUa6NGeVo9N3kAKx45XGaEGuQQUPj3Y5lvgIS1YCfji3c24kX2lt rSXmRr5rFfkqcmtB5ZS+E+PxkeGxrx4tFQziqPaHhEqzKfhy25d8SbDUzqDWvvgB8M q0oPgEj+KTbfg== Date: Wed, 18 Mar 2026 20:26:49 -0700 From: Jakub Kicinski To: Jiayuan Chen Cc: netdev@vger.kernel.org, Jiayuan Chen , syzbot+afbcf622635e98bf40d2@syzkaller.appspotmail.com, "David S. Miller" , David Ahern , Eric Dumazet , Paolo Abeni , Simon Horman , Taehee Yoo , linux-kernel@vger.kernel.org Subject: Re: [PATCH net v1] net/ipv6: mcast: fix circular locking dependency in __ipv6_dev_mc_inc() Message-ID: <20260318202649.004d33fd@kernel.org> In-Reply-To: References: <20260317111208.62667-1-jiayuan.chen@linux.dev> <20260318181536.47ed9fd1@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 19 Mar 2026 11:04:24 +0800 Jiayuan Chen wrote: > >> Split mca_alloc() into mca_alloc() + mca_init(): mca_alloc() does the > >> GFP_KERNEL allocation before mc_lock, mca_init() initializes under > >> mc_lock. If the address already exists, the pre-allocated memory is > >> simply freed. Also move inet6_ifmcaddr_notify() outside mc_lock since > >> it also does GFP_KERNEL allocation. > > Moving the allocation seems fine, but also having to move the > > notification, potentially letting the notification go out of order > > makes me wonder if we aren't better off adding helpers for taking this > > lock which also call memalloc_noio_{save,restore} ? > Yeah, using memalloc_noio helpers is simpler. I checked and there > are about 18 places taking mc_lock, so having a common mc_lock()/mc_unlock() > wrapper that does the noio save/restore covers them all (if necessary). > > The only thing that feels a bit odd is using memalloc_noio in the networking > subsystem. It makes sense in block/fs to protect itself from recursion. Totally agree that it feels a bit odd that we have to worry about IO, but unless we can figure out a way to prevent nbd sockets from getting here all our solutions are dealing with noio in networking code :( IMHO it's better to acknowledge this with the explicit memalloc_noio so future developers don't break things again with a mis-placed allocation.