Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1415190imm; Thu, 5 Jul 2018 22:59:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpffK2xx/8vHnoCv1ACTHQZA48/pIzEo4yGfMI4TWa2OA3/u0tC0ANw++r6tMV+VhMRzsfiH X-Received: by 2002:a17:902:e281:: with SMTP id cf1-v6mr9024216plb.86.1530856768935; Thu, 05 Jul 2018 22:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856768; cv=none; d=google.com; s=arc-20160816; b=w8+YzEEfNnyN207ymov3rpZk9sN3xWkeSFixB+Ilh3pXt6XsD7SsmmbwH4154FXcYF Sxu4619qPiYKuJ6OQ/HqdHj5zCOh/Raqiee2Q2/6rutIEas8nz9Wo+N5D8IsLPTzudoI AkhYSnSh+BI6aQLj8yQfI69PNA7IQwoZnmZGewntORBRTuDxXChMIhbq7Hk1plJGmUQ4 XhNqfe/z17XKnJwQpYz2BDUpCdGnyrcsyAW9nnYpRSEaRnb38xS1glhjV0sJtmcB1pJ9 RRWRakEis9+/yL3dluo6gmMb0ytglXMcemGWLmQ7rZKPq4V53VlrQ8FXrRUW8UVDyrz4 eyEQ== 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=0R2nY31PssEE2J7aU/upG+VBh8icrNe5y9m8O8GT4kQ=; b=PmsBpGLOxL6vcQaIDrc6dGDXy5zkJPiE4EOsyQK1d5GpBZXvVoNDpA8py8w0mivxfb bcVVJI4NDXHr6/GkyfkusrVn3RD/FPGR7oR6rFlOtgvbZnd7KDth7KfJUCsvEwv5QsN9 NLW9GE+/nBIwPjxbse3mI6BkpKhDsaxFN49IbZHSlDVR2TMY5jT0kICZboY93UmQjlZY gEB9F1vfhDpDKrNpXyAQXDka1UzF9fyJMsRkDP3xMnMkEZdBeE98wGFqFSoSmGY1p343 anS/85LkLX6EAQiQAMlnq7YClhOB5jUhjWGeK90gaFzYmTUB/Jnk8T9GSvcb2VOCKKc0 UuMw== 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 c5-v6si7360972pll.75.2018.07.05.22.59.14; Thu, 05 Jul 2018 22:59:28 -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 S934320AbeGFFva (ORCPT + 99 others); Fri, 6 Jul 2018 01:51:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33334 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934299AbeGFFv1 (ORCPT ); Fri, 6 Jul 2018 01:51:27 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EE15286A; Fri, 6 Jul 2018 05:51:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+55b1d9f811650de944c6@syzkaller.appspotmail.com, Laura Abbott Subject: [PATCH 4.14 11/61] staging: android: ion: Return an ERR_PTR in ion_map_kernel Date: Fri, 6 Jul 2018 07:46:35 +0200 Message-Id: <20180706054712.765136766@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@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: Laura Abbott commit 0a2bc00341dcfcc793c0dbf4f8d43adf60458b05 upstream. The expected return value from ion_map_kernel is an ERR_PTR. The error path for a vmalloc failure currently just returns NULL, triggering a warning in ion_buffer_kmap_get. Encode the vmalloc failure as an ERR_PTR. Reported-by: syzbot+55b1d9f811650de944c6@syzkaller.appspotmail.com Signed-off-by: Laura Abbott Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -38,7 +38,7 @@ void *ion_heap_map_kernel(struct ion_hea struct page **tmp = pages; if (!pages) - return NULL; + return ERR_PTR(-ENOMEM); if (buffer->flags & ION_FLAG_CACHED) pgprot = PAGE_KERNEL;