Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] gpio: mockup: add missing single_release()
@ 2019-09-04 14:18 Wei Yongjun
  2019-09-04 14:54 ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2019-09-04 14:18 UTC (permalink / raw)
  To: Bamvor Jian Zhang, Linus Walleij, Bartosz Golaszewski
  Cc: Wei Yongjun, linux-gpio, kernel-janitors

When using single_open() for opening, single_release() should be
used instead of seq_release(), otherwise there is a memory leak.

Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpio/gpio-mockup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index f1a9c0544e3f..213aedc97dc2 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -309,6 +309,7 @@ static const struct file_operations gpio_mockup_debugfs_ops = {
 	.read = gpio_mockup_debugfs_read,
 	.write = gpio_mockup_debugfs_write,
 	.llseek = no_llseek,
+	.release = single_release,
 };
 
 static void gpio_mockup_debugfs_setup(struct device *dev,




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mockup: add missing single_release()
  2019-09-04 14:18 [PATCH] gpio: mockup: add missing single_release() Wei Yongjun
@ 2019-09-04 14:54 ` Bartosz Golaszewski
  2019-09-09  8:08   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-09-04 14:54 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Wei Yongjun, Bamvor Jian Zhang, linux-gpio, kernel-janitors

śr., 4 wrz 2019 o 16:00 Wei Yongjun <weiyongjun1@huawei.com> napisał(a):
>
> When using single_open() for opening, single_release() should be
> used instead of seq_release(), otherwise there is a memory leak.
>
> Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/gpio/gpio-mockup.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index f1a9c0544e3f..213aedc97dc2 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -309,6 +309,7 @@ static const struct file_operations gpio_mockup_debugfs_ops = {
>         .read = gpio_mockup_debugfs_read,
>         .write = gpio_mockup_debugfs_write,
>         .llseek = no_llseek,
> +       .release = single_release,
>  };
>
>  static void gpio_mockup_debugfs_setup(struct device *dev,
>
>
>

Good catch!

Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Linus: can you pick it up for your last pull-requests with fixes for v5.3?

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mockup: add missing single_release()
  2019-09-04 14:54 ` Bartosz Golaszewski
@ 2019-09-09  8:08   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-09-09  8:08 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Wei Yongjun, Bamvor Jian Zhang, linux-gpio, kernel-janitors

śr., 4 wrz 2019 o 16:54 Bartosz Golaszewski
<bgolaszewski@baylibre.com> napisał(a):
>
> śr., 4 wrz 2019 o 16:00 Wei Yongjun <weiyongjun1@huawei.com> napisał(a):
> >
> > When using single_open() for opening, single_release() should be
> > used instead of seq_release(), otherwise there is a memory leak.
> >
> > Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/gpio/gpio-mockup.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> > index f1a9c0544e3f..213aedc97dc2 100644
> > --- a/drivers/gpio/gpio-mockup.c
> > +++ b/drivers/gpio/gpio-mockup.c
> > @@ -309,6 +309,7 @@ static const struct file_operations gpio_mockup_debugfs_ops = {
> >         .read = gpio_mockup_debugfs_read,
> >         .write = gpio_mockup_debugfs_write,
> >         .llseek = no_llseek,
> > +       .release = single_release,
> >  };
> >
> >  static void gpio_mockup_debugfs_setup(struct device *dev,
> >
> >
> >
>
> Good catch!
>
> Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> Linus: can you pick it up for your last pull-requests with fixes for v5.3?
>
> Bart

Nevermind - I applied it to my tree and will send it with two other
fixes in a PR.

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 14:18 [PATCH] gpio: mockup: add missing single_release() Wei Yongjun
2019-09-04 14:54 ` Bartosz Golaszewski
2019-09-09  8:08   ` Bartosz Golaszewski

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org linux-gpio@archiver.kernel.org
	public-inbox-index linux-gpio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox