Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14241464pxu; Mon, 4 Jan 2021 17:31:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOAoaQ3EukmaEPWapKruyG6Ys5PuPzsp+ULOAFR8pq/1bcGUEePR2zHN2u8uHCTQn2ZpH7 X-Received: by 2002:aa7:d784:: with SMTP id s4mr72666816edq.215.1609810319639; Mon, 04 Jan 2021 17:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609810319; cv=none; d=google.com; s=arc-20160816; b=d3nBNz4NFQd2tRvpUF4/1Sw91t/kSq7yGtkqCJ3CXPaTIBcV/dSrApQhhss4rbvkpm POlV6Yaw4UkSK6dRX0yhfVmVX3Ve5kwtvS04MbFA42WUAsjKs4pgC+XfQDxNINdQpv7+ AP++h440I0lB8iTwhjtVKcfhCyJsWMlVg0BClZdnvPXSHJf639IoonojAqLy24VFwVXr KK0YZaaFhrIsikCiGnLP6H2EnBSSLtKfthre32HotMvojO/OiGnwvgkEHNpS6y+LPL6f WNO1NygUwS4BHUT0HPtqMz5RvK8DNvQjO+Xzgpgz76kBlgl5/lqZnn0jbvNCxkAJKRwb kdHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=C3UjD26QN0UA/ub3IY5/65dvjqpB+2GS72iiAT/kBTU=; b=snwH4kP6wgu06FUdTBaT1irxklPfF8z2dQIfbRQ5l2iJz4E1tfH9hp9xhqy/Pe4ya+ Q3A4c//3eaRu9Ibc1KPTK5b4YVGPEILhEXY4LrO6I6yEuG7MvL5Tk9AH5z+GAlhLh8ka ZUYTLIerLptKoTcVIl5REKYq6goxHEA2IEyESFiQCi1eqWoea/iR0SJIiK1D/xlRqy56 93x9wNzNH8GDL4kmCpW33X2HjySHdqLP0jN/IJys4djILzMtuAwGcNVjLLkHU1KjFAr2 h1wL11UvhyQhex1soB4zfwAatM8iSsGJEcZw/9L1f5j3QGKbvFvoNEUOESQZsQP1O+XA 7BRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Slobn0e8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si25442638edt.564.2021.01.04.17.31.27; Mon, 04 Jan 2021 17:31:59 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Slobn0e8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbhAEB3W (ORCPT + 99 others); Mon, 4 Jan 2021 20:29:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbhAEB3W (ORCPT ); Mon, 4 Jan 2021 20:29:22 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34AA1C061574 for ; Mon, 4 Jan 2021 17:28:42 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id j13so725557pjz.3 for ; Mon, 04 Jan 2021 17:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C3UjD26QN0UA/ub3IY5/65dvjqpB+2GS72iiAT/kBTU=; b=Slobn0e8o4BZv6BeB5DyM/pu1y93XUeoGPA3Fp5x33Lx8DO5Emw6mGz9vvERtceiwD LxLfX4kdY04SBYfvOz/lIJBB0qcMpb9Z0wDeTM58BUXOhPmJu75OMJe0CPOciSCq04Ka Y8OpIhDFY5Tj0Di8BCVPz/XhvpoS/uI+/07hQKYFBnF3+M5zRBsv2NNH/FcbFBQti0DX KS1/wV4dBtMND6OJkUIbRk8HBShwdL9Lhi1RzBX4FmWn5nh4995NXeVs6BeQuhbFobyV YjQ0Wwi6pOKywkEgkUwTTC1J/oTf4TyRFaDWA364u4me/ve7tgCGbt6I9V5G3NbNSczU DcUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C3UjD26QN0UA/ub3IY5/65dvjqpB+2GS72iiAT/kBTU=; b=fvCo+mOfN1Trv6w6IUSyyXYA3ImJFDssqnxmaeTPzvuQeISE0B6Z/dfe+h4or7vxvg QZnlO/A5nlN5qrPlVfiJwwlHDToQG0fhhUDAc+iwCbgqPITjN7N+ZPXYDadcvneS7v7P 0UnVgyEbkQqOz2x0D1YZrkGYOsEcV7cRr4Kx4CgtRFxAuyxadxCavL9rcde5UZZ0NfMr kExezmG28aHwK7tH5vKlJOts8U4gc0pNum27bq7AKV/Z520o3/xgiuSGQpxYW35PQqm7 SkIzghRzIMVf9BPO/vXI6owb27e+7gUh1k3HrGjaUrUtnkk6rfPBdH8KYeUQSIxZmSGo vJ5w== X-Gm-Message-State: AOAM530BTtE/GrpSqxxT4zfNsgqyxH9f22mIhqu7s+Usbnd3rFzms2mz wbc1KSGXeuB38GsMvLFQih61GdhrqkE= X-Received: by 2002:a17:90a:5914:: with SMTP id k20mr1582782pji.199.1609810121409; Mon, 04 Jan 2021 17:28:41 -0800 (PST) Received: from daehojeong1.seo.corp.google.com ([2401:fa00:d:11:a6ae:11ff:fe18:6ce2]) by smtp.gmail.com with ESMTPSA id gk8sm531043pjb.52.2021.01.04.17.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 17:28:40 -0800 (PST) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong , Colin Ian King Subject: [PATCH] f2fs: fix null page reference in redirty_blocks Date: Tue, 5 Jan 2021 10:28:26 +0900 Message-Id: <20210105012826.956800-1-daeho43@gmail.com> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") --- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9e5275716be8..bf6682a52433 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) + if (!page) { ret = -ENOENT; + continue; + } set_page_dirty(page); f2fs_put_page(page, 1); f2fs_put_page(page, 0); -- 2.29.2.729.g45daf8777d-goog