From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 609B73A59BF for ; Tue, 12 May 2026 14:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778594641; cv=none; b=AUPQcS6n6R5yDZvxvMebg7YOlmtSJPETfvlGghpzlOZv6bo0kikWr5E5rojY15EGZwN1BVpFX1mKmqCK8DHLawex96KZ6HE0tnrGjyCfjNnpKF9pJzYcYdR6T5Lb4XOyaKoyCo8azTRHnPsMGG91RcJqPEUFV1Z2kqG7V9S5CAY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778594641; c=relaxed/simple; bh=6duw/N+Zy+h0JG6WttAkIuv3vmXMpXPf1GASxGSjI8o=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=nKNnRecQqBG7dcvwT+CDsA30Ih3OMsQ2LntwObPF7w9OeZnyBPRK2S3s2XQEyVUXOOjIsOUi0C77vKaO26xe8aTSlVfTULkWzvBDeHR9vFuH1FPidSHhCblfyomnLJ6SfBYi4WXN7ZXmyv+L5l7yG8ZID+2MvRSvLcJUOXd8HiQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dqWzkrt6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dqWzkrt6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9C15C2BCF5; Tue, 12 May 2026 14:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778594641; bh=6duw/N+Zy+h0JG6WttAkIuv3vmXMpXPf1GASxGSjI8o=; h=Subject:To:Cc:From:Date:From; b=dqWzkrt6yM8cdK1owZ0n9hn/YMoVJEB437S9UMvRz/F0O3q99yBoefO+5LzixaycD jJxezvHyaTOs3sy8QMJJ7Xquo+pzUAB9Bt4j8Z5BQhVB5JVJyN05Jv5R5c6s0CXoyE 98+E8scoAf7OaJkF4WkG47XlOm1zUnuHyARKlo/U= Subject: FAILED: patch "[PATCH] s390/debug: Reject zero-length input before trimming a" failed to apply to 6.1-stable tree To: pengpeng@iscas.ac.cn,agordeev@linux.ibm.com,bblock@linux.ibm.com,gor@linux.ibm.com Cc: From: Date: Tue, 12 May 2026 16:03:55 +0200 Message-ID: <2026051255-outsider-irk-67c3@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x c366a7b5ed7564e41345c380285bd3f6cb98971b # git commit -s git send-email --to '' --in-reply-to '2026051255-outsider-irk-67c3@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From c366a7b5ed7564e41345c380285bd3f6cb98971b Mon Sep 17 00:00:00 2001 From: Pengpeng Hou Date: Fri, 17 Apr 2026 15:35:30 +0800 Subject: [PATCH] s390/debug: Reject zero-length input before trimming a newline debug_get_user_string() duplicates the userspace buffer with memdup_user_nul() and then unconditionally looks at buffer[user_len - 1] to strip a trailing newline. A zero-length write reaches this helper unchanged, so the newline trim reads before the start of the allocated buffer. Reject empty writes before accessing the last input byte. Fixes: 66a464dbc8e0 ("[PATCH] s390: debug feature changes") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou Reviewed-by: Benjamin Block Reviewed-by: Vasily Gorbik Tested-by: Vasily Gorbik Link: https://lore.kernel.org/r/20260417073530.96002-1-pengpeng@iscas.ac.cn Signed-off-by: Vasily Gorbik Signed-off-by: Alexander Gordeev diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index 31430e9bcfdd..2612f634e826 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -1414,6 +1414,9 @@ static inline char *debug_get_user_string(const char __user *user_buf, { char *buffer; + if (!user_len) + return ERR_PTR(-EINVAL); + buffer = memdup_user_nul(user_buf, user_len); if (IS_ERR(buffer)) return buffer;