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 220CA315D5D; Mon, 17 Aug 2026 13:43:01 +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=1786974182; cv=none; b=eZPMGH1NFUwT96tHk1GA7qeGycSo0OeLH0HqEx5JHoGSgbjYxmsvu/eyBRX90zRjIOiz/OVXG+cP6jVy51Xym1PDc8O2274USo1Fx3ny2VMgsYJ6+evyFEWz7fnH/gEdpclg7OQ2/8+wQBoLGwcB8eHbAU3IMvAu31OpGsDCzKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786974182; c=relaxed/simple; bh=PJkS95cQ+rfewjkNJWlCDs9kwBqAbQPiOiBahYuQTDg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Eb5rP60fIFlN31VYD7V4wXNmJE3Bg2PNuNjr+U5ASQ257go7cdI+gZT83Dv8Ts68Fdh5aLQTUPa0qgNnwh2OyImx2BN2zsCSv1IiW3+DO066HhUIqJCP84jBkHXwlhvwLZ0ReG37p4O5d4aG6N4yO+IIFYcsSIqGgJo0GB9vijQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UzpOzyJx; 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="UzpOzyJx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A728A1F000E9; Mon, 17 Aug 2026 13:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786974181; bh=nwooSrWnP1ErbzOEaJS1LBq0OKg/3UaCBc7RnVCaHyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UzpOzyJxDNz2gGZNBd0/ksEprMD21DBYkETt66m8t9LwqbqplhilTJdUHMJLVioZj qNJaMfYKmZKfVM/Ar+x694e1VE2YBMuCsr6UatOPXyoYX4brC9/LvbofegeErVgdfX 5JGyKwv+MQCYw/H9ly4UfBONJmF2LnmTmHyBzbpk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wilken Gottwalt , Guenter Roeck , Sasha Levin Subject: [PATCH 7.1 116/271] hwmon: (corsair-psu) fix possible out-of-bounds access on missing string termination Date: Mon, 17 Aug 2026 15:30:41 +0200 Message-ID: <20260817132541.651529114@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132536.752504388@linuxfoundation.org> References: <20260817132536.752504388@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 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wilken Gottwalt [ Upstream commit 36c4d73ce05d1d8896c2669eb0730d35a02a2ec1 ] In theory it could be possible that the REPLY_SIZE sized buffers for holding the vendor and product strings could be end up missing the null termination (for example by malicious hardware built on purpose) required by the seq_printf() call. That limits the debugfs printf calls to a maximum string length of REPLY_SIZE. Fixes: d115b51e0e567 ("hwmon: add Corsair PSU HID controller driver") Signed-off-by: Wilken Gottwalt Link: https://lore.kernel.org/r/anLj9gPWRoRDbQBV@monster.localdomain Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/corsair-psu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c index ce958cdaef58a..3c01ae3fc4af2 100644 --- a/drivers/hwmon/corsair-psu.c +++ b/drivers/hwmon/corsair-psu.c @@ -701,7 +701,7 @@ static int vendor_show(struct seq_file *seqf, void *unused) { struct corsairpsu_data *priv = seqf->private; - seq_printf(seqf, "%s\n", priv->vendor); + seq_printf(seqf, "%.*s\n", REPLY_SIZE, priv->vendor); return 0; } @@ -711,7 +711,7 @@ static int product_show(struct seq_file *seqf, void *unused) { struct corsairpsu_data *priv = seqf->private; - seq_printf(seqf, "%s\n", priv->product); + seq_printf(seqf, "%.*s\n", REPLY_SIZE, priv->product); return 0; } -- 2.53.0