Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2100060rdf; Mon, 6 Nov 2023 04:57:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrFZAB2EQEJVbX8nzlDLeqbaSOT1BiG5BIv5Ysv0abvDA4u6qh2NhboZ3fLvW64o3ybmWy X-Received: by 2002:a17:90a:1a:b0:280:1d7f:440f with SMTP id 26-20020a17090a001a00b002801d7f440fmr20169919pja.26.1699275433655; Mon, 06 Nov 2023 04:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699275433; cv=none; d=google.com; s=arc-20160816; b=iyzyYioIbZM5ZqtJ6i9gyKtx8RM67/zoYpkCPcuHQiQyZsauosDf3BQK3Hx4vq3lhr 81FSuJmAuiMVaP7Qk4by40U3ULLPYFvpEBk61d+gdJqSpxu2AkNlwIgdkmcSsm11QoDi YDzv0CIN5guEFk0K+uy50137zOFhkfN22I0qExHPBn9yX6Z4JrA1qktlDTPCyTuTGrBx jq8ZSmJysWa6sfNRhOv3B4YErWmwyUf1hrU4AK2D+HBAnx1/gTOuWhzlXce4ecyVaS6E nUxo18TIu90W/Teu+nlBcJ2ZD1B6GCDHOpYgQhQcovPa0KK3VtW5lgmPolvUImdaMcEp tV/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S+S7KmsX3GFHCegboU1gXYl66Q3Pry1JLrSMWqvwjRM=; fh=vZfb3O80gXx+GWahWnKknQMjJZuXMRkYD83JzxokXDU=; b=GpgIjhEgMdbN/RNwjcnG03UXl4fdEzWMLsIzFJhamK5nC9aw4Bvt96W0XiEHYF8fnS ZO+xw4HvFzyTdtOFBnpGtl87K2MXq5yYn1lHHbXvVKmMPyM0B72WXjWabd2bl5wjBdNR 4mzQZabETvQVSziItD3gxtQ/LmXItuqn0o3KC3c/KMwp6IjeZl3Zn9XOdZ59O3doZOPm eTtMyVg8HJFGODHjGS7Z6Llnxn+fkw6Wvdc60qh5k9RnaXSRADEcyw0Trab7rjtOpUQu 2c7sLw+45cjZqOlfnpxB3exvuPkTLfthITyNEDRK2eOgq+PbSrWObciBtb8sLETvvYvh MBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UC/qHwhC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i5-20020a17090acf8500b00263eb5054f2si7863870pju.105.2023.11.06.04.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 04:57:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UC/qHwhC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4F49F80417DC; Mon, 6 Nov 2023 04:57:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbjKFM5J (ORCPT + 99 others); Mon, 6 Nov 2023 07:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbjKFM5I (ORCPT ); Mon, 6 Nov 2023 07:57:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F22AB8; Mon, 6 Nov 2023 04:57:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9388C433C7; Mon, 6 Nov 2023 12:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699275425; bh=91XMDEaz+kg1KIfgTuYeEQd868vbHqKOBc+0GMghNjU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UC/qHwhCjj/GJSxAM1U/h1CtMYMg5SBK92CjxGCOk9iV2g/qluAsrPX6+xFkFhQFg VbSlddBIP4KBRJBPn2QroY5rUgVYFEXIZULT3/05xshggwTWTb+mSlWnmqewBXJ+jr t5L8jjNNjVPlr7Qy7NgdaiT+t6Vtjbgbfia0P6ow= Date: Mon, 6 Nov 2023 13:57:02 +0100 From: Greg KH To: Florian Eckert Cc: Eckert.Florian@googlemail.com, jirislaby@kernel.org, pavel@ucw.cz, lee@kernel.org, kabel@kernel.org, u.kleine-koenig@pengutronix.de, m.brock@vanmierlo.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [Patch v7 2/6] leds: ledtrig-tty: free allocated ttyname buffer on deactivate Message-ID: <2023110653-deceptive-camisole-0d2d@gregkh> References: <20231106123415.3365732-1-fe@dev.tdt.de> <20231106123415.3365732-3-fe@dev.tdt.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231106123415.3365732-3-fe@dev.tdt.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 04:57:12 -0800 (PST) On Mon, Nov 06, 2023 at 01:34:11PM +0100, Florian Eckert wrote: > The ttyname buffer for the ledtrig_tty_data struct is allocated in the > sysfs ttyname_store() function. This buffer must be released on trigger > deactivation. This was missing and is thus a memory leak. > > While we are at it, the tty handler in the ledtrig_tty_data struct should > also be returned in case of the trigger deactivation call. > > Fixes: fd4a641ac88f ("leds: trigger: implement a tty trigger") > Signed-off-by: Florian Eckert > --- > drivers/leds/trigger/ledtrig-tty.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c > index 8ae0d2d284af..3e69a7bde928 100644 > --- a/drivers/leds/trigger/ledtrig-tty.c > +++ b/drivers/leds/trigger/ledtrig-tty.c > @@ -168,6 +168,10 @@ static void ledtrig_tty_deactivate(struct led_classdev *led_cdev) > > cancel_delayed_work_sync(&trigger_data->dwork); > > + kfree(trigger_data->ttyname); > + tty_kref_put(trigger_data->tty); > + trigger_data->tty = NULL; > + > kfree(trigger_data); > } > > -- > 2.30.2 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot