Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751806AbcCVDkM (ORCPT ); Mon, 21 Mar 2016 23:40:12 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:41295 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750860AbcCVDkK (ORCPT ); Mon, 21 Mar 2016 23:40:10 -0400 X-AuditID: cbfee61b-f793c6d00000236c-01-56f0be9739ab From: Chao Yu To: "'Jaegeuk Kim'" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: "'stable 4 . 5+'" References: <1458586565-8827-1-git-send-email-jaegeuk@kernel.org> In-reply-to: <1458586565-8827-1-git-send-email-jaegeuk@kernel.org> Subject: RE: [f2fs-dev] [PATCH 1/2] f2fs: cover large section in sanity check of super Date: Tue, 22 Mar 2016 11:39:14 +0800 Message-id: <013f01d183ec$854a61e0$8fdf25a0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQMA4PO1z3j38Gmdxz1GYZ+z4jCLtp0F/vvg Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsVy+t9jQd3p+z6EGTS/ErJ4sn4Ws8WlRe4W e/aeZLG4vGsOm8WCjY8YHVg9Nq3qZPPYveAzk8fnTXIBzFFcNimpOZllqUX6dglcGetermYq WCpRcef7RZYGxtkiXYycHBICJhLH/3SwQNhiEhfurWfrYuTiEBKYxSjx+t5MNpCEkMArRom9 8x1BbDYBFYnlHf+ZQIpEBHoZJX6c6WcGSTAL6Els/zwDqIEDqMFRYsP+SJAwp4CTRPOpT6wg trBAhMSPb91gy1gEVCX+HH0K1sorYClxanI/O4QtKPFj8j0WiJFaEut3HmeCsOUlNq95ywxx qILEjrOvGUFsEQEjif5Db9ghasQlNh65xTKBUWgWklGzkIyahWTULCQtCxhZVjFKpBYkFxQn peca5aWW6xUn5haX5qXrJefnbmIER8Iz6R2Mh3e5H2IU4GBU4uFt2PAhTIg1say4MvcQowQH s5II74q9QCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8j/+vCxMSSE8sSc1OTS1ILYLJMnFwSjUw iqe82zvnpJVC0Pal0z9+l1qvL7K/6Oir9277ROdnHo799zV2weGPwrtfH7Ffc+t0j+TFy+/+ +D7/fTXVvGJ3QJVCSIhS77K753J5ww/NXCNsZF2+9lTTpLC1Ak9N0lZcyl/+eTrjK8f69Ooc hytf8j4cttFT4XP88Mj+vjfHj27tegZJCd7KbiWW4oxEQy3mouJEAHeNZQqAAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3026 Lines: 81 Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Tuesday, March 22, 2016 2:56 AM > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Cc: Jaegeuk Kim; stable 4 . 5+ > Subject: [f2fs-dev] [PATCH 1/2] f2fs: cover large section in sanity check of super > > This patch fixes the bug which does not cover a large section case when checking > the sanity of superblock. > > Reported-by: Matthias Prager > Reported-by: David Gnedt > Cc: stable 4.5+ > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/super.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 15bb81f..fc9147f 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -1000,6 +1000,7 @@ static inline bool sanity_check_area_boundary(struct super_block *sb, > u32 segment_count_main = le32_to_cpu(raw_super->segment_count_main); > u32 segment_count = le32_to_cpu(raw_super->segment_count); > u32 log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); > + u32 segs_per_sec = le32_to_cpu(raw_super->segs_per_sec); > > if (segment0_blkaddr != cp_blkaddr) { > f2fs_msg(sb, KERN_INFO, > @@ -1044,12 +1045,26 @@ static inline bool sanity_check_area_boundary(struct super_block *sb, > return true; > } > > - if (main_blkaddr + (segment_count_main << log_blocks_per_seg) != > + if (segs_per_sec == 1 && > + main_blkaddr + (segment_count_main << log_blocks_per_seg) != > segment0_blkaddr + (segment_count << log_blocks_per_seg)) { > f2fs_msg(sb, KERN_INFO, > "Wrong MAIN_AREA boundary, start(%u) end(%u) blocks(%u)", > main_blkaddr, > - segment0_blkaddr + (segment_count << log_blocks_per_seg), > + segment0_blkaddr + > + (segment_count << log_blocks_per_seg), > + segment_count_main << log_blocks_per_seg); > + return true; > + } > + > + if (segs_per_sec > 1 && if ((segs_per_sec > 1 || secs_per_zone > 1)) && ? Thanks, > + main_blkaddr + (segment_count_main << log_blocks_per_seg) > > + segment0_blkaddr + (segment_count << log_blocks_per_seg)) { > + f2fs_msg(sb, KERN_INFO, > + "Wrong MAIN_AREA boundary in large section, start(%u) end(%u) blocks(%u)", > + main_blkaddr, > + segment0_blkaddr + > + (segment_count << log_blocks_per_seg), > segment_count_main << log_blocks_per_seg); > return true; > } > -- > 2.6.3 > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel