Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3060869imm; Sun, 1 Jul 2018 11:19:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8gTFd2oxmyhuEh7GIwWwCZHwST3AsqEaCTDmAboU68NdI5xLOAS2CK7pj6JdWL1SpXQUm X-Received: by 2002:a17:902:b590:: with SMTP id a16-v6mr23492434pls.225.1530469155826; Sun, 01 Jul 2018 11:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530469155; cv=none; d=google.com; s=arc-20160816; b=d5yOG4Xha1AWbxos62sz2N5C6cD5Yz9AmVe1jb8NZb5bpNQYooaQgT6mhbajjm/IVw 5uQyjMoVOJ/yjrC9MiNLY69F/jlI0EMnjhxlEgDuQNUmo2Asgx8dejoL10J0XrjQZhH0 e+EWTdhx/6H5dlqKtEKwl0gDxaU7wwiJpm3TLFh7pVZU0XawdFpErL/+eARMPBm5yz1o cdSLgf5h5fmaURdL+Qgbd3NA/A1R0aXz48eZEy5Ds/UugGArE68CPpJpWzraD+FUK9uj aLq35vH+0+5wHGw/ofsT0dELRr4gfSA8ntWQPuxnNdvpra+kk4RXPbo5NBIuE8bVP5fZ 8X2w== 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=zpeFf8CTpZVWEyNpQDbBCtmkQ82w982mWBtqB90Ms8k=; b=L4+Ga/GAsCe/zrt4ZkdE6SQvZfkzYzDhuCY2ACproxbh5T0Xr61CgizeQK3KxbxECl r3LCcH2Sb/npF4iUw9W76gx8dey56Oag11tjBB/wxs8l8j/tcuSDrWvrIC1nHcQVE8gv iaJeczvU7HEpiQvbC7wIgXgRRXC2DPsK+7avD6qGIyljK+HVZfdXUyGVfOMbqPgpz96A MeBVK6A2bJg0Jg4IB4q2DEbf7DjcdAHjne+18pyV44CB/y27rhWgJTp2oKJqYu8GVnSp Wd4kVBi0YjavIqz0jFrthlbxYAcT/D7RBUtqaHvQUHXgz3R1CqwGfTJyY5UI9ok8LuP0 BABA== 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 e95-v6si14622261plb.239.2018.07.01.11.19.01; Sun, 01 Jul 2018 11:19:15 -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 S965485AbeGASRk (ORCPT + 99 others); Sun, 1 Jul 2018 14:17:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33770 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933901AbeGAQ0A (ORCPT ); Sun, 1 Jul 2018 12:26:00 -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 176DEAD8; Sun, 1 Jul 2018 16:25: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 4.9 007/101] m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() Date: Sun, 1 Jul 2018 18:20:53 +0200 Message-Id: <20180701160757.432756875@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@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.9-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; }