Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756567AbbESPNa (ORCPT ); Tue, 19 May 2015 11:13:30 -0400 Received: from rrw.me.uk ([93.93.129.10]:56572 "EHLO rrw.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452AbbESPNH (ORCPT ); Tue, 19 May 2015 11:13:07 -0400 X-Greylist: delayed 516 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 May 2015 11:13:07 EDT Message-ID: <555B5305.9050506@kynesim.co.uk> Date: Tue, 19 May 2015 16:13:09 +0100 From: Richard Watts User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH 000/003] Attempt to cope with device changes and delayed kobject deallocation Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1425 Lines: 37 Sometimes (eg. when a ttyACM device undergoes a usb reset) we get into the situation where we are destroying and recreating a device object (specifically, the tty representing the ttyACM device) very quickly. When CONFIG_DEBUG_KOBJECT_RELEASE=y, kobject release is delayed and this allows the new ttyACM0 sysfs object to be linked to the old (zero-referenced) tty sysfs object. That object is then destroyed by the delayed kobject release and this leads to an oops. This patchset avoids that oops by: - using kref_get_unless_zero() to obtain the parent object. - inserting some code into sysfs_create_dir() to stop it complaining about duplicate directory names if the name we are a duplicate of has a zero reference count. This looks like a pretty grotty way to get around it to me, but perhaps it will prompt some discussion of what the right way to fix this is (or indeed if we should simply leave it be and have spurious oopses when CONFIG_DEBUG_KOBJECT_RELEASE=y). Comments, brickbats, etc. very welcome, Patch against e26081808edadfd257c6c9d81014e3b25e9a6118 (master of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git ) Richard. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/