1 |
commit: 89df9075a31ed1e517572dd7d700527b79252803 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 27 15:24:58 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 27 15:24:58 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=89df9075 |
7 |
|
8 |
Linux patch 4.14.182 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1181_linux-4.14.182.patch | 2340 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2344 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 0e85d1b..b13e85f 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -767,6 +767,10 @@ Patch: 1180_linux-4.14.181.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.181 |
23 |
|
24 |
+Patch: 1181_linux-4.14.182.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.182 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1181_linux-4.14.182.patch b/1181_linux-4.14.182.patch |
33 |
new file mode 100644 |
34 |
index 0000000..6544cc8 |
35 |
--- /dev/null |
36 |
+++ b/1181_linux-4.14.182.patch |
37 |
@@ -0,0 +1,2340 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 12bf05880d2d..591582e26a57 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 181 |
47 |
++SUBLEVEL = 182 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h |
52 |
+index ffebe7b7a5b7..91ca80035fc4 100644 |
53 |
+--- a/arch/arm/include/asm/futex.h |
54 |
++++ b/arch/arm/include/asm/futex.h |
55 |
+@@ -163,8 +163,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) |
56 |
+ preempt_enable(); |
57 |
+ #endif |
58 |
+ |
59 |
+- if (!ret) |
60 |
+- *oval = oldval; |
61 |
++ /* |
62 |
++ * Store unconditionally. If ret != 0 the extra store is the least |
63 |
++ * of the worries but GCC cannot figure out that __futex_atomic_op() |
64 |
++ * is either setting ret to -EFAULT or storing the old value in |
65 |
++ * oldval which results in a uninitialized warning at the call site. |
66 |
++ */ |
67 |
++ *oval = oldval; |
68 |
+ |
69 |
+ return ret; |
70 |
+ } |
71 |
+diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c |
72 |
+index 11121f608eb5..f7e593965c1d 100644 |
73 |
+--- a/arch/arm64/kernel/machine_kexec.c |
74 |
++++ b/arch/arm64/kernel/machine_kexec.c |
75 |
+@@ -184,7 +184,8 @@ void machine_kexec(struct kimage *kimage) |
76 |
+ /* Flush the reboot_code_buffer in preparation for its execution. */ |
77 |
+ __flush_dcache_area(reboot_code_buffer, arm64_relocate_new_kernel_size); |
78 |
+ flush_icache_range((uintptr_t)reboot_code_buffer, |
79 |
+- arm64_relocate_new_kernel_size); |
80 |
++ (uintptr_t)reboot_code_buffer + |
81 |
++ arm64_relocate_new_kernel_size); |
82 |
+ |
83 |
+ /* Flush the kimage list and its buffers. */ |
84 |
+ kexec_list_flush(kimage); |
85 |
+diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig |
86 |
+index 277e4ffb928b..679e1e3c1695 100644 |
87 |
+--- a/arch/powerpc/Kconfig |
88 |
++++ b/arch/powerpc/Kconfig |
89 |
+@@ -141,12 +141,14 @@ config PPC |
90 |
+ select ARCH_HAS_GCOV_PROFILE_ALL |
91 |
+ select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE |
92 |
+ select ARCH_HAS_SG_CHAIN |
93 |
++ select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION) |
94 |
+ select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
95 |
+ select ARCH_HAS_UBSAN_SANITIZE_ALL |
96 |
+ select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64 |
97 |
+ select ARCH_HAVE_NMI_SAFE_CMPXCHG |
98 |
+ select ARCH_MIGHT_HAVE_PC_PARPORT |
99 |
+ select ARCH_MIGHT_HAVE_PC_SERIO |
100 |
++ select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX |
101 |
+ select ARCH_SUPPORTS_ATOMIC_RMW |
102 |
+ select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT |
103 |
+ select ARCH_USE_BUILTIN_BSWAP |
104 |
+@@ -178,8 +180,6 @@ config PPC |
105 |
+ select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT |
106 |
+ select HAVE_ARCH_SECCOMP_FILTER |
107 |
+ select HAVE_ARCH_TRACEHOOK |
108 |
+- select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) |
109 |
+- select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX |
110 |
+ select HAVE_CBPF_JIT if !PPC64 |
111 |
+ select HAVE_CONTEXT_TRACKING if PPC64 |
112 |
+ select HAVE_DEBUG_KMEMLEAK |
113 |
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
114 |
+index 6415b4aead54..48ab5fdd1044 100644 |
115 |
+--- a/arch/x86/kernel/apic/apic.c |
116 |
++++ b/arch/x86/kernel/apic/apic.c |
117 |
+@@ -353,8 +353,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) |
118 |
+ * According to Intel, MFENCE can do the serialization here. |
119 |
+ */ |
120 |
+ asm volatile("mfence" : : : "memory"); |
121 |
+- |
122 |
+- printk_once(KERN_DEBUG "TSC deadline timer enabled\n"); |
123 |
+ return; |
124 |
+ } |
125 |
+ |
126 |
+@@ -553,7 +551,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events); |
127 |
+ #define DEADLINE_MODEL_MATCH_REV(model, rev) \ |
128 |
+ { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)rev } |
129 |
+ |
130 |
+-static u32 hsx_deadline_rev(void) |
131 |
++static __init u32 hsx_deadline_rev(void) |
132 |
+ { |
133 |
+ switch (boot_cpu_data.x86_stepping) { |
134 |
+ case 0x02: return 0x3a; /* EP */ |
135 |
+@@ -563,7 +561,7 @@ static u32 hsx_deadline_rev(void) |
136 |
+ return ~0U; |
137 |
+ } |
138 |
+ |
139 |
+-static u32 bdx_deadline_rev(void) |
140 |
++static __init u32 bdx_deadline_rev(void) |
141 |
+ { |
142 |
+ switch (boot_cpu_data.x86_stepping) { |
143 |
+ case 0x02: return 0x00000011; |
144 |
+@@ -575,7 +573,7 @@ static u32 bdx_deadline_rev(void) |
145 |
+ return ~0U; |
146 |
+ } |
147 |
+ |
148 |
+-static u32 skx_deadline_rev(void) |
149 |
++static __init u32 skx_deadline_rev(void) |
150 |
+ { |
151 |
+ switch (boot_cpu_data.x86_stepping) { |
152 |
+ case 0x03: return 0x01000136; |
153 |
+@@ -588,7 +586,7 @@ static u32 skx_deadline_rev(void) |
154 |
+ return ~0U; |
155 |
+ } |
156 |
+ |
157 |
+-static const struct x86_cpu_id deadline_match[] = { |
158 |
++static const struct x86_cpu_id deadline_match[] __initconst = { |
159 |
+ DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_HASWELL_X, hsx_deadline_rev), |
160 |
+ DEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_BROADWELL_X, 0x0b000020), |
161 |
+ DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_BROADWELL_XEON_D, bdx_deadline_rev), |
162 |
+@@ -610,18 +608,19 @@ static const struct x86_cpu_id deadline_match[] = { |
163 |
+ {}, |
164 |
+ }; |
165 |
+ |
166 |
+-static void apic_check_deadline_errata(void) |
167 |
++static __init bool apic_validate_deadline_timer(void) |
168 |
+ { |
169 |
+ const struct x86_cpu_id *m; |
170 |
+ u32 rev; |
171 |
+ |
172 |
+- if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER) || |
173 |
+- boot_cpu_has(X86_FEATURE_HYPERVISOR)) |
174 |
+- return; |
175 |
++ if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER)) |
176 |
++ return false; |
177 |
++ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) |
178 |
++ return true; |
179 |
+ |
180 |
+ m = x86_match_cpu(deadline_match); |
181 |
+ if (!m) |
182 |
+- return; |
183 |
++ return true; |
184 |
+ |
185 |
+ /* |
186 |
+ * Function pointers will have the MSB set due to address layout, |
187 |
+@@ -633,11 +632,12 @@ static void apic_check_deadline_errata(void) |
188 |
+ rev = (u32)m->driver_data; |
189 |
+ |
190 |
+ if (boot_cpu_data.microcode >= rev) |
191 |
+- return; |
192 |
++ return true; |
193 |
+ |
194 |
+ setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); |
195 |
+ pr_err(FW_BUG "TSC_DEADLINE disabled due to Errata; " |
196 |
+ "please update microcode to version: 0x%x (or later)\n", rev); |
197 |
++ return false; |
198 |
+ } |
199 |
+ |
200 |
+ /* |
201 |
+@@ -1914,7 +1914,8 @@ void __init init_apic_mappings(void) |
202 |
+ { |
203 |
+ unsigned int new_apicid; |
204 |
+ |
205 |
+- apic_check_deadline_errata(); |
206 |
++ if (apic_validate_deadline_timer()) |
207 |
++ pr_debug("TSC deadline timer available\n"); |
208 |
+ |
209 |
+ if (x2apic_mode) { |
210 |
+ boot_cpu_physical_apicid = read_apic_id(); |
211 |
+diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c |
212 |
+index b698468f726b..a9a55e76a43f 100644 |
213 |
+--- a/arch/x86/kernel/unwind_orc.c |
214 |
++++ b/arch/x86/kernel/unwind_orc.c |
215 |
+@@ -255,12 +255,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address); |
216 |
+ |
217 |
+ unsigned long *unwind_get_return_address_ptr(struct unwind_state *state) |
218 |
+ { |
219 |
++ struct task_struct *task = state->task; |
220 |
++ |
221 |
+ if (unwind_done(state)) |
222 |
+ return NULL; |
223 |
+ |
224 |
+ if (state->regs) |
225 |
+ return &state->regs->ip; |
226 |
+ |
227 |
++ if (task != current && state->sp == task->thread.sp) { |
228 |
++ struct inactive_task_frame *frame = (void *)task->thread.sp; |
229 |
++ return &frame->ret_addr; |
230 |
++ } |
231 |
++ |
232 |
+ if (state->sp) |
233 |
+ return (unsigned long *)state->sp - 1; |
234 |
+ |
235 |
+diff --git a/drivers/base/component.c b/drivers/base/component.c |
236 |
+index 08da6160e94d..55f0856bd9b5 100644 |
237 |
+--- a/drivers/base/component.c |
238 |
++++ b/drivers/base/component.c |
239 |
+@@ -162,7 +162,8 @@ static int try_to_bring_up_master(struct master *master, |
240 |
+ ret = master->ops->bind(master->dev); |
241 |
+ if (ret < 0) { |
242 |
+ devres_release_group(master->dev, NULL); |
243 |
+- dev_info(master->dev, "master bind failed: %d\n", ret); |
244 |
++ if (ret != -EPROBE_DEFER) |
245 |
++ dev_info(master->dev, "master bind failed: %d\n", ret); |
246 |
+ return ret; |
247 |
+ } |
248 |
+ |
249 |
+@@ -431,8 +432,9 @@ static int component_bind(struct component *component, struct master *master, |
250 |
+ devres_release_group(component->dev, NULL); |
251 |
+ devres_release_group(master->dev, NULL); |
252 |
+ |
253 |
+- dev_err(master->dev, "failed to bind %s (ops %ps): %d\n", |
254 |
+- dev_name(component->dev), component->ops, ret); |
255 |
++ if (ret != -EPROBE_DEFER) |
256 |
++ dev_err(master->dev, "failed to bind %s (ops %ps): %d\n", |
257 |
++ dev_name(component->dev), component->ops, ret); |
258 |
+ } |
259 |
+ |
260 |
+ return ret; |
261 |
+diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c |
262 |
+index 4f4733d831a1..045351f3549c 100644 |
263 |
+--- a/drivers/dma/tegra210-adma.c |
264 |
++++ b/drivers/dma/tegra210-adma.c |
265 |
+@@ -793,7 +793,7 @@ static int tegra_adma_probe(struct platform_device *pdev) |
266 |
+ ret = dma_async_device_register(&tdma->dma_dev); |
267 |
+ if (ret < 0) { |
268 |
+ dev_err(&pdev->dev, "ADMA registration failed: %d\n", ret); |
269 |
+- goto irq_dispose; |
270 |
++ goto rpm_put; |
271 |
+ } |
272 |
+ |
273 |
+ ret = of_dma_controller_register(pdev->dev.of_node, |
274 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
275 |
+index 9d372fa7c298..a1e5e0529545 100644 |
276 |
+--- a/drivers/hid/hid-ids.h |
277 |
++++ b/drivers/hid/hid-ids.h |
278 |
+@@ -369,6 +369,7 @@ |
279 |
+ #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349 |
280 |
+ #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7 |
281 |
+ #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 |
282 |
++#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002 |
283 |
+ |
284 |
+ #define USB_VENDOR_ID_ELAN 0x04f3 |
285 |
+ |
286 |
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c |
287 |
+index 07d92d4a9f7c..db29bf539a4b 100644 |
288 |
+--- a/drivers/hid/hid-multitouch.c |
289 |
++++ b/drivers/hid/hid-multitouch.c |
290 |
+@@ -1550,6 +1550,9 @@ static const struct hid_device_id mt_devices[] = { |
291 |
+ { .driver_data = MT_CLS_EGALAX_SERIAL, |
292 |
+ MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
293 |
+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, |
294 |
++ { .driver_data = MT_CLS_EGALAX, |
295 |
++ MT_USB_DEVICE(USB_VENDOR_ID_DWAV, |
296 |
++ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) }, |
297 |
+ |
298 |
+ /* Elitegroup panel */ |
299 |
+ { .driver_data = MT_CLS_SERIAL, |
300 |
+diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c |
301 |
+index eaa312bc3a3c..c4066276eb7b 100644 |
302 |
+--- a/drivers/i2c/i2c-dev.c |
303 |
++++ b/drivers/i2c/i2c-dev.c |
304 |
+@@ -47,7 +47,7 @@ |
305 |
+ struct i2c_dev { |
306 |
+ struct list_head list; |
307 |
+ struct i2c_adapter *adap; |
308 |
+- struct device *dev; |
309 |
++ struct device dev; |
310 |
+ struct cdev cdev; |
311 |
+ }; |
312 |
+ |
313 |
+@@ -91,12 +91,14 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap) |
314 |
+ return i2c_dev; |
315 |
+ } |
316 |
+ |
317 |
+-static void put_i2c_dev(struct i2c_dev *i2c_dev) |
318 |
++static void put_i2c_dev(struct i2c_dev *i2c_dev, bool del_cdev) |
319 |
+ { |
320 |
+ spin_lock(&i2c_dev_list_lock); |
321 |
+ list_del(&i2c_dev->list); |
322 |
+ spin_unlock(&i2c_dev_list_lock); |
323 |
+- kfree(i2c_dev); |
324 |
++ if (del_cdev) |
325 |
++ cdev_device_del(&i2c_dev->cdev, &i2c_dev->dev); |
326 |
++ put_device(&i2c_dev->dev); |
327 |
+ } |
328 |
+ |
329 |
+ static ssize_t name_show(struct device *dev, |
330 |
+@@ -542,6 +544,14 @@ static const struct file_operations i2cdev_fops = { |
331 |
+ |
332 |
+ static struct class *i2c_dev_class; |
333 |
+ |
334 |
++static void i2cdev_dev_release(struct device *dev) |
335 |
++{ |
336 |
++ struct i2c_dev *i2c_dev; |
337 |
++ |
338 |
++ i2c_dev = container_of(dev, struct i2c_dev, dev); |
339 |
++ kfree(i2c_dev); |
340 |
++} |
341 |
++ |
342 |
+ static int i2cdev_attach_adapter(struct device *dev, void *dummy) |
343 |
+ { |
344 |
+ struct i2c_adapter *adap; |
345 |
+@@ -558,27 +568,23 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy) |
346 |
+ |
347 |
+ cdev_init(&i2c_dev->cdev, &i2cdev_fops); |
348 |
+ i2c_dev->cdev.owner = THIS_MODULE; |
349 |
+- res = cdev_add(&i2c_dev->cdev, MKDEV(I2C_MAJOR, adap->nr), 1); |
350 |
+- if (res) |
351 |
+- goto error_cdev; |
352 |
+- |
353 |
+- /* register this i2c device with the driver core */ |
354 |
+- i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, |
355 |
+- MKDEV(I2C_MAJOR, adap->nr), NULL, |
356 |
+- "i2c-%d", adap->nr); |
357 |
+- if (IS_ERR(i2c_dev->dev)) { |
358 |
+- res = PTR_ERR(i2c_dev->dev); |
359 |
+- goto error; |
360 |
++ |
361 |
++ device_initialize(&i2c_dev->dev); |
362 |
++ i2c_dev->dev.devt = MKDEV(I2C_MAJOR, adap->nr); |
363 |
++ i2c_dev->dev.class = i2c_dev_class; |
364 |
++ i2c_dev->dev.parent = &adap->dev; |
365 |
++ i2c_dev->dev.release = i2cdev_dev_release; |
366 |
++ dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr); |
367 |
++ |
368 |
++ res = cdev_device_add(&i2c_dev->cdev, &i2c_dev->dev); |
369 |
++ if (res) { |
370 |
++ put_i2c_dev(i2c_dev, false); |
371 |
++ return res; |
372 |
+ } |
373 |
+ |
374 |
+ pr_debug("i2c-dev: adapter [%s] registered as minor %d\n", |
375 |
+ adap->name, adap->nr); |
376 |
+ return 0; |
377 |
+-error: |
378 |
+- cdev_del(&i2c_dev->cdev); |
379 |
+-error_cdev: |
380 |
+- put_i2c_dev(i2c_dev); |
381 |
+- return res; |
382 |
+ } |
383 |
+ |
384 |
+ static int i2cdev_detach_adapter(struct device *dev, void *dummy) |
385 |
+@@ -594,9 +600,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy) |
386 |
+ if (!i2c_dev) /* attach_adapter must have failed */ |
387 |
+ return 0; |
388 |
+ |
389 |
+- cdev_del(&i2c_dev->cdev); |
390 |
+- put_i2c_dev(i2c_dev); |
391 |
+- device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); |
392 |
++ put_i2c_dev(i2c_dev, true); |
393 |
+ |
394 |
+ pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); |
395 |
+ return 0; |
396 |
+diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
397 |
+index 33ce032cb701..0c637ae81404 100644 |
398 |
+--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c |
399 |
++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
400 |
+@@ -270,6 +270,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) |
401 |
+ err_rollback_available: |
402 |
+ device_remove_file(&pdev->dev, &dev_attr_available_masters); |
403 |
+ err_rollback: |
404 |
++ i2c_demux_deactivate_master(priv); |
405 |
+ for (j = 0; j < i; j++) { |
406 |
+ of_node_put(priv->chan[j].parent_np); |
407 |
+ of_changeset_destroy(&priv->chan[j].chgset); |
408 |
+diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c |
409 |
+index f2761b385541..edceda640fa2 100644 |
410 |
+--- a/drivers/iio/accel/sca3000.c |
411 |
++++ b/drivers/iio/accel/sca3000.c |
412 |
+@@ -982,7 +982,7 @@ static int sca3000_read_data(struct sca3000_state *st, |
413 |
+ st->tx[0] = SCA3000_READ_REG(reg_address_high); |
414 |
+ ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer)); |
415 |
+ if (ret) { |
416 |
+- dev_err(get_device(&st->us->dev), "problem reading register"); |
417 |
++ dev_err(&st->us->dev, "problem reading register\n"); |
418 |
+ return ret; |
419 |
+ } |
420 |
+ |
421 |
+diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c |
422 |
+index 3cfb2d4b2441..206feefbc456 100644 |
423 |
+--- a/drivers/iio/adc/stm32-adc.c |
424 |
++++ b/drivers/iio/adc/stm32-adc.c |
425 |
+@@ -1627,15 +1627,27 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev) |
426 |
+ return 0; |
427 |
+ } |
428 |
+ |
429 |
+-static int stm32_adc_dma_request(struct iio_dev *indio_dev) |
430 |
++static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev) |
431 |
+ { |
432 |
+ struct stm32_adc *adc = iio_priv(indio_dev); |
433 |
+ struct dma_slave_config config; |
434 |
+ int ret; |
435 |
+ |
436 |
+- adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx"); |
437 |
+- if (!adc->dma_chan) |
438 |
++ adc->dma_chan = dma_request_chan(dev, "rx"); |
439 |
++ if (IS_ERR(adc->dma_chan)) { |
440 |
++ ret = PTR_ERR(adc->dma_chan); |
441 |
++ if (ret != -ENODEV) { |
442 |
++ if (ret != -EPROBE_DEFER) |
443 |
++ dev_err(dev, |
444 |
++ "DMA channel request failed with %d\n", |
445 |
++ ret); |
446 |
++ return ret; |
447 |
++ } |
448 |
++ |
449 |
++ /* DMA is optional: fall back to IRQ mode */ |
450 |
++ adc->dma_chan = NULL; |
451 |
+ return 0; |
452 |
++ } |
453 |
+ |
454 |
+ adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev, |
455 |
+ STM32_DMA_BUFFER_SIZE, |
456 |
+@@ -1749,7 +1761,7 @@ static int stm32_adc_probe(struct platform_device *pdev) |
457 |
+ if (ret < 0) |
458 |
+ goto err_clk_disable; |
459 |
+ |
460 |
+- ret = stm32_adc_dma_request(indio_dev); |
461 |
++ ret = stm32_adc_dma_request(dev, indio_dev); |
462 |
+ if (ret < 0) |
463 |
+ goto err_clk_disable; |
464 |
+ |
465 |
+diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c |
466 |
+index c4ec7779b394..190a7c1c5604 100644 |
467 |
+--- a/drivers/iio/dac/vf610_dac.c |
468 |
++++ b/drivers/iio/dac/vf610_dac.c |
469 |
+@@ -235,6 +235,7 @@ static int vf610_dac_probe(struct platform_device *pdev) |
470 |
+ return 0; |
471 |
+ |
472 |
+ error_iio_device_register: |
473 |
++ vf610_dac_exit(info); |
474 |
+ clk_disable_unprepare(info->clk); |
475 |
+ |
476 |
+ return ret; |
477 |
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
478 |
+index 6c228144b3da..ec9a20e06941 100644 |
479 |
+--- a/drivers/iommu/amd_iommu_init.c |
480 |
++++ b/drivers/iommu/amd_iommu_init.c |
481 |
+@@ -1317,8 +1317,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, |
482 |
+ } |
483 |
+ case IVHD_DEV_ACPI_HID: { |
484 |
+ u16 devid; |
485 |
+- u8 hid[ACPIHID_HID_LEN] = {0}; |
486 |
+- u8 uid[ACPIHID_UID_LEN] = {0}; |
487 |
++ u8 hid[ACPIHID_HID_LEN]; |
488 |
++ u8 uid[ACPIHID_UID_LEN]; |
489 |
+ int ret; |
490 |
+ |
491 |
+ if (h->type != 0x40) { |
492 |
+@@ -1335,6 +1335,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, |
493 |
+ break; |
494 |
+ } |
495 |
+ |
496 |
++ uid[0] = '\0'; |
497 |
+ switch (e->uidf) { |
498 |
+ case UID_NOT_PRESENT: |
499 |
+ |
500 |
+@@ -1349,8 +1350,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, |
501 |
+ break; |
502 |
+ case UID_IS_CHARACTER: |
503 |
+ |
504 |
+- memcpy(uid, (u8 *)(&e->uid), ACPIHID_UID_LEN - 1); |
505 |
+- uid[ACPIHID_UID_LEN - 1] = '\0'; |
506 |
++ memcpy(uid, &e->uid, e->uidl); |
507 |
++ uid[e->uidl] = '\0'; |
508 |
+ |
509 |
+ break; |
510 |
+ default: |
511 |
+diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c |
512 |
+index d8d406c79cfa..5965e34e36cc 100644 |
513 |
+--- a/drivers/media/platform/rcar_fdp1.c |
514 |
++++ b/drivers/media/platform/rcar_fdp1.c |
515 |
+@@ -2372,7 +2372,7 @@ static int fdp1_probe(struct platform_device *pdev) |
516 |
+ dprintk(fdp1, "FDP1 Version R-Car H3\n"); |
517 |
+ break; |
518 |
+ case FD1_IP_M3N: |
519 |
+- dprintk(fdp1, "FDP1 Version R-Car M3N\n"); |
520 |
++ dprintk(fdp1, "FDP1 Version R-Car M3-N\n"); |
521 |
+ break; |
522 |
+ case FD1_IP_E3: |
523 |
+ dprintk(fdp1, "FDP1 Version R-Car E3\n"); |
524 |
+diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c |
525 |
+index be64969d986a..391c6d4855ff 100644 |
526 |
+--- a/drivers/misc/mei/client.c |
527 |
++++ b/drivers/misc/mei/client.c |
528 |
+@@ -276,6 +276,7 @@ void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid) |
529 |
+ down_write(&dev->me_clients_rwsem); |
530 |
+ me_cl = __mei_me_cl_by_uuid(dev, uuid); |
531 |
+ __mei_me_cl_del(dev, me_cl); |
532 |
++ mei_me_cl_put(me_cl); |
533 |
+ up_write(&dev->me_clients_rwsem); |
534 |
+ } |
535 |
+ |
536 |
+@@ -297,6 +298,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, const uuid_le *uuid, u8 id) |
537 |
+ down_write(&dev->me_clients_rwsem); |
538 |
+ me_cl = __mei_me_cl_by_uuid_id(dev, uuid, id); |
539 |
+ __mei_me_cl_del(dev, me_cl); |
540 |
++ mei_me_cl_put(me_cl); |
541 |
+ up_write(&dev->me_clients_rwsem); |
542 |
+ } |
543 |
+ |
544 |
+diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c |
545 |
+index 7bc96294ae4d..b108e1f04bf6 100644 |
546 |
+--- a/drivers/mtd/ubi/debug.c |
547 |
++++ b/drivers/mtd/ubi/debug.c |
548 |
+@@ -405,9 +405,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos) |
549 |
+ { |
550 |
+ struct ubi_device *ubi = s->private; |
551 |
+ |
552 |
+- if (*pos == 0) |
553 |
+- return SEQ_START_TOKEN; |
554 |
+- |
555 |
+ if (*pos < ubi->peb_count) |
556 |
+ return pos; |
557 |
+ |
558 |
+@@ -421,8 +418,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos) |
559 |
+ { |
560 |
+ struct ubi_device *ubi = s->private; |
561 |
+ |
562 |
+- if (v == SEQ_START_TOKEN) |
563 |
+- return pos; |
564 |
+ (*pos)++; |
565 |
+ |
566 |
+ if (*pos < ubi->peb_count) |
567 |
+@@ -444,11 +439,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter) |
568 |
+ int err; |
569 |
+ |
570 |
+ /* If this is the start, print a header */ |
571 |
+- if (iter == SEQ_START_TOKEN) { |
572 |
+- seq_puts(s, |
573 |
+- "physical_block_number\terase_count\tblock_status\tread_status\n"); |
574 |
+- return 0; |
575 |
+- } |
576 |
++ if (*block_number == 0) |
577 |
++ seq_puts(s, "physical_block_number\terase_count\n"); |
578 |
+ |
579 |
+ err = ubi_io_is_bad(ubi, *block_number); |
580 |
+ if (err) |
581 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
582 |
+index 0e13989608f1..6eb65b870da7 100644 |
583 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
584 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
585 |
+@@ -2241,8 +2241,6 @@ static int cxgb_up(struct adapter *adap) |
586 |
+ #if IS_ENABLED(CONFIG_IPV6) |
587 |
+ update_clip(adap); |
588 |
+ #endif |
589 |
+- /* Initialize hash mac addr list*/ |
590 |
+- INIT_LIST_HEAD(&adap->mac_hlist); |
591 |
+ return err; |
592 |
+ |
593 |
+ irq_err: |
594 |
+@@ -2264,6 +2262,7 @@ static void cxgb_down(struct adapter *adapter) |
595 |
+ |
596 |
+ t4_sge_stop(adapter); |
597 |
+ t4_free_sge_resources(adapter); |
598 |
++ |
599 |
+ adapter->flags &= ~FULL_INIT_DONE; |
600 |
+ } |
601 |
+ |
602 |
+@@ -4962,6 +4961,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
603 |
+ (is_t5(adapter->params.chip) ? STATMODE_V(0) : |
604 |
+ T6_STATMODE_V(0))); |
605 |
+ |
606 |
++ /* Initialize hash mac addr list */ |
607 |
++ INIT_LIST_HEAD(&adapter->mac_hlist); |
608 |
++ |
609 |
+ for_each_port(adapter, i) { |
610 |
+ netdev = alloc_etherdev_mq(sizeof(struct port_info), |
611 |
+ MAX_ETH_QSETS); |
612 |
+@@ -5252,6 +5254,7 @@ free_mbox_log: |
613 |
+ static void remove_one(struct pci_dev *pdev) |
614 |
+ { |
615 |
+ struct adapter *adapter = pci_get_drvdata(pdev); |
616 |
++ struct hash_mac_addr *entry, *tmp; |
617 |
+ |
618 |
+ if (!adapter) { |
619 |
+ pci_release_regions(pdev); |
620 |
+@@ -5295,6 +5298,12 @@ static void remove_one(struct pci_dev *pdev) |
621 |
+ if (adapter->num_uld || adapter->num_ofld_uld) |
622 |
+ t4_uld_mem_free(adapter); |
623 |
+ free_some_resources(adapter); |
624 |
++ list_for_each_entry_safe(entry, tmp, &adapter->mac_hlist, |
625 |
++ list) { |
626 |
++ list_del(&entry->list); |
627 |
++ kfree(entry); |
628 |
++ } |
629 |
++ |
630 |
+ #if IS_ENABLED(CONFIG_IPV6) |
631 |
+ t4_cleanup_clip_tbl(adapter); |
632 |
+ #endif |
633 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
634 |
+index 26ba18ea08c6..fa116f0a107d 100644 |
635 |
+--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
636 |
++++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
637 |
+@@ -715,9 +715,6 @@ static int adapter_up(struct adapter *adapter) |
638 |
+ if (adapter->flags & USING_MSIX) |
639 |
+ name_msix_vecs(adapter); |
640 |
+ |
641 |
+- /* Initialize hash mac addr list*/ |
642 |
+- INIT_LIST_HEAD(&adapter->mac_hlist); |
643 |
+- |
644 |
+ adapter->flags |= FULL_INIT_DONE; |
645 |
+ } |
646 |
+ |
647 |
+@@ -2936,6 +2933,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, |
648 |
+ if (err) |
649 |
+ goto err_unmap_bar; |
650 |
+ |
651 |
++ /* Initialize hash mac addr list */ |
652 |
++ INIT_LIST_HEAD(&adapter->mac_hlist); |
653 |
++ |
654 |
+ /* |
655 |
+ * Allocate our "adapter ports" and stitch everything together. |
656 |
+ */ |
657 |
+diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c |
658 |
+index 92e4e5d53053..090607e725a2 100644 |
659 |
+--- a/drivers/net/gtp.c |
660 |
++++ b/drivers/net/gtp.c |
661 |
+@@ -1177,11 +1177,11 @@ out_unlock: |
662 |
+ static struct genl_family gtp_genl_family; |
663 |
+ |
664 |
+ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, |
665 |
+- u32 type, struct pdp_ctx *pctx) |
666 |
++ int flags, u32 type, struct pdp_ctx *pctx) |
667 |
+ { |
668 |
+ void *genlh; |
669 |
+ |
670 |
+- genlh = genlmsg_put(skb, snd_portid, snd_seq, >p_genl_family, 0, |
671 |
++ genlh = genlmsg_put(skb, snd_portid, snd_seq, >p_genl_family, flags, |
672 |
+ type); |
673 |
+ if (genlh == NULL) |
674 |
+ goto nlmsg_failure; |
675 |
+@@ -1235,8 +1235,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) |
676 |
+ goto err_unlock; |
677 |
+ } |
678 |
+ |
679 |
+- err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid, |
680 |
+- info->snd_seq, info->nlhdr->nlmsg_type, pctx); |
681 |
++ err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid, info->snd_seq, |
682 |
++ 0, info->nlhdr->nlmsg_type, pctx); |
683 |
+ if (err < 0) |
684 |
+ goto err_unlock_free; |
685 |
+ |
686 |
+@@ -1279,6 +1279,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb, |
687 |
+ gtp_genl_fill_info(skb, |
688 |
+ NETLINK_CB(cb->skb).portid, |
689 |
+ cb->nlh->nlmsg_seq, |
690 |
++ NLM_F_MULTI, |
691 |
+ cb->nlh->nlmsg_type, pctx)) { |
692 |
+ cb->args[0] = i; |
693 |
+ cb->args[1] = j; |
694 |
+diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c |
695 |
+index 471498469d0a..c46b7e1b0132 100644 |
696 |
+--- a/drivers/nvdimm/btt.c |
697 |
++++ b/drivers/nvdimm/btt.c |
698 |
+@@ -540,9 +540,9 @@ static int arena_clear_freelist_error(struct arena_info *arena, u32 lane) |
699 |
+ |
700 |
+ static int btt_freelist_init(struct arena_info *arena) |
701 |
+ { |
702 |
+- int old, new, ret; |
703 |
+- u32 i, map_entry; |
704 |
+- struct log_entry log_new, log_old; |
705 |
++ int new, ret; |
706 |
++ struct log_entry log_new; |
707 |
++ u32 i, map_entry, log_oldmap, log_newmap; |
708 |
+ |
709 |
+ arena->freelist = kcalloc(arena->nfree, sizeof(struct free_entry), |
710 |
+ GFP_KERNEL); |
711 |
+@@ -550,24 +550,26 @@ static int btt_freelist_init(struct arena_info *arena) |
712 |
+ return -ENOMEM; |
713 |
+ |
714 |
+ for (i = 0; i < arena->nfree; i++) { |
715 |
+- old = btt_log_read(arena, i, &log_old, LOG_OLD_ENT); |
716 |
+- if (old < 0) |
717 |
+- return old; |
718 |
+- |
719 |
+ new = btt_log_read(arena, i, &log_new, LOG_NEW_ENT); |
720 |
+ if (new < 0) |
721 |
+ return new; |
722 |
+ |
723 |
++ /* old and new map entries with any flags stripped out */ |
724 |
++ log_oldmap = ent_lba(le32_to_cpu(log_new.old_map)); |
725 |
++ log_newmap = ent_lba(le32_to_cpu(log_new.new_map)); |
726 |
++ |
727 |
+ /* sub points to the next one to be overwritten */ |
728 |
+ arena->freelist[i].sub = 1 - new; |
729 |
+ arena->freelist[i].seq = nd_inc_seq(le32_to_cpu(log_new.seq)); |
730 |
+- arena->freelist[i].block = le32_to_cpu(log_new.old_map); |
731 |
++ arena->freelist[i].block = log_oldmap; |
732 |
+ |
733 |
+ /* |
734 |
+ * FIXME: if error clearing fails during init, we want to make |
735 |
+ * the BTT read-only |
736 |
+ */ |
737 |
+- if (ent_e_flag(log_new.old_map)) { |
738 |
++ if (ent_e_flag(log_new.old_map) && |
739 |
++ !ent_normal(log_new.old_map)) { |
740 |
++ arena->freelist[i].has_err = 1; |
741 |
+ ret = arena_clear_freelist_error(arena, i); |
742 |
+ if (ret) |
743 |
+ dev_err_ratelimited(to_dev(arena), |
744 |
+@@ -575,7 +577,7 @@ static int btt_freelist_init(struct arena_info *arena) |
745 |
+ } |
746 |
+ |
747 |
+ /* This implies a newly created or untouched flog entry */ |
748 |
+- if (log_new.old_map == log_new.new_map) |
749 |
++ if (log_oldmap == log_newmap) |
750 |
+ continue; |
751 |
+ |
752 |
+ /* Check if map recovery is needed */ |
753 |
+@@ -583,8 +585,15 @@ static int btt_freelist_init(struct arena_info *arena) |
754 |
+ NULL, NULL, 0); |
755 |
+ if (ret) |
756 |
+ return ret; |
757 |
+- if ((le32_to_cpu(log_new.new_map) != map_entry) && |
758 |
+- (le32_to_cpu(log_new.old_map) == map_entry)) { |
759 |
++ |
760 |
++ /* |
761 |
++ * The map_entry from btt_read_map is stripped of any flag bits, |
762 |
++ * so use the stripped out versions from the log as well for |
763 |
++ * testing whether recovery is needed. For restoration, use the |
764 |
++ * 'raw' version of the log entries as that captured what we |
765 |
++ * were going to write originally. |
766 |
++ */ |
767 |
++ if ((log_newmap != map_entry) && (log_oldmap == map_entry)) { |
768 |
+ /* |
769 |
+ * Last transaction wrote the flog, but wasn't able |
770 |
+ * to complete the map write. So fix up the map. |
771 |
+diff --git a/drivers/nvdimm/btt.h b/drivers/nvdimm/btt.h |
772 |
+index 2609683c4167..c3e6a5da2ec7 100644 |
773 |
+--- a/drivers/nvdimm/btt.h |
774 |
++++ b/drivers/nvdimm/btt.h |
775 |
+@@ -44,6 +44,8 @@ |
776 |
+ #define ent_e_flag(ent) (!!(ent & MAP_ERR_MASK)) |
777 |
+ #define ent_z_flag(ent) (!!(ent & MAP_TRIM_MASK)) |
778 |
+ #define set_e_flag(ent) (ent |= MAP_ERR_MASK) |
779 |
++/* 'normal' is both e and z flags set */ |
780 |
++#define ent_normal(ent) (ent_e_flag(ent) && ent_z_flag(ent)) |
781 |
+ |
782 |
+ enum btt_init_state { |
783 |
+ INIT_UNCHECKED = 0, |
784 |
+diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c |
785 |
+index e610dd890263..76a74e292fd7 100644 |
786 |
+--- a/drivers/nvdimm/btt_devs.c |
787 |
++++ b/drivers/nvdimm/btt_devs.c |
788 |
+@@ -159,11 +159,19 @@ static ssize_t size_show(struct device *dev, |
789 |
+ } |
790 |
+ static DEVICE_ATTR_RO(size); |
791 |
+ |
792 |
++static ssize_t log_zero_flags_show(struct device *dev, |
793 |
++ struct device_attribute *attr, char *buf) |
794 |
++{ |
795 |
++ return sprintf(buf, "Y\n"); |
796 |
++} |
797 |
++static DEVICE_ATTR_RO(log_zero_flags); |
798 |
++ |
799 |
+ static struct attribute *nd_btt_attributes[] = { |
800 |
+ &dev_attr_sector_size.attr, |
801 |
+ &dev_attr_namespace.attr, |
802 |
+ &dev_attr_uuid.attr, |
803 |
+ &dev_attr_size.attr, |
804 |
++ &dev_attr_log_zero_flags.attr, |
805 |
+ NULL, |
806 |
+ }; |
807 |
+ |
808 |
+diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
809 |
+index 59f3a37a44d7..8db2dc05b8cf 100644 |
810 |
+--- a/drivers/platform/x86/asus-nb-wmi.c |
811 |
++++ b/drivers/platform/x86/asus-nb-wmi.c |
812 |
+@@ -517,9 +517,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { |
813 |
+ .detect_quirks = asus_nb_wmi_quirks, |
814 |
+ }; |
815 |
+ |
816 |
++static const struct dmi_system_id asus_nb_wmi_blacklist[] __initconst = { |
817 |
++ { |
818 |
++ /* |
819 |
++ * asus-nb-wm adds no functionality. The T100TA has a detachable |
820 |
++ * USB kbd, so no hotkeys and it has no WMI rfkill; and loading |
821 |
++ * asus-nb-wm causes the camera LED to turn and _stay_ on. |
822 |
++ */ |
823 |
++ .matches = { |
824 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
825 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"), |
826 |
++ }, |
827 |
++ }, |
828 |
++ { |
829 |
++ /* The Asus T200TA has the same issue as the T100TA */ |
830 |
++ .matches = { |
831 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
832 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T200TA"), |
833 |
++ }, |
834 |
++ }, |
835 |
++ {} /* Terminating entry */ |
836 |
++}; |
837 |
+ |
838 |
+ static int __init asus_nb_wmi_init(void) |
839 |
+ { |
840 |
++ if (dmi_check_system(asus_nb_wmi_blacklist)) |
841 |
++ return -ENODEV; |
842 |
++ |
843 |
+ return asus_wmi_register_driver(&asus_nb_wmi_driver); |
844 |
+ } |
845 |
+ |
846 |
+diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c |
847 |
+index ecd71efe8ea0..f15f6d1e1070 100644 |
848 |
+--- a/drivers/rapidio/devices/rio_mport_cdev.c |
849 |
++++ b/drivers/rapidio/devices/rio_mport_cdev.c |
850 |
+@@ -904,6 +904,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, |
851 |
+ rmcd_error("pinned %ld out of %ld pages", |
852 |
+ pinned, nr_pages); |
853 |
+ ret = -EFAULT; |
854 |
++ /* |
855 |
++ * Set nr_pages up to mean "how many pages to unpin, in |
856 |
++ * the error handler: |
857 |
++ */ |
858 |
++ nr_pages = pinned; |
859 |
+ goto err_pg; |
860 |
+ } |
861 |
+ |
862 |
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c |
863 |
+index 07c23bbd968c..83645a1c6f82 100644 |
864 |
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c |
865 |
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c |
866 |
+@@ -2299,16 +2299,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) |
867 |
+ static int ibmvscsi_remove(struct vio_dev *vdev) |
868 |
+ { |
869 |
+ struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev); |
870 |
+- unsigned long flags; |
871 |
+ |
872 |
+ srp_remove_host(hostdata->host); |
873 |
+ scsi_remove_host(hostdata->host); |
874 |
+ |
875 |
+ purge_requests(hostdata, DID_ERROR); |
876 |
+- |
877 |
+- spin_lock_irqsave(hostdata->host->host_lock, flags); |
878 |
+ release_event_pool(&hostdata->pool, hostdata); |
879 |
+- spin_unlock_irqrestore(hostdata->host->host_lock, flags); |
880 |
+ |
881 |
+ ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, |
882 |
+ max_events); |
883 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
884 |
+index 5e8ae510aef8..9d9737114dcf 100644 |
885 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
886 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
887 |
+@@ -2998,7 +2998,7 @@ qla24xx_abort_command(srb_t *sp) |
888 |
+ ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108c, |
889 |
+ "Entered %s.\n", __func__); |
890 |
+ |
891 |
+- if (vha->flags.qpairs_available && sp->qpair) |
892 |
++ if (sp->qpair) |
893 |
+ req = sp->qpair->req; |
894 |
+ |
895 |
+ if (ql2xasynctmfenable) |
896 |
+diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c |
897 |
+index c6d01b800d3c..2b297df88bdd 100644 |
898 |
+--- a/drivers/staging/greybus/uart.c |
899 |
++++ b/drivers/staging/greybus/uart.c |
900 |
+@@ -538,9 +538,9 @@ static void gb_tty_set_termios(struct tty_struct *tty, |
901 |
+ } |
902 |
+ |
903 |
+ if (C_CRTSCTS(tty) && C_BAUD(tty) != B0) |
904 |
+- newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN; |
905 |
++ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN; |
906 |
+ else |
907 |
+- newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN; |
908 |
++ newline.flow_control = 0; |
909 |
+ |
910 |
+ if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) { |
911 |
+ memcpy(&gb_tty->line_coding, &newline, sizeof(newline)); |
912 |
+diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c |
913 |
+index 3e00df74b18c..989d5eca8861 100644 |
914 |
+--- a/drivers/staging/iio/resolver/ad2s1210.c |
915 |
++++ b/drivers/staging/iio/resolver/ad2s1210.c |
916 |
+@@ -126,17 +126,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data) |
917 |
+ static int ad2s1210_config_read(struct ad2s1210_state *st, |
918 |
+ unsigned char address) |
919 |
+ { |
920 |
+- struct spi_transfer xfer = { |
921 |
+- .len = 2, |
922 |
+- .rx_buf = st->rx, |
923 |
+- .tx_buf = st->tx, |
924 |
++ struct spi_transfer xfers[] = { |
925 |
++ { |
926 |
++ .len = 1, |
927 |
++ .rx_buf = &st->rx[0], |
928 |
++ .tx_buf = &st->tx[0], |
929 |
++ .cs_change = 1, |
930 |
++ }, { |
931 |
++ .len = 1, |
932 |
++ .rx_buf = &st->rx[1], |
933 |
++ .tx_buf = &st->tx[1], |
934 |
++ }, |
935 |
+ }; |
936 |
+ int ret = 0; |
937 |
+ |
938 |
+ ad2s1210_set_mode(MOD_CONFIG, st); |
939 |
+ st->tx[0] = address | AD2S1210_MSB_IS_HIGH; |
940 |
+ st->tx[1] = AD2S1210_REG_FAULT; |
941 |
+- ret = spi_sync_transfer(st->sdev, &xfer, 1); |
942 |
++ ret = spi_sync_transfer(st->sdev, xfers, 2); |
943 |
+ if (ret < 0) |
944 |
+ return ret; |
945 |
+ st->old_data = true; |
946 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
947 |
+index 00e80cfe614c..298c91f83aee 100644 |
948 |
+--- a/drivers/usb/core/message.c |
949 |
++++ b/drivers/usb/core/message.c |
950 |
+@@ -1082,11 +1082,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, |
951 |
+ |
952 |
+ if (usb_endpoint_out(epaddr)) { |
953 |
+ ep = dev->ep_out[epnum]; |
954 |
+- if (reset_hardware) |
955 |
++ if (reset_hardware && epnum != 0) |
956 |
+ dev->ep_out[epnum] = NULL; |
957 |
+ } else { |
958 |
+ ep = dev->ep_in[epnum]; |
959 |
+- if (reset_hardware) |
960 |
++ if (reset_hardware && epnum != 0) |
961 |
+ dev->ep_in[epnum] = NULL; |
962 |
+ } |
963 |
+ if (ep) { |
964 |
+diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c |
965 |
+index 834e88e20550..3f2f34ebf51f 100644 |
966 |
+--- a/drivers/vhost/vsock.c |
967 |
++++ b/drivers/vhost/vsock.c |
968 |
+@@ -182,14 +182,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, |
969 |
+ break; |
970 |
+ } |
971 |
+ |
972 |
+- vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); |
973 |
+- added = true; |
974 |
+- |
975 |
+- /* Deliver to monitoring devices all correctly transmitted |
976 |
+- * packets. |
977 |
++ /* Deliver to monitoring devices all packets that we |
978 |
++ * will transmit. |
979 |
+ */ |
980 |
+ virtio_transport_deliver_tap_pkt(pkt); |
981 |
+ |
982 |
++ vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len); |
983 |
++ added = true; |
984 |
++ |
985 |
+ pkt->off += payload_len; |
986 |
+ total_len += payload_len; |
987 |
+ |
988 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
989 |
+index 52e03f1c76e3..21c3ffdc8a09 100644 |
990 |
+--- a/drivers/watchdog/watchdog_dev.c |
991 |
++++ b/drivers/watchdog/watchdog_dev.c |
992 |
+@@ -38,7 +38,6 @@ |
993 |
+ #include <linux/init.h> /* For __init/__exit/... */ |
994 |
+ #include <linux/jiffies.h> /* For timeout functions */ |
995 |
+ #include <linux/kernel.h> /* For printk/panic/... */ |
996 |
+-#include <linux/kref.h> /* For data references */ |
997 |
+ #include <linux/miscdevice.h> /* For handling misc devices */ |
998 |
+ #include <linux/module.h> /* For module stuff/... */ |
999 |
+ #include <linux/mutex.h> /* For mutexes */ |
1000 |
+@@ -53,14 +52,14 @@ |
1001 |
+ |
1002 |
+ /* |
1003 |
+ * struct watchdog_core_data - watchdog core internal data |
1004 |
+- * @kref: Reference count. |
1005 |
++ * @dev: The watchdog's internal device |
1006 |
+ * @cdev: The watchdog's Character device. |
1007 |
+ * @wdd: Pointer to watchdog device. |
1008 |
+ * @lock: Lock for watchdog core. |
1009 |
+ * @status: Watchdog core internal status bits. |
1010 |
+ */ |
1011 |
+ struct watchdog_core_data { |
1012 |
+- struct kref kref; |
1013 |
++ struct device dev; |
1014 |
+ struct cdev cdev; |
1015 |
+ struct watchdog_device *wdd; |
1016 |
+ struct mutex lock; |
1017 |
+@@ -802,7 +801,7 @@ static int watchdog_open(struct inode *inode, struct file *file) |
1018 |
+ file->private_data = wd_data; |
1019 |
+ |
1020 |
+ if (!hw_running) |
1021 |
+- kref_get(&wd_data->kref); |
1022 |
++ get_device(&wd_data->dev); |
1023 |
+ |
1024 |
+ /* dev/watchdog is a virtual (and thus non-seekable) filesystem */ |
1025 |
+ return nonseekable_open(inode, file); |
1026 |
+@@ -814,11 +813,11 @@ out_clear: |
1027 |
+ return err; |
1028 |
+ } |
1029 |
+ |
1030 |
+-static void watchdog_core_data_release(struct kref *kref) |
1031 |
++static void watchdog_core_data_release(struct device *dev) |
1032 |
+ { |
1033 |
+ struct watchdog_core_data *wd_data; |
1034 |
+ |
1035 |
+- wd_data = container_of(kref, struct watchdog_core_data, kref); |
1036 |
++ wd_data = container_of(dev, struct watchdog_core_data, dev); |
1037 |
+ |
1038 |
+ kfree(wd_data); |
1039 |
+ } |
1040 |
+@@ -878,7 +877,7 @@ done: |
1041 |
+ */ |
1042 |
+ if (!running) { |
1043 |
+ module_put(wd_data->cdev.owner); |
1044 |
+- kref_put(&wd_data->kref, watchdog_core_data_release); |
1045 |
++ put_device(&wd_data->dev); |
1046 |
+ } |
1047 |
+ return 0; |
1048 |
+ } |
1049 |
+@@ -897,17 +896,22 @@ static struct miscdevice watchdog_miscdev = { |
1050 |
+ .fops = &watchdog_fops, |
1051 |
+ }; |
1052 |
+ |
1053 |
++static struct class watchdog_class = { |
1054 |
++ .name = "watchdog", |
1055 |
++ .owner = THIS_MODULE, |
1056 |
++ .dev_groups = wdt_groups, |
1057 |
++}; |
1058 |
++ |
1059 |
+ /* |
1060 |
+ * watchdog_cdev_register: register watchdog character device |
1061 |
+ * @wdd: watchdog device |
1062 |
+- * @devno: character device number |
1063 |
+ * |
1064 |
+ * Register a watchdog character device including handling the legacy |
1065 |
+ * /dev/watchdog node. /dev/watchdog is actually a miscdevice and |
1066 |
+ * thus we set it up like that. |
1067 |
+ */ |
1068 |
+ |
1069 |
+-static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno) |
1070 |
++static int watchdog_cdev_register(struct watchdog_device *wdd) |
1071 |
+ { |
1072 |
+ struct watchdog_core_data *wd_data; |
1073 |
+ int err; |
1074 |
+@@ -915,7 +919,6 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno) |
1075 |
+ wd_data = kzalloc(sizeof(struct watchdog_core_data), GFP_KERNEL); |
1076 |
+ if (!wd_data) |
1077 |
+ return -ENOMEM; |
1078 |
+- kref_init(&wd_data->kref); |
1079 |
+ mutex_init(&wd_data->lock); |
1080 |
+ |
1081 |
+ wd_data->wdd = wdd; |
1082 |
+@@ -942,23 +945,33 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno) |
1083 |
+ } |
1084 |
+ } |
1085 |
+ |
1086 |
++ device_initialize(&wd_data->dev); |
1087 |
++ wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id); |
1088 |
++ wd_data->dev.class = &watchdog_class; |
1089 |
++ wd_data->dev.parent = wdd->parent; |
1090 |
++ wd_data->dev.groups = wdd->groups; |
1091 |
++ wd_data->dev.release = watchdog_core_data_release; |
1092 |
++ dev_set_drvdata(&wd_data->dev, wdd); |
1093 |
++ dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); |
1094 |
++ |
1095 |
+ /* Fill in the data structures */ |
1096 |
+ cdev_init(&wd_data->cdev, &watchdog_fops); |
1097 |
+- wd_data->cdev.owner = wdd->ops->owner; |
1098 |
+ |
1099 |
+ /* Add the device */ |
1100 |
+- err = cdev_add(&wd_data->cdev, devno, 1); |
1101 |
++ err = cdev_device_add(&wd_data->cdev, &wd_data->dev); |
1102 |
+ if (err) { |
1103 |
+ pr_err("watchdog%d unable to add device %d:%d\n", |
1104 |
+ wdd->id, MAJOR(watchdog_devt), wdd->id); |
1105 |
+ if (wdd->id == 0) { |
1106 |
+ misc_deregister(&watchdog_miscdev); |
1107 |
+ old_wd_data = NULL; |
1108 |
+- kref_put(&wd_data->kref, watchdog_core_data_release); |
1109 |
++ put_device(&wd_data->dev); |
1110 |
+ } |
1111 |
+ return err; |
1112 |
+ } |
1113 |
+ |
1114 |
++ wd_data->cdev.owner = wdd->ops->owner; |
1115 |
++ |
1116 |
+ /* Record time of most recent heartbeat as 'just before now'. */ |
1117 |
+ wd_data->last_hw_keepalive = jiffies - 1; |
1118 |
+ |
1119 |
+@@ -968,7 +981,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno) |
1120 |
+ */ |
1121 |
+ if (watchdog_hw_running(wdd)) { |
1122 |
+ __module_get(wdd->ops->owner); |
1123 |
+- kref_get(&wd_data->kref); |
1124 |
++ get_device(&wd_data->dev); |
1125 |
+ if (handle_boot_enabled) |
1126 |
+ queue_delayed_work(watchdog_wq, &wd_data->work, 0); |
1127 |
+ else |
1128 |
+@@ -991,7 +1004,7 @@ static void watchdog_cdev_unregister(struct watchdog_device *wdd) |
1129 |
+ { |
1130 |
+ struct watchdog_core_data *wd_data = wdd->wd_data; |
1131 |
+ |
1132 |
+- cdev_del(&wd_data->cdev); |
1133 |
++ cdev_device_del(&wd_data->cdev, &wd_data->dev); |
1134 |
+ if (wdd->id == 0) { |
1135 |
+ misc_deregister(&watchdog_miscdev); |
1136 |
+ old_wd_data = NULL; |
1137 |
+@@ -1009,15 +1022,9 @@ static void watchdog_cdev_unregister(struct watchdog_device *wdd) |
1138 |
+ |
1139 |
+ cancel_delayed_work_sync(&wd_data->work); |
1140 |
+ |
1141 |
+- kref_put(&wd_data->kref, watchdog_core_data_release); |
1142 |
++ put_device(&wd_data->dev); |
1143 |
+ } |
1144 |
+ |
1145 |
+-static struct class watchdog_class = { |
1146 |
+- .name = "watchdog", |
1147 |
+- .owner = THIS_MODULE, |
1148 |
+- .dev_groups = wdt_groups, |
1149 |
+-}; |
1150 |
+- |
1151 |
+ /* |
1152 |
+ * watchdog_dev_register: register a watchdog device |
1153 |
+ * @wdd: watchdog device |
1154 |
+@@ -1029,27 +1036,14 @@ static struct class watchdog_class = { |
1155 |
+ |
1156 |
+ int watchdog_dev_register(struct watchdog_device *wdd) |
1157 |
+ { |
1158 |
+- struct device *dev; |
1159 |
+- dev_t devno; |
1160 |
+ int ret; |
1161 |
+ |
1162 |
+- devno = MKDEV(MAJOR(watchdog_devt), wdd->id); |
1163 |
+- |
1164 |
+- ret = watchdog_cdev_register(wdd, devno); |
1165 |
++ ret = watchdog_cdev_register(wdd); |
1166 |
+ if (ret) |
1167 |
+ return ret; |
1168 |
+ |
1169 |
+- dev = device_create_with_groups(&watchdog_class, wdd->parent, |
1170 |
+- devno, wdd, wdd->groups, |
1171 |
+- "watchdog%d", wdd->id); |
1172 |
+- if (IS_ERR(dev)) { |
1173 |
+- watchdog_cdev_unregister(wdd); |
1174 |
+- return PTR_ERR(dev); |
1175 |
+- } |
1176 |
+- |
1177 |
+ ret = watchdog_register_pretimeout(wdd); |
1178 |
+ if (ret) { |
1179 |
+- device_destroy(&watchdog_class, devno); |
1180 |
+ watchdog_cdev_unregister(wdd); |
1181 |
+ } |
1182 |
+ |
1183 |
+@@ -1067,7 +1061,6 @@ int watchdog_dev_register(struct watchdog_device *wdd) |
1184 |
+ void watchdog_dev_unregister(struct watchdog_device *wdd) |
1185 |
+ { |
1186 |
+ watchdog_unregister_pretimeout(wdd); |
1187 |
+- device_destroy(&watchdog_class, wdd->wd_data->cdev.dev); |
1188 |
+ watchdog_cdev_unregister(wdd); |
1189 |
+ } |
1190 |
+ |
1191 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
1192 |
+index 1b5a50848b5b..589cfe3ed873 100644 |
1193 |
+--- a/fs/ceph/caps.c |
1194 |
++++ b/fs/ceph/caps.c |
1195 |
+@@ -3502,6 +3502,7 @@ retry: |
1196 |
+ WARN_ON(1); |
1197 |
+ tsession = NULL; |
1198 |
+ target = -1; |
1199 |
++ mutex_lock(&session->s_mutex); |
1200 |
+ } |
1201 |
+ goto retry; |
1202 |
+ |
1203 |
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c |
1204 |
+index c2ef617d2f97..c875f246cb0e 100644 |
1205 |
+--- a/fs/configfs/dir.c |
1206 |
++++ b/fs/configfs/dir.c |
1207 |
+@@ -1537,6 +1537,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) |
1208 |
+ spin_lock(&configfs_dirent_lock); |
1209 |
+ configfs_detach_rollback(dentry); |
1210 |
+ spin_unlock(&configfs_dirent_lock); |
1211 |
++ config_item_put(parent_item); |
1212 |
+ return -EINTR; |
1213 |
+ } |
1214 |
+ frag->frag_dead = true; |
1215 |
+diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c |
1216 |
+index 13eb028607ca..3cbee832e796 100644 |
1217 |
+--- a/fs/ext4/block_validity.c |
1218 |
++++ b/fs/ext4/block_validity.c |
1219 |
+@@ -153,6 +153,7 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) |
1220 |
+ return PTR_ERR(inode); |
1221 |
+ num = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
1222 |
+ while (i < num) { |
1223 |
++ cond_resched(); |
1224 |
+ map.m_lblk = i; |
1225 |
+ map.m_len = num - i; |
1226 |
+ n = ext4_map_blocks(NULL, inode, &map, 0); |
1227 |
+diff --git a/fs/file.c b/fs/file.c |
1228 |
+index 0c25b980affe..97c6f0df39da 100644 |
1229 |
+--- a/fs/file.c |
1230 |
++++ b/fs/file.c |
1231 |
+@@ -75,7 +75,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt, |
1232 |
+ */ |
1233 |
+ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt) |
1234 |
+ { |
1235 |
+- unsigned int cpy, set; |
1236 |
++ size_t cpy, set; |
1237 |
+ |
1238 |
+ BUG_ON(nfdt->max_fds < ofdt->max_fds); |
1239 |
+ |
1240 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
1241 |
+index 1e2ff4b32c79..aea1ed0aebd0 100644 |
1242 |
+--- a/fs/gfs2/glock.c |
1243 |
++++ b/fs/gfs2/glock.c |
1244 |
+@@ -636,9 +636,6 @@ __acquires(&gl->gl_lockref.lock) |
1245 |
+ goto out_unlock; |
1246 |
+ if (nonblock) |
1247 |
+ goto out_sched; |
1248 |
+- smp_mb(); |
1249 |
+- if (atomic_read(&gl->gl_revokes) != 0) |
1250 |
+- goto out_sched; |
1251 |
+ set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags); |
1252 |
+ GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE); |
1253 |
+ gl->gl_target = gl->gl_demote_state; |
1254 |
+diff --git a/include/linux/padata.h b/include/linux/padata.h |
1255 |
+index 2f9c1f93b1ce..d803397a28f7 100644 |
1256 |
+--- a/include/linux/padata.h |
1257 |
++++ b/include/linux/padata.h |
1258 |
+@@ -24,7 +24,6 @@ |
1259 |
+ #include <linux/workqueue.h> |
1260 |
+ #include <linux/spinlock.h> |
1261 |
+ #include <linux/list.h> |
1262 |
+-#include <linux/timer.h> |
1263 |
+ #include <linux/notifier.h> |
1264 |
+ #include <linux/kobject.h> |
1265 |
+ |
1266 |
+@@ -37,6 +36,7 @@ |
1267 |
+ * @list: List entry, to attach to the padata lists. |
1268 |
+ * @pd: Pointer to the internal control structure. |
1269 |
+ * @cb_cpu: Callback cpu for serializatioon. |
1270 |
++ * @cpu: Cpu for parallelization. |
1271 |
+ * @seq_nr: Sequence number of the parallelized data object. |
1272 |
+ * @info: Used to pass information from the parallel to the serial function. |
1273 |
+ * @parallel: Parallel execution function. |
1274 |
+@@ -46,6 +46,7 @@ struct padata_priv { |
1275 |
+ struct list_head list; |
1276 |
+ struct parallel_data *pd; |
1277 |
+ int cb_cpu; |
1278 |
++ int cpu; |
1279 |
+ int info; |
1280 |
+ void (*parallel)(struct padata_priv *padata); |
1281 |
+ void (*serial)(struct padata_priv *padata); |
1282 |
+@@ -83,7 +84,6 @@ struct padata_serial_queue { |
1283 |
+ * @serial: List to wait for serialization after reordering. |
1284 |
+ * @pwork: work struct for parallelization. |
1285 |
+ * @swork: work struct for serialization. |
1286 |
+- * @pd: Backpointer to the internal control structure. |
1287 |
+ * @work: work struct for parallelization. |
1288 |
+ * @num_obj: Number of objects that are processed by this cpu. |
1289 |
+ * @cpu_index: Index of the cpu. |
1290 |
+@@ -91,7 +91,6 @@ struct padata_serial_queue { |
1291 |
+ struct padata_parallel_queue { |
1292 |
+ struct padata_list parallel; |
1293 |
+ struct padata_list reorder; |
1294 |
+- struct parallel_data *pd; |
1295 |
+ struct work_struct work; |
1296 |
+ atomic_t num_obj; |
1297 |
+ int cpu_index; |
1298 |
+@@ -118,10 +117,10 @@ struct padata_cpumask { |
1299 |
+ * @reorder_objects: Number of objects waiting in the reorder queues. |
1300 |
+ * @refcnt: Number of objects holding a reference on this parallel_data. |
1301 |
+ * @max_seq_nr: Maximal used sequence number. |
1302 |
++ * @cpu: Next CPU to be processed. |
1303 |
+ * @cpumask: The cpumasks in use for parallel and serial workers. |
1304 |
++ * @reorder_work: work struct for reordering. |
1305 |
+ * @lock: Reorder lock. |
1306 |
+- * @processed: Number of already processed objects. |
1307 |
+- * @timer: Reorder timer. |
1308 |
+ */ |
1309 |
+ struct parallel_data { |
1310 |
+ struct padata_instance *pinst; |
1311 |
+@@ -130,10 +129,10 @@ struct parallel_data { |
1312 |
+ atomic_t reorder_objects; |
1313 |
+ atomic_t refcnt; |
1314 |
+ atomic_t seq_nr; |
1315 |
++ int cpu; |
1316 |
+ struct padata_cpumask cpumask; |
1317 |
++ struct work_struct reorder_work; |
1318 |
+ spinlock_t lock ____cacheline_aligned; |
1319 |
+- unsigned int processed; |
1320 |
+- struct timer_list timer; |
1321 |
+ }; |
1322 |
+ |
1323 |
+ /** |
1324 |
+diff --git a/kernel/padata.c b/kernel/padata.c |
1325 |
+index a71620d2b8ba..f56ec63f60ba 100644 |
1326 |
+--- a/kernel/padata.c |
1327 |
++++ b/kernel/padata.c |
1328 |
+@@ -133,6 +133,7 @@ int padata_do_parallel(struct padata_instance *pinst, |
1329 |
+ padata->cb_cpu = cb_cpu; |
1330 |
+ |
1331 |
+ target_cpu = padata_cpu_hash(pd); |
1332 |
++ padata->cpu = target_cpu; |
1333 |
+ queue = per_cpu_ptr(pd->pqueue, target_cpu); |
1334 |
+ |
1335 |
+ spin_lock(&queue->parallel.lock); |
1336 |
+@@ -165,23 +166,12 @@ EXPORT_SYMBOL(padata_do_parallel); |
1337 |
+ */ |
1338 |
+ static struct padata_priv *padata_get_next(struct parallel_data *pd) |
1339 |
+ { |
1340 |
+- int cpu, num_cpus; |
1341 |
+- unsigned int next_nr, next_index; |
1342 |
+ struct padata_parallel_queue *next_queue; |
1343 |
+ struct padata_priv *padata; |
1344 |
+ struct padata_list *reorder; |
1345 |
++ int cpu = pd->cpu; |
1346 |
+ |
1347 |
+- num_cpus = cpumask_weight(pd->cpumask.pcpu); |
1348 |
+- |
1349 |
+- /* |
1350 |
+- * Calculate the percpu reorder queue and the sequence |
1351 |
+- * number of the next object. |
1352 |
+- */ |
1353 |
+- next_nr = pd->processed; |
1354 |
+- next_index = next_nr % num_cpus; |
1355 |
+- cpu = padata_index_to_cpu(pd, next_index); |
1356 |
+ next_queue = per_cpu_ptr(pd->pqueue, cpu); |
1357 |
+- |
1358 |
+ reorder = &next_queue->reorder; |
1359 |
+ |
1360 |
+ spin_lock(&reorder->lock); |
1361 |
+@@ -192,7 +182,8 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd) |
1362 |
+ list_del_init(&padata->list); |
1363 |
+ atomic_dec(&pd->reorder_objects); |
1364 |
+ |
1365 |
+- pd->processed++; |
1366 |
++ pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, |
1367 |
++ false); |
1368 |
+ |
1369 |
+ spin_unlock(&reorder->lock); |
1370 |
+ goto out; |
1371 |
+@@ -215,6 +206,7 @@ static void padata_reorder(struct parallel_data *pd) |
1372 |
+ struct padata_priv *padata; |
1373 |
+ struct padata_serial_queue *squeue; |
1374 |
+ struct padata_instance *pinst = pd->pinst; |
1375 |
++ struct padata_parallel_queue *next_queue; |
1376 |
+ |
1377 |
+ /* |
1378 |
+ * We need to ensure that only one cpu can work on dequeueing of |
1379 |
+@@ -246,7 +238,6 @@ static void padata_reorder(struct parallel_data *pd) |
1380 |
+ * so exit immediately. |
1381 |
+ */ |
1382 |
+ if (PTR_ERR(padata) == -ENODATA) { |
1383 |
+- del_timer(&pd->timer); |
1384 |
+ spin_unlock_bh(&pd->lock); |
1385 |
+ return; |
1386 |
+ } |
1387 |
+@@ -265,28 +256,27 @@ static void padata_reorder(struct parallel_data *pd) |
1388 |
+ |
1389 |
+ /* |
1390 |
+ * The next object that needs serialization might have arrived to |
1391 |
+- * the reorder queues in the meantime, we will be called again |
1392 |
+- * from the timer function if no one else cares for it. |
1393 |
++ * the reorder queues in the meantime. |
1394 |
+ * |
1395 |
+- * Ensure reorder_objects is read after pd->lock is dropped so we see |
1396 |
+- * an increment from another task in padata_do_serial. Pairs with |
1397 |
++ * Ensure reorder queue is read after pd->lock is dropped so we see |
1398 |
++ * new objects from another task in padata_do_serial. Pairs with |
1399 |
+ * smp_mb__after_atomic in padata_do_serial. |
1400 |
+ */ |
1401 |
+ smp_mb(); |
1402 |
+- if (atomic_read(&pd->reorder_objects) |
1403 |
+- && !(pinst->flags & PADATA_RESET)) |
1404 |
+- mod_timer(&pd->timer, jiffies + HZ); |
1405 |
+- else |
1406 |
+- del_timer(&pd->timer); |
1407 |
+ |
1408 |
+- return; |
1409 |
++ next_queue = per_cpu_ptr(pd->pqueue, pd->cpu); |
1410 |
++ if (!list_empty(&next_queue->reorder.list)) |
1411 |
++ queue_work(pinst->wq, &pd->reorder_work); |
1412 |
+ } |
1413 |
+ |
1414 |
+-static void padata_reorder_timer(unsigned long arg) |
1415 |
++static void invoke_padata_reorder(struct work_struct *work) |
1416 |
+ { |
1417 |
+- struct parallel_data *pd = (struct parallel_data *)arg; |
1418 |
++ struct parallel_data *pd; |
1419 |
+ |
1420 |
++ local_bh_disable(); |
1421 |
++ pd = container_of(work, struct parallel_data, reorder_work); |
1422 |
+ padata_reorder(pd); |
1423 |
++ local_bh_enable(); |
1424 |
+ } |
1425 |
+ |
1426 |
+ static void padata_serial_worker(struct work_struct *serial_work) |
1427 |
+@@ -333,29 +323,22 @@ static void padata_serial_worker(struct work_struct *serial_work) |
1428 |
+ */ |
1429 |
+ void padata_do_serial(struct padata_priv *padata) |
1430 |
+ { |
1431 |
+- int cpu; |
1432 |
+- struct padata_parallel_queue *pqueue; |
1433 |
+- struct parallel_data *pd; |
1434 |
+- |
1435 |
+- pd = padata->pd; |
1436 |
+- |
1437 |
+- cpu = get_cpu(); |
1438 |
+- pqueue = per_cpu_ptr(pd->pqueue, cpu); |
1439 |
++ struct parallel_data *pd = padata->pd; |
1440 |
++ struct padata_parallel_queue *pqueue = per_cpu_ptr(pd->pqueue, |
1441 |
++ padata->cpu); |
1442 |
+ |
1443 |
+ spin_lock(&pqueue->reorder.lock); |
1444 |
+- atomic_inc(&pd->reorder_objects); |
1445 |
+ list_add_tail(&padata->list, &pqueue->reorder.list); |
1446 |
++ atomic_inc(&pd->reorder_objects); |
1447 |
+ spin_unlock(&pqueue->reorder.lock); |
1448 |
+ |
1449 |
+ /* |
1450 |
+- * Ensure the atomic_inc of reorder_objects above is ordered correctly |
1451 |
++ * Ensure the addition to the reorder list is ordered correctly |
1452 |
+ * with the trylock of pd->lock in padata_reorder. Pairs with smp_mb |
1453 |
+ * in padata_reorder. |
1454 |
+ */ |
1455 |
+ smp_mb__after_atomic(); |
1456 |
+ |
1457 |
+- put_cpu(); |
1458 |
+- |
1459 |
+ padata_reorder(pd); |
1460 |
+ } |
1461 |
+ EXPORT_SYMBOL(padata_do_serial); |
1462 |
+@@ -404,9 +387,14 @@ static void padata_init_pqueues(struct parallel_data *pd) |
1463 |
+ struct padata_parallel_queue *pqueue; |
1464 |
+ |
1465 |
+ cpu_index = 0; |
1466 |
+- for_each_cpu(cpu, pd->cpumask.pcpu) { |
1467 |
++ for_each_possible_cpu(cpu) { |
1468 |
+ pqueue = per_cpu_ptr(pd->pqueue, cpu); |
1469 |
+- pqueue->pd = pd; |
1470 |
++ |
1471 |
++ if (!cpumask_test_cpu(cpu, pd->cpumask.pcpu)) { |
1472 |
++ pqueue->cpu_index = -1; |
1473 |
++ continue; |
1474 |
++ } |
1475 |
++ |
1476 |
+ pqueue->cpu_index = cpu_index; |
1477 |
+ cpu_index++; |
1478 |
+ |
1479 |
+@@ -440,12 +428,13 @@ static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst, |
1480 |
+ |
1481 |
+ padata_init_pqueues(pd); |
1482 |
+ padata_init_squeues(pd); |
1483 |
+- setup_timer(&pd->timer, padata_reorder_timer, (unsigned long)pd); |
1484 |
+ atomic_set(&pd->seq_nr, -1); |
1485 |
+ atomic_set(&pd->reorder_objects, 0); |
1486 |
+ atomic_set(&pd->refcnt, 1); |
1487 |
+ pd->pinst = pinst; |
1488 |
+ spin_lock_init(&pd->lock); |
1489 |
++ pd->cpu = cpumask_first(pd->cpumask.pcpu); |
1490 |
++ INIT_WORK(&pd->reorder_work, invoke_padata_reorder); |
1491 |
+ |
1492 |
+ return pd; |
1493 |
+ |
1494 |
+diff --git a/lib/Makefile b/lib/Makefile |
1495 |
+index 4ea31c2d982d..ae2d261daec9 100644 |
1496 |
+--- a/lib/Makefile |
1497 |
++++ b/lib/Makefile |
1498 |
+@@ -256,6 +256,8 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string.o |
1499 |
+ obj-$(CONFIG_UBSAN) += ubsan.o |
1500 |
+ |
1501 |
+ UBSAN_SANITIZE_ubsan.o := n |
1502 |
++KASAN_SANITIZE_ubsan.o := n |
1503 |
++CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN) |
1504 |
+ |
1505 |
+ obj-$(CONFIG_SBITMAP) += sbitmap.o |
1506 |
+ |
1507 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
1508 |
+index b8c90f8d1a57..c3f8bac32584 100644 |
1509 |
+--- a/net/l2tp/l2tp_core.c |
1510 |
++++ b/net/l2tp/l2tp_core.c |
1511 |
+@@ -328,8 +328,8 @@ struct l2tp_session *l2tp_session_get_by_ifname(const struct net *net, |
1512 |
+ } |
1513 |
+ EXPORT_SYMBOL_GPL(l2tp_session_get_by_ifname); |
1514 |
+ |
1515 |
+-static int l2tp_session_add_to_tunnel(struct l2tp_tunnel *tunnel, |
1516 |
+- struct l2tp_session *session) |
1517 |
++int l2tp_session_register(struct l2tp_session *session, |
1518 |
++ struct l2tp_tunnel *tunnel) |
1519 |
+ { |
1520 |
+ struct l2tp_session *session_walk; |
1521 |
+ struct hlist_head *g_head; |
1522 |
+@@ -382,6 +382,10 @@ static int l2tp_session_add_to_tunnel(struct l2tp_tunnel *tunnel, |
1523 |
+ hlist_add_head(&session->hlist, head); |
1524 |
+ write_unlock_bh(&tunnel->hlist_lock); |
1525 |
+ |
1526 |
++ /* Ignore management session in session count value */ |
1527 |
++ if (session->session_id != 0) |
1528 |
++ atomic_inc(&l2tp_session_count); |
1529 |
++ |
1530 |
+ return 0; |
1531 |
+ |
1532 |
+ err_tlock_pnlock: |
1533 |
+@@ -391,6 +395,7 @@ err_tlock: |
1534 |
+ |
1535 |
+ return err; |
1536 |
+ } |
1537 |
++EXPORT_SYMBOL_GPL(l2tp_session_register); |
1538 |
+ |
1539 |
+ /* Lookup a tunnel by id |
1540 |
+ */ |
1541 |
+@@ -1791,7 +1796,6 @@ EXPORT_SYMBOL_GPL(l2tp_session_set_header_len); |
1542 |
+ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg) |
1543 |
+ { |
1544 |
+ struct l2tp_session *session; |
1545 |
+- int err; |
1546 |
+ |
1547 |
+ session = kzalloc(sizeof(struct l2tp_session) + priv_size, GFP_KERNEL); |
1548 |
+ if (session != NULL) { |
1549 |
+@@ -1848,17 +1852,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn |
1550 |
+ |
1551 |
+ refcount_set(&session->ref_count, 1); |
1552 |
+ |
1553 |
+- err = l2tp_session_add_to_tunnel(tunnel, session); |
1554 |
+- if (err) { |
1555 |
+- kfree(session); |
1556 |
+- |
1557 |
+- return ERR_PTR(err); |
1558 |
+- } |
1559 |
+- |
1560 |
+- /* Ignore management session in session count value */ |
1561 |
+- if (session->session_id != 0) |
1562 |
+- atomic_inc(&l2tp_session_count); |
1563 |
+- |
1564 |
+ return session; |
1565 |
+ } |
1566 |
+ |
1567 |
+diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h |
1568 |
+index 62598ee7b2e7..e75748cdedb9 100644 |
1569 |
+--- a/net/l2tp/l2tp_core.h |
1570 |
++++ b/net/l2tp/l2tp_core.h |
1571 |
+@@ -257,6 +257,9 @@ struct l2tp_session *l2tp_session_create(int priv_size, |
1572 |
+ struct l2tp_tunnel *tunnel, |
1573 |
+ u32 session_id, u32 peer_session_id, |
1574 |
+ struct l2tp_session_cfg *cfg); |
1575 |
++int l2tp_session_register(struct l2tp_session *session, |
1576 |
++ struct l2tp_tunnel *tunnel); |
1577 |
++ |
1578 |
+ void __l2tp_session_unhash(struct l2tp_session *session); |
1579 |
+ int l2tp_session_delete(struct l2tp_session *session); |
1580 |
+ void l2tp_session_free(struct l2tp_session *session); |
1581 |
+diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c |
1582 |
+index 014a7bc2a872..d29bfee291cb 100644 |
1583 |
+--- a/net/l2tp/l2tp_eth.c |
1584 |
++++ b/net/l2tp/l2tp_eth.c |
1585 |
+@@ -54,7 +54,7 @@ struct l2tp_eth { |
1586 |
+ |
1587 |
+ /* via l2tp_session_priv() */ |
1588 |
+ struct l2tp_eth_sess { |
1589 |
+- struct net_device *dev; |
1590 |
++ struct net_device __rcu *dev; |
1591 |
+ }; |
1592 |
+ |
1593 |
+ |
1594 |
+@@ -72,7 +72,14 @@ static int l2tp_eth_dev_init(struct net_device *dev) |
1595 |
+ |
1596 |
+ static void l2tp_eth_dev_uninit(struct net_device *dev) |
1597 |
+ { |
1598 |
+- dev_put(dev); |
1599 |
++ struct l2tp_eth *priv = netdev_priv(dev); |
1600 |
++ struct l2tp_eth_sess *spriv; |
1601 |
++ |
1602 |
++ spriv = l2tp_session_priv(priv->session); |
1603 |
++ RCU_INIT_POINTER(spriv->dev, NULL); |
1604 |
++ /* No need for synchronize_net() here. We're called by |
1605 |
++ * unregister_netdev*(), which does the synchronisation for us. |
1606 |
++ */ |
1607 |
+ } |
1608 |
+ |
1609 |
+ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev) |
1610 |
+@@ -130,8 +137,8 @@ static void l2tp_eth_dev_setup(struct net_device *dev) |
1611 |
+ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) |
1612 |
+ { |
1613 |
+ struct l2tp_eth_sess *spriv = l2tp_session_priv(session); |
1614 |
+- struct net_device *dev = spriv->dev; |
1615 |
+- struct l2tp_eth *priv = netdev_priv(dev); |
1616 |
++ struct net_device *dev; |
1617 |
++ struct l2tp_eth *priv; |
1618 |
+ |
1619 |
+ if (session->debug & L2TP_MSG_DATA) { |
1620 |
+ unsigned int length; |
1621 |
+@@ -155,16 +162,25 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, |
1622 |
+ skb_dst_drop(skb); |
1623 |
+ nf_reset(skb); |
1624 |
+ |
1625 |
++ rcu_read_lock(); |
1626 |
++ dev = rcu_dereference(spriv->dev); |
1627 |
++ if (!dev) |
1628 |
++ goto error_rcu; |
1629 |
++ |
1630 |
++ priv = netdev_priv(dev); |
1631 |
+ if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) { |
1632 |
+ atomic_long_inc(&priv->rx_packets); |
1633 |
+ atomic_long_add(data_len, &priv->rx_bytes); |
1634 |
+ } else { |
1635 |
+ atomic_long_inc(&priv->rx_errors); |
1636 |
+ } |
1637 |
++ rcu_read_unlock(); |
1638 |
++ |
1639 |
+ return; |
1640 |
+ |
1641 |
++error_rcu: |
1642 |
++ rcu_read_unlock(); |
1643 |
+ error: |
1644 |
+- atomic_long_inc(&priv->rx_errors); |
1645 |
+ kfree_skb(skb); |
1646 |
+ } |
1647 |
+ |
1648 |
+@@ -175,11 +191,15 @@ static void l2tp_eth_delete(struct l2tp_session *session) |
1649 |
+ |
1650 |
+ if (session) { |
1651 |
+ spriv = l2tp_session_priv(session); |
1652 |
+- dev = spriv->dev; |
1653 |
++ |
1654 |
++ rtnl_lock(); |
1655 |
++ dev = rtnl_dereference(spriv->dev); |
1656 |
+ if (dev) { |
1657 |
+- unregister_netdev(dev); |
1658 |
+- spriv->dev = NULL; |
1659 |
++ unregister_netdevice(dev); |
1660 |
++ rtnl_unlock(); |
1661 |
+ module_put(THIS_MODULE); |
1662 |
++ } else { |
1663 |
++ rtnl_unlock(); |
1664 |
+ } |
1665 |
+ } |
1666 |
+ } |
1667 |
+@@ -189,9 +209,20 @@ static void l2tp_eth_show(struct seq_file *m, void *arg) |
1668 |
+ { |
1669 |
+ struct l2tp_session *session = arg; |
1670 |
+ struct l2tp_eth_sess *spriv = l2tp_session_priv(session); |
1671 |
+- struct net_device *dev = spriv->dev; |
1672 |
++ struct net_device *dev; |
1673 |
++ |
1674 |
++ rcu_read_lock(); |
1675 |
++ dev = rcu_dereference(spriv->dev); |
1676 |
++ if (!dev) { |
1677 |
++ rcu_read_unlock(); |
1678 |
++ return; |
1679 |
++ } |
1680 |
++ dev_hold(dev); |
1681 |
++ rcu_read_unlock(); |
1682 |
+ |
1683 |
+ seq_printf(m, " interface %s\n", dev->name); |
1684 |
++ |
1685 |
++ dev_put(dev); |
1686 |
+ } |
1687 |
+ #endif |
1688 |
+ |
1689 |
+@@ -268,14 +299,14 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel, |
1690 |
+ peer_session_id, cfg); |
1691 |
+ if (IS_ERR(session)) { |
1692 |
+ rc = PTR_ERR(session); |
1693 |
+- goto out; |
1694 |
++ goto err; |
1695 |
+ } |
1696 |
+ |
1697 |
+ dev = alloc_netdev(sizeof(*priv), name, name_assign_type, |
1698 |
+ l2tp_eth_dev_setup); |
1699 |
+ if (!dev) { |
1700 |
+ rc = -ENOMEM; |
1701 |
+- goto out_del_session; |
1702 |
++ goto err_sess; |
1703 |
+ } |
1704 |
+ |
1705 |
+ dev_net_set(dev, net); |
1706 |
+@@ -295,26 +326,48 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel, |
1707 |
+ #endif |
1708 |
+ |
1709 |
+ spriv = l2tp_session_priv(session); |
1710 |
+- spriv->dev = dev; |
1711 |
+ |
1712 |
+- rc = register_netdev(dev); |
1713 |
+- if (rc < 0) |
1714 |
+- goto out_del_dev; |
1715 |
++ l2tp_session_inc_refcount(session); |
1716 |
++ |
1717 |
++ rtnl_lock(); |
1718 |
++ |
1719 |
++ /* Register both device and session while holding the rtnl lock. This |
1720 |
++ * ensures that l2tp_eth_delete() will see that there's a device to |
1721 |
++ * unregister, even if it happened to run before we assign spriv->dev. |
1722 |
++ */ |
1723 |
++ rc = l2tp_session_register(session, tunnel); |
1724 |
++ if (rc < 0) { |
1725 |
++ rtnl_unlock(); |
1726 |
++ goto err_sess_dev; |
1727 |
++ } |
1728 |
++ |
1729 |
++ rc = register_netdevice(dev); |
1730 |
++ if (rc < 0) { |
1731 |
++ rtnl_unlock(); |
1732 |
++ l2tp_session_delete(session); |
1733 |
++ l2tp_session_dec_refcount(session); |
1734 |
++ free_netdev(dev); |
1735 |
++ |
1736 |
++ return rc; |
1737 |
++ } |
1738 |
+ |
1739 |
+- __module_get(THIS_MODULE); |
1740 |
+- /* Must be done after register_netdev() */ |
1741 |
+ strlcpy(session->ifname, dev->name, IFNAMSIZ); |
1742 |
++ rcu_assign_pointer(spriv->dev, dev); |
1743 |
+ |
1744 |
+- dev_hold(dev); |
1745 |
++ rtnl_unlock(); |
1746 |
++ |
1747 |
++ l2tp_session_dec_refcount(session); |
1748 |
++ |
1749 |
++ __module_get(THIS_MODULE); |
1750 |
+ |
1751 |
+ return 0; |
1752 |
+ |
1753 |
+-out_del_dev: |
1754 |
++err_sess_dev: |
1755 |
++ l2tp_session_dec_refcount(session); |
1756 |
+ free_netdev(dev); |
1757 |
+- spriv->dev = NULL; |
1758 |
+-out_del_session: |
1759 |
+- l2tp_session_delete(session); |
1760 |
+-out: |
1761 |
++err_sess: |
1762 |
++ kfree(session); |
1763 |
++err: |
1764 |
+ return rc; |
1765 |
+ } |
1766 |
+ |
1767 |
+diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c |
1768 |
+index a7fcf48e9087..ad07b7cb6558 100644 |
1769 |
+--- a/net/l2tp/l2tp_ppp.c |
1770 |
++++ b/net/l2tp/l2tp_ppp.c |
1771 |
+@@ -122,8 +122,11 @@ |
1772 |
+ struct pppol2tp_session { |
1773 |
+ int owner; /* pid that opened the socket */ |
1774 |
+ |
1775 |
+- struct sock *sock; /* Pointer to the session |
1776 |
++ struct mutex sk_lock; /* Protects .sk */ |
1777 |
++ struct sock __rcu *sk; /* Pointer to the session |
1778 |
+ * PPPoX socket */ |
1779 |
++ struct sock *__sk; /* Copy of .sk, for cleanup */ |
1780 |
++ struct rcu_head rcu; /* For asynchronous release */ |
1781 |
+ struct sock *tunnel_sock; /* Pointer to the tunnel UDP |
1782 |
+ * socket */ |
1783 |
+ int flags; /* accessed by PPPIOCGFLAGS. |
1784 |
+@@ -138,6 +141,24 @@ static const struct ppp_channel_ops pppol2tp_chan_ops = { |
1785 |
+ |
1786 |
+ static const struct proto_ops pppol2tp_ops; |
1787 |
+ |
1788 |
++/* Retrieves the pppol2tp socket associated to a session. |
1789 |
++ * A reference is held on the returned socket, so this function must be paired |
1790 |
++ * with sock_put(). |
1791 |
++ */ |
1792 |
++static struct sock *pppol2tp_session_get_sock(struct l2tp_session *session) |
1793 |
++{ |
1794 |
++ struct pppol2tp_session *ps = l2tp_session_priv(session); |
1795 |
++ struct sock *sk; |
1796 |
++ |
1797 |
++ rcu_read_lock(); |
1798 |
++ sk = rcu_dereference(ps->sk); |
1799 |
++ if (sk) |
1800 |
++ sock_hold(sk); |
1801 |
++ rcu_read_unlock(); |
1802 |
++ |
1803 |
++ return sk; |
1804 |
++} |
1805 |
++ |
1806 |
+ /* Helpers to obtain tunnel/session contexts from sockets. |
1807 |
+ */ |
1808 |
+ static inline struct l2tp_session *pppol2tp_sock_to_session(struct sock *sk) |
1809 |
+@@ -224,7 +245,8 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int |
1810 |
+ /* If the socket is bound, send it in to PPP's input queue. Otherwise |
1811 |
+ * queue it on the session socket. |
1812 |
+ */ |
1813 |
+- sk = ps->sock; |
1814 |
++ rcu_read_lock(); |
1815 |
++ sk = rcu_dereference(ps->sk); |
1816 |
+ if (sk == NULL) |
1817 |
+ goto no_sock; |
1818 |
+ |
1819 |
+@@ -247,30 +269,16 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int |
1820 |
+ kfree_skb(skb); |
1821 |
+ } |
1822 |
+ } |
1823 |
++ rcu_read_unlock(); |
1824 |
+ |
1825 |
+ return; |
1826 |
+ |
1827 |
+ no_sock: |
1828 |
++ rcu_read_unlock(); |
1829 |
+ l2tp_info(session, L2TP_MSG_DATA, "%s: no socket\n", session->name); |
1830 |
+ kfree_skb(skb); |
1831 |
+ } |
1832 |
+ |
1833 |
+-static void pppol2tp_session_sock_hold(struct l2tp_session *session) |
1834 |
+-{ |
1835 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
1836 |
+- |
1837 |
+- if (ps->sock) |
1838 |
+- sock_hold(ps->sock); |
1839 |
+-} |
1840 |
+- |
1841 |
+-static void pppol2tp_session_sock_put(struct l2tp_session *session) |
1842 |
+-{ |
1843 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
1844 |
+- |
1845 |
+- if (ps->sock) |
1846 |
+- sock_put(ps->sock); |
1847 |
+-} |
1848 |
+- |
1849 |
+ /************************************************************************ |
1850 |
+ * Transmit handling |
1851 |
+ ***********************************************************************/ |
1852 |
+@@ -431,17 +439,16 @@ abort: |
1853 |
+ */ |
1854 |
+ static void pppol2tp_session_close(struct l2tp_session *session) |
1855 |
+ { |
1856 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
1857 |
+- struct sock *sk = ps->sock; |
1858 |
+- struct socket *sock = sk->sk_socket; |
1859 |
++ struct sock *sk; |
1860 |
+ |
1861 |
+ BUG_ON(session->magic != L2TP_SESSION_MAGIC); |
1862 |
+ |
1863 |
+- if (sock) |
1864 |
+- inet_shutdown(sock, SEND_SHUTDOWN); |
1865 |
+- |
1866 |
+- /* Don't let the session go away before our socket does */ |
1867 |
+- l2tp_session_inc_refcount(session); |
1868 |
++ sk = pppol2tp_session_get_sock(session); |
1869 |
++ if (sk) { |
1870 |
++ if (sk->sk_socket) |
1871 |
++ inet_shutdown(sk->sk_socket, SEND_SHUTDOWN); |
1872 |
++ sock_put(sk); |
1873 |
++ } |
1874 |
+ } |
1875 |
+ |
1876 |
+ /* Really kill the session socket. (Called from sock_put() if |
1877 |
+@@ -461,6 +468,14 @@ static void pppol2tp_session_destruct(struct sock *sk) |
1878 |
+ } |
1879 |
+ } |
1880 |
+ |
1881 |
++static void pppol2tp_put_sk(struct rcu_head *head) |
1882 |
++{ |
1883 |
++ struct pppol2tp_session *ps; |
1884 |
++ |
1885 |
++ ps = container_of(head, typeof(*ps), rcu); |
1886 |
++ sock_put(ps->__sk); |
1887 |
++} |
1888 |
++ |
1889 |
+ /* Called when the PPPoX socket (session) is closed. |
1890 |
+ */ |
1891 |
+ static int pppol2tp_release(struct socket *sock) |
1892 |
+@@ -486,11 +501,23 @@ static int pppol2tp_release(struct socket *sock) |
1893 |
+ |
1894 |
+ session = pppol2tp_sock_to_session(sk); |
1895 |
+ |
1896 |
+- /* Purge any queued data */ |
1897 |
+ if (session != NULL) { |
1898 |
+- __l2tp_session_unhash(session); |
1899 |
+- l2tp_session_queue_purge(session); |
1900 |
+- sock_put(sk); |
1901 |
++ struct pppol2tp_session *ps; |
1902 |
++ |
1903 |
++ l2tp_session_delete(session); |
1904 |
++ |
1905 |
++ ps = l2tp_session_priv(session); |
1906 |
++ mutex_lock(&ps->sk_lock); |
1907 |
++ ps->__sk = rcu_dereference_protected(ps->sk, |
1908 |
++ lockdep_is_held(&ps->sk_lock)); |
1909 |
++ RCU_INIT_POINTER(ps->sk, NULL); |
1910 |
++ mutex_unlock(&ps->sk_lock); |
1911 |
++ call_rcu(&ps->rcu, pppol2tp_put_sk); |
1912 |
++ |
1913 |
++ /* Rely on the sock_put() call at the end of the function for |
1914 |
++ * dropping the reference held by pppol2tp_sock_to_session(). |
1915 |
++ * The last reference will be dropped by pppol2tp_put_sk(). |
1916 |
++ */ |
1917 |
+ } |
1918 |
+ release_sock(sk); |
1919 |
+ |
1920 |
+@@ -557,16 +584,47 @@ out: |
1921 |
+ static void pppol2tp_show(struct seq_file *m, void *arg) |
1922 |
+ { |
1923 |
+ struct l2tp_session *session = arg; |
1924 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
1925 |
++ struct sock *sk; |
1926 |
++ |
1927 |
++ sk = pppol2tp_session_get_sock(session); |
1928 |
++ if (sk) { |
1929 |
++ struct pppox_sock *po = pppox_sk(sk); |
1930 |
+ |
1931 |
+- if (ps) { |
1932 |
+- struct pppox_sock *po = pppox_sk(ps->sock); |
1933 |
+- if (po) |
1934 |
+- seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); |
1935 |
++ seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); |
1936 |
++ sock_put(sk); |
1937 |
+ } |
1938 |
+ } |
1939 |
+ #endif |
1940 |
+ |
1941 |
++static void pppol2tp_session_init(struct l2tp_session *session) |
1942 |
++{ |
1943 |
++ struct pppol2tp_session *ps; |
1944 |
++ struct dst_entry *dst; |
1945 |
++ |
1946 |
++ session->recv_skb = pppol2tp_recv; |
1947 |
++ session->session_close = pppol2tp_session_close; |
1948 |
++#if IS_ENABLED(CONFIG_L2TP_DEBUGFS) |
1949 |
++ session->show = pppol2tp_show; |
1950 |
++#endif |
1951 |
++ |
1952 |
++ ps = l2tp_session_priv(session); |
1953 |
++ mutex_init(&ps->sk_lock); |
1954 |
++ ps->tunnel_sock = session->tunnel->sock; |
1955 |
++ ps->owner = current->pid; |
1956 |
++ |
1957 |
++ /* If PMTU discovery was enabled, use the MTU that was discovered */ |
1958 |
++ dst = sk_dst_get(session->tunnel->sock); |
1959 |
++ if (dst) { |
1960 |
++ u32 pmtu = dst_mtu(dst); |
1961 |
++ |
1962 |
++ if (pmtu) { |
1963 |
++ session->mtu = pmtu - PPPOL2TP_HEADER_OVERHEAD; |
1964 |
++ session->mru = pmtu - PPPOL2TP_HEADER_OVERHEAD; |
1965 |
++ } |
1966 |
++ dst_release(dst); |
1967 |
++ } |
1968 |
++} |
1969 |
++ |
1970 |
+ /* connect() handler. Attach a PPPoX socket to a tunnel UDP socket |
1971 |
+ */ |
1972 |
+ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, |
1973 |
+@@ -578,7 +636,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, |
1974 |
+ struct l2tp_session *session = NULL; |
1975 |
+ struct l2tp_tunnel *tunnel; |
1976 |
+ struct pppol2tp_session *ps; |
1977 |
+- struct dst_entry *dst; |
1978 |
+ struct l2tp_session_cfg cfg = { 0, }; |
1979 |
+ int error = 0; |
1980 |
+ u32 tunnel_id, peer_tunnel_id; |
1981 |
+@@ -703,13 +760,17 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, |
1982 |
+ /* Using a pre-existing session is fine as long as it hasn't |
1983 |
+ * been connected yet. |
1984 |
+ */ |
1985 |
+- if (ps->sock) { |
1986 |
++ mutex_lock(&ps->sk_lock); |
1987 |
++ if (rcu_dereference_protected(ps->sk, |
1988 |
++ lockdep_is_held(&ps->sk_lock))) { |
1989 |
++ mutex_unlock(&ps->sk_lock); |
1990 |
+ error = -EEXIST; |
1991 |
+ goto end; |
1992 |
+ } |
1993 |
+ |
1994 |
+ /* consistency checks */ |
1995 |
+ if (ps->tunnel_sock != tunnel->sock) { |
1996 |
++ mutex_unlock(&ps->sk_lock); |
1997 |
+ error = -EEXIST; |
1998 |
+ goto end; |
1999 |
+ } |
2000 |
+@@ -725,35 +786,19 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, |
2001 |
+ error = PTR_ERR(session); |
2002 |
+ goto end; |
2003 |
+ } |
2004 |
+- } |
2005 |
+- |
2006 |
+- /* Associate session with its PPPoL2TP socket */ |
2007 |
+- ps = l2tp_session_priv(session); |
2008 |
+- ps->owner = current->pid; |
2009 |
+- ps->sock = sk; |
2010 |
+- ps->tunnel_sock = tunnel->sock; |
2011 |
+- |
2012 |
+- session->recv_skb = pppol2tp_recv; |
2013 |
+- session->session_close = pppol2tp_session_close; |
2014 |
+-#if IS_ENABLED(CONFIG_L2TP_DEBUGFS) |
2015 |
+- session->show = pppol2tp_show; |
2016 |
+-#endif |
2017 |
+- |
2018 |
+- /* We need to know each time a skb is dropped from the reorder |
2019 |
+- * queue. |
2020 |
+- */ |
2021 |
+- session->ref = pppol2tp_session_sock_hold; |
2022 |
+- session->deref = pppol2tp_session_sock_put; |
2023 |
+ |
2024 |
+- /* If PMTU discovery was enabled, use the MTU that was discovered */ |
2025 |
+- dst = sk_dst_get(tunnel->sock); |
2026 |
+- if (dst != NULL) { |
2027 |
+- u32 pmtu = dst_mtu(dst); |
2028 |
++ pppol2tp_session_init(session); |
2029 |
++ ps = l2tp_session_priv(session); |
2030 |
++ l2tp_session_inc_refcount(session); |
2031 |
+ |
2032 |
+- if (pmtu != 0) |
2033 |
+- session->mtu = session->mru = pmtu - |
2034 |
+- PPPOL2TP_HEADER_OVERHEAD; |
2035 |
+- dst_release(dst); |
2036 |
++ mutex_lock(&ps->sk_lock); |
2037 |
++ error = l2tp_session_register(session, tunnel); |
2038 |
++ if (error < 0) { |
2039 |
++ mutex_unlock(&ps->sk_lock); |
2040 |
++ kfree(session); |
2041 |
++ goto end; |
2042 |
++ } |
2043 |
++ drop_refcnt = true; |
2044 |
+ } |
2045 |
+ |
2046 |
+ /* Special case: if source & dest session_id == 0x0000, this |
2047 |
+@@ -778,12 +823,23 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, |
2048 |
+ po->chan.mtu = session->mtu; |
2049 |
+ |
2050 |
+ error = ppp_register_net_channel(sock_net(sk), &po->chan); |
2051 |
+- if (error) |
2052 |
++ if (error) { |
2053 |
++ mutex_unlock(&ps->sk_lock); |
2054 |
+ goto end; |
2055 |
++ } |
2056 |
+ |
2057 |
+ out_no_ppp: |
2058 |
+ /* This is how we get the session context from the socket. */ |
2059 |
+ sk->sk_user_data = session; |
2060 |
++ rcu_assign_pointer(ps->sk, sk); |
2061 |
++ mutex_unlock(&ps->sk_lock); |
2062 |
++ |
2063 |
++ /* Keep the reference we've grabbed on the session: sk doesn't expect |
2064 |
++ * the session to disappear. pppol2tp_session_destruct() is responsible |
2065 |
++ * for dropping it. |
2066 |
++ */ |
2067 |
++ drop_refcnt = false; |
2068 |
++ |
2069 |
+ sk->sk_state = PPPOX_CONNECTED; |
2070 |
+ l2tp_info(session, L2TP_MSG_CONTROL, "%s: created\n", |
2071 |
+ session->name); |
2072 |
+@@ -807,12 +863,11 @@ static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel, |
2073 |
+ { |
2074 |
+ int error; |
2075 |
+ struct l2tp_session *session; |
2076 |
+- struct pppol2tp_session *ps; |
2077 |
+ |
2078 |
+ /* Error if tunnel socket is not prepped */ |
2079 |
+ if (!tunnel->sock) { |
2080 |
+ error = -ENOENT; |
2081 |
+- goto out; |
2082 |
++ goto err; |
2083 |
+ } |
2084 |
+ |
2085 |
+ /* Default MTU values. */ |
2086 |
+@@ -827,18 +882,20 @@ static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel, |
2087 |
+ peer_session_id, cfg); |
2088 |
+ if (IS_ERR(session)) { |
2089 |
+ error = PTR_ERR(session); |
2090 |
+- goto out; |
2091 |
++ goto err; |
2092 |
+ } |
2093 |
+ |
2094 |
+- ps = l2tp_session_priv(session); |
2095 |
+- ps->tunnel_sock = tunnel->sock; |
2096 |
++ pppol2tp_session_init(session); |
2097 |
+ |
2098 |
+- l2tp_info(session, L2TP_MSG_CONTROL, "%s: created\n", |
2099 |
+- session->name); |
2100 |
++ error = l2tp_session_register(session, tunnel); |
2101 |
++ if (error < 0) |
2102 |
++ goto err_sess; |
2103 |
+ |
2104 |
+- error = 0; |
2105 |
++ return 0; |
2106 |
+ |
2107 |
+-out: |
2108 |
++err_sess: |
2109 |
++ kfree(session); |
2110 |
++err: |
2111 |
+ return error; |
2112 |
+ } |
2113 |
+ |
2114 |
+@@ -999,12 +1056,10 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session, |
2115 |
+ "%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n", |
2116 |
+ session->name, cmd, arg); |
2117 |
+ |
2118 |
+- sk = ps->sock; |
2119 |
++ sk = pppol2tp_session_get_sock(session); |
2120 |
+ if (!sk) |
2121 |
+ return -EBADR; |
2122 |
+ |
2123 |
+- sock_hold(sk); |
2124 |
+- |
2125 |
+ switch (cmd) { |
2126 |
+ case SIOCGIFMTU: |
2127 |
+ err = -ENXIO; |
2128 |
+@@ -1280,7 +1335,6 @@ static int pppol2tp_session_setsockopt(struct sock *sk, |
2129 |
+ int optname, int val) |
2130 |
+ { |
2131 |
+ int err = 0; |
2132 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
2133 |
+ |
2134 |
+ switch (optname) { |
2135 |
+ case PPPOL2TP_SO_RECVSEQ: |
2136 |
+@@ -1301,8 +1355,8 @@ static int pppol2tp_session_setsockopt(struct sock *sk, |
2137 |
+ } |
2138 |
+ session->send_seq = !!val; |
2139 |
+ { |
2140 |
+- struct sock *ssk = ps->sock; |
2141 |
+- struct pppox_sock *po = pppox_sk(ssk); |
2142 |
++ struct pppox_sock *po = pppox_sk(sk); |
2143 |
++ |
2144 |
+ po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : |
2145 |
+ PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; |
2146 |
+ } |
2147 |
+@@ -1641,8 +1695,9 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
2148 |
+ { |
2149 |
+ struct l2tp_session *session = v; |
2150 |
+ struct l2tp_tunnel *tunnel = session->tunnel; |
2151 |
+- struct pppol2tp_session *ps = l2tp_session_priv(session); |
2152 |
+- struct pppox_sock *po = pppox_sk(ps->sock); |
2153 |
++ unsigned char state; |
2154 |
++ char user_data_ok; |
2155 |
++ struct sock *sk; |
2156 |
+ u32 ip = 0; |
2157 |
+ u16 port = 0; |
2158 |
+ |
2159 |
+@@ -1652,6 +1707,15 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
2160 |
+ port = ntohs(inet->inet_sport); |
2161 |
+ } |
2162 |
+ |
2163 |
++ sk = pppol2tp_session_get_sock(session); |
2164 |
++ if (sk) { |
2165 |
++ state = sk->sk_state; |
2166 |
++ user_data_ok = (session == sk->sk_user_data) ? 'Y' : 'N'; |
2167 |
++ } else { |
2168 |
++ state = 0; |
2169 |
++ user_data_ok = 'N'; |
2170 |
++ } |
2171 |
++ |
2172 |
+ seq_printf(m, " SESSION '%s' %08X/%d %04X/%04X -> " |
2173 |
+ "%04X/%04X %d %c\n", |
2174 |
+ session->name, ip, port, |
2175 |
+@@ -1659,9 +1723,7 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
2176 |
+ session->session_id, |
2177 |
+ tunnel->peer_tunnel_id, |
2178 |
+ session->peer_session_id, |
2179 |
+- ps->sock->sk_state, |
2180 |
+- (session == ps->sock->sk_user_data) ? |
2181 |
+- 'Y' : 'N'); |
2182 |
++ state, user_data_ok); |
2183 |
+ seq_printf(m, " %d/%d/%c/%c/%s %08x %u\n", |
2184 |
+ session->mtu, session->mru, |
2185 |
+ session->recv_seq ? 'R' : '-', |
2186 |
+@@ -1678,8 +1740,12 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
2187 |
+ atomic_long_read(&session->stats.rx_bytes), |
2188 |
+ atomic_long_read(&session->stats.rx_errors)); |
2189 |
+ |
2190 |
+- if (po) |
2191 |
++ if (sk) { |
2192 |
++ struct pppox_sock *po = pppox_sk(sk); |
2193 |
++ |
2194 |
+ seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); |
2195 |
++ sock_put(sk); |
2196 |
++ } |
2197 |
+ } |
2198 |
+ |
2199 |
+ static int pppol2tp_seq_show(struct seq_file *m, void *v) |
2200 |
+diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c |
2201 |
+index 77cb23c7bd0a..48fad9ba8601 100644 |
2202 |
+--- a/net/rxrpc/rxkad.c |
2203 |
++++ b/net/rxrpc/rxkad.c |
2204 |
+@@ -1111,7 +1111,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, |
2205 |
+ ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key, |
2206 |
+ &expiry, _abort_code); |
2207 |
+ if (ret < 0) |
2208 |
+- goto temporary_error_free_resp; |
2209 |
++ goto temporary_error_free_ticket; |
2210 |
+ |
2211 |
+ /* use the session key from inside the ticket to decrypt the |
2212 |
+ * response */ |
2213 |
+@@ -1193,7 +1193,6 @@ protocol_error: |
2214 |
+ |
2215 |
+ temporary_error_free_ticket: |
2216 |
+ kfree(ticket); |
2217 |
+-temporary_error_free_resp: |
2218 |
+ kfree(response); |
2219 |
+ temporary_error: |
2220 |
+ /* Ignore the response packet if we got a temporary error such as |
2221 |
+diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile |
2222 |
+index e2ff425f4c7e..c404d7628039 100644 |
2223 |
+--- a/scripts/gcc-plugins/Makefile |
2224 |
++++ b/scripts/gcc-plugins/Makefile |
2225 |
+@@ -10,6 +10,7 @@ else |
2226 |
+ HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti |
2227 |
+ HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb |
2228 |
+ HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable |
2229 |
++ HOST_EXTRACXXFLAGS += -Wno-format-diag |
2230 |
+ export HOST_EXTRACXXFLAGS |
2231 |
+ endif |
2232 |
+ |
2233 |
+diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h |
2234 |
+index 797e3786b415..01312b1d6294 100644 |
2235 |
+--- a/scripts/gcc-plugins/gcc-common.h |
2236 |
++++ b/scripts/gcc-plugins/gcc-common.h |
2237 |
+@@ -35,7 +35,9 @@ |
2238 |
+ #include "ggc.h" |
2239 |
+ #include "timevar.h" |
2240 |
+ |
2241 |
++#if BUILDING_GCC_VERSION < 10000 |
2242 |
+ #include "params.h" |
2243 |
++#endif |
2244 |
+ |
2245 |
+ #if BUILDING_GCC_VERSION <= 4009 |
2246 |
+ #include "pointer-set.h" |
2247 |
+@@ -841,6 +843,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l |
2248 |
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); |
2249 |
+ } |
2250 |
+ |
2251 |
++#if BUILDING_GCC_VERSION < 10000 |
2252 |
+ template <> |
2253 |
+ template <> |
2254 |
+ inline bool is_a_helper<const ggoto *>::test(const_gimple gs) |
2255 |
+@@ -854,6 +857,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs) |
2256 |
+ { |
2257 |
+ return gs->code == GIMPLE_RETURN; |
2258 |
+ } |
2259 |
++#endif |
2260 |
+ |
2261 |
+ static inline gasm *as_a_gasm(gimple stmt) |
2262 |
+ { |
2263 |
+diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c |
2264 |
+index c106988c1b25..5341d8e52a2b 100644 |
2265 |
+--- a/security/apparmor/apparmorfs.c |
2266 |
++++ b/security/apparmor/apparmorfs.c |
2267 |
+@@ -426,7 +426,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size, |
2268 |
+ */ |
2269 |
+ error = aa_may_manage_policy(label, ns, mask); |
2270 |
+ if (error) |
2271 |
+- return error; |
2272 |
++ goto end_section; |
2273 |
+ |
2274 |
+ data = aa_simple_write_to_buffer(buf, size, size, pos); |
2275 |
+ error = PTR_ERR(data); |
2276 |
+@@ -434,6 +434,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size, |
2277 |
+ error = aa_replace_profiles(ns, label, mask, data); |
2278 |
+ aa_put_loaddata(data); |
2279 |
+ } |
2280 |
++end_section: |
2281 |
+ end_current_label_crit_section(label); |
2282 |
+ |
2283 |
+ return error; |
2284 |
+diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c |
2285 |
+index f1f030ae363b..73791d22ae07 100644 |
2286 |
+--- a/security/integrity/evm/evm_crypto.c |
2287 |
++++ b/security/integrity/evm/evm_crypto.c |
2288 |
+@@ -90,7 +90,7 @@ static struct shash_desc *init_desc(char type) |
2289 |
+ algo = evm_hash; |
2290 |
+ } |
2291 |
+ |
2292 |
+- if (*tfm == NULL) { |
2293 |
++ if (IS_ERR_OR_NULL(*tfm)) { |
2294 |
+ mutex_lock(&mutex); |
2295 |
+ if (*tfm) |
2296 |
+ goto out; |
2297 |
+diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c |
2298 |
+index 06b0ee75f34f..7b16e54f01c6 100644 |
2299 |
+--- a/security/integrity/ima/ima_crypto.c |
2300 |
++++ b/security/integrity/ima/ima_crypto.c |
2301 |
+@@ -432,7 +432,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
2302 |
+ loff_t i_size; |
2303 |
+ int rc; |
2304 |
+ struct file *f = file; |
2305 |
+- bool new_file_instance = false, modified_flags = false; |
2306 |
++ bool new_file_instance = false, modified_mode = false; |
2307 |
+ |
2308 |
+ /* |
2309 |
+ * For consistency, fail file's opened with the O_DIRECT flag on |
2310 |
+@@ -452,13 +452,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
2311 |
+ f = dentry_open(&file->f_path, flags, file->f_cred); |
2312 |
+ if (IS_ERR(f)) { |
2313 |
+ /* |
2314 |
+- * Cannot open the file again, lets modify f_flags |
2315 |
++ * Cannot open the file again, lets modify f_mode |
2316 |
+ * of original and continue |
2317 |
+ */ |
2318 |
+ pr_info_ratelimited("Unable to reopen file for reading.\n"); |
2319 |
+ f = file; |
2320 |
+- f->f_flags |= FMODE_READ; |
2321 |
+- modified_flags = true; |
2322 |
++ f->f_mode |= FMODE_READ; |
2323 |
++ modified_mode = true; |
2324 |
+ } else { |
2325 |
+ new_file_instance = true; |
2326 |
+ } |
2327 |
+@@ -476,8 +476,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
2328 |
+ out: |
2329 |
+ if (new_file_instance) |
2330 |
+ fput(f); |
2331 |
+- else if (modified_flags) |
2332 |
+- f->f_flags &= ~FMODE_READ; |
2333 |
++ else if (modified_mode) |
2334 |
++ f->f_mode &= ~FMODE_READ; |
2335 |
+ return rc; |
2336 |
+ } |
2337 |
+ |
2338 |
+diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c |
2339 |
+index 2c4e83f6409e..d37f9ac46670 100644 |
2340 |
+--- a/security/integrity/ima/ima_fs.c |
2341 |
++++ b/security/integrity/ima/ima_fs.c |
2342 |
+@@ -340,8 +340,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf, |
2343 |
+ integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL, |
2344 |
+ "policy_update", "signed policy required", |
2345 |
+ 1, 0); |
2346 |
+- if (ima_appraise & IMA_APPRAISE_ENFORCE) |
2347 |
+- result = -EACCES; |
2348 |
++ result = -EACCES; |
2349 |
+ } else { |
2350 |
+ result = ima_parse_add_rule(data); |
2351 |
+ } |
2352 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
2353 |
+index 80453266a2de..c412f2a909c9 100644 |
2354 |
+--- a/sound/core/pcm_lib.c |
2355 |
++++ b/sound/core/pcm_lib.c |
2356 |
+@@ -440,6 +440,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, |
2357 |
+ |
2358 |
+ no_delta_check: |
2359 |
+ if (runtime->status->hw_ptr == new_hw_ptr) { |
2360 |
++ runtime->hw_ptr_jiffies = curr_jiffies; |
2361 |
+ update_audio_tstamp(substream, &curr_tstamp, &audio_tstamp); |
2362 |
+ return 0; |
2363 |
+ } |
2364 |
+diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c |
2365 |
+index 0e66afa403a3..5a7928e1b29e 100644 |
2366 |
+--- a/sound/pci/ice1712/ice1712.c |
2367 |
++++ b/sound/pci/ice1712/ice1712.c |
2368 |
+@@ -2377,7 +2377,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice) |
2369 |
+ pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); |
2370 |
+ pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); |
2371 |
+ pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); |
2372 |
+- if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) { |
2373 |
++ if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 && |
2374 |
++ ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) { |
2375 |
+ ice->gpio.write_mask = ice->eeprom.gpiomask; |
2376 |
+ ice->gpio.direction = ice->eeprom.gpiodir; |
2377 |
+ snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, |