Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp135864pxm; Wed, 2 Mar 2022 11:57:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw35k6q+IzxnjX3/YqxZfHPAGhcQpvNQBn1gRRouqf3uZKKCuQoDKMahkvM919+ddHGs0wa X-Received: by 2002:a17:902:8a8a:b0:14d:bd69:e797 with SMTP id p10-20020a1709028a8a00b0014dbd69e797mr31952591plo.49.1646251054320; Wed, 02 Mar 2022 11:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646251054; cv=none; d=google.com; s=arc-20160816; b=K84rtyyIKL0Ein/yRpOvZbdHevRvpT98hcUPoiBl5+LhNsFjdZwlih+MLxJSkox+TC Nw6VHY+nHxCyUoj/GDC4a7JOloUTlLyhI0ejBpFa4yu5OgWQ2issWF0TirmnkMf9IH5e 46QZX9sXy7Sprn2MVpKo+F6j1lTyCu0VWiMyEA2Xvjw9xF3vATjZ/o03HHeyFoCWH+Vc zT3NmjHx0mEbo2qeInP4lryhsJdJ3DDT3xQfMYJ2mNQTmYkVoXpSU8y7Fw1sypZw06/W zqLjWXr/qyR1Csvw5/iDaVxAsDX4DtcgpLxls7ST0lHEb3P78h5Mb0zPzWb24fQZdAyq 6hQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=26qAZ8Q2pHBdn0K0eCFUvy+r01d2r5enzn016+wPVs4=; b=DXuUC1jMD1Qi5ay4LhhmOF1KO4QIDB2iI/LRDwHFPJ7Gqxcrt6jwCPAvmWqR/q84y0 8IibX8TEQjFt6iFwryF+YbC602tm6Syji7DwTWbuULhcinE1tSx6bBM5Y5tiWwb4jtV6 S4JvRSqDgtYgMyn1bSp1LgbrYh4mHMZWRzfVdZvQQ6PCoSwQTIEhzbJW3T9xxX8wlaXC u+fEP9wlkuBxLqUsM0y/YdsfwKXrQUlFMYF4oe2TnsYDiBY04awshEf/BuO3qe/DjCbd icTGHRPz+KQXfQy4NfvshvVQ6e0u2H86OG3Tra3GCZfODkfOgMo2iW0HgHEi8Isw9P5y 0X7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1iB8bj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a170902f64700b0014b4bc60e72si17066903plg.261.2022.03.02.11.57.18; Wed, 02 Mar 2022 11:57:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1iB8bj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235245AbiCAOcd (ORCPT + 99 others); Tue, 1 Mar 2022 09:32:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231699AbiCAOcd (ORCPT ); Tue, 1 Mar 2022 09:32:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E15DA145D; Tue, 1 Mar 2022 06:31:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E637DB819EB; Tue, 1 Mar 2022 14:31:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 557EAC340EE; Tue, 1 Mar 2022 14:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646145109; bh=z9sBMCaC7PrIXmRTVNKzPUl4Np+y5tuogN0n+r7OyP4=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=X1iB8bj0FXrV0BTbZZ6gw/o6yeajKjg755ldIZFdjzmiumf0foSn2ehK/kEZS7Qhz GJMVdo/q+UUyHELVIji7Xhb1YU2kG8JKaF4H3zE4BzFs6yF+Gz+UQhUOZCXYUbKchI uX8QucfWMKUGoI3EI+jXD4pGSdMq419cDFrkKNVe4R6hjpuJb2eUsRzRI41oC7Q6oX D1zZuTVBy+CXFQyUjY0KbrGAJoVXhxB246ha9TOMyxTVSb0fDiR2fInLMwFndCS2GB nIMbsWTHpmf4WW40FBp4IzpXjterVp9req2ZylVlDZVXBtnbQisbmuUEosYN3BEvyi p8WmeT08fknlg== Date: Tue, 1 Mar 2022 15:31:46 +0100 (CET) From: Jiri Kosina To: Dmitry Torokhov cc: Benjamin Tissoires , Stephen Boyd , Sean O'Brien , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: vivaldi: fix sysfs attributes leak In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Fri, 25 Feb 2022, Dmitry Torokhov wrote: > The driver creates the top row map sysfs attribute in input_configured() > method; unfortunately we do not have a callback that is executed when HID > interface is unbound, thus we are leaking these sysfs attributes, for > example when device is disconnected. > > To fix it let's switch to managed version of adding sysfs attributes which > will ensure that they are destroyed when the driver is unbound. > > Fixes: 14c9c014babe ("HID: add vivaldi HID driver") > Signed-off-by: Dmitry Torokhov > --- > > Compiled only. > > drivers/hid/hid-vivaldi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c > index efa6140915f4..42ceb2058a09 100644 > --- a/drivers/hid/hid-vivaldi.c > +++ b/drivers/hid/hid-vivaldi.c > @@ -144,7 +144,7 @@ static void vivaldi_feature_mapping(struct hid_device *hdev, > static int vivaldi_input_configured(struct hid_device *hdev, > struct hid_input *hidinput) > { > - return sysfs_create_group(&hdev->dev.kobj, &input_attribute_group); > + return devm_device_add_group(&hdev->dev, &input_attribute_group); > } > > static const struct hid_device_id vivaldi_table[] = { Applied, thanks Dmitry. -- Jiri Kosina SUSE Labs