From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4B231DED40 for ; Mon, 10 Aug 2026 01:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786325522; cv=none; b=noh5LYkwtMg3vZm+B7+RnUjTK2HZ4lsHRzlXm11DPnOdVTvmXq7y1ZrRC2dOZdSkKYw+AROVDhjkPm8M/i5ls2gT3+5v7OTq0S3Dt1yYetMRRnfqBelwKXS7D+RlcoUHvwRAfWYGJEjfOWcB0v6/j8hzVRiSb6tgOsg/5PrLzUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786325522; c=relaxed/simple; bh=pc2d2oGxjwJiQyEaE6C1+iaJskLK0RV8Yzw8+87++kM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WC2F9RW0DfzHuQCxSAAPBYaY0k92qoCp1BT2dHliOKfGTYSBoptHZZ30C2tadqmFgfjJ0rIrCZzC7ouFadOHffJeg0NnwnRJcLdjfijGT7Su8/akq5Eq0kshSzYRm2qfhi5Y37i0HISr4qAb8n9XDxrN35U+RGOA+3o2cgGZJxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DRExtv+S; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DRExtv+S" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-38e3efab7e0so952879a91.0 for ; Sun, 09 Aug 2026 18:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786325520; x=1786930320; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=XDbchV2G7EpH82x3rYzlRJkGZqdzjbYQyUeWypMVefo=; b=DRExtv+ShCkzbAZ3vgR94KSZo430ko45l5jL7WCgY5zhFUEQo819o/J65du4A0pbSd T31PEdSBNdMwttDnfFZYSQp/JQuEmdxruaMEc7pKzMbDEohzWqZWPOHFhB9FZkvpRb/E 5AS0VzaUl6hMx4gZWReFLznTPWVWS2r13qx1RC9IMACLeY3KMtgxTRvLx+nKfFAetZxA Ac0k8aL4EBcF87iI0nyYmua0p6PZHVKceEnLWjP8QPD62PUD/WwTr2P5+QFPisGpmHbB YnhgqmoY358Qoe1v/Rt/eXTRjgc3MSXZ5JjZ1kBFTFwX+hxMz1sshJjIyKEuQ5sIUPPM mD3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786325520; x=1786930320; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XDbchV2G7EpH82x3rYzlRJkGZqdzjbYQyUeWypMVefo=; b=HFoQ9KVv2E0ZxWKvOB/JCIiYe8Rm/hqVnm30Y0cK9XZBDdCCM8DLx/P9Gbr7aS5MGG EpsITdCo/5KOhgfk3v2SYUEgflvPxJr+orNITYzeozNA3F+irJWlrVvFxqfUPTIRlU+f P+kF0d1CDwk/2fxhnRX3xHstGv/RGXi6mrEyykJIZ1Rtm+4wGkgx7dRPlEf0mc/0estt ngXIFIoT+sdZSG71Gn+lYWo7HgAduPbo3JdMVF4p0evsyVc2KYAfMQgwM02OCw9+Gpof gj1GBJjZzMEU4iiKqRCr1kCGxq/f/gJtOiQSzfv78uhgtcH9Bq0ixsEep1XBHIB09jkc z/3A== X-Forwarded-Encrypted: i=1; AHgh+Rrms18rFrtu6AycDYBbVUSimwhCFtXOHa35tONo6m4i2eIqcAV8yO+YQug7az5dWvD/Xc+tSSyTR5Z7poU=@vger.kernel.org X-Gm-Message-State: AOJu0YzzYZq5Q9lkE5IGy/euE2+K7npZpAeMrehmXSwmujuNqEoH2WIG wzmmoeBn0/98yb4ZqBH2B1X62htyFxO4lWrhZNkells0kV4nF3VfMsfJITTzKA== X-Gm-Gg: AR+sD123qIpLKXBVLg+fE2k3tikXMIPzbIJSuUhq02glRvfM/c9IZ2wsOOyDGcGF99f C8zZRyEIWtNPJcQPv1fZ8eTAP/0D4msTN7hXXQIg3qY/cOKxQLGdOctSsmKpm6IY+hs7J7m2B41 XoirJ57o1sLSP6n7CRswFyKznsK7bkniAVQ65WeNQkXp5j6jiM+9HoL0G3FOa+J+K8FHqjYqZRz W5oYt/v8WkUEmQUxIKZnj7bX7v8q95tP+xfKuD4PRHsjcmouzVT9c6yU7EXNV33MVCKUR0MMIJe lbHmKV5mrr4g6iAs4+eBgRLv2PKZgri/IlSuf52jwvfbu/3B93iDkVOIMjGLIU7gu8+cLQsP6Rz Bn9NXwVtbwfnWg76V1XKkgYiV/Ui9u5+zGkFRTwRxvJSZ+eCzKiqYMjzhB8Q6cpFNLSZPrX3CGK NIKErCGjUXBvyNkx5gCOTnl06OxoQQPSorK6wugMYjwVW5VoF7VUWZlxyftRZtNNpQlg== X-Received: by 2002:a17:90b:4a4e:b0:38e:6d55:b1a6 with SMTP id 98e67ed59e1d1-392845e2173mr6585248a91.3.1786325520057; Sun, 09 Aug 2026 18:32:00 -0700 (PDT) Received: from fedora ([203.175.12.242]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3926254ee45sm9987298a91.2.2026.08.09.18.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2026 18:31:59 -0700 (PDT) Date: Mon, 10 Aug 2026 09:31:52 +0800 From: Hangbin Liu To: Xin Xie Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, fmaurer@redhat.com, luka.gejak@linux.dev, kexinsun@smail.nju.edu.cn, arvid.brodin@alten.se, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: hsr: free learned nodes on device setup failure Message-ID: References: <20260808110814.1637-1-xiexinet@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260808110814.1637-1-xiexinet@gmail.com> On Sat, Aug 08, 2026 at 01:08:14PM +0200, Xin Xie wrote: > hsr_dev_finalize() can fail after a lower-device RX handler has > already been registered (slave A is added before the failable slave B > and interlink adds). RX handlers run in softirq regardless of the > master's state, so frames received in that window can learn dynamic > nodes into node_db, and the error unwind never releases them. > > Free both owned dynamic databases in the unwind, mirroring > hsr_dellink(). proxy_node_db is provably empty on every current error > exit (only interlink RX feeds it, and the interlink add is the last > failable step) and is freed for symmetry. The order is safe: > hsr_del_port() unregisters each RX handler with synchronize_net() > before hsr_del_nodes() runs, which removes remaining entries with > list_del_rcu() and defers their release with call_rcu() for readers > already under RCU. > > Fixes: 81ba6afd6e64 ("net/hsr: Switch from dev_add_pack() to netdev_rx_handler_register()") Should we use this fix tag? The proxy_node_db is added in 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)"). Thanks Hangbin