Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3309227imu; Sun, 11 Nov 2018 12:05:27 -0800 (PST) X-Google-Smtp-Source: AJdET5eFyj1upvl3M2FqDYZTMZNz/LgAv8V6449mmQ21YNyw1iRpGteCJHXhAR+sv6+Ow0hAjhea X-Received: by 2002:a17:902:244:: with SMTP id 62-v6mr17575777plc.280.1541966726970; Sun, 11 Nov 2018 12:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966726; cv=none; d=google.com; s=arc-20160816; b=dhbsXqS0Y1FUD3qhzZY2nN9cevo91Whr1Xdo3qfPTlarmlh7sSdRkkLBnZruPh7iYk MGU1YLBhferFnB2u7OQ/koT276Zym2Z7tfoAnZQCCkHUFMWGIouAFiMKFx+rkpQV8N7P W6zLU0uSCOz3iGpZu3/ylah10B5ljbHee3OFjW4KD04TR5vMZD6v0pycNnOgGWcRJEBd 08N8yzfAECo5+ykC1LKaDHsF+GENngaIAQK01v6o4TQqnuqaxn3wIFXcPNrAPmhdD8sU HMmaFKcDsO8s5vihFiPzon/VWlUFfjcCdr9m/wLrWXUK9QfpC8R/+8zsQbzy0fQeujSD 7Rkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=spU60LlM9vBMqbJDliv7oUyD3o5ADWPJfx8z4+Avxc4=; b=g0zrA6A3qFrG8+rOEO2vUMlV+JW4VClQbPeU2MAYPu+IGTa2ibM6vTfd4jGhCSqY9w XwpknKv/1EP/BbPwWGWXEie/BTrbopd7p6mLGEcLhvRgG8e/Ym8QN4gCMlj20nJ8Ce2B brdz/ht3Hii851St823IjSBkKA0MdH2Irkk+2y1+vXSuV8tbuwWN01mbgy4VpdahShoe zM20mrPQFu2NSlR9PGqE6CWhqWFbol2ITCJO7ezNTMZ9Ni+DzvmRM0Cya5Zs4xiq7uXk t6c7WanVJ4DVNiA/f39DaYkEhZrdrm1g4CYmgSeg1Z7NAMtcb4QMcpK3LQ+0zWofTca3 YrWA== 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 k8-v6si14098146pgj.192.2018.11.11.12.05.11; Sun, 11 Nov 2018 12:05:26 -0800 (PST) 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 S1731060AbeKLFxn (ORCPT + 99 others); Mon, 12 Nov 2018 00:53:43 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51636 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbeKLFxn (ORCPT ); Mon, 12 Nov 2018 00:53:43 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsx-0000oU-Mz; Sun, 11 Nov 2018 19:59:07 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsU-0001dO-A0; Sun, 11 Nov 2018 19:58:38 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Laura Abbott" , "Greg Kroah-Hartman" , syzbot+55b1d9f811650de944c6@syzkaller.appspotmail.com Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 196/366] staging: android: ion: Return an ERR_PTR in ion_map_kernel In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- 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;