Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3022690imm; Sun, 1 Jul 2018 10:29:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+IrCXkBxNTg/nrdjG5kZpGUaXwTVr2cxjhDjEAqAmjcWsQgDF+zQZqh8z8TqpvZ7vra2v X-Received: by 2002:a63:a919:: with SMTP id u25-v6mr8401663pge.211.1530466184809; Sun, 01 Jul 2018 10:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530466184; cv=none; d=google.com; s=arc-20160816; b=lDSixr4TpVNgeXdGmXGdSv+LZWdlWvvNhMgN/w/TRa3EyQk2AtDfekcN7NQ+WGqq+y CJnJate1dZkoFazt3PpMJ2DRuNVeo1G0XZI4UslLOKnUHqGjAJMx3A5T+/xqUun79VXr Z2Y+LcKvtsTlE7jBlIrohso8q6xYzVyEFpQcRgMx3WZSEjp42joTaU5gvHQeBdTOugwC BsBjiHuugbZv+3e3uRdeBLBX3Eg38TOthxUDUuoQU0/L49gtubJ6zIqYp8Kfnc80+hld LNab6DHYC7zgGZcaFbtdVpfLlFQ9Wgtp+zSmpV6WEiEjXHJFY78p18NXJCuSzv34brOe wAtA== 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=qsu+OpgPeWACH4kwm8E5kK5aDoj1PtWmgrq0RlJCx5k=; b=FM0c+N1UlMjBXofJNNKEQUWPWbZfTKNmbnJDuFvN1Dt66QFdX66DQhJ9sXqI0yLKG/ px+KkCWm+HLK4B8puDObnt1FiMPrDfAei2K71OQdwkhBWHHZxq11U/zzMwt8MJXN0CSW 8gxSBnNwQ5a+ZOw+AlUCWyYW9AHokqxndGNaoEQDjh1P7+k4XnnLmVIPaaFStErGG/tk lPUvdRy9qJZsFbC3PpU3fP9lSDP7Q9Z6ceADVuWY3FKKQi3xMvoIkKZ4LNtjfD9dR1IM vjSeM+uBsQQjy66yMEGnSyYdbc337q5VI365bxEwpTnZctU8VuMDt562SwQy8NaE+DsC Ph7Q== 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 u10-v6si12186241pgc.261.2018.07.01.10.29.30; Sun, 01 Jul 2018 10:29:44 -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 S1031364AbeGAQhA (ORCPT + 99 others); Sun, 1 Jul 2018 12:37:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36132 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031352AbeGAQgx (ORCPT ); Sun, 1 Jul 2018 12:36:53 -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 88386ACC; Sun, 1 Jul 2018 16:36:52 +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 4.17 011/220] m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() Date: Sun, 1 Jul 2018 18:20:35 +0200 Message-Id: <20180701160908.824938082@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@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 4.17-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 @@ -89,7 +89,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; }