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 C7285401A3F; Wed, 20 May 2026 18:40:27 +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=1779302429; cv=none; b=NGs7gOFJcIfbLTpxuo2ZNFr0ZX5FcIRXpZNHoBr6okle2gMdCkSNlGEKfL4xvaRFQ8Q0wwrsa9l3FSGmidRR41vtMvz3t5Ai1Sd6hfe3GfTvwgY6/aw4DIUec1Hktz6YQzBBjVOrH8qz6od3YLNQwY7I+J079T9qDTHbDF2fJYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302429; c=relaxed/simple; bh=lvvw6oZnMpnR8J30w8UfW8G+du6FUjiH2OPPI3Kc6RM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YQDhk3NYVUPrHaYVT4MJqvY9QAcyGMsGEI8s1rYUH7Iyan61Sbxqti8TdW8ZT2UwnVpZHCzUJwD7FlhoSen/hthI5zXc6b85/UPqHmv5B151A7Sx0OnX9gVsJih++G8Dgoe9ucgdnCkFvALcyODhjR01XtrNHagR9ZhzzUt/fLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JUF4FfGx; 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="JUF4FfGx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2380A1F000E9; Wed, 20 May 2026 18:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779302427; bh=blmrmFwsQAJAOznWUjY+PALkorwW3Ybz7rNEdG6LRC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JUF4FfGxtFUhk7sw95SeEaeAl+D2emCDjADFpkDs3ctQStN6vOFOHcyL64a0e0oZA kyxC3y4arQtqwN0n5xLaxX8/UV8akwFNPvgULgW+EFCitolhVrXTuiTV391FjCg/Wa 14nZOUxJpVUGws/7OUW74UxPwlwrGjVvHYJC61kc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Randy Dunlap , Sasha Levin Subject: [PATCH 6.6 264/508] tty: hvc_iucv: fix off-by-one in number of supported devices Date: Wed, 20 May 2026 18:21:27 +0200 Message-ID: <20260520162104.365759971@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Randy Dunlap [ Upstream commit f2a880e802ad12d1e38039d1334fb1475d0f5241 ] MAX_HVC_IUCV_LINES == HVC_ALLOC_TTY_ADAPTERS == 8. This is the number of entries in: static struct hvc_iucv_private *hvc_iucv_table[MAX_HVC_IUCV_LINES]; Sometimes hvc_iucv_table[] is limited by: (a) if (num > hvc_iucv_devices) // for error detection or (b) for (i = 0; i < hvc_iucv_devices; i++) // in 2 places (so these 2 don't agree; second one appears to be correct to me.) hvc_iucv_devices can be 0..8. This is a counter. (c) if (hvc_iucv_devices > MAX_HVC_IUCV_LINES) If hvc_iucv_devices == 8, (a) allows the code to access hvc_iucv_table[8]. Oops. Fixes: 44a01d5ba8a4 ("[S390] s390/hvc_console: z/VM IUCV hypervisor console support") Signed-off-by: Randy Dunlap Link: https://patch.msgid.link/20260130072939.1535869-1-rdunlap@infradead.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/hvc/hvc_iucv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c index 543f35ddf523c..26953f0daa9fc 100644 --- a/drivers/tty/hvc/hvc_iucv.c +++ b/drivers/tty/hvc/hvc_iucv.c @@ -130,7 +130,7 @@ static struct iucv_handler hvc_iucv_handler = { */ static struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num) { - if (num > hvc_iucv_devices) + if (num >= hvc_iucv_devices) return NULL; return hvc_iucv_table[num]; } -- 2.53.0