From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762855AbdAET3K (ORCPT ); Thu, 5 Jan 2017 14:29:10 -0500 Received: from muru.com ([72.249.23.125]:55076 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754768AbdAET1w (ORCPT ); Thu, 5 Jan 2017 14:27:52 -0500 Date: Thu, 5 Jan 2017 11:27:48 -0800 From: Tony Lindgren To: Linus Walleij Cc: Jon Hunter , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH] pinctrl: core: Fix panic when pinctrl devices with hogs are unregistered Message-ID: <20170105192748.GS4310@atomide.com> References: <1483631575-14422-1-git-send-email-jonathanh@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Linus Walleij [170105 08:16]: > On Thu, Jan 5, 2017 at 4:52 PM, Jon Hunter wrote: > > > Commit df61b366af26 ('pinctrl: core: Use delayed work for hogs') > > deferred part of the registration for pinctrl devices if the pinctrl > > device has hogs. This introduced a window where if the pinctrl device > > with hogs was sucessfully registered, but then unregistered again > > (which could be caused by parent device being probe deferred) before > > the delayed work has chanced to run, then this will cause a kernel > > panic to occur because: > > > > 1. The 'pctldev->p' has not yet been initialised and when unregistering > > the pinctrl device we only check to see if it is an error value, but > > now it could also be NULL. > > 2. The pinctrl device may not have been added to the 'pinctrldev_list' > > list and we don't check to see if it was added before removing. > > > > Fix up the above by checking to see if the 'pctldev->p' pointer is an > > error value or NULL before putting the pinctrl device and verifying > > that the pinctrl device is present in 'pinctrldev_list' before removing. > > > > Fixes: df61b366af26 ('pinctrl: core: Use delayed work for hogs') > > > > Signed-off-by: Jon Hunter > > Oops. Patch applied. OK, did not see that with my testing of hogs with omap4-duovero-parlor. Thanks for fixing that. Tony