[PATCH] i2c: imx: Make sure to unregister adapter on remove()

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Sat Jul 30 16:13:35 PDT 2022


On Fri, Jul 29, 2022 at 06:29:22AM +0200, Oleksij Rempel wrote:
> Hi Uwe,
> 
> thank you for your work.
> 
> On Wed, Jul 20, 2022 at 05:09:33PM +0200, Uwe Kleine-König wrote:
> > If for whatever reasons pm_runtime_resume_and_get() fails and .remove() is
> > exited early, the i2c adapter stays around and the irq still calls its
> > handler, while the driver data and the register mapping go away. So if
> > later the i2c adapter is accessed or the irq triggers this results in
> > havoc accessing freed memory and unmapped registers.
> > 
> > So unregister the software resources even if resume failed, and only skip
> > the hardware access in that case.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> 
> Can you please add Fixes tag. I assume this patch can got to stable
> kernel version too.

That would be:

Fixes: 588eb93ea49f ("i2c: imx: add runtime pm support to improve the performance")

and that was merged around v4.4. I'm not sure it's sensible to backport
that given the bug is that old and didn't even pop up in a user story
but by a cleanup effort. *shrug* Up to you and Wolfram to decide.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220731/11cc5117/attachment.sig>


More information about the linux-arm-kernel mailing list