From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750747AbdAVWZj (ORCPT ); Sun, 22 Jan 2017 17:25:39 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:6893 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdAVWZh (ORCPT ); Sun, 22 Jan 2017 17:25:37 -0500 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 22 Jan 2017 14:25:37 -0800 Subject: Re: [PATCH] mm: do not export ioremap_page_range symbol for external module To: zhongjiang , , , References: <1485089881-61531-1-git-send-email-zhongjiang@huawei.com> CC: , X-Nvconfidentiality: public From: John Hubbard Message-ID: Date: Sun, 22 Jan 2017 14:25:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1485089881-61531-1-git-send-email-zhongjiang@huawei.com> X-Originating-IP: [172.17.160.221] X-ClientProxiedBy: HQMAIL102.nvidia.com (172.18.146.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/22/2017 04:58 AM, zhongjiang wrote: > From: zhong jiang > > Recently, I find the ioremap_page_range had been abusing. The improper > address mapping is a issue. it will result in the crash. so, remove > the symbol. It can be replaced by the ioremap_cache or others symbol. Hi Zhong, After thinking about this for a bit, and looking through our own (out-of-tree) kernel modules, I think you have a good point. I just can't see any reason for a driver to call ioremap_page_range directly. So the code change looks good to me. For the commit description, here is a proposed re-wording, optional, that perhaps may be a little clearer. See if you like it? ------- Recently, I've found cases in which ioremap_page_range was used incorrectly, in external modules, leading to crashes. This can be partly attributed to the fact that ioremap_page_range is lower-level, with fewer protections, as compared to the other functions that an external module would typically call. Those include: ioremap_cache ioremap_nocache ioremap_prot ioremap_uc ioremap_wc ioremap_wt ...each of which wraps __ioremap_caller, which in turn provides a safer way to achieve the mapping. Therefore, stop EXPORT-ing ioremap_page_range. ------- I may get some heat for this if another out-of-tree driver needs that symbol, but if no one else pops up and shrieks, you can add: Reviewed-by: John Hubbard thanks, john h > > Signed-off-by: zhong jiang > --- > lib/ioremap.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/lib/ioremap.c b/lib/ioremap.c > index 86c8911..a3e14ce 100644 > --- a/lib/ioremap.c > +++ b/lib/ioremap.c > @@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr, > > return err; > } > -EXPORT_SYMBOL_GPL(ioremap_page_range); > -- > 1.8.3.1 >