Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6204802pxu; Wed, 23 Dec 2020 17:15:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPWFAXv4mNEU+GYopvQs+b1q1s5uwjY0JnqOIr1Tr0sIXusqrKshzRt8qli2kBIJtYkmLp X-Received: by 2002:a17:907:11ca:: with SMTP id va10mr25222397ejb.78.1608772553031; Wed, 23 Dec 2020 17:15:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608772553; cv=none; d=google.com; s=arc-20160816; b=cS6pHu9xijR3vGhCLzEks9jSvMbaPgbIok85zoKZ5BAAjispnqay39sv22ZHhxtyN8 ejk2Xt50ryTgeXrVWCqYcic28Yx4bot7mtcMAhcQk4vv1CsJV0SaDI/oBMQSd4fAQV+P xXFEkEyTA/Bv9f7KS6rVBwQ8SlEM5wUJlhvNwt3rA90JtRFiNnYoTgURryrDe/Tdl1oK ZSnPeAC+Pua2Yk8QETXOp8WIriJtneT83HdecIMGqYiMyjz6Ghg9A0H+yISU3skvc/sK bQIgw7xhf/MQXqrCRCrlNFWgoB9LrPVcMVNQe8anCFOFaLLuODPHUyb8H+58zuNKs8OV xH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=85jL5ZNkTzxA7wPo5GGBmv4j+fCt7DbvWbJRNwPj+y0=; b=mQqc5SQRSudksXlTM+Sx/0SK24U8Dr9uUM3SxCiDOgzOzbPj0PL2slvc6qCjmmNLqO RH8QERxVQIKBT+5SskNx+ntAl0j2ewUuGFN3t2R0YlhtyYttIhaP+oiSCCEQaXqV/lwm onVtThCVATIy6hkXVM+uCfiUAVaDK9F7Hg+t6cg1htEVepQqSZIHeH/+V66BH7hpPe3d abnIbG9HCeYvbg+jxzysCTbU+BDI/aw7/Ru6jHkxvjH7Fe4V6GnT6NBoovFW96AaLIaR s9v5FWKHuaVVUm3QU7RN2J9WCFVy9YdcPHlheerWa1Oa5h7qwZA/lEM/OjrTSh5rQP1X Aiow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj13si12966104ejb.475.2020.12.23.17.15.31; Wed, 23 Dec 2020 17:15:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbgLXBMi (ORCPT + 99 others); Wed, 23 Dec 2020 20:12:38 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:9478 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728141AbgLXBMi (ORCPT ); Wed, 23 Dec 2020 20:12:38 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4D1X8R4f5CzhwlC; Thu, 24 Dec 2020 09:11:19 +0800 (CST) Received: from [10.136.114.67] (10.136.114.67) by smtp.huawei.com (10.3.19.214) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 24 Dec 2020 09:11:53 +0800 Subject: Re: [PATCH 5.10 24/40] f2fs: fix to seek incorrect data offset in inline data file To: Greg Kroah-Hartman CC: , , kitestramuort , Jaegeuk Kim References: <20201223150515.553836647@linuxfoundation.org> <20201223150516.715040953@linuxfoundation.org> From: Chao Yu Message-ID: <962b2db7-383f-b4da-5221-2004235d19c1@huawei.com> Date: Thu, 24 Dec 2020 09:11:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20201223150516.715040953@linuxfoundation.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.114.67] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, Thanks a lot for helping to resend and merge the patch. :) Thanks, On 2020/12/23 23:33, Greg Kroah-Hartman wrote: > From: Chao Yu > > commit 7a6e59d719ef0ec9b3d765cba3ba98ee585cbde3 upstream. > > As kitestramuort reported: > > F2FS-fs (nvme0n1p4): access invalid blkaddr:1598541474 > [ 25.725898] ------------[ cut here ]------------ > [ 25.725903] WARNING: CPU: 6 PID: 2018 at f2fs_is_valid_blkaddr+0x23a/0x250 > [ 25.725923] Call Trace: > [ 25.725927] ? f2fs_llseek+0x204/0x620 > [ 25.725929] ? ovl_copy_up_data+0x14f/0x200 > [ 25.725931] ? ovl_copy_up_inode+0x174/0x1e0 > [ 25.725933] ? ovl_copy_up_one+0xa22/0xdf0 > [ 25.725936] ? ovl_copy_up_flags+0xa6/0xf0 > [ 25.725938] ? ovl_aio_cleanup_handler+0xd0/0xd0 > [ 25.725939] ? ovl_maybe_copy_up+0x86/0xa0 > [ 25.725941] ? ovl_open+0x22/0x80 > [ 25.725943] ? do_dentry_open+0x136/0x350 > [ 25.725945] ? path_openat+0xb7e/0xf40 > [ 25.725947] ? __check_sticky+0x40/0x40 > [ 25.725948] ? do_filp_open+0x70/0x100 > [ 25.725950] ? __check_sticky+0x40/0x40 > [ 25.725951] ? __check_sticky+0x40/0x40 > [ 25.725953] ? __x64_sys_openat+0x1db/0x2c0 > [ 25.725955] ? do_syscall_64+0x2d/0x40 > [ 25.725957] ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > llseek() reports invalid block address access, the root cause is if > file has inline data, f2fs_seek_block() will access inline data regard > as block address index in inode block, which should be wrong, fix it. > > Reported-by: kitestramuort > Signed-off-by: Chao Yu > Signed-off-by: Jaegeuk Kim > Signed-off-by: Greg Kroah-Hartman > > --- > fs/f2fs/file.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -412,9 +412,14 @@ static loff_t f2fs_seek_block(struct fil > goto fail; > > /* handle inline data case */ > - if (f2fs_has_inline_data(inode) && whence == SEEK_HOLE) { > - data_ofs = isize; > - goto found; > + if (f2fs_has_inline_data(inode)) { > + if (whence == SEEK_HOLE) { > + data_ofs = isize; > + goto found; > + } else if (whence == SEEK_DATA) { > + data_ofs = offset; > + goto found; > + } > } > > pgofs = (pgoff_t)(offset >> PAGE_SHIFT); > > > . >