public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 000/003] Attempt to cope with device changes and delayed kobject deallocation
@ 2015-05-19 15:13 Richard Watts
  2015-05-19 15:14 ` [PATCH 001/003] " Richard Watts
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Watts @ 2015-05-19 15:13 UTC (permalink / raw)
  To: linux-kernel, gregkh

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-10  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-19 15:13 [PATCH 000/003] Attempt to cope with device changes and delayed kobject deallocation Richard Watts
2015-05-19 15:14 ` [PATCH 001/003] " Richard Watts
2015-06-10  6:46   ` Alex Bennée
2015-05-19 15:15 ` [PATCH 002/003] " Richard Watts
2015-05-19 15:15 ` [PATCH 003/003] " Richard Watts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox