mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Wenwen Wang <wenwen@cs.uga.edu>
Cc: Pavel Machek <pavel@ucw.cz>, 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: Tue, 20 Aug 2019 20:27:36 +0200	[thread overview]
Message-ID: <18d06a7c-bac6-ad5b-198f-3ac373c44d47@gmail.com> (raw)
In-Reply-To: <1566247302-6217-1-git-send-email-wenwen@cs.uga.edu>

Hi Wenwen,

Thank you for the patch.

On 8/19/19 10:41 PM, 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>
> ---
>  drivers/leds/led-triggers.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index 8d11a5e..eff1bda 100644
> --- a/drivers/leds/led-triggers.c
> +++ 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;
>  }
> 

Added tag:

Fixes: 52c47742f79d ("leds: triggers: send uevent when changing triggers")

and applied.

-- 
Best regards,
Jacek Anaszewski

      parent reply	other threads:[~2019-08-20 18:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 20:41 Wenwen Wang
2019-08-19 21:16 ` Pavel Machek
2019-08-20 18:27 ` Jacek Anaszewski [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=18d06a7c-bac6-ad5b-198f-3ac373c44d47@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®