diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 12:34:53 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-14 12:34:53 -0800 |
commit | 60f40585c9c9c5c09af1b7854e1299a61fc95b21 (patch) | |
tree | 5a9d444777fbe729bcbd38a3f5377888cbd33226 /lib | |
parent | 779ee19da757d6bbf5504840f8b624f525de9797 (diff) | |
parent | 00cd29b799e3449f0c68b1cc77cd4a5f95b42d17 (diff) |
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); |