From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73363563FC3 for ; Tue, 13 Oct 2026 22:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791931225; cv=none; b=DKKgg+DMWPsmBEQjwclPm65xUQVrHxfY+SUi/IbhN3GL/S3zn4TXj7z9Tcp4WUqDnxT5Dh/yTkcorzOZ4+58HJNxH21Jgl4ninJEswoLaLiMS5OUTv/YhxDMRHxZf3aXZC0moCuBFHSPNdWi2S5r430iLoorUoncJnRNTyYDe9w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791931225; c=relaxed/simple; bh=1NEN+Scbgml9ozAbt8aLROD/kvCT+P1eXcLOXmgikX8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Y6zeEvekWPxj91b9HG8VGft7QASvO8EycJkFHZnPzvJV8cCokEt4hAqHWmkye/VpMtiUyJcKNtEVg1IKUE5+XkQxVJXb1nF05MrhY1ghTLljqWr9cB66OIboYz+o9b9ws+WcDH5BAXsP1uhBf6lGGau8XWrqQKCCvv08FDV2JiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=p29oeSrJ; arc=none smtp.client-ip=74.125.82.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="p29oeSrJ" Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-3552883bd19so4648304eec.1 for ; Tue, 13 Oct 2026 15:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1791931218; x=1792536018; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qdtOvNbLAOJ9idJnmqNXkxs2lXj3bNW1pL8KRmE6mUU=; b=p29oeSrJx8sx71pHHqeoKYpTIv3xL5+8GPbJ84JE4rdi5B1MWGoo1IOyOw5d6DFgdg IRbnlsBCvSfMjK1UeC+3GnjLuJpZsdcB+ZWy9gWdm7TwuoWvqOxue3fQxEuTqR/PA5XZ Rl3qhOI9nPhRsqnK+n+jFiwtO44XfsVNb+A50hgPDLaGNF1Oip6WMD4I9jblXW+4ReAM CQsQzWaMfmqa1Pwmt+T8ZhbnDp1CAyJoSqubS63wqVVF9I4OUZ2PaVFEVYBZJcEQgYM8 xan0nG7Fqd4cCW/aAL7sQd1faAZiKWl0Ic6wMvf+k10hxT2rQ+CWvVc26aQaneFrkfCG Z2Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791931218; x=1792536018; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qdtOvNbLAOJ9idJnmqNXkxs2lXj3bNW1pL8KRmE6mUU=; b=xkgUYR0TJJHGsfGtuL4ay7me7q71GJr6xYieRjoce6gYlyuPizf2uLraLSEXjjk+jb 8fm1DNwTMSU6DjVXxPs0OsQBACmgPr1skH0rC4uZfhBIGn1AA2q8H3gp2tX6RCP5tV4+ WFPOc9XHw9qPyA53JD90Cg4A9hJLINUN3FmYzhsy9SjrJpUOYXZLnzStiBzPX70dkbbT C2Ohm0in7NKSwxvR82NQ0b16krhuryV0P4aEXyq1wQf35RUbE/iwv38tIpC+M1XRLgmb kB6am11Q1B06ximI60il/Rqmsd8a77aJ0HoJbaZM3ZE1hCT0hnYRbHVUq8fV+S6FZ9dN 3a0A== X-Forwarded-Encrypted: i=1; AKwUvBwKsVhbtAGWvX/jJURyFjqb0uU9YDIE0dBj/oPUumEZQzccfNM2dw6VudEldYrk7hO8qcRvkac4CiWG504=@vger.kernel.org X-Gm-Message-State: AFq9FYK0ZpMpS2/Cj04CLDnaROKGywSSSGlq3470xGxmR/B3tbSJV19j TXIYhZcYejMbnFK3JJTVNZIunZ5CwvVpN9xoClY5wpFvXWcq2yU1FqICdbcCxF469YDArdNvTX3 hvVKZw26FqQ== X-Received: from dycrm16.prod.google.com ([2002:a05:693c:2a10:b0:358:f250:485f]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:4141:20b0:35c:8d1f:5634 with SMTP id 5a478bee46e88-35c8d1f58e8mr4713972eec.12.1791931216820; Tue, 13 Oct 2026 15:40:16 -0700 (PDT) Date: Tue, 13 Oct 2026 15:39:37 -0700 In-Reply-To: <20261013223946.1836757-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20261013223946.1836757-1-irogers@google.com> X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261013223946.1836757-3-irogers@google.com> Subject: [PATCH 02/11] powerpc/secvar: Add missing kobject release callback to secvar_ktype From: Ian Rogers To: Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Miguel Ojeda , Kees Cook , Nathan Chancellor Cc: Nick Desaulniers , Bill Wendling , Justin Stitt , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Nayna Jain , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Viresh Kumar , David Teigland , Alexander Aring , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Richard Weinberger , Zhihao Cheng , Felix Kuehling , Alex Deucher , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , driver-core@lists.linux.dev, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, gfs2@lists.linux.dev, xen-devel@lists.xenproject.org, linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" In add_var(), a struct kobject is dynamically allocated with kzalloc_obj() and initialized with secvar_ktype. If kobject_add() or sysfs_create_file() fails, kobject_put(kobj) is called to clean up. However, secvar_ktype does not define a .release callback, which results in a memory leak of kobj (and a pr_debug warning in kobject_cleanup() when CONFIG_DEBUG_KOBJECT_RELEASE is enabled). Provide a secvar_release() callback that calls kfree(kobj). Fixes: bd5d9c743d38 ("powerpc: expose secure variables to userspace via sysfs") Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers --- arch/powerpc/kernel/secvar-sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c index 395399bbab2c..f3f6ac25ea78 100644 --- a/arch/powerpc/kernel/secvar-sysfs.c +++ b/arch/powerpc/kernel/secvar-sysfs.c @@ -126,7 +126,13 @@ static const struct attribute_group secvar_attr_group = { }; __ATTRIBUTE_GROUPS(secvar_attr); +static void secvar_release(struct kobject *kobj) +{ + kfree(kobj); +} + static const struct kobj_type secvar_ktype = { + .release = secvar_release, .sysfs_ops = &kobj_sysfs_ops, .default_groups = secvar_attr_groups, }; -- 2.56.0.385.gd3acb90ef8-goog