From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035339AbdEZGv3 (ORCPT ); Fri, 26 May 2017 02:51:29 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:35979 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030668AbdEZGuu (ORCPT ); Fri, 26 May 2017 02:50:50 -0400 MIME-Version: 1.0 X-Originating-IP: [2a02:168:5640:0:960b:2678:e223:c1c6] In-Reply-To: <20170526055218.GA23802@infradead.org> References: <1495521583-29151-1-git-send-email-jeffy.chen@rock-chips.com> <20170525153045.7svkkmfsqbqkfacp@art_vandelay> <59279331.3050402@rock-chips.com> <20170526055218.GA23802@infradead.org> From: Daniel Vetter Date: Fri, 26 May 2017 08:50:49 +0200 X-Google-Sender-Auth: cg-ub_kQJx-qrdPHYCNk-FWABLY Message-ID: Subject: Re: [PATCH] drm/rockchip: Don't allow zero sized gem buffer To: Christoph Hellwig Cc: jeffy , Linux Kernel Mailing List , dri-devel , Tomasz Figa , "open list:ARM/Rockchip SoC..." , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 26, 2017 at 7:52 AM, Christoph Hellwig wrote: > On Fri, May 26, 2017 at 10:30:09AM +0800, jeffy wrote: >> Hi sean, >> >> On 05/25/2017 11:30 PM, Sean Paul wrote: >> > On Tue, May 23, 2017 at 02:39:43PM +0800, Jeffy Chen wrote: >> > > The system would crash when trying to alloc zero sized gem buffer: >> > > [ 6.712435] Unable to handle kernel NULL pointer dereference at virtual address 00000010 <--ZERO_SIZE_PTR >> > > ... >> > > [ 6.757502] PC is at sg_alloc_table_from_pages+0x170/0x1ec >> > >> > It's unfortunate that you didn't include the entire stack trace. From code >> > inspection, it seems like the 0 size comes from the fb_probe path? Is there >> > somewhere in the helpers that you could check the mode is sane so all drivers >> > can benefit? >> >> hmm, sorry, i was testing it on chromeos 4.4 kernel, it turns out that we >> have a custom ioctl for userspace to create gem buffer(the same as exynos >> drm), which might get the the 0 size. >> >> but on upstream kernel, it could only be called by dump_create, and the >> drm_mode_create_dumb_ioctl already did the size check. >> >> will resent this patch, and rewrite the commit message, thanx. > > That suggests that this patch isn't needed at all. Yes, not needed for upstream. But next time around pls include the entire backtrace (or at least the relevant parts), not just the last line, so that we can figure this out directly. Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch