Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825001imm; Mon, 3 Sep 2018 10:24:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbYGNKDdZZyrv+yW8zGaibqHSLUuqQvhTYH2LYclJFxi8W03IvUomSNtvxftlNHDdQXERVg X-Received: by 2002:a63:9a02:: with SMTP id o2-v6mr8889159pge.440.1535995450983; Mon, 03 Sep 2018 10:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995450; cv=none; d=google.com; s=arc-20160816; b=COu1pgleDSaTD7UVLMQFcs1Os6Z9rwo3+r/12Zfuj4StGJFjhxVbzSUEuwvyPBJm2F 9DtTACIJqPBzvy3UV1V0pMBGQ62/IeGeR6EbwEaLl/JWmjQJ8OX0KTINDSypoBbXtssS PcX7XzOUsJUZS7q3XdPgu6KFcDnZjJYP6kDRygVwEN2wgIRUrlZT9ZR3/5pKmx/79rid wg393Y9OeNXwy+ybw0i+eCUm4uiERNESIz/K4TqUzHVZcvyeku9omEZP7LH/kn3tK/V1 oYfJb4YVTnHctyj4sRlY9WFwzSaUTFwR4RRzsXiEH25TnWCKOVrlHaA8Hr39CfXeeqlH +aTQ== 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=XhZ63AEsaeiEn8eHOjwHW5IRUsGly3zzSnZaMkZjvu4=; b=xfnaQuuUwNPvcQaTf/f5EtlYjnoAB4PHbXcJwMjq9EbbOIWpJWaWADYqDRWwVbmkn9 5x7w+1zgzfP2KUzAcPOS1Me41Wk7ATqhShfmiCxi//SH8afWfLGGZjEG+C9PxphfpKAa JU5dvUgRz6170KKCuhh/NAbnl+HD/6yk21kYIibnFGa9LUdvYkSmfSBbF0/Y3XDT4ZV2 9JijqMaMCjU82bLzhKATdaVgoRDT+H6vM+/8DjyjorA2K411MeT2q0UPEBmsU2rLJ6nn WOOtRrhsm7ukRe/1xa6Jw0p77LLd/OaAOcdGGNs1/rfBowad2NVnhzyo7tb6/50uaPpu CCqQ== 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 w20-v6si17872663pgf.434.2018.09.03.10.23.55; Mon, 03 Sep 2018 10:24:10 -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 S1730236AbeICVnG (ORCPT + 99 others); Mon, 3 Sep 2018 17:43:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43306 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbeICVnG (ORCPT ); Mon, 3 Sep 2018 17:43:06 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 853C9D2F; Mon, 3 Sep 2018 17:22:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chen jie , Andrew Morton , Li Zefan , Yang Shi , Alexey Dobriyan , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 082/165] mm/memory.c: check return value of ioremap_prot Date: Mon, 3 Sep 2018 18:56:08 +0200 Message-Id: <20180903165659.191757538@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "jie@chenjie6@huwei.com" [ Upstream commit 24eee1e4c47977bdfb71d6f15f6011e7b6188d04 ] ioremap_prot() can return NULL which could lead to an oops. Link: http://lkml.kernel.org/r/1533195441-58594-1-git-send-email-chenjie6@huawei.com Signed-off-by: chen jie Reviewed-by: Andrew Morton Cc: Li Zefan Cc: chenjie Cc: Yang Shi Cc: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- mm/memory.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/memory.c +++ b/mm/memory.c @@ -4348,6 +4348,9 @@ int generic_access_phys(struct vm_area_s return -EINVAL; maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); + if (!maddr) + return -ENOMEM; + if (write) memcpy_toio(maddr + offset, buf, len); else