1 |
commit: 322846fef88cdebfc404e238754403f460b16adb |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 15 12:50:48 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 15 12:50:48 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=322846fe |
7 |
|
8 |
proj/linux-patches: Linux patches 4.14.100 and 4.14.101 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 8 + |
13 |
1099_linux-4.14.100.patch | 1775 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
1100_linux-4.14.101.patch | 35 + |
15 |
3 files changed, 1818 insertions(+) |
16 |
|
17 |
diff --git a/0000_README b/0000_README |
18 |
index 6e5e8ac..b57a8e5 100644 |
19 |
--- a/0000_README |
20 |
+++ b/0000_README |
21 |
@@ -439,6 +439,14 @@ Patch: 1098_4.14.99.patch |
22 |
From: http://www.kernel.org |
23 |
Desc: Linux 4.14.99 |
24 |
|
25 |
+Patch: 1099_4.14.100.patch |
26 |
+From: http://www.kernel.org |
27 |
+Desc: Linux 4.14.100 |
28 |
+ |
29 |
+Patch: 1100_4.14.101.patch |
30 |
+From: http://www.kernel.org |
31 |
+Desc: Linux 4.14.101 |
32 |
+ |
33 |
Patch: 1500_XATTR_USER_PREFIX.patch |
34 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
35 |
Desc: Support for namespace user.pax.* on tmpfs. |
36 |
|
37 |
diff --git a/1099_linux-4.14.100.patch b/1099_linux-4.14.100.patch |
38 |
new file mode 100644 |
39 |
index 0000000..d6607d1 |
40 |
--- /dev/null |
41 |
+++ b/1099_linux-4.14.100.patch |
42 |
@@ -0,0 +1,1775 @@ |
43 |
+diff --git a/Makefile b/Makefile |
44 |
+index 3b10c8b542e2..86fa9a371383 100644 |
45 |
+--- a/Makefile |
46 |
++++ b/Makefile |
47 |
+@@ -1,7 +1,7 @@ |
48 |
+ # SPDX-License-Identifier: GPL-2.0 |
49 |
+ VERSION = 4 |
50 |
+ PATCHLEVEL = 14 |
51 |
+-SUBLEVEL = 99 |
52 |
++SUBLEVEL = 100 |
53 |
+ EXTRAVERSION = |
54 |
+ NAME = Petit Gorille |
55 |
+ |
56 |
+diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c |
57 |
+index c1cd80ecc219..a904244264ce 100644 |
58 |
+--- a/arch/arm/mach-iop32x/n2100.c |
59 |
++++ b/arch/arm/mach-iop32x/n2100.c |
60 |
+@@ -75,8 +75,7 @@ void __init n2100_map_io(void) |
61 |
+ /* |
62 |
+ * N2100 PCI. |
63 |
+ */ |
64 |
+-static int __init |
65 |
+-n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
66 |
++static int n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
67 |
+ { |
68 |
+ int irq; |
69 |
+ |
70 |
+diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c |
71 |
+index 028e50c6383f..a32c3b631484 100644 |
72 |
+--- a/arch/arm/mach-tango/pm.c |
73 |
++++ b/arch/arm/mach-tango/pm.c |
74 |
+@@ -3,6 +3,7 @@ |
75 |
+ #include <linux/suspend.h> |
76 |
+ #include <asm/suspend.h> |
77 |
+ #include "smc.h" |
78 |
++#include "pm.h" |
79 |
+ |
80 |
+ static int tango_pm_powerdown(unsigned long arg) |
81 |
+ { |
82 |
+@@ -24,10 +25,7 @@ static const struct platform_suspend_ops tango_pm_ops = { |
83 |
+ .valid = suspend_valid_only_mem, |
84 |
+ }; |
85 |
+ |
86 |
+-static int __init tango_pm_init(void) |
87 |
++void __init tango_pm_init(void) |
88 |
+ { |
89 |
+ suspend_set_ops(&tango_pm_ops); |
90 |
+- return 0; |
91 |
+ } |
92 |
+- |
93 |
+-late_initcall(tango_pm_init); |
94 |
+diff --git a/arch/arm/mach-tango/pm.h b/arch/arm/mach-tango/pm.h |
95 |
+new file mode 100644 |
96 |
+index 000000000000..35ea705a0ee2 |
97 |
+--- /dev/null |
98 |
++++ b/arch/arm/mach-tango/pm.h |
99 |
+@@ -0,0 +1,7 @@ |
100 |
++/* SPDX-License-Identifier: GPL-2.0 */ |
101 |
++ |
102 |
++#ifdef CONFIG_SUSPEND |
103 |
++void __init tango_pm_init(void); |
104 |
++#else |
105 |
++#define tango_pm_init NULL |
106 |
++#endif |
107 |
+diff --git a/arch/arm/mach-tango/setup.c b/arch/arm/mach-tango/setup.c |
108 |
+index 677dd7b5efd9..824f90737b04 100644 |
109 |
+--- a/arch/arm/mach-tango/setup.c |
110 |
++++ b/arch/arm/mach-tango/setup.c |
111 |
+@@ -2,6 +2,7 @@ |
112 |
+ #include <asm/mach/arch.h> |
113 |
+ #include <asm/hardware/cache-l2x0.h> |
114 |
+ #include "smc.h" |
115 |
++#include "pm.h" |
116 |
+ |
117 |
+ static void tango_l2c_write(unsigned long val, unsigned int reg) |
118 |
+ { |
119 |
+@@ -15,4 +16,5 @@ DT_MACHINE_START(TANGO_DT, "Sigma Tango DT") |
120 |
+ .dt_compat = tango_dt_compat, |
121 |
+ .l2c_aux_mask = ~0, |
122 |
+ .l2c_write_sec = tango_l2c_write, |
123 |
++ .init_late = tango_pm_init, |
124 |
+ MACHINE_END |
125 |
+diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c |
126 |
+index 8f5bd04f320a..7f3f136572de 100644 |
127 |
+--- a/arch/mips/kernel/mips-cm.c |
128 |
++++ b/arch/mips/kernel/mips-cm.c |
129 |
+@@ -457,5 +457,5 @@ void mips_cm_error_report(void) |
130 |
+ } |
131 |
+ |
132 |
+ /* reprime cause register */ |
133 |
+- write_gcr_error_cause(0); |
134 |
++ write_gcr_error_cause(cm_error); |
135 |
+ } |
136 |
+diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c |
137 |
+index 3e92a06fa772..4adb8f1fcbc7 100644 |
138 |
+--- a/arch/mips/pci/pci-octeon.c |
139 |
++++ b/arch/mips/pci/pci-octeon.c |
140 |
+@@ -572,6 +572,11 @@ static int __init octeon_pci_setup(void) |
141 |
+ if (octeon_has_feature(OCTEON_FEATURE_PCIE)) |
142 |
+ return 0; |
143 |
+ |
144 |
++ if (!octeon_is_pci_host()) { |
145 |
++ pr_notice("Not in host mode, PCI Controller not initialized\n"); |
146 |
++ return 0; |
147 |
++ } |
148 |
++ |
149 |
+ /* Point pcibios_map_irq() to the PCI version of it */ |
150 |
+ octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; |
151 |
+ |
152 |
+@@ -583,11 +588,6 @@ static int __init octeon_pci_setup(void) |
153 |
+ else |
154 |
+ octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; |
155 |
+ |
156 |
+- if (!octeon_is_pci_host()) { |
157 |
+- pr_notice("Not in host mode, PCI Controller not initialized\n"); |
158 |
+- return 0; |
159 |
+- } |
160 |
+- |
161 |
+ /* PCI I/O and PCI MEM values */ |
162 |
+ set_io_port_base(OCTEON_PCI_IOSPACE_BASE); |
163 |
+ ioport_resource.start = 0; |
164 |
+diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile |
165 |
+index ce196046ac3e..d1a60690e690 100644 |
166 |
+--- a/arch/mips/vdso/Makefile |
167 |
++++ b/arch/mips/vdso/Makefile |
168 |
+@@ -121,7 +121,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE |
169 |
+ $(call cmd,force_checksrc) |
170 |
+ $(call if_changed_rule,cc_o_c) |
171 |
+ |
172 |
+-$(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32 |
173 |
++$(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 |
174 |
+ $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE |
175 |
+ $(call if_changed_dep,cpp_lds_S) |
176 |
+ |
177 |
+@@ -161,7 +161,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE |
178 |
+ $(call cmd,force_checksrc) |
179 |
+ $(call if_changed_rule,cc_o_c) |
180 |
+ |
181 |
+-$(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32 |
182 |
++$(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 |
183 |
+ $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE |
184 |
+ $(call if_changed_dep,cpp_lds_S) |
185 |
+ |
186 |
+diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c |
187 |
+index 4a3f68a33844..3e3035c9e96b 100644 |
188 |
+--- a/drivers/gpu/drm/drm_modes.c |
189 |
++++ b/drivers/gpu/drm/drm_modes.c |
190 |
+@@ -751,7 +751,7 @@ int drm_mode_hsync(const struct drm_display_mode *mode) |
191 |
+ if (mode->hsync) |
192 |
+ return mode->hsync; |
193 |
+ |
194 |
+- if (mode->htotal < 0) |
195 |
++ if (mode->htotal <= 0) |
196 |
+ return 0; |
197 |
+ |
198 |
+ calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ |
199 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
200 |
+index 86d25f18aa99..3bc7915097ad 100644 |
201 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
202 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
203 |
+@@ -604,13 +604,16 @@ out_fixup: |
204 |
+ static int vmw_dma_masks(struct vmw_private *dev_priv) |
205 |
+ { |
206 |
+ struct drm_device *dev = dev_priv->dev; |
207 |
++ int ret = 0; |
208 |
+ |
209 |
+- if (intel_iommu_enabled && |
210 |
++ ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)); |
211 |
++ if (dev_priv->map_mode != vmw_dma_phys && |
212 |
+ (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) { |
213 |
+ DRM_INFO("Restricting DMA addresses to 44 bits.\n"); |
214 |
+- return dma_set_mask(dev->dev, DMA_BIT_MASK(44)); |
215 |
++ return dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(44)); |
216 |
+ } |
217 |
+- return 0; |
218 |
++ |
219 |
++ return ret; |
220 |
+ } |
221 |
+ #else |
222 |
+ static int vmw_dma_masks(struct vmw_private *dev_priv) |
223 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |
224 |
+index 87e8af5776a3..49c28a48c5ab 100644 |
225 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |
226 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |
227 |
+@@ -3818,7 +3818,7 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv, |
228 |
+ *p_fence = NULL; |
229 |
+ } |
230 |
+ |
231 |
+- return 0; |
232 |
++ return ret; |
233 |
+ } |
234 |
+ |
235 |
+ /** |
236 |
+diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c |
237 |
+index ae8c8e66a6c4..a90967cd4987 100644 |
238 |
+--- a/drivers/hid/hid-debug.c |
239 |
++++ b/drivers/hid/hid-debug.c |
240 |
+@@ -30,6 +30,7 @@ |
241 |
+ |
242 |
+ #include <linux/debugfs.h> |
243 |
+ #include <linux/seq_file.h> |
244 |
++#include <linux/kfifo.h> |
245 |
+ #include <linux/sched/signal.h> |
246 |
+ #include <linux/export.h> |
247 |
+ #include <linux/slab.h> |
248 |
+@@ -457,7 +458,7 @@ static char *resolv_usage_page(unsigned page, struct seq_file *f) { |
249 |
+ char *buf = NULL; |
250 |
+ |
251 |
+ if (!f) { |
252 |
+- buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); |
253 |
++ buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_ATOMIC); |
254 |
+ if (!buf) |
255 |
+ return ERR_PTR(-ENOMEM); |
256 |
+ } |
257 |
+@@ -661,17 +662,12 @@ EXPORT_SYMBOL_GPL(hid_dump_device); |
258 |
+ /* enqueue string to 'events' ring buffer */ |
259 |
+ void hid_debug_event(struct hid_device *hdev, char *buf) |
260 |
+ { |
261 |
+- unsigned i; |
262 |
+ struct hid_debug_list *list; |
263 |
+ unsigned long flags; |
264 |
+ |
265 |
+ spin_lock_irqsave(&hdev->debug_list_lock, flags); |
266 |
+- list_for_each_entry(list, &hdev->debug_list, node) { |
267 |
+- for (i = 0; buf[i]; i++) |
268 |
+- list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = |
269 |
+- buf[i]; |
270 |
+- list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; |
271 |
+- } |
272 |
++ list_for_each_entry(list, &hdev->debug_list, node) |
273 |
++ kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); |
274 |
+ spin_unlock_irqrestore(&hdev->debug_list_lock, flags); |
275 |
+ |
276 |
+ wake_up_interruptible(&hdev->debug_wait); |
277 |
+@@ -722,8 +718,7 @@ void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 valu |
278 |
+ hid_debug_event(hdev, buf); |
279 |
+ |
280 |
+ kfree(buf); |
281 |
+- wake_up_interruptible(&hdev->debug_wait); |
282 |
+- |
283 |
++ wake_up_interruptible(&hdev->debug_wait); |
284 |
+ } |
285 |
+ EXPORT_SYMBOL_GPL(hid_dump_input); |
286 |
+ |
287 |
+@@ -1088,8 +1083,8 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) |
288 |
+ goto out; |
289 |
+ } |
290 |
+ |
291 |
+- if (!(list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL))) { |
292 |
+- err = -ENOMEM; |
293 |
++ err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); |
294 |
++ if (err) { |
295 |
+ kfree(list); |
296 |
+ goto out; |
297 |
+ } |
298 |
+@@ -1109,77 +1104,57 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, |
299 |
+ size_t count, loff_t *ppos) |
300 |
+ { |
301 |
+ struct hid_debug_list *list = file->private_data; |
302 |
+- int ret = 0, len; |
303 |
++ int ret = 0, copied; |
304 |
+ DECLARE_WAITQUEUE(wait, current); |
305 |
+ |
306 |
+ mutex_lock(&list->read_mutex); |
307 |
+- while (ret == 0) { |
308 |
+- if (list->head == list->tail) { |
309 |
+- add_wait_queue(&list->hdev->debug_wait, &wait); |
310 |
+- set_current_state(TASK_INTERRUPTIBLE); |
311 |
+- |
312 |
+- while (list->head == list->tail) { |
313 |
+- if (file->f_flags & O_NONBLOCK) { |
314 |
+- ret = -EAGAIN; |
315 |
+- break; |
316 |
+- } |
317 |
+- if (signal_pending(current)) { |
318 |
+- ret = -ERESTARTSYS; |
319 |
+- break; |
320 |
+- } |
321 |
++ if (kfifo_is_empty(&list->hid_debug_fifo)) { |
322 |
++ add_wait_queue(&list->hdev->debug_wait, &wait); |
323 |
++ set_current_state(TASK_INTERRUPTIBLE); |
324 |
++ |
325 |
++ while (kfifo_is_empty(&list->hid_debug_fifo)) { |
326 |
++ if (file->f_flags & O_NONBLOCK) { |
327 |
++ ret = -EAGAIN; |
328 |
++ break; |
329 |
++ } |
330 |
+ |
331 |
+- if (!list->hdev || !list->hdev->debug) { |
332 |
+- ret = -EIO; |
333 |
+- set_current_state(TASK_RUNNING); |
334 |
+- goto out; |
335 |
+- } |
336 |
++ if (signal_pending(current)) { |
337 |
++ ret = -ERESTARTSYS; |
338 |
++ break; |
339 |
++ } |
340 |
+ |
341 |
+- /* allow O_NONBLOCK from other threads */ |
342 |
+- mutex_unlock(&list->read_mutex); |
343 |
+- schedule(); |
344 |
+- mutex_lock(&list->read_mutex); |
345 |
+- set_current_state(TASK_INTERRUPTIBLE); |
346 |
++ /* if list->hdev is NULL we cannot remove_wait_queue(). |
347 |
++ * if list->hdev->debug is 0 then hid_debug_unregister() |
348 |
++ * was already called and list->hdev is being destroyed. |
349 |
++ * if we add remove_wait_queue() here we can hit a race. |
350 |
++ */ |
351 |
++ if (!list->hdev || !list->hdev->debug) { |
352 |
++ ret = -EIO; |
353 |
++ set_current_state(TASK_RUNNING); |
354 |
++ goto out; |
355 |
+ } |
356 |
+ |
357 |
+- set_current_state(TASK_RUNNING); |
358 |
+- remove_wait_queue(&list->hdev->debug_wait, &wait); |
359 |
++ /* allow O_NONBLOCK from other threads */ |
360 |
++ mutex_unlock(&list->read_mutex); |
361 |
++ schedule(); |
362 |
++ mutex_lock(&list->read_mutex); |
363 |
++ set_current_state(TASK_INTERRUPTIBLE); |
364 |
+ } |
365 |
+ |
366 |
+- if (ret) |
367 |
+- goto out; |
368 |
++ __set_current_state(TASK_RUNNING); |
369 |
++ remove_wait_queue(&list->hdev->debug_wait, &wait); |
370 |
+ |
371 |
+- /* pass the ringbuffer contents to userspace */ |
372 |
+-copy_rest: |
373 |
+- if (list->tail == list->head) |
374 |
++ if (ret) |
375 |
+ goto out; |
376 |
+- if (list->tail > list->head) { |
377 |
+- len = list->tail - list->head; |
378 |
+- if (len > count) |
379 |
+- len = count; |
380 |
+- |
381 |
+- if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { |
382 |
+- ret = -EFAULT; |
383 |
+- goto out; |
384 |
+- } |
385 |
+- ret += len; |
386 |
+- list->head += len; |
387 |
+- } else { |
388 |
+- len = HID_DEBUG_BUFSIZE - list->head; |
389 |
+- if (len > count) |
390 |
+- len = count; |
391 |
+- |
392 |
+- if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { |
393 |
+- ret = -EFAULT; |
394 |
+- goto out; |
395 |
+- } |
396 |
+- list->head = 0; |
397 |
+- ret += len; |
398 |
+- count -= len; |
399 |
+- if (count > 0) |
400 |
+- goto copy_rest; |
401 |
+- } |
402 |
+- |
403 |
+ } |
404 |
++ |
405 |
++ /* pass the fifo content to userspace, locking is not needed with only |
406 |
++ * one concurrent reader and one concurrent writer |
407 |
++ */ |
408 |
++ ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); |
409 |
++ if (ret) |
410 |
++ goto out; |
411 |
++ ret = copied; |
412 |
+ out: |
413 |
+ mutex_unlock(&list->read_mutex); |
414 |
+ return ret; |
415 |
+@@ -1190,7 +1165,7 @@ static unsigned int hid_debug_events_poll(struct file *file, poll_table *wait) |
416 |
+ struct hid_debug_list *list = file->private_data; |
417 |
+ |
418 |
+ poll_wait(file, &list->hdev->debug_wait, wait); |
419 |
+- if (list->head != list->tail) |
420 |
++ if (!kfifo_is_empty(&list->hid_debug_fifo)) |
421 |
+ return POLLIN | POLLRDNORM; |
422 |
+ if (!list->hdev->debug) |
423 |
+ return POLLERR | POLLHUP; |
424 |
+@@ -1205,7 +1180,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file) |
425 |
+ spin_lock_irqsave(&list->hdev->debug_list_lock, flags); |
426 |
+ list_del(&list->node); |
427 |
+ spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); |
428 |
+- kfree(list->hid_debug_buf); |
429 |
++ kfifo_free(&list->hid_debug_fifo); |
430 |
+ kfree(list); |
431 |
+ |
432 |
+ return 0; |
433 |
+@@ -1256,4 +1231,3 @@ void hid_debug_exit(void) |
434 |
+ { |
435 |
+ debugfs_remove_recursive(hid_debug_root); |
436 |
+ } |
437 |
+- |
438 |
+diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c |
439 |
+index 462a99c13e7a..0153df01e7b6 100644 |
440 |
+--- a/drivers/iio/adc/axp288_adc.c |
441 |
++++ b/drivers/iio/adc/axp288_adc.c |
442 |
+@@ -27,9 +27,18 @@ |
443 |
+ #include <linux/iio/machine.h> |
444 |
+ #include <linux/iio/driver.h> |
445 |
+ |
446 |
+-#define AXP288_ADC_EN_MASK 0xF1 |
447 |
+-#define AXP288_ADC_TS_PIN_GPADC 0xF2 |
448 |
+-#define AXP288_ADC_TS_PIN_ON 0xF3 |
449 |
++/* |
450 |
++ * This mask enables all ADCs except for the battery temp-sensor (TS), that is |
451 |
++ * left as-is to avoid breaking charging on devices without a temp-sensor. |
452 |
++ */ |
453 |
++#define AXP288_ADC_EN_MASK 0xF0 |
454 |
++#define AXP288_ADC_TS_ENABLE 0x01 |
455 |
++ |
456 |
++#define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) |
457 |
++#define AXP288_ADC_TS_CURRENT_OFF (0 << 0) |
458 |
++#define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) |
459 |
++#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) |
460 |
++#define AXP288_ADC_TS_CURRENT_ON (3 << 0) |
461 |
+ |
462 |
+ enum axp288_adc_id { |
463 |
+ AXP288_ADC_TS, |
464 |
+@@ -44,6 +53,7 @@ enum axp288_adc_id { |
465 |
+ struct axp288_adc_info { |
466 |
+ int irq; |
467 |
+ struct regmap *regmap; |
468 |
++ bool ts_enabled; |
469 |
+ }; |
470 |
+ |
471 |
+ static const struct iio_chan_spec axp288_adc_channels[] = { |
472 |
+@@ -123,21 +133,33 @@ static int axp288_adc_read_channel(int *val, unsigned long address, |
473 |
+ return IIO_VAL_INT; |
474 |
+ } |
475 |
+ |
476 |
+-static int axp288_adc_set_ts(struct regmap *regmap, unsigned int mode, |
477 |
+- unsigned long address) |
478 |
++/* |
479 |
++ * The current-source used for the battery temp-sensor (TS) is shared |
480 |
++ * with the GPADC. For proper fuel-gauge and charger operation the TS |
481 |
++ * current-source needs to be permanently on. But to read the GPADC we |
482 |
++ * need to temporary switch the TS current-source to ondemand, so that |
483 |
++ * the GPADC can use it, otherwise we will always read an all 0 value. |
484 |
++ */ |
485 |
++static int axp288_adc_set_ts(struct axp288_adc_info *info, |
486 |
++ unsigned int mode, unsigned long address) |
487 |
+ { |
488 |
+ int ret; |
489 |
+ |
490 |
+- /* channels other than GPADC do not need to switch TS pin */ |
491 |
++ /* No need to switch the current-source if the TS pin is disabled */ |
492 |
++ if (!info->ts_enabled) |
493 |
++ return 0; |
494 |
++ |
495 |
++ /* Channels other than GPADC do not need the current source */ |
496 |
+ if (address != AXP288_GP_ADC_H) |
497 |
+ return 0; |
498 |
+ |
499 |
+- ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, mode); |
500 |
++ ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, |
501 |
++ AXP288_ADC_TS_CURRENT_ON_OFF_MASK, mode); |
502 |
+ if (ret) |
503 |
+ return ret; |
504 |
+ |
505 |
+ /* When switching to the GPADC pin give things some time to settle */ |
506 |
+- if (mode == AXP288_ADC_TS_PIN_GPADC) |
507 |
++ if (mode == AXP288_ADC_TS_CURRENT_ON_ONDEMAND) |
508 |
+ usleep_range(6000, 10000); |
509 |
+ |
510 |
+ return 0; |
511 |
+@@ -153,14 +175,14 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, |
512 |
+ mutex_lock(&indio_dev->mlock); |
513 |
+ switch (mask) { |
514 |
+ case IIO_CHAN_INFO_RAW: |
515 |
+- if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_GPADC, |
516 |
++ if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON_ONDEMAND, |
517 |
+ chan->address)) { |
518 |
+ dev_err(&indio_dev->dev, "GPADC mode\n"); |
519 |
+ ret = -EINVAL; |
520 |
+ break; |
521 |
+ } |
522 |
+ ret = axp288_adc_read_channel(val, chan->address, info->regmap); |
523 |
+- if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_ON, |
524 |
++ if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON, |
525 |
+ chan->address)) |
526 |
+ dev_err(&indio_dev->dev, "TS pin restore\n"); |
527 |
+ break; |
528 |
+@@ -172,13 +194,35 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, |
529 |
+ return ret; |
530 |
+ } |
531 |
+ |
532 |
+-static int axp288_adc_set_state(struct regmap *regmap) |
533 |
++static int axp288_adc_initialize(struct axp288_adc_info *info) |
534 |
+ { |
535 |
+- /* ADC should be always enabled for internal FG to function */ |
536 |
+- if (regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON)) |
537 |
+- return -EIO; |
538 |
++ int ret, adc_enable_val; |
539 |
++ |
540 |
++ /* |
541 |
++ * Determine if the TS pin is enabled and set the TS current-source |
542 |
++ * accordingly. |
543 |
++ */ |
544 |
++ ret = regmap_read(info->regmap, AXP20X_ADC_EN1, &adc_enable_val); |
545 |
++ if (ret) |
546 |
++ return ret; |
547 |
++ |
548 |
++ if (adc_enable_val & AXP288_ADC_TS_ENABLE) { |
549 |
++ info->ts_enabled = true; |
550 |
++ ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, |
551 |
++ AXP288_ADC_TS_CURRENT_ON_OFF_MASK, |
552 |
++ AXP288_ADC_TS_CURRENT_ON); |
553 |
++ } else { |
554 |
++ info->ts_enabled = false; |
555 |
++ ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, |
556 |
++ AXP288_ADC_TS_CURRENT_ON_OFF_MASK, |
557 |
++ AXP288_ADC_TS_CURRENT_OFF); |
558 |
++ } |
559 |
++ if (ret) |
560 |
++ return ret; |
561 |
+ |
562 |
+- return regmap_write(regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK); |
563 |
++ /* Turn on the ADC for all channels except TS, leave TS as is */ |
564 |
++ return regmap_update_bits(info->regmap, AXP20X_ADC_EN1, |
565 |
++ AXP288_ADC_EN_MASK, AXP288_ADC_EN_MASK); |
566 |
+ } |
567 |
+ |
568 |
+ static const struct iio_info axp288_adc_iio_info = { |
569 |
+@@ -209,7 +253,7 @@ static int axp288_adc_probe(struct platform_device *pdev) |
570 |
+ * Set ADC to enabled state at all time, including system suspend. |
571 |
+ * otherwise internal fuel gauge functionality may be affected. |
572 |
+ */ |
573 |
+- ret = axp288_adc_set_state(axp20x->regmap); |
574 |
++ ret = axp288_adc_initialize(info); |
575 |
+ if (ret) { |
576 |
+ dev_err(&pdev->dev, "unable to enable ADC device\n"); |
577 |
+ return ret; |
578 |
+diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c |
579 |
+index ef761a508630..dad2a8be6830 100644 |
580 |
+--- a/drivers/iio/chemical/atlas-ph-sensor.c |
581 |
++++ b/drivers/iio/chemical/atlas-ph-sensor.c |
582 |
+@@ -453,9 +453,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev, |
583 |
+ case IIO_CHAN_INFO_SCALE: |
584 |
+ switch (chan->type) { |
585 |
+ case IIO_TEMP: |
586 |
+- *val = 1; /* 0.01 */ |
587 |
+- *val2 = 100; |
588 |
+- break; |
589 |
++ *val = 10; |
590 |
++ return IIO_VAL_INT; |
591 |
+ case IIO_PH: |
592 |
+ *val = 1; /* 0.001 */ |
593 |
+ *val2 = 1000; |
594 |
+@@ -486,7 +485,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev, |
595 |
+ int val, int val2, long mask) |
596 |
+ { |
597 |
+ struct atlas_data *data = iio_priv(indio_dev); |
598 |
+- __be32 reg = cpu_to_be32(val); |
599 |
++ __be32 reg = cpu_to_be32(val / 10); |
600 |
+ |
601 |
+ if (val2 != 0 || val < 0 || val > 20000) |
602 |
+ return -EINVAL; |
603 |
+diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c |
604 |
+index 2cde80c7bb93..9b4eba41ee5d 100644 |
605 |
+--- a/drivers/misc/vexpress-syscfg.c |
606 |
++++ b/drivers/misc/vexpress-syscfg.c |
607 |
+@@ -61,7 +61,7 @@ static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func, |
608 |
+ int tries; |
609 |
+ long timeout; |
610 |
+ |
611 |
+- if (WARN_ON(index > func->num_templates)) |
612 |
++ if (WARN_ON(index >= func->num_templates)) |
613 |
+ return -EINVAL; |
614 |
+ |
615 |
+ command = readl(syscfg->base + SYS_CFGCTRL); |
616 |
+diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
617 |
+index 97787246af41..55e369b6b862 100644 |
618 |
+--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
619 |
++++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
620 |
+@@ -168,9 +168,10 @@ int gpmi_init(struct gpmi_nand_data *this) |
621 |
+ |
622 |
+ /* |
623 |
+ * Reset BCH here, too. We got failures otherwise :( |
624 |
+- * See later BCH reset for explanation of MX23 handling |
625 |
++ * See later BCH reset for explanation of MX23 and MX28 handling |
626 |
+ */ |
627 |
+- ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); |
628 |
++ ret = gpmi_reset_block(r->bch_regs, |
629 |
++ GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); |
630 |
+ if (ret) |
631 |
+ goto err_out; |
632 |
+ |
633 |
+@@ -275,13 +276,11 @@ int bch_set_geometry(struct gpmi_nand_data *this) |
634 |
+ |
635 |
+ /* |
636 |
+ * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this |
637 |
+- * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. |
638 |
+- * On the other hand, the MX28 needs the reset, because one case has been |
639 |
+- * seen where the BCH produced ECC errors constantly after 10000 |
640 |
+- * consecutive reboots. The latter case has not been seen on the MX23 |
641 |
+- * yet, still we don't know if it could happen there as well. |
642 |
++ * chip, otherwise it will lock up. So we skip resetting BCH on the MX23 |
643 |
++ * and MX28. |
644 |
+ */ |
645 |
+- ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); |
646 |
++ ret = gpmi_reset_block(r->bch_regs, |
647 |
++ GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); |
648 |
+ if (ret) |
649 |
+ goto err_out; |
650 |
+ |
651 |
+diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c |
652 |
+index 654579bc1e54..fb5c9701b1fb 100644 |
653 |
+--- a/drivers/uio/uio.c |
654 |
++++ b/drivers/uio/uio.c |
655 |
+@@ -215,7 +215,20 @@ static ssize_t name_show(struct device *dev, |
656 |
+ struct device_attribute *attr, char *buf) |
657 |
+ { |
658 |
+ struct uio_device *idev = dev_get_drvdata(dev); |
659 |
+- return sprintf(buf, "%s\n", idev->info->name); |
660 |
++ int ret; |
661 |
++ |
662 |
++ mutex_lock(&idev->info_lock); |
663 |
++ if (!idev->info) { |
664 |
++ ret = -EINVAL; |
665 |
++ dev_err(dev, "the device has been unregistered\n"); |
666 |
++ goto out; |
667 |
++ } |
668 |
++ |
669 |
++ ret = sprintf(buf, "%s\n", idev->info->name); |
670 |
++ |
671 |
++out: |
672 |
++ mutex_unlock(&idev->info_lock); |
673 |
++ return ret; |
674 |
+ } |
675 |
+ static DEVICE_ATTR_RO(name); |
676 |
+ |
677 |
+@@ -223,7 +236,20 @@ static ssize_t version_show(struct device *dev, |
678 |
+ struct device_attribute *attr, char *buf) |
679 |
+ { |
680 |
+ struct uio_device *idev = dev_get_drvdata(dev); |
681 |
+- return sprintf(buf, "%s\n", idev->info->version); |
682 |
++ int ret; |
683 |
++ |
684 |
++ mutex_lock(&idev->info_lock); |
685 |
++ if (!idev->info) { |
686 |
++ ret = -EINVAL; |
687 |
++ dev_err(dev, "the device has been unregistered\n"); |
688 |
++ goto out; |
689 |
++ } |
690 |
++ |
691 |
++ ret = sprintf(buf, "%s\n", idev->info->version); |
692 |
++ |
693 |
++out: |
694 |
++ mutex_unlock(&idev->info_lock); |
695 |
++ return ret; |
696 |
+ } |
697 |
+ static DEVICE_ATTR_RO(version); |
698 |
+ |
699 |
+@@ -272,7 +298,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) |
700 |
+ if (!map_found) { |
701 |
+ map_found = 1; |
702 |
+ idev->map_dir = kobject_create_and_add("maps", |
703 |
+- &idev->dev->kobj); |
704 |
++ &idev->dev.kobj); |
705 |
+ if (!idev->map_dir) { |
706 |
+ ret = -ENOMEM; |
707 |
+ goto err_map; |
708 |
+@@ -301,7 +327,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) |
709 |
+ if (!portio_found) { |
710 |
+ portio_found = 1; |
711 |
+ idev->portio_dir = kobject_create_and_add("portio", |
712 |
+- &idev->dev->kobj); |
713 |
++ &idev->dev.kobj); |
714 |
+ if (!idev->portio_dir) { |
715 |
+ ret = -ENOMEM; |
716 |
+ goto err_portio; |
717 |
+@@ -344,7 +370,7 @@ err_map_kobj: |
718 |
+ kobject_put(&map->kobj); |
719 |
+ } |
720 |
+ kobject_put(idev->map_dir); |
721 |
+- dev_err(idev->dev, "error creating sysfs files (%d)\n", ret); |
722 |
++ dev_err(&idev->dev, "error creating sysfs files (%d)\n", ret); |
723 |
+ return ret; |
724 |
+ } |
725 |
+ |
726 |
+@@ -381,7 +407,7 @@ static int uio_get_minor(struct uio_device *idev) |
727 |
+ idev->minor = retval; |
728 |
+ retval = 0; |
729 |
+ } else if (retval == -ENOSPC) { |
730 |
+- dev_err(idev->dev, "too many uio devices\n"); |
731 |
++ dev_err(&idev->dev, "too many uio devices\n"); |
732 |
+ retval = -EINVAL; |
733 |
+ } |
734 |
+ mutex_unlock(&minor_lock); |
735 |
+@@ -417,8 +443,9 @@ EXPORT_SYMBOL_GPL(uio_event_notify); |
736 |
+ static irqreturn_t uio_interrupt(int irq, void *dev_id) |
737 |
+ { |
738 |
+ struct uio_device *idev = (struct uio_device *)dev_id; |
739 |
+- irqreturn_t ret = idev->info->handler(irq, idev->info); |
740 |
++ irqreturn_t ret; |
741 |
+ |
742 |
++ ret = idev->info->handler(irq, idev->info); |
743 |
+ if (ret == IRQ_HANDLED) |
744 |
+ uio_event_notify(idev->info); |
745 |
+ |
746 |
+@@ -444,9 +471,11 @@ static int uio_open(struct inode *inode, struct file *filep) |
747 |
+ goto out; |
748 |
+ } |
749 |
+ |
750 |
++ get_device(&idev->dev); |
751 |
++ |
752 |
+ if (!try_module_get(idev->owner)) { |
753 |
+ ret = -ENODEV; |
754 |
+- goto out; |
755 |
++ goto err_module_get; |
756 |
+ } |
757 |
+ |
758 |
+ listener = kmalloc(sizeof(*listener), GFP_KERNEL); |
759 |
+@@ -459,11 +488,19 @@ static int uio_open(struct inode *inode, struct file *filep) |
760 |
+ listener->event_count = atomic_read(&idev->event); |
761 |
+ filep->private_data = listener; |
762 |
+ |
763 |
+- if (idev->info->open) { |
764 |
+- ret = idev->info->open(idev->info, inode); |
765 |
+- if (ret) |
766 |
+- goto err_infoopen; |
767 |
++ mutex_lock(&idev->info_lock); |
768 |
++ if (!idev->info) { |
769 |
++ mutex_unlock(&idev->info_lock); |
770 |
++ ret = -EINVAL; |
771 |
++ goto err_alloc_listener; |
772 |
+ } |
773 |
++ |
774 |
++ if (idev->info && idev->info->open) |
775 |
++ ret = idev->info->open(idev->info, inode); |
776 |
++ mutex_unlock(&idev->info_lock); |
777 |
++ if (ret) |
778 |
++ goto err_infoopen; |
779 |
++ |
780 |
+ return 0; |
781 |
+ |
782 |
+ err_infoopen: |
783 |
+@@ -472,6 +509,9 @@ err_infoopen: |
784 |
+ err_alloc_listener: |
785 |
+ module_put(idev->owner); |
786 |
+ |
787 |
++err_module_get: |
788 |
++ put_device(&idev->dev); |
789 |
++ |
790 |
+ out: |
791 |
+ return ret; |
792 |
+ } |
793 |
+@@ -490,11 +530,14 @@ static int uio_release(struct inode *inode, struct file *filep) |
794 |
+ struct uio_listener *listener = filep->private_data; |
795 |
+ struct uio_device *idev = listener->dev; |
796 |
+ |
797 |
+- if (idev->info->release) |
798 |
++ mutex_lock(&idev->info_lock); |
799 |
++ if (idev->info && idev->info->release) |
800 |
+ ret = idev->info->release(idev->info, inode); |
801 |
++ mutex_unlock(&idev->info_lock); |
802 |
+ |
803 |
+ module_put(idev->owner); |
804 |
+ kfree(listener); |
805 |
++ put_device(&idev->dev); |
806 |
+ return ret; |
807 |
+ } |
808 |
+ |
809 |
+@@ -502,9 +545,15 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait) |
810 |
+ { |
811 |
+ struct uio_listener *listener = filep->private_data; |
812 |
+ struct uio_device *idev = listener->dev; |
813 |
++ unsigned int ret = 0; |
814 |
+ |
815 |
+- if (!idev->info->irq) |
816 |
+- return -EIO; |
817 |
++ mutex_lock(&idev->info_lock); |
818 |
++ if (!idev->info || !idev->info->irq) |
819 |
++ ret = -EIO; |
820 |
++ mutex_unlock(&idev->info_lock); |
821 |
++ |
822 |
++ if (ret) |
823 |
++ return ret; |
824 |
+ |
825 |
+ poll_wait(filep, &idev->wait, wait); |
826 |
+ if (listener->event_count != atomic_read(&idev->event)) |
827 |
+@@ -518,11 +567,16 @@ static ssize_t uio_read(struct file *filep, char __user *buf, |
828 |
+ struct uio_listener *listener = filep->private_data; |
829 |
+ struct uio_device *idev = listener->dev; |
830 |
+ DECLARE_WAITQUEUE(wait, current); |
831 |
+- ssize_t retval; |
832 |
++ ssize_t retval = 0; |
833 |
+ s32 event_count; |
834 |
+ |
835 |
+- if (!idev->info->irq) |
836 |
+- return -EIO; |
837 |
++ mutex_lock(&idev->info_lock); |
838 |
++ if (!idev->info || !idev->info->irq) |
839 |
++ retval = -EIO; |
840 |
++ mutex_unlock(&idev->info_lock); |
841 |
++ |
842 |
++ if (retval) |
843 |
++ return retval; |
844 |
+ |
845 |
+ if (count != sizeof(s32)) |
846 |
+ return -EINVAL; |
847 |
+@@ -570,20 +624,32 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, |
848 |
+ ssize_t retval; |
849 |
+ s32 irq_on; |
850 |
+ |
851 |
+- if (!idev->info->irq) |
852 |
+- return -EIO; |
853 |
+- |
854 |
+ if (count != sizeof(s32)) |
855 |
+ return -EINVAL; |
856 |
+ |
857 |
+- if (!idev->info->irqcontrol) |
858 |
+- return -ENOSYS; |
859 |
+- |
860 |
+ if (copy_from_user(&irq_on, buf, count)) |
861 |
+ return -EFAULT; |
862 |
+ |
863 |
++ mutex_lock(&idev->info_lock); |
864 |
++ if (!idev->info) { |
865 |
++ retval = -EINVAL; |
866 |
++ goto out; |
867 |
++ } |
868 |
++ |
869 |
++ if (!idev->info || !idev->info->irq) { |
870 |
++ retval = -EIO; |
871 |
++ goto out; |
872 |
++ } |
873 |
++ |
874 |
++ if (!idev->info->irqcontrol) { |
875 |
++ retval = -ENOSYS; |
876 |
++ goto out; |
877 |
++ } |
878 |
++ |
879 |
+ retval = idev->info->irqcontrol(idev->info, irq_on); |
880 |
+ |
881 |
++out: |
882 |
++ mutex_unlock(&idev->info_lock); |
883 |
+ return retval ? retval : sizeof(s32); |
884 |
+ } |
885 |
+ |
886 |
+@@ -605,10 +671,20 @@ static int uio_vma_fault(struct vm_fault *vmf) |
887 |
+ struct page *page; |
888 |
+ unsigned long offset; |
889 |
+ void *addr; |
890 |
++ int ret = 0; |
891 |
++ int mi; |
892 |
+ |
893 |
+- int mi = uio_find_mem_index(vmf->vma); |
894 |
+- if (mi < 0) |
895 |
+- return VM_FAULT_SIGBUS; |
896 |
++ mutex_lock(&idev->info_lock); |
897 |
++ if (!idev->info) { |
898 |
++ ret = VM_FAULT_SIGBUS; |
899 |
++ goto out; |
900 |
++ } |
901 |
++ |
902 |
++ mi = uio_find_mem_index(vmf->vma); |
903 |
++ if (mi < 0) { |
904 |
++ ret = VM_FAULT_SIGBUS; |
905 |
++ goto out; |
906 |
++ } |
907 |
+ |
908 |
+ /* |
909 |
+ * We need to subtract mi because userspace uses offset = N*PAGE_SIZE |
910 |
+@@ -623,7 +699,11 @@ static int uio_vma_fault(struct vm_fault *vmf) |
911 |
+ page = vmalloc_to_page(addr); |
912 |
+ get_page(page); |
913 |
+ vmf->page = page; |
914 |
+- return 0; |
915 |
++ |
916 |
++out: |
917 |
++ mutex_unlock(&idev->info_lock); |
918 |
++ |
919 |
++ return ret; |
920 |
+ } |
921 |
+ |
922 |
+ static const struct vm_operations_struct uio_logical_vm_ops = { |
923 |
+@@ -648,6 +728,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma) |
924 |
+ struct uio_device *idev = vma->vm_private_data; |
925 |
+ int mi = uio_find_mem_index(vma); |
926 |
+ struct uio_mem *mem; |
927 |
++ |
928 |
+ if (mi < 0) |
929 |
+ return -EINVAL; |
930 |
+ mem = idev->info->mem + mi; |
931 |
+@@ -689,30 +770,46 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma) |
932 |
+ |
933 |
+ vma->vm_private_data = idev; |
934 |
+ |
935 |
++ mutex_lock(&idev->info_lock); |
936 |
++ if (!idev->info) { |
937 |
++ ret = -EINVAL; |
938 |
++ goto out; |
939 |
++ } |
940 |
++ |
941 |
+ mi = uio_find_mem_index(vma); |
942 |
+- if (mi < 0) |
943 |
+- return -EINVAL; |
944 |
++ if (mi < 0) { |
945 |
++ ret = -EINVAL; |
946 |
++ goto out; |
947 |
++ } |
948 |
+ |
949 |
+ requested_pages = vma_pages(vma); |
950 |
+ actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK) |
951 |
+ + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; |
952 |
+- if (requested_pages > actual_pages) |
953 |
+- return -EINVAL; |
954 |
++ if (requested_pages > actual_pages) { |
955 |
++ ret = -EINVAL; |
956 |
++ goto out; |
957 |
++ } |
958 |
+ |
959 |
+ if (idev->info->mmap) { |
960 |
+ ret = idev->info->mmap(idev->info, vma); |
961 |
+- return ret; |
962 |
++ goto out; |
963 |
+ } |
964 |
+ |
965 |
+ switch (idev->info->mem[mi].memtype) { |
966 |
+ case UIO_MEM_PHYS: |
967 |
+- return uio_mmap_physical(vma); |
968 |
++ ret = uio_mmap_physical(vma); |
969 |
++ break; |
970 |
+ case UIO_MEM_LOGICAL: |
971 |
+ case UIO_MEM_VIRTUAL: |
972 |
+- return uio_mmap_logical(vma); |
973 |
++ ret = uio_mmap_logical(vma); |
974 |
++ break; |
975 |
+ default: |
976 |
+- return -EINVAL; |
977 |
++ ret = -EINVAL; |
978 |
+ } |
979 |
++ |
980 |
++out: |
981 |
++ mutex_unlock(&idev->info_lock); |
982 |
++ return ret; |
983 |
+ } |
984 |
+ |
985 |
+ static const struct file_operations uio_fops = { |
986 |
+@@ -800,6 +897,13 @@ static void release_uio_class(void) |
987 |
+ uio_major_cleanup(); |
988 |
+ } |
989 |
+ |
990 |
++static void uio_device_release(struct device *dev) |
991 |
++{ |
992 |
++ struct uio_device *idev = dev_get_drvdata(dev); |
993 |
++ |
994 |
++ kfree(idev); |
995 |
++} |
996 |
++ |
997 |
+ /** |
998 |
+ * uio_register_device - register a new userspace IO device |
999 |
+ * @owner: module that creates the new device |
1000 |
+@@ -823,13 +927,14 @@ int __uio_register_device(struct module *owner, |
1001 |
+ |
1002 |
+ info->uio_dev = NULL; |
1003 |
+ |
1004 |
+- idev = devm_kzalloc(parent, sizeof(*idev), GFP_KERNEL); |
1005 |
++ idev = kzalloc(sizeof(*idev), GFP_KERNEL); |
1006 |
+ if (!idev) { |
1007 |
+ return -ENOMEM; |
1008 |
+ } |
1009 |
+ |
1010 |
+ idev->owner = owner; |
1011 |
+ idev->info = info; |
1012 |
++ mutex_init(&idev->info_lock); |
1013 |
+ init_waitqueue_head(&idev->wait); |
1014 |
+ atomic_set(&idev->event, 0); |
1015 |
+ |
1016 |
+@@ -837,14 +942,19 @@ int __uio_register_device(struct module *owner, |
1017 |
+ if (ret) |
1018 |
+ return ret; |
1019 |
+ |
1020 |
+- idev->dev = device_create(&uio_class, parent, |
1021 |
+- MKDEV(uio_major, idev->minor), idev, |
1022 |
+- "uio%d", idev->minor); |
1023 |
+- if (IS_ERR(idev->dev)) { |
1024 |
+- printk(KERN_ERR "UIO: device register failed\n"); |
1025 |
+- ret = PTR_ERR(idev->dev); |
1026 |
++ idev->dev.devt = MKDEV(uio_major, idev->minor); |
1027 |
++ idev->dev.class = &uio_class; |
1028 |
++ idev->dev.parent = parent; |
1029 |
++ idev->dev.release = uio_device_release; |
1030 |
++ dev_set_drvdata(&idev->dev, idev); |
1031 |
++ |
1032 |
++ ret = dev_set_name(&idev->dev, "uio%d", idev->minor); |
1033 |
++ if (ret) |
1034 |
++ goto err_device_create; |
1035 |
++ |
1036 |
++ ret = device_register(&idev->dev); |
1037 |
++ if (ret) |
1038 |
+ goto err_device_create; |
1039 |
+- } |
1040 |
+ |
1041 |
+ ret = uio_dev_add_attributes(idev); |
1042 |
+ if (ret) |
1043 |
+@@ -874,7 +984,7 @@ int __uio_register_device(struct module *owner, |
1044 |
+ err_request_irq: |
1045 |
+ uio_dev_del_attributes(idev); |
1046 |
+ err_uio_dev_add_attributes: |
1047 |
+- device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); |
1048 |
++ device_unregister(&idev->dev); |
1049 |
+ err_device_create: |
1050 |
+ uio_free_minor(idev); |
1051 |
+ return ret; |
1052 |
+@@ -897,12 +1007,16 @@ void uio_unregister_device(struct uio_info *info) |
1053 |
+ |
1054 |
+ uio_free_minor(idev); |
1055 |
+ |
1056 |
++ mutex_lock(&idev->info_lock); |
1057 |
+ uio_dev_del_attributes(idev); |
1058 |
+ |
1059 |
+ if (info->irq && info->irq != UIO_IRQ_CUSTOM) |
1060 |
+ free_irq(info->irq, idev); |
1061 |
+ |
1062 |
+- device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); |
1063 |
++ idev->info = NULL; |
1064 |
++ mutex_unlock(&idev->info_lock); |
1065 |
++ |
1066 |
++ device_unregister(&idev->dev); |
1067 |
+ |
1068 |
+ return; |
1069 |
+ } |
1070 |
+diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c |
1071 |
+index c59f015f386e..ccfe1e1cb6bc 100644 |
1072 |
+--- a/fs/debugfs/inode.c |
1073 |
++++ b/fs/debugfs/inode.c |
1074 |
+@@ -766,6 +766,13 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
1075 |
+ struct dentry *dentry = NULL, *trap; |
1076 |
+ struct name_snapshot old_name; |
1077 |
+ |
1078 |
++ if (IS_ERR(old_dir)) |
1079 |
++ return old_dir; |
1080 |
++ if (IS_ERR(new_dir)) |
1081 |
++ return new_dir; |
1082 |
++ if (IS_ERR_OR_NULL(old_dentry)) |
1083 |
++ return old_dentry; |
1084 |
++ |
1085 |
+ trap = lock_rename(new_dir, old_dir); |
1086 |
+ /* Source or destination directories don't exist? */ |
1087 |
+ if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir)) |
1088 |
+diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c |
1089 |
+index 712f00995390..5508baa11bb6 100644 |
1090 |
+--- a/fs/ext4/fsync.c |
1091 |
++++ b/fs/ext4/fsync.c |
1092 |
+@@ -116,16 +116,8 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
1093 |
+ goto out; |
1094 |
+ } |
1095 |
+ |
1096 |
+- ret = file_write_and_wait_range(file, start, end); |
1097 |
+- if (ret) |
1098 |
+- return ret; |
1099 |
+- |
1100 |
+ if (!journal) { |
1101 |
+- struct writeback_control wbc = { |
1102 |
+- .sync_mode = WB_SYNC_ALL |
1103 |
+- }; |
1104 |
+- |
1105 |
+- ret = ext4_write_inode(inode, &wbc); |
1106 |
++ ret = __generic_file_fsync(file, start, end, datasync); |
1107 |
+ if (!ret) |
1108 |
+ ret = ext4_sync_parent(inode); |
1109 |
+ if (test_opt(inode->i_sb, BARRIER)) |
1110 |
+@@ -133,6 +125,9 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
1111 |
+ goto out; |
1112 |
+ } |
1113 |
+ |
1114 |
++ ret = file_write_and_wait_range(file, start, end); |
1115 |
++ if (ret) |
1116 |
++ return ret; |
1117 |
+ /* |
1118 |
+ * data=writeback,ordered: |
1119 |
+ * The caller's filemap_fdatawrite()/wait will sync the data. |
1120 |
+diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h |
1121 |
+index 8663f216c563..2d6100edf204 100644 |
1122 |
+--- a/include/linux/hid-debug.h |
1123 |
++++ b/include/linux/hid-debug.h |
1124 |
+@@ -24,7 +24,10 @@ |
1125 |
+ |
1126 |
+ #ifdef CONFIG_DEBUG_FS |
1127 |
+ |
1128 |
++#include <linux/kfifo.h> |
1129 |
++ |
1130 |
+ #define HID_DEBUG_BUFSIZE 512 |
1131 |
++#define HID_DEBUG_FIFOSIZE 512 |
1132 |
+ |
1133 |
+ void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); |
1134 |
+ void hid_dump_report(struct hid_device *, int , u8 *, int); |
1135 |
+@@ -37,11 +40,8 @@ void hid_debug_init(void); |
1136 |
+ void hid_debug_exit(void); |
1137 |
+ void hid_debug_event(struct hid_device *, char *); |
1138 |
+ |
1139 |
+- |
1140 |
+ struct hid_debug_list { |
1141 |
+- char *hid_debug_buf; |
1142 |
+- int head; |
1143 |
+- int tail; |
1144 |
++ DECLARE_KFIFO_PTR(hid_debug_fifo, char); |
1145 |
+ struct fasync_struct *fasync; |
1146 |
+ struct hid_device *hdev; |
1147 |
+ struct list_head node; |
1148 |
+@@ -64,4 +64,3 @@ struct hid_debug_list { |
1149 |
+ #endif |
1150 |
+ |
1151 |
+ #endif |
1152 |
+- |
1153 |
+diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h |
1154 |
+index 3c85c81b0027..6f8b68cd460f 100644 |
1155 |
+--- a/include/linux/uio_driver.h |
1156 |
++++ b/include/linux/uio_driver.h |
1157 |
+@@ -14,6 +14,7 @@ |
1158 |
+ #ifndef _UIO_DRIVER_H_ |
1159 |
+ #define _UIO_DRIVER_H_ |
1160 |
+ |
1161 |
++#include <linux/device.h> |
1162 |
+ #include <linux/fs.h> |
1163 |
+ #include <linux/interrupt.h> |
1164 |
+ |
1165 |
+@@ -68,12 +69,13 @@ struct uio_port { |
1166 |
+ |
1167 |
+ struct uio_device { |
1168 |
+ struct module *owner; |
1169 |
+- struct device *dev; |
1170 |
++ struct device dev; |
1171 |
+ int minor; |
1172 |
+ atomic_t event; |
1173 |
+ struct fasync_struct *async_queue; |
1174 |
+ wait_queue_head_t wait; |
1175 |
+ struct uio_info *info; |
1176 |
++ struct mutex info_lock; |
1177 |
+ struct kobject *map_dir; |
1178 |
+ struct kobject *portio_dir; |
1179 |
+ }; |
1180 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
1181 |
+index 164c36ef0825..04b3a621b3cc 100644 |
1182 |
+--- a/kernel/signal.c |
1183 |
++++ b/kernel/signal.c |
1184 |
+@@ -672,6 +672,48 @@ void signal_wake_up_state(struct task_struct *t, unsigned int state) |
1185 |
+ kick_process(t); |
1186 |
+ } |
1187 |
+ |
1188 |
++static int dequeue_synchronous_signal(siginfo_t *info) |
1189 |
++{ |
1190 |
++ struct task_struct *tsk = current; |
1191 |
++ struct sigpending *pending = &tsk->pending; |
1192 |
++ struct sigqueue *q, *sync = NULL; |
1193 |
++ |
1194 |
++ /* |
1195 |
++ * Might a synchronous signal be in the queue? |
1196 |
++ */ |
1197 |
++ if (!((pending->signal.sig[0] & ~tsk->blocked.sig[0]) & SYNCHRONOUS_MASK)) |
1198 |
++ return 0; |
1199 |
++ |
1200 |
++ /* |
1201 |
++ * Return the first synchronous signal in the queue. |
1202 |
++ */ |
1203 |
++ list_for_each_entry(q, &pending->list, list) { |
1204 |
++ /* Synchronous signals have a postive si_code */ |
1205 |
++ if ((q->info.si_code > SI_USER) && |
1206 |
++ (sigmask(q->info.si_signo) & SYNCHRONOUS_MASK)) { |
1207 |
++ sync = q; |
1208 |
++ goto next; |
1209 |
++ } |
1210 |
++ } |
1211 |
++ return 0; |
1212 |
++next: |
1213 |
++ /* |
1214 |
++ * Check if there is another siginfo for the same signal. |
1215 |
++ */ |
1216 |
++ list_for_each_entry_continue(q, &pending->list, list) { |
1217 |
++ if (q->info.si_signo == sync->info.si_signo) |
1218 |
++ goto still_pending; |
1219 |
++ } |
1220 |
++ |
1221 |
++ sigdelset(&pending->signal, sync->info.si_signo); |
1222 |
++ recalc_sigpending(); |
1223 |
++still_pending: |
1224 |
++ list_del_init(&sync->list); |
1225 |
++ copy_siginfo(info, &sync->info); |
1226 |
++ __sigqueue_free(sync); |
1227 |
++ return info->si_signo; |
1228 |
++} |
1229 |
++ |
1230 |
+ /* |
1231 |
+ * Remove signals in mask from the pending set and queue. |
1232 |
+ * Returns 1 if any signals were found. |
1233 |
+@@ -2225,6 +2267,11 @@ relock: |
1234 |
+ goto relock; |
1235 |
+ } |
1236 |
+ |
1237 |
++ /* Has this task already been marked for death? */ |
1238 |
++ ksig->info.si_signo = signr = SIGKILL; |
1239 |
++ if (signal_group_exit(signal)) |
1240 |
++ goto fatal; |
1241 |
++ |
1242 |
+ for (;;) { |
1243 |
+ struct k_sigaction *ka; |
1244 |
+ |
1245 |
+@@ -2238,7 +2285,15 @@ relock: |
1246 |
+ goto relock; |
1247 |
+ } |
1248 |
+ |
1249 |
+- signr = dequeue_signal(current, ¤t->blocked, &ksig->info); |
1250 |
++ /* |
1251 |
++ * Signals generated by the execution of an instruction |
1252 |
++ * need to be delivered before any other pending signals |
1253 |
++ * so that the instruction pointer in the signal stack |
1254 |
++ * frame points to the faulting instruction. |
1255 |
++ */ |
1256 |
++ signr = dequeue_synchronous_signal(&ksig->info); |
1257 |
++ if (!signr) |
1258 |
++ signr = dequeue_signal(current, ¤t->blocked, &ksig->info); |
1259 |
+ |
1260 |
+ if (!signr) |
1261 |
+ break; /* will return 0 */ |
1262 |
+@@ -2320,6 +2375,7 @@ relock: |
1263 |
+ continue; |
1264 |
+ } |
1265 |
+ |
1266 |
++ fatal: |
1267 |
+ spin_unlock_irq(&sighand->siglock); |
1268 |
+ |
1269 |
+ /* |
1270 |
+diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
1271 |
+index ea0d90a31fc9..86718c85d8d3 100644 |
1272 |
+--- a/kernel/trace/trace_uprobe.c |
1273 |
++++ b/kernel/trace/trace_uprobe.c |
1274 |
+@@ -17,7 +17,7 @@ |
1275 |
+ * Copyright (C) IBM Corporation, 2010-2012 |
1276 |
+ * Author: Srikar Dronamraju <srikar@××××××××××××××.com> |
1277 |
+ */ |
1278 |
+-#define pr_fmt(fmt) "trace_kprobe: " fmt |
1279 |
++#define pr_fmt(fmt) "trace_uprobe: " fmt |
1280 |
+ |
1281 |
+ #include <linux/module.h> |
1282 |
+ #include <linux/uaccess.h> |
1283 |
+diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c |
1284 |
+index e348f76ea8c1..2e1a084b0bd2 100644 |
1285 |
+--- a/net/batman-adv/hard-interface.c |
1286 |
++++ b/net/batman-adv/hard-interface.c |
1287 |
+@@ -19,7 +19,6 @@ |
1288 |
+ #include "main.h" |
1289 |
+ |
1290 |
+ #include <linux/atomic.h> |
1291 |
+-#include <linux/bug.h> |
1292 |
+ #include <linux/byteorder/generic.h> |
1293 |
+ #include <linux/errno.h> |
1294 |
+ #include <linux/fs.h> |
1295 |
+@@ -172,8 +171,10 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) |
1296 |
+ parent_dev = __dev_get_by_index((struct net *)parent_net, |
1297 |
+ dev_get_iflink(net_dev)); |
1298 |
+ /* if we got a NULL parent_dev there is something broken.. */ |
1299 |
+- if (WARN(!parent_dev, "Cannot find parent device")) |
1300 |
++ if (!parent_dev) { |
1301 |
++ pr_err("Cannot find parent device\n"); |
1302 |
+ return false; |
1303 |
++ } |
1304 |
+ |
1305 |
+ if (batadv_mutual_parents(net_dev, net, parent_dev, parent_net)) |
1306 |
+ return false; |
1307 |
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c |
1308 |
+index 8cedb5db1ab3..3a80beef247c 100644 |
1309 |
+--- a/net/batman-adv/soft-interface.c |
1310 |
++++ b/net/batman-adv/soft-interface.c |
1311 |
+@@ -213,6 +213,8 @@ static int batadv_interface_tx(struct sk_buff *skb, |
1312 |
+ |
1313 |
+ netif_trans_update(soft_iface); |
1314 |
+ vid = batadv_get_vid(skb, 0); |
1315 |
++ |
1316 |
++ skb_reset_mac_header(skb); |
1317 |
+ ethhdr = eth_hdr(skb); |
1318 |
+ |
1319 |
+ switch (ntohs(ethhdr->h_proto)) { |
1320 |
+diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c |
1321 |
+index f864807284d4..5fd222dc64b3 100644 |
1322 |
+--- a/net/ceph/messenger.c |
1323 |
++++ b/net/ceph/messenger.c |
1324 |
+@@ -3210,9 +3210,10 @@ void ceph_con_keepalive(struct ceph_connection *con) |
1325 |
+ dout("con_keepalive %p\n", con); |
1326 |
+ mutex_lock(&con->mutex); |
1327 |
+ clear_standby(con); |
1328 |
++ con_flag_set(con, CON_FLAG_KEEPALIVE_PENDING); |
1329 |
+ mutex_unlock(&con->mutex); |
1330 |
+- if (con_flag_test_and_set(con, CON_FLAG_KEEPALIVE_PENDING) == 0 && |
1331 |
+- con_flag_test_and_set(con, CON_FLAG_WRITE_PENDING) == 0) |
1332 |
++ |
1333 |
++ if (con_flag_test_and_set(con, CON_FLAG_WRITE_PENDING) == 0) |
1334 |
+ queue_con(con); |
1335 |
+ } |
1336 |
+ EXPORT_SYMBOL(ceph_con_keepalive); |
1337 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
1338 |
+index 6b9bf9c027a2..305a4655f23e 100644 |
1339 |
+--- a/net/mac80211/tx.c |
1340 |
++++ b/net/mac80211/tx.c |
1341 |
+@@ -1856,9 +1856,16 @@ static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, |
1342 |
+ int head_need, bool may_encrypt) |
1343 |
+ { |
1344 |
+ struct ieee80211_local *local = sdata->local; |
1345 |
++ struct ieee80211_hdr *hdr; |
1346 |
++ bool enc_tailroom; |
1347 |
+ int tail_need = 0; |
1348 |
+ |
1349 |
+- if (may_encrypt && sdata->crypto_tx_tailroom_needed_cnt) { |
1350 |
++ hdr = (struct ieee80211_hdr *) skb->data; |
1351 |
++ enc_tailroom = may_encrypt && |
1352 |
++ (sdata->crypto_tx_tailroom_needed_cnt || |
1353 |
++ ieee80211_is_mgmt(hdr->frame_control)); |
1354 |
++ |
1355 |
++ if (enc_tailroom) { |
1356 |
+ tail_need = IEEE80211_ENCRYPT_TAILROOM; |
1357 |
+ tail_need -= skb_tailroom(skb); |
1358 |
+ tail_need = max_t(int, tail_need, 0); |
1359 |
+@@ -1866,8 +1873,7 @@ static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, |
1360 |
+ |
1361 |
+ if (skb_cloned(skb) && |
1362 |
+ (!ieee80211_hw_check(&local->hw, SUPPORTS_CLONED_SKBS) || |
1363 |
+- !skb_clone_writable(skb, ETH_HLEN) || |
1364 |
+- (may_encrypt && sdata->crypto_tx_tailroom_needed_cnt))) |
1365 |
++ !skb_clone_writable(skb, ETH_HLEN) || enc_tailroom)) |
1366 |
+ I802_DEBUG_INC(local->tx_expand_skb_head_cloned); |
1367 |
+ else if (head_need || tail_need) |
1368 |
+ I802_DEBUG_INC(local->tx_expand_skb_head); |
1369 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
1370 |
+index 4e8319766f2b..9ff9255d2191 100644 |
1371 |
+--- a/net/xfrm/xfrm_user.c |
1372 |
++++ b/net/xfrm/xfrm_user.c |
1373 |
+@@ -1445,10 +1445,15 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) |
1374 |
+ if (!ut[i].family) |
1375 |
+ ut[i].family = family; |
1376 |
+ |
1377 |
+- if ((ut[i].mode == XFRM_MODE_TRANSPORT) && |
1378 |
+- (ut[i].family != prev_family)) |
1379 |
+- return -EINVAL; |
1380 |
+- |
1381 |
++ switch (ut[i].mode) { |
1382 |
++ case XFRM_MODE_TUNNEL: |
1383 |
++ case XFRM_MODE_BEET: |
1384 |
++ break; |
1385 |
++ default: |
1386 |
++ if (ut[i].family != prev_family) |
1387 |
++ return -EINVAL; |
1388 |
++ break; |
1389 |
++ } |
1390 |
+ if (ut[i].mode >= XFRM_MODE_MAX) |
1391 |
+ return -EINVAL; |
1392 |
+ |
1393 |
+diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c |
1394 |
+index 57d0d871dcf7..bb9988914a56 100644 |
1395 |
+--- a/samples/mei/mei-amt-version.c |
1396 |
++++ b/samples/mei/mei-amt-version.c |
1397 |
+@@ -117,7 +117,7 @@ static bool mei_init(struct mei *me, const uuid_le *guid, |
1398 |
+ |
1399 |
+ me->verbose = verbose; |
1400 |
+ |
1401 |
+- me->fd = open("/dev/mei", O_RDWR); |
1402 |
++ me->fd = open("/dev/mei0", O_RDWR); |
1403 |
+ if (me->fd == -1) { |
1404 |
+ mei_err(me, "Cannot establish a handle to the Intel MEI driver\n"); |
1405 |
+ goto err; |
1406 |
+diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record |
1407 |
+index 31e0b1da830b..37940665f736 100644 |
1408 |
+--- a/tools/perf/tests/attr/base-record |
1409 |
++++ b/tools/perf/tests/attr/base-record |
1410 |
+@@ -23,7 +23,7 @@ comm=1 |
1411 |
+ freq=1 |
1412 |
+ inherit_stat=0 |
1413 |
+ enable_on_exec=1 |
1414 |
+-task=0 |
1415 |
++task=1 |
1416 |
+ watermark=0 |
1417 |
+ precise_ip=0|1|2|3 |
1418 |
+ mmap_data=0 |
1419 |
+diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group |
1420 |
+index 6e7961f6f7a5..618ba1c17474 100644 |
1421 |
+--- a/tools/perf/tests/attr/test-record-group |
1422 |
++++ b/tools/perf/tests/attr/test-record-group |
1423 |
+@@ -17,5 +17,6 @@ sample_type=327 |
1424 |
+ read_format=4 |
1425 |
+ mmap=0 |
1426 |
+ comm=0 |
1427 |
++task=0 |
1428 |
+ enable_on_exec=0 |
1429 |
+ disabled=0 |
1430 |
+diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling |
1431 |
+index ef59afd6d635..f906b793196f 100644 |
1432 |
+--- a/tools/perf/tests/attr/test-record-group-sampling |
1433 |
++++ b/tools/perf/tests/attr/test-record-group-sampling |
1434 |
+@@ -23,7 +23,7 @@ sample_type=343 |
1435 |
+ |
1436 |
+ # PERF_FORMAT_ID | PERF_FORMAT_GROUP |
1437 |
+ read_format=12 |
1438 |
+- |
1439 |
++task=0 |
1440 |
+ mmap=0 |
1441 |
+ comm=0 |
1442 |
+ enable_on_exec=0 |
1443 |
+diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1 |
1444 |
+index 87a222d014d8..48e8bd12fe46 100644 |
1445 |
+--- a/tools/perf/tests/attr/test-record-group1 |
1446 |
++++ b/tools/perf/tests/attr/test-record-group1 |
1447 |
+@@ -18,5 +18,6 @@ sample_type=327 |
1448 |
+ read_format=4 |
1449 |
+ mmap=0 |
1450 |
+ comm=0 |
1451 |
++task=0 |
1452 |
+ enable_on_exec=0 |
1453 |
+ disabled=0 |
1454 |
+diff --git a/tools/perf/tests/attr/test-stat-C0 b/tools/perf/tests/attr/test-stat-C0 |
1455 |
+index 67717fe6a65d..a2c76d10b2bb 100644 |
1456 |
+--- a/tools/perf/tests/attr/test-stat-C0 |
1457 |
++++ b/tools/perf/tests/attr/test-stat-C0 |
1458 |
+@@ -7,3 +7,4 @@ ret = 1 |
1459 |
+ # events are disabled by default when attached to cpu |
1460 |
+ disabled=1 |
1461 |
+ enable_on_exec=0 |
1462 |
++optional=1 |
1463 |
+diff --git a/tools/perf/tests/attr/test-stat-basic b/tools/perf/tests/attr/test-stat-basic |
1464 |
+index 74e17881f2ba..69867d049fda 100644 |
1465 |
+--- a/tools/perf/tests/attr/test-stat-basic |
1466 |
++++ b/tools/perf/tests/attr/test-stat-basic |
1467 |
+@@ -4,3 +4,4 @@ args = -e cycles kill >/dev/null 2>&1 |
1468 |
+ ret = 1 |
1469 |
+ |
1470 |
+ [event:base-stat] |
1471 |
++optional=1 |
1472 |
+diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default |
1473 |
+index e911dbd4eb47..d9e99b3f77e6 100644 |
1474 |
+--- a/tools/perf/tests/attr/test-stat-default |
1475 |
++++ b/tools/perf/tests/attr/test-stat-default |
1476 |
+@@ -32,6 +32,7 @@ config=2 |
1477 |
+ fd=5 |
1478 |
+ type=0 |
1479 |
+ config=0 |
1480 |
++optional=1 |
1481 |
+ |
1482 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND |
1483 |
+ [event6:base-stat] |
1484 |
+@@ -52,15 +53,18 @@ optional=1 |
1485 |
+ fd=8 |
1486 |
+ type=0 |
1487 |
+ config=1 |
1488 |
++optional=1 |
1489 |
+ |
1490 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS |
1491 |
+ [event9:base-stat] |
1492 |
+ fd=9 |
1493 |
+ type=0 |
1494 |
+ config=4 |
1495 |
++optional=1 |
1496 |
+ |
1497 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES |
1498 |
+ [event10:base-stat] |
1499 |
+ fd=10 |
1500 |
+ type=0 |
1501 |
+ config=5 |
1502 |
++optional=1 |
1503 |
+diff --git a/tools/perf/tests/attr/test-stat-detailed-1 b/tools/perf/tests/attr/test-stat-detailed-1 |
1504 |
+index b39270a08e74..8b04a055d154 100644 |
1505 |
+--- a/tools/perf/tests/attr/test-stat-detailed-1 |
1506 |
++++ b/tools/perf/tests/attr/test-stat-detailed-1 |
1507 |
+@@ -33,6 +33,7 @@ config=2 |
1508 |
+ fd=5 |
1509 |
+ type=0 |
1510 |
+ config=0 |
1511 |
++optional=1 |
1512 |
+ |
1513 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND |
1514 |
+ [event6:base-stat] |
1515 |
+@@ -53,18 +54,21 @@ optional=1 |
1516 |
+ fd=8 |
1517 |
+ type=0 |
1518 |
+ config=1 |
1519 |
++optional=1 |
1520 |
+ |
1521 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS |
1522 |
+ [event9:base-stat] |
1523 |
+ fd=9 |
1524 |
+ type=0 |
1525 |
+ config=4 |
1526 |
++optional=1 |
1527 |
+ |
1528 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES |
1529 |
+ [event10:base-stat] |
1530 |
+ fd=10 |
1531 |
+ type=0 |
1532 |
+ config=5 |
1533 |
++optional=1 |
1534 |
+ |
1535 |
+ # PERF_TYPE_HW_CACHE / |
1536 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1537 |
+@@ -74,6 +78,7 @@ config=5 |
1538 |
+ fd=11 |
1539 |
+ type=3 |
1540 |
+ config=0 |
1541 |
++optional=1 |
1542 |
+ |
1543 |
+ # PERF_TYPE_HW_CACHE / |
1544 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1545 |
+@@ -83,6 +88,7 @@ config=0 |
1546 |
+ fd=12 |
1547 |
+ type=3 |
1548 |
+ config=65536 |
1549 |
++optional=1 |
1550 |
+ |
1551 |
+ # PERF_TYPE_HW_CACHE / |
1552 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1553 |
+@@ -92,6 +98,7 @@ config=65536 |
1554 |
+ fd=13 |
1555 |
+ type=3 |
1556 |
+ config=2 |
1557 |
++optional=1 |
1558 |
+ |
1559 |
+ # PERF_TYPE_HW_CACHE, |
1560 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1561 |
+@@ -101,3 +108,4 @@ config=2 |
1562 |
+ fd=14 |
1563 |
+ type=3 |
1564 |
+ config=65538 |
1565 |
++optional=1 |
1566 |
+diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2 |
1567 |
+index 45f8e6ea34f8..4fca9f1bfbf8 100644 |
1568 |
+--- a/tools/perf/tests/attr/test-stat-detailed-2 |
1569 |
++++ b/tools/perf/tests/attr/test-stat-detailed-2 |
1570 |
+@@ -33,6 +33,7 @@ config=2 |
1571 |
+ fd=5 |
1572 |
+ type=0 |
1573 |
+ config=0 |
1574 |
++optional=1 |
1575 |
+ |
1576 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND |
1577 |
+ [event6:base-stat] |
1578 |
+@@ -53,18 +54,21 @@ optional=1 |
1579 |
+ fd=8 |
1580 |
+ type=0 |
1581 |
+ config=1 |
1582 |
++optional=1 |
1583 |
+ |
1584 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS |
1585 |
+ [event9:base-stat] |
1586 |
+ fd=9 |
1587 |
+ type=0 |
1588 |
+ config=4 |
1589 |
++optional=1 |
1590 |
+ |
1591 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES |
1592 |
+ [event10:base-stat] |
1593 |
+ fd=10 |
1594 |
+ type=0 |
1595 |
+ config=5 |
1596 |
++optional=1 |
1597 |
+ |
1598 |
+ # PERF_TYPE_HW_CACHE / |
1599 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1600 |
+@@ -74,6 +78,7 @@ config=5 |
1601 |
+ fd=11 |
1602 |
+ type=3 |
1603 |
+ config=0 |
1604 |
++optional=1 |
1605 |
+ |
1606 |
+ # PERF_TYPE_HW_CACHE / |
1607 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1608 |
+@@ -83,6 +88,7 @@ config=0 |
1609 |
+ fd=12 |
1610 |
+ type=3 |
1611 |
+ config=65536 |
1612 |
++optional=1 |
1613 |
+ |
1614 |
+ # PERF_TYPE_HW_CACHE / |
1615 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1616 |
+@@ -92,6 +98,7 @@ config=65536 |
1617 |
+ fd=13 |
1618 |
+ type=3 |
1619 |
+ config=2 |
1620 |
++optional=1 |
1621 |
+ |
1622 |
+ # PERF_TYPE_HW_CACHE, |
1623 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1624 |
+@@ -101,6 +108,7 @@ config=2 |
1625 |
+ fd=14 |
1626 |
+ type=3 |
1627 |
+ config=65538 |
1628 |
++optional=1 |
1629 |
+ |
1630 |
+ # PERF_TYPE_HW_CACHE, |
1631 |
+ # PERF_COUNT_HW_CACHE_L1I << 0 | |
1632 |
+@@ -120,6 +128,7 @@ optional=1 |
1633 |
+ fd=16 |
1634 |
+ type=3 |
1635 |
+ config=65537 |
1636 |
++optional=1 |
1637 |
+ |
1638 |
+ # PERF_TYPE_HW_CACHE, |
1639 |
+ # PERF_COUNT_HW_CACHE_DTLB << 0 | |
1640 |
+@@ -129,6 +138,7 @@ config=65537 |
1641 |
+ fd=17 |
1642 |
+ type=3 |
1643 |
+ config=3 |
1644 |
++optional=1 |
1645 |
+ |
1646 |
+ # PERF_TYPE_HW_CACHE, |
1647 |
+ # PERF_COUNT_HW_CACHE_DTLB << 0 | |
1648 |
+@@ -138,6 +148,7 @@ config=3 |
1649 |
+ fd=18 |
1650 |
+ type=3 |
1651 |
+ config=65539 |
1652 |
++optional=1 |
1653 |
+ |
1654 |
+ # PERF_TYPE_HW_CACHE, |
1655 |
+ # PERF_COUNT_HW_CACHE_ITLB << 0 | |
1656 |
+@@ -147,6 +158,7 @@ config=65539 |
1657 |
+ fd=19 |
1658 |
+ type=3 |
1659 |
+ config=4 |
1660 |
++optional=1 |
1661 |
+ |
1662 |
+ # PERF_TYPE_HW_CACHE, |
1663 |
+ # PERF_COUNT_HW_CACHE_ITLB << 0 | |
1664 |
+@@ -156,3 +168,4 @@ config=4 |
1665 |
+ fd=20 |
1666 |
+ type=3 |
1667 |
+ config=65540 |
1668 |
++optional=1 |
1669 |
+diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3 |
1670 |
+index 30ae0fb7a3fd..4bb58e1c82a6 100644 |
1671 |
+--- a/tools/perf/tests/attr/test-stat-detailed-3 |
1672 |
++++ b/tools/perf/tests/attr/test-stat-detailed-3 |
1673 |
+@@ -33,6 +33,7 @@ config=2 |
1674 |
+ fd=5 |
1675 |
+ type=0 |
1676 |
+ config=0 |
1677 |
++optional=1 |
1678 |
+ |
1679 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND |
1680 |
+ [event6:base-stat] |
1681 |
+@@ -53,18 +54,21 @@ optional=1 |
1682 |
+ fd=8 |
1683 |
+ type=0 |
1684 |
+ config=1 |
1685 |
++optional=1 |
1686 |
+ |
1687 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS |
1688 |
+ [event9:base-stat] |
1689 |
+ fd=9 |
1690 |
+ type=0 |
1691 |
+ config=4 |
1692 |
++optional=1 |
1693 |
+ |
1694 |
+ # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES |
1695 |
+ [event10:base-stat] |
1696 |
+ fd=10 |
1697 |
+ type=0 |
1698 |
+ config=5 |
1699 |
++optional=1 |
1700 |
+ |
1701 |
+ # PERF_TYPE_HW_CACHE / |
1702 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1703 |
+@@ -74,6 +78,7 @@ config=5 |
1704 |
+ fd=11 |
1705 |
+ type=3 |
1706 |
+ config=0 |
1707 |
++optional=1 |
1708 |
+ |
1709 |
+ # PERF_TYPE_HW_CACHE / |
1710 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1711 |
+@@ -83,6 +88,7 @@ config=0 |
1712 |
+ fd=12 |
1713 |
+ type=3 |
1714 |
+ config=65536 |
1715 |
++optional=1 |
1716 |
+ |
1717 |
+ # PERF_TYPE_HW_CACHE / |
1718 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1719 |
+@@ -92,6 +98,7 @@ config=65536 |
1720 |
+ fd=13 |
1721 |
+ type=3 |
1722 |
+ config=2 |
1723 |
++optional=1 |
1724 |
+ |
1725 |
+ # PERF_TYPE_HW_CACHE, |
1726 |
+ # PERF_COUNT_HW_CACHE_LL << 0 | |
1727 |
+@@ -101,6 +108,7 @@ config=2 |
1728 |
+ fd=14 |
1729 |
+ type=3 |
1730 |
+ config=65538 |
1731 |
++optional=1 |
1732 |
+ |
1733 |
+ # PERF_TYPE_HW_CACHE, |
1734 |
+ # PERF_COUNT_HW_CACHE_L1I << 0 | |
1735 |
+@@ -120,6 +128,7 @@ optional=1 |
1736 |
+ fd=16 |
1737 |
+ type=3 |
1738 |
+ config=65537 |
1739 |
++optional=1 |
1740 |
+ |
1741 |
+ # PERF_TYPE_HW_CACHE, |
1742 |
+ # PERF_COUNT_HW_CACHE_DTLB << 0 | |
1743 |
+@@ -129,6 +138,7 @@ config=65537 |
1744 |
+ fd=17 |
1745 |
+ type=3 |
1746 |
+ config=3 |
1747 |
++optional=1 |
1748 |
+ |
1749 |
+ # PERF_TYPE_HW_CACHE, |
1750 |
+ # PERF_COUNT_HW_CACHE_DTLB << 0 | |
1751 |
+@@ -138,6 +148,7 @@ config=3 |
1752 |
+ fd=18 |
1753 |
+ type=3 |
1754 |
+ config=65539 |
1755 |
++optional=1 |
1756 |
+ |
1757 |
+ # PERF_TYPE_HW_CACHE, |
1758 |
+ # PERF_COUNT_HW_CACHE_ITLB << 0 | |
1759 |
+@@ -147,6 +158,7 @@ config=65539 |
1760 |
+ fd=19 |
1761 |
+ type=3 |
1762 |
+ config=4 |
1763 |
++optional=1 |
1764 |
+ |
1765 |
+ # PERF_TYPE_HW_CACHE, |
1766 |
+ # PERF_COUNT_HW_CACHE_ITLB << 0 | |
1767 |
+@@ -156,6 +168,7 @@ config=4 |
1768 |
+ fd=20 |
1769 |
+ type=3 |
1770 |
+ config=65540 |
1771 |
++optional=1 |
1772 |
+ |
1773 |
+ # PERF_TYPE_HW_CACHE, |
1774 |
+ # PERF_COUNT_HW_CACHE_L1D << 0 | |
1775 |
+diff --git a/tools/perf/tests/attr/test-stat-group b/tools/perf/tests/attr/test-stat-group |
1776 |
+index fdc1596a8862..e15d6946e9b3 100644 |
1777 |
+--- a/tools/perf/tests/attr/test-stat-group |
1778 |
++++ b/tools/perf/tests/attr/test-stat-group |
1779 |
+@@ -6,6 +6,7 @@ ret = 1 |
1780 |
+ [event-1:base-stat] |
1781 |
+ fd=1 |
1782 |
+ group_fd=-1 |
1783 |
++read_format=3|15 |
1784 |
+ |
1785 |
+ [event-2:base-stat] |
1786 |
+ fd=2 |
1787 |
+@@ -13,3 +14,4 @@ group_fd=1 |
1788 |
+ config=1 |
1789 |
+ disabled=0 |
1790 |
+ enable_on_exec=0 |
1791 |
++read_format=3|15 |
1792 |
+diff --git a/tools/perf/tests/attr/test-stat-group1 b/tools/perf/tests/attr/test-stat-group1 |
1793 |
+index 2a1f86e4a904..1746751123dc 100644 |
1794 |
+--- a/tools/perf/tests/attr/test-stat-group1 |
1795 |
++++ b/tools/perf/tests/attr/test-stat-group1 |
1796 |
+@@ -6,6 +6,7 @@ ret = 1 |
1797 |
+ [event-1:base-stat] |
1798 |
+ fd=1 |
1799 |
+ group_fd=-1 |
1800 |
++read_format=3|15 |
1801 |
+ |
1802 |
+ [event-2:base-stat] |
1803 |
+ fd=2 |
1804 |
+@@ -13,3 +14,4 @@ group_fd=1 |
1805 |
+ config=1 |
1806 |
+ disabled=0 |
1807 |
+ enable_on_exec=0 |
1808 |
++read_format=3|15 |
1809 |
+diff --git a/tools/perf/tests/attr/test-stat-no-inherit b/tools/perf/tests/attr/test-stat-no-inherit |
1810 |
+index d54b2a1e3e28..924fbb9300d1 100644 |
1811 |
+--- a/tools/perf/tests/attr/test-stat-no-inherit |
1812 |
++++ b/tools/perf/tests/attr/test-stat-no-inherit |
1813 |
+@@ -5,3 +5,4 @@ ret = 1 |
1814 |
+ |
1815 |
+ [event:base-stat] |
1816 |
+ inherit=0 |
1817 |
++optional=1 |
1818 |
|
1819 |
diff --git a/1100_linux-4.14.101.patch b/1100_linux-4.14.101.patch |
1820 |
new file mode 100644 |
1821 |
index 0000000..9b535b6 |
1822 |
--- /dev/null |
1823 |
+++ b/1100_linux-4.14.101.patch |
1824 |
@@ -0,0 +1,35 @@ |
1825 |
+diff --git a/Makefile b/Makefile |
1826 |
+index 86fa9a371383..d5b20b618517 100644 |
1827 |
+--- a/Makefile |
1828 |
++++ b/Makefile |
1829 |
+@@ -1,7 +1,7 @@ |
1830 |
+ # SPDX-License-Identifier: GPL-2.0 |
1831 |
+ VERSION = 4 |
1832 |
+ PATCHLEVEL = 14 |
1833 |
+-SUBLEVEL = 100 |
1834 |
++SUBLEVEL = 101 |
1835 |
+ EXTRAVERSION = |
1836 |
+ NAME = Petit Gorille |
1837 |
+ |
1838 |
+diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c |
1839 |
+index d0078cbb718b..7cde3f46ad26 100644 |
1840 |
+--- a/fs/binfmt_script.c |
1841 |
++++ b/fs/binfmt_script.c |
1842 |
+@@ -42,14 +42,10 @@ static int load_script(struct linux_binprm *bprm) |
1843 |
+ fput(bprm->file); |
1844 |
+ bprm->file = NULL; |
1845 |
+ |
1846 |
+- for (cp = bprm->buf+2;; cp++) { |
1847 |
+- if (cp >= bprm->buf + BINPRM_BUF_SIZE) |
1848 |
+- return -ENOEXEC; |
1849 |
+- if (!*cp || (*cp == '\n')) |
1850 |
+- break; |
1851 |
+- } |
1852 |
++ bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; |
1853 |
++ if ((cp = strchr(bprm->buf, '\n')) == NULL) |
1854 |
++ cp = bprm->buf+BINPRM_BUF_SIZE-1; |
1855 |
+ *cp = '\0'; |
1856 |
+- |
1857 |
+ while (cp > bprm->buf) { |
1858 |
+ cp--; |
1859 |
+ if ((*cp == ' ') || (*cp == '\t')) |