Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp699697pxm; Fri, 25 Feb 2022 17:38:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNdQar/MTQaq5Dpq1QWh2PI3eVjdB4m9lxAsKIpBsTZfCUxpJIps/lUCyuCQkJB0FwXqTO X-Received: by 2002:a17:90b:1896:b0:1bc:62f1:d859 with SMTP id mn22-20020a17090b189600b001bc62f1d859mr5828299pjb.18.1645839518878; Fri, 25 Feb 2022 17:38:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645839518; cv=none; d=google.com; s=arc-20160816; b=PEIp0WDiE2GNcS2TTr37kI/4OdqzsJukb4Ca854tOCkdOzy6OgA0vU2E30T/RWi1cj nkExs2Tg4BkFStr3mIXPcbsY1aeKHS/a4YOkLDOxhgdzRRkplulU85tqcR2hrYWxlboS fr8PAQ6cEJey1rR5rh6bFA4fQcrq/+7dY+IMBx5RMXN/EzNiJT3BUCAjWwAOFRhx6qGz zfg4rXb99LNQj0iPv404BZtAJRyBjkKjcOoQH7WUcvY1v4whME1iUD1Dusb39hh15u0s VBN/CfvlEO8zadmdaipxeUSvgFNB5FEiTRRUU35chSS28AV6R6NoRFyw1md3phg60PrR Qz3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=Xf19W65T+aquV1Z1erkfVQlxQTRcO+WOHA5YfbjFpt8=; b=i/v4AnFZzbjA5hQhsXRy8lvJPsQBKOZIoUqPqVNiosjGsvq1gX8vMZ9quvWtdXq93C /V8Qf04zQuvSNytWtyOLx2GkK01YIBUYWV2apHwJDpc1LYYaOv2y00jCB+j/CPATzRpO W2tn2Wq9xuypeBn3JfIeJ94dCW9m1PI/hONz8zZeWNIxUa3Yc7mxnVmiF7+oqFSn8UUE H8RFuexlOCDPDZYwKRHHbIvUi5SCK/dmvedi7tKT4DDGMvNYhfYs53RP50D1kajVvqdl THy9XozzSnTftFHPXBQXEYWPnVQGNkWNVU8it446FCBvJwxns/EAZwcixcp7r6QJdfZV 7m0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=a8tbBrwG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m15-20020a170902db0f00b001500140c69csi3346354plx.123.2022.02.25.17.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:38:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=a8tbBrwG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8AE7E1F4876; Fri, 25 Feb 2022 17:32:16 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241245AbiBZBTh (ORCPT + 99 others); Fri, 25 Feb 2022 20:19:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232978AbiBZBTg (ORCPT ); Fri, 25 Feb 2022 20:19:36 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E93C18FAE0; Fri, 25 Feb 2022 17:19:03 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id d187so6143930pfa.10; Fri, 25 Feb 2022 17:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=Xf19W65T+aquV1Z1erkfVQlxQTRcO+WOHA5YfbjFpt8=; b=a8tbBrwGlVOHOsnoyKWhOvTDR1Cf9SHfvKAVNRRrL7COKs27aA6ywdStVwjvpCXGst GYJcMo2dbLdt8cAxbDNytTj3oPENWquE/I3gzxBTCIg3cmbM402ZUc/h6KgCeZoGbQnE mzMLEdZPjd9QidlBroktklkDLtHLtxtWoed92992F7DF42S4l8KuRRlf15SLOWGnpvMW S9vrOsG2Agrf0N3ZNlvTDfg5UqL1DN1l2C/XR733whZcU9e3WmtX8WC7lPpsb7pc0qb9 HetdyFCOfSpEFKsDstYSCH7KInVyra0yb9zJ5T3SW6sYAbO+esjs1U2Q8EucNduZ/OWZ LNCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Xf19W65T+aquV1Z1erkfVQlxQTRcO+WOHA5YfbjFpt8=; b=k9mlnR1bY1fS6vMnYJ1HZbrrlwW6JHdMnpnlsUYGrW8CjOq7uTpALMfJpQnnTKtP7O ZqUVPG/dsJvGqEF5KYxYdcsNqRrW4s7I6PJVzXMIU4cnjVC9BviLa/ZwdWA14qOb9PQ9 FZ7QwIZkkEAgujIsk7M3DYiVZupFcT7LXLcJ3bVzLfOR5/ZQlaG2qQBtqFR+Nq9s0qVn 6fpC5hTHsesFMRwknh0cfOh044tmHqPjBNFRtIYo6hjhZ3Mvwazn2tbRPeI8HdOEYbwm iEiOdcgRcZMLFNeGzEdYfgxd/iLlcb6gu8MyINkjmSNhMrG+ta8EmiHYG3TxOrdGr17j 4eDw== X-Gm-Message-State: AOAM532Tac8/b1yHA6bicR7sgeQRHtkSze8z5+Pr4z3ftvsZZ1sNaERY 5E+wexq7/FlCRfX1SxmKX4I= X-Received: by 2002:a62:e813:0:b0:4e1:922a:2a6d with SMTP id c19-20020a62e813000000b004e1922a2a6dmr10660636pfi.50.1645838342573; Fri, 25 Feb 2022 17:19:02 -0800 (PST) Received: from google.com ([2620:15c:202:201:a91a:1bbf:dba0:d0eb]) by smtp.gmail.com with ESMTPSA id j19-20020a62b613000000b004e1b0df0713sm4197867pff.188.2022.02.25.17.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:19:01 -0800 (PST) Date: Fri, 25 Feb 2022 17:18:58 -0800 From: Dmitry Torokhov To: Jiri Kosina , Benjamin Tissoires Cc: Stephen Boyd , Sean O'Brien , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: vivaldi: fix sysfs attributes leak Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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[] = { -- 2.35.1.574.g5d30c73bfb-goog -- Dmitry