diff options
author | LCPD Auto Merger | 2016-12-02 12:17:48 -0600 |
---|---|---|
committer | LCPD Auto Merger | 2016-12-02 12:17:48 -0600 |
commit | 7f655674db9f3a80c99a8e29c0a6046ec14a7d27 (patch) | |
tree | 30c899cf9c1ffbbffc6a7659aa66c6e790a6fe7b | |
parent | 0e81dfbd5ada5c09d8b9caf9d615011b4b947eb2 (diff) | |
parent | 7cf800a769189522dfcaf78b9107ae47b5d80abe (diff) | |
download | ti-linux-kernel-7f655674db9f3a80c99a8e29c0a6046ec14a7d27.tar.gz ti-linux-kernel-7f655674db9f3a80c99a8e29c0a6046ec14a7d27.tar.xz ti-linux-kernel-7f655674db9f3a80c99a8e29c0a6046ec14a7d27.zip |
Merge branch 'ti-linux-4.1.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel into ti-lsk-linux-4.1.y
TI-Feature: ti_linux_base_lsk
TI-Tree: git@git.ti.com:ti-linux-kernel/ti-linux-kernel.git
TI-Branch: ti-linux-4.1.y
* 'ti-linux-4.1.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel: (72 commits)
Linux 4.1.36
kbuild: add -fno-PIE
firewire: net: fix fragmented datagram_size off-by-one
firewire: net: guard against rx buffer overflows
parisc: Ensure consistent state when switching to kernel stack at syscall entry
ovl: fsync after copy-up
virtio: console: Unlock vqs while freeing buffers
md: be careful not lot leak internal curr_resync value into metadata. -- (all)
md: sync sync_completed has correct value as recovery finishes.
scsi: arcmsr: Send SYNCHRONIZE_CACHE command to firmware
scsi: scsi_debug: Fix memory leak if LBP enabled and module is unloaded
drm/radeon/si_dpm: workaround for SI kickers
drm/dp/mst: Check peer device type before attempting EDID read
drm/dp/mst: add some defines for logical/physical ports
drm/dp/mst: Clear port->pdt when tearing down the i2c adapter
KVM: MIPS: Precalculate MMIO load resume PC
KVM: MIPS: Make ERET handle ERL before EXL
drm/radeon: drop register readback in cayman_cp_int_cntl_setup
scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
Revert "drm/radeon: fix DP link training issue with second 4K monitor"
...
Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>
73 files changed, 672 insertions, 306 deletions
diff --git a/Documentation/x86/exception-tables.txt b/Documentation/x86/exception-tables.txt index 32901aa36f0a..e396bcd8d830 100644 --- a/Documentation/x86/exception-tables.txt +++ b/Documentation/x86/exception-tables.txt | |||
@@ -290,3 +290,38 @@ Due to the way that the exception table is built and needs to be ordered, | |||
290 | only use exceptions for code in the .text section. Any other section | 290 | only use exceptions for code in the .text section. Any other section |
291 | will cause the exception table to not be sorted correctly, and the | 291 | will cause the exception table to not be sorted correctly, and the |
292 | exceptions will fail. | 292 | exceptions will fail. |
293 | |||
294 | Things changed when 64-bit support was added to x86 Linux. Rather than | ||
295 | double the size of the exception table by expanding the two entries | ||
296 | from 32-bits to 64 bits, a clever trick was used to store addresses | ||
297 | as relative offsets from the table itself. The assembly code changed | ||
298 | from: | ||
299 | .long 1b,3b | ||
300 | to: | ||
301 | .long (from) - . | ||
302 | .long (to) - . | ||
303 | |||
304 | and the C-code that uses these values converts back to absolute addresses | ||
305 | like this: | ||
306 | |||
307 | ex_insn_addr(const struct exception_table_entry *x) | ||
308 | { | ||
309 | return (unsigned long)&x->insn + x->insn; | ||
310 | } | ||
311 | |||
312 | In v4.6 the exception table entry was expanded with a new field "handler". | ||
313 | This is also 32-bits wide and contains a third relative function | ||
314 | pointer which points to one of: | ||
315 | |||
316 | 1) int ex_handler_default(const struct exception_table_entry *fixup) | ||
317 | This is legacy case that just jumps to the fixup code | ||
318 | 2) int ex_handler_fault(const struct exception_table_entry *fixup) | ||
319 | This case provides the fault number of the trap that occurred at | ||
320 | entry->insn. It is used to distinguish page faults from machine | ||
321 | check. | ||
322 | 3) int ex_handler_ext(const struct exception_table_entry *fixup) | ||
323 | This case is used for uaccess_err ... we need to set a flag | ||
324 | in the task structure. Before the handler functions existed this | ||
325 | case was handled by adding a large offset to the fixup to tag | ||
326 | it as special. | ||
327 | More functions can easily be added. | ||
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 1 | 2 | PATCHLEVEL = 1 |
3 | SUBLEVEL = 35 | 3 | SUBLEVEL = 36 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Series 4800 | 5 | NAME = Series 4800 |
6 | 6 | ||
@@ -610,6 +610,8 @@ all: vmlinux | |||
610 | include arch/$(SRCARCH)/Makefile | 610 | include arch/$(SRCARCH)/Makefile |
611 | 611 | ||
612 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) | 612 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
613 | KBUILD_CFLAGS += $(call cc-option,-fno-PIE) | ||
614 | KBUILD_AFLAGS += $(call cc-option,-fno-PIE) | ||
613 | 615 | ||
614 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 616 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
615 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) | 617 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) |
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h index a9c80a2ea1a7..642934a5ae9b 100644 --- a/arch/arm/include/asm/kvm_emulate.h +++ b/arch/arm/include/asm/kvm_emulate.h | |||
@@ -131,6 +131,11 @@ static inline bool kvm_vcpu_dabt_iss1tw(struct kvm_vcpu *vcpu) | |||
131 | return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_S1PTW; | 131 | return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_S1PTW; |
132 | } | 132 | } |
133 | 133 | ||
134 | static inline bool kvm_vcpu_dabt_is_cm(struct kvm_vcpu *vcpu) | ||
135 | { | ||
136 | return !!(kvm_vcpu_get_hsr(vcpu) & HSR_DABT_CM); | ||
137 | } | ||
138 | |||
134 | /* Get Access Size from a data abort */ | 139 | /* Get Access Size from a data abort */ |
135 | static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu) | 140 | static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu) |
136 | { | 141 | { |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 334dbd0da47e..a7849b4d322a 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -1442,6 +1442,22 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | /* | 1444 | /* |
1445 | * Check for a cache maintenance operation. Since we | ||
1446 | * ended-up here, we know it is outside of any memory | ||
1447 | * slot. But we can't find out if that is for a device, | ||
1448 | * or if the guest is just being stupid. The only thing | ||
1449 | * we know for sure is that this range cannot be cached. | ||
1450 | * | ||
1451 | * So let's assume that the guest is just being | ||
1452 | * cautious, and skip the instruction. | ||
1453 | */ | ||
1454 | if (kvm_vcpu_dabt_is_cm(vcpu)) { | ||
1455 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | ||
1456 | ret = 1; | ||
1457 | goto out_unlock; | ||
1458 | } | ||
1459 | |||
1460 | /* | ||
1445 | * The IPA is reported as [MAX:12], so we need to | 1461 | * The IPA is reported as [MAX:12], so we need to |
1446 | * complement it with the bottom 12 bits from the | 1462 | * complement it with the bottom 12 bits from the |
1447 | * faulting VA. This is always 12 bits, irrespective | 1463 | * faulting VA. This is always 12 bits, irrespective |
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 3ca894ecf699..3e3c4c7a5082 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h | |||
@@ -153,11 +153,6 @@ static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu) | |||
153 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_ISV); | 153 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_ISV); |
154 | } | 154 | } |
155 | 155 | ||
156 | static inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu) | ||
157 | { | ||
158 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WNR); | ||
159 | } | ||
160 | |||
161 | static inline bool kvm_vcpu_dabt_issext(const struct kvm_vcpu *vcpu) | 156 | static inline bool kvm_vcpu_dabt_issext(const struct kvm_vcpu *vcpu) |
162 | { | 157 | { |
163 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SSE); | 158 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SSE); |
@@ -178,6 +173,17 @@ static inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu) | |||
178 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_S1PTW); | 173 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_S1PTW); |
179 | } | 174 | } |
180 | 175 | ||
176 | static inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu) | ||
177 | { | ||
178 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WNR) || | ||
179 | kvm_vcpu_dabt_iss1tw(vcpu); /* AF/DBM update */ | ||
180 | } | ||
181 | |||
182 | static inline bool kvm_vcpu_dabt_is_cm(const struct kvm_vcpu *vcpu) | ||
183 | { | ||
184 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_CM); | ||
185 | } | ||
186 | |||
181 | static inline int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu) | 187 | static inline int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu) |
182 | { | 188 | { |
183 | return 1 << ((kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT); | 189 | return 1 << ((kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT); |
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 0a456bef8c79..8a336852eeba 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h | |||
@@ -44,48 +44,44 @@ static inline unsigned long __percpu_##op(void *ptr, \ | |||
44 | \ | 44 | \ |
45 | switch (size) { \ | 45 | switch (size) { \ |
46 | case 1: \ | 46 | case 1: \ |
47 | do { \ | 47 | asm ("//__per_cpu_" #op "_1\n" \ |
48 | asm ("//__per_cpu_" #op "_1\n" \ | 48 | "1: ldxrb %w[ret], %[ptr]\n" \ |
49 | "ldxrb %w[ret], %[ptr]\n" \ | ||
50 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ | 49 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ |
51 | "stxrb %w[loop], %w[ret], %[ptr]\n" \ | 50 | " stxrb %w[loop], %w[ret], %[ptr]\n" \ |
52 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ | 51 | " cbnz %w[loop], 1b" \ |
53 | [ptr] "+Q"(*(u8 *)ptr) \ | 52 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ |
54 | : [val] "Ir" (val)); \ | 53 | [ptr] "+Q"(*(u8 *)ptr) \ |
55 | } while (loop); \ | 54 | : [val] "Ir" (val)); \ |
56 | break; \ | 55 | break; \ |
57 | case 2: \ | 56 | case 2: \ |
58 | do { \ | 57 | asm ("//__per_cpu_" #op "_2\n" \ |
59 | asm ("//__per_cpu_" #op "_2\n" \ | 58 | "1: ldxrh %w[ret], %[ptr]\n" \ |
60 | "ldxrh %w[ret], %[ptr]\n" \ | ||
61 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ | 59 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ |
62 | "stxrh %w[loop], %w[ret], %[ptr]\n" \ | 60 | " stxrh %w[loop], %w[ret], %[ptr]\n" \ |
63 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ | 61 | " cbnz %w[loop], 1b" \ |
64 | [ptr] "+Q"(*(u16 *)ptr) \ | 62 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ |
65 | : [val] "Ir" (val)); \ | 63 | [ptr] "+Q"(*(u16 *)ptr) \ |
66 | } while (loop); \ | 64 | : [val] "Ir" (val)); \ |
67 | break; \ | 65 | break; \ |
68 | case 4: \ | 66 | case 4: \ |
69 | do { \ | 67 | asm ("//__per_cpu_" #op "_4\n" \ |
70 | asm ("//__per_cpu_" #op "_4\n" \ | 68 | "1: ldxr %w[ret], %[ptr]\n" \ |
71 | "ldxr %w[ret], %[ptr]\n" \ | ||
72 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ | 69 | #asm_op " %w[ret], %w[ret], %w[val]\n" \ |
73 | "stxr %w[loop], %w[ret], %[ptr]\n" \ | 70 | " stxr %w[loop], %w[ret], %[ptr]\n" \ |
74 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ | 71 | " cbnz %w[loop], 1b" \ |
75 | [ptr] "+Q"(*(u32 *)ptr) \ | 72 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ |
76 | : [val] "Ir" (val)); \ | 73 | [ptr] "+Q"(*(u32 *)ptr) \ |
77 | } while (loop); \ | 74 | : [val] "Ir" (val)); \ |
78 | break; \ | 75 | break; \ |
79 | case 8: \ | 76 | case 8: \ |
80 | do { \ | 77 | asm ("//__per_cpu_" #op "_8\n" \ |
81 | asm ("//__per_cpu_" #op "_8\n" \ | 78 | "1: ldxr %[ret], %[ptr]\n" \ |
82 | "ldxr %[ret], %[ptr]\n" \ | ||
83 | #asm_op " %[ret], %[ret], %[val]\n" \ | 79 | #asm_op " %[ret], %[ret], %[val]\n" \ |
84 | "stxr %w[loop], %[ret], %[ptr]\n" \ | 80 | " stxr %w[loop], %[ret], %[ptr]\n" \ |
85 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ | 81 | " cbnz %w[loop], 1b" \ |
86 | [ptr] "+Q"(*(u64 *)ptr) \ | 82 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ |
87 | : [val] "Ir" (val)); \ | 83 | [ptr] "+Q"(*(u64 *)ptr) \ |
88 | } while (loop); \ | 84 | : [val] "Ir" (val)); \ |
89 | break; \ | 85 | break; \ |
90 | default: \ | 86 | default: \ |
91 | BUILD_BUG(); \ | 87 | BUILD_BUG(); \ |
@@ -150,44 +146,40 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, | |||
150 | 146 | ||
151 | switch (size) { | 147 | switch (size) { |
152 | case 1: | 148 | case 1: |
153 | do { | 149 | asm ("//__percpu_xchg_1\n" |
154 | asm ("//__percpu_xchg_1\n" | 150 | "1: ldxrb %w[ret], %[ptr]\n" |
155 | "ldxrb %w[ret], %[ptr]\n" | 151 | " stxrb %w[loop], %w[val], %[ptr]\n" |
156 | "stxrb %w[loop], %w[val], %[ptr]\n" | 152 | " cbnz %w[loop], 1b" |
157 | : [loop] "=&r"(loop), [ret] "=&r"(ret), | 153 | : [loop] "=&r"(loop), [ret] "=&r"(ret), |
158 | [ptr] "+Q"(*(u8 *)ptr) | 154 | [ptr] "+Q"(*(u8 *)ptr) |
159 | : [val] "r" (val)); | 155 | : [val] "r" (val)); |
160 | } while (loop); | ||
161 | break; | 156 | break; |
162 | case 2: | 157 | case 2: |
163 | do { | 158 | asm ("//__percpu_xchg_2\n" |
164 | asm ("//__percpu_xchg_2\n" | 159 | "1: ldxrh %w[ret], %[ptr]\n" |
165 | "ldxrh %w[ret], %[ptr]\n" | 160 | " stxrh %w[loop], %w[val], %[ptr]\n" |
166 | "stxrh %w[loop], %w[val], %[ptr]\n" | 161 | " cbnz %w[loop], 1b" |
167 | : [loop] "=&r"(loop), [ret] "=&r"(ret), | 162 | : [loop] "=&r"(loop), [ret] "=&r"(ret), |
168 | [ptr] "+Q"(*(u16 *)ptr) | 163 | [ptr] "+Q"(*(u16 *)ptr) |
169 | : [val] "r" (val)); | 164 | : [val] "r" (val)); |
170 | } while (loop); | ||
171 | break; | 165 | break; |
172 | case 4: | 166 | case 4: |
173 | do { | 167 | asm ("//__percpu_xchg_4\n" |
174 | asm ("//__percpu_xchg_4\n" | 168 | "1: ldxr %w[ret], %[ptr]\n" |
175 | "ldxr %w[ret], %[ptr]\n" | 169 | " stxr %w[loop], %w[val], %[ptr]\n" |
176 | "stxr %w[loop], %w[val], %[ptr]\n" | 170 | " cbnz %w[loop], 1b" |
177 | : [loop] "=&r"(loop), [ret] "=&r"(ret), | 171 | : [loop] "=&r"(loop), [ret] "=&r"(ret), |
178 | [ptr] "+Q"(*(u32 *)ptr) | 172 | [ptr] "+Q"(*(u32 *)ptr) |
179 | : [val] "r" (val)); | 173 | : [val] "r" (val)); |
180 | } while (loop); | ||
181 | break; | 174 | break; |
182 | case 8: | 175 | case 8: |
183 | do { | 176 | asm ("//__percpu_xchg_8\n" |
184 | asm ("//__percpu_xchg_8\n" | 177 | "1: ldxr %[ret], %[ptr]\n" |
185 | "ldxr %[ret], %[ptr]\n" | 178 | " stxr %w[loop], %[val], %[ptr]\n" |
186 | "stxr %w[loop], %[val], %[ptr]\n" | 179 | " cbnz %w[loop], 1b" |
187 | : [loop] "=&r"(loop), [ret] "=&r"(ret), | 180 | : [loop] "=&r"(loop), [ret] "=&r"(ret), |
188 | [ptr] "+Q"(*(u64 *)ptr) | 181 | [ptr] "+Q"(*(u64 *)ptr) |
189 | : [val] "r" (val)); | 182 | : [val] "r" (val)); |
190 | } while (loop); | ||
191 | break; | 183 | break; |
192 | default: | 184 | default: |
193 | BUILD_BUG(); | 185 | BUILD_BUG(); |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index f484684ff44a..d67697a60715 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -513,8 +513,9 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems | |||
513 | b.lt 4f // Skip if no PMU present | 513 | b.lt 4f // Skip if no PMU present |
514 | mrs x0, pmcr_el0 // Disable debug access traps | 514 | mrs x0, pmcr_el0 // Disable debug access traps |
515 | ubfx x0, x0, #11, #5 // to EL2 and allow access to | 515 | ubfx x0, x0, #11, #5 // to EL2 and allow access to |
516 | msr mdcr_el2, x0 // all PMU counters from EL1 | ||
517 | 4: | 516 | 4: |
517 | csel x0, xzr, x0, lt // all PMU counters from EL1 | ||
518 | msr mdcr_el2, x0 // (if they exist) | ||
518 | 519 | ||
519 | /* Stage-2 translation */ | 520 | /* Stage-2 translation */ |
520 | msr vttbr_el2, xzr | 521 | msr vttbr_el2, xzr |
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index ab518d14b7b0..2ab11c31d77c 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h | |||
@@ -398,7 +398,10 @@ struct kvm_vcpu_arch { | |||
398 | /* Host KSEG0 address of the EI/DI offset */ | 398 | /* Host KSEG0 address of the EI/DI offset */ |
399 | void *kseg0_commpage; | 399 | void *kseg0_commpage; |
400 | 400 | ||
401 | u32 io_gpr; /* GPR used as IO source/target */ | 401 | /* Resume PC after MMIO completion */ |
402 | unsigned long io_pc; | ||
403 | /* GPR used as IO source/target */ | ||
404 | u32 io_gpr; | ||
402 | 405 | ||
403 | struct hrtimer comparecount_timer; | 406 | struct hrtimer comparecount_timer; |
404 | /* Count timer control KVM register */ | 407 | /* Count timer control KVM register */ |
@@ -420,8 +423,6 @@ struct kvm_vcpu_arch { | |||
420 | /* Bitmask of pending exceptions to be cleared */ | 423 | /* Bitmask of pending exceptions to be cleared */ |
421 | unsigned long pending_exceptions_clr; | 424 | unsigned long pending_exceptions_clr; |
422 | 425 | ||
423 | unsigned long pending_load_cause; | ||
424 | |||
425 | /* Save/Restore the entryhi register when are are preempted/scheduled back in */ | 426 | /* Save/Restore the entryhi register when are are preempted/scheduled back in */ |
426 | unsigned long preempt_entryhi; | 427 | unsigned long preempt_entryhi; |
427 | 428 | ||
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index d6476d11212e..7f3183494e69 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c | |||
@@ -752,15 +752,15 @@ enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu) | |||
752 | struct mips_coproc *cop0 = vcpu->arch.cop0; | 752 | struct mips_coproc *cop0 = vcpu->arch.cop0; |
753 | enum emulation_result er = EMULATE_DONE; | 753 | enum emulation_result er = EMULATE_DONE; |
754 | 754 | ||
755 | if (kvm_read_c0_guest_status(cop0) & ST0_EXL) { | 755 | if (kvm_read_c0_guest_status(cop0) & ST0_ERL) { |
756 | kvm_clear_c0_guest_status(cop0, ST0_ERL); | ||
757 | vcpu->arch.pc = kvm_read_c0_guest_errorepc(cop0); | ||
758 | } else if (kvm_read_c0_guest_status(cop0) & ST0_EXL) { | ||
756 | kvm_debug("[%#lx] ERET to %#lx\n", vcpu->arch.pc, | 759 | kvm_debug("[%#lx] ERET to %#lx\n", vcpu->arch.pc, |
757 | kvm_read_c0_guest_epc(cop0)); | 760 | kvm_read_c0_guest_epc(cop0)); |
758 | kvm_clear_c0_guest_status(cop0, ST0_EXL); | 761 | kvm_clear_c0_guest_status(cop0, ST0_EXL); |
759 | vcpu->arch.pc = kvm_read_c0_guest_epc(cop0); | 762 | vcpu->arch.pc = kvm_read_c0_guest_epc(cop0); |
760 | 763 | ||
761 | } else if (kvm_read_c0_guest_status(cop0) & ST0_ERL) { | ||
762 | kvm_clear_c0_guest_status(cop0, ST0_ERL); | ||
763 | vcpu->arch.pc = kvm_read_c0_guest_errorepc(cop0); | ||
764 | } else { | 764 | } else { |
765 | kvm_err("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n", | 765 | kvm_err("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n", |
766 | vcpu->arch.pc); | 766 | vcpu->arch.pc); |
@@ -1430,6 +1430,7 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause, | |||
1430 | struct kvm_vcpu *vcpu) | 1430 | struct kvm_vcpu *vcpu) |
1431 | { | 1431 | { |
1432 | enum emulation_result er = EMULATE_DO_MMIO; | 1432 | enum emulation_result er = EMULATE_DO_MMIO; |
1433 | unsigned long curr_pc; | ||
1433 | int32_t op, base, rt, offset; | 1434 | int32_t op, base, rt, offset; |
1434 | uint32_t bytes; | 1435 | uint32_t bytes; |
1435 | 1436 | ||
@@ -1438,7 +1439,18 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause, | |||
1438 | offset = inst & 0xffff; | 1439 | offset = inst & 0xffff; |
1439 | op = (inst >> 26) & 0x3f; | 1440 | op = (inst >> 26) & 0x3f; |
1440 | 1441 | ||
1441 | vcpu->arch.pending_load_cause = cause; | 1442 | /* |
1443 | * Find the resume PC now while we have safe and easy access to the | ||
1444 | * prior branch instruction, and save it for | ||
1445 | * kvm_mips_complete_mmio_load() to restore later. | ||
1446 | */ | ||
1447 | curr_pc = vcpu->arch.pc; | ||
1448 | er = update_pc(vcpu, cause); | ||
1449 | if (er == EMULATE_FAIL) | ||
1450 | return er; | ||
1451 | vcpu->arch.io_pc = vcpu->arch.pc; | ||
1452 | vcpu->arch.pc = curr_pc; | ||
1453 | |||
1442 | vcpu->arch.io_gpr = rt; | 1454 | vcpu->arch.io_gpr = rt; |
1443 | 1455 | ||
1444 | switch (op) { | 1456 | switch (op) { |
@@ -2418,9 +2430,8 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, | |||
2418 | goto done; | 2430 | goto done; |
2419 | } | 2431 | } |
2420 | 2432 | ||
2421 | er = update_pc(vcpu, vcpu->arch.pending_load_cause); | 2433 | /* Restore saved resume PC */ |
2422 | if (er == EMULATE_FAIL) | 2434 | vcpu->arch.pc = vcpu->arch.io_pc; |
2423 | return er; | ||
2424 | 2435 | ||
2425 | switch (run->mmio.len) { | 2436 | switch (run->mmio.len) { |
2426 | case 4: | 2437 | case 4: |
@@ -2442,11 +2453,6 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, | |||
2442 | break; | 2453 | break; |
2443 | } | 2454 | } |
2444 | 2455 | ||
2445 | if (vcpu->arch.pending_load_cause & CAUSEF_BD) | ||
2446 | kvm_debug("[%#lx] Completing %d byte BD Load to gpr %d (0x%08lx) type %d\n", | ||
2447 | vcpu->arch.pc, run->mmio.len, vcpu->arch.io_gpr, *gpr, | ||
2448 | vcpu->mmio_needed); | ||
2449 | |||
2450 | done: | 2456 | done: |
2451 | return er; | 2457 | return er; |
2452 | } | 2458 | } |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index 099c23616901..8f13c7facdd7 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -106,8 +106,6 @@ linux_gateway_entry: | |||
106 | mtsp %r0,%sr4 /* get kernel space into sr4 */ | 106 | mtsp %r0,%sr4 /* get kernel space into sr4 */ |
107 | mtsp %r0,%sr5 /* get kernel space into sr5 */ | 107 | mtsp %r0,%sr5 /* get kernel space into sr5 */ |
108 | mtsp %r0,%sr6 /* get kernel space into sr6 */ | 108 | mtsp %r0,%sr6 /* get kernel space into sr6 */ |
109 | mfsp %sr7,%r1 /* save user sr7 */ | ||
110 | mtsp %r1,%sr3 /* and store it in sr3 */ | ||
111 | 109 | ||
112 | #ifdef CONFIG_64BIT | 110 | #ifdef CONFIG_64BIT |
113 | /* for now we can *always* set the W bit on entry to the syscall | 111 | /* for now we can *always* set the W bit on entry to the syscall |
@@ -133,6 +131,14 @@ linux_gateway_entry: | |||
133 | depdi 0, 31, 32, %r21 | 131 | depdi 0, 31, 32, %r21 |
134 | 1: | 132 | 1: |
135 | #endif | 133 | #endif |
134 | |||
135 | /* We use a rsm/ssm pair to prevent sr3 from being clobbered | ||
136 | * by external interrupts. | ||
137 | */ | ||
138 | mfsp %sr7,%r1 /* save user sr7 */ | ||
139 | rsm PSW_SM_I, %r0 /* disable interrupts */ | ||
140 | mtsp %r1,%sr3 /* and store it in sr3 */ | ||
141 | |||
136 | mfctl %cr30,%r1 | 142 | mfctl %cr30,%r1 |
137 | xor %r1,%r30,%r30 /* ye olde xor trick */ | 143 | xor %r1,%r30,%r30 /* ye olde xor trick */ |
138 | xor %r1,%r30,%r1 | 144 | xor %r1,%r30,%r1 |
@@ -147,6 +153,7 @@ linux_gateway_entry: | |||
147 | */ | 153 | */ |
148 | 154 | ||
149 | mtsp %r0,%sr7 /* get kernel space into sr7 */ | 155 | mtsp %r0,%sr7 /* get kernel space into sr7 */ |
156 | ssm PSW_SM_I, %r0 /* enable interrupts */ | ||
150 | STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */ | 157 | STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */ |
151 | mfctl %cr30,%r1 /* get task ptr in %r1 */ | 158 | mfctl %cr30,%r1 /* get task ptr in %r1 */ |
152 | LDREG TI_TASK(%r1),%r1 | 159 | LDREG TI_TASK(%r1),%r1 |
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 112ccf497562..73f638789a38 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -44,7 +44,7 @@ | |||
44 | std r0,0(r1); \ | 44 | std r0,0(r1); \ |
45 | ptesync; \ | 45 | ptesync; \ |
46 | ld r0,0(r1); \ | 46 | ld r0,0(r1); \ |
47 | 1: cmp cr0,r0,r0; \ | 47 | 1: cmpd cr0,r0,r0; \ |
48 | bne 1b; \ | 48 | bne 1b; \ |
49 | IDLE_INST; \ | 49 | IDLE_INST; \ |
50 | b . | 50 | b . |
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c index f031a47d7701..6fb1b3774b11 100644 --- a/arch/powerpc/mm/copro_fault.c +++ b/arch/powerpc/mm/copro_fault.c | |||
@@ -106,6 +106,8 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
106 | switch (REGION_ID(ea)) { | 106 | switch (REGION_ID(ea)) { |
107 | case USER_REGION_ID: | 107 | case USER_REGION_ID: |
108 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); | 108 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); |
109 | if (mm == NULL) | ||
110 | return 1; | ||
109 | psize = get_slice_psize(mm, ea); | 111 | psize = get_slice_psize(mm, ea); |
110 | ssize = user_segment_size(ea); | 112 | ssize = user_segment_size(ea); |
111 | vsid = get_vsid(mm->context.id, ea, ssize); | 113 | vsid = get_vsid(mm->context.id, ea, ssize); |
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 7730c1c5c83a..e2015452177d 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h | |||
@@ -44,19 +44,22 @@ | |||
44 | 44 | ||
45 | /* Exception table entry */ | 45 | /* Exception table entry */ |
46 | #ifdef __ASSEMBLY__ | 46 | #ifdef __ASSEMBLY__ |
47 | # define _ASM_EXTABLE(from,to) \ | 47 | # define _ASM_EXTABLE_HANDLE(from, to, handler) \ |
48 | .pushsection "__ex_table","a" ; \ | 48 | .pushsection "__ex_table","a" ; \ |
49 | .balign 8 ; \ | 49 | .balign 4 ; \ |
50 | .long (from) - . ; \ | 50 | .long (from) - . ; \ |
51 | .long (to) - . ; \ | 51 | .long (to) - . ; \ |
52 | .long (handler) - . ; \ | ||
52 | .popsection | 53 | .popsection |
53 | 54 | ||
54 | # define _ASM_EXTABLE_EX(from,to) \ | 55 | # define _ASM_EXTABLE(from, to) \ |
55 | .pushsection "__ex_table","a" ; \ | 56 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) |
56 | .balign 8 ; \ | 57 | |
57 | .long (from) - . ; \ | 58 | # define _ASM_EXTABLE_FAULT(from, to) \ |
58 | .long (to) - . + 0x7ffffff0 ; \ | 59 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) |
59 | .popsection | 60 | |
61 | # define _ASM_EXTABLE_EX(from, to) \ | ||
62 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) | ||
60 | 63 | ||
61 | # define _ASM_NOKPROBE(entry) \ | 64 | # define _ASM_NOKPROBE(entry) \ |
62 | .pushsection "_kprobe_blacklist","aw" ; \ | 65 | .pushsection "_kprobe_blacklist","aw" ; \ |
@@ -64,19 +67,24 @@ | |||
64 | _ASM_PTR (entry); \ | 67 | _ASM_PTR (entry); \ |
65 | .popsection | 68 | .popsection |
66 | #else | 69 | #else |
67 | # define _ASM_EXTABLE(from,to) \ | 70 | # define _EXPAND_EXTABLE_HANDLE(x) #x |
71 | # define _ASM_EXTABLE_HANDLE(from, to, handler) \ | ||
68 | " .pushsection \"__ex_table\",\"a\"\n" \ | 72 | " .pushsection \"__ex_table\",\"a\"\n" \ |
69 | " .balign 8\n" \ | 73 | " .balign 4\n" \ |
70 | " .long (" #from ") - .\n" \ | 74 | " .long (" #from ") - .\n" \ |
71 | " .long (" #to ") - .\n" \ | 75 | " .long (" #to ") - .\n" \ |
76 | " .long (" _EXPAND_EXTABLE_HANDLE(handler) ") - .\n" \ | ||
72 | " .popsection\n" | 77 | " .popsection\n" |
73 | 78 | ||
74 | # define _ASM_EXTABLE_EX(from,to) \ | 79 | # define _ASM_EXTABLE(from, to) \ |
75 | " .pushsection \"__ex_table\",\"a\"\n" \ | 80 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) |
76 | " .balign 8\n" \ | 81 | |
77 | " .long (" #from ") - .\n" \ | 82 | # define _ASM_EXTABLE_FAULT(from, to) \ |
78 | " .long (" #to ") - . + 0x7ffffff0\n" \ | 83 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) |
79 | " .popsection\n" | 84 | |
85 | # define _ASM_EXTABLE_EX(from, to) \ | ||
86 | _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) | ||
87 | |||
80 | /* For C file, we already have NOKPROBE_SYMBOL macro */ | 88 | /* For C file, we already have NOKPROBE_SYMBOL macro */ |
81 | #endif | 89 | #endif |
82 | 90 | ||
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index d081e7e42fb3..81782dc54193 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -89,12 +89,11 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un | |||
89 | likely(!__range_not_ok(addr, size, user_addr_max())) | 89 | likely(!__range_not_ok(addr, size, user_addr_max())) |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * The exception table consists of pairs of addresses relative to the | 92 | * The exception table consists of triples of addresses relative to the |
93 | * exception table enty itself: the first is the address of an | 93 | * exception table entry itself. The first address is of an instruction |
94 | * instruction that is allowed to fault, and the second is the address | 94 | * that is allowed to fault, the second is the target at which the program |
95 | * at which the program should continue. No registers are modified, | 95 | * should continue. The third is a handler function to deal with the fault |
96 | * so it is entirely up to the continuation code to figure out what to | 96 | * caused by the instruction in the first field. |
97 | * do. | ||
98 | * | 97 | * |
99 | * All the routines below use bits of fixup code that are out of line | 98 | * All the routines below use bits of fixup code that are out of line |
100 | * with the main instruction path. This means when everything is well, | 99 | * with the main instruction path. This means when everything is well, |
@@ -103,13 +102,14 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un | |||
103 | */ | 102 | */ |
104 | 103 | ||
105 | struct exception_table_entry { | 104 | struct exception_table_entry { |
106 | int insn, fixup; | 105 | int insn, fixup, handler; |
107 | }; | 106 | }; |
108 | /* This is not the generic standard exception_table_entry format */ | 107 | /* This is not the generic standard exception_table_entry format */ |
109 | #define ARCH_HAS_SORT_EXTABLE | 108 | #define ARCH_HAS_SORT_EXTABLE |
110 | #define ARCH_HAS_SEARCH_EXTABLE | 109 | #define ARCH_HAS_SEARCH_EXTABLE |
111 | 110 | ||
112 | extern int fixup_exception(struct pt_regs *regs); | 111 | extern int fixup_exception(struct pt_regs *regs, int trapnr); |
112 | extern bool ex_has_fault_handler(unsigned long ip); | ||
113 | extern int early_fixup_exception(unsigned long *ip); | 113 | extern int early_fixup_exception(unsigned long *ip); |
114 | 114 | ||
115 | /* | 115 | /* |
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 023c442c33bb..e1d1f6cbaf11 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -1000,7 +1000,7 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
1000 | * In case the user-specified fault handler returned | 1000 | * In case the user-specified fault handler returned |
1001 | * zero, try to fix up. | 1001 | * zero, try to fix up. |
1002 | */ | 1002 | */ |
1003 | if (fixup_exception(regs)) | 1003 | if (fixup_exception(regs, trapnr)) |
1004 | return 1; | 1004 | return 1; |
1005 | 1005 | ||
1006 | /* | 1006 | /* |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 324ab5247687..020248f2cec4 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -208,7 +208,7 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | if (!user_mode(regs)) { | 210 | if (!user_mode(regs)) { |
211 | if (!fixup_exception(regs)) { | 211 | if (!fixup_exception(regs, trapnr)) { |
212 | tsk->thread.error_code = error_code; | 212 | tsk->thread.error_code = error_code; |
213 | tsk->thread.trap_nr = trapnr; | 213 | tsk->thread.trap_nr = trapnr; |
214 | die(str, regs, error_code); | 214 | die(str, regs, error_code); |
@@ -469,7 +469,7 @@ do_general_protection(struct pt_regs *regs, long error_code) | |||
469 | 469 | ||
470 | tsk = current; | 470 | tsk = current; |
471 | if (!user_mode(regs)) { | 471 | if (!user_mode(regs)) { |
472 | if (fixup_exception(regs)) | 472 | if (fixup_exception(regs, X86_TRAP_GP)) |
473 | goto exit; | 473 | goto exit; |
474 | 474 | ||
475 | tsk->thread.error_code = error_code; | 475 | tsk->thread.error_code = error_code; |
@@ -720,7 +720,7 @@ static void math_error(struct pt_regs *regs, int error_code, int trapnr) | |||
720 | 720 | ||
721 | if (!user_mode(regs)) | 721 | if (!user_mode(regs)) |
722 | { | 722 | { |
723 | if (!fixup_exception(regs)) { | 723 | if (!fixup_exception(regs, trapnr)) { |
724 | task->thread.error_code = error_code; | 724 | task->thread.error_code = error_code; |
725 | task->thread.trap_nr = trapnr; | 725 | task->thread.trap_nr = trapnr; |
726 | die(str, regs, error_code); | 726 | die(str, regs, error_code); |
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c index 28146f03c514..74c3285dfdcf 100644 --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c | |||
@@ -596,7 +596,7 @@ static void kvm_ioapic_reset(struct kvm_ioapic *ioapic) | |||
596 | ioapic->irr = 0; | 596 | ioapic->irr = 0; |
597 | ioapic->irr_delivered = 0; | 597 | ioapic->irr_delivered = 0; |
598 | ioapic->id = 0; | 598 | ioapic->id = 0; |
599 | memset(ioapic->irq_eoi, 0x00, IOAPIC_NUM_PINS); | 599 | memset(ioapic->irq_eoi, 0x00, sizeof(ioapic->irq_eoi)); |
600 | rtc_irq_eoi_tracking_reset(ioapic); | 600 | rtc_irq_eoi_tracking_reset(ioapic); |
601 | update_handled_vectors(ioapic); | 601 | update_handled_vectors(ioapic); |
602 | } | 602 | } |
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 903ec1e9c326..9dd7e4b7fcde 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c | |||
@@ -3,6 +3,9 @@ | |||
3 | #include <linux/sort.h> | 3 | #include <linux/sort.h> |
4 | #include <asm/uaccess.h> | 4 | #include <asm/uaccess.h> |
5 | 5 | ||
6 | typedef bool (*ex_handler_t)(const struct exception_table_entry *, | ||
7 | struct pt_regs *, int); | ||
8 | |||
6 | static inline unsigned long | 9 | static inline unsigned long |
7 | ex_insn_addr(const struct exception_table_entry *x) | 10 | ex_insn_addr(const struct exception_table_entry *x) |
8 | { | 11 | { |
@@ -13,11 +16,56 @@ ex_fixup_addr(const struct exception_table_entry *x) | |||
13 | { | 16 | { |
14 | return (unsigned long)&x->fixup + x->fixup; | 17 | return (unsigned long)&x->fixup + x->fixup; |
15 | } | 18 | } |
19 | static inline ex_handler_t | ||
20 | ex_fixup_handler(const struct exception_table_entry *x) | ||
21 | { | ||
22 | return (ex_handler_t)((unsigned long)&x->handler + x->handler); | ||
23 | } | ||
16 | 24 | ||
17 | int fixup_exception(struct pt_regs *regs) | 25 | bool ex_handler_default(const struct exception_table_entry *fixup, |
26 | struct pt_regs *regs, int trapnr) | ||
18 | { | 27 | { |
19 | const struct exception_table_entry *fixup; | 28 | regs->ip = ex_fixup_addr(fixup); |
20 | unsigned long new_ip; | 29 | return true; |
30 | } | ||
31 | EXPORT_SYMBOL(ex_handler_default); | ||
32 | |||
33 | bool ex_handler_fault(const struct exception_table_entry *fixup, | ||
34 | struct pt_regs *regs, int trapnr) | ||
35 | { | ||
36 | regs->ip = ex_fixup_addr(fixup); | ||
37 | regs->ax = trapnr; | ||
38 | return true; | ||
39 | } | ||
40 | EXPORT_SYMBOL_GPL(ex_handler_fault); | ||
41 | |||
42 | bool ex_handler_ext(const struct exception_table_entry *fixup, | ||
43 | struct pt_regs *regs, int trapnr) | ||
44 | { | ||
45 | /* Special hack for uaccess_err */ | ||
46 | current_thread_info()->uaccess_err = 1; | ||
47 | regs->ip = ex_fixup_addr(fixup); | ||
48 | return true; | ||
49 | } | ||
50 | EXPORT_SYMBOL(ex_handler_ext); | ||
51 | |||
52 | bool ex_has_fault_handler(unsigned long ip) | ||
53 | { | ||
54 | const struct exception_table_entry *e; | ||
55 | ex_handler_t handler; | ||
56 | |||
57 | e = search_exception_tables(ip); | ||
58 | if (!e) | ||
59 | return false; | ||
60 | handler = ex_fixup_handler(e); | ||
61 | |||
62 | return handler == ex_handler_fault; | ||
63 | } | ||
64 | |||
65 | int fixup_exception(struct pt_regs *regs, int trapnr) | ||
66 | { | ||
67 | const struct exception_table_entry *e; | ||
68 | ex_handler_t handler; | ||
21 | 69 | ||
22 | #ifdef CONFIG_PNPBIOS | 70 | #ifdef CONFIG_PNPBIOS |
23 | if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) { | 71 | if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) { |
@@ -33,42 +81,34 @@ int fixup_exception(struct pt_regs *regs) | |||
33 | } | 81 | } |
34 | #endif | 82 | #endif |
35 | 83 | ||
36 | fixup = search_exception_tables(regs->ip); | 84 | e = search_exception_tables(regs->ip); |
37 | if (fixup) { | 85 | if (!e) |
38 | new_ip = ex_fixup_addr(fixup); | 86 | return 0; |
39 | |||
40 | if (fixup->fixup - fixup->insn >= 0x7ffffff0 - 4) { | ||
41 | /* Special hack for uaccess_err */ | ||
42 | current_thread_info()->uaccess_err = 1; | ||
43 | new_ip -= 0x7ffffff0; | ||
44 | } | ||
45 | regs->ip = new_ip; | ||
46 | return 1; | ||
47 | } | ||
48 | 87 | ||
49 | return 0; | 88 | handler = ex_fixup_handler(e); |
89 | return handler(e, regs, trapnr); | ||
50 | } | 90 | } |
51 | 91 | ||
52 | /* Restricted version used during very early boot */ | 92 | /* Restricted version used during very early boot */ |
53 | int __init early_fixup_exception(unsigned long *ip) | 93 | int __init early_fixup_exception(unsigned long *ip) |
54 | { | 94 | { |
55 | const struct exception_table_entry *fixup; | 95 | const struct exception_table_entry *e; |
56 | unsigned long new_ip; | 96 | unsigned long new_ip; |
97 | ex_handler_t handler; | ||
57 | 98 | ||
58 | fixup = search_exception_tables(*ip); | 99 | e = search_exception_tables(*ip); |
59 | if (fixup) { | 100 | if (!e) |
60 | new_ip = ex_fixup_addr(fixup); | 101 | return 0; |
61 | 102 | ||
62 | if (fixup->fixup - fixup->insn >= 0x7ffffff0 - 4) { | 103 | new_ip = ex_fixup_addr(e); |
63 | /* uaccess handling not supported during early boot */ | 104 | handler = ex_fixup_handler(e); |
64 | return 0; | ||
65 | } | ||
66 | 105 | ||
67 | *ip = new_ip; | 106 | /* special handling not supported during early boot */ |
68 | return 1; | 107 | if (handler != ex_handler_default) |
69 | } | 108 | return 0; |
70 | 109 | ||
71 | return 0; | 110 | *ip = new_ip; |
111 | return 1; | ||
72 | } | 112 | } |
73 | 113 | ||
74 | /* | 114 | /* |
@@ -133,6 +173,8 @@ void sort_extable(struct exception_table_entry *start, | |||
133 | i += 4; | 173 | i += 4; |
134 | p->fixup += i; | 174 | p->fixup += i; |
135 | i += 4; | 175 | i += 4; |
176 | p->handler += i; | ||
177 | i += 4; | ||
136 | } | 178 | } |
137 | 179 | ||
138 | sort(start, finish - start, sizeof(struct exception_table_entry), | 180 | sort(start, finish - start, sizeof(struct exception_table_entry), |
@@ -145,6 +187,8 @@ void sort_extable(struct exception_table_entry *start, | |||
145 | i += 4; | 187 | i += 4; |
146 | p->fixup -= i; | 188 | p->fixup -= i; |
147 | i += 4; | 189 | i += 4; |
190 | p->handler -= i; | ||
191 | i += 4; | ||
148 | } | 192 | } |
149 | } | 193 | } |
150 | 194 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 62855ac37ab7..27bc31f0da52 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -659,7 +659,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, | |||
659 | int sig; | 659 | int sig; |
660 | 660 | ||
661 | /* Are we prepared to handle this kernel fault? */ | 661 | /* Are we prepared to handle this kernel fault? */ |
662 | if (fixup_exception(regs)) { | 662 | if (fixup_exception(regs, X86_TRAP_PF)) { |
663 | /* | 663 | /* |
664 | * Any interrupt that takes a fault gets the fixup. This makes | 664 | * Any interrupt that takes a fault gets the fixup. This makes |
665 | * the below recursive fault logic only apply to a faults from | 665 | * the below recursive fault logic only apply to a faults from |
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index f1a26d937d98..6f086415727c 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
@@ -1003,7 +1003,7 @@ static int binder_dec_node(struct binder_node *node, int strong, int internal) | |||
1003 | 1003 | ||
1004 | 1004 | ||
1005 | static struct binder_ref *binder_get_ref(struct binder_proc *proc, | 1005 | static struct binder_ref *binder_get_ref(struct binder_proc *proc, |
1006 | uint32_t desc) | 1006 | u32 desc, bool need_strong_ref) |
1007 | { | 1007 | { |
1008 | struct rb_node *n = proc->refs_by_desc.rb_node; | 1008 | struct rb_node *n = proc->refs_by_desc.rb_node; |
1009 | struct binder_ref *ref; | 1009 | struct binder_ref *ref; |
@@ -1011,12 +1011,16 @@ static struct binder_ref *binder_get_ref(struct binder_proc *proc, | |||
1011 | while (n) { | 1011 | while (n) { |
1012 | ref = rb_entry(n, struct binder_ref, rb_node_desc); | 1012 | ref = rb_entry(n, struct binder_ref, rb_node_desc); |
1013 | 1013 | ||
1014 | if (desc < ref->desc) | 1014 | if (desc < ref->desc) { |
1015 | n = n->rb_left; | 1015 | n = n->rb_left; |
1016 | else if (desc > ref->desc) | 1016 | } else if (desc > ref->desc) { |
1017 | n = n->rb_right; | 1017 | n = n->rb_right; |
1018 | else | 1018 | } else if (need_strong_ref && !ref->strong) { |
1019 | binder_user_error("tried to use weak ref as strong ref\n"); | ||
1020 | return NULL; | ||
1021 | } else { | ||
1019 | return ref; | 1022 | return ref; |
1023 | } | ||
1020 | } | 1024 | } |
1021 | return NULL; | 1025 | return NULL; |
1022 | } | 1026 | } |
@@ -1286,7 +1290,10 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, | |||
1286 | } break; | 1290 | } break; |
1287 | case BINDER_TYPE_HANDLE: | 1291 | case BINDER_TYPE_HANDLE: |
1288 | case BINDER_TYPE_WEAK_HANDLE: { | 1292 | case BINDER_TYPE_WEAK_HANDLE: { |
1289 | struct binder_ref *ref = binder_get_ref(proc, fp->handle); | 1293 | struct binder_ref *ref; |
1294 | |||
1295 | ref = binder_get_ref(proc, fp->handle, | ||
1296 | fp->type == BINDER_TYPE_HANDLE); | ||
1290 | 1297 | ||
1291 | if (ref == NULL) { | 1298 | if (ref == NULL) { |
1292 | pr_err("transaction release %d bad handle %d\n", | 1299 | pr_err("transaction release %d bad handle %d\n", |
@@ -1380,7 +1387,7 @@ static void binder_transaction(struct binder_proc *proc, | |||
1380 | if (tr->target.handle) { | 1387 | if (tr->target.handle) { |
1381 | struct binder_ref *ref; | 1388 | struct binder_ref *ref; |
1382 | 1389 | ||
1383 | ref = binder_get_ref(proc, tr->target.handle); | 1390 | ref = binder_get_ref(proc, tr->target.handle, true); |
1384 | if (ref == NULL) { | 1391 | if (ref == NULL) { |
1385 | binder_user_error("%d:%d got transaction to invalid handle\n", | 1392 | binder_user_error("%d:%d got transaction to invalid handle\n", |
1386 | proc->pid, thread->pid); | 1393 | proc->pid, thread->pid); |
@@ -1571,7 +1578,9 @@ static void binder_transaction(struct binder_proc *proc, | |||
1571 | fp->type = BINDER_TYPE_HANDLE; | 1578 | fp->type = BINDER_TYPE_HANDLE; |
1572 | else | 1579 | else |
1573 | fp->type = BINDER_TYPE_WEAK_HANDLE; | 1580 | fp->type = BINDER_TYPE_WEAK_HANDLE; |
1581 | fp->binder = 0; | ||
1574 | fp->handle = ref->desc; | 1582 | fp->handle = ref->desc; |
1583 | fp->cookie = 0; | ||
1575 | binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE, | 1584 | binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE, |
1576 | &thread->todo); | 1585 | &thread->todo); |
1577 | 1586 | ||
@@ -1583,7 +1592,10 @@ static void binder_transaction(struct binder_proc *proc, | |||
1583 | } break; | 1592 | } break; |
1584 | case BINDER_TYPE_HANDLE: | 1593 | case BINDER_TYPE_HANDLE: |
1585 | case BINDER_TYPE_WEAK_HANDLE: { | 1594 | case BINDER_TYPE_WEAK_HANDLE: { |
1586 | struct binder_ref *ref = binder_get_ref(proc, fp->handle); | 1595 | struct binder_ref *ref; |
1596 | |||
1597 | ref = binder_get_ref(proc, fp->handle, | ||
1598 | fp->type == BINDER_TYPE_HANDLE); | ||
1587 | 1599 | ||
1588 | if (ref == NULL) { | 1600 | if (ref == NULL) { |
1589 | binder_user_error("%d:%d got transaction with invalid handle, %d\n", | 1601 | binder_user_error("%d:%d got transaction with invalid handle, %d\n", |
@@ -1618,7 +1630,9 @@ static void binder_transaction(struct binder_proc *proc, | |||
1618 | return_error = BR_FAILED_REPLY; | 1630 | return_error = BR_FAILED_REPLY; |
1619 | goto err_binder_get_ref_for_node_failed; | 1631 | goto err_binder_get_ref_for_node_failed; |
1620 | } | 1632 | } |
1633 | fp->binder = 0; | ||
1621 | fp->handle = new_ref->desc; | 1634 | fp->handle = new_ref->desc; |
1635 | fp->cookie = 0; | ||
1622 | binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL); | 1636 | binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL); |
1623 | trace_binder_transaction_ref_to_ref(t, ref, | 1637 | trace_binder_transaction_ref_to_ref(t, ref, |
1624 | new_ref); | 1638 | new_ref); |
@@ -1672,6 +1686,7 @@ static void binder_transaction(struct binder_proc *proc, | |||
1672 | binder_debug(BINDER_DEBUG_TRANSACTION, | 1686 | binder_debug(BINDER_DEBUG_TRANSACTION, |
1673 | " fd %d -> %d\n", fp->handle, target_fd); | 1687 | " fd %d -> %d\n", fp->handle, target_fd); |
1674 | /* TODO: fput? */ | 1688 | /* TODO: fput? */ |
1689 | fp->binder = 0; | ||
1675 | fp->handle = target_fd; | 1690 | fp->handle = target_fd; |
1676 | } break; | 1691 | } break; |
1677 | 1692 | ||
@@ -1794,7 +1809,9 @@ static int binder_thread_write(struct binder_proc *proc, | |||
1794 | ref->desc); | 1809 | ref->desc); |
1795 | } | 1810 | } |
1796 | } else | 1811 | } else |
1797 | ref = binder_get_ref(proc, target); | 1812 | ref = binder_get_ref(proc, target, |
1813 | cmd == BC_ACQUIRE || | ||
1814 | cmd == BC_RELEASE); | ||
1798 | if (ref == NULL) { | 1815 | if (ref == NULL) { |
1799 | binder_user_error("%d:%d refcount change on invalid ref %d\n", | 1816 | binder_user_error("%d:%d refcount change on invalid ref %d\n", |
1800 | proc->pid, thread->pid, target); | 1817 | proc->pid, thread->pid, target); |
@@ -1990,7 +2007,7 @@ static int binder_thread_write(struct binder_proc *proc, | |||
1990 | if (get_user(cookie, (binder_uintptr_t __user *)ptr)) | 2007 | if (get_user(cookie, (binder_uintptr_t __user *)ptr)) |
1991 | return -EFAULT; | 2008 | return -EFAULT; |
1992 | ptr += sizeof(binder_uintptr_t); | 2009 | ptr += sizeof(binder_uintptr_t); |
1993 | ref = binder_get_ref(proc, target); | 2010 | ref = binder_get_ref(proc, target, false); |
1994 | if (ref == NULL) { | 2011 | if (ref == NULL) { |
1995 | binder_user_error("%d:%d %s invalid ref %d\n", | 2012 | binder_user_error("%d:%d %s invalid ref %d\n", |
1996 | proc->pid, thread->pid, | 2013 | proc->pid, thread->pid, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 50754d203310..8cc67132d55d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1533,19 +1533,29 @@ static void remove_port_data(struct port *port) | |||
1533 | spin_lock_irq(&port->inbuf_lock); | 1533 | spin_lock_irq(&port->inbuf_lock); |
1534 | /* Remove unused data this port might have received. */ | 1534 | /* Remove unused data this port might have received. */ |
1535 | discard_port_data(port); | 1535 | discard_port_data(port); |
1536 | spin_unlock_irq(&port->inbuf_lock); | ||
1536 | 1537 | ||
1537 | /* Remove buffers we queued up for the Host to send us data in. */ | 1538 | /* Remove buffers we queued up for the Host to send us data in. */ |
1538 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) | 1539 | do { |
1539 | free_buf(buf, true); | 1540 | spin_lock_irq(&port->inbuf_lock); |
1540 | spin_unlock_irq(&port->inbuf_lock); | 1541 | buf = virtqueue_detach_unused_buf(port->in_vq); |
1542 | spin_unlock_irq(&port->inbuf_lock); | ||
1543 | if (buf) | ||
1544 | free_buf(buf, true); | ||
1545 | } while (buf); | ||
1541 | 1546 | ||
1542 | spin_lock_irq(&port->outvq_lock); | 1547 | spin_lock_irq(&port->outvq_lock); |
1543 | reclaim_consumed_buffers(port); | 1548 | reclaim_consumed_buffers(port); |
1549 | spin_unlock_irq(&port->outvq_lock); | ||
1544 | 1550 | ||
1545 | /* Free pending buffers from the out-queue. */ | 1551 | /* Free pending buffers from the out-queue. */ |
1546 | while ((buf = virtqueue_detach_unused_buf(port->out_vq))) | 1552 | do { |
1547 | free_buf(buf, true); | 1553 | spin_lock_irq(&port->outvq_lock); |
1548 | spin_unlock_irq(&port->outvq_lock); | 1554 | buf = virtqueue_detach_unused_buf(port->out_vq); |
1555 | spin_unlock_irq(&port->outvq_lock); | ||
1556 | if (buf) | ||
1557 | free_buf(buf, true); | ||
1558 | } while (buf); | ||
1549 | } | 1559 | } |
1550 | 1560 | ||
1551 | /* | 1561 | /* |
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index f4ea80d602f7..b9d2f76a0cf7 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -73,13 +73,13 @@ struct rfc2734_header { | |||
73 | 73 | ||
74 | #define fwnet_get_hdr_lf(h) (((h)->w0 & 0xc0000000) >> 30) | 74 | #define fwnet_get_hdr_lf(h) (((h)->w0 & 0xc0000000) >> 30) |
75 | #define fwnet_get_hdr_ether_type(h) (((h)->w0 & 0x0000ffff)) | 75 | #define fwnet_get_hdr_ether_type(h) (((h)->w0 & 0x0000ffff)) |
76 | #define fwnet_get_hdr_dg_size(h) (((h)->w0 & 0x0fff0000) >> 16) | 76 | #define fwnet_get_hdr_dg_size(h) ((((h)->w0 & 0x0fff0000) >> 16) + 1) |
77 | #define fwnet_get_hdr_fg_off(h) (((h)->w0 & 0x00000fff)) | 77 | #define fwnet_get_hdr_fg_off(h) (((h)->w0 & 0x00000fff)) |
78 | #define fwnet_get_hdr_dgl(h) (((h)->w1 & 0xffff0000) >> 16) | 78 | #define fwnet_get_hdr_dgl(h) (((h)->w1 & 0xffff0000) >> 16) |
79 | 79 | ||
80 | #define fwnet_set_hdr_lf(lf) ((lf) << 30) | 80 | #define fwnet_set_hdr_lf(lf) ((lf) << 30) |
81 | #define fwnet_set_hdr_ether_type(et) (et) | 81 | #define fwnet_set_hdr_ether_type(et) (et) |
82 | #define fwnet_set_hdr_dg_size(dgs) ((dgs) << 16) | 82 | #define fwnet_set_hdr_dg_size(dgs) (((dgs) - 1) << 16) |
83 | #define fwnet_set_hdr_fg_off(fgo) (fgo) | 83 | #define fwnet_set_hdr_fg_off(fgo) (fgo) |
84 | 84 | ||
85 | #define fwnet_set_hdr_dgl(dgl) ((dgl) << 16) | 85 | #define fwnet_set_hdr_dgl(dgl) ((dgl) << 16) |
@@ -578,6 +578,9 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, | |||
578 | int retval; | 578 | int retval; |
579 | u16 ether_type; | 579 | u16 ether_type; |
580 | 580 | ||
581 | if (len <= RFC2374_UNFRAG_HDR_SIZE) | ||
582 | return 0; | ||
583 | |||
581 | hdr.w0 = be32_to_cpu(buf[0]); | 584 | hdr.w0 = be32_to_cpu(buf[0]); |
582 | lf = fwnet_get_hdr_lf(&hdr); | 585 | lf = fwnet_get_hdr_lf(&hdr); |
583 | if (lf == RFC2374_HDR_UNFRAG) { | 586 | if (lf == RFC2374_HDR_UNFRAG) { |
@@ -602,7 +605,12 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, | |||
602 | return fwnet_finish_incoming_packet(net, skb, source_node_id, | 605 | return fwnet_finish_incoming_packet(net, skb, source_node_id, |
603 | is_broadcast, ether_type); | 606 | is_broadcast, ether_type); |
604 | } | 607 | } |
608 | |||
605 | /* A datagram fragment has been received, now the fun begins. */ | 609 | /* A datagram fragment has been received, now the fun begins. */ |
610 | |||
611 | if (len <= RFC2374_FRAG_HDR_SIZE) | ||
612 | return 0; | ||
613 | |||
606 | hdr.w1 = ntohl(buf[1]); | 614 | hdr.w1 = ntohl(buf[1]); |
607 | buf += 2; | 615 | buf += 2; |
608 | len -= RFC2374_FRAG_HDR_SIZE; | 616 | len -= RFC2374_FRAG_HDR_SIZE; |
@@ -614,7 +622,10 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, | |||
614 | fg_off = fwnet_get_hdr_fg_off(&hdr); | 622 | fg_off = fwnet_get_hdr_fg_off(&hdr); |
615 | } | 623 | } |
616 | datagram_label = fwnet_get_hdr_dgl(&hdr); | 624 | datagram_label = fwnet_get_hdr_dgl(&hdr); |
617 | dg_size = fwnet_get_hdr_dg_size(&hdr); /* ??? + 1 */ | 625 | dg_size = fwnet_get_hdr_dg_size(&hdr); |
626 | |||
627 | if (fg_off + len > dg_size) | ||
628 | return 0; | ||
618 | 629 | ||
619 | spin_lock_irqsave(&dev->lock, flags); | 630 | spin_lock_irqsave(&dev->lock, flags); |
620 | 631 | ||
@@ -722,6 +733,22 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r, | |||
722 | fw_send_response(card, r, rcode); | 733 | fw_send_response(card, r, rcode); |
723 | } | 734 | } |
724 | 735 | ||
736 | static int gasp_source_id(__be32 *p) | ||
737 | { | ||
738 | return be32_to_cpu(p[0]) >> 16; | ||
739 | } | ||
740 | |||
741 | static u32 gasp_specifier_id(__be32 *p) | ||
742 | { | ||
743 | return (be32_to_cpu(p[0]) & 0xffff) << 8 | | ||
744 | (be32_to_cpu(p[1]) & 0xff000000) >> 24; | ||
745 | } | ||
746 | |||
747 | static u32 gasp_version(__be32 *p) | ||
748 | { | ||
749 | return be32_to_cpu(p[1]) & 0xffffff; | ||
750 | } | ||
751 | |||
725 | static void fwnet_receive_broadcast(struct fw_iso_context *context, | 752 | static void fwnet_receive_broadcast(struct fw_iso_context *context, |
726 | u32 cycle, size_t header_length, void *header, void *data) | 753 | u32 cycle, size_t header_length, void *header, void *data) |
727 | { | 754 | { |
@@ -731,9 +758,6 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
731 | __be32 *buf_ptr; | 758 | __be32 *buf_ptr; |
732 | int retval; | 759 | int retval; |
733 | u32 length; | 760 | u32 length; |
734 | u16 source_node_id; | ||
735 | u32 specifier_id; | ||
736 | u32 ver; | ||
737 | unsigned long offset; | 761 | unsigned long offset; |
738 | unsigned long flags; | 762 | unsigned long flags; |
739 | 763 | ||
@@ -750,22 +774,17 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | |||
750 | 774 | ||
751 | spin_unlock_irqrestore(&dev->lock, flags); | 775 | spin_unlock_irqrestore(&dev->lock, flags); |
752 | 776 | ||
753 | specifier_id = (be32_to_cpu(buf_ptr[0]) & 0xffff) << 8 | 777 | if (length > IEEE1394_GASP_HDR_SIZE && |
754 | | (be32_to_cpu(buf_ptr[1]) & 0xff000000) >> 24; | 778 | gasp_specifier_id(buf_ptr) == IANA_SPECIFIER_ID && |
755 | ver = be32_to_cpu(buf_ptr[1]) & 0xffffff; | 779 | (gasp_version(buf_ptr) == RFC2734_SW_VERSION |
756 | source_node_id = be32_to_cpu(buf_ptr[0]) >> 16; | ||
757 | |||
758 | if (specifier_id == IANA_SPECIFIER_ID && | ||
759 | (ver == RFC2734_SW_VERSION | ||
760 | #if IS_ENABLED(CONFIG_IPV6) | 780 | #if IS_ENABLED(CONFIG_IPV6) |
761 | || ver == RFC3146_SW_VERSION | 781 | || gasp_version(buf_ptr) == RFC3146_SW_VERSION |
762 | #endif | 782 | #endif |
763 | )) { | 783 | )) |
764 | buf_ptr += 2; | 784 | fwnet_incoming_packet(dev, buf_ptr + 2, |
765 | length -= IEEE1394_GASP_HDR_SIZE; | 785 | length - IEEE1394_GASP_HDR_SIZE, |
766 | fwnet_incoming_packet(dev, buf_ptr, length, source_node_id, | 786 | gasp_source_id(buf_ptr), |
767 | context->card->generation, true); | 787 | context->card->generation, true); |
768 | } | ||
769 | 788 | ||
770 | packet.payload_length = dev->rcv_buffer_size; | 789 | packet.payload_length = dev->rcv_buffer_size; |
771 | packet.interrupt = 1; | 790 | packet.interrupt = 1; |
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 52dea773bb1b..ef773bf58a25 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | |||
@@ -909,6 +909,7 @@ static void drm_dp_destroy_port(struct kref *kref) | |||
909 | /* no need to clean up vcpi | 909 | /* no need to clean up vcpi |
910 | * as if we have no connector we never setup a vcpi */ | 910 | * as if we have no connector we never setup a vcpi */ |
911 | drm_dp_port_teardown_pdt(port, port->pdt); | 911 | drm_dp_port_teardown_pdt(port, port->pdt); |
912 | port->pdt = DP_PEER_DEVICE_NONE; | ||
912 | } | 913 | } |
913 | kfree(port); | 914 | kfree(port); |
914 | } | 915 | } |
@@ -1155,7 +1156,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, | |||
1155 | drm_dp_put_port(port); | 1156 | drm_dp_put_port(port); |
1156 | goto out; | 1157 | goto out; |
1157 | } | 1158 | } |
1158 | if (port->port_num >= 8) { | 1159 | if ((port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV || |
1160 | port->pdt == DP_PEER_DEVICE_SST_SINK) && | ||
1161 | port->port_num >= DP_MST_LOGICAL_PORT_0) { | ||
1159 | port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); | 1162 | port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); |
1160 | } | 1163 | } |
1161 | } | 1164 | } |
@@ -2860,6 +2863,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) | |||
2860 | mgr->cbs->destroy_connector(mgr, port->connector); | 2863 | mgr->cbs->destroy_connector(mgr, port->connector); |
2861 | 2864 | ||
2862 | drm_dp_port_teardown_pdt(port, port->pdt); | 2865 | drm_dp_port_teardown_pdt(port, port->pdt); |
2866 | port->pdt = DP_PEER_DEVICE_NONE; | ||
2863 | 2867 | ||
2864 | if (!port->input && port->vcpi.vcpi > 0) { | 2868 | if (!port->input && port->vcpi.vcpi > 0) { |
2865 | drm_dp_mst_reset_vcpi_slots(mgr, port); | 2869 | drm_dp_mst_reset_vcpi_slots(mgr, port); |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 64d3a771920d..fc305ee22471 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1371,9 +1371,7 @@ static void cayman_pcie_gart_fini(struct radeon_device *rdev) | |||
1371 | void cayman_cp_int_cntl_setup(struct radeon_device *rdev, | 1371 | void cayman_cp_int_cntl_setup(struct radeon_device *rdev, |
1372 | int ring, u32 cp_int_cntl) | 1372 | int ring, u32 cp_int_cntl) |
1373 | { | 1373 | { |
1374 | u32 srbm_gfx_cntl = RREG32(SRBM_GFX_CNTL) & ~3; | 1374 | WREG32(SRBM_GFX_CNTL, RINGID(ring)); |
1375 | |||
1376 | WREG32(SRBM_GFX_CNTL, srbm_gfx_cntl | (ring & 3)); | ||
1377 | WREG32(CP_INT_CNTL, cp_int_cntl); | 1375 | WREG32(CP_INT_CNTL, cp_int_cntl); |
1378 | } | 1376 | } |
1379 | 1377 | ||
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index fa2154493cf1..470af4aa4a6a 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -156,19 +156,20 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) | |||
156 | struct drm_device *dev = rdev->ddev; | 156 | struct drm_device *dev = rdev->ddev; |
157 | struct drm_crtc *crtc; | 157 | struct drm_crtc *crtc; |
158 | struct radeon_crtc *radeon_crtc; | 158 | struct radeon_crtc *radeon_crtc; |
159 | u32 line_time_us, vblank_lines; | 159 | u32 vblank_in_pixels; |
160 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ | 160 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ |
161 | 161 | ||
162 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { | 162 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
163 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 163 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
164 | radeon_crtc = to_radeon_crtc(crtc); | 164 | radeon_crtc = to_radeon_crtc(crtc); |
165 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { | 165 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
166 | line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / | 166 | vblank_in_pixels = |
167 | radeon_crtc->hw_mode.clock; | 167 | radeon_crtc->hw_mode.crtc_htotal * |
168 | vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - | 168 | (radeon_crtc->hw_mode.crtc_vblank_end - |
169 | radeon_crtc->hw_mode.crtc_vdisplay + | 169 | radeon_crtc->hw_mode.crtc_vdisplay + |
170 | (radeon_crtc->v_border * 2); | 170 | (radeon_crtc->v_border * 2)); |
171 | vblank_time_us = vblank_lines * line_time_us; | 171 | |
172 | vblank_time_us = vblank_in_pixels * 1000 / radeon_crtc->hw_mode.clock; | ||
172 | break; | 173 | break; |
173 | } | 174 | } |
174 | } | 175 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c index db64e0062689..3b0c229d7dcd 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c +++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c | |||
@@ -105,7 +105,7 @@ radeon_dp_aux_transfer_native(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg | |||
105 | 105 | ||
106 | tmp &= AUX_HPD_SEL(0x7); | 106 | tmp &= AUX_HPD_SEL(0x7); |
107 | tmp |= AUX_HPD_SEL(chan->rec.hpd); | 107 | tmp |= AUX_HPD_SEL(chan->rec.hpd); |
108 | tmp |= AUX_EN | AUX_LS_READ_EN | AUX_HPD_DISCON(0x1); | 108 | tmp |= AUX_EN | AUX_LS_READ_EN; |
109 | 109 | ||
110 | WREG32(AUX_CONTROL + aux_offset[instance], tmp); | 110 | WREG32(AUX_CONTROL + aux_offset[instance], tmp); |
111 | 111 | ||
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index f666277a8993..a808ba001ee7 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -2948,6 +2948,49 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2948 | int i; | 2948 | int i; |
2949 | struct si_dpm_quirk *p = si_dpm_quirk_list; | 2949 | struct si_dpm_quirk *p = si_dpm_quirk_list; |
2950 | 2950 | ||
2951 | /* limit all SI kickers */ | ||
2952 | if (rdev->family == CHIP_PITCAIRN) { | ||
2953 | if ((rdev->pdev->revision == 0x81) || | ||
2954 | (rdev->pdev->device == 0x6810) || | ||
2955 | (rdev->pdev->device == 0x6811) || | ||
2956 | (rdev->pdev->device == 0x6816) || | ||
2957 | (rdev->pdev->device == 0x6817) || | ||
2958 | (rdev->pdev->device == 0x6806)) | ||
2959 | max_mclk = 120000; | ||
2960 | } else if (rdev->family == CHIP_VERDE) { | ||
2961 | if ((rdev->pdev->revision == 0x81) || | ||
2962 | (rdev->pdev->revision == 0x83) || | ||
2963 | (rdev->pdev->revision == 0x87) || | ||
2964 | (rdev->pdev->device == 0x6820) || | ||
2965 | (rdev->pdev->device == 0x6821) || | ||
2966 | (rdev->pdev->device == 0x6822) || | ||
2967 | (rdev->pdev->device == 0x6823) || | ||
2968 | (rdev->pdev->device == 0x682A) || | ||
2969 | (rdev->pdev->device == 0x682B)) { | ||
2970 | max_sclk = 75000; | ||
2971 | max_mclk = 80000; | ||
2972 | } | ||
2973 | } else if (rdev->family == CHIP_OLAND) { | ||
2974 | if ((rdev->pdev->revision == 0xC7) || | ||
2975 | (rdev->pdev->revision == 0x80) || | ||
2976 | (rdev->pdev->revision == 0x81) || | ||
2977 | (rdev->pdev->revision == 0x83) || | ||
2978 | (rdev->pdev->device == 0x6604) || | ||
2979 | (rdev->pdev->device == 0x6605)) { | ||
2980 | max_sclk = 75000; | ||
2981 | max_mclk = 80000; | ||
2982 | } | ||
2983 | } else if (rdev->family == CHIP_HAINAN) { | ||
2984 | if ((rdev->pdev->revision == 0x81) || | ||
2985 | (rdev->pdev->revision == 0x83) || | ||
2986 | (rdev->pdev->revision == 0xC3) || | ||
2987 | (rdev->pdev->device == 0x6664) || | ||
2988 | (rdev->pdev->device == 0x6665) || | ||
2989 | (rdev->pdev->device == 0x6667)) { | ||
2990 | max_sclk = 75000; | ||
2991 | max_mclk = 80000; | ||
2992 | } | ||
2993 | } | ||
2951 | /* Apply dpm quirks */ | 2994 | /* Apply dpm quirks */ |
2952 | while (p && p->chip_device != 0) { | 2995 | while (p && p->chip_device != 0) { |
2953 | if (rdev->pdev->vendor == p->chip_vendor && | 2996 | if (rdev->pdev->vendor == p->chip_vendor && |
@@ -2960,10 +3003,6 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2960 | } | 3003 | } |
2961 | ++p; | 3004 | ++p; |
2962 | } | 3005 | } |
2963 | /* limit mclk on all R7 370 parts for stability */ | ||
2964 | if (rdev->pdev->device == 0x6811 && | ||
2965 | rdev->pdev->revision == 0x81) | ||
2966 | max_mclk = 120000; | ||
2967 | 3006 | ||
2968 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 3007 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
2969 | ni_dpm_vblank_too_short(rdev)) | 3008 | ni_dpm_vblank_too_short(rdev)) |
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 7994ec2e4151..41f5896224bd 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c | |||
@@ -283,10 +283,14 @@ static void heartbeat_onchannelcallback(void *context) | |||
283 | u8 *hbeat_txf_buf = util_heartbeat.recv_buffer; | 283 | u8 *hbeat_txf_buf = util_heartbeat.recv_buffer; |
284 | struct icmsg_negotiate *negop = NULL; | 284 | struct icmsg_negotiate *negop = NULL; |
285 | 285 | ||
286 | vmbus_recvpacket(channel, hbeat_txf_buf, | 286 | while (1) { |
287 | PAGE_SIZE, &recvlen, &requestid); | 287 | |
288 | vmbus_recvpacket(channel, hbeat_txf_buf, | ||
289 | PAGE_SIZE, &recvlen, &requestid); | ||
290 | |||
291 | if (!recvlen) | ||
292 | break; | ||
288 | 293 | ||
289 | if (recvlen > 0) { | ||
290 | icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[ | 294 | icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[ |
291 | sizeof(struct vmbuspipe_hdr)]; | 295 | sizeof(struct vmbuspipe_hdr)]; |
292 | 296 | ||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 68f5f4a0f1e7..418701947800 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -793,6 +793,13 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { | |||
793 | DMI_MATCH(DMI_PRODUCT_NAME, "P34"), | 793 | DMI_MATCH(DMI_PRODUCT_NAME, "P34"), |
794 | }, | 794 | }, |
795 | }, | 795 | }, |
796 | { | ||
797 | /* Schenker XMG C504 - Elantech touchpad */ | ||
798 | .matches = { | ||
799 | DMI_MATCH(DMI_SYS_VENDOR, "XMG"), | ||
800 | DMI_MATCH(DMI_PRODUCT_NAME, "C504"), | ||
801 | }, | ||
802 | }, | ||
796 | { } | 803 | { } |
797 | }; | 804 | }; |
798 | 805 | ||
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 1dbae580e8ca..f1b15a0b3774 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c | |||
@@ -180,7 +180,7 @@ static void gic_enable_redist(bool enable) | |||
180 | return; /* No PM support in this redistributor */ | 180 | return; /* No PM support in this redistributor */ |
181 | } | 181 | } |
182 | 182 | ||
183 | while (count--) { | 183 | while (--count) { |
184 | val = readl_relaxed(rbase + GICR_WAKER); | 184 | val = readl_relaxed(rbase + GICR_WAKER); |
185 | if (enable ^ (val & GICR_WAKER_ChildrenAsleep)) | 185 | if (enable ^ (val & GICR_WAKER_ChildrenAsleep)) |
186 | break; | 186 | break; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index e411ccba0af6..94533bdcbef2 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -700,37 +700,32 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
700 | 700 | ||
701 | tgt->type = dm_get_target_type(type); | 701 | tgt->type = dm_get_target_type(type); |
702 | if (!tgt->type) { | 702 | if (!tgt->type) { |
703 | DMERR("%s: %s: unknown target type", dm_device_name(t->md), | 703 | DMERR("%s: %s: unknown target type", dm_device_name(t->md), type); |
704 | type); | ||
705 | return -EINVAL; | 704 | return -EINVAL; |
706 | } | 705 | } |
707 | 706 | ||
708 | if (dm_target_needs_singleton(tgt->type)) { | 707 | if (dm_target_needs_singleton(tgt->type)) { |
709 | if (t->num_targets) { | 708 | if (t->num_targets) { |
710 | DMERR("%s: target type %s must appear alone in table", | 709 | tgt->error = "singleton target type must appear alone in table"; |
711 | dm_device_name(t->md), type); | 710 | goto bad; |
712 | return -EINVAL; | ||
713 | } | 711 | } |
714 | t->singleton = 1; | 712 | t->singleton = 1; |
715 | } | 713 | } |
716 | 714 | ||
717 | if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) { | 715 | if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) { |
718 | DMERR("%s: target type %s may not be included in read-only tables", | 716 | tgt->error = "target type may not be included in a read-only table"; |
719 | dm_device_name(t->md), type); | 717 | goto bad; |
720 | return -EINVAL; | ||
721 | } | 718 | } |
722 | 719 | ||
723 | if (t->immutable_target_type) { | 720 | if (t->immutable_target_type) { |
724 | if (t->immutable_target_type != tgt->type) { | 721 | if (t->immutable_target_type != tgt->type) { |
725 | DMERR("%s: immutable target type %s cannot be mixed with other target types", | 722 | tgt->error = "immutable target type cannot be mixed with other target types"; |
726 | dm_device_name(t->md), t->immutable_target_type->name); | 723 | goto bad; |
727 | return -EINVAL; | ||
728 | } | 724 | } |
729 | } else if (dm_target_is_immutable(tgt->type)) { | 725 | } else if (dm_target_is_immutable(tgt->type)) { |
730 | if (t->num_targets) { | 726 | if (t->num_targets) { |
731 | DMERR("%s: immutable target type %s cannot be mixed with other target types", | 727 | tgt->error = "immutable target type cannot be mixed with other target types"; |
732 | dm_device_name(t->md), tgt->type->name); | 728 | goto bad; |
733 | return -EINVAL; | ||
734 | } | 729 | } |
735 | t->immutable_target_type = tgt->type; | 730 | t->immutable_target_type = tgt->type; |
736 | } | 731 | } |
@@ -745,7 +740,6 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
745 | */ | 740 | */ |
746 | if (!adjoin(t, tgt)) { | 741 | if (!adjoin(t, tgt)) { |
747 | tgt->error = "Gap in table"; | 742 | tgt->error = "Gap in table"; |
748 | r = -EINVAL; | ||
749 | goto bad; | 743 | goto bad; |
750 | } | 744 | } |
751 | 745 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 72dc91de80f8..7453c3ed4b8f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7847,6 +7847,9 @@ void md_do_sync(struct md_thread *thread) | |||
7847 | break; | 7847 | break; |
7848 | 7848 | ||
7849 | j += sectors; | 7849 | j += sectors; |
7850 | if (j > max_sectors) | ||
7851 | /* when skipping, extra large numbers can be returned. */ | ||
7852 | j = max_sectors; | ||
7850 | if (j > 2) | 7853 | if (j > 2) |
7851 | mddev->curr_resync = j; | 7854 | mddev->curr_resync = j; |
7852 | if (mddev_is_clustered(mddev)) | 7855 | if (mddev_is_clustered(mddev)) |
@@ -7915,6 +7918,12 @@ void md_do_sync(struct md_thread *thread) | |||
7915 | blk_finish_plug(&plug); | 7918 | blk_finish_plug(&plug); |
7916 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 7919 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
7917 | 7920 | ||
7921 | if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && | ||
7922 | !test_bit(MD_RECOVERY_INTR, &mddev->recovery) && | ||
7923 | mddev->curr_resync > 3) { | ||
7924 | mddev->curr_resync_completed = mddev->curr_resync; | ||
7925 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
7926 | } | ||
7918 | /* tell personality that we are finished */ | 7927 | /* tell personality that we are finished */ |
7919 | mddev->pers->sync_request(mddev, max_sectors, &skipped); | 7928 | mddev->pers->sync_request(mddev, max_sectors, &skipped); |
7920 | 7929 | ||
@@ -7922,7 +7931,7 @@ void md_do_sync(struct md_thread *thread) | |||
7922 | md_cluster_ops->resync_finish(mddev); | 7931 | md_cluster_ops->resync_finish(mddev); |
7923 | 7932 | ||
7924 | if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && | 7933 | if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && |
7925 | mddev->curr_resync > 2) { | 7934 | mddev->curr_resync > 3) { |
7926 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 7935 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
7927 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 7936 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
7928 | if (mddev->curr_resync >= mddev->recovery_cp) { | 7937 | if (mddev->curr_resync >= mddev->recovery_cp) { |
diff --git a/drivers/memstick/host/rtsx_usb_ms.c b/drivers/memstick/host/rtsx_usb_ms.c index 1105db2355d2..83bfb1659abe 100644 --- a/drivers/memstick/host/rtsx_usb_ms.c +++ b/drivers/memstick/host/rtsx_usb_ms.c | |||
@@ -524,6 +524,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work) | |||
524 | int rc; | 524 | int rc; |
525 | 525 | ||
526 | if (!host->req) { | 526 | if (!host->req) { |
527 | pm_runtime_get_sync(ms_dev(host)); | ||
527 | do { | 528 | do { |
528 | rc = memstick_next_req(msh, &host->req); | 529 | rc = memstick_next_req(msh, &host->req); |
529 | dev_dbg(ms_dev(host), "next req %d\n", rc); | 530 | dev_dbg(ms_dev(host), "next req %d\n", rc); |
@@ -544,6 +545,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work) | |||
544 | host->req->error); | 545 | host->req->error); |
545 | } | 546 | } |
546 | } while (!rc); | 547 | } while (!rc); |
548 | pm_runtime_put(ms_dev(host)); | ||
547 | } | 549 | } |
548 | 550 | ||
549 | } | 551 | } |
@@ -570,6 +572,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh, | |||
570 | dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n", | 572 | dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n", |
571 | __func__, param, value); | 573 | __func__, param, value); |
572 | 574 | ||
575 | pm_runtime_get_sync(ms_dev(host)); | ||
573 | mutex_lock(&ucr->dev_mutex); | 576 | mutex_lock(&ucr->dev_mutex); |
574 | 577 | ||
575 | err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD); | 578 | err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD); |
@@ -635,6 +638,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh, | |||
635 | } | 638 | } |
636 | out: | 639 | out: |
637 | mutex_unlock(&ucr->dev_mutex); | 640 | mutex_unlock(&ucr->dev_mutex); |
641 | pm_runtime_put(ms_dev(host)); | ||
638 | 642 | ||
639 | /* power-on delay */ | 643 | /* power-on delay */ |
640 | if (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON) | 644 | if (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON) |
@@ -681,6 +685,7 @@ static int rtsx_usb_detect_ms_card(void *__host) | |||
681 | int err; | 685 | int err; |
682 | 686 | ||
683 | for (;;) { | 687 | for (;;) { |
688 | pm_runtime_get_sync(ms_dev(host)); | ||
684 | mutex_lock(&ucr->dev_mutex); | 689 | mutex_lock(&ucr->dev_mutex); |
685 | 690 | ||
686 | /* Check pending MS card changes */ | 691 | /* Check pending MS card changes */ |
@@ -703,6 +708,7 @@ static int rtsx_usb_detect_ms_card(void *__host) | |||
703 | } | 708 | } |
704 | 709 | ||
705 | poll_again: | 710 | poll_again: |
711 | pm_runtime_put(ms_dev(host)); | ||
706 | if (host->eject) | 712 | if (host->eject) |
707 | break; | 713 | break; |
708 | 714 | ||
diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c index 1ca94e6fa8fb..e9e6f7d61a71 100644 --- a/drivers/misc/genwqe/card_utils.c +++ b/drivers/misc/genwqe/card_utils.c | |||
@@ -351,17 +351,27 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, | |||
351 | if (copy_from_user(sgl->lpage, user_addr + user_size - | 351 | if (copy_from_user(sgl->lpage, user_addr + user_size - |
352 | sgl->lpage_size, sgl->lpage_size)) { | 352 | sgl->lpage_size, sgl->lpage_size)) { |
353 | rc = -EFAULT; | 353 | rc = -EFAULT; |
354 | goto err_out1; | 354 | goto err_out2; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | return 0; | 357 | return 0; |
358 | 358 | ||
359 | err_out2: | ||
360 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->lpage, | ||
361 | sgl->lpage_dma_addr); | ||
362 | sgl->lpage = NULL; | ||
363 | sgl->lpage_dma_addr = 0; | ||
359 | err_out1: | 364 | err_out1: |
360 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->fpage, | 365 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->fpage, |
361 | sgl->fpage_dma_addr); | 366 | sgl->fpage_dma_addr); |
367 | sgl->fpage = NULL; | ||
368 | sgl->fpage_dma_addr = 0; | ||
362 | err_out: | 369 | err_out: |
363 | __genwqe_free_consistent(cd, sgl->sgl_size, sgl->sgl, | 370 | __genwqe_free_consistent(cd, sgl->sgl_size, sgl->sgl, |
364 | sgl->sgl_dma_addr); | 371 | sgl->sgl_dma_addr); |
372 | sgl->sgl = NULL; | ||
373 | sgl->sgl_dma_addr = 0; | ||
374 | sgl->sgl_size = 0; | ||
365 | return -ENOMEM; | 375 | return -ENOMEM; |
366 | } | 376 | } |
367 | 377 | ||
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c index bae680c648ff..396d75d9fb11 100644 --- a/drivers/misc/mei/hw-txe.c +++ b/drivers/misc/mei/hw-txe.c | |||
@@ -972,11 +972,13 @@ static bool mei_txe_check_and_ack_intrs(struct mei_device *dev, bool do_ack) | |||
972 | hisr = mei_txe_br_reg_read(hw, HISR_REG); | 972 | hisr = mei_txe_br_reg_read(hw, HISR_REG); |
973 | 973 | ||
974 | aliveness = mei_txe_aliveness_get(dev); | 974 | aliveness = mei_txe_aliveness_get(dev); |
975 | if (hhisr & IPC_HHIER_SEC && aliveness) | 975 | if (hhisr & IPC_HHIER_SEC && aliveness) { |
976 | ipc_isr = mei_txe_sec_reg_read_silent(hw, | 976 | ipc_isr = mei_txe_sec_reg_read_silent(hw, |
977 | SEC_IPC_HOST_INT_STATUS_REG); | 977 | SEC_IPC_HOST_INT_STATUS_REG); |
978 | else | 978 | } else { |
979 | ipc_isr = 0; | 979 | ipc_isr = 0; |
980 | hhisr &= ~IPC_HHIER_SEC; | ||
981 | } | ||
980 | 982 | ||
981 | generated = generated || | 983 | generated = generated || |
982 | (hisr & HISR_INT_STS_MSK) || | 984 | (hisr & HISR_INT_STS_MSK) || |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index ccefd6ca9c99..25939928d8fe 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -1652,7 +1652,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, | |||
1652 | struct mmc_blk_data *md = mq->data; | 1652 | struct mmc_blk_data *md = mq->data; |
1653 | struct mmc_packed *packed = mqrq->packed; | 1653 | struct mmc_packed *packed = mqrq->packed; |
1654 | bool do_rel_wr, do_data_tag; | 1654 | bool do_rel_wr, do_data_tag; |
1655 | u32 *packed_cmd_hdr; | 1655 | __le32 *packed_cmd_hdr; |
1656 | u8 hdr_blocks; | 1656 | u8 hdr_blocks; |
1657 | u8 i = 1; | 1657 | u8 i = 1; |
1658 | 1658 | ||
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h index 99e6521e6169..f42c11293dd8 100644 --- a/drivers/mmc/card/queue.h +++ b/drivers/mmc/card/queue.h | |||
@@ -24,7 +24,7 @@ enum mmc_packed_type { | |||
24 | 24 | ||
25 | struct mmc_packed { | 25 | struct mmc_packed { |
26 | struct list_head list; | 26 | struct list_head list; |
27 | u32 cmd_hdr[1024]; | 27 | __le32 cmd_hdr[1024]; |
28 | unsigned int blocks; | 28 | unsigned int blocks; |
29 | u8 nr_entries; | 29 | u8 nr_entries; |
30 | u8 retries; | 30 | u8 retries; |
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c index 88af827e086b..a9e97a138f3d 100644 --- a/drivers/mmc/host/rtsx_usb_sdmmc.c +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c | |||
@@ -1138,11 +1138,6 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1138 | dev_dbg(sdmmc_dev(host), "%s\n", __func__); | 1138 | dev_dbg(sdmmc_dev(host), "%s\n", __func__); |
1139 | mutex_lock(&ucr->dev_mutex); | 1139 | mutex_lock(&ucr->dev_mutex); |
1140 | 1140 | ||
1141 | if (rtsx_usb_card_exclusive_check(ucr, RTSX_USB_SD_CARD)) { | ||
1142 | mutex_unlock(&ucr->dev_mutex); | ||
1143 | return; | ||
1144 | } | ||
1145 | |||
1146 | sd_set_power_mode(host, ios->power_mode); | 1141 | sd_set_power_mode(host, ios->power_mode); |
1147 | sd_set_bus_width(host, ios->bus_width); | 1142 | sd_set_bus_width(host, ios->bus_width); |
1148 | sd_set_timing(host, ios->timing, &host->ddr_mode); | 1143 | sd_set_timing(host, ios->timing, &host->ddr_mode); |
@@ -1314,6 +1309,7 @@ static void rtsx_usb_update_led(struct work_struct *work) | |||
1314 | container_of(work, struct rtsx_usb_sdmmc, led_work); | 1309 | container_of(work, struct rtsx_usb_sdmmc, led_work); |
1315 | struct rtsx_ucr *ucr = host->ucr; | 1310 | struct rtsx_ucr *ucr = host->ucr; |
1316 | 1311 | ||
1312 | pm_runtime_get_sync(sdmmc_dev(host)); | ||
1317 | mutex_lock(&ucr->dev_mutex); | 1313 | mutex_lock(&ucr->dev_mutex); |
1318 | 1314 | ||
1319 | if (host->led.brightness == LED_OFF) | 1315 | if (host->led.brightness == LED_OFF) |
@@ -1322,6 +1318,7 @@ static void rtsx_usb_update_led(struct work_struct *work) | |||
1322 | rtsx_usb_turn_on_led(ucr); | 1318 | rtsx_usb_turn_on_led(ucr); |
1323 | 1319 | ||
1324 | mutex_unlock(&ucr->dev_mutex); | 1320 | mutex_unlock(&ucr->dev_mutex); |
1321 | pm_runtime_put(sdmmc_dev(host)); | ||
1325 | } | 1322 | } |
1326 | #endif | 1323 | #endif |
1327 | 1324 | ||
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c60dde917e49..5eb23ae82def 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -690,7 +690,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) | |||
690 | * host->clock is in Hz. target_timeout is in us. | 690 | * host->clock is in Hz. target_timeout is in us. |
691 | * Hence, us = 1000000 * cycles / Hz. Round up. | 691 | * Hence, us = 1000000 * cycles / Hz. Round up. |
692 | */ | 692 | */ |
693 | val = 1000000 * data->timeout_clks; | 693 | val = 1000000ULL * data->timeout_clks; |
694 | if (do_div(val, host->clock)) | 694 | if (do_div(val, host->clock)) |
695 | target_timeout++; | 695 | target_timeout++; |
696 | target_timeout += val; | 696 | target_timeout += val; |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 914c39f9f388..2926295a936d 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -2540,18 +2540,9 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, | |||
2540 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 2540 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
2541 | struct CommandControlBlock *ccb; | 2541 | struct CommandControlBlock *ccb; |
2542 | int target = cmd->device->id; | 2542 | int target = cmd->device->id; |
2543 | int lun = cmd->device->lun; | ||
2544 | uint8_t scsicmd = cmd->cmnd[0]; | ||
2545 | cmd->scsi_done = done; | 2543 | cmd->scsi_done = done; |
2546 | cmd->host_scribble = NULL; | 2544 | cmd->host_scribble = NULL; |
2547 | cmd->result = 0; | 2545 | cmd->result = 0; |
2548 | if ((scsicmd == SYNCHRONIZE_CACHE) ||(scsicmd == SEND_DIAGNOSTIC)){ | ||
2549 | if(acb->devstate[target][lun] == ARECA_RAID_GONE) { | ||
2550 | cmd->result = (DID_NO_CONNECT << 16); | ||
2551 | } | ||
2552 | cmd->scsi_done(cmd); | ||
2553 | return 0; | ||
2554 | } | ||
2555 | if (target == 16) { | 2546 | if (target == 16) { |
2556 | /* virtual device for iop message transfer */ | 2547 | /* virtual device for iop message transfer */ |
2557 | arcmsr_handle_virtual_command(acb, cmd); | 2548 | arcmsr_handle_virtual_command(acb, cmd); |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7a1c4b4e764b..a991690167aa 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -1622,16 +1622,13 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) | |||
1622 | goto out_done; | 1622 | goto out_done; |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | switch (scmd->cmnd[0]) { | 1625 | /* |
1626 | case SYNCHRONIZE_CACHE: | 1626 | * FW takes care of flush cache on its own for Virtual Disk. |
1627 | /* | 1627 | * No need to send it down for VD. For JBOD send SYNCHRONIZE_CACHE to FW. |
1628 | * FW takes care of flush cache on its own | 1628 | */ |
1629 | * No need to send it down | 1629 | if ((scmd->cmnd[0] == SYNCHRONIZE_CACHE) && MEGASAS_IS_LOGICAL(scmd)) { |
1630 | */ | ||
1631 | scmd->result = DID_OK << 16; | 1630 | scmd->result = DID_OK << 16; |
1632 | goto out_done; | 1631 | goto out_done; |
1633 | default: | ||
1634 | break; | ||
1635 | } | 1632 | } |
1636 | 1633 | ||
1637 | if (instance->instancet->build_and_issue_cmd(instance, scmd)) { | 1634 | if (instance->instancet->build_and_issue_cmd(instance, scmd)) { |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 1f8e2dc9c616..c07d1cd28e91 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -4993,6 +4993,7 @@ static void __exit scsi_debug_exit(void) | |||
4993 | if (dif_storep) | 4993 | if (dif_storep) |
4994 | vfree(dif_storep); | 4994 | vfree(dif_storep); |
4995 | 4995 | ||
4996 | vfree(map_storep); | ||
4996 | vfree(fake_storep); | 4997 | vfree(fake_storep); |
4997 | } | 4998 | } |
4998 | 4999 | ||
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 6efab1c455e1..f7aa434811b5 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -1516,12 +1516,12 @@ retry: | |||
1516 | out_err: | 1516 | out_err: |
1517 | kfree(lun_data); | 1517 | kfree(lun_data); |
1518 | out: | 1518 | out: |
1519 | scsi_device_put(sdev); | ||
1520 | if (scsi_device_created(sdev)) | 1519 | if (scsi_device_created(sdev)) |
1521 | /* | 1520 | /* |
1522 | * the sdev we used didn't appear in the report luns scan | 1521 | * the sdev we used didn't appear in the report luns scan |
1523 | */ | 1522 | */ |
1524 | __scsi_remove_device(sdev); | 1523 | __scsi_remove_device(sdev); |
1524 | scsi_device_put(sdev); | ||
1525 | return ret; | 1525 | return ret; |
1526 | } | 1526 | } |
1527 | 1527 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 7580abe7cb45..1cf3c0819b81 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2495,8 +2495,10 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) | |||
2495 | * fabric acknowledgement that requires two target_put_sess_cmd() | 2495 | * fabric acknowledgement that requires two target_put_sess_cmd() |
2496 | * invocations before se_cmd descriptor release. | 2496 | * invocations before se_cmd descriptor release. |
2497 | */ | 2497 | */ |
2498 | if (ack_kref) | 2498 | if (ack_kref) { |
2499 | kref_get(&se_cmd->cmd_kref); | 2499 | kref_get(&se_cmd->cmd_kref); |
2500 | se_cmd->se_cmd_flags |= SCF_ACK_KREF; | ||
2501 | } | ||
2500 | 2502 | ||
2501 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | 2503 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
2502 | if (se_sess->sess_tearing_down) { | 2504 | if (se_sess->sess_tearing_down) { |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 4609305a1591..ddb0d6bc45f2 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
@@ -675,6 +675,7 @@ static int target_xcopy_read_source( | |||
675 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], | 675 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], |
676 | remote_port, true); | 676 | remote_port, true); |
677 | if (rc < 0) { | 677 | if (rc < 0) { |
678 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
678 | transport_generic_free_cmd(se_cmd, 0); | 679 | transport_generic_free_cmd(se_cmd, 0); |
679 | return rc; | 680 | return rc; |
680 | } | 681 | } |
@@ -686,6 +687,7 @@ static int target_xcopy_read_source( | |||
686 | 687 | ||
687 | rc = target_xcopy_issue_pt_cmd(xpt_cmd); | 688 | rc = target_xcopy_issue_pt_cmd(xpt_cmd); |
688 | if (rc < 0) { | 689 | if (rc < 0) { |
690 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
689 | transport_generic_free_cmd(se_cmd, 0); | 691 | transport_generic_free_cmd(se_cmd, 0); |
690 | return rc; | 692 | return rc; |
691 | } | 693 | } |
@@ -736,6 +738,7 @@ static int target_xcopy_write_destination( | |||
736 | remote_port, false); | 738 | remote_port, false); |
737 | if (rc < 0) { | 739 | if (rc < 0) { |
738 | struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; | 740 | struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; |
741 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
739 | /* | 742 | /* |
740 | * If the failure happened before the t_mem_list hand-off in | 743 | * If the failure happened before the t_mem_list hand-off in |
741 | * target_xcopy_setup_pt_cmd(), Reset memory + clear flag so that | 744 | * target_xcopy_setup_pt_cmd(), Reset memory + clear flag so that |
@@ -751,6 +754,7 @@ static int target_xcopy_write_destination( | |||
751 | 754 | ||
752 | rc = target_xcopy_issue_pt_cmd(xpt_cmd); | 755 | rc = target_xcopy_issue_pt_cmd(xpt_cmd); |
753 | if (rc < 0) { | 756 | if (rc < 0) { |
757 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
754 | se_cmd->se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | 758 | se_cmd->se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; |
755 | transport_generic_free_cmd(se_cmd, 0); | 759 | transport_generic_free_cmd(se_cmd, 0); |
756 | return rc; | 760 | return rc; |
@@ -837,9 +841,14 @@ static void target_xcopy_do_work(struct work_struct *work) | |||
837 | out: | 841 | out: |
838 | xcopy_pt_undepend_remotedev(xop); | 842 | xcopy_pt_undepend_remotedev(xop); |
839 | kfree(xop); | 843 | kfree(xop); |
840 | 844 | /* | |
841 | pr_warn("target_xcopy_do_work: Setting X-COPY CHECK_CONDITION -> sending response\n"); | 845 | * Don't override an error scsi status if it has already been set |
842 | ec_cmd->scsi_status = SAM_STAT_CHECK_CONDITION; | 846 | */ |
847 | if (ec_cmd->scsi_status == SAM_STAT_GOOD) { | ||
848 | pr_warn_ratelimited("target_xcopy_do_work: rc: %d, Setting X-COPY" | ||
849 | " CHECK_CONDITION -> sending response\n", rc); | ||
850 | ec_cmd->scsi_status = SAM_STAT_CHECK_CONDITION; | ||
851 | } | ||
843 | target_complete_cmd(ec_cmd, SAM_STAT_CHECK_CONDITION); | 852 | target_complete_cmd(ec_cmd, SAM_STAT_CHECK_CONDITION); |
844 | } | 853 | } |
845 | 854 | ||
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index ba86956ef4b5..2df90a54509a 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -865,10 +865,15 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | |||
865 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) | 865 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) |
866 | return 0; | 866 | return 0; |
867 | 867 | ||
868 | if (new_screen_size > (4 << 20)) | ||
869 | return -EINVAL; | ||
868 | newscreen = kmalloc(new_screen_size, GFP_USER); | 870 | newscreen = kmalloc(new_screen_size, GFP_USER); |
869 | if (!newscreen) | 871 | if (!newscreen) |
870 | return -ENOMEM; | 872 | return -ENOMEM; |
871 | 873 | ||
874 | if (vc == sel_cons) | ||
875 | clear_selection(); | ||
876 | |||
872 | old_rows = vc->vc_rows; | 877 | old_rows = vc->vc_rows; |
873 | old_row_size = vc->vc_size_row; | 878 | old_row_size = vc->vc_size_row; |
874 | 879 | ||
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index f1fd777ef4ec..82e63f73bfd5 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c | |||
@@ -591,8 +591,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, | |||
591 | 591 | ||
592 | /* throttle high/super speed IRQ rate back slightly */ | 592 | /* throttle high/super speed IRQ rate back slightly */ |
593 | if (gadget_is_dualspeed(dev->gadget)) | 593 | if (gadget_is_dualspeed(dev->gadget)) |
594 | req->no_interrupt = (dev->gadget->speed == USB_SPEED_HIGH || | 594 | req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH || |
595 | dev->gadget->speed == USB_SPEED_SUPER) | 595 | dev->gadget->speed == USB_SPEED_SUPER)) && |
596 | !list_empty(&dev->tx_reqs)) | ||
596 | ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0) | 597 | ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0) |
597 | : 0; | 598 | : 0; |
598 | 599 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 1dab9dfbca6a..c5de2e24c9e7 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -72,7 +72,7 @@ | |||
72 | static const char hcd_name [] = "ohci_hcd"; | 72 | static const char hcd_name [] = "ohci_hcd"; |
73 | 73 | ||
74 | #define STATECHANGE_DELAY msecs_to_jiffies(300) | 74 | #define STATECHANGE_DELAY msecs_to_jiffies(300) |
75 | #define IO_WATCHDOG_DELAY msecs_to_jiffies(250) | 75 | #define IO_WATCHDOG_DELAY msecs_to_jiffies(275) |
76 | 76 | ||
77 | #include "ohci.h" | 77 | #include "ohci.h" |
78 | #include "pci-quirks.h" | 78 | #include "pci-quirks.h" |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 7288333e6afe..b702eb3bd379 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -1230,6 +1230,35 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1230 | return 0; | 1230 | return 0; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | /* | ||
1234 | * Workaround for missing Cold Attach Status (CAS) if device re-plugged in S3. | ||
1235 | * warm reset a USB3 device stuck in polling or compliance mode after resume. | ||
1236 | * See Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8 | ||
1237 | */ | ||
1238 | static bool xhci_port_missing_cas_quirk(int port_index, | ||
1239 | __le32 __iomem **port_array) | ||
1240 | { | ||
1241 | u32 portsc; | ||
1242 | |||
1243 | portsc = readl(port_array[port_index]); | ||
1244 | |||
1245 | /* if any of these are set we are not stuck */ | ||
1246 | if (portsc & (PORT_CONNECT | PORT_CAS)) | ||
1247 | return false; | ||
1248 | |||
1249 | if (((portsc & PORT_PLS_MASK) != XDEV_POLLING) && | ||
1250 | ((portsc & PORT_PLS_MASK) != XDEV_COMP_MODE)) | ||
1251 | return false; | ||
1252 | |||
1253 | /* clear wakeup/change bits, and do a warm port reset */ | ||
1254 | portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); | ||
1255 | portsc |= PORT_WR; | ||
1256 | writel(portsc, port_array[port_index]); | ||
1257 | /* flush write */ | ||
1258 | readl(port_array[port_index]); | ||
1259 | return true; | ||
1260 | } | ||
1261 | |||
1233 | int xhci_bus_resume(struct usb_hcd *hcd) | 1262 | int xhci_bus_resume(struct usb_hcd *hcd) |
1234 | { | 1263 | { |
1235 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 1264 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
@@ -1264,6 +1293,14 @@ int xhci_bus_resume(struct usb_hcd *hcd) | |||
1264 | int slot_id; | 1293 | int slot_id; |
1265 | 1294 | ||
1266 | temp = readl(port_array[port_index]); | 1295 | temp = readl(port_array[port_index]); |
1296 | |||
1297 | /* warm reset CAS limited ports stuck in polling/compliance */ | ||
1298 | if ((xhci->quirks & XHCI_MISSING_CAS) && | ||
1299 | (hcd->speed >= HCD_USB3) && | ||
1300 | xhci_port_missing_cas_quirk(port_index, port_array)) { | ||
1301 | xhci_dbg(xhci, "reset stuck port %d\n", port_index); | ||
1302 | continue; | ||
1303 | } | ||
1267 | if (DEV_SUPERSPEED(temp)) | 1304 | if (DEV_SUPERSPEED(temp)) |
1268 | temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); | 1305 | temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); |
1269 | else | 1306 | else |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index a000324a1442..840fd44b99d1 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -45,11 +45,13 @@ | |||
45 | 45 | ||
46 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 | 46 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 |
47 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 | 47 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 |
48 | #define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI 0x9cb1 | ||
48 | #define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 | 49 | #define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 |
49 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f | 50 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f |
50 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f | 51 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f |
51 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 | 52 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 |
52 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 | 53 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 |
54 | #define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 | ||
53 | 55 | ||
54 | static const char hcd_name[] = "xhci_hcd"; | 56 | static const char hcd_name[] = "xhci_hcd"; |
55 | 57 | ||
@@ -154,7 +156,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
154 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 156 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
155 | } | 157 | } |
156 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 158 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
157 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { | 159 | (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI || |
160 | pdev->device == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI)) { | ||
158 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 161 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
159 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; | 162 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; |
160 | } | 163 | } |
@@ -170,6 +173,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
170 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { | 173 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { |
171 | xhci->quirks |= XHCI_SSIC_PORT_UNUSED; | 174 | xhci->quirks |= XHCI_SSIC_PORT_UNUSED; |
172 | } | 175 | } |
176 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
177 | (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | ||
178 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) | ||
179 | xhci->quirks |= XHCI_MISSING_CAS; | ||
180 | |||
173 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | 181 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
174 | pdev->device == PCI_DEVICE_ID_EJ168) { | 182 | pdev->device == PCI_DEVICE_ID_EJ168) { |
175 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 183 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 520d3c81f1a3..6b2d6a206424 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -286,6 +286,8 @@ struct xhci_op_regs { | |||
286 | #define XDEV_U2 (0x2 << 5) | 286 | #define XDEV_U2 (0x2 << 5) |
287 | #define XDEV_U3 (0x3 << 5) | 287 | #define XDEV_U3 (0x3 << 5) |
288 | #define XDEV_INACTIVE (0x6 << 5) | 288 | #define XDEV_INACTIVE (0x6 << 5) |
289 | #define XDEV_POLLING (0x7 << 5) | ||
290 | #define XDEV_COMP_MODE (0xa << 5) | ||
289 | #define XDEV_RESUME (0xf << 5) | 291 | #define XDEV_RESUME (0xf << 5) |
290 | /* true: port has power (see HCC_PPC) */ | 292 | /* true: port has power (see HCC_PPC) */ |
291 | #define PORT_POWER (1 << 9) | 293 | #define PORT_POWER (1 << 9) |
@@ -1575,6 +1577,7 @@ struct xhci_hcd { | |||
1575 | #define XHCI_BROKEN_PORT_PE (1 << 21) | 1577 | #define XHCI_BROKEN_PORT_PE (1 << 21) |
1576 | #define XHCI_SSIC_PORT_UNUSED (1 << 22) | 1578 | #define XHCI_SSIC_PORT_UNUSED (1 << 22) |
1577 | #define XHCI_NO_64BIT_SUPPORT (1 << 23) | 1579 | #define XHCI_NO_64BIT_SUPPORT (1 << 23) |
1580 | #define XHCI_MISSING_CAS (1 << 24) | ||
1578 | unsigned int num_active_eps; | 1581 | unsigned int num_active_eps; |
1579 | unsigned int limit_active_eps; | 1582 | unsigned int limit_active_eps; |
1580 | /* There are two roothubs to keep track of bus suspend info for */ | 1583 | /* There are two roothubs to keep track of bus suspend info for */ |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f49e859ac5ce..6d4d8b828971 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -844,7 +844,9 @@ static int cp210x_tiocmget(struct tty_struct *tty) | |||
844 | unsigned int control; | 844 | unsigned int control; |
845 | int result; | 845 | int result; |
846 | 846 | ||
847 | cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1); | 847 | result = cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1); |
848 | if (result) | ||
849 | return result; | ||
848 | 850 | ||
849 | result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0) | 851 | result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0) |
850 | |((control & CONTROL_RTS) ? TIOCM_RTS : 0) | 852 | |((control & CONTROL_RTS) ? TIOCM_RTS : 0) |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8c48c9d83d48..494167fe6a2c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -986,7 +986,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
986 | /* ekey Devices */ | 986 | /* ekey Devices */ |
987 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | 987 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, |
988 | /* Infineon Devices */ | 988 | /* Infineon Devices */ |
989 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 989 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_TC1798_PID, 1) }, |
990 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_TC2X7_PID, 1) }, | ||
990 | /* GE Healthcare devices */ | 991 | /* GE Healthcare devices */ |
991 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, | 992 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, |
992 | /* Active Research (Actisense) devices */ | 993 | /* Active Research (Actisense) devices */ |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 48db84f25cc9..db1a9b3a5f38 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -626,8 +626,9 @@ | |||
626 | /* | 626 | /* |
627 | * Infineon Technologies | 627 | * Infineon Technologies |
628 | */ | 628 | */ |
629 | #define INFINEON_VID 0x058b | 629 | #define INFINEON_VID 0x058b |
630 | #define INFINEON_TRIBOARD_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ | 630 | #define INFINEON_TRIBOARD_TC1798_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ |
631 | #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */ | ||
631 | 632 | ||
632 | /* | 633 | /* |
633 | * Acton Research Corp. | 634 | * Acton Research Corp. |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a0ca291bc07f..e7e29c797824 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1077,7 +1077,8 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1077 | 1077 | ||
1078 | serial->disconnected = 0; | 1078 | serial->disconnected = 0; |
1079 | 1079 | ||
1080 | usb_serial_console_init(serial->port[0]->minor); | 1080 | if (num_ports > 0) |
1081 | usb_serial_console_init(serial->port[0]->minor); | ||
1081 | exit: | 1082 | exit: |
1082 | module_put(type->driver.owner); | 1083 | module_put(type->driver.owner); |
1083 | return 0; | 1084 | return 0; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index bd3c92b4bcee..32ecb95f6214 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2596,14 +2596,12 @@ static inline void btrfs_remove_all_log_ctxs(struct btrfs_root *root, | |||
2596 | int index, int error) | 2596 | int index, int error) |
2597 | { | 2597 | { |
2598 | struct btrfs_log_ctx *ctx; | 2598 | struct btrfs_log_ctx *ctx; |
2599 | struct btrfs_log_ctx *safe; | ||
2599 | 2600 | ||
2600 | if (!error) { | 2601 | list_for_each_entry_safe(ctx, safe, &root->log_ctxs[index], list) { |
2601 | INIT_LIST_HEAD(&root->log_ctxs[index]); | 2602 | list_del_init(&ctx->list); |
2602 | return; | ||
2603 | } | ||
2604 | |||
2605 | list_for_each_entry(ctx, &root->log_ctxs[index], list) | ||
2606 | ctx->log_ret = error; | 2603 | ctx->log_ret = error; |
2604 | } | ||
2607 | 2605 | ||
2608 | INIT_LIST_HEAD(&root->log_ctxs[index]); | 2606 | INIT_LIST_HEAD(&root->log_ctxs[index]); |
2609 | } | 2607 | } |
@@ -2842,13 +2840,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2842 | mutex_unlock(&root->log_mutex); | 2840 | mutex_unlock(&root->log_mutex); |
2843 | 2841 | ||
2844 | out_wake_log_root: | 2842 | out_wake_log_root: |
2845 | /* | 2843 | mutex_lock(&log_root_tree->log_mutex); |
2846 | * We needn't get log_mutex here because we are sure all | ||
2847 | * the other tasks are blocked. | ||
2848 | */ | ||
2849 | btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); | 2844 | btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); |
2850 | 2845 | ||
2851 | mutex_lock(&log_root_tree->log_mutex); | ||
2852 | log_root_tree->log_transid_committed++; | 2846 | log_root_tree->log_transid_committed++; |
2853 | atomic_set(&log_root_tree->log_commit[index2], 0); | 2847 | atomic_set(&log_root_tree->log_commit[index2], 0); |
2854 | mutex_unlock(&log_root_tree->log_mutex); | 2848 | mutex_unlock(&log_root_tree->log_mutex); |
@@ -2856,10 +2850,8 @@ out_wake_log_root: | |||
2856 | if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) | 2850 | if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) |
2857 | wake_up(&log_root_tree->log_commit_wait[index2]); | 2851 | wake_up(&log_root_tree->log_commit_wait[index2]); |
2858 | out: | 2852 | out: |
2859 | /* See above. */ | ||
2860 | btrfs_remove_all_log_ctxs(root, index1, ret); | ||
2861 | |||
2862 | mutex_lock(&root->log_mutex); | 2853 | mutex_lock(&root->log_mutex); |
2854 | btrfs_remove_all_log_ctxs(root, index1, ret); | ||
2863 | root->log_transid_committed++; | 2855 | root->log_transid_committed++; |
2864 | atomic_set(&root->log_commit[index1], 0); | 2856 | atomic_set(&root->log_commit[index1], 0); |
2865 | mutex_unlock(&root->log_mutex); | 2857 | mutex_unlock(&root->log_mutex); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 3b6b522b4b31..5ae447cbd2b5 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -868,7 +868,8 @@ again: | |||
868 | statret = __ceph_do_getattr(inode, page, | 868 | statret = __ceph_do_getattr(inode, page, |
869 | CEPH_STAT_CAP_INLINE_DATA, !!page); | 869 | CEPH_STAT_CAP_INLINE_DATA, !!page); |
870 | if (statret < 0) { | 870 | if (statret < 0) { |
871 | __free_page(page); | 871 | if (page) |
872 | __free_page(page); | ||
872 | if (statret == -ENODATA) { | 873 | if (statret == -ENODATA) { |
873 | BUG_ON(retry_op != READ_INLINE); | 874 | BUG_ON(retry_op != READ_INLINE); |
874 | goto again; | 875 | goto again; |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index d67a16f2a45d..350f67fb5b9c 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -690,6 +690,11 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
690 | pri_bh = NULL; | 690 | pri_bh = NULL; |
691 | 691 | ||
692 | root_found: | 692 | root_found: |
693 | /* We don't support read-write mounts */ | ||
694 | if (!(s->s_flags & MS_RDONLY)) { | ||
695 | error = -EACCES; | ||
696 | goto out_freebh; | ||
697 | } | ||
693 | 698 | ||
694 | if (joliet_level && (pri == NULL || !opt.rock)) { | 699 | if (joliet_level && (pri == NULL || !opt.rock)) { |
695 | /* This is the case of Joliet with the norock mount flag. | 700 | /* This is the case of Joliet with the norock mount flag. |
@@ -1503,9 +1508,6 @@ struct inode *__isofs_iget(struct super_block *sb, | |||
1503 | static struct dentry *isofs_mount(struct file_system_type *fs_type, | 1508 | static struct dentry *isofs_mount(struct file_system_type *fs_type, |
1504 | int flags, const char *dev_name, void *data) | 1509 | int flags, const char *dev_name, void *data) |
1505 | { | 1510 | { |
1506 | /* We don't support read-write mounts */ | ||
1507 | if (!(flags & MS_RDONLY)) | ||
1508 | return ERR_PTR(-EACCES); | ||
1509 | return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super); | 1511 | return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super); |
1510 | } | 1512 | } |
1511 | 1513 | ||
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index ff2f2e6ad311..2abbb2babcae 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1087,6 +1087,7 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
1087 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | 1087 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); |
1088 | spin_lock(&journal->j_list_lock); | 1088 | spin_lock(&journal->j_list_lock); |
1089 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); | 1089 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); |
1090 | spin_unlock(&journal->j_list_lock); | ||
1090 | } else if (jh->b_transaction == journal->j_committing_transaction) { | 1091 | } else if (jh->b_transaction == journal->j_committing_transaction) { |
1091 | /* first access by this transaction */ | 1092 | /* first access by this transaction */ |
1092 | jh->b_modified = 0; | 1093 | jh->b_modified = 0; |
@@ -1094,8 +1095,8 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
1094 | JBUFFER_TRACE(jh, "set next transaction"); | 1095 | JBUFFER_TRACE(jh, "set next transaction"); |
1095 | spin_lock(&journal->j_list_lock); | 1096 | spin_lock(&journal->j_list_lock); |
1096 | jh->b_next_transaction = transaction; | 1097 | jh->b_next_transaction = transaction; |
1098 | spin_unlock(&journal->j_list_lock); | ||
1097 | } | 1099 | } |
1098 | spin_unlock(&journal->j_list_lock); | ||
1099 | jbd_unlock_bh_state(bh); | 1100 | jbd_unlock_bh_state(bh); |
1100 | 1101 | ||
1101 | /* | 1102 | /* |
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 4d8aa749d9b2..c57cd417802b 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c | |||
@@ -129,6 +129,8 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) | |||
129 | len -= bytes; | 129 | len -= bytes; |
130 | } | 130 | } |
131 | 131 | ||
132 | if (!error) | ||
133 | error = vfs_fsync(new_file, 0); | ||
132 | fput(new_file); | 134 | fput(new_file); |
133 | out_fput: | 135 | out_fput: |
134 | fput(old_file); | 136 | fput(old_file); |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 27060fc855d4..e0af247f4740 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -350,7 +350,7 @@ static unsigned int vfs_dent_type(uint8_t type) | |||
350 | */ | 350 | */ |
351 | static int ubifs_readdir(struct file *file, struct dir_context *ctx) | 351 | static int ubifs_readdir(struct file *file, struct dir_context *ctx) |
352 | { | 352 | { |
353 | int err; | 353 | int err = 0; |
354 | struct qstr nm; | 354 | struct qstr nm; |
355 | union ubifs_key key; | 355 | union ubifs_key key; |
356 | struct ubifs_dent_node *dent; | 356 | struct ubifs_dent_node *dent; |
@@ -449,16 +449,23 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) | |||
449 | } | 449 | } |
450 | 450 | ||
451 | out: | 451 | out: |
452 | if (err != -ENOENT) { | ||
453 | ubifs_err(c, "cannot find next direntry, error %d", err); | ||
454 | return err; | ||
455 | } | ||
456 | |||
457 | kfree(file->private_data); | 452 | kfree(file->private_data); |
458 | file->private_data = NULL; | 453 | file->private_data = NULL; |
454 | |||
455 | if (err != -ENOENT) | ||
456 | ubifs_err(c, "cannot find next direntry, error %d", err); | ||
457 | else | ||
458 | /* | ||
459 | * -ENOENT is a non-fatal error in this context, the TNC uses | ||
460 | * it to indicate that the cursor moved past the current directory | ||
461 | * and readdir() has to stop. | ||
462 | */ | ||
463 | err = 0; | ||
464 | |||
465 | |||
459 | /* 2 is a special value indicating that there are no more direntries */ | 466 | /* 2 is a special value indicating that there are no more direntries */ |
460 | ctx->pos = 2; | 467 | ctx->pos = 2; |
461 | return 0; | 468 | return err; |
462 | } | 469 | } |
463 | 470 | ||
464 | /* Free saved readdir() state when the directory is closed */ | 471 | /* Free saved readdir() state when the directory is closed */ |
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index fd65b3f1923c..7270162b72e4 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
@@ -173,6 +173,7 @@ out_cancel: | |||
173 | host_ui->xattr_cnt -= 1; | 173 | host_ui->xattr_cnt -= 1; |
174 | host_ui->xattr_size -= CALC_DENT_SIZE(nm->len); | 174 | host_ui->xattr_size -= CALC_DENT_SIZE(nm->len); |
175 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); | 175 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); |
176 | host_ui->xattr_names -= nm->len; | ||
176 | mutex_unlock(&host_ui->ui_mutex); | 177 | mutex_unlock(&host_ui->ui_mutex); |
177 | out_free: | 178 | out_free: |
178 | make_bad_inode(inode); | 179 | make_bad_inode(inode); |
@@ -527,6 +528,7 @@ out_cancel: | |||
527 | host_ui->xattr_cnt += 1; | 528 | host_ui->xattr_cnt += 1; |
528 | host_ui->xattr_size += CALC_DENT_SIZE(nm->len); | 529 | host_ui->xattr_size += CALC_DENT_SIZE(nm->len); |
529 | host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); | 530 | host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); |
531 | host_ui->xattr_names += nm->len; | ||
530 | mutex_unlock(&host_ui->ui_mutex); | 532 | mutex_unlock(&host_ui->ui_mutex); |
531 | ubifs_release_budget(c, &req); | 533 | ubifs_release_budget(c, &req); |
532 | make_bad_inode(inode); | 534 | make_bad_inode(inode); |
diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c index f48c3040c9ce..6021c322316c 100644 --- a/fs/xfs/libxfs/xfs_dquot_buf.c +++ b/fs/xfs/libxfs/xfs_dquot_buf.c | |||
@@ -191,8 +191,7 @@ xfs_dquot_buf_verify_crc( | |||
191 | if (mp->m_quotainfo) | 191 | if (mp->m_quotainfo) |
192 | ndquots = mp->m_quotainfo->qi_dqperchunk; | 192 | ndquots = mp->m_quotainfo->qi_dqperchunk; |
193 | else | 193 | else |
194 | ndquots = xfs_calc_dquots_per_chunk( | 194 | ndquots = xfs_calc_dquots_per_chunk(bp->b_length); |
195 | XFS_BB_TO_FSB(mp, bp->b_length)); | ||
196 | 195 | ||
197 | for (i = 0; i < ndquots; i++, d++) { | 196 | for (i = 0; i < ndquots; i++, d++) { |
198 | if (!xfs_verify_cksum((char *)d, sizeof(struct xfs_dqblk), | 197 | if (!xfs_verify_cksum((char *)d, sizeof(struct xfs_dqblk), |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 523f04c90dea..cede0a45b9c0 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
@@ -568,6 +568,10 @@ | |||
568 | #define MODE_I2C_READ 4 | 568 | #define MODE_I2C_READ 4 |
569 | #define MODE_I2C_STOP 8 | 569 | #define MODE_I2C_STOP 8 |
570 | 570 | ||
571 | /* DP 1.2 MST PORTs - Section 2.5.1 v1.2a spec */ | ||
572 | #define DP_MST_PHYSICAL_PORT_0 0 | ||
573 | #define DP_MST_LOGICAL_PORT_0 8 | ||
574 | |||
571 | #define DP_LINK_STATUS_SIZE 6 | 575 | #define DP_LINK_STATUS_SIZE 6 |
572 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], | 576 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], |
573 | int lane_count); | 577 | int lane_count); |
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index d14568e05047..a46dfd5fb9e8 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
@@ -218,7 +218,7 @@ | |||
218 | #define GITS_BASER_TYPE_SHIFT (56) | 218 | #define GITS_BASER_TYPE_SHIFT (56) |
219 | #define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7) | 219 | #define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7) |
220 | #define GITS_BASER_ENTRY_SIZE_SHIFT (48) | 220 | #define GITS_BASER_ENTRY_SIZE_SHIFT (48) |
221 | #define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0xff) + 1) | 221 | #define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1) |
222 | #define GITS_BASER_NonShareable (0UL << 10) | 222 | #define GITS_BASER_NonShareable (0UL << 10) |
223 | #define GITS_BASER_InnerShareable (1UL << 10) | 223 | #define GITS_BASER_InnerShareable (1UL << 10) |
224 | #define GITS_BASER_OuterShareable (2UL << 10) | 224 | #define GITS_BASER_OuterShareable (2UL << 10) |
diff --git a/mm/list_lru.c b/mm/list_lru.c index 909eca2c820e..84b4c21d78d7 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c | |||
@@ -532,6 +532,8 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware, | |||
532 | err = memcg_init_list_lru(lru, memcg_aware); | 532 | err = memcg_init_list_lru(lru, memcg_aware); |
533 | if (err) { | 533 | if (err) { |
534 | kfree(lru->node); | 534 | kfree(lru->node); |
535 | /* Do this so a list_lru_destroy() doesn't crash: */ | ||
536 | lru->node = NULL; | ||
535 | goto out; | 537 | goto out; |
536 | } | 538 | } |
537 | 539 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 3073164a6fcf..06d1732e2094 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2179,16 +2179,22 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
2179 | if (!(status->rx_flags & IEEE80211_RX_AMSDU)) | 2179 | if (!(status->rx_flags & IEEE80211_RX_AMSDU)) |
2180 | return RX_CONTINUE; | 2180 | return RX_CONTINUE; |
2181 | 2181 | ||
2182 | if (ieee80211_has_a4(hdr->frame_control) && | 2182 | if (unlikely(ieee80211_has_a4(hdr->frame_control))) { |
2183 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | 2183 | switch (rx->sdata->vif.type) { |
2184 | !rx->sdata->u.vlan.sta) | 2184 | case NL80211_IFTYPE_AP_VLAN: |
2185 | return RX_DROP_UNUSABLE; | 2185 | if (!rx->sdata->u.vlan.sta) |
2186 | return RX_DROP_UNUSABLE; | ||
2187 | break; | ||
2188 | case NL80211_IFTYPE_STATION: | ||
2189 | if (!rx->sdata->u.mgd.use_4addr) | ||
2190 | return RX_DROP_UNUSABLE; | ||
2191 | break; | ||
2192 | default: | ||
2193 | return RX_DROP_UNUSABLE; | ||
2194 | } | ||
2195 | } | ||
2186 | 2196 | ||
2187 | if (is_multicast_ether_addr(hdr->addr1) && | 2197 | if (is_multicast_ether_addr(hdr->addr1)) |
2188 | ((rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | ||
2189 | rx->sdata->u.vlan.sta) || | ||
2190 | (rx->sdata->vif.type == NL80211_IFTYPE_STATION && | ||
2191 | rx->sdata->u.mgd.use_4addr))) | ||
2192 | return RX_DROP_UNUSABLE; | 2198 | return RX_DROP_UNUSABLE; |
2193 | 2199 | ||
2194 | skb->dev = dev; | 2200 | skb->dev = dev; |
diff --git a/scripts/sortextable.c b/scripts/sortextable.c index 1052d4834a44..4dd16a72a2ef 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c | |||
@@ -205,6 +205,35 @@ static int compare_relative_table(const void *a, const void *b) | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void x86_sort_relative_table(char *extab_image, int image_size) | ||
209 | { | ||
210 | int i; | ||
211 | |||
212 | i = 0; | ||
213 | while (i < image_size) { | ||
214 | uint32_t *loc = (uint32_t *)(extab_image + i); | ||
215 | |||
216 | w(r(loc) + i, loc); | ||
217 | w(r(loc + 1) + i + 4, loc + 1); | ||
218 | w(r(loc + 2) + i + 8, loc + 2); | ||
219 | |||
220 | i += sizeof(uint32_t) * 3; | ||
221 | } | ||
222 | |||
223 | qsort(extab_image, image_size / 12, 12, compare_relative_table); | ||
224 | |||
225 | i = 0; | ||
226 | while (i < image_size) { | ||
227 | uint32_t *loc = (uint32_t *)(extab_image + i); | ||
228 | |||
229 | w(r(loc) - i, loc); | ||
230 | w(r(loc + 1) - (i + 4), loc + 1); | ||
231 | w(r(loc + 2) - (i + 8), loc + 2); | ||
232 | |||
233 | i += sizeof(uint32_t) * 3; | ||
234 | } | ||
235 | } | ||
236 | |||
208 | static void sort_relative_table(char *extab_image, int image_size) | 237 | static void sort_relative_table(char *extab_image, int image_size) |
209 | { | 238 | { |
210 | int i; | 239 | int i; |
@@ -277,6 +306,9 @@ do_file(char const *const fname) | |||
277 | break; | 306 | break; |
278 | case EM_386: | 307 | case EM_386: |
279 | case EM_X86_64: | 308 | case EM_X86_64: |
309 | custom_sort = x86_sort_relative_table; | ||
310 | break; | ||
311 | |||
280 | case EM_S390: | 312 | case EM_S390: |
281 | custom_sort = sort_relative_table; | 313 | custom_sort = sort_relative_table; |
282 | break; | 314 | break; |
diff --git a/security/keys/proc.c b/security/keys/proc.c index f0611a6368cd..b9f531c9e4fa 100644 --- a/security/keys/proc.c +++ b/security/keys/proc.c | |||
@@ -181,7 +181,7 @@ static int proc_keys_show(struct seq_file *m, void *v) | |||
181 | struct timespec now; | 181 | struct timespec now; |
182 | unsigned long timo; | 182 | unsigned long timo; |
183 | key_ref_t key_ref, skey_ref; | 183 | key_ref_t key_ref, skey_ref; |
184 | char xbuf[12]; | 184 | char xbuf[16]; |
185 | int rc; | 185 | int rc; |
186 | 186 | ||
187 | struct keyring_search_context ctx = { | 187 | struct keyring_search_context ctx = { |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 26ce990592a0..40072d630b49 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -1738,7 +1738,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
1738 | status = azx_readb(chip, RIRBSTS); | 1738 | status = azx_readb(chip, RIRBSTS); |
1739 | if (status & RIRB_INT_MASK) { | 1739 | if (status & RIRB_INT_MASK) { |
1740 | if (status & RIRB_INT_RESPONSE) { | 1740 | if (status & RIRB_INT_RESPONSE) { |
1741 | if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY) | 1741 | if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) |
1742 | udelay(80); | 1742 | udelay(80); |
1743 | azx_update_rirb(chip); | 1743 | azx_update_rirb(chip); |
1744 | } | 1744 | } |
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h index 0efdb094d21c..6bb5340cf842 100644 --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h | |||
@@ -158,7 +158,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
158 | #define AZX_DCAPS_SNOOP_MASK (3 << 10) /* snoop type mask */ | 158 | #define AZX_DCAPS_SNOOP_MASK (3 << 10) /* snoop type mask */ |
159 | #define AZX_DCAPS_SNOOP_OFF (1 << 12) /* snoop default off */ | 159 | #define AZX_DCAPS_SNOOP_OFF (1 << 12) /* snoop default off */ |
160 | #define AZX_DCAPS_RIRB_DELAY (1 << 13) /* Long delay in read loop */ | 160 | #define AZX_DCAPS_RIRB_DELAY (1 << 13) /* Long delay in read loop */ |
161 | #define AZX_DCAPS_RIRB_PRE_DELAY (1 << 14) /* Put a delay before read */ | 161 | /* 14 unused */ |
162 | #define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ | 162 | #define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ |
163 | #define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ | 163 | #define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ |
164 | #define AZX_DCAPS_POSFIX_VIA (1 << 17) /* Use VIACOMBO as default */ | 164 | #define AZX_DCAPS_POSFIX_VIA (1 << 17) /* Use VIACOMBO as default */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c8506496826a..16d09825a995 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2220,14 +2220,12 @@ static const struct pci_device_id azx_ids[] = { | |||
2220 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | 2220 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2221 | .class_mask = 0xffffff, | 2221 | .class_mask = 0xffffff, |
2222 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | | 2222 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | |
2223 | AZX_DCAPS_NO_64BIT | | 2223 | AZX_DCAPS_NO_64BIT | AZX_DCAPS_POSFIX_LPIB }, |
2224 | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, | ||
2225 | #else | 2224 | #else |
2226 | /* this entry seems still valid -- i.e. without emu20kx chip */ | 2225 | /* this entry seems still valid -- i.e. without emu20kx chip */ |
2227 | { PCI_DEVICE(0x1102, 0x0009), | 2226 | { PCI_DEVICE(0x1102, 0x0009), |
2228 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | | 2227 | .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | |
2229 | AZX_DCAPS_NO_64BIT | | 2228 | AZX_DCAPS_NO_64BIT | AZX_DCAPS_POSFIX_LPIB }, |
2230 | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, | ||
2231 | #endif | 2229 | #endif |
2232 | /* CM8888 */ | 2230 | /* CM8888 */ |
2233 | { PCI_DEVICE(0x13f6, 0x5011), | 2231 | { PCI_DEVICE(0x13f6, 0x5011), |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index ecc2a4ea014d..32719f28aa86 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -2898,6 +2898,23 @@ AU0828_DEVICE(0x2040, 0x7260, "Hauppauge", "HVR-950Q"), | |||
2898 | AU0828_DEVICE(0x2040, 0x7213, "Hauppauge", "HVR-950Q"), | 2898 | AU0828_DEVICE(0x2040, 0x7213, "Hauppauge", "HVR-950Q"), |
2899 | AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), | 2899 | AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
2900 | 2900 | ||
2901 | /* Syntek STK1160 */ | ||
2902 | { | ||
2903 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | | ||
2904 | USB_DEVICE_ID_MATCH_INT_CLASS | | ||
2905 | USB_DEVICE_ID_MATCH_INT_SUBCLASS, | ||
2906 | .idVendor = 0x05e1, | ||
2907 | .idProduct = 0x0408, | ||
2908 | .bInterfaceClass = USB_CLASS_AUDIO, | ||
2909 | .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, | ||
2910 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
2911 | .vendor_name = "Syntek", | ||
2912 | .product_name = "STK1160", | ||
2913 | .ifnum = QUIRK_ANY_INTERFACE, | ||
2914 | .type = QUIRK_AUDIO_ALIGN_TRANSFER | ||
2915 | } | ||
2916 | }, | ||
2917 | |||
2901 | /* Digidesign Mbox */ | 2918 | /* Digidesign Mbox */ |
2902 | { | 2919 | { |
2903 | /* Thanks to Clemens Ladisch <clemens@ladisch.de> */ | 2920 | /* Thanks to Clemens Ladisch <clemens@ladisch.de> */ |