Return-Path: Received: from mx2.suse.de ([195.135.220.15]:52647 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbdJPJ5j (ORCPT ); Mon, 16 Oct 2017 05:57:39 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B857EABAF for ; Mon, 16 Oct 2017 09:57:37 +0000 (UTC) From: Jan Kara To: Cc: Jan Kara Subject: [PATCH] udf: Avoid overflow when session starts at large offset Date: Mon, 16 Oct 2017 11:57:33 +0200 Message-Id: <20171016095733.15567-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) I will queue this patch into my tree. diff --git a/fs/udf/super.c b/fs/udf/super.c index 99cb81d0077f..08bf097507f6 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -703,7 +703,7 @@ static loff_t udf_check_vsd(struct super_block *sb) 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), -- 2.12.3