Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4235056pxp; Tue, 15 Mar 2022 16:02:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5uEATMB1Adznc+aE9gpdi8WhphfXB575bT9IQv/3Q0KXvCILDyP3tjXnGdAclEGrpLrW/ X-Received: by 2002:aa7:8385:0:b0:4f6:ef47:e943 with SMTP id u5-20020aa78385000000b004f6ef47e943mr31515869pfm.38.1647385360767; Tue, 15 Mar 2022 16:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647385360; cv=none; d=google.com; s=arc-20160816; b=HEci7Lm0Fdc2bvnTNGmtL6qtaHuHKtqfuVSVClv52VGpjVk+lFcqNMdSlcEI8YKW44 aYuSLF8wKb+cfQiaU2ZxsjNdl0aA/PHCC7vIYqgxi50GQTsFuIrHCj+woW9I8BZYf6q9 QgzD/7RMWDV+kmbXb/+Z8iQAmnFDNASXTm5Y92aD9bN/IKe2uMsQqYLR6bR2EyLqMrwX Jk9u93+39FMiG7e83NbS1T4E+om4x8R1DkKpg/QKHbfkw6gD3MBmKMhAE/7mHz7sKEsY rbNpphiHSoIbseS00mjX/dT+IOAzITdtzzGFQLt4Ul6ksSQEN1MmK8jfKRXGrxBXg+tY tvuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N0Pq6E4kPczwvAXAzwia3kRyklODEhKIYBJ6Lw2PKJ8=; b=BwdtirnXdcujsOnaIc6Q7g3QR9qwXJkkvl/GXj6JEv+mCdECGRDE8yuQM7OD/OTSe8 6HaYq7ltJ2HfZJlIOvBuyInROtjbKv9mBIREP84MeC8Y+vI7ARSqrlwdnHbrEYRpO36G glH0mdXqlZLM7KDZxISroDBZvogfXBGd3GC5SHtSBjXXC3PifJGYF5JaDS9acydQ/0fM rvfUeSuA8cjRhJfbjx5d1+8695lhqv7DLQEZ4kwo2yH0YL73HvjrkWhrWfwwt5akdfEO Kq7Ga7LlABvtAqVvDCTLI0/tyQyzqouH/T8RsafJ5Xo+Wuc6JIKv6fAES1OPBRKkq4jr cbmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FsSelRC7; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a17090a014800b001bd14e01f69si3477099pje.87.2022.03.15.16.02.25; Tue, 15 Mar 2022 16:02:40 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=FsSelRC7; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243144AbiCNMah (ORCPT + 99 others); Mon, 14 Mar 2022 08:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241952AbiCNMSf (ORCPT ); Mon, 14 Mar 2022 08:18:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4A039811; Mon, 14 Mar 2022 05:13:13 -0700 (PDT) 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 E9002B80DFB; Mon, 14 Mar 2022 12:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D1CC340EC; Mon, 14 Mar 2022 12:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259990; bh=FqpALfqcNa6EdMdvrr0CBCpp7kSW2XO976p/OpdCGBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FsSelRC70yOFyyaVbfhPWSl5BMERyC9tY/3BeBrgactstsySp1OnNoqRguX9/pCnc 6/M9BYrHnDcATd3NclHytwjfpJgn983r3iXDEadLHWBimPf/3bVIDENmWkSiRe8DQZ EGgFP4jFs9zAxcBaIaJocuwa/A1TGIDBJ0ez9T20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Stephen Boyd , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 009/121] HID: vivaldi: fix sysfs attributes leak Date: Mon, 14 Mar 2022 12:53:12 +0100 Message-Id: <20220314112744.385427545@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 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 From: Dmitry Torokhov [ Upstream commit cc71d37fd1f11e0495b1cf580909ebea37eaa886 ] 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 Tested-by: Stephen Boyd Reviewed-by: Stephen Boyd Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- 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 576518e704ee..d57ec1767037 100644 --- a/drivers/hid/hid-vivaldi.c +++ b/drivers/hid/hid-vivaldi.c @@ -143,7 +143,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[] = { -- 2.34.1