Contents of /trunk/kernel-alx/patches-5.4/0292-5.4.193-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(show annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (19 months ago) by niro
File size: 64932 byte(s)
Mon Oct 24 12:34:12 2022 UTC (19 months ago) by niro
File size: 64932 byte(s)
-sync kernel patches
1 | diff --git a/Makefile b/Makefile |
2 | index 968470cf368ee..888d896058553 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 192 |
10 | +SUBLEVEL = 193 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h |
15 | index b05bb70a2e46f..8026baf46e729 100644 |
16 | --- a/arch/mips/include/asm/timex.h |
17 | +++ b/arch/mips/include/asm/timex.h |
18 | @@ -40,9 +40,9 @@ |
19 | typedef unsigned int cycles_t; |
20 | |
21 | /* |
22 | - * On R4000/R4400 before version 5.0 an erratum exists such that if the |
23 | - * cycle counter is read in the exact moment that it is matching the |
24 | - * compare register, no interrupt will be generated. |
25 | + * On R4000/R4400 an erratum exists such that if the cycle counter is |
26 | + * read in the exact moment that it is matching the compare register, |
27 | + * no interrupt will be generated. |
28 | * |
29 | * There is a suggested workaround and also the erratum can't strike if |
30 | * the compare interrupt isn't being used as the clock source device. |
31 | @@ -63,7 +63,7 @@ static inline int can_use_mips_counter(unsigned int prid) |
32 | if (!__builtin_constant_p(cpu_has_counter)) |
33 | asm volatile("" : "=m" (cpu_data[0].options)); |
34 | if (likely(cpu_has_counter && |
35 | - prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0)))) |
36 | + prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15)))) |
37 | return 1; |
38 | else |
39 | return 0; |
40 | diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c |
41 | index caa01457dce60..ed339d7979f3f 100644 |
42 | --- a/arch/mips/kernel/time.c |
43 | +++ b/arch/mips/kernel/time.c |
44 | @@ -141,15 +141,10 @@ static __init int cpu_has_mfc0_count_bug(void) |
45 | case CPU_R4400MC: |
46 | /* |
47 | * The published errata for the R4400 up to 3.0 say the CPU |
48 | - * has the mfc0 from count bug. |
49 | + * has the mfc0 from count bug. This seems the last version |
50 | + * produced. |
51 | */ |
52 | - if ((current_cpu_data.processor_id & 0xff) <= 0x30) |
53 | - return 1; |
54 | - |
55 | - /* |
56 | - * we assume newer revisions are ok |
57 | - */ |
58 | - return 0; |
59 | + return 1; |
60 | } |
61 | |
62 | return 0; |
63 | diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c |
64 | index 13f771f74ee3b..b0045889864c2 100644 |
65 | --- a/arch/parisc/kernel/processor.c |
66 | +++ b/arch/parisc/kernel/processor.c |
67 | @@ -419,8 +419,7 @@ show_cpuinfo (struct seq_file *m, void *v) |
68 | } |
69 | seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); |
70 | |
71 | - seq_printf(m, "model\t\t: %s\n" |
72 | - "model name\t: %s\n", |
73 | + seq_printf(m, "model\t\t: %s - %s\n", |
74 | boot_cpu_data.pdc.sys_model_name, |
75 | cpuinfo->dev ? |
76 | cpuinfo->dev->name : "Unknown"); |
77 | diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c |
78 | index 408b51aba2930..f582dda8dd34f 100644 |
79 | --- a/arch/x86/kernel/kvm.c |
80 | +++ b/arch/x86/kernel/kvm.c |
81 | @@ -59,6 +59,7 @@ static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __align |
82 | DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible; |
83 | static int has_steal_clock = 0; |
84 | |
85 | +static int has_guest_poll = 0; |
86 | /* |
87 | * No need for any "IO delay" on KVM |
88 | */ |
89 | @@ -584,14 +585,26 @@ static int kvm_cpu_down_prepare(unsigned int cpu) |
90 | |
91 | static int kvm_suspend(void) |
92 | { |
93 | + u64 val = 0; |
94 | + |
95 | kvm_guest_cpu_offline(false); |
96 | |
97 | +#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL |
98 | + if (kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) |
99 | + rdmsrl(MSR_KVM_POLL_CONTROL, val); |
100 | + has_guest_poll = !(val & 1); |
101 | +#endif |
102 | return 0; |
103 | } |
104 | |
105 | static void kvm_resume(void) |
106 | { |
107 | kvm_cpu_online(raw_smp_processor_id()); |
108 | + |
109 | +#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL |
110 | + if (kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL) && has_guest_poll) |
111 | + wrmsrl(MSR_KVM_POLL_CONTROL, 0); |
112 | +#endif |
113 | } |
114 | |
115 | static struct syscore_ops kvm_syscore_ops = { |
116 | diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c |
117 | index 6a8db8eb0e943..62c7f771a7cf8 100644 |
118 | --- a/arch/x86/kvm/cpuid.c |
119 | +++ b/arch/x86/kvm/cpuid.c |
120 | @@ -592,6 +592,11 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, |
121 | union cpuid10_eax eax; |
122 | union cpuid10_edx edx; |
123 | |
124 | + if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { |
125 | + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; |
126 | + break; |
127 | + } |
128 | + |
129 | perf_get_x86_pmu_capability(&cap); |
130 | |
131 | /* |
132 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
133 | index afe3b8e615146..3696b4de9d99d 100644 |
134 | --- a/arch/x86/kvm/lapic.c |
135 | +++ b/arch/x86/kvm/lapic.c |
136 | @@ -118,7 +118,8 @@ static inline u32 kvm_x2apic_id(struct kvm_lapic *apic) |
137 | |
138 | bool kvm_can_post_timer_interrupt(struct kvm_vcpu *vcpu) |
139 | { |
140 | - return pi_inject_timer && kvm_vcpu_apicv_active(vcpu); |
141 | + return pi_inject_timer && kvm_vcpu_apicv_active(vcpu) && |
142 | + (kvm_mwait_in_guest(vcpu->kvm) || kvm_hlt_in_guest(vcpu->kvm)); |
143 | } |
144 | EXPORT_SYMBOL_GPL(kvm_can_post_timer_interrupt); |
145 | |
146 | diff --git a/block/bio.c b/block/bio.c |
147 | index 1c52d0196e15c..40004a3631a80 100644 |
148 | --- a/block/bio.c |
149 | +++ b/block/bio.c |
150 | @@ -1627,7 +1627,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, |
151 | if (bytes > len) |
152 | bytes = len; |
153 | |
154 | - page = alloc_page(q->bounce_gfp | gfp_mask); |
155 | + page = alloc_page(q->bounce_gfp | __GFP_ZERO | gfp_mask); |
156 | if (!page) |
157 | goto cleanup; |
158 | |
159 | diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c |
160 | index 3f045b5953b2e..a0c1a665dfc12 100644 |
161 | --- a/drivers/acpi/acpica/nsaccess.c |
162 | +++ b/drivers/acpi/acpica/nsaccess.c |
163 | @@ -99,13 +99,12 @@ acpi_status acpi_ns_root_initialize(void) |
164 | * just create and link the new node(s) here. |
165 | */ |
166 | new_node = |
167 | - ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node)); |
168 | + acpi_ns_create_node(*ACPI_CAST_PTR(u32, init_val->name)); |
169 | if (!new_node) { |
170 | status = AE_NO_MEMORY; |
171 | goto unlock_and_exit; |
172 | } |
173 | |
174 | - ACPI_COPY_NAMESEG(new_node->name.ascii, init_val->name); |
175 | new_node->descriptor_type = ACPI_DESC_TYPE_NAMED; |
176 | new_node->type = init_val->type; |
177 | |
178 | diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c |
179 | index 54be88167c60b..f3b3953cac834 100644 |
180 | --- a/drivers/firewire/core-card.c |
181 | +++ b/drivers/firewire/core-card.c |
182 | @@ -668,6 +668,7 @@ EXPORT_SYMBOL_GPL(fw_card_release); |
183 | void fw_core_remove_card(struct fw_card *card) |
184 | { |
185 | struct fw_card_driver dummy_driver = dummy_driver_template; |
186 | + unsigned long flags; |
187 | |
188 | card->driver->update_phy_reg(card, 4, |
189 | PHY_LINK_ACTIVE | PHY_CONTENDER, 0); |
190 | @@ -682,7 +683,9 @@ void fw_core_remove_card(struct fw_card *card) |
191 | dummy_driver.stop_iso = card->driver->stop_iso; |
192 | card->driver = &dummy_driver; |
193 | |
194 | + spin_lock_irqsave(&card->lock, flags); |
195 | fw_destroy_nodes(card); |
196 | + spin_unlock_irqrestore(&card->lock, flags); |
197 | |
198 | /* Wait for all users, especially device workqueue jobs, to finish. */ |
199 | fw_card_put(card); |
200 | diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c |
201 | index 1da7ba18d3993..3a43e5d6ed3b2 100644 |
202 | --- a/drivers/firewire/core-cdev.c |
203 | +++ b/drivers/firewire/core-cdev.c |
204 | @@ -1482,6 +1482,7 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, |
205 | { |
206 | struct outbound_phy_packet_event *e = |
207 | container_of(packet, struct outbound_phy_packet_event, p); |
208 | + struct client *e_client; |
209 | |
210 | switch (status) { |
211 | /* expected: */ |
212 | @@ -1498,9 +1499,10 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, |
213 | } |
214 | e->phy_packet.data[0] = packet->timestamp; |
215 | |
216 | + e_client = e->client; |
217 | queue_event(e->client, &e->event, &e->phy_packet, |
218 | sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); |
219 | - client_put(e->client); |
220 | + client_put(e_client); |
221 | } |
222 | |
223 | static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) |
224 | diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c |
225 | index 94a13fca82673..5999dce11fc88 100644 |
226 | --- a/drivers/firewire/core-topology.c |
227 | +++ b/drivers/firewire/core-topology.c |
228 | @@ -374,16 +374,13 @@ static void report_found_node(struct fw_card *card, |
229 | card->bm_retries = 0; |
230 | } |
231 | |
232 | +/* Must be called with card->lock held */ |
233 | void fw_destroy_nodes(struct fw_card *card) |
234 | { |
235 | - unsigned long flags; |
236 | - |
237 | - spin_lock_irqsave(&card->lock, flags); |
238 | card->color++; |
239 | if (card->local_node != NULL) |
240 | for_each_fw_node(card, card->local_node, report_lost_node); |
241 | card->local_node = NULL; |
242 | - spin_unlock_irqrestore(&card->lock, flags); |
243 | } |
244 | |
245 | static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) |
246 | @@ -509,6 +506,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, |
247 | struct fw_node *local_node; |
248 | unsigned long flags; |
249 | |
250 | + spin_lock_irqsave(&card->lock, flags); |
251 | + |
252 | /* |
253 | * If the selfID buffer is not the immediate successor of the |
254 | * previously processed one, we cannot reliably compare the |
255 | @@ -520,8 +519,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, |
256 | card->bm_retries = 0; |
257 | } |
258 | |
259 | - spin_lock_irqsave(&card->lock, flags); |
260 | - |
261 | card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated; |
262 | card->node_id = node_id; |
263 | /* |
264 | diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c |
265 | index 404a035f104d0..78574789a1872 100644 |
266 | --- a/drivers/firewire/core-transaction.c |
267 | +++ b/drivers/firewire/core-transaction.c |
268 | @@ -73,24 +73,25 @@ static int try_cancel_split_timeout(struct fw_transaction *t) |
269 | static int close_transaction(struct fw_transaction *transaction, |
270 | struct fw_card *card, int rcode) |
271 | { |
272 | - struct fw_transaction *t; |
273 | + struct fw_transaction *t = NULL, *iter; |
274 | unsigned long flags; |
275 | |
276 | spin_lock_irqsave(&card->lock, flags); |
277 | - list_for_each_entry(t, &card->transaction_list, link) { |
278 | - if (t == transaction) { |
279 | - if (!try_cancel_split_timeout(t)) { |
280 | + list_for_each_entry(iter, &card->transaction_list, link) { |
281 | + if (iter == transaction) { |
282 | + if (!try_cancel_split_timeout(iter)) { |
283 | spin_unlock_irqrestore(&card->lock, flags); |
284 | goto timed_out; |
285 | } |
286 | - list_del_init(&t->link); |
287 | - card->tlabel_mask &= ~(1ULL << t->tlabel); |
288 | + list_del_init(&iter->link); |
289 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); |
290 | + t = iter; |
291 | break; |
292 | } |
293 | } |
294 | spin_unlock_irqrestore(&card->lock, flags); |
295 | |
296 | - if (&t->link != &card->transaction_list) { |
297 | + if (t) { |
298 | t->callback(card, rcode, NULL, 0, t->callback_data); |
299 | return 0; |
300 | } |
301 | @@ -935,7 +936,7 @@ EXPORT_SYMBOL(fw_core_handle_request); |
302 | |
303 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
304 | { |
305 | - struct fw_transaction *t; |
306 | + struct fw_transaction *t = NULL, *iter; |
307 | unsigned long flags; |
308 | u32 *data; |
309 | size_t data_length; |
310 | @@ -947,20 +948,21 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
311 | rcode = HEADER_GET_RCODE(p->header[1]); |
312 | |
313 | spin_lock_irqsave(&card->lock, flags); |
314 | - list_for_each_entry(t, &card->transaction_list, link) { |
315 | - if (t->node_id == source && t->tlabel == tlabel) { |
316 | - if (!try_cancel_split_timeout(t)) { |
317 | + list_for_each_entry(iter, &card->transaction_list, link) { |
318 | + if (iter->node_id == source && iter->tlabel == tlabel) { |
319 | + if (!try_cancel_split_timeout(iter)) { |
320 | spin_unlock_irqrestore(&card->lock, flags); |
321 | goto timed_out; |
322 | } |
323 | - list_del_init(&t->link); |
324 | - card->tlabel_mask &= ~(1ULL << t->tlabel); |
325 | + list_del_init(&iter->link); |
326 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); |
327 | + t = iter; |
328 | break; |
329 | } |
330 | } |
331 | spin_unlock_irqrestore(&card->lock, flags); |
332 | |
333 | - if (&t->link == &card->transaction_list) { |
334 | + if (!t) { |
335 | timed_out: |
336 | fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", |
337 | source, tlabel); |
338 | diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c |
339 | index 4d5054211550b..2ceed9287435f 100644 |
340 | --- a/drivers/firewire/sbp2.c |
341 | +++ b/drivers/firewire/sbp2.c |
342 | @@ -408,7 +408,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, |
343 | void *payload, size_t length, void *callback_data) |
344 | { |
345 | struct sbp2_logical_unit *lu = callback_data; |
346 | - struct sbp2_orb *orb; |
347 | + struct sbp2_orb *orb = NULL, *iter; |
348 | struct sbp2_status status; |
349 | unsigned long flags; |
350 | |
351 | @@ -433,17 +433,18 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, |
352 | |
353 | /* Lookup the orb corresponding to this status write. */ |
354 | spin_lock_irqsave(&lu->tgt->lock, flags); |
355 | - list_for_each_entry(orb, &lu->orb_list, link) { |
356 | + list_for_each_entry(iter, &lu->orb_list, link) { |
357 | if (STATUS_GET_ORB_HIGH(status) == 0 && |
358 | - STATUS_GET_ORB_LOW(status) == orb->request_bus) { |
359 | - orb->rcode = RCODE_COMPLETE; |
360 | - list_del(&orb->link); |
361 | + STATUS_GET_ORB_LOW(status) == iter->request_bus) { |
362 | + iter->rcode = RCODE_COMPLETE; |
363 | + list_del(&iter->link); |
364 | + orb = iter; |
365 | break; |
366 | } |
367 | } |
368 | spin_unlock_irqrestore(&lu->tgt->lock, flags); |
369 | |
370 | - if (&orb->link != &lu->orb_list) { |
371 | + if (orb) { |
372 | orb->callback(orb, &status); |
373 | kref_put(&orb->kref, free_orb); /* orb callback reference */ |
374 | } else { |
375 | diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c |
376 | index 3ece59185d372..b1dcd2dd52e6b 100644 |
377 | --- a/drivers/gpio/gpiolib-of.c |
378 | +++ b/drivers/gpio/gpiolib-of.c |
379 | @@ -783,7 +783,7 @@ static void of_gpiochip_init_valid_mask(struct gpio_chip *chip) |
380 | i, &start); |
381 | of_property_read_u32_index(np, "gpio-reserved-ranges", |
382 | i + 1, &count); |
383 | - if (start >= chip->ngpio || start + count >= chip->ngpio) |
384 | + if (start >= chip->ngpio || start + count > chip->ngpio) |
385 | continue; |
386 | |
387 | bitmap_clear(chip->valid_mask, start, count); |
388 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |
389 | index 25af45adc03e7..49b52ac3e4731 100644 |
390 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |
391 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |
392 | @@ -951,11 +951,15 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd, |
393 | struct dma_fence **ef) |
394 | { |
395 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
396 | - struct drm_file *drm_priv = filp->private_data; |
397 | - struct amdgpu_fpriv *drv_priv = drm_priv->driver_priv; |
398 | - struct amdgpu_vm *avm = &drv_priv->vm; |
399 | + struct amdgpu_fpriv *drv_priv; |
400 | + struct amdgpu_vm *avm; |
401 | int ret; |
402 | |
403 | + ret = amdgpu_file_to_fpriv(filp, &drv_priv); |
404 | + if (ret) |
405 | + return ret; |
406 | + avm = &drv_priv->vm; |
407 | + |
408 | /* Already a compute VM? */ |
409 | if (avm->process_info) |
410 | return -EINVAL; |
411 | diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c |
412 | index a30f34cf512c2..95e06886991dc 100644 |
413 | --- a/drivers/hwmon/adt7470.c |
414 | +++ b/drivers/hwmon/adt7470.c |
415 | @@ -20,6 +20,7 @@ |
416 | #include <linux/kthread.h> |
417 | #include <linux/slab.h> |
418 | #include <linux/util_macros.h> |
419 | +#include <linux/sched.h> |
420 | |
421 | /* Addresses to scan */ |
422 | static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; |
423 | @@ -260,11 +261,10 @@ static int adt7470_update_thread(void *p) |
424 | adt7470_read_temperatures(client, data); |
425 | mutex_unlock(&data->lock); |
426 | |
427 | - set_current_state(TASK_INTERRUPTIBLE); |
428 | if (kthread_should_stop()) |
429 | break; |
430 | |
431 | - schedule_timeout(msecs_to_jiffies(data->auto_update_interval)); |
432 | + schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval)); |
433 | } |
434 | |
435 | return 0; |
436 | diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c |
437 | index e3bac1a877bb7..3aed597103d3d 100644 |
438 | --- a/drivers/infiniband/sw/siw/siw_cm.c |
439 | +++ b/drivers/infiniband/sw/siw/siw_cm.c |
440 | @@ -976,14 +976,15 @@ static void siw_accept_newconn(struct siw_cep *cep) |
441 | |
442 | siw_cep_set_inuse(new_cep); |
443 | rv = siw_proc_mpareq(new_cep); |
444 | - siw_cep_set_free(new_cep); |
445 | - |
446 | if (rv != -EAGAIN) { |
447 | siw_cep_put(cep); |
448 | new_cep->listen_cep = NULL; |
449 | - if (rv) |
450 | + if (rv) { |
451 | + siw_cep_set_free(new_cep); |
452 | goto error; |
453 | + } |
454 | } |
455 | + siw_cep_set_free(new_cep); |
456 | } |
457 | return; |
458 | |
459 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
460 | index 530c0fe142291..37b8bb4d80f0f 100644 |
461 | --- a/drivers/md/dm.c |
462 | +++ b/drivers/md/dm.c |
463 | @@ -676,19 +676,20 @@ static void start_io_acct(struct dm_io *io) |
464 | false, 0, &io->stats_aux); |
465 | } |
466 | |
467 | -static void end_io_acct(struct dm_io *io) |
468 | +static void end_io_acct(struct mapped_device *md, struct bio *bio, |
469 | + unsigned long start_time, struct dm_stats_aux *stats_aux) |
470 | { |
471 | - struct mapped_device *md = io->md; |
472 | - struct bio *bio = io->orig_bio; |
473 | - unsigned long duration = jiffies - io->start_time; |
474 | - |
475 | - generic_end_io_acct(md->queue, bio_op(bio), &dm_disk(md)->part0, |
476 | - io->start_time); |
477 | + unsigned long duration = jiffies - start_time; |
478 | |
479 | if (unlikely(dm_stats_used(&md->stats))) |
480 | dm_stats_account_io(&md->stats, bio_data_dir(bio), |
481 | bio->bi_iter.bi_sector, bio_sectors(bio), |
482 | - true, duration, &io->stats_aux); |
483 | + true, duration, stats_aux); |
484 | + |
485 | + smp_wmb(); |
486 | + |
487 | + generic_end_io_acct(md->queue, bio_op(bio), &dm_disk(md)->part0, |
488 | + start_time); |
489 | |
490 | /* nudge anyone waiting on suspend queue */ |
491 | if (unlikely(wq_has_sleeper(&md->wait))) |
492 | @@ -909,6 +910,8 @@ static void dec_pending(struct dm_io *io, blk_status_t error) |
493 | blk_status_t io_error; |
494 | struct bio *bio; |
495 | struct mapped_device *md = io->md; |
496 | + unsigned long start_time = 0; |
497 | + struct dm_stats_aux stats_aux; |
498 | |
499 | /* Push-back supersedes any I/O errors */ |
500 | if (unlikely(error)) { |
501 | @@ -935,8 +938,10 @@ static void dec_pending(struct dm_io *io, blk_status_t error) |
502 | |
503 | io_error = io->status; |
504 | bio = io->orig_bio; |
505 | - end_io_acct(io); |
506 | + start_time = io->start_time; |
507 | + stats_aux = io->stats_aux; |
508 | free_io(md, io); |
509 | + end_io_acct(md, bio, start_time, &stats_aux); |
510 | |
511 | if (io_error == BLK_STS_DM_REQUEUE) |
512 | return; |
513 | @@ -2491,6 +2496,8 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state) |
514 | } |
515 | finish_wait(&md->wait, &wait); |
516 | |
517 | + smp_rmb(); |
518 | + |
519 | return r; |
520 | } |
521 | |
522 | diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c |
523 | index 9ff718b61c72e..e5ae3346b05a9 100644 |
524 | --- a/drivers/mmc/host/rtsx_pci_sdmmc.c |
525 | +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c |
526 | @@ -37,10 +37,7 @@ struct realtek_pci_sdmmc { |
527 | bool double_clk; |
528 | bool eject; |
529 | bool initial_mode; |
530 | - int power_state; |
531 | -#define SDMMC_POWER_ON 1 |
532 | -#define SDMMC_POWER_OFF 0 |
533 | - |
534 | + int prev_power_state; |
535 | int sg_count; |
536 | s32 cookie; |
537 | int cookie_sg_count; |
538 | @@ -902,14 +899,21 @@ static int sd_set_bus_width(struct realtek_pci_sdmmc *host, |
539 | return err; |
540 | } |
541 | |
542 | -static int sd_power_on(struct realtek_pci_sdmmc *host) |
543 | +static int sd_power_on(struct realtek_pci_sdmmc *host, unsigned char power_mode) |
544 | { |
545 | struct rtsx_pcr *pcr = host->pcr; |
546 | int err; |
547 | |
548 | - if (host->power_state == SDMMC_POWER_ON) |
549 | + if (host->prev_power_state == MMC_POWER_ON) |
550 | return 0; |
551 | |
552 | + if (host->prev_power_state == MMC_POWER_UP) { |
553 | + rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0); |
554 | + goto finish; |
555 | + } |
556 | + |
557 | + msleep(100); |
558 | + |
559 | rtsx_pci_init_cmd(pcr); |
560 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL); |
561 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE, |
562 | @@ -928,11 +932,17 @@ static int sd_power_on(struct realtek_pci_sdmmc *host) |
563 | if (err < 0) |
564 | return err; |
565 | |
566 | + mdelay(1); |
567 | + |
568 | err = rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN); |
569 | if (err < 0) |
570 | return err; |
571 | |
572 | - host->power_state = SDMMC_POWER_ON; |
573 | + /* send at least 74 clocks */ |
574 | + rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN); |
575 | + |
576 | +finish: |
577 | + host->prev_power_state = power_mode; |
578 | return 0; |
579 | } |
580 | |
581 | @@ -941,7 +951,7 @@ static int sd_power_off(struct realtek_pci_sdmmc *host) |
582 | struct rtsx_pcr *pcr = host->pcr; |
583 | int err; |
584 | |
585 | - host->power_state = SDMMC_POWER_OFF; |
586 | + host->prev_power_state = MMC_POWER_OFF; |
587 | |
588 | rtsx_pci_init_cmd(pcr); |
589 | |
590 | @@ -967,7 +977,7 @@ static int sd_set_power_mode(struct realtek_pci_sdmmc *host, |
591 | if (power_mode == MMC_POWER_OFF) |
592 | err = sd_power_off(host); |
593 | else |
594 | - err = sd_power_on(host); |
595 | + err = sd_power_on(host, power_mode); |
596 | |
597 | return err; |
598 | } |
599 | @@ -1402,10 +1412,11 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev) |
600 | |
601 | host = mmc_priv(mmc); |
602 | host->pcr = pcr; |
603 | + mmc->ios.power_delay_ms = 5; |
604 | host->mmc = mmc; |
605 | host->pdev = pdev; |
606 | host->cookie = -1; |
607 | - host->power_state = SDMMC_POWER_OFF; |
608 | + host->prev_power_state = MMC_POWER_OFF; |
609 | INIT_WORK(&host->work, sd_request); |
610 | platform_set_drvdata(pdev, host); |
611 | pcr->slots[RTSX_SD_CARD].p_dev = pdev; |
612 | diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c |
613 | index b8f1f2b69dd3e..3496dfa1b5217 100644 |
614 | --- a/drivers/net/can/grcan.c |
615 | +++ b/drivers/net/can/grcan.c |
616 | @@ -248,6 +248,7 @@ struct grcan_device_config { |
617 | struct grcan_priv { |
618 | struct can_priv can; /* must be the first member */ |
619 | struct net_device *dev; |
620 | + struct device *ofdev_dev; |
621 | struct napi_struct napi; |
622 | |
623 | struct grcan_registers __iomem *regs; /* ioremap'ed registers */ |
624 | @@ -924,7 +925,7 @@ static void grcan_free_dma_buffers(struct net_device *dev) |
625 | struct grcan_priv *priv = netdev_priv(dev); |
626 | struct grcan_dma *dma = &priv->dma; |
627 | |
628 | - dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf, |
629 | + dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf, |
630 | dma->base_handle); |
631 | memset(dma, 0, sizeof(*dma)); |
632 | } |
633 | @@ -949,7 +950,7 @@ static int grcan_allocate_dma_buffers(struct net_device *dev, |
634 | |
635 | /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */ |
636 | dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT; |
637 | - dma->base_buf = dma_alloc_coherent(&dev->dev, |
638 | + dma->base_buf = dma_alloc_coherent(priv->ofdev_dev, |
639 | dma->base_size, |
640 | &dma->base_handle, |
641 | GFP_KERNEL); |
642 | @@ -1113,8 +1114,10 @@ static int grcan_close(struct net_device *dev) |
643 | |
644 | priv->closing = true; |
645 | if (priv->need_txbug_workaround) { |
646 | + spin_unlock_irqrestore(&priv->lock, flags); |
647 | del_timer_sync(&priv->hang_timer); |
648 | del_timer_sync(&priv->rr_timer); |
649 | + spin_lock_irqsave(&priv->lock, flags); |
650 | } |
651 | netif_stop_queue(dev); |
652 | grcan_stop_hardware(dev); |
653 | @@ -1600,6 +1603,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev, |
654 | memcpy(&priv->config, &grcan_module_config, |
655 | sizeof(struct grcan_device_config)); |
656 | priv->dev = dev; |
657 | + priv->ofdev_dev = &ofdev->dev; |
658 | priv->regs = base; |
659 | priv->can.bittiming_const = &grcan_bittiming_const; |
660 | priv->can.do_set_bittiming = grcan_set_bittiming; |
661 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
662 | index 7f590a9e3af79..5a7d5e7f3b238 100644 |
663 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
664 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
665 | @@ -9791,7 +9791,7 @@ static bool bnxt_rfs_capable(struct bnxt *bp) |
666 | |
667 | if (bp->flags & BNXT_FLAG_CHIP_P5) |
668 | return bnxt_rfs_supported(bp); |
669 | - if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp)) |
670 | + if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp) || !bp->rx_nr_rings) |
671 | return false; |
672 | |
673 | vnics = 1 + bp->rx_nr_rings; |
674 | @@ -11725,10 +11725,9 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) |
675 | goto init_dflt_ring_err; |
676 | |
677 | bp->tx_nr_rings_per_tc = bp->tx_nr_rings; |
678 | - if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { |
679 | - bp->flags |= BNXT_FLAG_RFS; |
680 | - bp->dev->features |= NETIF_F_NTUPLE; |
681 | - } |
682 | + |
683 | + bnxt_set_dflt_rfs(bp); |
684 | + |
685 | init_dflt_ring_err: |
686 | bnxt_ulp_irq_restart(bp, rc); |
687 | return rc; |
688 | diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c |
689 | index 4db27dfc7ec1f..6702d77030885 100644 |
690 | --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c |
691 | +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c |
692 | @@ -26,6 +26,7 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *r, u32 ana_rgc3) |
693 | break; |
694 | |
695 | ss->regmap[i] = syscon_node_to_regmap(np); |
696 | + of_node_put(np); |
697 | if (IS_ERR(ss->regmap[i])) |
698 | return PTR_ERR(ss->regmap[i]); |
699 | } |
700 | diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c |
701 | index c7bdada4d1b97..7767d0ae9ebc1 100644 |
702 | --- a/drivers/net/ethernet/smsc/smsc911x.c |
703 | +++ b/drivers/net/ethernet/smsc/smsc911x.c |
704 | @@ -2433,7 +2433,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) |
705 | if (irq == -EPROBE_DEFER) { |
706 | retval = -EPROBE_DEFER; |
707 | goto out_0; |
708 | - } else if (irq <= 0) { |
709 | + } else if (irq < 0) { |
710 | pr_warn("Could not allocate irq resource\n"); |
711 | retval = -ENODEV; |
712 | goto out_0; |
713 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
714 | index 7c73d296b940d..497ce6e6b16ff 100644 |
715 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
716 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |
717 | @@ -879,6 +879,7 @@ static int sun8i_dwmac_register_mdio_mux(struct stmmac_priv *priv) |
718 | |
719 | ret = mdio_mux_init(priv->device, mdio_mux, mdio_mux_syscon_switch_fn, |
720 | &gmac->mux_handle, priv, priv->mii); |
721 | + of_node_put(mdio_mux); |
722 | return ret; |
723 | } |
724 | |
725 | diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
726 | index 63a2d1bcccfbc..bec09008997de 100644 |
727 | --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
728 | +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
729 | @@ -820,10 +820,10 @@ static int xemaclite_mdio_write(struct mii_bus *bus, int phy_id, int reg, |
730 | static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
731 | { |
732 | struct mii_bus *bus; |
733 | - int rc; |
734 | struct resource res; |
735 | struct device_node *np = of_get_parent(lp->phy_node); |
736 | struct device_node *npp; |
737 | + int rc, ret; |
738 | |
739 | /* Don't register the MDIO bus if the phy_node or its parent node |
740 | * can't be found. |
741 | @@ -833,8 +833,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
742 | return -ENODEV; |
743 | } |
744 | npp = of_get_parent(np); |
745 | - |
746 | - of_address_to_resource(npp, 0, &res); |
747 | + ret = of_address_to_resource(npp, 0, &res); |
748 | + of_node_put(npp); |
749 | + if (ret) { |
750 | + dev_err(dev, "%s resource error!\n", |
751 | + dev->of_node->full_name); |
752 | + of_node_put(np); |
753 | + return ret; |
754 | + } |
755 | if (lp->ndev->mem_start != res.start) { |
756 | struct phy_device *phydev; |
757 | phydev = of_phy_find_device(lp->phy_node); |
758 | @@ -843,6 +849,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
759 | "MDIO of the phy is not registered yet\n"); |
760 | else |
761 | put_device(&phydev->mdio.dev); |
762 | + of_node_put(np); |
763 | return 0; |
764 | } |
765 | |
766 | @@ -855,6 +862,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
767 | bus = mdiobus_alloc(); |
768 | if (!bus) { |
769 | dev_err(dev, "Failed to allocate mdiobus\n"); |
770 | + of_node_put(np); |
771 | return -ENOMEM; |
772 | } |
773 | |
774 | @@ -867,6 +875,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
775 | bus->parent = dev; |
776 | |
777 | rc = of_mdiobus_register(bus, np); |
778 | + of_node_put(np); |
779 | if (rc) { |
780 | dev_err(dev, "Failed to register mdio bus.\n"); |
781 | goto err_register; |
782 | diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c |
783 | index 529be35ac1782..54d228acc0f5d 100644 |
784 | --- a/drivers/nfc/nfcmrvl/main.c |
785 | +++ b/drivers/nfc/nfcmrvl/main.c |
786 | @@ -194,6 +194,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) |
787 | { |
788 | struct nci_dev *ndev = priv->ndev; |
789 | |
790 | + nci_unregister_device(ndev); |
791 | if (priv->ndev->nfc_dev->fw_download_in_progress) |
792 | nfcmrvl_fw_dnld_abort(priv); |
793 | |
794 | @@ -202,7 +203,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) |
795 | if (gpio_is_valid(priv->config.reset_n_io)) |
796 | gpio_free(priv->config.reset_n_io); |
797 | |
798 | - nci_unregister_device(ndev); |
799 | nci_free_device(ndev); |
800 | kfree(priv); |
801 | } |
802 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
803 | index 721d2652319ce..7219ca39aa909 100644 |
804 | --- a/drivers/pci/controller/pci-aardvark.c |
805 | +++ b/drivers/pci/controller/pci-aardvark.c |
806 | @@ -108,6 +108,7 @@ |
807 | #define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54) |
808 | #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58) |
809 | #define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C) |
810 | +#define PCIE_MSI_ALL_MASK GENMASK(31, 0) |
811 | #define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C) |
812 | #define PCIE_MSI_DATA_MASK GENMASK(15, 0) |
813 | |
814 | @@ -561,6 +562,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
815 | advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); |
816 | |
817 | /* Clear all interrupts */ |
818 | + advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG); |
819 | advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG); |
820 | advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG); |
821 | advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG); |
822 | @@ -573,7 +575,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
823 | advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG); |
824 | |
825 | /* Unmask all MSIs */ |
826 | - advk_writel(pcie, 0, PCIE_MSI_MASK_REG); |
827 | + advk_writel(pcie, ~(u32)PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG); |
828 | |
829 | /* Enable summary interrupt for GIC SPI source */ |
830 | reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); |
831 | @@ -1370,23 +1372,19 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie) |
832 | static void advk_pcie_handle_msi(struct advk_pcie *pcie) |
833 | { |
834 | u32 msi_val, msi_mask, msi_status, msi_idx; |
835 | - u16 msi_data; |
836 | + int virq; |
837 | |
838 | msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); |
839 | msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); |
840 | - msi_status = msi_val & ~msi_mask; |
841 | + msi_status = msi_val & ((~msi_mask) & PCIE_MSI_ALL_MASK); |
842 | |
843 | for (msi_idx = 0; msi_idx < MSI_IRQ_NUM; msi_idx++) { |
844 | if (!(BIT(msi_idx) & msi_status)) |
845 | continue; |
846 | |
847 | - /* |
848 | - * msi_idx contains bits [4:0] of the msi_data and msi_data |
849 | - * contains 16bit MSI interrupt number |
850 | - */ |
851 | advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG); |
852 | - msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK; |
853 | - generic_handle_irq(msi_data); |
854 | + virq = irq_find_mapping(pcie->msi_inner_domain, msi_idx); |
855 | + generic_handle_irq(virq); |
856 | } |
857 | |
858 | advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING, |
859 | diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c |
860 | index b577c8f7e3462..e0570cd0e520c 100644 |
861 | --- a/drivers/s390/block/dasd.c |
862 | +++ b/drivers/s390/block/dasd.c |
863 | @@ -1462,6 +1462,13 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) |
864 | if (!cqr->lpm) |
865 | cqr->lpm = dasd_path_get_opm(device); |
866 | } |
867 | + /* |
868 | + * remember the amount of formatted tracks to prevent double format on |
869 | + * ESE devices |
870 | + */ |
871 | + if (cqr->block) |
872 | + cqr->trkcount = atomic_read(&cqr->block->trkcount); |
873 | + |
874 | if (cqr->cpmode == 1) { |
875 | rc = ccw_device_tm_start(device->cdev, cqr->cpaddr, |
876 | (long) cqr, cqr->lpm); |
877 | @@ -1680,6 +1687,7 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, |
878 | unsigned long now; |
879 | int nrf_suppressed = 0; |
880 | int fp_suppressed = 0; |
881 | + struct request *req; |
882 | u8 *sense = NULL; |
883 | int expires; |
884 | |
885 | @@ -1780,7 +1788,12 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, |
886 | } |
887 | |
888 | if (dasd_ese_needs_format(cqr->block, irb)) { |
889 | - if (rq_data_dir((struct request *)cqr->callback_data) == READ) { |
890 | + req = dasd_get_callback_data(cqr); |
891 | + if (!req) { |
892 | + cqr->status = DASD_CQR_ERROR; |
893 | + return; |
894 | + } |
895 | + if (rq_data_dir(req) == READ) { |
896 | device->discipline->ese_read(cqr, irb); |
897 | cqr->status = DASD_CQR_SUCCESS; |
898 | cqr->stopclk = now; |
899 | @@ -2799,8 +2812,7 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr) |
900 | * complete a request partially. |
901 | */ |
902 | if (proc_bytes) { |
903 | - blk_update_request(req, BLK_STS_OK, |
904 | - blk_rq_bytes(req) - proc_bytes); |
905 | + blk_update_request(req, BLK_STS_OK, proc_bytes); |
906 | blk_mq_requeue_request(req, true); |
907 | } else { |
908 | blk_mq_complete_request(req); |
909 | diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c |
910 | index ad44d22e88591..7749deb614d75 100644 |
911 | --- a/drivers/s390/block/dasd_eckd.c |
912 | +++ b/drivers/s390/block/dasd_eckd.c |
913 | @@ -3026,13 +3026,24 @@ static int dasd_eckd_format_device(struct dasd_device *base, |
914 | } |
915 | |
916 | static bool test_and_set_format_track(struct dasd_format_entry *to_format, |
917 | - struct dasd_block *block) |
918 | + struct dasd_ccw_req *cqr) |
919 | { |
920 | + struct dasd_block *block = cqr->block; |
921 | struct dasd_format_entry *format; |
922 | unsigned long flags; |
923 | bool rc = false; |
924 | |
925 | spin_lock_irqsave(&block->format_lock, flags); |
926 | + if (cqr->trkcount != atomic_read(&block->trkcount)) { |
927 | + /* |
928 | + * The number of formatted tracks has changed after request |
929 | + * start and we can not tell if the current track was involved. |
930 | + * To avoid data corruption treat it as if the current track is |
931 | + * involved |
932 | + */ |
933 | + rc = true; |
934 | + goto out; |
935 | + } |
936 | list_for_each_entry(format, &block->format_list, list) { |
937 | if (format->track == to_format->track) { |
938 | rc = true; |
939 | @@ -3052,6 +3063,7 @@ static void clear_format_track(struct dasd_format_entry *format, |
940 | unsigned long flags; |
941 | |
942 | spin_lock_irqsave(&block->format_lock, flags); |
943 | + atomic_inc(&block->trkcount); |
944 | list_del_init(&format->list); |
945 | spin_unlock_irqrestore(&block->format_lock, flags); |
946 | } |
947 | @@ -3088,7 +3100,7 @@ dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr, |
948 | sector_t curr_trk; |
949 | int rc; |
950 | |
951 | - req = cqr->callback_data; |
952 | + req = dasd_get_callback_data(cqr); |
953 | block = cqr->block; |
954 | base = block->base; |
955 | private = base->private; |
956 | @@ -3113,8 +3125,11 @@ dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr, |
957 | } |
958 | format->track = curr_trk; |
959 | /* test if track is already in formatting by another thread */ |
960 | - if (test_and_set_format_track(format, block)) |
961 | + if (test_and_set_format_track(format, cqr)) { |
962 | + /* this is no real error so do not count down retries */ |
963 | + cqr->retries++; |
964 | return ERR_PTR(-EEXIST); |
965 | + } |
966 | |
967 | fdata.start_unit = curr_trk; |
968 | fdata.stop_unit = curr_trk; |
969 | @@ -3213,12 +3228,11 @@ static int dasd_eckd_ese_read(struct dasd_ccw_req *cqr, struct irb *irb) |
970 | cqr->proc_bytes = blk_count * blksize; |
971 | return 0; |
972 | } |
973 | - if (dst && !skip_block) { |
974 | - dst += off; |
975 | + if (dst && !skip_block) |
976 | memset(dst, 0, blksize); |
977 | - } else { |
978 | + else |
979 | skip_block--; |
980 | - } |
981 | + dst += blksize; |
982 | blk_count++; |
983 | } |
984 | } |
985 | diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h |
986 | index fa552f9f16667..9d9685c25253d 100644 |
987 | --- a/drivers/s390/block/dasd_int.h |
988 | +++ b/drivers/s390/block/dasd_int.h |
989 | @@ -188,6 +188,7 @@ struct dasd_ccw_req { |
990 | void (*callback)(struct dasd_ccw_req *, void *data); |
991 | void *callback_data; |
992 | unsigned int proc_bytes; /* bytes for partial completion */ |
993 | + unsigned int trkcount; /* count formatted tracks */ |
994 | }; |
995 | |
996 | /* |
997 | @@ -575,6 +576,7 @@ struct dasd_block { |
998 | |
999 | struct list_head format_list; |
1000 | spinlock_t format_lock; |
1001 | + atomic_t trkcount; |
1002 | }; |
1003 | |
1004 | struct dasd_attention_data { |
1005 | @@ -723,6 +725,18 @@ dasd_check_blocksize(int bsize) |
1006 | return 0; |
1007 | } |
1008 | |
1009 | +/* |
1010 | + * return the callback data of the original request in case there are |
1011 | + * ERP requests build on top of it |
1012 | + */ |
1013 | +static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr) |
1014 | +{ |
1015 | + while (cqr->refers) |
1016 | + cqr = cqr->refers; |
1017 | + |
1018 | + return cqr->callback_data; |
1019 | +} |
1020 | + |
1021 | /* externals in dasd.c */ |
1022 | #define DASD_PROFILE_OFF 0 |
1023 | #define DASD_PROFILE_ON 1 |
1024 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
1025 | index 9b703c0db9796..b7bfecfc2ea33 100644 |
1026 | --- a/fs/btrfs/tree-log.c |
1027 | +++ b/fs/btrfs/tree-log.c |
1028 | @@ -5294,6 +5294,18 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
1029 | mutex_lock(&inode->log_mutex); |
1030 | } |
1031 | |
1032 | + /* |
1033 | + * For symlinks, we must always log their content, which is stored in an |
1034 | + * inline extent, otherwise we could end up with an empty symlink after |
1035 | + * log replay, which is invalid on linux (symlink(2) returns -ENOENT if |
1036 | + * one attempts to create an empty symlink). |
1037 | + * We don't need to worry about flushing delalloc, because when we create |
1038 | + * the inline extent when the symlink is created (we never have delalloc |
1039 | + * for symlinks). |
1040 | + */ |
1041 | + if (S_ISLNK(inode->vfs_inode.i_mode)) |
1042 | + inode_only = LOG_INODE_ALL; |
1043 | + |
1044 | /* |
1045 | * a brute force approach to making sure we get the most uptodate |
1046 | * copies of everything. |
1047 | @@ -5707,7 +5719,7 @@ process_leaf: |
1048 | } |
1049 | |
1050 | ctx->log_new_dentries = false; |
1051 | - if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK) |
1052 | + if (type == BTRFS_FT_DIR) |
1053 | log_mode = LOG_INODE_ALL; |
1054 | ret = btrfs_log_inode(trans, root, BTRFS_I(di_inode), |
1055 | log_mode, 0, LLONG_MAX, ctx); |
1056 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
1057 | index 76baf7b441f3c..cf3b00751ff65 100644 |
1058 | --- a/fs/nfs/nfs4proc.c |
1059 | +++ b/fs/nfs/nfs4proc.c |
1060 | @@ -359,6 +359,14 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent |
1061 | kunmap_atomic(start); |
1062 | } |
1063 | |
1064 | +static void nfs4_fattr_set_prechange(struct nfs_fattr *fattr, u64 version) |
1065 | +{ |
1066 | + if (!(fattr->valid & NFS_ATTR_FATTR_PRECHANGE)) { |
1067 | + fattr->pre_change_attr = version; |
1068 | + fattr->valid |= NFS_ATTR_FATTR_PRECHANGE; |
1069 | + } |
1070 | +} |
1071 | + |
1072 | static void nfs4_test_and_free_stateid(struct nfs_server *server, |
1073 | nfs4_stateid *stateid, |
1074 | const struct cred *cred) |
1075 | @@ -6307,7 +6315,9 @@ static void nfs4_delegreturn_release(void *calldata) |
1076 | pnfs_roc_release(&data->lr.arg, &data->lr.res, |
1077 | data->res.lr_ret); |
1078 | if (inode) { |
1079 | - nfs_post_op_update_inode_force_wcc(inode, &data->fattr); |
1080 | + nfs4_fattr_set_prechange(&data->fattr, |
1081 | + inode_peek_iversion_raw(inode)); |
1082 | + nfs_refresh_inode(inode, &data->fattr); |
1083 | nfs_iput_and_deactive(inode); |
1084 | } |
1085 | kfree(calldata); |
1086 | diff --git a/include/net/tcp.h b/include/net/tcp.h |
1087 | index 9237362e56065..65be8bd1f0f4a 100644 |
1088 | --- a/include/net/tcp.h |
1089 | +++ b/include/net/tcp.h |
1090 | @@ -2015,6 +2015,11 @@ struct tcp_request_sock_ops { |
1091 | enum tcp_synack_type synack_type); |
1092 | }; |
1093 | |
1094 | +extern const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops; |
1095 | +#if IS_ENABLED(CONFIG_IPV6) |
1096 | +extern const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops; |
1097 | +#endif |
1098 | + |
1099 | #ifdef CONFIG_SYN_COOKIES |
1100 | static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops, |
1101 | const struct sock *sk, struct sk_buff *skb, |
1102 | diff --git a/include/sound/pcm.h b/include/sound/pcm.h |
1103 | index bbe6eb1ff5d22..f0045f842a604 100644 |
1104 | --- a/include/sound/pcm.h |
1105 | +++ b/include/sound/pcm.h |
1106 | @@ -395,6 +395,8 @@ struct snd_pcm_runtime { |
1107 | wait_queue_head_t sleep; /* poll sleep */ |
1108 | wait_queue_head_t tsleep; /* transfer sleep */ |
1109 | struct fasync_struct *fasync; |
1110 | + struct mutex buffer_mutex; /* protect for buffer changes */ |
1111 | + atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */ |
1112 | |
1113 | /* -- private section -- */ |
1114 | void *private_data; |
1115 | diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h |
1116 | index c9d8eb7f5c029..ba4d742c1c655 100644 |
1117 | --- a/kernel/irq/internals.h |
1118 | +++ b/kernel/irq/internals.h |
1119 | @@ -29,12 +29,14 @@ extern struct irqaction chained_action; |
1120 | * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed |
1121 | * IRQTF_AFFINITY - irq thread is requested to adjust affinity |
1122 | * IRQTF_FORCED_THREAD - irq action is force threaded |
1123 | + * IRQTF_READY - signals that irq thread is ready |
1124 | */ |
1125 | enum { |
1126 | IRQTF_RUNTHREAD, |
1127 | IRQTF_WARNED, |
1128 | IRQTF_AFFINITY, |
1129 | IRQTF_FORCED_THREAD, |
1130 | + IRQTF_READY, |
1131 | }; |
1132 | |
1133 | /* |
1134 | diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c |
1135 | index 9be995fc3c5a1..172b5e6bc4c2f 100644 |
1136 | --- a/kernel/irq/irqdesc.c |
1137 | +++ b/kernel/irq/irqdesc.c |
1138 | @@ -405,6 +405,7 @@ static struct irq_desc *alloc_desc(int irq, int node, unsigned int flags, |
1139 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
1140 | mutex_init(&desc->request_mutex); |
1141 | init_rcu_head(&desc->rcu); |
1142 | + init_waitqueue_head(&desc->wait_for_threads); |
1143 | |
1144 | desc_set_defaults(irq, desc, node, affinity, owner); |
1145 | irqd_set(&desc->irq_data, flags); |
1146 | @@ -573,6 +574,7 @@ int __init early_irq_init(void) |
1147 | raw_spin_lock_init(&desc[i].lock); |
1148 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); |
1149 | mutex_init(&desc[i].request_mutex); |
1150 | + init_waitqueue_head(&desc[i].wait_for_threads); |
1151 | desc_set_defaults(i, &desc[i], node, NULL, NULL); |
1152 | } |
1153 | return arch_early_irq_init(); |
1154 | diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
1155 | index 918fe05933862..79214f9836243 100644 |
1156 | --- a/kernel/irq/manage.c |
1157 | +++ b/kernel/irq/manage.c |
1158 | @@ -1102,6 +1102,31 @@ static void irq_wake_secondary(struct irq_desc *desc, struct irqaction *action) |
1159 | raw_spin_unlock_irq(&desc->lock); |
1160 | } |
1161 | |
1162 | +/* |
1163 | + * Internal function to notify that a interrupt thread is ready. |
1164 | + */ |
1165 | +static void irq_thread_set_ready(struct irq_desc *desc, |
1166 | + struct irqaction *action) |
1167 | +{ |
1168 | + set_bit(IRQTF_READY, &action->thread_flags); |
1169 | + wake_up(&desc->wait_for_threads); |
1170 | +} |
1171 | + |
1172 | +/* |
1173 | + * Internal function to wake up a interrupt thread and wait until it is |
1174 | + * ready. |
1175 | + */ |
1176 | +static void wake_up_and_wait_for_irq_thread_ready(struct irq_desc *desc, |
1177 | + struct irqaction *action) |
1178 | +{ |
1179 | + if (!action || !action->thread) |
1180 | + return; |
1181 | + |
1182 | + wake_up_process(action->thread); |
1183 | + wait_event(desc->wait_for_threads, |
1184 | + test_bit(IRQTF_READY, &action->thread_flags)); |
1185 | +} |
1186 | + |
1187 | /* |
1188 | * Interrupt handler thread |
1189 | */ |
1190 | @@ -1113,6 +1138,8 @@ static int irq_thread(void *data) |
1191 | irqreturn_t (*handler_fn)(struct irq_desc *desc, |
1192 | struct irqaction *action); |
1193 | |
1194 | + irq_thread_set_ready(desc, action); |
1195 | + |
1196 | if (force_irqthreads && test_bit(IRQTF_FORCED_THREAD, |
1197 | &action->thread_flags)) |
1198 | handler_fn = irq_forced_thread_fn; |
1199 | @@ -1541,8 +1568,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) |
1200 | } |
1201 | |
1202 | if (!shared) { |
1203 | - init_waitqueue_head(&desc->wait_for_threads); |
1204 | - |
1205 | /* Setup the type (level, edge polarity) if configured: */ |
1206 | if (new->flags & IRQF_TRIGGER_MASK) { |
1207 | ret = __irq_set_trigger(desc, |
1208 | @@ -1632,14 +1657,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) |
1209 | |
1210 | irq_setup_timings(desc, new); |
1211 | |
1212 | - /* |
1213 | - * Strictly no need to wake it up, but hung_task complains |
1214 | - * when no hard interrupt wakes the thread up. |
1215 | - */ |
1216 | - if (new->thread) |
1217 | - wake_up_process(new->thread); |
1218 | - if (new->secondary) |
1219 | - wake_up_process(new->secondary->thread); |
1220 | + wake_up_and_wait_for_irq_thread_ready(desc, new); |
1221 | + wake_up_and_wait_for_irq_thread_ready(desc, new->secondary); |
1222 | |
1223 | register_irq_proc(irq, desc); |
1224 | new->dir = NULL; |
1225 | diff --git a/mm/page_io.c b/mm/page_io.c |
1226 | index bcf27d0572534..f0e3f2be7b44c 100644 |
1227 | --- a/mm/page_io.c |
1228 | +++ b/mm/page_io.c |
1229 | @@ -69,54 +69,6 @@ void end_swap_bio_write(struct bio *bio) |
1230 | bio_put(bio); |
1231 | } |
1232 | |
1233 | -static void swap_slot_free_notify(struct page *page) |
1234 | -{ |
1235 | - struct swap_info_struct *sis; |
1236 | - struct gendisk *disk; |
1237 | - swp_entry_t entry; |
1238 | - |
1239 | - /* |
1240 | - * There is no guarantee that the page is in swap cache - the software |
1241 | - * suspend code (at least) uses end_swap_bio_read() against a non- |
1242 | - * swapcache page. So we must check PG_swapcache before proceeding with |
1243 | - * this optimization. |
1244 | - */ |
1245 | - if (unlikely(!PageSwapCache(page))) |
1246 | - return; |
1247 | - |
1248 | - sis = page_swap_info(page); |
1249 | - if (!(sis->flags & SWP_BLKDEV)) |
1250 | - return; |
1251 | - |
1252 | - /* |
1253 | - * The swap subsystem performs lazy swap slot freeing, |
1254 | - * expecting that the page will be swapped out again. |
1255 | - * So we can avoid an unnecessary write if the page |
1256 | - * isn't redirtied. |
1257 | - * This is good for real swap storage because we can |
1258 | - * reduce unnecessary I/O and enhance wear-leveling |
1259 | - * if an SSD is used as the as swap device. |
1260 | - * But if in-memory swap device (eg zram) is used, |
1261 | - * this causes a duplicated copy between uncompressed |
1262 | - * data in VM-owned memory and compressed data in |
1263 | - * zram-owned memory. So let's free zram-owned memory |
1264 | - * and make the VM-owned decompressed page *dirty*, |
1265 | - * so the page should be swapped out somewhere again if |
1266 | - * we again wish to reclaim it. |
1267 | - */ |
1268 | - disk = sis->bdev->bd_disk; |
1269 | - entry.val = page_private(page); |
1270 | - if (disk->fops->swap_slot_free_notify && __swap_count(entry) == 1) { |
1271 | - unsigned long offset; |
1272 | - |
1273 | - offset = swp_offset(entry); |
1274 | - |
1275 | - SetPageDirty(page); |
1276 | - disk->fops->swap_slot_free_notify(sis->bdev, |
1277 | - offset); |
1278 | - } |
1279 | -} |
1280 | - |
1281 | static void end_swap_bio_read(struct bio *bio) |
1282 | { |
1283 | struct page *page = bio_first_page_all(bio); |
1284 | @@ -132,7 +84,6 @@ static void end_swap_bio_read(struct bio *bio) |
1285 | } |
1286 | |
1287 | SetPageUptodate(page); |
1288 | - swap_slot_free_notify(page); |
1289 | out: |
1290 | unlock_page(page); |
1291 | WRITE_ONCE(bio->bi_private, NULL); |
1292 | @@ -371,11 +322,6 @@ int swap_readpage(struct page *page, bool synchronous) |
1293 | |
1294 | ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); |
1295 | if (!ret) { |
1296 | - if (trylock_page(page)) { |
1297 | - swap_slot_free_notify(page); |
1298 | - unlock_page(page); |
1299 | - } |
1300 | - |
1301 | count_vm_event(PSWPIN); |
1302 | return 0; |
1303 | } |
1304 | diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
1305 | index b1ecc91955172..cac2fdd08df05 100644 |
1306 | --- a/net/ipv4/igmp.c |
1307 | +++ b/net/ipv4/igmp.c |
1308 | @@ -2403,9 +2403,10 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct |
1309 | newpsl->sl_addr[i] = psl->sl_addr[i]; |
1310 | /* decrease mem now to avoid the memleak warning */ |
1311 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); |
1312 | - kfree_rcu(psl, rcu); |
1313 | } |
1314 | rcu_assign_pointer(pmc->sflist, newpsl); |
1315 | + if (psl) |
1316 | + kfree_rcu(psl, rcu); |
1317 | psl = newpsl; |
1318 | } |
1319 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ |
1320 | @@ -2503,11 +2504,13 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) |
1321 | psl->sl_count, psl->sl_addr, 0); |
1322 | /* decrease mem now to avoid the memleak warning */ |
1323 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); |
1324 | - kfree_rcu(psl, rcu); |
1325 | - } else |
1326 | + } else { |
1327 | (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode, |
1328 | 0, NULL, 0); |
1329 | + } |
1330 | rcu_assign_pointer(pmc->sflist, newpsl); |
1331 | + if (psl) |
1332 | + kfree_rcu(psl, rcu); |
1333 | pmc->sfmode = msf->imsf_fmode; |
1334 | err = 0; |
1335 | done: |
1336 | diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c |
1337 | index 2b45d14555926..6811174ad5189 100644 |
1338 | --- a/net/ipv4/syncookies.c |
1339 | +++ b/net/ipv4/syncookies.c |
1340 | @@ -332,6 +332,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) |
1341 | |
1342 | ireq = inet_rsk(req); |
1343 | treq = tcp_rsk(req); |
1344 | + treq->af_specific = &tcp_request_sock_ipv4_ops; |
1345 | treq->rcv_isn = ntohl(th->seq) - 1; |
1346 | treq->snt_isn = cookie; |
1347 | treq->ts_off = 0; |
1348 | diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
1349 | index 426d70d45eda4..72fe93ace7d73 100644 |
1350 | --- a/net/ipv4/tcp_ipv4.c |
1351 | +++ b/net/ipv4/tcp_ipv4.c |
1352 | @@ -1383,7 +1383,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = { |
1353 | .syn_ack_timeout = tcp_syn_ack_timeout, |
1354 | }; |
1355 | |
1356 | -static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { |
1357 | +const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { |
1358 | .mss_clamp = TCP_MSS_DEFAULT, |
1359 | #ifdef CONFIG_TCP_MD5SIG |
1360 | .req_md5_lookup = tcp_v4_md5_lookup, |
1361 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
1362 | index 69aef71f32ea7..92b32d131e1c3 100644 |
1363 | --- a/net/ipv6/addrconf.c |
1364 | +++ b/net/ipv6/addrconf.c |
1365 | @@ -3715,6 +3715,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) |
1366 | struct inet6_dev *idev; |
1367 | struct inet6_ifaddr *ifa, *tmp; |
1368 | bool keep_addr = false; |
1369 | + bool was_ready; |
1370 | int state, i; |
1371 | |
1372 | ASSERT_RTNL(); |
1373 | @@ -3780,7 +3781,10 @@ restart: |
1374 | |
1375 | addrconf_del_rs_timer(idev); |
1376 | |
1377 | - /* Step 2: clear flags for stateless addrconf */ |
1378 | + /* Step 2: clear flags for stateless addrconf, repeated down |
1379 | + * detection |
1380 | + */ |
1381 | + was_ready = idev->if_flags & IF_READY; |
1382 | if (!how) |
1383 | idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); |
1384 | |
1385 | @@ -3854,7 +3858,7 @@ restart: |
1386 | if (how) { |
1387 | ipv6_ac_destroy_dev(idev); |
1388 | ipv6_mc_destroy_dev(idev); |
1389 | - } else { |
1390 | + } else if (was_ready) { |
1391 | ipv6_mc_down(idev); |
1392 | } |
1393 | |
1394 | diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c |
1395 | index ec155844012b2..37ab254f7b92d 100644 |
1396 | --- a/net/ipv6/syncookies.c |
1397 | +++ b/net/ipv6/syncookies.c |
1398 | @@ -176,6 +176,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) |
1399 | |
1400 | ireq = inet_rsk(req); |
1401 | treq = tcp_rsk(req); |
1402 | + treq->af_specific = &tcp_request_sock_ipv6_ops; |
1403 | treq->tfo_listener = false; |
1404 | |
1405 | if (security_inet_conn_request(sk, skb, req)) |
1406 | diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
1407 | index 51c900e9bfe20..063898cae3e5c 100644 |
1408 | --- a/net/ipv6/tcp_ipv6.c |
1409 | +++ b/net/ipv6/tcp_ipv6.c |
1410 | @@ -800,7 +800,7 @@ struct request_sock_ops tcp6_request_sock_ops __read_mostly = { |
1411 | .syn_ack_timeout = tcp_syn_ack_timeout, |
1412 | }; |
1413 | |
1414 | -static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { |
1415 | +const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { |
1416 | .mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - |
1417 | sizeof(struct ipv6hdr), |
1418 | #ifdef CONFIG_TCP_MD5SIG |
1419 | diff --git a/net/nfc/core.c b/net/nfc/core.c |
1420 | index e752692d36802..63701a980ee12 100644 |
1421 | --- a/net/nfc/core.c |
1422 | +++ b/net/nfc/core.c |
1423 | @@ -38,7 +38,7 @@ int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) |
1424 | |
1425 | device_lock(&dev->dev); |
1426 | |
1427 | - if (!device_is_registered(&dev->dev)) { |
1428 | + if (dev->shutting_down) { |
1429 | rc = -ENODEV; |
1430 | goto error; |
1431 | } |
1432 | @@ -94,7 +94,7 @@ int nfc_dev_up(struct nfc_dev *dev) |
1433 | |
1434 | device_lock(&dev->dev); |
1435 | |
1436 | - if (!device_is_registered(&dev->dev)) { |
1437 | + if (dev->shutting_down) { |
1438 | rc = -ENODEV; |
1439 | goto error; |
1440 | } |
1441 | @@ -142,7 +142,7 @@ int nfc_dev_down(struct nfc_dev *dev) |
1442 | |
1443 | device_lock(&dev->dev); |
1444 | |
1445 | - if (!device_is_registered(&dev->dev)) { |
1446 | + if (dev->shutting_down) { |
1447 | rc = -ENODEV; |
1448 | goto error; |
1449 | } |
1450 | @@ -206,7 +206,7 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols) |
1451 | |
1452 | device_lock(&dev->dev); |
1453 | |
1454 | - if (!device_is_registered(&dev->dev)) { |
1455 | + if (dev->shutting_down) { |
1456 | rc = -ENODEV; |
1457 | goto error; |
1458 | } |
1459 | @@ -245,7 +245,7 @@ int nfc_stop_poll(struct nfc_dev *dev) |
1460 | |
1461 | device_lock(&dev->dev); |
1462 | |
1463 | - if (!device_is_registered(&dev->dev)) { |
1464 | + if (dev->shutting_down) { |
1465 | rc = -ENODEV; |
1466 | goto error; |
1467 | } |
1468 | @@ -290,7 +290,7 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode) |
1469 | |
1470 | device_lock(&dev->dev); |
1471 | |
1472 | - if (!device_is_registered(&dev->dev)) { |
1473 | + if (dev->shutting_down) { |
1474 | rc = -ENODEV; |
1475 | goto error; |
1476 | } |
1477 | @@ -334,7 +334,7 @@ int nfc_dep_link_down(struct nfc_dev *dev) |
1478 | |
1479 | device_lock(&dev->dev); |
1480 | |
1481 | - if (!device_is_registered(&dev->dev)) { |
1482 | + if (dev->shutting_down) { |
1483 | rc = -ENODEV; |
1484 | goto error; |
1485 | } |
1486 | @@ -400,7 +400,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol) |
1487 | |
1488 | device_lock(&dev->dev); |
1489 | |
1490 | - if (!device_is_registered(&dev->dev)) { |
1491 | + if (dev->shutting_down) { |
1492 | rc = -ENODEV; |
1493 | goto error; |
1494 | } |
1495 | @@ -446,7 +446,7 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx, u8 mode) |
1496 | |
1497 | device_lock(&dev->dev); |
1498 | |
1499 | - if (!device_is_registered(&dev->dev)) { |
1500 | + if (dev->shutting_down) { |
1501 | rc = -ENODEV; |
1502 | goto error; |
1503 | } |
1504 | @@ -493,7 +493,7 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb, |
1505 | |
1506 | device_lock(&dev->dev); |
1507 | |
1508 | - if (!device_is_registered(&dev->dev)) { |
1509 | + if (dev->shutting_down) { |
1510 | rc = -ENODEV; |
1511 | kfree_skb(skb); |
1512 | goto error; |
1513 | @@ -550,7 +550,7 @@ int nfc_enable_se(struct nfc_dev *dev, u32 se_idx) |
1514 | |
1515 | device_lock(&dev->dev); |
1516 | |
1517 | - if (!device_is_registered(&dev->dev)) { |
1518 | + if (dev->shutting_down) { |
1519 | rc = -ENODEV; |
1520 | goto error; |
1521 | } |
1522 | @@ -599,7 +599,7 @@ int nfc_disable_se(struct nfc_dev *dev, u32 se_idx) |
1523 | |
1524 | device_lock(&dev->dev); |
1525 | |
1526 | - if (!device_is_registered(&dev->dev)) { |
1527 | + if (dev->shutting_down) { |
1528 | rc = -ENODEV; |
1529 | goto error; |
1530 | } |
1531 | @@ -1127,6 +1127,7 @@ int nfc_register_device(struct nfc_dev *dev) |
1532 | dev->rfkill = NULL; |
1533 | } |
1534 | } |
1535 | + dev->shutting_down = false; |
1536 | device_unlock(&dev->dev); |
1537 | |
1538 | rc = nfc_genl_device_added(dev); |
1539 | @@ -1159,12 +1160,10 @@ void nfc_unregister_device(struct nfc_dev *dev) |
1540 | rfkill_unregister(dev->rfkill); |
1541 | rfkill_destroy(dev->rfkill); |
1542 | } |
1543 | + dev->shutting_down = true; |
1544 | device_unlock(&dev->dev); |
1545 | |
1546 | if (dev->ops->check_presence) { |
1547 | - device_lock(&dev->dev); |
1548 | - dev->shutting_down = true; |
1549 | - device_unlock(&dev->dev); |
1550 | del_timer_sync(&dev->check_pres_timer); |
1551 | cancel_work_sync(&dev->check_pres_work); |
1552 | } |
1553 | diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c |
1554 | index 4d90cbdc083b5..9e94f732e717c 100644 |
1555 | --- a/net/nfc/netlink.c |
1556 | +++ b/net/nfc/netlink.c |
1557 | @@ -1252,7 +1252,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
1558 | struct sk_buff *msg; |
1559 | void *hdr; |
1560 | |
1561 | - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
1562 | + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
1563 | if (!msg) |
1564 | return -ENOMEM; |
1565 | |
1566 | @@ -1268,7 +1268,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
1567 | |
1568 | genlmsg_end(msg, hdr); |
1569 | |
1570 | - genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); |
1571 | + genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); |
1572 | |
1573 | return 0; |
1574 | |
1575 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
1576 | index 480e879e74ae5..43bc02dea80c8 100644 |
1577 | --- a/net/sunrpc/xprtsock.c |
1578 | +++ b/net/sunrpc/xprtsock.c |
1579 | @@ -2963,9 +2963,6 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args) |
1580 | } |
1581 | xprt_set_bound(xprt); |
1582 | xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); |
1583 | - ret = ERR_PTR(xs_local_setup_socket(transport)); |
1584 | - if (ret) |
1585 | - goto out_err; |
1586 | break; |
1587 | default: |
1588 | ret = ERR_PTR(-EAFNOSUPPORT); |
1589 | diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
1590 | index f8ce961c28d6e..3561cdceaadc2 100644 |
1591 | --- a/sound/core/pcm.c |
1592 | +++ b/sound/core/pcm.c |
1593 | @@ -969,6 +969,8 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, |
1594 | init_waitqueue_head(&runtime->tsleep); |
1595 | |
1596 | runtime->status->state = SNDRV_PCM_STATE_OPEN; |
1597 | + mutex_init(&runtime->buffer_mutex); |
1598 | + atomic_set(&runtime->buffer_accessing, 0); |
1599 | |
1600 | substream->runtime = runtime; |
1601 | substream->private_data = pcm->private_data; |
1602 | @@ -1000,6 +1002,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) |
1603 | substream->runtime = NULL; |
1604 | if (substream->timer) |
1605 | spin_unlock_irq(&substream->timer->lock); |
1606 | + mutex_destroy(&runtime->buffer_mutex); |
1607 | kfree(runtime); |
1608 | put_pid(substream->pid); |
1609 | substream->pid = NULL; |
1610 | diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
1611 | index fd300c3adddec..1bce55533519d 100644 |
1612 | --- a/sound/core/pcm_lib.c |
1613 | +++ b/sound/core/pcm_lib.c |
1614 | @@ -2211,10 +2211,15 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
1615 | err = -EINVAL; |
1616 | goto _end_unlock; |
1617 | } |
1618 | + if (!atomic_inc_unless_negative(&runtime->buffer_accessing)) { |
1619 | + err = -EBUSY; |
1620 | + goto _end_unlock; |
1621 | + } |
1622 | snd_pcm_stream_unlock_irq(substream); |
1623 | err = writer(substream, appl_ofs, data, offset, frames, |
1624 | transfer); |
1625 | snd_pcm_stream_lock_irq(substream); |
1626 | + atomic_dec(&runtime->buffer_accessing); |
1627 | if (err < 0) |
1628 | goto _end_unlock; |
1629 | err = pcm_accessible_state(runtime); |
1630 | diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c |
1631 | index 7600dcdf5fd4d..9aea1d6fb0547 100644 |
1632 | --- a/sound/core/pcm_memory.c |
1633 | +++ b/sound/core/pcm_memory.c |
1634 | @@ -133,19 +133,20 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry, |
1635 | size_t size; |
1636 | struct snd_dma_buffer new_dmab; |
1637 | |
1638 | + mutex_lock(&substream->pcm->open_mutex); |
1639 | if (substream->runtime) { |
1640 | buffer->error = -EBUSY; |
1641 | - return; |
1642 | + goto unlock; |
1643 | } |
1644 | if (!snd_info_get_line(buffer, line, sizeof(line))) { |
1645 | snd_info_get_str(str, line, sizeof(str)); |
1646 | size = simple_strtoul(str, NULL, 10) * 1024; |
1647 | if ((size != 0 && size < 8192) || size > substream->dma_max) { |
1648 | buffer->error = -EINVAL; |
1649 | - return; |
1650 | + goto unlock; |
1651 | } |
1652 | if (substream->dma_buffer.bytes == size) |
1653 | - return; |
1654 | + goto unlock; |
1655 | memset(&new_dmab, 0, sizeof(new_dmab)); |
1656 | new_dmab.dev = substream->dma_buffer.dev; |
1657 | if (size > 0) { |
1658 | @@ -153,7 +154,7 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry, |
1659 | substream->dma_buffer.dev.dev, |
1660 | size, &new_dmab) < 0) { |
1661 | buffer->error = -ENOMEM; |
1662 | - return; |
1663 | + goto unlock; |
1664 | } |
1665 | substream->buffer_bytes_max = size; |
1666 | } else { |
1667 | @@ -165,6 +166,8 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry, |
1668 | } else { |
1669 | buffer->error = -EINVAL; |
1670 | } |
1671 | + unlock: |
1672 | + mutex_unlock(&substream->pcm->open_mutex); |
1673 | } |
1674 | |
1675 | static inline void preallocate_info_init(struct snd_pcm_substream *substream) |
1676 | diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
1677 | index dbe9a65cc1d45..57a4991fa0f36 100644 |
1678 | --- a/sound/core/pcm_native.c |
1679 | +++ b/sound/core/pcm_native.c |
1680 | @@ -630,6 +630,30 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, |
1681 | return 0; |
1682 | } |
1683 | |
1684 | +/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise |
1685 | + * block the further r/w operations |
1686 | + */ |
1687 | +static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime) |
1688 | +{ |
1689 | + if (!atomic_dec_unless_positive(&runtime->buffer_accessing)) |
1690 | + return -EBUSY; |
1691 | + mutex_lock(&runtime->buffer_mutex); |
1692 | + return 0; /* keep buffer_mutex, unlocked by below */ |
1693 | +} |
1694 | + |
1695 | +/* release buffer_mutex and clear r/w access flag */ |
1696 | +static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime) |
1697 | +{ |
1698 | + mutex_unlock(&runtime->buffer_mutex); |
1699 | + atomic_inc(&runtime->buffer_accessing); |
1700 | +} |
1701 | + |
1702 | +#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
1703 | +#define is_oss_stream(substream) ((substream)->oss.oss) |
1704 | +#else |
1705 | +#define is_oss_stream(substream) false |
1706 | +#endif |
1707 | + |
1708 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
1709 | struct snd_pcm_hw_params *params) |
1710 | { |
1711 | @@ -641,22 +665,25 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
1712 | if (PCM_RUNTIME_CHECK(substream)) |
1713 | return -ENXIO; |
1714 | runtime = substream->runtime; |
1715 | + err = snd_pcm_buffer_access_lock(runtime); |
1716 | + if (err < 0) |
1717 | + return err; |
1718 | snd_pcm_stream_lock_irq(substream); |
1719 | switch (runtime->status->state) { |
1720 | case SNDRV_PCM_STATE_OPEN: |
1721 | case SNDRV_PCM_STATE_SETUP: |
1722 | case SNDRV_PCM_STATE_PREPARED: |
1723 | + if (!is_oss_stream(substream) && |
1724 | + atomic_read(&substream->mmap_count)) |
1725 | + err = -EBADFD; |
1726 | break; |
1727 | default: |
1728 | - snd_pcm_stream_unlock_irq(substream); |
1729 | - return -EBADFD; |
1730 | + err = -EBADFD; |
1731 | + break; |
1732 | } |
1733 | snd_pcm_stream_unlock_irq(substream); |
1734 | -#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
1735 | - if (!substream->oss.oss) |
1736 | -#endif |
1737 | - if (atomic_read(&substream->mmap_count)) |
1738 | - return -EBADFD; |
1739 | + if (err) |
1740 | + goto unlock; |
1741 | |
1742 | params->rmask = ~0U; |
1743 | err = snd_pcm_hw_refine(substream, params); |
1744 | @@ -733,14 +760,19 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
1745 | if ((usecs = period_to_usecs(runtime)) >= 0) |
1746 | pm_qos_add_request(&substream->latency_pm_qos_req, |
1747 | PM_QOS_CPU_DMA_LATENCY, usecs); |
1748 | - return 0; |
1749 | + err = 0; |
1750 | _error: |
1751 | - /* hardware might be unusable from this time, |
1752 | - so we force application to retry to set |
1753 | - the correct hardware parameter settings */ |
1754 | - snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
1755 | - if (substream->ops->hw_free != NULL) |
1756 | - substream->ops->hw_free(substream); |
1757 | + if (err) { |
1758 | + /* hardware might be unusable from this time, |
1759 | + * so we force application to retry to set |
1760 | + * the correct hardware parameter settings |
1761 | + */ |
1762 | + snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
1763 | + if (substream->ops->hw_free != NULL) |
1764 | + substream->ops->hw_free(substream); |
1765 | + } |
1766 | + unlock: |
1767 | + snd_pcm_buffer_access_unlock(runtime); |
1768 | return err; |
1769 | } |
1770 | |
1771 | @@ -773,22 +805,29 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) |
1772 | if (PCM_RUNTIME_CHECK(substream)) |
1773 | return -ENXIO; |
1774 | runtime = substream->runtime; |
1775 | + result = snd_pcm_buffer_access_lock(runtime); |
1776 | + if (result < 0) |
1777 | + return result; |
1778 | snd_pcm_stream_lock_irq(substream); |
1779 | switch (runtime->status->state) { |
1780 | case SNDRV_PCM_STATE_SETUP: |
1781 | case SNDRV_PCM_STATE_PREPARED: |
1782 | + if (atomic_read(&substream->mmap_count)) |
1783 | + result = -EBADFD; |
1784 | break; |
1785 | default: |
1786 | - snd_pcm_stream_unlock_irq(substream); |
1787 | - return -EBADFD; |
1788 | + result = -EBADFD; |
1789 | + break; |
1790 | } |
1791 | snd_pcm_stream_unlock_irq(substream); |
1792 | - if (atomic_read(&substream->mmap_count)) |
1793 | - return -EBADFD; |
1794 | + if (result) |
1795 | + goto unlock; |
1796 | if (substream->ops->hw_free) |
1797 | result = substream->ops->hw_free(substream); |
1798 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
1799 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
1800 | + unlock: |
1801 | + snd_pcm_buffer_access_unlock(runtime); |
1802 | return result; |
1803 | } |
1804 | |
1805 | @@ -1025,15 +1064,17 @@ struct action_ops { |
1806 | */ |
1807 | static int snd_pcm_action_group(const struct action_ops *ops, |
1808 | struct snd_pcm_substream *substream, |
1809 | - int state, int do_lock) |
1810 | + int state, int stream_lock) |
1811 | { |
1812 | struct snd_pcm_substream *s = NULL; |
1813 | struct snd_pcm_substream *s1; |
1814 | int res = 0, depth = 1; |
1815 | |
1816 | snd_pcm_group_for_each_entry(s, substream) { |
1817 | - if (do_lock && s != substream) { |
1818 | - if (s->pcm->nonatomic) |
1819 | + if (s != substream) { |
1820 | + if (!stream_lock) |
1821 | + mutex_lock_nested(&s->runtime->buffer_mutex, depth); |
1822 | + else if (s->pcm->nonatomic) |
1823 | mutex_lock_nested(&s->self_group.mutex, depth); |
1824 | else |
1825 | spin_lock_nested(&s->self_group.lock, depth); |
1826 | @@ -1061,18 +1102,18 @@ static int snd_pcm_action_group(const struct action_ops *ops, |
1827 | ops->post_action(s, state); |
1828 | } |
1829 | _unlock: |
1830 | - if (do_lock) { |
1831 | - /* unlock streams */ |
1832 | - snd_pcm_group_for_each_entry(s1, substream) { |
1833 | - if (s1 != substream) { |
1834 | - if (s1->pcm->nonatomic) |
1835 | - mutex_unlock(&s1->self_group.mutex); |
1836 | - else |
1837 | - spin_unlock(&s1->self_group.lock); |
1838 | - } |
1839 | - if (s1 == s) /* end */ |
1840 | - break; |
1841 | + /* unlock streams */ |
1842 | + snd_pcm_group_for_each_entry(s1, substream) { |
1843 | + if (s1 != substream) { |
1844 | + if (!stream_lock) |
1845 | + mutex_unlock(&s1->runtime->buffer_mutex); |
1846 | + else if (s1->pcm->nonatomic) |
1847 | + mutex_unlock(&s1->self_group.mutex); |
1848 | + else |
1849 | + spin_unlock(&s1->self_group.lock); |
1850 | } |
1851 | + if (s1 == s) /* end */ |
1852 | + break; |
1853 | } |
1854 | return res; |
1855 | } |
1856 | @@ -1202,10 +1243,15 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops, |
1857 | |
1858 | /* Guarantee the group members won't change during non-atomic action */ |
1859 | down_read(&snd_pcm_link_rwsem); |
1860 | + res = snd_pcm_buffer_access_lock(substream->runtime); |
1861 | + if (res < 0) |
1862 | + goto unlock; |
1863 | if (snd_pcm_stream_linked(substream)) |
1864 | res = snd_pcm_action_group(ops, substream, state, 0); |
1865 | else |
1866 | res = snd_pcm_action_single(ops, substream, state); |
1867 | + snd_pcm_buffer_access_unlock(substream->runtime); |
1868 | + unlock: |
1869 | up_read(&snd_pcm_link_rwsem); |
1870 | return res; |
1871 | } |
1872 | diff --git a/sound/firewire/fireworks/fireworks_hwdep.c b/sound/firewire/fireworks/fireworks_hwdep.c |
1873 | index e93eb4616c5f4..c739173c668f3 100644 |
1874 | --- a/sound/firewire/fireworks/fireworks_hwdep.c |
1875 | +++ b/sound/firewire/fireworks/fireworks_hwdep.c |
1876 | @@ -34,6 +34,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, |
1877 | type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE; |
1878 | if (copy_to_user(buf, &type, sizeof(type))) |
1879 | return -EFAULT; |
1880 | + count += sizeof(type); |
1881 | remained -= sizeof(type); |
1882 | buf += sizeof(type); |
1883 | |
1884 | diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c |
1885 | index f83a6eaba12cb..ef8bd9e046374 100644 |
1886 | --- a/sound/soc/codecs/da7219.c |
1887 | +++ b/sound/soc/codecs/da7219.c |
1888 | @@ -446,7 +446,7 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, |
1889 | struct soc_mixer_control *mixer_ctrl = |
1890 | (struct soc_mixer_control *) kcontrol->private_value; |
1891 | unsigned int reg = mixer_ctrl->reg; |
1892 | - __le16 val; |
1893 | + __le16 val_new, val_old; |
1894 | int ret; |
1895 | |
1896 | /* |
1897 | @@ -454,13 +454,19 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, |
1898 | * Therefore we need to convert to little endian here to align with |
1899 | * HW registers. |
1900 | */ |
1901 | - val = cpu_to_le16(ucontrol->value.integer.value[0]); |
1902 | + val_new = cpu_to_le16(ucontrol->value.integer.value[0]); |
1903 | |
1904 | mutex_lock(&da7219->ctrl_lock); |
1905 | - ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val)); |
1906 | + ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old)); |
1907 | + if (ret == 0 && (val_old != val_new)) |
1908 | + ret = regmap_raw_write(da7219->regmap, reg, |
1909 | + &val_new, sizeof(val_new)); |
1910 | mutex_unlock(&da7219->ctrl_lock); |
1911 | |
1912 | - return ret; |
1913 | + if (ret < 0) |
1914 | + return ret; |
1915 | + |
1916 | + return val_old != val_new; |
1917 | } |
1918 | |
1919 | |
1920 | diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c |
1921 | index 04f23477039a5..c677c068b05ec 100644 |
1922 | --- a/sound/soc/codecs/wm8958-dsp2.c |
1923 | +++ b/sound/soc/codecs/wm8958-dsp2.c |
1924 | @@ -534,7 +534,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol, |
1925 | |
1926 | wm8958_dsp_apply(component, mbc, wm8994->mbc_ena[mbc]); |
1927 | |
1928 | - return 0; |
1929 | + return 1; |
1930 | } |
1931 | |
1932 | #define WM8958_MBC_SWITCH(xname, xval) {\ |
1933 | @@ -660,7 +660,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol, |
1934 | |
1935 | wm8958_dsp_apply(component, vss, wm8994->vss_ena[vss]); |
1936 | |
1937 | - return 0; |
1938 | + return 1; |
1939 | } |
1940 | |
1941 | |
1942 | @@ -734,7 +734,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol, |
1943 | |
1944 | wm8958_dsp_apply(component, hpf % 3, ucontrol->value.integer.value[0]); |
1945 | |
1946 | - return 0; |
1947 | + return 1; |
1948 | } |
1949 | |
1950 | #define WM8958_HPF_SWITCH(xname, xval) {\ |
1951 | @@ -828,7 +828,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol, |
1952 | |
1953 | wm8958_dsp_apply(component, eq, ucontrol->value.integer.value[0]); |
1954 | |
1955 | - return 0; |
1956 | + return 1; |
1957 | } |
1958 | |
1959 | #define WM8958_ENH_EQ_SWITCH(xname, xval) {\ |
1960 | diff --git a/sound/soc/meson/g12a-tohdmitx.c b/sound/soc/meson/g12a-tohdmitx.c |
1961 | index 9cfbd343a00c8..cbe47e0cae426 100644 |
1962 | --- a/sound/soc/meson/g12a-tohdmitx.c |
1963 | +++ b/sound/soc/meson/g12a-tohdmitx.c |
1964 | @@ -127,7 +127,7 @@ static int g12a_tohdmitx_i2s_mux_put_enum(struct snd_kcontrol *kcontrol, |
1965 | |
1966 | snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); |
1967 | |
1968 | - return 0; |
1969 | + return 1; |
1970 | } |
1971 | |
1972 | static const struct snd_kcontrol_new g12a_tohdmitx_i2s_mux = |
1973 | diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c |
1974 | index ca4b17bd95d14..5552c66ca6422 100644 |
1975 | --- a/sound/soc/soc-generic-dmaengine-pcm.c |
1976 | +++ b/sound/soc/soc-generic-dmaengine-pcm.c |
1977 | @@ -91,10 +91,10 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, |
1978 | |
1979 | memset(&slave_config, 0, sizeof(slave_config)); |
1980 | |
1981 | - if (pcm->config && pcm->config->prepare_slave_config) |
1982 | - prepare_slave_config = pcm->config->prepare_slave_config; |
1983 | - else |
1984 | + if (!pcm->config) |
1985 | prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
1986 | + else |
1987 | + prepare_slave_config = pcm->config->prepare_slave_config; |
1988 | |
1989 | if (prepare_slave_config) { |
1990 | ret = prepare_slave_config(substream, params, &slave_config); |
1991 | diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh |
1992 | index a3402cd8d5b68..9ff22f28032dd 100755 |
1993 | --- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh |
1994 | +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh |
1995 | @@ -61,9 +61,12 @@ setup_prepare() |
1996 | |
1997 | vrf_prepare |
1998 | mirror_gre_topo_create |
1999 | + # Avoid changing br1's PVID while it is operational as a L3 interface. |
2000 | + ip link set dev br1 down |
2001 | |
2002 | ip link set dev $swp3 master br1 |
2003 | bridge vlan add dev br1 vid 555 pvid untagged self |
2004 | + ip link set dev br1 up |
2005 | ip address add dev br1 192.0.2.129/28 |
2006 | ip address add dev br1 2001:db8:2::1/64 |
2007 |