1 |
commit: 9bd73a5d0a3436141ab5107d303f0f5faa51eb40 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 7 17:39:28 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 29 13:59:02 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9bd73a5d |
7 |
|
8 |
Linux patch 4.14.148 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1147_linux-4.14.148.patch | 2595 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2599 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 300d3fc..140c250 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -631,6 +631,10 @@ Patch: 1146_linux-4.14.147.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.147 |
23 |
|
24 |
+Patch: 1147_linux-4.14.148.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.148 |
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/1147_linux-4.14.148.patch b/1147_linux-4.14.148.patch |
33 |
new file mode 100644 |
34 |
index 0000000..e0d3bfb |
35 |
--- /dev/null |
36 |
+++ b/1147_linux-4.14.148.patch |
37 |
@@ -0,0 +1,2595 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index d6f1a056b233..feecefa13ca6 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 = 147 |
47 |
++SUBLEVEL = 148 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c |
52 |
+index 49b1b8048635..9bb446cc135d 100644 |
53 |
+--- a/arch/arm/mm/fault.c |
54 |
++++ b/arch/arm/mm/fault.c |
55 |
+@@ -215,7 +215,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) |
56 |
+ { |
57 |
+ unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; |
58 |
+ |
59 |
+- if (fsr & FSR_WRITE) |
60 |
++ if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) |
61 |
+ mask = VM_WRITE; |
62 |
+ if (fsr & FSR_LNX_PF) |
63 |
+ mask = VM_EXEC; |
64 |
+@@ -285,7 +285,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) |
65 |
+ |
66 |
+ if (user_mode(regs)) |
67 |
+ flags |= FAULT_FLAG_USER; |
68 |
+- if (fsr & FSR_WRITE) |
69 |
++ if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) |
70 |
+ flags |= FAULT_FLAG_WRITE; |
71 |
+ |
72 |
+ /* |
73 |
+diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h |
74 |
+index c063708fa503..9ecc2097a87a 100644 |
75 |
+--- a/arch/arm/mm/fault.h |
76 |
++++ b/arch/arm/mm/fault.h |
77 |
+@@ -6,6 +6,7 @@ |
78 |
+ * Fault status register encodings. We steal bit 31 for our own purposes. |
79 |
+ */ |
80 |
+ #define FSR_LNX_PF (1 << 31) |
81 |
++#define FSR_CM (1 << 13) |
82 |
+ #define FSR_WRITE (1 << 11) |
83 |
+ #define FSR_FS4 (1 << 10) |
84 |
+ #define FSR_FS3_0 (15) |
85 |
+diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c |
86 |
+index e46a6a446cdd..70e560cf8ca0 100644 |
87 |
+--- a/arch/arm/mm/mmu.c |
88 |
++++ b/arch/arm/mm/mmu.c |
89 |
+@@ -1175,6 +1175,22 @@ void __init adjust_lowmem_bounds(void) |
90 |
+ */ |
91 |
+ vmalloc_limit = (u64)(uintptr_t)vmalloc_min - PAGE_OFFSET + PHYS_OFFSET; |
92 |
+ |
93 |
++ /* |
94 |
++ * The first usable region must be PMD aligned. Mark its start |
95 |
++ * as MEMBLOCK_NOMAP if it isn't |
96 |
++ */ |
97 |
++ for_each_memblock(memory, reg) { |
98 |
++ if (!memblock_is_nomap(reg)) { |
99 |
++ if (!IS_ALIGNED(reg->base, PMD_SIZE)) { |
100 |
++ phys_addr_t len; |
101 |
++ |
102 |
++ len = round_up(reg->base, PMD_SIZE) - reg->base; |
103 |
++ memblock_mark_nomap(reg->base, len); |
104 |
++ } |
105 |
++ break; |
106 |
++ } |
107 |
++ } |
108 |
++ |
109 |
+ for_each_memblock(memory, reg) { |
110 |
+ phys_addr_t block_start = reg->base; |
111 |
+ phys_addr_t block_end = reg->base + reg->size; |
112 |
+diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h |
113 |
+index 0f2e1ab5e166..9b2e2e2e728a 100644 |
114 |
+--- a/arch/arm64/include/asm/cmpxchg.h |
115 |
++++ b/arch/arm64/include/asm/cmpxchg.h |
116 |
+@@ -73,7 +73,7 @@ __XCHG_CASE( , , mb_8, dmb ish, nop, , a, l, "memory") |
117 |
+ #undef __XCHG_CASE |
118 |
+ |
119 |
+ #define __XCHG_GEN(sfx) \ |
120 |
+-static inline unsigned long __xchg##sfx(unsigned long x, \ |
121 |
++static __always_inline unsigned long __xchg##sfx(unsigned long x, \ |
122 |
+ volatile void *ptr, \ |
123 |
+ int size) \ |
124 |
+ { \ |
125 |
+@@ -115,7 +115,7 @@ __XCHG_GEN(_mb) |
126 |
+ #define xchg(...) __xchg_wrapper( _mb, __VA_ARGS__) |
127 |
+ |
128 |
+ #define __CMPXCHG_GEN(sfx) \ |
129 |
+-static inline unsigned long __cmpxchg##sfx(volatile void *ptr, \ |
130 |
++static __always_inline unsigned long __cmpxchg##sfx(volatile void *ptr, \ |
131 |
+ unsigned long old, \ |
132 |
+ unsigned long new, \ |
133 |
+ int size) \ |
134 |
+@@ -248,7 +248,7 @@ __CMPWAIT_CASE( , , 8); |
135 |
+ #undef __CMPWAIT_CASE |
136 |
+ |
137 |
+ #define __CMPWAIT_GEN(sfx) \ |
138 |
+-static inline void __cmpwait##sfx(volatile void *ptr, \ |
139 |
++static __always_inline void __cmpwait##sfx(volatile void *ptr, \ |
140 |
+ unsigned long val, \ |
141 |
+ int size) \ |
142 |
+ { \ |
143 |
+diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c |
144 |
+index c2a6869418f7..dc495578d44d 100644 |
145 |
+--- a/arch/mips/mm/tlbex.c |
146 |
++++ b/arch/mips/mm/tlbex.c |
147 |
+@@ -634,7 +634,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p, |
148 |
+ return; |
149 |
+ } |
150 |
+ |
151 |
+- if (cpu_has_rixi && _PAGE_NO_EXEC) { |
152 |
++ if (cpu_has_rixi && !!_PAGE_NO_EXEC) { |
153 |
+ if (fill_includes_sw_bits) { |
154 |
+ UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); |
155 |
+ } else { |
156 |
+diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h |
157 |
+index 1a944c18c539..3c7d85945229 100644 |
158 |
+--- a/arch/powerpc/include/asm/futex.h |
159 |
++++ b/arch/powerpc/include/asm/futex.h |
160 |
+@@ -59,8 +59,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, |
161 |
+ |
162 |
+ pagefault_enable(); |
163 |
+ |
164 |
+- if (!ret) |
165 |
+- *oval = oldval; |
166 |
++ *oval = oldval; |
167 |
+ |
168 |
+ return ret; |
169 |
+ } |
170 |
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
171 |
+index 43cde6c60279..cdc53fd90597 100644 |
172 |
+--- a/arch/powerpc/kernel/exceptions-64s.S |
173 |
++++ b/arch/powerpc/kernel/exceptions-64s.S |
174 |
+@@ -464,6 +464,10 @@ EXC_COMMON_BEGIN(machine_check_handle_early) |
175 |
+ RFI_TO_USER_OR_KERNEL |
176 |
+ 9: |
177 |
+ /* Deliver the machine check to host kernel in V mode. */ |
178 |
++BEGIN_FTR_SECTION |
179 |
++ ld r10,ORIG_GPR3(r1) |
180 |
++ mtspr SPRN_CFAR,r10 |
181 |
++END_FTR_SECTION_IFSET(CPU_FTR_CFAR) |
182 |
+ MACHINE_CHECK_HANDLER_WINDUP |
183 |
+ b machine_check_pSeries |
184 |
+ |
185 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
186 |
+index 1643e9e53655..141d192c6953 100644 |
187 |
+--- a/arch/powerpc/kernel/rtas.c |
188 |
++++ b/arch/powerpc/kernel/rtas.c |
189 |
+@@ -874,15 +874,17 @@ static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
190 |
+ return 0; |
191 |
+ |
192 |
+ for_each_cpu(cpu, cpus) { |
193 |
++ struct device *dev = get_cpu_device(cpu); |
194 |
++ |
195 |
+ switch (state) { |
196 |
+ case DOWN: |
197 |
+- cpuret = cpu_down(cpu); |
198 |
++ cpuret = device_offline(dev); |
199 |
+ break; |
200 |
+ case UP: |
201 |
+- cpuret = cpu_up(cpu); |
202 |
++ cpuret = device_online(dev); |
203 |
+ break; |
204 |
+ } |
205 |
+- if (cpuret) { |
206 |
++ if (cpuret < 0) { |
207 |
+ pr_debug("%s: cpu_%s for cpu#%d returned %d.\n", |
208 |
+ __func__, |
209 |
+ ((state == UP) ? "up" : "down"), |
210 |
+@@ -971,6 +973,8 @@ int rtas_ibm_suspend_me(u64 handle) |
211 |
+ data.token = rtas_token("ibm,suspend-me"); |
212 |
+ data.complete = &done; |
213 |
+ |
214 |
++ lock_device_hotplug(); |
215 |
++ |
216 |
+ /* All present CPUs must be online */ |
217 |
+ cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask); |
218 |
+ cpuret = rtas_online_cpus_mask(offline_mask); |
219 |
+@@ -1002,6 +1006,7 @@ int rtas_ibm_suspend_me(u64 handle) |
220 |
+ __func__); |
221 |
+ |
222 |
+ out: |
223 |
++ unlock_device_hotplug(); |
224 |
+ free_cpumask_var(offline_mask); |
225 |
+ return atomic_read(&data.error); |
226 |
+ } |
227 |
+diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c |
228 |
+index 4addc552eb33..9739a055e5f7 100644 |
229 |
+--- a/arch/powerpc/platforms/pseries/mobility.c |
230 |
++++ b/arch/powerpc/platforms/pseries/mobility.c |
231 |
+@@ -12,6 +12,7 @@ |
232 |
+ #include <linux/cpu.h> |
233 |
+ #include <linux/kernel.h> |
234 |
+ #include <linux/kobject.h> |
235 |
++#include <linux/sched.h> |
236 |
+ #include <linux/smp.h> |
237 |
+ #include <linux/stat.h> |
238 |
+ #include <linux/completion.h> |
239 |
+@@ -208,7 +209,11 @@ static int update_dt_node(__be32 phandle, s32 scope) |
240 |
+ |
241 |
+ prop_data += vd; |
242 |
+ } |
243 |
++ |
244 |
++ cond_resched(); |
245 |
+ } |
246 |
++ |
247 |
++ cond_resched(); |
248 |
+ } while (rtas_rc == 1); |
249 |
+ |
250 |
+ of_node_put(dn); |
251 |
+@@ -317,8 +322,12 @@ int pseries_devicetree_update(s32 scope) |
252 |
+ add_dt_node(phandle, drc_index); |
253 |
+ break; |
254 |
+ } |
255 |
++ |
256 |
++ cond_resched(); |
257 |
+ } |
258 |
+ } |
259 |
++ |
260 |
++ cond_resched(); |
261 |
+ } while (rc == 1); |
262 |
+ |
263 |
+ kfree(rtas_buf); |
264 |
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
265 |
+index 6a0ad56e89b9..7a9945b35053 100644 |
266 |
+--- a/arch/powerpc/platforms/pseries/setup.c |
267 |
++++ b/arch/powerpc/platforms/pseries/setup.c |
268 |
+@@ -307,6 +307,9 @@ static void pseries_lpar_idle(void) |
269 |
+ * low power mode by ceding processor to hypervisor |
270 |
+ */ |
271 |
+ |
272 |
++ if (!prep_irq_for_idle()) |
273 |
++ return; |
274 |
++ |
275 |
+ /* Indicate to hypervisor that we are idle. */ |
276 |
+ get_lppaca()->idle = 1; |
277 |
+ |
278 |
+diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c |
279 |
+index 6b9038a3e79f..5a739588aa50 100644 |
280 |
+--- a/arch/powerpc/xmon/xmon.c |
281 |
++++ b/arch/powerpc/xmon/xmon.c |
282 |
+@@ -2438,13 +2438,16 @@ static void dump_pacas(void) |
283 |
+ static void dump_one_xive(int cpu) |
284 |
+ { |
285 |
+ unsigned int hwid = get_hard_smp_processor_id(cpu); |
286 |
++ bool hv = cpu_has_feature(CPU_FTR_HVMODE); |
287 |
+ |
288 |
+- opal_xive_dump(XIVE_DUMP_TM_HYP, hwid); |
289 |
+- opal_xive_dump(XIVE_DUMP_TM_POOL, hwid); |
290 |
+- opal_xive_dump(XIVE_DUMP_TM_OS, hwid); |
291 |
+- opal_xive_dump(XIVE_DUMP_TM_USER, hwid); |
292 |
+- opal_xive_dump(XIVE_DUMP_VP, hwid); |
293 |
+- opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid); |
294 |
++ if (hv) { |
295 |
++ opal_xive_dump(XIVE_DUMP_TM_HYP, hwid); |
296 |
++ opal_xive_dump(XIVE_DUMP_TM_POOL, hwid); |
297 |
++ opal_xive_dump(XIVE_DUMP_TM_OS, hwid); |
298 |
++ opal_xive_dump(XIVE_DUMP_TM_USER, hwid); |
299 |
++ opal_xive_dump(XIVE_DUMP_VP, hwid); |
300 |
++ opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid); |
301 |
++ } |
302 |
+ |
303 |
+ if (setjmp(bus_error_jmp) != 0) { |
304 |
+ catch_memory_errors = 0; |
305 |
+diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c |
306 |
+index 45eb5999110b..32f5b3fb069f 100644 |
307 |
+--- a/arch/s390/hypfs/inode.c |
308 |
++++ b/arch/s390/hypfs/inode.c |
309 |
+@@ -269,7 +269,7 @@ static int hypfs_show_options(struct seq_file *s, struct dentry *root) |
310 |
+ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) |
311 |
+ { |
312 |
+ struct inode *root_inode; |
313 |
+- struct dentry *root_dentry; |
314 |
++ struct dentry *root_dentry, *update_file; |
315 |
+ int rc = 0; |
316 |
+ struct hypfs_sb_info *sbi; |
317 |
+ |
318 |
+@@ -300,9 +300,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent) |
319 |
+ rc = hypfs_diag_create_files(root_dentry); |
320 |
+ if (rc) |
321 |
+ return rc; |
322 |
+- sbi->update_file = hypfs_create_update_file(root_dentry); |
323 |
+- if (IS_ERR(sbi->update_file)) |
324 |
+- return PTR_ERR(sbi->update_file); |
325 |
++ update_file = hypfs_create_update_file(root_dentry); |
326 |
++ if (IS_ERR(update_file)) |
327 |
++ return PTR_ERR(update_file); |
328 |
++ sbi->update_file = update_file; |
329 |
+ hypfs_update_update(sb); |
330 |
+ pr_info("Hypervisor filesystem mounted\n"); |
331 |
+ return 0; |
332 |
+diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c |
333 |
+index 11ec92e47455..94944d063b37 100644 |
334 |
+--- a/drivers/block/pktcdvd.c |
335 |
++++ b/drivers/block/pktcdvd.c |
336 |
+@@ -2585,7 +2585,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) |
337 |
+ if (ret) |
338 |
+ return ret; |
339 |
+ if (!blk_queue_scsi_passthrough(bdev_get_queue(bdev))) { |
340 |
+- WARN_ONCE(true, "Attempt to register a non-SCSI queue\n"); |
341 |
+ blkdev_put(bdev, FMODE_READ | FMODE_NDELAY); |
342 |
+ return -EINVAL; |
343 |
+ } |
344 |
+diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c |
345 |
+index a106cf7b5ee0..f6ba90b90503 100644 |
346 |
+--- a/drivers/char/ipmi/ipmi_si_intf.c |
347 |
++++ b/drivers/char/ipmi/ipmi_si_intf.c |
348 |
+@@ -284,6 +284,9 @@ struct smi_info { |
349 |
+ */ |
350 |
+ bool irq_enable_broken; |
351 |
+ |
352 |
++ /* Is the driver in maintenance mode? */ |
353 |
++ bool in_maintenance_mode; |
354 |
++ |
355 |
+ /* |
356 |
+ * Did we get an attention that we did not handle? |
357 |
+ */ |
358 |
+@@ -1094,11 +1097,20 @@ static int ipmi_thread(void *data) |
359 |
+ spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
360 |
+ busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, |
361 |
+ &busy_until); |
362 |
+- if (smi_result == SI_SM_CALL_WITHOUT_DELAY) |
363 |
++ if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { |
364 |
+ ; /* do nothing */ |
365 |
+- else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) |
366 |
+- schedule(); |
367 |
+- else if (smi_result == SI_SM_IDLE) { |
368 |
++ } else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) { |
369 |
++ /* |
370 |
++ * In maintenance mode we run as fast as |
371 |
++ * possible to allow firmware updates to |
372 |
++ * complete as fast as possible, but normally |
373 |
++ * don't bang on the scheduler. |
374 |
++ */ |
375 |
++ if (smi_info->in_maintenance_mode) |
376 |
++ schedule(); |
377 |
++ else |
378 |
++ usleep_range(100, 200); |
379 |
++ } else if (smi_result == SI_SM_IDLE) { |
380 |
+ if (atomic_read(&smi_info->need_watch)) { |
381 |
+ schedule_timeout_interruptible(100); |
382 |
+ } else { |
383 |
+@@ -1106,8 +1118,9 @@ static int ipmi_thread(void *data) |
384 |
+ __set_current_state(TASK_INTERRUPTIBLE); |
385 |
+ schedule(); |
386 |
+ } |
387 |
+- } else |
388 |
++ } else { |
389 |
+ schedule_timeout_interruptible(1); |
390 |
++ } |
391 |
+ } |
392 |
+ return 0; |
393 |
+ } |
394 |
+@@ -1286,6 +1299,7 @@ static void set_maintenance_mode(void *send_info, bool enable) |
395 |
+ |
396 |
+ if (!enable) |
397 |
+ atomic_set(&smi_info->req_events, 0); |
398 |
++ smi_info->in_maintenance_mode = enable; |
399 |
+ } |
400 |
+ |
401 |
+ static const struct ipmi_smi_handlers handlers = { |
402 |
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
403 |
+index 0eca20c5a80c..dcf5bb153495 100644 |
404 |
+--- a/drivers/char/tpm/tpm-chip.c |
405 |
++++ b/drivers/char/tpm/tpm-chip.c |
406 |
+@@ -158,12 +158,13 @@ static int tpm_class_shutdown(struct device *dev) |
407 |
+ { |
408 |
+ struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev); |
409 |
+ |
410 |
++ down_write(&chip->ops_sem); |
411 |
+ if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
412 |
+- down_write(&chip->ops_sem); |
413 |
+ tpm2_shutdown(chip, TPM2_SU_CLEAR); |
414 |
+ chip->ops = NULL; |
415 |
+- up_write(&chip->ops_sem); |
416 |
+ } |
417 |
++ chip->ops = NULL; |
418 |
++ up_write(&chip->ops_sem); |
419 |
+ |
420 |
+ return 0; |
421 |
+ } |
422 |
+diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c |
423 |
+index 86f38d239476..177a60e5c6ec 100644 |
424 |
+--- a/drivers/char/tpm/tpm-sysfs.c |
425 |
++++ b/drivers/char/tpm/tpm-sysfs.c |
426 |
+@@ -20,44 +20,46 @@ |
427 |
+ #include <linux/device.h> |
428 |
+ #include "tpm.h" |
429 |
+ |
430 |
+-#define READ_PUBEK_RESULT_SIZE 314 |
431 |
++struct tpm_readpubek_out { |
432 |
++ u8 algorithm[4]; |
433 |
++ u8 encscheme[2]; |
434 |
++ u8 sigscheme[2]; |
435 |
++ __be32 paramsize; |
436 |
++ u8 parameters[12]; |
437 |
++ __be32 keysize; |
438 |
++ u8 modulus[256]; |
439 |
++ u8 checksum[20]; |
440 |
++} __packed; |
441 |
++ |
442 |
+ #define READ_PUBEK_RESULT_MIN_BODY_SIZE (28 + 256) |
443 |
+ #define TPM_ORD_READPUBEK 124 |
444 |
+-static const struct tpm_input_header tpm_readpubek_header = { |
445 |
+- .tag = cpu_to_be16(TPM_TAG_RQU_COMMAND), |
446 |
+- .length = cpu_to_be32(30), |
447 |
+- .ordinal = cpu_to_be32(TPM_ORD_READPUBEK) |
448 |
+-}; |
449 |
++ |
450 |
+ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, |
451 |
+ char *buf) |
452 |
+ { |
453 |
+- u8 *data; |
454 |
+- struct tpm_cmd_t tpm_cmd; |
455 |
+- ssize_t err; |
456 |
+- int i, rc; |
457 |
++ struct tpm_buf tpm_buf; |
458 |
++ struct tpm_readpubek_out *out; |
459 |
++ int i; |
460 |
+ char *str = buf; |
461 |
+ struct tpm_chip *chip = to_tpm_chip(dev); |
462 |
++ char anti_replay[20]; |
463 |
+ |
464 |
+- memset(&tpm_cmd, 0, sizeof(tpm_cmd)); |
465 |
+- |
466 |
+- tpm_cmd.header.in = tpm_readpubek_header; |
467 |
+- err = tpm_transmit_cmd(chip, NULL, &tpm_cmd, READ_PUBEK_RESULT_SIZE, |
468 |
+- READ_PUBEK_RESULT_MIN_BODY_SIZE, 0, |
469 |
+- "attempting to read the PUBEK"); |
470 |
+- if (err) |
471 |
+- goto out; |
472 |
+- |
473 |
+- /* |
474 |
+- ignore header 10 bytes |
475 |
+- algorithm 32 bits (1 == RSA ) |
476 |
+- encscheme 16 bits |
477 |
+- sigscheme 16 bits |
478 |
+- parameters (RSA 12->bytes: keybit, #primes, expbit) |
479 |
+- keylenbytes 32 bits |
480 |
+- 256 byte modulus |
481 |
+- ignore checksum 20 bytes |
482 |
+- */ |
483 |
+- data = tpm_cmd.params.readpubek_out_buffer; |
484 |
++ memset(&anti_replay, 0, sizeof(anti_replay)); |
485 |
++ |
486 |
++ if (tpm_try_get_ops(chip)) |
487 |
++ return 0; |
488 |
++ |
489 |
++ if (tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK)) |
490 |
++ goto out_ops; |
491 |
++ |
492 |
++ tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay)); |
493 |
++ |
494 |
++ if (tpm_transmit_cmd(chip, NULL, tpm_buf.data, PAGE_SIZE, |
495 |
++ READ_PUBEK_RESULT_MIN_BODY_SIZE, 0, |
496 |
++ "attempting to read the PUBEK")) |
497 |
++ goto out_buf; |
498 |
++ |
499 |
++ out = (struct tpm_readpubek_out *)&tpm_buf.data[10]; |
500 |
+ str += |
501 |
+ sprintf(str, |
502 |
+ "Algorithm: %02X %02X %02X %02X\n" |
503 |
+@@ -68,22 +70,29 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, |
504 |
+ "%02X %02X %02X %02X\n" |
505 |
+ "Modulus length: %d\n" |
506 |
+ "Modulus:\n", |
507 |
+- data[0], data[1], data[2], data[3], |
508 |
+- data[4], data[5], |
509 |
+- data[6], data[7], |
510 |
+- data[12], data[13], data[14], data[15], |
511 |
+- data[16], data[17], data[18], data[19], |
512 |
+- data[20], data[21], data[22], data[23], |
513 |
+- be32_to_cpu(*((__be32 *) (data + 24)))); |
514 |
++ out->algorithm[0], out->algorithm[1], out->algorithm[2], |
515 |
++ out->algorithm[3], |
516 |
++ out->encscheme[0], out->encscheme[1], |
517 |
++ out->sigscheme[0], out->sigscheme[1], |
518 |
++ out->parameters[0], out->parameters[1], |
519 |
++ out->parameters[2], out->parameters[3], |
520 |
++ out->parameters[4], out->parameters[5], |
521 |
++ out->parameters[6], out->parameters[7], |
522 |
++ out->parameters[8], out->parameters[9], |
523 |
++ out->parameters[10], out->parameters[11], |
524 |
++ be32_to_cpu(out->keysize)); |
525 |
+ |
526 |
+ for (i = 0; i < 256; i++) { |
527 |
+- str += sprintf(str, "%02X ", data[i + 28]); |
528 |
++ str += sprintf(str, "%02X ", out->modulus[i]); |
529 |
+ if ((i + 1) % 16 == 0) |
530 |
+ str += sprintf(str, "\n"); |
531 |
+ } |
532 |
+-out: |
533 |
+- rc = str - buf; |
534 |
+- return rc; |
535 |
++ |
536 |
++out_buf: |
537 |
++ tpm_buf_destroy(&tpm_buf); |
538 |
++out_ops: |
539 |
++ tpm_put_ops(chip); |
540 |
++ return str - buf; |
541 |
+ } |
542 |
+ static DEVICE_ATTR_RO(pubek); |
543 |
+ |
544 |
+@@ -97,12 +106,16 @@ static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr, |
545 |
+ char *str = buf; |
546 |
+ struct tpm_chip *chip = to_tpm_chip(dev); |
547 |
+ |
548 |
+- rc = tpm_getcap(chip, TPM_CAP_PROP_PCR, &cap, |
549 |
+- "attempting to determine the number of PCRS", |
550 |
+- sizeof(cap.num_pcrs)); |
551 |
+- if (rc) |
552 |
++ if (tpm_try_get_ops(chip)) |
553 |
+ return 0; |
554 |
+ |
555 |
++ if (tpm_getcap(chip, TPM_CAP_PROP_PCR, &cap, |
556 |
++ "attempting to determine the number of PCRS", |
557 |
++ sizeof(cap.num_pcrs))) { |
558 |
++ tpm_put_ops(chip); |
559 |
++ return 0; |
560 |
++ } |
561 |
++ |
562 |
+ num_pcrs = be32_to_cpu(cap.num_pcrs); |
563 |
+ for (i = 0; i < num_pcrs; i++) { |
564 |
+ rc = tpm_pcr_read_dev(chip, i, digest); |
565 |
+@@ -113,6 +126,7 @@ static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr, |
566 |
+ str += sprintf(str, "%02X ", digest[j]); |
567 |
+ str += sprintf(str, "\n"); |
568 |
+ } |
569 |
++ tpm_put_ops(chip); |
570 |
+ return str - buf; |
571 |
+ } |
572 |
+ static DEVICE_ATTR_RO(pcrs); |
573 |
+@@ -120,16 +134,21 @@ static DEVICE_ATTR_RO(pcrs); |
574 |
+ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, |
575 |
+ char *buf) |
576 |
+ { |
577 |
++ struct tpm_chip *chip = to_tpm_chip(dev); |
578 |
++ ssize_t rc = 0; |
579 |
+ cap_t cap; |
580 |
+- ssize_t rc; |
581 |
+ |
582 |
+- rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_PERM, &cap, |
583 |
+- "attempting to determine the permanent enabled state", |
584 |
+- sizeof(cap.perm_flags)); |
585 |
+- if (rc) |
586 |
++ if (tpm_try_get_ops(chip)) |
587 |
+ return 0; |
588 |
+ |
589 |
++ if (tpm_getcap(chip, TPM_CAP_FLAG_PERM, &cap, |
590 |
++ "attempting to determine the permanent enabled state", |
591 |
++ sizeof(cap.perm_flags))) |
592 |
++ goto out_ops; |
593 |
++ |
594 |
+ rc = sprintf(buf, "%d\n", !cap.perm_flags.disable); |
595 |
++out_ops: |
596 |
++ tpm_put_ops(chip); |
597 |
+ return rc; |
598 |
+ } |
599 |
+ static DEVICE_ATTR_RO(enabled); |
600 |
+@@ -137,16 +156,21 @@ static DEVICE_ATTR_RO(enabled); |
601 |
+ static ssize_t active_show(struct device *dev, struct device_attribute *attr, |
602 |
+ char *buf) |
603 |
+ { |
604 |
++ struct tpm_chip *chip = to_tpm_chip(dev); |
605 |
++ ssize_t rc = 0; |
606 |
+ cap_t cap; |
607 |
+- ssize_t rc; |
608 |
+ |
609 |
+- rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_PERM, &cap, |
610 |
+- "attempting to determine the permanent active state", |
611 |
+- sizeof(cap.perm_flags)); |
612 |
+- if (rc) |
613 |
++ if (tpm_try_get_ops(chip)) |
614 |
+ return 0; |
615 |
+ |
616 |
++ if (tpm_getcap(chip, TPM_CAP_FLAG_PERM, &cap, |
617 |
++ "attempting to determine the permanent active state", |
618 |
++ sizeof(cap.perm_flags))) |
619 |
++ goto out_ops; |
620 |
++ |
621 |
+ rc = sprintf(buf, "%d\n", !cap.perm_flags.deactivated); |
622 |
++out_ops: |
623 |
++ tpm_put_ops(chip); |
624 |
+ return rc; |
625 |
+ } |
626 |
+ static DEVICE_ATTR_RO(active); |
627 |
+@@ -154,16 +178,21 @@ static DEVICE_ATTR_RO(active); |
628 |
+ static ssize_t owned_show(struct device *dev, struct device_attribute *attr, |
629 |
+ char *buf) |
630 |
+ { |
631 |
++ struct tpm_chip *chip = to_tpm_chip(dev); |
632 |
++ ssize_t rc = 0; |
633 |
+ cap_t cap; |
634 |
+- ssize_t rc; |
635 |
+ |
636 |
+- rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_PROP_OWNER, &cap, |
637 |
+- "attempting to determine the owner state", |
638 |
+- sizeof(cap.owned)); |
639 |
+- if (rc) |
640 |
++ if (tpm_try_get_ops(chip)) |
641 |
+ return 0; |
642 |
+ |
643 |
++ if (tpm_getcap(to_tpm_chip(dev), TPM_CAP_PROP_OWNER, &cap, |
644 |
++ "attempting to determine the owner state", |
645 |
++ sizeof(cap.owned))) |
646 |
++ goto out_ops; |
647 |
++ |
648 |
+ rc = sprintf(buf, "%d\n", cap.owned); |
649 |
++out_ops: |
650 |
++ tpm_put_ops(chip); |
651 |
+ return rc; |
652 |
+ } |
653 |
+ static DEVICE_ATTR_RO(owned); |
654 |
+@@ -171,16 +200,21 @@ static DEVICE_ATTR_RO(owned); |
655 |
+ static ssize_t temp_deactivated_show(struct device *dev, |
656 |
+ struct device_attribute *attr, char *buf) |
657 |
+ { |
658 |
++ struct tpm_chip *chip = to_tpm_chip(dev); |
659 |
++ ssize_t rc = 0; |
660 |
+ cap_t cap; |
661 |
+- ssize_t rc; |
662 |
+ |
663 |
+- rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_VOL, &cap, |
664 |
+- "attempting to determine the temporary state", |
665 |
+- sizeof(cap.stclear_flags)); |
666 |
+- if (rc) |
667 |
++ if (tpm_try_get_ops(chip)) |
668 |
+ return 0; |
669 |
+ |
670 |
++ if (tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_VOL, &cap, |
671 |
++ "attempting to determine the temporary state", |
672 |
++ sizeof(cap.stclear_flags))) |
673 |
++ goto out_ops; |
674 |
++ |
675 |
+ rc = sprintf(buf, "%d\n", cap.stclear_flags.deactivated); |
676 |
++out_ops: |
677 |
++ tpm_put_ops(chip); |
678 |
+ return rc; |
679 |
+ } |
680 |
+ static DEVICE_ATTR_RO(temp_deactivated); |
681 |
+@@ -189,15 +223,18 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr, |
682 |
+ char *buf) |
683 |
+ { |
684 |
+ struct tpm_chip *chip = to_tpm_chip(dev); |
685 |
+- cap_t cap; |
686 |
+- ssize_t rc; |
687 |
++ ssize_t rc = 0; |
688 |
+ char *str = buf; |
689 |
++ cap_t cap; |
690 |
+ |
691 |
+- rc = tpm_getcap(chip, TPM_CAP_PROP_MANUFACTURER, &cap, |
692 |
+- "attempting to determine the manufacturer", |
693 |
+- sizeof(cap.manufacturer_id)); |
694 |
+- if (rc) |
695 |
++ if (tpm_try_get_ops(chip)) |
696 |
+ return 0; |
697 |
++ |
698 |
++ if (tpm_getcap(chip, TPM_CAP_PROP_MANUFACTURER, &cap, |
699 |
++ "attempting to determine the manufacturer", |
700 |
++ sizeof(cap.manufacturer_id))) |
701 |
++ goto out_ops; |
702 |
++ |
703 |
+ str += sprintf(str, "Manufacturer: 0x%x\n", |
704 |
+ be32_to_cpu(cap.manufacturer_id)); |
705 |
+ |
706 |
+@@ -214,20 +251,22 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr, |
707 |
+ cap.tpm_version_1_2.revMinor); |
708 |
+ } else { |
709 |
+ /* Otherwise just use TPM_STRUCT_VER */ |
710 |
+- rc = tpm_getcap(chip, TPM_CAP_VERSION_1_1, &cap, |
711 |
+- "attempting to determine the 1.1 version", |
712 |
+- sizeof(cap.tpm_version)); |
713 |
+- if (rc) |
714 |
+- return 0; |
715 |
++ if (tpm_getcap(chip, TPM_CAP_VERSION_1_1, &cap, |
716 |
++ "attempting to determine the 1.1 version", |
717 |
++ sizeof(cap.tpm_version))) |
718 |
++ goto out_ops; |
719 |
++ |
720 |
+ str += sprintf(str, |
721 |
+ "TCG version: %d.%d\nFirmware version: %d.%d\n", |
722 |
+ cap.tpm_version.Major, |
723 |
+ cap.tpm_version.Minor, |
724 |
+ cap.tpm_version.revMajor, |
725 |
+ cap.tpm_version.revMinor); |
726 |
+- } |
727 |
+- |
728 |
+- return str - buf; |
729 |
++} |
730 |
++ rc = str - buf; |
731 |
++out_ops: |
732 |
++ tpm_put_ops(chip); |
733 |
++ return rc; |
734 |
+ } |
735 |
+ static DEVICE_ATTR_RO(caps); |
736 |
+ |
737 |
+@@ -235,10 +274,12 @@ static ssize_t cancel_store(struct device *dev, struct device_attribute *attr, |
738 |
+ const char *buf, size_t count) |
739 |
+ { |
740 |
+ struct tpm_chip *chip = to_tpm_chip(dev); |
741 |
+- if (chip == NULL) |
742 |
++ |
743 |
++ if (tpm_try_get_ops(chip)) |
744 |
+ return 0; |
745 |
+ |
746 |
+ chip->ops->cancel(chip); |
747 |
++ tpm_put_ops(chip); |
748 |
+ return count; |
749 |
+ } |
750 |
+ static DEVICE_ATTR_WO(cancel); |
751 |
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
752 |
+index 4bb9b4aa9b49..d53d12f3df6d 100644 |
753 |
+--- a/drivers/char/tpm/tpm.h |
754 |
++++ b/drivers/char/tpm/tpm.h |
755 |
+@@ -351,17 +351,6 @@ enum tpm_sub_capabilities { |
756 |
+ TPM_CAP_PROP_TIS_DURATION = 0x120, |
757 |
+ }; |
758 |
+ |
759 |
+-struct tpm_readpubek_params_out { |
760 |
+- u8 algorithm[4]; |
761 |
+- u8 encscheme[2]; |
762 |
+- u8 sigscheme[2]; |
763 |
+- __be32 paramsize; |
764 |
+- u8 parameters[12]; /*assuming RSA*/ |
765 |
+- __be32 keysize; |
766 |
+- u8 modulus[256]; |
767 |
+- u8 checksum[20]; |
768 |
+-} __packed; |
769 |
+- |
770 |
+ typedef union { |
771 |
+ struct tpm_input_header in; |
772 |
+ struct tpm_output_header out; |
773 |
+@@ -391,8 +380,6 @@ struct tpm_getrandom_in { |
774 |
+ } __packed; |
775 |
+ |
776 |
+ typedef union { |
777 |
+- struct tpm_readpubek_params_out readpubek_out; |
778 |
+- u8 readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)]; |
779 |
+ struct tpm_pcrread_in pcrread_in; |
780 |
+ struct tpm_pcrread_out pcrread_out; |
781 |
+ struct tpm_getrandom_in getrandom_in; |
782 |
+diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c |
783 |
+index c813c27f2e58..2f97a843d6d6 100644 |
784 |
+--- a/drivers/clk/at91/clk-main.c |
785 |
++++ b/drivers/clk/at91/clk-main.c |
786 |
+@@ -27,6 +27,10 @@ |
787 |
+ |
788 |
+ #define MOR_KEY_MASK (0xff << 16) |
789 |
+ |
790 |
++#define clk_main_parent_select(s) (((s) & \ |
791 |
++ (AT91_PMC_MOSCEN | \ |
792 |
++ AT91_PMC_OSCBYPASS)) ? 1 : 0) |
793 |
++ |
794 |
+ struct clk_main_osc { |
795 |
+ struct clk_hw hw; |
796 |
+ struct regmap *regmap; |
797 |
+@@ -119,7 +123,7 @@ static int clk_main_osc_is_prepared(struct clk_hw *hw) |
798 |
+ |
799 |
+ regmap_read(regmap, AT91_PMC_SR, &status); |
800 |
+ |
801 |
+- return (status & AT91_PMC_MOSCS) && (tmp & AT91_PMC_MOSCEN); |
802 |
++ return (status & AT91_PMC_MOSCS) && clk_main_parent_select(tmp); |
803 |
+ } |
804 |
+ |
805 |
+ static const struct clk_ops main_osc_ops = { |
806 |
+@@ -530,7 +534,7 @@ static u8 clk_sam9x5_main_get_parent(struct clk_hw *hw) |
807 |
+ |
808 |
+ regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status); |
809 |
+ |
810 |
+- return status & AT91_PMC_MOSCEN ? 1 : 0; |
811 |
++ return clk_main_parent_select(status); |
812 |
+ } |
813 |
+ |
814 |
+ static const struct clk_ops sam9x5_main_ops = { |
815 |
+@@ -572,7 +576,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, |
816 |
+ clkmain->hw.init = &init; |
817 |
+ clkmain->regmap = regmap; |
818 |
+ regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status); |
819 |
+- clkmain->parent = status & AT91_PMC_MOSCEN ? 1 : 0; |
820 |
++ clkmain->parent = clk_main_parent_select(status); |
821 |
+ |
822 |
+ hw = &clkmain->hw; |
823 |
+ ret = clk_hw_register(NULL, &clkmain->hw); |
824 |
+diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c |
825 |
+index b0ea753b8709..1a292519d84f 100644 |
826 |
+--- a/drivers/clk/clk-qoriq.c |
827 |
++++ b/drivers/clk/clk-qoriq.c |
828 |
+@@ -610,7 +610,7 @@ static const struct clockgen_chipinfo chipinfo[] = { |
829 |
+ .guts_compat = "fsl,qoriq-device-config-1.0", |
830 |
+ .init_periph = p5020_init_periph, |
831 |
+ .cmux_groups = { |
832 |
+- &p2041_cmux_grp1, &p2041_cmux_grp2 |
833 |
++ &p5020_cmux_grp1, &p5020_cmux_grp2 |
834 |
+ }, |
835 |
+ .cmux_to_group = { |
836 |
+ 0, 1, -1 |
837 |
+diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c |
838 |
+index 77e1e2491689..edb7197cc4b4 100644 |
839 |
+--- a/drivers/clk/sirf/clk-common.c |
840 |
++++ b/drivers/clk/sirf/clk-common.c |
841 |
+@@ -298,9 +298,10 @@ static u8 dmn_clk_get_parent(struct clk_hw *hw) |
842 |
+ { |
843 |
+ struct clk_dmn *clk = to_dmnclk(hw); |
844 |
+ u32 cfg = clkc_readl(clk->regofs); |
845 |
++ const char *name = clk_hw_get_name(hw); |
846 |
+ |
847 |
+ /* parent of io domain can only be pll3 */ |
848 |
+- if (strcmp(hw->init->name, "io") == 0) |
849 |
++ if (strcmp(name, "io") == 0) |
850 |
+ return 4; |
851 |
+ |
852 |
+ WARN_ON((cfg & (BIT(3) - 1)) > 4); |
853 |
+@@ -312,9 +313,10 @@ static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent) |
854 |
+ { |
855 |
+ struct clk_dmn *clk = to_dmnclk(hw); |
856 |
+ u32 cfg = clkc_readl(clk->regofs); |
857 |
++ const char *name = clk_hw_get_name(hw); |
858 |
+ |
859 |
+ /* parent of io domain can only be pll3 */ |
860 |
+- if (strcmp(hw->init->name, "io") == 0) |
861 |
++ if (strcmp(name, "io") == 0) |
862 |
+ return -EINVAL; |
863 |
+ |
864 |
+ cfg &= ~(BIT(3) - 1); |
865 |
+@@ -354,7 +356,8 @@ static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate, |
866 |
+ { |
867 |
+ unsigned long fin; |
868 |
+ unsigned ratio, wait, hold; |
869 |
+- unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; |
870 |
++ const char *name = clk_hw_get_name(hw); |
871 |
++ unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4; |
872 |
+ |
873 |
+ fin = *parent_rate; |
874 |
+ ratio = fin / rate; |
875 |
+@@ -376,7 +379,8 @@ static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
876 |
+ struct clk_dmn *clk = to_dmnclk(hw); |
877 |
+ unsigned long fin; |
878 |
+ unsigned ratio, wait, hold, reg; |
879 |
+- unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; |
880 |
++ const char *name = clk_hw_get_name(hw); |
881 |
++ unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4; |
882 |
+ |
883 |
+ fin = parent_rate; |
884 |
+ ratio = fin / rate; |
885 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
886 |
+index ac12f261f8ca..9e3f4088724b 100644 |
887 |
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
888 |
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c |
889 |
+@@ -499,6 +499,9 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { |
890 |
+ [CLK_MMC1] = &mmc1_clk.common.hw, |
891 |
+ [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, |
892 |
+ [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, |
893 |
++ [CLK_MMC2] = &mmc2_clk.common.hw, |
894 |
++ [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, |
895 |
++ [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, |
896 |
+ [CLK_CE] = &ce_clk.common.hw, |
897 |
+ [CLK_SPI0] = &spi0_clk.common.hw, |
898 |
+ [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, |
899 |
+diff --git a/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c |
900 |
+index 354dd508c516..8dfb8523b79d 100644 |
901 |
+--- a/drivers/clk/zte/clk-zx296718.c |
902 |
++++ b/drivers/clk/zte/clk-zx296718.c |
903 |
+@@ -567,6 +567,7 @@ static int __init top_clocks_init(struct device_node *np) |
904 |
+ { |
905 |
+ void __iomem *reg_base; |
906 |
+ int i, ret; |
907 |
++ const char *name; |
908 |
+ |
909 |
+ reg_base = of_iomap(np, 0); |
910 |
+ if (!reg_base) { |
911 |
+@@ -576,11 +577,10 @@ static int __init top_clocks_init(struct device_node *np) |
912 |
+ |
913 |
+ for (i = 0; i < ARRAY_SIZE(zx296718_pll_clk); i++) { |
914 |
+ zx296718_pll_clk[i].reg_base += (uintptr_t)reg_base; |
915 |
++ name = zx296718_pll_clk[i].hw.init->name; |
916 |
+ ret = clk_hw_register(NULL, &zx296718_pll_clk[i].hw); |
917 |
+- if (ret) { |
918 |
+- pr_warn("top clk %s init error!\n", |
919 |
+- zx296718_pll_clk[i].hw.init->name); |
920 |
+- } |
921 |
++ if (ret) |
922 |
++ pr_warn("top clk %s init error!\n", name); |
923 |
+ } |
924 |
+ |
925 |
+ for (i = 0; i < ARRAY_SIZE(top_ffactor_clk); i++) { |
926 |
+@@ -588,11 +588,10 @@ static int __init top_clocks_init(struct device_node *np) |
927 |
+ top_hw_onecell_data.hws[top_ffactor_clk[i].id] = |
928 |
+ &top_ffactor_clk[i].factor.hw; |
929 |
+ |
930 |
++ name = top_ffactor_clk[i].factor.hw.init->name; |
931 |
+ ret = clk_hw_register(NULL, &top_ffactor_clk[i].factor.hw); |
932 |
+- if (ret) { |
933 |
+- pr_warn("top clk %s init error!\n", |
934 |
+- top_ffactor_clk[i].factor.hw.init->name); |
935 |
+- } |
936 |
++ if (ret) |
937 |
++ pr_warn("top clk %s init error!\n", name); |
938 |
+ } |
939 |
+ |
940 |
+ for (i = 0; i < ARRAY_SIZE(top_mux_clk); i++) { |
941 |
+@@ -601,11 +600,10 @@ static int __init top_clocks_init(struct device_node *np) |
942 |
+ &top_mux_clk[i].mux.hw; |
943 |
+ |
944 |
+ top_mux_clk[i].mux.reg += (uintptr_t)reg_base; |
945 |
++ name = top_mux_clk[i].mux.hw.init->name; |
946 |
+ ret = clk_hw_register(NULL, &top_mux_clk[i].mux.hw); |
947 |
+- if (ret) { |
948 |
+- pr_warn("top clk %s init error!\n", |
949 |
+- top_mux_clk[i].mux.hw.init->name); |
950 |
+- } |
951 |
++ if (ret) |
952 |
++ pr_warn("top clk %s init error!\n", name); |
953 |
+ } |
954 |
+ |
955 |
+ for (i = 0; i < ARRAY_SIZE(top_gate_clk); i++) { |
956 |
+@@ -614,11 +612,10 @@ static int __init top_clocks_init(struct device_node *np) |
957 |
+ &top_gate_clk[i].gate.hw; |
958 |
+ |
959 |
+ top_gate_clk[i].gate.reg += (uintptr_t)reg_base; |
960 |
++ name = top_gate_clk[i].gate.hw.init->name; |
961 |
+ ret = clk_hw_register(NULL, &top_gate_clk[i].gate.hw); |
962 |
+- if (ret) { |
963 |
+- pr_warn("top clk %s init error!\n", |
964 |
+- top_gate_clk[i].gate.hw.init->name); |
965 |
+- } |
966 |
++ if (ret) |
967 |
++ pr_warn("top clk %s init error!\n", name); |
968 |
+ } |
969 |
+ |
970 |
+ for (i = 0; i < ARRAY_SIZE(top_div_clk); i++) { |
971 |
+@@ -627,11 +624,10 @@ static int __init top_clocks_init(struct device_node *np) |
972 |
+ &top_div_clk[i].div.hw; |
973 |
+ |
974 |
+ top_div_clk[i].div.reg += (uintptr_t)reg_base; |
975 |
++ name = top_div_clk[i].div.hw.init->name; |
976 |
+ ret = clk_hw_register(NULL, &top_div_clk[i].div.hw); |
977 |
+- if (ret) { |
978 |
+- pr_warn("top clk %s init error!\n", |
979 |
+- top_div_clk[i].div.hw.init->name); |
980 |
+- } |
981 |
++ if (ret) |
982 |
++ pr_warn("top clk %s init error!\n", name); |
983 |
+ } |
984 |
+ |
985 |
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, |
986 |
+@@ -757,6 +753,7 @@ static int __init lsp0_clocks_init(struct device_node *np) |
987 |
+ { |
988 |
+ void __iomem *reg_base; |
989 |
+ int i, ret; |
990 |
++ const char *name; |
991 |
+ |
992 |
+ reg_base = of_iomap(np, 0); |
993 |
+ if (!reg_base) { |
994 |
+@@ -770,11 +767,10 @@ static int __init lsp0_clocks_init(struct device_node *np) |
995 |
+ &lsp0_mux_clk[i].mux.hw; |
996 |
+ |
997 |
+ lsp0_mux_clk[i].mux.reg += (uintptr_t)reg_base; |
998 |
++ name = lsp0_mux_clk[i].mux.hw.init->name; |
999 |
+ ret = clk_hw_register(NULL, &lsp0_mux_clk[i].mux.hw); |
1000 |
+- if (ret) { |
1001 |
+- pr_warn("lsp0 clk %s init error!\n", |
1002 |
+- lsp0_mux_clk[i].mux.hw.init->name); |
1003 |
+- } |
1004 |
++ if (ret) |
1005 |
++ pr_warn("lsp0 clk %s init error!\n", name); |
1006 |
+ } |
1007 |
+ |
1008 |
+ for (i = 0; i < ARRAY_SIZE(lsp0_gate_clk); i++) { |
1009 |
+@@ -783,11 +779,10 @@ static int __init lsp0_clocks_init(struct device_node *np) |
1010 |
+ &lsp0_gate_clk[i].gate.hw; |
1011 |
+ |
1012 |
+ lsp0_gate_clk[i].gate.reg += (uintptr_t)reg_base; |
1013 |
++ name = lsp0_gate_clk[i].gate.hw.init->name; |
1014 |
+ ret = clk_hw_register(NULL, &lsp0_gate_clk[i].gate.hw); |
1015 |
+- if (ret) { |
1016 |
+- pr_warn("lsp0 clk %s init error!\n", |
1017 |
+- lsp0_gate_clk[i].gate.hw.init->name); |
1018 |
+- } |
1019 |
++ if (ret) |
1020 |
++ pr_warn("lsp0 clk %s init error!\n", name); |
1021 |
+ } |
1022 |
+ |
1023 |
+ for (i = 0; i < ARRAY_SIZE(lsp0_div_clk); i++) { |
1024 |
+@@ -796,11 +791,10 @@ static int __init lsp0_clocks_init(struct device_node *np) |
1025 |
+ &lsp0_div_clk[i].div.hw; |
1026 |
+ |
1027 |
+ lsp0_div_clk[i].div.reg += (uintptr_t)reg_base; |
1028 |
++ name = lsp0_div_clk[i].div.hw.init->name; |
1029 |
+ ret = clk_hw_register(NULL, &lsp0_div_clk[i].div.hw); |
1030 |
+- if (ret) { |
1031 |
+- pr_warn("lsp0 clk %s init error!\n", |
1032 |
+- lsp0_div_clk[i].div.hw.init->name); |
1033 |
+- } |
1034 |
++ if (ret) |
1035 |
++ pr_warn("lsp0 clk %s init error!\n", name); |
1036 |
+ } |
1037 |
+ |
1038 |
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, |
1039 |
+@@ -865,6 +859,7 @@ static int __init lsp1_clocks_init(struct device_node *np) |
1040 |
+ { |
1041 |
+ void __iomem *reg_base; |
1042 |
+ int i, ret; |
1043 |
++ const char *name; |
1044 |
+ |
1045 |
+ reg_base = of_iomap(np, 0); |
1046 |
+ if (!reg_base) { |
1047 |
+@@ -878,11 +873,10 @@ static int __init lsp1_clocks_init(struct device_node *np) |
1048 |
+ &lsp0_mux_clk[i].mux.hw; |
1049 |
+ |
1050 |
+ lsp1_mux_clk[i].mux.reg += (uintptr_t)reg_base; |
1051 |
++ name = lsp1_mux_clk[i].mux.hw.init->name; |
1052 |
+ ret = clk_hw_register(NULL, &lsp1_mux_clk[i].mux.hw); |
1053 |
+- if (ret) { |
1054 |
+- pr_warn("lsp1 clk %s init error!\n", |
1055 |
+- lsp1_mux_clk[i].mux.hw.init->name); |
1056 |
+- } |
1057 |
++ if (ret) |
1058 |
++ pr_warn("lsp1 clk %s init error!\n", name); |
1059 |
+ } |
1060 |
+ |
1061 |
+ for (i = 0; i < ARRAY_SIZE(lsp1_gate_clk); i++) { |
1062 |
+@@ -891,11 +885,10 @@ static int __init lsp1_clocks_init(struct device_node *np) |
1063 |
+ &lsp1_gate_clk[i].gate.hw; |
1064 |
+ |
1065 |
+ lsp1_gate_clk[i].gate.reg += (uintptr_t)reg_base; |
1066 |
++ name = lsp1_gate_clk[i].gate.hw.init->name; |
1067 |
+ ret = clk_hw_register(NULL, &lsp1_gate_clk[i].gate.hw); |
1068 |
+- if (ret) { |
1069 |
+- pr_warn("lsp1 clk %s init error!\n", |
1070 |
+- lsp1_gate_clk[i].gate.hw.init->name); |
1071 |
+- } |
1072 |
++ if (ret) |
1073 |
++ pr_warn("lsp1 clk %s init error!\n", name); |
1074 |
+ } |
1075 |
+ |
1076 |
+ for (i = 0; i < ARRAY_SIZE(lsp1_div_clk); i++) { |
1077 |
+@@ -904,11 +897,10 @@ static int __init lsp1_clocks_init(struct device_node *np) |
1078 |
+ &lsp1_div_clk[i].div.hw; |
1079 |
+ |
1080 |
+ lsp1_div_clk[i].div.reg += (uintptr_t)reg_base; |
1081 |
++ name = lsp1_div_clk[i].div.hw.init->name; |
1082 |
+ ret = clk_hw_register(NULL, &lsp1_div_clk[i].div.hw); |
1083 |
+- if (ret) { |
1084 |
+- pr_warn("lsp1 clk %s init error!\n", |
1085 |
+- lsp1_div_clk[i].div.hw.init->name); |
1086 |
+- } |
1087 |
++ if (ret) |
1088 |
++ pr_warn("lsp1 clk %s init error!\n", name); |
1089 |
+ } |
1090 |
+ |
1091 |
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, |
1092 |
+@@ -982,6 +974,7 @@ static int __init audio_clocks_init(struct device_node *np) |
1093 |
+ { |
1094 |
+ void __iomem *reg_base; |
1095 |
+ int i, ret; |
1096 |
++ const char *name; |
1097 |
+ |
1098 |
+ reg_base = of_iomap(np, 0); |
1099 |
+ if (!reg_base) { |
1100 |
+@@ -995,11 +988,10 @@ static int __init audio_clocks_init(struct device_node *np) |
1101 |
+ &audio_mux_clk[i].mux.hw; |
1102 |
+ |
1103 |
+ audio_mux_clk[i].mux.reg += (uintptr_t)reg_base; |
1104 |
++ name = audio_mux_clk[i].mux.hw.init->name; |
1105 |
+ ret = clk_hw_register(NULL, &audio_mux_clk[i].mux.hw); |
1106 |
+- if (ret) { |
1107 |
+- pr_warn("audio clk %s init error!\n", |
1108 |
+- audio_mux_clk[i].mux.hw.init->name); |
1109 |
+- } |
1110 |
++ if (ret) |
1111 |
++ pr_warn("audio clk %s init error!\n", name); |
1112 |
+ } |
1113 |
+ |
1114 |
+ for (i = 0; i < ARRAY_SIZE(audio_adiv_clk); i++) { |
1115 |
+@@ -1008,11 +1000,10 @@ static int __init audio_clocks_init(struct device_node *np) |
1116 |
+ &audio_adiv_clk[i].hw; |
1117 |
+ |
1118 |
+ audio_adiv_clk[i].reg_base += (uintptr_t)reg_base; |
1119 |
++ name = audio_adiv_clk[i].hw.init->name; |
1120 |
+ ret = clk_hw_register(NULL, &audio_adiv_clk[i].hw); |
1121 |
+- if (ret) { |
1122 |
+- pr_warn("audio clk %s init error!\n", |
1123 |
+- audio_adiv_clk[i].hw.init->name); |
1124 |
+- } |
1125 |
++ if (ret) |
1126 |
++ pr_warn("audio clk %s init error!\n", name); |
1127 |
+ } |
1128 |
+ |
1129 |
+ for (i = 0; i < ARRAY_SIZE(audio_div_clk); i++) { |
1130 |
+@@ -1021,11 +1012,10 @@ static int __init audio_clocks_init(struct device_node *np) |
1131 |
+ &audio_div_clk[i].div.hw; |
1132 |
+ |
1133 |
+ audio_div_clk[i].div.reg += (uintptr_t)reg_base; |
1134 |
++ name = audio_div_clk[i].div.hw.init->name; |
1135 |
+ ret = clk_hw_register(NULL, &audio_div_clk[i].div.hw); |
1136 |
+- if (ret) { |
1137 |
+- pr_warn("audio clk %s init error!\n", |
1138 |
+- audio_div_clk[i].div.hw.init->name); |
1139 |
+- } |
1140 |
++ if (ret) |
1141 |
++ pr_warn("audio clk %s init error!\n", name); |
1142 |
+ } |
1143 |
+ |
1144 |
+ for (i = 0; i < ARRAY_SIZE(audio_gate_clk); i++) { |
1145 |
+@@ -1034,11 +1024,10 @@ static int __init audio_clocks_init(struct device_node *np) |
1146 |
+ &audio_gate_clk[i].gate.hw; |
1147 |
+ |
1148 |
+ audio_gate_clk[i].gate.reg += (uintptr_t)reg_base; |
1149 |
++ name = audio_gate_clk[i].gate.hw.init->name; |
1150 |
+ ret = clk_hw_register(NULL, &audio_gate_clk[i].gate.hw); |
1151 |
+- if (ret) { |
1152 |
+- pr_warn("audio clk %s init error!\n", |
1153 |
+- audio_gate_clk[i].gate.hw.init->name); |
1154 |
+- } |
1155 |
++ if (ret) |
1156 |
++ pr_warn("audio clk %s init error!\n", name); |
1157 |
+ } |
1158 |
+ |
1159 |
+ ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, |
1160 |
+diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c |
1161 |
+index 24f83f9eeaed..114b36674af4 100644 |
1162 |
+--- a/drivers/dma-buf/sw_sync.c |
1163 |
++++ b/drivers/dma-buf/sw_sync.c |
1164 |
+@@ -141,17 +141,14 @@ static void timeline_fence_release(struct dma_fence *fence) |
1165 |
+ { |
1166 |
+ struct sync_pt *pt = dma_fence_to_sync_pt(fence); |
1167 |
+ struct sync_timeline *parent = dma_fence_parent(fence); |
1168 |
++ unsigned long flags; |
1169 |
+ |
1170 |
++ spin_lock_irqsave(fence->lock, flags); |
1171 |
+ if (!list_empty(&pt->link)) { |
1172 |
+- unsigned long flags; |
1173 |
+- |
1174 |
+- spin_lock_irqsave(fence->lock, flags); |
1175 |
+- if (!list_empty(&pt->link)) { |
1176 |
+- list_del(&pt->link); |
1177 |
+- rb_erase(&pt->node, &parent->pt_tree); |
1178 |
+- } |
1179 |
+- spin_unlock_irqrestore(fence->lock, flags); |
1180 |
++ list_del(&pt->link); |
1181 |
++ rb_erase(&pt->node, &parent->pt_tree); |
1182 |
+ } |
1183 |
++ spin_unlock_irqrestore(fence->lock, flags); |
1184 |
+ |
1185 |
+ sync_timeline_put(parent); |
1186 |
+ dma_fence_free(fence); |
1187 |
+@@ -275,7 +272,8 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, |
1188 |
+ p = &parent->rb_left; |
1189 |
+ } else { |
1190 |
+ if (dma_fence_get_rcu(&other->base)) { |
1191 |
+- dma_fence_put(&pt->base); |
1192 |
++ sync_timeline_put(obj); |
1193 |
++ kfree(pt); |
1194 |
+ pt = other; |
1195 |
+ goto unlock; |
1196 |
+ } |
1197 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c |
1198 |
+index 40520a968eac..28eea8317e87 100644 |
1199 |
+--- a/drivers/gpu/drm/amd/amdgpu/si.c |
1200 |
++++ b/drivers/gpu/drm/amd/amdgpu/si.c |
1201 |
+@@ -1783,7 +1783,7 @@ static void si_program_aspm(struct amdgpu_device *adev) |
1202 |
+ if (orig != data) |
1203 |
+ si_pif_phy1_wreg(adev,PB1_PIF_PWRDOWN_1, data); |
1204 |
+ |
1205 |
+- if ((adev->family != CHIP_OLAND) && (adev->family != CHIP_HAINAN)) { |
1206 |
++ if ((adev->asic_type != CHIP_OLAND) && (adev->asic_type != CHIP_HAINAN)) { |
1207 |
+ orig = data = si_pif_phy0_rreg(adev,PB0_PIF_PWRDOWN_0); |
1208 |
+ data &= ~PLL_RAMP_UP_TIME_0_MASK; |
1209 |
+ if (orig != data) |
1210 |
+@@ -1832,14 +1832,14 @@ static void si_program_aspm(struct amdgpu_device *adev) |
1211 |
+ |
1212 |
+ orig = data = si_pif_phy0_rreg(adev,PB0_PIF_CNTL); |
1213 |
+ data &= ~LS2_EXIT_TIME_MASK; |
1214 |
+- if ((adev->family == CHIP_OLAND) || (adev->family == CHIP_HAINAN)) |
1215 |
++ if ((adev->asic_type == CHIP_OLAND) || (adev->asic_type == CHIP_HAINAN)) |
1216 |
+ data |= LS2_EXIT_TIME(5); |
1217 |
+ if (orig != data) |
1218 |
+ si_pif_phy0_wreg(adev,PB0_PIF_CNTL, data); |
1219 |
+ |
1220 |
+ orig = data = si_pif_phy1_rreg(adev,PB1_PIF_CNTL); |
1221 |
+ data &= ~LS2_EXIT_TIME_MASK; |
1222 |
+- if ((adev->family == CHIP_OLAND) || (adev->family == CHIP_HAINAN)) |
1223 |
++ if ((adev->asic_type == CHIP_OLAND) || (adev->asic_type == CHIP_HAINAN)) |
1224 |
+ data |= LS2_EXIT_TIME(5); |
1225 |
+ if (orig != data) |
1226 |
+ si_pif_phy1_wreg(adev,PB1_PIF_CNTL, data); |
1227 |
+diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c |
1228 |
+index 9705ca197b90..cefa2c1685ba 100644 |
1229 |
+--- a/drivers/gpu/drm/bridge/tc358767.c |
1230 |
++++ b/drivers/gpu/drm/bridge/tc358767.c |
1231 |
+@@ -300,7 +300,7 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux, |
1232 |
+ struct drm_dp_aux_msg *msg) |
1233 |
+ { |
1234 |
+ struct tc_data *tc = aux_to_tc(aux); |
1235 |
+- size_t size = min_t(size_t, 8, msg->size); |
1236 |
++ size_t size = min_t(size_t, DP_AUX_MAX_PAYLOAD_BYTES - 1, msg->size); |
1237 |
+ u8 request = msg->request & ~DP_AUX_I2C_MOT; |
1238 |
+ u8 *buf = msg->buffer; |
1239 |
+ u32 tmp = 0; |
1240 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c |
1241 |
+index 7143ea4611aa..33a9fb5ac558 100644 |
1242 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c |
1243 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c |
1244 |
+@@ -96,6 +96,8 @@ nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, |
1245 |
+ info->min = min(info->base, |
1246 |
+ info->base + info->step * info->vidmask); |
1247 |
+ info->max = nvbios_rd32(bios, volt + 0x0e); |
1248 |
++ if (!info->max) |
1249 |
++ info->max = max(info->base, info->base + info->step * info->vidmask); |
1250 |
+ break; |
1251 |
+ case 0x50: |
1252 |
+ info->min = nvbios_rd32(bios, volt + 0x0a); |
1253 |
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c |
1254 |
+index 7a0fd4e4e78d..c1daed3fe842 100644 |
1255 |
+--- a/drivers/gpu/drm/panel/panel-simple.c |
1256 |
++++ b/drivers/gpu/drm/panel/panel-simple.c |
1257 |
+@@ -614,9 +614,9 @@ static const struct panel_desc auo_g133han01 = { |
1258 |
+ static const struct display_timing auo_g185han01_timings = { |
1259 |
+ .pixelclock = { 120000000, 144000000, 175000000 }, |
1260 |
+ .hactive = { 1920, 1920, 1920 }, |
1261 |
+- .hfront_porch = { 18, 60, 74 }, |
1262 |
+- .hback_porch = { 12, 44, 54 }, |
1263 |
+- .hsync_len = { 10, 24, 32 }, |
1264 |
++ .hfront_porch = { 36, 120, 148 }, |
1265 |
++ .hback_porch = { 24, 88, 108 }, |
1266 |
++ .hsync_len = { 20, 48, 64 }, |
1267 |
+ .vactive = { 1080, 1080, 1080 }, |
1268 |
+ .vfront_porch = { 6, 10, 40 }, |
1269 |
+ .vback_porch = { 2, 5, 20 }, |
1270 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
1271 |
+index 337d3a1c2a40..48f752cf7a92 100644 |
1272 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
1273 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
1274 |
+@@ -764,7 +764,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct |
1275 |
+ |
1276 |
+ radeon_encoder->output_csc = val; |
1277 |
+ |
1278 |
+- if (connector->encoder->crtc) { |
1279 |
++ if (connector->encoder && connector->encoder->crtc) { |
1280 |
+ struct drm_crtc *crtc = connector->encoder->crtc; |
1281 |
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
1282 |
+ |
1283 |
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
1284 |
+index f4becad0a78c..54d97dd5780a 100644 |
1285 |
+--- a/drivers/gpu/drm/radeon/radeon_drv.c |
1286 |
++++ b/drivers/gpu/drm/radeon/radeon_drv.c |
1287 |
+@@ -368,11 +368,19 @@ radeon_pci_remove(struct pci_dev *pdev) |
1288 |
+ static void |
1289 |
+ radeon_pci_shutdown(struct pci_dev *pdev) |
1290 |
+ { |
1291 |
++ struct drm_device *ddev = pci_get_drvdata(pdev); |
1292 |
++ |
1293 |
+ /* if we are running in a VM, make sure the device |
1294 |
+ * torn down properly on reboot/shutdown |
1295 |
+ */ |
1296 |
+ if (radeon_device_is_virtual()) |
1297 |
+ radeon_pci_remove(pdev); |
1298 |
++ |
1299 |
++ /* Some adapters need to be suspended before a |
1300 |
++ * shutdown occurs in order to prevent an error |
1301 |
++ * during kexec. |
1302 |
++ */ |
1303 |
++ radeon_suspend_kms(ddev, true, true, false); |
1304 |
+ } |
1305 |
+ |
1306 |
+ static int radeon_pmops_suspend(struct device *dev) |
1307 |
+diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c |
1308 |
+index d394a03632c4..c3bd80b03f16 100644 |
1309 |
+--- a/drivers/gpu/drm/stm/ltdc.c |
1310 |
++++ b/drivers/gpu/drm/stm/ltdc.c |
1311 |
+@@ -20,6 +20,7 @@ |
1312 |
+ #include <drm/drm_crtc_helper.h> |
1313 |
+ #include <drm/drm_fb_cma_helper.h> |
1314 |
+ #include <drm/drm_gem_cma_helper.h> |
1315 |
++#include <drm/drm_gem_framebuffer_helper.h> |
1316 |
+ #include <drm/drm_of.h> |
1317 |
+ #include <drm/drm_bridge.h> |
1318 |
+ #include <drm/drm_plane_helper.h> |
1319 |
+@@ -691,6 +692,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = { |
1320 |
+ }; |
1321 |
+ |
1322 |
+ static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = { |
1323 |
++ .prepare_fb = drm_gem_fb_prepare_fb, |
1324 |
+ .atomic_check = ltdc_plane_atomic_check, |
1325 |
+ .atomic_update = ltdc_plane_atomic_update, |
1326 |
+ .atomic_disable = ltdc_plane_atomic_disable, |
1327 |
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c |
1328 |
+index 1cb41992aaa1..d0a81a03ddbd 100644 |
1329 |
+--- a/drivers/hid/hid-apple.c |
1330 |
++++ b/drivers/hid/hid-apple.c |
1331 |
+@@ -57,7 +57,6 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") |
1332 |
+ struct apple_sc { |
1333 |
+ unsigned long quirks; |
1334 |
+ unsigned int fn_on; |
1335 |
+- DECLARE_BITMAP(pressed_fn, KEY_CNT); |
1336 |
+ DECLARE_BITMAP(pressed_numlock, KEY_CNT); |
1337 |
+ }; |
1338 |
+ |
1339 |
+@@ -184,6 +183,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
1340 |
+ { |
1341 |
+ struct apple_sc *asc = hid_get_drvdata(hid); |
1342 |
+ const struct apple_key_translation *trans, *table; |
1343 |
++ bool do_translate; |
1344 |
++ u16 code = 0; |
1345 |
+ |
1346 |
+ if (usage->code == KEY_FN) { |
1347 |
+ asc->fn_on = !!value; |
1348 |
+@@ -192,8 +193,6 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
1349 |
+ } |
1350 |
+ |
1351 |
+ if (fnmode) { |
1352 |
+- int do_translate; |
1353 |
+- |
1354 |
+ if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && |
1355 |
+ hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) |
1356 |
+ table = macbookair_fn_keys; |
1357 |
+@@ -205,25 +204,33 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
1358 |
+ trans = apple_find_translation (table, usage->code); |
1359 |
+ |
1360 |
+ if (trans) { |
1361 |
+- if (test_bit(usage->code, asc->pressed_fn)) |
1362 |
+- do_translate = 1; |
1363 |
+- else if (trans->flags & APPLE_FLAG_FKEY) |
1364 |
+- do_translate = (fnmode == 2 && asc->fn_on) || |
1365 |
+- (fnmode == 1 && !asc->fn_on); |
1366 |
+- else |
1367 |
+- do_translate = asc->fn_on; |
1368 |
+- |
1369 |
+- if (do_translate) { |
1370 |
+- if (value) |
1371 |
+- set_bit(usage->code, asc->pressed_fn); |
1372 |
+- else |
1373 |
+- clear_bit(usage->code, asc->pressed_fn); |
1374 |
+- |
1375 |
+- input_event(input, usage->type, trans->to, |
1376 |
+- value); |
1377 |
+- |
1378 |
+- return 1; |
1379 |
++ if (test_bit(trans->from, input->key)) |
1380 |
++ code = trans->from; |
1381 |
++ else if (test_bit(trans->to, input->key)) |
1382 |
++ code = trans->to; |
1383 |
++ |
1384 |
++ if (!code) { |
1385 |
++ if (trans->flags & APPLE_FLAG_FKEY) { |
1386 |
++ switch (fnmode) { |
1387 |
++ case 1: |
1388 |
++ do_translate = !asc->fn_on; |
1389 |
++ break; |
1390 |
++ case 2: |
1391 |
++ do_translate = asc->fn_on; |
1392 |
++ break; |
1393 |
++ default: |
1394 |
++ /* should never happen */ |
1395 |
++ do_translate = false; |
1396 |
++ } |
1397 |
++ } else { |
1398 |
++ do_translate = asc->fn_on; |
1399 |
++ } |
1400 |
++ |
1401 |
++ code = do_translate ? trans->to : trans->from; |
1402 |
+ } |
1403 |
++ |
1404 |
++ input_event(input, usage->type, code, value); |
1405 |
++ return 1; |
1406 |
+ } |
1407 |
+ |
1408 |
+ if (asc->quirks & APPLE_NUMLOCK_EMULATION && |
1409 |
+diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c |
1410 |
+index 190bbbc7bfee..29456c8821e7 100644 |
1411 |
+--- a/drivers/i2c/busses/i2c-cht-wc.c |
1412 |
++++ b/drivers/i2c/busses/i2c-cht-wc.c |
1413 |
+@@ -185,6 +185,51 @@ static const struct i2c_algorithm cht_wc_i2c_adap_algo = { |
1414 |
+ .smbus_xfer = cht_wc_i2c_adap_smbus_xfer, |
1415 |
+ }; |
1416 |
+ |
1417 |
++/* |
1418 |
++ * We are an i2c-adapter which itself is part of an i2c-client. This means that |
1419 |
++ * transfers done through us take adapter->bus_lock twice, once for our parent |
1420 |
++ * i2c-adapter and once to take our own bus_lock. Lockdep does not like this |
1421 |
++ * nested locking, to make lockdep happy in the case of busses with muxes, the |
1422 |
++ * i2c-core's i2c_adapter_lock_bus function calls: |
1423 |
++ * rt_mutex_lock_nested(&adapter->bus_lock, i2c_adapter_depth(adapter)); |
1424 |
++ * |
1425 |
++ * But i2c_adapter_depth only works when the direct parent of the adapter is |
1426 |
++ * another adapter, as it is only meant for muxes. In our case there is an |
1427 |
++ * i2c-client and MFD instantiated platform_device in the parent->child chain |
1428 |
++ * between the 2 devices. |
1429 |
++ * |
1430 |
++ * So we override the default i2c_lock_operations and pass a hardcoded |
1431 |
++ * depth of 1 to rt_mutex_lock_nested, to make lockdep happy. |
1432 |
++ * |
1433 |
++ * Note that if there were to be a mux attached to our adapter, this would |
1434 |
++ * break things again since the i2c-mux code expects the root-adapter to have |
1435 |
++ * a locking depth of 0. But we always have only 1 client directly attached |
1436 |
++ * in the form of the Charger IC paired with the CHT Whiskey Cove PMIC. |
1437 |
++ */ |
1438 |
++static void cht_wc_i2c_adap_lock_bus(struct i2c_adapter *adapter, |
1439 |
++ unsigned int flags) |
1440 |
++{ |
1441 |
++ rt_mutex_lock_nested(&adapter->bus_lock, 1); |
1442 |
++} |
1443 |
++ |
1444 |
++static int cht_wc_i2c_adap_trylock_bus(struct i2c_adapter *adapter, |
1445 |
++ unsigned int flags) |
1446 |
++{ |
1447 |
++ return rt_mutex_trylock(&adapter->bus_lock); |
1448 |
++} |
1449 |
++ |
1450 |
++static void cht_wc_i2c_adap_unlock_bus(struct i2c_adapter *adapter, |
1451 |
++ unsigned int flags) |
1452 |
++{ |
1453 |
++ rt_mutex_unlock(&adapter->bus_lock); |
1454 |
++} |
1455 |
++ |
1456 |
++static const struct i2c_lock_operations cht_wc_i2c_adap_lock_ops = { |
1457 |
++ .lock_bus = cht_wc_i2c_adap_lock_bus, |
1458 |
++ .trylock_bus = cht_wc_i2c_adap_trylock_bus, |
1459 |
++ .unlock_bus = cht_wc_i2c_adap_unlock_bus, |
1460 |
++}; |
1461 |
++ |
1462 |
+ /**** irqchip for the client connected to the extchgr i2c adapter ****/ |
1463 |
+ static void cht_wc_i2c_irq_lock(struct irq_data *data) |
1464 |
+ { |
1465 |
+@@ -268,6 +313,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) |
1466 |
+ adap->adapter.owner = THIS_MODULE; |
1467 |
+ adap->adapter.class = I2C_CLASS_HWMON; |
1468 |
+ adap->adapter.algo = &cht_wc_i2c_adap_algo; |
1469 |
++ adap->adapter.lock_ops = &cht_wc_i2c_adap_lock_ops; |
1470 |
+ strlcpy(adap->adapter.name, "PMIC I2C Adapter", |
1471 |
+ sizeof(adap->adapter.name)); |
1472 |
+ adap->adapter.dev.parent = &pdev->dev; |
1473 |
+diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c |
1474 |
+index d9ae983095c5..2b7e8eeaa59e 100644 |
1475 |
+--- a/drivers/mfd/intel-lpss-pci.c |
1476 |
++++ b/drivers/mfd/intel-lpss-pci.c |
1477 |
+@@ -39,6 +39,8 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, |
1478 |
+ info->mem = &pdev->resource[0]; |
1479 |
+ info->irq = pdev->irq; |
1480 |
+ |
1481 |
++ pdev->d3cold_delay = 0; |
1482 |
++ |
1483 |
+ /* Probably it is enough to set this for iDMA capable devices only */ |
1484 |
+ pci_set_master(pdev); |
1485 |
+ pci_try_set_mwi(pdev); |
1486 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
1487 |
+index 99a9d5278369..8441ce3541af 100644 |
1488 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
1489 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
1490 |
+@@ -137,13 +137,12 @@ static int uldrx_handler(struct sge_rspq *q, const __be64 *rsp, |
1491 |
+ static int alloc_uld_rxqs(struct adapter *adap, |
1492 |
+ struct sge_uld_rxq_info *rxq_info, bool lro) |
1493 |
+ { |
1494 |
+- struct sge *s = &adap->sge; |
1495 |
+ unsigned int nq = rxq_info->nrxq + rxq_info->nciq; |
1496 |
++ int i, err, msi_idx, que_idx = 0, bmap_idx = 0; |
1497 |
+ struct sge_ofld_rxq *q = rxq_info->uldrxq; |
1498 |
+ unsigned short *ids = rxq_info->rspq_id; |
1499 |
+- unsigned int bmap_idx = 0; |
1500 |
++ struct sge *s = &adap->sge; |
1501 |
+ unsigned int per_chan; |
1502 |
+- int i, err, msi_idx, que_idx = 0; |
1503 |
+ |
1504 |
+ per_chan = rxq_info->nrxq / adap->params.nports; |
1505 |
+ |
1506 |
+@@ -161,6 +160,10 @@ static int alloc_uld_rxqs(struct adapter *adap, |
1507 |
+ |
1508 |
+ if (msi_idx >= 0) { |
1509 |
+ bmap_idx = get_msix_idx_from_bmap(adap); |
1510 |
++ if (bmap_idx < 0) { |
1511 |
++ err = -ENOSPC; |
1512 |
++ goto freeout; |
1513 |
++ } |
1514 |
+ msi_idx = adap->msix_info_ulds[bmap_idx].idx; |
1515 |
+ } |
1516 |
+ err = t4_sge_alloc_rxq(adap, &q->rspq, false, |
1517 |
+diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
1518 |
+index 080d00520362..5fca9a75780c 100644 |
1519 |
+--- a/drivers/net/ethernet/qlogic/qla3xxx.c |
1520 |
++++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
1521 |
+@@ -2787,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1522 |
+ netdev_err(qdev->ndev, |
1523 |
+ "PCI mapping failed with error: %d\n", |
1524 |
+ err); |
1525 |
++ dev_kfree_skb_irq(skb); |
1526 |
+ ql_free_large_buffers(qdev); |
1527 |
+ return -ENOMEM; |
1528 |
+ } |
1529 |
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
1530 |
+index 18a0952f68a8..6597d1f8d68c 100644 |
1531 |
+--- a/drivers/net/usb/hso.c |
1532 |
++++ b/drivers/net/usb/hso.c |
1533 |
+@@ -2633,14 +2633,18 @@ static struct hso_device *hso_create_bulk_serial_device( |
1534 |
+ */ |
1535 |
+ if (serial->tiocmget) { |
1536 |
+ tiocmget = serial->tiocmget; |
1537 |
++ tiocmget->endp = hso_get_ep(interface, |
1538 |
++ USB_ENDPOINT_XFER_INT, |
1539 |
++ USB_DIR_IN); |
1540 |
++ if (!tiocmget->endp) { |
1541 |
++ dev_err(&interface->dev, "Failed to find INT IN ep\n"); |
1542 |
++ goto exit; |
1543 |
++ } |
1544 |
++ |
1545 |
+ tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); |
1546 |
+ if (tiocmget->urb) { |
1547 |
+ mutex_init(&tiocmget->mutex); |
1548 |
+ init_waitqueue_head(&tiocmget->waitq); |
1549 |
+- tiocmget->endp = hso_get_ep( |
1550 |
+- interface, |
1551 |
+- USB_ENDPOINT_XFER_INT, |
1552 |
+- USB_DIR_IN); |
1553 |
+ } else |
1554 |
+ hso_free_tiomget(serial); |
1555 |
+ } |
1556 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1557 |
+index e2050afaab7a..e406a05e79dc 100644 |
1558 |
+--- a/drivers/net/usb/qmi_wwan.c |
1559 |
++++ b/drivers/net/usb/qmi_wwan.c |
1560 |
+@@ -1275,6 +1275,7 @@ static const struct usb_device_id products[] = { |
1561 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
1562 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
1563 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ |
1564 |
++ {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */ |
1565 |
+ {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ |
1566 |
+ {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ |
1567 |
+ {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
1568 |
+diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
1569 |
+index 5cb3edae586f..91bf86cee273 100644 |
1570 |
+--- a/drivers/net/xen-netfront.c |
1571 |
++++ b/drivers/net/xen-netfront.c |
1572 |
+@@ -889,9 +889,9 @@ static int xennet_set_skb_gso(struct sk_buff *skb, |
1573 |
+ return 0; |
1574 |
+ } |
1575 |
+ |
1576 |
+-static RING_IDX xennet_fill_frags(struct netfront_queue *queue, |
1577 |
+- struct sk_buff *skb, |
1578 |
+- struct sk_buff_head *list) |
1579 |
++static int xennet_fill_frags(struct netfront_queue *queue, |
1580 |
++ struct sk_buff *skb, |
1581 |
++ struct sk_buff_head *list) |
1582 |
+ { |
1583 |
+ RING_IDX cons = queue->rx.rsp_cons; |
1584 |
+ struct sk_buff *nskb; |
1585 |
+@@ -910,7 +910,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, |
1586 |
+ if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { |
1587 |
+ queue->rx.rsp_cons = ++cons + skb_queue_len(list); |
1588 |
+ kfree_skb(nskb); |
1589 |
+- return ~0U; |
1590 |
++ return -ENOENT; |
1591 |
+ } |
1592 |
+ |
1593 |
+ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
1594 |
+@@ -921,7 +921,9 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, |
1595 |
+ kfree_skb(nskb); |
1596 |
+ } |
1597 |
+ |
1598 |
+- return cons; |
1599 |
++ queue->rx.rsp_cons = cons; |
1600 |
++ |
1601 |
++ return 0; |
1602 |
+ } |
1603 |
+ |
1604 |
+ static int checksum_setup(struct net_device *dev, struct sk_buff *skb) |
1605 |
+@@ -1047,8 +1049,7 @@ err: |
1606 |
+ skb->data_len = rx->status; |
1607 |
+ skb->len += rx->status; |
1608 |
+ |
1609 |
+- i = xennet_fill_frags(queue, skb, &tmpq); |
1610 |
+- if (unlikely(i == ~0U)) |
1611 |
++ if (unlikely(xennet_fill_frags(queue, skb, &tmpq))) |
1612 |
+ goto err; |
1613 |
+ |
1614 |
+ if (rx->flags & XEN_NETRXF_csum_blank) |
1615 |
+@@ -1058,7 +1059,7 @@ err: |
1616 |
+ |
1617 |
+ __skb_queue_tail(&rxq, skb); |
1618 |
+ |
1619 |
+- queue->rx.rsp_cons = ++i; |
1620 |
++ i = ++queue->rx.rsp_cons; |
1621 |
+ work_done++; |
1622 |
+ } |
1623 |
+ |
1624 |
+diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c |
1625 |
+index ea03f1ec12a4..01acb418d1fd 100644 |
1626 |
+--- a/drivers/pci/dwc/pci-exynos.c |
1627 |
++++ b/drivers/pci/dwc/pci-exynos.c |
1628 |
+@@ -683,7 +683,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) |
1629 |
+ |
1630 |
+ ep->phy = devm_of_phy_get(dev, np, NULL); |
1631 |
+ if (IS_ERR(ep->phy)) { |
1632 |
+- if (PTR_ERR(ep->phy) == -EPROBE_DEFER) |
1633 |
++ if (PTR_ERR(ep->phy) != -ENODEV) |
1634 |
+ return PTR_ERR(ep->phy); |
1635 |
+ dev_warn(dev, "Use the 'phy' property. Current DT of pci-exynos was deprecated!!\n"); |
1636 |
+ } else |
1637 |
+diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c |
1638 |
+index 1f1069b70e45..5509b6e2de94 100644 |
1639 |
+--- a/drivers/pci/dwc/pci-imx6.c |
1640 |
++++ b/drivers/pci/dwc/pci-imx6.c |
1641 |
+@@ -827,8 +827,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) |
1642 |
+ |
1643 |
+ imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); |
1644 |
+ if (IS_ERR(imx6_pcie->vpcie)) { |
1645 |
+- if (PTR_ERR(imx6_pcie->vpcie) == -EPROBE_DEFER) |
1646 |
+- return -EPROBE_DEFER; |
1647 |
++ if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) |
1648 |
++ return PTR_ERR(imx6_pcie->vpcie); |
1649 |
+ imx6_pcie->vpcie = NULL; |
1650 |
+ } |
1651 |
+ |
1652 |
+diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c |
1653 |
+index 1987fec1f126..8efd086c57c9 100644 |
1654 |
+--- a/drivers/pci/host/pci-tegra.c |
1655 |
++++ b/drivers/pci/host/pci-tegra.c |
1656 |
+@@ -1910,14 +1910,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) |
1657 |
+ err = of_pci_get_devfn(port); |
1658 |
+ if (err < 0) { |
1659 |
+ dev_err(dev, "failed to parse address: %d\n", err); |
1660 |
+- return err; |
1661 |
++ goto err_node_put; |
1662 |
+ } |
1663 |
+ |
1664 |
+ index = PCI_SLOT(err); |
1665 |
+ |
1666 |
+ if (index < 1 || index > soc->num_ports) { |
1667 |
+ dev_err(dev, "invalid port number: %d\n", index); |
1668 |
+- return -EINVAL; |
1669 |
++ err = -EINVAL; |
1670 |
++ goto err_node_put; |
1671 |
+ } |
1672 |
+ |
1673 |
+ index--; |
1674 |
+@@ -1926,12 +1927,13 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) |
1675 |
+ if (err < 0) { |
1676 |
+ dev_err(dev, "failed to parse # of lanes: %d\n", |
1677 |
+ err); |
1678 |
+- return err; |
1679 |
++ goto err_node_put; |
1680 |
+ } |
1681 |
+ |
1682 |
+ if (value > 16) { |
1683 |
+ dev_err(dev, "invalid # of lanes: %u\n", value); |
1684 |
+- return -EINVAL; |
1685 |
++ err = -EINVAL; |
1686 |
++ goto err_node_put; |
1687 |
+ } |
1688 |
+ |
1689 |
+ lanes |= value << (index << 3); |
1690 |
+@@ -1945,13 +1947,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) |
1691 |
+ lane += value; |
1692 |
+ |
1693 |
+ rp = devm_kzalloc(dev, sizeof(*rp), GFP_KERNEL); |
1694 |
+- if (!rp) |
1695 |
+- return -ENOMEM; |
1696 |
++ if (!rp) { |
1697 |
++ err = -ENOMEM; |
1698 |
++ goto err_node_put; |
1699 |
++ } |
1700 |
+ |
1701 |
+ err = of_address_to_resource(port, 0, &rp->regs); |
1702 |
+ if (err < 0) { |
1703 |
+ dev_err(dev, "failed to parse address: %d\n", err); |
1704 |
+- return err; |
1705 |
++ goto err_node_put; |
1706 |
+ } |
1707 |
+ |
1708 |
+ INIT_LIST_HEAD(&rp->list); |
1709 |
+@@ -1978,6 +1982,10 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) |
1710 |
+ return err; |
1711 |
+ |
1712 |
+ return 0; |
1713 |
++ |
1714 |
++err_node_put: |
1715 |
++ of_node_put(port); |
1716 |
++ return err; |
1717 |
+ } |
1718 |
+ |
1719 |
+ /* |
1720 |
+diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c |
1721 |
+index 9051c6c8fea4..d3f9e7d24727 100644 |
1722 |
+--- a/drivers/pci/host/pcie-rockchip.c |
1723 |
++++ b/drivers/pci/host/pcie-rockchip.c |
1724 |
+@@ -1129,29 +1129,29 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) |
1725 |
+ |
1726 |
+ rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v"); |
1727 |
+ if (IS_ERR(rockchip->vpcie12v)) { |
1728 |
+- if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER) |
1729 |
+- return -EPROBE_DEFER; |
1730 |
++ if (PTR_ERR(rockchip->vpcie12v) != -ENODEV) |
1731 |
++ return PTR_ERR(rockchip->vpcie12v); |
1732 |
+ dev_info(dev, "no vpcie12v regulator found\n"); |
1733 |
+ } |
1734 |
+ |
1735 |
+ rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); |
1736 |
+ if (IS_ERR(rockchip->vpcie3v3)) { |
1737 |
+- if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER) |
1738 |
+- return -EPROBE_DEFER; |
1739 |
++ if (PTR_ERR(rockchip->vpcie3v3) != -ENODEV) |
1740 |
++ return PTR_ERR(rockchip->vpcie3v3); |
1741 |
+ dev_info(dev, "no vpcie3v3 regulator found\n"); |
1742 |
+ } |
1743 |
+ |
1744 |
+ rockchip->vpcie1v8 = devm_regulator_get_optional(dev, "vpcie1v8"); |
1745 |
+ if (IS_ERR(rockchip->vpcie1v8)) { |
1746 |
+- if (PTR_ERR(rockchip->vpcie1v8) == -EPROBE_DEFER) |
1747 |
+- return -EPROBE_DEFER; |
1748 |
++ if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV) |
1749 |
++ return PTR_ERR(rockchip->vpcie1v8); |
1750 |
+ dev_info(dev, "no vpcie1v8 regulator found\n"); |
1751 |
+ } |
1752 |
+ |
1753 |
+ rockchip->vpcie0v9 = devm_regulator_get_optional(dev, "vpcie0v9"); |
1754 |
+ if (IS_ERR(rockchip->vpcie0v9)) { |
1755 |
+- if (PTR_ERR(rockchip->vpcie0v9) == -EPROBE_DEFER) |
1756 |
+- return -EPROBE_DEFER; |
1757 |
++ if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV) |
1758 |
++ return PTR_ERR(rockchip->vpcie0v9); |
1759 |
+ dev_info(dev, "no vpcie0v9 regulator found\n"); |
1760 |
+ } |
1761 |
+ |
1762 |
+diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c |
1763 |
+index 51716819129d..e5c9b9c68428 100644 |
1764 |
+--- a/drivers/pinctrl/tegra/pinctrl-tegra.c |
1765 |
++++ b/drivers/pinctrl/tegra/pinctrl-tegra.c |
1766 |
+@@ -51,7 +51,9 @@ static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg) |
1767 |
+ |
1768 |
+ static inline void pmx_writel(struct tegra_pmx *pmx, u32 val, u32 bank, u32 reg) |
1769 |
+ { |
1770 |
+- writel(val, pmx->regs[bank] + reg); |
1771 |
++ writel_relaxed(val, pmx->regs[bank] + reg); |
1772 |
++ /* make sure pinmux register write completed */ |
1773 |
++ pmx_readl(pmx, bank, reg); |
1774 |
+ } |
1775 |
+ |
1776 |
+ static int tegra_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) |
1777 |
+diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c |
1778 |
+index 71eee39520f0..7aa2c5ea0de4 100644 |
1779 |
+--- a/drivers/rtc/rtc-snvs.c |
1780 |
++++ b/drivers/rtc/rtc-snvs.c |
1781 |
+@@ -280,6 +280,10 @@ static int snvs_rtc_probe(struct platform_device *pdev) |
1782 |
+ if (!data) |
1783 |
+ return -ENOMEM; |
1784 |
+ |
1785 |
++ data->rtc = devm_rtc_allocate_device(&pdev->dev); |
1786 |
++ if (IS_ERR(data->rtc)) |
1787 |
++ return PTR_ERR(data->rtc); |
1788 |
++ |
1789 |
+ data->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); |
1790 |
+ |
1791 |
+ if (IS_ERR(data->regmap)) { |
1792 |
+@@ -342,10 +346,9 @@ static int snvs_rtc_probe(struct platform_device *pdev) |
1793 |
+ goto error_rtc_device_register; |
1794 |
+ } |
1795 |
+ |
1796 |
+- data->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
1797 |
+- &snvs_rtc_ops, THIS_MODULE); |
1798 |
+- if (IS_ERR(data->rtc)) { |
1799 |
+- ret = PTR_ERR(data->rtc); |
1800 |
++ data->rtc->ops = &snvs_rtc_ops; |
1801 |
++ ret = rtc_register_device(data->rtc); |
1802 |
++ if (ret) { |
1803 |
+ dev_err(&pdev->dev, "failed to register rtc: %d\n", ret); |
1804 |
+ goto error_rtc_device_register; |
1805 |
+ } |
1806 |
+diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c |
1807 |
+index bd70339c1242..03d9855a6afd 100644 |
1808 |
+--- a/drivers/scsi/scsi_logging.c |
1809 |
++++ b/drivers/scsi/scsi_logging.c |
1810 |
+@@ -16,57 +16,15 @@ |
1811 |
+ #include <scsi/scsi_eh.h> |
1812 |
+ #include <scsi/scsi_dbg.h> |
1813 |
+ |
1814 |
+-#define SCSI_LOG_SPOOLSIZE 4096 |
1815 |
+- |
1816 |
+-#if (SCSI_LOG_SPOOLSIZE / SCSI_LOG_BUFSIZE) > BITS_PER_LONG |
1817 |
+-#warning SCSI logging bitmask too large |
1818 |
+-#endif |
1819 |
+- |
1820 |
+-struct scsi_log_buf { |
1821 |
+- char buffer[SCSI_LOG_SPOOLSIZE]; |
1822 |
+- unsigned long map; |
1823 |
+-}; |
1824 |
+- |
1825 |
+-static DEFINE_PER_CPU(struct scsi_log_buf, scsi_format_log); |
1826 |
+- |
1827 |
+ static char *scsi_log_reserve_buffer(size_t *len) |
1828 |
+ { |
1829 |
+- struct scsi_log_buf *buf; |
1830 |
+- unsigned long map_bits = sizeof(buf->buffer) / SCSI_LOG_BUFSIZE; |
1831 |
+- unsigned long idx = 0; |
1832 |
+- |
1833 |
+- preempt_disable(); |
1834 |
+- buf = this_cpu_ptr(&scsi_format_log); |
1835 |
+- idx = find_first_zero_bit(&buf->map, map_bits); |
1836 |
+- if (likely(idx < map_bits)) { |
1837 |
+- while (test_and_set_bit(idx, &buf->map)) { |
1838 |
+- idx = find_next_zero_bit(&buf->map, map_bits, idx); |
1839 |
+- if (idx >= map_bits) |
1840 |
+- break; |
1841 |
+- } |
1842 |
+- } |
1843 |
+- if (WARN_ON(idx >= map_bits)) { |
1844 |
+- preempt_enable(); |
1845 |
+- return NULL; |
1846 |
+- } |
1847 |
+- *len = SCSI_LOG_BUFSIZE; |
1848 |
+- return buf->buffer + idx * SCSI_LOG_BUFSIZE; |
1849 |
++ *len = 128; |
1850 |
++ return kmalloc(*len, GFP_ATOMIC); |
1851 |
+ } |
1852 |
+ |
1853 |
+ static void scsi_log_release_buffer(char *bufptr) |
1854 |
+ { |
1855 |
+- struct scsi_log_buf *buf; |
1856 |
+- unsigned long idx; |
1857 |
+- int ret; |
1858 |
+- |
1859 |
+- buf = this_cpu_ptr(&scsi_format_log); |
1860 |
+- if (bufptr >= buf->buffer && |
1861 |
+- bufptr < buf->buffer + SCSI_LOG_SPOOLSIZE) { |
1862 |
+- idx = (bufptr - buf->buffer) / SCSI_LOG_BUFSIZE; |
1863 |
+- ret = test_and_clear_bit(idx, &buf->map); |
1864 |
+- WARN_ON(!ret); |
1865 |
+- } |
1866 |
+- preempt_enable(); |
1867 |
++ kfree(bufptr); |
1868 |
+ } |
1869 |
+ |
1870 |
+ static inline const char *scmd_name(const struct scsi_cmnd *scmd) |
1871 |
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
1872 |
+index 6f5cc67e343e..15b1cd4ef5a7 100644 |
1873 |
+--- a/drivers/vfio/pci/vfio_pci.c |
1874 |
++++ b/drivers/vfio/pci/vfio_pci.c |
1875 |
+@@ -363,11 +363,20 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) |
1876 |
+ pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); |
1877 |
+ |
1878 |
+ /* |
1879 |
+- * Try to reset the device. The success of this is dependent on |
1880 |
+- * being able to lock the device, which is not always possible. |
1881 |
++ * Try to get the locks ourselves to prevent a deadlock. The |
1882 |
++ * success of this is dependent on being able to lock the device, |
1883 |
++ * which is not always possible. |
1884 |
++ * We can not use the "try" reset interface here, which will |
1885 |
++ * overwrite the previously restored configuration information. |
1886 |
+ */ |
1887 |
+- if (vdev->reset_works && !pci_try_reset_function(pdev)) |
1888 |
+- vdev->needs_reset = false; |
1889 |
++ if (vdev->reset_works && pci_cfg_access_trylock(pdev)) { |
1890 |
++ if (device_trylock(&pdev->dev)) { |
1891 |
++ if (!__pci_reset_function_locked(pdev)) |
1892 |
++ vdev->needs_reset = false; |
1893 |
++ device_unlock(&pdev->dev); |
1894 |
++ } |
1895 |
++ pci_cfg_access_unlock(pdev); |
1896 |
++ } |
1897 |
+ |
1898 |
+ pci_restore_state(pdev); |
1899 |
+ out: |
1900 |
+diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c |
1901 |
+index f599520374dd..5f7dbf1c4609 100644 |
1902 |
+--- a/drivers/video/fbdev/ssd1307fb.c |
1903 |
++++ b/drivers/video/fbdev/ssd1307fb.c |
1904 |
+@@ -433,7 +433,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) |
1905 |
+ if (ret < 0) |
1906 |
+ return ret; |
1907 |
+ |
1908 |
+- ret = ssd1307fb_write_cmd(par->client, 0x0); |
1909 |
++ ret = ssd1307fb_write_cmd(par->client, par->page_offset); |
1910 |
+ if (ret < 0) |
1911 |
+ return ret; |
1912 |
+ |
1913 |
+diff --git a/fs/fat/dir.c b/fs/fat/dir.c |
1914 |
+index 81cecbe6d7cf..971e369517a7 100644 |
1915 |
+--- a/fs/fat/dir.c |
1916 |
++++ b/fs/fat/dir.c |
1917 |
+@@ -1097,8 +1097,11 @@ static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used, |
1918 |
+ err = -ENOMEM; |
1919 |
+ goto error; |
1920 |
+ } |
1921 |
++ /* Avoid race with userspace read via bdev */ |
1922 |
++ lock_buffer(bhs[n]); |
1923 |
+ memset(bhs[n]->b_data, 0, sb->s_blocksize); |
1924 |
+ set_buffer_uptodate(bhs[n]); |
1925 |
++ unlock_buffer(bhs[n]); |
1926 |
+ mark_buffer_dirty_inode(bhs[n], dir); |
1927 |
+ |
1928 |
+ n++; |
1929 |
+@@ -1155,6 +1158,8 @@ int fat_alloc_new_dir(struct inode *dir, struct timespec *ts) |
1930 |
+ fat_time_unix2fat(sbi, ts, &time, &date, &time_cs); |
1931 |
+ |
1932 |
+ de = (struct msdos_dir_entry *)bhs[0]->b_data; |
1933 |
++ /* Avoid race with userspace read via bdev */ |
1934 |
++ lock_buffer(bhs[0]); |
1935 |
+ /* filling the new directory slots ("." and ".." entries) */ |
1936 |
+ memcpy(de[0].name, MSDOS_DOT, MSDOS_NAME); |
1937 |
+ memcpy(de[1].name, MSDOS_DOTDOT, MSDOS_NAME); |
1938 |
+@@ -1177,6 +1182,7 @@ int fat_alloc_new_dir(struct inode *dir, struct timespec *ts) |
1939 |
+ de[0].size = de[1].size = 0; |
1940 |
+ memset(de + 2, 0, sb->s_blocksize - 2 * sizeof(*de)); |
1941 |
+ set_buffer_uptodate(bhs[0]); |
1942 |
++ unlock_buffer(bhs[0]); |
1943 |
+ mark_buffer_dirty_inode(bhs[0], dir); |
1944 |
+ |
1945 |
+ err = fat_zeroed_cluster(dir, blknr, 1, bhs, MAX_BUF_PER_PAGE); |
1946 |
+@@ -1234,11 +1240,14 @@ static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots, |
1947 |
+ |
1948 |
+ /* fill the directory entry */ |
1949 |
+ copy = min(size, sb->s_blocksize); |
1950 |
++ /* Avoid race with userspace read via bdev */ |
1951 |
++ lock_buffer(bhs[n]); |
1952 |
+ memcpy(bhs[n]->b_data, slots, copy); |
1953 |
+- slots += copy; |
1954 |
+- size -= copy; |
1955 |
+ set_buffer_uptodate(bhs[n]); |
1956 |
++ unlock_buffer(bhs[n]); |
1957 |
+ mark_buffer_dirty_inode(bhs[n], dir); |
1958 |
++ slots += copy; |
1959 |
++ size -= copy; |
1960 |
+ if (!size) |
1961 |
+ break; |
1962 |
+ n++; |
1963 |
+diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c |
1964 |
+index 9635df94db7d..24ed1f4e48ae 100644 |
1965 |
+--- a/fs/fat/fatent.c |
1966 |
++++ b/fs/fat/fatent.c |
1967 |
+@@ -389,8 +389,11 @@ static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs, |
1968 |
+ err = -ENOMEM; |
1969 |
+ goto error; |
1970 |
+ } |
1971 |
++ /* Avoid race with userspace read via bdev */ |
1972 |
++ lock_buffer(c_bh); |
1973 |
+ memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize); |
1974 |
+ set_buffer_uptodate(c_bh); |
1975 |
++ unlock_buffer(c_bh); |
1976 |
+ mark_buffer_dirty_inode(c_bh, sbi->fat_inode); |
1977 |
+ if (sb->s_flags & MS_SYNCHRONOUS) |
1978 |
+ err = sync_dirty_buffer(c_bh); |
1979 |
+diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c |
1980 |
+index 63d701cd1e2e..c8e9b7031d9a 100644 |
1981 |
+--- a/fs/ocfs2/dlm/dlmunlock.c |
1982 |
++++ b/fs/ocfs2/dlm/dlmunlock.c |
1983 |
+@@ -105,7 +105,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, |
1984 |
+ enum dlm_status status; |
1985 |
+ int actions = 0; |
1986 |
+ int in_use; |
1987 |
+- u8 owner; |
1988 |
++ u8 owner; |
1989 |
++ int recovery_wait = 0; |
1990 |
+ |
1991 |
+ mlog(0, "master_node = %d, valblk = %d\n", master_node, |
1992 |
+ flags & LKM_VALBLK); |
1993 |
+@@ -208,9 +209,12 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, |
1994 |
+ } |
1995 |
+ if (flags & LKM_CANCEL) |
1996 |
+ lock->cancel_pending = 0; |
1997 |
+- else |
1998 |
+- lock->unlock_pending = 0; |
1999 |
+- |
2000 |
++ else { |
2001 |
++ if (!lock->unlock_pending) |
2002 |
++ recovery_wait = 1; |
2003 |
++ else |
2004 |
++ lock->unlock_pending = 0; |
2005 |
++ } |
2006 |
+ } |
2007 |
+ |
2008 |
+ /* get an extra ref on lock. if we are just switching |
2009 |
+@@ -244,6 +248,17 @@ leave: |
2010 |
+ spin_unlock(&res->spinlock); |
2011 |
+ wake_up(&res->wq); |
2012 |
+ |
2013 |
++ if (recovery_wait) { |
2014 |
++ spin_lock(&res->spinlock); |
2015 |
++ /* Unlock request will directly succeed after owner dies, |
2016 |
++ * and the lock is already removed from grant list. We have to |
2017 |
++ * wait for RECOVERING done or we miss the chance to purge it |
2018 |
++ * since the removement is much faster than RECOVERING proc. |
2019 |
++ */ |
2020 |
++ __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_RECOVERING); |
2021 |
++ spin_unlock(&res->spinlock); |
2022 |
++ } |
2023 |
++ |
2024 |
+ /* let the caller's final dlm_lock_put handle the actual kfree */ |
2025 |
+ if (actions & DLM_UNLOCK_FREE_LOCK) { |
2026 |
+ /* this should always be coupled with list removal */ |
2027 |
+diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h |
2028 |
+index 04e0679767f6..2b5dfae78272 100644 |
2029 |
+--- a/include/scsi/scsi_dbg.h |
2030 |
++++ b/include/scsi/scsi_dbg.h |
2031 |
+@@ -6,8 +6,6 @@ struct scsi_cmnd; |
2032 |
+ struct scsi_device; |
2033 |
+ struct scsi_sense_hdr; |
2034 |
+ |
2035 |
+-#define SCSI_LOG_BUFSIZE 128 |
2036 |
+- |
2037 |
+ extern void scsi_print_command(struct scsi_cmnd *); |
2038 |
+ extern size_t __scsi_format_command(char *, size_t, |
2039 |
+ const unsigned char *, size_t); |
2040 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
2041 |
+index 2d828d346982..59d2e94ecb79 100644 |
2042 |
+--- a/kernel/bpf/syscall.c |
2043 |
++++ b/kernel/bpf/syscall.c |
2044 |
+@@ -1067,20 +1067,26 @@ static int bpf_prog_load(union bpf_attr *attr) |
2045 |
+ if (err) |
2046 |
+ goto free_used_maps; |
2047 |
+ |
2048 |
+- err = bpf_prog_new_fd(prog); |
2049 |
+- if (err < 0) { |
2050 |
+- /* failed to allocate fd. |
2051 |
+- * bpf_prog_put() is needed because the above |
2052 |
+- * bpf_prog_alloc_id() has published the prog |
2053 |
+- * to the userspace and the userspace may |
2054 |
+- * have refcnt-ed it through BPF_PROG_GET_FD_BY_ID. |
2055 |
+- */ |
2056 |
+- bpf_prog_put(prog); |
2057 |
+- return err; |
2058 |
+- } |
2059 |
+- |
2060 |
++ /* Upon success of bpf_prog_alloc_id(), the BPF prog is |
2061 |
++ * effectively publicly exposed. However, retrieving via |
2062 |
++ * bpf_prog_get_fd_by_id() will take another reference, |
2063 |
++ * therefore it cannot be gone underneath us. |
2064 |
++ * |
2065 |
++ * Only for the time /after/ successful bpf_prog_new_fd() |
2066 |
++ * and before returning to userspace, we might just hold |
2067 |
++ * one reference and any parallel close on that fd could |
2068 |
++ * rip everything out. Hence, below notifications must |
2069 |
++ * happen before bpf_prog_new_fd(). |
2070 |
++ * |
2071 |
++ * Also, any failure handling from this point onwards must |
2072 |
++ * be using bpf_prog_put() given the program is exposed. |
2073 |
++ */ |
2074 |
+ bpf_prog_kallsyms_add(prog); |
2075 |
+ trace_bpf_prog_load(prog, err); |
2076 |
++ |
2077 |
++ err = bpf_prog_new_fd(prog); |
2078 |
++ if (err < 0) |
2079 |
++ bpf_prog_put(prog); |
2080 |
+ return err; |
2081 |
+ |
2082 |
+ free_used_maps: |
2083 |
+diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c |
2084 |
+index 20fef1a38602..8f15665ab616 100644 |
2085 |
+--- a/kernel/kexec_core.c |
2086 |
++++ b/kernel/kexec_core.c |
2087 |
+@@ -301,6 +301,8 @@ static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order) |
2088 |
+ { |
2089 |
+ struct page *pages; |
2090 |
+ |
2091 |
++ if (fatal_signal_pending(current)) |
2092 |
++ return NULL; |
2093 |
+ pages = alloc_pages(gfp_mask & ~__GFP_ZERO, order); |
2094 |
+ if (pages) { |
2095 |
+ unsigned int count, i; |
2096 |
+diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c |
2097 |
+index 88754e9790f9..f8dc77b18962 100644 |
2098 |
+--- a/kernel/livepatch/core.c |
2099 |
++++ b/kernel/livepatch/core.c |
2100 |
+@@ -941,6 +941,7 @@ err: |
2101 |
+ pr_warn("patch '%s' failed for module '%s', refusing to load module '%s'\n", |
2102 |
+ patch->mod->name, obj->mod->name, obj->mod->name); |
2103 |
+ mod->klp_alive = false; |
2104 |
++ obj->mod = NULL; |
2105 |
+ klp_cleanup_module_patches_limited(mod, patch); |
2106 |
+ mutex_unlock(&klp_mutex); |
2107 |
+ |
2108 |
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug |
2109 |
+index 131d5871f8c9..e1df563cdfe7 100644 |
2110 |
+--- a/lib/Kconfig.debug |
2111 |
++++ b/lib/Kconfig.debug |
2112 |
+@@ -570,7 +570,7 @@ config DEBUG_KMEMLEAK_EARLY_LOG_SIZE |
2113 |
+ int "Maximum kmemleak early log entries" |
2114 |
+ depends on DEBUG_KMEMLEAK |
2115 |
+ range 200 40000 |
2116 |
+- default 400 |
2117 |
++ default 16000 |
2118 |
+ help |
2119 |
+ Kmemleak must track all the memory allocations to avoid |
2120 |
+ reporting false positives. Since memory may be allocated or |
2121 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
2122 |
+index c8d39092e8bf..5f466db916ee 100644 |
2123 |
+--- a/net/core/sock.c |
2124 |
++++ b/net/core/sock.c |
2125 |
+@@ -1561,8 +1561,6 @@ static void __sk_destruct(struct rcu_head *head) |
2126 |
+ sk_filter_uncharge(sk, filter); |
2127 |
+ RCU_INIT_POINTER(sk->sk_filter, NULL); |
2128 |
+ } |
2129 |
+- if (rcu_access_pointer(sk->sk_reuseport_cb)) |
2130 |
+- reuseport_detach_sock(sk); |
2131 |
+ |
2132 |
+ sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP); |
2133 |
+ |
2134 |
+@@ -1585,7 +1583,14 @@ static void __sk_destruct(struct rcu_head *head) |
2135 |
+ |
2136 |
+ void sk_destruct(struct sock *sk) |
2137 |
+ { |
2138 |
+- if (sock_flag(sk, SOCK_RCU_FREE)) |
2139 |
++ bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE); |
2140 |
++ |
2141 |
++ if (rcu_access_pointer(sk->sk_reuseport_cb)) { |
2142 |
++ reuseport_detach_sock(sk); |
2143 |
++ use_call_rcu = true; |
2144 |
++ } |
2145 |
++ |
2146 |
++ if (use_call_rcu) |
2147 |
+ call_rcu(&sk->sk_rcu, __sk_destruct); |
2148 |
+ else |
2149 |
+ __sk_destruct(&sk->sk_rcu); |
2150 |
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
2151 |
+index 0fc499db6da2..347be2ea78d4 100644 |
2152 |
+--- a/net/ipv4/ip_gre.c |
2153 |
++++ b/net/ipv4/ip_gre.c |
2154 |
+@@ -1424,6 +1424,7 @@ nla_put_failure: |
2155 |
+ static void erspan_setup(struct net_device *dev) |
2156 |
+ { |
2157 |
+ ether_setup(dev); |
2158 |
++ dev->max_mtu = 0; |
2159 |
+ dev->netdev_ops = &erspan_netdev_ops; |
2160 |
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
2161 |
+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
2162 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
2163 |
+index 3b72990a8bb9..5a1cffb769fd 100644 |
2164 |
+--- a/net/ipv4/route.c |
2165 |
++++ b/net/ipv4/route.c |
2166 |
+@@ -925,16 +925,15 @@ void ip_rt_send_redirect(struct sk_buff *skb) |
2167 |
+ if (peer->rate_tokens == 0 || |
2168 |
+ time_after(jiffies, |
2169 |
+ (peer->rate_last + |
2170 |
+- (ip_rt_redirect_load << peer->rate_tokens)))) { |
2171 |
++ (ip_rt_redirect_load << peer->n_redirects)))) { |
2172 |
+ __be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr); |
2173 |
+ |
2174 |
+ icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); |
2175 |
+ peer->rate_last = jiffies; |
2176 |
+- ++peer->rate_tokens; |
2177 |
+ ++peer->n_redirects; |
2178 |
+ #ifdef CONFIG_IP_ROUTE_VERBOSE |
2179 |
+ if (log_martians && |
2180 |
+- peer->rate_tokens == ip_rt_redirect_number) |
2181 |
++ peer->n_redirects == ip_rt_redirect_number) |
2182 |
+ net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n", |
2183 |
+ &ip_hdr(skb)->saddr, inet_iif(skb), |
2184 |
+ &ip_hdr(skb)->daddr, &gw); |
2185 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
2186 |
+index c47161e92407..a81201dd3a1a 100644 |
2187 |
+--- a/net/ipv6/addrconf.c |
2188 |
++++ b/net/ipv6/addrconf.c |
2189 |
+@@ -5547,13 +5547,20 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) |
2190 |
+ switch (event) { |
2191 |
+ case RTM_NEWADDR: |
2192 |
+ /* |
2193 |
+- * If the address was optimistic |
2194 |
+- * we inserted the route at the start of |
2195 |
+- * our DAD process, so we don't need |
2196 |
+- * to do it again |
2197 |
++ * If the address was optimistic we inserted the route at the |
2198 |
++ * start of our DAD process, so we don't need to do it again. |
2199 |
++ * If the device was taken down in the middle of the DAD |
2200 |
++ * cycle there is a race where we could get here without a |
2201 |
++ * host route, so nothing to insert. That will be fixed when |
2202 |
++ * the device is brought up. |
2203 |
+ */ |
2204 |
+- if (!rcu_access_pointer(ifp->rt->rt6i_node)) |
2205 |
++ if (ifp->rt && !rcu_access_pointer(ifp->rt->rt6i_node)) { |
2206 |
+ ip6_ins_rt(ifp->rt); |
2207 |
++ } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) { |
2208 |
++ pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n", |
2209 |
++ &ifp->addr, ifp->idev->dev->name); |
2210 |
++ } |
2211 |
++ |
2212 |
+ if (ifp->idev->cnf.forwarding) |
2213 |
+ addrconf_join_anycast(ifp); |
2214 |
+ if (!ipv6_addr_any(&ifp->peer_addr)) |
2215 |
+diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c |
2216 |
+index 9ee208a348f5..e41070fb4fc0 100644 |
2217 |
+--- a/net/ipv6/ip6_input.c |
2218 |
++++ b/net/ipv6/ip6_input.c |
2219 |
+@@ -173,6 +173,16 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt |
2220 |
+ if (ipv6_addr_is_multicast(&hdr->saddr)) |
2221 |
+ goto err; |
2222 |
+ |
2223 |
++ /* While RFC4291 is not explicit about v4mapped addresses |
2224 |
++ * in IPv6 headers, it seems clear linux dual-stack |
2225 |
++ * model can not deal properly with these. |
2226 |
++ * Security models could be fooled by ::ffff:127.0.0.1 for example. |
2227 |
++ * |
2228 |
++ * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 |
2229 |
++ */ |
2230 |
++ if (ipv6_addr_v4mapped(&hdr->saddr)) |
2231 |
++ goto err; |
2232 |
++ |
2233 |
+ skb->transport_header = skb->network_header + sizeof(*hdr); |
2234 |
+ IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
2235 |
+ |
2236 |
+diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
2237 |
+index 33ad7e25a89d..a51bfba19b9e 100644 |
2238 |
+--- a/net/nfc/llcp_sock.c |
2239 |
++++ b/net/nfc/llcp_sock.c |
2240 |
+@@ -119,9 +119,14 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) |
2241 |
+ llcp_sock->service_name = kmemdup(llcp_addr.service_name, |
2242 |
+ llcp_sock->service_name_len, |
2243 |
+ GFP_KERNEL); |
2244 |
+- |
2245 |
++ if (!llcp_sock->service_name) { |
2246 |
++ ret = -ENOMEM; |
2247 |
++ goto put_dev; |
2248 |
++ } |
2249 |
+ llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); |
2250 |
+ if (llcp_sock->ssap == LLCP_SAP_MAX) { |
2251 |
++ kfree(llcp_sock->service_name); |
2252 |
++ llcp_sock->service_name = NULL; |
2253 |
+ ret = -EADDRINUSE; |
2254 |
+ goto put_dev; |
2255 |
+ } |
2256 |
+diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c |
2257 |
+index 08ed6abe4aae..5f2acd029da5 100644 |
2258 |
+--- a/net/nfc/netlink.c |
2259 |
++++ b/net/nfc/netlink.c |
2260 |
+@@ -970,7 +970,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info) |
2261 |
+ int rc; |
2262 |
+ u32 idx; |
2263 |
+ |
2264 |
+- if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) |
2265 |
++ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || |
2266 |
++ !info->attrs[NFC_ATTR_TARGET_INDEX]) |
2267 |
+ return -EINVAL; |
2268 |
+ |
2269 |
+ idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); |
2270 |
+@@ -1019,7 +1020,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info) |
2271 |
+ struct sk_buff *msg = NULL; |
2272 |
+ u32 idx; |
2273 |
+ |
2274 |
+- if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) |
2275 |
++ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || |
2276 |
++ !info->attrs[NFC_ATTR_FIRMWARE_NAME]) |
2277 |
+ return -EINVAL; |
2278 |
+ |
2279 |
+ idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); |
2280 |
+diff --git a/net/rds/ib.c b/net/rds/ib.c |
2281 |
+index c21eb4850b9d..e723146cec29 100644 |
2282 |
+--- a/net/rds/ib.c |
2283 |
++++ b/net/rds/ib.c |
2284 |
+@@ -140,6 +140,9 @@ static void rds_ib_add_one(struct ib_device *device) |
2285 |
+ refcount_set(&rds_ibdev->refcount, 1); |
2286 |
+ INIT_WORK(&rds_ibdev->free_work, rds_ib_dev_free); |
2287 |
+ |
2288 |
++ INIT_LIST_HEAD(&rds_ibdev->ipaddr_list); |
2289 |
++ INIT_LIST_HEAD(&rds_ibdev->conn_list); |
2290 |
++ |
2291 |
+ rds_ibdev->max_wrs = device->attrs.max_qp_wr; |
2292 |
+ rds_ibdev->max_sge = min(device->attrs.max_sge, RDS_IB_MAX_SGE); |
2293 |
+ |
2294 |
+@@ -199,9 +202,6 @@ static void rds_ib_add_one(struct ib_device *device) |
2295 |
+ device->name, |
2296 |
+ rds_ibdev->use_fastreg ? "FRMR" : "FMR"); |
2297 |
+ |
2298 |
+- INIT_LIST_HEAD(&rds_ibdev->ipaddr_list); |
2299 |
+- INIT_LIST_HEAD(&rds_ibdev->conn_list); |
2300 |
+- |
2301 |
+ down_write(&rds_ib_devices_lock); |
2302 |
+ list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices); |
2303 |
+ up_write(&rds_ib_devices_lock); |
2304 |
+diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c |
2305 |
+index aeffa320429d..40fd1ee0095c 100644 |
2306 |
+--- a/net/sched/sch_cbq.c |
2307 |
++++ b/net/sched/sch_cbq.c |
2308 |
+@@ -1131,6 +1131,26 @@ static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = { |
2309 |
+ [TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) }, |
2310 |
+ }; |
2311 |
+ |
2312 |
++static int cbq_opt_parse(struct nlattr *tb[TCA_CBQ_MAX + 1], struct nlattr *opt) |
2313 |
++{ |
2314 |
++ int err; |
2315 |
++ |
2316 |
++ if (!opt) |
2317 |
++ return -EINVAL; |
2318 |
++ |
2319 |
++ err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL); |
2320 |
++ if (err < 0) |
2321 |
++ return err; |
2322 |
++ |
2323 |
++ if (tb[TCA_CBQ_WRROPT]) { |
2324 |
++ const struct tc_cbq_wrropt *wrr = nla_data(tb[TCA_CBQ_WRROPT]); |
2325 |
++ |
2326 |
++ if (wrr->priority > TC_CBQ_MAXPRIO) |
2327 |
++ err = -EINVAL; |
2328 |
++ } |
2329 |
++ return err; |
2330 |
++} |
2331 |
++ |
2332 |
+ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) |
2333 |
+ { |
2334 |
+ struct cbq_sched_data *q = qdisc_priv(sch); |
2335 |
+@@ -1142,10 +1162,7 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) |
2336 |
+ hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED); |
2337 |
+ q->delay_timer.function = cbq_undelay; |
2338 |
+ |
2339 |
+- if (!opt) |
2340 |
+- return -EINVAL; |
2341 |
+- |
2342 |
+- err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL); |
2343 |
++ err = cbq_opt_parse(tb, opt); |
2344 |
+ if (err < 0) |
2345 |
+ return err; |
2346 |
+ |
2347 |
+@@ -1459,10 +1476,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t |
2348 |
+ struct cbq_class *parent; |
2349 |
+ struct qdisc_rate_table *rtab = NULL; |
2350 |
+ |
2351 |
+- if (opt == NULL) |
2352 |
+- return -EINVAL; |
2353 |
+- |
2354 |
+- err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL); |
2355 |
++ err = cbq_opt_parse(tb, opt); |
2356 |
+ if (err < 0) |
2357 |
+ return err; |
2358 |
+ |
2359 |
+diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c |
2360 |
+index 2836c80c7aa5..b507a72d5813 100644 |
2361 |
+--- a/net/sched/sch_dsmark.c |
2362 |
++++ b/net/sched/sch_dsmark.c |
2363 |
+@@ -353,6 +353,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt) |
2364 |
+ goto errout; |
2365 |
+ |
2366 |
+ err = -EINVAL; |
2367 |
++ if (!tb[TCA_DSMARK_INDICES]) |
2368 |
++ goto errout; |
2369 |
+ indices = nla_get_u16(tb[TCA_DSMARK_INDICES]); |
2370 |
+ |
2371 |
+ if (hweight32(indices) != 1) |
2372 |
+diff --git a/net/tipc/link.c b/net/tipc/link.c |
2373 |
+index ac0144f532aa..631bfc7e9127 100644 |
2374 |
+--- a/net/tipc/link.c |
2375 |
++++ b/net/tipc/link.c |
2376 |
+@@ -157,6 +157,7 @@ struct tipc_link { |
2377 |
+ struct { |
2378 |
+ u16 len; |
2379 |
+ u16 limit; |
2380 |
++ struct sk_buff *target_bskb; |
2381 |
+ } backlog[5]; |
2382 |
+ u16 snd_nxt; |
2383 |
+ u16 last_retransm; |
2384 |
+@@ -826,6 +827,8 @@ void link_prepare_wakeup(struct tipc_link *l) |
2385 |
+ |
2386 |
+ void tipc_link_reset(struct tipc_link *l) |
2387 |
+ { |
2388 |
++ u32 imp; |
2389 |
++ |
2390 |
+ l->peer_session = ANY_SESSION; |
2391 |
+ l->session++; |
2392 |
+ l->mtu = l->advertised_mtu; |
2393 |
+@@ -833,11 +836,10 @@ void tipc_link_reset(struct tipc_link *l) |
2394 |
+ __skb_queue_purge(&l->deferdq); |
2395 |
+ skb_queue_splice_init(&l->wakeupq, l->inputq); |
2396 |
+ __skb_queue_purge(&l->backlogq); |
2397 |
+- l->backlog[TIPC_LOW_IMPORTANCE].len = 0; |
2398 |
+- l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0; |
2399 |
+- l->backlog[TIPC_HIGH_IMPORTANCE].len = 0; |
2400 |
+- l->backlog[TIPC_CRITICAL_IMPORTANCE].len = 0; |
2401 |
+- l->backlog[TIPC_SYSTEM_IMPORTANCE].len = 0; |
2402 |
++ for (imp = 0; imp <= TIPC_SYSTEM_IMPORTANCE; imp++) { |
2403 |
++ l->backlog[imp].len = 0; |
2404 |
++ l->backlog[imp].target_bskb = NULL; |
2405 |
++ } |
2406 |
+ kfree_skb(l->reasm_buf); |
2407 |
+ kfree_skb(l->failover_reasm_skb); |
2408 |
+ l->reasm_buf = NULL; |
2409 |
+@@ -876,7 +878,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, |
2410 |
+ u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; |
2411 |
+ struct sk_buff_head *transmq = &l->transmq; |
2412 |
+ struct sk_buff_head *backlogq = &l->backlogq; |
2413 |
+- struct sk_buff *skb, *_skb, *bskb; |
2414 |
++ struct sk_buff *skb, *_skb, **tskb; |
2415 |
+ int pkt_cnt = skb_queue_len(list); |
2416 |
+ int rc = 0; |
2417 |
+ |
2418 |
+@@ -922,19 +924,21 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, |
2419 |
+ seqno++; |
2420 |
+ continue; |
2421 |
+ } |
2422 |
+- if (tipc_msg_bundle(skb_peek_tail(backlogq), hdr, mtu)) { |
2423 |
++ tskb = &l->backlog[imp].target_bskb; |
2424 |
++ if (tipc_msg_bundle(*tskb, hdr, mtu)) { |
2425 |
+ kfree_skb(__skb_dequeue(list)); |
2426 |
+ l->stats.sent_bundled++; |
2427 |
+ continue; |
2428 |
+ } |
2429 |
+- if (tipc_msg_make_bundle(&bskb, hdr, mtu, l->addr)) { |
2430 |
++ if (tipc_msg_make_bundle(tskb, hdr, mtu, l->addr)) { |
2431 |
+ kfree_skb(__skb_dequeue(list)); |
2432 |
+- __skb_queue_tail(backlogq, bskb); |
2433 |
+- l->backlog[msg_importance(buf_msg(bskb))].len++; |
2434 |
++ __skb_queue_tail(backlogq, *tskb); |
2435 |
++ l->backlog[imp].len++; |
2436 |
+ l->stats.sent_bundled++; |
2437 |
+ l->stats.sent_bundles++; |
2438 |
+ continue; |
2439 |
+ } |
2440 |
++ l->backlog[imp].target_bskb = NULL; |
2441 |
+ l->backlog[imp].len += skb_queue_len(list); |
2442 |
+ skb_queue_splice_tail_init(list, backlogq); |
2443 |
+ } |
2444 |
+@@ -949,6 +953,7 @@ void tipc_link_advance_backlog(struct tipc_link *l, struct sk_buff_head *xmitq) |
2445 |
+ u16 seqno = l->snd_nxt; |
2446 |
+ u16 ack = l->rcv_nxt - 1; |
2447 |
+ u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; |
2448 |
++ u32 imp; |
2449 |
+ |
2450 |
+ while (skb_queue_len(&l->transmq) < l->window) { |
2451 |
+ skb = skb_peek(&l->backlogq); |
2452 |
+@@ -959,7 +964,10 @@ void tipc_link_advance_backlog(struct tipc_link *l, struct sk_buff_head *xmitq) |
2453 |
+ break; |
2454 |
+ __skb_dequeue(&l->backlogq); |
2455 |
+ hdr = buf_msg(skb); |
2456 |
+- l->backlog[msg_importance(hdr)].len--; |
2457 |
++ imp = msg_importance(hdr); |
2458 |
++ l->backlog[imp].len--; |
2459 |
++ if (unlikely(skb == l->backlog[imp].target_bskb)) |
2460 |
++ l->backlog[imp].target_bskb = NULL; |
2461 |
+ __skb_queue_tail(&l->transmq, skb); |
2462 |
+ __skb_queue_tail(xmitq, _skb); |
2463 |
+ TIPC_SKB_CB(skb)->ackers = l->ackers; |
2464 |
+diff --git a/net/tipc/msg.c b/net/tipc/msg.c |
2465 |
+index 17146c16ee2d..e38396025874 100644 |
2466 |
+--- a/net/tipc/msg.c |
2467 |
++++ b/net/tipc/msg.c |
2468 |
+@@ -456,10 +456,7 @@ bool tipc_msg_make_bundle(struct sk_buff **skb, struct tipc_msg *msg, |
2469 |
+ bmsg = buf_msg(_skb); |
2470 |
+ tipc_msg_init(msg_prevnode(msg), bmsg, MSG_BUNDLER, 0, |
2471 |
+ INT_H_SIZE, dnode); |
2472 |
+- if (msg_isdata(msg)) |
2473 |
+- msg_set_importance(bmsg, TIPC_CRITICAL_IMPORTANCE); |
2474 |
+- else |
2475 |
+- msg_set_importance(bmsg, TIPC_SYSTEM_IMPORTANCE); |
2476 |
++ msg_set_importance(bmsg, msg_importance(msg)); |
2477 |
+ msg_set_seqno(bmsg, msg_seqno(msg)); |
2478 |
+ msg_set_ack(bmsg, msg_ack(msg)); |
2479 |
+ msg_set_bcast_ack(bmsg, msg_bcast_ack(msg)); |
2480 |
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c |
2481 |
+index b41170417316..148c949cdfe7 100644 |
2482 |
+--- a/net/vmw_vsock/af_vsock.c |
2483 |
++++ b/net/vmw_vsock/af_vsock.c |
2484 |
+@@ -648,7 +648,7 @@ struct sock *__vsock_create(struct net *net, |
2485 |
+ } |
2486 |
+ EXPORT_SYMBOL_GPL(__vsock_create); |
2487 |
+ |
2488 |
+-static void __vsock_release(struct sock *sk) |
2489 |
++static void __vsock_release(struct sock *sk, int level) |
2490 |
+ { |
2491 |
+ if (sk) { |
2492 |
+ struct sk_buff *skb; |
2493 |
+@@ -658,9 +658,17 @@ static void __vsock_release(struct sock *sk) |
2494 |
+ vsk = vsock_sk(sk); |
2495 |
+ pending = NULL; /* Compiler warning. */ |
2496 |
+ |
2497 |
++ /* The release call is supposed to use lock_sock_nested() |
2498 |
++ * rather than lock_sock(), if a sock lock should be acquired. |
2499 |
++ */ |
2500 |
+ transport->release(vsk); |
2501 |
+ |
2502 |
+- lock_sock(sk); |
2503 |
++ /* When "level" is SINGLE_DEPTH_NESTING, use the nested |
2504 |
++ * version to avoid the warning "possible recursive locking |
2505 |
++ * detected". When "level" is 0, lock_sock_nested(sk, level) |
2506 |
++ * is the same as lock_sock(sk). |
2507 |
++ */ |
2508 |
++ lock_sock_nested(sk, level); |
2509 |
+ sock_orphan(sk); |
2510 |
+ sk->sk_shutdown = SHUTDOWN_MASK; |
2511 |
+ |
2512 |
+@@ -669,7 +677,7 @@ static void __vsock_release(struct sock *sk) |
2513 |
+ |
2514 |
+ /* Clean up any sockets that never were accepted. */ |
2515 |
+ while ((pending = vsock_dequeue_accept(sk)) != NULL) { |
2516 |
+- __vsock_release(pending); |
2517 |
++ __vsock_release(pending, SINGLE_DEPTH_NESTING); |
2518 |
+ sock_put(pending); |
2519 |
+ } |
2520 |
+ |
2521 |
+@@ -718,7 +726,7 @@ EXPORT_SYMBOL_GPL(vsock_stream_has_space); |
2522 |
+ |
2523 |
+ static int vsock_release(struct socket *sock) |
2524 |
+ { |
2525 |
+- __vsock_release(sock->sk); |
2526 |
++ __vsock_release(sock->sk, 0); |
2527 |
+ sock->sk = NULL; |
2528 |
+ sock->state = SS_FREE; |
2529 |
+ |
2530 |
+diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c |
2531 |
+index ec72a5edaa1b..6614512f8180 100644 |
2532 |
+--- a/net/vmw_vsock/hyperv_transport.c |
2533 |
++++ b/net/vmw_vsock/hyperv_transport.c |
2534 |
+@@ -539,7 +539,7 @@ static void hvs_release(struct vsock_sock *vsk) |
2535 |
+ struct sock *sk = sk_vsock(vsk); |
2536 |
+ bool remove_sock; |
2537 |
+ |
2538 |
+- lock_sock(sk); |
2539 |
++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
2540 |
+ remove_sock = hvs_close_lock_held(vsk); |
2541 |
+ release_sock(sk); |
2542 |
+ if (remove_sock) |
2543 |
+diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c |
2544 |
+index f3f3d06cb6d8..a8eb0657c1e8 100644 |
2545 |
+--- a/net/vmw_vsock/virtio_transport_common.c |
2546 |
++++ b/net/vmw_vsock/virtio_transport_common.c |
2547 |
+@@ -791,7 +791,7 @@ void virtio_transport_release(struct vsock_sock *vsk) |
2548 |
+ struct sock *sk = &vsk->sk; |
2549 |
+ bool remove_sock = true; |
2550 |
+ |
2551 |
+- lock_sock(sk); |
2552 |
++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
2553 |
+ if (sk->sk_type == SOCK_STREAM) |
2554 |
+ remove_sock = virtio_transport_close(vsk); |
2555 |
+ |
2556 |
+diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c |
2557 |
+index 1a3004189447..a9c20821a726 100644 |
2558 |
+--- a/security/smack/smack_access.c |
2559 |
++++ b/security/smack/smack_access.c |
2560 |
+@@ -469,7 +469,7 @@ char *smk_parse_smack(const char *string, int len) |
2561 |
+ if (i == 0 || i >= SMK_LONGLABEL) |
2562 |
+ return ERR_PTR(-EINVAL); |
2563 |
+ |
2564 |
+- smack = kzalloc(i + 1, GFP_KERNEL); |
2565 |
++ smack = kzalloc(i + 1, GFP_NOFS); |
2566 |
+ if (smack == NULL) |
2567 |
+ return ERR_PTR(-ENOMEM); |
2568 |
+ |
2569 |
+@@ -504,7 +504,7 @@ int smk_netlbl_mls(int level, char *catset, struct netlbl_lsm_secattr *sap, |
2570 |
+ if ((m & *cp) == 0) |
2571 |
+ continue; |
2572 |
+ rc = netlbl_catmap_setbit(&sap->attr.mls.cat, |
2573 |
+- cat, GFP_KERNEL); |
2574 |
++ cat, GFP_NOFS); |
2575 |
+ if (rc < 0) { |
2576 |
+ netlbl_catmap_free(sap->attr.mls.cat); |
2577 |
+ return rc; |
2578 |
+@@ -540,7 +540,7 @@ struct smack_known *smk_import_entry(const char *string, int len) |
2579 |
+ if (skp != NULL) |
2580 |
+ goto freeout; |
2581 |
+ |
2582 |
+- skp = kzalloc(sizeof(*skp), GFP_KERNEL); |
2583 |
++ skp = kzalloc(sizeof(*skp), GFP_NOFS); |
2584 |
+ if (skp == NULL) { |
2585 |
+ skp = ERR_PTR(-ENOMEM); |
2586 |
+ goto freeout; |
2587 |
+diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
2588 |
+index 0d5ce7190b17..a0e1b99212b2 100644 |
2589 |
+--- a/security/smack/smack_lsm.c |
2590 |
++++ b/security/smack/smack_lsm.c |
2591 |
+@@ -269,7 +269,7 @@ static struct smack_known *smk_fetch(const char *name, struct inode *ip, |
2592 |
+ if (!(ip->i_opflags & IOP_XATTR)) |
2593 |
+ return ERR_PTR(-EOPNOTSUPP); |
2594 |
+ |
2595 |
+- buffer = kzalloc(SMK_LONGLABEL, GFP_KERNEL); |
2596 |
++ buffer = kzalloc(SMK_LONGLABEL, GFP_NOFS); |
2597 |
+ if (buffer == NULL) |
2598 |
+ return ERR_PTR(-ENOMEM); |
2599 |
+ |
2600 |
+@@ -944,7 +944,8 @@ static int smack_bprm_set_creds(struct linux_binprm *bprm) |
2601 |
+ |
2602 |
+ if (rc != 0) |
2603 |
+ return rc; |
2604 |
+- } else if (bprm->unsafe) |
2605 |
++ } |
2606 |
++ if (bprm->unsafe & ~LSM_UNSAFE_PTRACE) |
2607 |
+ return -EPERM; |
2608 |
+ |
2609 |
+ bsp->smk_task = isp->smk_task; |
2610 |
+@@ -4031,6 +4032,8 @@ access_check: |
2611 |
+ skp = smack_ipv6host_label(&sadd); |
2612 |
+ if (skp == NULL) |
2613 |
+ skp = smack_net_ambient; |
2614 |
++ if (skb == NULL) |
2615 |
++ break; |
2616 |
+ #ifdef CONFIG_AUDIT |
2617 |
+ smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
2618 |
+ ad.a.u.net->family = family; |
2619 |
+diff --git a/usr/Makefile b/usr/Makefile |
2620 |
+index 237a028693ce..5f1bc5b23b14 100644 |
2621 |
+--- a/usr/Makefile |
2622 |
++++ b/usr/Makefile |
2623 |
+@@ -11,6 +11,9 @@ datafile_y = initramfs_data.cpio$(suffix_y) |
2624 |
+ datafile_d_y = .$(datafile_y).d |
2625 |
+ AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" |
2626 |
+ |
2627 |
++# clean rules do not have CONFIG_INITRAMFS_COMPRESSION. So clean up after all |
2628 |
++# possible compression formats. |
2629 |
++clean-files += initramfs_data.cpio* |
2630 |
+ |
2631 |
+ # Generate builtin.o based on initramfs_data.o |
2632 |
+ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o |