Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3071579imm; Sun, 1 Jul 2018 11:34:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ7CO3PXsvzVFmbH/k8DKXqV2V9WDUCw3mee6Z/bf7yIKoEdbVXio6fFZHh0eAuOhuqs4rO X-Received: by 2002:a17:902:9a01:: with SMTP id v1-v6mr23400508plp.20.1530470094587; Sun, 01 Jul 2018 11:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530470094; cv=none; d=google.com; s=arc-20160816; b=mB44kNERqL9ijcAhOJKEUT9xo+vuKPjl/qpYB8qmwEUh0uMX+uxGr7x0uME7rsSLb0 7obk3r6DTe0Ju4r1XdjmYhmfvq27yNbOrSqeFazW8Bdxt7DnGXxL0qCawp16Wpmbv5mv 6qmjPlU+V/xJNdTRNJOeG9sKyq43B/orP7uwBNqsnyogMJu2tR0RyQV/+QJFAjF6cJ0z 6oQTmV/ByIv5YK+Jlh+CldPag/JMFTPUYhMjqtPtkbQRJXRnAyoMGwd/lWvwYq4NCAzP MZAk0vkpsBRH1ZycQG/L8lACHID6uZKxhhFpC0JkjmoElNwiA2K/zAH2tyOzorC9rmGX xMUQ== 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=wlhNDfJ+5hWLRBC3BWk/PWON2C5q0POZ7Afmx/DJOJE=; b=0jg2zffsFTw9fAnuuJjRPEqwa5bNXiaxU+Oi5+fzteoHyQDItWRMJwuNQ7TRcuh2vB AXsZafI08Xdbz6Bg0xHwPlkwKascE/bfavMWC5NYXPcZGu534VsWnd+XPo3VxGS6PO80 LUe6TOGR06IV1qEsU6KaKThy08UZP+6y2smopD5FAH0TytEll13zlSZfF9YpfQHYe2Wr lGac7SFqUxM7i1Aw0qgvg3yCSGx+58SMWk8VT9wGEYifyfhdfzNhXkPB5HlymgFXgyx8 WAZ/t4SmFLxgOo0ed/7wRrXmF8DQAMghebSZTcaf714t/TKiK139YG/xzPVVGRlz9dYD Vlpw== 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 l10-v6si14212206pfb.69.2018.07.01.11.34.40; Sun, 01 Jul 2018 11:34:54 -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 S933390AbeGAQQG (ORCPT + 99 others); Sun, 1 Jul 2018 12:16:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60696 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932678AbeGAQQD (ORCPT ); Sun, 1 Jul 2018 12:16:03 -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 E8BCA4A3; Sun, 1 Jul 2018 16:16:02 +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.4 027/105] m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() Date: Sun, 1 Jul 2018 18:01:37 +0200 Message-Id: <20180701153151.280819416@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153149.382300170@linuxfoundation.org> References: <20180701153149.382300170@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.4-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; }