Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2962694imm; Sun, 1 Jul 2018 09:14:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeCZ/4FT7GgGPq+e3TUcHgjA+qTK4AQvoGs2QS2UxyU1SdYE18kKn+ZXdKp86IWXUR180kw X-Received: by 2002:a65:6086:: with SMTP id t6-v6mr17482778pgu.424.1530461680482; Sun, 01 Jul 2018 09:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530461680; cv=none; d=google.com; s=arc-20160816; b=i44kV89EeBddMUJ3tXAOOuYCal87RxFru45J+/jtMpyJB5Dn2u2iVdERNelptHnZki nnsMuuzisi78iTEVy96GFzRDp9I6IRSx5MDrJWHxEhw5obrXNysD4PQHyU9jlCS8h+TN ba4H5Tk8G0yEpPAVihVpqYeA1Nm/5IqY2lh85WqiAJyoZ3gPjzGUgFPteO9y2/0NQoHN EA7fNazKcLRC/9L3ymlfJ5fIY9Kus3RmXXZoaaBsFjuOd+hHSVK5KL3V2fd08YztNqLE Z55F3KVVxIUnSOnsWjPHlmmOfU69qLDW3IWyWJwHSrDejSTCY/At2zUUZXTBtIC5bhlK Y2QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cAqm8wB8dtTGJMj2P/H7GCpGEiy6zi3P/FCoDPNquTM=; b=DRL28HVEyOEAATv65lVouApgWq/0RPA59J6/KjKnZVbOxH1bpm2Id4jTt2UqPXNuJ1 jsmrbMQ6tHn9h4ia2WUaSNuNA19H1cZLiIn+0G9qBbxyhGFFDn70ZDl6vgPOHKzLLsGk UHWzZU3guvHG3zPk4conlm86mNMmkJaq4lVOQIK3ThR4/RiSw1FAFLyuBaVn1FKiSaGI pVpYkBV9vxJc0PUjmVJUhWldJjbnRbQzJZ3PIbApNDkfOnzNMtIAu4PhUmSQL6VIY+65 uZXjFkx0V7G0I4e7QrsiNPfzurcSvtVTHDwgs9rGSdQ0wS4zxzzo0yfyvmMcEMMoKqqQ 3/aQ== 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 t17-v6si11802932pgv.615.2018.07.01.09.14.25; Sun, 01 Jul 2018 09:14:40 -0700 (PDT) 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 S932312AbeGAQNI (ORCPT + 99 others); Sun, 1 Jul 2018 12:13:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60040 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932083AbeGAQM7 (ORCPT ); Sun, 1 Jul 2018 12:12:59 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 941F586D; Sun, 1 Jul 2018 16:12:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Schmitz , Geert Uytterhoeven Subject: [PATCH 3.18 47/85] m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() Date: Sun, 1 Jul 2018 18:02:05 +0200 Message-Id: <20180701153124.232187037@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153122.365061142@linuxfoundation.org> References: <20180701153122.365061142@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Schmitz commit 3f90f9ef2dda316d64e420d5d51ba369587ccc55 upstream. If 020/030 support is enabled, get_io_area() leaves an IO_SIZE gap between mappings which is added to the vm_struct representing the mapping. __ioremap() uses the actual requested size (after alignment), while __iounmap() is passed the size from the vm_struct. On 020/030, early termination descriptors are used to set up mappings of extent 'size', which are validated on unmapping. The unmapped gap of size IO_SIZE defeats the sanity check of the pmd tables, causing __iounmap() to loop forever on 030. On 040/060, unmapping of page table entries does not check for a valid mapping, so the umapping loop always completes there. Adjust size to be unmapped by the gap that had been added in the vm_struct prior. This fixes the hang in atari_platform_init() reported a long time ago, and a similar one reported by Finn recently (addressed by removing ioremap() use from the SWIM driver. Tested on my Falcon in 030 mode - untested but should work the same on 040/060 (the extra page tables cleared there would never have been set up anyway). Signed-off-by: Michael Schmitz [geert: Minor commit description improvements] [geert: This was fixed in 2.4.23, but not in 2.5.x] Signed-off-by: Geert Uytterhoeven Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/m68k/mm/kmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/m68k/mm/kmap.c +++ b/arch/m68k/mm/kmap.c @@ -88,7 +88,8 @@ static inline void free_io_area(void *ad for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { if (tmp->addr == addr) { *p = tmp->next; - __iounmap(tmp->addr, tmp->size); + /* remove gap added in get_io_area() */ + __iounmap(tmp->addr, tmp->size - IO_SIZE); kfree(tmp); return; }