Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1542978ybh; Tue, 14 Jul 2020 00:06:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJRXM6H+Ba7lL9VvpchpHGdwrdhOe9zah0voj+z52dhjCfdgFd11/My8RcearDX2COpaeJ X-Received: by 2002:aa7:da8a:: with SMTP id q10mr3079083eds.139.1594710380646; Tue, 14 Jul 2020 00:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594710380; cv=none; d=google.com; s=arc-20160816; b=KCrRokFBnVJzM6A6Ryddpp/rpxygRH8FRIjDvnijEqhSWS3+fl9RCSJi+KTUJvWQ5c kAtLW2E4FYIeCvmYWbctYBMhpm12Alq7QQh8+QRC4LME4bdulYtogBOZ2iwG5XnEF4US Ougcqjj679Aa8pmESi/xnQY+Eutli3otgcdIpWjqRyPdNGbmp5ccb88MEfYRIhByg0kR VDV09+My/M1YLm9O2eaPSuX/fKdK+9hmuUhmyFYyJ7NCgeOoA7jTBRy/9B2YWnbByOiv K6PZ8hnm0kvTmUexwycQTm/uvSwo/P76FSCG7/6c7hToSMOq7mqQOkpLzGGlAoPM+UjQ bkVw== 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 :ironport-sdr:ironport-sdr; bh=JPB0ijbMmuwNhiyiV9TNXlj+cqKHKLyZDV5alzQoTUU=; b=qNh1TGGpcdgTVKNAbV98Pa7sBpEalBclfpBsb8JYRFcuW3fZTy3INZUn8g9FcoolMs A2+b7PKBTVcPJ0zIib942GmwetnAm7UY1hQEVk1lyMC4fer+0WwN8WuAVMzjl1bqc+tX rAe6hRHuOhv4oRDBLNZX45s2825rCyPIBJEes63psStnR9IkgahzZWFusej8IDfvFp0v 425zfgnILJm0M3JC6G9aRTi8wzRXNad4J2eJCieJjfI8dsKqUlbQTTKvsbPM+agC7aOy l9H8RXs/PL6qgO9MplN9FCcR1Va+G9jHjJleupCTQohJ8BJlUb5ZeuXa1mcDsG3UPG3Z Z3DA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si9337258edw.533.2020.07.14.00.05.57; Tue, 14 Jul 2020 00:06:20 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbgGNHFO (ORCPT + 99 others); Tue, 14 Jul 2020 03:05:14 -0400 Received: from mga04.intel.com ([192.55.52.120]:50365 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbgGNHET (ORCPT ); Tue, 14 Jul 2020 03:04:19 -0400 IronPort-SDR: fwgGQ7YNDCwQCEUIT2phI1ATj/Qu6M9vCHJZzzk27SSttayB+89Un9q37EB3RVQaaelIib8SR0 y/oiYUdEnOKA== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="146304344" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="146304344" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 00:04:19 -0700 IronPort-SDR: 9LKgIdM/SdUreJg1navD+iwUluxTNA29jANU+9W/GbR+y4NJhTqBe5QwxAfUIq7aVqFXyOWk5Q vWEckWQDPPOw== X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="317627579" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 00:04:18 -0700 From: ira.weiny@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra Cc: Ira Weiny , Dan Williams , x86@kernel.org, Dave Hansen , Vishal Verma , Andrew Morton , Fenghua Yu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [RFC PATCH 10/15] drivers/dax: Expand lock scope to cover the use of addresses Date: Tue, 14 Jul 2020 00:02:15 -0700 Message-Id: <20200714070220.3500839-11-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200714070220.3500839-1-ira.weiny@intel.com> References: <20200714070220.3500839-1-ira.weiny@intel.com> 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 From: Ira Weiny The addition of PKS protection to dax read lock/unlock will require that the address returned by dax_direct_access() be protected by this lock. While not technically necessary for this series, this corrects the locking by ensuring that the use of kaddr and end_kaddr are covered by the dax read lock/unlock. Change the lock scope to cover the kaddr and end_kaddr use. Reviewed-by: Dan Williams Signed-off-by: Ira Weiny --- drivers/dax/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 8e32345be0f7..021739768093 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -103,11 +103,11 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, id = dax_read_lock(); len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn); len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn); - dax_read_unlock(id); if (len < 1 || len2 < 1) { pr_debug("%s: error: dax access failed (%ld)\n", bdevname(bdev, buf), len < 1 ? len : len2); + dax_read_unlock(id); return false; } @@ -137,6 +137,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, put_dev_pagemap(end_pgmap); } + dax_read_unlock(id); if (!dax_enabled) { pr_debug("%s: error: dax support not enabled\n", -- 2.25.1