hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/w1/w1.c
....@@ -1131,6 +1131,8 @@
11311131 /* remainder if it woke up early */
11321132 unsigned long jremain = 0;
11331133
1134
+ atomic_inc(&dev->refcnt);
1135
+
11341136 for (;;) {
11351137
11361138 if (!jremain && dev->search_count) {
....@@ -1158,8 +1160,10 @@
11581160 */
11591161 mutex_unlock(&dev->list_mutex);
11601162
1161
- if (kthread_should_stop())
1163
+ if (kthread_should_stop()) {
1164
+ __set_current_state(TASK_RUNNING);
11621165 break;
1166
+ }
11631167
11641168 /* Only sleep when the search is active. */
11651169 if (dev->search_count) {
....@@ -1224,10 +1228,10 @@
12241228
12251229 static void __exit w1_fini(void)
12261230 {
1227
- struct w1_master *dev;
1231
+ struct w1_master *dev, *n;
12281232
12291233 /* Set netlink removal messages and some cleanup */
1230
- list_for_each_entry(dev, &w1_masters, w1_master_entry)
1234
+ list_for_each_entry_safe(dev, n, &w1_masters, w1_master_entry)
12311235 __w1_remove_master_device(dev);
12321236
12331237 w1_fini_netlink();