Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4030199imu; Mon, 28 Jan 2019 15:48:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN5uIBrdlhIq4KEhOBPPu4acrDOL9JeWYc+Yq22ur4nzoipqqUCp0jHAoOm7hpyRijrRswvy X-Received: by 2002:a63:9c1a:: with SMTP id f26mr21767070pge.381.1548719285559; Mon, 28 Jan 2019 15:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548719285; cv=none; d=google.com; s=arc-20160816; b=bFDEQDhbx54PeiwLka3uk7ISbRmIlClx7pzf1x7e96+Tu9xQIwyxI2Vdt0TSIHgrqx kVmsx1oS2IUdVYtoybpZWb09N4ACgc/JonC2QwJgFrJxgbiBcoXSTyfWa/JtrqSghRak yl2vuBj6YOP0KQ86fsBXEtjs0gSq3u9yYNvHicq5V6P0LPM0z0oF0kIsMqZTuyw/hCIq xL65+ZhklKPzoBA+QygPfT2s4wPr515cnmMMx7cADxvNwQ65u7UqIiXgHdRe2pj7mcbr RKE/TCTEhPYztZ9U6HQ22ih75Kr2/rsI9KriOsEi1RxWxtDSMVGOj9oSHYOOS9ovYbeN CUkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KGzyEmvWD2e0hehu8ij4pOoMDXd8LAtlb0kSJjHv5Os=; b=IqS9nBqPnuHl6gQRBIUW0tfXgh+TVaPk80J3PSz4kU0QG2QDCqVBJYsTUTGVyec7J/ AckQdBUaOV+wYwGRPQRlcrqHdRYD+tt/laTsMGh8RYOGn3kalOLScnGct561YDWKF5gA xXFlRnWUk+UUauf3BUrIRyJtTyxrZmekZ/SLg+QcY2qot/4FTYve12BEL6KGBv4RV+SA gbu+Qb23PsJZLZD9T1dWDMxmI0K8de3tJsOsDJQwZVvjaXxmcpeSrUarwzgQghuzeRVs N/6iRG047yDchjdf05bZAklQLL79c8ETXgwNLR7WSi3OF1MQo/GAwjHs2zIGKCaqJtFf SGnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QTJmRX6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j65si33560713pge.444.2019.01.28.15.47.50; Mon, 28 Jan 2019 15:48:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QTJmRX6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbfA1Xrd (ORCPT + 99 others); Mon, 28 Jan 2019 18:47:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:39892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfA1Xrc (ORCPT ); Mon, 28 Jan 2019 18:47:32 -0500 Received: from localhost (203-69-98-252.HINET-IP.hinet.net [203.69.98.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F39D92175B; Mon, 28 Jan 2019 23:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548719252; bh=d65mwd0fmOb9GOEtqx9ELDI4p7UE30aluKyJXmrLLpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTJmRX6XcbEa92ZDUvhcq5RpwgD+UUozLVhjcM6owu3bLRBn0S6+wedabSmTkm6c1 iXKwxZ/iNPuf1bgsWMlGZPJhQr9Nl93VkHxRjg5GuOonOFe/JSHBOq7sDQCTz4xoJF +hzQkfRUM3POVOrmz2RrH3OsS8hGYsBDNUgVS7xk= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 5/7] f2fs: avoid null pointer exception in dcc_info Date: Tue, 29 Jan 2019 07:47:15 +0800 Message-Id: <20190128234717.77225-5-jaegeuk@kernel.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20190128234717.77225-1-jaegeuk@kernel.org> References: <20190128234717.77225-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If dcc_info is not set yet, we can get null pointer panic. Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index fe95abb05d40..8c928cd72b61 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2161,10 +2161,17 @@ static inline bool is_idle(struct f2fs_sb_info *sbi, int type) get_pages(sbi, F2FS_RD_META) || get_pages(sbi, F2FS_WB_DATA) || get_pages(sbi, F2FS_WB_CP_DATA) || get_pages(sbi, F2FS_DIO_READ) || - get_pages(sbi, F2FS_DIO_WRITE) || - atomic_read(&SM_I(sbi)->dcc_info->queued_discard) || - atomic_read(&SM_I(sbi)->fcc_info->queued_flush)) + get_pages(sbi, F2FS_DIO_WRITE)) return false; + + if (SM_I(sbi) && SM_I(sbi)->dcc_info && + atomic_read(&SM_I(sbi)->dcc_info->queued_discard)) + return false; + + if (SM_I(sbi) && SM_I(sbi)->fcc_info && + atomic_read(&SM_I(sbi)->fcc_info->queued_flush)) + return false; + return f2fs_time_over(sbi, type); } -- 2.19.0.605.g01d371f741-goog