From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04E86CCA490 for ; Sun, 18 Oct 2026 17:10:12 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4j74tV57C8z2ygK; Mon, 19 Oct 2026 04:10:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1792343410; cv=none; b=T0dpKr6ZXIFR3kPdmHWiYrIWu1kjwj/IJxbeKfSP9qKY4Tqooxu9ZTzbZe++AduTkW3LRSSjNWrtTjqQXXTSw1PsYy/2m9rU/W24grgBaRobVDUBanXYLjTQZhhMqdSh4sILSn+MWEgm3zHFJEjR2kRG8+wJ6Nt9YL0KAq8V9eJESYGQ6yQLqFHpcq45cqwaRAprEnyjrtFWutvbo/x0H+DexAV2+Z5y2HJz/DIRlJRklXU/l9nq4RVleYrpJOe6XUbAF/7Z11S8DJ1N1VRJxVhR6B67N2JF21RIuR8eCDP4YTa8Fwwg/czsNN5CPF9OuXyB5Yxyn6sH2EUZJ4k0pQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1792343410; c=relaxed/relaxed; bh=AkubgfKKCqmlBjsLOPi74HWrQsSj7O0vEuZUA4HCxyg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Smw2SzMs5pt/mXhYKex/0RERjFWM1c3BzFqVD8UY58r9dly2tcXXK0ysDuiatAL8KbhV5yh09wsQESfkfLSX80Yge7eF3d7OhKyJpLfuVl473ixDAP5rYRuzY3mG5qscdxYJCNVeNq5AEaFSYHs0gdzvHtnXZNlLbinNmLxzojo7Fd2eqrJ7am7o8sC7VGysZaGty4RLe6JHV/HTxAuOlfi8spExZTvuubhVTwXldep48HW8SPlukd7ZeVnBlwsjsbwr+2Lmf6o2GKB6YrNQMoiGV4Q5L42j/v44Ljdr0zFf1Vy7sb5vYGYpYirYfcL8OoNyMQ2FY3aKnlxTTc8otQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=A6FmOQcY; dkim-atps=neutral; spf=pass (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=ssrish@linux.ibm.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=A6FmOQcY; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=ssrish@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4j74tT6NtZz2xg9 for ; Mon, 19 Oct 2026 04:10:09 +1100 (AEDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69IFF3jJ1211885; Sun, 18 Oct 2026 17:09:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=AkubgfKKCqmlBjsLO Pi74HWrQsSj7O0vEuZUA4HCxyg=; b=A6FmOQcYly34hnyT2CNoKpyM/6yuus58g w+/zdzhVd8bxHkOulqprSnqZDdvRocRMLrs4aSWO4mOmxaCXOu/IpS0jyT1NF5ZG GNMNmEYINMxSINy5qulHXmL2FJ0PEKPEAjOkwS4D7ZFVr2TQKopxPUKMmebSA/s6 8ImMfFRYq8/0HcXD0JPL+QW5n4q3nBlB/eS4wKAUzCY26XZ+Thby51qOF/CHCWXw W6B/Qa6A64UWQQ5JoOtPIWeq8vWc0X0uIbVqnhA4DFYEvEComPNKZlTm0IRKqr5M 3cD8oqgZBnq9gRWcmlWWU2COwNoZ4NJpElv85kxKmNlrwRZtVjYtg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4hbxehpfuu-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 18 Oct 2026 17:09:56 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 69IFJun82693219; Sun, 18 Oct 2026 17:09:56 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4hcmbjt6dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 18 Oct 2026 17:09:55 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 69IH9q5t14614906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 18 Oct 2026 17:09:52 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 016CD20043; Sun, 18 Oct 2026 17:09:52 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 684B120040; Sun, 18 Oct 2026 17:09:41 +0000 (GMT) Received: from li-fc74f8cc-3279-11b2-a85c-ef5828687581.ibm.com (unknown [9.67.125.165]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 18 Oct 2026 17:09:40 +0000 (GMT) From: Srish Srinivasan To: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: maddy@linux.ibm.com, ritesh.list@gmail.com, sshegde@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, James.Bottomley@HansenPartnership.com, jarkko@kernel.org, zohar@linux.ibm.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, nayna@linux.ibm.com, rnsastry@linux.ibm.com, ssrish@linux.ibm.com, stable@vger.kernel.org Subject: [PATCH v5 5/9] keys/trusted_keys: fix PKWM output buffer cleanup Date: Sun, 18 Oct 2026 22:38:40 +0530 Message-ID: <20261018170844.491252-6-ssrish@linux.ibm.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261018170844.491252-1-ssrish@linux.ibm.com> References: <20261018170844.491252-1-ssrish@linux.ibm.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpo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:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-18_03,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 suspectscore=0 phishscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610180066 The PKWM seal and unseal paths unconditionally free their output buffers, but the PLPKS helpers can return without initializing those pointers. Initialize the output buffer pointers to NULL to make cleanup safe on early failure paths. Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source") Cc: stable@vger.kernel.org # 7.0 Signed-off-by: Srish Srinivasan --- security/keys/trusted-keys/trusted_pkwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c index 633a7674d065..7345f233eb74 100644 --- a/security/keys/trusted-keys/trusted_pkwm.c +++ b/security/keys/trusted-keys/trusted_pkwm.c @@ -82,7 +82,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob) { struct trusted_key_options *options = NULL; struct trusted_pkwm_options *pkwm = NULL; - u8 *input_buf, *output_buf; + u8 *input_buf, *output_buf = NULL; u64 output_len, input_len; int rc; @@ -129,7 +129,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob) static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob) { - u8 *input_buf, *output_buf; + u8 *input_buf, *output_buf = NULL; u64 input_len, output_len; int rc; -- 2.52.0