Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150812ybi; Mon, 8 Jul 2019 15:40:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxW4YHCEpOCrAkPUlZg2LhFhojcxRunfydGh0WMY3sUEX1bXLNwj92tS31fgCdeGdacKxO/ X-Received: by 2002:a17:902:29e6:: with SMTP id h93mr26593037plb.297.1562625608399; Mon, 08 Jul 2019 15:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625608; cv=none; d=google.com; s=arc-20160816; b=hFppKvEpHfwcQ+XhGDWK8gFQIF84U94AjuYawtXAqcpoD+1j/ojeiOJ729eFQKBJOy DsFbBlxc1DHxrxWgDaAjFXtZsYsuxhRp6Xz40M9ULbUvmv4Gkb0Esy6xI4DlQvtEUGmc mTnxlVPKkfCF1UfixVY1VDA7qKYdEZDId6cAbxUYTuDRYtQiPr12iTtGOSZs4zCPF1XC CXC3sY2lZKxW2Bzb6yISyMHSLSCvtE6A9e2yevSXiwMP28y3r2pYwvQBfBadzSip6PHi fP7NMlw+zX/K2V6p4UI7dWy92osNuY8hBHnp+092C6PL1kFvmF64YWtzCn8+P/mrwV0W sIPA== 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=WqqIhTPw+o9MYP+5pCyyP7ByeXS5aK8jXSf1WhFfXULONuCe2csJIMW156onUtLrTz mUpVAzFJspY97HkSpl106fY7WDzvgB0NjZk9Ja+lhJLOT7+ziMsr47BjEjI7Co7zP+iM QMWTB/yBMIDpGwpduW3Htx74I+2WZ+QOAxGlNEDNEsqqAmPZKNG5Ql/W7SLEkZMxBY9E FfJ30ANhsRWIJiepvTbzalqyS8ZGUmAw0CBCMZXGTaooGtRLgRJqDc8k6VcPBdGHCIj3 viGU7zX7kIFMi7U2dh+ae7QZiMIlU37jZEg2obgg+/7xRfOkf/+9lOBiWgNMXOWcNa9R /F5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iG7ODRBQ; 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 z7si2400632pgi.257.2019.07.08.15.39.52; Mon, 08 Jul 2019 15:40:08 -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=iG7ODRBQ; 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 S2390691AbfGHPf3 (ORCPT + 99 others); Mon, 8 Jul 2019 11:35:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:38020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390650AbfGHPf0 (ORCPT ); Mon, 8 Jul 2019 11:35:26 -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 3D58620665; Mon, 8 Jul 2019 15:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600125; bh=oqJOOPIzXqtL84WhyP7K9dTw3vqk5/8dazpQ8iRpGL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iG7ODRBQTcYqhtc5Erjlc93taDmC0Cl0BN0o+9ti1BVMRcUOEqIF4/TZN37/j3cCK To9ZR8209fRyDIITQJvubRb5xy44JMCXF02nq44eKlezajyd8PA/MsxxtMnKBRzNZW KFQ3F2yOlwuM0ahuO9ztNzq37v9jezQuuz3rsDkM= 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 5.1 89/96] MIPS: Fix bounds check virt_addr_valid Date: Mon, 8 Jul 2019 17:14:01 +0200 Message-Id: <20190708150531.247785719@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@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;