Contents of /trunk/kernel-alx/patches-4.4/0135-4.4.36-all-fixes.patch
Parent Directory | Revision Log
Revision 2871 -
(show annotations)
(download)
Mon Mar 27 13:49:13 2017 UTC (7 years, 6 months ago) by niro
File size: 30863 byte(s)
Mon Mar 27 13:49:13 2017 UTC (7 years, 6 months ago) by niro
File size: 30863 byte(s)
linux-4.4.36
1 | diff --git a/Makefile b/Makefile |
2 | index f88830af1533..705eb9e38fce 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 4 |
8 | -SUBLEVEL = 35 |
9 | +SUBLEVEL = 36 |
10 | EXTRAVERSION = |
11 | NAME = Blurry Fish Butt |
12 | |
13 | diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c |
14 | index cda6dbbe9842..fd5979f28ada 100644 |
15 | --- a/arch/parisc/kernel/cache.c |
16 | +++ b/arch/parisc/kernel/cache.c |
17 | @@ -351,6 +351,7 @@ void __init parisc_setup_cache_timing(void) |
18 | { |
19 | unsigned long rangetime, alltime; |
20 | unsigned long size, start; |
21 | + unsigned long threshold; |
22 | |
23 | alltime = mfctl(16); |
24 | flush_data_cache(); |
25 | @@ -364,17 +365,12 @@ void __init parisc_setup_cache_timing(void) |
26 | printk(KERN_DEBUG "Whole cache flush %lu cycles, flushing %lu bytes %lu cycles\n", |
27 | alltime, size, rangetime); |
28 | |
29 | - /* Racy, but if we see an intermediate value, it's ok too... */ |
30 | - parisc_cache_flush_threshold = size * alltime / rangetime; |
31 | - |
32 | - parisc_cache_flush_threshold = L1_CACHE_ALIGN(parisc_cache_flush_threshold); |
33 | - if (!parisc_cache_flush_threshold) |
34 | - parisc_cache_flush_threshold = FLUSH_THRESHOLD; |
35 | - |
36 | - if (parisc_cache_flush_threshold > cache_info.dc_size) |
37 | - parisc_cache_flush_threshold = cache_info.dc_size; |
38 | - |
39 | - printk(KERN_INFO "Setting cache flush threshold to %lu kB\n", |
40 | + threshold = L1_CACHE_ALIGN(size * alltime / rangetime); |
41 | + if (threshold > cache_info.dc_size) |
42 | + threshold = cache_info.dc_size; |
43 | + if (threshold) |
44 | + parisc_cache_flush_threshold = threshold; |
45 | + printk(KERN_INFO "Cache flush threshold set to %lu KiB\n", |
46 | parisc_cache_flush_threshold/1024); |
47 | |
48 | /* calculate TLB flush threshold */ |
49 | @@ -383,7 +379,7 @@ void __init parisc_setup_cache_timing(void) |
50 | flush_tlb_all(); |
51 | alltime = mfctl(16) - alltime; |
52 | |
53 | - size = PAGE_SIZE; |
54 | + size = 0; |
55 | start = (unsigned long) _text; |
56 | rangetime = mfctl(16); |
57 | while (start < (unsigned long) _end) { |
58 | @@ -396,13 +392,10 @@ void __init parisc_setup_cache_timing(void) |
59 | printk(KERN_DEBUG "Whole TLB flush %lu cycles, flushing %lu bytes %lu cycles\n", |
60 | alltime, size, rangetime); |
61 | |
62 | - parisc_tlb_flush_threshold = size * alltime / rangetime; |
63 | - parisc_tlb_flush_threshold *= num_online_cpus(); |
64 | - parisc_tlb_flush_threshold = PAGE_ALIGN(parisc_tlb_flush_threshold); |
65 | - if (!parisc_tlb_flush_threshold) |
66 | - parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD; |
67 | - |
68 | - printk(KERN_INFO "Setting TLB flush threshold to %lu kB\n", |
69 | + threshold = PAGE_ALIGN(num_online_cpus() * size * alltime / rangetime); |
70 | + if (threshold) |
71 | + parisc_tlb_flush_threshold = threshold; |
72 | + printk(KERN_INFO "TLB flush threshold set to %lu KiB\n", |
73 | parisc_tlb_flush_threshold/1024); |
74 | } |
75 | |
76 | diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S |
77 | index b743a80eaba0..675521919229 100644 |
78 | --- a/arch/parisc/kernel/pacache.S |
79 | +++ b/arch/parisc/kernel/pacache.S |
80 | @@ -96,7 +96,7 @@ fitmanyloop: /* Loop if LOOP >= 2 */ |
81 | |
82 | fitmanymiddle: /* Loop if LOOP >= 2 */ |
83 | addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */ |
84 | - pitlbe 0(%sr1, %r28) |
85 | + pitlbe %r0(%sr1, %r28) |
86 | pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */ |
87 | addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */ |
88 | copy %arg3, %r31 /* Re-init inner loop count */ |
89 | @@ -139,7 +139,7 @@ fdtmanyloop: /* Loop if LOOP >= 2 */ |
90 | |
91 | fdtmanymiddle: /* Loop if LOOP >= 2 */ |
92 | addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */ |
93 | - pdtlbe 0(%sr1, %r28) |
94 | + pdtlbe %r0(%sr1, %r28) |
95 | pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */ |
96 | addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */ |
97 | copy %arg3, %r31 /* Re-init inner loop count */ |
98 | @@ -620,12 +620,12 @@ ENTRY(copy_user_page_asm) |
99 | /* Purge any old translations */ |
100 | |
101 | #ifdef CONFIG_PA20 |
102 | - pdtlb,l 0(%r28) |
103 | - pdtlb,l 0(%r29) |
104 | + pdtlb,l %r0(%r28) |
105 | + pdtlb,l %r0(%r29) |
106 | #else |
107 | tlb_lock %r20,%r21,%r22 |
108 | - pdtlb 0(%r28) |
109 | - pdtlb 0(%r29) |
110 | + pdtlb %r0(%r28) |
111 | + pdtlb %r0(%r29) |
112 | tlb_unlock %r20,%r21,%r22 |
113 | #endif |
114 | |
115 | @@ -768,10 +768,10 @@ ENTRY(clear_user_page_asm) |
116 | /* Purge any old translation */ |
117 | |
118 | #ifdef CONFIG_PA20 |
119 | - pdtlb,l 0(%r28) |
120 | + pdtlb,l %r0(%r28) |
121 | #else |
122 | tlb_lock %r20,%r21,%r22 |
123 | - pdtlb 0(%r28) |
124 | + pdtlb %r0(%r28) |
125 | tlb_unlock %r20,%r21,%r22 |
126 | #endif |
127 | |
128 | @@ -852,10 +852,10 @@ ENTRY(flush_dcache_page_asm) |
129 | /* Purge any old translation */ |
130 | |
131 | #ifdef CONFIG_PA20 |
132 | - pdtlb,l 0(%r28) |
133 | + pdtlb,l %r0(%r28) |
134 | #else |
135 | tlb_lock %r20,%r21,%r22 |
136 | - pdtlb 0(%r28) |
137 | + pdtlb %r0(%r28) |
138 | tlb_unlock %r20,%r21,%r22 |
139 | #endif |
140 | |
141 | @@ -892,10 +892,10 @@ ENTRY(flush_dcache_page_asm) |
142 | sync |
143 | |
144 | #ifdef CONFIG_PA20 |
145 | - pdtlb,l 0(%r25) |
146 | + pdtlb,l %r0(%r25) |
147 | #else |
148 | tlb_lock %r20,%r21,%r22 |
149 | - pdtlb 0(%r25) |
150 | + pdtlb %r0(%r25) |
151 | tlb_unlock %r20,%r21,%r22 |
152 | #endif |
153 | |
154 | @@ -925,13 +925,18 @@ ENTRY(flush_icache_page_asm) |
155 | depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ |
156 | #endif |
157 | |
158 | - /* Purge any old translation */ |
159 | + /* Purge any old translation. Note that the FIC instruction |
160 | + * may use either the instruction or data TLB. Given that we |
161 | + * have a flat address space, it's not clear which TLB will be |
162 | + * used. So, we purge both entries. */ |
163 | |
164 | #ifdef CONFIG_PA20 |
165 | + pdtlb,l %r0(%r28) |
166 | pitlb,l %r0(%sr4,%r28) |
167 | #else |
168 | tlb_lock %r20,%r21,%r22 |
169 | - pitlb (%sr4,%r28) |
170 | + pdtlb %r0(%r28) |
171 | + pitlb %r0(%sr4,%r28) |
172 | tlb_unlock %r20,%r21,%r22 |
173 | #endif |
174 | |
175 | @@ -970,10 +975,12 @@ ENTRY(flush_icache_page_asm) |
176 | sync |
177 | |
178 | #ifdef CONFIG_PA20 |
179 | + pdtlb,l %r0(%r28) |
180 | pitlb,l %r0(%sr4,%r25) |
181 | #else |
182 | tlb_lock %r20,%r21,%r22 |
183 | - pitlb (%sr4,%r25) |
184 | + pdtlb %r0(%r28) |
185 | + pitlb %r0(%sr4,%r25) |
186 | tlb_unlock %r20,%r21,%r22 |
187 | #endif |
188 | |
189 | diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c |
190 | index b9402c9b3454..af0d7fae7aa7 100644 |
191 | --- a/arch/parisc/kernel/pci-dma.c |
192 | +++ b/arch/parisc/kernel/pci-dma.c |
193 | @@ -95,8 +95,8 @@ static inline int map_pte_uncached(pte_t * pte, |
194 | |
195 | if (!pte_none(*pte)) |
196 | printk(KERN_ERR "map_pte_uncached: page already exists\n"); |
197 | - set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC)); |
198 | purge_tlb_start(flags); |
199 | + set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC)); |
200 | pdtlb_kernel(orig_vaddr); |
201 | purge_tlb_end(flags); |
202 | vaddr += PAGE_SIZE; |
203 | diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c |
204 | index 81d6f6391944..2e66a887788e 100644 |
205 | --- a/arch/parisc/kernel/setup.c |
206 | +++ b/arch/parisc/kernel/setup.c |
207 | @@ -334,6 +334,10 @@ static int __init parisc_init(void) |
208 | /* tell PDC we're Linux. Nevermind failure. */ |
209 | pdc_stable_write(0x40, &osid, sizeof(osid)); |
210 | |
211 | + /* start with known state */ |
212 | + flush_cache_all_local(); |
213 | + flush_tlb_all_local(NULL); |
214 | + |
215 | processor_init(); |
216 | #ifdef CONFIG_SMP |
217 | pr_info("CPU(s): %d out of %d %s at %d.%06d MHz online\n", |
218 | diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c |
219 | index 178989e6d3e3..ea960d660917 100644 |
220 | --- a/arch/tile/kernel/time.c |
221 | +++ b/arch/tile/kernel/time.c |
222 | @@ -218,8 +218,8 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num) |
223 | */ |
224 | unsigned long long sched_clock(void) |
225 | { |
226 | - return clocksource_cyc2ns(get_cycles(), |
227 | - sched_clock_mult, SCHED_CLOCK_SHIFT); |
228 | + return mult_frac(get_cycles(), |
229 | + sched_clock_mult, 1ULL << SCHED_CLOCK_SHIFT); |
230 | } |
231 | |
232 | int setup_profiling_timer(unsigned int multiplier) |
233 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
234 | index 5fa652c16a50..f49e98062ea5 100644 |
235 | --- a/arch/x86/kvm/emulate.c |
236 | +++ b/arch/x86/kvm/emulate.c |
237 | @@ -2093,16 +2093,10 @@ static int em_iret(struct x86_emulate_ctxt *ctxt) |
238 | static int em_jmp_far(struct x86_emulate_ctxt *ctxt) |
239 | { |
240 | int rc; |
241 | - unsigned short sel, old_sel; |
242 | - struct desc_struct old_desc, new_desc; |
243 | - const struct x86_emulate_ops *ops = ctxt->ops; |
244 | + unsigned short sel; |
245 | + struct desc_struct new_desc; |
246 | u8 cpl = ctxt->ops->cpl(ctxt); |
247 | |
248 | - /* Assignment of RIP may only fail in 64-bit mode */ |
249 | - if (ctxt->mode == X86EMUL_MODE_PROT64) |
250 | - ops->get_segment(ctxt, &old_sel, &old_desc, NULL, |
251 | - VCPU_SREG_CS); |
252 | - |
253 | memcpy(&sel, ctxt->src.valptr + ctxt->op_bytes, 2); |
254 | |
255 | rc = __load_segment_descriptor(ctxt, sel, VCPU_SREG_CS, cpl, |
256 | @@ -2112,12 +2106,10 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt) |
257 | return rc; |
258 | |
259 | rc = assign_eip_far(ctxt, ctxt->src.val, &new_desc); |
260 | - if (rc != X86EMUL_CONTINUE) { |
261 | - WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
262 | - /* assigning eip failed; restore the old cs */ |
263 | - ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); |
264 | - return rc; |
265 | - } |
266 | + /* Error handling is not implemented. */ |
267 | + if (rc != X86EMUL_CONTINUE) |
268 | + return X86EMUL_UNHANDLEABLE; |
269 | + |
270 | return rc; |
271 | } |
272 | |
273 | @@ -2177,14 +2169,8 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) |
274 | { |
275 | int rc; |
276 | unsigned long eip, cs; |
277 | - u16 old_cs; |
278 | int cpl = ctxt->ops->cpl(ctxt); |
279 | - struct desc_struct old_desc, new_desc; |
280 | - const struct x86_emulate_ops *ops = ctxt->ops; |
281 | - |
282 | - if (ctxt->mode == X86EMUL_MODE_PROT64) |
283 | - ops->get_segment(ctxt, &old_cs, &old_desc, NULL, |
284 | - VCPU_SREG_CS); |
285 | + struct desc_struct new_desc; |
286 | |
287 | rc = emulate_pop(ctxt, &eip, ctxt->op_bytes); |
288 | if (rc != X86EMUL_CONTINUE) |
289 | @@ -2201,10 +2187,10 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) |
290 | if (rc != X86EMUL_CONTINUE) |
291 | return rc; |
292 | rc = assign_eip_far(ctxt, eip, &new_desc); |
293 | - if (rc != X86EMUL_CONTINUE) { |
294 | - WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
295 | - ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); |
296 | - } |
297 | + /* Error handling is not implemented. */ |
298 | + if (rc != X86EMUL_CONTINUE) |
299 | + return X86EMUL_UNHANDLEABLE; |
300 | + |
301 | return rc; |
302 | } |
303 | |
304 | diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c |
305 | index 84b96d319909..d09544e826f6 100644 |
306 | --- a/arch/x86/kvm/irq_comm.c |
307 | +++ b/arch/x86/kvm/irq_comm.c |
308 | @@ -38,6 +38,15 @@ static int kvm_set_pic_irq(struct kvm_kernel_irq_routing_entry *e, |
309 | bool line_status) |
310 | { |
311 | struct kvm_pic *pic = pic_irqchip(kvm); |
312 | + |
313 | + /* |
314 | + * XXX: rejecting pic routes when pic isn't in use would be better, |
315 | + * but the default routing table is installed while kvm->arch.vpic is |
316 | + * NULL and KVM_CREATE_IRQCHIP can race with KVM_IRQ_LINE. |
317 | + */ |
318 | + if (!pic) |
319 | + return -1; |
320 | + |
321 | return kvm_pic_set_irq(pic, e->irqchip.pin, irq_source_id, level); |
322 | } |
323 | |
324 | @@ -46,6 +55,10 @@ static int kvm_set_ioapic_irq(struct kvm_kernel_irq_routing_entry *e, |
325 | bool line_status) |
326 | { |
327 | struct kvm_ioapic *ioapic = kvm->arch.vioapic; |
328 | + |
329 | + if (!ioapic) |
330 | + return -1; |
331 | + |
332 | return kvm_ioapic_set_irq(ioapic, e->irqchip.pin, irq_source_id, level, |
333 | line_status); |
334 | } |
335 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
336 | index 79bab6fd76bb..6755d4768f59 100644 |
337 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c |
338 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
339 | @@ -275,6 +275,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) |
340 | atombios_enable_crtc_memreq(crtc, ATOM_ENABLE); |
341 | atombios_blank_crtc(crtc, ATOM_DISABLE); |
342 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
343 | + /* Make sure vblank interrupt is still enabled if needed */ |
344 | + radeon_irq_set(rdev); |
345 | radeon_crtc_load_lut(crtc); |
346 | break; |
347 | case DRM_MODE_DPMS_STANDBY: |
348 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
349 | index 678b4386540d..89f22bdde298 100644 |
350 | --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
351 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
352 | @@ -331,6 +331,8 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) |
353 | WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl)); |
354 | } |
355 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
356 | + /* Make sure vblank interrupt is still enabled if needed */ |
357 | + radeon_irq_set(rdev); |
358 | radeon_crtc_load_lut(crtc); |
359 | break; |
360 | case DRM_MODE_DPMS_STANDBY: |
361 | diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c |
362 | index 565bb2c140ed..e913a930ac80 100644 |
363 | --- a/drivers/iommu/dmar.c |
364 | +++ b/drivers/iommu/dmar.c |
365 | @@ -326,7 +326,9 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb, |
366 | struct pci_dev *pdev = to_pci_dev(data); |
367 | struct dmar_pci_notify_info *info; |
368 | |
369 | - /* Only care about add/remove events for physical functions */ |
370 | + /* Only care about add/remove events for physical functions. |
371 | + * For VFs we actually do the lookup based on the corresponding |
372 | + * PF in device_to_iommu() anyway. */ |
373 | if (pdev->is_virtfn) |
374 | return NOTIFY_DONE; |
375 | if (action != BUS_NOTIFY_ADD_DEVICE && |
376 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
377 | index 5baa830ce49f..59e9abd3345e 100644 |
378 | --- a/drivers/iommu/intel-iommu.c |
379 | +++ b/drivers/iommu/intel-iommu.c |
380 | @@ -885,7 +885,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf |
381 | return NULL; |
382 | |
383 | if (dev_is_pci(dev)) { |
384 | + struct pci_dev *pf_pdev; |
385 | + |
386 | pdev = to_pci_dev(dev); |
387 | + /* VFs aren't listed in scope tables; we need to look up |
388 | + * the PF instead to find the IOMMU. */ |
389 | + pf_pdev = pci_physfn(pdev); |
390 | + dev = &pf_pdev->dev; |
391 | segment = pci_domain_nr(pdev->bus); |
392 | } else if (has_acpi_companion(dev)) |
393 | dev = &ACPI_COMPANION(dev)->dev; |
394 | @@ -898,6 +904,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf |
395 | for_each_active_dev_scope(drhd->devices, |
396 | drhd->devices_cnt, i, tmp) { |
397 | if (tmp == dev) { |
398 | + /* For a VF use its original BDF# not that of the PF |
399 | + * which we used for the IOMMU lookup. Strictly speaking |
400 | + * we could do this for all PCI devices; we only need to |
401 | + * get the BDF# from the scope table for ACPI matches. */ |
402 | + if (pdev->is_virtfn) |
403 | + goto got_pdev; |
404 | + |
405 | *bus = drhd->devices[i].bus; |
406 | *devfn = drhd->devices[i].devfn; |
407 | goto out; |
408 | diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c |
409 | index d9939fa9b588..f929879ecae6 100644 |
410 | --- a/drivers/iommu/intel-svm.c |
411 | +++ b/drivers/iommu/intel-svm.c |
412 | @@ -39,10 +39,18 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) |
413 | struct page *pages; |
414 | int order; |
415 | |
416 | - order = ecap_pss(iommu->ecap) + 7 - PAGE_SHIFT; |
417 | - if (order < 0) |
418 | - order = 0; |
419 | - |
420 | + /* Start at 2 because it's defined as 2^(1+PSS) */ |
421 | + iommu->pasid_max = 2 << ecap_pss(iommu->ecap); |
422 | + |
423 | + /* Eventually I'm promised we will get a multi-level PASID table |
424 | + * and it won't have to be physically contiguous. Until then, |
425 | + * limit the size because 8MiB contiguous allocations can be hard |
426 | + * to come by. The limit of 0x20000, which is 1MiB for each of |
427 | + * the PASID and PASID-state tables, is somewhat arbitrary. */ |
428 | + if (iommu->pasid_max > 0x20000) |
429 | + iommu->pasid_max = 0x20000; |
430 | + |
431 | + order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max); |
432 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); |
433 | if (!pages) { |
434 | pr_warn("IOMMU: %s: Failed to allocate PASID table\n", |
435 | @@ -53,6 +61,8 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) |
436 | pr_info("%s: Allocated order %d PASID table.\n", iommu->name, order); |
437 | |
438 | if (ecap_dis(iommu->ecap)) { |
439 | + /* Just making it explicit... */ |
440 | + BUILD_BUG_ON(sizeof(struct pasid_entry) != sizeof(struct pasid_state_entry)); |
441 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); |
442 | if (pages) |
443 | iommu->pasid_state_table = page_address(pages); |
444 | @@ -68,11 +78,7 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) |
445 | |
446 | int intel_svm_free_pasid_tables(struct intel_iommu *iommu) |
447 | { |
448 | - int order; |
449 | - |
450 | - order = ecap_pss(iommu->ecap) + 7 - PAGE_SHIFT; |
451 | - if (order < 0) |
452 | - order = 0; |
453 | + int order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max); |
454 | |
455 | if (iommu->pasid_table) { |
456 | free_pages((unsigned long)iommu->pasid_table, order); |
457 | @@ -371,8 +377,8 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ |
458 | } |
459 | svm->iommu = iommu; |
460 | |
461 | - if (pasid_max > 2 << ecap_pss(iommu->ecap)) |
462 | - pasid_max = 2 << ecap_pss(iommu->ecap); |
463 | + if (pasid_max > iommu->pasid_max) |
464 | + pasid_max = iommu->pasid_max; |
465 | |
466 | /* Do not use PASID 0 in caching mode (virtualised IOMMU) */ |
467 | ret = idr_alloc(&iommu->pasid_idr, svm, |
468 | diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c |
469 | index a77643954523..e59838231703 100644 |
470 | --- a/drivers/misc/mei/bus.c |
471 | +++ b/drivers/misc/mei/bus.c |
472 | @@ -144,7 +144,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length) |
473 | mutex_lock(&bus->device_lock); |
474 | |
475 | if (!mei_cl_is_connected(cl)) { |
476 | - rets = -EBUSY; |
477 | + rets = -ENODEV; |
478 | goto out; |
479 | } |
480 | } |
481 | diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h |
482 | index 4e8069866c85..a2661381ddfc 100644 |
483 | --- a/drivers/misc/mei/hw-me-regs.h |
484 | +++ b/drivers/misc/mei/hw-me-regs.h |
485 | @@ -66,9 +66,6 @@ |
486 | #ifndef _MEI_HW_MEI_REGS_H_ |
487 | #define _MEI_HW_MEI_REGS_H_ |
488 | |
489 | -#define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ |
490 | -#define MEI_DEV_ID_KBP_2 0xA2BB /* Kaby Point 2 */ |
491 | - |
492 | /* |
493 | * MEI device IDs |
494 | */ |
495 | @@ -124,6 +121,10 @@ |
496 | #define MEI_DEV_ID_SPT_2 0x9D3B /* Sunrise Point 2 */ |
497 | #define MEI_DEV_ID_SPT_H 0xA13A /* Sunrise Point H */ |
498 | #define MEI_DEV_ID_SPT_H_2 0xA13B /* Sunrise Point H 2 */ |
499 | + |
500 | +#define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ |
501 | +#define MEI_DEV_ID_KBP_2 0xA2BB /* Kaby Point 2 */ |
502 | + |
503 | /* |
504 | * MEI HW Section |
505 | */ |
506 | diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c |
507 | index 25b1997a62cb..36333750c512 100644 |
508 | --- a/drivers/misc/mei/hw-me.c |
509 | +++ b/drivers/misc/mei/hw-me.c |
510 | @@ -1258,8 +1258,14 @@ static bool mei_me_fw_type_nm(struct pci_dev *pdev) |
511 | static bool mei_me_fw_type_sps(struct pci_dev *pdev) |
512 | { |
513 | u32 reg; |
514 | - /* Read ME FW Status check for SPS Firmware */ |
515 | - pci_read_config_dword(pdev, PCI_CFG_HFS_1, ®); |
516 | + unsigned int devfn; |
517 | + |
518 | + /* |
519 | + * Read ME FW Status register to check for SPS Firmware |
520 | + * The SPS FW is only signaled in pci function 0 |
521 | + */ |
522 | + devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0); |
523 | + pci_bus_read_config_dword(pdev->bus, devfn, PCI_CFG_HFS_1, ®); |
524 | /* if bits [19:16] = 15, running SPS Firmware */ |
525 | return (reg & 0xf0000) == 0xf0000; |
526 | } |
527 | diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c |
528 | index 80f9afcb1382..4ef189a7a2fb 100644 |
529 | --- a/drivers/misc/mei/main.c |
530 | +++ b/drivers/misc/mei/main.c |
531 | @@ -207,7 +207,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, |
532 | |
533 | mutex_lock(&dev->device_lock); |
534 | if (!mei_cl_is_connected(cl)) { |
535 | - rets = -EBUSY; |
536 | + rets = -ENODEV; |
537 | goto out; |
538 | } |
539 | } |
540 | diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c |
541 | index 0af3d7d30419..01e20384ac44 100644 |
542 | --- a/drivers/misc/mei/pci-me.c |
543 | +++ b/drivers/misc/mei/pci-me.c |
544 | @@ -84,8 +84,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { |
545 | |
546 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT, mei_me_pch8_cfg)}, |
547 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, mei_me_pch8_cfg)}, |
548 | - {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_cfg)}, |
549 | - {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_cfg)}, |
550 | + {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_sps_cfg)}, |
551 | + {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_sps_cfg)}, |
552 | |
553 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, mei_me_pch8_cfg)}, |
554 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, mei_me_pch8_cfg)}, |
555 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
556 | index 2d867c5bfd9f..8cead04f26d6 100644 |
557 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
558 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
559 | @@ -3706,6 +3706,11 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, |
560 | } |
561 | } |
562 | |
563 | +static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) |
564 | +{ |
565 | + return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); |
566 | +} |
567 | + |
568 | /** |
569 | * _scsih_flush_running_cmds - completing outstanding commands. |
570 | * @ioc: per adapter object |
571 | @@ -3727,6 +3732,9 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) |
572 | if (!scmd) |
573 | continue; |
574 | count++; |
575 | + if (ata_12_16_cmd(scmd)) |
576 | + scsi_internal_device_unblock(scmd->device, |
577 | + SDEV_RUNNING); |
578 | mpt3sas_base_free_smid(ioc, smid); |
579 | scsi_dma_unmap(scmd); |
580 | if (ioc->pci_error_recovery) |
581 | @@ -3831,8 +3839,6 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) |
582 | SAM_STAT_CHECK_CONDITION; |
583 | } |
584 | |
585 | - |
586 | - |
587 | /** |
588 | * scsih_qcmd - main scsi request entry point |
589 | * @scmd: pointer to scsi command object |
590 | @@ -3859,6 +3865,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) |
591 | if (ioc->logging_level & MPT_DEBUG_SCSI) |
592 | scsi_print_command(scmd); |
593 | |
594 | + /* |
595 | + * Lock the device for any subsequent command until command is |
596 | + * done. |
597 | + */ |
598 | + if (ata_12_16_cmd(scmd)) |
599 | + scsi_internal_device_block(scmd->device); |
600 | + |
601 | sas_device_priv_data = scmd->device->hostdata; |
602 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { |
603 | scmd->result = DID_NO_CONNECT << 16; |
604 | @@ -4431,6 +4444,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) |
605 | if (scmd == NULL) |
606 | return 1; |
607 | |
608 | + if (ata_12_16_cmd(scmd)) |
609 | + scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); |
610 | + |
611 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
612 | |
613 | if (mpi_reply == NULL) { |
614 | diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c |
615 | index 965d0e240dcb..ba4a2a1eb3ff 100644 |
616 | --- a/drivers/usb/chipidea/core.c |
617 | +++ b/drivers/usb/chipidea/core.c |
618 | @@ -926,6 +926,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) |
619 | if (!ci) |
620 | return -ENOMEM; |
621 | |
622 | + spin_lock_init(&ci->lock); |
623 | ci->dev = dev; |
624 | ci->platdata = dev_get_platdata(dev); |
625 | ci->imx28_write_fix = !!(ci->platdata->flags & |
626 | diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c |
627 | index 68fc5fce4cc5..d8a045fc1fdb 100644 |
628 | --- a/drivers/usb/chipidea/udc.c |
629 | +++ b/drivers/usb/chipidea/udc.c |
630 | @@ -1884,8 +1884,6 @@ static int udc_start(struct ci_hdrc *ci) |
631 | struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; |
632 | int retval = 0; |
633 | |
634 | - spin_lock_init(&ci->lock); |
635 | - |
636 | ci->gadget.ops = &usb_gadget_ops; |
637 | ci->gadget.speed = USB_SPEED_UNKNOWN; |
638 | ci->gadget.max_speed = USB_SPEED_HIGH; |
639 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
640 | index 976195e748a3..fe7452f0f38a 100644 |
641 | --- a/drivers/usb/serial/cp210x.c |
642 | +++ b/drivers/usb/serial/cp210x.c |
643 | @@ -130,6 +130,7 @@ static const struct usb_device_id id_table[] = { |
644 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
645 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
646 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
647 | + { USB_DEVICE(0x10C4, 0x8962) }, /* Brim Brothers charging dock */ |
648 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ |
649 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ |
650 | { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ |
651 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
652 | index 494167fe6a2c..d3d6ec455151 100644 |
653 | --- a/drivers/usb/serial/ftdi_sio.c |
654 | +++ b/drivers/usb/serial/ftdi_sio.c |
655 | @@ -1012,6 +1012,8 @@ static const struct usb_device_id id_table_combined[] = { |
656 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, |
657 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, |
658 | { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, |
659 | + { USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID), |
660 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
661 | { } /* Terminating entry */ |
662 | }; |
663 | |
664 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
665 | index 21011c0a4c64..48ee04c94a75 100644 |
666 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
667 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
668 | @@ -596,6 +596,12 @@ |
669 | #define STK541_PID 0x2109 /* Zigbee Controller */ |
670 | |
671 | /* |
672 | + * Texas Instruments |
673 | + */ |
674 | +#define TI_VID 0x0451 |
675 | +#define TI_CC3200_LAUNCHPAD_PID 0xC32A /* SimpleLink Wi-Fi CC3200 LaunchPad */ |
676 | + |
677 | +/* |
678 | * Blackfin gnICE JTAG |
679 | * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice |
680 | */ |
681 | diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c |
682 | index 5e67f63b2e46..02f86dd1a340 100644 |
683 | --- a/drivers/usb/storage/transport.c |
684 | +++ b/drivers/usb/storage/transport.c |
685 | @@ -919,10 +919,15 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us) |
686 | |
687 | /* COMMAND STAGE */ |
688 | /* let's send the command via the control pipe */ |
689 | + /* |
690 | + * Command is sometime (f.e. after scsi_eh_prep_cmnd) on the stack. |
691 | + * Stack may be vmallocated. So no DMA for us. Make a copy. |
692 | + */ |
693 | + memcpy(us->iobuf, srb->cmnd, srb->cmd_len); |
694 | result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, |
695 | US_CBI_ADSC, |
696 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, |
697 | - us->ifnum, srb->cmnd, srb->cmd_len); |
698 | + us->ifnum, us->iobuf, srb->cmd_len); |
699 | |
700 | /* check the return code for the command */ |
701 | usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n", |
702 | diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c |
703 | index 52a28311e2a4..48efe62e1302 100644 |
704 | --- a/fs/nfs/callback.c |
705 | +++ b/fs/nfs/callback.c |
706 | @@ -261,7 +261,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv, |
707 | } |
708 | |
709 | ret = -EPROTONOSUPPORT; |
710 | - if (minorversion == 0) |
711 | + if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0) |
712 | ret = nfs4_callback_up_net(serv, net); |
713 | else if (xprt->ops->bc_up) |
714 | ret = xprt->ops->bc_up(serv, net); |
715 | diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
716 | index 2d9b650047a5..d49e26c6cdc7 100644 |
717 | --- a/include/linux/intel-iommu.h |
718 | +++ b/include/linux/intel-iommu.h |
719 | @@ -429,6 +429,7 @@ struct intel_iommu { |
720 | struct page_req_dsc *prq; |
721 | unsigned char prq_name[16]; /* Name for PRQ interrupt */ |
722 | struct idr pasid_idr; |
723 | + u32 pasid_max; |
724 | #endif |
725 | struct q_inval *qi; /* Queued invalidation info */ |
726 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ |
727 | diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c |
728 | index 5464c8744ea9..e24388a863a7 100644 |
729 | --- a/lib/mpi/mpi-pow.c |
730 | +++ b/lib/mpi/mpi-pow.c |
731 | @@ -64,8 +64,13 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
732 | if (!esize) { |
733 | /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 |
734 | * depending on if MOD equals 1. */ |
735 | - rp[0] = 1; |
736 | res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1; |
737 | + if (res->nlimbs) { |
738 | + if (mpi_resize(res, 1) < 0) |
739 | + goto enomem; |
740 | + rp = res->d; |
741 | + rp[0] = 1; |
742 | + } |
743 | res->sign = 0; |
744 | goto leave; |
745 | } |
746 | diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c |
747 | index 9aba9e93c0a2..ee9082792530 100644 |
748 | --- a/net/core/flow_dissector.c |
749 | +++ b/net/core/flow_dissector.c |
750 | @@ -949,4 +949,4 @@ static int __init init_default_flow_dissectors(void) |
751 | return 0; |
752 | } |
753 | |
754 | -late_initcall_sync(init_default_flow_dissectors); |
755 | +core_initcall(init_default_flow_dissectors); |
756 | diff --git a/net/wireless/core.h b/net/wireless/core.h |
757 | index a618b4b86fa4..47a967fed8ff 100644 |
758 | --- a/net/wireless/core.h |
759 | +++ b/net/wireless/core.h |
760 | @@ -72,6 +72,7 @@ struct cfg80211_registered_device { |
761 | struct list_head bss_list; |
762 | struct rb_root bss_tree; |
763 | u32 bss_generation; |
764 | + u32 bss_entries; |
765 | struct cfg80211_scan_request *scan_req; /* protected by RTNL */ |
766 | struct sk_buff *scan_msg; |
767 | struct cfg80211_sched_scan_request __rcu *sched_scan_req; |
768 | diff --git a/net/wireless/scan.c b/net/wireless/scan.c |
769 | index 14d5369eb778..8dde12a11725 100644 |
770 | --- a/net/wireless/scan.c |
771 | +++ b/net/wireless/scan.c |
772 | @@ -56,6 +56,19 @@ |
773 | * also linked into the probe response struct. |
774 | */ |
775 | |
776 | +/* |
777 | + * Limit the number of BSS entries stored in mac80211. Each one is |
778 | + * a bit over 4k at most, so this limits to roughly 4-5M of memory. |
779 | + * If somebody wants to really attack this though, they'd likely |
780 | + * use small beacons, and only one type of frame, limiting each of |
781 | + * the entries to a much smaller size (in order to generate more |
782 | + * entries in total, so overhead is bigger.) |
783 | + */ |
784 | +static int bss_entries_limit = 1000; |
785 | +module_param(bss_entries_limit, int, 0644); |
786 | +MODULE_PARM_DESC(bss_entries_limit, |
787 | + "limit to number of scan BSS entries (per wiphy, default 1000)"); |
788 | + |
789 | #define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ) |
790 | |
791 | static void bss_free(struct cfg80211_internal_bss *bss) |
792 | @@ -136,6 +149,10 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev, |
793 | |
794 | list_del_init(&bss->list); |
795 | rb_erase(&bss->rbn, &rdev->bss_tree); |
796 | + rdev->bss_entries--; |
797 | + WARN_ONCE((rdev->bss_entries == 0) ^ list_empty(&rdev->bss_list), |
798 | + "rdev bss entries[%d]/list[empty:%d] corruption\n", |
799 | + rdev->bss_entries, list_empty(&rdev->bss_list)); |
800 | bss_ref_put(rdev, bss); |
801 | return true; |
802 | } |
803 | @@ -162,6 +179,40 @@ static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev, |
804 | rdev->bss_generation++; |
805 | } |
806 | |
807 | +static bool cfg80211_bss_expire_oldest(struct cfg80211_registered_device *rdev) |
808 | +{ |
809 | + struct cfg80211_internal_bss *bss, *oldest = NULL; |
810 | + bool ret; |
811 | + |
812 | + lockdep_assert_held(&rdev->bss_lock); |
813 | + |
814 | + list_for_each_entry(bss, &rdev->bss_list, list) { |
815 | + if (atomic_read(&bss->hold)) |
816 | + continue; |
817 | + |
818 | + if (!list_empty(&bss->hidden_list) && |
819 | + !bss->pub.hidden_beacon_bss) |
820 | + continue; |
821 | + |
822 | + if (oldest && time_before(oldest->ts, bss->ts)) |
823 | + continue; |
824 | + oldest = bss; |
825 | + } |
826 | + |
827 | + if (WARN_ON(!oldest)) |
828 | + return false; |
829 | + |
830 | + /* |
831 | + * The callers make sure to increase rdev->bss_generation if anything |
832 | + * gets removed (and a new entry added), so there's no need to also do |
833 | + * it here. |
834 | + */ |
835 | + |
836 | + ret = __cfg80211_unlink_bss(rdev, oldest); |
837 | + WARN_ON(!ret); |
838 | + return ret; |
839 | +} |
840 | + |
841 | void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, |
842 | bool send_message) |
843 | { |
844 | @@ -687,6 +738,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev, |
845 | const u8 *ie; |
846 | int i, ssidlen; |
847 | u8 fold = 0; |
848 | + u32 n_entries = 0; |
849 | |
850 | ies = rcu_access_pointer(new->pub.beacon_ies); |
851 | if (WARN_ON(!ies)) |
852 | @@ -710,6 +762,12 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev, |
853 | /* This is the bad part ... */ |
854 | |
855 | list_for_each_entry(bss, &rdev->bss_list, list) { |
856 | + /* |
857 | + * we're iterating all the entries anyway, so take the |
858 | + * opportunity to validate the list length accounting |
859 | + */ |
860 | + n_entries++; |
861 | + |
862 | if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) |
863 | continue; |
864 | if (bss->pub.channel != new->pub.channel) |
865 | @@ -738,6 +796,10 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev, |
866 | new->pub.beacon_ies); |
867 | } |
868 | |
869 | + WARN_ONCE(n_entries != rdev->bss_entries, |
870 | + "rdev bss entries[%d]/list[len:%d] corruption\n", |
871 | + rdev->bss_entries, n_entries); |
872 | + |
873 | return true; |
874 | } |
875 | |
876 | @@ -890,7 +952,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, |
877 | } |
878 | } |
879 | |
880 | + if (rdev->bss_entries >= bss_entries_limit && |
881 | + !cfg80211_bss_expire_oldest(rdev)) { |
882 | + kfree(new); |
883 | + goto drop; |
884 | + } |
885 | + |
886 | list_add_tail(&new->list, &rdev->bss_list); |
887 | + rdev->bss_entries++; |
888 | rb_insert_bss(rdev, new); |
889 | found = new; |
890 | } |
891 | diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
892 | index dc0027b28b04..53426a6ee6dc 100644 |
893 | --- a/security/apparmor/domain.c |
894 | +++ b/security/apparmor/domain.c |
895 | @@ -623,8 +623,8 @@ int aa_change_hat(const char *hats[], int count, u64 token, bool permtest) |
896 | /* released below */ |
897 | cred = get_current_cred(); |
898 | cxt = cred_cxt(cred); |
899 | - profile = aa_cred_profile(cred); |
900 | - previous_profile = cxt->previous; |
901 | + profile = aa_get_newest_profile(aa_cred_profile(cred)); |
902 | + previous_profile = aa_get_newest_profile(cxt->previous); |
903 | |
904 | if (unconfined(profile)) { |
905 | info = "unconfined"; |
906 | @@ -720,6 +720,8 @@ audit: |
907 | out: |
908 | aa_put_profile(hat); |
909 | kfree(name); |
910 | + aa_put_profile(profile); |
911 | + aa_put_profile(previous_profile); |
912 | put_cred(cred); |
913 | |
914 | return error; |