Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14447802pxu; Tue, 5 Jan 2021 01:37:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoKI/eNpt8Nqwq/i7mZ7GYFR7CBOiDD91mheSSX/CN1QL2Yb5zYF0LuaMgxND1Bm3XUFrl X-Received: by 2002:a17:906:d8a1:: with SMTP id qc1mr68787786ejb.294.1609839437406; Tue, 05 Jan 2021 01:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609839437; cv=none; d=google.com; s=arc-20160816; b=n7r9dlT5QVtnfurpzaV+vhUUajdRWBjpTyR6oF0wpQn7QpGxacEaov9H8V9qAUu4n9 wL/VSnAMDTacFj2cOn8lEtAe5j+BgDJrkADPtMjEojQqy3QmzPob5mdIGTHM/7gSKX8e Tbbys5mPTjAhMcWDACkqmKMHrwHSTJdeGLP0Zm/Z+W2CL7hyAI5E0dFB/wE+05U+9NCK nAzzOjq7sTRyWP7mULL4nVoVSp/OvGE4+DZuUPgyQ5yd6MPupR+2RMj/+4Cut3P4y8jh o3eKPfC1TvbTTUPOaI40tZsBFzgBdqmFm1GZwNfUzmJF4qQ39Tn5ilrPt0rkbuRDJFo+ wtfA== 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=9BdU9iA90Mw+RMEF/zAnCi2Pnjb5bpO8GzrvAluNLqo=; b=VwtW8CrgMoW7Q/pWngrvUQVVYle2P4c6ALg1tLnu3iTFQ5g/QScdwz81ZKpWImHwW5 4cW43xt/jO7NwQRmgp6YxwtY3KfYcl+/HK4+dezxlVJYZB5qvDLvDRWYdU39c1ytsMPA nC0at3jGXOGrE8iXjGyc8xnb9J/h6l6+uNOZHEbVzTPHTzLI5HiwMUUkHXMvR264ZAqz VQi0fTbD4nS/k5Pu0k32mPiU6S0KwwxoJCZPHrm/9LMr1GgbBdRooYRDCITjfjOW6bX3 sTTAMbL3Eu0DPxNNRIjaQWuO+4gTZc4QEsgw4FbWmVdUCPGRnkwNPYGezuoLe/iq3RKg /a9g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go40si29318667ejc.141.2021.01.05.01.36.54; Tue, 05 Jan 2021 01:37:17 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728436AbhAEJfK (ORCPT + 99 others); Tue, 5 Jan 2021 04:35:10 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:50434 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbhAEJfJ (ORCPT ); Tue, 5 Jan 2021 04:35:09 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kwijS-0007eX-9w; Tue, 05 Jan 2021 09:34:26 +0000 Subject: Re: [PATCH v2] f2fs: fix null page reference in redirty_blocks To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong References: <20210105041630.1393157-1-daeho43@gmail.com> From: Colin Ian King Message-ID: <57be566b-89e2-04a1-9a8e-51e902fee96c@canonical.com> Date: Tue, 5 Jan 2021 09:34:25 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210105041630.1393157-1-daeho43@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/01/2021 04:16, Daeho Jeong wrote: > From: Daeho Jeong > > Fixed null page reference when find_lock_page() fails in > redirty_blocks(). > > Signed-off-by: Daeho Jeong > Reported-by: Colin Ian King > Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE") > --- > v2: changed error value and break the loop when error occurs > --- > fs/f2fs/file.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 9e5275716be8..d27173c24391 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) > > for (i = 0; i < page_len; i++, redirty_idx++) { > page = find_lock_page(mapping, redirty_idx); > - if (!page) > - ret = -ENOENT; > + if (!page) { > + ret = -ENOMEM; > + break; > + } > set_page_dirty(page); > f2fs_put_page(page, 1); > f2fs_put_page(page, 0); > Thanks, looks good to me. Reviewed-by: Colin Ian King