Annotation of /trunk/kernel-alx/patches-4.9/0226-4.9.127-all-fixes.patch
Parent Directory | Revision Log
Revision 3226 -
(hide annotations)
(download)
Tue Sep 18 11:27:43 2018 UTC (6 years ago) by niro
File size: 64670 byte(s)
Tue Sep 18 11:27:43 2018 UTC (6 years ago) by niro
File size: 64670 byte(s)
-linux-4.9.127
1 | niro | 3226 | diff --git a/Makefile b/Makefile |
2 | index b26481fef3f0..4e37716ae395 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 9 | ||
8 | -SUBLEVEL = 126 | ||
9 | +SUBLEVEL = 127 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Roaring Lionus | ||
12 | |||
13 | diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig | ||
14 | index 6b7d4f535984..8ec4dbbb50b0 100644 | ||
15 | --- a/arch/arm/configs/imx_v6_v7_defconfig | ||
16 | +++ b/arch/arm/configs/imx_v6_v7_defconfig | ||
17 | @@ -271,7 +271,6 @@ CONFIG_USB_STORAGE=y | ||
18 | CONFIG_USB_CHIPIDEA=y | ||
19 | CONFIG_USB_CHIPIDEA_UDC=y | ||
20 | CONFIG_USB_CHIPIDEA_HOST=y | ||
21 | -CONFIG_USB_CHIPIDEA_ULPI=y | ||
22 | CONFIG_USB_SERIAL=m | ||
23 | CONFIG_USB_SERIAL_GENERIC=y | ||
24 | CONFIG_USB_SERIAL_FTDI_SIO=m | ||
25 | @@ -308,7 +307,6 @@ CONFIG_USB_GADGETFS=m | ||
26 | CONFIG_USB_FUNCTIONFS=m | ||
27 | CONFIG_USB_MASS_STORAGE=m | ||
28 | CONFIG_USB_G_SERIAL=m | ||
29 | -CONFIG_USB_ULPI_BUS=y | ||
30 | CONFIG_MMC=y | ||
31 | CONFIG_MMC_SDHCI=y | ||
32 | CONFIG_MMC_SDHCI_PLTFM=y | ||
33 | diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig | ||
34 | index 9ad84cd01ba0..5ed8fa5a9825 100644 | ||
35 | --- a/arch/arm/mach-rockchip/Kconfig | ||
36 | +++ b/arch/arm/mach-rockchip/Kconfig | ||
37 | @@ -16,6 +16,7 @@ config ARCH_ROCKCHIP | ||
38 | select ROCKCHIP_TIMER | ||
39 | select ARM_GLOBAL_TIMER | ||
40 | select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK | ||
41 | + select PM | ||
42 | help | ||
43 | Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs | ||
44 | containing the RK2928, RK30xx and RK31xx series. | ||
45 | diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms | ||
46 | index 08a4497f70a6..3428a4ba2ccd 100644 | ||
47 | --- a/arch/arm64/Kconfig.platforms | ||
48 | +++ b/arch/arm64/Kconfig.platforms | ||
49 | @@ -125,6 +125,7 @@ config ARCH_ROCKCHIP | ||
50 | select GPIOLIB | ||
51 | select PINCTRL | ||
52 | select PINCTRL_ROCKCHIP | ||
53 | + select PM | ||
54 | select ROCKCHIP_TIMER | ||
55 | help | ||
56 | This enables support for the ARMv8 based Rockchip chipsets, | ||
57 | diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h | ||
58 | index f5588692f1d4..877d4789dcb3 100644 | ||
59 | --- a/arch/arm64/include/asm/cachetype.h | ||
60 | +++ b/arch/arm64/include/asm/cachetype.h | ||
61 | @@ -22,6 +22,11 @@ | ||
62 | #define CTR_L1IP_MASK 3 | ||
63 | #define CTR_CWG_SHIFT 24 | ||
64 | #define CTR_CWG_MASK 15 | ||
65 | +#define CTR_DMINLINE_SHIFT 16 | ||
66 | +#define CTR_IMINLINE_SHIFT 0 | ||
67 | + | ||
68 | +#define CTR_CACHE_MINLINE_MASK \ | ||
69 | + ((0xf << CTR_DMINLINE_SHIFT) | (0xf << CTR_IMINLINE_SHIFT)) | ||
70 | |||
71 | #define ICACHE_POLICY_RESERVED 0 | ||
72 | #define ICACHE_POLICY_AIVIVT 1 | ||
73 | diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h | ||
74 | index 7010779a1429..8c7c4b23a8b1 100644 | ||
75 | --- a/arch/arm64/include/asm/cpucaps.h | ||
76 | +++ b/arch/arm64/include/asm/cpucaps.h | ||
77 | @@ -37,7 +37,8 @@ | ||
78 | #define ARM64_UNMAP_KERNEL_AT_EL0 16 | ||
79 | #define ARM64_HARDEN_BRANCH_PREDICTOR 17 | ||
80 | #define ARM64_SSBD 18 | ||
81 | +#define ARM64_MISMATCHED_CACHE_TYPE 19 | ||
82 | |||
83 | -#define ARM64_NCAPS 19 | ||
84 | +#define ARM64_NCAPS 20 | ||
85 | |||
86 | #endif /* __ASM_CPUCAPS_H */ | ||
87 | diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c | ||
88 | index 1db97ad7b58b..930e74d9fcbd 100644 | ||
89 | --- a/arch/arm64/kernel/cpu_errata.c | ||
90 | +++ b/arch/arm64/kernel/cpu_errata.c | ||
91 | @@ -17,6 +17,7 @@ | ||
92 | */ | ||
93 | |||
94 | #include <linux/types.h> | ||
95 | +#include <asm/cachetype.h> | ||
96 | #include <asm/cpu.h> | ||
97 | #include <asm/cputype.h> | ||
98 | #include <asm/cpufeature.h> | ||
99 | @@ -31,12 +32,18 @@ is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) | ||
100 | } | ||
101 | |||
102 | static bool | ||
103 | -has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry, | ||
104 | - int scope) | ||
105 | +has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry, | ||
106 | + int scope) | ||
107 | { | ||
108 | + u64 mask = CTR_CACHE_MINLINE_MASK; | ||
109 | + | ||
110 | + /* Skip matching the min line sizes for cache type check */ | ||
111 | + if (entry->capability == ARM64_MISMATCHED_CACHE_TYPE) | ||
112 | + mask ^= arm64_ftr_reg_ctrel0.strict_mask; | ||
113 | + | ||
114 | WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); | ||
115 | - return (read_cpuid_cachetype() & arm64_ftr_reg_ctrel0.strict_mask) != | ||
116 | - (arm64_ftr_reg_ctrel0.sys_val & arm64_ftr_reg_ctrel0.strict_mask); | ||
117 | + return (read_cpuid_cachetype() & mask) != | ||
118 | + (arm64_ftr_reg_ctrel0.sys_val & mask); | ||
119 | } | ||
120 | |||
121 | static int cpu_enable_trap_ctr_access(void *__unused) | ||
122 | @@ -446,7 +453,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { | ||
123 | { | ||
124 | .desc = "Mismatched cache line size", | ||
125 | .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE, | ||
126 | - .matches = has_mismatched_cache_line_size, | ||
127 | + .matches = has_mismatched_cache_type, | ||
128 | + .def_scope = SCOPE_LOCAL_CPU, | ||
129 | + .enable = cpu_enable_trap_ctr_access, | ||
130 | + }, | ||
131 | + { | ||
132 | + .desc = "Mismatched cache type", | ||
133 | + .capability = ARM64_MISMATCHED_CACHE_TYPE, | ||
134 | + .matches = has_mismatched_cache_type, | ||
135 | .def_scope = SCOPE_LOCAL_CPU, | ||
136 | .enable = cpu_enable_trap_ctr_access, | ||
137 | }, | ||
138 | diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c | ||
139 | index ab15747a49d4..a3ab7dfad50a 100644 | ||
140 | --- a/arch/arm64/kernel/cpufeature.c | ||
141 | +++ b/arch/arm64/kernel/cpufeature.c | ||
142 | @@ -152,7 +152,7 @@ static const struct arm64_ftr_bits ftr_ctr[] = { | ||
143 | ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 28, 3, 0), | ||
144 | ARM64_FTR_BITS(FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */ | ||
145 | ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */ | ||
146 | - ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */ | ||
147 | + ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, CTR_DMINLINE_SHIFT, 4, 1), | ||
148 | /* | ||
149 | * Linux can handle differing I-cache policies. Userspace JITs will | ||
150 | * make use of *minLine. | ||
151 | @@ -160,7 +160,7 @@ static const struct arm64_ftr_bits ftr_ctr[] = { | ||
152 | */ | ||
153 | ARM64_FTR_BITS(FTR_NONSTRICT, FTR_EXACT, 14, 2, ICACHE_POLICY_AIVIVT), /* L1Ip */ | ||
154 | ARM64_FTR_BITS(FTR_STRICT, FTR_EXACT, 4, 10, 0), /* RAZ */ | ||
155 | - ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, 0, 4, 0), /* IminLine */ | ||
156 | + ARM64_FTR_BITS(FTR_STRICT, FTR_LOWER_SAFE, CTR_IMINLINE_SHIFT, 4, 0), | ||
157 | ARM64_FTR_END, | ||
158 | }; | ||
159 | |||
160 | diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c | ||
161 | index 34989ce43147..8799d8a83d56 100644 | ||
162 | --- a/arch/powerpc/platforms/pseries/ras.c | ||
163 | +++ b/arch/powerpc/platforms/pseries/ras.c | ||
164 | @@ -357,7 +357,7 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs) | ||
165 | int len, error_log_length; | ||
166 | |||
167 | error_log_length = 8 + rtas_error_extended_log_length(h); | ||
168 | - len = max_t(int, error_log_length, RTAS_ERROR_LOG_MAX); | ||
169 | + len = min_t(int, error_log_length, RTAS_ERROR_LOG_MAX); | ||
170 | memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX); | ||
171 | memcpy(global_mce_data_buf, h, len); | ||
172 | errhdr = (struct rtas_error_log *)global_mce_data_buf; | ||
173 | diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c | ||
174 | index db2286be5d9a..47fb336741d4 100644 | ||
175 | --- a/arch/powerpc/sysdev/mpic_msgr.c | ||
176 | +++ b/arch/powerpc/sysdev/mpic_msgr.c | ||
177 | @@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platform_device *dev) | ||
178 | |||
179 | /* IO map the message register block. */ | ||
180 | of_address_to_resource(np, 0, &rsrc); | ||
181 | - msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start); | ||
182 | + msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc)); | ||
183 | if (!msgr_block_addr) { | ||
184 | dev_err(&dev->dev, "Failed to iomap MPIC message registers"); | ||
185 | return -EFAULT; | ||
186 | diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c | ||
187 | index 598254461fb7..167135294ca5 100644 | ||
188 | --- a/arch/s390/kernel/crash_dump.c | ||
189 | +++ b/arch/s390/kernel/crash_dump.c | ||
190 | @@ -401,11 +401,13 @@ static void *get_vmcoreinfo_old(unsigned long *size) | ||
191 | if (copy_oldmem_kernel(nt_name, addr + sizeof(note), | ||
192 | sizeof(nt_name) - 1)) | ||
193 | return NULL; | ||
194 | - if (strcmp(nt_name, "VMCOREINFO") != 0) | ||
195 | + if (strcmp(nt_name, VMCOREINFO_NOTE_NAME) != 0) | ||
196 | return NULL; | ||
197 | vmcoreinfo = kzalloc_panic(note.n_descsz); | ||
198 | - if (copy_oldmem_kernel(vmcoreinfo, addr + 24, note.n_descsz)) | ||
199 | + if (copy_oldmem_kernel(vmcoreinfo, addr + 24, note.n_descsz)) { | ||
200 | + kfree(vmcoreinfo); | ||
201 | return NULL; | ||
202 | + } | ||
203 | *size = note.n_descsz; | ||
204 | return vmcoreinfo; | ||
205 | } | ||
206 | @@ -415,15 +417,20 @@ static void *get_vmcoreinfo_old(unsigned long *size) | ||
207 | */ | ||
208 | static void *nt_vmcoreinfo(void *ptr) | ||
209 | { | ||
210 | + const char *name = VMCOREINFO_NOTE_NAME; | ||
211 | unsigned long size; | ||
212 | void *vmcoreinfo; | ||
213 | |||
214 | vmcoreinfo = os_info_old_entry(OS_INFO_VMCOREINFO, &size); | ||
215 | - if (!vmcoreinfo) | ||
216 | - vmcoreinfo = get_vmcoreinfo_old(&size); | ||
217 | + if (vmcoreinfo) | ||
218 | + return nt_init_name(ptr, 0, vmcoreinfo, size, name); | ||
219 | + | ||
220 | + vmcoreinfo = get_vmcoreinfo_old(&size); | ||
221 | if (!vmcoreinfo) | ||
222 | return ptr; | ||
223 | - return nt_init_name(ptr, 0, vmcoreinfo, size, "VMCOREINFO"); | ||
224 | + ptr = nt_init_name(ptr, 0, vmcoreinfo, size, name); | ||
225 | + kfree(vmcoreinfo); | ||
226 | + return ptr; | ||
227 | } | ||
228 | |||
229 | /* | ||
230 | diff --git a/arch/s390/lib/mem.S b/arch/s390/lib/mem.S | ||
231 | index e7672edc284a..5ff0520784f2 100644 | ||
232 | --- a/arch/s390/lib/mem.S | ||
233 | +++ b/arch/s390/lib/mem.S | ||
234 | @@ -27,7 +27,7 @@ | ||
235 | */ | ||
236 | ENTRY(memset) | ||
237 | ltgr %r4,%r4 | ||
238 | - bzr %r14 | ||
239 | + jz .Lmemset_exit | ||
240 | ltgr %r3,%r3 | ||
241 | jnz .Lmemset_fill | ||
242 | aghi %r4,-1 | ||
243 | @@ -42,12 +42,13 @@ ENTRY(memset) | ||
244 | .Lmemset_clear_rest: | ||
245 | larl %r3,.Lmemset_xc | ||
246 | ex %r4,0(%r3) | ||
247 | +.Lmemset_exit: | ||
248 | BR_EX %r14 | ||
249 | .Lmemset_fill: | ||
250 | stc %r3,0(%r2) | ||
251 | cghi %r4,1 | ||
252 | lgr %r1,%r2 | ||
253 | - ber %r14 | ||
254 | + je .Lmemset_fill_exit | ||
255 | aghi %r4,-2 | ||
256 | srlg %r3,%r4,8 | ||
257 | ltgr %r3,%r3 | ||
258 | @@ -59,6 +60,7 @@ ENTRY(memset) | ||
259 | .Lmemset_fill_rest: | ||
260 | larl %r3,.Lmemset_mvc | ||
261 | ex %r4,0(%r3) | ||
262 | +.Lmemset_fill_exit: | ||
263 | BR_EX %r14 | ||
264 | .Lmemset_xc: | ||
265 | xc 0(1,%r1),0(%r1) | ||
266 | @@ -73,7 +75,7 @@ EXPORT_SYMBOL(memset) | ||
267 | */ | ||
268 | ENTRY(memcpy) | ||
269 | ltgr %r4,%r4 | ||
270 | - bzr %r14 | ||
271 | + jz .Lmemcpy_exit | ||
272 | aghi %r4,-1 | ||
273 | srlg %r5,%r4,8 | ||
274 | ltgr %r5,%r5 | ||
275 | @@ -82,6 +84,7 @@ ENTRY(memcpy) | ||
276 | .Lmemcpy_rest: | ||
277 | larl %r5,.Lmemcpy_mvc | ||
278 | ex %r4,0(%r5) | ||
279 | +.Lmemcpy_exit: | ||
280 | BR_EX %r14 | ||
281 | .Lmemcpy_loop: | ||
282 | mvc 0(256,%r1),0(%r3) | ||
283 | diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h | ||
284 | index 5c686382d84b..095dbc25122a 100644 | ||
285 | --- a/arch/x86/include/asm/pgtable-3level.h | ||
286 | +++ b/arch/x86/include/asm/pgtable-3level.h | ||
287 | @@ -1,6 +1,8 @@ | ||
288 | #ifndef _ASM_X86_PGTABLE_3LEVEL_H | ||
289 | #define _ASM_X86_PGTABLE_3LEVEL_H | ||
290 | |||
291 | +#include <asm/atomic64_32.h> | ||
292 | + | ||
293 | /* | ||
294 | * Intel Physical Address Extension (PAE) Mode - three-level page | ||
295 | * tables on PPro+ CPUs. | ||
296 | @@ -142,10 +144,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *ptep) | ||
297 | { | ||
298 | pte_t res; | ||
299 | |||
300 | - /* xchg acts as a barrier before the setting of the high bits */ | ||
301 | - res.pte_low = xchg(&ptep->pte_low, 0); | ||
302 | - res.pte_high = ptep->pte_high; | ||
303 | - ptep->pte_high = 0; | ||
304 | + res.pte = (pteval_t)atomic64_xchg((atomic64_t *)ptep, 0); | ||
305 | |||
306 | return res; | ||
307 | } | ||
308 | diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h | ||
309 | index c535012bdb56..5736306bdaab 100644 | ||
310 | --- a/arch/x86/include/asm/pgtable.h | ||
311 | +++ b/arch/x86/include/asm/pgtable.h | ||
312 | @@ -420,7 +420,7 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) | ||
313 | |||
314 | static inline pud_t pfn_pud(unsigned long page_nr, pgprot_t pgprot) | ||
315 | { | ||
316 | - phys_addr_t pfn = page_nr << PAGE_SHIFT; | ||
317 | + phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT; | ||
318 | pfn ^= protnone_mask(pgprot_val(pgprot)); | ||
319 | pfn &= PHYSICAL_PUD_PAGE_MASK; | ||
320 | return __pud(pfn | massage_pgprot(pgprot)); | ||
321 | diff --git a/block/bio.c b/block/bio.c | ||
322 | index 4f93345c6a82..68972e3d3f5c 100644 | ||
323 | --- a/block/bio.c | ||
324 | +++ b/block/bio.c | ||
325 | @@ -155,7 +155,7 @@ out: | ||
326 | |||
327 | unsigned int bvec_nr_vecs(unsigned short idx) | ||
328 | { | ||
329 | - return bvec_slabs[idx].nr_vecs; | ||
330 | + return bvec_slabs[--idx].nr_vecs; | ||
331 | } | ||
332 | |||
333 | void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned int idx) | ||
334 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
335 | index 145dcf293c6f..0792ec5a9efc 100644 | ||
336 | --- a/drivers/acpi/scan.c | ||
337 | +++ b/drivers/acpi/scan.c | ||
338 | @@ -1453,7 +1453,8 @@ static int acpi_add_single_object(struct acpi_device **child, | ||
339 | * Note this must be done before the get power-/wakeup_dev-flags calls. | ||
340 | */ | ||
341 | if (type == ACPI_BUS_TYPE_DEVICE) | ||
342 | - acpi_bus_get_status(device); | ||
343 | + if (acpi_bus_get_status(device) < 0) | ||
344 | + acpi_set_device_status(device, 0); | ||
345 | |||
346 | acpi_bus_get_power_flags(device); | ||
347 | acpi_bus_get_wakeup_device_flags(device); | ||
348 | @@ -1531,7 +1532,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | ||
349 | * acpi_add_single_object updates this once we've an acpi_device | ||
350 | * so that acpi_bus_get_status' quirk handling can be used. | ||
351 | */ | ||
352 | - *sta = 0; | ||
353 | + *sta = ACPI_STA_DEFAULT; | ||
354 | break; | ||
355 | case ACPI_TYPE_PROCESSOR: | ||
356 | *type = ACPI_BUS_TYPE_PROCESSOR; | ||
357 | diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c | ||
358 | index 05671c03efe2..410998800af5 100644 | ||
359 | --- a/drivers/clk/rockchip/clk-rk3399.c | ||
360 | +++ b/drivers/clk/rockchip/clk-rk3399.c | ||
361 | @@ -1521,6 +1521,7 @@ static const char *const rk3399_pmucru_critical_clocks[] __initconst = { | ||
362 | "pclk_pmu_src", | ||
363 | "fclk_cm0s_src_pmu", | ||
364 | "clk_timer_src_pmu", | ||
365 | + "pclk_rkpwm_pmu", | ||
366 | }; | ||
367 | |||
368 | static void __init rk3399_clk_init(struct device_node *np) | ||
369 | diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c | ||
370 | index 6b31e0474271..37ba5f51378e 100644 | ||
371 | --- a/drivers/gpu/drm/drm_edid.c | ||
372 | +++ b/drivers/gpu/drm/drm_edid.c | ||
373 | @@ -110,6 +110,9 @@ static const struct edid_quirk { | ||
374 | /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */ | ||
375 | { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC }, | ||
376 | |||
377 | + /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */ | ||
378 | + { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC }, | ||
379 | + | ||
380 | /* Belinea 10 15 55 */ | ||
381 | { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 }, | ||
382 | { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 }, | ||
383 | diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c | ||
384 | index 05db7d59812a..da61ce82c3d9 100644 | ||
385 | --- a/drivers/infiniband/hw/hns/hns_roce_pd.c | ||
386 | +++ b/drivers/infiniband/hw/hns/hns_roce_pd.c | ||
387 | @@ -35,7 +35,7 @@ | ||
388 | |||
389 | static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn) | ||
390 | { | ||
391 | - return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn); | ||
392 | + return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn) ? -ENOMEM : 0; | ||
393 | } | ||
394 | |||
395 | static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn) | ||
396 | diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c | ||
397 | index e86dd8d06777..33cf1035030b 100644 | ||
398 | --- a/drivers/infiniband/hw/hns/hns_roce_qp.c | ||
399 | +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c | ||
400 | @@ -114,7 +114,10 @@ static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt, | ||
401 | { | ||
402 | struct hns_roce_qp_table *qp_table = &hr_dev->qp_table; | ||
403 | |||
404 | - return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base); | ||
405 | + return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, | ||
406 | + base) ? | ||
407 | + -ENOMEM : | ||
408 | + 0; | ||
409 | } | ||
410 | |||
411 | enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state) | ||
412 | diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c | ||
413 | index c2662a1bfdd3..6e24facebb46 100644 | ||
414 | --- a/drivers/irqchip/irq-bcm7038-l1.c | ||
415 | +++ b/drivers/irqchip/irq-bcm7038-l1.c | ||
416 | @@ -215,6 +215,7 @@ static int bcm7038_l1_set_affinity(struct irq_data *d, | ||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | +#ifdef CONFIG_SMP | ||
421 | static void bcm7038_l1_cpu_offline(struct irq_data *d) | ||
422 | { | ||
423 | struct cpumask *mask = irq_data_get_affinity_mask(d); | ||
424 | @@ -239,6 +240,7 @@ static void bcm7038_l1_cpu_offline(struct irq_data *d) | ||
425 | } | ||
426 | irq_set_affinity_locked(d, &new_affinity, false); | ||
427 | } | ||
428 | +#endif | ||
429 | |||
430 | static int __init bcm7038_l1_init_one(struct device_node *dn, | ||
431 | unsigned int idx, | ||
432 | @@ -291,7 +293,9 @@ static struct irq_chip bcm7038_l1_irq_chip = { | ||
433 | .irq_mask = bcm7038_l1_mask, | ||
434 | .irq_unmask = bcm7038_l1_unmask, | ||
435 | .irq_set_affinity = bcm7038_l1_set_affinity, | ||
436 | +#ifdef CONFIG_SMP | ||
437 | .irq_cpu_offline = bcm7038_l1_cpu_offline, | ||
438 | +#endif | ||
439 | }; | ||
440 | |||
441 | static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq, | ||
442 | diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c | ||
443 | index 9e9d04cb7d51..56fcccc30554 100644 | ||
444 | --- a/drivers/md/dm-kcopyd.c | ||
445 | +++ b/drivers/md/dm-kcopyd.c | ||
446 | @@ -454,6 +454,8 @@ static int run_complete_job(struct kcopyd_job *job) | ||
447 | if (atomic_dec_and_test(&kc->nr_jobs)) | ||
448 | wake_up(&kc->destroyq); | ||
449 | |||
450 | + cond_resched(); | ||
451 | + | ||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c | ||
456 | index 40534352e574..3270b8dbc949 100644 | ||
457 | --- a/drivers/mfd/sm501.c | ||
458 | +++ b/drivers/mfd/sm501.c | ||
459 | @@ -714,6 +714,7 @@ sm501_create_subdev(struct sm501_devdata *sm, char *name, | ||
460 | smdev->pdev.name = name; | ||
461 | smdev->pdev.id = sm->pdev_id; | ||
462 | smdev->pdev.dev.parent = sm->dev; | ||
463 | + smdev->pdev.dev.coherent_dma_mask = 0xffffffff; | ||
464 | |||
465 | if (res_count) { | ||
466 | smdev->pdev.resource = (struct resource *)(smdev+1); | ||
467 | diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c | ||
468 | index f9c6ec4b98ab..013a7b3fe92d 100644 | ||
469 | --- a/drivers/misc/mei/pci-me.c | ||
470 | +++ b/drivers/misc/mei/pci-me.c | ||
471 | @@ -229,8 +229,11 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
472 | if (!pci_dev_run_wake(pdev)) | ||
473 | mei_me_set_pm_domain(dev); | ||
474 | |||
475 | - if (mei_pg_is_enabled(dev)) | ||
476 | + if (mei_pg_is_enabled(dev)) { | ||
477 | pm_runtime_put_noidle(&pdev->dev); | ||
478 | + if (hw->d0i3_supported) | ||
479 | + pm_runtime_allow(&pdev->dev); | ||
480 | + } | ||
481 | |||
482 | dev_dbg(&pdev->dev, "initialization successful.\n"); | ||
483 | |||
484 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | ||
485 | index db7f289d65ae..3f8858db12eb 100644 | ||
486 | --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h | ||
487 | +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | ||
488 | @@ -185,6 +185,9 @@ struct bcmgenet_mib_counters { | ||
489 | #define UMAC_MAC1 0x010 | ||
490 | #define UMAC_MAX_FRAME_LEN 0x014 | ||
491 | |||
492 | +#define UMAC_MODE 0x44 | ||
493 | +#define MODE_LINK_STATUS (1 << 5) | ||
494 | + | ||
495 | #define UMAC_EEE_CTRL 0x064 | ||
496 | #define EN_LPI_RX_PAUSE (1 << 0) | ||
497 | #define EN_LPI_TX_PFC (1 << 1) | ||
498 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c | ||
499 | index 2f9281936f0e..3b9e1a5dce82 100644 | ||
500 | --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c | ||
501 | +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | ||
502 | @@ -167,8 +167,14 @@ void bcmgenet_mii_setup(struct net_device *dev) | ||
503 | static int bcmgenet_fixed_phy_link_update(struct net_device *dev, | ||
504 | struct fixed_phy_status *status) | ||
505 | { | ||
506 | - if (dev && dev->phydev && status) | ||
507 | - status->link = dev->phydev->link; | ||
508 | + struct bcmgenet_priv *priv; | ||
509 | + u32 reg; | ||
510 | + | ||
511 | + if (dev && dev->phydev && status) { | ||
512 | + priv = netdev_priv(dev); | ||
513 | + reg = bcmgenet_umac_readl(priv, UMAC_MODE); | ||
514 | + status->link = !!(reg & MODE_LINK_STATUS); | ||
515 | + } | ||
516 | |||
517 | return 0; | ||
518 | } | ||
519 | diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c | ||
520 | index f7e7b79c6050..f314be07ec58 100644 | ||
521 | --- a/drivers/net/ethernet/cisco/enic/enic_main.c | ||
522 | +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | ||
523 | @@ -2681,7 +2681,6 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
524 | */ | ||
525 | |||
526 | enic->port_mtu = enic->config.mtu; | ||
527 | - (void)enic_change_mtu(netdev, enic->port_mtu); | ||
528 | |||
529 | err = enic_set_mac_addr(netdev, enic->mac_addr); | ||
530 | if (err) { | ||
531 | @@ -2731,6 +2730,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
532 | netdev->features |= NETIF_F_HIGHDMA; | ||
533 | |||
534 | netdev->priv_flags |= IFF_UNICAST_FLT; | ||
535 | + netdev->mtu = enic->port_mtu; | ||
536 | |||
537 | err = register_netdev(netdev); | ||
538 | if (err) { | ||
539 | diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | ||
540 | index fd4a8e473f11..6a507544682f 100644 | ||
541 | --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c | ||
542 | +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | ||
543 | @@ -2387,26 +2387,20 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, | ||
544 | return status; | ||
545 | } | ||
546 | |||
547 | -static netdev_features_t qlge_fix_features(struct net_device *ndev, | ||
548 | - netdev_features_t features) | ||
549 | -{ | ||
550 | - int err; | ||
551 | - | ||
552 | - /* Update the behavior of vlan accel in the adapter */ | ||
553 | - err = qlge_update_hw_vlan_features(ndev, features); | ||
554 | - if (err) | ||
555 | - return err; | ||
556 | - | ||
557 | - return features; | ||
558 | -} | ||
559 | - | ||
560 | static int qlge_set_features(struct net_device *ndev, | ||
561 | netdev_features_t features) | ||
562 | { | ||
563 | netdev_features_t changed = ndev->features ^ features; | ||
564 | + int err; | ||
565 | + | ||
566 | + if (changed & NETIF_F_HW_VLAN_CTAG_RX) { | ||
567 | + /* Update the behavior of vlan accel in the adapter */ | ||
568 | + err = qlge_update_hw_vlan_features(ndev, features); | ||
569 | + if (err) | ||
570 | + return err; | ||
571 | |||
572 | - if (changed & NETIF_F_HW_VLAN_CTAG_RX) | ||
573 | qlge_vlan_mode(ndev, features); | ||
574 | + } | ||
575 | |||
576 | return 0; | ||
577 | } | ||
578 | @@ -4719,7 +4713,6 @@ static const struct net_device_ops qlge_netdev_ops = { | ||
579 | .ndo_set_mac_address = qlge_set_mac_address, | ||
580 | .ndo_validate_addr = eth_validate_addr, | ||
581 | .ndo_tx_timeout = qlge_tx_timeout, | ||
582 | - .ndo_fix_features = qlge_fix_features, | ||
583 | .ndo_set_features = qlge_set_features, | ||
584 | .ndo_vlan_rx_add_vid = qlge_vlan_rx_add_vid, | ||
585 | .ndo_vlan_rx_kill_vid = qlge_vlan_rx_kill_vid, | ||
586 | diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c | ||
587 | index 59b932db0d42..f65e8cd6d144 100644 | ||
588 | --- a/drivers/net/ethernet/realtek/r8169.c | ||
589 | +++ b/drivers/net/ethernet/realtek/r8169.c | ||
590 | @@ -329,6 +329,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { | ||
591 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 }, | ||
592 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, | ||
593 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, | ||
594 | + { PCI_DEVICE(PCI_VENDOR_ID_NCUBE, 0x8168), 0, 0, RTL_CFG_1 }, | ||
595 | { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, | ||
596 | { PCI_VENDOR_ID_DLINK, 0x4300, | ||
597 | PCI_VENDOR_ID_DLINK, 0x4b10, 0, 0, RTL_CFG_1 }, | ||
598 | diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c | ||
599 | index 36a04e182af1..53602fdf5b47 100644 | ||
600 | --- a/drivers/net/hyperv/netvsc_drv.c | ||
601 | +++ b/drivers/net/hyperv/netvsc_drv.c | ||
602 | @@ -29,6 +29,7 @@ | ||
603 | #include <linux/netdevice.h> | ||
604 | #include <linux/inetdevice.h> | ||
605 | #include <linux/etherdevice.h> | ||
606 | +#include <linux/pci.h> | ||
607 | #include <linux/skbuff.h> | ||
608 | #include <linux/if_vlan.h> | ||
609 | #include <linux/in.h> | ||
610 | @@ -1228,11 +1229,15 @@ static int netvsc_register_vf(struct net_device *vf_netdev) | ||
611 | { | ||
612 | struct net_device *ndev; | ||
613 | struct net_device_context *net_device_ctx; | ||
614 | + struct device *pdev = vf_netdev->dev.parent; | ||
615 | struct netvsc_device *netvsc_dev; | ||
616 | |||
617 | if (vf_netdev->addr_len != ETH_ALEN) | ||
618 | return NOTIFY_DONE; | ||
619 | |||
620 | + if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev)) | ||
621 | + return NOTIFY_DONE; | ||
622 | + | ||
623 | /* | ||
624 | * We will use the MAC address to locate the synthetic interface to | ||
625 | * associate with the VF interface. If we don't find a matching | ||
626 | diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c | ||
627 | index 90e0b6f134ad..23d7f73cc347 100644 | ||
628 | --- a/drivers/pci/host/pci-mvebu.c | ||
629 | +++ b/drivers/pci/host/pci-mvebu.c | ||
630 | @@ -1236,7 +1236,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) | ||
631 | pcie->realio.start = PCIBIOS_MIN_IO; | ||
632 | pcie->realio.end = min_t(resource_size_t, | ||
633 | IO_SPACE_LIMIT, | ||
634 | - resource_size(&pcie->io)); | ||
635 | + resource_size(&pcie->io) - 1); | ||
636 | } else | ||
637 | pcie->realio = pcie->io; | ||
638 | |||
639 | diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c | ||
640 | index 687cc5b922ee..c857d2d7bbec 100644 | ||
641 | --- a/drivers/platform/x86/asus-nb-wmi.c | ||
642 | +++ b/drivers/platform/x86/asus-nb-wmi.c | ||
643 | @@ -531,6 +531,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { | ||
644 | { KE_KEY, 0xC4, { KEY_KBDILLUMUP } }, | ||
645 | { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, | ||
646 | { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ | ||
647 | + { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ | ||
648 | { KE_END, 0}, | ||
649 | }; | ||
650 | |||
651 | diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c | ||
652 | index b5b890127479..b7dfe06261f1 100644 | ||
653 | --- a/drivers/platform/x86/intel_punit_ipc.c | ||
654 | +++ b/drivers/platform/x86/intel_punit_ipc.c | ||
655 | @@ -17,6 +17,7 @@ | ||
656 | #include <linux/bitops.h> | ||
657 | #include <linux/device.h> | ||
658 | #include <linux/interrupt.h> | ||
659 | +#include <linux/io.h> | ||
660 | #include <linux/platform_device.h> | ||
661 | #include <asm/intel_punit_ipc.h> | ||
662 | |||
663 | diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c | ||
664 | index 0f5bc2f8382b..be17de9807b6 100644 | ||
665 | --- a/drivers/s390/block/dasd_eckd.c | ||
666 | +++ b/drivers/s390/block/dasd_eckd.c | ||
667 | @@ -1834,6 +1834,9 @@ static void dasd_eckd_uncheck_device(struct dasd_device *device) | ||
668 | struct dasd_eckd_private *private = device->private; | ||
669 | int i; | ||
670 | |||
671 | + if (!private) | ||
672 | + return; | ||
673 | + | ||
674 | dasd_alias_disconnect_device_from_lcu(device); | ||
675 | private->ned = NULL; | ||
676 | private->sneq = NULL; | ||
677 | @@ -2085,8 +2088,11 @@ static int dasd_eckd_basic_to_ready(struct dasd_device *device) | ||
678 | |||
679 | static int dasd_eckd_online_to_ready(struct dasd_device *device) | ||
680 | { | ||
681 | - cancel_work_sync(&device->reload_device); | ||
682 | - cancel_work_sync(&device->kick_validate); | ||
683 | + if (cancel_work_sync(&device->reload_device)) | ||
684 | + dasd_put_device(device); | ||
685 | + if (cancel_work_sync(&device->kick_validate)) | ||
686 | + dasd_put_device(device); | ||
687 | + | ||
688 | return 0; | ||
689 | }; | ||
690 | |||
691 | diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c | ||
692 | index 662b2321d1b0..913ebb6d0d29 100644 | ||
693 | --- a/drivers/scsi/aic94xx/aic94xx_init.c | ||
694 | +++ b/drivers/scsi/aic94xx/aic94xx_init.c | ||
695 | @@ -1031,8 +1031,10 @@ static int __init aic94xx_init(void) | ||
696 | |||
697 | aic94xx_transport_template = | ||
698 | sas_domain_attach_transport(&aic94xx_transport_functions); | ||
699 | - if (!aic94xx_transport_template) | ||
700 | + if (!aic94xx_transport_template) { | ||
701 | + err = -ENOMEM; | ||
702 | goto out_destroy_caches; | ||
703 | + } | ||
704 | |||
705 | err = pci_register_driver(&aic94xx_pci_driver); | ||
706 | if (err) | ||
707 | diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c | ||
708 | index 18c5312f7886..0fa85d55c82f 100644 | ||
709 | --- a/drivers/staging/comedi/drivers/ni_mio_common.c | ||
710 | +++ b/drivers/staging/comedi/drivers/ni_mio_common.c | ||
711 | @@ -5407,11 +5407,11 @@ static int ni_E_init(struct comedi_device *dev, | ||
712 | /* Digital I/O (PFI) subdevice */ | ||
713 | s = &dev->subdevices[NI_PFI_DIO_SUBDEV]; | ||
714 | s->type = COMEDI_SUBD_DIO; | ||
715 | - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; | ||
716 | s->maxdata = 1; | ||
717 | if (devpriv->is_m_series) { | ||
718 | s->n_chan = 16; | ||
719 | s->insn_bits = ni_pfi_insn_bits; | ||
720 | + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; | ||
721 | |||
722 | ni_writew(dev, s->state, NI_M_PFI_DO_REG); | ||
723 | for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) { | ||
724 | @@ -5420,6 +5420,7 @@ static int ni_E_init(struct comedi_device *dev, | ||
725 | } | ||
726 | } else { | ||
727 | s->n_chan = 10; | ||
728 | + s->subdev_flags = SDF_INTERNAL; | ||
729 | } | ||
730 | s->insn_config = ni_pfi_insn_config; | ||
731 | |||
732 | diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c | ||
733 | index 8b6489ae74eb..c569b6454a9d 100644 | ||
734 | --- a/drivers/vhost/vhost.c | ||
735 | +++ b/drivers/vhost/vhost.c | ||
736 | @@ -905,7 +905,7 @@ static void vhost_iotlb_notify_vq(struct vhost_dev *d, | ||
737 | list_for_each_entry_safe(node, n, &d->pending_list, node) { | ||
738 | struct vhost_iotlb_msg *vq_msg = &node->msg.iotlb; | ||
739 | if (msg->iova <= vq_msg->iova && | ||
740 | - msg->iova + msg->size - 1 > vq_msg->iova && | ||
741 | + msg->iova + msg->size - 1 >= vq_msg->iova && | ||
742 | vq_msg->type == VHOST_IOTLB_MISS) { | ||
743 | vhost_poll_queue(&node->vq->poll); | ||
744 | list_del(&node->node); | ||
745 | diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c | ||
746 | index 6d9e5173d5fa..fbc4761987e8 100644 | ||
747 | --- a/drivers/virtio/virtio_pci_legacy.c | ||
748 | +++ b/drivers/virtio/virtio_pci_legacy.c | ||
749 | @@ -121,6 +121,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev, | ||
750 | struct virtqueue *vq; | ||
751 | u16 num; | ||
752 | int err; | ||
753 | + u64 q_pfn; | ||
754 | |||
755 | /* Select the queue we're interested in */ | ||
756 | iowrite16(index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); | ||
757 | @@ -139,9 +140,17 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev, | ||
758 | if (!vq) | ||
759 | return ERR_PTR(-ENOMEM); | ||
760 | |||
761 | + q_pfn = virtqueue_get_desc_addr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT; | ||
762 | + if (q_pfn >> 32) { | ||
763 | + dev_err(&vp_dev->pci_dev->dev, | ||
764 | + "platform bug: legacy virtio-mmio must not be used with RAM above 0x%llxGB\n", | ||
765 | + 0x1ULL << (32 + PAGE_SHIFT - 30)); | ||
766 | + err = -E2BIG; | ||
767 | + goto out_del_vq; | ||
768 | + } | ||
769 | + | ||
770 | /* activate the queue */ | ||
771 | - iowrite32(virtqueue_get_desc_addr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT, | ||
772 | - vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
773 | + iowrite32(q_pfn, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
774 | |||
775 | vq->priv = (void __force *)vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY; | ||
776 | |||
777 | @@ -158,6 +167,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev, | ||
778 | |||
779 | out_deactivate: | ||
780 | iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
781 | +out_del_vq: | ||
782 | vring_del_virtqueue(vq); | ||
783 | return ERR_PTR(err); | ||
784 | } | ||
785 | diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c | ||
786 | index 05169ef30596..b450adf65236 100644 | ||
787 | --- a/fs/btrfs/dev-replace.c | ||
788 | +++ b/fs/btrfs/dev-replace.c | ||
789 | @@ -585,6 +585,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | ||
790 | |||
791 | btrfs_rm_dev_replace_unblocked(fs_info); | ||
792 | |||
793 | + /* | ||
794 | + * Increment dev_stats_ccnt so that btrfs_run_dev_stats() will | ||
795 | + * update on-disk dev stats value during commit transaction | ||
796 | + */ | ||
797 | + atomic_inc(&tgt_device->dev_stats_ccnt); | ||
798 | + | ||
799 | /* | ||
800 | * this is again a consistent state where no dev_replace procedure | ||
801 | * is running, the target device is part of the filesystem, the | ||
802 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c | ||
803 | index 92f3b231d5a2..18d05323ca53 100644 | ||
804 | --- a/fs/btrfs/disk-io.c | ||
805 | +++ b/fs/btrfs/disk-io.c | ||
806 | @@ -1096,8 +1096,9 @@ static int btree_writepages(struct address_space *mapping, | ||
807 | |||
808 | fs_info = BTRFS_I(mapping->host)->root->fs_info; | ||
809 | /* this is a bit racy, but that's ok */ | ||
810 | - ret = percpu_counter_compare(&fs_info->dirty_metadata_bytes, | ||
811 | - BTRFS_DIRTY_METADATA_THRESH); | ||
812 | + ret = __percpu_counter_compare(&fs_info->dirty_metadata_bytes, | ||
813 | + BTRFS_DIRTY_METADATA_THRESH, | ||
814 | + fs_info->dirty_metadata_batch); | ||
815 | if (ret < 0) | ||
816 | return 0; | ||
817 | } | ||
818 | @@ -4107,8 +4108,9 @@ static void __btrfs_btree_balance_dirty(struct btrfs_root *root, | ||
819 | if (flush_delayed) | ||
820 | btrfs_balance_delayed_items(root); | ||
821 | |||
822 | - ret = percpu_counter_compare(&root->fs_info->dirty_metadata_bytes, | ||
823 | - BTRFS_DIRTY_METADATA_THRESH); | ||
824 | + ret = __percpu_counter_compare(&root->fs_info->dirty_metadata_bytes, | ||
825 | + BTRFS_DIRTY_METADATA_THRESH, | ||
826 | + root->fs_info->dirty_metadata_batch); | ||
827 | if (ret > 0) { | ||
828 | balance_dirty_pages_ratelimited( | ||
829 | root->fs_info->btree_inode->i_mapping); | ||
830 | diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c | ||
831 | index 44a43851404a..6661116c47d9 100644 | ||
832 | --- a/fs/btrfs/extent-tree.c | ||
833 | +++ b/fs/btrfs/extent-tree.c | ||
834 | @@ -10853,7 +10853,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | ||
835 | /* Don't want to race with allocators so take the groups_sem */ | ||
836 | down_write(&space_info->groups_sem); | ||
837 | spin_lock(&block_group->lock); | ||
838 | - if (block_group->reserved || | ||
839 | + if (block_group->reserved || block_group->pinned || | ||
840 | btrfs_block_group_used(&block_group->item) || | ||
841 | block_group->ro || | ||
842 | list_is_singular(&block_group->list)) { | ||
843 | diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c | ||
844 | index 04c61bcf62e5..9140aede5869 100644 | ||
845 | --- a/fs/btrfs/relocation.c | ||
846 | +++ b/fs/btrfs/relocation.c | ||
847 | @@ -1325,18 +1325,19 @@ static void __del_reloc_root(struct btrfs_root *root) | ||
848 | struct mapping_node *node = NULL; | ||
849 | struct reloc_control *rc = root->fs_info->reloc_ctl; | ||
850 | |||
851 | - spin_lock(&rc->reloc_root_tree.lock); | ||
852 | - rb_node = tree_search(&rc->reloc_root_tree.rb_root, | ||
853 | - root->node->start); | ||
854 | - if (rb_node) { | ||
855 | - node = rb_entry(rb_node, struct mapping_node, rb_node); | ||
856 | - rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root); | ||
857 | + if (rc) { | ||
858 | + spin_lock(&rc->reloc_root_tree.lock); | ||
859 | + rb_node = tree_search(&rc->reloc_root_tree.rb_root, | ||
860 | + root->node->start); | ||
861 | + if (rb_node) { | ||
862 | + node = rb_entry(rb_node, struct mapping_node, rb_node); | ||
863 | + rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root); | ||
864 | + } | ||
865 | + spin_unlock(&rc->reloc_root_tree.lock); | ||
866 | + if (!node) | ||
867 | + return; | ||
868 | + BUG_ON((struct btrfs_root *)node->data != root); | ||
869 | } | ||
870 | - spin_unlock(&rc->reloc_root_tree.lock); | ||
871 | - | ||
872 | - if (!node) | ||
873 | - return; | ||
874 | - BUG_ON((struct btrfs_root *)node->data != root); | ||
875 | |||
876 | spin_lock(&root->fs_info->trans_lock); | ||
877 | list_del_init(&root->root_list); | ||
878 | diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c | ||
879 | index ad8bd96093f7..e06468f8e041 100644 | ||
880 | --- a/fs/cifs/cifs_debug.c | ||
881 | +++ b/fs/cifs/cifs_debug.c | ||
882 | @@ -284,6 +284,10 @@ static ssize_t cifs_stats_proc_write(struct file *file, | ||
883 | atomic_set(&totBufAllocCount, 0); | ||
884 | atomic_set(&totSmBufAllocCount, 0); | ||
885 | #endif /* CONFIG_CIFS_STATS2 */ | ||
886 | + spin_lock(&GlobalMid_Lock); | ||
887 | + GlobalMaxActiveXid = 0; | ||
888 | + GlobalCurrentXid = 0; | ||
889 | + spin_unlock(&GlobalMid_Lock); | ||
890 | spin_lock(&cifs_tcp_ses_lock); | ||
891 | list_for_each(tmp1, &cifs_tcp_ses_list) { | ||
892 | server = list_entry(tmp1, struct TCP_Server_Info, | ||
893 | @@ -296,6 +300,10 @@ static ssize_t cifs_stats_proc_write(struct file *file, | ||
894 | struct cifs_tcon, | ||
895 | tcon_list); | ||
896 | atomic_set(&tcon->num_smbs_sent, 0); | ||
897 | + spin_lock(&tcon->stat_lock); | ||
898 | + tcon->bytes_read = 0; | ||
899 | + tcon->bytes_written = 0; | ||
900 | + spin_unlock(&tcon->stat_lock); | ||
901 | if (server->ops->clear_stats) | ||
902 | server->ops->clear_stats(tcon); | ||
903 | } | ||
904 | diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c | ||
905 | index 967dfe656ced..e96a74da756f 100644 | ||
906 | --- a/fs/cifs/smb2misc.c | ||
907 | +++ b/fs/cifs/smb2misc.c | ||
908 | @@ -208,6 +208,13 @@ smb2_check_message(char *buf, unsigned int length, struct TCP_Server_Info *srvr) | ||
909 | if (clc_len == 4 + len + 1) | ||
910 | return 0; | ||
911 | |||
912 | + /* | ||
913 | + * Some windows servers (win2016) will pad also the final | ||
914 | + * PDU in a compound to 8 bytes. | ||
915 | + */ | ||
916 | + if (((clc_len + 7) & ~7) == len) | ||
917 | + return 0; | ||
918 | + | ||
919 | /* | ||
920 | * MacOS server pads after SMB2.1 write response with 3 bytes | ||
921 | * of junk. Other servers match RFC1001 len to actual | ||
922 | diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c | ||
923 | index 4ded64b8b43b..383cf8148fe7 100644 | ||
924 | --- a/fs/cifs/smb2pdu.c | ||
925 | +++ b/fs/cifs/smb2pdu.c | ||
926 | @@ -320,7 +320,7 @@ small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon, | ||
927 | smb2_hdr_assemble((struct smb2_hdr *) *request_buf, smb2_command, tcon); | ||
928 | |||
929 | if (tcon != NULL) { | ||
930 | -#ifdef CONFIG_CIFS_STATS2 | ||
931 | +#ifdef CONFIG_CIFS_STATS | ||
932 | uint16_t com_code = le16_to_cpu(smb2_command); | ||
933 | cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]); | ||
934 | #endif | ||
935 | diff --git a/fs/dcache.c b/fs/dcache.c | ||
936 | index 461ff8f234e3..f903b86b06e5 100644 | ||
937 | --- a/fs/dcache.c | ||
938 | +++ b/fs/dcache.c | ||
939 | @@ -286,7 +286,8 @@ void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry | ||
940 | spin_unlock(&dentry->d_lock); | ||
941 | name->name = p->name; | ||
942 | } else { | ||
943 | - memcpy(name->inline_name, dentry->d_iname, DNAME_INLINE_LEN); | ||
944 | + memcpy(name->inline_name, dentry->d_iname, | ||
945 | + dentry->d_name.len + 1); | ||
946 | spin_unlock(&dentry->d_lock); | ||
947 | name->name = name->inline_name; | ||
948 | } | ||
949 | diff --git a/fs/fat/cache.c b/fs/fat/cache.c | ||
950 | index 5d384921524d..f04b189fd90d 100644 | ||
951 | --- a/fs/fat/cache.c | ||
952 | +++ b/fs/fat/cache.c | ||
953 | @@ -224,7 +224,8 @@ static inline void cache_init(struct fat_cache_id *cid, int fclus, int dclus) | ||
954 | int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) | ||
955 | { | ||
956 | struct super_block *sb = inode->i_sb; | ||
957 | - const int limit = sb->s_maxbytes >> MSDOS_SB(sb)->cluster_bits; | ||
958 | + struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
959 | + const int limit = sb->s_maxbytes >> sbi->cluster_bits; | ||
960 | struct fat_entry fatent; | ||
961 | struct fat_cache_id cid; | ||
962 | int nr; | ||
963 | @@ -233,6 +234,12 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) | ||
964 | |||
965 | *fclus = 0; | ||
966 | *dclus = MSDOS_I(inode)->i_start; | ||
967 | + if (!fat_valid_entry(sbi, *dclus)) { | ||
968 | + fat_fs_error_ratelimit(sb, | ||
969 | + "%s: invalid start cluster (i_pos %lld, start %08x)", | ||
970 | + __func__, MSDOS_I(inode)->i_pos, *dclus); | ||
971 | + return -EIO; | ||
972 | + } | ||
973 | if (cluster == 0) | ||
974 | return 0; | ||
975 | |||
976 | @@ -249,9 +256,8 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) | ||
977 | /* prevent the infinite loop of cluster chain */ | ||
978 | if (*fclus > limit) { | ||
979 | fat_fs_error_ratelimit(sb, | ||
980 | - "%s: detected the cluster chain loop" | ||
981 | - " (i_pos %lld)", __func__, | ||
982 | - MSDOS_I(inode)->i_pos); | ||
983 | + "%s: detected the cluster chain loop (i_pos %lld)", | ||
984 | + __func__, MSDOS_I(inode)->i_pos); | ||
985 | nr = -EIO; | ||
986 | goto out; | ||
987 | } | ||
988 | @@ -261,9 +267,8 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) | ||
989 | goto out; | ||
990 | else if (nr == FAT_ENT_FREE) { | ||
991 | fat_fs_error_ratelimit(sb, | ||
992 | - "%s: invalid cluster chain (i_pos %lld)", | ||
993 | - __func__, | ||
994 | - MSDOS_I(inode)->i_pos); | ||
995 | + "%s: invalid cluster chain (i_pos %lld)", | ||
996 | + __func__, MSDOS_I(inode)->i_pos); | ||
997 | nr = -EIO; | ||
998 | goto out; | ||
999 | } else if (nr == FAT_ENT_EOF) { | ||
1000 | diff --git a/fs/fat/fat.h b/fs/fat/fat.h | ||
1001 | index e6b764a17a9c..437affe987c5 100644 | ||
1002 | --- a/fs/fat/fat.h | ||
1003 | +++ b/fs/fat/fat.h | ||
1004 | @@ -347,6 +347,11 @@ static inline void fatent_brelse(struct fat_entry *fatent) | ||
1005 | fatent->fat_inode = NULL; | ||
1006 | } | ||
1007 | |||
1008 | +static inline bool fat_valid_entry(struct msdos_sb_info *sbi, int entry) | ||
1009 | +{ | ||
1010 | + return FAT_START_ENT <= entry && entry < sbi->max_cluster; | ||
1011 | +} | ||
1012 | + | ||
1013 | extern void fat_ent_access_init(struct super_block *sb); | ||
1014 | extern int fat_ent_read(struct inode *inode, struct fat_entry *fatent, | ||
1015 | int entry); | ||
1016 | diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c | ||
1017 | index 1d9a8c4e9de0..3b7644e43796 100644 | ||
1018 | --- a/fs/fat/fatent.c | ||
1019 | +++ b/fs/fat/fatent.c | ||
1020 | @@ -23,7 +23,7 @@ static void fat12_ent_blocknr(struct super_block *sb, int entry, | ||
1021 | { | ||
1022 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
1023 | int bytes = entry + (entry >> 1); | ||
1024 | - WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry); | ||
1025 | + WARN_ON(!fat_valid_entry(sbi, entry)); | ||
1026 | *offset = bytes & (sb->s_blocksize - 1); | ||
1027 | *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits); | ||
1028 | } | ||
1029 | @@ -33,7 +33,7 @@ static void fat_ent_blocknr(struct super_block *sb, int entry, | ||
1030 | { | ||
1031 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
1032 | int bytes = (entry << sbi->fatent_shift); | ||
1033 | - WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry); | ||
1034 | + WARN_ON(!fat_valid_entry(sbi, entry)); | ||
1035 | *offset = bytes & (sb->s_blocksize - 1); | ||
1036 | *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits); | ||
1037 | } | ||
1038 | @@ -353,7 +353,7 @@ int fat_ent_read(struct inode *inode, struct fat_entry *fatent, int entry) | ||
1039 | int err, offset; | ||
1040 | sector_t blocknr; | ||
1041 | |||
1042 | - if (entry < FAT_START_ENT || sbi->max_cluster <= entry) { | ||
1043 | + if (!fat_valid_entry(sbi, entry)) { | ||
1044 | fatent_brelse(fatent); | ||
1045 | fat_fs_error(sb, "invalid access to FAT (entry 0x%08x)", entry); | ||
1046 | return -EIO; | ||
1047 | diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c | ||
1048 | index 6fc766df0461..2a6f3c67cb3f 100644 | ||
1049 | --- a/fs/hfs/brec.c | ||
1050 | +++ b/fs/hfs/brec.c | ||
1051 | @@ -74,9 +74,10 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) | ||
1052 | if (!fd->bnode) { | ||
1053 | if (!tree->root) | ||
1054 | hfs_btree_inc_height(tree); | ||
1055 | - fd->bnode = hfs_bnode_find(tree, tree->leaf_head); | ||
1056 | - if (IS_ERR(fd->bnode)) | ||
1057 | - return PTR_ERR(fd->bnode); | ||
1058 | + node = hfs_bnode_find(tree, tree->leaf_head); | ||
1059 | + if (IS_ERR(node)) | ||
1060 | + return PTR_ERR(node); | ||
1061 | + fd->bnode = node; | ||
1062 | fd->record = -1; | ||
1063 | } | ||
1064 | new_node = NULL; | ||
1065 | diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c | ||
1066 | index 31d5e3f1fe17..193d5411210a 100644 | ||
1067 | --- a/fs/hfsplus/dir.c | ||
1068 | +++ b/fs/hfsplus/dir.c | ||
1069 | @@ -77,13 +77,13 @@ again: | ||
1070 | cpu_to_be32(HFSP_HARDLINK_TYPE) && | ||
1071 | entry.file.user_info.fdCreator == | ||
1072 | cpu_to_be32(HFSP_HFSPLUS_CREATOR) && | ||
1073 | + HFSPLUS_SB(sb)->hidden_dir && | ||
1074 | (entry.file.create_date == | ||
1075 | HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)-> | ||
1076 | create_date || | ||
1077 | entry.file.create_date == | ||
1078 | HFSPLUS_I(d_inode(sb->s_root))-> | ||
1079 | - create_date) && | ||
1080 | - HFSPLUS_SB(sb)->hidden_dir) { | ||
1081 | + create_date)) { | ||
1082 | struct qstr str; | ||
1083 | char name[32]; | ||
1084 | |||
1085 | diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c | ||
1086 | index b9563cdcfe28..7fb976e0aa07 100644 | ||
1087 | --- a/fs/hfsplus/super.c | ||
1088 | +++ b/fs/hfsplus/super.c | ||
1089 | @@ -524,8 +524,10 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | ||
1090 | goto out_put_root; | ||
1091 | if (!hfs_brec_read(&fd, &entry, sizeof(entry))) { | ||
1092 | hfs_find_exit(&fd); | ||
1093 | - if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) | ||
1094 | + if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) { | ||
1095 | + err = -EINVAL; | ||
1096 | goto out_put_root; | ||
1097 | + } | ||
1098 | inode = hfsplus_iget(sb, be32_to_cpu(entry.folder.id)); | ||
1099 | if (IS_ERR(inode)) { | ||
1100 | err = PTR_ERR(inode); | ||
1101 | diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h | ||
1102 | index 6ca00471afbf..d920a646b578 100644 | ||
1103 | --- a/fs/reiserfs/reiserfs.h | ||
1104 | +++ b/fs/reiserfs/reiserfs.h | ||
1105 | @@ -270,7 +270,7 @@ struct reiserfs_journal_list { | ||
1106 | |||
1107 | struct mutex j_commit_mutex; | ||
1108 | unsigned int j_trans_id; | ||
1109 | - time_t j_timestamp; | ||
1110 | + time64_t j_timestamp; /* write-only but useful for crash dump analysis */ | ||
1111 | struct reiserfs_list_bitmap *j_list_bitmap; | ||
1112 | struct buffer_head *j_commit_bh; /* commit buffer head */ | ||
1113 | struct reiserfs_journal_cnode *j_realblock; | ||
1114 | diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h | ||
1115 | index 43082049baf2..bba5604f3a03 100644 | ||
1116 | --- a/include/linux/pci_ids.h | ||
1117 | +++ b/include/linux/pci_ids.h | ||
1118 | @@ -3054,4 +3054,6 @@ | ||
1119 | |||
1120 | #define PCI_VENDOR_ID_OCZ 0x1b85 | ||
1121 | |||
1122 | +#define PCI_VENDOR_ID_NCUBE 0x10ff | ||
1123 | + | ||
1124 | #endif /* _LINUX_PCI_IDS_H */ | ||
1125 | diff --git a/kernel/fork.c b/kernel/fork.c | ||
1126 | index 2c98b987808d..5d0e2f366766 100644 | ||
1127 | --- a/kernel/fork.c | ||
1128 | +++ b/kernel/fork.c | ||
1129 | @@ -1304,7 +1304,9 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) | ||
1130 | return -ENOMEM; | ||
1131 | |||
1132 | atomic_set(&sig->count, 1); | ||
1133 | + spin_lock_irq(¤t->sighand->siglock); | ||
1134 | memcpy(sig->action, current->sighand->action, sizeof(sig->action)); | ||
1135 | + spin_unlock_irq(¤t->sighand->siglock); | ||
1136 | return 0; | ||
1137 | } | ||
1138 | |||
1139 | diff --git a/lib/debugobjects.c b/lib/debugobjects.c | ||
1140 | index 056052dc8e91..88580e8ee39e 100644 | ||
1141 | --- a/lib/debugobjects.c | ||
1142 | +++ b/lib/debugobjects.c | ||
1143 | @@ -294,9 +294,12 @@ static void debug_object_is_on_stack(void *addr, int onstack) | ||
1144 | |||
1145 | limit++; | ||
1146 | if (is_on_stack) | ||
1147 | - pr_warn("object is on stack, but not annotated\n"); | ||
1148 | + pr_warn("object %p is on stack %p, but NOT annotated.\n", addr, | ||
1149 | + task_stack_page(current)); | ||
1150 | else | ||
1151 | - pr_warn("object is not on stack, but annotated\n"); | ||
1152 | + pr_warn("object %p is NOT on stack %p, but annotated.\n", addr, | ||
1153 | + task_stack_page(current)); | ||
1154 | + | ||
1155 | WARN_ON(1); | ||
1156 | } | ||
1157 | |||
1158 | diff --git a/mm/fadvise.c b/mm/fadvise.c | ||
1159 | index 27fc9ad267ac..eb3269e59002 100644 | ||
1160 | --- a/mm/fadvise.c | ||
1161 | +++ b/mm/fadvise.c | ||
1162 | @@ -68,8 +68,12 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) | ||
1163 | goto out; | ||
1164 | } | ||
1165 | |||
1166 | - /* Careful about overflows. Len == 0 means "as much as possible" */ | ||
1167 | - endbyte = offset + len; | ||
1168 | + /* | ||
1169 | + * Careful about overflows. Len == 0 means "as much as possible". Use | ||
1170 | + * unsigned math because signed overflows are undefined and UBSan | ||
1171 | + * complains. | ||
1172 | + */ | ||
1173 | + endbyte = (u64)offset + (u64)len; | ||
1174 | if (!len || endbyte < len) | ||
1175 | endbyte = -1; | ||
1176 | else | ||
1177 | diff --git a/mm/huge_memory.c b/mm/huge_memory.c | ||
1178 | index 9efe88ef9702..e4c6c3edaf6a 100644 | ||
1179 | --- a/mm/huge_memory.c | ||
1180 | +++ b/mm/huge_memory.c | ||
1181 | @@ -1259,12 +1259,12 @@ int do_huge_pmd_numa_page(struct fault_env *fe, pmd_t pmd) | ||
1182 | |||
1183 | /* Migration could have started since the pmd_trans_migrating check */ | ||
1184 | if (!page_locked) { | ||
1185 | + page_nid = -1; | ||
1186 | if (!get_page_unless_zero(page)) | ||
1187 | goto out_unlock; | ||
1188 | spin_unlock(fe->ptl); | ||
1189 | wait_on_page_locked(page); | ||
1190 | put_page(page); | ||
1191 | - page_nid = -1; | ||
1192 | goto out; | ||
1193 | } | ||
1194 | |||
1195 | diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c | ||
1196 | index 2b543532e2f1..aa4586672cee 100644 | ||
1197 | --- a/net/9p/trans_fd.c | ||
1198 | +++ b/net/9p/trans_fd.c | ||
1199 | @@ -195,15 +195,14 @@ static void p9_mux_poll_stop(struct p9_conn *m) | ||
1200 | static void p9_conn_cancel(struct p9_conn *m, int err) | ||
1201 | { | ||
1202 | struct p9_req_t *req, *rtmp; | ||
1203 | - unsigned long flags; | ||
1204 | LIST_HEAD(cancel_list); | ||
1205 | |||
1206 | p9_debug(P9_DEBUG_ERROR, "mux %p err %d\n", m, err); | ||
1207 | |||
1208 | - spin_lock_irqsave(&m->client->lock, flags); | ||
1209 | + spin_lock(&m->client->lock); | ||
1210 | |||
1211 | if (m->err) { | ||
1212 | - spin_unlock_irqrestore(&m->client->lock, flags); | ||
1213 | + spin_unlock(&m->client->lock); | ||
1214 | return; | ||
1215 | } | ||
1216 | |||
1217 | @@ -215,7 +214,6 @@ static void p9_conn_cancel(struct p9_conn *m, int err) | ||
1218 | list_for_each_entry_safe(req, rtmp, &m->unsent_req_list, req_list) { | ||
1219 | list_move(&req->req_list, &cancel_list); | ||
1220 | } | ||
1221 | - spin_unlock_irqrestore(&m->client->lock, flags); | ||
1222 | |||
1223 | list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { | ||
1224 | p9_debug(P9_DEBUG_ERROR, "call back req %p\n", req); | ||
1225 | @@ -224,6 +222,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err) | ||
1226 | req->t_err = err; | ||
1227 | p9_client_cb(m->client, req, REQ_STATUS_ERROR); | ||
1228 | } | ||
1229 | + spin_unlock(&m->client->lock); | ||
1230 | } | ||
1231 | |||
1232 | static int | ||
1233 | @@ -379,8 +378,9 @@ static void p9_read_work(struct work_struct *work) | ||
1234 | if (m->req->status != REQ_STATUS_ERROR) | ||
1235 | status = REQ_STATUS_RCVD; | ||
1236 | list_del(&m->req->req_list); | ||
1237 | - spin_unlock(&m->client->lock); | ||
1238 | + /* update req->status while holding client->lock */ | ||
1239 | p9_client_cb(m->client, m->req, status); | ||
1240 | + spin_unlock(&m->client->lock); | ||
1241 | m->rc.sdata = NULL; | ||
1242 | m->rc.offset = 0; | ||
1243 | m->rc.capacity = 0; | ||
1244 | diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c | ||
1245 | index da0d3b257459..e73fd647065a 100644 | ||
1246 | --- a/net/9p/trans_virtio.c | ||
1247 | +++ b/net/9p/trans_virtio.c | ||
1248 | @@ -571,7 +571,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) | ||
1249 | chan->vq = virtio_find_single_vq(vdev, req_done, "requests"); | ||
1250 | if (IS_ERR(chan->vq)) { | ||
1251 | err = PTR_ERR(chan->vq); | ||
1252 | - goto out_free_vq; | ||
1253 | + goto out_free_chan; | ||
1254 | } | ||
1255 | chan->vq->vdev->priv = chan; | ||
1256 | spin_lock_init(&chan->lock); | ||
1257 | @@ -624,6 +624,7 @@ out_free_tag: | ||
1258 | kfree(tag); | ||
1259 | out_free_vq: | ||
1260 | vdev->config->del_vqs(vdev); | ||
1261 | +out_free_chan: | ||
1262 | kfree(chan); | ||
1263 | fail: | ||
1264 | return err; | ||
1265 | diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c | ||
1266 | index 504cdae41013..16dea67792e0 100644 | ||
1267 | --- a/net/ipv4/tcp_ipv4.c | ||
1268 | +++ b/net/ipv4/tcp_ipv4.c | ||
1269 | @@ -2440,6 +2440,12 @@ static int __net_init tcp_sk_init(struct net *net) | ||
1270 | if (res) | ||
1271 | goto fail; | ||
1272 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); | ||
1273 | + | ||
1274 | + /* Please enforce IP_DF and IPID==0 for RST and | ||
1275 | + * ACK sent in SYN-RECV and TIME-WAIT state. | ||
1276 | + */ | ||
1277 | + inet_sk(sk)->pmtudisc = IP_PMTUDISC_DO; | ||
1278 | + | ||
1279 | *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk; | ||
1280 | } | ||
1281 | |||
1282 | diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c | ||
1283 | index 830a5645d8c1..a501b45d0334 100644 | ||
1284 | --- a/net/ipv4/tcp_minisocks.c | ||
1285 | +++ b/net/ipv4/tcp_minisocks.c | ||
1286 | @@ -194,8 +194,9 @@ kill: | ||
1287 | inet_twsk_deschedule_put(tw); | ||
1288 | return TCP_TW_SUCCESS; | ||
1289 | } | ||
1290 | + } else { | ||
1291 | + inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN); | ||
1292 | } | ||
1293 | - inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN); | ||
1294 | |||
1295 | if (tmp_opt.saw_tstamp) { | ||
1296 | tcptw->tw_ts_recent = tmp_opt.rcv_tsval; | ||
1297 | diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c | ||
1298 | index 3d063eb37848..f6c50af24a64 100644 | ||
1299 | --- a/net/ipv4/tcp_probe.c | ||
1300 | +++ b/net/ipv4/tcp_probe.c | ||
1301 | @@ -117,7 +117,7 @@ static void jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | ||
1302 | (fwmark > 0 && skb->mark == fwmark)) && | ||
1303 | (full || tp->snd_cwnd != tcp_probe.lastcwnd)) { | ||
1304 | |||
1305 | - spin_lock_bh(&tcp_probe.lock); | ||
1306 | + spin_lock(&tcp_probe.lock); | ||
1307 | /* If log fills, just silently drop */ | ||
1308 | if (tcp_probe_avail() > 1) { | ||
1309 | struct tcp_log *p = tcp_probe.log + tcp_probe.head; | ||
1310 | @@ -157,7 +157,7 @@ static void jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | ||
1311 | tcp_probe.head = (tcp_probe.head + 1) & (bufsize - 1); | ||
1312 | } | ||
1313 | tcp_probe.lastcwnd = tp->snd_cwnd; | ||
1314 | - spin_unlock_bh(&tcp_probe.lock); | ||
1315 | + spin_unlock(&tcp_probe.lock); | ||
1316 | |||
1317 | wake_up(&tcp_probe.wait); | ||
1318 | } | ||
1319 | diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c | ||
1320 | index a5aeeb613fac..3213921cdfee 100644 | ||
1321 | --- a/net/ipv6/ip6_vti.c | ||
1322 | +++ b/net/ipv6/ip6_vti.c | ||
1323 | @@ -481,7 +481,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | ||
1324 | } | ||
1325 | |||
1326 | mtu = dst_mtu(dst); | ||
1327 | - if (!skb->ignore_df && skb->len > mtu) { | ||
1328 | + if (skb->len > mtu) { | ||
1329 | skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); | ||
1330 | |||
1331 | if (skb->protocol == htons(ETH_P_IPV6)) { | ||
1332 | diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c | ||
1333 | index 101ed6c42808..0a78f17006a4 100644 | ||
1334 | --- a/net/irda/af_irda.c | ||
1335 | +++ b/net/irda/af_irda.c | ||
1336 | @@ -774,6 +774,13 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | ||
1337 | return -EINVAL; | ||
1338 | |||
1339 | lock_sock(sk); | ||
1340 | + | ||
1341 | + /* Ensure that the socket is not already bound */ | ||
1342 | + if (self->ias_obj) { | ||
1343 | + err = -EINVAL; | ||
1344 | + goto out; | ||
1345 | + } | ||
1346 | + | ||
1347 | #ifdef CONFIG_IRDA_ULTRA | ||
1348 | /* Special care for Ultra sockets */ | ||
1349 | if ((sk->sk_type == SOCK_DGRAM) && | ||
1350 | @@ -2016,7 +2023,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, | ||
1351 | err = -EINVAL; | ||
1352 | goto out; | ||
1353 | } | ||
1354 | - irias_insert_object(ias_obj); | ||
1355 | + | ||
1356 | + /* Only insert newly allocated objects */ | ||
1357 | + if (free_ias) | ||
1358 | + irias_insert_object(ias_obj); | ||
1359 | + | ||
1360 | kfree(ias_opt); | ||
1361 | break; | ||
1362 | case IRLMP_IAS_DEL: | ||
1363 | diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c | ||
1364 | index e34d3f60fccd..fd186b011a99 100644 | ||
1365 | --- a/net/netfilter/ipvs/ip_vs_core.c | ||
1366 | +++ b/net/netfilter/ipvs/ip_vs_core.c | ||
1367 | @@ -1968,13 +1968,20 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int | ||
1368 | if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) { | ||
1369 | /* the destination server is not available */ | ||
1370 | |||
1371 | - if (sysctl_expire_nodest_conn(ipvs)) { | ||
1372 | + __u32 flags = cp->flags; | ||
1373 | + | ||
1374 | + /* when timer already started, silently drop the packet.*/ | ||
1375 | + if (timer_pending(&cp->timer)) | ||
1376 | + __ip_vs_conn_put(cp); | ||
1377 | + else | ||
1378 | + ip_vs_conn_put(cp); | ||
1379 | + | ||
1380 | + if (sysctl_expire_nodest_conn(ipvs) && | ||
1381 | + !(flags & IP_VS_CONN_F_ONE_PACKET)) { | ||
1382 | /* try to expire the connection immediately */ | ||
1383 | ip_vs_conn_expire_now(cp); | ||
1384 | } | ||
1385 | - /* don't restart its timer, and silently | ||
1386 | - drop the packet. */ | ||
1387 | - __ip_vs_conn_put(cp); | ||
1388 | + | ||
1389 | return NF_DROP; | ||
1390 | } | ||
1391 | |||
1392 | diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c | ||
1393 | index 66b3d6228a15..3d9c4c6397c3 100644 | ||
1394 | --- a/net/rds/ib_frmr.c | ||
1395 | +++ b/net/rds/ib_frmr.c | ||
1396 | @@ -61,6 +61,7 @@ static struct rds_ib_mr *rds_ib_alloc_frmr(struct rds_ib_device *rds_ibdev, | ||
1397 | pool->fmr_attr.max_pages); | ||
1398 | if (IS_ERR(frmr->mr)) { | ||
1399 | pr_warn("RDS/IB: %s failed to allocate MR", __func__); | ||
1400 | + err = PTR_ERR(frmr->mr); | ||
1401 | goto out_no_cigar; | ||
1402 | } | ||
1403 | |||
1404 | diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c | ||
1405 | index 235db2c9bbbb..d2932dc4c83d 100644 | ||
1406 | --- a/net/sched/act_ife.c | ||
1407 | +++ b/net/sched/act_ife.c | ||
1408 | @@ -267,10 +267,8 @@ static int ife_validate_metatype(struct tcf_meta_ops *ops, void *val, int len) | ||
1409 | } | ||
1410 | |||
1411 | /* called when adding new meta information | ||
1412 | - * under ife->tcf_lock for existing action | ||
1413 | */ | ||
1414 | -static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid, | ||
1415 | - void *val, int len, bool exists) | ||
1416 | +static int load_metaops_and_vet(u32 metaid, void *val, int len) | ||
1417 | { | ||
1418 | struct tcf_meta_ops *ops = find_ife_oplist(metaid); | ||
1419 | int ret = 0; | ||
1420 | @@ -278,13 +276,9 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid, | ||
1421 | if (!ops) { | ||
1422 | ret = -ENOENT; | ||
1423 | #ifdef CONFIG_MODULES | ||
1424 | - if (exists) | ||
1425 | - spin_unlock_bh(&ife->tcf_lock); | ||
1426 | rtnl_unlock(); | ||
1427 | request_module("ifemeta%u", metaid); | ||
1428 | rtnl_lock(); | ||
1429 | - if (exists) | ||
1430 | - spin_lock_bh(&ife->tcf_lock); | ||
1431 | ops = find_ife_oplist(metaid); | ||
1432 | #endif | ||
1433 | } | ||
1434 | @@ -301,24 +295,17 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid, | ||
1435 | } | ||
1436 | |||
1437 | /* called when adding new meta information | ||
1438 | - * under ife->tcf_lock for existing action | ||
1439 | */ | ||
1440 | -static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, | ||
1441 | - int len, bool atomic) | ||
1442 | +static int __add_metainfo(const struct tcf_meta_ops *ops, | ||
1443 | + struct tcf_ife_info *ife, u32 metaid, void *metaval, | ||
1444 | + int len, bool atomic, bool exists) | ||
1445 | { | ||
1446 | struct tcf_meta_info *mi = NULL; | ||
1447 | - struct tcf_meta_ops *ops = find_ife_oplist(metaid); | ||
1448 | int ret = 0; | ||
1449 | |||
1450 | - if (!ops) | ||
1451 | - return -ENOENT; | ||
1452 | - | ||
1453 | mi = kzalloc(sizeof(*mi), atomic ? GFP_ATOMIC : GFP_KERNEL); | ||
1454 | - if (!mi) { | ||
1455 | - /*put back what find_ife_oplist took */ | ||
1456 | - module_put(ops->owner); | ||
1457 | + if (!mi) | ||
1458 | return -ENOMEM; | ||
1459 | - } | ||
1460 | |||
1461 | mi->metaid = metaid; | ||
1462 | mi->ops = ops; | ||
1463 | @@ -326,17 +313,49 @@ static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, | ||
1464 | ret = ops->alloc(mi, metaval, atomic ? GFP_ATOMIC : GFP_KERNEL); | ||
1465 | if (ret != 0) { | ||
1466 | kfree(mi); | ||
1467 | - module_put(ops->owner); | ||
1468 | return ret; | ||
1469 | } | ||
1470 | } | ||
1471 | |||
1472 | + if (exists) | ||
1473 | + spin_lock_bh(&ife->tcf_lock); | ||
1474 | list_add_tail(&mi->metalist, &ife->metalist); | ||
1475 | + if (exists) | ||
1476 | + spin_unlock_bh(&ife->tcf_lock); | ||
1477 | + | ||
1478 | + return ret; | ||
1479 | +} | ||
1480 | + | ||
1481 | +static int add_metainfo_and_get_ops(const struct tcf_meta_ops *ops, | ||
1482 | + struct tcf_ife_info *ife, u32 metaid, | ||
1483 | + bool exists) | ||
1484 | +{ | ||
1485 | + int ret; | ||
1486 | + | ||
1487 | + if (!try_module_get(ops->owner)) | ||
1488 | + return -ENOENT; | ||
1489 | + ret = __add_metainfo(ops, ife, metaid, NULL, 0, true, exists); | ||
1490 | + if (ret) | ||
1491 | + module_put(ops->owner); | ||
1492 | + return ret; | ||
1493 | +} | ||
1494 | + | ||
1495 | +static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, | ||
1496 | + int len, bool exists) | ||
1497 | +{ | ||
1498 | + const struct tcf_meta_ops *ops = find_ife_oplist(metaid); | ||
1499 | + int ret; | ||
1500 | |||
1501 | + if (!ops) | ||
1502 | + return -ENOENT; | ||
1503 | + ret = __add_metainfo(ops, ife, metaid, metaval, len, false, exists); | ||
1504 | + if (ret) | ||
1505 | + /*put back what find_ife_oplist took */ | ||
1506 | + module_put(ops->owner); | ||
1507 | return ret; | ||
1508 | } | ||
1509 | |||
1510 | -static int use_all_metadata(struct tcf_ife_info *ife) | ||
1511 | +static int use_all_metadata(struct tcf_ife_info *ife, bool exists) | ||
1512 | { | ||
1513 | struct tcf_meta_ops *o; | ||
1514 | int rc = 0; | ||
1515 | @@ -344,7 +363,7 @@ static int use_all_metadata(struct tcf_ife_info *ife) | ||
1516 | |||
1517 | read_lock(&ife_mod_lock); | ||
1518 | list_for_each_entry(o, &ifeoplist, list) { | ||
1519 | - rc = add_metainfo(ife, o->metaid, NULL, 0, true); | ||
1520 | + rc = add_metainfo_and_get_ops(o, ife, o->metaid, exists); | ||
1521 | if (rc == 0) | ||
1522 | installed += 1; | ||
1523 | } | ||
1524 | @@ -395,7 +414,6 @@ static void _tcf_ife_cleanup(struct tc_action *a, int bind) | ||
1525 | struct tcf_meta_info *e, *n; | ||
1526 | |||
1527 | list_for_each_entry_safe(e, n, &ife->metalist, metalist) { | ||
1528 | - module_put(e->ops->owner); | ||
1529 | list_del(&e->metalist); | ||
1530 | if (e->metaval) { | ||
1531 | if (e->ops->release) | ||
1532 | @@ -403,6 +421,7 @@ static void _tcf_ife_cleanup(struct tc_action *a, int bind) | ||
1533 | else | ||
1534 | kfree(e->metaval); | ||
1535 | } | ||
1536 | + module_put(e->ops->owner); | ||
1537 | kfree(e); | ||
1538 | } | ||
1539 | } | ||
1540 | @@ -416,7 +435,6 @@ static void tcf_ife_cleanup(struct tc_action *a, int bind) | ||
1541 | spin_unlock_bh(&ife->tcf_lock); | ||
1542 | } | ||
1543 | |||
1544 | -/* under ife->tcf_lock for existing action */ | ||
1545 | static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, | ||
1546 | bool exists) | ||
1547 | { | ||
1548 | @@ -430,7 +448,7 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, | ||
1549 | val = nla_data(tb[i]); | ||
1550 | len = nla_len(tb[i]); | ||
1551 | |||
1552 | - rc = load_metaops_and_vet(ife, i, val, len, exists); | ||
1553 | + rc = load_metaops_and_vet(i, val, len); | ||
1554 | if (rc != 0) | ||
1555 | return rc; | ||
1556 | |||
1557 | @@ -510,6 +528,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, | ||
1558 | if (exists) | ||
1559 | spin_lock_bh(&ife->tcf_lock); | ||
1560 | ife->tcf_action = parm->action; | ||
1561 | + if (exists) | ||
1562 | + spin_unlock_bh(&ife->tcf_lock); | ||
1563 | |||
1564 | if (parm->flags & IFE_ENCODE) { | ||
1565 | if (daddr) | ||
1566 | @@ -537,9 +557,6 @@ metadata_parse_err: | ||
1567 | tcf_hash_release(*a, bind); | ||
1568 | if (ret == ACT_P_CREATED) | ||
1569 | _tcf_ife_cleanup(*a, bind); | ||
1570 | - | ||
1571 | - if (exists) | ||
1572 | - spin_unlock_bh(&ife->tcf_lock); | ||
1573 | return err; | ||
1574 | } | ||
1575 | |||
1576 | @@ -553,20 +570,14 @@ metadata_parse_err: | ||
1577 | * as we can. You better have at least one else we are | ||
1578 | * going to bail out | ||
1579 | */ | ||
1580 | - err = use_all_metadata(ife); | ||
1581 | + err = use_all_metadata(ife, exists); | ||
1582 | if (err) { | ||
1583 | if (ret == ACT_P_CREATED) | ||
1584 | _tcf_ife_cleanup(*a, bind); | ||
1585 | - | ||
1586 | - if (exists) | ||
1587 | - spin_unlock_bh(&ife->tcf_lock); | ||
1588 | return err; | ||
1589 | } | ||
1590 | } | ||
1591 | |||
1592 | - if (exists) | ||
1593 | - spin_unlock_bh(&ife->tcf_lock); | ||
1594 | - | ||
1595 | if (ret == ACT_P_CREATED) | ||
1596 | tcf_hash_insert(tn, *a); | ||
1597 | |||
1598 | diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c | ||
1599 | index da574a16e7b3..e377dd5b06a6 100644 | ||
1600 | --- a/net/sched/cls_u32.c | ||
1601 | +++ b/net/sched/cls_u32.c | ||
1602 | @@ -851,6 +851,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | ||
1603 | struct nlattr *opt = tca[TCA_OPTIONS]; | ||
1604 | struct nlattr *tb[TCA_U32_MAX + 1]; | ||
1605 | u32 htid, flags = 0; | ||
1606 | + size_t sel_size; | ||
1607 | int err; | ||
1608 | #ifdef CONFIG_CLS_U32_PERF | ||
1609 | size_t size; | ||
1610 | @@ -967,8 +968,11 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | ||
1611 | return -EINVAL; | ||
1612 | |||
1613 | s = nla_data(tb[TCA_U32_SEL]); | ||
1614 | + sel_size = sizeof(*s) + sizeof(*s->keys) * s->nkeys; | ||
1615 | + if (nla_len(tb[TCA_U32_SEL]) < sel_size) | ||
1616 | + return -EINVAL; | ||
1617 | |||
1618 | - n = kzalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL); | ||
1619 | + n = kzalloc(offsetof(typeof(*n), sel) + sel_size, GFP_KERNEL); | ||
1620 | if (n == NULL) | ||
1621 | return -ENOBUFS; | ||
1622 | |||
1623 | @@ -981,7 +985,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | ||
1624 | } | ||
1625 | #endif | ||
1626 | |||
1627 | - memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); | ||
1628 | + memcpy(&n->sel, s, sel_size); | ||
1629 | RCU_INIT_POINTER(n->ht_up, ht); | ||
1630 | n->handle = handle; | ||
1631 | n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; | ||
1632 | diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c | ||
1633 | index 2fae8b5f1b80..f4b2d69973c3 100644 | ||
1634 | --- a/net/sched/sch_hhf.c | ||
1635 | +++ b/net/sched/sch_hhf.c | ||
1636 | @@ -492,6 +492,9 @@ static void hhf_destroy(struct Qdisc *sch) | ||
1637 | hhf_free(q->hhf_valid_bits[i]); | ||
1638 | } | ||
1639 | |||
1640 | + if (!q->hh_flows) | ||
1641 | + return; | ||
1642 | + | ||
1643 | for (i = 0; i < HH_FLOWS_CNT; i++) { | ||
1644 | struct hh_flow_state *flow, *next; | ||
1645 | struct list_head *head = &q->hh_flows[i]; | ||
1646 | diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c | ||
1647 | index c798d0de8a9d..95fe75d441eb 100644 | ||
1648 | --- a/net/sched/sch_htb.c | ||
1649 | +++ b/net/sched/sch_htb.c | ||
1650 | @@ -1013,6 +1013,9 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | ||
1651 | int err; | ||
1652 | int i; | ||
1653 | |||
1654 | + qdisc_watchdog_init(&q->watchdog, sch); | ||
1655 | + INIT_WORK(&q->work, htb_work_func); | ||
1656 | + | ||
1657 | if (!opt) | ||
1658 | return -EINVAL; | ||
1659 | |||
1660 | @@ -1033,8 +1036,6 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | ||
1661 | for (i = 0; i < TC_HTB_NUMPRIO; i++) | ||
1662 | INIT_LIST_HEAD(q->drops + i); | ||
1663 | |||
1664 | - qdisc_watchdog_init(&q->watchdog, sch); | ||
1665 | - INIT_WORK(&q->work, htb_work_func); | ||
1666 | qdisc_skb_head_init(&q->direct_queue); | ||
1667 | |||
1668 | if (tb[TCA_HTB_DIRECT_QLEN]) | ||
1669 | diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c | ||
1670 | index 9ffbb025b37e..66b6e807b4ec 100644 | ||
1671 | --- a/net/sched/sch_multiq.c | ||
1672 | +++ b/net/sched/sch_multiq.c | ||
1673 | @@ -234,7 +234,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt) | ||
1674 | static int multiq_init(struct Qdisc *sch, struct nlattr *opt) | ||
1675 | { | ||
1676 | struct multiq_sched_data *q = qdisc_priv(sch); | ||
1677 | - int i, err; | ||
1678 | + int i; | ||
1679 | |||
1680 | q->queues = NULL; | ||
1681 | |||
1682 | @@ -249,12 +249,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt) | ||
1683 | for (i = 0; i < q->max_bands; i++) | ||
1684 | q->queues[i] = &noop_qdisc; | ||
1685 | |||
1686 | - err = multiq_tune(sch, opt); | ||
1687 | - | ||
1688 | - if (err) | ||
1689 | - kfree(q->queues); | ||
1690 | - | ||
1691 | - return err; | ||
1692 | + return multiq_tune(sch, opt); | ||
1693 | } | ||
1694 | |||
1695 | static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb) | ||
1696 | diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c | ||
1697 | index e899d9eb76cb..3f87ddb1777d 100644 | ||
1698 | --- a/net/sched/sch_netem.c | ||
1699 | +++ b/net/sched/sch_netem.c | ||
1700 | @@ -937,11 +937,11 @@ static int netem_init(struct Qdisc *sch, struct nlattr *opt) | ||
1701 | struct netem_sched_data *q = qdisc_priv(sch); | ||
1702 | int ret; | ||
1703 | |||
1704 | + qdisc_watchdog_init(&q->watchdog, sch); | ||
1705 | + | ||
1706 | if (!opt) | ||
1707 | return -EINVAL; | ||
1708 | |||
1709 | - qdisc_watchdog_init(&q->watchdog, sch); | ||
1710 | - | ||
1711 | q->loss_model = CLG_RANDOM; | ||
1712 | ret = netem_change(sch, opt); | ||
1713 | if (ret) | ||
1714 | diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c | ||
1715 | index 303355c449ab..b3f7980b0f27 100644 | ||
1716 | --- a/net/sched/sch_tbf.c | ||
1717 | +++ b/net/sched/sch_tbf.c | ||
1718 | @@ -423,12 +423,13 @@ static int tbf_init(struct Qdisc *sch, struct nlattr *opt) | ||
1719 | { | ||
1720 | struct tbf_sched_data *q = qdisc_priv(sch); | ||
1721 | |||
1722 | + qdisc_watchdog_init(&q->watchdog, sch); | ||
1723 | + q->qdisc = &noop_qdisc; | ||
1724 | + | ||
1725 | if (opt == NULL) | ||
1726 | return -EINVAL; | ||
1727 | |||
1728 | q->t_c = ktime_get_ns(); | ||
1729 | - qdisc_watchdog_init(&q->watchdog, sch); | ||
1730 | - q->qdisc = &noop_qdisc; | ||
1731 | |||
1732 | return tbf_change(sch, opt); | ||
1733 | } | ||
1734 | diff --git a/net/sctp/proc.c b/net/sctp/proc.c | ||
1735 | index 206377fe91ec..fd7f23566ed6 100644 | ||
1736 | --- a/net/sctp/proc.c | ||
1737 | +++ b/net/sctp/proc.c | ||
1738 | @@ -337,8 +337,6 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | ||
1739 | } | ||
1740 | |||
1741 | transport = (struct sctp_transport *)v; | ||
1742 | - if (!sctp_transport_hold(transport)) | ||
1743 | - return 0; | ||
1744 | assoc = transport->asoc; | ||
1745 | epb = &assoc->base; | ||
1746 | sk = epb->sk; | ||
1747 | @@ -428,8 +426,6 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | ||
1748 | } | ||
1749 | |||
1750 | transport = (struct sctp_transport *)v; | ||
1751 | - if (!sctp_transport_hold(transport)) | ||
1752 | - return 0; | ||
1753 | assoc = transport->asoc; | ||
1754 | |||
1755 | list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, | ||
1756 | diff --git a/net/sctp/socket.c b/net/sctp/socket.c | ||
1757 | index 78f38056fca6..64d2d9ea2f8c 100644 | ||
1758 | --- a/net/sctp/socket.c | ||
1759 | +++ b/net/sctp/socket.c | ||
1760 | @@ -4476,9 +4476,14 @@ struct sctp_transport *sctp_transport_get_next(struct net *net, | ||
1761 | break; | ||
1762 | } | ||
1763 | |||
1764 | + if (!sctp_transport_hold(t)) | ||
1765 | + continue; | ||
1766 | + | ||
1767 | if (net_eq(sock_net(t->asoc->base.sk), net) && | ||
1768 | t->asoc->peer.primary_path == t) | ||
1769 | break; | ||
1770 | + | ||
1771 | + sctp_transport_put(t); | ||
1772 | } | ||
1773 | |||
1774 | return t; | ||
1775 | @@ -4488,13 +4493,18 @@ struct sctp_transport *sctp_transport_get_idx(struct net *net, | ||
1776 | struct rhashtable_iter *iter, | ||
1777 | int pos) | ||
1778 | { | ||
1779 | - void *obj = SEQ_START_TOKEN; | ||
1780 | + struct sctp_transport *t; | ||
1781 | |||
1782 | - while (pos && (obj = sctp_transport_get_next(net, iter)) && | ||
1783 | - !IS_ERR(obj)) | ||
1784 | - pos--; | ||
1785 | + if (!pos) | ||
1786 | + return SEQ_START_TOKEN; | ||
1787 | |||
1788 | - return obj; | ||
1789 | + while ((t = sctp_transport_get_next(net, iter)) && !IS_ERR(t)) { | ||
1790 | + if (!--pos) | ||
1791 | + break; | ||
1792 | + sctp_transport_put(t); | ||
1793 | + } | ||
1794 | + | ||
1795 | + return t; | ||
1796 | } | ||
1797 | |||
1798 | int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), | ||
1799 | @@ -4556,8 +4566,6 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), | ||
1800 | for (; !IS_ERR_OR_NULL(obj); obj = sctp_transport_get_next(net, &hti)) { | ||
1801 | struct sctp_transport *transport = obj; | ||
1802 | |||
1803 | - if (!sctp_transport_hold(transport)) | ||
1804 | - continue; | ||
1805 | err = cb(transport, p); | ||
1806 | sctp_transport_put(transport); | ||
1807 | if (err) | ||
1808 | diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c | ||
1809 | index 4afd4149a632..bad69e91fea3 100644 | ||
1810 | --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c | ||
1811 | +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | ||
1812 | @@ -169,7 +169,7 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen, | ||
1813 | struct scatterlist sg[1]; | ||
1814 | int err = -1; | ||
1815 | u8 *checksumdata; | ||
1816 | - u8 rc4salt[4]; | ||
1817 | + u8 *rc4salt; | ||
1818 | struct crypto_ahash *md5; | ||
1819 | struct crypto_ahash *hmac_md5; | ||
1820 | struct ahash_request *req; | ||
1821 | @@ -183,14 +183,18 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen, | ||
1822 | return GSS_S_FAILURE; | ||
1823 | } | ||
1824 | |||
1825 | + rc4salt = kmalloc_array(4, sizeof(*rc4salt), GFP_NOFS); | ||
1826 | + if (!rc4salt) | ||
1827 | + return GSS_S_FAILURE; | ||
1828 | + | ||
1829 | if (arcfour_hmac_md5_usage_to_salt(usage, rc4salt)) { | ||
1830 | dprintk("%s: invalid usage value %u\n", __func__, usage); | ||
1831 | - return GSS_S_FAILURE; | ||
1832 | + goto out_free_rc4salt; | ||
1833 | } | ||
1834 | |||
1835 | checksumdata = kmalloc(GSS_KRB5_MAX_CKSUM_LEN, GFP_NOFS); | ||
1836 | if (!checksumdata) | ||
1837 | - return GSS_S_FAILURE; | ||
1838 | + goto out_free_rc4salt; | ||
1839 | |||
1840 | md5 = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC); | ||
1841 | if (IS_ERR(md5)) | ||
1842 | @@ -258,6 +262,8 @@ out_free_md5: | ||
1843 | crypto_free_ahash(md5); | ||
1844 | out_free_cksum: | ||
1845 | kfree(checksumdata); | ||
1846 | +out_free_rc4salt: | ||
1847 | + kfree(rc4salt); | ||
1848 | return err ? GSS_S_FAILURE : 0; | ||
1849 | } | ||
1850 | |||
1851 | diff --git a/scripts/depmod.sh b/scripts/depmod.sh | ||
1852 | index ea1e96921e3b..baedaef53ca0 100755 | ||
1853 | --- a/scripts/depmod.sh | ||
1854 | +++ b/scripts/depmod.sh | ||
1855 | @@ -15,9 +15,9 @@ if ! test -r System.map ; then | ||
1856 | fi | ||
1857 | |||
1858 | if [ -z $(command -v $DEPMOD) ]; then | ||
1859 | - echo "'make modules_install' requires $DEPMOD. Please install it." >&2 | ||
1860 | + echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2 | ||
1861 | echo "This is probably in the kmod package." >&2 | ||
1862 | - exit 1 | ||
1863 | + exit 0 | ||
1864 | fi | ||
1865 | |||
1866 | # older versions of depmod don't support -P <symbol-prefix> | ||
1867 | diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c | ||
1868 | index 238db4ffd30c..88b3dc19bbae 100644 | ||
1869 | --- a/scripts/mod/modpost.c | ||
1870 | +++ b/scripts/mod/modpost.c | ||
1871 | @@ -649,7 +649,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | ||
1872 | if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) | ||
1873 | break; | ||
1874 | if (symname[0] == '.') { | ||
1875 | - char *munged = strdup(symname); | ||
1876 | + char *munged = NOFAIL(strdup(symname)); | ||
1877 | munged[0] = '_'; | ||
1878 | munged[1] = toupper(munged[1]); | ||
1879 | symname = munged; | ||
1880 | @@ -1312,7 +1312,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, | ||
1881 | static char *sec2annotation(const char *s) | ||
1882 | { | ||
1883 | if (match(s, init_exit_sections)) { | ||
1884 | - char *p = malloc(20); | ||
1885 | + char *p = NOFAIL(malloc(20)); | ||
1886 | char *r = p; | ||
1887 | |||
1888 | *p++ = '_'; | ||
1889 | @@ -1332,7 +1332,7 @@ static char *sec2annotation(const char *s) | ||
1890 | strcat(p, " "); | ||
1891 | return r; | ||
1892 | } else { | ||
1893 | - return strdup(""); | ||
1894 | + return NOFAIL(strdup("")); | ||
1895 | } | ||
1896 | } | ||
1897 | |||
1898 | @@ -2033,7 +2033,7 @@ void buf_write(struct buffer *buf, const char *s, int len) | ||
1899 | { | ||
1900 | if (buf->size - buf->pos < len) { | ||
1901 | buf->size += len + SZ; | ||
1902 | - buf->p = realloc(buf->p, buf->size); | ||
1903 | + buf->p = NOFAIL(realloc(buf->p, buf->size)); | ||
1904 | } | ||
1905 | strncpy(buf->p + buf->pos, s, len); | ||
1906 | buf->pos += len; | ||
1907 | diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c | ||
1908 | index 3896523b71e9..f289762cd676 100644 | ||
1909 | --- a/sound/soc/codecs/wm8994.c | ||
1910 | +++ b/sound/soc/codecs/wm8994.c | ||
1911 | @@ -2431,6 +2431,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai, | ||
1912 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2, | ||
1913 | WM8994_OPCLK_ENA, 0); | ||
1914 | } | ||
1915 | + break; | ||
1916 | |||
1917 | default: | ||
1918 | return -EINVAL; | ||
1919 | diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c | ||
1920 | index 1030a6e504bb..de477a3dc968 100644 | ||
1921 | --- a/tools/perf/arch/powerpc/util/sym-handling.c | ||
1922 | +++ b/tools/perf/arch/powerpc/util/sym-handling.c | ||
1923 | @@ -115,8 +115,10 @@ void arch__post_process_probe_trace_events(struct perf_probe_event *pev, | ||
1924 | for (i = 0; i < ntevs; i++) { | ||
1925 | tev = &pev->tevs[i]; | ||
1926 | map__for_each_symbol(map, sym, tmp) { | ||
1927 | - if (map->unmap_ip(map, sym->start) == tev->point.address) | ||
1928 | + if (map->unmap_ip(map, sym->start) == tev->point.address) { | ||
1929 | arch__fix_tev_from_maps(pev, tev, map, sym); | ||
1930 | + break; | ||
1931 | + } | ||
1932 | } | ||
1933 | } | ||
1934 | } | ||
1935 | diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c | ||
1936 | index 66d31de60b9a..9d7166dfad1e 100644 | ||
1937 | --- a/tools/testing/selftests/powerpc/harness.c | ||
1938 | +++ b/tools/testing/selftests/powerpc/harness.c | ||
1939 | @@ -85,13 +85,13 @@ wait: | ||
1940 | return status; | ||
1941 | } | ||
1942 | |||
1943 | -static void alarm_handler(int signum) | ||
1944 | +static void sig_handler(int signum) | ||
1945 | { | ||
1946 | - /* Jut wake us up from waitpid */ | ||
1947 | + /* Just wake us up from waitpid */ | ||
1948 | } | ||
1949 | |||
1950 | -static struct sigaction alarm_action = { | ||
1951 | - .sa_handler = alarm_handler, | ||
1952 | +static struct sigaction sig_action = { | ||
1953 | + .sa_handler = sig_handler, | ||
1954 | }; | ||
1955 | |||
1956 | void test_harness_set_timeout(uint64_t time) | ||
1957 | @@ -106,8 +106,14 @@ int test_harness(int (test_function)(void), char *name) | ||
1958 | test_start(name); | ||
1959 | test_set_git_version(GIT_VERSION); | ||
1960 | |||
1961 | - if (sigaction(SIGALRM, &alarm_action, NULL)) { | ||
1962 | - perror("sigaction"); | ||
1963 | + if (sigaction(SIGINT, &sig_action, NULL)) { | ||
1964 | + perror("sigaction (sigint)"); | ||
1965 | + test_error(name); | ||
1966 | + return 1; | ||
1967 | + } | ||
1968 | + | ||
1969 | + if (sigaction(SIGALRM, &sig_action, NULL)) { | ||
1970 | + perror("sigaction (sigalrm)"); | ||
1971 | test_error(name); | ||
1972 | return 1; | ||
1973 | } |