public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix i2c mux module refcount issues
@ 2023-10-19  7:35 Herve Codina
  2023-10-19  7:35 ` [PATCH 1/3] i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() Herve Codina
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Herve Codina @ 2023-10-19  7:35 UTC (permalink / raw)
  To: Wolfram Sang, Peter Rosin
  Cc: linux-i2c, linux-kernel, Allan Nielsen, Horatiu Vultur,
	Steen Hegelund, Thomas Petazzoni, Herve Codina

Hi,

Some i2c mux drivers wrongly use the pair of_find_i2c_adapter_by_node()
/ i2c_put_adapter() to lock the 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.

Identified mux drivers impacted are:
- i2c-mux-gpmux
- i2c-demux-pinctrl
- i2c-mux-pinctrl

Commit 48e9743dd648 ("i2c: core: add and export of_get_i2c_adapter_by_node()
interface") introduces of_get_i2c_adapter_by_node() to correctly handle
this refcount issue.

This series fixes the 3 identified mux drivers replacing the
of_find_i2c_adapter_by_node() call by an of_get_i2c_adapter_by_node()
call.

Best regards,
Hervé

Herve Codina (3):
  i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()

 drivers/i2c/muxes/i2c-demux-pinctrl.c | 2 +-
 drivers/i2c/muxes/i2c-mux-gpmux.c     | 2 +-
 drivers/i2c/muxes/i2c-mux-pinctrl.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-19  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox