All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH] gpiolib: cdev: fix NULL-pointer dereferences
Date: Fri, 25 Nov 2022 19:56:09 +0200	[thread overview]
Message-ID: <Y4EBubusGqo4IroP@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=Me83-_oiGEmwy4BUrzLEMT6ZsoMwWYsb6iXwg19yHMHdQ@mail.gmail.com>

On Fri, Nov 25, 2022 at 05:48:02PM +0100, Bartosz Golaszewski wrote:
> On Fri, Nov 25, 2022 at 5:24 PM Kent Gibson <warthog618@gmail.com> wrote:

...

> Then at the subsystem level, the GPIO device struct would need a lock
> that would be taken by every user-space operation AND the code
> unregistering the device so that we don't do what you described (i.e.
> if there's a thread doing a read(), then let's wait until it returns
> before we drop the device).

It's called a reference counting, basically you need to get device and then
put when it makes sense.

> This wouldn't fix the case in which the same situation happened in a
> kernel driver but crashing the kernel from within is a much lesser
> offense than allowing user-space to crash it.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-11-25 17:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 15:32 [PATCH] gpiolib: cdev: fix NULL-pointer dereferences Bartosz Golaszewski
2022-11-25 16:24 ` Kent Gibson
2022-11-25 16:48   ` Bartosz Golaszewski
2022-11-25 17:56     ` Andy Shevchenko [this message]
2022-11-25 18:02       ` Andy Shevchenko
2022-11-25 21:03       ` Bartosz Golaszewski
2022-11-25 21:33         ` Andy Shevchenko
2022-11-26  0:39         ` Kent Gibson
2022-11-26  4:02 ` kernel test robot

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=Y4EBubusGqo4IroP@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.