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 2565B3624AE; Wed, 3 Dec 2025 16:46:20 +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=1764780380; cv=none; b=O5TJZJdiYt+XzGTqnQqfne2sYA2npnZQR79/jHz4emEv6DY7B5vdVn875MZMLpi1woqbPAJKKuasU9EiwiTpuDqSirEU+ntmOvf+QM0VQ++1YVIFv432J46kayGDSAh4EYaszQfW79SGtFoTLel5ZTi9copwFsX0eFsFVNuLxYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764780380; c=relaxed/simple; bh=3dDbR14MelWx93tZxulYwPM5P0k9VBudHuuk+vOIUcY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nk/WeDO8I1yUvJetefR6/X4dxt4C/EPseVrmi4VOUUYAqRo/3y2vFQ7uPLK1ppa2Mw0wwvJNHdS1bhPINH/fnjT7mGEci5I/utTN0LPshff7YXy+q9znYbQK2tgdP65MSj+HVtoa+WY5HRj+FXPXDAvyB+MY8LXzRpZxos75Bmc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=isb9YfSv; 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="isb9YfSv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CA4BC4CEF5; Wed, 3 Dec 2025 16:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764780379; bh=3dDbR14MelWx93tZxulYwPM5P0k9VBudHuuk+vOIUcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=isb9YfSvAboI+tlnD+eDKPw++65s5JQl4b1yi6nercrMgExfk5hvBVc1IMZ6F+oq2 xmfQWye+3k0IXLUOE1Eh9rFf9tLelqlRjkwMSLQXgXsl9ZoHrzi+dBhD7AuP3Q5E8l U9Zab0P95C608CWGQw2WUkkwsBwS5NMSxRJy57HY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tianchu Chen , stable Subject: [PATCH 6.1 540/568] usb: storage: sddr55: Reject out-of-bound new_pba Date: Wed, 3 Dec 2025 16:29:02 +0100 Message-ID: <20251203152500.490192872@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152440.645416925@linuxfoundation.org> References: <20251203152440.645416925@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tianchu Chen commit b59d4fda7e7d0aff1043a7f742487cb829f5aac1 upstream. Discovered by Atuin - Automated Vulnerability Discovery Engine. new_pba comes from the status packet returned after each write. A bogus device could report values beyond the block count derived from info->capacity, letting the driver walk off the end of pba_to_lba[] and corrupt heap memory. Reject PBAs that exceed the computed block count and fail the transfer so we avoid touching out-of-range mapping entries. Signed-off-by: Tianchu Chen Cc: stable Link: https://patch.msgid.link/B2DC73A3EE1E3A1D+202511161322001664687@tencent.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/sddr55.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -469,6 +469,12 @@ static int sddr55_write_data(struct us_d new_pba = (status[3] + (status[4] << 8) + (status[5] << 16)) >> info->blockshift; + /* check if device-reported new_pba is out of range */ + if (new_pba >= (info->capacity >> (info->blockshift + info->pageshift))) { + result = USB_STOR_TRANSPORT_FAILED; + goto leave; + } + /* check status for error */ if (status[0] == 0xff && status[1] == 0x4) { info->pba_to_lba[new_pba] = BAD_BLOCK;