public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Marc Zyngier <maz@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/2] genirq: proc: fix a procfs entry leak
Date: Tue, 29 Aug 2023 11:11:52 +0200	[thread overview]
Message-ID: <87msya6wmf.ffs@tglx> (raw)
In-Reply-To: <CAMRc=Meigus=WOGwM-fStkhtDeKyTd+9vZH19HoP+U1xpwYx9Q@mail.gmail.com>

On Tue, Aug 29 2023 at 08:26, Bartosz Golaszewski wrote:
> On Mon, Aug 28, 2023 at 11:44 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>> That's the module which provides the interrupt domain and hid-whatever
>> is the one which requests the interrupt, no?
>>
> Not at all! This is what I said: "we have the hid-cp2112 module which
> drives a GPIO-and-I2C-expander-on-a-USB-stick". Meaning: the
> hid-cp2112 module registers a USB driver for a GPIO expander on a
> stick. This GPIO chip is the interrupt controller here. It's the USB
> stick that provides interrupts for whatever else needs them (in real
> life: it can be an IIO device on the I2C bus which signals some events
> over the GPIOs). The user can get the interrupt number using the
> gpiod_to_irq() function. It can be unplugged at any moment and module
> references will not stop the USB bus from unbinding it.

Sorry for my confusion, but this all is confusing at best.

So what you are saying is that the GPIO driver, which creates the
interrupt domain is unbound and that unbind destroys the interrupt
domain, right? IOW, the wonderful world of plug and pray.

Let's look at the full picture again.

   USB -> USB-device
          |----------- GPIO
          |------------I2C  ---------- I2C-device
                 (hid-cp2112 driver)   (i2c-xx-driver)

i2x-xx-driver is the one which requests the interrupt from
hid-cp2112-GPIO, right?

So when the USB device disconnects, then something needs to tell the
i2c-xx-driver that the I2C interface is not longer available, right?

IOW, the unbind operation needs the following notification and teardown
order:

   1) USB core notifies hid-cp2112

   2) hid-cp2112 notifies i2c-xx-driver

   3) i2c-xx-driver mops up and invokes free_irq()

   4) hid-cp2112 removes the interrupt domain

But it seems that you end up with a situation where the notification of
the i2c-xx-driver is either not happening or the driver in question is
simply failing to mop up and free the requested interrupt.

As a consequence you want to work around it by mopping up the requested
interrupts somewhere else.

It's not clear to me what you are trying to achieve here.

   If this is meant as a hardening effort to catch such issues and let
   the kernel gracefully "survive", then I'm all ears.

   If this is just meant to paper over the shortcomings of subsystems or
   driver implemtations then I'm not interested at all.

Thanks,

        tglx





  reply	other threads:[~2023-08-29  9:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14  9:36 [PATCH 0/2] genirq: don't leak handler procfs entries Bartosz Golaszewski
2023-08-14  9:36 ` [PATCH 1/2] genirq: proc: drop unused argument from unregister_handler_proc() Bartosz Golaszewski
2023-08-14  9:36 ` [PATCH 2/2] genirq: proc: fix a procfs entry leak Bartosz Golaszewski
2023-08-24 20:12   ` Thomas Gleixner
2023-08-25  7:36     ` brgl
2023-08-25  8:11       ` Thomas Gleixner
2023-08-25 11:01         ` Bartosz Golaszewski
2023-08-25 14:58           ` Thomas Gleixner
2023-08-25 17:08           ` Thomas Gleixner
2023-08-25 20:07             ` Bartosz Golaszewski
2023-08-26 15:08               ` Thomas Gleixner
2023-08-28 10:06                 ` Bartosz Golaszewski
2023-08-28 12:41                   ` Thomas Gleixner
2023-08-28 19:03                     ` Bartosz Golaszewski
2023-08-28 21:44                       ` Thomas Gleixner
2023-08-29  6:26                         ` Bartosz Golaszewski
2023-08-29  9:11                           ` Thomas Gleixner [this message]
2023-08-29 12:24                             ` Bartosz Golaszewski
2023-08-29 20:18                               ` Greg Kroah-Hartman
2023-08-29 22:29                               ` Thomas Gleixner
2023-09-06 14:54                                 ` Bartosz Golaszewski
2023-09-12 18:16                                   ` Thomas Gleixner
2023-09-15 19:50                                     ` Bartosz Golaszewski
2023-11-13 20:53                                       ` Bartosz Golaszewski
2023-11-14 12:27                                         ` Greg Kroah-Hartman
2023-11-14 13:25                                         ` Linus Walleij

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=87msya6wmf.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    /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