Annotation of /trunk/kernel-alx/patches-4.4/0147-4.4.48-all-fixes.patch
Parent Directory | Revision Log
Revision 2883 -
(hide annotations)
(download)
Mon Mar 27 13:49:22 2017 UTC (7 years, 6 months ago) by niro
File size: 34276 byte(s)
Mon Mar 27 13:49:22 2017 UTC (7 years, 6 months ago) by niro
File size: 34276 byte(s)
linux-4.4.48
1 | niro | 2883 | diff --git a/Makefile b/Makefile |
2 | index 7b233ac7f86c..0793cd412656 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 4 | ||
8 | -SUBLEVEL = 47 | ||
9 | +SUBLEVEL = 48 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Blurry Fish Butt | ||
12 | |||
13 | diff --git a/arch/arm64/crypto/aes-modes.S b/arch/arm64/crypto/aes-modes.S | ||
14 | index c53dbeae79f2..838dad5c209f 100644 | ||
15 | --- a/arch/arm64/crypto/aes-modes.S | ||
16 | +++ b/arch/arm64/crypto/aes-modes.S | ||
17 | @@ -193,15 +193,16 @@ AES_ENTRY(aes_cbc_encrypt) | ||
18 | cbz w6, .Lcbcencloop | ||
19 | |||
20 | ld1 {v0.16b}, [x5] /* get iv */ | ||
21 | - enc_prepare w3, x2, x5 | ||
22 | + enc_prepare w3, x2, x6 | ||
23 | |||
24 | .Lcbcencloop: | ||
25 | ld1 {v1.16b}, [x1], #16 /* get next pt block */ | ||
26 | eor v0.16b, v0.16b, v1.16b /* ..and xor with iv */ | ||
27 | - encrypt_block v0, w3, x2, x5, w6 | ||
28 | + encrypt_block v0, w3, x2, x6, w7 | ||
29 | st1 {v0.16b}, [x0], #16 | ||
30 | subs w4, w4, #1 | ||
31 | bne .Lcbcencloop | ||
32 | + st1 {v0.16b}, [x5] /* return iv */ | ||
33 | ret | ||
34 | AES_ENDPROC(aes_cbc_encrypt) | ||
35 | |||
36 | @@ -211,7 +212,7 @@ AES_ENTRY(aes_cbc_decrypt) | ||
37 | cbz w6, .LcbcdecloopNx | ||
38 | |||
39 | ld1 {v7.16b}, [x5] /* get iv */ | ||
40 | - dec_prepare w3, x2, x5 | ||
41 | + dec_prepare w3, x2, x6 | ||
42 | |||
43 | .LcbcdecloopNx: | ||
44 | #if INTERLEAVE >= 2 | ||
45 | @@ -248,7 +249,7 @@ AES_ENTRY(aes_cbc_decrypt) | ||
46 | .Lcbcdecloop: | ||
47 | ld1 {v1.16b}, [x1], #16 /* get next ct block */ | ||
48 | mov v0.16b, v1.16b /* ...and copy to v0 */ | ||
49 | - decrypt_block v0, w3, x2, x5, w6 | ||
50 | + decrypt_block v0, w3, x2, x6, w7 | ||
51 | eor v0.16b, v0.16b, v7.16b /* xor with iv => pt */ | ||
52 | mov v7.16b, v1.16b /* ct is next iv */ | ||
53 | st1 {v0.16b}, [x0], #16 | ||
54 | @@ -256,6 +257,7 @@ AES_ENTRY(aes_cbc_decrypt) | ||
55 | bne .Lcbcdecloop | ||
56 | .Lcbcdecout: | ||
57 | FRAME_POP | ||
58 | + st1 {v7.16b}, [x5] /* return iv */ | ||
59 | ret | ||
60 | AES_ENDPROC(aes_cbc_decrypt) | ||
61 | |||
62 | @@ -267,24 +269,15 @@ AES_ENDPROC(aes_cbc_decrypt) | ||
63 | |||
64 | AES_ENTRY(aes_ctr_encrypt) | ||
65 | FRAME_PUSH | ||
66 | - cbnz w6, .Lctrfirst /* 1st time around? */ | ||
67 | - umov x5, v4.d[1] /* keep swabbed ctr in reg */ | ||
68 | - rev x5, x5 | ||
69 | -#if INTERLEAVE >= 2 | ||
70 | - cmn w5, w4 /* 32 bit overflow? */ | ||
71 | - bcs .Lctrinc | ||
72 | - add x5, x5, #1 /* increment BE ctr */ | ||
73 | - b .LctrincNx | ||
74 | -#else | ||
75 | - b .Lctrinc | ||
76 | -#endif | ||
77 | -.Lctrfirst: | ||
78 | + cbz w6, .Lctrnotfirst /* 1st time around? */ | ||
79 | enc_prepare w3, x2, x6 | ||
80 | ld1 {v4.16b}, [x5] | ||
81 | - umov x5, v4.d[1] /* keep swabbed ctr in reg */ | ||
82 | - rev x5, x5 | ||
83 | + | ||
84 | +.Lctrnotfirst: | ||
85 | + umov x8, v4.d[1] /* keep swabbed ctr in reg */ | ||
86 | + rev x8, x8 | ||
87 | #if INTERLEAVE >= 2 | ||
88 | - cmn w5, w4 /* 32 bit overflow? */ | ||
89 | + cmn w8, w4 /* 32 bit overflow? */ | ||
90 | bcs .Lctrloop | ||
91 | .LctrloopNx: | ||
92 | subs w4, w4, #INTERLEAVE | ||
93 | @@ -292,11 +285,11 @@ AES_ENTRY(aes_ctr_encrypt) | ||
94 | #if INTERLEAVE == 2 | ||
95 | mov v0.8b, v4.8b | ||
96 | mov v1.8b, v4.8b | ||
97 | - rev x7, x5 | ||
98 | - add x5, x5, #1 | ||
99 | + rev x7, x8 | ||
100 | + add x8, x8, #1 | ||
101 | ins v0.d[1], x7 | ||
102 | - rev x7, x5 | ||
103 | - add x5, x5, #1 | ||
104 | + rev x7, x8 | ||
105 | + add x8, x8, #1 | ||
106 | ins v1.d[1], x7 | ||
107 | ld1 {v2.16b-v3.16b}, [x1], #32 /* get 2 input blocks */ | ||
108 | do_encrypt_block2x | ||
109 | @@ -305,7 +298,7 @@ AES_ENTRY(aes_ctr_encrypt) | ||
110 | st1 {v0.16b-v1.16b}, [x0], #32 | ||
111 | #else | ||
112 | ldr q8, =0x30000000200000001 /* addends 1,2,3[,0] */ | ||
113 | - dup v7.4s, w5 | ||
114 | + dup v7.4s, w8 | ||
115 | mov v0.16b, v4.16b | ||
116 | add v7.4s, v7.4s, v8.4s | ||
117 | mov v1.16b, v4.16b | ||
118 | @@ -323,18 +316,12 @@ AES_ENTRY(aes_ctr_encrypt) | ||
119 | eor v2.16b, v7.16b, v2.16b | ||
120 | eor v3.16b, v5.16b, v3.16b | ||
121 | st1 {v0.16b-v3.16b}, [x0], #64 | ||
122 | - add x5, x5, #INTERLEAVE | ||
123 | + add x8, x8, #INTERLEAVE | ||
124 | #endif | ||
125 | - cbz w4, .LctroutNx | ||
126 | -.LctrincNx: | ||
127 | - rev x7, x5 | ||
128 | + rev x7, x8 | ||
129 | ins v4.d[1], x7 | ||
130 | + cbz w4, .Lctrout | ||
131 | b .LctrloopNx | ||
132 | -.LctroutNx: | ||
133 | - sub x5, x5, #1 | ||
134 | - rev x7, x5 | ||
135 | - ins v4.d[1], x7 | ||
136 | - b .Lctrout | ||
137 | .Lctr1x: | ||
138 | adds w4, w4, #INTERLEAVE | ||
139 | beq .Lctrout | ||
140 | @@ -342,30 +329,39 @@ AES_ENTRY(aes_ctr_encrypt) | ||
141 | .Lctrloop: | ||
142 | mov v0.16b, v4.16b | ||
143 | encrypt_block v0, w3, x2, x6, w7 | ||
144 | + | ||
145 | + adds x8, x8, #1 /* increment BE ctr */ | ||
146 | + rev x7, x8 | ||
147 | + ins v4.d[1], x7 | ||
148 | + bcs .Lctrcarry /* overflow? */ | ||
149 | + | ||
150 | +.Lctrcarrydone: | ||
151 | subs w4, w4, #1 | ||
152 | bmi .Lctrhalfblock /* blocks < 0 means 1/2 block */ | ||
153 | ld1 {v3.16b}, [x1], #16 | ||
154 | eor v3.16b, v0.16b, v3.16b | ||
155 | st1 {v3.16b}, [x0], #16 | ||
156 | - beq .Lctrout | ||
157 | -.Lctrinc: | ||
158 | - adds x5, x5, #1 /* increment BE ctr */ | ||
159 | - rev x7, x5 | ||
160 | - ins v4.d[1], x7 | ||
161 | - bcc .Lctrloop /* no overflow? */ | ||
162 | - umov x7, v4.d[0] /* load upper word of ctr */ | ||
163 | - rev x7, x7 /* ... to handle the carry */ | ||
164 | - add x7, x7, #1 | ||
165 | - rev x7, x7 | ||
166 | - ins v4.d[0], x7 | ||
167 | - b .Lctrloop | ||
168 | + bne .Lctrloop | ||
169 | + | ||
170 | +.Lctrout: | ||
171 | + st1 {v4.16b}, [x5] /* return next CTR value */ | ||
172 | + FRAME_POP | ||
173 | + ret | ||
174 | + | ||
175 | .Lctrhalfblock: | ||
176 | ld1 {v3.8b}, [x1] | ||
177 | eor v3.8b, v0.8b, v3.8b | ||
178 | st1 {v3.8b}, [x0] | ||
179 | -.Lctrout: | ||
180 | FRAME_POP | ||
181 | ret | ||
182 | + | ||
183 | +.Lctrcarry: | ||
184 | + umov x7, v4.d[0] /* load upper word of ctr */ | ||
185 | + rev x7, x7 /* ... to handle the carry */ | ||
186 | + add x7, x7, #1 | ||
187 | + rev x7, x7 | ||
188 | + ins v4.d[0], x7 | ||
189 | + b .Lctrcarrydone | ||
190 | AES_ENDPROC(aes_ctr_encrypt) | ||
191 | .ltorg | ||
192 | |||
193 | diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c | ||
194 | index 300382e5a2cc..c314db8b798c 100644 | ||
195 | --- a/arch/powerpc/kernel/eeh_driver.c | ||
196 | +++ b/arch/powerpc/kernel/eeh_driver.c | ||
197 | @@ -485,7 +485,7 @@ static void *eeh_pe_detach_dev(void *data, void *userdata) | ||
198 | static void *__eeh_clear_pe_frozen_state(void *data, void *flag) | ||
199 | { | ||
200 | struct eeh_pe *pe = (struct eeh_pe *)data; | ||
201 | - bool *clear_sw_state = flag; | ||
202 | + bool clear_sw_state = *(bool *)flag; | ||
203 | int i, rc = 1; | ||
204 | |||
205 | for (i = 0; rc && i < 3; i++) | ||
206 | diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c | ||
207 | index 7b89e7b305e6..3139533640fc 100644 | ||
208 | --- a/arch/powerpc/kernel/prom_init.c | ||
209 | +++ b/arch/powerpc/kernel/prom_init.c | ||
210 | @@ -2664,6 +2664,9 @@ static void __init prom_find_boot_cpu(void) | ||
211 | |||
212 | cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); | ||
213 | |||
214 | + if (!PHANDLE_VALID(cpu_pkg)) | ||
215 | + return; | ||
216 | + | ||
217 | prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); | ||
218 | prom.cpu = be32_to_cpu(rval); | ||
219 | |||
220 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c | ||
221 | index aaacbd667212..1e5d2f07416b 100644 | ||
222 | --- a/arch/x86/kernel/apic/io_apic.c | ||
223 | +++ b/arch/x86/kernel/apic/io_apic.c | ||
224 | @@ -2117,6 +2117,7 @@ static inline void __init check_timer(void) | ||
225 | if (idx != -1 && irq_trigger(idx)) | ||
226 | unmask_ioapic_irq(irq_get_chip_data(0)); | ||
227 | } | ||
228 | + irq_domain_deactivate_irq(irq_data); | ||
229 | irq_domain_activate_irq(irq_data); | ||
230 | if (timer_irq_works()) { | ||
231 | if (disable_timer_pin_1 > 0) | ||
232 | @@ -2138,6 +2139,7 @@ static inline void __init check_timer(void) | ||
233 | * legacy devices should be connected to IO APIC #0 | ||
234 | */ | ||
235 | replace_pin_at_irq_node(data, node, apic1, pin1, apic2, pin2); | ||
236 | + irq_domain_deactivate_irq(irq_data); | ||
237 | irq_domain_activate_irq(irq_data); | ||
238 | legacy_pic->unmask(0); | ||
239 | if (timer_irq_works()) { | ||
240 | diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c | ||
241 | index b8e6ff5cd5d0..acc9b8f19ca8 100644 | ||
242 | --- a/arch/x86/kernel/hpet.c | ||
243 | +++ b/arch/x86/kernel/hpet.c | ||
244 | @@ -351,6 +351,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) | ||
245 | } else { | ||
246 | struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); | ||
247 | |||
248 | + irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq)); | ||
249 | irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); | ||
250 | disable_irq(hdev->irq); | ||
251 | irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); | ||
252 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c | ||
253 | index 25a6efcfdf7f..e75095fa414e 100644 | ||
254 | --- a/arch/x86/kvm/x86.c | ||
255 | +++ b/arch/x86/kvm/x86.c | ||
256 | @@ -3057,6 +3057,7 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu) | ||
257 | memcpy(dest, xsave, XSAVE_HDR_OFFSET); | ||
258 | |||
259 | /* Set XSTATE_BV */ | ||
260 | + xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE; | ||
261 | *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; | ||
262 | |||
263 | /* | ||
264 | diff --git a/crypto/algapi.c b/crypto/algapi.c | ||
265 | index 59bf491fe3d8..43f5bdb6b570 100644 | ||
266 | --- a/crypto/algapi.c | ||
267 | +++ b/crypto/algapi.c | ||
268 | @@ -357,6 +357,7 @@ int crypto_register_alg(struct crypto_alg *alg) | ||
269 | struct crypto_larval *larval; | ||
270 | int err; | ||
271 | |||
272 | + alg->cra_flags &= ~CRYPTO_ALG_DEAD; | ||
273 | err = crypto_check_alg(alg); | ||
274 | if (err) | ||
275 | return err; | ||
276 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
277 | index bd370c98f77d..b0b77b61c40c 100644 | ||
278 | --- a/drivers/ata/libata-core.c | ||
279 | +++ b/drivers/ata/libata-core.c | ||
280 | @@ -4139,10 +4139,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
281 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, | ||
282 | |||
283 | /* | ||
284 | - * Device times out with higher max sects. | ||
285 | + * These devices time out with higher max sects. | ||
286 | * https://bugzilla.kernel.org/show_bug.cgi?id=121671 | ||
287 | */ | ||
288 | - { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, | ||
289 | + { "LITEON CX1-JB*-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, | ||
290 | |||
291 | /* Devices we expect to fail diagnostics */ | ||
292 | |||
293 | diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c | ||
294 | index bd74ee555278..729f26322095 100644 | ||
295 | --- a/drivers/ata/sata_mv.c | ||
296 | +++ b/drivers/ata/sata_mv.c | ||
297 | @@ -4121,6 +4121,9 @@ static int mv_platform_probe(struct platform_device *pdev) | ||
298 | host->iomap = NULL; | ||
299 | hpriv->base = devm_ioremap(&pdev->dev, res->start, | ||
300 | resource_size(res)); | ||
301 | + if (!hpriv->base) | ||
302 | + return -ENOMEM; | ||
303 | + | ||
304 | hpriv->base -= SATAHC0_REG_BASE; | ||
305 | |||
306 | hpriv->clk = clk_get(&pdev->dev, NULL); | ||
307 | diff --git a/drivers/base/memory.c b/drivers/base/memory.c | ||
308 | index 25425d3f2575..48c0a1d0dd3a 100644 | ||
309 | --- a/drivers/base/memory.c | ||
310 | +++ b/drivers/base/memory.c | ||
311 | @@ -388,30 +388,29 @@ static ssize_t show_valid_zones(struct device *dev, | ||
312 | { | ||
313 | struct memory_block *mem = to_memory_block(dev); | ||
314 | unsigned long start_pfn, end_pfn; | ||
315 | + unsigned long valid_start, valid_end; | ||
316 | unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; | ||
317 | - struct page *first_page; | ||
318 | struct zone *zone; | ||
319 | |||
320 | start_pfn = section_nr_to_pfn(mem->start_section_nr); | ||
321 | end_pfn = start_pfn + nr_pages; | ||
322 | - first_page = pfn_to_page(start_pfn); | ||
323 | |||
324 | /* The block contains more than one zone can not be offlined. */ | ||
325 | - if (!test_pages_in_a_zone(start_pfn, end_pfn)) | ||
326 | + if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) | ||
327 | return sprintf(buf, "none\n"); | ||
328 | |||
329 | - zone = page_zone(first_page); | ||
330 | + zone = page_zone(pfn_to_page(valid_start)); | ||
331 | |||
332 | if (zone_idx(zone) == ZONE_MOVABLE - 1) { | ||
333 | /*The mem block is the last memoryblock of this zone.*/ | ||
334 | - if (end_pfn == zone_end_pfn(zone)) | ||
335 | + if (valid_end == zone_end_pfn(zone)) | ||
336 | return sprintf(buf, "%s %s\n", | ||
337 | zone->name, (zone + 1)->name); | ||
338 | } | ||
339 | |||
340 | if (zone_idx(zone) == ZONE_MOVABLE) { | ||
341 | /*The mem block is the first memoryblock of ZONE_MOVABLE.*/ | ||
342 | - if (start_pfn == zone->zone_start_pfn) | ||
343 | + if (valid_start == zone->zone_start_pfn) | ||
344 | return sprintf(buf, "%s %s\n", | ||
345 | zone->name, (zone - 1)->name); | ||
346 | } | ||
347 | diff --git a/drivers/gpu/drm/nouveau/dispnv04/hw.c b/drivers/gpu/drm/nouveau/dispnv04/hw.c | ||
348 | index 956a833b8200..57c7389feee4 100644 | ||
349 | --- a/drivers/gpu/drm/nouveau/dispnv04/hw.c | ||
350 | +++ b/drivers/gpu/drm/nouveau/dispnv04/hw.c | ||
351 | @@ -222,6 +222,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) | ||
352 | uint32_t mpllP; | ||
353 | |||
354 | pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP); | ||
355 | + mpllP = (mpllP >> 8) & 0xf; | ||
356 | if (!mpllP) | ||
357 | mpllP = 4; | ||
358 | |||
359 | @@ -232,7 +233,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) | ||
360 | uint32_t clock; | ||
361 | |||
362 | pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock); | ||
363 | - return clock; | ||
364 | + return clock / 1000; | ||
365 | } | ||
366 | |||
367 | ret = nouveau_hw_get_pllvals(dev, plltype, &pllvals); | ||
368 | diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c | ||
369 | index c1590b746f13..eb58cd7bfbc9 100644 | ||
370 | --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c | ||
371 | +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c | ||
372 | @@ -59,7 +59,7 @@ gt215_hda_eld(NV50_DISP_MTHD_V1) | ||
373 | ); | ||
374 | } | ||
375 | for (i = 0; i < size; i++) | ||
376 | - nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[0]); | ||
377 | + nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[i]); | ||
378 | for (; i < 0x60; i++) | ||
379 | nvkm_wr32(device, 0x61c440 + soff, (i << 8)); | ||
380 | nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003); | ||
381 | diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c | ||
382 | index 5c02d7bbc7f2..35e3fd9fadf6 100644 | ||
383 | --- a/drivers/hid/wacom_wac.c | ||
384 | +++ b/drivers/hid/wacom_wac.c | ||
385 | @@ -148,19 +148,21 @@ static int wacom_pl_irq(struct wacom_wac *wacom) | ||
386 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
387 | } | ||
388 | |||
389 | - pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | ||
390 | - if (features->pressure_max > 255) | ||
391 | - pressure = (pressure << 1) | ((data[4] >> 6) & 1); | ||
392 | - pressure += (features->pressure_max + 1) / 2; | ||
393 | - | ||
394 | - input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | ||
395 | - input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | ||
396 | - input_report_abs(input, ABS_PRESSURE, pressure); | ||
397 | - | ||
398 | - input_report_key(input, BTN_TOUCH, data[4] & 0x08); | ||
399 | - input_report_key(input, BTN_STYLUS, data[4] & 0x10); | ||
400 | - /* Only allow the stylus2 button to be reported for the pen tool. */ | ||
401 | - input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); | ||
402 | + if (prox) { | ||
403 | + pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | ||
404 | + if (features->pressure_max > 255) | ||
405 | + pressure = (pressure << 1) | ((data[4] >> 6) & 1); | ||
406 | + pressure += (features->pressure_max + 1) / 2; | ||
407 | + | ||
408 | + input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | ||
409 | + input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | ||
410 | + input_report_abs(input, ABS_PRESSURE, pressure); | ||
411 | + | ||
412 | + input_report_key(input, BTN_TOUCH, data[4] & 0x08); | ||
413 | + input_report_key(input, BTN_STYLUS, data[4] & 0x10); | ||
414 | + /* Only allow the stylus2 button to be reported for the pen tool. */ | ||
415 | + input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); | ||
416 | + } | ||
417 | |||
418 | if (!prox) | ||
419 | wacom->id[0] = 0; | ||
420 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c | ||
421 | index 7277dfd7338f..bda164089904 100644 | ||
422 | --- a/drivers/mmc/host/sdhci.c | ||
423 | +++ b/drivers/mmc/host/sdhci.c | ||
424 | @@ -2629,7 +2629,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) | ||
425 | pr_err("%s: Card is consuming too much power!\n", | ||
426 | mmc_hostname(host->mmc)); | ||
427 | |||
428 | - if (intmask & SDHCI_INT_CARD_INT) { | ||
429 | + if ((intmask & SDHCI_INT_CARD_INT) && | ||
430 | + (host->ier & SDHCI_INT_CARD_INT)) { | ||
431 | sdhci_enable_sdio_irq_nolock(host, false); | ||
432 | host->thread_isr |= SDHCI_INT_CARD_INT; | ||
433 | result = IRQ_WAKE_THREAD; | ||
434 | diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c | ||
435 | index 317e3558a35e..c6a012b5ba39 100644 | ||
436 | --- a/drivers/pci/pcie/aspm.c | ||
437 | +++ b/drivers/pci/pcie/aspm.c | ||
438 | @@ -518,25 +518,32 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) | ||
439 | link = kzalloc(sizeof(*link), GFP_KERNEL); | ||
440 | if (!link) | ||
441 | return NULL; | ||
442 | + | ||
443 | INIT_LIST_HEAD(&link->sibling); | ||
444 | INIT_LIST_HEAD(&link->children); | ||
445 | INIT_LIST_HEAD(&link->link); | ||
446 | link->pdev = pdev; | ||
447 | - if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) { | ||
448 | + | ||
449 | + /* | ||
450 | + * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe | ||
451 | + * hierarchies. | ||
452 | + */ | ||
453 | + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || | ||
454 | + pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE) { | ||
455 | + link->root = link; | ||
456 | + } else { | ||
457 | struct pcie_link_state *parent; | ||
458 | + | ||
459 | parent = pdev->bus->parent->self->link_state; | ||
460 | if (!parent) { | ||
461 | kfree(link); | ||
462 | return NULL; | ||
463 | } | ||
464 | + | ||
465 | link->parent = parent; | ||
466 | + link->root = link->parent->root; | ||
467 | list_add(&link->link, &parent->children); | ||
468 | } | ||
469 | - /* Setup a pointer to the root port link */ | ||
470 | - if (!link->parent) | ||
471 | - link->root = link; | ||
472 | - else | ||
473 | - link->root = link->parent->root; | ||
474 | |||
475 | list_add(&link->sibling, &link_list); | ||
476 | pdev->link_state = link; | ||
477 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c | ||
478 | index d2e50a27140c..24f9f98968a5 100644 | ||
479 | --- a/drivers/usb/core/quirks.c | ||
480 | +++ b/drivers/usb/core/quirks.c | ||
481 | @@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = { | ||
482 | /* CBM - Flash disk */ | ||
483 | { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
484 | |||
485 | + /* WORLDE easy key (easykey.25) MIDI controller */ | ||
486 | + { USB_DEVICE(0x0218, 0x0401), .driver_info = | ||
487 | + USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
488 | + | ||
489 | /* HP 5300/5370C scanner */ | ||
490 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = | ||
491 | USB_QUIRK_STRING_FETCH_255 }, | ||
492 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c | ||
493 | index 803c503a2e3d..cfda1a1c0ab6 100644 | ||
494 | --- a/drivers/usb/gadget/function/f_fs.c | ||
495 | +++ b/drivers/usb/gadget/function/f_fs.c | ||
496 | @@ -2079,6 +2079,8 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | ||
497 | if (len < sizeof(*d) || h->interface >= ffs->interfaces_count) | ||
498 | return -EINVAL; | ||
499 | length = le32_to_cpu(d->dwSize); | ||
500 | + if (len < length) | ||
501 | + return -EINVAL; | ||
502 | type = le32_to_cpu(d->dwPropertyDataType); | ||
503 | if (type < USB_EXT_PROP_UNICODE || | ||
504 | type > USB_EXT_PROP_UNICODE_MULTI) { | ||
505 | @@ -2087,6 +2089,11 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, | ||
506 | return -EINVAL; | ||
507 | } | ||
508 | pnl = le16_to_cpu(d->wPropertyNameLength); | ||
509 | + if (length < 14 + pnl) { | ||
510 | + pr_vdebug("invalid os descriptor length: %d pnl:%d (descriptor %d)\n", | ||
511 | + length, pnl, type); | ||
512 | + return -EINVAL; | ||
513 | + } | ||
514 | pdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl)); | ||
515 | if (length != 14 + pnl + pdl) { | ||
516 | pr_vdebug("invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\n", | ||
517 | @@ -2171,6 +2178,9 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | ||
518 | } | ||
519 | } | ||
520 | if (flags & (1 << i)) { | ||
521 | + if (len < 4) { | ||
522 | + goto error; | ||
523 | + } | ||
524 | os_descs_count = get_unaligned_le32(data); | ||
525 | data += 4; | ||
526 | len -= 4; | ||
527 | @@ -2243,7 +2253,8 @@ static int __ffs_data_got_strings(struct ffs_data *ffs, | ||
528 | |||
529 | ENTER(); | ||
530 | |||
531 | - if (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || | ||
532 | + if (unlikely(len < 16 || | ||
533 | + get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || | ||
534 | get_unaligned_le32(data + 4) != len)) | ||
535 | goto error; | ||
536 | str_count = get_unaligned_le32(data + 8); | ||
537 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
538 | index 7ce31a4c7e7f..42cc72e54c05 100644 | ||
539 | --- a/drivers/usb/serial/option.c | ||
540 | +++ b/drivers/usb/serial/option.c | ||
541 | @@ -2007,6 +2007,7 @@ static const struct usb_device_id option_ids[] = { | ||
542 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) }, | ||
543 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) }, | ||
544 | { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) }, | ||
545 | + { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x421d, 0xff, 0xff, 0xff) }, /* HP lt2523 (Novatel E371) */ | ||
546 | { } /* Terminating entry */ | ||
547 | }; | ||
548 | MODULE_DEVICE_TABLE(usb, option_ids); | ||
549 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c | ||
550 | index 46fca6b75846..1db4b61bdf7b 100644 | ||
551 | --- a/drivers/usb/serial/pl2303.c | ||
552 | +++ b/drivers/usb/serial/pl2303.c | ||
553 | @@ -49,6 +49,7 @@ static const struct usb_device_id id_table[] = { | ||
554 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | ||
555 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | ||
556 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | ||
557 | + { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) }, | ||
558 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, | ||
559 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, | ||
560 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, | ||
561 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h | ||
562 | index e3b7af8adfb7..09d9be88209e 100644 | ||
563 | --- a/drivers/usb/serial/pl2303.h | ||
564 | +++ b/drivers/usb/serial/pl2303.h | ||
565 | @@ -27,6 +27,7 @@ | ||
566 | #define ATEN_VENDOR_ID 0x0557 | ||
567 | #define ATEN_VENDOR_ID2 0x0547 | ||
568 | #define ATEN_PRODUCT_ID 0x2008 | ||
569 | +#define ATEN_PRODUCT_ID2 0x2118 | ||
570 | |||
571 | #define IODATA_VENDOR_ID 0x04bb | ||
572 | #define IODATA_PRODUCT_ID 0x0a03 | ||
573 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c | ||
574 | index 1bc6089b9008..696458db7e3c 100644 | ||
575 | --- a/drivers/usb/serial/qcserial.c | ||
576 | +++ b/drivers/usb/serial/qcserial.c | ||
577 | @@ -124,6 +124,7 @@ static const struct usb_device_id id_table[] = { | ||
578 | {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ | ||
579 | {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ | ||
580 | {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ | ||
581 | + {USB_DEVICE(0x413c, 0x81a6)}, /* Dell DW5570 QDL (MC8805) */ | ||
582 | {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */ | ||
583 | {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ | ||
584 | {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */ | ||
585 | diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c | ||
586 | index 833e5844a2db..97d1a15873c5 100644 | ||
587 | --- a/fs/cifs/readdir.c | ||
588 | +++ b/fs/cifs/readdir.c | ||
589 | @@ -282,6 +282,7 @@ initiate_cifs_search(const unsigned int xid, struct file *file) | ||
590 | rc = -ENOMEM; | ||
591 | goto error_exit; | ||
592 | } | ||
593 | + spin_lock_init(&cifsFile->file_info_lock); | ||
594 | file->private_data = cifsFile; | ||
595 | cifsFile->tlink = cifs_get_tlink(tlink); | ||
596 | tcon = tlink_tcon(tlink); | ||
597 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c | ||
598 | index 68640e6f95c5..b405a7b74ce0 100644 | ||
599 | --- a/fs/ext4/super.c | ||
600 | +++ b/fs/ext4/super.c | ||
601 | @@ -3663,6 +3663,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||
602 | (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); | ||
603 | db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / | ||
604 | EXT4_DESC_PER_BLOCK(sb); | ||
605 | + if (ext4_has_feature_meta_bg(sb)) { | ||
606 | + if (le32_to_cpu(es->s_first_meta_bg) >= db_count) { | ||
607 | + ext4_msg(sb, KERN_WARNING, | ||
608 | + "first meta block group too large: %u " | ||
609 | + "(group descriptor block count %u)", | ||
610 | + le32_to_cpu(es->s_first_meta_bg), db_count); | ||
611 | + goto failed_mount; | ||
612 | + } | ||
613 | + } | ||
614 | sbi->s_group_desc = ext4_kvmalloc(db_count * | ||
615 | sizeof(struct buffer_head *), | ||
616 | GFP_KERNEL); | ||
617 | diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c | ||
618 | index c9d6c715c0fb..9eed219f57a5 100644 | ||
619 | --- a/fs/nfsd/nfs4layouts.c | ||
620 | +++ b/fs/nfsd/nfs4layouts.c | ||
621 | @@ -189,10 +189,11 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate, | ||
622 | struct nfs4_layout_stateid *ls; | ||
623 | struct nfs4_stid *stp; | ||
624 | |||
625 | - stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache); | ||
626 | + stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache, | ||
627 | + nfsd4_free_layout_stateid); | ||
628 | if (!stp) | ||
629 | return NULL; | ||
630 | - stp->sc_free = nfsd4_free_layout_stateid; | ||
631 | + | ||
632 | get_nfs4_file(fp); | ||
633 | stp->sc_file = fp; | ||
634 | |||
635 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
636 | index 55638110cb06..c7f1ce41442a 100644 | ||
637 | --- a/fs/nfsd/nfs4state.c | ||
638 | +++ b/fs/nfsd/nfs4state.c | ||
639 | @@ -553,8 +553,8 @@ out: | ||
640 | return co; | ||
641 | } | ||
642 | |||
643 | -struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | ||
644 | - struct kmem_cache *slab) | ||
645 | +struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, | ||
646 | + void (*sc_free)(struct nfs4_stid *)) | ||
647 | { | ||
648 | struct nfs4_stid *stid; | ||
649 | int new_id; | ||
650 | @@ -570,6 +570,8 @@ struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | ||
651 | idr_preload_end(); | ||
652 | if (new_id < 0) | ||
653 | goto out_free; | ||
654 | + | ||
655 | + stid->sc_free = sc_free; | ||
656 | stid->sc_client = cl; | ||
657 | stid->sc_stateid.si_opaque.so_id = new_id; | ||
658 | stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; | ||
659 | @@ -595,15 +597,12 @@ out_free: | ||
660 | static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) | ||
661 | { | ||
662 | struct nfs4_stid *stid; | ||
663 | - struct nfs4_ol_stateid *stp; | ||
664 | |||
665 | - stid = nfs4_alloc_stid(clp, stateid_slab); | ||
666 | + stid = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_ol_stateid); | ||
667 | if (!stid) | ||
668 | return NULL; | ||
669 | |||
670 | - stp = openlockstateid(stid); | ||
671 | - stp->st_stid.sc_free = nfs4_free_ol_stateid; | ||
672 | - return stp; | ||
673 | + return openlockstateid(stid); | ||
674 | } | ||
675 | |||
676 | static void nfs4_free_deleg(struct nfs4_stid *stid) | ||
677 | @@ -701,11 +700,10 @@ alloc_init_deleg(struct nfs4_client *clp, struct svc_fh *current_fh, | ||
678 | goto out_dec; | ||
679 | if (delegation_blocked(¤t_fh->fh_handle)) | ||
680 | goto out_dec; | ||
681 | - dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); | ||
682 | + dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab, nfs4_free_deleg)); | ||
683 | if (dp == NULL) | ||
684 | goto out_dec; | ||
685 | |||
686 | - dp->dl_stid.sc_free = nfs4_free_deleg; | ||
687 | /* | ||
688 | * delegation seqid's are never incremented. The 4.1 special | ||
689 | * meaning of seqid 0 isn't meaningful, really, but let's avoid | ||
690 | @@ -5396,7 +5394,6 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | ||
691 | stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); | ||
692 | get_nfs4_file(fp); | ||
693 | stp->st_stid.sc_file = fp; | ||
694 | - stp->st_stid.sc_free = nfs4_free_lock_stateid; | ||
695 | stp->st_access_bmap = 0; | ||
696 | stp->st_deny_bmap = open_stp->st_deny_bmap; | ||
697 | stp->st_openstp = open_stp; | ||
698 | @@ -5439,7 +5436,7 @@ find_or_create_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fi, | ||
699 | lst = find_lock_stateid(lo, fi); | ||
700 | if (lst == NULL) { | ||
701 | spin_unlock(&clp->cl_lock); | ||
702 | - ns = nfs4_alloc_stid(clp, stateid_slab); | ||
703 | + ns = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_lock_stateid); | ||
704 | if (ns == NULL) | ||
705 | return NULL; | ||
706 | |||
707 | diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h | ||
708 | index 77860b75da9d..5134eedcb16c 100644 | ||
709 | --- a/fs/nfsd/state.h | ||
710 | +++ b/fs/nfsd/state.h | ||
711 | @@ -583,8 +583,8 @@ extern __be32 nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, | ||
712 | __be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, | ||
713 | stateid_t *stateid, unsigned char typemask, | ||
714 | struct nfs4_stid **s, struct nfsd_net *nn); | ||
715 | -struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | ||
716 | - struct kmem_cache *slab); | ||
717 | +struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, | ||
718 | + void (*sc_free)(struct nfs4_stid *)); | ||
719 | void nfs4_unhash_stid(struct nfs4_stid *s); | ||
720 | void nfs4_put_stid(struct nfs4_stid *s); | ||
721 | void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid); | ||
722 | diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h | ||
723 | index 2ea574ff9714..538488bd1d3d 100644 | ||
724 | --- a/include/linux/memory_hotplug.h | ||
725 | +++ b/include/linux/memory_hotplug.h | ||
726 | @@ -85,7 +85,8 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); | ||
727 | extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); | ||
728 | /* VM interface that may be used by firmware interface */ | ||
729 | extern int online_pages(unsigned long, unsigned long, int); | ||
730 | -extern int test_pages_in_a_zone(unsigned long, unsigned long); | ||
731 | +extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, | ||
732 | + unsigned long *valid_start, unsigned long *valid_end); | ||
733 | extern void __offline_isolated_pages(unsigned long, unsigned long); | ||
734 | |||
735 | typedef void (*online_page_callback_t)(struct page *page); | ||
736 | diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h | ||
737 | index 12c9b485beb7..abd7c01c84db 100644 | ||
738 | --- a/include/linux/percpu-refcount.h | ||
739 | +++ b/include/linux/percpu-refcount.h | ||
740 | @@ -206,7 +206,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref) | ||
741 | static inline bool percpu_ref_tryget(struct percpu_ref *ref) | ||
742 | { | ||
743 | unsigned long __percpu *percpu_count; | ||
744 | - int ret; | ||
745 | + bool ret; | ||
746 | |||
747 | rcu_read_lock_sched(); | ||
748 | |||
749 | @@ -240,7 +240,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) | ||
750 | static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) | ||
751 | { | ||
752 | unsigned long __percpu *percpu_count; | ||
753 | - int ret = false; | ||
754 | + bool ret = false; | ||
755 | |||
756 | rcu_read_lock_sched(); | ||
757 | |||
758 | diff --git a/kernel/events/core.c b/kernel/events/core.c | ||
759 | index bc6371b0e4fb..9bbe9ac23cf2 100644 | ||
760 | --- a/kernel/events/core.c | ||
761 | +++ b/kernel/events/core.c | ||
762 | @@ -6039,6 +6039,27 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | ||
763 | char *buf = NULL; | ||
764 | char *name; | ||
765 | |||
766 | + if (vma->vm_flags & VM_READ) | ||
767 | + prot |= PROT_READ; | ||
768 | + if (vma->vm_flags & VM_WRITE) | ||
769 | + prot |= PROT_WRITE; | ||
770 | + if (vma->vm_flags & VM_EXEC) | ||
771 | + prot |= PROT_EXEC; | ||
772 | + | ||
773 | + if (vma->vm_flags & VM_MAYSHARE) | ||
774 | + flags = MAP_SHARED; | ||
775 | + else | ||
776 | + flags = MAP_PRIVATE; | ||
777 | + | ||
778 | + if (vma->vm_flags & VM_DENYWRITE) | ||
779 | + flags |= MAP_DENYWRITE; | ||
780 | + if (vma->vm_flags & VM_MAYEXEC) | ||
781 | + flags |= MAP_EXECUTABLE; | ||
782 | + if (vma->vm_flags & VM_LOCKED) | ||
783 | + flags |= MAP_LOCKED; | ||
784 | + if (vma->vm_flags & VM_HUGETLB) | ||
785 | + flags |= MAP_HUGETLB; | ||
786 | + | ||
787 | if (file) { | ||
788 | struct inode *inode; | ||
789 | dev_t dev; | ||
790 | @@ -6065,27 +6086,6 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | ||
791 | maj = MAJOR(dev); | ||
792 | min = MINOR(dev); | ||
793 | |||
794 | - if (vma->vm_flags & VM_READ) | ||
795 | - prot |= PROT_READ; | ||
796 | - if (vma->vm_flags & VM_WRITE) | ||
797 | - prot |= PROT_WRITE; | ||
798 | - if (vma->vm_flags & VM_EXEC) | ||
799 | - prot |= PROT_EXEC; | ||
800 | - | ||
801 | - if (vma->vm_flags & VM_MAYSHARE) | ||
802 | - flags = MAP_SHARED; | ||
803 | - else | ||
804 | - flags = MAP_PRIVATE; | ||
805 | - | ||
806 | - if (vma->vm_flags & VM_DENYWRITE) | ||
807 | - flags |= MAP_DENYWRITE; | ||
808 | - if (vma->vm_flags & VM_MAYEXEC) | ||
809 | - flags |= MAP_EXECUTABLE; | ||
810 | - if (vma->vm_flags & VM_LOCKED) | ||
811 | - flags |= MAP_LOCKED; | ||
812 | - if (vma->vm_flags & VM_HUGETLB) | ||
813 | - flags |= MAP_HUGETLB; | ||
814 | - | ||
815 | goto got_name; | ||
816 | } else { | ||
817 | if (vma->vm_ops && vma->vm_ops->name) { | ||
818 | diff --git a/mm/filemap.c b/mm/filemap.c | ||
819 | index c588d1222b2a..c33c31d75a2b 100644 | ||
820 | --- a/mm/filemap.c | ||
821 | +++ b/mm/filemap.c | ||
822 | @@ -1559,6 +1559,11 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos, | ||
823 | |||
824 | cond_resched(); | ||
825 | find_page: | ||
826 | + if (fatal_signal_pending(current)) { | ||
827 | + error = -EINTR; | ||
828 | + goto out; | ||
829 | + } | ||
830 | + | ||
831 | page = find_get_page(mapping, index); | ||
832 | if (!page) { | ||
833 | page_cache_sync_readahead(mapping, | ||
834 | diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c | ||
835 | index a042a9d537bb..a18923e4359d 100644 | ||
836 | --- a/mm/memory_hotplug.c | ||
837 | +++ b/mm/memory_hotplug.c | ||
838 | @@ -1371,17 +1371,20 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) | ||
839 | } | ||
840 | |||
841 | /* | ||
842 | - * Confirm all pages in a range [start, end) is belongs to the same zone. | ||
843 | + * Confirm all pages in a range [start, end) belong to the same zone. | ||
844 | + * When true, return its valid [start, end). | ||
845 | */ | ||
846 | -int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | ||
847 | +int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, | ||
848 | + unsigned long *valid_start, unsigned long *valid_end) | ||
849 | { | ||
850 | unsigned long pfn, sec_end_pfn; | ||
851 | + unsigned long start, end; | ||
852 | struct zone *zone = NULL; | ||
853 | struct page *page; | ||
854 | int i; | ||
855 | - for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn); | ||
856 | + for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1); | ||
857 | pfn < end_pfn; | ||
858 | - pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) { | ||
859 | + pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) { | ||
860 | /* Make sure the memory section is present first */ | ||
861 | if (!present_section_nr(pfn_to_section_nr(pfn))) | ||
862 | continue; | ||
863 | @@ -1397,10 +1400,20 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | ||
864 | page = pfn_to_page(pfn + i); | ||
865 | if (zone && page_zone(page) != zone) | ||
866 | return 0; | ||
867 | + if (!zone) | ||
868 | + start = pfn + i; | ||
869 | zone = page_zone(page); | ||
870 | + end = pfn + MAX_ORDER_NR_PAGES; | ||
871 | } | ||
872 | } | ||
873 | - return 1; | ||
874 | + | ||
875 | + if (zone) { | ||
876 | + *valid_start = start; | ||
877 | + *valid_end = end; | ||
878 | + return 1; | ||
879 | + } else { | ||
880 | + return 0; | ||
881 | + } | ||
882 | } | ||
883 | |||
884 | /* | ||
885 | @@ -1718,6 +1731,7 @@ static int __ref __offline_pages(unsigned long start_pfn, | ||
886 | long offlined_pages; | ||
887 | int ret, drain, retry_max, node; | ||
888 | unsigned long flags; | ||
889 | + unsigned long valid_start, valid_end; | ||
890 | struct zone *zone; | ||
891 | struct memory_notify arg; | ||
892 | |||
893 | @@ -1728,10 +1742,10 @@ static int __ref __offline_pages(unsigned long start_pfn, | ||
894 | return -EINVAL; | ||
895 | /* This makes hotplug much easier...and readable. | ||
896 | we assume this for now. .*/ | ||
897 | - if (!test_pages_in_a_zone(start_pfn, end_pfn)) | ||
898 | + if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) | ||
899 | return -EINVAL; | ||
900 | |||
901 | - zone = page_zone(pfn_to_page(start_pfn)); | ||
902 | + zone = page_zone(pfn_to_page(valid_start)); | ||
903 | node = zone_to_nid(zone); | ||
904 | nr_pages = end_pfn - start_pfn; | ||
905 | |||
906 | diff --git a/mm/zswap.c b/mm/zswap.c | ||
907 | index 340261946fda..45476f429789 100644 | ||
908 | --- a/mm/zswap.c | ||
909 | +++ b/mm/zswap.c | ||
910 | @@ -78,7 +78,13 @@ static u64 zswap_duplicate_entry; | ||
911 | |||
912 | /* Enable/disable zswap (disabled by default) */ | ||
913 | static bool zswap_enabled; | ||
914 | -module_param_named(enabled, zswap_enabled, bool, 0644); | ||
915 | +static int zswap_enabled_param_set(const char *, | ||
916 | + const struct kernel_param *); | ||
917 | +static struct kernel_param_ops zswap_enabled_param_ops = { | ||
918 | + .set = zswap_enabled_param_set, | ||
919 | + .get = param_get_bool, | ||
920 | +}; | ||
921 | +module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644); | ||
922 | |||
923 | /* Crypto compressor to use */ | ||
924 | #define ZSWAP_COMPRESSOR_DEFAULT "lzo" | ||
925 | @@ -176,6 +182,9 @@ static atomic_t zswap_pools_count = ATOMIC_INIT(0); | ||
926 | /* used by param callback function */ | ||
927 | static bool zswap_init_started; | ||
928 | |||
929 | +/* fatal error during init */ | ||
930 | +static bool zswap_init_failed; | ||
931 | + | ||
932 | /********************************* | ||
933 | * helpers and fwd declarations | ||
934 | **********************************/ | ||
935 | @@ -702,6 +711,11 @@ static int __zswap_param_set(const char *val, const struct kernel_param *kp, | ||
936 | char *s = strstrip((char *)val); | ||
937 | int ret; | ||
938 | |||
939 | + if (zswap_init_failed) { | ||
940 | + pr_err("can't set param, initialization failed\n"); | ||
941 | + return -ENODEV; | ||
942 | + } | ||
943 | + | ||
944 | /* no change required */ | ||
945 | if (!strcmp(s, *(char **)kp->arg)) | ||
946 | return 0; | ||
947 | @@ -781,6 +795,17 @@ static int zswap_zpool_param_set(const char *val, | ||
948 | return __zswap_param_set(val, kp, NULL, zswap_compressor); | ||
949 | } | ||
950 | |||
951 | +static int zswap_enabled_param_set(const char *val, | ||
952 | + const struct kernel_param *kp) | ||
953 | +{ | ||
954 | + if (zswap_init_failed) { | ||
955 | + pr_err("can't enable, initialization failed\n"); | ||
956 | + return -ENODEV; | ||
957 | + } | ||
958 | + | ||
959 | + return param_set_bool(val, kp); | ||
960 | +} | ||
961 | + | ||
962 | /********************************* | ||
963 | * writeback code | ||
964 | **********************************/ | ||
965 | @@ -1267,6 +1292,9 @@ pool_fail: | ||
966 | dstmem_fail: | ||
967 | zswap_entry_cache_destroy(); | ||
968 | cache_fail: | ||
969 | + /* if built-in, we aren't unloaded on failure; don't allow use */ | ||
970 | + zswap_init_failed = true; | ||
971 | + zswap_enabled = false; | ||
972 | return -ENOMEM; | ||
973 | } | ||
974 | /* must be late so crypto has time to come up */ | ||
975 | diff --git a/net/can/bcm.c b/net/can/bcm.c | ||
976 | index 8ef1afacad82..24d66c1cc0cd 100644 | ||
977 | --- a/net/can/bcm.c | ||
978 | +++ b/net/can/bcm.c | ||
979 | @@ -710,14 +710,23 @@ static struct bcm_op *bcm_find_op(struct list_head *ops, canid_t can_id, | ||
980 | |||
981 | static void bcm_remove_op(struct bcm_op *op) | ||
982 | { | ||
983 | - hrtimer_cancel(&op->timer); | ||
984 | - hrtimer_cancel(&op->thrtimer); | ||
985 | - | ||
986 | - if (op->tsklet.func) | ||
987 | - tasklet_kill(&op->tsklet); | ||
988 | + if (op->tsklet.func) { | ||
989 | + while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) || | ||
990 | + test_bit(TASKLET_STATE_RUN, &op->tsklet.state) || | ||
991 | + hrtimer_active(&op->timer)) { | ||
992 | + hrtimer_cancel(&op->timer); | ||
993 | + tasklet_kill(&op->tsklet); | ||
994 | + } | ||
995 | + } | ||
996 | |||
997 | - if (op->thrtsklet.func) | ||
998 | - tasklet_kill(&op->thrtsklet); | ||
999 | + if (op->thrtsklet.func) { | ||
1000 | + while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) || | ||
1001 | + test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) || | ||
1002 | + hrtimer_active(&op->thrtimer)) { | ||
1003 | + hrtimer_cancel(&op->thrtimer); | ||
1004 | + tasklet_kill(&op->thrtsklet); | ||
1005 | + } | ||
1006 | + } | ||
1007 | |||
1008 | if ((op->frames) && (op->frames != &op->sframe)) | ||
1009 | kfree(op->frames); | ||
1010 | diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
1011 | index eeeba5adee6d..2410d557ae39 100644 | ||
1012 | --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
1013 | +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
1014 | @@ -260,7 +260,7 @@ static int gssx_dec_option_array(struct xdr_stream *xdr, | ||
1015 | if (!oa->data) | ||
1016 | return -ENOMEM; | ||
1017 | |||
1018 | - creds = kmalloc(sizeof(struct svc_cred), GFP_KERNEL); | ||
1019 | + creds = kzalloc(sizeof(struct svc_cred), GFP_KERNEL); | ||
1020 | if (!creds) { | ||
1021 | kfree(oa->data); | ||
1022 | return -ENOMEM; |