Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933301AbdLRPvq (ORCPT ); Mon, 18 Dec 2017 10:51:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33328 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933278AbdLRPvl (ORCPT ); Mon, 18 Dec 2017 10:51:41 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cezary Sliwa , Jan Kara , Sasha Levin Subject: [PATCH 3.18 66/69] udf: Avoid overflow when session starts at large offset Date: Mon, 18 Dec 2017 16:48:52 +0100 Message-Id: <20171218152748.816820852@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171218152735.055508271@linuxfoundation.org> References: <20171218152735.055508271@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1000 Lines: 33 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara [ Upstream commit abdc0eb06964fe1d2fea6dd1391b734d0590365d ] When session starts beyond offset 2^31 the arithmetics in udf_check_vsd() would overflow. Make sure the computation is done in large enough type. Reported-by: Cezary Sliwa Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -706,7 +706,7 @@ static loff_t udf_check_vsd(struct super else sectorsize = sb->s_blocksize; - sector += (sbi->s_session << sb->s_blocksize_bits); + sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits); udf_debug("Starting at sector %u (%ld byte sectors)\n", (unsigned int)(sector >> sb->s_blocksize_bits),