Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp750001rwb; Fri, 4 Aug 2023 23:44:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8fSz9KDGOzHDhrlzMupObH6ebfX3jsw/QjhQCf+7iFFxhXkzKA2Qgi2emgxjMdC6/fs3w X-Received: by 2002:a50:ed90:0:b0:522:56e7:bafb with SMTP id h16-20020a50ed90000000b0052256e7bafbmr3050159edr.19.1691217863209; Fri, 04 Aug 2023 23:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691217863; cv=none; d=google.com; s=arc-20160816; b=0n0BS6Hh0T4roQ0LTtWN6ISEJcTeUIPbUOU6wLy3JEqHRZp4obxJNycoIXpEiGamIZ r7QRZ9G7Z7oMn7QxJuMhIAfO8QnkCrrn1iPDwhWCaI2MUE0s+CZVpdTL/tr85aDRcQx/ xYNIFf0/9Unzzy6iVZa5LuUK/nE4NzvLCKauUONzRQtcQXA470WSkIk+niVwfNyW+/GZ 5F/jFeVPOyLWurvzkxQeiZdjVtylYsMoY8s2lxua2m9Ini/33LJhA120Ik+w/K6P8z8R lpKsgCIcys8zPFEZ9kXDhOCsfCi1fEm+4Heh0zRrq1/+xePFimCYRbY53QmCloLQm14y QA9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=kEGhPzXMYePV/Jlt5jk4DFtHpZ+3wMxEH5Cl+glWLIc=; fh=IimzwwkUlwI5Pyptv4XejKICTw+a2ELPlXTRcSRIuAU=; b=GH9fmFw4NdHQO8lq5+Z/Lprokq01HNXrXPobkOEem0tUcU0OaZTTxfadYjvOKhvLft 1PJwYh/o4cvopCU0MxBoxc1rWDAP/6O6C9E8dHSdNWnAh1SO2/7uwMO/q5udcydEhsX8 ri5Klm765RqjJKpAK7I9jUnwDtAAzdMJMeQl43GQm+Hf7U8bB/EUePwqSQ+zjjMpTjE4 yhBcvjnnG2W68XhnexGmdEL9xyoFLFn/XDhMncQzKAaNArj/a5pfqpKucKcSpZIykGic /PBUWvlE8r+irFWHS5AA0NSJSeQoTxGgTd14Ymm5+hYO7CZIaolCsgpBboUehU7T3fRm mvjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=WztmmToY; 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=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020aa7d60c000000b00521937f0c53si2736064edr.489.2023.08.04.23.43.58; Fri, 04 Aug 2023 23:44:23 -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=@gmx.de header.s=s31663417 header.b=WztmmToY; 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=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229530AbjHEFg1 (ORCPT + 99 others); Sat, 5 Aug 2023 01:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjHEFgZ (ORCPT ); Sat, 5 Aug 2023 01:36:25 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC8146B3; Fri, 4 Aug 2023 22:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1691213772; x=1691818572; i=w_armin@gmx.de; bh=Xc5Uz3yHM1cYmTbfdHFbQvSyh54bIq4BmIZkafOGP8Q=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=WztmmToYD9V4MELG/sZBCibor6a4SSfMWRdoyJwHc7C0tXWvmk3fm8nxyAbcqUfSXxfkXJe k28cl35Y2q8MG3wnrNhURND5OZxLtlHM3JuAGpiU9IXEm3ef7qZciXWR681lqMjlYWmX757Xo Z4Zu9YgtYe66nxjySsjLkYbpkQNmwY4JYKiqL1f0LdnPAFq+F7ynjM8xfZWC1q8jb5IO7zzvk mnas6TjctvI9KBwczHsxQXDkJEjvoDssLcR5gWbZNQuD/1M8YCW7cls5jtLwsui1z5FWuxZ+n qN7mM0A/o8Q7DzUOGBVa12xXz3OSNt11IPQYRGfh1Ve2+MzQu6Sg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N6bfw-1plbjW1n14-01816B; Sat, 05 Aug 2023 07:36:12 +0200 From: Armin Wolf To: prasanth.ksr@dell.com, hdegoede@redhat.com, markgross@kernel.org Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: dell-sysman: Fix reference leak Date: Sat, 5 Aug 2023 07:36:10 +0200 Message-Id: <20230805053610.7106-1-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:1Ex/nogT+uSYoxHzoSeE2GZ+pKYhOchFCLlj5z6jUoNGPKe2SjA J75Wan7+Iwod2cEJ44K77Zx9Bcfju/lM7QwMk13kUe78nf2kInsQx8mjbMdGFbOp7Hl1Mm7 qTGOpryQvdv4uQSTAA1oxpKxRxyI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/yyHmifFLaxd6 xtC+tTaLCJiJkPzV4iZ57AOctyM= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 If a duplicate attribute is found using kset_find_obj(), a reference to that attribute is returned. This means that we need to dispose it accordingly. Use kobject_put() to dispose the duplicate attribute in such a case. Compile-tested only. Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Manageme= nt Driver over WMI for Dell Systems") Signed-off-by: Armin Wolf =2D-- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/= platform/x86/dell/dell-wmi-sysman/sysman.c index b68dd11cb892..b929b4f82420 100644 =2D-- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -393,6 +393,7 @@ static int init_bios_attributes(int attr_type, const c= har *guid) struct kobject *attr_name_kobj; //individual attribute names union acpi_object *obj =3D NULL; union acpi_object *elements; + struct kobject *duplicate; struct kset *tmp_set; int min_elements; @@ -451,9 +452,11 @@ static int init_bios_attributes(int attr_type, const = char *guid) else tmp_set =3D wmi_priv.main_dir_kset; - if (kset_find_obj(tmp_set, elements[ATTR_NAME].string.pointer)) { - pr_debug("duplicate attribute name found - %s\n", - elements[ATTR_NAME].string.pointer); + duplicate =3D kset_find_obj(tmp_set, elements[ATTR_NAME].string.pointer= ); + if (duplicate) { + pr_debug("Duplicate attribute name found - %s\n", + elements[ATTR_NAME].string.pointer); + kobject_put(duplicate); goto nextobj; } =2D- 2.39.2