mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kenny Hsieh <kenny_hsieh@jabil.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"jk@codeconstruct.com.au" <jk@codeconstruct.com.au>,
	"matt@codeconstruct.com.au" <matt@codeconstruct.com.au>,
	"andi.shyti@kernel.org" <andi.shyti@kernel.org>,
	"peda@lysator.liu.se" <peda@lysator.liu.se>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@kernel.org" <edumazet@kernel.org>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2] mctp i2c: add sysfs control for mux child netdevs
Date: Tue, 27 Oct 2026 08:58:05 +0000	[thread overview]
Message-ID: <DM8PR02MB808768B7D02FF12777B7777E8E602@DM8PR02MB8087.namprd02.prod.outlook.com> (raw)
In-Reply-To: <179239912623.3135.11352652156626817288@kernel.org>

Hi Andi, Peter, Matt, Jeremy,

> - [High] The store-side guard against adapters being deleted does not
>   close the race it claims to close.

> - [High] mctp_i2c_remove() runs mctp_i2c_remove_sysfs_all() while the
>   client is still on driver_clients.

> - [Medium] mctp_i2c_probe() now releases driver_clients_lock after
>   list_add() and before i2c_for_each_dev(mcli,...

> - [Medium] The new ABI lives on i2c adapter devices, which the I2C core
>   owns, but the mctp-i2c driver attaches it with sysfs_update_group() on...

These races come back to the last point: mctp-i2c bolts the attribute
onto adapters the i2c core owns. Before I respin I'd like to check which
way to go.

I can keep it in mctp-i2c and fix the races there, mostly by reordering
notify_del() and remove(), and adding the attributes after the probe
walk so it can hold driver_clients_lock again. That works, but it's more
bookkeeping and there's still no uevent for the attribute.

The other option is to declare it on i2c_adapter_type in the core and
have mctp-i2c register the show/store callbacks. That's cleaner, the
driver core handles the lifetime and most of the races go away, but it
adds an i2c API with mctp-i2c as its only user.

I prefer to keep it in mctp-i2c, but happy to go either way.

> - [High] When mctp_register_netdev() fails, mctp_i2c_add_netdev()
>   (drivers/net/mctp/mctp-i2c.c) now always sets `midev = NULL`, so the...

> - [Medium] In the baseline, mctp_i2c_add_netdev() has a real double
>   teardown.

This is the known double free, tracked in a separate patch on net, and
v3 drops the midev = NULL change:
https://lore.kernel.org/netdev/20261027053715.1623087-1-kenny_hsieh@jabil.com/

> - [Medium] The new ABI document Documentation/ABI/testing/sysfs-
>   bus-i2c-devices-mctp says "The attribute appears only on mux child...

> - [Medium] mctp_i2c_new_client() now calls `write_pnet(&mcli->net,
>   get_net(current->nsproxy->net_ns))` before i2c_slave_register().

> - [Low] The commit message says "a rebind reattaches it reading 0".

> - [Low] The commit message gives "an adapter that the devicetree cannot
>   describe at all, such as a USB-attached one" as a use case.

Will fix all four in v3.

> - [Medium] Writing 0 to mctp_controller removes a channel's netdev
>   through mctp_i2c_remove_netdev() -> mctp_i2c_unregister() ->...

The sel reselection on removal isn't new, removing a mux adapter already
goes down that path. I'd rather leave that for a separate patch and just
fix the ABI wording here.

pw-bot: cr

  reply	other threads:[~2026-10-27  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  8:13 Kenny Hsieh
2026-10-19  8:38 ` netdev-bot+sashiko
2026-10-27  8:58   ` Kenny Hsieh [this message]
2026-11-02  9:04     ` Matt Johnston
2026-11-03 14:47       ` Kenny Hsieh
2026-11-04  6:44         ` Matt Johnston
2026-11-04 14:23           ` Kenny Hsieh
2026-11-05 10:16           ` Kenny Hsieh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM8PR02MB808768B7D02FF12777B7777E8E602@DM8PR02MB8087.namprd02.prod.outlook.com \
    --to=kenny_hsieh@jabil.com \
    --cc=andi.shyti@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kuba@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peda@lysator.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®