Contents of /trunk/kernel26-alx/patches-3.10/0170-3.10.71-all-fixes.patch
Parent Directory | Revision Log
Revision 2672 -
(show annotations)
(download)
Tue Jul 21 16:46:35 2015 UTC (9 years, 2 months ago) by niro
File size: 49394 byte(s)
Tue Jul 21 16:46:35 2015 UTC (9 years, 2 months ago) by niro
File size: 49394 byte(s)
-3.10.84-alx-r1
1 | diff --git a/Makefile b/Makefile |
2 | index 402cbb7c27f1..d8b42f71ea5a 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 3 |
7 | PATCHLEVEL = 10 |
8 | -SUBLEVEL = 70 |
9 | +SUBLEVEL = 71 |
10 | EXTRAVERSION = |
11 | NAME = TOSSUG Baby Fish |
12 | |
13 | diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h |
14 | index 95b1522212a7..ecf23eaa20c1 100644 |
15 | --- a/arch/arc/include/asm/pgtable.h |
16 | +++ b/arch/arc/include/asm/pgtable.h |
17 | @@ -270,7 +270,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) |
18 | #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) |
19 | |
20 | #define pte_page(x) (mem_map + \ |
21 | - (unsigned long)(((pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT))) |
22 | + (unsigned long)(((pte_val(x) - CONFIG_LINUX_LINK_BASE) >> \ |
23 | + PAGE_SHIFT))) |
24 | |
25 | #define mk_pte(page, pgprot) \ |
26 | ({ \ |
27 | diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c |
28 | index a5b8fead7d61..9cb7ea776ecd 100644 |
29 | --- a/arch/arm/mach-pxa/corgi.c |
30 | +++ b/arch/arm/mach-pxa/corgi.c |
31 | @@ -26,6 +26,7 @@ |
32 | #include <linux/i2c.h> |
33 | #include <linux/i2c/pxa-i2c.h> |
34 | #include <linux/io.h> |
35 | +#include <linux/regulator/machine.h> |
36 | #include <linux/spi/spi.h> |
37 | #include <linux/spi/ads7846.h> |
38 | #include <linux/spi/corgi_lcd.h> |
39 | @@ -711,6 +712,8 @@ static void __init corgi_init(void) |
40 | sharpsl_nand_partitions[1].size = 53 * 1024 * 1024; |
41 | |
42 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
43 | + |
44 | + regulator_has_full_constraints(); |
45 | } |
46 | |
47 | static void __init fixup_corgi(struct tag *tags, char **cmdline, |
48 | diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c |
49 | index 133109ec7332..a07accfb3aec 100644 |
50 | --- a/arch/arm/mach-pxa/hx4700.c |
51 | +++ b/arch/arm/mach-pxa/hx4700.c |
52 | @@ -891,6 +891,8 @@ static void __init hx4700_init(void) |
53 | mdelay(10); |
54 | gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1); |
55 | mdelay(10); |
56 | + |
57 | + regulator_has_full_constraints(); |
58 | } |
59 | |
60 | MACHINE_START(H4700, "HP iPAQ HX4700") |
61 | diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c |
62 | index 50ccd5f1d560..362c05fffc28 100644 |
63 | --- a/arch/arm/mach-pxa/poodle.c |
64 | +++ b/arch/arm/mach-pxa/poodle.c |
65 | @@ -25,6 +25,7 @@ |
66 | #include <linux/gpio.h> |
67 | #include <linux/i2c.h> |
68 | #include <linux/i2c/pxa-i2c.h> |
69 | +#include <linux/regulator/machine.h> |
70 | #include <linux/spi/spi.h> |
71 | #include <linux/spi/ads7846.h> |
72 | #include <linux/spi/pxa2xx_spi.h> |
73 | @@ -452,6 +453,7 @@ static void __init poodle_init(void) |
74 | pxa_set_i2c_info(NULL); |
75 | i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices)); |
76 | poodle_init_spi(); |
77 | + regulator_has_full_constraints(); |
78 | } |
79 | |
80 | static void __init fixup_poodle(struct tag *tags, char **cmdline, |
81 | diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c |
82 | index 6645d1e31f14..34853d5dfda2 100644 |
83 | --- a/arch/arm/mach-sa1100/pm.c |
84 | +++ b/arch/arm/mach-sa1100/pm.c |
85 | @@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state) |
86 | /* |
87 | * Ensure not to come back here if it wasn't intended |
88 | */ |
89 | + RCSR = RCSR_SMR; |
90 | PSPR = 0; |
91 | |
92 | /* |
93 | diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c |
94 | index e393174fe859..3d478102b1c0 100644 |
95 | --- a/arch/arm64/kernel/signal32.c |
96 | +++ b/arch/arm64/kernel/signal32.c |
97 | @@ -179,8 +179,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
98 | case __SI_TIMER: |
99 | err |= __put_user(from->si_tid, &to->si_tid); |
100 | err |= __put_user(from->si_overrun, &to->si_overrun); |
101 | - err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, |
102 | - &to->si_ptr); |
103 | + err |= __put_user(from->si_int, &to->si_int); |
104 | break; |
105 | case __SI_POLL: |
106 | err |= __put_user(from->si_band, &to->si_band); |
107 | @@ -209,7 +208,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
108 | case __SI_MESGQ: /* But this is */ |
109 | err |= __put_user(from->si_pid, &to->si_pid); |
110 | err |= __put_user(from->si_uid, &to->si_uid); |
111 | - err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); |
112 | + err |= __put_user(from->si_int, &to->si_int); |
113 | break; |
114 | default: /* this is just in case for now ... */ |
115 | err |= __put_user(from->si_pid, &to->si_pid); |
116 | diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h |
117 | index 579e3d93a5ca..b88e9cbdc64b 100644 |
118 | --- a/arch/metag/include/asm/processor.h |
119 | +++ b/arch/metag/include/asm/processor.h |
120 | @@ -149,8 +149,8 @@ extern void exit_thread(void); |
121 | |
122 | unsigned long get_wchan(struct task_struct *p); |
123 | |
124 | -#define KSTK_EIP(tsk) ((tsk)->thread.kernel_context->CurrPC) |
125 | -#define KSTK_ESP(tsk) ((tsk)->thread.kernel_context->AX[0].U0) |
126 | +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ctx.CurrPC) |
127 | +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->ctx.AX[0].U0) |
128 | |
129 | #define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) |
130 | |
131 | diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c |
132 | index 6e58e97fcd39..cedeb5686eb5 100644 |
133 | --- a/arch/mips/kernel/mips_ksyms.c |
134 | +++ b/arch/mips/kernel/mips_ksyms.c |
135 | @@ -14,6 +14,7 @@ |
136 | #include <linux/mm.h> |
137 | #include <asm/uaccess.h> |
138 | #include <asm/ftrace.h> |
139 | +#include <asm/fpu.h> |
140 | |
141 | extern void *__bzero(void *__s, size_t __count); |
142 | extern long __strncpy_from_user_nocheck_asm(char *__to, |
143 | @@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s); |
144 | extern long __strnlen_user_asm(const char *s); |
145 | |
146 | /* |
147 | + * Core architecture code |
148 | + */ |
149 | +#ifdef CONFIG_CPU_R4K_FPU |
150 | +EXPORT_SYMBOL_GPL(_save_fp); |
151 | +#endif |
152 | + |
153 | +/* |
154 | * String functions |
155 | */ |
156 | EXPORT_SYMBOL(memset); |
157 | diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S |
158 | index dca2aa665993..920b63210806 100644 |
159 | --- a/arch/mips/kvm/kvm_locore.S |
160 | +++ b/arch/mips/kvm/kvm_locore.S |
161 | @@ -431,7 +431,7 @@ __kvm_mips_return_to_guest: |
162 | /* Setup status register for running guest in UM */ |
163 | .set at |
164 | or v1, v1, (ST0_EXL | KSU_USER | ST0_IE) |
165 | - and v1, v1, ~ST0_CU0 |
166 | + and v1, v1, ~(ST0_CU0 | ST0_MX) |
167 | .set noat |
168 | mtc0 v1, CP0_STATUS |
169 | ehb |
170 | diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c |
171 | index 2c7b3ade8ec0..843ec38fec7b 100644 |
172 | --- a/arch/mips/kvm/kvm_mips.c |
173 | +++ b/arch/mips/kvm/kvm_mips.c |
174 | @@ -15,6 +15,7 @@ |
175 | #include <linux/vmalloc.h> |
176 | #include <linux/fs.h> |
177 | #include <linux/bootmem.h> |
178 | +#include <asm/fpu.h> |
179 | #include <asm/page.h> |
180 | #include <asm/cacheflush.h> |
181 | #include <asm/mmu_context.h> |
182 | @@ -413,11 +414,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) |
183 | vcpu->mmio_needed = 0; |
184 | } |
185 | |
186 | + lose_fpu(1); |
187 | + |
188 | + local_irq_disable(); |
189 | /* Check if we have any exceptions/interrupts pending */ |
190 | kvm_mips_deliver_interrupts(vcpu, |
191 | kvm_read_c0_guest_cause(vcpu->arch.cop0)); |
192 | |
193 | - local_irq_disable(); |
194 | kvm_guest_enter(); |
195 | |
196 | r = __kvm_mips_vcpu_run(run, vcpu); |
197 | @@ -1017,9 +1020,6 @@ void kvm_mips_set_c0_status(void) |
198 | { |
199 | uint32_t status = read_c0_status(); |
200 | |
201 | - if (cpu_has_fpu) |
202 | - status |= (ST0_CU1); |
203 | - |
204 | if (cpu_has_dsp) |
205 | status |= (ST0_MX); |
206 | |
207 | diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c |
208 | index 1c16141c031c..1fea24944ff4 100644 |
209 | --- a/arch/powerpc/sysdev/axonram.c |
210 | +++ b/arch/powerpc/sysdev/axonram.c |
211 | @@ -155,7 +155,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector, |
212 | } |
213 | |
214 | *kaddr = (void *)(bank->ph_addr + offset); |
215 | - *pfn = virt_to_phys(kaddr) >> PAGE_SHIFT; |
216 | + *pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT; |
217 | |
218 | return 0; |
219 | } |
220 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
221 | index adfc30d9f9f4..41ba726c1ce2 100644 |
222 | --- a/arch/x86/kvm/x86.c |
223 | +++ b/arch/x86/kvm/x86.c |
224 | @@ -1182,21 +1182,22 @@ void kvm_track_tsc_matching(struct kvm_vcpu *vcpu) |
225 | { |
226 | #ifdef CONFIG_X86_64 |
227 | bool vcpus_matched; |
228 | - bool do_request = false; |
229 | struct kvm_arch *ka = &vcpu->kvm->arch; |
230 | struct pvclock_gtod_data *gtod = &pvclock_gtod_data; |
231 | |
232 | vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 == |
233 | atomic_read(&vcpu->kvm->online_vcpus)); |
234 | |
235 | - if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) |
236 | - if (!ka->use_master_clock) |
237 | - do_request = 1; |
238 | - |
239 | - if (!vcpus_matched && ka->use_master_clock) |
240 | - do_request = 1; |
241 | - |
242 | - if (do_request) |
243 | + /* |
244 | + * Once the masterclock is enabled, always perform request in |
245 | + * order to update it. |
246 | + * |
247 | + * In order to enable masterclock, the host clocksource must be TSC |
248 | + * and the vcpus need to have matched TSCs. When that happens, |
249 | + * perform request to enable masterclock. |
250 | + */ |
251 | + if (ka->use_master_clock || |
252 | + (gtod->clock.vclock_mode == VCLOCK_TSC && vcpus_matched)) |
253 | kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); |
254 | |
255 | trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc, |
256 | diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c |
257 | index 5c1ae28825cd..75f9e5d80d02 100644 |
258 | --- a/arch/x86/mm/mmap.c |
259 | +++ b/arch/x86/mm/mmap.c |
260 | @@ -35,12 +35,12 @@ struct __read_mostly va_alignment va_align = { |
261 | .flags = -1, |
262 | }; |
263 | |
264 | -static unsigned int stack_maxrandom_size(void) |
265 | +static unsigned long stack_maxrandom_size(void) |
266 | { |
267 | - unsigned int max = 0; |
268 | + unsigned long max = 0; |
269 | if ((current->flags & PF_RANDOMIZE) && |
270 | !(current->personality & ADDR_NO_RANDOMIZE)) { |
271 | - max = ((-1U) & STACK_RND_MASK) << PAGE_SHIFT; |
272 | + max = ((-1UL) & STACK_RND_MASK) << PAGE_SHIFT; |
273 | } |
274 | |
275 | return max; |
276 | diff --git a/block/blk-throttle.c b/block/blk-throttle.c |
277 | index 31146225f3d0..7cddfe6baf66 100644 |
278 | --- a/block/blk-throttle.c |
279 | +++ b/block/blk-throttle.c |
280 | @@ -942,6 +942,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, |
281 | struct blkg_rwstat rwstat = { }, tmp; |
282 | int i, cpu; |
283 | |
284 | + if (tg->stats_cpu == NULL) |
285 | + return 0; |
286 | + |
287 | for_each_possible_cpu(cpu) { |
288 | struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu); |
289 | |
290 | diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c |
291 | index c981097dd634..69111c5c352c 100644 |
292 | --- a/block/cfq-iosched.c |
293 | +++ b/block/cfq-iosched.c |
294 | @@ -3575,6 +3575,11 @@ retry: |
295 | |
296 | blkcg = bio_blkcg(bio); |
297 | cfqg = cfq_lookup_create_cfqg(cfqd, blkcg); |
298 | + if (!cfqg) { |
299 | + cfqq = &cfqd->oom_cfqq; |
300 | + goto out; |
301 | + } |
302 | + |
303 | cfqq = cic_to_cfqq(cic, is_sync); |
304 | |
305 | /* |
306 | @@ -3611,7 +3616,7 @@ retry: |
307 | } else |
308 | cfqq = &cfqd->oom_cfqq; |
309 | } |
310 | - |
311 | +out: |
312 | if (new_cfqq) |
313 | kmem_cache_free(cfq_pool, new_cfqq); |
314 | |
315 | @@ -3641,12 +3646,17 @@ static struct cfq_queue * |
316 | cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic, |
317 | struct bio *bio, gfp_t gfp_mask) |
318 | { |
319 | - const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); |
320 | - const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); |
321 | + int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); |
322 | + int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); |
323 | struct cfq_queue **async_cfqq = NULL; |
324 | struct cfq_queue *cfqq = NULL; |
325 | |
326 | if (!is_sync) { |
327 | + if (!ioprio_valid(cic->ioprio)) { |
328 | + struct task_struct *tsk = current; |
329 | + ioprio = task_nice_ioprio(tsk); |
330 | + ioprio_class = task_nice_ioclass(tsk); |
331 | + } |
332 | async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio); |
333 | cfqq = *async_cfqq; |
334 | } |
335 | diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
336 | index 2acabdaecec8..dad8891ecbfa 100644 |
337 | --- a/drivers/bluetooth/ath3k.c |
338 | +++ b/drivers/bluetooth/ath3k.c |
339 | @@ -151,6 +151,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { |
340 | #define USB_REQ_DFU_DNLOAD 1 |
341 | #define BULK_SIZE 4096 |
342 | #define FW_HDR_SIZE 20 |
343 | +#define TIMEGAP_USEC_MIN 50 |
344 | +#define TIMEGAP_USEC_MAX 100 |
345 | |
346 | static int ath3k_load_firmware(struct usb_device *udev, |
347 | const struct firmware *firmware) |
348 | @@ -181,6 +183,9 @@ static int ath3k_load_firmware(struct usb_device *udev, |
349 | count -= 20; |
350 | |
351 | while (count) { |
352 | + /* workaround the compatibility issue with xHCI controller*/ |
353 | + usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); |
354 | + |
355 | size = min_t(uint, count, BULK_SIZE); |
356 | pipe = usb_sndbulkpipe(udev, 0x02); |
357 | memcpy(send_buf, firmware->data + sent, size); |
358 | @@ -277,6 +282,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, |
359 | count -= size; |
360 | |
361 | while (count) { |
362 | + /* workaround the compatibility issue with xHCI controller*/ |
363 | + usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); |
364 | + |
365 | size = min_t(uint, count, BULK_SIZE); |
366 | pipe = usb_sndbulkpipe(udev, 0x02); |
367 | |
368 | diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c |
369 | index 156bd3c72770..3925f7b86841 100644 |
370 | --- a/drivers/char/tpm/tpm_i2c_stm_st33.c |
371 | +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c |
372 | @@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, |
373 | if (burstcnt < 0) |
374 | return burstcnt; |
375 | size = min_t(int, len - i - 1, burstcnt); |
376 | - ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); |
377 | + ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size); |
378 | if (ret < 0) |
379 | goto out_err; |
380 | |
381 | diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c |
382 | index 56b07c35a13e..538856f3e68a 100644 |
383 | --- a/drivers/char/tpm/tpm_ibmvtpm.c |
384 | +++ b/drivers/char/tpm/tpm_ibmvtpm.c |
385 | @@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) |
386 | crq.len = (u16)count; |
387 | crq.data = ibmvtpm->rtce_dma_handle; |
388 | |
389 | - rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]); |
390 | + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), |
391 | + cpu_to_be64(word[1])); |
392 | if (rc != H_SUCCESS) { |
393 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); |
394 | rc = 0; |
395 | @@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) |
396 | crq.valid = (u8)IBMVTPM_VALID_CMD; |
397 | crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; |
398 | |
399 | - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); |
400 | + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), |
401 | + cpu_to_be64(buf[1])); |
402 | if (rc != H_SUCCESS) |
403 | dev_err(ibmvtpm->dev, |
404 | "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); |
405 | @@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) |
406 | crq.valid = (u8)IBMVTPM_VALID_CMD; |
407 | crq.msg = (u8)VTPM_GET_VERSION; |
408 | |
409 | - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); |
410 | + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), |
411 | + cpu_to_be64(buf[1])); |
412 | if (rc != H_SUCCESS) |
413 | dev_err(ibmvtpm->dev, |
414 | "ibmvtpm_crq_get_version failed rc=%d\n", rc); |
415 | @@ -307,6 +310,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) |
416 | static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) |
417 | { |
418 | struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); |
419 | + |
420 | + /* ibmvtpm initializes at probe time, so the data we are |
421 | + * asking for may not be set yet. Estimate that 4K required |
422 | + * for TCE-mapped buffer in addition to CRQ. |
423 | + */ |
424 | + if (!ibmvtpm) |
425 | + return CRQ_RES_BUF_SIZE + PAGE_SIZE; |
426 | + |
427 | return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; |
428 | } |
429 | |
430 | @@ -327,7 +338,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev) |
431 | crq.valid = (u8)IBMVTPM_VALID_CMD; |
432 | crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; |
433 | |
434 | - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); |
435 | + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), |
436 | + cpu_to_be64(buf[1])); |
437 | if (rc != H_SUCCESS) |
438 | dev_err(ibmvtpm->dev, |
439 | "tpm_ibmvtpm_suspend failed rc=%d\n", rc); |
440 | @@ -511,11 +523,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, |
441 | case IBMVTPM_VALID_CMD: |
442 | switch (crq->msg) { |
443 | case VTPM_GET_RTCE_BUFFER_SIZE_RES: |
444 | - if (crq->len <= 0) { |
445 | + if (be16_to_cpu(crq->len) <= 0) { |
446 | dev_err(ibmvtpm->dev, "Invalid rtce size\n"); |
447 | return; |
448 | } |
449 | - ibmvtpm->rtce_size = crq->len; |
450 | + ibmvtpm->rtce_size = be16_to_cpu(crq->len); |
451 | ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, |
452 | GFP_KERNEL); |
453 | if (!ibmvtpm->rtce_buf) { |
454 | @@ -536,11 +548,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, |
455 | |
456 | return; |
457 | case VTPM_GET_VERSION_RES: |
458 | - ibmvtpm->vtpm_version = crq->data; |
459 | + ibmvtpm->vtpm_version = be32_to_cpu(crq->data); |
460 | return; |
461 | case VTPM_TPM_COMMAND_RES: |
462 | /* len of the data in rtce buffer */ |
463 | - ibmvtpm->res_len = crq->len; |
464 | + ibmvtpm->res_len = be16_to_cpu(crq->len); |
465 | wake_up_interruptible(&ibmvtpm->wq); |
466 | return; |
467 | default: |
468 | diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c |
469 | index 72f21377fa02..323d02d33c70 100644 |
470 | --- a/drivers/char/tpm/tpm_tis.c |
471 | +++ b/drivers/char/tpm/tpm_tis.c |
472 | @@ -75,6 +75,10 @@ enum tis_defaults { |
473 | #define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) |
474 | #define TPM_RID(l) (0x0F04 | ((l) << 12)) |
475 | |
476 | +struct priv_data { |
477 | + bool irq_tested; |
478 | +}; |
479 | + |
480 | static LIST_HEAD(tis_chips); |
481 | static DEFINE_MUTEX(tis_lock); |
482 | |
483 | @@ -338,12 +342,27 @@ out_err: |
484 | return rc; |
485 | } |
486 | |
487 | +static void disable_interrupts(struct tpm_chip *chip) |
488 | +{ |
489 | + u32 intmask; |
490 | + |
491 | + intmask = |
492 | + ioread32(chip->vendor.iobase + |
493 | + TPM_INT_ENABLE(chip->vendor.locality)); |
494 | + intmask &= ~TPM_GLOBAL_INT_ENABLE; |
495 | + iowrite32(intmask, |
496 | + chip->vendor.iobase + |
497 | + TPM_INT_ENABLE(chip->vendor.locality)); |
498 | + free_irq(chip->vendor.irq, chip); |
499 | + chip->vendor.irq = 0; |
500 | +} |
501 | + |
502 | /* |
503 | * If interrupts are used (signaled by an irq set in the vendor structure) |
504 | * tpm.c can skip polling for the data to be available as the interrupt is |
505 | * waited for here |
506 | */ |
507 | -static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) |
508 | +static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len) |
509 | { |
510 | int rc; |
511 | u32 ordinal; |
512 | @@ -373,6 +392,30 @@ out_err: |
513 | return rc; |
514 | } |
515 | |
516 | +static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) |
517 | +{ |
518 | + int rc, irq; |
519 | + struct priv_data *priv = chip->vendor.priv; |
520 | + |
521 | + if (!chip->vendor.irq || priv->irq_tested) |
522 | + return tpm_tis_send_main(chip, buf, len); |
523 | + |
524 | + /* Verify receipt of the expected IRQ */ |
525 | + irq = chip->vendor.irq; |
526 | + chip->vendor.irq = 0; |
527 | + rc = tpm_tis_send_main(chip, buf, len); |
528 | + chip->vendor.irq = irq; |
529 | + if (!priv->irq_tested) |
530 | + msleep(1); |
531 | + if (!priv->irq_tested) { |
532 | + disable_interrupts(chip); |
533 | + dev_err(chip->dev, |
534 | + FW_BUG "TPM interrupt not working, polling instead\n"); |
535 | + } |
536 | + priv->irq_tested = true; |
537 | + return rc; |
538 | +} |
539 | + |
540 | struct tis_vendor_timeout_override { |
541 | u32 did_vid; |
542 | unsigned long timeout_us[4]; |
543 | @@ -546,6 +589,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) |
544 | if (interrupt == 0) |
545 | return IRQ_NONE; |
546 | |
547 | + ((struct priv_data *)chip->vendor.priv)->irq_tested = true; |
548 | if (interrupt & TPM_INTF_DATA_AVAIL_INT) |
549 | wake_up_interruptible(&chip->vendor.read_queue); |
550 | if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) |
551 | @@ -575,9 +619,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, |
552 | u32 vendor, intfcaps, intmask; |
553 | int rc, i, irq_s, irq_e, probe; |
554 | struct tpm_chip *chip; |
555 | + struct priv_data *priv; |
556 | |
557 | + priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); |
558 | + if (priv == NULL) |
559 | + return -ENOMEM; |
560 | if (!(chip = tpm_register_hardware(dev, &tpm_tis))) |
561 | return -ENODEV; |
562 | + chip->vendor.priv = priv; |
563 | |
564 | chip->vendor.iobase = ioremap(start, len); |
565 | if (!chip->vendor.iobase) { |
566 | @@ -646,19 +695,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, |
567 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) |
568 | dev_dbg(dev, "\tData Avail Int Support\n"); |
569 | |
570 | - /* get the timeouts before testing for irqs */ |
571 | - if (tpm_get_timeouts(chip)) { |
572 | - dev_err(dev, "Could not get TPM timeouts and durations\n"); |
573 | - rc = -ENODEV; |
574 | - goto out_err; |
575 | - } |
576 | - |
577 | - if (tpm_do_selftest(chip)) { |
578 | - dev_err(dev, "TPM self test failed\n"); |
579 | - rc = -ENODEV; |
580 | - goto out_err; |
581 | - } |
582 | - |
583 | /* INTERRUPT Setup */ |
584 | init_waitqueue_head(&chip->vendor.read_queue); |
585 | init_waitqueue_head(&chip->vendor.int_queue); |
586 | @@ -760,6 +796,18 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, |
587 | } |
588 | } |
589 | |
590 | + if (tpm_get_timeouts(chip)) { |
591 | + dev_err(dev, "Could not get TPM timeouts and durations\n"); |
592 | + rc = -ENODEV; |
593 | + goto out_err; |
594 | + } |
595 | + |
596 | + if (tpm_do_selftest(chip)) { |
597 | + dev_err(dev, "TPM self test failed\n"); |
598 | + rc = -ENODEV; |
599 | + goto out_err; |
600 | + } |
601 | + |
602 | INIT_LIST_HEAD(&chip->vendor.list); |
603 | mutex_lock(&tis_lock); |
604 | list_add(&chip->vendor.list, &tis_chips); |
605 | diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c |
606 | index 7047821a7f8a..4ab7a2156672 100644 |
607 | --- a/drivers/cpufreq/speedstep-lib.c |
608 | +++ b/drivers/cpufreq/speedstep-lib.c |
609 | @@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, |
610 | |
611 | pr_debug("previous speed is %u\n", prev_speed); |
612 | |
613 | + preempt_disable(); |
614 | local_irq_save(flags); |
615 | |
616 | /* switch to low state */ |
617 | @@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, |
618 | |
619 | out: |
620 | local_irq_restore(flags); |
621 | + preempt_enable(); |
622 | + |
623 | return ret; |
624 | } |
625 | EXPORT_SYMBOL_GPL(speedstep_get_freqs); |
626 | diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c |
627 | index f5a6b70ee6c0..2844009135f8 100644 |
628 | --- a/drivers/cpufreq/speedstep-smi.c |
629 | +++ b/drivers/cpufreq/speedstep-smi.c |
630 | @@ -188,6 +188,7 @@ static void speedstep_set_state(unsigned int state) |
631 | return; |
632 | |
633 | /* Disable IRQs */ |
634 | + preempt_disable(); |
635 | local_irq_save(flags); |
636 | |
637 | command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); |
638 | @@ -198,9 +199,19 @@ static void speedstep_set_state(unsigned int state) |
639 | |
640 | do { |
641 | if (retry) { |
642 | + /* |
643 | + * We need to enable interrupts, otherwise the blockage |
644 | + * won't resolve. |
645 | + * |
646 | + * We disable preemption so that other processes don't |
647 | + * run. If other processes were running, they could |
648 | + * submit more DMA requests, making the blockage worse. |
649 | + */ |
650 | pr_debug("retry %u, previous result %u, waiting...\n", |
651 | retry, result); |
652 | + local_irq_enable(); |
653 | mdelay(retry * 50); |
654 | + local_irq_disable(); |
655 | } |
656 | retry++; |
657 | __asm__ __volatile__( |
658 | @@ -217,6 +228,7 @@ static void speedstep_set_state(unsigned int state) |
659 | |
660 | /* enable IRQs */ |
661 | local_irq_restore(flags); |
662 | + preempt_enable(); |
663 | |
664 | if (new_state == state) |
665 | pr_debug("change to %u MHz succeeded after %u tries " |
666 | diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c |
667 | index 30a5844a7dca..845730469945 100644 |
668 | --- a/drivers/gpio/gpio-tps65912.c |
669 | +++ b/drivers/gpio/gpio-tps65912.c |
670 | @@ -26,9 +26,12 @@ struct tps65912_gpio_data { |
671 | struct gpio_chip gpio_chip; |
672 | }; |
673 | |
674 | +#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) |
675 | + |
676 | static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) |
677 | { |
678 | - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); |
679 | + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
680 | + struct tps65912 *tps65912 = tps65912_gpio->tps65912; |
681 | int val; |
682 | |
683 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); |
684 | @@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) |
685 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, |
686 | int value) |
687 | { |
688 | - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); |
689 | + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
690 | + struct tps65912 *tps65912 = tps65912_gpio->tps65912; |
691 | |
692 | if (value) |
693 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, |
694 | @@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, |
695 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, |
696 | int value) |
697 | { |
698 | - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); |
699 | + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
700 | + struct tps65912 *tps65912 = tps65912_gpio->tps65912; |
701 | |
702 | /* Set the initial value */ |
703 | tps65912_gpio_set(gc, offset, value); |
704 | @@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, |
705 | |
706 | static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) |
707 | { |
708 | - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); |
709 | + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
710 | + struct tps65912 *tps65912 = tps65912_gpio->tps65912; |
711 | |
712 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, |
713 | GPIO_CFG_MASK); |
714 | diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c |
715 | index 469daa04dadb..ccc2f36bb334 100644 |
716 | --- a/drivers/hid/i2c-hid/i2c-hid.c |
717 | +++ b/drivers/hid/i2c-hid/i2c-hid.c |
718 | @@ -341,7 +341,10 @@ static int i2c_hid_hwreset(struct i2c_client *client) |
719 | static void i2c_hid_get_input(struct i2c_hid *ihid) |
720 | { |
721 | int ret, ret_size; |
722 | - int size = ihid->bufsize; |
723 | + int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); |
724 | + |
725 | + if (size > ihid->bufsize) |
726 | + size = ihid->bufsize; |
727 | |
728 | ret = i2c_master_recv(ihid->client, ihid->inbuf, size); |
729 | if (ret != size) { |
730 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
731 | index e885dbf08c40..86ac4a4ccc01 100644 |
732 | --- a/drivers/md/raid1.c |
733 | +++ b/drivers/md/raid1.c |
734 | @@ -557,7 +557,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect |
735 | if (test_bit(WriteMostly, &rdev->flags)) { |
736 | /* Don't balance among write-mostly, just |
737 | * use the first as a last resort */ |
738 | - if (best_disk < 0) { |
739 | + if (best_dist_disk < 0) { |
740 | if (is_badblock(rdev, this_sector, sectors, |
741 | &first_bad, &bad_sectors)) { |
742 | if (first_bad < this_sector) |
743 | @@ -566,7 +566,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect |
744 | best_good_sectors = first_bad - this_sector; |
745 | } else |
746 | best_good_sectors = sectors; |
747 | - best_disk = disk; |
748 | + best_dist_disk = disk; |
749 | + best_pending_disk = disk; |
750 | } |
751 | continue; |
752 | } |
753 | diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
754 | index 4daf5c03b33b..1b6986ce5da9 100644 |
755 | --- a/drivers/md/raid5.c |
756 | +++ b/drivers/md/raid5.c |
757 | @@ -2853,7 +2853,8 @@ static void handle_stripe_dirtying(struct r5conf *conf, |
758 | * generate correct data from the parity. |
759 | */ |
760 | if (conf->max_degraded == 2 || |
761 | - (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { |
762 | + (recovery_cp < MaxSector && sh->sector >= recovery_cp && |
763 | + s->failed == 0)) { |
764 | /* Calculate the real rcw later - for now make it |
765 | * look like rcw is cheaper |
766 | */ |
767 | diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c |
768 | index b3fd0ffa3c3f..fc28d514bff0 100644 |
769 | --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c |
770 | +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c |
771 | @@ -350,6 +350,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) |
772 | { |
773 | struct dvb_usb_device *d = adap_to_d(adap); |
774 | struct lme2510_state *lme_int = adap_to_priv(adap); |
775 | + struct usb_host_endpoint *ep; |
776 | |
777 | lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC); |
778 | |
779 | @@ -371,6 +372,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) |
780 | adap, |
781 | 8); |
782 | |
783 | + /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ |
784 | + ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); |
785 | + |
786 | + if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) |
787 | + lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa), |
788 | + |
789 | lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
790 | |
791 | usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC); |
792 | diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c |
793 | index 1ae358e0662d..4edb24bf56f8 100644 |
794 | --- a/drivers/mmc/host/sdhci-pxav3.c |
795 | +++ b/drivers/mmc/host/sdhci-pxav3.c |
796 | @@ -201,8 +201,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) |
797 | if (!pdata) |
798 | return NULL; |
799 | |
800 | - of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); |
801 | - if (clk_delay_cycles > 0) |
802 | + if (!of_property_read_u32(np, "mrvl,clk-delay-cycles", |
803 | + &clk_delay_cycles)) |
804 | pdata->clk_delay_cycles = clk_delay_cycles; |
805 | |
806 | return pdata; |
807 | diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
808 | index 88b9c0964696..e6660d692008 100644 |
809 | --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
810 | +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
811 | @@ -360,9 +360,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, |
812 | mvmvif->uploaded = false; |
813 | mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; |
814 | |
815 | - /* does this make sense at all? */ |
816 | - mvmvif->color++; |
817 | - |
818 | spin_lock_bh(&mvm->time_event_lock); |
819 | iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); |
820 | spin_unlock_bh(&mvm->time_event_lock); |
821 | @@ -544,7 +541,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, |
822 | |
823 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); |
824 | if (ret) |
825 | - goto out_release; |
826 | + goto out_remove_mac; |
827 | |
828 | /* |
829 | * Update power state on the new interface. Admittedly, based on |
830 | diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c |
831 | index 4ec8385e4307..3dd0e5bfa0fc 100644 |
832 | --- a/drivers/net/wireless/iwlwifi/mvm/tx.c |
833 | +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c |
834 | @@ -832,6 +832,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, |
835 | sta_id = ba_notif->sta_id; |
836 | tid = ba_notif->tid; |
837 | |
838 | + if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT || |
839 | + tid >= IWL_MAX_TID_COUNT, |
840 | + "sta_id %d tid %d", sta_id, tid)) |
841 | + return 0; |
842 | + |
843 | rcu_read_lock(); |
844 | |
845 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); |
846 | diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c |
847 | index 48acfc620191..f05962c32497 100644 |
848 | --- a/drivers/net/wireless/iwlwifi/pcie/tx.c |
849 | +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c |
850 | @@ -720,7 +720,12 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans) |
851 | iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG, |
852 | trans_pcie->kw.dma >> 4); |
853 | |
854 | - iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr); |
855 | + /* |
856 | + * Send 0 as the scd_base_addr since the device may have be reset |
857 | + * while we were in WoWLAN in which case SCD_SRAM_BASE_ADDR will |
858 | + * contain garbage. |
859 | + */ |
860 | + iwl_pcie_tx_start(trans, 0); |
861 | } |
862 | |
863 | /* |
864 | diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c |
865 | index 66aabde82727..5548a13617ab 100644 |
866 | --- a/drivers/pci/pci-driver.c |
867 | +++ b/drivers/pci/pci-driver.c |
868 | @@ -1267,7 +1267,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) |
869 | if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev))) |
870 | return -ENOMEM; |
871 | |
872 | - if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", |
873 | + if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X", |
874 | pdev->vendor, pdev->device, |
875 | pdev->subsystem_vendor, pdev->subsystem_device, |
876 | (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), |
877 | diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c |
878 | index c5d0a08a8747..d6d499782fb4 100644 |
879 | --- a/drivers/pci/rom.c |
880 | +++ b/drivers/pci/rom.c |
881 | @@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) |
882 | { |
883 | void __iomem *image; |
884 | int last_image; |
885 | + unsigned length; |
886 | |
887 | image = rom; |
888 | do { |
889 | @@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) |
890 | if (readb(pds + 3) != 'R') |
891 | break; |
892 | last_image = readb(pds + 21) & 0x80; |
893 | - /* this length is reliable */ |
894 | - image += readw(pds + 16) * 512; |
895 | - } while (!last_image); |
896 | + length = readw(pds + 16); |
897 | + image += length * 512; |
898 | + } while (length && !last_image); |
899 | |
900 | /* never return a size larger than the PCI resource window */ |
901 | /* there are known ROMs that get the size wrong */ |
902 | diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c |
903 | index 36fb4b5a4b0d..1ef35ab79d0f 100644 |
904 | --- a/drivers/power/88pm860x_charger.c |
905 | +++ b/drivers/power/88pm860x_charger.c |
906 | @@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev) |
907 | return 0; |
908 | |
909 | out_irq: |
910 | + power_supply_unregister(&info->usb); |
911 | while (--i >= 0) |
912 | free_irq(info->irq[i], info); |
913 | out: |
914 | diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c |
915 | index 81289520f96b..bd53364b75e8 100644 |
916 | --- a/drivers/target/iscsi/iscsi_target_tq.c |
917 | +++ b/drivers/target/iscsi/iscsi_target_tq.c |
918 | @@ -26,36 +26,22 @@ |
919 | #include "iscsi_target_tq.h" |
920 | #include "iscsi_target.h" |
921 | |
922 | -static LIST_HEAD(active_ts_list); |
923 | static LIST_HEAD(inactive_ts_list); |
924 | -static DEFINE_SPINLOCK(active_ts_lock); |
925 | static DEFINE_SPINLOCK(inactive_ts_lock); |
926 | static DEFINE_SPINLOCK(ts_bitmap_lock); |
927 | |
928 | -static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts) |
929 | -{ |
930 | - spin_lock(&active_ts_lock); |
931 | - list_add_tail(&ts->ts_list, &active_ts_list); |
932 | - iscsit_global->active_ts++; |
933 | - spin_unlock(&active_ts_lock); |
934 | -} |
935 | - |
936 | static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts) |
937 | { |
938 | + if (!list_empty(&ts->ts_list)) { |
939 | + WARN_ON(1); |
940 | + return; |
941 | + } |
942 | spin_lock(&inactive_ts_lock); |
943 | list_add_tail(&ts->ts_list, &inactive_ts_list); |
944 | iscsit_global->inactive_ts++; |
945 | spin_unlock(&inactive_ts_lock); |
946 | } |
947 | |
948 | -static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts) |
949 | -{ |
950 | - spin_lock(&active_ts_lock); |
951 | - list_del(&ts->ts_list); |
952 | - iscsit_global->active_ts--; |
953 | - spin_unlock(&active_ts_lock); |
954 | -} |
955 | - |
956 | static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) |
957 | { |
958 | struct iscsi_thread_set *ts; |
959 | @@ -68,7 +54,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) |
960 | |
961 | ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list); |
962 | |
963 | - list_del(&ts->ts_list); |
964 | + list_del_init(&ts->ts_list); |
965 | iscsit_global->inactive_ts--; |
966 | spin_unlock(&inactive_ts_lock); |
967 | |
968 | @@ -219,8 +205,6 @@ static void iscsi_deallocate_extra_thread_sets(void) |
969 | |
970 | void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts) |
971 | { |
972 | - iscsi_add_ts_to_active_list(ts); |
973 | - |
974 | spin_lock_bh(&ts->ts_state_lock); |
975 | conn->thread_set = ts; |
976 | ts->conn = conn; |
977 | @@ -423,7 +407,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts) |
978 | |
979 | if (ts->delay_inactive && (--ts->thread_count == 0)) { |
980 | spin_unlock_bh(&ts->ts_state_lock); |
981 | - iscsi_del_ts_from_active_list(ts); |
982 | |
983 | if (!iscsit_global->in_shutdown) |
984 | iscsi_deallocate_extra_thread_sets(); |
985 | @@ -476,7 +459,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts) |
986 | |
987 | if (ts->delay_inactive && (--ts->thread_count == 0)) { |
988 | spin_unlock_bh(&ts->ts_state_lock); |
989 | - iscsi_del_ts_from_active_list(ts); |
990 | |
991 | if (!iscsit_global->in_shutdown) |
992 | iscsi_deallocate_extra_thread_sets(); |
993 | diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
994 | index abfd99089781..7cb36813aac2 100644 |
995 | --- a/drivers/tty/pty.c |
996 | +++ b/drivers/tty/pty.c |
997 | @@ -215,6 +215,9 @@ static int pty_signal(struct tty_struct *tty, int sig) |
998 | unsigned long flags; |
999 | struct pid *pgrp; |
1000 | |
1001 | + if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP) |
1002 | + return -EINVAL; |
1003 | + |
1004 | if (tty->link) { |
1005 | spin_lock_irqsave(&tty->link->ctrl_lock, flags); |
1006 | pgrp = get_pid(tty->link->pgrp); |
1007 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1008 | index 0d1b3757cfb6..db9d69fa1085 100644 |
1009 | --- a/drivers/tty/vt/vt.c |
1010 | +++ b/drivers/tty/vt/vt.c |
1011 | @@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) |
1012 | #endif |
1013 | if (DO_UPDATE(vc)) |
1014 | do_update_region(vc, (unsigned long) p, count); |
1015 | + notify_update(vc); |
1016 | } |
1017 | |
1018 | /* used by selection: complement pointer position */ |
1019 | @@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset) |
1020 | scr_writew(old, screenpos(vc, old_offset, 1)); |
1021 | if (DO_UPDATE(vc)) |
1022 | vc->vc_sw->con_putc(vc, old, oldy, oldx); |
1023 | + notify_update(vc); |
1024 | } |
1025 | |
1026 | old_offset = offset; |
1027 | @@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset) |
1028 | oldy = (offset >> 1) / vc->vc_cols; |
1029 | vc->vc_sw->con_putc(vc, new, oldy, oldx); |
1030 | } |
1031 | + notify_update(vc); |
1032 | } |
1033 | - |
1034 | } |
1035 | |
1036 | static void insert_char(struct vc_data *vc, unsigned int nr) |
1037 | diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c |
1038 | index b0585e623ba9..19fa68a732f3 100644 |
1039 | --- a/drivers/usb/core/buffer.c |
1040 | +++ b/drivers/usb/core/buffer.c |
1041 | @@ -22,17 +22,25 @@ |
1042 | */ |
1043 | |
1044 | /* FIXME tune these based on pool statistics ... */ |
1045 | -static const size_t pool_max[HCD_BUFFER_POOLS] = { |
1046 | - /* platforms without dma-friendly caches might need to |
1047 | - * prevent cacheline sharing... |
1048 | - */ |
1049 | - 32, |
1050 | - 128, |
1051 | - 512, |
1052 | - PAGE_SIZE / 2 |
1053 | - /* bigger --> allocate pages */ |
1054 | +static size_t pool_max[HCD_BUFFER_POOLS] = { |
1055 | + 32, 128, 512, 2048, |
1056 | }; |
1057 | |
1058 | +void __init usb_init_pool_max(void) |
1059 | +{ |
1060 | + /* |
1061 | + * The pool_max values must never be smaller than |
1062 | + * ARCH_KMALLOC_MINALIGN. |
1063 | + */ |
1064 | + if (ARCH_KMALLOC_MINALIGN <= 32) |
1065 | + ; /* Original value is okay */ |
1066 | + else if (ARCH_KMALLOC_MINALIGN <= 64) |
1067 | + pool_max[0] = 64; |
1068 | + else if (ARCH_KMALLOC_MINALIGN <= 128) |
1069 | + pool_max[0] = 0; /* Don't use this pool */ |
1070 | + else |
1071 | + BUILD_BUG(); /* We don't allow this */ |
1072 | +} |
1073 | |
1074 | /* SETUP primitives */ |
1075 | |
1076 | diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
1077 | index f6e5ceb03afb..cbfd3d14fa5a 100644 |
1078 | --- a/drivers/usb/core/hcd.c |
1079 | +++ b/drivers/usb/core/hcd.c |
1080 | @@ -1593,6 +1593,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status) |
1081 | int usb_hcd_unlink_urb (struct urb *urb, int status) |
1082 | { |
1083 | struct usb_hcd *hcd; |
1084 | + struct usb_device *udev = urb->dev; |
1085 | int retval = -EIDRM; |
1086 | unsigned long flags; |
1087 | |
1088 | @@ -1604,20 +1605,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) |
1089 | spin_lock_irqsave(&hcd_urb_unlink_lock, flags); |
1090 | if (atomic_read(&urb->use_count) > 0) { |
1091 | retval = 0; |
1092 | - usb_get_dev(urb->dev); |
1093 | + usb_get_dev(udev); |
1094 | } |
1095 | spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags); |
1096 | if (retval == 0) { |
1097 | hcd = bus_to_hcd(urb->dev->bus); |
1098 | retval = unlink1(hcd, urb, status); |
1099 | - usb_put_dev(urb->dev); |
1100 | + if (retval == 0) |
1101 | + retval = -EINPROGRESS; |
1102 | + else if (retval != -EIDRM && retval != -EBUSY) |
1103 | + dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n", |
1104 | + urb, retval); |
1105 | + usb_put_dev(udev); |
1106 | } |
1107 | - |
1108 | - if (retval == 0) |
1109 | - retval = -EINPROGRESS; |
1110 | - else if (retval != -EIDRM && retval != -EBUSY) |
1111 | - dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n", |
1112 | - urb, retval); |
1113 | return retval; |
1114 | } |
1115 | |
1116 | diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c |
1117 | index b10da720f2b4..e54b1bdcd66e 100644 |
1118 | --- a/drivers/usb/core/usb.c |
1119 | +++ b/drivers/usb/core/usb.c |
1120 | @@ -1003,6 +1003,7 @@ static int __init usb_init(void) |
1121 | pr_info("%s: USB support disabled\n", usbcore_name); |
1122 | return 0; |
1123 | } |
1124 | + usb_init_pool_max(); |
1125 | |
1126 | retval = usb_debugfs_init(); |
1127 | if (retval) |
1128 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1129 | index 8e15acd204ef..f48f5dfab245 100644 |
1130 | --- a/drivers/usb/serial/cp210x.c |
1131 | +++ b/drivers/usb/serial/cp210x.c |
1132 | @@ -56,6 +56,7 @@ static const struct usb_device_id id_table[] = { |
1133 | { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ |
1134 | { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ |
1135 | { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ |
1136 | + { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ |
1137 | { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ |
1138 | { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ |
1139 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
1140 | diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
1141 | index 3aac8e9edac3..3c4d8797ea9a 100644 |
1142 | --- a/fs/binfmt_elf.c |
1143 | +++ b/fs/binfmt_elf.c |
1144 | @@ -552,11 +552,12 @@ out: |
1145 | |
1146 | static unsigned long randomize_stack_top(unsigned long stack_top) |
1147 | { |
1148 | - unsigned int random_variable = 0; |
1149 | + unsigned long random_variable = 0; |
1150 | |
1151 | if ((current->flags & PF_RANDOMIZE) && |
1152 | !(current->personality & ADDR_NO_RANDOMIZE)) { |
1153 | - random_variable = get_random_int() & STACK_RND_MASK; |
1154 | + random_variable = (unsigned long) get_random_int(); |
1155 | + random_variable &= STACK_RND_MASK; |
1156 | random_variable <<= PAGE_SHIFT; |
1157 | } |
1158 | #ifdef CONFIG_STACK_GROWSUP |
1159 | diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c |
1160 | index 7654e87b0428..9ad5ba4b299b 100644 |
1161 | --- a/fs/jffs2/scan.c |
1162 | +++ b/fs/jffs2/scan.c |
1163 | @@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo |
1164 | sumlen = c->sector_size - je32_to_cpu(sm->offset); |
1165 | sumptr = buf + buf_size - sumlen; |
1166 | |
1167 | + /* sm->offset maybe wrong but MAGIC maybe right */ |
1168 | + if (sumlen > c->sector_size) |
1169 | + goto full_scan; |
1170 | + |
1171 | /* Now, make sure the summary itself is available */ |
1172 | if (sumlen > buf_size) { |
1173 | /* Need to kmalloc for this. */ |
1174 | @@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo |
1175 | } |
1176 | } |
1177 | |
1178 | +full_scan: |
1179 | buf_ofs = jeb->offset; |
1180 | |
1181 | if (!buf_size) { |
1182 | diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c |
1183 | index cff089a412c7..e05c96ebb27d 100644 |
1184 | --- a/fs/nfs/callback.c |
1185 | +++ b/fs/nfs/callback.c |
1186 | @@ -128,22 +128,24 @@ nfs41_callback_svc(void *vrqstp) |
1187 | if (try_to_freeze()) |
1188 | continue; |
1189 | |
1190 | - prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE); |
1191 | + prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE); |
1192 | spin_lock_bh(&serv->sv_cb_lock); |
1193 | if (!list_empty(&serv->sv_cb_list)) { |
1194 | req = list_first_entry(&serv->sv_cb_list, |
1195 | struct rpc_rqst, rq_bc_list); |
1196 | list_del(&req->rq_bc_list); |
1197 | spin_unlock_bh(&serv->sv_cb_lock); |
1198 | + finish_wait(&serv->sv_cb_waitq, &wq); |
1199 | dprintk("Invoking bc_svc_process()\n"); |
1200 | error = bc_svc_process(serv, req, rqstp); |
1201 | dprintk("bc_svc_process() returned w/ error code= %d\n", |
1202 | error); |
1203 | } else { |
1204 | spin_unlock_bh(&serv->sv_cb_lock); |
1205 | - schedule(); |
1206 | + /* schedule_timeout to game the hung task watchdog */ |
1207 | + schedule_timeout(60 * HZ); |
1208 | + finish_wait(&serv->sv_cb_waitq, &wq); |
1209 | } |
1210 | - finish_wait(&serv->sv_cb_waitq, &wq); |
1211 | } |
1212 | return 0; |
1213 | } |
1214 | diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c |
1215 | index a35582c9d444..e98ecf8d2588 100644 |
1216 | --- a/fs/nfs/callback_xdr.c |
1217 | +++ b/fs/nfs/callback_xdr.c |
1218 | @@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, |
1219 | |
1220 | for (i = 0; i < args->csa_nrclists; i++) { |
1221 | status = decode_rc_list(xdr, &args->csa_rclists[i]); |
1222 | - if (status) |
1223 | + if (status) { |
1224 | + args->csa_nrclists = i; |
1225 | goto out_free; |
1226 | + } |
1227 | } |
1228 | } |
1229 | status = 0; |
1230 | diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c |
1231 | index 4ec431777048..e0451f4201cf 100644 |
1232 | --- a/fs/xfs/xfs_buf_item.c |
1233 | +++ b/fs/xfs/xfs_buf_item.c |
1234 | @@ -296,6 +296,10 @@ xfs_buf_item_format( |
1235 | ASSERT(atomic_read(&bip->bli_refcount) > 0); |
1236 | ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || |
1237 | (bip->bli_flags & XFS_BLI_STALE)); |
1238 | + ASSERT((bip->bli_flags & XFS_BLI_STALE) || |
1239 | + (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF |
1240 | + && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF)); |
1241 | + |
1242 | |
1243 | /* |
1244 | * If it is an inode buffer, transfer the in-memory state to the |
1245 | diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
1246 | index 7f7be5f98f52..f010ab4594f1 100644 |
1247 | --- a/fs/xfs/xfs_inode.c |
1248 | +++ b/fs/xfs/xfs_inode.c |
1249 | @@ -1655,6 +1655,7 @@ xfs_iunlink( |
1250 | agi->agi_unlinked[bucket_index] = cpu_to_be32(agino); |
1251 | offset = offsetof(xfs_agi_t, agi_unlinked) + |
1252 | (sizeof(xfs_agino_t) * bucket_index); |
1253 | + xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); |
1254 | xfs_trans_log_buf(tp, agibp, offset, |
1255 | (offset + sizeof(xfs_agino_t) - 1)); |
1256 | return 0; |
1257 | @@ -1746,6 +1747,7 @@ xfs_iunlink_remove( |
1258 | agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino); |
1259 | offset = offsetof(xfs_agi_t, agi_unlinked) + |
1260 | (sizeof(xfs_agino_t) * bucket_index); |
1261 | + xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); |
1262 | xfs_trans_log_buf(tp, agibp, offset, |
1263 | (offset + sizeof(xfs_agino_t) - 1)); |
1264 | } else { |
1265 | diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c |
1266 | index 2fd7c1ff1d21..b5d5beb7df3a 100644 |
1267 | --- a/fs/xfs/xfs_trans.c |
1268 | +++ b/fs/xfs/xfs_trans.c |
1269 | @@ -1100,6 +1100,7 @@ xfs_trans_apply_sb_deltas( |
1270 | whole = 1; |
1271 | } |
1272 | |
1273 | + xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF); |
1274 | if (whole) |
1275 | /* |
1276 | * Log the whole thing, the fields are noncontiguous. |
1277 | diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h |
1278 | index a78680a92dba..661c0aeef1c4 100644 |
1279 | --- a/include/linux/fsnotify.h |
1280 | +++ b/include/linux/fsnotify.h |
1281 | @@ -101,8 +101,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, |
1282 | new_dir_mask |= FS_ISDIR; |
1283 | } |
1284 | |
1285 | - fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); |
1286 | - fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); |
1287 | + fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, |
1288 | + fs_cookie); |
1289 | + fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, |
1290 | + fs_cookie); |
1291 | |
1292 | if (target) |
1293 | fsnotify_link_count(target); |
1294 | diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h |
1295 | index 0fdff28d5015..287b906f5d59 100644 |
1296 | --- a/include/linux/usb/hcd.h |
1297 | +++ b/include/linux/usb/hcd.h |
1298 | @@ -416,6 +416,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops; |
1299 | #endif /* CONFIG_PCI */ |
1300 | |
1301 | /* pci-ish (pdev null is ok) buffer alloc/mapping support */ |
1302 | +void usb_init_pool_max(void); |
1303 | int hcd_buffer_create(struct usb_hcd *hcd); |
1304 | void hcd_buffer_destroy(struct usb_hcd *hcd); |
1305 | |
1306 | diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c |
1307 | index 00eb8f7fbf41..545241de23bf 100644 |
1308 | --- a/kernel/debug/kdb/kdb_main.c |
1309 | +++ b/kernel/debug/kdb/kdb_main.c |
1310 | @@ -2532,7 +2532,7 @@ static int kdb_summary(int argc, const char **argv) |
1311 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
1312 | kdb_printf("\nMemTotal: %8lu kB\nMemFree: %8lu kB\n" |
1313 | "Buffers: %8lu kB\n", |
1314 | - val.totalram, val.freeram, val.bufferram); |
1315 | + K(val.totalram), K(val.freeram), K(val.bufferram)); |
1316 | return 0; |
1317 | } |
1318 | |
1319 | diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c |
1320 | index 28db9bedc857..6211d5d6d465 100644 |
1321 | --- a/kernel/time/ntp.c |
1322 | +++ b/kernel/time/ntp.c |
1323 | @@ -631,10 +631,14 @@ int ntp_validate_timex(struct timex *txc) |
1324 | if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) |
1325 | return -EPERM; |
1326 | |
1327 | - if (txc->modes & ADJ_FREQUENCY) { |
1328 | - if (LONG_MIN / PPM_SCALE > txc->freq) |
1329 | + /* |
1330 | + * Check for potential multiplication overflows that can |
1331 | + * only happen on 64-bit systems: |
1332 | + */ |
1333 | + if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { |
1334 | + if (LLONG_MIN / PPM_SCALE > txc->freq) |
1335 | return -EINVAL; |
1336 | - if (LONG_MAX / PPM_SCALE < txc->freq) |
1337 | + if (LLONG_MAX / PPM_SCALE < txc->freq) |
1338 | return -EINVAL; |
1339 | } |
1340 | |
1341 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1342 | index 18cdf91b2f85..8d7e8098e768 100644 |
1343 | --- a/kernel/trace/trace.c |
1344 | +++ b/kernel/trace/trace.c |
1345 | @@ -4588,7 +4588,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, |
1346 | *fpos += written; |
1347 | |
1348 | out_unlock: |
1349 | - for (i = 0; i < nr_pages; i++){ |
1350 | + for (i = nr_pages - 1; i >= 0; i--) { |
1351 | kunmap_atomic(map_page[i]); |
1352 | put_page(pages[i]); |
1353 | } |
1354 | diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c |
1355 | index 3663a305daf7..1b51d9216e7e 100644 |
1356 | --- a/net/ceph/osd_client.c |
1357 | +++ b/net/ceph/osd_client.c |
1358 | @@ -967,12 +967,24 @@ static void put_osd(struct ceph_osd *osd) |
1359 | */ |
1360 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
1361 | { |
1362 | - dout("__remove_osd %p\n", osd); |
1363 | - BUG_ON(!list_empty(&osd->o_requests)); |
1364 | - rb_erase(&osd->o_node, &osdc->osds); |
1365 | + dout("%s %p osd%d\n", __func__, osd, osd->o_osd); |
1366 | + WARN_ON(!list_empty(&osd->o_requests)); |
1367 | + WARN_ON(!list_empty(&osd->o_linger_requests)); |
1368 | + |
1369 | list_del_init(&osd->o_osd_lru); |
1370 | - ceph_con_close(&osd->o_con); |
1371 | - put_osd(osd); |
1372 | + rb_erase(&osd->o_node, &osdc->osds); |
1373 | + RB_CLEAR_NODE(&osd->o_node); |
1374 | +} |
1375 | + |
1376 | +static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
1377 | +{ |
1378 | + dout("%s %p osd%d\n", __func__, osd, osd->o_osd); |
1379 | + |
1380 | + if (!RB_EMPTY_NODE(&osd->o_node)) { |
1381 | + ceph_con_close(&osd->o_con); |
1382 | + __remove_osd(osdc, osd); |
1383 | + put_osd(osd); |
1384 | + } |
1385 | } |
1386 | |
1387 | static void remove_all_osds(struct ceph_osd_client *osdc) |
1388 | @@ -982,7 +994,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc) |
1389 | while (!RB_EMPTY_ROOT(&osdc->osds)) { |
1390 | struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), |
1391 | struct ceph_osd, o_node); |
1392 | - __remove_osd(osdc, osd); |
1393 | + remove_osd(osdc, osd); |
1394 | } |
1395 | mutex_unlock(&osdc->request_mutex); |
1396 | } |
1397 | @@ -1012,7 +1024,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc) |
1398 | list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { |
1399 | if (time_before(jiffies, osd->lru_ttl)) |
1400 | break; |
1401 | - __remove_osd(osdc, osd); |
1402 | + remove_osd(osdc, osd); |
1403 | } |
1404 | mutex_unlock(&osdc->request_mutex); |
1405 | } |
1406 | @@ -1027,8 +1039,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
1407 | dout("__reset_osd %p osd%d\n", osd, osd->o_osd); |
1408 | if (list_empty(&osd->o_requests) && |
1409 | list_empty(&osd->o_linger_requests)) { |
1410 | - __remove_osd(osdc, osd); |
1411 | - |
1412 | + remove_osd(osdc, osd); |
1413 | return -ENODEV; |
1414 | } |
1415 | |
1416 | @@ -1610,6 +1621,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) |
1417 | { |
1418 | struct rb_node *p, *n; |
1419 | |
1420 | + dout("%s %p\n", __func__, osdc); |
1421 | for (p = rb_first(&osdc->osds); p; p = n) { |
1422 | struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); |
1423 | |
1424 | diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c |
1425 | index 63c1c8041554..fa66ba30470e 100644 |
1426 | --- a/sound/pci/riptide/riptide.c |
1427 | +++ b/sound/pci/riptide/riptide.c |
1428 | @@ -2032,32 +2032,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) |
1429 | { |
1430 | static int dev; |
1431 | struct gameport *gameport; |
1432 | + int ret; |
1433 | |
1434 | if (dev >= SNDRV_CARDS) |
1435 | return -ENODEV; |
1436 | + |
1437 | if (!enable[dev]) { |
1438 | - dev++; |
1439 | - return -ENOENT; |
1440 | + ret = -ENOENT; |
1441 | + goto inc_dev; |
1442 | } |
1443 | |
1444 | - if (!joystick_port[dev++]) |
1445 | - return 0; |
1446 | + if (!joystick_port[dev]) { |
1447 | + ret = 0; |
1448 | + goto inc_dev; |
1449 | + } |
1450 | |
1451 | gameport = gameport_allocate_port(); |
1452 | - if (!gameport) |
1453 | - return -ENOMEM; |
1454 | + if (!gameport) { |
1455 | + ret = -ENOMEM; |
1456 | + goto inc_dev; |
1457 | + } |
1458 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { |
1459 | snd_printk(KERN_WARNING |
1460 | "Riptide: cannot grab gameport 0x%x\n", |
1461 | joystick_port[dev]); |
1462 | gameport_free_port(gameport); |
1463 | - return -EBUSY; |
1464 | + ret = -EBUSY; |
1465 | + goto inc_dev; |
1466 | } |
1467 | |
1468 | gameport->io = joystick_port[dev]; |
1469 | gameport_register_port(gameport); |
1470 | pci_set_drvdata(pci, gameport); |
1471 | - return 0; |
1472 | + |
1473 | + ret = 0; |
1474 | +inc_dev: |
1475 | + dev++; |
1476 | + return ret; |
1477 | } |
1478 | |
1479 | static void snd_riptide_joystick_remove(struct pci_dev *pci) |
1480 | diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c |
1481 | index 9ea05e956474..dd910d249987 100644 |
1482 | --- a/sound/pci/rme9652/hdspm.c |
1483 | +++ b/sound/pci/rme9652/hdspm.c |
1484 | @@ -5789,6 +5789,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) |
1485 | snd_pcm_hw_constraint_minmax(runtime, |
1486 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |
1487 | 64, 8192); |
1488 | + snd_pcm_hw_constraint_minmax(runtime, |
1489 | + SNDRV_PCM_HW_PARAM_PERIODS, |
1490 | + 2, 2); |
1491 | break; |
1492 | } |
1493 | |
1494 | @@ -5863,6 +5866,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) |
1495 | snd_pcm_hw_constraint_minmax(runtime, |
1496 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |
1497 | 64, 8192); |
1498 | + snd_pcm_hw_constraint_minmax(runtime, |
1499 | + SNDRV_PCM_HW_PARAM_PERIODS, |
1500 | + 2, 2); |
1501 | break; |
1502 | } |
1503 |