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 2B02A354AD9; Wed, 3 Dec 2025 16:15:17 +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=1764778517; cv=none; b=a1qch8vtm58vvDPAx2vdzHAAibnwpxBT93psXlcHNNLrQjK9eKd7O6c7IHMHBx5L1FyPUs9N3SehvtH1AinNv9zMNMFF3lLV7NQB7v1GId2Ez4skglorKiFVEpBjZZMlgis2EdyCYAVPXfGy3SZ9E3/5ln2wlW7/FZH7rSAYHb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764778517; c=relaxed/simple; bh=OwRulNxA4Fa9/WWB3NOZU5KvpW8ltkxcQIhuiBq34hA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0gg+amVxdr5yTRnxliBlmwJyMSY1eKdtEfRwkL8Eiu3ZyPdrHQCUrleYLT/rN3GfSixFkNbSmM8iolc8GbIkp5mSdNRmR6vv2Bjd7ws0kSeXE8tSnQJfFdh8nNAz8Pp4uNIbJfU7bqVRbU9+M0va6LgrFYSuy6C1kinaiAyRvA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RNF7wnnl; 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="RNF7wnnl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F2A4C4CEF5; Wed, 3 Dec 2025 16:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764778517; bh=OwRulNxA4Fa9/WWB3NOZU5KvpW8ltkxcQIhuiBq34hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNF7wnnlNejIZT2185Q3L0kL5elWEGSi76hIGIic9Gpp422PnssVsaDTwvqGOghPb EOYnkhhf+Yhg1vLUGkXGqP5At72KJEuotzFaaYh5y0fGu0FQze3MgxPyr8ddKNv1+3 4RqnQIuQBpYcf+UEmbZP7F4ZcCouI4QPnuaAN75c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tianchu Chen , stable Subject: [PATCH 5.15 369/392] usb: storage: sddr55: Reject out-of-bound new_pba Date: Wed, 3 Dec 2025 16:28:39 +0100 Message-ID: <20251203152427.738740402@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152414.082328008@linuxfoundation.org> References: <20251203152414.082328008@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 5.15-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;