All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Peter Rosin <peda@axentia.se>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Allan Nielsen <allan.nielsen@microchip.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 1/3] i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
Date: Thu, 19 Oct 2023 11:45:59 +0200	[thread overview]
Message-ID: <20231019114559.5a81741e@bootlin.com> (raw)
In-Reply-To: <668b7c50-bcd7-b99e-3438-eceff6594dd7@axentia.se>

Hi Peter,

On Thu, 19 Oct 2023 11:25:35 +0200
Peter Rosin <peda@axentia.se> wrote:

> Hi!
> 
> 2023-10-19 at 09:35, Herve Codina wrote:
> > i2c-mux-pinctrl uses the pair of_find_i2c_adapter_by_node() /
> > i2c_put_adapter(). These pair alone is not correct to properly lock the
> > I2C parent adapter.
> > 
> > Indeed, i2c_put_adapter() decrements the module refcount while
> > of_find_i2c_adapter_by_node() does not increment it. This leads to an
> > overflow over zero of the parent adapter user counter.  
> 
> Perhaps "... underflow of the parent module refcount."?

Yes, will be changed in the next iteration.

> 
> > 
> > Use the dedicated function, of_get_i2c_adapter_by_node(), to handle
> > correctly the module refcount.
> > 
> > Signed-off-by: Herve Codina <herve.codina@bootlin.com>  
> 
> Good find, and sorry about that!
> 
> Fixes: c4aee3e1b0de ("i2c: mux: pinctrl: remove platform_data")
> Acked-by: Peter Rosin <peda@axentia.se>
> 
Will be added in the next iteration.

Thanks for the review,
Hervé

  reply	other threads:[~2023-10-19  9:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  7:35 [PATCH 0/3] Fix i2c mux module refcount issues Herve Codina
2023-10-19  7:35 ` [PATCH 1/3] i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() Herve Codina
2023-10-19  9:25   ` Peter Rosin
2023-10-19  9:45     ` Herve Codina [this message]
2023-10-19  7:35 ` [PATCH 2/3] i2c: muxes: i2c-demux-pinctrl: " Herve Codina
2023-10-19  9:26   ` Peter Rosin
2023-10-19  9:46     ` Herve Codina
2023-10-19  7:35 ` [PATCH 3/3] i2c: muxes: i2c-mux-gpmux: " Herve Codina
2023-10-19  9:26   ` Peter Rosin
2023-10-19  9:46     ` Herve Codina

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=20231019114559.5a81741e@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=steen.hegelund@microchip.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa+renesas@sang-engineering.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.