Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1410405imm; Thu, 5 Jul 2018 22:51:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIRZt8zQzRpcCQrkE4beMb79dCKgWXAngy5XHEhn4ZqxMK1cyAPPXLdyQ4wt9zK/MFWJ7r X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr8759113pli.263.1530856309181; Thu, 05 Jul 2018 22:51:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856309; cv=none; d=google.com; s=arc-20160816; b=Hks2g7j/sYI4pgLILibc9undJU2cgcYK5zDvoGDzSx5L44GL6aMMDVJ+wx0YGtHH6r Dyohd95yV5Tfy3ozqwDSGKocnAMuGVi25GK8f2rv/eu7IuEzEtL4rqIqlS37RrFDNnwn FtV0LUOVkmPXSBOO+5t1cdQb5dJG2MHP2QwOqoR2Nf4bcZLEChTfeWV9e/Ci58NgM6qb LtNltw2PIUnxTIyo47n536NPUEHxVLByb/AjVpOYFAImG46hpEqcuuOS9ducSCXld3d4 UYC+AcWMxEBwUMHLIMM7nt7RO3UGyN/cBLwipD1z6TEsgyhWPFzk0wLOSZcdQLo6mPNb KZ6w== 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=ZdlvMi1ZzMeuFgIVPPlZ6OrS6oc4rJIIwUPl0sMqKz0=; b=Dq4g5SERxoYgnzxQ6MhE2Dic7rTcsK9Rth3u9OljyEthlWdrw5Xawm+ngtuEK6whvJ DJRXsHWpzfH8Vy/mT86LbYGAPrwNj0wyXeLkybjj3lKBFQT9/3H9kcUDEUkNpDkMchxv 1/F1hW8bvKDc4/cEuWth3tDXVBOQq4nlouMiV6Ny41nZljsVsx/A20FKxXdCWM4MbMfo CWd4z6iq9FN0BFYRPiYFRwAB0eIzb7xmVPbKahIsYOYLAciYmF8DSydKnvhg82wSVcu7 Ox7T7+IRNBSBodRHaG0/HMAZBcQ1rRwkDUfLXYBGClc8Ph7Lq8EmC+byNpEBQDIiVGyY 1KVQ== 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 q23-v6si7347282pls.101.2018.07.05.22.51.35; Thu, 05 Jul 2018 22:51:49 -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 S933304AbeGFFs4 (ORCPT + 99 others); Fri, 6 Jul 2018 01:48:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60120 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932439AbeGFFsy (ORCPT ); Fri, 6 Jul 2018 01:48:54 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D325786A; Fri, 6 Jul 2018 05:48:53 +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.17 12/46] staging: android: ion: Return an ERR_PTR in ion_map_kernel Date: Fri, 6 Jul 2018 07:46:33 +0200 Message-Id: <20180706054525.193982377@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@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.17-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 @@ -29,7 +29,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;