Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3212184ybl; Mon, 19 Aug 2019 14:17:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwhN3aj2QXwAhga0GupECMzAqhXZ0QBQuqDdeiOGfCvBTevYnNHa9bSo1VfXlYihM9TWWU X-Received: by 2002:a62:c584:: with SMTP id j126mr26404967pfg.21.1566249447103; Mon, 19 Aug 2019 14:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566249447; cv=none; d=google.com; s=arc-20160816; b=xo100406u/gdIW4pQwU8ll8OQziG2Cfs6XyKcwdlUPYfjHfhe+aBObsiO3oFkgX5dq FBDFL/o5gCBIKCq2NED6ubYbhuGKVtMAfiseInOx+5RVZiGARErDfGxypJsKCF91hVzH aqfzAylXrKSa5fYbweOQAwkMmo5o8jCCO148VTN+FFYI/jYmgz25zp0AmzOwTBRjTavT I/ivxygm1es0b/R06707eWyXZsfo5+dy7Y+uAHm2k3mwOxRuAc6lT/DWorRXo0pfhqbm 0jkAEmOK6xOyCmKgRuCvMgFbNn6ogI0MMQmDqx+WHmeiEnvBncY73izsZRlKGb/rTr6d G86w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=sWTsELYzH1SlFoSEOtfuJ7YqVABtI46Vq4FYAzkSNWM=; b=IfsCwR4VMpA4Wr00S93hizOqH/b8jZaTkAQLhBGReoLSOSyzdlSDEZtypo4gBzNJmY o9ZLDYs3xzCVzPovXClwe5O9TEY006WKlvCGi11ZcJ0jtUvSK/J4+iipkL1FoPpY2kTH ej/blO7EQR5qQl4Q57je5meEVAY8jsV3Yq8k/6OMKkgIeGcdFRcnGRgOVQgjLC8Gl26G YyCdgSp72KVDpToWGulxN8Xq+St4EoIw6xLjpt6Mh+rByS1EHWanVLEtFZ3e3GQVnGhq Tg+xLy21Ebrb6GcE98j0M03yIGbyeZ5LRSEm6sGUEPsORChtBPXLKQ+weNKuszTyWmnj mgCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si10856669plk.268.2019.08.19.14.17.11; Mon, 19 Aug 2019 14:17:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728463AbfHSVQP (ORCPT + 99 others); Mon, 19 Aug 2019 17:16:15 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:42811 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727971AbfHSVQO (ORCPT ); Mon, 19 Aug 2019 17:16:14 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id F39598128C; Mon, 19 Aug 2019 23:15:58 +0200 (CEST) Date: Mon, 19 Aug 2019 23:16:11 +0200 From: Pavel Machek To: Wenwen Wang Cc: Jacek Anaszewski , Dan Murphy , "open list:LED SUBSYSTEM" , open list Subject: Re: [PATCH] led: triggers: Fix a memory leak bug Message-ID: <20190819211611.GA13437@amd> References: <1566247302-6217-1-git-send-email-wenwen@cs.uga.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <1566247302-6217-1-git-send-email-wenwen@cs.uga.edu> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Wenwen Wang Acked-by: Pavel Machek > +++ b/drivers/leds/led-triggers.c > @@ -173,6 +173,7 @@ int led_trigger_set(struct led_classdev *led_cdev, st= ruct 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); > =20 > return ret; > } --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl1bEZsACgkQMOfwapXb+vI9jACgqcunWuABPR8NQjbzqfWOMope tHcAoJmIhGa3fqwGm5MqOf6y8qdP52qD =uvQW -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--