Skip to content

Commit 60f4058

Browse files
committed
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
2 parents 779ee19 + 00cd29b commit 60f4058

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/klist.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i,
282282
struct klist_node *n)
283283
{
284284
i->i_klist = k;
285-
i->i_cur = n;
286-
if (n)
287-
kref_get(&n->n_ref);
285+
i->i_cur = NULL;
286+
if (n && kref_get_unless_zero(&n->n_ref))
287+
i->i_cur = n;
288288
}
289289
EXPORT_SYMBOL_GPL(klist_iter_init_node);
290290

0 commit comments

Comments
 (0)