Skip to content

Fix i2c mux module refcount issues

Herve Codina linux-i2c lkml stable 3 versions – Applied

Status from this message: Applied to for-current, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesApplied
  2. v23 patches 6 repliesSuperseded
  3. v13 patches 6 repliesSuperseded

Changes in v3 from the cover letter

- Patch 2
Replace a wrong <tab> char by a <space> char in commit message

- All patches
Add 'Cc: [email protected]'
Add 'Reviewed-by: Jonathan Cameron <[email protected]>'

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()drivers/i2c/muxes/i2c-mux-pinctrl.c+1 -11 reply
2/3i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()drivers/i2c/muxes/i2c-demux-pinctrl.c+1 -11 reply
3/3i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()drivers/i2c/muxes/i2c-mux-gpmux.c+1 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPeter RosinJonathan Cameron
1/3A-b R-b
2/3A-b R-b
3/3A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] Fix i2c mux module refcount issues

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.

Compare to the previous iteration
https://lore.kernel.org/linux-kernel/[email protected]/
This v3 series:
- Fixes a wrong <tab> char in a commit log message
- Add 'Cc: [email protected]'
- Add Reviewed-by tags

Best regards,
Hervé

Changes v2 -> v3
- Patch 2
Replace a wrong <tab> char by a <space> char in commit message

- All patches
Add 'Cc: [email protected]'
Add 'Reviewed-by: Jonathan Cameron <[email protected]>'

Changes v1 -> v2:
- All patches
Fix commit log
Add relevant Fixes tag
Add 'Acked-by: Peter Rosin <[email protected]>'

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(-)
Signature · 1 line
2.41.0