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 833751CCB2C; Tue, 27 Aug 2024 15:18:18 +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=1724771898; cv=none; b=Ylm2je4VVGhfKxMNl4Ew+//w5fipfJnjnmn3TCBX46sSTF6+5v0VGfTPcJ83piWwHm56CxCdm0NNouDFCNA8altfL630JHtQ7gXy59z0FrTN+Aqom7qpsG88bQZKU45VmFTITikwPr1Xh6LgCMKRfBT0xF9YeWGLUXVmzzBCRKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724771898; c=relaxed/simple; bh=kfUHONCxlveMOpPJy+5sdzviDmceVdZ4V1jBzobIpPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G3kSQRDyP3A/Ynw7XxP1rYroaOcynwHW0v6elLI/0dwk3U6mlIAKktyC31cHhlNG7xdmAM2IV9Xfeb7EDsFBxIks7uSMt4gJjZwBMP/vgwKEJsSAjiYWIHZQuusAWJO2+qoDmuL0cBsx8bsNgwDkgUIW9DXy44ZRuGMUM8PZmSU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1FHQT5is; 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="1FHQT5is" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD8CCC61067; Tue, 27 Aug 2024 15:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724771898; bh=kfUHONCxlveMOpPJy+5sdzviDmceVdZ4V1jBzobIpPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1FHQT5is/qoNHUlfR6Ec6zzFUyfDSs/9PFSyol/ZVh6P+CPGKhkIOzrdUhgbT5yOu vGjYkmtTLU7NohwcKOYi9ZWhJcnnwGWTqtOV1FVwd9zbpqlMsoDIds5fwtI0OgFEol ktyUwm8TtJKL4nBqEnejeR6I1B+M20qGSpsagmcQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+411debe54d318eaed386@syzkaller.appspotmail.com, Manas Ghandat , Dave Kleikamp , Sasha Levin Subject: [PATCH 6.1 053/321] jfs: fix shift-out-of-bounds in dbJoin Date: Tue, 27 Aug 2024 16:36:01 +0200 Message-ID: <20240827143840.253366173@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240827143838.192435816@linuxfoundation.org> References: <20240827143838.192435816@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Manas Ghandat [ Upstream commit cca974daeb6c43ea971f8ceff5a7080d7d49ee30 ] Currently while joining the leaf in a buddy system there is shift out of bound error in calculation of BUDSIZE. Added the required check to the BUDSIZE and fixed the documentation as well. Reported-by: syzbot+411debe54d318eaed386@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=411debe54d318eaed386 Signed-off-by: Manas Ghandat Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_dmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 4462274e325ac..8d064c9e9605d 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -2763,7 +2763,9 @@ static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl) * leafno - the number of the leaf to be updated. * newval - the new value for the leaf. * - * RETURN VALUES: none + * RETURN VALUES: + * 0 - success + * -EIO - i/o error */ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) { @@ -2790,6 +2792,10 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) * get the buddy size (number of words covered) of * the new value. */ + + if ((newval - tp->dmt_budmin) > BUDMIN) + return -EIO; + budsz = BUDSIZE(newval, tp->dmt_budmin); /* try to join. -- 2.43.0