Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753466AbdGKJlH (ORCPT ); Tue, 11 Jul 2017 05:41:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59090 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbdGKJlF (ORCPT ); Tue, 11 Jul 2017 05:41:05 -0400 Date: Tue, 11 Jul 2017 11:41:02 +0200 From: Greg Kroah-Hartman To: Daniel Vetter Cc: Alexandru Moise <00moses.alexander00@gmail.com>, Rusty Russell , Jessica Yu , Linux Kernel Mailing List , Daniel Vetter , dri-devel , Dave Airlie , Sean Paul , "Nikula, Jani" Subject: Re: [PATCH] drm: inhibit drm drivers register to uninitialized drm core Message-ID: <20170711094102.GB14041@kroah.com> References: <20170708214352.GA27205@gmail.com> <20170710065246.rn4o3bjje37bktww@phenom.ffwll.local> <20170710071453.GA16847@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1449 Lines: 33 On Mon, Jul 10, 2017 at 08:00:37PM +0200, Daniel Vetter wrote: > On Mon, Jul 10, 2017 at 9:14 AM, Alexandru Moise > <00moses.alexander00@gmail.com> wrote: > > On Mon, Jul 10, 2017 at 08:52:46AM +0200, Daniel Vetter wrote: > >> On Sat, Jul 08, 2017 at 11:43:52PM +0200, Alexandru Moise wrote: > >> > If the DRM core fails to init for whatever reason, ensure that > >> > no driver ever calls drm_dev_register(). > >> > > >> > This is best done at drm_dev_init() as it covers drivers that call > >> > drm_dev_alloc() as well as drivers that prefer to embed struct > >> > drm_device into their own device struct and call drm_dev_init() > >> > themselves. > >> > > >> > In my case I had so many dynamic device majors used that the major > >> > number for DRM (226) was stolen, causing DRM core init to fail after > >> > failing to register a chrdev, and ultimately calling debugfs_remove() > >> > on drm_debugfs_root in drm_core_exit(). Note, there are patches in my "to-apply" queue to prevent that from happening, that should show up in 4.14-rc1. So that shouldn't be an issue in the future. > I feared that would be the answer :-/ Still feels funny that everyone > will need to hand-roll this, or does everyone simply assume that their > subsystem's module_init never fails? How would we not "hand-roll" this? Every subsystem works a bit differently. But if you can think of a way to make this generic, that would be great... thanks, greg k-h