Received: by 10.223.176.46 with SMTP id f43csp3170860wra; Mon, 22 Jan 2018 09:30:18 -0800 (PST) X-Google-Smtp-Source: AH8x225+gzIsAsoldCOQPtU5yje8vxTzqNIkvngLXjigXwaNcgmF18mkpcYWyXcWGx8Qk3jjwUvI X-Received: by 10.36.190.15 with SMTP id i15mr9702810itf.109.1516642218671; Mon, 22 Jan 2018 09:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516642218; cv=none; d=google.com; s=arc-20160816; b=h7bSKjUvu5jrkc8Zg2Zj5OBAivbx6wGCUbq4ndMWDh0aqwuLYcyw71isjAc+ql8aR7 RDz5qJJGhIMJN5611ipm1tYW0SbnlhdHnWIZlE5cL3M3INYVLfoJPpfZizMPH0G5aiex J7kYVneIHfVlrhGFQ741h/G3B34G9MPRSgwtqlaAKO88Unwso7JSe4x4jp7gENhEjUCW fpou1jA18N9zA56LqYaQKwnPAhjdbebJSb6esQnIET1eAhkDSP7nL6VBxfzHCki5oVvu iiopVTd/dXHGpBI1/iuv+hlee/eAqPScggJaECTvbfl/2lbFXn99WWGel7ybuoAh5K+G d2XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iq+5NG3sMPqk7lu+/gnpIKl19zDuJR+x+3/+rGFFSD8=; b=wXgXhZ15Zuv0oRIclPOINpHUcNQf1bmDvnouqbzq5i97UFFocc1ERWriK7+rbp8egE ErSNOCe+GVsL0wsL4uNHyHk+gUnKjXmcNJw5ePKt48gtz4alMLv2YjonOAUWpzpXJc3Q g+aRb52ofHH/edkasBNdmjRAbBbSRdEMrebxki+vg6GxTuanHrJbaWhOUN/tL94Jndip 7PLfKIaGvpeMW/H/2B38IB2AxE72ZyEWMXPQw5OajlFOT3xzwYrb67CkokjM/YTe0YKG vfTZItdEtnWVjMDYJhxpvJbuLWyfyOA+sGxDJiHw7BAZUCfoW2iBOkxauagZ0aHY5yPG yWRA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si13496220iof.187.2018.01.22.09.30.06; Mon, 22 Jan 2018 09:30:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbeAVR3S (ORCPT + 99 others); Mon, 22 Jan 2018 12:29:18 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:39001 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbeAVR3R (ORCPT ); Mon, 22 Jan 2018 12:29:17 -0500 Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Mon, 22 Jan 2018 10:29:12 -0700 From: Davidlohr Bueso To: tony.luck@intel.com, fenghua.yu@intel.com Cc: linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, dave@stgolabs.net, Davidlohr Bueso Subject: [PATCH] ia64/err-inject: Use get_user_pages_fast() Date: Mon, 22 Jan 2018 09:21:37 -0800 Message-Id: <20180122172137.26849-1-dave@stgolabs.net> X-Mailer: git-send-email 2.13.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At the point of sysfs callback, the call to gup is done without mmap_sem (or any lock for that matter). This is racy. As such, use the get_user_pages_fast() alternative and safely avoid taking the lock, if possible. Signed-off-by: Davidlohr Bueso --- arch/ia64/kernel/err_inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index 85bba43e7d5d..658a8e06a69b 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c @@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, u64 virt_addr=simple_strtoull(buf, NULL, 16); int ret; - ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL); + ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); if (ret<=0) { #ifdef ERR_INJ_DEBUG printk("Virtual address %lx is not existing.\n",virt_addr); -- 2.13.6