public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: core: fix potential use-after-free on adapter removal
Date: Thu, 16 Jun 2022 21:32:51 +0200	[thread overview]
Message-ID: <YquFY50LfsezqrVn@shikoro> (raw)
In-Reply-To: <YqoehVjd5qgEYSen@qmqm.qmqm.pl>

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

Hi Michał,

> I looked briefly at the kobject machinery and it seems to ignore module
> dependencies. So while both approaches might work, I'd usually reverse

Thanks for checking!

> the order the init code is using: in this case module_get+device_get,
> so on release: device_put+module_put. I don't know what keeps the kernel

I agree this is good style. I'll add a comment why we reverse the order.
This will be also good to avoid regressions.

> from unloading the module after module_put() and before the function
> returns, but I assume that would blow up for both patches.

Yes. There are other users in the kernel doing it like this (RTC and
regmap IIRC), so I think problems would have become visible by then.

Thank you for your help!

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-06-16 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15  1:12 [PATCH] i2c: core: fix potential use-after-free on adapter removal Michał Mirosław
2022-06-14 19:45 ` Wolfram Sang
2022-06-15 18:01   ` Michał Mirosław
2022-06-16 19:32     ` Wolfram Sang [this message]

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=YquFY50LfsezqrVn@shikoro \
    --to=wsa@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    /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