From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0FD1265606; Tue, 21 Jul 2026 19:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663793; cv=none; b=s16lMJTz9T3J18KOfPu6D2RyVB15sCw1yz9Pcq73BgecRlz1z+XJFFgl7TyF5bglhqSdyP+ePYar3XizcfK564Qa/Ll2mlnpQsCyjU4BsBV84S/g9958oIV0a5Kw0HcWyjlLSJhD7WBqhMPxY1RAdsHfWKph+PgGT+nn20G4KfU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663793; c=relaxed/simple; bh=Dx4GMhfm6FAOHTIl1mS9U+YC+cRvReArb6tspBa7goI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GKci38R43VLOoc0sv7+uPmWm2e0KTIOItMnjxMs5tY+A/PxZNzCNxgoxWoR5F3QTmfCy4Jls4YdUu6ViE+Y4c2mAZheAXZhpfPP0Y7fxemUFuKdasJQsnFsyn8U51rrfT+AJYktFyA/ijnXVRGapiU4IMYnNfW1HPeMTlU+ZE/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1xic9BQw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1xic9BQw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3349A1F000E9; Tue, 21 Jul 2026 19:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663792; bh=TJUO42RtNlU9/umuVJi331/EDZleFYTWKrhmenwQv10=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1xic9BQwLkiRSoL37uniTv6uNkzJ2QvmJ8DJHSq0EAZgIkV0OO2VYzmbOR+AfbHNF NmU9R3aGB+HtpLf46qNYVt50mZ6AZEGmoqjkDI5LJzNw9sJ97fXo4e4zpraKThnalf mcNcVwbyDwBAQahySKM9aOsSRprWJXe/jJp+ry6c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Borntraeger , Harald Freudenberger , Holger Dengler , Alexander Gordeev Subject: [PATCH 6.12 0956/1276] s390/pkey: Check length in pkey_pckmo handler implementation Date: Tue, 21 Jul 2026 17:23:19 +0200 Message-ID: <20260721152507.423056715@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Holger Dengler commit 1ac287e2af9a9112fe271427ef45eceb26bce8b4 upstream. Explicitly check the length of the target buffer in the pkey_pckmo implementation of the key_to_protkey() handler function. The handler function fails, if the generated output data exceeds the length of the provided target buffer. Cc: stable@vger.kernel.org Fixes: 8fcc231ce3be ("s390/pkey: Introduce pkey base with handler registry and handler modules") Reported-by: Christian Borntraeger Reviewed-by: Harald Freudenberger Signed-off-by: Holger Dengler Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman --- drivers/s390/crypto/pkey_pckmo.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/s390/crypto/pkey_pckmo.c +++ b/drivers/s390/crypto/pkey_pckmo.c @@ -321,6 +321,10 @@ static int pckmo_key2protkey(const u8 *k __func__, t->keytype); goto out; } + if (t->len > *protkeylen) { + rc = -EINVAL; + goto out; + } memcpy(protkey, t->protkey, t->len); *protkeylen = t->len; *protkeytype = t->keytype;