Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150525ybi; Mon, 8 Jul 2019 15:39:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5Hh2xgDjkZhyalQlSZXJayDGyFXJkPcN3+H5Nogoy115aVsBSvPX9y/OP7YSgyf9DMIbP X-Received: by 2002:a17:902:9a82:: with SMTP id w2mr27677137plp.291.1562625586044; Mon, 08 Jul 2019 15:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625586; cv=none; d=google.com; s=arc-20160816; b=qPdCGky4WiK1RFtB3pV5fdvxLYD+LWwvBphHC2QkgszivSh4gfayEbmsExgO5etwR7 ANC7oWZpMtnMf/U8pYXfjqcKidJVRCvWo0/7qsN/Vf7f2GhaAWIw6eaLKAmDRyr+mDZf PI/Qex7JFVFlwIfyGVOvQqX9pIOmkdH+E00CYrhBMAF18M4YNcnoJbol2o4FlYXmOdRG Jp3a5HAR0zyYQsQgztGdvRokVYBXSJgYVggoP0uiZjyGxam7f3udsVYItYuCUqJ0D56c w7/CMBh66xLtq1es1+Z2BcUqsVsDoQ35fkgGiQuWBm/CNGVag8SjycKNMdvcnoG3+x3R At5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bhE0ZQgABc4HM6IRJKrwWIxuBrs2Zy6Xp6UrSQ4Jn20=; b=c5HOly4jfYEdHsCf2na27kzu6mZXW7fHsKFnFT3uWXKBRejTXI8TiaqzMGxWrEFYcn +xmGm81fkC1AssnDvOxnI1nrxViQRCfCta0hA25pukd/DqyH8NJYUcsx6GF7A9kmMXnL JhUsviSo9USBOiIf4fK79ZeMpYBYi2FQU+4W7mS/BIpJsBb69V31uC7m6AE2njlrUN4e KlyhhpeIMcdQW+/OYcawIwDm4j6RQSXVL6von7cwsTAOw3CbdSWtMywHrxeeXKWQUtER 25vv5IXqVbfB1DF5ESHCiUyw6a9iQln9XrE6M/gV3xe/jB8KYWi2JrHUjOpNB5a55t5Y 7eaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gtLBaEHu; 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 l63si20180198pge.264.2019.07.08.15.39.31; Mon, 08 Jul 2019 15:39:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gtLBaEHu; 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 S1730116AbfGHPas (ORCPT + 99 others); Mon, 8 Jul 2019 11:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:59850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730174AbfGHPap (ORCPT ); Mon, 8 Jul 2019 11:30:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14FF8216C4; Mon, 8 Jul 2019 15:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599844; bh=oqJOOPIzXqtL84WhyP7K9dTw3vqk5/8dazpQ8iRpGL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtLBaEHuX506Uwg6vmtgMB3iqJyh0Imvmt5ivP57+sSv6SM8AVRBt75SosmkVuS8A yvkoxdDrX0QJD2horKqahtwsR7jx83Lnl8dOEl9SwLpYA9an42pvsVYWceQkEQdCS0 m//xPP1l9vEDDkW68loQHneWGauvgcTD7xG19qD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Burton , Hauke Mehrtens , ralf@linux-mips.org, jhogan@kernel.org, f4bug@amsat.org, linux-mips@vger.kernel.org, ysu@wavecomp.com, jcristau@debian.org Subject: [PATCH 4.19 86/90] MIPS: Fix bounds check virt_addr_valid Date: Mon, 8 Jul 2019 17:13:53 +0200 Message-Id: <20190708150526.824054542@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150521.829733162@linuxfoundation.org> References: <20190708150521.829733162@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hauke Mehrtens commit d6ed083f5cc621e15c15b56c3b585fd524dbcb0f upstream. The bounds check used the uninitialized variable vaddr, it should use the given parameter kaddr instead. When using the uninitialized value the compiler assumed it to be 0 and optimized this function to just return 0 in all cases. This should make the function check the range of the given address and only do the page map check in case it is in the expected range of virtual addresses. Fixes: 074a1e1167af ("MIPS: Bounds check virt_addr_valid") Cc: stable@vger.kernel.org # v4.12+ Cc: Paul Burton Signed-off-by: Hauke Mehrtens Signed-off-by: Paul Burton Cc: ralf@linux-mips.org Cc: jhogan@kernel.org Cc: f4bug@amsat.org Cc: linux-mips@vger.kernel.org Cc: ysu@wavecomp.com Cc: jcristau@debian.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -203,7 +203,7 @@ unsigned long arch_randomize_brk(struct int __virt_addr_valid(const volatile void *kaddr) { - unsigned long vaddr = (unsigned long)vaddr; + unsigned long vaddr = (unsigned long)kaddr; if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE)) return 0;