Contents of /trunk/kernel-alx/patches-4.4/0109-4.4.10-all-fixes.patch
Parent Directory | Revision Log
Revision 2801 -
(show annotations)
(download)
Mon May 30 12:46:08 2016 UTC (8 years, 3 months ago) by niro
File size: 64135 byte(s)
Mon May 30 12:46:08 2016 UTC (8 years, 3 months ago) by niro
File size: 64135 byte(s)
-linux-4.4.10
1 | diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt |
2 | index c2340eeeb97f..c000832a7fb9 100644 |
3 | --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt |
4 | +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt |
5 | @@ -30,6 +30,10 @@ Optional properties: |
6 | - target-supply : regulator for SATA target power |
7 | - phys : reference to the SATA PHY node |
8 | - phy-names : must be "sata-phy" |
9 | +- ports-implemented : Mask that indicates which ports that the HBA supports |
10 | + are available for software to use. Useful if PORTS_IMPL |
11 | + is not programmed by the BIOS, which is true with |
12 | + some embedded SOC's. |
13 | |
14 | Required properties when using sub-nodes: |
15 | - #address-cells : number of cells to encode an address |
16 | diff --git a/MAINTAINERS b/MAINTAINERS |
17 | index 4c3e1d2ac31b..ab65bbecb159 100644 |
18 | --- a/MAINTAINERS |
19 | +++ b/MAINTAINERS |
20 | @@ -4097,8 +4097,8 @@ F: Documentation/efi-stub.txt |
21 | F: arch/ia64/kernel/efi.c |
22 | F: arch/x86/boot/compressed/eboot.[ch] |
23 | F: arch/x86/include/asm/efi.h |
24 | -F: arch/x86/platform/efi/* |
25 | -F: drivers/firmware/efi/* |
26 | +F: arch/x86/platform/efi/ |
27 | +F: drivers/firmware/efi/ |
28 | F: include/linux/efi*.h |
29 | |
30 | EFI VARIABLE FILESYSTEM |
31 | diff --git a/Makefile b/Makefile |
32 | index 0722cdf52152..5b5f462f834c 100644 |
33 | --- a/Makefile |
34 | +++ b/Makefile |
35 | @@ -1,6 +1,6 @@ |
36 | VERSION = 4 |
37 | PATCHLEVEL = 4 |
38 | -SUBLEVEL = 9 |
39 | +SUBLEVEL = 10 |
40 | EXTRAVERSION = |
41 | NAME = Blurry Fish Butt |
42 | |
43 | diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h |
44 | index 27b17adea50d..cb69299a492e 100644 |
45 | --- a/arch/arc/include/asm/io.h |
46 | +++ b/arch/arc/include/asm/io.h |
47 | @@ -13,6 +13,15 @@ |
48 | #include <asm/byteorder.h> |
49 | #include <asm/page.h> |
50 | |
51 | +#ifdef CONFIG_ISA_ARCV2 |
52 | +#include <asm/barrier.h> |
53 | +#define __iormb() rmb() |
54 | +#define __iowmb() wmb() |
55 | +#else |
56 | +#define __iormb() do { } while (0) |
57 | +#define __iowmb() do { } while (0) |
58 | +#endif |
59 | + |
60 | extern void __iomem *ioremap(unsigned long physaddr, unsigned long size); |
61 | extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, |
62 | unsigned long flags); |
63 | @@ -22,6 +31,15 @@ extern void iounmap(const void __iomem *addr); |
64 | #define ioremap_wc(phy, sz) ioremap(phy, sz) |
65 | #define ioremap_wt(phy, sz) ioremap(phy, sz) |
66 | |
67 | +/* |
68 | + * io{read,write}{16,32}be() macros |
69 | + */ |
70 | +#define ioread16be(p) ({ u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; }) |
71 | +#define ioread32be(p) ({ u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; }) |
72 | + |
73 | +#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); }) |
74 | +#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); }) |
75 | + |
76 | /* Change struct page to physical address */ |
77 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
78 | |
79 | @@ -99,15 +117,6 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr) |
80 | |
81 | } |
82 | |
83 | -#ifdef CONFIG_ISA_ARCV2 |
84 | -#include <asm/barrier.h> |
85 | -#define __iormb() rmb() |
86 | -#define __iowmb() wmb() |
87 | -#else |
88 | -#define __iormb() do { } while (0) |
89 | -#define __iowmb() do { } while (0) |
90 | -#endif |
91 | - |
92 | /* |
93 | * MMIO can also get buffered/optimized in micro-arch, so barriers needed |
94 | * Based on ARM model for the typical use case |
95 | diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c |
96 | index 47905a50e075..318394ed5c7a 100644 |
97 | --- a/arch/arm/mach-cns3xxx/pcie.c |
98 | +++ b/arch/arm/mach-cns3xxx/pcie.c |
99 | @@ -220,13 +220,13 @@ static void cns3xxx_write_config(struct cns3xxx_pcie *cnspci, |
100 | u32 mask = (0x1ull << (size * 8)) - 1; |
101 | int shift = (where % 4) * 8; |
102 | |
103 | - v = readl_relaxed(base + (where & 0xffc)); |
104 | + v = readl_relaxed(base); |
105 | |
106 | v &= ~(mask << shift); |
107 | v |= (val & mask) << shift; |
108 | |
109 | - writel_relaxed(v, base + (where & 0xffc)); |
110 | - readl_relaxed(base + (where & 0xffc)); |
111 | + writel_relaxed(v, base); |
112 | + readl_relaxed(base); |
113 | } |
114 | |
115 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) |
116 | diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c |
117 | index 7c21760f590f..875a2bab64f6 100644 |
118 | --- a/arch/arm/mach-exynos/pm_domains.c |
119 | +++ b/arch/arm/mach-exynos/pm_domains.c |
120 | @@ -92,7 +92,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) |
121 | if (IS_ERR(pd->clk[i])) |
122 | break; |
123 | |
124 | - if (IS_ERR(pd->clk[i])) |
125 | + if (IS_ERR(pd->pclk[i])) |
126 | continue; /* Skip on first power up */ |
127 | if (clk_set_parent(pd->clk[i], pd->pclk[i])) |
128 | pr_err("%s: error setting parent to clock%d\n", |
129 | diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S |
130 | index 5d94b7a2fb10..c160fa3007e9 100644 |
131 | --- a/arch/arm/mach-socfpga/headsmp.S |
132 | +++ b/arch/arm/mach-socfpga/headsmp.S |
133 | @@ -13,6 +13,7 @@ |
134 | #include <asm/assembler.h> |
135 | |
136 | .arch armv7-a |
137 | + .arm |
138 | |
139 | ENTRY(secondary_trampoline) |
140 | /* CPU1 will always fetch from 0x0 when it is brought out of reset. |
141 | diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h |
142 | index e4396a7d0f7c..4afe66aa1400 100644 |
143 | --- a/arch/powerpc/include/asm/word-at-a-time.h |
144 | +++ b/arch/powerpc/include/asm/word-at-a-time.h |
145 | @@ -82,7 +82,7 @@ static inline unsigned long create_zero_mask(unsigned long bits) |
146 | "andc %1,%1,%2\n\t" |
147 | "popcntd %0,%1" |
148 | : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask) |
149 | - : "r" (bits)); |
150 | + : "b" (bits)); |
151 | |
152 | return leading_zero_bits; |
153 | } |
154 | diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
155 | index ef2ad2d682da..646bf4d222c1 100644 |
156 | --- a/arch/powerpc/kernel/process.c |
157 | +++ b/arch/powerpc/kernel/process.c |
158 | @@ -569,24 +569,6 @@ static void tm_reclaim_thread(struct thread_struct *thr, |
159 | if (!MSR_TM_SUSPENDED(mfmsr())) |
160 | return; |
161 | |
162 | - /* |
163 | - * Use the current MSR TM suspended bit to track if we have |
164 | - * checkpointed state outstanding. |
165 | - * On signal delivery, we'd normally reclaim the checkpointed |
166 | - * state to obtain stack pointer (see:get_tm_stackpointer()). |
167 | - * This will then directly return to userspace without going |
168 | - * through __switch_to(). However, if the stack frame is bad, |
169 | - * we need to exit this thread which calls __switch_to() which |
170 | - * will again attempt to reclaim the already saved tm state. |
171 | - * Hence we need to check that we've not already reclaimed |
172 | - * this state. |
173 | - * We do this using the current MSR, rather tracking it in |
174 | - * some specific thread_struct bit, as it has the additional |
175 | - * benifit of checking for a potential TM bad thing exception. |
176 | - */ |
177 | - if (!MSR_TM_SUSPENDED(mfmsr())) |
178 | - return; |
179 | - |
180 | tm_reclaim(thr, thr->regs->msr, cause); |
181 | |
182 | /* Having done the reclaim, we now have the checkpointed |
183 | diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
184 | index 2c5aaf8c2e2f..05538582a809 100644 |
185 | --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c |
186 | +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
187 | @@ -385,6 +385,9 @@ static void intel_thermal_interrupt(void) |
188 | { |
189 | __u64 msr_val; |
190 | |
191 | + if (static_cpu_has(X86_FEATURE_HWP)) |
192 | + wrmsrl_safe(MSR_HWP_STATUS, 0); |
193 | + |
194 | rdmsrl(MSR_IA32_THERM_STATUS, msr_val); |
195 | |
196 | /* Check for violation of core thermal thresholds*/ |
197 | diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c |
198 | index b285d4e8c68e..5da924bbf0a0 100644 |
199 | --- a/arch/x86/kernel/sysfb_efi.c |
200 | +++ b/arch/x86/kernel/sysfb_efi.c |
201 | @@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id) |
202 | continue; |
203 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
204 | resource_size_t start, end; |
205 | + unsigned long flags; |
206 | + |
207 | + flags = pci_resource_flags(dev, i); |
208 | + if (!(flags & IORESOURCE_MEM)) |
209 | + continue; |
210 | + |
211 | + if (flags & IORESOURCE_UNSET) |
212 | + continue; |
213 | + |
214 | + if (pci_resource_len(dev, i) == 0) |
215 | + continue; |
216 | |
217 | start = pci_resource_start(dev, i); |
218 | - if (start == 0) |
219 | - break; |
220 | end = pci_resource_end(dev, i); |
221 | if (screen_info.lfb_base >= start && |
222 | screen_info.lfb_base < end) { |
223 | found_bar = 1; |
224 | + break; |
225 | } |
226 | } |
227 | } |
228 | diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c |
229 | index 92ae6acac8a7..6aa0f4d9eea6 100644 |
230 | --- a/arch/x86/kernel/tsc_msr.c |
231 | +++ b/arch/x86/kernel/tsc_msr.c |
232 | @@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void) |
233 | |
234 | if (freq_desc_tables[cpu_index].msr_plat) { |
235 | rdmsr(MSR_PLATFORM_INFO, lo, hi); |
236 | - ratio = (lo >> 8) & 0x1f; |
237 | + ratio = (lo >> 8) & 0xff; |
238 | } else { |
239 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); |
240 | ratio = (hi >> 8) & 0x1f; |
241 | diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c |
242 | index 6979186dbd4b..9f77943653fb 100644 |
243 | --- a/drivers/acpi/acpi_processor.c |
244 | +++ b/drivers/acpi/acpi_processor.c |
245 | @@ -491,6 +491,58 @@ static void acpi_processor_remove(struct acpi_device *device) |
246 | } |
247 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
248 | |
249 | +#ifdef CONFIG_X86 |
250 | +static bool acpi_hwp_native_thermal_lvt_set; |
251 | +static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle, |
252 | + u32 lvl, |
253 | + void *context, |
254 | + void **rv) |
255 | +{ |
256 | + u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953"; |
257 | + u32 capbuf[2]; |
258 | + struct acpi_osc_context osc_context = { |
259 | + .uuid_str = sb_uuid_str, |
260 | + .rev = 1, |
261 | + .cap.length = 8, |
262 | + .cap.pointer = capbuf, |
263 | + }; |
264 | + |
265 | + if (acpi_hwp_native_thermal_lvt_set) |
266 | + return AE_CTRL_TERMINATE; |
267 | + |
268 | + capbuf[0] = 0x0000; |
269 | + capbuf[1] = 0x1000; /* set bit 12 */ |
270 | + |
271 | + if (ACPI_SUCCESS(acpi_run_osc(handle, &osc_context))) { |
272 | + if (osc_context.ret.pointer && osc_context.ret.length > 1) { |
273 | + u32 *capbuf_ret = osc_context.ret.pointer; |
274 | + |
275 | + if (capbuf_ret[1] & 0x1000) { |
276 | + acpi_handle_info(handle, |
277 | + "_OSC native thermal LVT Acked\n"); |
278 | + acpi_hwp_native_thermal_lvt_set = true; |
279 | + } |
280 | + } |
281 | + kfree(osc_context.ret.pointer); |
282 | + } |
283 | + |
284 | + return AE_OK; |
285 | +} |
286 | + |
287 | +void __init acpi_early_processor_osc(void) |
288 | +{ |
289 | + if (boot_cpu_has(X86_FEATURE_HWP)) { |
290 | + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
291 | + ACPI_UINT32_MAX, |
292 | + acpi_hwp_native_thermal_lvt_osc, |
293 | + NULL, NULL, NULL); |
294 | + acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, |
295 | + acpi_hwp_native_thermal_lvt_osc, |
296 | + NULL, NULL); |
297 | + } |
298 | +} |
299 | +#endif |
300 | + |
301 | /* |
302 | * The following ACPI IDs are known to be suitable for representing as |
303 | * processor devices. |
304 | diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c |
305 | index bc32f3194afe..28c50c6b5f45 100644 |
306 | --- a/drivers/acpi/acpica/dsmethod.c |
307 | +++ b/drivers/acpi/acpica/dsmethod.c |
308 | @@ -417,6 +417,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, |
309 | obj_desc->method.mutex->mutex. |
310 | original_sync_level = |
311 | obj_desc->method.mutex->mutex.sync_level; |
312 | + |
313 | + obj_desc->method.mutex->mutex.thread_id = |
314 | + acpi_os_get_thread_id(); |
315 | } |
316 | } |
317 | |
318 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
319 | index a212cefae524..ca4f28432d87 100644 |
320 | --- a/drivers/acpi/bus.c |
321 | +++ b/drivers/acpi/bus.c |
322 | @@ -1004,6 +1004,9 @@ static int __init acpi_bus_init(void) |
323 | goto error1; |
324 | } |
325 | |
326 | + /* Set capability bits for _OSC under processor scope */ |
327 | + acpi_early_processor_osc(); |
328 | + |
329 | /* |
330 | * _OSC method may exist in module level code, |
331 | * so it must be run after ACPI_FULL_INITIALIZATION |
332 | diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h |
333 | index 11d87bf67e73..0f3f41c13b38 100644 |
334 | --- a/drivers/acpi/internal.h |
335 | +++ b/drivers/acpi/internal.h |
336 | @@ -130,6 +130,12 @@ void acpi_early_processor_set_pdc(void); |
337 | static inline void acpi_early_processor_set_pdc(void) {} |
338 | #endif |
339 | |
340 | +#ifdef CONFIG_X86 |
341 | +void acpi_early_processor_osc(void); |
342 | +#else |
343 | +static inline void acpi_early_processor_osc(void) {} |
344 | +#endif |
345 | + |
346 | /* -------------------------------------------------------------------------- |
347 | Embedded Controller |
348 | -------------------------------------------------------------------------- */ |
349 | diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c |
350 | index 04975b851c23..639adb1f8abd 100644 |
351 | --- a/drivers/ata/ahci_platform.c |
352 | +++ b/drivers/ata/ahci_platform.c |
353 | @@ -51,6 +51,9 @@ static int ahci_probe(struct platform_device *pdev) |
354 | if (rc) |
355 | return rc; |
356 | |
357 | + of_property_read_u32(dev->of_node, |
358 | + "ports-implemented", &hpriv->force_port_map); |
359 | + |
360 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) |
361 | hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; |
362 | |
363 | diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c |
364 | index e2c6d9e0c5ac..e916bff6cee8 100644 |
365 | --- a/drivers/ata/ahci_xgene.c |
366 | +++ b/drivers/ata/ahci_xgene.c |
367 | @@ -739,9 +739,9 @@ static int xgene_ahci_probe(struct platform_device *pdev) |
368 | dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n", |
369 | __func__); |
370 | version = XGENE_AHCI_V1; |
371 | - } |
372 | - if (info->valid & ACPI_VALID_CID) |
373 | + } else if (info->valid & ACPI_VALID_CID) { |
374 | version = XGENE_AHCI_V2; |
375 | + } |
376 | } |
377 | } |
378 | #endif |
379 | diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
380 | index 998c6a85ad89..9628fa131757 100644 |
381 | --- a/drivers/ata/libahci.c |
382 | +++ b/drivers/ata/libahci.c |
383 | @@ -467,6 +467,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) |
384 | dev_info(dev, "forcing port_map 0x%x -> 0x%x\n", |
385 | port_map, hpriv->force_port_map); |
386 | port_map = hpriv->force_port_map; |
387 | + hpriv->saved_port_map = port_map; |
388 | } |
389 | |
390 | if (hpriv->mask_port_map) { |
391 | diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
392 | index 93b3f99b6865..8f1ce6d57a08 100644 |
393 | --- a/drivers/block/nbd.c |
394 | +++ b/drivers/block/nbd.c |
395 | @@ -618,8 +618,8 @@ static void nbd_request_handler(struct request_queue *q) |
396 | req, req->cmd_type); |
397 | |
398 | if (unlikely(!nbd->sock)) { |
399 | - dev_err(disk_to_dev(nbd->disk), |
400 | - "Attempted send on closed socket\n"); |
401 | + dev_err_ratelimited(disk_to_dev(nbd->disk), |
402 | + "Attempted send on closed socket\n"); |
403 | req->errors++; |
404 | nbd_end_request(nbd, req); |
405 | spin_lock_irq(q->queue_lock); |
406 | diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c |
407 | index 3ace102a2a0a..bbf206e3da0d 100644 |
408 | --- a/drivers/clk/clk-divider.c |
409 | +++ b/drivers/clk/clk-divider.c |
410 | @@ -422,6 +422,12 @@ const struct clk_ops clk_divider_ops = { |
411 | }; |
412 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
413 | |
414 | +const struct clk_ops clk_divider_ro_ops = { |
415 | + .recalc_rate = clk_divider_recalc_rate, |
416 | + .round_rate = clk_divider_round_rate, |
417 | +}; |
418 | +EXPORT_SYMBOL_GPL(clk_divider_ro_ops); |
419 | + |
420 | static struct clk *_register_divider(struct device *dev, const char *name, |
421 | const char *parent_name, unsigned long flags, |
422 | void __iomem *reg, u8 shift, u8 width, |
423 | @@ -445,7 +451,10 @@ static struct clk *_register_divider(struct device *dev, const char *name, |
424 | return ERR_PTR(-ENOMEM); |
425 | |
426 | init.name = name; |
427 | - init.ops = &clk_divider_ops; |
428 | + if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) |
429 | + init.ops = &clk_divider_ro_ops; |
430 | + else |
431 | + init.ops = &clk_divider_ops; |
432 | init.flags = flags | CLK_IS_BASIC; |
433 | init.parent_names = (parent_name ? &parent_name: NULL); |
434 | init.num_parents = (parent_name ? 1 : 0); |
435 | diff --git a/drivers/clk/meson/clkc.c b/drivers/clk/meson/clkc.c |
436 | index c83ae1367abc..d920d410b51d 100644 |
437 | --- a/drivers/clk/meson/clkc.c |
438 | +++ b/drivers/clk/meson/clkc.c |
439 | @@ -198,7 +198,7 @@ meson_clk_register_fixed_rate(const struct clk_conf *clk_conf, |
440 | } |
441 | |
442 | void __init meson_clk_register_clks(const struct clk_conf *clk_confs, |
443 | - size_t nr_confs, |
444 | + unsigned int nr_confs, |
445 | void __iomem *clk_base) |
446 | { |
447 | unsigned int i; |
448 | diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c |
449 | index 13aabbb3acbe..558da89555af 100644 |
450 | --- a/drivers/clk/nxp/clk-lpc18xx-ccu.c |
451 | +++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c |
452 | @@ -222,7 +222,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran |
453 | div->width = 1; |
454 | |
455 | div_hw = &div->hw; |
456 | - div_ops = &clk_divider_ops; |
457 | + div_ops = &clk_divider_ro_ops; |
458 | } |
459 | |
460 | branch->gate.reg = branch->offset + reg_base; |
461 | diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c |
462 | index 66c18bc97857..bdc4b2d07a23 100644 |
463 | --- a/drivers/clk/qcom/gcc-msm8960.c |
464 | +++ b/drivers/clk/qcom/gcc-msm8960.c |
465 | @@ -2753,7 +2753,7 @@ static struct clk_rcg ce3_src = { |
466 | }, |
467 | .freq_tbl = clk_tbl_ce3, |
468 | .clkr = { |
469 | - .enable_reg = 0x2c08, |
470 | + .enable_reg = 0x36c0, |
471 | .enable_mask = BIT(7), |
472 | .hw.init = &(struct clk_init_data){ |
473 | .name = "ce3_src", |
474 | @@ -2769,7 +2769,7 @@ static struct clk_branch ce3_core_clk = { |
475 | .halt_reg = 0x2fdc, |
476 | .halt_bit = 5, |
477 | .clkr = { |
478 | - .enable_reg = 0x36c4, |
479 | + .enable_reg = 0x36cc, |
480 | .enable_mask = BIT(4), |
481 | .hw.init = &(struct clk_init_data){ |
482 | .name = "ce3_core_clk", |
483 | diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c |
484 | index be6c7fd8315d..9b6c8188efac 100644 |
485 | --- a/drivers/clk/rockchip/clk.c |
486 | +++ b/drivers/clk/rockchip/clk.c |
487 | @@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
488 | if (gate_offset >= 0) { |
489 | gate = kzalloc(sizeof(*gate), GFP_KERNEL); |
490 | if (!gate) |
491 | - return ERR_PTR(-ENOMEM); |
492 | + goto err_gate; |
493 | |
494 | gate->flags = gate_flags; |
495 | gate->reg = base + gate_offset; |
496 | @@ -82,7 +82,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
497 | if (div_width > 0) { |
498 | div = kzalloc(sizeof(*div), GFP_KERNEL); |
499 | if (!div) |
500 | - return ERR_PTR(-ENOMEM); |
501 | + goto err_div; |
502 | |
503 | div->flags = div_flags; |
504 | div->reg = base + muxdiv_offset; |
505 | @@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
506 | div->width = div_width; |
507 | div->lock = lock; |
508 | div->table = div_table; |
509 | - div_ops = &clk_divider_ops; |
510 | + div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) |
511 | + ? &clk_divider_ro_ops |
512 | + : &clk_divider_ops; |
513 | } |
514 | |
515 | clk = clk_register_composite(NULL, name, parent_names, num_parents, |
516 | @@ -100,6 +102,11 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
517 | flags); |
518 | |
519 | return clk; |
520 | +err_div: |
521 | + kfree(gate); |
522 | +err_gate: |
523 | + kfree(mux); |
524 | + return ERR_PTR(-ENOMEM); |
525 | } |
526 | |
527 | static struct clk *rockchip_clk_register_frac_branch(const char *name, |
528 | diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c |
529 | index a1cdef6b0f90..897c36c1754a 100644 |
530 | --- a/drivers/clk/versatile/clk-sp810.c |
531 | +++ b/drivers/clk/versatile/clk-sp810.c |
532 | @@ -92,6 +92,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
533 | int num = ARRAY_SIZE(parent_names); |
534 | char name[12]; |
535 | struct clk_init_data init; |
536 | + static int instance; |
537 | int i; |
538 | bool deprecated; |
539 | |
540 | @@ -118,7 +119,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
541 | deprecated = !of_find_property(node, "assigned-clock-parents", NULL); |
542 | |
543 | for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) { |
544 | - snprintf(name, ARRAY_SIZE(name), "timerclken%d", i); |
545 | + snprintf(name, sizeof(name), "sp810_%d_%d", instance, i); |
546 | |
547 | sp810->timerclken[i].sp810 = sp810; |
548 | sp810->timerclken[i].channel = i; |
549 | @@ -139,5 +140,6 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
550 | } |
551 | |
552 | of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810); |
553 | + instance++; |
554 | } |
555 | CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup); |
556 | diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c |
557 | index 545069d5fdfb..e342565e8715 100644 |
558 | --- a/drivers/cpuidle/cpuidle-arm.c |
559 | +++ b/drivers/cpuidle/cpuidle-arm.c |
560 | @@ -50,7 +50,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, |
561 | * call the CPU ops suspend protocol with idle index as a |
562 | * parameter. |
563 | */ |
564 | - arm_cpuidle_suspend(idx); |
565 | + ret = arm_cpuidle_suspend(idx); |
566 | |
567 | cpu_pm_exit(); |
568 | } |
569 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
570 | index b8fbbd7699e4..73628c7599e7 100644 |
571 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
572 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
573 | @@ -540,6 +540,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, |
574 | if (!metadata_size) { |
575 | if (bo->metadata_size) { |
576 | kfree(bo->metadata); |
577 | + bo->metadata = NULL; |
578 | bo->metadata_size = 0; |
579 | } |
580 | return 0; |
581 | diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
582 | index 1e0bba29e167..1cd6de575305 100644 |
583 | --- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
584 | +++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
585 | @@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder, |
586 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) |
587 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; |
588 | |
589 | + /* vertical FP must be at least 1 */ |
590 | + if (mode->crtc_vsync_start == mode->crtc_vdisplay) |
591 | + adjusted_mode->crtc_vsync_start++; |
592 | + |
593 | /* get the native mode for scaling */ |
594 | if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) |
595 | amdgpu_panel_mode_fixup(encoder, adjusted_mode); |
596 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
597 | index bc7b8faba84d..7e461dca564c 100644 |
598 | --- a/drivers/gpu/drm/i915/i915_reg.h |
599 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
600 | @@ -2838,7 +2838,14 @@ enum skl_disp_power_wells { |
601 | #define GEN6_RP_STATE_CAP (MCHBAR_MIRROR_BASE_SNB + 0x5998) |
602 | #define BXT_RP_STATE_CAP 0x138170 |
603 | |
604 | -#define INTERVAL_1_28_US(us) (((us) * 100) >> 7) |
605 | +/* |
606 | + * Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS |
607 | + * 8300) freezing up around GPU hangs. Looks as if even |
608 | + * scheduling/timer interrupts start misbehaving if the RPS |
609 | + * EI/thresholds are "bad", leading to a very sluggish or even |
610 | + * frozen machine. |
611 | + */ |
612 | +#define INTERVAL_1_28_US(us) roundup(((us) * 100) >> 7, 25) |
613 | #define INTERVAL_1_33_US(us) (((us) * 3) >> 2) |
614 | #define INTERVAL_0_833_US(us) (((us) * 6) / 5) |
615 | #define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \ |
616 | diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c |
617 | index 9e530a739354..fc28c512ece3 100644 |
618 | --- a/drivers/gpu/drm/i915/intel_csr.c |
619 | +++ b/drivers/gpu/drm/i915/intel_csr.c |
620 | @@ -180,7 +180,8 @@ struct stepping_info { |
621 | static const struct stepping_info skl_stepping_info[] = { |
622 | {'A', '0'}, {'B', '0'}, {'C', '0'}, |
623 | {'D', '0'}, {'E', '0'}, {'F', '0'}, |
624 | - {'G', '0'}, {'H', '0'}, {'I', '0'} |
625 | + {'G', '0'}, {'H', '0'}, {'I', '0'}, |
626 | + {'J', '0'}, {'K', '0'} |
627 | }; |
628 | |
629 | static struct stepping_info bxt_stepping_info[] = { |
630 | diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
631 | index 7e6158b889da..3c6b07683bd9 100644 |
632 | --- a/drivers/gpu/drm/i915/intel_ddi.c |
633 | +++ b/drivers/gpu/drm/i915/intel_ddi.c |
634 | @@ -464,9 +464,17 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, |
635 | } else if (IS_BROADWELL(dev)) { |
636 | ddi_translations_fdi = bdw_ddi_translations_fdi; |
637 | ddi_translations_dp = bdw_ddi_translations_dp; |
638 | - ddi_translations_edp = bdw_ddi_translations_edp; |
639 | + |
640 | + if (dev_priv->edp_low_vswing) { |
641 | + ddi_translations_edp = bdw_ddi_translations_edp; |
642 | + n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp); |
643 | + } else { |
644 | + ddi_translations_edp = bdw_ddi_translations_dp; |
645 | + n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_dp); |
646 | + } |
647 | + |
648 | ddi_translations_hdmi = bdw_ddi_translations_hdmi; |
649 | - n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp); |
650 | + |
651 | n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp); |
652 | n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi); |
653 | hdmi_default_entry = 7; |
654 | @@ -3188,12 +3196,6 @@ void intel_ddi_get_config(struct intel_encoder *encoder, |
655 | intel_ddi_clock_get(encoder, pipe_config); |
656 | } |
657 | |
658 | -static void intel_ddi_destroy(struct drm_encoder *encoder) |
659 | -{ |
660 | - /* HDMI has nothing special to destroy, so we can go with this. */ |
661 | - intel_dp_encoder_destroy(encoder); |
662 | -} |
663 | - |
664 | static bool intel_ddi_compute_config(struct intel_encoder *encoder, |
665 | struct intel_crtc_state *pipe_config) |
666 | { |
667 | @@ -3212,7 +3214,8 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder, |
668 | } |
669 | |
670 | static const struct drm_encoder_funcs intel_ddi_funcs = { |
671 | - .destroy = intel_ddi_destroy, |
672 | + .reset = intel_dp_encoder_reset, |
673 | + .destroy = intel_dp_encoder_destroy, |
674 | }; |
675 | |
676 | static struct intel_connector * |
677 | @@ -3284,6 +3287,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) |
678 | intel_encoder->post_disable = intel_ddi_post_disable; |
679 | intel_encoder->get_hw_state = intel_ddi_get_hw_state; |
680 | intel_encoder->get_config = intel_ddi_get_config; |
681 | + intel_encoder->suspend = intel_dp_encoder_suspend; |
682 | |
683 | intel_dig_port->port = port; |
684 | intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) & |
685 | diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
686 | index 78b8ec84d576..e55a82a99e7f 100644 |
687 | --- a/drivers/gpu/drm/i915/intel_dp.c |
688 | +++ b/drivers/gpu/drm/i915/intel_dp.c |
689 | @@ -5035,7 +5035,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) |
690 | kfree(intel_dig_port); |
691 | } |
692 | |
693 | -static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) |
694 | +void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) |
695 | { |
696 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); |
697 | |
698 | @@ -5077,7 +5077,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) |
699 | edp_panel_vdd_schedule_off(intel_dp); |
700 | } |
701 | |
702 | -static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
703 | +void intel_dp_encoder_reset(struct drm_encoder *encoder) |
704 | { |
705 | struct intel_dp *intel_dp; |
706 | |
707 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
708 | index 0d00f07b7163..f34a219ec5c4 100644 |
709 | --- a/drivers/gpu/drm/i915/intel_drv.h |
710 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
711 | @@ -1204,6 +1204,8 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp, |
712 | void intel_dp_start_link_train(struct intel_dp *intel_dp); |
713 | void intel_dp_stop_link_train(struct intel_dp *intel_dp); |
714 | void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); |
715 | +void intel_dp_encoder_reset(struct drm_encoder *encoder); |
716 | +void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); |
717 | void intel_dp_encoder_destroy(struct drm_encoder *encoder); |
718 | int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc); |
719 | bool intel_dp_compute_config(struct intel_encoder *encoder, |
720 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c |
721 | index e6c035b0fc1c..4b8ed9f2dabc 100644 |
722 | --- a/drivers/gpu/drm/i915/intel_hdmi.c |
723 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c |
724 | @@ -1388,8 +1388,16 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) |
725 | hdmi_to_dig_port(intel_hdmi)); |
726 | } |
727 | |
728 | - if (!live_status) |
729 | - DRM_DEBUG_KMS("Live status not up!"); |
730 | + if (!live_status) { |
731 | + DRM_DEBUG_KMS("HDMI live status down\n"); |
732 | + /* |
733 | + * Live status register is not reliable on all intel platforms. |
734 | + * So consider live_status only for certain platforms, for |
735 | + * others, read EDID to determine presence of sink. |
736 | + */ |
737 | + if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv)) |
738 | + live_status = true; |
739 | + } |
740 | |
741 | intel_hdmi_unset_edid(connector); |
742 | |
743 | diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
744 | index adf74f4366bb..0b04b9282f56 100644 |
745 | --- a/drivers/gpu/drm/radeon/atombios_encoders.c |
746 | +++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
747 | @@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, |
748 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) |
749 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; |
750 | |
751 | + /* vertical FP must be at least 1 */ |
752 | + if (mode->crtc_vsync_start == mode->crtc_vdisplay) |
753 | + adjusted_mode->crtc_vsync_start++; |
754 | + |
755 | /* get the native mode for scaling */ |
756 | if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { |
757 | radeon_panel_mode_fixup(encoder, adjusted_mode); |
758 | diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c |
759 | index a0e28f3a278d..0585fd2031dd 100644 |
760 | --- a/drivers/gpu/ipu-v3/ipu-common.c |
761 | +++ b/drivers/gpu/ipu-v3/ipu-common.c |
762 | @@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
763 | goto err_register; |
764 | } |
765 | |
766 | - pdev->dev.of_node = of_node; |
767 | pdev->dev.parent = dev; |
768 | |
769 | ret = platform_device_add_data(pdev, ®->pdata, |
770 | @@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
771 | platform_device_put(pdev); |
772 | goto err_register; |
773 | } |
774 | + |
775 | + /* |
776 | + * Set of_node only after calling platform_device_add. Otherwise |
777 | + * the platform:imx-ipuv3-crtc modalias won't be used. |
778 | + */ |
779 | + pdev->dev.of_node = of_node; |
780 | } |
781 | |
782 | return 0; |
783 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
784 | index 8b78a7f1f779..909ab0176ef2 100644 |
785 | --- a/drivers/hid/hid-ids.h |
786 | +++ b/drivers/hid/hid-ids.h |
787 | @@ -255,6 +255,7 @@ |
788 | #define USB_DEVICE_ID_CORSAIR_K90 0x1b02 |
789 | |
790 | #define USB_VENDOR_ID_CREATIVELABS 0x041e |
791 | +#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c |
792 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 |
793 | |
794 | #define USB_VENDOR_ID_CVTOUCH 0x1ff7 |
795 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c |
796 | index 7dd0953cd70f..dc8e6adf95a4 100644 |
797 | --- a/drivers/hid/usbhid/hid-quirks.c |
798 | +++ b/drivers/hid/usbhid/hid-quirks.c |
799 | @@ -70,6 +70,7 @@ static const struct hid_blacklist { |
800 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, |
801 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
802 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
803 | + { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, |
804 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
805 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
806 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, |
807 | diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
808 | index 3c0f47ac8e53..5c02d7bbc7f2 100644 |
809 | --- a/drivers/hid/wacom_wac.c |
810 | +++ b/drivers/hid/wacom_wac.c |
811 | @@ -3449,6 +3449,10 @@ static const struct wacom_features wacom_features_0x33E = |
812 | { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, |
813 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
814 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
815 | +static const struct wacom_features wacom_features_0x343 = |
816 | + { "Wacom DTK1651", 34616, 19559, 1023, 0, |
817 | + DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
818 | + WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
819 | |
820 | static const struct wacom_features wacom_features_HID_ANY_ID = |
821 | { "Wacom HID", .type = HID_GENERIC }; |
822 | @@ -3614,6 +3618,7 @@ const struct hid_device_id wacom_ids[] = { |
823 | { USB_DEVICE_WACOM(0x33C) }, |
824 | { USB_DEVICE_WACOM(0x33D) }, |
825 | { USB_DEVICE_WACOM(0x33E) }, |
826 | + { USB_DEVICE_WACOM(0x343) }, |
827 | { USB_DEVICE_WACOM(0x4001) }, |
828 | { USB_DEVICE_WACOM(0x4004) }, |
829 | { USB_DEVICE_WACOM(0x5000) }, |
830 | diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c |
831 | index b13936dacc78..f2a7f72f7aa6 100644 |
832 | --- a/drivers/iio/magnetometer/ak8975.c |
833 | +++ b/drivers/iio/magnetometer/ak8975.c |
834 | @@ -462,6 +462,8 @@ static int ak8975_setup_irq(struct ak8975_data *data) |
835 | int rc; |
836 | int irq; |
837 | |
838 | + init_waitqueue_head(&data->data_ready_queue); |
839 | + clear_bit(0, &data->flags); |
840 | if (client->irq) |
841 | irq = client->irq; |
842 | else |
843 | @@ -477,8 +479,6 @@ static int ak8975_setup_irq(struct ak8975_data *data) |
844 | return rc; |
845 | } |
846 | |
847 | - init_waitqueue_head(&data->data_ready_queue); |
848 | - clear_bit(0, &data->flags); |
849 | data->eoc_irq = irq; |
850 | |
851 | return rc; |
852 | @@ -732,7 +732,7 @@ static int ak8975_probe(struct i2c_client *client, |
853 | int eoc_gpio; |
854 | int err; |
855 | const char *name = NULL; |
856 | - enum asahi_compass_chipset chipset; |
857 | + enum asahi_compass_chipset chipset = AK_MAX_TYPE; |
858 | |
859 | /* Grab and set up the supplied GPIO. */ |
860 | if (client->dev.platform_data) |
861 | diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c |
862 | index de9cd6901752..bc147582bed9 100644 |
863 | --- a/drivers/infiniband/hw/cxgb4/cq.c |
864 | +++ b/drivers/infiniband/hw/cxgb4/cq.c |
865 | @@ -162,7 +162,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, |
866 | cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS, |
867 | &cq->bar2_qid, |
868 | user ? &cq->bar2_pa : NULL); |
869 | - if (user && !cq->bar2_va) { |
870 | + if (user && !cq->bar2_pa) { |
871 | pr_warn(MOD "%s: cqid %u not in BAR2 range.\n", |
872 | pci_name(rdev->lldi.pdev), cq->cqid); |
873 | ret = -EINVAL; |
874 | diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
875 | index aa515afee724..53aa7515f542 100644 |
876 | --- a/drivers/infiniband/hw/cxgb4/qp.c |
877 | +++ b/drivers/infiniband/hw/cxgb4/qp.c |
878 | @@ -185,6 +185,10 @@ void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid, |
879 | |
880 | if (pbar2_pa) |
881 | *pbar2_pa = (rdev->bar2_pa + bar2_qoffset) & PAGE_MASK; |
882 | + |
883 | + if (is_t4(rdev->lldi.adapter_type)) |
884 | + return NULL; |
885 | + |
886 | return rdev->bar2_kva + bar2_qoffset; |
887 | } |
888 | |
889 | @@ -270,7 +274,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, |
890 | /* |
891 | * User mode must have bar2 access. |
892 | */ |
893 | - if (user && (!wq->sq.bar2_va || !wq->rq.bar2_va)) { |
894 | + if (user && (!wq->sq.bar2_pa || !wq->rq.bar2_pa)) { |
895 | pr_warn(MOD "%s: sqid %u or rqid %u not in BAR2 range.\n", |
896 | pci_name(rdev->lldi.pdev), wq->sq.qid, wq->rq.qid); |
897 | goto free_dma; |
898 | diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c |
899 | index 9bbadaaf6bc3..7b3845aa5983 100644 |
900 | --- a/drivers/input/touchscreen/zforce_ts.c |
901 | +++ b/drivers/input/touchscreen/zforce_ts.c |
902 | @@ -370,8 +370,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) |
903 | point.coord_x = point.coord_y = 0; |
904 | } |
905 | |
906 | - point.state = payload[9 * i + 5] & 0x03; |
907 | - point.id = (payload[9 * i + 5] & 0xfc) >> 2; |
908 | + point.state = payload[9 * i + 5] & 0x0f; |
909 | + point.id = (payload[9 * i + 5] & 0xf0) >> 4; |
910 | |
911 | /* determine touch major, minor and orientation */ |
912 | point.area_major = max(payload[9 * i + 6], |
913 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
914 | index b1e1f6b95782..c57fdf847b47 100644 |
915 | --- a/drivers/md/md.c |
916 | +++ b/drivers/md/md.c |
917 | @@ -293,6 +293,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) |
918 | * go away inside make_request |
919 | */ |
920 | sectors = bio_sectors(bio); |
921 | + /* bio could be mergeable after passing to underlayer */ |
922 | + bio->bi_rw &= ~REQ_NOMERGE; |
923 | mddev->pers->make_request(mddev, bio); |
924 | |
925 | cpu = part_stat_lock(); |
926 | diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c |
927 | index 6255513f54c7..68aa31ae553a 100644 |
928 | --- a/drivers/mfd/intel-lpss.c |
929 | +++ b/drivers/mfd/intel-lpss.c |
930 | @@ -445,6 +445,7 @@ int intel_lpss_probe(struct device *dev, |
931 | err_remove_ltr: |
932 | intel_lpss_debugfs_remove(lpss); |
933 | intel_lpss_ltr_hide(lpss); |
934 | + intel_lpss_unregister_clock(lpss); |
935 | |
936 | err_clk_register: |
937 | ida_simple_remove(&intel_lpss_devid_ida, lpss->devid); |
938 | diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
939 | index 8f8793004b9f..1b271b99c49e 100644 |
940 | --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
941 | +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
942 | @@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah, |
943 | }; |
944 | static const int inc[4] = { 0, 100, 0, 0 }; |
945 | |
946 | + memset(&mask_m, 0, sizeof(int8_t) * 123); |
947 | + memset(&mask_p, 0, sizeof(int8_t) * 123); |
948 | + |
949 | cur_bin = -6000; |
950 | upper = bin + 100; |
951 | lower = bin - 100; |
952 | @@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah, |
953 | int tmp, new; |
954 | int i; |
955 | |
956 | - int8_t mask_m[123]; |
957 | - int8_t mask_p[123]; |
958 | int cur_bb_spur; |
959 | bool is2GHz = IS_CHAN_2GHZ(chan); |
960 | |
961 | - memset(&mask_m, 0, sizeof(int8_t) * 123); |
962 | - memset(&mask_p, 0, sizeof(int8_t) * 123); |
963 | - |
964 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { |
965 | cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); |
966 | if (AR_NO_SPUR == cur_bb_spur) |
967 | diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
968 | index db6624527d99..53d7445a5d12 100644 |
969 | --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
970 | +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
971 | @@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah, |
972 | int i; |
973 | struct chan_centers centers; |
974 | |
975 | - int8_t mask_m[123]; |
976 | - int8_t mask_p[123]; |
977 | int cur_bb_spur; |
978 | bool is2GHz = IS_CHAN_2GHZ(chan); |
979 | |
980 | - memset(&mask_m, 0, sizeof(int8_t) * 123); |
981 | - memset(&mask_p, 0, sizeof(int8_t) * 123); |
982 | - |
983 | ath9k_hw_get_channel_centers(ah, chan, ¢ers); |
984 | freq = centers.synth_center; |
985 | |
986 | diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c |
987 | index a6c8a4f7bfe9..d6c4f0f60839 100644 |
988 | --- a/drivers/net/wireless/mwifiex/sta_ioctl.c |
989 | +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c |
990 | @@ -313,6 +313,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
991 | mwifiex_dbg(adapter, ERROR, |
992 | "Attempt to reconnect on csa closed chan(%d)\n", |
993 | bss_desc->channel); |
994 | + ret = -1; |
995 | goto done; |
996 | } |
997 | |
998 | diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c |
999 | index 8ba19bba3156..2bb3c5799ac4 100644 |
1000 | --- a/drivers/nvmem/mxs-ocotp.c |
1001 | +++ b/drivers/nvmem/mxs-ocotp.c |
1002 | @@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size, |
1003 | if (ret) |
1004 | goto close_banks; |
1005 | |
1006 | - while (val_size) { |
1007 | + while (val_size >= reg_size) { |
1008 | if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) { |
1009 | /* fill up non-data register */ |
1010 | *buf = 0; |
1011 | @@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size, |
1012 | } |
1013 | |
1014 | buf++; |
1015 | - val_size--; |
1016 | + val_size -= reg_size; |
1017 | offset += reg_size; |
1018 | } |
1019 | |
1020 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
1021 | index db9446c612da..b0d92b84bcdc 100644 |
1022 | --- a/drivers/scsi/lpfc/lpfc_init.c |
1023 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
1024 | @@ -2855,7 +2855,7 @@ lpfc_online(struct lpfc_hba *phba) |
1025 | } |
1026 | |
1027 | vports = lpfc_create_vport_work_array(phba); |
1028 | - if (vports != NULL) |
1029 | + if (vports != NULL) { |
1030 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { |
1031 | struct Scsi_Host *shost; |
1032 | shost = lpfc_shost_from_vport(vports[i]); |
1033 | @@ -2872,7 +2872,8 @@ lpfc_online(struct lpfc_hba *phba) |
1034 | } |
1035 | spin_unlock_irq(shost->host_lock); |
1036 | } |
1037 | - lpfc_destroy_vport_work_array(phba, vports); |
1038 | + } |
1039 | + lpfc_destroy_vport_work_array(phba, vports); |
1040 | |
1041 | lpfc_unblock_mgmt_io(phba); |
1042 | return 0; |
1043 | diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c |
1044 | index 534c58937a56..4a65c5bda146 100644 |
1045 | --- a/drivers/soc/rockchip/pm_domains.c |
1046 | +++ b/drivers/soc/rockchip/pm_domains.c |
1047 | @@ -419,6 +419,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) |
1048 | if (error) { |
1049 | dev_err(dev, "failed to handle node %s: %d\n", |
1050 | node->name, error); |
1051 | + of_node_put(node); |
1052 | goto err_out; |
1053 | } |
1054 | } |
1055 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1056 | index bdc0f2f24f19..a2b43a6e7fa7 100644 |
1057 | --- a/drivers/usb/serial/cp210x.c |
1058 | +++ b/drivers/usb/serial/cp210x.c |
1059 | @@ -108,6 +108,7 @@ static const struct usb_device_id id_table[] = { |
1060 | { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ |
1061 | { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ |
1062 | { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ |
1063 | + { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ |
1064 | { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ |
1065 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
1066 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
1067 | @@ -117,6 +118,7 @@ static const struct usb_device_id id_table[] = { |
1068 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ |
1069 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
1070 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
1071 | + { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ |
1072 | { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ |
1073 | { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ |
1074 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
1075 | @@ -140,6 +142,8 @@ static const struct usb_device_id id_table[] = { |
1076 | { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */ |
1077 | { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */ |
1078 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ |
1079 | + { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */ |
1080 | + { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ |
1081 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
1082 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
1083 | { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ |
1084 | diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
1085 | index 12eab503efd1..364bc44610c1 100644 |
1086 | --- a/drivers/xen/balloon.c |
1087 | +++ b/drivers/xen/balloon.c |
1088 | @@ -152,6 +152,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); |
1089 | static void balloon_process(struct work_struct *work); |
1090 | static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); |
1091 | |
1092 | +static void release_memory_resource(struct resource *resource); |
1093 | + |
1094 | /* When ballooning out (allocating memory to return to Xen) we don't really |
1095 | want the kernel to try too hard since that can trigger the oom killer. */ |
1096 | #define GFP_BALLOON \ |
1097 | @@ -268,6 +270,20 @@ static struct resource *additional_memory_resource(phys_addr_t size) |
1098 | return NULL; |
1099 | } |
1100 | |
1101 | +#ifdef CONFIG_SPARSEMEM |
1102 | + { |
1103 | + unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT); |
1104 | + unsigned long pfn = res->start >> PAGE_SHIFT; |
1105 | + |
1106 | + if (pfn > limit) { |
1107 | + pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n", |
1108 | + pfn, limit); |
1109 | + release_memory_resource(res); |
1110 | + return NULL; |
1111 | + } |
1112 | + } |
1113 | +#endif |
1114 | + |
1115 | return res; |
1116 | } |
1117 | |
1118 | diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c |
1119 | index 38272ad24551..f4edd6df3df2 100644 |
1120 | --- a/drivers/xen/evtchn.c |
1121 | +++ b/drivers/xen/evtchn.c |
1122 | @@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per_user_data *u) |
1123 | { |
1124 | unsigned int new_size; |
1125 | evtchn_port_t *new_ring, *old_ring; |
1126 | - unsigned int p, c; |
1127 | |
1128 | /* |
1129 | * Ensure the ring is large enough to capture all possible |
1130 | @@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per_user_data *u) |
1131 | /* |
1132 | * Copy the old ring contents to the new ring. |
1133 | * |
1134 | - * If the ring contents crosses the end of the current ring, |
1135 | - * it needs to be copied in two chunks. |
1136 | + * To take care of wrapping, a full ring, and the new index |
1137 | + * pointing into the second half, simply copy the old contents |
1138 | + * twice. |
1139 | * |
1140 | * +---------+ +------------------+ |
1141 | - * |34567 12| -> | 1234567 | |
1142 | - * +-----p-c-+ +------------------+ |
1143 | + * |34567 12| -> |34567 1234567 12| |
1144 | + * +-----p-c-+ +-------c------p---+ |
1145 | */ |
1146 | - p = evtchn_ring_offset(u, u->ring_prod); |
1147 | - c = evtchn_ring_offset(u, u->ring_cons); |
1148 | - if (p < c) { |
1149 | - memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * sizeof(*u->ring)); |
1150 | - memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring)); |
1151 | - } else |
1152 | - memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring)); |
1153 | + memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring)); |
1154 | + memcpy(new_ring + u->ring_size, old_ring, |
1155 | + u->ring_size * sizeof(*u->ring)); |
1156 | |
1157 | u->ring = new_ring; |
1158 | u->ring_size = new_size; |
1159 | diff --git a/fs/pnode.c b/fs/pnode.c |
1160 | index 6367e1e435c6..99899705b105 100644 |
1161 | --- a/fs/pnode.c |
1162 | +++ b/fs/pnode.c |
1163 | @@ -198,10 +198,15 @@ static struct mount *next_group(struct mount *m, struct mount *origin) |
1164 | |
1165 | /* all accesses are serialized by namespace_sem */ |
1166 | static struct user_namespace *user_ns; |
1167 | -static struct mount *last_dest, *last_source, *dest_master; |
1168 | +static struct mount *last_dest, *first_source, *last_source, *dest_master; |
1169 | static struct mountpoint *mp; |
1170 | static struct hlist_head *list; |
1171 | |
1172 | +static inline bool peers(struct mount *m1, struct mount *m2) |
1173 | +{ |
1174 | + return m1->mnt_group_id == m2->mnt_group_id && m1->mnt_group_id; |
1175 | +} |
1176 | + |
1177 | static int propagate_one(struct mount *m) |
1178 | { |
1179 | struct mount *child; |
1180 | @@ -212,24 +217,26 @@ static int propagate_one(struct mount *m) |
1181 | /* skip if mountpoint isn't covered by it */ |
1182 | if (!is_subdir(mp->m_dentry, m->mnt.mnt_root)) |
1183 | return 0; |
1184 | - if (m->mnt_group_id == last_dest->mnt_group_id) { |
1185 | + if (peers(m, last_dest)) { |
1186 | type = CL_MAKE_SHARED; |
1187 | } else { |
1188 | struct mount *n, *p; |
1189 | + bool done; |
1190 | for (n = m; ; n = p) { |
1191 | p = n->mnt_master; |
1192 | - if (p == dest_master || IS_MNT_MARKED(p)) { |
1193 | - while (last_dest->mnt_master != p) { |
1194 | - last_source = last_source->mnt_master; |
1195 | - last_dest = last_source->mnt_parent; |
1196 | - } |
1197 | - if (n->mnt_group_id != last_dest->mnt_group_id) { |
1198 | - last_source = last_source->mnt_master; |
1199 | - last_dest = last_source->mnt_parent; |
1200 | - } |
1201 | + if (p == dest_master || IS_MNT_MARKED(p)) |
1202 | break; |
1203 | - } |
1204 | } |
1205 | + do { |
1206 | + struct mount *parent = last_source->mnt_parent; |
1207 | + if (last_source == first_source) |
1208 | + break; |
1209 | + done = parent->mnt_master == p; |
1210 | + if (done && peers(n, parent)) |
1211 | + break; |
1212 | + last_source = last_source->mnt_master; |
1213 | + } while (!done); |
1214 | + |
1215 | type = CL_SLAVE; |
1216 | /* beginning of peer group among the slaves? */ |
1217 | if (IS_MNT_SHARED(m)) |
1218 | @@ -281,6 +288,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, |
1219 | */ |
1220 | user_ns = current->nsproxy->mnt_ns->user_ns; |
1221 | last_dest = dest_mnt; |
1222 | + first_source = source_mnt; |
1223 | last_source = source_mnt; |
1224 | mp = dest_mp; |
1225 | list = tree_list; |
1226 | diff --git a/fs/proc/base.c b/fs/proc/base.c |
1227 | index b7de324bec11..e8bbf6cdb437 100644 |
1228 | --- a/fs/proc/base.c |
1229 | +++ b/fs/proc/base.c |
1230 | @@ -954,7 +954,8 @@ static ssize_t environ_read(struct file *file, char __user *buf, |
1231 | int ret = 0; |
1232 | struct mm_struct *mm = file->private_data; |
1233 | |
1234 | - if (!mm) |
1235 | + /* Ensure the process spawned far enough to have an environment. */ |
1236 | + if (!mm || !mm->env_end) |
1237 | return 0; |
1238 | |
1239 | page = (char *)__get_free_page(GFP_TEMPORARY); |
1240 | diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h |
1241 | index c56988ac63f7..7cd0171963ae 100644 |
1242 | --- a/include/linux/clk-provider.h |
1243 | +++ b/include/linux/clk-provider.h |
1244 | @@ -384,6 +384,7 @@ struct clk_divider { |
1245 | #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) |
1246 | |
1247 | extern const struct clk_ops clk_divider_ops; |
1248 | +extern const struct clk_ops clk_divider_ro_ops; |
1249 | |
1250 | unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, |
1251 | unsigned int val, const struct clk_div_table *table, |
1252 | diff --git a/include/linux/hash.h b/include/linux/hash.h |
1253 | index 1afde47e1528..79c52fa81cac 100644 |
1254 | --- a/include/linux/hash.h |
1255 | +++ b/include/linux/hash.h |
1256 | @@ -32,12 +32,28 @@ |
1257 | #error Wordsize not 32 or 64 |
1258 | #endif |
1259 | |
1260 | +/* |
1261 | + * The above primes are actively bad for hashing, since they are |
1262 | + * too sparse. The 32-bit one is mostly ok, the 64-bit one causes |
1263 | + * real problems. Besides, the "prime" part is pointless for the |
1264 | + * multiplicative hash. |
1265 | + * |
1266 | + * Although a random odd number will do, it turns out that the golden |
1267 | + * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice |
1268 | + * properties. |
1269 | + * |
1270 | + * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2. |
1271 | + * (See Knuth vol 3, section 6.4, exercise 9.) |
1272 | + */ |
1273 | +#define GOLDEN_RATIO_32 0x61C88647 |
1274 | +#define GOLDEN_RATIO_64 0x61C8864680B583EBull |
1275 | + |
1276 | static __always_inline u64 hash_64(u64 val, unsigned int bits) |
1277 | { |
1278 | u64 hash = val; |
1279 | |
1280 | -#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
1281 | - hash = hash * GOLDEN_RATIO_PRIME_64; |
1282 | +#if BITS_PER_LONG == 64 |
1283 | + hash = hash * GOLDEN_RATIO_64; |
1284 | #else |
1285 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ |
1286 | u64 n = hash; |
1287 | diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
1288 | index 0816c872b689..a6cc576fd467 100644 |
1289 | --- a/include/net/ip_vs.h |
1290 | +++ b/include/net/ip_vs.h |
1291 | @@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) |
1292 | } |
1293 | #endif /* CONFIG_IP_VS_NFCT */ |
1294 | |
1295 | +/* Really using conntrack? */ |
1296 | +static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, |
1297 | + struct sk_buff *skb) |
1298 | +{ |
1299 | +#ifdef CONFIG_IP_VS_NFCT |
1300 | + enum ip_conntrack_info ctinfo; |
1301 | + struct nf_conn *ct; |
1302 | + |
1303 | + if (!(cp->flags & IP_VS_CONN_F_NFCT)) |
1304 | + return false; |
1305 | + ct = nf_ct_get(skb, &ctinfo); |
1306 | + if (ct && !nf_ct_is_untracked(ct)) |
1307 | + return true; |
1308 | +#endif |
1309 | + return false; |
1310 | +} |
1311 | + |
1312 | static inline int |
1313 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) |
1314 | { |
1315 | diff --git a/include/xen/page.h b/include/xen/page.h |
1316 | index 96294ac93755..9dc46cb8a0fd 100644 |
1317 | --- a/include/xen/page.h |
1318 | +++ b/include/xen/page.h |
1319 | @@ -15,9 +15,9 @@ |
1320 | */ |
1321 | |
1322 | #define xen_pfn_to_page(xen_pfn) \ |
1323 | - ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT))) |
1324 | + (pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT))) |
1325 | #define page_to_xen_pfn(page) \ |
1326 | - (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT) |
1327 | + ((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT)) |
1328 | |
1329 | #define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE) |
1330 | |
1331 | diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
1332 | index d202d991edae..996f0fd34312 100644 |
1333 | --- a/kernel/trace/trace_events.c |
1334 | +++ b/kernel/trace/trace_events.c |
1335 | @@ -2107,8 +2107,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file) |
1336 | trace_create_file("filter", 0644, file->dir, file, |
1337 | &ftrace_event_filter_fops); |
1338 | |
1339 | - trace_create_file("trigger", 0644, file->dir, file, |
1340 | - &event_trigger_fops); |
1341 | + /* |
1342 | + * Only event directories that can be enabled should have |
1343 | + * triggers. |
1344 | + */ |
1345 | + if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) |
1346 | + trace_create_file("trigger", 0644, file->dir, file, |
1347 | + &event_trigger_fops); |
1348 | |
1349 | trace_create_file("format", 0444, file->dir, call, |
1350 | &ftrace_event_format_fops); |
1351 | diff --git a/lib/test-string_helpers.c b/lib/test-string_helpers.c |
1352 | index 98866a770770..25b5cbfb7615 100644 |
1353 | --- a/lib/test-string_helpers.c |
1354 | +++ b/lib/test-string_helpers.c |
1355 | @@ -327,36 +327,67 @@ out: |
1356 | } |
1357 | |
1358 | #define string_get_size_maxbuf 16 |
1359 | -#define test_string_get_size_one(size, blk_size, units, exp_result) \ |
1360 | +#define test_string_get_size_one(size, blk_size, exp_result10, exp_result2) \ |
1361 | do { \ |
1362 | - BUILD_BUG_ON(sizeof(exp_result) >= string_get_size_maxbuf); \ |
1363 | - __test_string_get_size((size), (blk_size), (units), \ |
1364 | - (exp_result)); \ |
1365 | + BUILD_BUG_ON(sizeof(exp_result10) >= string_get_size_maxbuf); \ |
1366 | + BUILD_BUG_ON(sizeof(exp_result2) >= string_get_size_maxbuf); \ |
1367 | + __test_string_get_size((size), (blk_size), (exp_result10), \ |
1368 | + (exp_result2)); \ |
1369 | } while (0) |
1370 | |
1371 | |
1372 | -static __init void __test_string_get_size(const u64 size, const u64 blk_size, |
1373 | - const enum string_size_units units, |
1374 | - const char *exp_result) |
1375 | +static __init void test_string_get_size_check(const char *units, |
1376 | + const char *exp, |
1377 | + char *res, |
1378 | + const u64 size, |
1379 | + const u64 blk_size) |
1380 | { |
1381 | - char buf[string_get_size_maxbuf]; |
1382 | - |
1383 | - string_get_size(size, blk_size, units, buf, sizeof(buf)); |
1384 | - if (!memcmp(buf, exp_result, strlen(exp_result) + 1)) |
1385 | + if (!memcmp(res, exp, strlen(exp) + 1)) |
1386 | return; |
1387 | |
1388 | - buf[sizeof(buf) - 1] = '\0'; |
1389 | - pr_warn("Test 'test_string_get_size_one' failed!\n"); |
1390 | - pr_warn("string_get_size(size = %llu, blk_size = %llu, units = %d\n", |
1391 | + res[string_get_size_maxbuf - 1] = '\0'; |
1392 | + |
1393 | + pr_warn("Test 'test_string_get_size' failed!\n"); |
1394 | + pr_warn("string_get_size(size = %llu, blk_size = %llu, units = %s)\n", |
1395 | size, blk_size, units); |
1396 | - pr_warn("expected: '%s', got '%s'\n", exp_result, buf); |
1397 | + pr_warn("expected: '%s', got '%s'\n", exp, res); |
1398 | +} |
1399 | + |
1400 | +static __init void __test_string_get_size(const u64 size, const u64 blk_size, |
1401 | + const char *exp_result10, |
1402 | + const char *exp_result2) |
1403 | +{ |
1404 | + char buf10[string_get_size_maxbuf]; |
1405 | + char buf2[string_get_size_maxbuf]; |
1406 | + |
1407 | + string_get_size(size, blk_size, STRING_UNITS_10, buf10, sizeof(buf10)); |
1408 | + string_get_size(size, blk_size, STRING_UNITS_2, buf2, sizeof(buf2)); |
1409 | + |
1410 | + test_string_get_size_check("STRING_UNITS_10", exp_result10, buf10, |
1411 | + size, blk_size); |
1412 | + |
1413 | + test_string_get_size_check("STRING_UNITS_2", exp_result2, buf2, |
1414 | + size, blk_size); |
1415 | } |
1416 | |
1417 | static __init void test_string_get_size(void) |
1418 | { |
1419 | - test_string_get_size_one(16384, 512, STRING_UNITS_2, "8.00 MiB"); |
1420 | - test_string_get_size_one(8192, 4096, STRING_UNITS_10, "32.7 MB"); |
1421 | - test_string_get_size_one(1, 512, STRING_UNITS_10, "512 B"); |
1422 | + /* small values */ |
1423 | + test_string_get_size_one(0, 512, "0 B", "0 B"); |
1424 | + test_string_get_size_one(1, 512, "512 B", "512 B"); |
1425 | + test_string_get_size_one(1100, 1, "1.10 kB", "1.07 KiB"); |
1426 | + |
1427 | + /* normal values */ |
1428 | + test_string_get_size_one(16384, 512, "8.39 MB", "8.00 MiB"); |
1429 | + test_string_get_size_one(500118192, 512, "256 GB", "238 GiB"); |
1430 | + test_string_get_size_one(8192, 4096, "33.6 MB", "32.0 MiB"); |
1431 | + |
1432 | + /* weird block sizes */ |
1433 | + test_string_get_size_one(3000, 1900, "5.70 MB", "5.44 MiB"); |
1434 | + |
1435 | + /* huge values */ |
1436 | + test_string_get_size_one(U64_MAX, 4096, "75.6 ZB", "64.0 ZiB"); |
1437 | + test_string_get_size_one(4096, U64_MAX, "75.6 ZB", "64.0 ZiB"); |
1438 | } |
1439 | |
1440 | static int __init test_string_helpers_init(void) |
1441 | diff --git a/mm/compaction.c b/mm/compaction.c |
1442 | index de3e1e71cd9f..7881e072dc33 100644 |
1443 | --- a/mm/compaction.c |
1444 | +++ b/mm/compaction.c |
1445 | @@ -880,16 +880,8 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, |
1446 | pfn = isolate_migratepages_block(cc, pfn, block_end_pfn, |
1447 | ISOLATE_UNEVICTABLE); |
1448 | |
1449 | - /* |
1450 | - * In case of fatal failure, release everything that might |
1451 | - * have been isolated in the previous iteration, and signal |
1452 | - * the failure back to caller. |
1453 | - */ |
1454 | - if (!pfn) { |
1455 | - putback_movable_pages(&cc->migratepages); |
1456 | - cc->nr_migratepages = 0; |
1457 | + if (!pfn) |
1458 | break; |
1459 | - } |
1460 | |
1461 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) |
1462 | break; |
1463 | diff --git a/mm/page-writeback.c b/mm/page-writeback.c |
1464 | index d15d88c8efa1..e40c9364582d 100644 |
1465 | --- a/mm/page-writeback.c |
1466 | +++ b/mm/page-writeback.c |
1467 | @@ -1899,7 +1899,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) |
1468 | if (gdtc->dirty > gdtc->bg_thresh) |
1469 | return true; |
1470 | |
1471 | - if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(gdtc)) |
1472 | + if (wb_stat(wb, WB_RECLAIMABLE) > |
1473 | + wb_calc_thresh(gdtc->wb, gdtc->bg_thresh)) |
1474 | return true; |
1475 | |
1476 | if (mdtc) { |
1477 | @@ -1913,7 +1914,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) |
1478 | if (mdtc->dirty > mdtc->bg_thresh) |
1479 | return true; |
1480 | |
1481 | - if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(mdtc)) |
1482 | + if (wb_stat(wb, WB_RECLAIMABLE) > |
1483 | + wb_calc_thresh(mdtc->wb, mdtc->bg_thresh)) |
1484 | return true; |
1485 | } |
1486 | |
1487 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
1488 | index c69531afbd8f..6cf5cadeaef7 100644 |
1489 | --- a/mm/page_alloc.c |
1490 | +++ b/mm/page_alloc.c |
1491 | @@ -6193,7 +6193,7 @@ int __meminit init_per_zone_wmark_min(void) |
1492 | setup_per_zone_inactive_ratio(); |
1493 | return 0; |
1494 | } |
1495 | -module_init(init_per_zone_wmark_min) |
1496 | +core_initcall(init_per_zone_wmark_min) |
1497 | |
1498 | /* |
1499 | * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so |
1500 | diff --git a/mm/zswap.c b/mm/zswap.c |
1501 | index bf14508afd64..340261946fda 100644 |
1502 | --- a/mm/zswap.c |
1503 | +++ b/mm/zswap.c |
1504 | @@ -170,6 +170,8 @@ static struct zswap_tree *zswap_trees[MAX_SWAPFILES]; |
1505 | static LIST_HEAD(zswap_pools); |
1506 | /* protects zswap_pools list modification */ |
1507 | static DEFINE_SPINLOCK(zswap_pools_lock); |
1508 | +/* pool counter to provide unique names to zpool */ |
1509 | +static atomic_t zswap_pools_count = ATOMIC_INIT(0); |
1510 | |
1511 | /* used by param callback function */ |
1512 | static bool zswap_init_started; |
1513 | @@ -565,6 +567,7 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor) |
1514 | static struct zswap_pool *zswap_pool_create(char *type, char *compressor) |
1515 | { |
1516 | struct zswap_pool *pool; |
1517 | + char name[38]; /* 'zswap' + 32 char (max) num + \0 */ |
1518 | gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM; |
1519 | |
1520 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); |
1521 | @@ -573,7 +576,10 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) |
1522 | return NULL; |
1523 | } |
1524 | |
1525 | - pool->zpool = zpool_create_pool(type, "zswap", gfp, &zswap_zpool_ops); |
1526 | + /* unique name for each pool specifically required by zsmalloc */ |
1527 | + snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count)); |
1528 | + |
1529 | + pool->zpool = zpool_create_pool(type, name, gfp, &zswap_zpool_ops); |
1530 | if (!pool->zpool) { |
1531 | pr_err("%s zpool not available\n", type); |
1532 | goto error; |
1533 | diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c |
1534 | index a49c705fb86b..5f19133c5530 100644 |
1535 | --- a/net/batman-adv/distributed-arp-table.c |
1536 | +++ b/net/batman-adv/distributed-arp-table.c |
1537 | @@ -553,6 +553,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, |
1538 | * be sent to |
1539 | * @bat_priv: the bat priv with all the soft interface information |
1540 | * @ip_dst: ipv4 to look up in the DHT |
1541 | + * @vid: VLAN identifier |
1542 | * |
1543 | * An originator O is selected if and only if its DHT_ID value is one of three |
1544 | * closest values (from the LEFT, with wrap around if needed) then the hash |
1545 | @@ -561,7 +562,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, |
1546 | * Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM. |
1547 | */ |
1548 | static struct batadv_dat_candidate * |
1549 | -batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
1550 | +batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst, |
1551 | + unsigned short vid) |
1552 | { |
1553 | int select; |
1554 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; |
1555 | @@ -577,7 +579,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
1556 | return NULL; |
1557 | |
1558 | dat.ip = ip_dst; |
1559 | - dat.vid = 0; |
1560 | + dat.vid = vid; |
1561 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, |
1562 | BATADV_DAT_ADDR_MAX); |
1563 | |
1564 | @@ -597,6 +599,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
1565 | * @bat_priv: the bat priv with all the soft interface information |
1566 | * @skb: payload to send |
1567 | * @ip: the DHT key |
1568 | + * @vid: VLAN identifier |
1569 | * @packet_subtype: unicast4addr packet subtype to use |
1570 | * |
1571 | * This function copies the skb with pskb_copy() and is sent as unicast packet |
1572 | @@ -607,7 +610,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
1573 | */ |
1574 | static bool batadv_dat_send_data(struct batadv_priv *bat_priv, |
1575 | struct sk_buff *skb, __be32 ip, |
1576 | - int packet_subtype) |
1577 | + unsigned short vid, int packet_subtype) |
1578 | { |
1579 | int i; |
1580 | bool ret = false; |
1581 | @@ -616,7 +619,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, |
1582 | struct sk_buff *tmp_skb; |
1583 | struct batadv_dat_candidate *cand; |
1584 | |
1585 | - cand = batadv_dat_select_candidates(bat_priv, ip); |
1586 | + cand = batadv_dat_select_candidates(bat_priv, ip, vid); |
1587 | if (!cand) |
1588 | goto out; |
1589 | |
1590 | @@ -1004,7 +1007,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, |
1591 | ret = true; |
1592 | } else { |
1593 | /* Send the request to the DHT */ |
1594 | - ret = batadv_dat_send_data(bat_priv, skb, ip_dst, |
1595 | + ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid, |
1596 | BATADV_P_DAT_DHT_GET); |
1597 | } |
1598 | out: |
1599 | @@ -1132,8 +1135,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, |
1600 | /* Send the ARP reply to the candidates for both the IP addresses that |
1601 | * the node obtained from the ARP reply |
1602 | */ |
1603 | - batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT); |
1604 | - batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT); |
1605 | + batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT); |
1606 | + batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT); |
1607 | } |
1608 | |
1609 | /** |
1610 | diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c |
1611 | index 3207667e69de..d8a2f33e60e5 100644 |
1612 | --- a/net/batman-adv/routing.c |
1613 | +++ b/net/batman-adv/routing.c |
1614 | @@ -104,6 +104,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, |
1615 | neigh_node = NULL; |
1616 | |
1617 | spin_lock_bh(&orig_node->neigh_list_lock); |
1618 | + /* curr_router used earlier may not be the current orig_ifinfo->router |
1619 | + * anymore because it was dereferenced outside of the neigh_list_lock |
1620 | + * protected region. After the new best neighbor has replace the current |
1621 | + * best neighbor the reference counter needs to decrease. Consequently, |
1622 | + * the code needs to ensure the curr_router variable contains a pointer |
1623 | + * to the replaced best neighbor. |
1624 | + */ |
1625 | + curr_router = rcu_dereference_protected(orig_ifinfo->router, true); |
1626 | + |
1627 | rcu_assign_pointer(orig_ifinfo->router, neigh_node); |
1628 | spin_unlock_bh(&orig_node->neigh_list_lock); |
1629 | batadv_orig_ifinfo_free_ref(orig_ifinfo); |
1630 | diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c |
1631 | index f664324805eb..0e0c3b8ed927 100644 |
1632 | --- a/net/batman-adv/send.c |
1633 | +++ b/net/batman-adv/send.c |
1634 | @@ -630,6 +630,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, |
1635 | |
1636 | if (pending) { |
1637 | hlist_del(&forw_packet->list); |
1638 | + if (!forw_packet->own) |
1639 | + atomic_inc(&bat_priv->bcast_queue_left); |
1640 | + |
1641 | batadv_forw_packet_free(forw_packet); |
1642 | } |
1643 | } |
1644 | @@ -657,6 +660,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, |
1645 | |
1646 | if (pending) { |
1647 | hlist_del(&forw_packet->list); |
1648 | + if (!forw_packet->own) |
1649 | + atomic_inc(&bat_priv->batman_queue_left); |
1650 | + |
1651 | batadv_forw_packet_free(forw_packet); |
1652 | } |
1653 | } |
1654 | diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c |
1655 | index ac4d08de5df4..720f1a5b81ac 100644 |
1656 | --- a/net/batman-adv/soft-interface.c |
1657 | +++ b/net/batman-adv/soft-interface.c |
1658 | @@ -407,11 +407,17 @@ void batadv_interface_rx(struct net_device *soft_iface, |
1659 | */ |
1660 | nf_reset(skb); |
1661 | |
1662 | + if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) |
1663 | + goto dropped; |
1664 | + |
1665 | vid = batadv_get_vid(skb, 0); |
1666 | ethhdr = eth_hdr(skb); |
1667 | |
1668 | switch (ntohs(ethhdr->h_proto)) { |
1669 | case ETH_P_8021Q: |
1670 | + if (!pskb_may_pull(skb, VLAN_ETH_HLEN)) |
1671 | + goto dropped; |
1672 | + |
1673 | vhdr = (struct vlan_ethhdr *)skb->data; |
1674 | |
1675 | if (vhdr->h_vlan_encapsulated_proto != ethertype) |
1676 | @@ -423,8 +429,6 @@ void batadv_interface_rx(struct net_device *soft_iface, |
1677 | } |
1678 | |
1679 | /* skb->dev & skb->pkt_type are set here */ |
1680 | - if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) |
1681 | - goto dropped; |
1682 | skb->protocol = eth_type_trans(skb, soft_iface); |
1683 | |
1684 | /* should not be necessary anymore as we use skb_pull_rcsum() |
1685 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
1686 | index 7a2b7915093b..bcb0a1b64556 100644 |
1687 | --- a/net/mac80211/iface.c |
1688 | +++ b/net/mac80211/iface.c |
1689 | @@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
1690 | |
1691 | ret = dev_alloc_name(ndev, ndev->name); |
1692 | if (ret < 0) { |
1693 | - free_netdev(ndev); |
1694 | + ieee80211_if_free(ndev); |
1695 | return ret; |
1696 | } |
1697 | |
1698 | @@ -1836,7 +1836,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
1699 | |
1700 | ret = register_netdevice(ndev); |
1701 | if (ret) { |
1702 | - free_netdev(ndev); |
1703 | + ieee80211_if_free(ndev); |
1704 | return ret; |
1705 | } |
1706 | } |
1707 | diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c |
1708 | index f57b4dcdb233..4da560005b0e 100644 |
1709 | --- a/net/netfilter/ipvs/ip_vs_core.c |
1710 | +++ b/net/netfilter/ipvs/ip_vs_core.c |
1711 | @@ -1757,15 +1757,34 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
1712 | cp = pp->conn_in_get(ipvs, af, skb, &iph); |
1713 | |
1714 | conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); |
1715 | - if (conn_reuse_mode && !iph.fragoffs && |
1716 | - is_new_conn(skb, &iph) && cp && |
1717 | - ((unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
1718 | - unlikely(!atomic_read(&cp->dest->weight))) || |
1719 | - unlikely(is_new_conn_expected(cp, conn_reuse_mode)))) { |
1720 | - if (!atomic_read(&cp->n_control)) |
1721 | - ip_vs_conn_expire_now(cp); |
1722 | - __ip_vs_conn_put(cp); |
1723 | - cp = NULL; |
1724 | + if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { |
1725 | + bool uses_ct = false, resched = false; |
1726 | + |
1727 | + if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
1728 | + unlikely(!atomic_read(&cp->dest->weight))) { |
1729 | + resched = true; |
1730 | + uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
1731 | + } else if (is_new_conn_expected(cp, conn_reuse_mode)) { |
1732 | + uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
1733 | + if (!atomic_read(&cp->n_control)) { |
1734 | + resched = true; |
1735 | + } else { |
1736 | + /* Do not reschedule controlling connection |
1737 | + * that uses conntrack while it is still |
1738 | + * referenced by controlled connection(s). |
1739 | + */ |
1740 | + resched = !uses_ct; |
1741 | + } |
1742 | + } |
1743 | + |
1744 | + if (resched) { |
1745 | + if (!atomic_read(&cp->n_control)) |
1746 | + ip_vs_conn_expire_now(cp); |
1747 | + __ip_vs_conn_put(cp); |
1748 | + if (uses_ct) |
1749 | + return NF_DROP; |
1750 | + cp = NULL; |
1751 | + } |
1752 | } |
1753 | |
1754 | if (unlikely(!cp)) { |
1755 | diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c |
1756 | index 1b8d594e493a..0a6eb5c0d9e9 100644 |
1757 | --- a/net/netfilter/ipvs/ip_vs_pe_sip.c |
1758 | +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c |
1759 | @@ -70,10 +70,10 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) |
1760 | const char *dptr; |
1761 | int retc; |
1762 | |
1763 | - ip_vs_fill_iph_skb(p->af, skb, false, &iph); |
1764 | + retc = ip_vs_fill_iph_skb(p->af, skb, false, &iph); |
1765 | |
1766 | /* Only useful with UDP */ |
1767 | - if (iph.protocol != IPPROTO_UDP) |
1768 | + if (!retc || iph.protocol != IPPROTO_UDP) |
1769 | return -EINVAL; |
1770 | /* todo: IPv6 fragments: |
1771 | * I think this only should be done for the first fragment. /HS |
1772 | @@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) |
1773 | dptr = skb->data + dataoff; |
1774 | datalen = skb->len - dataoff; |
1775 | |
1776 | - if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen)) |
1777 | + if (get_callid(dptr, 0, datalen, &matchoff, &matchlen)) |
1778 | return -EINVAL; |
1779 | |
1780 | /* N.B: pe_data is only set on success, |