All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Wenwen Wang <wenwen@cs.uga.edu>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Dan Murphy <dmurphy@ti.com>,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] led: triggers: Fix a memory leak bug
Date: Mon, 19 Aug 2019 23:16:11 +0200	[thread overview]
Message-ID: <20190819211611.GA13437@amd> (raw)
In-Reply-To: <1566247302-6217-1-git-send-email-wenwen@cs.uga.edu>

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

On Mon 2019-08-19 15:41:42, Wenwen Wang wrote:
> In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is
> not deallocated in the following execution if the label 'err_activate' or
> 'err_add_groups' is entered, leading to memory leaks. To fix this issue,
> free 'event' before returning the error.
> 
> Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>

Acked-by: Pavel Machek <pavel@ucw.cz>

> +++ b/drivers/leds/led-triggers.c
> @@ -173,6 +173,7 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
>  	list_del(&led_cdev->trig_list);
>  	write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
>  	led_set_brightness(led_cdev, LED_OFF);
> +	kfree(event);
>  
>  	return ret;
>  }

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2019-08-19 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 20:41 [PATCH] led: triggers: Fix a memory leak bug Wenwen Wang
2019-08-19 21:16 ` Pavel Machek [this message]
2019-08-20 18:27 ` Jacek Anaszewski

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=20190819211611.GA13437@amd \
    --to=pavel@ucw.cz \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=wenwen@cs.uga.edu \
    /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.