From patchwork Mon Jun 11 18:06:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10458631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A8B5601A0 for ; Mon, 11 Jun 2018 18:07:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A88C285C4 for ; Mon, 11 Jun 2018 18:07:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FC73285C6; Mon, 11 Jun 2018 18:07:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 138BC28599 for ; Mon, 11 Jun 2018 18:07:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF2D56E380; Mon, 11 Jun 2018 18:06:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot0-f194.google.com (mail-ot0-f194.google.com [74.125.82.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id B050D6E380 for ; Mon, 11 Jun 2018 18:06:58 +0000 (UTC) Received: by mail-ot0-f194.google.com with SMTP id n3-v6so24863461ota.5 for ; Mon, 11 Jun 2018 11:06:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2wVfBJExz/kyiM37pRv/Vc6rAqkWscaiD8J+QlX7+CQ=; b=UkfAt9zrrzvfSd02hAxOE7TwRPmS6+BWY/79/uqv6dpBSCzwDWbM6odH2OhibVgeus cZwR5neTXsG4yYxv3wn/ZBt9Qk6EucMXyPkpy3mKzntb7/ROOODKkFaqZTkUNCnWh1fF ok6dVoEkOkNYSm228Vv0hV9WVKmbHmUsiJ+wMHHdOCbloYadFqUhScPnODzYxrf+4wJ3 rPMItvCBZGfIBQofZD1qqVpP5v/rUjfelD7B3hCpJsCZKZ/NLiLzYyKLSLlvH1LA/2dC jCYINuCX3fj3UDCUP1LQN0kr9fVbmxQmHt0Kv/FyiIKAA/CQ3Ked8DyqqxxpekTiGQut dWUQ== X-Gm-Message-State: APt69E2sW4Tu1LFKixgwCMx7h0+UlTD7RdCFnz3CD+DVyDfwFJ4Kljw3 1aw16DUoifyeX+rixt6tuzhEkw== X-Google-Smtp-Source: ADUXVKLmZ9lghjLk3N6zczmCXCzXELYgAI+VdAkmBEPjYohsWby/CJvgJEE8ZZaUebhhTvSKJtAizw== X-Received: by 2002:a9d:49a8:: with SMTP id g40-v6mr146581otf.223.1528740417836; Mon, 11 Jun 2018 11:06:57 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::d2dd]) by smtp.gmail.com with ESMTPSA id b38-v6sm18406664otd.61.2018.06.11.11.06.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 11:06:56 -0700 (PDT) From: Laura Abbott To: Sumit Semwal , Greg Kroah-Hartman Subject: [PATCH] staging: android: ion: Return an ERR_PTR in ion_map_kernel Date: Mon, 11 Jun 2018 11:06:53 -0700 Message-Id: <20180611180653.30573-1-labbott@redhat.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Todd Kjos , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Martijn Coenen MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/staging/android/ion/ion_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index 772dad65396e..f32c12439eee 100644 --- 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_heap *heap, struct page **tmp = pages; if (!pages) - return NULL; + return ERR_PTR(-ENOMEM); if (buffer->flags & ION_FLAG_CACHED) pgprot = PAGE_KERNEL;