diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 21:34:53 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 21:34:53 +0100 |
commit | 60f40585c9c9c5c09af1b7854e1299a61fc95b21 (patch) | |
tree | 5a9d444777fbe729bcbd38a3f5377888cbd33226 /lib | |
parent | Merge tag 'tty-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/greg... (diff) | |
parent | klist: fix starting point removed bug in klist iterators (diff) | |
download | linux-60f40585c9c9c5c09af1b7854e1299a61fc95b21.tar.xz linux-60f40585c9c9c5c09af1b7854e1299a61fc95b21.zip |
Merge tag 'driver-core-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fix from Greg KH:
"Here is one driver core, well klist, fix for 4.5-rc4.
It fixes a problem found in the scsi device list traversal that
probably also could be triggered by other subsystems.
The fix has been in linux-next for a while with no reported problems"
* tag 'driver-core-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
klist: fix starting point removed bug in klist iterators
Diffstat (limited to 'lib')
-rw-r--r-- | lib/klist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/klist.c b/lib/klist.c index d74cf7a29afd..0507fa5d84c5 100644 --- a/lib/klist.c +++ b/lib/klist.c @@ -282,9 +282,9 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i, struct klist_node *n) { i->i_klist = k; - i->i_cur = n; - if (n) - kref_get(&n->n_ref); + i->i_cur = NULL; + if (n && kref_get_unless_zero(&n->n_ref)) + i->i_cur = n; } EXPORT_SYMBOL_GPL(klist_iter_init_node); |