Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1605 - genpatches-2.6/trunk/2.6.31
Date: Wed, 09 Sep 2009 23:51:58
Message-Id: E1MlWwb-00043v-8S@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-09-09 23:51:20 +0000 (Wed, 09 Sep 2009)
3 New Revision: 1605
4
5 Removed:
6 genpatches-2.6/trunk/2.6.31/1000_linux-2.6.30.1.patch
7 genpatches-2.6/trunk/2.6.31/1001_linux-2.6.30.2.patch
8 genpatches-2.6/trunk/2.6.31/1002_linux-2.6.30.3.patch
9 genpatches-2.6/trunk/2.6.31/1003_linux-2.6.30.4.patch
10 genpatches-2.6/trunk/2.6.31/1004_linux-2.6.30.5.patch
11 genpatches-2.6/trunk/2.6.31/1005_linux-2.6.30.6.patch
12 genpatches-2.6/trunk/2.6.31/1510_hid-move-deref-below-null-test.patch
13 genpatches-2.6/trunk/2.6.31/2500_ide-cd-handle-fragmented-patckets.patch
14 genpatches-2.6/trunk/2.6.31/2900_makefile-no-delete-null-pointer-checks-fix.patch
15 genpatches-2.6/trunk/2.6.31/2910_add-sysrq-h-needs-errno-h-include.patch
16 Modified:
17 genpatches-2.6/trunk/2.6.31/0000_README
18 Log:
19 Removal of .30 patches
20
21 Modified: genpatches-2.6/trunk/2.6.31/0000_README
22 ===================================================================
23 --- genpatches-2.6/trunk/2.6.31/0000_README 2009-09-09 23:15:13 UTC (rev 1604)
24 +++ genpatches-2.6/trunk/2.6.31/0000_README 2009-09-09 23:51:20 UTC (rev 1605)
25 @@ -39,46 +39,6 @@
26 Individual Patch Descriptions:
27 --------------------------------------------------------------------------
28
29 -Patch: 1000_linux-2.6.30.1.patch
30 -From: http://www.kernel.org
31 -Desc: Linux 2.6.30.1
32 -
33 -Patch: 1001_linux-2.6.30.2.patch
34 -From: http://www.kernel.org
35 -Desc: Linux 2.6.30.2
36 -
37 -Patch: 1002_linux-2.6.30.3.patch
38 -From: http://www.kernel.org
39 -Desc: Linux 2.6.30.3
40 -
41 -Patch: 1003_linux-2.6.30.4.patch
42 -From: http://www.kernel.org
43 -Desc: Linux 2.6.30.4
44 -
45 -Patch: 1004_linux-2.6.30.5.patch
46 -From: http://www.kernel.org
47 -Desc: Linux 2.6.30.5
48 -
49 -Patch: 1005_linux-2.6.30.6.patch
50 -From: http://www.kernel.org
51 -Desc: Linux 2.6.30.6
52 -
53 -Patch: 1510_hid-move-deref-below-null-test.patch
54 -From: http://lwn.net/Articles/342440/
55 -Desc: HID: Move dereferences below a NULL test
56 -
57 -Patch: 2500_ide-cd-handle-fragmented-patckets.patch
58 -From: http://bugs.gentoo.org/show_bug.cgi?id=274182
59 -Desc: ide-cd: handle fragmented packet commands gracefully
60 -
61 -Patch: 2900_makefile-no-delete-null-pointer-checks-fix.patch
62 -From: http://www.kernel.org
63 -Desc: Add compiler flag to not remove useless null ptr checks on optimization
64 -
65 -Patch: 2910_add-sysrq-h-needs-errno-h-include.patch
66 -From: http://bugs.gentoo.org/show_bug.cgi?id=283812
67 -Desc: linux/sysrq.h needs linux/errno.h
68 -
69 Patch: 4100_dm-bbr.patch
70 From: EVMS 2.5.2
71 Desc: Bad block relocation support for LiveCD users
72
73 Deleted: genpatches-2.6/trunk/2.6.31/1000_linux-2.6.30.1.patch
74 ===================================================================
75 --- genpatches-2.6/trunk/2.6.31/1000_linux-2.6.30.1.patch 2009-09-09 23:15:13 UTC (rev 1604)
76 +++ genpatches-2.6/trunk/2.6.31/1000_linux-2.6.30.1.patch 2009-09-09 23:51:20 UTC (rev 1605)
77 @@ -1,5245 +0,0 @@
78 -diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
79 -index c302ddf..5236573 100644
80 ---- a/Documentation/sysctl/vm.txt
81 -+++ b/Documentation/sysctl/vm.txt
82 -@@ -314,10 +314,14 @@ min_unmapped_ratio:
83 -
84 - This is available only on NUMA kernels.
85 -
86 --A percentage of the total pages in each zone. Zone reclaim will only
87 --occur if more than this percentage of pages are file backed and unmapped.
88 --This is to insure that a minimal amount of local pages is still available for
89 --file I/O even if the node is overallocated.
90 -+This is a percentage of the total pages in each zone. Zone reclaim will
91 -+only occur if more than this percentage of pages are in a state that
92 -+zone_reclaim_mode allows to be reclaimed.
93 -+
94 -+If zone_reclaim_mode has the value 4 OR'd, then the percentage is compared
95 -+against all file-backed unmapped pages including swapcache pages and tmpfs
96 -+files. Otherwise, only unmapped pages backed by normal files but not tmpfs
97 -+files and similar are considered.
98 -
99 - The default is 1 percent.
100 -
101 -diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
102 -index bb7d695..1a711ea 100644
103 ---- a/arch/arm/include/asm/cacheflush.h
104 -+++ b/arch/arm/include/asm/cacheflush.h
105 -@@ -429,6 +429,14 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
106 - __flush_anon_page(vma, page, vmaddr);
107 - }
108 -
109 -+#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
110 -+static inline void flush_kernel_dcache_page(struct page *page)
111 -+{
112 -+ /* highmem pages are always flushed upon kunmap already */
113 -+ if ((cache_is_vivt() || cache_is_vipt_aliasing()) && !PageHighMem(page))
114 -+ __cpuc_flush_dcache_page(page_address(page));
115 -+}
116 -+
117 - #define flush_dcache_mmap_lock(mapping) \
118 - spin_lock_irq(&(mapping)->tree_lock)
119 - #define flush_dcache_mmap_unlock(mapping) \
120 -diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
121 -index caba996..eb0566e 100644
122 ---- a/arch/x86/crypto/aesni-intel_asm.S
123 -+++ b/arch/x86/crypto/aesni-intel_asm.S
124 -@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc)
125 - */
126 - ENTRY(aesni_cbc_dec)
127 - cmp $16, LEN
128 -- jb .Lcbc_dec_ret
129 -+ jb .Lcbc_dec_just_ret
130 - mov 480(KEYP), KLEN
131 - add $240, KEYP
132 - movups (IVP), IV
133 -@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec)
134 - add $16, OUTP
135 - cmp $16, LEN
136 - jge .Lcbc_dec_loop1
137 -- movups IV, (IVP)
138 - .Lcbc_dec_ret:
139 -+ movups IV, (IVP)
140 -+.Lcbc_dec_just_ret:
141 - ret
142 -diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
143 -index 42f2f83..9b2c049 100644
144 ---- a/arch/x86/include/asm/apic.h
145 -+++ b/arch/x86/include/asm/apic.h
146 -@@ -410,7 +410,7 @@ static inline unsigned default_get_apic_id(unsigned long x)
147 - {
148 - unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
149 -
150 -- if (APIC_XAPIC(ver))
151 -+ if (APIC_XAPIC(ver) || boot_cpu_has(X86_FEATURE_EXTD_APICID))
152 - return (x >> 24) & 0xFF;
153 - else
154 - return (x >> 24) & 0x0F;
155 -diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
156 -index bb83b1c..78dee4f 100644
157 ---- a/arch/x86/include/asm/cpufeature.h
158 -+++ b/arch/x86/include/asm/cpufeature.h
159 -@@ -94,6 +94,7 @@
160 - #define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
161 - #define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
162 - #define X86_FEATURE_CLFLUSH_MONITOR (3*32+25) /* "" clflush reqd with monitor */
163 -+#define X86_FEATURE_EXTD_APICID (3*32+26) /* has extended APICID (8 bits) */
164 -
165 - /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
166 - #define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */
167 -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
168 -index f0faf58..a93d1cc 100644
169 ---- a/arch/x86/include/asm/kvm_host.h
170 -+++ b/arch/x86/include/asm/kvm_host.h
171 -@@ -371,6 +371,8 @@ struct kvm_vcpu_arch {
172 - unsigned long dr6;
173 - unsigned long dr7;
174 - unsigned long eff_db[KVM_NR_DB_REGS];
175 -+
176 -+ u32 exit_reason;
177 - };
178 -
179 - struct kvm_mem_alias {
180 -diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
181 -index 4f8c199..5c70378 100644
182 ---- a/arch/x86/include/asm/mce.h
183 -+++ b/arch/x86/include/asm/mce.h
184 -@@ -153,5 +153,7 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
185 -
186 - extern void (*mce_threshold_vector)(void);
187 -
188 -+extern void (*machine_check_vector)(struct pt_regs *, long error_code);
189 -+
190 - #endif /* __KERNEL__ */
191 - #endif /* _ASM_X86_MCE_H */
192 -diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
193 -index 9b0e61b..bddd44f 100644
194 ---- a/arch/x86/include/asm/uv/uv_bau.h
195 -+++ b/arch/x86/include/asm/uv/uv_bau.h
196 -@@ -37,7 +37,7 @@
197 - #define UV_CPUS_PER_ACT_STATUS 32
198 - #define UV_ACT_STATUS_MASK 0x3
199 - #define UV_ACT_STATUS_SIZE 2
200 --#define UV_ACTIVATION_DESCRIPTOR_SIZE 32
201 -+#define UV_ADP_SIZE 32
202 - #define UV_DISTRIBUTION_SIZE 256
203 - #define UV_SW_ACK_NPENDING 8
204 - #define UV_NET_ENDPOINT_INTD 0x38
205 -diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
206 -index d3a98ea..341070f 100644
207 ---- a/arch/x86/include/asm/uv/uv_hub.h
208 -+++ b/arch/x86/include/asm/uv/uv_hub.h
209 -@@ -133,6 +133,7 @@ struct uv_scir_s {
210 - struct uv_hub_info_s {
211 - unsigned long global_mmr_base;
212 - unsigned long gpa_mask;
213 -+ unsigned int gnode_extra;
214 - unsigned long gnode_upper;
215 - unsigned long lowmem_remap_top;
216 - unsigned long lowmem_remap_base;
217 -@@ -159,7 +160,8 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
218 - * p - PNODE (local part of nsids, right shifted 1)
219 - */
220 - #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
221 --#define UV_PNODE_TO_NASID(p) (((p) << 1) | uv_hub_info->gnode_upper)
222 -+#define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra)
223 -+#define UV_PNODE_TO_NASID(p) (UV_PNODE_TO_GNODE(p) << 1)
224 -
225 - #define UV_LOCAL_MMR_BASE 0xf4000000UL
226 - #define UV_GLOBAL_MMR32_BASE 0xf8000000UL
227 -@@ -173,7 +175,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
228 - #define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT))
229 -
230 - #define UV_GLOBAL_MMR64_PNODE_BITS(p) \
231 -- ((unsigned long)(p) << UV_GLOBAL_MMR64_PNODE_SHIFT)
232 -+ ((unsigned long)(UV_PNODE_TO_GNODE(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT)
233 -
234 - #define UV_APIC_PNODE_SHIFT 6
235 -
236 -diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
237 -index 498f944..11be5ad 100644
238 ---- a/arch/x86/include/asm/vmx.h
239 -+++ b/arch/x86/include/asm/vmx.h
240 -@@ -247,6 +247,7 @@ enum vmcs_field {
241 - #define EXIT_REASON_MSR_READ 31
242 - #define EXIT_REASON_MSR_WRITE 32
243 - #define EXIT_REASON_MWAIT_INSTRUCTION 36
244 -+#define EXIT_REASON_MCE_DURING_VMENTRY 41
245 - #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
246 - #define EXIT_REASON_APIC_ACCESS 44
247 - #define EXIT_REASON_EPT_VIOLATION 48
248 -diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
249 -index 2bda693..39f2af4 100644
250 ---- a/arch/x86/kernel/apic/x2apic_uv_x.c
251 -+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
252 -@@ -562,7 +562,7 @@ void __init uv_system_init(void)
253 - union uvh_node_id_u node_id;
254 - unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size;
255 - int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val;
256 -- int max_pnode = 0;
257 -+ int gnode_extra, max_pnode = 0;
258 - unsigned long mmr_base, present, paddr;
259 - unsigned short pnode_mask;
260 -
261 -@@ -574,6 +574,13 @@ void __init uv_system_init(void)
262 - mmr_base =
263 - uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
264 - ~UV_MMR_ENABLE;
265 -+ pnode_mask = (1 << n_val) - 1;
266 -+ node_id.v = uv_read_local_mmr(UVH_NODE_ID);
267 -+ gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1;
268 -+ gnode_upper = ((unsigned long)gnode_extra << m_val);
269 -+ printk(KERN_DEBUG "UV: N %d, M %d, gnode_upper 0x%lx, gnode_extra 0x%x\n",
270 -+ n_val, m_val, gnode_upper, gnode_extra);
271 -+
272 - printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
273 -
274 - for(i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++)
275 -@@ -607,11 +614,6 @@ void __init uv_system_init(void)
276 - }
277 - }
278 -
279 -- pnode_mask = (1 << n_val) - 1;
280 -- node_id.v = uv_read_local_mmr(UVH_NODE_ID);
281 -- gnode_upper = (((unsigned long)node_id.s.node_id) &
282 -- ~((1 << n_val) - 1)) << m_val;
283 --
284 - uv_bios_init();
285 - uv_bios_get_sn_info(0, &uv_type, &sn_partition_id,
286 - &sn_coherency_id, &sn_region_size);
287 -@@ -634,6 +636,7 @@ void __init uv_system_init(void)
288 - uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
289 - uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
290 - uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
291 -+ uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
292 - uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
293 - uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id;
294 - uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu;
295 -diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
296 -index 7e4a459..d869b3b 100644
297 ---- a/arch/x86/kernel/cpu/amd.c
298 -+++ b/arch/x86/kernel/cpu/amd.c
299 -@@ -6,6 +6,7 @@
300 - #include <asm/processor.h>
301 - #include <asm/apic.h>
302 - #include <asm/cpu.h>
303 -+#include <asm/pci-direct.h>
304 -
305 - #ifdef CONFIG_X86_64
306 - # include <asm/numa_64.h>
307 -@@ -257,13 +258,15 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
308 - {
309 - #ifdef CONFIG_X86_HT
310 - unsigned bits;
311 -+ int cpu = smp_processor_id();
312 -
313 - bits = c->x86_coreid_bits;
314 --
315 - /* Low order bits define the core id (index of core in socket) */
316 - c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
317 - /* Convert the initial APIC ID into the socket ID */
318 - c->phys_proc_id = c->initial_apicid >> bits;
319 -+ /* use socket ID also for last level cache */
320 -+ per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
321 - #endif
322 - }
323 -
324 -@@ -351,6 +354,15 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
325 - (c->x86_model == 8 && c->x86_mask >= 8))
326 - set_cpu_cap(c, X86_FEATURE_K6_MTRR);
327 - #endif
328 -+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_PCI)
329 -+ /* check CPU config space for extended APIC ID */
330 -+ if (c->x86 >= 0xf) {
331 -+ unsigned int val;
332 -+ val = read_pci_config(0, 24, 0, 0x68);
333 -+ if ((val & ((1 << 17) | (1 << 18))) == ((1 << 17) | (1 << 18)))
334 -+ set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
335 -+ }
336 -+#endif
337 - }
338 -
339 - static void __cpuinit init_amd(struct cpuinfo_x86 *c)
340 -diff --git a/arch/x86/kernel/cpu/mcheck/mce_32.c b/arch/x86/kernel/cpu/mcheck/mce_32.c
341 -index 3552119..07b523c 100644
342 ---- a/arch/x86/kernel/cpu/mcheck/mce_32.c
343 -+++ b/arch/x86/kernel/cpu/mcheck/mce_32.c
344 -@@ -29,6 +29,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
345 -
346 - /* Call the installed machine check handler for this CPU setup. */
347 - void (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check;
348 -+EXPORT_SYMBOL_GPL(machine_check_vector);
349 -
350 - /* This has to be run for each processor */
351 - void mcheck_init(struct cpuinfo_x86 *c)
352 -diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
353 -index 09dd1d4..289cc48 100644
354 ---- a/arch/x86/kernel/cpu/mcheck/mce_64.c
355 -+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
356 -@@ -420,6 +420,7 @@ void do_machine_check(struct pt_regs * regs, long error_code)
357 - out2:
358 - atomic_dec(&mce_entry);
359 - }
360 -+EXPORT_SYMBOL_GPL(do_machine_check);
361 -
362 - #ifdef CONFIG_X86_MCE_INTEL
363 - /***
364 -diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
365 -index 81408b9..dedc2bd 100644
366 ---- a/arch/x86/kernel/hpet.c
367 -+++ b/arch/x86/kernel/hpet.c
368 -@@ -510,7 +510,8 @@ static int hpet_setup_irq(struct hpet_dev *dev)
369 - {
370 -
371 - if (request_irq(dev->irq, hpet_interrupt_handler,
372 -- IRQF_DISABLED|IRQF_NOBALANCING, dev->name, dev))
373 -+ IRQF_TIMER | IRQF_DISABLED | IRQF_NOBALANCING,
374 -+ dev->name, dev))
375 - return -1;
376 -
377 - disable_irq(dev->irq);
378 -diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
379 -index b284b58..3065b40 100644
380 ---- a/arch/x86/kernel/pci-gart_64.c
381 -+++ b/arch/x86/kernel/pci-gart_64.c
382 -@@ -688,8 +688,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
383 -
384 - agp_gatt_table = gatt;
385 -
386 -- enable_gart_translations();
387 --
388 - error = sysdev_class_register(&gart_sysdev_class);
389 - if (!error)
390 - error = sysdev_register(&device_gart);
391 -@@ -847,6 +845,14 @@ void __init gart_iommu_init(void)
392 - wbinvd();
393 -
394 - /*
395 -+ * Now all caches are flushed and we can safely enable
396 -+ * GART hardware. Doing it early leaves the possibility
397 -+ * of stale cache entries that can lead to GART PTE
398 -+ * errors.
399 -+ */
400 -+ enable_gart_translations();
401 -+
402 -+ /*
403 - * Try to workaround a bug (thanks to BenH):
404 - * Set unmapped entries to a scratch page instead of 0.
405 - * Any prefetches that hit unmapped entries won't get an bus abort
406 -diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
407 -index 667188e..d2d1ce8 100644
408 ---- a/arch/x86/kernel/reboot.c
409 -+++ b/arch/x86/kernel/reboot.c
410 -@@ -192,6 +192,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
411 - DMI_MATCH(DMI_BOARD_NAME, "0KP561"),
412 - },
413 - },
414 -+ { /* Handle problems with rebooting on Dell Optiplex 360 with 0T656F */
415 -+ .callback = set_bios_reboot,
416 -+ .ident = "Dell OptiPlex 360",
417 -+ .matches = {
418 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
419 -+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"),
420 -+ DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
421 -+ },
422 -+ },
423 - { /* Handle problems with rebooting on Dell 2400's */
424 - .callback = set_bios_reboot,
425 - .ident = "Dell PowerEdge 2400",
426 -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
427 -index b415843..0acc6a7 100644
428 ---- a/arch/x86/kernel/setup.c
429 -+++ b/arch/x86/kernel/setup.c
430 -@@ -293,15 +293,13 @@ static void __init reserve_brk(void)
431 -
432 - #ifdef CONFIG_BLK_DEV_INITRD
433 -
434 --#ifdef CONFIG_X86_32
435 --
436 - #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
437 - static void __init relocate_initrd(void)
438 - {
439 -
440 - u64 ramdisk_image = boot_params.hdr.ramdisk_image;
441 - u64 ramdisk_size = boot_params.hdr.ramdisk_size;
442 -- u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
443 -+ u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
444 - u64 ramdisk_here;
445 - unsigned long slop, clen, mapaddr;
446 - char *p, *q;
447 -@@ -357,14 +355,13 @@ static void __init relocate_initrd(void)
448 - ramdisk_image, ramdisk_image + ramdisk_size - 1,
449 - ramdisk_here, ramdisk_here + ramdisk_size - 1);
450 - }
451 --#endif
452 -
453 - static void __init reserve_initrd(void)
454 - {
455 - u64 ramdisk_image = boot_params.hdr.ramdisk_image;
456 - u64 ramdisk_size = boot_params.hdr.ramdisk_size;
457 - u64 ramdisk_end = ramdisk_image + ramdisk_size;
458 -- u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
459 -+ u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
460 -
461 - if (!boot_params.hdr.type_of_loader ||
462 - !ramdisk_image || !ramdisk_size)
463 -@@ -394,14 +391,8 @@ static void __init reserve_initrd(void)
464 - return;
465 - }
466 -
467 --#ifdef CONFIG_X86_32
468 - relocate_initrd();
469 --#else
470 -- printk(KERN_ERR "initrd extends beyond end of memory "
471 -- "(0x%08llx > 0x%08llx)\ndisabling initrd\n",
472 -- ramdisk_end, end_of_lowmem);
473 -- initrd_start = 0;
474 --#endif
475 -+
476 - free_early(ramdisk_image, ramdisk_end);
477 - }
478 - #else
479 -diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
480 -index 8c7b03b..8ccabb8 100644
481 ---- a/arch/x86/kernel/tlb_uv.c
482 -+++ b/arch/x86/kernel/tlb_uv.c
483 -@@ -711,25 +711,31 @@ uv_activation_descriptor_init(int node, int pnode)
484 - unsigned long pa;
485 - unsigned long m;
486 - unsigned long n;
487 -- unsigned long mmr_image;
488 - struct bau_desc *adp;
489 - struct bau_desc *ad2;
490 -
491 -- adp = (struct bau_desc *)kmalloc_node(16384, GFP_KERNEL, node);
492 -+ /*
493 -+ * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
494 -+ * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per blade
495 -+ */
496 -+ adp = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
497 -+ UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
498 - BUG_ON(!adp);
499 -
500 - pa = uv_gpa(adp); /* need the real nasid*/
501 - n = pa >> uv_nshift;
502 - m = pa & uv_mmask;
503 -
504 -- mmr_image = uv_read_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE);
505 -- if (mmr_image) {
506 -- uv_write_global_mmr64(pnode, (unsigned long)
507 -- UVH_LB_BAU_SB_DESCRIPTOR_BASE,
508 -- (n << UV_DESC_BASE_PNODE_SHIFT | m));
509 -- }
510 -+ uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE,
511 -+ (n << UV_DESC_BASE_PNODE_SHIFT | m));
512 -
513 -- for (i = 0, ad2 = adp; i < UV_ACTIVATION_DESCRIPTOR_SIZE; i++, ad2++) {
514 -+ /*
515 -+ * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each
516 -+ * cpu even though we only use the first one; one descriptor can
517 -+ * describe a broadcast to 256 nodes.
518 -+ */
519 -+ for (i = 0, ad2 = adp; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR);
520 -+ i++, ad2++) {
521 - memset(ad2, 0, sizeof(struct bau_desc));
522 - ad2->header.sw_ack_flag = 1;
523 - /*
524 -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
525 -index d57de05..cf8611d 100644
526 ---- a/arch/x86/kernel/tsc.c
527 -+++ b/arch/x86/kernel/tsc.c
528 -@@ -710,7 +710,16 @@ static cycle_t read_tsc(struct clocksource *cs)
529 - #ifdef CONFIG_X86_64
530 - static cycle_t __vsyscall_fn vread_tsc(void)
531 - {
532 -- cycle_t ret = (cycle_t)vget_cycles();
533 -+ cycle_t ret;
534 -+
535 -+ /*
536 -+ * Surround the RDTSC by barriers, to make sure it's not
537 -+ * speculated to outside the seqlock critical section and
538 -+ * does not cause time warps:
539 -+ */
540 -+ rdtsc_barrier();
541 -+ ret = (cycle_t)vget_cycles();
542 -+ rdtsc_barrier();
543 -
544 - return ret >= __vsyscall_gtod_data.clock.cycle_last ?
545 - ret : __vsyscall_gtod_data.clock.cycle_last;
546 -diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
547 -index d7ac84e..6a17769 100644
548 ---- a/arch/x86/kernel/vm86_32.c
549 -+++ b/arch/x86/kernel/vm86_32.c
550 -@@ -287,10 +287,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
551 - info->regs.pt.ds = 0;
552 - info->regs.pt.es = 0;
553 - info->regs.pt.fs = 0;
554 --
555 --/* we are clearing gs later just before "jmp resume_userspace",
556 -- * because it is not saved/restored.
557 -- */
558 -+#ifndef CONFIG_X86_32_LAZY_GS
559 -+ info->regs.pt.gs = 0;
560 -+#endif
561 -
562 - /*
563 - * The flags register is also special: we cannot trust that the user
564 -@@ -343,7 +342,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
565 - __asm__ __volatile__(
566 - "movl %0,%%esp\n\t"
567 - "movl %1,%%ebp\n\t"
568 -+#ifdef CONFIG_X86_32_LAZY_GS
569 - "mov %2, %%gs\n\t"
570 -+#endif
571 - "jmp resume_userspace"
572 - : /* no outputs */
573 - :"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
574 -diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
575 -index 44153af..25ee06a 100644
576 ---- a/arch/x86/kernel/vsyscall_64.c
577 -+++ b/arch/x86/kernel/vsyscall_64.c
578 -@@ -132,15 +132,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
579 - return;
580 - }
581 -
582 -- /*
583 -- * Surround the RDTSC by barriers, to make sure it's not
584 -- * speculated to outside the seqlock critical section and
585 -- * does not cause time warps:
586 -- */
587 -- rdtsc_barrier();
588 - now = vread();
589 -- rdtsc_barrier();
590 --
591 - base = __vsyscall_gtod_data.clock.cycle_last;
592 - mask = __vsyscall_gtod_data.clock.mask;
593 - mult = __vsyscall_gtod_data.clock.mult;
594 -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
595 -index bb48133..fa0adcd 100644
596 ---- a/arch/x86/kvm/vmx.c
597 -+++ b/arch/x86/kvm/vmx.c
598 -@@ -32,6 +32,7 @@
599 - #include <asm/desc.h>
600 - #include <asm/vmx.h>
601 - #include <asm/virtext.h>
602 -+#include <asm/mce.h>
603 -
604 - #define __ex(x) __kvm_handle_fault_on_reboot(x)
605 -
606 -@@ -97,6 +98,8 @@ struct vcpu_vmx {
607 - int soft_vnmi_blocked;
608 - ktime_t entry_time;
609 - s64 vnmi_blocked_time;
610 -+
611 -+ u32 exit_reason;
612 - };
613 -
614 - static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
615 -@@ -478,7 +481,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
616 - {
617 - u32 eb;
618 -
619 -- eb = (1u << PF_VECTOR) | (1u << UD_VECTOR);
620 -+ eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR);
621 - if (!vcpu->fpu_active)
622 - eb |= 1u << NM_VECTOR;
623 - if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
624 -@@ -2585,6 +2588,35 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu,
625 - return 0;
626 - }
627 -
628 -+/*
629 -+ * Trigger machine check on the host. We assume all the MSRs are already set up
630 -+ * by the CPU and that we still run on the same CPU as the MCE occurred on.
631 -+ * We pass a fake environment to the machine check handler because we want
632 -+ * the guest to be always treated like user space, no matter what context
633 -+ * it used internally.
634 -+ */
635 -+static void kvm_machine_check(void)
636 -+{
637 -+#ifdef CONFIG_X86_MCE
638 -+ struct pt_regs regs = {
639 -+ .cs = 3, /* Fake ring 3 no matter what the guest ran on */
640 -+ .flags = X86_EFLAGS_IF,
641 -+ };
642 -+
643 -+#ifdef CONFIG_X86_64
644 -+ do_machine_check(&regs, 0);
645 -+#else
646 -+ machine_check_vector(&regs, 0);
647 -+#endif
648 -+#endif
649 -+}
650 -+
651 -+static int handle_machine_check(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
652 -+{
653 -+ /* already handled by vcpu_run */
654 -+ return 1;
655 -+}
656 -+
657 - static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
658 - {
659 - struct vcpu_vmx *vmx = to_vmx(vcpu);
660 -@@ -2596,6 +2628,10 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
661 - vect_info = vmx->idt_vectoring_info;
662 - intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
663 -
664 -+ ex_no = intr_info & INTR_INFO_VECTOR_MASK;
665 -+ if (ex_no == MC_VECTOR)
666 -+ return handle_machine_check(vcpu, kvm_run);
667 -+
668 - if ((vect_info & VECTORING_INFO_VALID_MASK) &&
669 - !is_page_fault(intr_info))
670 - printk(KERN_ERR "%s: unexpected, vectoring info 0x%x "
671 -@@ -2648,7 +2684,6 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
672 - return 1;
673 - }
674 -
675 -- ex_no = intr_info & INTR_INFO_VECTOR_MASK;
676 - switch (ex_no) {
677 - case DB_VECTOR:
678 - dr6 = vmcs_readl(EXIT_QUALIFICATION);
679 -@@ -2978,6 +3013,12 @@ static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
680 - return 1;
681 - }
682 -
683 -+static int handle_vmx_insn(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
684 -+{
685 -+ kvm_queue_exception(vcpu, UD_VECTOR);
686 -+ return 1;
687 -+}
688 -+
689 - static int handle_invlpg(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
690 - {
691 - u64 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
692 -@@ -3145,11 +3186,21 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu,
693 - [EXIT_REASON_HLT] = handle_halt,
694 - [EXIT_REASON_INVLPG] = handle_invlpg,
695 - [EXIT_REASON_VMCALL] = handle_vmcall,
696 -+ [EXIT_REASON_VMCLEAR] = handle_vmx_insn,
697 -+ [EXIT_REASON_VMLAUNCH] = handle_vmx_insn,
698 -+ [EXIT_REASON_VMPTRLD] = handle_vmx_insn,
699 -+ [EXIT_REASON_VMPTRST] = handle_vmx_insn,
700 -+ [EXIT_REASON_VMREAD] = handle_vmx_insn,
701 -+ [EXIT_REASON_VMRESUME] = handle_vmx_insn,
702 -+ [EXIT_REASON_VMWRITE] = handle_vmx_insn,
703 -+ [EXIT_REASON_VMOFF] = handle_vmx_insn,
704 -+ [EXIT_REASON_VMON] = handle_vmx_insn,
705 - [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold,
706 - [EXIT_REASON_APIC_ACCESS] = handle_apic_access,
707 - [EXIT_REASON_WBINVD] = handle_wbinvd,
708 - [EXIT_REASON_TASK_SWITCH] = handle_task_switch,
709 - [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation,
710 -+ [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check,
711 - };
712 -
713 - static const int kvm_vmx_max_exit_handlers =
714 -@@ -3161,8 +3212,8 @@ static const int kvm_vmx_max_exit_handlers =
715 - */
716 - static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
717 - {
718 -- u32 exit_reason = vmcs_read32(VM_EXIT_REASON);
719 - struct vcpu_vmx *vmx = to_vmx(vcpu);
720 -+ u32 exit_reason = vmx->exit_reason;
721 - u32 vectoring_info = vmx->idt_vectoring_info;
722 -
723 - KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu),
724 -@@ -3512,6 +3563,13 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
725 -
726 - intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
727 -
728 -+ vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
729 -+
730 -+ /* Handle machine checks before interrupts are enabled */
731 -+ if ((vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY) ||
732 -+ (intr_info & INTR_INFO_VECTOR_MASK) == MC_VECTOR)
733 -+ kvm_machine_check();
734 -+
735 - /* We need to handle NMIs before interrupts are enabled */
736 - if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
737 - (intr_info & INTR_INFO_VALID_MASK)) {
738 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
739 -index 3944e91..ee4714b 100644
740 ---- a/arch/x86/kvm/x86.c
741 -+++ b/arch/x86/kvm/x86.c
742 -@@ -634,10 +634,12 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
743 - if ((!vcpu->time_page))
744 - return;
745 -
746 -+ preempt_disable();
747 - if (unlikely(vcpu->hv_clock_tsc_khz != __get_cpu_var(cpu_tsc_khz))) {
748 - kvm_set_time_scale(__get_cpu_var(cpu_tsc_khz), &vcpu->hv_clock);
749 - vcpu->hv_clock_tsc_khz = __get_cpu_var(cpu_tsc_khz);
750 - }
751 -+ preempt_enable();
752 -
753 - /* Keep irq disabled to prevent changes to the clock */
754 - local_irq_save(flags);
755 -@@ -3934,7 +3936,13 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
756 -
757 - vcpu->arch.cr2 = sregs->cr2;
758 - mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3;
759 -- vcpu->arch.cr3 = sregs->cr3;
760 -+
761 -+ down_read(&vcpu->kvm->slots_lock);
762 -+ if (gfn_to_memslot(vcpu->kvm, sregs->cr3 >> PAGE_SHIFT))
763 -+ vcpu->arch.cr3 = sregs->cr3;
764 -+ else
765 -+ set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
766 -+ up_read(&vcpu->kvm->slots_lock);
767 -
768 - kvm_set_cr8(vcpu, sregs->cr8);
769 -
770 -diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
771 -index 605c8be..c0bedcd 100644
772 ---- a/arch/x86/mm/memtest.c
773 -+++ b/arch/x86/mm/memtest.c
774 -@@ -40,23 +40,23 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
775 -
776 - static void __init memtest(u64 pattern, u64 start_phys, u64 size)
777 - {
778 -- u64 i, count;
779 -- u64 *start;
780 -+ u64 *p;
781 -+ void *start, *end;
782 - u64 start_bad, last_bad;
783 - u64 start_phys_aligned;
784 - size_t incr;
785 -
786 - incr = sizeof(pattern);
787 - start_phys_aligned = ALIGN(start_phys, incr);
788 -- count = (size - (start_phys_aligned - start_phys))/incr;
789 - start = __va(start_phys_aligned);
790 -+ end = start + size - (start_phys_aligned - start_phys);
791 - start_bad = 0;
792 - last_bad = 0;
793 -
794 -- for (i = 0; i < count; i++)
795 -- start[i] = pattern;
796 -- for (i = 0; i < count; i++, start++, start_phys_aligned += incr) {
797 -- if (*start == pattern)
798 -+ for (p = start; p < end; p++)
799 -+ *p = pattern;
800 -+ for (p = start; p < end; p++, start_phys_aligned += incr) {
801 -+ if (*p == pattern)
802 - continue;
803 - if (start_phys_aligned == last_bad + incr) {
804 - last_bad += incr;
805 -diff --git a/drivers/char/epca.c b/drivers/char/epca.c
806 -index af7c13c..bcd07cb 100644
807 ---- a/drivers/char/epca.c
808 -+++ b/drivers/char/epca.c
809 -@@ -1518,7 +1518,7 @@ static void doevent(int crd)
810 - if (event & MODEMCHG_IND) {
811 - /* A modem signal change has been indicated */
812 - ch->imodem = mstat;
813 -- if (test_bit(ASYNC_CHECK_CD, &ch->port.flags)) {
814 -+ if (test_bit(ASYNCB_CHECK_CD, &ch->port.flags)) {
815 - /* We are now receiving dcd */
816 - if (mstat & ch->dcd)
817 - wake_up_interruptible(&ch->port.open_wait);
818 -@@ -1765,9 +1765,9 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
819 - * that the driver will wait on carrier detect.
820 - */
821 - if (ts->c_cflag & CLOCAL)
822 -- clear_bit(ASYNC_CHECK_CD, &ch->port.flags);
823 -+ clear_bit(ASYNCB_CHECK_CD, &ch->port.flags);
824 - else
825 -- set_bit(ASYNC_CHECK_CD, &ch->port.flags);
826 -+ set_bit(ASYNCB_CHECK_CD, &ch->port.flags);
827 - mval = ch->m_dtr | ch->m_rts;
828 - } /* End CBAUD not detected */
829 - iflag = termios2digi_i(ch, ts->c_iflag);
830 -@@ -2244,7 +2244,8 @@ static void do_softint(struct work_struct *work)
831 - if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
832 - tty_hangup(tty);
833 - wake_up_interruptible(&ch->port.open_wait);
834 -- clear_bit(ASYNC_NORMAL_ACTIVE, &ch->port.flags);
835 -+ clear_bit(ASYNCB_NORMAL_ACTIVE,
836 -+ &ch->port.flags);
837 - }
838 - }
839 - tty_kref_put(tty);
840 -diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
841 -index 4a4cab7..a57ab11 100644
842 ---- a/drivers/char/moxa.c
843 -+++ b/drivers/char/moxa.c
844 -@@ -1184,6 +1184,11 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
845 - return -ENODEV;
846 - }
847 -
848 -+ if (port % MAX_PORTS_PER_BOARD >= brd->numPorts) {
849 -+ retval = -ENODEV;
850 -+ goto out_unlock;
851 -+ }
852 -+
853 - ch = &brd->ports[port % MAX_PORTS_PER_BOARD];
854 - ch->port.count++;
855 - tty->driver_data = ch;
856 -@@ -1208,8 +1213,8 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
857 - moxa_close_port(tty);
858 - } else
859 - ch->port.flags |= ASYNC_NORMAL_ACTIVE;
860 -+out_unlock:
861 - mutex_unlock(&moxa_openlock);
862 --
863 - return retval;
864 - }
865 -
866 -diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
867 -index d2e93e3..2e99158 100644
868 ---- a/drivers/char/n_r3964.c
869 -+++ b/drivers/char/n_r3964.c
870 -@@ -1062,7 +1062,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
871 - struct r3964_client_info *pClient;
872 - struct r3964_message *pMsg;
873 - struct r3964_client_message theMsg;
874 -- int count;
875 -+ int ret;
876 -
877 - TRACE_L("read()");
878 -
879 -@@ -1074,8 +1074,8 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
880 - if (pMsg == NULL) {
881 - /* no messages available. */
882 - if (file->f_flags & O_NONBLOCK) {
883 -- unlock_kernel();
884 -- return -EAGAIN;
885 -+ ret = -EAGAIN;
886 -+ goto unlock;
887 - }
888 - /* block until there is a message: */
889 - wait_event_interruptible(pInfo->read_wait,
890 -@@ -1085,29 +1085,31 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
891 - /* If we still haven't got a message, we must have been signalled */
892 -
893 - if (!pMsg) {
894 -- unlock_kernel();
895 -- return -EINTR;
896 -+ ret = -EINTR;
897 -+ goto unlock;
898 - }
899 -
900 - /* deliver msg to client process: */
901 - theMsg.msg_id = pMsg->msg_id;
902 - theMsg.arg = pMsg->arg;
903 - theMsg.error_code = pMsg->error_code;
904 -- count = sizeof(struct r3964_client_message);
905 -+ ret = sizeof(struct r3964_client_message);
906 -
907 - kfree(pMsg);
908 - TRACE_M("r3964_read - msg kfree %p", pMsg);
909 -
910 -- if (copy_to_user(buf, &theMsg, count)) {
911 -- unlock_kernel();
912 -- return -EFAULT;
913 -+ if (copy_to_user(buf, &theMsg, ret)) {
914 -+ ret = -EFAULT;
915 -+ goto unlock;
916 - }
917 -
918 -- TRACE_PS("read - return %d", count);
919 -- return count;
920 -+ TRACE_PS("read - return %d", ret);
921 -+ goto unlock;
922 - }
923 -+ ret = -EPERM;
924 -+unlock:
925 - unlock_kernel();
926 -- return -EPERM;
927 -+ return ret;
928 - }
929 -
930 - static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
931 -diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
932 -index dbb9125..881934c 100644
933 ---- a/drivers/char/pcmcia/cm4000_cs.c
934 -+++ b/drivers/char/pcmcia/cm4000_cs.c
935 -@@ -1575,7 +1575,8 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
936 - clear_bit(LOCK_IO, &dev->flags);
937 - wake_up_interruptible(&dev->ioq);
938 -
939 -- return 0;
940 -+ rc = 0;
941 -+ break;
942 - case CM_IOCSPTS:
943 - {
944 - struct ptsreq krnptsreq;
945 -diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
946 -index f59fc5c..3fa7234 100644
947 ---- a/drivers/char/rocket.c
948 -+++ b/drivers/char/rocket.c
949 -@@ -934,7 +934,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
950 - /*
951 - * Info->count is now 1; so it's safe to sleep now.
952 - */
953 -- if (!test_bit(ASYNC_INITIALIZED, &port->flags)) {
954 -+ if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
955 - cp = &info->channel;
956 - sSetRxTrigger(cp, TRIG_1);
957 - if (sGetChanStatus(cp) & CD_ACT)
958 -@@ -958,7 +958,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
959 - sEnRxFIFO(cp);
960 - sEnTransmit(cp);
961 -
962 -- set_bit(ASYNC_INITIALIZED, &info->port.flags);
963 -+ set_bit(ASYNCB_INITIALIZED, &info->port.flags);
964 -
965 - /*
966 - * Set up the tty->alt_speed kludge
967 -@@ -1641,7 +1641,7 @@ static int rp_write(struct tty_struct *tty,
968 - /* Write remaining data into the port's xmit_buf */
969 - while (1) {
970 - /* Hung up ? */
971 -- if (!test_bit(ASYNC_NORMAL_ACTIVE, &info->port.flags))
972 -+ if (!test_bit(ASYNCB_NORMAL_ACTIVE, &info->port.flags))
973 - goto end;
974 - c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1);
975 - c = min(c, XMIT_BUF_SIZE - info->xmit_head);
976 -diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
977 -index e6ce632..7539bed 100644
978 ---- a/drivers/char/vt_ioctl.c
979 -+++ b/drivers/char/vt_ioctl.c
980 -@@ -396,7 +396,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
981 - kbd = kbd_table + console;
982 - switch (cmd) {
983 - case TIOCLINUX:
984 -- return tioclinux(tty, arg);
985 -+ ret = tioclinux(tty, arg);
986 -+ break;
987 - case KIOCSOUND:
988 - if (!perm)
989 - goto eperm;
990 -diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
991 -index 05aa2d4..d5ea8a6 100644
992 ---- a/drivers/firmware/memmap.c
993 -+++ b/drivers/firmware/memmap.c
994 -@@ -31,8 +31,12 @@
995 - * information is necessary as for the resource tree.
996 - */
997 - struct firmware_map_entry {
998 -- resource_size_t start; /* start of the memory range */
999 -- resource_size_t end; /* end of the memory range (incl.) */
1000 -+ /*
1001 -+ * start and end must be u64 rather than resource_size_t, because e820
1002 -+ * resources can lie at addresses above 4G.
1003 -+ */
1004 -+ u64 start; /* start of the memory range */
1005 -+ u64 end; /* end of the memory range (incl.) */
1006 - const char *type; /* type of the memory range */
1007 - struct list_head list; /* entry for the linked list */
1008 - struct kobject kobj; /* kobject for each entry */
1009 -@@ -101,7 +105,7 @@ static LIST_HEAD(map_entries);
1010 - * Common implementation of firmware_map_add() and firmware_map_add_early()
1011 - * which expects a pre-allocated struct firmware_map_entry.
1012 - **/
1013 --static int firmware_map_add_entry(resource_size_t start, resource_size_t end,
1014 -+static int firmware_map_add_entry(u64 start, u64 end,
1015 - const char *type,
1016 - struct firmware_map_entry *entry)
1017 - {
1018 -@@ -132,8 +136,7 @@ static int firmware_map_add_entry(resource_size_t start, resource_size_t end,
1019 - *
1020 - * Returns 0 on success, or -ENOMEM if no memory could be allocated.
1021 - **/
1022 --int firmware_map_add(resource_size_t start, resource_size_t end,
1023 -- const char *type)
1024 -+int firmware_map_add(u64 start, u64 end, const char *type)
1025 - {
1026 - struct firmware_map_entry *entry;
1027 -
1028 -@@ -157,8 +160,7 @@ int firmware_map_add(resource_size_t start, resource_size_t end,
1029 - *
1030 - * Returns 0 on success, or -ENOMEM if no memory could be allocated.
1031 - **/
1032 --int __init firmware_map_add_early(resource_size_t start, resource_size_t end,
1033 -- const char *type)
1034 -+int __init firmware_map_add_early(u64 start, u64 end, const char *type)
1035 - {
1036 - struct firmware_map_entry *entry;
1037 -
1038 -diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
1039 -index 98560e1..e3cb402 100644
1040 ---- a/drivers/gpu/drm/i915/i915_drv.c
1041 -+++ b/drivers/gpu/drm/i915/i915_drv.c
1042 -@@ -67,8 +67,6 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
1043 -
1044 - pci_save_state(dev->pdev);
1045 -
1046 -- i915_save_state(dev);
1047 --
1048 - /* If KMS is active, we do the leavevt stuff here */
1049 - if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1050 - if (i915_gem_idle(dev))
1051 -@@ -77,6 +75,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
1052 - drm_irq_uninstall(dev);
1053 - }
1054 -
1055 -+ i915_save_state(dev);
1056 -+
1057 - intel_opregion_free(dev, 1);
1058 -
1059 - if (state.event == PM_EVENT_SUSPEND) {
1060 -diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
1061 -index 925eb9e..6368f57 100644
1062 ---- a/drivers/ide/ide-cd.c
1063 -+++ b/drivers/ide/ide-cd.c
1064 -@@ -758,7 +758,7 @@ out_end:
1065 - rq->errors = -EIO;
1066 - }
1067 -
1068 -- if (uptodate == 0)
1069 -+ if (uptodate == 0 && rq->bio)
1070 - ide_cd_error_cmd(drive, cmd);
1071 -
1072 - /* make sure it's fully ended */
1073 -diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
1074 -index 20724ae..c4a0264 100644
1075 ---- a/drivers/infiniband/hw/mlx4/qp.c
1076 -+++ b/drivers/infiniband/hw/mlx4/qp.c
1077 -@@ -1585,12 +1585,16 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1078 - break;
1079 -
1080 - case IB_WR_LOCAL_INV:
1081 -+ ctrl->srcrb_flags |=
1082 -+ cpu_to_be32(MLX4_WQE_CTRL_STRONG_ORDER);
1083 - set_local_inv_seg(wqe, wr->ex.invalidate_rkey);
1084 - wqe += sizeof (struct mlx4_wqe_local_inval_seg);
1085 - size += sizeof (struct mlx4_wqe_local_inval_seg) / 16;
1086 - break;
1087 -
1088 - case IB_WR_FAST_REG_MR:
1089 -+ ctrl->srcrb_flags |=
1090 -+ cpu_to_be32(MLX4_WQE_CTRL_STRONG_ORDER);
1091 - set_fmr_seg(wqe, wr);
1092 - wqe += sizeof (struct mlx4_wqe_fmr_seg);
1093 - size += sizeof (struct mlx4_wqe_fmr_seg) / 16;
1094 -diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
1095 -index f126566..3d337d9 100644
1096 ---- a/drivers/isdn/hisax/hfc_pci.c
1097 -+++ b/drivers/isdn/hisax/hfc_pci.c
1098 -@@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
1099 - Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
1100 - pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
1101 - del_timer(&cs->hw.hfcpci.timer);
1102 -- kfree(cs->hw.hfcpci.share_start);
1103 -- cs->hw.hfcpci.share_start = NULL;
1104 -+ pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
1105 -+ cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1106 -+ cs->hw.hfcpci.fifos = NULL;
1107 - iounmap((void *)cs->hw.hfcpci.pci_io);
1108 - }
1109 -
1110 -@@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
1111 - dev_hfcpci);
1112 - i++;
1113 - if (tmp_hfcpci) {
1114 -+ dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
1115 - if (pci_enable_device(tmp_hfcpci))
1116 - continue;
1117 -+ if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
1118 -+ printk(KERN_WARNING
1119 -+ "HiSax hfc_pci: No suitable DMA available.\n");
1120 -+ continue;
1121 -+ }
1122 -+ if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
1123 -+ printk(KERN_WARNING
1124 -+ "HiSax hfc_pci: No suitable consistent DMA available.\n");
1125 -+ continue;
1126 -+ }
1127 - pci_set_master(tmp_hfcpci);
1128 - if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1129 - continue;
1130 -@@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
1131 - printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1132 - return (0);
1133 - }
1134 -+
1135 - /* Allocate memory for FIFOS */
1136 -- /* Because the HFC-PCI needs a 32K physical alignment, we */
1137 -- /* need to allocate the double mem and align the address */
1138 -- if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
1139 -- printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
1140 -+ cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
1141 -+ 0x8000, &cs->hw.hfcpci.dma);
1142 -+ if (!cs->hw.hfcpci.fifos) {
1143 -+ printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
1144 -+ return 0;
1145 -+ }
1146 -+ if (cs->hw.hfcpci.dma & 0x7fff) {
1147 -+ printk(KERN_WARNING
1148 -+ "HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
1149 -+ (u_long)cs->hw.hfcpci.dma);
1150 -+ pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
1151 -+ cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1152 - return 0;
1153 - }
1154 -- cs->hw.hfcpci.fifos = (void *)
1155 -- (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
1156 -- pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
1157 -+ pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
1158 - cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
1159 - printk(KERN_INFO
1160 -- "HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
1161 -+ "HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
1162 - cs->hw.hfcpci.pci_io,
1163 - cs->hw.hfcpci.fifos,
1164 -- (u_int) virt_to_bus(cs->hw.hfcpci.fifos),
1165 -+ (u_long)cs->hw.hfcpci.dma,
1166 - cs->irq, HZ);
1167 -
1168 - spin_lock_irqsave(&cs->lock, flags);
1169 -diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h
1170 -index f852704..0685c19 100644
1171 ---- a/drivers/isdn/hisax/hisax.h
1172 -+++ b/drivers/isdn/hisax/hisax.h
1173 -@@ -703,7 +703,7 @@ struct hfcPCI_hw {
1174 - int nt_timer;
1175 - struct pci_dev *dev;
1176 - unsigned char *pci_io; /* start of PCI IO memory */
1177 -- void *share_start; /* shared memory for Fifos start */
1178 -+ dma_addr_t dma; /* dma handle for Fifos */
1179 - void *fifos; /* FIFO memory */
1180 - int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
1181 - struct timer_list timer;
1182 -diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
1183 -index a2e26c2..14ce11e 100644
1184 ---- a/drivers/md/dm-exception-store.c
1185 -+++ b/drivers/md/dm-exception-store.c
1186 -@@ -195,7 +195,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1187 - struct dm_exception_store **store)
1188 - {
1189 - int r = 0;
1190 -- struct dm_exception_store_type *type;
1191 -+ struct dm_exception_store_type *type = NULL;
1192 - struct dm_exception_store *tmp_store;
1193 - char persistent;
1194 -
1195 -@@ -211,12 +211,15 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1196 - }
1197 -
1198 - persistent = toupper(*argv[1]);
1199 -- if (persistent != 'P' && persistent != 'N') {
1200 -+ if (persistent == 'P')
1201 -+ type = get_type("P");
1202 -+ else if (persistent == 'N')
1203 -+ type = get_type("N");
1204 -+ else {
1205 - ti->error = "Persistent flag is not P or N";
1206 - return -EINVAL;
1207 - }
1208 -
1209 -- type = get_type(argv[1]);
1210 - if (!type) {
1211 - ti->error = "Exception store type not recognised";
1212 - r = -EINVAL;
1213 -diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
1214 -index 0a2e6e7..96a796b 100644
1215 ---- a/drivers/md/dm-exception-store.h
1216 -+++ b/drivers/md/dm-exception-store.h
1217 -@@ -156,7 +156,7 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e)
1218 - */
1219 - static inline sector_t get_dev_size(struct block_device *bdev)
1220 - {
1221 -- return bdev->bd_inode->i_size >> SECTOR_SHIFT;
1222 -+ return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT;
1223 - }
1224 -
1225 - static inline chunk_t sector_to_chunk(struct dm_exception_store *store,
1226 -diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
1227 -index be233bc..5eaa954 100644
1228 ---- a/drivers/md/dm-log.c
1229 -+++ b/drivers/md/dm-log.c
1230 -@@ -415,7 +415,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
1231 - buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
1232 - bitset_size, ti->limits.hardsect_size);
1233 -
1234 -- if (buf_size > dev->bdev->bd_inode->i_size) {
1235 -+ if (buf_size > i_size_read(dev->bdev->bd_inode)) {
1236 - DMWARN("log device %s too small: need %llu bytes",
1237 - dev->name, (unsigned long long)buf_size);
1238 - kfree(lc);
1239 -diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
1240 -index 6a386ab..3a8f827 100644
1241 ---- a/drivers/md/dm-mpath.c
1242 -+++ b/drivers/md/dm-mpath.c
1243 -@@ -553,6 +553,12 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg,
1244 - return -EINVAL;
1245 - }
1246 -
1247 -+ if (ps_argc > as->argc) {
1248 -+ dm_put_path_selector(pst);
1249 -+ ti->error = "not enough arguments for path selector";
1250 -+ return -EINVAL;
1251 -+ }
1252 -+
1253 - r = pst->create(&pg->ps, ps_argc, as->argv);
1254 - if (r) {
1255 - dm_put_path_selector(pst);
1256 -@@ -699,6 +705,11 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m)
1257 - if (!hw_argc)
1258 - return 0;
1259 -
1260 -+ if (hw_argc > as->argc) {
1261 -+ ti->error = "not enough arguments for hardware handler";
1262 -+ return -EINVAL;
1263 -+ }
1264 -+
1265 - m->hw_handler_name = kstrdup(shift(as), GFP_KERNEL);
1266 - request_module("scsi_dh_%s", m->hw_handler_name);
1267 - if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
1268 -@@ -836,6 +847,7 @@ static void multipath_dtr(struct dm_target *ti)
1269 -
1270 - flush_workqueue(kmpath_handlerd);
1271 - flush_workqueue(kmultipathd);
1272 -+ flush_scheduled_work();
1273 - free_multipath(m);
1274 - }
1275 -
1276 -diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
1277 -index 429b50b..c5c4a0d 100644
1278 ---- a/drivers/md/dm-table.c
1279 -+++ b/drivers/md/dm-table.c
1280 -@@ -387,7 +387,8 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
1281 - static int check_device_area(struct dm_dev_internal *dd, sector_t start,
1282 - sector_t len)
1283 - {
1284 -- sector_t dev_size = dd->dm_dev.bdev->bd_inode->i_size >> SECTOR_SHIFT;
1285 -+ sector_t dev_size = i_size_read(dd->dm_dev.bdev->bd_inode) >>
1286 -+ SECTOR_SHIFT;
1287 -
1288 - if (!dev_size)
1289 - return 1;
1290 -diff --git a/drivers/md/dm.c b/drivers/md/dm.c
1291 -index 424f7b0..add49c1 100644
1292 ---- a/drivers/md/dm.c
1293 -+++ b/drivers/md/dm.c
1294 -@@ -1780,6 +1780,10 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
1295 - if (&md->kobj != kobj)
1296 - return NULL;
1297 -
1298 -+ if (test_bit(DMF_FREEING, &md->flags) ||
1299 -+ test_bit(DMF_DELETING, &md->flags))
1300 -+ return NULL;
1301 -+
1302 - dm_get(md);
1303 - return md;
1304 - }
1305 -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1306 -index bb37fb1..c0434e0 100644
1307 ---- a/drivers/md/raid5.c
1308 -+++ b/drivers/md/raid5.c
1309 -@@ -3696,6 +3696,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
1310 - spin_unlock_irq(&conf->device_lock);
1311 - if (must_retry) {
1312 - release_stripe(sh);
1313 -+ schedule();
1314 - goto retry;
1315 - }
1316 - }
1317 -diff --git a/drivers/media/dvb/frontends/lgdt3305.c b/drivers/media/dvb/frontends/lgdt3305.c
1318 -index d92d055..fde8c59 100644
1319 ---- a/drivers/media/dvb/frontends/lgdt3305.c
1320 -+++ b/drivers/media/dvb/frontends/lgdt3305.c
1321 -@@ -19,6 +19,7 @@
1322 - *
1323 - */
1324 -
1325 -+#include <asm/div64.h>
1326 - #include <linux/dvb/frontend.h>
1327 - #include "dvb_math.h"
1328 - #include "lgdt3305.h"
1329 -@@ -496,27 +497,15 @@ static int lgdt3305_set_if(struct lgdt3305_state *state,
1330 -
1331 - nco = if_freq_khz / 10;
1332 -
1333 --#define LGDT3305_64BIT_DIVISION_ENABLED 0
1334 -- /* FIXME: 64bit division disabled to avoid linking error:
1335 -- * WARNING: "__udivdi3" [lgdt3305.ko] undefined!
1336 -- */
1337 - switch (param->u.vsb.modulation) {
1338 - case VSB_8:
1339 --#if LGDT3305_64BIT_DIVISION_ENABLED
1340 - nco <<= 24;
1341 -- nco /= 625;
1342 --#else
1343 -- nco *= ((1 << 24) / 625);
1344 --#endif
1345 -+ do_div(nco, 625);
1346 - break;
1347 - case QAM_64:
1348 - case QAM_256:
1349 --#if LGDT3305_64BIT_DIVISION_ENABLED
1350 - nco <<= 28;
1351 -- nco /= 625;
1352 --#else
1353 -- nco *= ((1 << 28) / 625);
1354 --#endif
1355 -+ do_div(nco, 625);
1356 - break;
1357 - default:
1358 - return -EINVAL;
1359 -diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
1360 -index 3f1a035..448c306 100644
1361 ---- a/drivers/media/video/Makefile
1362 -+++ b/drivers/media/video/Makefile
1363 -@@ -12,6 +12,8 @@ omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o
1364 -
1365 - videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o
1366 -
1367 -+# V4L2 core modules
1368 -+
1369 - obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o
1370 - ifeq ($(CONFIG_COMPAT),y)
1371 - obj-$(CONFIG_VIDEO_DEV) += v4l2-compat-ioctl32.o
1372 -@@ -23,21 +25,15 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y)
1373 - obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o
1374 - endif
1375 -
1376 --obj-$(CONFIG_VIDEO_TUNER) += tuner.o
1377 -+# All i2c modules must come first:
1378 -
1379 --obj-$(CONFIG_VIDEO_BT848) += bt8xx/
1380 --obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
1381 -+obj-$(CONFIG_VIDEO_TUNER) += tuner.o
1382 - obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
1383 - obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
1384 - obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
1385 --
1386 - obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
1387 - obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o
1388 - obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o
1389 --obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o
1390 --obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o
1391 --obj-$(CONFIG_VIDEO_W9966) += w9966.o
1392 --
1393 - obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
1394 - obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
1395 - obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o
1396 -@@ -54,11 +50,40 @@ obj-$(CONFIG_VIDEO_BT819) += bt819.o
1397 - obj-$(CONFIG_VIDEO_BT856) += bt856.o
1398 - obj-$(CONFIG_VIDEO_BT866) += bt866.o
1399 - obj-$(CONFIG_VIDEO_KS0127) += ks0127.o
1400 -+obj-$(CONFIG_VIDEO_VINO) += indycam.o
1401 -+obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
1402 -+obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
1403 -+obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
1404 -+obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
1405 -+obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
1406 -+obj-$(CONFIG_VIDEO_M52790) += m52790.o
1407 -+obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o
1408 -+obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
1409 -+obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
1410 -+obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
1411 -+obj-$(CONFIG_VIDEO_CX25840) += cx25840/
1412 -+obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
1413 -+obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
1414 -+obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
1415 -+obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
1416 -+obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
1417 -
1418 --obj-$(CONFIG_VIDEO_ZORAN) += zoran/
1419 -+obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
1420 -+obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
1421 -+obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
1422 -+obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
1423 -+obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
1424 -+obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
1425 -
1426 -+# And now the v4l2 drivers:
1427 -+
1428 -+obj-$(CONFIG_VIDEO_BT848) += bt8xx/
1429 -+obj-$(CONFIG_VIDEO_ZORAN) += zoran/
1430 -+obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o
1431 -+obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o
1432 -+obj-$(CONFIG_VIDEO_W9966) += w9966.o
1433 - obj-$(CONFIG_VIDEO_PMS) += pms.o
1434 --obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o
1435 -+obj-$(CONFIG_VIDEO_VINO) += vino.o
1436 - obj-$(CONFIG_VIDEO_STRADIS) += stradis.o
1437 - obj-$(CONFIG_VIDEO_CPIA) += cpia.o
1438 - obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o
1439 -@@ -69,17 +94,7 @@ obj-$(CONFIG_VIDEO_CX88) += cx88/
1440 - obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
1441 - obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
1442 - obj-$(CONFIG_VIDEO_USBVISION) += usbvision/
1443 --obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
1444 --obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
1445 - obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/
1446 --obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
1447 --obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
1448 --obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
1449 --obj-$(CONFIG_VIDEO_M52790) += m52790.o
1450 --obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o
1451 --obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
1452 --obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
1453 --obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
1454 - obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/
1455 - obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
1456 - obj-$(CONFIG_VIDEO_MXB) += mxb.o
1457 -@@ -92,19 +107,12 @@ obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
1458 - obj-$(CONFIG_VIDEOBUF_VMALLOC) += videobuf-vmalloc.o
1459 - obj-$(CONFIG_VIDEOBUF_DVB) += videobuf-dvb.o
1460 - obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o
1461 --obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
1462 -
1463 - obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
1464 -
1465 --obj-$(CONFIG_VIDEO_CX25840) += cx25840/
1466 --obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
1467 --obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
1468 - obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
1469 -
1470 - obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o
1471 --obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
1472 --
1473 --obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
1474 -
1475 - obj-$(CONFIG_USB_DABUSB) += dabusb.o
1476 - obj-$(CONFIG_USB_OV511) += ov511.o
1477 -@@ -134,24 +142,21 @@ obj-$(CONFIG_VIDEO_CX18) += cx18/
1478 - obj-$(CONFIG_VIDEO_VIVI) += vivi.o
1479 - obj-$(CONFIG_VIDEO_CX23885) += cx23885/
1480 -
1481 -+obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o
1482 -+obj-$(CONFIG_SOC_CAMERA) += soc_camera.o
1483 -+obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o
1484 -+# soc-camera host drivers have to be linked after camera drivers
1485 - obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o
1486 - obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
1487 - obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
1488 - obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
1489 --obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o
1490 --obj-$(CONFIG_SOC_CAMERA) += soc_camera.o
1491 --obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
1492 --obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
1493 --obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
1494 --obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
1495 --obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
1496 --obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o
1497 --obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
1498 -
1499 - obj-$(CONFIG_VIDEO_AU0828) += au0828/
1500 -
1501 - obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
1502 -
1503 -+obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
1504 -+
1505 - EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
1506 - EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
1507 - EXTRA_CFLAGS += -Idrivers/media/common/tuners
1508 -diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
1509 -index 82fc2f9..3783b49 100644
1510 ---- a/drivers/media/video/cx18/cx18-controls.c
1511 -+++ b/drivers/media/video/cx18/cx18-controls.c
1512 -@@ -61,6 +61,8 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
1513 -
1514 - switch (qctrl->id) {
1515 - /* Standard V4L2 controls */
1516 -+ case V4L2_CID_USER_CLASS:
1517 -+ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1518 - case V4L2_CID_BRIGHTNESS:
1519 - case V4L2_CID_HUE:
1520 - case V4L2_CID_SATURATION:
1521 -diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
1522 -index 8ded529..4c8e958 100644
1523 ---- a/drivers/media/video/cx2341x.c
1524 -+++ b/drivers/media/video/cx2341x.c
1525 -@@ -500,6 +500,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
1526 - int err;
1527 -
1528 - switch (qctrl->id) {
1529 -+ case V4L2_CID_MPEG_CLASS:
1530 -+ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1531 - case V4L2_CID_MPEG_STREAM_TYPE:
1532 - return v4l2_ctrl_query_fill(qctrl,
1533 - V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
1534 -diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
1535 -index 84995bc..a3b77ed 100644
1536 ---- a/drivers/media/video/ivtv/ivtv-controls.c
1537 -+++ b/drivers/media/video/ivtv/ivtv-controls.c
1538 -@@ -60,6 +60,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
1539 -
1540 - switch (qctrl->id) {
1541 - /* Standard V4L2 controls */
1542 -+ case V4L2_CID_USER_CLASS:
1543 -+ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1544 - case V4L2_CID_BRIGHTNESS:
1545 - case V4L2_CID_HUE:
1546 - case V4L2_CID_SATURATION:
1547 -diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1548 -index add3395..c5563cf 100644
1549 ---- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1550 -+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1551 -@@ -1978,6 +1978,34 @@ static unsigned int pvr2_copy_i2c_addr_list(
1552 - }
1553 -
1554 -
1555 -+static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw)
1556 -+{
1557 -+ /*
1558 -+ Mike Isely <isely@×××××.com> 19-Nov-2006 - This bit of nuttiness
1559 -+ for cx25840 causes that module to correctly set up its video
1560 -+ scaling. This is really a problem in the cx25840 module itself,
1561 -+ but we work around it here. The problem has not been seen in
1562 -+ ivtv because there VBI is supported and set up. We don't do VBI
1563 -+ here (at least not yet) and thus we never attempted to even set
1564 -+ it up.
1565 -+ */
1566 -+ struct v4l2_format fmt;
1567 -+ if (hdw->decoder_client_id != PVR2_CLIENT_ID_CX25840) {
1568 -+ /* We're not using a cx25840 so don't enable the hack */
1569 -+ return;
1570 -+ }
1571 -+
1572 -+ pvr2_trace(PVR2_TRACE_INIT,
1573 -+ "Module ID %u:"
1574 -+ " Executing cx25840 VBI hack",
1575 -+ hdw->decoder_client_id);
1576 -+ memset(&fmt, 0, sizeof(fmt));
1577 -+ fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
1578 -+ v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
1579 -+ video, s_fmt, &fmt);
1580 -+}
1581 -+
1582 -+
1583 - static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1584 - const struct pvr2_device_client_desc *cd)
1585 - {
1586 -@@ -2069,30 +2097,6 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1587 - /* client-specific setup... */
1588 - switch (mid) {
1589 - case PVR2_CLIENT_ID_CX25840:
1590 -- hdw->decoder_client_id = mid;
1591 -- {
1592 -- /*
1593 -- Mike Isely <isely@×××××.com> 19-Nov-2006 - This
1594 -- bit of nuttiness for cx25840 causes that module
1595 -- to correctly set up its video scaling. This is
1596 -- really a problem in the cx25840 module itself,
1597 -- but we work around it here. The problem has not
1598 -- been seen in ivtv because there VBI is supported
1599 -- and set up. We don't do VBI here (at least not
1600 -- yet) and thus we never attempted to even set it
1601 -- up.
1602 -- */
1603 -- struct v4l2_format fmt;
1604 -- pvr2_trace(PVR2_TRACE_INIT,
1605 -- "Module ID %u:"
1606 -- " Executing cx25840 VBI hack",
1607 -- mid);
1608 -- memset(&fmt, 0, sizeof(fmt));
1609 -- fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
1610 -- v4l2_device_call_all(&hdw->v4l2_dev, mid,
1611 -- video, s_fmt, &fmt);
1612 -- }
1613 -- break;
1614 - case PVR2_CLIENT_ID_SAA7115:
1615 - hdw->decoder_client_id = mid;
1616 - break;
1617 -@@ -2193,6 +2197,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
1618 - cptr->info->set_value(cptr,~0,cptr->info->default_value);
1619 - }
1620 -
1621 -+ pvr2_hdw_cx25840_vbi_hack(hdw);
1622 -+
1623 - /* Set up special default values for the television and radio
1624 - frequencies here. It's not really important what these defaults
1625 - are, but I set them to something usable in the Chicago area just
1626 -@@ -2944,6 +2950,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
1627 - vs = hdw->std_mask_cur;
1628 - v4l2_device_call_all(&hdw->v4l2_dev, 0,
1629 - core, s_std, vs);
1630 -+ pvr2_hdw_cx25840_vbi_hack(hdw);
1631 - }
1632 - hdw->tuner_signal_stale = !0;
1633 - hdw->cropcap_stale = !0;
1634 -@@ -4066,6 +4073,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
1635 - if (hdw->decoder_client_id) {
1636 - v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
1637 - core, reset, 0);
1638 -+ pvr2_hdw_cx25840_vbi_hack(hdw);
1639 - return 0;
1640 - }
1641 - pvr2_trace(PVR2_TRACE_INIT,
1642 -diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
1643 -index 3dbaa19..604158a 100644
1644 ---- a/drivers/media/video/saa7134/Makefile
1645 -+++ b/drivers/media/video/saa7134/Makefile
1646 -@@ -3,8 +3,7 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \
1647 - saa7134-ts.o saa7134-tvaudio.o saa7134-vbi.o \
1648 - saa7134-video.o saa7134-input.o
1649 -
1650 --obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \
1651 -- saa6752hs.o
1652 -+obj-$(CONFIG_VIDEO_SAA7134) += saa6752hs.o saa7134.o saa7134-empress.o
1653 -
1654 - obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o
1655 -
1656 -diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
1657 -index d287315..cd95093 100644
1658 ---- a/drivers/net/bonding/bond_sysfs.c
1659 -+++ b/drivers/net/bonding/bond_sysfs.c
1660 -@@ -1538,6 +1538,7 @@ int bond_create_sysfs(void)
1661 - printk(KERN_ERR
1662 - "network device named %s already exists in sysfs",
1663 - class_attr_bonding_masters.attr.name);
1664 -+ ret = 0;
1665 - }
1666 -
1667 - return ret;
1668 -diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
1669 -index ca82f19..42055a5 100644
1670 ---- a/drivers/net/e1000e/netdev.c
1671 -+++ b/drivers/net/e1000e/netdev.c
1672 -@@ -1996,7 +1996,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1673 - struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
1674 - struct e1000_hw *hw = &adapter->hw;
1675 - struct net_device *poll_dev = adapter->netdev;
1676 -- int tx_cleaned = 0, work_done = 0;
1677 -+ int tx_cleaned = 1, work_done = 0;
1678 -
1679 - adapter = netdev_priv(poll_dev);
1680 -
1681 -diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
1682 -index 6bb5af3..305e0d1 100644
1683 ---- a/drivers/net/mv643xx_eth.c
1684 -+++ b/drivers/net/mv643xx_eth.c
1685 -@@ -1751,12 +1751,12 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
1686 -
1687 - uc_addr_set(mp, dev->dev_addr);
1688 -
1689 -- port_config = rdlp(mp, PORT_CONFIG);
1690 -+ port_config = rdlp(mp, PORT_CONFIG) & ~UNICAST_PROMISCUOUS_MODE;
1691 -+
1692 - nibbles = uc_addr_filter_mask(dev);
1693 - if (!nibbles) {
1694 - port_config |= UNICAST_PROMISCUOUS_MODE;
1695 -- wrlp(mp, PORT_CONFIG, port_config);
1696 -- return;
1697 -+ nibbles = 0xffff;
1698 - }
1699 -
1700 - for (i = 0; i < 16; i += 4) {
1701 -@@ -1777,7 +1777,6 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
1702 - wrl(mp, off, v);
1703 - }
1704 -
1705 -- port_config &= ~UNICAST_PROMISCUOUS_MODE;
1706 - wrlp(mp, PORT_CONFIG, port_config);
1707 - }
1708 -
1709 -diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
1710 -index a2ff9cb..6714a9d 100644
1711 ---- a/drivers/net/sky2.c
1712 -+++ b/drivers/net/sky2.c
1713 -@@ -4365,6 +4365,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
1714 - goto err_out;
1715 - }
1716 -
1717 -+ /* Get configuration information
1718 -+ * Note: only regular PCI config access once to test for HW issues
1719 -+ * other PCI access through shared memory for speed and to
1720 -+ * avoid MMCONFIG problems.
1721 -+ */
1722 -+ err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
1723 -+ if (err) {
1724 -+ dev_err(&pdev->dev, "PCI read config failed\n");
1725 -+ goto err_out;
1726 -+ }
1727 -+
1728 -+ if (~reg == 0) {
1729 -+ dev_err(&pdev->dev, "PCI configuration read error\n");
1730 -+ goto err_out;
1731 -+ }
1732 -+
1733 - err = pci_request_regions(pdev, DRV_NAME);
1734 - if (err) {
1735 - dev_err(&pdev->dev, "cannot obtain PCI resources\n");
1736 -@@ -4390,21 +4406,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
1737 - }
1738 - }
1739 -
1740 -- /* Get configuration information
1741 -- * Note: only regular PCI config access once to test for HW issues
1742 -- * other PCI access through shared memory for speed and to
1743 -- * avoid MMCONFIG problems.
1744 -- */
1745 -- err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
1746 -- if (err) {
1747 -- dev_err(&pdev->dev, "PCI read config failed\n");
1748 -- goto err_out_free_regions;
1749 -- }
1750 --
1751 -- /* size of available VPD, only impact sysfs */
1752 -- err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
1753 -- if (err)
1754 -- dev_warn(&pdev->dev, "Can't set VPD size\n");
1755 -
1756 - #ifdef __BIG_ENDIAN
1757 - /* The sk98lin vendor driver uses hardware byte swapping but
1758 -diff --git a/drivers/net/tun.c b/drivers/net/tun.c
1759 -index 735bf41..1be6a6b 100644
1760 ---- a/drivers/net/tun.c
1761 -+++ b/drivers/net/tun.c
1762 -@@ -1275,21 +1275,22 @@ static int tun_chr_open(struct inode *inode, struct file * file)
1763 - static int tun_chr_close(struct inode *inode, struct file *file)
1764 - {
1765 - struct tun_file *tfile = file->private_data;
1766 -- struct tun_struct *tun = __tun_get(tfile);
1767 -+ struct tun_struct *tun;
1768 -
1769 -
1770 -+ rtnl_lock();
1771 -+ tun = __tun_get(tfile);
1772 - if (tun) {
1773 - DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name);
1774 -
1775 -- rtnl_lock();
1776 - __tun_detach(tun);
1777 -
1778 - /* If desireable, unregister the netdevice. */
1779 - if (!(tun->flags & TUN_PERSIST))
1780 - unregister_netdevice(tun->dev);
1781 -
1782 -- rtnl_unlock();
1783 - }
1784 -+ rtnl_unlock();
1785 -
1786 - tun = tfile->tun;
1787 - if (tun)
1788 -diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
1789 -index 2138535..73acbd2 100644
1790 ---- a/drivers/net/usb/pegasus.c
1791 -+++ b/drivers/net/usb/pegasus.c
1792 -@@ -297,7 +297,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
1793 -
1794 - pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
1795 - pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
1796 -- pegasus->dr.wValue = 0;
1797 -+ pegasus->dr.wValue = cpu_to_le16(0);
1798 - pegasus->dr.wIndex = cpu_to_le16(EthCtrl0);
1799 - pegasus->dr.wLength = cpu_to_le16(3);
1800 - pegasus->ctrl_urb->transfer_buffer_length = 3;
1801 -@@ -446,11 +446,12 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
1802 - int i;
1803 - __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
1804 - int ret;
1805 -+ __le16 le_data = cpu_to_le16(data);
1806 -
1807 - set_registers(pegasus, EpromOffset, 4, d);
1808 - enable_eprom_write(pegasus);
1809 - set_register(pegasus, EpromOffset, index);
1810 -- set_registers(pegasus, EpromData, 2, &data);
1811 -+ set_registers(pegasus, EpromData, 2, &le_data);
1812 - set_register(pegasus, EpromCtrl, EPROM_WRITE);
1813 -
1814 - for (i = 0; i < REG_TIMEOUT; i++) {
1815 -@@ -923,29 +924,32 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
1816 -
1817 - static inline void disable_net_traffic(pegasus_t * pegasus)
1818 - {
1819 -- int tmp = 0;
1820 -+ __le16 tmp = cpu_to_le16(0);
1821 -
1822 -- set_registers(pegasus, EthCtrl0, 2, &tmp);
1823 -+ set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
1824 - }
1825 -
1826 - static inline void get_interrupt_interval(pegasus_t * pegasus)
1827 - {
1828 -- __u8 data[2];
1829 -+ u16 data;
1830 -+ u8 interval;
1831 -
1832 -- read_eprom_word(pegasus, 4, (__u16 *) data);
1833 -+ read_eprom_word(pegasus, 4, &data);
1834 -+ interval = data >> 8;
1835 - if (pegasus->usb->speed != USB_SPEED_HIGH) {
1836 -- if (data[1] < 0x80) {
1837 -+ if (interval < 0x80) {
1838 - if (netif_msg_timer(pegasus))
1839 - dev_info(&pegasus->intf->dev, "intr interval "
1840 - "changed from %ums to %ums\n",
1841 -- data[1], 0x80);
1842 -- data[1] = 0x80;
1843 -+ interval, 0x80);
1844 -+ interval = 0x80;
1845 -+ data = (data & 0x00FF) | ((u16)interval << 8);
1846 - #ifdef PEGASUS_WRITE_EEPROM
1847 -- write_eprom_word(pegasus, 4, *(__u16 *) data);
1848 -+ write_eprom_word(pegasus, 4, data);
1849 - #endif
1850 - }
1851 - }
1852 -- pegasus->intr_interval = data[1];
1853 -+ pegasus->intr_interval = interval;
1854 - }
1855 -
1856 - static void set_carrier(struct net_device *net)
1857 -@@ -1299,7 +1303,8 @@ static int pegasus_blacklisted(struct usb_device *udev)
1858 - /* Special quirk to keep the driver from handling the Belkin Bluetooth
1859 - * dongle which happens to have the same ID.
1860 - */
1861 -- if ((udd->idVendor == VENDOR_BELKIN && udd->idProduct == 0x0121) &&
1862 -+ if ((udd->idVendor == cpu_to_le16(VENDOR_BELKIN)) &&
1863 -+ (udd->idProduct == cpu_to_le16(0x0121)) &&
1864 - (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) &&
1865 - (udd->bDeviceProtocol == 1))
1866 - return 1;
1867 -diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
1868 -index 754a4b1..b2816ad 100644
1869 ---- a/drivers/net/via-velocity.c
1870 -+++ b/drivers/net/via-velocity.c
1871 -@@ -1845,7 +1845,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
1872 - */
1873 - if (tdinfo->skb_dma) {
1874 -
1875 -- pktlen = (skb->len > ETH_ZLEN ? : ETH_ZLEN);
1876 -+ pktlen = max_t(unsigned int, skb->len, ETH_ZLEN);
1877 - for (i = 0; i < tdinfo->nskb_dma; i++) {
1878 - #ifdef VELOCITY_ZERO_COPY_SUPPORT
1879 - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
1880 -diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
1881 -index 32df27a..409f022 100644
1882 ---- a/drivers/net/wireless/ath5k/base.c
1883 -+++ b/drivers/net/wireless/ath5k/base.c
1884 -@@ -685,6 +685,13 @@ ath5k_pci_resume(struct pci_dev *pdev)
1885 - if (err)
1886 - return err;
1887 -
1888 -+ /*
1889 -+ * Suspend/Resume resets the PCI configuration space, so we have to
1890 -+ * re-disable the RETRY_TIMEOUT register (0x41) to keep
1891 -+ * PCI Tx retries from interfering with C3 CPU state
1892 -+ */
1893 -+ pci_write_config_byte(pdev, 0x41, 0);
1894 -+
1895 - err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
1896 - if (err) {
1897 - ATH5K_ERR(sc, "request_irq failed\n");
1898 -diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
1899 -index e2d62e9..2117074 100644
1900 ---- a/drivers/net/wireless/ath9k/calib.c
1901 -+++ b/drivers/net/wireless/ath9k/calib.c
1902 -@@ -284,8 +284,8 @@ static bool ath9k_hw_iscal_supported(struct ath_hw *ah,
1903 - return true;
1904 - case ADC_GAIN_CAL:
1905 - case ADC_DC_CAL:
1906 -- if (conf->channel->band == IEEE80211_BAND_5GHZ &&
1907 -- conf_is_ht20(conf))
1908 -+ if (!(conf->channel->band == IEEE80211_BAND_2GHZ &&
1909 -+ conf_is_ht20(conf)))
1910 - return true;
1911 - break;
1912 - }
1913 -@@ -883,7 +883,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
1914 - static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
1915 - {
1916 - REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1917 -- if (chan->channelFlags & CHANNEL_HT20) {
1918 -+ if (IS_CHAN_HT20(chan)) {
1919 - REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE);
1920 - REG_SET_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
1921 - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
1922 -@@ -919,83 +919,66 @@ static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
1923 - return true;
1924 - }
1925 -
1926 --bool ath9k_hw_init_cal(struct ath_hw *ah,
1927 -- struct ath9k_channel *chan)
1928 -+bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
1929 - {
1930 - if (AR_SREV_9285(ah) && AR_SREV_9285_12_OR_LATER(ah)) {
1931 - if (!ar9285_clc(ah, chan))
1932 - return false;
1933 -- } else if (AR_SREV_9280_10_OR_LATER(ah)) {
1934 -- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1935 -- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1936 -- REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1937 -+ } else {
1938 -+ if (AR_SREV_9280_10_OR_LATER(ah)) {
1939 -+ REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1940 -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1941 -+ }
1942 -
1943 -- /* Kick off the cal */
1944 -+ /* Calibrate the AGC */
1945 - REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1946 -- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1947 -- AR_PHY_AGC_CONTROL_CAL);
1948 -+ REG_READ(ah, AR_PHY_AGC_CONTROL) |
1949 -+ AR_PHY_AGC_CONTROL_CAL);
1950 -
1951 -- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
1952 -- AR_PHY_AGC_CONTROL_CAL, 0,
1953 -- AH_WAIT_TIMEOUT)) {
1954 -+ /* Poll for offset calibration complete */
1955 -+ if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1956 -+ 0, AH_WAIT_TIMEOUT)) {
1957 - DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1958 - "offset calibration failed to complete in 1ms; "
1959 - "noisy environment?\n");
1960 - return false;
1961 - }
1962 -
1963 -- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1964 -- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1965 -- REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1966 -- }
1967 --
1968 -- /* Calibrate the AGC */
1969 -- REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1970 -- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1971 -- AR_PHY_AGC_CONTROL_CAL);
1972 --
1973 -- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1974 -- 0, AH_WAIT_TIMEOUT)) {
1975 -- DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1976 -- "offset calibration failed to complete in 1ms; "
1977 -- "noisy environment?\n");
1978 -- return false;
1979 -- }
1980 --
1981 -- if (AR_SREV_9280_10_OR_LATER(ah)) {
1982 -- REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1983 -- REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1984 -+ if (AR_SREV_9280_10_OR_LATER(ah)) {
1985 -+ REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1986 -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1987 -+ }
1988 - }
1989 -
1990 - /* Do PA Calibration */
1991 - if (AR_SREV_9285(ah) && AR_SREV_9285_11_OR_LATER(ah))
1992 - ath9k_hw_9285_pa_cal(ah);
1993 -
1994 -- /* Do NF Calibration */
1995 -+ /* Do NF Calibration after DC offset and other calibrations */
1996 - REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1997 -- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1998 -- AR_PHY_AGC_CONTROL_NF);
1999 -+ REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF);
2000 -
2001 - ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
2002 -
2003 -+ /* Enable IQ, ADC Gain and ADC DC offset CALs */
2004 - if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
2005 - if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
2006 - INIT_CAL(&ah->adcgain_caldata);
2007 - INSERT_CAL(ah, &ah->adcgain_caldata);
2008 - DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
2009 -- "enabling ADC Gain Calibration.\n");
2010 -+ "enabling ADC Gain Calibration.\n");
2011 - }
2012 - if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
2013 - INIT_CAL(&ah->adcdc_caldata);
2014 - INSERT_CAL(ah, &ah->adcdc_caldata);
2015 - DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
2016 -- "enabling ADC DC Calibration.\n");
2017 -+ "enabling ADC DC Calibration.\n");
2018 - }
2019 - if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
2020 - INIT_CAL(&ah->iq_caldata);
2021 - INSERT_CAL(ah, &ah->iq_caldata);
2022 - DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
2023 -- "enabling IQ Calibration.\n");
2024 -+ "enabling IQ Calibration.\n");
2025 - }
2026 -
2027 - ah->cal_list_curr = ah->cal_list;
2028 -diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
2029 -index 13d4e67..bb5312f 100644
2030 ---- a/drivers/net/wireless/ath9k/main.c
2031 -+++ b/drivers/net/wireless/ath9k/main.c
2032 -@@ -408,6 +408,18 @@ set_timer:
2033 - mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
2034 - }
2035 -
2036 -+static void ath_start_ani(struct ath_softc *sc)
2037 -+{
2038 -+ unsigned long timestamp = jiffies_to_msecs(jiffies);
2039 -+
2040 -+ sc->ani.longcal_timer = timestamp;
2041 -+ sc->ani.shortcal_timer = timestamp;
2042 -+ sc->ani.checkani_timer = timestamp;
2043 -+
2044 -+ mod_timer(&sc->ani.timer,
2045 -+ jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2046 -+}
2047 -+
2048 - /*
2049 - * Update tx/rx chainmask. For legacy association,
2050 - * hard code chainmask to 1x1, for 11n association, use
2051 -@@ -920,9 +932,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
2052 - sc->nodestats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
2053 - sc->nodestats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER;
2054 -
2055 -- /* Start ANI */
2056 -- mod_timer(&sc->ani.timer,
2057 -- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2058 -+ ath_start_ani(sc);
2059 - } else {
2060 - DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n");
2061 - sc->curaid = 0;
2062 -@@ -1416,7 +1426,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
2063 - for (i = 0; i < sc->keymax; i++)
2064 - ath9k_hw_keyreset(ah, (u16) i);
2065 -
2066 -- if (ath9k_regd_init(sc->sc_ah))
2067 -+ error = ath9k_regd_init(sc->sc_ah);
2068 -+ if (error)
2069 - goto bad;
2070 -
2071 - /* default to MONITOR mode */
2072 -@@ -2270,12 +2281,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2073 -
2074 - ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
2075 -
2076 -- if (conf->type == NL80211_IFTYPE_AP) {
2077 -- /* TODO: is this a suitable place to start ANI for AP mode? */
2078 -- /* Start ANI */
2079 -- mod_timer(&sc->ani.timer,
2080 -- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2081 -- }
2082 -+ if (conf->type == NL80211_IFTYPE_AP)
2083 -+ ath_start_ani(sc);
2084 -
2085 - out:
2086 - mutex_unlock(&sc->mutex);
2087 -@@ -2771,6 +2778,7 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2088 - mutex_lock(&sc->mutex);
2089 - aphy->state = ATH_WIPHY_ACTIVE;
2090 - sc->sc_flags &= ~SC_OP_SCANNING;
2091 -+ sc->sc_flags |= SC_OP_FULL_RESET;
2092 - mutex_unlock(&sc->mutex);
2093 - }
2094 -
2095 -diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
2096 -index 168411d..4affb49 100644
2097 ---- a/drivers/net/wireless/ath9k/pci.c
2098 -+++ b/drivers/net/wireless/ath9k/pci.c
2099 -@@ -87,6 +87,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2100 - struct ath_softc *sc;
2101 - struct ieee80211_hw *hw;
2102 - u8 csz;
2103 -+ u32 val;
2104 - int ret = 0;
2105 - struct ath_hw *ah;
2106 -
2107 -@@ -133,6 +134,14 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2108 -
2109 - pci_set_master(pdev);
2110 -
2111 -+ /*
2112 -+ * Disable the RETRY_TIMEOUT register (0x41) to keep
2113 -+ * PCI Tx retries from interfering with C3 CPU state.
2114 -+ */
2115 -+ pci_read_config_dword(pdev, 0x40, &val);
2116 -+ if ((val & 0x0000ff00) != 0)
2117 -+ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
2118 -+
2119 - ret = pci_request_region(pdev, 0, "ath9k");
2120 - if (ret) {
2121 - dev_err(&pdev->dev, "PCI memory region reserve error\n");
2122 -@@ -244,12 +253,21 @@ static int ath_pci_resume(struct pci_dev *pdev)
2123 - struct ieee80211_hw *hw = pci_get_drvdata(pdev);
2124 - struct ath_wiphy *aphy = hw->priv;
2125 - struct ath_softc *sc = aphy->sc;
2126 -+ u32 val;
2127 - int err;
2128 -
2129 - err = pci_enable_device(pdev);
2130 - if (err)
2131 - return err;
2132 - pci_restore_state(pdev);
2133 -+ /*
2134 -+ * Suspend/Resume resets the PCI configuration space, so we have to
2135 -+ * re-disable the RETRY_TIMEOUT register (0x41) to keep
2136 -+ * PCI Tx retries from interfering with C3 CPU state
2137 -+ */
2138 -+ pci_read_config_dword(pdev, 0x40, &val);
2139 -+ if ((val & 0x0000ff00) != 0)
2140 -+ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
2141 -
2142 - /* Enable LED */
2143 - ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN,
2144 -diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
2145 -index 4ca6251..5256d24 100644
2146 ---- a/drivers/net/wireless/ath9k/regd.c
2147 -+++ b/drivers/net/wireless/ath9k/regd.c
2148 -@@ -439,7 +439,7 @@ int ath9k_regd_init(struct ath_hw *ah)
2149 - u16 regdmn;
2150 -
2151 - if (!ath9k_regd_is_eeprom_valid(ah)) {
2152 -- DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
2153 -+ DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
2154 - "Invalid EEPROM contents\n");
2155 - return -EINVAL;
2156 - }
2157 -diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
2158 -index 689bdbf..c92f442 100644
2159 ---- a/drivers/net/wireless/ath9k/xmit.c
2160 -+++ b/drivers/net/wireless/ath9k/xmit.c
2161 -@@ -1573,8 +1573,9 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
2162 - skb->len, DMA_TO_DEVICE);
2163 - if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) {
2164 - bf->bf_mpdu = NULL;
2165 -- DPRINTF(sc, ATH_DBG_CONFIG,
2166 -- "dma_mapping_error() on TX\n");
2167 -+ kfree(tx_info_priv);
2168 -+ tx_info->rate_driver_data[0] = NULL;
2169 -+ DPRINTF(sc, ATH_DBG_FATAL, "dma_mapping_error() on TX\n");
2170 - return -ENOMEM;
2171 - }
2172 -
2173 -diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
2174 -index 4e63cc9..3d3c9c0 100644
2175 ---- a/drivers/parport/parport_pc.c
2176 -+++ b/drivers/parport/parport_pc.c
2177 -@@ -1413,11 +1413,13 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
2178 -
2179 - static void __devinit winbond_check(int io, int key)
2180 - {
2181 -- int devid,devrev,oldid,x_devid,x_devrev,x_oldid;
2182 -+ int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid;
2183 -
2184 - if (!request_region(io, 3, __func__))
2185 - return;
2186 -
2187 -+ origval = inb(io); /* Save original value */
2188 -+
2189 - /* First probe without key */
2190 - outb(0x20,io);
2191 - x_devid=inb(io+1);
2192 -@@ -1437,6 +1439,8 @@ static void __devinit winbond_check(int io, int key)
2193 - oldid=inb(io+1);
2194 - outb(0xaa,io); /* Magic Seal */
2195 -
2196 -+ outb(origval, io); /* in case we poked some entirely different hardware */
2197 -+
2198 - if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
2199 - goto out; /* protection against false positives */
2200 -
2201 -@@ -1447,11 +1451,15 @@ out:
2202 -
2203 - static void __devinit winbond_check2(int io,int key)
2204 - {
2205 -- int devid,devrev,oldid,x_devid,x_devrev,x_oldid;
2206 -+ int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid;
2207 -
2208 - if (!request_region(io, 3, __func__))
2209 - return;
2210 -
2211 -+ origval[0] = inb(io); /* Save original values */
2212 -+ origval[1] = inb(io + 1);
2213 -+ origval[2] = inb(io + 2);
2214 -+
2215 - /* First probe without the key */
2216 - outb(0x20,io+2);
2217 - x_devid=inb(io+2);
2218 -@@ -1470,6 +1478,10 @@ static void __devinit winbond_check2(int io,int key)
2219 - oldid=inb(io+2);
2220 - outb(0xaa,io); /* Magic Seal */
2221 -
2222 -+ outb(origval[0], io); /* in case we poked some entirely different hardware */
2223 -+ outb(origval[1], io + 1);
2224 -+ outb(origval[2], io + 2);
2225 -+
2226 - if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
2227 - goto out; /* protection against false positives */
2228 -
2229 -@@ -1480,11 +1492,13 @@ out:
2230 -
2231 - static void __devinit smsc_check(int io, int key)
2232 - {
2233 -- int id,rev,oldid,oldrev,x_id,x_rev,x_oldid,x_oldrev;
2234 -+ int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev;
2235 -
2236 - if (!request_region(io, 3, __func__))
2237 - return;
2238 -
2239 -+ origval = inb(io); /* Save original value */
2240 -+
2241 - /* First probe without the key */
2242 - outb(0x0d,io);
2243 - x_oldid=inb(io+1);
2244 -@@ -1508,6 +1522,8 @@ static void __devinit smsc_check(int io, int key)
2245 - rev=inb(io+1);
2246 - outb(0xaa,io); /* Magic Seal */
2247 -
2248 -+ outb(origval, io); /* in case we poked some entirely different hardware */
2249 -+
2250 - if ((x_id == id) && (x_oldrev == oldrev) &&
2251 - (x_oldid == oldid) && (x_rev == rev))
2252 - goto out; /* protection against false positives */
2253 -@@ -1544,11 +1560,12 @@ static void __devinit detect_and_report_smsc (void)
2254 - static void __devinit detect_and_report_it87(void)
2255 - {
2256 - u16 dev;
2257 -- u8 r;
2258 -+ u8 origval, r;
2259 - if (verbose_probing)
2260 - printk(KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n");
2261 -- if (!request_region(0x2e, 1, __func__))
2262 -+ if (!request_region(0x2e, 2, __func__))
2263 - return;
2264 -+ origval = inb(0x2e); /* Save original value */
2265 - outb(0x87, 0x2e);
2266 - outb(0x01, 0x2e);
2267 - outb(0x55, 0x2e);
2268 -@@ -1568,8 +1585,10 @@ static void __devinit detect_and_report_it87(void)
2269 - outb(r | 8, 0x2F);
2270 - outb(0x02, 0x2E); /* Lock */
2271 - outb(0x02, 0x2F);
2272 -+ } else {
2273 -+ outb(origval, 0x2e); /* Oops, sorry to disturb */
2274 - }
2275 -- release_region(0x2e, 1);
2276 -+ release_region(0x2e, 2);
2277 - }
2278 - #endif /* CONFIG_PARPORT_PC_SUPERIO */
2279 -
2280 -@@ -2193,6 +2212,9 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2281 - if (IS_ERR(pdev))
2282 - return NULL;
2283 - dev = &pdev->dev;
2284 -+
2285 -+ dev->coherent_dma_mask = DMA_BIT_MASK(24);
2286 -+ dev->dma_mask = &dev->coherent_dma_mask;
2287 - }
2288 -
2289 - ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
2290 -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
2291 -index 1a91bf9..440f4fb 100644
2292 ---- a/drivers/pci/pci.c
2293 -+++ b/drivers/pci/pci.c
2294 -@@ -480,6 +480,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
2295 - pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
2296 - pmcsr |= state;
2297 - break;
2298 -+ case PCI_D3hot:
2299 -+ case PCI_D3cold:
2300 - case PCI_UNKNOWN: /* Boot-up */
2301 - if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
2302 - && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
2303 -@@ -1282,15 +1284,14 @@ pci_power_t pci_target_state(struct pci_dev *dev)
2304 - default:
2305 - target_state = state;
2306 - }
2307 -+ } else if (!dev->pm_cap) {
2308 -+ target_state = PCI_D0;
2309 - } else if (device_may_wakeup(&dev->dev)) {
2310 - /*
2311 - * Find the deepest state from which the device can generate
2312 - * wake-up events, make it the target state and enable device
2313 - * to generate PME#.
2314 - */
2315 -- if (!dev->pm_cap)
2316 -- return PCI_POWER_ERROR;
2317 --
2318 - if (dev->pme_support) {
2319 - while (target_state
2320 - && !(dev->pme_support & (1 << target_state)))
2321 -diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
2322 -index b0367f1..777b2c7 100644
2323 ---- a/drivers/pci/pcie/aspm.c
2324 -+++ b/drivers/pci/pcie/aspm.c
2325 -@@ -638,6 +638,10 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
2326 - if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
2327 - pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
2328 - return;
2329 -+ /* VIA has a strange chipset, root port is under a bridge */
2330 -+ if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT &&
2331 -+ pdev->bus->self)
2332 -+ return;
2333 - down_read(&pci_bus_sem);
2334 - if (list_empty(&pdev->subordinate->devices))
2335 - goto out;
2336 -diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
2337 -index 34760f8..00856ba 100644
2338 ---- a/drivers/scsi/qla2xxx/qla_dbg.c
2339 -+++ b/drivers/scsi/qla2xxx/qla_dbg.c
2340 -@@ -218,7 +218,7 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
2341 -
2342 - static int
2343 - qla2xxx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint16_t *ram,
2344 -- uint16_t ram_words, void **nxt)
2345 -+ uint32_t ram_words, void **nxt)
2346 - {
2347 - int rval;
2348 - uint32_t cnt, stat, timer, words, idx;
2349 -diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
2350 -index ffa70d1..e9e1865 100644
2351 ---- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
2352 -+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
2353 -@@ -2312,8 +2312,9 @@ static void sym_int_par (struct sym_hcb *np, u_short sist)
2354 - int phase = cmd & 7;
2355 - struct sym_ccb *cp = sym_ccb_from_dsa(np, dsa);
2356 -
2357 -- printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
2358 -- sym_name(np), hsts, dbc, sbcl);
2359 -+ if (printk_ratelimit())
2360 -+ printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
2361 -+ sym_name(np), hsts, dbc, sbcl);
2362 -
2363 - /*
2364 - * Check that the chip is connected to the SCSI BUS.
2365 -diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
2366 -index d86123e..a543acf 100644
2367 ---- a/drivers/serial/bfin_5xx.c
2368 -+++ b/drivers/serial/bfin_5xx.c
2369 -@@ -38,6 +38,10 @@
2370 - #include <asm/cacheflush.h>
2371 - #endif
2372 -
2373 -+#ifdef CONFIG_SERIAL_BFIN_MODULE
2374 -+# undef CONFIG_EARLY_PRINTK
2375 -+#endif
2376 -+
2377 - /* UART name and device definitions */
2378 - #define BFIN_SERIAL_NAME "ttyBF"
2379 - #define BFIN_SERIAL_MAJOR 204
2380 -@@ -1058,6 +1062,7 @@ static void __init bfin_serial_init_ports(void)
2381 - bfin_serial_hw_init();
2382 -
2383 - for (i = 0; i < nr_active_ports; i++) {
2384 -+ spin_lock_init(&bfin_serial_ports[i].port.lock);
2385 - bfin_serial_ports[i].port.uartclk = get_sclk();
2386 - bfin_serial_ports[i].port.fifosize = BFIN_UART_TX_FIFO_SIZE;
2387 - bfin_serial_ports[i].port.ops = &bfin_serial_pops;
2388 -diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
2389 -index f4573a9..a32ccb4 100644
2390 ---- a/drivers/spi/spi_mpc83xx.c
2391 -+++ b/drivers/spi/spi_mpc83xx.c
2392 -@@ -711,12 +711,12 @@ static int of_mpc83xx_spi_get_chipselects(struct device *dev)
2393 - return 0;
2394 - }
2395 -
2396 -- pinfo->gpios = kmalloc(ngpios * sizeof(pinfo->gpios), GFP_KERNEL);
2397 -+ pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
2398 - if (!pinfo->gpios)
2399 - return -ENOMEM;
2400 -- memset(pinfo->gpios, -1, ngpios * sizeof(pinfo->gpios));
2401 -+ memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
2402 -
2403 -- pinfo->alow_flags = kzalloc(ngpios * sizeof(pinfo->alow_flags),
2404 -+ pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
2405 - GFP_KERNEL);
2406 - if (!pinfo->alow_flags) {
2407 - ret = -ENOMEM;
2408 -diff --git a/drivers/staging/uc2322/aten2011.c b/drivers/staging/uc2322/aten2011.c
2409 -index 9c62f78..39d0926 100644
2410 ---- a/drivers/staging/uc2322/aten2011.c
2411 -+++ b/drivers/staging/uc2322/aten2011.c
2412 -@@ -2336,7 +2336,7 @@ static int ATEN2011_startup(struct usb_serial *serial)
2413 - return 0;
2414 - }
2415 -
2416 --static void ATEN2011_shutdown(struct usb_serial *serial)
2417 -+static void ATEN2011_release(struct usb_serial *serial)
2418 - {
2419 - int i;
2420 - struct ATENINTL_port *ATEN2011_port;
2421 -@@ -2382,7 +2382,7 @@ static struct usb_serial_driver aten_serial_driver = {
2422 - .tiocmget = ATEN2011_tiocmget,
2423 - .tiocmset = ATEN2011_tiocmset,
2424 - .attach = ATEN2011_startup,
2425 -- .shutdown = ATEN2011_shutdown,
2426 -+ .release = ATEN2011_release,
2427 - .read_bulk_callback = ATEN2011_bulk_in_callback,
2428 - .read_int_callback = ATEN2011_interrupt_callback,
2429 - };
2430 -diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
2431 -index c40a9b2..3703789 100644
2432 ---- a/drivers/usb/class/usbtmc.c
2433 -+++ b/drivers/usb/class/usbtmc.c
2434 -@@ -927,21 +927,27 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2435 - switch (cmd) {
2436 - case USBTMC_IOCTL_CLEAR_OUT_HALT:
2437 - retval = usbtmc_ioctl_clear_out_halt(data);
2438 -+ break;
2439 -
2440 - case USBTMC_IOCTL_CLEAR_IN_HALT:
2441 - retval = usbtmc_ioctl_clear_in_halt(data);
2442 -+ break;
2443 -
2444 - case USBTMC_IOCTL_INDICATOR_PULSE:
2445 - retval = usbtmc_ioctl_indicator_pulse(data);
2446 -+ break;
2447 -
2448 - case USBTMC_IOCTL_CLEAR:
2449 - retval = usbtmc_ioctl_clear(data);
2450 -+ break;
2451 -
2452 - case USBTMC_IOCTL_ABORT_BULK_OUT:
2453 - retval = usbtmc_ioctl_abort_bulk_out(data);
2454 -+ break;
2455 -
2456 - case USBTMC_IOCTL_ABORT_BULK_IN:
2457 - retval = usbtmc_ioctl_abort_bulk_in(data);
2458 -+ break;
2459 - }
2460 -
2461 - mutex_unlock(&data->io_mutex);
2462 -diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
2463 -index 6d106e7..2cbfab3 100644
2464 ---- a/drivers/usb/serial/aircable.c
2465 -+++ b/drivers/usb/serial/aircable.c
2466 -@@ -364,7 +364,7 @@ static int aircable_attach(struct usb_serial *serial)
2467 - return 0;
2468 - }
2469 -
2470 --static void aircable_shutdown(struct usb_serial *serial)
2471 -+static void aircable_release(struct usb_serial *serial)
2472 - {
2473 -
2474 - struct usb_serial_port *port = serial->port[0];
2475 -@@ -375,7 +375,6 @@ static void aircable_shutdown(struct usb_serial *serial)
2476 - if (priv) {
2477 - serial_buf_free(priv->tx_buf);
2478 - serial_buf_free(priv->rx_buf);
2479 -- usb_set_serial_port_data(port, NULL);
2480 - kfree(priv);
2481 - }
2482 - }
2483 -@@ -601,7 +600,7 @@ static struct usb_serial_driver aircable_device = {
2484 - .num_ports = 1,
2485 - .attach = aircable_attach,
2486 - .probe = aircable_probe,
2487 -- .shutdown = aircable_shutdown,
2488 -+ .release = aircable_release,
2489 - .write = aircable_write,
2490 - .write_room = aircable_write_room,
2491 - .write_bulk_callback = aircable_write_bulk_callback,
2492 -diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
2493 -index b7eacad..9637228 100644
2494 ---- a/drivers/usb/serial/belkin_sa.c
2495 -+++ b/drivers/usb/serial/belkin_sa.c
2496 -@@ -90,7 +90,7 @@ static int debug;
2497 -
2498 - /* function prototypes for a Belkin USB Serial Adapter F5U103 */
2499 - static int belkin_sa_startup(struct usb_serial *serial);
2500 --static void belkin_sa_shutdown(struct usb_serial *serial);
2501 -+static void belkin_sa_release(struct usb_serial *serial);
2502 - static int belkin_sa_open(struct tty_struct *tty,
2503 - struct usb_serial_port *port, struct file *filp);
2504 - static void belkin_sa_close(struct tty_struct *tty,
2505 -@@ -143,7 +143,7 @@ static struct usb_serial_driver belkin_device = {
2506 - .tiocmget = belkin_sa_tiocmget,
2507 - .tiocmset = belkin_sa_tiocmset,
2508 - .attach = belkin_sa_startup,
2509 -- .shutdown = belkin_sa_shutdown,
2510 -+ .release = belkin_sa_release,
2511 - };
2512 -
2513 -
2514 -@@ -198,14 +198,13 @@ static int belkin_sa_startup(struct usb_serial *serial)
2515 - }
2516 -
2517 -
2518 --static void belkin_sa_shutdown(struct usb_serial *serial)
2519 -+static void belkin_sa_release(struct usb_serial *serial)
2520 - {
2521 - struct belkin_sa_private *priv;
2522 - int i;
2523 -
2524 - dbg("%s", __func__);
2525 -
2526 -- /* stop reads and writes on all ports */
2527 - for (i = 0; i < serial->num_ports; ++i) {
2528 - /* My special items, the standard routines free my urbs */
2529 - priv = usb_get_serial_port_data(serial->port[i]);
2530 -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2531 -index e8d5133..cf5093f 100644
2532 ---- a/drivers/usb/serial/cp210x.c
2533 -+++ b/drivers/usb/serial/cp210x.c
2534 -@@ -51,7 +51,7 @@ static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *,
2535 - unsigned int, unsigned int);
2536 - static void cp2101_break_ctl(struct tty_struct *, int);
2537 - static int cp2101_startup(struct usb_serial *);
2538 --static void cp2101_shutdown(struct usb_serial *);
2539 -+static void cp2101_disconnect(struct usb_serial *);
2540 -
2541 - static int debug;
2542 -
2543 -@@ -131,7 +131,7 @@ static struct usb_serial_driver cp2101_device = {
2544 - .tiocmget = cp2101_tiocmget,
2545 - .tiocmset = cp2101_tiocmset,
2546 - .attach = cp2101_startup,
2547 -- .shutdown = cp2101_shutdown,
2548 -+ .disconnect = cp2101_disconnect,
2549 - };
2550 -
2551 - /* Config request types */
2552 -@@ -773,7 +773,7 @@ static int cp2101_startup(struct usb_serial *serial)
2553 - return 0;
2554 - }
2555 -
2556 --static void cp2101_shutdown(struct usb_serial *serial)
2557 -+static void cp2101_disconnect(struct usb_serial *serial)
2558 - {
2559 - int i;
2560 -
2561 -diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
2562 -index dd501bb..49cf9ee 100644
2563 ---- a/drivers/usb/serial/cyberjack.c
2564 -+++ b/drivers/usb/serial/cyberjack.c
2565 -@@ -58,7 +58,8 @@ static int debug;
2566 -
2567 - /* Function prototypes */
2568 - static int cyberjack_startup(struct usb_serial *serial);
2569 --static void cyberjack_shutdown(struct usb_serial *serial);
2570 -+static void cyberjack_disconnect(struct usb_serial *serial);
2571 -+static void cyberjack_release(struct usb_serial *serial);
2572 - static int cyberjack_open(struct tty_struct *tty,
2573 - struct usb_serial_port *port, struct file *filp);
2574 - static void cyberjack_close(struct tty_struct *tty,
2575 -@@ -95,7 +96,8 @@ static struct usb_serial_driver cyberjack_device = {
2576 - .id_table = id_table,
2577 - .num_ports = 1,
2578 - .attach = cyberjack_startup,
2579 -- .shutdown = cyberjack_shutdown,
2580 -+ .disconnect = cyberjack_disconnect,
2581 -+ .release = cyberjack_release,
2582 - .open = cyberjack_open,
2583 - .close = cyberjack_close,
2584 - .write = cyberjack_write,
2585 -@@ -149,17 +151,25 @@ static int cyberjack_startup(struct usb_serial *serial)
2586 - return 0;
2587 - }
2588 -
2589 --static void cyberjack_shutdown(struct usb_serial *serial)
2590 -+static void cyberjack_disconnect(struct usb_serial *serial)
2591 - {
2592 - int i;
2593 -
2594 - dbg("%s", __func__);
2595 -
2596 -- for (i = 0; i < serial->num_ports; ++i) {
2597 -+ for (i = 0; i < serial->num_ports; ++i)
2598 - usb_kill_urb(serial->port[i]->interrupt_in_urb);
2599 -+}
2600 -+
2601 -+static void cyberjack_release(struct usb_serial *serial)
2602 -+{
2603 -+ int i;
2604 -+
2605 -+ dbg("%s", __func__);
2606 -+
2607 -+ for (i = 0; i < serial->num_ports; ++i) {
2608 - /* My special items, the standard routines free my urbs */
2609 - kfree(usb_get_serial_port_data(serial->port[i]));
2610 -- usb_set_serial_port_data(serial->port[i], NULL);
2611 - }
2612 - }
2613 -
2614 -diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
2615 -index e568710..b8e6e4d 100644
2616 ---- a/drivers/usb/serial/cypress_m8.c
2617 -+++ b/drivers/usb/serial/cypress_m8.c
2618 -@@ -171,7 +171,7 @@ struct cypress_buf {
2619 - static int cypress_earthmate_startup(struct usb_serial *serial);
2620 - static int cypress_hidcom_startup(struct usb_serial *serial);
2621 - static int cypress_ca42v2_startup(struct usb_serial *serial);
2622 --static void cypress_shutdown(struct usb_serial *serial);
2623 -+static void cypress_release(struct usb_serial *serial);
2624 - static int cypress_open(struct tty_struct *tty,
2625 - struct usb_serial_port *port, struct file *filp);
2626 - static void cypress_close(struct tty_struct *tty,
2627 -@@ -215,7 +215,7 @@ static struct usb_serial_driver cypress_earthmate_device = {
2628 - .id_table = id_table_earthmate,
2629 - .num_ports = 1,
2630 - .attach = cypress_earthmate_startup,
2631 -- .shutdown = cypress_shutdown,
2632 -+ .release = cypress_release,
2633 - .open = cypress_open,
2634 - .close = cypress_close,
2635 - .write = cypress_write,
2636 -@@ -241,7 +241,7 @@ static struct usb_serial_driver cypress_hidcom_device = {
2637 - .id_table = id_table_cyphidcomrs232,
2638 - .num_ports = 1,
2639 - .attach = cypress_hidcom_startup,
2640 -- .shutdown = cypress_shutdown,
2641 -+ .release = cypress_release,
2642 - .open = cypress_open,
2643 - .close = cypress_close,
2644 - .write = cypress_write,
2645 -@@ -267,7 +267,7 @@ static struct usb_serial_driver cypress_ca42v2_device = {
2646 - .id_table = id_table_nokiaca42v2,
2647 - .num_ports = 1,
2648 - .attach = cypress_ca42v2_startup,
2649 -- .shutdown = cypress_shutdown,
2650 -+ .release = cypress_release,
2651 - .open = cypress_open,
2652 - .close = cypress_close,
2653 - .write = cypress_write,
2654 -@@ -613,7 +613,7 @@ static int cypress_ca42v2_startup(struct usb_serial *serial)
2655 - } /* cypress_ca42v2_startup */
2656 -
2657 -
2658 --static void cypress_shutdown(struct usb_serial *serial)
2659 -+static void cypress_release(struct usb_serial *serial)
2660 - {
2661 - struct cypress_private *priv;
2662 -
2663 -@@ -626,7 +626,6 @@ static void cypress_shutdown(struct usb_serial *serial)
2664 - if (priv) {
2665 - cypress_buf_free(priv->buf);
2666 - kfree(priv);
2667 -- usb_set_serial_port_data(serial->port[0], NULL);
2668 - }
2669 - }
2670 -
2671 -diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
2672 -index 38ba4ea..e9373db 100644
2673 ---- a/drivers/usb/serial/digi_acceleport.c
2674 -+++ b/drivers/usb/serial/digi_acceleport.c
2675 -@@ -460,7 +460,8 @@ static void digi_close(struct tty_struct *tty, struct usb_serial_port *port,
2676 - struct file *filp);
2677 - static int digi_startup_device(struct usb_serial *serial);
2678 - static int digi_startup(struct usb_serial *serial);
2679 --static void digi_shutdown(struct usb_serial *serial);
2680 -+static void digi_disconnect(struct usb_serial *serial);
2681 -+static void digi_release(struct usb_serial *serial);
2682 - static void digi_read_bulk_callback(struct urb *urb);
2683 - static int digi_read_inb_callback(struct urb *urb);
2684 - static int digi_read_oob_callback(struct urb *urb);
2685 -@@ -522,7 +523,8 @@ static struct usb_serial_driver digi_acceleport_2_device = {
2686 - .tiocmget = digi_tiocmget,
2687 - .tiocmset = digi_tiocmset,
2688 - .attach = digi_startup,
2689 -- .shutdown = digi_shutdown,
2690 -+ .disconnect = digi_disconnect,
2691 -+ .release = digi_release,
2692 - };
2693 -
2694 - static struct usb_serial_driver digi_acceleport_4_device = {
2695 -@@ -548,7 +550,8 @@ static struct usb_serial_driver digi_acceleport_4_device = {
2696 - .tiocmget = digi_tiocmget,
2697 - .tiocmset = digi_tiocmset,
2698 - .attach = digi_startup,
2699 -- .shutdown = digi_shutdown,
2700 -+ .disconnect = digi_disconnect,
2701 -+ .release = digi_release,
2702 - };
2703 -
2704 -
2705 -@@ -1589,16 +1592,23 @@ static int digi_startup(struct usb_serial *serial)
2706 - }
2707 -
2708 -
2709 --static void digi_shutdown(struct usb_serial *serial)
2710 -+static void digi_disconnect(struct usb_serial *serial)
2711 - {
2712 - int i;
2713 -- dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt());
2714 -+ dbg("digi_disconnect: TOP, in_interrupt()=%ld", in_interrupt());
2715 -
2716 - /* stop reads and writes on all ports */
2717 - for (i = 0; i < serial->type->num_ports + 1; i++) {
2718 - usb_kill_urb(serial->port[i]->read_urb);
2719 - usb_kill_urb(serial->port[i]->write_urb);
2720 - }
2721 -+}
2722 -+
2723 -+
2724 -+static void digi_release(struct usb_serial *serial)
2725 -+{
2726 -+ int i;
2727 -+ dbg("digi_release: TOP, in_interrupt()=%ld", in_interrupt());
2728 -
2729 - /* free the private data structures for all ports */
2730 - /* number of regular ports + 1 for the out-of-band port */
2731 -diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
2732 -index c709ec4..b0d678c 100644
2733 ---- a/drivers/usb/serial/empeg.c
2734 -+++ b/drivers/usb/serial/empeg.c
2735 -@@ -91,7 +91,6 @@ static int empeg_chars_in_buffer(struct tty_struct *tty);
2736 - static void empeg_throttle(struct tty_struct *tty);
2737 - static void empeg_unthrottle(struct tty_struct *tty);
2738 - static int empeg_startup(struct usb_serial *serial);
2739 --static void empeg_shutdown(struct usb_serial *serial);
2740 - static void empeg_set_termios(struct tty_struct *tty,
2741 - struct usb_serial_port *port, struct ktermios *old_termios);
2742 - static void empeg_write_bulk_callback(struct urb *urb);
2743 -@@ -125,7 +124,6 @@ static struct usb_serial_driver empeg_device = {
2744 - .throttle = empeg_throttle,
2745 - .unthrottle = empeg_unthrottle,
2746 - .attach = empeg_startup,
2747 -- .shutdown = empeg_shutdown,
2748 - .set_termios = empeg_set_termios,
2749 - .write = empeg_write,
2750 - .write_room = empeg_write_room,
2751 -@@ -429,12 +427,6 @@ static int empeg_startup(struct usb_serial *serial)
2752 - }
2753 -
2754 -
2755 --static void empeg_shutdown(struct usb_serial *serial)
2756 --{
2757 -- dbg("%s", __func__);
2758 --}
2759 --
2760 --
2761 - static void empeg_set_termios(struct tty_struct *tty,
2762 - struct usb_serial_port *port, struct ktermios *old_termios)
2763 - {
2764 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2765 -index d9fcdae..9722512 100644
2766 ---- a/drivers/usb/serial/ftdi_sio.c
2767 -+++ b/drivers/usb/serial/ftdi_sio.c
2768 -@@ -714,7 +714,6 @@ static const char *ftdi_chip_name[] = {
2769 - /* function prototypes for a FTDI serial converter */
2770 - static int ftdi_sio_probe(struct usb_serial *serial,
2771 - const struct usb_device_id *id);
2772 --static void ftdi_shutdown(struct usb_serial *serial);
2773 - static int ftdi_sio_port_probe(struct usb_serial_port *port);
2774 - static int ftdi_sio_port_remove(struct usb_serial_port *port);
2775 - static int ftdi_open(struct tty_struct *tty,
2776 -@@ -770,7 +769,6 @@ static struct usb_serial_driver ftdi_sio_device = {
2777 - .ioctl = ftdi_ioctl,
2778 - .set_termios = ftdi_set_termios,
2779 - .break_ctl = ftdi_break_ctl,
2780 -- .shutdown = ftdi_shutdown,
2781 - };
2782 -
2783 -
2784 -@@ -1460,18 +1458,6 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
2785 - return 0;
2786 - }
2787 -
2788 --/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
2789 -- * it is called when the usb device is disconnected
2790 -- *
2791 -- * usbserial:usb_serial_disconnect
2792 -- * calls __serial_close for each open of the port
2793 -- * shutdown is called then (ie ftdi_shutdown)
2794 -- */
2795 --static void ftdi_shutdown(struct usb_serial *serial)
2796 --{
2797 -- dbg("%s", __func__);
2798 --}
2799 --
2800 - static void ftdi_sio_priv_release(struct kref *k)
2801 - {
2802 - struct ftdi_private *priv = container_of(k, struct ftdi_private, kref);
2803 -diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
2804 -index 586d30f..ed8bd90 100644
2805 ---- a/drivers/usb/serial/garmin_gps.c
2806 -+++ b/drivers/usb/serial/garmin_gps.c
2807 -@@ -1528,7 +1528,7 @@ static int garmin_attach(struct usb_serial *serial)
2808 - }
2809 -
2810 -
2811 --static void garmin_shutdown(struct usb_serial *serial)
2812 -+static void garmin_disconnect(struct usb_serial *serial)
2813 - {
2814 - struct usb_serial_port *port = serial->port[0];
2815 - struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
2816 -@@ -1537,8 +1537,17 @@ static void garmin_shutdown(struct usb_serial *serial)
2817 -
2818 - usb_kill_urb(port->interrupt_in_urb);
2819 - del_timer_sync(&garmin_data_p->timer);
2820 -+}
2821 -+
2822 -+
2823 -+static void garmin_release(struct usb_serial *serial)
2824 -+{
2825 -+ struct usb_serial_port *port = serial->port[0];
2826 -+ struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
2827 -+
2828 -+ dbg("%s", __func__);
2829 -+
2830 - kfree(garmin_data_p);
2831 -- usb_set_serial_port_data(port, NULL);
2832 - }
2833 -
2834 -
2835 -@@ -1557,7 +1566,8 @@ static struct usb_serial_driver garmin_device = {
2836 - .throttle = garmin_throttle,
2837 - .unthrottle = garmin_unthrottle,
2838 - .attach = garmin_attach,
2839 -- .shutdown = garmin_shutdown,
2840 -+ .disconnect = garmin_disconnect,
2841 -+ .release = garmin_release,
2842 - .write = garmin_write,
2843 - .write_room = garmin_write_room,
2844 - .write_bulk_callback = garmin_write_bulk_callback,
2845 -diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
2846 -index 4cec990..ef29788 100644
2847 ---- a/drivers/usb/serial/generic.c
2848 -+++ b/drivers/usb/serial/generic.c
2849 -@@ -63,7 +63,8 @@ struct usb_serial_driver usb_serial_generic_device = {
2850 - .id_table = generic_device_ids,
2851 - .usb_driver = &generic_driver,
2852 - .num_ports = 1,
2853 -- .shutdown = usb_serial_generic_shutdown,
2854 -+ .disconnect = usb_serial_generic_disconnect,
2855 -+ .release = usb_serial_generic_release,
2856 - .throttle = usb_serial_generic_throttle,
2857 - .unthrottle = usb_serial_generic_unthrottle,
2858 - .resume = usb_serial_generic_resume,
2859 -@@ -413,7 +414,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
2860 - }
2861 - }
2862 -
2863 --void usb_serial_generic_shutdown(struct usb_serial *serial)
2864 -+void usb_serial_generic_disconnect(struct usb_serial *serial)
2865 - {
2866 - int i;
2867 -
2868 -@@ -424,3 +425,7 @@ void usb_serial_generic_shutdown(struct usb_serial *serial)
2869 - generic_cleanup(serial->port[i]);
2870 - }
2871 -
2872 -+void usb_serial_generic_release(struct usb_serial *serial)
2873 -+{
2874 -+ dbg("%s", __func__);
2875 -+}
2876 -diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
2877 -index fb4a73d..fc509bb 100644
2878 ---- a/drivers/usb/serial/io_edgeport.c
2879 -+++ b/drivers/usb/serial/io_edgeport.c
2880 -@@ -225,7 +225,8 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file);
2881 - static int edge_tiocmset(struct tty_struct *tty, struct file *file,
2882 - unsigned int set, unsigned int clear);
2883 - static int edge_startup(struct usb_serial *serial);
2884 --static void edge_shutdown(struct usb_serial *serial);
2885 -+static void edge_disconnect(struct usb_serial *serial);
2886 -+static void edge_release(struct usb_serial *serial);
2887 -
2888 - #include "io_tables.h" /* all of the devices that this driver supports */
2889 -
2890 -@@ -3195,21 +3196,16 @@ static int edge_startup(struct usb_serial *serial)
2891 -
2892 -
2893 - /****************************************************************************
2894 -- * edge_shutdown
2895 -+ * edge_disconnect
2896 - * This function is called whenever the device is removed from the usb bus.
2897 - ****************************************************************************/
2898 --static void edge_shutdown(struct usb_serial *serial)
2899 -+static void edge_disconnect(struct usb_serial *serial)
2900 - {
2901 - struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2902 -- int i;
2903 -
2904 - dbg("%s", __func__);
2905 -
2906 - /* stop reads and writes on all ports */
2907 -- for (i = 0; i < serial->num_ports; ++i) {
2908 -- kfree(usb_get_serial_port_data(serial->port[i]));
2909 -- usb_set_serial_port_data(serial->port[i], NULL);
2910 -- }
2911 - /* free up our endpoint stuff */
2912 - if (edge_serial->is_epic) {
2913 - usb_kill_urb(edge_serial->interrupt_read_urb);
2914 -@@ -3220,9 +3216,24 @@ static void edge_shutdown(struct usb_serial *serial)
2915 - usb_free_urb(edge_serial->read_urb);
2916 - kfree(edge_serial->bulk_in_buffer);
2917 - }
2918 -+}
2919 -+
2920 -+
2921 -+/****************************************************************************
2922 -+ * edge_release
2923 -+ * This function is called when the device structure is deallocated.
2924 -+ ****************************************************************************/
2925 -+static void edge_release(struct usb_serial *serial)
2926 -+{
2927 -+ struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2928 -+ int i;
2929 -+
2930 -+ dbg("%s", __func__);
2931 -+
2932 -+ for (i = 0; i < serial->num_ports; ++i)
2933 -+ kfree(usb_get_serial_port_data(serial->port[i]));
2934 -
2935 - kfree(edge_serial);
2936 -- usb_set_serial_data(serial, NULL);
2937 - }
2938 -
2939 -
2940 -diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
2941 -index 7eb9d67..9241d31 100644
2942 ---- a/drivers/usb/serial/io_tables.h
2943 -+++ b/drivers/usb/serial/io_tables.h
2944 -@@ -117,7 +117,8 @@ static struct usb_serial_driver edgeport_2port_device = {
2945 - .throttle = edge_throttle,
2946 - .unthrottle = edge_unthrottle,
2947 - .attach = edge_startup,
2948 -- .shutdown = edge_shutdown,
2949 -+ .disconnect = edge_disconnect,
2950 -+ .release = edge_release,
2951 - .ioctl = edge_ioctl,
2952 - .set_termios = edge_set_termios,
2953 - .tiocmget = edge_tiocmget,
2954 -@@ -145,7 +146,8 @@ static struct usb_serial_driver edgeport_4port_device = {
2955 - .throttle = edge_throttle,
2956 - .unthrottle = edge_unthrottle,
2957 - .attach = edge_startup,
2958 -- .shutdown = edge_shutdown,
2959 -+ .disconnect = edge_disconnect,
2960 -+ .release = edge_release,
2961 - .ioctl = edge_ioctl,
2962 - .set_termios = edge_set_termios,
2963 - .tiocmget = edge_tiocmget,
2964 -@@ -173,7 +175,8 @@ static struct usb_serial_driver edgeport_8port_device = {
2965 - .throttle = edge_throttle,
2966 - .unthrottle = edge_unthrottle,
2967 - .attach = edge_startup,
2968 -- .shutdown = edge_shutdown,
2969 -+ .disconnect = edge_disconnect,
2970 -+ .release = edge_release,
2971 - .ioctl = edge_ioctl,
2972 - .set_termios = edge_set_termios,
2973 - .tiocmget = edge_tiocmget,
2974 -@@ -200,7 +203,8 @@ static struct usb_serial_driver epic_device = {
2975 - .throttle = edge_throttle,
2976 - .unthrottle = edge_unthrottle,
2977 - .attach = edge_startup,
2978 -- .shutdown = edge_shutdown,
2979 -+ .disconnect = edge_disconnect,
2980 -+ .release = edge_release,
2981 - .ioctl = edge_ioctl,
2982 - .set_termios = edge_set_termios,
2983 - .tiocmget = edge_tiocmget,
2984 -diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
2985 -index 513b25e..3139246 100644
2986 ---- a/drivers/usb/serial/io_ti.c
2987 -+++ b/drivers/usb/serial/io_ti.c
2988 -@@ -2664,7 +2664,7 @@ cleanup:
2989 - return -ENOMEM;
2990 - }
2991 -
2992 --static void edge_shutdown(struct usb_serial *serial)
2993 -+static void edge_disconnect(struct usb_serial *serial)
2994 - {
2995 - int i;
2996 - struct edgeport_port *edge_port;
2997 -@@ -2674,12 +2674,22 @@ static void edge_shutdown(struct usb_serial *serial)
2998 - for (i = 0; i < serial->num_ports; ++i) {
2999 - edge_port = usb_get_serial_port_data(serial->port[i]);
3000 - edge_remove_sysfs_attrs(edge_port->port);
3001 -+ }
3002 -+}
3003 -+
3004 -+static void edge_release(struct usb_serial *serial)
3005 -+{
3006 -+ int i;
3007 -+ struct edgeport_port *edge_port;
3008 -+
3009 -+ dbg("%s", __func__);
3010 -+
3011 -+ for (i = 0; i < serial->num_ports; ++i) {
3012 -+ edge_port = usb_get_serial_port_data(serial->port[i]);
3013 - edge_buf_free(edge_port->ep_out_buf);
3014 - kfree(edge_port);
3015 -- usb_set_serial_port_data(serial->port[i], NULL);
3016 - }
3017 - kfree(usb_get_serial_data(serial));
3018 -- usb_set_serial_data(serial, NULL);
3019 - }
3020 -
3021 -
3022 -@@ -2916,7 +2926,8 @@ static struct usb_serial_driver edgeport_1port_device = {
3023 - .throttle = edge_throttle,
3024 - .unthrottle = edge_unthrottle,
3025 - .attach = edge_startup,
3026 -- .shutdown = edge_shutdown,
3027 -+ .disconnect = edge_disconnect,
3028 -+ .release = edge_release,
3029 - .port_probe = edge_create_sysfs_attrs,
3030 - .ioctl = edge_ioctl,
3031 - .set_termios = edge_set_termios,
3032 -@@ -2945,7 +2956,8 @@ static struct usb_serial_driver edgeport_2port_device = {
3033 - .throttle = edge_throttle,
3034 - .unthrottle = edge_unthrottle,
3035 - .attach = edge_startup,
3036 -- .shutdown = edge_shutdown,
3037 -+ .disconnect = edge_disconnect,
3038 -+ .release = edge_release,
3039 - .port_probe = edge_create_sysfs_attrs,
3040 - .ioctl = edge_ioctl,
3041 - .set_termios = edge_set_termios,
3042 -diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
3043 -index cd62825..b70b0a0 100644
3044 ---- a/drivers/usb/serial/ipaq.c
3045 -+++ b/drivers/usb/serial/ipaq.c
3046 -@@ -80,7 +80,6 @@ static void ipaq_close(struct tty_struct *tty,
3047 - struct usb_serial_port *port, struct file *filp);
3048 - static int ipaq_calc_num_ports(struct usb_serial *serial);
3049 - static int ipaq_startup(struct usb_serial *serial);
3050 --static void ipaq_shutdown(struct usb_serial *serial);
3051 - static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port,
3052 - const unsigned char *buf, int count);
3053 - static int ipaq_write_bulk(struct usb_serial_port *port,
3054 -@@ -577,7 +576,6 @@ static struct usb_serial_driver ipaq_device = {
3055 - .close = ipaq_close,
3056 - .attach = ipaq_startup,
3057 - .calc_num_ports = ipaq_calc_num_ports,
3058 -- .shutdown = ipaq_shutdown,
3059 - .write = ipaq_write,
3060 - .write_room = ipaq_write_room,
3061 - .chars_in_buffer = ipaq_chars_in_buffer,
3062 -@@ -992,11 +990,6 @@ static int ipaq_startup(struct usb_serial *serial)
3063 - return usb_reset_configuration(serial->dev);
3064 - }
3065 -
3066 --static void ipaq_shutdown(struct usb_serial *serial)
3067 --{
3068 -- dbg("%s", __func__);
3069 --}
3070 --
3071 - static int __init ipaq_init(void)
3072 - {
3073 - int retval;
3074 -diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
3075 -index 4473d44..c03015b 100644
3076 ---- a/drivers/usb/serial/iuu_phoenix.c
3077 -+++ b/drivers/usb/serial/iuu_phoenix.c
3078 -@@ -122,8 +122,8 @@ static int iuu_startup(struct usb_serial *serial)
3079 - return 0;
3080 - }
3081 -
3082 --/* Shutdown function */
3083 --static void iuu_shutdown(struct usb_serial *serial)
3084 -+/* Release function */
3085 -+static void iuu_release(struct usb_serial *serial)
3086 - {
3087 - struct usb_serial_port *port = serial->port[0];
3088 - struct iuu_private *priv = usb_get_serial_port_data(port);
3089 -@@ -1176,7 +1176,7 @@ static struct usb_serial_driver iuu_device = {
3090 - .tiocmget = iuu_tiocmget,
3091 - .tiocmset = iuu_tiocmset,
3092 - .attach = iuu_startup,
3093 -- .shutdown = iuu_shutdown,
3094 -+ .release = iuu_release,
3095 - };
3096 -
3097 - static int __init iuu_init(void)
3098 -diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
3099 -index 00daa8f..8c69c3c 100644
3100 ---- a/drivers/usb/serial/keyspan.c
3101 -+++ b/drivers/usb/serial/keyspan.c
3102 -@@ -2682,7 +2682,7 @@ static int keyspan_startup(struct usb_serial *serial)
3103 - return 0;
3104 - }
3105 -
3106 --static void keyspan_shutdown(struct usb_serial *serial)
3107 -+static void keyspan_disconnect(struct usb_serial *serial)
3108 - {
3109 - int i, j;
3110 - struct usb_serial_port *port;
3111 -@@ -2722,6 +2722,17 @@ static void keyspan_shutdown(struct usb_serial *serial)
3112 - usb_free_urb(p_priv->out_urbs[j]);
3113 - }
3114 - }
3115 -+}
3116 -+
3117 -+static void keyspan_release(struct usb_serial *serial)
3118 -+{
3119 -+ int i;
3120 -+ struct usb_serial_port *port;
3121 -+ struct keyspan_serial_private *s_priv;
3122 -+
3123 -+ dbg("%s", __func__);
3124 -+
3125 -+ s_priv = usb_get_serial_data(serial);
3126 -
3127 - /* dbg("Freeing serial->private."); */
3128 - kfree(s_priv);
3129 -diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
3130 -index 38b4582..4961c26 100644
3131 ---- a/drivers/usb/serial/keyspan.h
3132 -+++ b/drivers/usb/serial/keyspan.h
3133 -@@ -42,7 +42,8 @@ static void keyspan_close (struct tty_struct *tty,
3134 - struct usb_serial_port *port,
3135 - struct file *filp);
3136 - static int keyspan_startup (struct usb_serial *serial);
3137 --static void keyspan_shutdown (struct usb_serial *serial);
3138 -+static void keyspan_disconnect (struct usb_serial *serial);
3139 -+static void keyspan_release (struct usb_serial *serial);
3140 - static int keyspan_write_room (struct tty_struct *tty);
3141 -
3142 - static int keyspan_write (struct tty_struct *tty,
3143 -@@ -569,7 +570,8 @@ static struct usb_serial_driver keyspan_1port_device = {
3144 - .tiocmget = keyspan_tiocmget,
3145 - .tiocmset = keyspan_tiocmset,
3146 - .attach = keyspan_startup,
3147 -- .shutdown = keyspan_shutdown,
3148 -+ .disconnect = keyspan_disconnect,
3149 -+ .release = keyspan_release,
3150 - };
3151 -
3152 - static struct usb_serial_driver keyspan_2port_device = {
3153 -@@ -589,7 +591,8 @@ static struct usb_serial_driver keyspan_2port_device = {
3154 - .tiocmget = keyspan_tiocmget,
3155 - .tiocmset = keyspan_tiocmset,
3156 - .attach = keyspan_startup,
3157 -- .shutdown = keyspan_shutdown,
3158 -+ .disconnect = keyspan_disconnect,
3159 -+ .release = keyspan_release,
3160 - };
3161 -
3162 - static struct usb_serial_driver keyspan_4port_device = {
3163 -@@ -609,7 +612,8 @@ static struct usb_serial_driver keyspan_4port_device = {
3164 - .tiocmget = keyspan_tiocmget,
3165 - .tiocmset = keyspan_tiocmset,
3166 - .attach = keyspan_startup,
3167 -- .shutdown = keyspan_shutdown,
3168 -+ .disconnect = keyspan_disconnect,
3169 -+ .release = keyspan_release,
3170 - };
3171 -
3172 - #endif
3173 -diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
3174 -index bf1ae24..d2e2b91 100644
3175 ---- a/drivers/usb/serial/keyspan_pda.c
3176 -+++ b/drivers/usb/serial/keyspan_pda.c
3177 -@@ -795,7 +795,7 @@ static int keyspan_pda_startup(struct usb_serial *serial)
3178 - return 0;
3179 - }
3180 -
3181 --static void keyspan_pda_shutdown(struct usb_serial *serial)
3182 -+static void keyspan_pda_release(struct usb_serial *serial)
3183 - {
3184 - dbg("%s", __func__);
3185 -
3186 -@@ -853,7 +853,7 @@ static struct usb_serial_driver keyspan_pda_device = {
3187 - .tiocmget = keyspan_pda_tiocmget,
3188 - .tiocmset = keyspan_pda_tiocmset,
3189 - .attach = keyspan_pda_startup,
3190 -- .shutdown = keyspan_pda_shutdown,
3191 -+ .release = keyspan_pda_release,
3192 - };
3193 -
3194 -
3195 -diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
3196 -index fcd9082..272a94f 100644
3197 ---- a/drivers/usb/serial/kl5kusb105.c
3198 -+++ b/drivers/usb/serial/kl5kusb105.c
3199 -@@ -73,7 +73,8 @@ static int debug;
3200 - * Function prototypes
3201 - */
3202 - static int klsi_105_startup(struct usb_serial *serial);
3203 --static void klsi_105_shutdown(struct usb_serial *serial);
3204 -+static void klsi_105_disconnect(struct usb_serial *serial);
3205 -+static void klsi_105_release(struct usb_serial *serial);
3206 - static int klsi_105_open(struct tty_struct *tty,
3207 - struct usb_serial_port *port, struct file *filp);
3208 - static void klsi_105_close(struct tty_struct *tty,
3209 -@@ -132,7 +133,8 @@ static struct usb_serial_driver kl5kusb105d_device = {
3210 - .tiocmget = klsi_105_tiocmget,
3211 - .tiocmset = klsi_105_tiocmset,
3212 - .attach = klsi_105_startup,
3213 -- .shutdown = klsi_105_shutdown,
3214 -+ .disconnect = klsi_105_disconnect,
3215 -+ .release = klsi_105_release,
3216 - .throttle = klsi_105_throttle,
3217 - .unthrottle = klsi_105_unthrottle,
3218 - };
3219 -@@ -316,7 +318,7 @@ err_cleanup:
3220 - } /* klsi_105_startup */
3221 -
3222 -
3223 --static void klsi_105_shutdown(struct usb_serial *serial)
3224 -+static void klsi_105_disconnect(struct usb_serial *serial)
3225 - {
3226 - int i;
3227 -
3228 -@@ -326,33 +328,36 @@ static void klsi_105_shutdown(struct usb_serial *serial)
3229 - for (i = 0; i < serial->num_ports; ++i) {
3230 - struct klsi_105_private *priv =
3231 - usb_get_serial_port_data(serial->port[i]);
3232 -- unsigned long flags;
3233 -
3234 - if (priv) {
3235 - /* kill our write urb pool */
3236 - int j;
3237 - struct urb **write_urbs = priv->write_urb_pool;
3238 -- spin_lock_irqsave(&priv->lock, flags);
3239 -
3240 - for (j = 0; j < NUM_URBS; j++) {
3241 - if (write_urbs[j]) {
3242 -- /* FIXME - uncomment the following
3243 -- * usb_kill_urb call when the host
3244 -- * controllers get fixed to set
3245 -- * urb->dev = NULL after the urb is
3246 -- * finished. Otherwise this call
3247 -- * oopses. */
3248 -- /* usb_kill_urb(write_urbs[j]); */
3249 -- kfree(write_urbs[j]->transfer_buffer);
3250 -+ usb_kill_urb(write_urbs[j]);
3251 - usb_free_urb(write_urbs[j]);
3252 - }
3253 - }
3254 -- spin_unlock_irqrestore(&priv->lock, flags);
3255 -- kfree(priv);
3256 -- usb_set_serial_port_data(serial->port[i], NULL);
3257 - }
3258 - }
3259 --} /* klsi_105_shutdown */
3260 -+} /* klsi_105_disconnect */
3261 -+
3262 -+
3263 -+static void klsi_105_release(struct usb_serial *serial)
3264 -+{
3265 -+ int i;
3266 -+
3267 -+ dbg("%s", __func__);
3268 -+
3269 -+ for (i = 0; i < serial->num_ports; ++i) {
3270 -+ struct klsi_105_private *priv =
3271 -+ usb_get_serial_port_data(serial->port[i]);
3272 -+
3273 -+ kfree(priv);
3274 -+ }
3275 -+} /* klsi_105_release */
3276 -
3277 - static int klsi_105_open(struct tty_struct *tty,
3278 - struct usb_serial_port *port, struct file *filp)
3279 -diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
3280 -index c148544..d88368c 100644
3281 ---- a/drivers/usb/serial/kobil_sct.c
3282 -+++ b/drivers/usb/serial/kobil_sct.c
3283 -@@ -69,7 +69,7 @@ static int debug;
3284 -
3285 - /* Function prototypes */
3286 - static int kobil_startup(struct usb_serial *serial);
3287 --static void kobil_shutdown(struct usb_serial *serial);
3288 -+static void kobil_release(struct usb_serial *serial);
3289 - static int kobil_open(struct tty_struct *tty,
3290 - struct usb_serial_port *port, struct file *filp);
3291 - static void kobil_close(struct tty_struct *tty, struct usb_serial_port *port,
3292 -@@ -118,7 +118,7 @@ static struct usb_serial_driver kobil_device = {
3293 - .id_table = id_table,
3294 - .num_ports = 1,
3295 - .attach = kobil_startup,
3296 -- .shutdown = kobil_shutdown,
3297 -+ .release = kobil_release,
3298 - .ioctl = kobil_ioctl,
3299 - .set_termios = kobil_set_termios,
3300 - .tiocmget = kobil_tiocmget,
3301 -@@ -202,17 +202,13 @@ static int kobil_startup(struct usb_serial *serial)
3302 - }
3303 -
3304 -
3305 --static void kobil_shutdown(struct usb_serial *serial)
3306 -+static void kobil_release(struct usb_serial *serial)
3307 - {
3308 - int i;
3309 - dbg("%s - port %d", __func__, serial->port[0]->number);
3310 -
3311 -- for (i = 0; i < serial->num_ports; ++i) {
3312 -- while (serial->port[i]->port.count > 0)
3313 -- kobil_close(NULL, serial->port[i], NULL);
3314 -+ for (i = 0; i < serial->num_ports; ++i)
3315 - kfree(usb_get_serial_port_data(serial->port[i]));
3316 -- usb_set_serial_port_data(serial->port[i], NULL);
3317 -- }
3318 - }
3319 -
3320 -
3321 -diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
3322 -index 82930a7..08ba8e6 100644
3323 ---- a/drivers/usb/serial/mct_u232.c
3324 -+++ b/drivers/usb/serial/mct_u232.c
3325 -@@ -92,7 +92,7 @@ static int debug;
3326 - * Function prototypes
3327 - */
3328 - static int mct_u232_startup(struct usb_serial *serial);
3329 --static void mct_u232_shutdown(struct usb_serial *serial);
3330 -+static void mct_u232_release(struct usb_serial *serial);
3331 - static int mct_u232_open(struct tty_struct *tty,
3332 - struct usb_serial_port *port, struct file *filp);
3333 - static void mct_u232_close(struct tty_struct *tty,
3334 -@@ -148,7 +148,7 @@ static struct usb_serial_driver mct_u232_device = {
3335 - .tiocmget = mct_u232_tiocmget,
3336 - .tiocmset = mct_u232_tiocmset,
3337 - .attach = mct_u232_startup,
3338 -- .shutdown = mct_u232_shutdown,
3339 -+ .release = mct_u232_release,
3340 - };
3341 -
3342 -
3343 -@@ -406,7 +406,7 @@ static int mct_u232_startup(struct usb_serial *serial)
3344 - } /* mct_u232_startup */
3345 -
3346 -
3347 --static void mct_u232_shutdown(struct usb_serial *serial)
3348 -+static void mct_u232_release(struct usb_serial *serial)
3349 - {
3350 - struct mct_u232_private *priv;
3351 - int i;
3352 -@@ -416,12 +416,9 @@ static void mct_u232_shutdown(struct usb_serial *serial)
3353 - for (i = 0; i < serial->num_ports; ++i) {
3354 - /* My special items, the standard routines free my urbs */
3355 - priv = usb_get_serial_port_data(serial->port[i]);
3356 -- if (priv) {
3357 -- usb_set_serial_port_data(serial->port[i], NULL);
3358 -- kfree(priv);
3359 -- }
3360 -+ kfree(priv);
3361 - }
3362 --} /* mct_u232_shutdown */
3363 -+} /* mct_u232_release */
3364 -
3365 - static int mct_u232_open(struct tty_struct *tty,
3366 - struct usb_serial_port *port, struct file *filp)
3367 -diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
3368 -index 24e3b5d..e0137ec 100644
3369 ---- a/drivers/usb/serial/mos7720.c
3370 -+++ b/drivers/usb/serial/mos7720.c
3371 -@@ -1522,19 +1522,16 @@ static int mos7720_startup(struct usb_serial *serial)
3372 - return 0;
3373 - }
3374 -
3375 --static void mos7720_shutdown(struct usb_serial *serial)
3376 -+static void mos7720_release(struct usb_serial *serial)
3377 - {
3378 - int i;
3379 -
3380 - /* free private structure allocated for serial port */
3381 -- for (i = 0; i < serial->num_ports; ++i) {
3382 -+ for (i = 0; i < serial->num_ports; ++i)
3383 - kfree(usb_get_serial_port_data(serial->port[i]));
3384 -- usb_set_serial_port_data(serial->port[i], NULL);
3385 -- }
3386 -
3387 - /* free private structure allocated for serial device */
3388 - kfree(usb_get_serial_data(serial));
3389 -- usb_set_serial_data(serial, NULL);
3390 - }
3391 -
3392 - static struct usb_driver usb_driver = {
3393 -@@ -1559,7 +1556,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
3394 - .throttle = mos7720_throttle,
3395 - .unthrottle = mos7720_unthrottle,
3396 - .attach = mos7720_startup,
3397 -- .shutdown = mos7720_shutdown,
3398 -+ .release = mos7720_release,
3399 - .ioctl = mos7720_ioctl,
3400 - .set_termios = mos7720_set_termios,
3401 - .write = mos7720_write,
3402 -diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
3403 -index 84fb1dc..3d30268 100644
3404 ---- a/drivers/usb/serial/mos7840.c
3405 -+++ b/drivers/usb/serial/mos7840.c
3406 -@@ -2673,16 +2673,16 @@ error:
3407 - }
3408 -
3409 - /****************************************************************************
3410 -- * mos7840_shutdown
3411 -+ * mos7840_disconnect
3412 - * This function is called whenever the device is removed from the usb bus.
3413 - ****************************************************************************/
3414 -
3415 --static void mos7840_shutdown(struct usb_serial *serial)
3416 -+static void mos7840_disconnect(struct usb_serial *serial)
3417 - {
3418 - int i;
3419 - unsigned long flags;
3420 - struct moschip_port *mos7840_port;
3421 -- dbg("%s \n", " shutdown :entering..........");
3422 -+ dbg("%s \n", " disconnect :entering..........");
3423 -
3424 - if (!serial) {
3425 - dbg("%s", "Invalid Handler \n");
3426 -@@ -2702,11 +2702,42 @@ static void mos7840_shutdown(struct usb_serial *serial)
3427 - mos7840_port->zombie = 1;
3428 - spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
3429 - usb_kill_urb(mos7840_port->control_urb);
3430 -+ }
3431 -+ }
3432 -+
3433 -+ dbg("%s", "Thank u :: ");
3434 -+
3435 -+}
3436 -+
3437 -+/****************************************************************************
3438 -+ * mos7840_release
3439 -+ * This function is called when the usb_serial structure is freed.
3440 -+ ****************************************************************************/
3441 -+
3442 -+static void mos7840_release(struct usb_serial *serial)
3443 -+{
3444 -+ int i;
3445 -+ struct moschip_port *mos7840_port;
3446 -+ dbg("%s", " release :entering..........");
3447 -+
3448 -+ if (!serial) {
3449 -+ dbg("%s", "Invalid Handler");
3450 -+ return;
3451 -+ }
3452 -+
3453 -+ /* check for the ports to be closed,close the ports and disconnect */
3454 -+
3455 -+ /* free private structure allocated for serial port *
3456 -+ * stop reads and writes on all ports */
3457 -+
3458 -+ for (i = 0; i < serial->num_ports; ++i) {
3459 -+ mos7840_port = mos7840_get_port_private(serial->port[i]);
3460 -+ dbg("mos7840_port %d = %p", i, mos7840_port);
3461 -+ if (mos7840_port) {
3462 - kfree(mos7840_port->ctrl_buf);
3463 - kfree(mos7840_port->dr);
3464 - kfree(mos7840_port);
3465 - }
3466 -- mos7840_set_port_private(serial->port[i], NULL);
3467 - }
3468 -
3469 - dbg("%s\n", "Thank u :: ");
3470 -@@ -2747,7 +2778,8 @@ static struct usb_serial_driver moschip7840_4port_device = {
3471 - .tiocmget = mos7840_tiocmget,
3472 - .tiocmset = mos7840_tiocmset,
3473 - .attach = mos7840_startup,
3474 -- .shutdown = mos7840_shutdown,
3475 -+ .disconnect = mos7840_disconnect,
3476 -+ .release = mos7840_release,
3477 - .read_bulk_callback = mos7840_bulk_in_callback,
3478 - .read_int_callback = mos7840_interrupt_callback,
3479 - };
3480 -diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
3481 -index df65397..65fb5c6 100644
3482 ---- a/drivers/usb/serial/omninet.c
3483 -+++ b/drivers/usb/serial/omninet.c
3484 -@@ -73,7 +73,8 @@ static void omninet_write_bulk_callback(struct urb *urb);
3485 - static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
3486 - const unsigned char *buf, int count);
3487 - static int omninet_write_room(struct tty_struct *tty);
3488 --static void omninet_shutdown(struct usb_serial *serial);
3489 -+static void omninet_disconnect(struct usb_serial *serial);
3490 -+static void omninet_release(struct usb_serial *serial);
3491 - static int omninet_attach(struct usb_serial *serial);
3492 -
3493 - static struct usb_device_id id_table[] = {
3494 -@@ -109,7 +110,8 @@ static struct usb_serial_driver zyxel_omninet_device = {
3495 - .write_room = omninet_write_room,
3496 - .read_bulk_callback = omninet_read_bulk_callback,
3497 - .write_bulk_callback = omninet_write_bulk_callback,
3498 -- .shutdown = omninet_shutdown,
3499 -+ .disconnect = omninet_disconnect,
3500 -+ .release = omninet_release,
3501 - };
3502 -
3503 -
3504 -@@ -347,13 +349,22 @@ static void omninet_write_bulk_callback(struct urb *urb)
3505 - }
3506 -
3507 -
3508 --static void omninet_shutdown(struct usb_serial *serial)
3509 -+static void omninet_disconnect(struct usb_serial *serial)
3510 - {
3511 - struct usb_serial_port *wport = serial->port[1];
3512 -- struct usb_serial_port *port = serial->port[0];
3513 -+
3514 - dbg("%s", __func__);
3515 -
3516 - usb_kill_urb(wport->write_urb);
3517 -+}
3518 -+
3519 -+
3520 -+static void omninet_release(struct usb_serial *serial)
3521 -+{
3522 -+ struct usb_serial_port *port = serial->port[0];
3523 -+
3524 -+ dbg("%s", __func__);
3525 -+
3526 - kfree(usb_get_serial_port_data(port));
3527 - }
3528 -
3529 -diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
3530 -index b500ad1..1e99ae0 100644
3531 ---- a/drivers/usb/serial/opticon.c
3532 -+++ b/drivers/usb/serial/opticon.c
3533 -@@ -464,7 +464,7 @@ error:
3534 - return retval;
3535 - }
3536 -
3537 --static void opticon_shutdown(struct usb_serial *serial)
3538 -+static void opticon_disconnect(struct usb_serial *serial)
3539 - {
3540 - struct opticon_private *priv = usb_get_serial_data(serial);
3541 -
3542 -@@ -472,9 +472,16 @@ static void opticon_shutdown(struct usb_serial *serial)
3543 -
3544 - usb_kill_urb(priv->bulk_read_urb);
3545 - usb_free_urb(priv->bulk_read_urb);
3546 -+}
3547 -+
3548 -+static void opticon_release(struct usb_serial *serial)
3549 -+{
3550 -+ struct opticon_private *priv = usb_get_serial_data(serial);
3551 -+
3552 -+ dbg("%s", __func__);
3553 -+
3554 - kfree(priv->bulk_in_buffer);
3555 - kfree(priv);
3556 -- usb_set_serial_data(serial, NULL);
3557 - }
3558 -
3559 - static int opticon_suspend(struct usb_interface *intf, pm_message_t message)
3560 -@@ -525,7 +532,8 @@ static struct usb_serial_driver opticon_device = {
3561 - .close = opticon_close,
3562 - .write = opticon_write,
3563 - .write_room = opticon_write_room,
3564 -- .shutdown = opticon_shutdown,
3565 -+ .disconnect = opticon_disconnect,
3566 -+ .release = opticon_release,
3567 - .throttle = opticon_throttle,
3568 - .unthrottle = opticon_unthrottle,
3569 - .ioctl = opticon_ioctl,
3570 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3571 -index 7817b82..ab3d883 100644
3572 ---- a/drivers/usb/serial/option.c
3573 -+++ b/drivers/usb/serial/option.c
3574 -@@ -48,7 +48,8 @@ static int option_open(struct tty_struct *tty, struct usb_serial_port *port,
3575 - static void option_close(struct tty_struct *tty, struct usb_serial_port *port,
3576 - struct file *filp);
3577 - static int option_startup(struct usb_serial *serial);
3578 --static void option_shutdown(struct usb_serial *serial);
3579 -+static void option_disconnect(struct usb_serial *serial);
3580 -+static void option_release(struct usb_serial *serial);
3581 - static int option_write_room(struct tty_struct *tty);
3582 -
3583 - static void option_instat_callback(struct urb *urb);
3584 -@@ -558,7 +559,8 @@ static struct usb_serial_driver option_1port_device = {
3585 - .tiocmget = option_tiocmget,
3586 - .tiocmset = option_tiocmset,
3587 - .attach = option_startup,
3588 -- .shutdown = option_shutdown,
3589 -+ .disconnect = option_disconnect,
3590 -+ .release = option_release,
3591 - .read_int_callback = option_instat_callback,
3592 - .suspend = option_suspend,
3593 - .resume = option_resume,
3594 -@@ -1129,7 +1131,14 @@ static void stop_read_write_urbs(struct usb_serial *serial)
3595 - }
3596 - }
3597 -
3598 --static void option_shutdown(struct usb_serial *serial)
3599 -+static void option_disconnect(struct usb_serial *serial)
3600 -+{
3601 -+ dbg("%s", __func__);
3602 -+
3603 -+ stop_read_write_urbs(serial);
3604 -+}
3605 -+
3606 -+static void option_release(struct usb_serial *serial)
3607 - {
3608 - int i, j;
3609 - struct usb_serial_port *port;
3610 -@@ -1137,8 +1146,6 @@ static void option_shutdown(struct usb_serial *serial)
3611 -
3612 - dbg("%s", __func__);
3613 -
3614 -- stop_read_write_urbs(serial);
3615 --
3616 - /* Now free them */
3617 - for (i = 0; i < serial->num_ports; ++i) {
3618 - port = serial->port[i];
3619 -diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
3620 -index ba551f0..f7388ef 100644
3621 ---- a/drivers/usb/serial/oti6858.c
3622 -+++ b/drivers/usb/serial/oti6858.c
3623 -@@ -160,7 +160,7 @@ static int oti6858_tiocmget(struct tty_struct *tty, struct file *file);
3624 - static int oti6858_tiocmset(struct tty_struct *tty, struct file *file,
3625 - unsigned int set, unsigned int clear);
3626 - static int oti6858_startup(struct usb_serial *serial);
3627 --static void oti6858_shutdown(struct usb_serial *serial);
3628 -+static void oti6858_release(struct usb_serial *serial);
3629 -
3630 - /* functions operating on buffers */
3631 - static struct oti6858_buf *oti6858_buf_alloc(unsigned int size);
3632 -@@ -195,7 +195,7 @@ static struct usb_serial_driver oti6858_device = {
3633 - .write_room = oti6858_write_room,
3634 - .chars_in_buffer = oti6858_chars_in_buffer,
3635 - .attach = oti6858_startup,
3636 -- .shutdown = oti6858_shutdown,
3637 -+ .release = oti6858_release,
3638 - };
3639 -
3640 - struct oti6858_private {
3641 -@@ -829,7 +829,7 @@ static int oti6858_ioctl(struct tty_struct *tty, struct file *file,
3642 - }
3643 -
3644 -
3645 --static void oti6858_shutdown(struct usb_serial *serial)
3646 -+static void oti6858_release(struct usb_serial *serial)
3647 - {
3648 - struct oti6858_private *priv;
3649 - int i;
3650 -@@ -841,7 +841,6 @@ static void oti6858_shutdown(struct usb_serial *serial)
3651 - if (priv) {
3652 - oti6858_buf_free(priv->buf);
3653 - kfree(priv);
3654 -- usb_set_serial_port_data(serial->port[i], NULL);
3655 - }
3656 - }
3657 - }
3658 -diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
3659 -index 751a533..4cf1ed1 100644
3660 ---- a/drivers/usb/serial/pl2303.c
3661 -+++ b/drivers/usb/serial/pl2303.c
3662 -@@ -897,7 +897,7 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state)
3663 - dbg("%s - error sending break = %d", __func__, result);
3664 - }
3665 -
3666 --static void pl2303_shutdown(struct usb_serial *serial)
3667 -+static void pl2303_release(struct usb_serial *serial)
3668 - {
3669 - int i;
3670 - struct pl2303_private *priv;
3671 -@@ -909,7 +909,6 @@ static void pl2303_shutdown(struct usb_serial *serial)
3672 - if (priv) {
3673 - pl2303_buf_free(priv->buf);
3674 - kfree(priv);
3675 -- usb_set_serial_port_data(serial->port[i], NULL);
3676 - }
3677 - }
3678 - }
3679 -@@ -1137,7 +1136,7 @@ static struct usb_serial_driver pl2303_device = {
3680 - .write_room = pl2303_write_room,
3681 - .chars_in_buffer = pl2303_chars_in_buffer,
3682 - .attach = pl2303_startup,
3683 -- .shutdown = pl2303_shutdown,
3684 -+ .release = pl2303_release,
3685 - };
3686 -
3687 - static int __init pl2303_init(void)
3688 -diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
3689 -index 913225c..5a26ed8 100644
3690 ---- a/drivers/usb/serial/sierra.c
3691 -+++ b/drivers/usb/serial/sierra.c
3692 -@@ -699,7 +699,7 @@ static int sierra_startup(struct usb_serial *serial)
3693 - return 0;
3694 - }
3695 -
3696 --static void sierra_shutdown(struct usb_serial *serial)
3697 -+static void sierra_disconnect(struct usb_serial *serial)
3698 - {
3699 - int i, j;
3700 - struct usb_serial_port *port;
3701 -@@ -718,10 +718,29 @@ static void sierra_shutdown(struct usb_serial *serial)
3702 - for (j = 0; j < N_IN_URB; j++) {
3703 - usb_kill_urb(portdata->in_urbs[j]);
3704 - usb_free_urb(portdata->in_urbs[j]);
3705 -- kfree(portdata->in_buffer[j]);
3706 - }
3707 -+ }
3708 -+}
3709 -+
3710 -+static void sierra_release(struct usb_serial *serial)
3711 -+{
3712 -+ int i, j;
3713 -+ struct usb_serial_port *port;
3714 -+ struct sierra_port_private *portdata;
3715 -+
3716 -+ dev_dbg(&serial->dev->dev, "%s\n", __func__);
3717 -+
3718 -+ for (i = 0; i < serial->num_ports; ++i) {
3719 -+ port = serial->port[i];
3720 -+ if (!port)
3721 -+ continue;
3722 -+ portdata = usb_get_serial_port_data(port);
3723 -+ if (!portdata)
3724 -+ continue;
3725 -+
3726 -+ for (j = 0; j < N_IN_URB; j++)
3727 -+ kfree(portdata->in_buffer[j]);
3728 - kfree(portdata);
3729 -- usb_set_serial_port_data(port, NULL);
3730 - }
3731 - }
3732 -
3733 -@@ -743,7 +762,8 @@ static struct usb_serial_driver sierra_device = {
3734 - .tiocmget = sierra_tiocmget,
3735 - .tiocmset = sierra_tiocmset,
3736 - .attach = sierra_startup,
3737 -- .shutdown = sierra_shutdown,
3738 -+ .disconnect = sierra_disconnect,
3739 -+ .release = sierra_release,
3740 - .read_int_callback = sierra_instat_callback,
3741 - };
3742 -
3743 -diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
3744 -index 5e7528c..f5403b0 100644
3745 ---- a/drivers/usb/serial/spcp8x5.c
3746 -+++ b/drivers/usb/serial/spcp8x5.c
3747 -@@ -356,7 +356,7 @@ cleanup:
3748 - }
3749 -
3750 - /* call when the device plug out. free all the memory alloced by probe */
3751 --static void spcp8x5_shutdown(struct usb_serial *serial)
3752 -+static void spcp8x5_release(struct usb_serial *serial)
3753 - {
3754 - int i;
3755 - struct spcp8x5_private *priv;
3756 -@@ -366,7 +366,6 @@ static void spcp8x5_shutdown(struct usb_serial *serial)
3757 - if (priv) {
3758 - free_ringbuf(priv->buf);
3759 - kfree(priv);
3760 -- usb_set_serial_port_data(serial->port[i] , NULL);
3761 - }
3762 - }
3763 - }
3764 -@@ -1043,7 +1042,7 @@ static struct usb_serial_driver spcp8x5_device = {
3765 - .write_bulk_callback = spcp8x5_write_bulk_callback,
3766 - .chars_in_buffer = spcp8x5_chars_in_buffer,
3767 - .attach = spcp8x5_startup,
3768 -- .shutdown = spcp8x5_shutdown,
3769 -+ .release = spcp8x5_release,
3770 - };
3771 -
3772 - static int __init spcp8x5_init(void)
3773 -diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
3774 -index 69879e4..b7a6bc8 100644
3775 ---- a/drivers/usb/serial/symbolserial.c
3776 -+++ b/drivers/usb/serial/symbolserial.c
3777 -@@ -268,7 +268,7 @@ error:
3778 - return retval;
3779 - }
3780 -
3781 --static void symbol_shutdown(struct usb_serial *serial)
3782 -+static void symbol_disconnect(struct usb_serial *serial)
3783 - {
3784 - struct symbol_private *priv = usb_get_serial_data(serial);
3785 -
3786 -@@ -276,9 +276,16 @@ static void symbol_shutdown(struct usb_serial *serial)
3787 -
3788 - usb_kill_urb(priv->int_urb);
3789 - usb_free_urb(priv->int_urb);
3790 -+}
3791 -+
3792 -+static void symbol_release(struct usb_serial *serial)
3793 -+{
3794 -+ struct symbol_private *priv = usb_get_serial_data(serial);
3795 -+
3796 -+ dbg("%s", __func__);
3797 -+
3798 - kfree(priv->int_buffer);
3799 - kfree(priv);
3800 -- usb_set_serial_data(serial, NULL);
3801 - }
3802 -
3803 - static struct usb_driver symbol_driver = {
3804 -@@ -300,7 +307,8 @@ static struct usb_serial_driver symbol_device = {
3805 - .attach = symbol_startup,
3806 - .open = symbol_open,
3807 - .close = symbol_close,
3808 -- .shutdown = symbol_shutdown,
3809 -+ .disconnect = symbol_disconnect,
3810 -+ .release = symbol_release,
3811 - .throttle = symbol_throttle,
3812 - .unthrottle = symbol_unthrottle,
3813 - };
3814 -diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
3815 -index 0a64bac..ef5f756 100644
3816 ---- a/drivers/usb/serial/ti_usb_3410_5052.c
3817 -+++ b/drivers/usb/serial/ti_usb_3410_5052.c
3818 -@@ -97,7 +97,7 @@ struct ti_device {
3819 - /* Function Declarations */
3820 -
3821 - static int ti_startup(struct usb_serial *serial);
3822 --static void ti_shutdown(struct usb_serial *serial);
3823 -+static void ti_release(struct usb_serial *serial);
3824 - static int ti_open(struct tty_struct *tty, struct usb_serial_port *port,
3825 - struct file *file);
3826 - static void ti_close(struct tty_struct *tty, struct usb_serial_port *port,
3827 -@@ -231,7 +231,7 @@ static struct usb_serial_driver ti_1port_device = {
3828 - .id_table = ti_id_table_3410,
3829 - .num_ports = 1,
3830 - .attach = ti_startup,
3831 -- .shutdown = ti_shutdown,
3832 -+ .release = ti_release,
3833 - .open = ti_open,
3834 - .close = ti_close,
3835 - .write = ti_write,
3836 -@@ -259,7 +259,7 @@ static struct usb_serial_driver ti_2port_device = {
3837 - .id_table = ti_id_table_5052,
3838 - .num_ports = 2,
3839 - .attach = ti_startup,
3840 -- .shutdown = ti_shutdown,
3841 -+ .release = ti_release,
3842 - .open = ti_open,
3843 - .close = ti_close,
3844 - .write = ti_write,
3845 -@@ -474,7 +474,7 @@ free_tdev:
3846 - }
3847 -
3848 -
3849 --static void ti_shutdown(struct usb_serial *serial)
3850 -+static void ti_release(struct usb_serial *serial)
3851 - {
3852 - int i;
3853 - struct ti_device *tdev = usb_get_serial_data(serial);
3854 -@@ -487,12 +487,10 @@ static void ti_shutdown(struct usb_serial *serial)
3855 - if (tport) {
3856 - ti_buf_free(tport->tp_write_buf);
3857 - kfree(tport);
3858 -- usb_set_serial_port_data(serial->port[i], NULL);
3859 - }
3860 - }
3861 -
3862 - kfree(tdev);
3863 -- usb_set_serial_data(serial, NULL);
3864 - }
3865 -
3866 -
3867 -diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
3868 -index f331e2b..131fc74 100644
3869 ---- a/drivers/usb/serial/usb-serial.c
3870 -+++ b/drivers/usb/serial/usb-serial.c
3871 -@@ -141,6 +141,14 @@ static void destroy_serial(struct kref *kref)
3872 - if (serial->minor != SERIAL_TTY_NO_MINOR)
3873 - return_serial(serial);
3874 -
3875 -+ serial->type->release(serial);
3876 -+
3877 -+ for (i = 0; i < serial->num_ports; ++i) {
3878 -+ port = serial->port[i];
3879 -+ if (port)
3880 -+ put_device(&port->dev);
3881 -+ }
3882 -+
3883 - /* If this is a "fake" port, we have to clean it up here, as it will
3884 - * not get cleaned up in port_release() as it was never registered with
3885 - * the driver core */
3886 -@@ -148,9 +156,8 @@ static void destroy_serial(struct kref *kref)
3887 - for (i = serial->num_ports;
3888 - i < serial->num_port_pointers; ++i) {
3889 - port = serial->port[i];
3890 -- if (!port)
3891 -- continue;
3892 -- port_free(port);
3893 -+ if (port)
3894 -+ port_free(port);
3895 - }
3896 - }
3897 -
3898 -@@ -1062,10 +1069,6 @@ void usb_serial_disconnect(struct usb_interface *interface)
3899 - serial->disconnected = 1;
3900 - mutex_unlock(&serial->disc_mutex);
3901 -
3902 -- /* Unfortunately, many of the sub-drivers expect the port structures
3903 -- * to exist when their shutdown method is called, so we have to go
3904 -- * through this awkward two-step unregistration procedure.
3905 -- */
3906 - for (i = 0; i < serial->num_ports; ++i) {
3907 - port = serial->port[i];
3908 - if (port) {
3909 -@@ -1079,14 +1082,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
3910 - device_del(&port->dev);
3911 - }
3912 - }
3913 -- serial->type->shutdown(serial);
3914 -- for (i = 0; i < serial->num_ports; ++i) {
3915 -- port = serial->port[i];
3916 -- if (port) {
3917 -- put_device(&port->dev);
3918 -- serial->port[i] = NULL;
3919 -- }
3920 -- }
3921 -+ serial->type->disconnect(serial);
3922 -
3923 - /* let the last holder of this object
3924 - * cause it to be cleaned up */
3925 -@@ -1262,7 +1258,8 @@ static void fixup_generic(struct usb_serial_driver *device)
3926 - set_to_generic_if_null(device, chars_in_buffer);
3927 - set_to_generic_if_null(device, read_bulk_callback);
3928 - set_to_generic_if_null(device, write_bulk_callback);
3929 -- set_to_generic_if_null(device, shutdown);
3930 -+ set_to_generic_if_null(device, disconnect);
3931 -+ set_to_generic_if_null(device, release);
3932 - }
3933 -
3934 - int usb_serial_register(struct usb_serial_driver *driver)
3935 -diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
3936 -index 5ac414b..e50f397 100644
3937 ---- a/drivers/usb/serial/visor.c
3938 -+++ b/drivers/usb/serial/visor.c
3939 -@@ -48,7 +48,7 @@ static void visor_unthrottle(struct tty_struct *tty);
3940 - static int visor_probe(struct usb_serial *serial,
3941 - const struct usb_device_id *id);
3942 - static int visor_calc_num_ports(struct usb_serial *serial);
3943 --static void visor_shutdown(struct usb_serial *serial);
3944 -+static void visor_release(struct usb_serial *serial);
3945 - static void visor_write_bulk_callback(struct urb *urb);
3946 - static void visor_read_bulk_callback(struct urb *urb);
3947 - static void visor_read_int_callback(struct urb *urb);
3948 -@@ -203,7 +203,7 @@ static struct usb_serial_driver handspring_device = {
3949 - .attach = treo_attach,
3950 - .probe = visor_probe,
3951 - .calc_num_ports = visor_calc_num_ports,
3952 -- .shutdown = visor_shutdown,
3953 -+ .release = visor_release,
3954 - .write = visor_write,
3955 - .write_room = visor_write_room,
3956 - .write_bulk_callback = visor_write_bulk_callback,
3957 -@@ -228,7 +228,7 @@ static struct usb_serial_driver clie_5_device = {
3958 - .attach = clie_5_attach,
3959 - .probe = visor_probe,
3960 - .calc_num_ports = visor_calc_num_ports,
3961 -- .shutdown = visor_shutdown,
3962 -+ .release = visor_release,
3963 - .write = visor_write,
3964 - .write_room = visor_write_room,
3965 - .write_bulk_callback = visor_write_bulk_callback,
3966 -@@ -920,7 +920,7 @@ static int clie_5_attach(struct usb_serial *serial)
3967 - return generic_startup(serial);
3968 - }
3969 -
3970 --static void visor_shutdown(struct usb_serial *serial)
3971 -+static void visor_release(struct usb_serial *serial)
3972 - {
3973 - struct visor_private *priv;
3974 - int i;
3975 -@@ -929,10 +929,7 @@ static void visor_shutdown(struct usb_serial *serial)
3976 -
3977 - for (i = 0; i < serial->num_ports; i++) {
3978 - priv = usb_get_serial_port_data(serial->port[i]);
3979 -- if (priv) {
3980 -- usb_set_serial_port_data(serial->port[i], NULL);
3981 -- kfree(priv);
3982 -- }
3983 -+ kfree(priv);
3984 - }
3985 - }
3986 -
3987 -diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
3988 -index 5335d32..319ec07 100644
3989 ---- a/drivers/usb/serial/whiteheat.c
3990 -+++ b/drivers/usb/serial/whiteheat.c
3991 -@@ -144,7 +144,7 @@ static int whiteheat_firmware_attach(struct usb_serial *serial);
3992 -
3993 - /* function prototypes for the Connect Tech WhiteHEAT serial converter */
3994 - static int whiteheat_attach(struct usb_serial *serial);
3995 --static void whiteheat_shutdown(struct usb_serial *serial);
3996 -+static void whiteheat_release(struct usb_serial *serial);
3997 - static int whiteheat_open(struct tty_struct *tty,
3998 - struct usb_serial_port *port, struct file *filp);
3999 - static void whiteheat_close(struct tty_struct *tty,
4000 -@@ -190,7 +190,7 @@ static struct usb_serial_driver whiteheat_device = {
4001 - .id_table = id_table_std,
4002 - .num_ports = 4,
4003 - .attach = whiteheat_attach,
4004 -- .shutdown = whiteheat_shutdown,
4005 -+ .release = whiteheat_release,
4006 - .open = whiteheat_open,
4007 - .close = whiteheat_close,
4008 - .write = whiteheat_write,
4009 -@@ -618,7 +618,7 @@ no_command_buffer:
4010 - }
4011 -
4012 -
4013 --static void whiteheat_shutdown(struct usb_serial *serial)
4014 -+static void whiteheat_release(struct usb_serial *serial)
4015 - {
4016 - struct usb_serial_port *command_port;
4017 - struct usb_serial_port *port;
4018 -diff --git a/fs/Kconfig b/fs/Kconfig
4019 -index 9f7270f..ab3ccc1 100644
4020 ---- a/fs/Kconfig
4021 -+++ b/fs/Kconfig
4022 -@@ -39,6 +39,13 @@ config FS_POSIX_ACL
4023 - bool
4024 - default n
4025 -
4026 -+source "fs/xfs/Kconfig"
4027 -+source "fs/gfs2/Kconfig"
4028 -+source "fs/ocfs2/Kconfig"
4029 -+source "fs/btrfs/Kconfig"
4030 -+
4031 -+endif # BLOCK
4032 -+
4033 - config FILE_LOCKING
4034 - bool "Enable POSIX file locking API" if EMBEDDED
4035 - default y
4036 -@@ -47,13 +54,6 @@ config FILE_LOCKING
4037 - for filesystems like NFS and for the flock() system
4038 - call. Disabling this option saves about 11k.
4039 -
4040 --source "fs/xfs/Kconfig"
4041 --source "fs/gfs2/Kconfig"
4042 --source "fs/ocfs2/Kconfig"
4043 --source "fs/btrfs/Kconfig"
4044 --
4045 --endif # BLOCK
4046 --
4047 - source "fs/notify/Kconfig"
4048 -
4049 - source "fs/quota/Kconfig"
4050 -diff --git a/fs/cifs/file.c b/fs/cifs/file.c
4051 -index 302ea15..bd44591 100644
4052 ---- a/fs/cifs/file.c
4053 -+++ b/fs/cifs/file.c
4054 -@@ -491,9 +491,9 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
4055 - return -EBADF;
4056 -
4057 - xid = GetXid();
4058 -- mutex_unlock(&pCifsFile->fh_mutex);
4059 -+ mutex_lock(&pCifsFile->fh_mutex);
4060 - if (!pCifsFile->invalidHandle) {
4061 -- mutex_lock(&pCifsFile->fh_mutex);
4062 -+ mutex_unlock(&pCifsFile->fh_mutex);
4063 - FreeXid(xid);
4064 - return 0;
4065 - }
4066 -@@ -524,7 +524,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
4067 - if (full_path == NULL) {
4068 - rc = -ENOMEM;
4069 - reopen_error_exit:
4070 -- mutex_lock(&pCifsFile->fh_mutex);
4071 -+ mutex_unlock(&pCifsFile->fh_mutex);
4072 - FreeXid(xid);
4073 - return rc;
4074 - }
4075 -@@ -566,14 +566,14 @@ reopen_error_exit:
4076 - cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
4077 - CIFS_MOUNT_MAP_SPECIAL_CHR);
4078 - if (rc) {
4079 -- mutex_lock(&pCifsFile->fh_mutex);
4080 -+ mutex_unlock(&pCifsFile->fh_mutex);
4081 - cFYI(1, ("cifs_open returned 0x%x", rc));
4082 - cFYI(1, ("oplock: %d", oplock));
4083 - } else {
4084 - reopen_success:
4085 - pCifsFile->netfid = netfid;
4086 - pCifsFile->invalidHandle = false;
4087 -- mutex_lock(&pCifsFile->fh_mutex);
4088 -+ mutex_unlock(&pCifsFile->fh_mutex);
4089 - pCifsInode = CIFS_I(inode);
4090 - if (pCifsInode) {
4091 - if (can_flush) {
4092 -diff --git a/fs/eventpoll.c b/fs/eventpoll.c
4093 -index 5458e80..085c5c0 100644
4094 ---- a/fs/eventpoll.c
4095 -+++ b/fs/eventpoll.c
4096 -@@ -98,7 +98,7 @@ struct epoll_filefd {
4097 - struct nested_call_node {
4098 - struct list_head llink;
4099 - void *cookie;
4100 -- int cpu;
4101 -+ void *ctx;
4102 - };
4103 -
4104 - /*
4105 -@@ -317,17 +317,17 @@ static void ep_nested_calls_init(struct nested_calls *ncalls)
4106 - * @nproc: Nested call core function pointer.
4107 - * @priv: Opaque data to be passed to the @nproc callback.
4108 - * @cookie: Cookie to be used to identify this nested call.
4109 -+ * @ctx: This instance context.
4110 - *
4111 - * Returns: Returns the code returned by the @nproc callback, or -1 if
4112 - * the maximum recursion limit has been exceeded.
4113 - */
4114 - static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4115 - int (*nproc)(void *, void *, int), void *priv,
4116 -- void *cookie)
4117 -+ void *cookie, void *ctx)
4118 - {
4119 - int error, call_nests = 0;
4120 - unsigned long flags;
4121 -- int this_cpu = get_cpu();
4122 - struct list_head *lsthead = &ncalls->tasks_call_list;
4123 - struct nested_call_node *tncur;
4124 - struct nested_call_node tnode;
4125 -@@ -340,7 +340,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4126 - * very much limited.
4127 - */
4128 - list_for_each_entry(tncur, lsthead, llink) {
4129 -- if (tncur->cpu == this_cpu &&
4130 -+ if (tncur->ctx == ctx &&
4131 - (tncur->cookie == cookie || ++call_nests > max_nests)) {
4132 - /*
4133 - * Ops ... loop detected or maximum nest level reached.
4134 -@@ -352,7 +352,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4135 - }
4136 -
4137 - /* Add the current task and cookie to the list */
4138 -- tnode.cpu = this_cpu;
4139 -+ tnode.ctx = ctx;
4140 - tnode.cookie = cookie;
4141 - list_add(&tnode.llink, lsthead);
4142 -
4143 -@@ -364,10 +364,9 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4144 - /* Remove the current task from the list */
4145 - spin_lock_irqsave(&ncalls->lock, flags);
4146 - list_del(&tnode.llink);
4147 -- out_unlock:
4148 -+out_unlock:
4149 - spin_unlock_irqrestore(&ncalls->lock, flags);
4150 -
4151 -- put_cpu();
4152 - return error;
4153 - }
4154 -
4155 -@@ -408,8 +407,12 @@ static int ep_poll_wakeup_proc(void *priv, void *cookie, int call_nests)
4156 - */
4157 - static void ep_poll_safewake(wait_queue_head_t *wq)
4158 - {
4159 -+ int this_cpu = get_cpu();
4160 -+
4161 - ep_call_nested(&poll_safewake_ncalls, EP_MAX_NESTS,
4162 -- ep_poll_wakeup_proc, NULL, wq);
4163 -+ ep_poll_wakeup_proc, NULL, wq, (void *) (long) this_cpu);
4164 -+
4165 -+ put_cpu();
4166 - }
4167 -
4168 - /*
4169 -@@ -663,7 +666,7 @@ static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait)
4170 - * could re-enter here.
4171 - */
4172 - pollflags = ep_call_nested(&poll_readywalk_ncalls, EP_MAX_NESTS,
4173 -- ep_poll_readyevents_proc, ep, ep);
4174 -+ ep_poll_readyevents_proc, ep, ep, current);
4175 -
4176 - return pollflags != -1 ? pollflags : 0;
4177 - }
4178 -diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
4179 -index 91013ff..39083e4 100644
4180 ---- a/fs/fs-writeback.c
4181 -+++ b/fs/fs-writeback.c
4182 -@@ -289,7 +289,6 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
4183 - int ret;
4184 -
4185 - BUG_ON(inode->i_state & I_SYNC);
4186 -- WARN_ON(inode->i_state & I_NEW);
4187 -
4188 - /* Set I_SYNC, reset I_DIRTY */
4189 - dirty = inode->i_state & I_DIRTY;
4190 -@@ -314,7 +313,6 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
4191 - }
4192 -
4193 - spin_lock(&inode_lock);
4194 -- WARN_ON(inode->i_state & I_NEW);
4195 - inode->i_state &= ~I_SYNC;
4196 - if (!(inode->i_state & I_FREEING)) {
4197 - if (!(inode->i_state & I_DIRTY) &&
4198 -diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
4199 -index bbbd5f2..41d6045 100644
4200 ---- a/fs/jfs/jfs_extent.c
4201 -+++ b/fs/jfs/jfs_extent.c
4202 -@@ -391,6 +391,7 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp)
4203 - }
4204 - XADaddress(xp, xaddr);
4205 - XADlength(xp, xlen);
4206 -+ XADoffset(xp, prev);
4207 - /*
4208 - * only preserve the abnr flag within the xad flags
4209 - * of the returned hint.
4210 -diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
4211 -index 79ff8d9..1a0f632 100644
4212 ---- a/fs/ocfs2/super.c
4213 -+++ b/fs/ocfs2/super.c
4214 -@@ -232,20 +232,24 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4215 - "%10s => Opts: 0x%lX AtimeQuanta: %u\n", "Mount",
4216 - osb->s_mount_opt, osb->s_atime_quantum);
4217 -
4218 -- out += snprintf(buf + out, len - out,
4219 -- "%10s => Stack: %s Name: %*s Version: %d.%d\n",
4220 -- "Cluster",
4221 -- (*osb->osb_cluster_stack == '\0' ?
4222 -- "o2cb" : osb->osb_cluster_stack),
4223 -- cconn->cc_namelen, cconn->cc_name,
4224 -- cconn->cc_version.pv_major, cconn->cc_version.pv_minor);
4225 -+ if (cconn) {
4226 -+ out += snprintf(buf + out, len - out,
4227 -+ "%10s => Stack: %s Name: %*s "
4228 -+ "Version: %d.%d\n", "Cluster",
4229 -+ (*osb->osb_cluster_stack == '\0' ?
4230 -+ "o2cb" : osb->osb_cluster_stack),
4231 -+ cconn->cc_namelen, cconn->cc_name,
4232 -+ cconn->cc_version.pv_major,
4233 -+ cconn->cc_version.pv_minor);
4234 -+ }
4235 -
4236 - spin_lock(&osb->dc_task_lock);
4237 - out += snprintf(buf + out, len - out,
4238 - "%10s => Pid: %d Count: %lu WakeSeq: %lu "
4239 - "WorkSeq: %lu\n", "DownCnvt",
4240 -- task_pid_nr(osb->dc_task), osb->blocked_lock_count,
4241 -- osb->dc_wake_sequence, osb->dc_work_sequence);
4242 -+ (osb->dc_task ? task_pid_nr(osb->dc_task) : -1),
4243 -+ osb->blocked_lock_count, osb->dc_wake_sequence,
4244 -+ osb->dc_work_sequence);
4245 - spin_unlock(&osb->dc_task_lock);
4246 -
4247 - spin_lock(&osb->osb_lock);
4248 -@@ -265,14 +269,15 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4249 -
4250 - out += snprintf(buf + out, len - out,
4251 - "%10s => Pid: %d Interval: %lu Needs: %d\n", "Commit",
4252 -- task_pid_nr(osb->commit_task), osb->osb_commit_interval,
4253 -+ (osb->commit_task ? task_pid_nr(osb->commit_task) : -1),
4254 -+ osb->osb_commit_interval,
4255 - atomic_read(&osb->needs_checkpoint));
4256 -
4257 - out += snprintf(buf + out, len - out,
4258 -- "%10s => State: %d NumTxns: %d TxnId: %lu\n",
4259 -+ "%10s => State: %d TxnId: %lu NumTxns: %d\n",
4260 - "Journal", osb->journal->j_state,
4261 -- atomic_read(&osb->journal->j_num_trans),
4262 -- osb->journal->j_trans_id);
4263 -+ osb->journal->j_trans_id,
4264 -+ atomic_read(&osb->journal->j_num_trans));
4265 -
4266 - out += snprintf(buf + out, len - out,
4267 - "%10s => GlobalAllocs: %d LocalAllocs: %d "
4268 -@@ -300,7 +305,6 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4269 -
4270 - out += snprintf(buf + out, len - out, "%10s => %3s %10s\n",
4271 - "Slots", "Num", "RecoGen");
4272 --
4273 - for (i = 0; i < osb->max_slots; ++i) {
4274 - out += snprintf(buf + out, len - out,
4275 - "%10s %c %3d %10d\n",
4276 -diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
4277 -index 3a6b193..0ff7566 100644
4278 ---- a/fs/ramfs/inode.c
4279 -+++ b/fs/ramfs/inode.c
4280 -@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts)
4281 - return -EINVAL;
4282 - opts->mode = option & S_IALLUGO;
4283 - break;
4284 -- default:
4285 -- printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
4286 -- return -EINVAL;
4287 -+ /*
4288 -+ * We might like to report bad mount options here;
4289 -+ * but traditionally ramfs has ignored all mount options,
4290 -+ * and as it is used as a !CONFIG_SHMEM simple substitute
4291 -+ * for tmpfs, better continue to ignore other mount options.
4292 -+ */
4293 - }
4294 - }
4295 -
4296 -diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
4297 -index ca7c600..b5cba98 100644
4298 ---- a/fs/xfs/xfs_bmap.c
4299 -+++ b/fs/xfs/xfs_bmap.c
4300 -@@ -6085,6 +6085,7 @@ xfs_getbmap(
4301 - break;
4302 - }
4303 -
4304 -+ kmem_free(out);
4305 - return error;
4306 - }
4307 -
4308 -diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
4309 -index cca686b..875451f 100644
4310 ---- a/include/linux/firmware-map.h
4311 -+++ b/include/linux/firmware-map.h
4312 -@@ -24,21 +24,17 @@
4313 - */
4314 - #ifdef CONFIG_FIRMWARE_MEMMAP
4315 -
4316 --int firmware_map_add(resource_size_t start, resource_size_t end,
4317 -- const char *type);
4318 --int firmware_map_add_early(resource_size_t start, resource_size_t end,
4319 -- const char *type);
4320 -+int firmware_map_add(u64 start, u64 end, const char *type);
4321 -+int firmware_map_add_early(u64 start, u64 end, const char *type);
4322 -
4323 - #else /* CONFIG_FIRMWARE_MEMMAP */
4324 -
4325 --static inline int firmware_map_add(resource_size_t start, resource_size_t end,
4326 -- const char *type)
4327 -+static inline int firmware_map_add(u64 start, u64 end, const char *type)
4328 - {
4329 - return 0;
4330 - }
4331 -
4332 --static inline int firmware_map_add_early(resource_size_t start,
4333 -- resource_size_t end, const char *type)
4334 -+static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
4335 - {
4336 - return 0;
4337 - }
4338 -diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
4339 -index 894a56e..5eed8fa 100644
4340 ---- a/include/linux/kvm_host.h
4341 -+++ b/include/linux/kvm_host.h
4342 -@@ -125,6 +125,7 @@ struct kvm_kernel_irq_routing_entry {
4343 - struct kvm {
4344 - struct mutex lock; /* protects the vcpus array and APIC accesses */
4345 - spinlock_t mmu_lock;
4346 -+ spinlock_t requests_lock;
4347 - struct rw_semaphore slots_lock;
4348 - struct mm_struct *mm; /* userspace tied to this vm */
4349 - int nmemslots;
4350 -diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
4351 -index bf8f119..9f29d86 100644
4352 ---- a/include/linux/mlx4/qp.h
4353 -+++ b/include/linux/mlx4/qp.h
4354 -@@ -165,6 +165,7 @@ enum {
4355 - MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
4356 - MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
4357 - MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
4358 -+ MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
4359 - };
4360 -
4361 - struct mlx4_wqe_ctrl_seg {
4362 -diff --git a/include/linux/serial.h b/include/linux/serial.h
4363 -index 9136cc5..e5bb75a 100644
4364 ---- a/include/linux/serial.h
4365 -+++ b/include/linux/serial.h
4366 -@@ -96,54 +96,76 @@ struct serial_uart_config {
4367 -
4368 - /*
4369 - * Definitions for async_struct (and serial_struct) flags field
4370 -+ *
4371 -+ * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
4372 - */
4373 --#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
4374 -- on the callout port */
4375 --#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
4376 --#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */
4377 --#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
4378 --
4379 --#define ASYNC_SPD_MASK 0x1030
4380 --#define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
4381 --
4382 --#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
4383 --#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */
4384 --
4385 --#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
4386 --#define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
4387 --#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
4388 --#define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
4389 --#define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
4390 --
4391 --#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */
4392 --
4393 --#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */
4394 --#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */
4395 --
4396 --#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
4397 --
4398 --#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety
4399 -- * checks. Note: can be dangerous! */
4400 --
4401 --#define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */
4402 --
4403 --#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */
4404 --#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged
4405 -- * users can set or reset */
4406 --
4407 --/* Internal flags used only by kernel/chr_drv/serial.c */
4408 --#define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */
4409 --#define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
4410 --#define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
4411 --#define ASYNC_CLOSING 0x08000000 /* Serial port is closing */
4412 --#define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
4413 --#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
4414 --#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards
4415 -- --- no longer used */
4416 --#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */
4417 --
4418 --#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */
4419 --#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */
4420 -+#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
4421 -+ * on the callout port */
4422 -+#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
4423 -+#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
4424 -+#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */
4425 -+#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
4426 -+#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
4427 -+#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
4428 -+#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
4429 -+ * autoconfiguration */
4430 -+#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */
4431 -+#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */
4432 -+#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */
4433 -+#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
4434 -+#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
4435 -+#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
4436 -+#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
4437 -+ * checks. Note: can be dangerous! */
4438 -+#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
4439 -+#define ASYNCB_LAST_USER 15
4440 -+
4441 -+/* Internal flags used only by kernel */
4442 -+#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
4443 -+#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
4444 -+#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
4445 -+#define ASYNCB_CLOSING 27 /* Serial port is closing */
4446 -+#define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */
4447 -+#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
4448 -+#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
4449 -+#define ASYNCB_CONS_FLOW 23 /* flow control for console */
4450 -+#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
4451 -+#define ASYNCB_FIRST_KERNEL 22
4452 -+
4453 -+#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
4454 -+#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
4455 -+#define ASYNC_SAK (1U << ASYNCB_SAK)
4456 -+#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
4457 -+#define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI)
4458 -+#define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI)
4459 -+#define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST)
4460 -+#define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ)
4461 -+#define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT)
4462 -+#define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT)
4463 -+#define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP)
4464 -+#define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD)
4465 -+#define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI)
4466 -+#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
4467 -+#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
4468 -+#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
4469 -+
4470 -+#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1)
4471 -+#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
4472 -+ ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
4473 -+#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
4474 -+#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
4475 -+#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
4476 -+
4477 -+#define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
4478 -+#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
4479 -+#define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF)
4480 -+#define ASYNC_CLOSING (1U << ASYNCB_CLOSING)
4481 -+#define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW)
4482 -+#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
4483 -+#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
4484 -+#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
4485 -+#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
4486 -+#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
4487 -
4488 - /*
4489 - * Multiport serial configuration structure --- external structure
4490 -diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
4491 -index 625e9e4..6d6c3b8 100644
4492 ---- a/include/linux/usb/serial.h
4493 -+++ b/include/linux/usb/serial.h
4494 -@@ -181,8 +181,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
4495 - * This will be called when the struct usb_serial structure is fully set
4496 - * set up. Do any local initialization of the device, or any private
4497 - * memory structure allocation at this point in time.
4498 -- * @shutdown: pointer to the driver's shutdown function. This will be
4499 -- * called when the device is removed from the system.
4500 -+ * @disconnect: pointer to the driver's disconnect function. This will be
4501 -+ * called when the device is unplugged or unbound from the driver.
4502 -+ * @release: pointer to the driver's release function. This will be called
4503 -+ * when the usb_serial data structure is about to be destroyed.
4504 - * @usb_driver: pointer to the struct usb_driver that controls this
4505 - * device. This is necessary to allow dynamic ids to be added to
4506 - * the driver from sysfs.
4507 -@@ -212,7 +214,8 @@ struct usb_serial_driver {
4508 - int (*attach)(struct usb_serial *serial);
4509 - int (*calc_num_ports) (struct usb_serial *serial);
4510 -
4511 -- void (*shutdown)(struct usb_serial *serial);
4512 -+ void (*disconnect)(struct usb_serial *serial);
4513 -+ void (*release)(struct usb_serial *serial);
4514 -
4515 - int (*port_probe)(struct usb_serial_port *port);
4516 - int (*port_remove)(struct usb_serial_port *port);
4517 -@@ -292,7 +295,8 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
4518 - extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
4519 - extern void usb_serial_generic_throttle(struct tty_struct *tty);
4520 - extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
4521 --extern void usb_serial_generic_shutdown(struct usb_serial *serial);
4522 -+extern void usb_serial_generic_disconnect(struct usb_serial *serial);
4523 -+extern void usb_serial_generic_release(struct usb_serial *serial);
4524 - extern int usb_serial_generic_register(int debug);
4525 - extern void usb_serial_generic_deregister(void);
4526 -
4527 -diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
4528 -index 524cd1b..cfdd3ca 100644
4529 ---- a/include/linux/vmstat.h
4530 -+++ b/include/linux/vmstat.h
4531 -@@ -36,6 +36,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
4532 - FOR_ALL_ZONES(PGSTEAL),
4533 - FOR_ALL_ZONES(PGSCAN_KSWAPD),
4534 - FOR_ALL_ZONES(PGSCAN_DIRECT),
4535 -+#ifdef CONFIG_NUMA
4536 -+ PGSCAN_ZONE_RECLAIM_FAILED,
4537 -+#endif
4538 - PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
4539 - PAGEOUTRUN, ALLOCSTALL, PGROTATED,
4540 - #ifdef CONFIG_HUGETLB_PAGE
4541 -diff --git a/include/net/x25.h b/include/net/x25.h
4542 -index fc3f03d..2cda040 100644
4543 ---- a/include/net/x25.h
4544 -+++ b/include/net/x25.h
4545 -@@ -187,7 +187,7 @@ extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
4546 - extern int x25_addr_aton(unsigned char *, struct x25_address *,
4547 - struct x25_address *);
4548 - extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
4549 --extern void x25_destroy_socket(struct sock *);
4550 -+extern void x25_destroy_socket_from_timer(struct sock *);
4551 - extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
4552 - extern void x25_kill_by_neigh(struct x25_neigh *);
4553 -
4554 -diff --git a/kernel/acct.c b/kernel/acct.c
4555 -index 7afa315..9f33910 100644
4556 ---- a/kernel/acct.c
4557 -+++ b/kernel/acct.c
4558 -@@ -215,6 +215,7 @@ static void acct_file_reopen(struct bsd_acct_struct *acct, struct file *file,
4559 - static int acct_on(char *name)
4560 - {
4561 - struct file *file;
4562 -+ struct vfsmount *mnt;
4563 - int error;
4564 - struct pid_namespace *ns;
4565 - struct bsd_acct_struct *acct = NULL;
4566 -@@ -256,11 +257,12 @@ static int acct_on(char *name)
4567 - acct = NULL;
4568 - }
4569 -
4570 -- mnt_pin(file->f_path.mnt);
4571 -+ mnt = file->f_path.mnt;
4572 -+ mnt_pin(mnt);
4573 - acct_file_reopen(ns->bacct, file, ns);
4574 - spin_unlock(&acct_lock);
4575 -
4576 -- mntput(file->f_path.mnt); /* it's pinned, now give up active reference */
4577 -+ mntput(mnt); /* it's pinned, now give up active reference */
4578 - kfree(acct);
4579 -
4580 - return 0;
4581 -diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
4582 -index c9a0b7d..90f1347 100644
4583 ---- a/kernel/trace/trace_functions.c
4584 -+++ b/kernel/trace/trace_functions.c
4585 -@@ -193,9 +193,11 @@ static void tracing_start_function_trace(void)
4586 - static void tracing_stop_function_trace(void)
4587 - {
4588 - ftrace_function_enabled = 0;
4589 -- /* OK if they are not registered */
4590 -- unregister_ftrace_function(&trace_stack_ops);
4591 -- unregister_ftrace_function(&trace_ops);
4592 -+
4593 -+ if (func_flags.val & TRACE_FUNC_OPT_STACK)
4594 -+ unregister_ftrace_function(&trace_stack_ops);
4595 -+ else
4596 -+ unregister_ftrace_function(&trace_ops);
4597 - }
4598 -
4599 - static int func_set_flag(u32 old_flags, u32 bit, int set)
4600 -diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
4601 -index 6cdcf38..3be4b7c 100644
4602 ---- a/lib/Kconfig.debug
4603 -+++ b/lib/Kconfig.debug
4604 -@@ -440,7 +440,7 @@ config LOCKDEP
4605 - bool
4606 - depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
4607 - select STACKTRACE
4608 -- select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
4609 -+ select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
4610 - select KALLSYMS
4611 - select KALLSYMS_ALL
4612 -
4613 -diff --git a/lib/dma-debug.c b/lib/dma-debug.c
4614 -index 69da09a..2b16536 100644
4615 ---- a/lib/dma-debug.c
4616 -+++ b/lib/dma-debug.c
4617 -@@ -185,15 +185,50 @@ static void put_hash_bucket(struct hash_bucket *bucket,
4618 - static struct dma_debug_entry *hash_bucket_find(struct hash_bucket *bucket,
4619 - struct dma_debug_entry *ref)
4620 - {
4621 -- struct dma_debug_entry *entry;
4622 -+ struct dma_debug_entry *entry, *ret = NULL;
4623 -+ int matches = 0, match_lvl, last_lvl = 0;
4624 -
4625 - list_for_each_entry(entry, &bucket->list, list) {
4626 -- if ((entry->dev_addr == ref->dev_addr) &&
4627 -- (entry->dev == ref->dev))
4628 -+ if ((entry->dev_addr != ref->dev_addr) ||
4629 -+ (entry->dev != ref->dev))
4630 -+ continue;
4631 -+
4632 -+ /*
4633 -+ * Some drivers map the same physical address multiple
4634 -+ * times. Without a hardware IOMMU this results in the
4635 -+ * same device addresses being put into the dma-debug
4636 -+ * hash multiple times too. This can result in false
4637 -+ * positives being reported. Therfore we implement a
4638 -+ * best-fit algorithm here which returns the entry from
4639 -+ * the hash which fits best to the reference value
4640 -+ * instead of the first-fit.
4641 -+ */
4642 -+ matches += 1;
4643 -+ match_lvl = 0;
4644 -+ entry->size == ref->size ? ++match_lvl : match_lvl;
4645 -+ entry->type == ref->type ? ++match_lvl : match_lvl;
4646 -+ entry->direction == ref->direction ? ++match_lvl : match_lvl;
4647 -+
4648 -+ if (match_lvl == 3) {
4649 -+ /* perfect-fit - return the result */
4650 - return entry;
4651 -+ } else if (match_lvl > last_lvl) {
4652 -+ /*
4653 -+ * We found an entry that fits better then the
4654 -+ * previous one
4655 -+ */
4656 -+ last_lvl = match_lvl;
4657 -+ ret = entry;
4658 -+ }
4659 - }
4660 -
4661 -- return NULL;
4662 -+ /*
4663 -+ * If we have multiple matches but no perfect-fit, just return
4664 -+ * NULL.
4665 -+ */
4666 -+ ret = (matches == 1) ? ret : NULL;
4667 -+
4668 -+ return ret;
4669 - }
4670 -
4671 - /*
4672 -diff --git a/lib/genalloc.c b/lib/genalloc.c
4673 -index f6d276d..eed2bdb 100644
4674 ---- a/lib/genalloc.c
4675 -+++ b/lib/genalloc.c
4676 -@@ -85,7 +85,6 @@ void gen_pool_destroy(struct gen_pool *pool)
4677 - int bit, end_bit;
4678 -
4679 -
4680 -- write_lock(&pool->lock);
4681 - list_for_each_safe(_chunk, _next_chunk, &pool->chunks) {
4682 - chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
4683 - list_del(&chunk->next_chunk);
4684 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
4685 -index fe753ec..f820383 100644
4686 ---- a/mm/page_alloc.c
4687 -+++ b/mm/page_alloc.c
4688 -@@ -2812,7 +2812,7 @@ bad:
4689 - if (dzone == zone)
4690 - break;
4691 - kfree(zone_pcp(dzone, cpu));
4692 -- zone_pcp(dzone, cpu) = NULL;
4693 -+ zone_pcp(dzone, cpu) = &boot_pageset[cpu];
4694 - }
4695 - return -ENOMEM;
4696 - }
4697 -@@ -2827,7 +2827,7 @@ static inline void free_zone_pagesets(int cpu)
4698 - /* Free per_cpu_pageset if it is slab allocated */
4699 - if (pset != &boot_pageset[cpu])
4700 - kfree(pset);
4701 -- zone_pcp(zone, cpu) = NULL;
4702 -+ zone_pcp(zone, cpu) = &boot_pageset[cpu];
4703 - }
4704 - }
4705 -
4706 -@@ -4501,7 +4501,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
4707 - ret = proc_dointvec_minmax(table, write, file, buffer, length, ppos);
4708 - if (!write || (ret == -EINVAL))
4709 - return ret;
4710 -- for_each_zone(zone) {
4711 -+ for_each_populated_zone(zone) {
4712 - for_each_online_cpu(cpu) {
4713 - unsigned long high;
4714 - high = zone->present_pages / percpu_pagelist_fraction;
4715 -diff --git a/mm/vmscan.c b/mm/vmscan.c
4716 -index d254306..2500b01 100644
4717 ---- a/mm/vmscan.c
4718 -+++ b/mm/vmscan.c
4719 -@@ -2290,6 +2290,48 @@ int sysctl_min_unmapped_ratio = 1;
4720 - */
4721 - int sysctl_min_slab_ratio = 5;
4722 -
4723 -+static inline unsigned long zone_unmapped_file_pages(struct zone *zone)
4724 -+{
4725 -+ unsigned long file_mapped = zone_page_state(zone, NR_FILE_MAPPED);
4726 -+ unsigned long file_lru = zone_page_state(zone, NR_INACTIVE_FILE) +
4727 -+ zone_page_state(zone, NR_ACTIVE_FILE);
4728 -+
4729 -+ /*
4730 -+ * It's possible for there to be more file mapped pages than
4731 -+ * accounted for by the pages on the file LRU lists because
4732 -+ * tmpfs pages accounted for as ANON can also be FILE_MAPPED
4733 -+ */
4734 -+ return (file_lru > file_mapped) ? (file_lru - file_mapped) : 0;
4735 -+}
4736 -+
4737 -+/* Work out how many page cache pages we can reclaim in this reclaim_mode */
4738 -+static long zone_pagecache_reclaimable(struct zone *zone)
4739 -+{
4740 -+ long nr_pagecache_reclaimable;
4741 -+ long delta = 0;
4742 -+
4743 -+ /*
4744 -+ * If RECLAIM_SWAP is set, then all file pages are considered
4745 -+ * potentially reclaimable. Otherwise, we have to worry about
4746 -+ * pages like swapcache and zone_unmapped_file_pages() provides
4747 -+ * a better estimate
4748 -+ */
4749 -+ if (zone_reclaim_mode & RECLAIM_SWAP)
4750 -+ nr_pagecache_reclaimable = zone_page_state(zone, NR_FILE_PAGES);
4751 -+ else
4752 -+ nr_pagecache_reclaimable = zone_unmapped_file_pages(zone);
4753 -+
4754 -+ /* If we can't clean pages, remove dirty pages from consideration */
4755 -+ if (!(zone_reclaim_mode & RECLAIM_WRITE))
4756 -+ delta += zone_page_state(zone, NR_FILE_DIRTY);
4757 -+
4758 -+ /* Watch for any possible underflows due to delta */
4759 -+ if (unlikely(delta > nr_pagecache_reclaimable))
4760 -+ delta = nr_pagecache_reclaimable;
4761 -+
4762 -+ return nr_pagecache_reclaimable - delta;
4763 -+}
4764 -+
4765 - /*
4766 - * Try to free up some pages from this zone through reclaim.
4767 - */
4768 -@@ -2324,9 +2366,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4769 - reclaim_state.reclaimed_slab = 0;
4770 - p->reclaim_state = &reclaim_state;
4771 -
4772 -- if (zone_page_state(zone, NR_FILE_PAGES) -
4773 -- zone_page_state(zone, NR_FILE_MAPPED) >
4774 -- zone->min_unmapped_pages) {
4775 -+ if (zone_pagecache_reclaimable(zone) > zone->min_unmapped_pages) {
4776 - /*
4777 - * Free memory by calling shrink zone with increasing
4778 - * priorities until we have enough memory freed.
4779 -@@ -2384,10 +2424,8 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4780 - * if less than a specified percentage of the zone is used by
4781 - * unmapped file backed pages.
4782 - */
4783 -- if (zone_page_state(zone, NR_FILE_PAGES) -
4784 -- zone_page_state(zone, NR_FILE_MAPPED) <= zone->min_unmapped_pages
4785 -- && zone_page_state(zone, NR_SLAB_RECLAIMABLE)
4786 -- <= zone->min_slab_pages)
4787 -+ if (zone_pagecache_reclaimable(zone) <= zone->min_unmapped_pages &&
4788 -+ zone_page_state(zone, NR_SLAB_RECLAIMABLE) <= zone->min_slab_pages)
4789 - return 0;
4790 -
4791 - if (zone_is_all_unreclaimable(zone))
4792 -@@ -2414,6 +2452,9 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4793 - ret = __zone_reclaim(zone, gfp_mask, order);
4794 - zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
4795 -
4796 -+ if (!ret)
4797 -+ count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED);
4798 -+
4799 - return ret;
4800 - }
4801 - #endif
4802 -diff --git a/mm/vmstat.c b/mm/vmstat.c
4803 -index 74d66db..ddb360a 100644
4804 ---- a/mm/vmstat.c
4805 -+++ b/mm/vmstat.c
4806 -@@ -675,6 +675,9 @@ static const char * const vmstat_text[] = {
4807 - TEXTS_FOR_ZONES("pgscan_kswapd")
4808 - TEXTS_FOR_ZONES("pgscan_direct")
4809 -
4810 -+#ifdef CONFIG_NUMA
4811 -+ "zone_reclaim_failed",
4812 -+#endif
4813 - "pginodesteal",
4814 - "slabs_scanned",
4815 - "kswapd_steal",
4816 -diff --git a/net/ipv4/route.c b/net/ipv4/route.c
4817 -index 28205e5..d777f84 100644
4818 ---- a/net/ipv4/route.c
4819 -+++ b/net/ipv4/route.c
4820 -@@ -1081,8 +1081,35 @@ restart:
4821 - now = jiffies;
4822 -
4823 - if (!rt_caching(dev_net(rt->u.dst.dev))) {
4824 -- rt_drop(rt);
4825 -- return 0;
4826 -+ /*
4827 -+ * If we're not caching, just tell the caller we
4828 -+ * were successful and don't touch the route. The
4829 -+ * caller hold the sole reference to the cache entry, and
4830 -+ * it will be released when the caller is done with it.
4831 -+ * If we drop it here, the callers have no way to resolve routes
4832 -+ * when we're not caching. Instead, just point *rp at rt, so
4833 -+ * the caller gets a single use out of the route
4834 -+ * Note that we do rt_free on this new route entry, so that
4835 -+ * once its refcount hits zero, we are still able to reap it
4836 -+ * (Thanks Alexey)
4837 -+ * Note also the rt_free uses call_rcu. We don't actually
4838 -+ * need rcu protection here, this is just our path to get
4839 -+ * on the route gc list.
4840 -+ */
4841 -+
4842 -+ if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) {
4843 -+ int err = arp_bind_neighbour(&rt->u.dst);
4844 -+ if (err) {
4845 -+ if (net_ratelimit())
4846 -+ printk(KERN_WARNING
4847 -+ "Neighbour table failure & not caching routes.\n");
4848 -+ rt_drop(rt);
4849 -+ return err;
4850 -+ }
4851 -+ }
4852 -+
4853 -+ rt_free(rt);
4854 -+ goto skip_hashing;
4855 - }
4856 -
4857 - rthp = &rt_hash_table[hash].chain;
4858 -@@ -1196,7 +1223,8 @@ restart:
4859 - #if RT_CACHE_DEBUG >= 2
4860 - if (rt->u.dst.rt_next) {
4861 - struct rtable *trt;
4862 -- printk(KERN_DEBUG "rt_cache @%02x: %pI4", hash, &rt->rt_dst);
4863 -+ printk(KERN_DEBUG "rt_cache @%02x: %pI4",
4864 -+ hash, &rt->rt_dst);
4865 - for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next)
4866 - printk(" . %pI4", &trt->rt_dst);
4867 - printk("\n");
4868 -@@ -1210,6 +1238,8 @@ restart:
4869 - rcu_assign_pointer(rt_hash_table[hash].chain, rt);
4870 -
4871 - spin_unlock_bh(rt_hash_lock_addr(hash));
4872 -+
4873 -+skip_hashing:
4874 - *rp = rt;
4875 - return 0;
4876 - }
4877 -diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
4878 -index d9233ec..2681dfa 100644
4879 ---- a/net/mac80211/rc80211_minstrel.c
4880 -+++ b/net/mac80211/rc80211_minstrel.c
4881 -@@ -216,7 +216,7 @@ minstrel_get_next_sample(struct minstrel_sta_info *mi)
4882 - unsigned int sample_ndx;
4883 - sample_ndx = SAMPLE_TBL(mi, mi->sample_idx, mi->sample_column);
4884 - mi->sample_idx++;
4885 -- if (mi->sample_idx > (mi->n_rates - 2)) {
4886 -+ if ((int) mi->sample_idx > (mi->n_rates - 2)) {
4887 - mi->sample_idx = 0;
4888 - mi->sample_column++;
4889 - if (mi->sample_column >= SAMPLE_COLUMNS)
4890 -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
4891 -index 2456e4e..b759106 100644
4892 ---- a/net/wireless/nl80211.c
4893 -+++ b/net/wireless/nl80211.c
4894 -@@ -2385,18 +2385,24 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
4895 - rem_reg_rules) {
4896 - num_rules++;
4897 - if (num_rules > NL80211_MAX_SUPP_REG_RULES)
4898 -- goto bad_reg;
4899 -+ return -EINVAL;
4900 - }
4901 -
4902 -- if (!reg_is_valid_request(alpha2))
4903 -- return -EINVAL;
4904 -+ mutex_lock(&cfg80211_mutex);
4905 -+
4906 -+ if (!reg_is_valid_request(alpha2)) {
4907 -+ r = -EINVAL;
4908 -+ goto bad_reg;
4909 -+ }
4910 -
4911 - size_of_regd = sizeof(struct ieee80211_regdomain) +
4912 - (num_rules * sizeof(struct ieee80211_reg_rule));
4913 -
4914 - rd = kzalloc(size_of_regd, GFP_KERNEL);
4915 -- if (!rd)
4916 -- return -ENOMEM;
4917 -+ if (!rd) {
4918 -+ r = -ENOMEM;
4919 -+ goto bad_reg;
4920 -+ }
4921 -
4922 - rd->n_reg_rules = num_rules;
4923 - rd->alpha2[0] = alpha2[0];
4924 -@@ -2413,20 +2419,24 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
4925 -
4926 - rule_idx++;
4927 -
4928 -- if (rule_idx > NL80211_MAX_SUPP_REG_RULES)
4929 -+ if (rule_idx > NL80211_MAX_SUPP_REG_RULES) {
4930 -+ r = -EINVAL;
4931 - goto bad_reg;
4932 -+ }
4933 - }
4934 -
4935 - BUG_ON(rule_idx != num_rules);
4936 -
4937 -- mutex_lock(&cfg80211_mutex);
4938 - r = set_regdom(rd);
4939 -+
4940 - mutex_unlock(&cfg80211_mutex);
4941 -+
4942 - return r;
4943 -
4944 - bad_reg:
4945 -+ mutex_unlock(&cfg80211_mutex);
4946 - kfree(rd);
4947 -- return -EINVAL;
4948 -+ return r;
4949 - }
4950 -
4951 - static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4952 -diff --git a/net/wireless/reg.c b/net/wireless/reg.c
4953 -index 487cb62..9765bc8 100644
4954 ---- a/net/wireless/reg.c
4955 -+++ b/net/wireless/reg.c
4956 -@@ -389,6 +389,8 @@ static int call_crda(const char *alpha2)
4957 - /* Used by nl80211 before kmalloc'ing our regulatory domain */
4958 - bool reg_is_valid_request(const char *alpha2)
4959 - {
4960 -+ assert_cfg80211_lock();
4961 -+
4962 - if (!last_request)
4963 - return false;
4964 -
4965 -@@ -2042,7 +2044,13 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
4966 - * the country IE rd with what CRDA believes that country should have
4967 - */
4968 -
4969 -- BUG_ON(!country_ie_regdomain);
4970 -+ /*
4971 -+ * Userspace could have sent two replies with only
4972 -+ * one kernel request. By the second reply we would have
4973 -+ * already processed and consumed the country_ie_regdomain.
4974 -+ */
4975 -+ if (!country_ie_regdomain)
4976 -+ return -EALREADY;
4977 - BUG_ON(rd == country_ie_regdomain);
4978 -
4979 - /*
4980 -diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
4981 -index ed80af8..c51f309 100644
4982 ---- a/net/x25/af_x25.c
4983 -+++ b/net/x25/af_x25.c
4984 -@@ -332,14 +332,14 @@ static unsigned int x25_new_lci(struct x25_neigh *nb)
4985 - /*
4986 - * Deferred destroy.
4987 - */
4988 --void x25_destroy_socket(struct sock *);
4989 -+static void __x25_destroy_socket(struct sock *);
4990 -
4991 - /*
4992 - * handler for deferred kills.
4993 - */
4994 - static void x25_destroy_timer(unsigned long data)
4995 - {
4996 -- x25_destroy_socket((struct sock *)data);
4997 -+ x25_destroy_socket_from_timer((struct sock *)data);
4998 - }
4999 -
5000 - /*
5001 -@@ -349,12 +349,10 @@ static void x25_destroy_timer(unsigned long data)
5002 - * will touch it and we are (fairly 8-) ) safe.
5003 - * Not static as it's used by the timer
5004 - */
5005 --void x25_destroy_socket(struct sock *sk)
5006 -+static void __x25_destroy_socket(struct sock *sk)
5007 - {
5008 - struct sk_buff *skb;
5009 -
5010 -- sock_hold(sk);
5011 -- lock_sock(sk);
5012 - x25_stop_heartbeat(sk);
5013 - x25_stop_timer(sk);
5014 -
5015 -@@ -385,7 +383,22 @@ void x25_destroy_socket(struct sock *sk)
5016 - /* drop last reference so sock_put will free */
5017 - __sock_put(sk);
5018 - }
5019 -+}
5020 -
5021 -+void x25_destroy_socket_from_timer(struct sock *sk)
5022 -+{
5023 -+ sock_hold(sk);
5024 -+ bh_lock_sock(sk);
5025 -+ __x25_destroy_socket(sk);
5026 -+ bh_unlock_sock(sk);
5027 -+ sock_put(sk);
5028 -+}
5029 -+
5030 -+static void x25_destroy_socket(struct sock *sk)
5031 -+{
5032 -+ sock_hold(sk);
5033 -+ lock_sock(sk);
5034 -+ __x25_destroy_socket(sk);
5035 - release_sock(sk);
5036 - sock_put(sk);
5037 - }
5038 -diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c
5039 -index d3e3e54..5c5db1a 100644
5040 ---- a/net/x25/x25_timer.c
5041 -+++ b/net/x25/x25_timer.c
5042 -@@ -113,7 +113,7 @@ static void x25_heartbeat_expiry(unsigned long param)
5043 - (sk->sk_state == TCP_LISTEN &&
5044 - sock_flag(sk, SOCK_DEAD))) {
5045 - bh_unlock_sock(sk);
5046 -- x25_destroy_socket(sk);
5047 -+ x25_destroy_socket_from_timer(sk);
5048 - return;
5049 - }
5050 - break;
5051 -diff --git a/security/integrity/ima/ima_audit.c b/security/integrity/ima/ima_audit.c
5052 -index 1e082bb..97a80fb 100644
5053 ---- a/security/integrity/ima/ima_audit.c
5054 -+++ b/security/integrity/ima/ima_audit.c
5055 -@@ -50,7 +50,7 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
5056 -
5057 - ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
5058 - audit_log_format(ab, "integrity: pid=%d uid=%u auid=%u ses=%u",
5059 -- current->pid, current->cred->uid,
5060 -+ current->pid, current_cred()->uid,
5061 - audit_get_loginuid(current),
5062 - audit_get_sessionid(current));
5063 - audit_log_task_context(ab);
5064 -diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
5065 -index f4e7266..88407e5 100644
5066 ---- a/security/integrity/ima/ima_main.c
5067 -+++ b/security/integrity/ima/ima_main.c
5068 -@@ -128,10 +128,6 @@ static int get_path_measurement(struct ima_iint_cache *iint, struct file *file,
5069 - {
5070 - int rc = 0;
5071 -
5072 -- if (IS_ERR(file)) {
5073 -- pr_info("%s dentry_open failed\n", filename);
5074 -- return rc;
5075 -- }
5076 - iint->opencount++;
5077 - iint->readcount++;
5078 -
5079 -@@ -196,7 +192,14 @@ int ima_path_check(struct path *path, int mask)
5080 - struct dentry *dentry = dget(path->dentry);
5081 - struct vfsmount *mnt = mntget(path->mnt);
5082 -
5083 -- file = dentry_open(dentry, mnt, O_RDONLY, current->cred);
5084 -+ file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE,
5085 -+ current_cred());
5086 -+ if (IS_ERR(file)) {
5087 -+ pr_info("%s dentry_open failed\n", dentry->d_name.name);
5088 -+ rc = PTR_ERR(file);
5089 -+ file = NULL;
5090 -+ goto out;
5091 -+ }
5092 - rc = get_path_measurement(iint, file, dentry->d_name.name);
5093 - }
5094 - out:
5095 -diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
5096 -index 8284f17..b5d6ea4 100644
5097 ---- a/sound/core/seq/seq_midi_event.c
5098 -+++ b/sound/core/seq/seq_midi_event.c
5099 -@@ -504,10 +504,10 @@ static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
5100 - if (dev->nostat && count < 12)
5101 - return -ENOMEM;
5102 - cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
5103 -- bytes[0] = ev->data.control.param & 0x007f;
5104 -- bytes[1] = (ev->data.control.param & 0x3f80) >> 7;
5105 -- bytes[2] = ev->data.control.value & 0x007f;
5106 -- bytes[3] = (ev->data.control.value & 0x3f80) >> 7;
5107 -+ bytes[0] = (ev->data.control.param & 0x3f80) >> 7;
5108 -+ bytes[1] = ev->data.control.param & 0x007f;
5109 -+ bytes[2] = (ev->data.control.value & 0x3f80) >> 7;
5110 -+ bytes[3] = ev->data.control.value & 0x007f;
5111 - if (cmd != dev->lastcmd && !dev->nostat) {
5112 - if (count < 9)
5113 - return -ENOMEM;
5114 -diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
5115 -index de83608..3ee0269 100644
5116 ---- a/sound/isa/cmi8330.c
5117 -+++ b/sound/isa/cmi8330.c
5118 -@@ -338,7 +338,7 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
5119 - return -EBUSY;
5120 -
5121 - acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
5122 -- if (acard->play == NULL)
5123 -+ if (acard->mpu == NULL)
5124 - return -EBUSY;
5125 -
5126 - pdev = acard->cap;
5127 -diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
5128 -index c111efe..f143f71 100644
5129 ---- a/sound/pci/ca0106/ca0106_mixer.c
5130 -+++ b/sound/pci/ca0106/ca0106_mixer.c
5131 -@@ -841,6 +841,9 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
5132 - snd_ca0106_master_db_scale);
5133 - if (!vmaster)
5134 - return -ENOMEM;
5135 -+ err = snd_ctl_add(card, vmaster);
5136 -+ if (err < 0)
5137 -+ return err;
5138 - add_slaves(card, vmaster, slave_vols);
5139 -
5140 - if (emu->details->spi_dac == 1) {
5141 -@@ -848,6 +851,9 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
5142 - NULL);
5143 - if (!vmaster)
5144 - return -ENOMEM;
5145 -+ err = snd_ctl_add(card, vmaster);
5146 -+ if (err < 0)
5147 -+ return err;
5148 - add_slaves(card, vmaster, slave_sws);
5149 - }
5150 - return 0;
5151 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
5152 -index 0fd258e..f09324a 100644
5153 ---- a/sound/pci/hda/patch_realtek.c
5154 -+++ b/sound/pci/hda/patch_realtek.c
5155 -@@ -10915,6 +10915,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
5156 - SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
5157 - SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
5158 - SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
5159 -+ SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
5160 - SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
5161 - ALC262_SONY_ASSAMD),
5162 - SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
5163 -@@ -11122,6 +11123,7 @@ static struct alc_config_preset alc262_presets[] = {
5164 - .capsrc_nids = alc262_dmic_capsrc_nids,
5165 - .dac_nids = alc262_dac_nids,
5166 - .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
5167 -+ .num_adc_nids = 1, /* single ADC */
5168 - .dig_out_nid = ALC262_DIGOUT_NID,
5169 - .num_channel_mode = ARRAY_SIZE(alc262_modes),
5170 - .channel_mode = alc262_modes,
5171 -diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
5172 -index 173bebf..8aa5687 100644
5173 ---- a/sound/pci/intel8x0.c
5174 -+++ b/sound/pci/intel8x0.c
5175 -@@ -356,8 +356,6 @@ struct ichdev {
5176 - unsigned int position;
5177 - unsigned int pos_shift;
5178 - unsigned int last_pos;
5179 -- unsigned long last_pos_jiffies;
5180 -- unsigned int jiffy_to_bytes;
5181 - int frags;
5182 - int lvi;
5183 - int lvi_frag;
5184 -@@ -844,7 +842,6 @@ static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd
5185 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
5186 - val = ICH_IOCE | ICH_STARTBM;
5187 - ichdev->last_pos = ichdev->position;
5188 -- ichdev->last_pos_jiffies = jiffies;
5189 - break;
5190 - case SNDRV_PCM_TRIGGER_SUSPEND:
5191 - ichdev->suspended = 1;
5192 -@@ -1048,7 +1045,6 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream)
5193 - ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
5194 - }
5195 - snd_intel8x0_setup_periods(chip, ichdev);
5196 -- ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ;
5197 - return 0;
5198 - }
5199 -
5200 -@@ -1073,19 +1069,23 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs
5201 - ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb))
5202 - break;
5203 - } while (timeout--);
5204 -+ ptr = ichdev->last_pos;
5205 - if (ptr1 != 0) {
5206 - ptr1 <<= ichdev->pos_shift;
5207 - ptr = ichdev->fragsize1 - ptr1;
5208 - ptr += position;
5209 -- ichdev->last_pos = ptr;
5210 -- ichdev->last_pos_jiffies = jiffies;
5211 -- } else {
5212 -- ptr1 = jiffies - ichdev->last_pos_jiffies;
5213 -- if (ptr1)
5214 -- ptr1 -= 1;
5215 -- ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes;
5216 -- ptr %= ichdev->size;
5217 -+ if (ptr < ichdev->last_pos) {
5218 -+ unsigned int pos_base, last_base;
5219 -+ pos_base = position / ichdev->fragsize1;
5220 -+ last_base = ichdev->last_pos / ichdev->fragsize1;
5221 -+ /* another sanity check; ptr1 can go back to full
5222 -+ * before the base position is updated
5223 -+ */
5224 -+ if (pos_base == last_base)
5225 -+ ptr = ichdev->last_pos;
5226 -+ }
5227 - }
5228 -+ ichdev->last_pos = ptr;
5229 - spin_unlock(&chip->reg_lock);
5230 - if (ptr >= ichdev->size)
5231 - return 0;
5232 -diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
5233 -index 8cf571f..39805ce 100644
5234 ---- a/sound/soc/codecs/wm8903.c
5235 -+++ b/sound/soc/codecs/wm8903.c
5236 -@@ -1215,22 +1215,18 @@ static struct {
5237 - int div;
5238 - } bclk_divs[] = {
5239 - { 10, 0 },
5240 -- { 15, 1 },
5241 - { 20, 2 },
5242 - { 30, 3 },
5243 - { 40, 4 },
5244 - { 50, 5 },
5245 -- { 55, 6 },
5246 - { 60, 7 },
5247 - { 80, 8 },
5248 - { 100, 9 },
5249 -- { 110, 10 },
5250 - { 120, 11 },
5251 - { 160, 12 },
5252 - { 200, 13 },
5253 - { 220, 14 },
5254 - { 240, 15 },
5255 -- { 250, 16 },
5256 - { 300, 17 },
5257 - { 320, 18 },
5258 - { 440, 19 },
5259 -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
5260 -index 4d0dd39..1489829 100644
5261 ---- a/virt/kvm/kvm_main.c
5262 -+++ b/virt/kvm/kvm_main.c
5263 -@@ -581,6 +581,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
5264 - cpumask_clear(cpus);
5265 -
5266 - me = get_cpu();
5267 -+ spin_lock(&kvm->requests_lock);
5268 - for (i = 0; i < KVM_MAX_VCPUS; ++i) {
5269 - vcpu = kvm->vcpus[i];
5270 - if (!vcpu)
5271 -@@ -597,6 +598,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
5272 - smp_call_function_many(cpus, ack_flush, NULL, 1);
5273 - else
5274 - called = false;
5275 -+ spin_unlock(&kvm->requests_lock);
5276 - put_cpu();
5277 - free_cpumask_var(cpus);
5278 - return called;
5279 -@@ -817,6 +819,7 @@ static struct kvm *kvm_create_vm(void)
5280 - kvm->mm = current->mm;
5281 - atomic_inc(&kvm->mm->mm_count);
5282 - spin_lock_init(&kvm->mmu_lock);
5283 -+ spin_lock_init(&kvm->requests_lock);
5284 - kvm_io_bus_init(&kvm->pio_bus);
5285 - mutex_init(&kvm->lock);
5286 - kvm_io_bus_init(&kvm->mmio_bus);
5287 -@@ -919,9 +922,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
5288 - {
5289 - int r;
5290 - gfn_t base_gfn;
5291 -- unsigned long npages;
5292 -- int largepages;
5293 -- unsigned long i;
5294 -+ unsigned long npages, ugfn;
5295 -+ unsigned long largepages, i;
5296 - struct kvm_memory_slot *memslot;
5297 - struct kvm_memory_slot old, new;
5298 -
5299 -@@ -1010,6 +1012,14 @@ int __kvm_set_memory_region(struct kvm *kvm,
5300 - new.lpage_info[0].write_count = 1;
5301 - if ((base_gfn+npages) % KVM_PAGES_PER_HPAGE)
5302 - new.lpage_info[largepages-1].write_count = 1;
5303 -+ ugfn = new.userspace_addr >> PAGE_SHIFT;
5304 -+ /*
5305 -+ * If the gfn and userspace address are not aligned wrt each
5306 -+ * other, disable large page support for this slot
5307 -+ */
5308 -+ if ((base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE - 1))
5309 -+ for (i = 0; i < largepages; ++i)
5310 -+ new.lpage_info[i].write_count = 1;
5311 - }
5312 -
5313 - /* Allocate page dirty bitmap if needed */
5314 -@@ -1020,6 +1030,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
5315 - if (!new.dirty_bitmap)
5316 - goto out_free;
5317 - memset(new.dirty_bitmap, 0, dirty_bytes);
5318 -+ if (old.npages)
5319 -+ kvm_arch_flush_shadow(kvm);
5320 - }
5321 - #endif /* not defined CONFIG_S390 */
5322 -
5323
5324 Deleted: genpatches-2.6/trunk/2.6.31/1001_linux-2.6.30.2.patch
5325 ===================================================================
5326 --- genpatches-2.6/trunk/2.6.31/1001_linux-2.6.30.2.patch 2009-09-09 23:15:13 UTC (rev 1604)
5327 +++ genpatches-2.6/trunk/2.6.31/1001_linux-2.6.30.2.patch 2009-09-09 23:51:20 UTC (rev 1605)
5328 @@ -1,763 +0,0 @@
5329 -diff --git a/arch/alpha/include/asm/percpu.h b/arch/alpha/include/asm/percpu.h
5330 -index 06c5c7a..b663f1f 100644
5331 ---- a/arch/alpha/include/asm/percpu.h
5332 -+++ b/arch/alpha/include/asm/percpu.h
5333 -@@ -30,7 +30,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
5334 -
5335 - #ifndef MODULE
5336 - #define SHIFT_PERCPU_PTR(var, offset) RELOC_HIDE(&per_cpu_var(var), (offset))
5337 --#define PER_CPU_ATTRIBUTES
5338 -+#define PER_CPU_DEF_ATTRIBUTES
5339 - #else
5340 - /*
5341 - * To calculate addresses of locally defined variables, GCC uses 32-bit
5342 -@@ -49,7 +49,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
5343 - : "=&r"(__ptr), "=&r"(tmp_gp)); \
5344 - (typeof(&per_cpu_var(var)))(__ptr + (offset)); })
5345 -
5346 --#define PER_CPU_ATTRIBUTES __used
5347 -+#define PER_CPU_DEF_ATTRIBUTES __used
5348 -
5349 - #endif /* MODULE */
5350 -
5351 -@@ -71,7 +71,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
5352 - #define __get_cpu_var(var) per_cpu_var(var)
5353 - #define __raw_get_cpu_var(var) per_cpu_var(var)
5354 -
5355 --#define PER_CPU_ATTRIBUTES
5356 -+#define PER_CPU_DEF_ATTRIBUTES
5357 -
5358 - #endif /* SMP */
5359 -
5360 -diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
5361 -index 401bd32..6ab0532 100644
5362 ---- a/arch/blackfin/kernel/irqchip.c
5363 -+++ b/arch/blackfin/kernel/irqchip.c
5364 -@@ -38,14 +38,6 @@
5365 - #include <asm/pda.h>
5366 -
5367 - static atomic_t irq_err_count;
5368 --static spinlock_t irq_controller_lock;
5369 --
5370 --/*
5371 -- * Dummy mask/unmask handler
5372 -- */
5373 --void dummy_mask_unmask_irq(unsigned int irq)
5374 --{
5375 --}
5376 -
5377 - void ack_bad_irq(unsigned int irq)
5378 - {
5379 -@@ -53,21 +45,9 @@ void ack_bad_irq(unsigned int irq)
5380 - printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
5381 - }
5382 -
5383 --static struct irq_chip bad_chip = {
5384 -- .ack = dummy_mask_unmask_irq,
5385 -- .mask = dummy_mask_unmask_irq,
5386 -- .unmask = dummy_mask_unmask_irq,
5387 --};
5388 --
5389 - static struct irq_desc bad_irq_desc = {
5390 -- .status = IRQ_DISABLED,
5391 -- .chip = &bad_chip,
5392 - .handle_irq = handle_bad_irq,
5393 -- .depth = 1,
5394 - .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
5395 --#ifdef CONFIG_SMP
5396 -- .affinity = CPU_MASK_ALL
5397 --#endif
5398 - };
5399 -
5400 - #ifdef CONFIG_CPUMASK_OFFSTACK
5401 -@@ -117,21 +97,13 @@ __attribute__((l1_text))
5402 - #endif
5403 - asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
5404 - {
5405 -- struct pt_regs *old_regs;
5406 -- struct irq_desc *desc = irq_desc + irq;
5407 - #ifndef CONFIG_IPIPE
5408 - unsigned short pending, other_ints;
5409 - #endif
5410 -- old_regs = set_irq_regs(regs);
5411 --
5412 -- /*
5413 -- * Some hardware gives randomly wrong interrupts. Rather
5414 -- * than crashing, do something sensible.
5415 -- */
5416 -- if (irq >= NR_IRQS)
5417 -- desc = &bad_irq_desc;
5418 -+ struct pt_regs *old_regs = set_irq_regs(regs);
5419 -
5420 - irq_enter();
5421 -+
5422 - #ifdef CONFIG_DEBUG_STACKOVERFLOW
5423 - /* Debugging check for stack overflow: is there less than STACK_WARN free? */
5424 - {
5425 -@@ -147,7 +119,15 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
5426 - }
5427 - }
5428 - #endif
5429 -- generic_handle_irq(irq);
5430 -+
5431 -+ /*
5432 -+ * Some hardware gives randomly wrong interrupts. Rather
5433 -+ * than crashing, do something sensible.
5434 -+ */
5435 -+ if (irq >= NR_IRQS)
5436 -+ handle_bad_irq(irq, &bad_irq_desc);
5437 -+ else
5438 -+ generic_handle_irq(irq);
5439 -
5440 - #ifndef CONFIG_IPIPE
5441 - /*
5442 -@@ -171,14 +151,6 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
5443 -
5444 - void __init init_IRQ(void)
5445 - {
5446 -- struct irq_desc *desc;
5447 -- int irq;
5448 --
5449 -- spin_lock_init(&irq_controller_lock);
5450 -- for (irq = 0, desc = irq_desc; irq < NR_IRQS; irq++, desc++) {
5451 -- *desc = bad_irq_desc;
5452 -- }
5453 --
5454 - init_arch_irq();
5455 -
5456 - #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
5457 -diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
5458 -index a58687b..b550bae 100644
5459 ---- a/arch/blackfin/kernel/setup.c
5460 -+++ b/arch/blackfin/kernel/setup.c
5461 -@@ -831,7 +831,8 @@ void __init setup_arch(char **cmdline_p)
5462 - defined(CONFIG_BF538) || defined(CONFIG_BF539)
5463 - _bfin_swrst = bfin_read_SWRST();
5464 - #else
5465 -- _bfin_swrst = bfin_read_SYSCR();
5466 -+ /* Clear boot mode field */
5467 -+ _bfin_swrst = bfin_read_SYSCR() & ~0xf;
5468 - #endif
5469 -
5470 - #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
5471 -diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
5472 -index 698d4c0..7e5143c 100644
5473 ---- a/arch/blackfin/mach-common/head.S
5474 -+++ b/arch/blackfin/mach-common/head.S
5475 -@@ -126,25 +126,25 @@ ENTRY(__start)
5476 - * below
5477 - */
5478 - GET_PDA(p0, r0);
5479 -- r7 = [p0 + PDA_RETX];
5480 -+ r6 = [p0 + PDA_RETX];
5481 - p1.l = _init_saved_retx;
5482 - p1.h = _init_saved_retx;
5483 -- [p1] = r7;
5484 -+ [p1] = r6;
5485 -
5486 -- r7 = [p0 + PDA_DCPLB];
5487 -+ r6 = [p0 + PDA_DCPLB];
5488 - p1.l = _init_saved_dcplb_fault_addr;
5489 - p1.h = _init_saved_dcplb_fault_addr;
5490 -- [p1] = r7;
5491 -+ [p1] = r6;
5492 -
5493 -- r7 = [p0 + PDA_ICPLB];
5494 -+ r6 = [p0 + PDA_ICPLB];
5495 - p1.l = _init_saved_icplb_fault_addr;
5496 - p1.h = _init_saved_icplb_fault_addr;
5497 -- [p1] = r7;
5498 -+ [p1] = r6;
5499 -
5500 -- r7 = [p0 + PDA_SEQSTAT];
5501 -+ r6 = [p0 + PDA_SEQSTAT];
5502 - p1.l = _init_saved_seqstat;
5503 - p1.h = _init_saved_seqstat;
5504 -- [p1] = r7;
5505 -+ [p1] = r6;
5506 - #endif
5507 -
5508 - /* Initialize stack pointer */
5509 -diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
5510 -index 93eab61..66fb780 100644
5511 ---- a/arch/blackfin/mach-common/smp.c
5512 -+++ b/arch/blackfin/mach-common/smp.c
5513 -@@ -139,7 +139,7 @@ static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
5514 -
5515 - static irqreturn_t ipi_handler(int irq, void *dev_instance)
5516 - {
5517 -- struct ipi_message *msg, *mg;
5518 -+ struct ipi_message *msg;
5519 - struct ipi_message_queue *msg_queue;
5520 - unsigned int cpu = smp_processor_id();
5521 -
5522 -@@ -149,7 +149,8 @@ static irqreturn_t ipi_handler(int irq, void *dev_instance)
5523 - msg_queue->count++;
5524 -
5525 - spin_lock(&msg_queue->lock);
5526 -- list_for_each_entry_safe(msg, mg, &msg_queue->head, list) {
5527 -+ while (!list_empty(&msg_queue->head)) {
5528 -+ msg = list_entry(msg_queue->head.next, typeof(*msg), list);
5529 - list_del(&msg->list);
5530 - switch (msg->type) {
5531 - case BFIN_IPI_RESCHEDULE:
5532 -@@ -216,7 +217,7 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)
5533 - for_each_cpu_mask(cpu, callmap) {
5534 - msg_queue = &per_cpu(ipi_msg_queue, cpu);
5535 - spin_lock_irqsave(&msg_queue->lock, flags);
5536 -- list_add(&msg->list, &msg_queue->head);
5537 -+ list_add_tail(&msg->list, &msg_queue->head);
5538 - spin_unlock_irqrestore(&msg_queue->lock, flags);
5539 - platform_send_ipi_cpu(cpu);
5540 - }
5541 -@@ -256,7 +257,7 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
5542 -
5543 - msg_queue = &per_cpu(ipi_msg_queue, cpu);
5544 - spin_lock_irqsave(&msg_queue->lock, flags);
5545 -- list_add(&msg->list, &msg_queue->head);
5546 -+ list_add_tail(&msg->list, &msg_queue->head);
5547 - spin_unlock_irqrestore(&msg_queue->lock, flags);
5548 - platform_send_ipi_cpu(cpu);
5549 -
5550 -@@ -287,7 +288,7 @@ void smp_send_reschedule(int cpu)
5551 -
5552 - msg_queue = &per_cpu(ipi_msg_queue, cpu);
5553 - spin_lock_irqsave(&msg_queue->lock, flags);
5554 -- list_add(&msg->list, &msg_queue->head);
5555 -+ list_add_tail(&msg->list, &msg_queue->head);
5556 - spin_unlock_irqrestore(&msg_queue->lock, flags);
5557 - platform_send_ipi_cpu(cpu);
5558 -
5559 -@@ -315,7 +316,7 @@ void smp_send_stop(void)
5560 - for_each_cpu_mask(cpu, callmap) {
5561 - msg_queue = &per_cpu(ipi_msg_queue, cpu);
5562 - spin_lock_irqsave(&msg_queue->lock, flags);
5563 -- list_add(&msg->list, &msg_queue->head);
5564 -+ list_add_tail(&msg->list, &msg_queue->head);
5565 - spin_unlock_irqrestore(&msg_queue->lock, flags);
5566 - platform_send_ipi_cpu(cpu);
5567 - }
5568 -diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
5569 -index b51a1e8..abbc09b 100644
5570 ---- a/arch/x86/include/asm/pci.h
5571 -+++ b/arch/x86/include/asm/pci.h
5572 -@@ -91,7 +91,7 @@ extern void pci_iommu_alloc(void);
5573 -
5574 - #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
5575 -
5576 --#if defined(CONFIG_X86_64) || defined(CONFIG_DMA_API_DEBUG)
5577 -+#if defined(CONFIG_X86_64) || defined(CONFIG_DMAR) || defined(CONFIG_DMA_API_DEBUG)
5578 -
5579 - #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
5580 - dma_addr_t ADDR_NAME;
5581 -diff --git a/block/blk-core.c b/block/blk-core.c
5582 -index c89883b..a59f180 100644
5583 ---- a/block/blk-core.c
5584 -+++ b/block/blk-core.c
5585 -@@ -1158,6 +1158,11 @@ static int __make_request(struct request_queue *q, struct bio *bio)
5586 -
5587 - nr_sectors = bio_sectors(bio);
5588 -
5589 -+ if (bio_barrier(bio) && bio_has_data(bio) &&
5590 -+ (q->next_ordered == QUEUE_ORDERED_NONE)) {
5591 -+ bio_endio(bio, -EOPNOTSUPP);
5592 -+ return 0;
5593 -+ }
5594 - /*
5595 - * low level driver can indicate that it wants pages above a
5596 - * certain limit bounced to low memory (ie for highmem, or even
5597 -@@ -1461,11 +1466,6 @@ static inline void __generic_make_request(struct bio *bio)
5598 - err = -EOPNOTSUPP;
5599 - goto end_io;
5600 - }
5601 -- if (bio_barrier(bio) && bio_has_data(bio) &&
5602 -- (q->next_ordered == QUEUE_ORDERED_NONE)) {
5603 -- err = -EOPNOTSUPP;
5604 -- goto end_io;
5605 -- }
5606 -
5607 - ret = q->make_request_fn(q, bio);
5608 - } while (ret);
5609 -diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
5610 -index 1300df6..39e1b58 100644
5611 ---- a/drivers/block/floppy.c
5612 -+++ b/drivers/block/floppy.c
5613 -@@ -3327,7 +3327,10 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
5614 - if (!capable(CAP_SYS_ADMIN))
5615 - return -EPERM;
5616 - mutex_lock(&open_lock);
5617 -- LOCK_FDC(drive, 1);
5618 -+ if (lock_fdc(drive, 1)) {
5619 -+ mutex_unlock(&open_lock);
5620 -+ return -EINTR;
5621 -+ }
5622 - floppy_type[type] = *g;
5623 - floppy_type[type].name = "user format";
5624 - for (cnt = type << 2; cnt < (type << 2) + 4; cnt++)
5625 -diff --git a/drivers/md/md.c b/drivers/md/md.c
5626 -index 641b211..eb1b73f 100644
5627 ---- a/drivers/md/md.c
5628 -+++ b/drivers/md/md.c
5629 -@@ -3589,7 +3589,8 @@ suspend_lo_store(mddev_t *mddev, const char *buf, size_t len)
5630 - char *e;
5631 - unsigned long long new = simple_strtoull(buf, &e, 10);
5632 -
5633 -- if (mddev->pers->quiesce == NULL)
5634 -+ if (mddev->pers == NULL ||
5635 -+ mddev->pers->quiesce == NULL)
5636 - return -EINVAL;
5637 - if (buf == e || (*e && *e != '\n'))
5638 - return -EINVAL;
5639 -@@ -3617,7 +3618,8 @@ suspend_hi_store(mddev_t *mddev, const char *buf, size_t len)
5640 - char *e;
5641 - unsigned long long new = simple_strtoull(buf, &e, 10);
5642 -
5643 -- if (mddev->pers->quiesce == NULL)
5644 -+ if (mddev->pers == NULL ||
5645 -+ mddev->pers->quiesce == NULL)
5646 - return -EINVAL;
5647 - if (buf == e || (*e && *e != '\n'))
5648 - return -EINVAL;
5649 -@@ -3876,6 +3878,8 @@ static int md_alloc(dev_t dev, char *name)
5650 - if (mddev2->gendisk &&
5651 - strcmp(mddev2->gendisk->disk_name, name) == 0) {
5652 - spin_unlock(&all_mddevs_lock);
5653 -+ mutex_unlock(&disks_mutex);
5654 -+ mddev_put(mddev);
5655 - return -EEXIST;
5656 - }
5657 - spin_unlock(&all_mddevs_lock);
5658 -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
5659 -index c0434e0..1f98ea4 100644
5660 ---- a/drivers/md/raid5.c
5661 -+++ b/drivers/md/raid5.c
5662 -@@ -3703,7 +3703,8 @@ static int make_request(struct request_queue *q, struct bio * bi)
5663 - /* FIXME what if we get a false positive because these
5664 - * are being updated.
5665 - */
5666 -- if (logical_sector >= mddev->suspend_lo &&
5667 -+ if (bio_data_dir(bi) == WRITE &&
5668 -+ logical_sector >= mddev->suspend_lo &&
5669 - logical_sector < mddev->suspend_hi) {
5670 - release_stripe(sh);
5671 - schedule();
5672 -diff --git a/drivers/net/tun.c b/drivers/net/tun.c
5673 -index 1be6a6b..8289292 100644
5674 ---- a/drivers/net/tun.c
5675 -+++ b/drivers/net/tun.c
5676 -@@ -486,12 +486,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
5677 - {
5678 - struct tun_file *tfile = file->private_data;
5679 - struct tun_struct *tun = __tun_get(tfile);
5680 -- struct sock *sk = tun->sk;
5681 -+ struct sock *sk;
5682 - unsigned int mask = 0;
5683 -
5684 - if (!tun)
5685 - return POLLERR;
5686 -
5687 -+ sk = tun->sk;
5688 -+
5689 - DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
5690 -
5691 - poll_wait(file, &tun->socket.wait, wait);
5692 -diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c
5693 -index 2287116..46dd440 100644
5694 ---- a/drivers/pci/iova.c
5695 -+++ b/drivers/pci/iova.c
5696 -@@ -1,9 +1,19 @@
5697 - /*
5698 -- * Copyright (c) 2006, Intel Corporation.
5699 -+ * Copyright © 2006-2009, Intel Corporation.
5700 - *
5701 -- * This file is released under the GPLv2.
5702 -+ * This program is free software; you can redistribute it and/or modify it
5703 -+ * under the terms and conditions of the GNU General Public License,
5704 -+ * version 2, as published by the Free Software Foundation.
5705 -+ *
5706 -+ * This program is distributed in the hope it will be useful, but WITHOUT
5707 -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5708 -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
5709 -+ * more details.
5710 -+ *
5711 -+ * You should have received a copy of the GNU General Public License along with
5712 -+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
5713 -+ * Place - Suite 330, Boston, MA 02111-1307 USA.
5714 - *
5715 -- * Copyright (C) 2006-2008 Intel Corporation
5716 - * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@×××××.com>
5717 - */
5718 -
5719 -@@ -123,7 +133,15 @@ move_left:
5720 - /* Insert the new_iova into domain rbtree by holding writer lock */
5721 - /* Add new node and rebalance tree. */
5722 - {
5723 -- struct rb_node **entry = &((prev)), *parent = NULL;
5724 -+ struct rb_node **entry, *parent = NULL;
5725 -+
5726 -+ /* If we have 'prev', it's a valid place to start the
5727 -+ insertion. Otherwise, start from the root. */
5728 -+ if (prev)
5729 -+ entry = &prev;
5730 -+ else
5731 -+ entry = &iovad->rbroot.rb_node;
5732 -+
5733 - /* Figure out where to put new node */
5734 - while (*entry) {
5735 - struct iova *this = container_of(*entry,
5736 -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
5737 -index ba76b68..eb40335 100644
5738 ---- a/fs/fuse/dev.c
5739 -+++ b/fs/fuse/dev.c
5740 -@@ -904,7 +904,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
5741 - unsigned long nr_segs, loff_t pos)
5742 - {
5743 - int err;
5744 -- unsigned nbytes = iov_length(iov, nr_segs);
5745 -+ size_t nbytes = iov_length(iov, nr_segs);
5746 - struct fuse_req *req;
5747 - struct fuse_out_header oh;
5748 - struct fuse_copy_state cs;
5749 -diff --git a/fs/fuse/file.c b/fs/fuse/file.c
5750 -index 06f30e9..053ff1c 100644
5751 ---- a/fs/fuse/file.c
5752 -+++ b/fs/fuse/file.c
5753 -@@ -1867,7 +1867,7 @@ static unsigned fuse_file_poll(struct file *file, poll_table *wait)
5754 -
5755 - req = fuse_get_req(fc);
5756 - if (IS_ERR(req))
5757 -- return PTR_ERR(req);
5758 -+ return POLLERR;
5759 -
5760 - req->in.h.opcode = FUSE_POLL;
5761 - req->in.h.nodeid = get_node_id(inode);
5762 -diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
5763 -index d7d50d7..aa00800 100644
5764 ---- a/include/asm-generic/percpu.h
5765 -+++ b/include/asm-generic/percpu.h
5766 -@@ -97,4 +97,8 @@ extern void setup_per_cpu_areas(void);
5767 - #define PER_CPU_ATTRIBUTES
5768 - #endif
5769 -
5770 -+#ifndef PER_CPU_DEF_ATTRIBUTES
5771 -+#define PER_CPU_DEF_ATTRIBUTES
5772 -+#endif
5773 -+
5774 - #endif /* _ASM_GENERIC_PERCPU_H_ */
5775 -diff --git a/include/linux/mm.h b/include/linux/mm.h
5776 -index bff1f0d..0c21af6 100644
5777 ---- a/include/linux/mm.h
5778 -+++ b/include/linux/mm.h
5779 -@@ -580,12 +580,10 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
5780 - */
5781 - static inline unsigned long round_hint_to_min(unsigned long hint)
5782 - {
5783 --#ifdef CONFIG_SECURITY
5784 - hint &= PAGE_MASK;
5785 - if (((void *)hint != NULL) &&
5786 - (hint < mmap_min_addr))
5787 - return PAGE_ALIGN(mmap_min_addr);
5788 --#endif
5789 - return hint;
5790 - }
5791 -
5792 -diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
5793 -index 8f921d7..68438e1 100644
5794 ---- a/include/linux/percpu-defs.h
5795 -+++ b/include/linux/percpu-defs.h
5796 -@@ -24,7 +24,8 @@
5797 -
5798 - #define DEFINE_PER_CPU_SECTION(type, name, section) \
5799 - __attribute__((__section__(PER_CPU_BASE_SECTION section))) \
5800 -- PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
5801 -+ PER_CPU_ATTRIBUTES PER_CPU_DEF_ATTRIBUTES \
5802 -+ __typeof__(type) per_cpu__##name
5803 -
5804 - /*
5805 - * Variant on the per-CPU variable declaration/definition theme used for
5806 -diff --git a/include/linux/personality.h b/include/linux/personality.h
5807 -index a84e9ff..1261208 100644
5808 ---- a/include/linux/personality.h
5809 -+++ b/include/linux/personality.h
5810 -@@ -40,7 +40,10 @@ enum {
5811 - * Security-relevant compatibility flags that must be
5812 - * cleared upon setuid or setgid exec:
5813 - */
5814 --#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE)
5815 -+#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \
5816 -+ ADDR_NO_RANDOMIZE | \
5817 -+ ADDR_COMPAT_LAYOUT | \
5818 -+ MMAP_PAGE_ZERO)
5819 -
5820 - /*
5821 - * Personality types.
5822 -diff --git a/include/linux/security.h b/include/linux/security.h
5823 -index d5fd616..5eff459 100644
5824 ---- a/include/linux/security.h
5825 -+++ b/include/linux/security.h
5826 -@@ -2197,6 +2197,8 @@ static inline int security_file_mmap(struct file *file, unsigned long reqprot,
5827 - unsigned long addr,
5828 - unsigned long addr_only)
5829 - {
5830 -+ if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO))
5831 -+ return -EACCES;
5832 - return 0;
5833 - }
5834 -
5835 -diff --git a/kernel/futex.c b/kernel/futex.c
5836 -index d546b2d..4d973bd 100644
5837 ---- a/kernel/futex.c
5838 -+++ b/kernel/futex.c
5839 -@@ -241,6 +241,7 @@ again:
5840 - if (err < 0)
5841 - return err;
5842 -
5843 -+ page = compound_head(page);
5844 - lock_page(page);
5845 - if (!page->mapping) {
5846 - unlock_page(page);
5847 -@@ -278,6 +279,25 @@ void put_futex_key(int fshared, union futex_key *key)
5848 - drop_futex_key_refs(key);
5849 - }
5850 -
5851 -+/*
5852 -+ * fault_in_user_writeable - fault in user address and verify RW access
5853 -+ * @uaddr: pointer to faulting user space address
5854 -+ *
5855 -+ * Slow path to fixup the fault we just took in the atomic write
5856 -+ * access to @uaddr.
5857 -+ *
5858 -+ * We have no generic implementation of a non destructive write to the
5859 -+ * user address. We know that we faulted in the atomic pagefault
5860 -+ * disabled section so we can as well avoid the #PF overhead by
5861 -+ * calling get_user_pages() right away.
5862 -+ */
5863 -+static int fault_in_user_writeable(u32 __user *uaddr)
5864 -+{
5865 -+ int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
5866 -+ 1, 1, 0, NULL, NULL);
5867 -+ return ret < 0 ? ret : 0;
5868 -+}
5869 -+
5870 - static u32 cmpxchg_futex_value_locked(u32 __user *uaddr, u32 uval, u32 newval)
5871 - {
5872 - u32 curval;
5873 -@@ -739,7 +759,6 @@ retry:
5874 - retry_private:
5875 - op_ret = futex_atomic_op_inuser(op, uaddr2);
5876 - if (unlikely(op_ret < 0)) {
5877 -- u32 dummy;
5878 -
5879 - double_unlock_hb(hb1, hb2);
5880 -
5881 -@@ -757,7 +776,7 @@ retry_private:
5882 - goto out_put_keys;
5883 - }
5884 -
5885 -- ret = get_user(dummy, uaddr2);
5886 -+ ret = fault_in_user_writeable(uaddr2);
5887 - if (ret)
5888 - goto out_put_keys;
5889 -
5890 -@@ -1097,7 +1116,7 @@ retry:
5891 - handle_fault:
5892 - spin_unlock(q->lock_ptr);
5893 -
5894 -- ret = get_user(uval, uaddr);
5895 -+ ret = fault_in_user_writeable(uaddr);
5896 -
5897 - spin_lock(q->lock_ptr);
5898 -
5899 -@@ -1552,16 +1571,9 @@ out:
5900 - return ret;
5901 -
5902 - uaddr_faulted:
5903 -- /*
5904 -- * We have to r/w *(int __user *)uaddr, and we have to modify it
5905 -- * atomically. Therefore, if we continue to fault after get_user()
5906 -- * below, we need to handle the fault ourselves, while still holding
5907 -- * the mmap_sem. This can occur if the uaddr is under contention as
5908 -- * we have to drop the mmap_sem in order to call get_user().
5909 -- */
5910 - queue_unlock(&q, hb);
5911 -
5912 -- ret = get_user(uval, uaddr);
5913 -+ ret = fault_in_user_writeable(uaddr);
5914 - if (ret)
5915 - goto out_put_key;
5916 -
5917 -@@ -1657,17 +1669,10 @@ out:
5918 - return ret;
5919 -
5920 - pi_faulted:
5921 -- /*
5922 -- * We have to r/w *(int __user *)uaddr, and we have to modify it
5923 -- * atomically. Therefore, if we continue to fault after get_user()
5924 -- * below, we need to handle the fault ourselves, while still holding
5925 -- * the mmap_sem. This can occur if the uaddr is under contention as
5926 -- * we have to drop the mmap_sem in order to call get_user().
5927 -- */
5928 - spin_unlock(&hb->lock);
5929 - put_futex_key(fshared, &key);
5930 -
5931 -- ret = get_user(uval, uaddr);
5932 -+ ret = fault_in_user_writeable(uaddr);
5933 - if (!ret)
5934 - goto retry;
5935 -
5936 -diff --git a/kernel/resource.c b/kernel/resource.c
5937 -index ac5f3a3..78b0872 100644
5938 ---- a/kernel/resource.c
5939 -+++ b/kernel/resource.c
5940 -@@ -787,7 +787,7 @@ static int __init reserve_setup(char *str)
5941 - static struct resource reserve[MAXRESERVE];
5942 -
5943 - for (;;) {
5944 -- int io_start, io_num;
5945 -+ unsigned int io_start, io_num;
5946 - int x = reserved;
5947 -
5948 - if (get_option (&str, &io_start) != 2)
5949 -diff --git a/kernel/sysctl.c b/kernel/sysctl.c
5950 -index b2970d5..e5bfcc7 100644
5951 ---- a/kernel/sysctl.c
5952 -+++ b/kernel/sysctl.c
5953 -@@ -1225,7 +1225,6 @@ static struct ctl_table vm_table[] = {
5954 - .strategy = &sysctl_jiffies,
5955 - },
5956 - #endif
5957 --#ifdef CONFIG_SECURITY
5958 - {
5959 - .ctl_name = CTL_UNNUMBERED,
5960 - .procname = "mmap_min_addr",
5961 -@@ -1234,7 +1233,6 @@ static struct ctl_table vm_table[] = {
5962 - .mode = 0644,
5963 - .proc_handler = &proc_doulongvec_minmax,
5964 - },
5965 --#endif
5966 - #ifdef CONFIG_NUMA
5967 - {
5968 - .ctl_name = CTL_UNNUMBERED,
5969 -diff --git a/lib/dma-debug.c b/lib/dma-debug.c
5970 -index 2b16536..6a4e3d4 100644
5971 ---- a/lib/dma-debug.c
5972 -+++ b/lib/dma-debug.c
5973 -@@ -599,7 +599,7 @@ static inline bool overlap(void *addr, u64 size, void *start, void *end)
5974 -
5975 - return ((addr >= start && addr < end) ||
5976 - (addr2 >= start && addr2 < end) ||
5977 -- ((addr < start) && (addr2 >= end)));
5978 -+ ((addr < start) && (addr2 > end)));
5979 - }
5980 -
5981 - static void check_for_illegal_area(struct device *dev, void *addr, u64 size)
5982 -diff --git a/mm/Kconfig b/mm/Kconfig
5983 -index c2b57d8..71830ba 100644
5984 ---- a/mm/Kconfig
5985 -+++ b/mm/Kconfig
5986 -@@ -226,6 +226,25 @@ config HAVE_MLOCKED_PAGE_BIT
5987 - config MMU_NOTIFIER
5988 - bool
5989 -
5990 -+config DEFAULT_MMAP_MIN_ADDR
5991 -+ int "Low address space to protect from user allocation"
5992 -+ default 4096
5993 -+ help
5994 -+ This is the portion of low virtual memory which should be protected
5995 -+ from userspace allocation. Keeping a user from writing to low pages
5996 -+ can help reduce the impact of kernel NULL pointer bugs.
5997 -+
5998 -+ For most ia64, ppc64 and x86 users with lots of address space
5999 -+ a value of 65536 is reasonable and should cause no problems.
6000 -+ On arm and other archs it should not be higher than 32768.
6001 -+ Programs which use vm86 functionality would either need additional
6002 -+ permissions from either the LSM or the capabilities module or have
6003 -+ this protection disabled.
6004 -+
6005 -+ This value can be changed after boot using the
6006 -+ /proc/sys/vm/mmap_min_addr tunable.
6007 -+
6008 -+
6009 - config NOMMU_INITIAL_TRIM_EXCESS
6010 - int "Turn on mmap() excess space trimming before booting"
6011 - depends on !MMU
6012 -diff --git a/mm/mmap.c b/mm/mmap.c
6013 -index 6b7b1a9..2b43fa1 100644
6014 ---- a/mm/mmap.c
6015 -+++ b/mm/mmap.c
6016 -@@ -87,6 +87,9 @@ int sysctl_overcommit_ratio = 50; /* default is 50% */
6017 - int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
6018 - struct percpu_counter vm_committed_as;
6019 -
6020 -+/* amount of vm to protect from userspace access */
6021 -+unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR;
6022 -+
6023 - /*
6024 - * Check that a process has enough memory to allocate a new virtual
6025 - * mapping. 0 means there is enough memory for the allocation to
6026 -diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
6027 -index f11931c..9c22032 100644
6028 ---- a/net/ipv4/arp.c
6029 -+++ b/net/ipv4/arp.c
6030 -@@ -801,11 +801,8 @@ static int arp_process(struct sk_buff *skb)
6031 - * cache.
6032 - */
6033 -
6034 -- /*
6035 -- * Special case: IPv4 duplicate address detection packet (RFC2131)
6036 -- * and Gratuitous ARP/ARP Announce. (RFC3927, Section 2.4)
6037 -- */
6038 -- if (sip == 0 || tip == sip) {
6039 -+ /* Special case: IPv4 duplicate address detection packet (RFC2131) */
6040 -+ if (sip == 0) {
6041 - if (arp->ar_op == htons(ARPOP_REQUEST) &&
6042 - inet_addr_type(net, tip) == RTN_LOCAL &&
6043 - !arp_ignore(in_dev, sip, tip))
6044 -diff --git a/security/Kconfig b/security/Kconfig
6045 -index bb24477..d23c839 100644
6046 ---- a/security/Kconfig
6047 -+++ b/security/Kconfig
6048 -@@ -110,28 +110,8 @@ config SECURITY_ROOTPLUG
6049 -
6050 - See <http://www.linuxjournal.com/article.php?sid=6279> for
6051 - more information about this module.
6052 --
6053 -- If you are unsure how to answer this question, answer N.
6054 --
6055 --config SECURITY_DEFAULT_MMAP_MIN_ADDR
6056 -- int "Low address space to protect from user allocation"
6057 -- depends on SECURITY
6058 -- default 0
6059 -- help
6060 -- This is the portion of low virtual memory which should be protected
6061 -- from userspace allocation. Keeping a user from writing to low pages
6062 -- can help reduce the impact of kernel NULL pointer bugs.
6063 --
6064 -- For most ia64, ppc64 and x86 users with lots of address space
6065 -- a value of 65536 is reasonable and should cause no problems.
6066 -- On arm and other archs it should not be higher than 32768.
6067 -- Programs which use vm86 functionality would either need additional
6068 -- permissions from either the LSM or the capabilities module or have
6069 -- this protection disabled.
6070 --
6071 -- This value can be changed after boot using the
6072 -- /proc/sys/vm/mmap_min_addr tunable.
6073 -
6074 -+ If you are unsure how to answer this question, answer N.
6075 -
6076 - source security/selinux/Kconfig
6077 - source security/smack/Kconfig
6078 -diff --git a/security/security.c b/security/security.c
6079 -index 5284255..dc7674f 100644
6080 ---- a/security/security.c
6081 -+++ b/security/security.c
6082 -@@ -26,9 +26,6 @@ extern void security_fixup_ops(struct security_operations *ops);
6083 -
6084 - struct security_operations *security_ops; /* Initialized to NULL */
6085 -
6086 --/* amount of vm to protect from userspace access */
6087 --unsigned long mmap_min_addr = CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR;
6088 --
6089 - static inline int verify(struct security_operations *ops)
6090 - {
6091 - /* verify the security_operations structure exists */
6092
6093 Deleted: genpatches-2.6/trunk/2.6.31/1002_linux-2.6.30.3.patch
6094 ===================================================================
6095 --- genpatches-2.6/trunk/2.6.31/1002_linux-2.6.30.3.patch 2009-09-09 23:15:13 UTC (rev 1604)
6096 +++ genpatches-2.6/trunk/2.6.31/1002_linux-2.6.30.3.patch 2009-09-09 23:51:20 UTC (rev 1605)
6097 @@ -1,15 +0,0 @@
6098 -diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
6099 -index 5c1a2c0..9ae9cd3 100644
6100 ---- a/drivers/video/fbmon.c
6101 -+++ b/drivers/video/fbmon.c
6102 -@@ -256,8 +256,8 @@ static void fix_edid(unsigned char *edid, int fix)
6103 -
6104 - static int edid_checksum(unsigned char *edid)
6105 - {
6106 -- unsigned char i, csum = 0, all_null = 0;
6107 -- int err = 0, fix = check_edid(edid);
6108 -+ unsigned char csum = 0, all_null = 0;
6109 -+ int i, err = 0, fix = check_edid(edid);
6110 -
6111 - if (fix)
6112 - fix_edid(edid, fix);
6113
6114 Deleted: genpatches-2.6/trunk/2.6.31/1003_linux-2.6.30.4.patch
6115 ===================================================================
6116 --- genpatches-2.6/trunk/2.6.31/1003_linux-2.6.30.4.patch 2009-09-09 23:15:13 UTC (rev 1604)
6117 +++ genpatches-2.6/trunk/2.6.31/1003_linux-2.6.30.4.patch 2009-09-09 23:51:20 UTC (rev 1605)
6118 @@ -1,2452 +0,0 @@
6119 -diff --git a/Documentation/RCU/rculist_nulls.txt b/Documentation/RCU/rculist_nulls.txt
6120 -index 6389dec..d0c017e 100644
6121 ---- a/Documentation/RCU/rculist_nulls.txt
6122 -+++ b/Documentation/RCU/rculist_nulls.txt
6123 -@@ -83,11 +83,12 @@ not detect it missed following items in original chain.
6124 - obj = kmem_cache_alloc(...);
6125 - lock_chain(); // typically a spin_lock()
6126 - obj->key = key;
6127 --atomic_inc(&obj->refcnt);
6128 - /*
6129 - * we need to make sure obj->key is updated before obj->next
6130 -+ * or obj->refcnt
6131 - */
6132 - smp_wmb();
6133 -+atomic_set(&obj->refcnt, 1);
6134 - hlist_add_head_rcu(&obj->obj_node, list);
6135 - unlock_chain(); // typically a spin_unlock()
6136 -
6137 -@@ -159,6 +160,10 @@ out:
6138 - obj = kmem_cache_alloc(cachep);
6139 - lock_chain(); // typically a spin_lock()
6140 - obj->key = key;
6141 -+/*
6142 -+ * changes to obj->key must be visible before refcnt one
6143 -+ */
6144 -+smp_wmb();
6145 - atomic_set(&obj->refcnt, 1);
6146 - /*
6147 - * insert obj in RCU way (readers might be traversing chain)
6148 -diff --git a/arch/parisc/include/asm/system.h b/arch/parisc/include/asm/system.h
6149 -index ee80c92..d91357b 100644
6150 ---- a/arch/parisc/include/asm/system.h
6151 -+++ b/arch/parisc/include/asm/system.h
6152 -@@ -168,8 +168,8 @@ static inline void set_eiem(unsigned long val)
6153 - /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */
6154 - #define __ldcw(a) ({ \
6155 - unsigned __ret; \
6156 -- __asm__ __volatile__(__LDCW " 0(%1),%0" \
6157 -- : "=r" (__ret) : "r" (a)); \
6158 -+ __asm__ __volatile__(__LDCW " 0(%2),%0" \
6159 -+ : "=r" (__ret), "+m" (*(a)) : "r" (a)); \
6160 - __ret; \
6161 - })
6162 -
6163 -diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
6164 -index 1f6fd4f..8f1a810 100644
6165 ---- a/arch/parisc/include/asm/tlbflush.h
6166 -+++ b/arch/parisc/include/asm/tlbflush.h
6167 -@@ -12,14 +12,12 @@
6168 - * N class systems, only one PxTLB inter processor broadcast can be
6169 - * active at any one time on the Merced bus. This tlb purge
6170 - * synchronisation is fairly lightweight and harmless so we activate
6171 -- * it on all SMP systems not just the N class. We also need to have
6172 -- * preemption disabled on uniprocessor machines, and spin_lock does that
6173 -- * nicely.
6174 -+ * it on all systems not just the N class.
6175 - */
6176 - extern spinlock_t pa_tlb_lock;
6177 -
6178 --#define purge_tlb_start(x) spin_lock(&pa_tlb_lock)
6179 --#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
6180 -+#define purge_tlb_start(flags) spin_lock_irqsave(&pa_tlb_lock, flags)
6181 -+#define purge_tlb_end(flags) spin_unlock_irqrestore(&pa_tlb_lock, flags)
6182 -
6183 - extern void flush_tlb_all(void);
6184 - extern void flush_tlb_all_local(void *);
6185 -@@ -63,14 +61,16 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
6186 - static inline void flush_tlb_page(struct vm_area_struct *vma,
6187 - unsigned long addr)
6188 - {
6189 -+ unsigned long flags;
6190 -+
6191 - /* For one page, it's not worth testing the split_tlb variable */
6192 -
6193 - mb();
6194 - mtsp(vma->vm_mm->context,1);
6195 -- purge_tlb_start();
6196 -+ purge_tlb_start(flags);
6197 - pdtlb(addr);
6198 - pitlb(addr);
6199 -- purge_tlb_end();
6200 -+ purge_tlb_end(flags);
6201 - }
6202 -
6203 - void __flush_tlb_range(unsigned long sid,
6204 -diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
6205 -index 837530e..43546de 100644
6206 ---- a/arch/parisc/kernel/cache.c
6207 -+++ b/arch/parisc/kernel/cache.c
6208 -@@ -398,12 +398,13 @@ EXPORT_SYMBOL(flush_kernel_icache_range_asm);
6209 -
6210 - void clear_user_page_asm(void *page, unsigned long vaddr)
6211 - {
6212 -+ unsigned long flags;
6213 - /* This function is implemented in assembly in pacache.S */
6214 - extern void __clear_user_page_asm(void *page, unsigned long vaddr);
6215 -
6216 -- purge_tlb_start();
6217 -+ purge_tlb_start(flags);
6218 - __clear_user_page_asm(page, vaddr);
6219 -- purge_tlb_end();
6220 -+ purge_tlb_end(flags);
6221 - }
6222 -
6223 - #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
6224 -@@ -444,20 +445,24 @@ extern void clear_user_page_asm(void *page, unsigned long vaddr);
6225 -
6226 - void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
6227 - {
6228 -+ unsigned long flags;
6229 -+
6230 - purge_kernel_dcache_page((unsigned long)page);
6231 -- purge_tlb_start();
6232 -+ purge_tlb_start(flags);
6233 - pdtlb_kernel(page);
6234 -- purge_tlb_end();
6235 -+ purge_tlb_end(flags);
6236 - clear_user_page_asm(page, vaddr);
6237 - }
6238 - EXPORT_SYMBOL(clear_user_page);
6239 -
6240 - void flush_kernel_dcache_page_addr(void *addr)
6241 - {
6242 -+ unsigned long flags;
6243 -+
6244 - flush_kernel_dcache_page_asm(addr);
6245 -- purge_tlb_start();
6246 -+ purge_tlb_start(flags);
6247 - pdtlb_kernel(addr);
6248 -- purge_tlb_end();
6249 -+ purge_tlb_end(flags);
6250 - }
6251 - EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
6252 -
6253 -@@ -490,8 +495,10 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
6254 - if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
6255 - flush_tlb_all();
6256 - else {
6257 -+ unsigned long flags;
6258 -+
6259 - mtsp(sid, 1);
6260 -- purge_tlb_start();
6261 -+ purge_tlb_start(flags);
6262 - if (split_tlb) {
6263 - while (npages--) {
6264 - pdtlb(start);
6265 -@@ -504,7 +511,7 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
6266 - start += PAGE_SIZE;
6267 - }
6268 - }
6269 -- purge_tlb_end();
6270 -+ purge_tlb_end(flags);
6271 - }
6272 - }
6273 -
6274 -diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
6275 -index 7d927ea..c07f618 100644
6276 ---- a/arch/parisc/kernel/pci-dma.c
6277 -+++ b/arch/parisc/kernel/pci-dma.c
6278 -@@ -90,12 +90,14 @@ static inline int map_pte_uncached(pte_t * pte,
6279 - if (end > PMD_SIZE)
6280 - end = PMD_SIZE;
6281 - do {
6282 -+ unsigned long flags;
6283 -+
6284 - if (!pte_none(*pte))
6285 - printk(KERN_ERR "map_pte_uncached: page already exists\n");
6286 - set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
6287 -- purge_tlb_start();
6288 -+ purge_tlb_start(flags);
6289 - pdtlb_kernel(orig_vaddr);
6290 -- purge_tlb_end();
6291 -+ purge_tlb_end(flags);
6292 - vaddr += PAGE_SIZE;
6293 - orig_vaddr += PAGE_SIZE;
6294 - (*paddr_ptr) += PAGE_SIZE;
6295 -@@ -168,11 +170,13 @@ static inline void unmap_uncached_pte(pmd_t * pmd, unsigned long vaddr,
6296 - if (end > PMD_SIZE)
6297 - end = PMD_SIZE;
6298 - do {
6299 -+ unsigned long flags;
6300 - pte_t page = *pte;
6301 -+
6302 - pte_clear(&init_mm, vaddr, pte);
6303 -- purge_tlb_start();
6304 -+ purge_tlb_start(flags);
6305 - pdtlb_kernel(orig_vaddr);
6306 -- purge_tlb_end();
6307 -+ purge_tlb_end(flags);
6308 - vaddr += PAGE_SIZE;
6309 - orig_vaddr += PAGE_SIZE;
6310 - pte++;
6311 -diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
6312 -index 0efc12d..5bd527b 100644
6313 ---- a/arch/powerpc/sysdev/mpic.c
6314 -+++ b/arch/powerpc/sysdev/mpic.c
6315 -@@ -279,28 +279,29 @@ static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr,
6316 - }
6317 -
6318 - #ifdef CONFIG_PPC_DCR
6319 --static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
6320 -+static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node,
6321 -+ struct mpic_reg_bank *rb,
6322 - unsigned int offset, unsigned int size)
6323 - {
6324 - const u32 *dbasep;
6325 -
6326 -- dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL);
6327 -+ dbasep = of_get_property(node, "dcr-reg", NULL);
6328 -
6329 -- rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size);
6330 -+ rb->dhost = dcr_map(node, *dbasep + offset, size);
6331 - BUG_ON(!DCR_MAP_OK(rb->dhost));
6332 - }
6333 -
6334 --static inline void mpic_map(struct mpic *mpic, phys_addr_t phys_addr,
6335 -- struct mpic_reg_bank *rb, unsigned int offset,
6336 -- unsigned int size)
6337 -+static inline void mpic_map(struct mpic *mpic, struct device_node *node,
6338 -+ phys_addr_t phys_addr, struct mpic_reg_bank *rb,
6339 -+ unsigned int offset, unsigned int size)
6340 - {
6341 - if (mpic->flags & MPIC_USES_DCR)
6342 -- _mpic_map_dcr(mpic, rb, offset, size);
6343 -+ _mpic_map_dcr(mpic, node, rb, offset, size);
6344 - else
6345 - _mpic_map_mmio(mpic, phys_addr, rb, offset, size);
6346 - }
6347 - #else /* CONFIG_PPC_DCR */
6348 --#define mpic_map(m,p,b,o,s) _mpic_map_mmio(m,p,b,o,s)
6349 -+#define mpic_map(m,n,p,b,o,s) _mpic_map_mmio(m,p,b,o,s)
6350 - #endif /* !CONFIG_PPC_DCR */
6351 -
6352 -
6353 -@@ -1150,8 +1151,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
6354 - }
6355 -
6356 - /* Map the global registers */
6357 -- mpic_map(mpic, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
6358 -- mpic_map(mpic, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
6359 -+ mpic_map(mpic, node, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
6360 -+ mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
6361 -
6362 - /* Reset */
6363 - if (flags & MPIC_WANTS_RESET) {
6364 -@@ -1192,7 +1193,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
6365 -
6366 - /* Map the per-CPU registers */
6367 - for (i = 0; i < mpic->num_cpus; i++) {
6368 -- mpic_map(mpic, paddr, &mpic->cpuregs[i],
6369 -+ mpic_map(mpic, node, paddr, &mpic->cpuregs[i],
6370 - MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE),
6371 - 0x1000);
6372 - }
6373 -@@ -1200,7 +1201,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
6374 - /* Initialize main ISU if none provided */
6375 - if (mpic->isu_size == 0) {
6376 - mpic->isu_size = mpic->num_sources;
6377 -- mpic_map(mpic, paddr, &mpic->isus[0],
6378 -+ mpic_map(mpic, node, paddr, &mpic->isus[0],
6379 - MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
6380 - }
6381 - mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
6382 -@@ -1254,8 +1255,10 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
6383 -
6384 - BUG_ON(isu_num >= MPIC_MAX_ISU);
6385 -
6386 -- mpic_map(mpic, paddr, &mpic->isus[isu_num], 0,
6387 -+ mpic_map(mpic, mpic->irqhost->of_node,
6388 -+ paddr, &mpic->isus[isu_num], 0,
6389 - MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
6390 -+
6391 - if ((isu_first + mpic->isu_size) > mpic->num_sources)
6392 - mpic->num_sources = isu_first + mpic->isu_size;
6393 - }
6394 -diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
6395 -index 9e0587a..2fd19e6 100644
6396 ---- a/arch/x86/boot/video-vga.c
6397 -+++ b/arch/x86/boot/video-vga.c
6398 -@@ -45,8 +45,10 @@ static u8 vga_set_basic_mode(void)
6399 -
6400 - #ifdef CONFIG_VIDEO_400_HACK
6401 - if (adapter >= ADAPTER_VGA) {
6402 -+ ax = 0x1202;
6403 - asm volatile(INT10
6404 -- : : "a" (0x1202), "b" (0x0030)
6405 -+ : "+a" (ax)
6406 -+ : "b" (0x0030)
6407 - : "ecx", "edx", "esi", "edi");
6408 - }
6409 - #endif
6410 -@@ -81,44 +83,59 @@ static u8 vga_set_basic_mode(void)
6411 -
6412 - static void vga_set_8font(void)
6413 - {
6414 -+ u16 ax;
6415 -+
6416 - /* Set 8x8 font - 80x43 on EGA, 80x50 on VGA */
6417 -
6418 - /* Set 8x8 font */
6419 -- asm volatile(INT10 : : "a" (0x1112), "b" (0));
6420 -+ ax = 0x1112;
6421 -+ asm volatile(INT10 : "+a" (ax) : "b" (0));
6422 -
6423 - /* Use alternate print screen */
6424 -- asm volatile(INT10 : : "a" (0x1200), "b" (0x20));
6425 -+ ax = 0x1200;
6426 -+ asm volatile(INT10 : "+a" (ax) : "b" (0x20));
6427 -
6428 - /* Turn off cursor emulation */
6429 -- asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6430 -+ ax = 0x1201;
6431 -+ asm volatile(INT10 : "+a" (ax) : "b" (0x34));
6432 -
6433 - /* Cursor is scan lines 6-7 */
6434 -- asm volatile(INT10 : : "a" (0x0100), "c" (0x0607));
6435 -+ ax = 0x0100;
6436 -+ asm volatile(INT10 : "+a" (ax) : "c" (0x0607));
6437 - }
6438 -
6439 - static void vga_set_14font(void)
6440 - {
6441 -+ u16 ax;
6442 -+
6443 - /* Set 9x14 font - 80x28 on VGA */
6444 -
6445 - /* Set 9x14 font */
6446 -- asm volatile(INT10 : : "a" (0x1111), "b" (0));
6447 -+ ax = 0x1111;
6448 -+ asm volatile(INT10 : "+a" (ax) : "b" (0));
6449 -
6450 - /* Turn off cursor emulation */
6451 -- asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
6452 -+ ax = 0x1201;
6453 -+ asm volatile(INT10 : "+a" (ax) : "b" (0x34));
6454 -
6455 - /* Cursor is scan lines 11-12 */
6456 -- asm volatile(INT10 : : "a" (0x0100), "c" (0x0b0c));
6457 -+ ax = 0x0100;
6458 -+ asm volatile(INT10 : "+a" (ax) : "c" (0x0b0c));
6459 - }
6460 -
6461 - static void vga_set_80x43(void)
6462 - {
6463 -+ u16 ax;
6464 -+
6465 - /* Set 80x43 mode on VGA (not EGA) */
6466 -
6467 - /* Set 350 scans */
6468 -- asm volatile(INT10 : : "a" (0x1201), "b" (0x30));
6469 -+ ax = 0x1201;
6470 -+ asm volatile(INT10 : "+a" (ax) : "b" (0x30));
6471 -
6472 - /* Reset video mode */
6473 -- asm volatile(INT10 : : "a" (0x0003));
6474 -+ ax = 0x0003;
6475 -+ asm volatile(INT10 : "+a" (ax));
6476 -
6477 - vga_set_8font();
6478 - }
6479 -@@ -225,7 +242,7 @@ static int vga_set_mode(struct mode_info *mode)
6480 - */
6481 - static int vga_probe(void)
6482 - {
6483 -- u16 ega_bx;
6484 -+ u16 ax, ega_bx;
6485 -
6486 - static const char *card_name[] = {
6487 - "CGA/MDA/HGC", "EGA", "VGA"
6488 -@@ -242,9 +259,10 @@ static int vga_probe(void)
6489 - };
6490 - u8 vga_flag;
6491 -
6492 -+ ax = 0x1200;
6493 - asm(INT10
6494 -- : "=b" (ega_bx)
6495 -- : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */
6496 -+ : "+a" (ax), "=b" (ega_bx)
6497 -+ : "b" (0x10) /* Check EGA/VGA */
6498 - : "ecx", "edx", "esi", "edi");
6499 -
6500 - #ifndef _WAKEUP
6501 -diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
6502 -index 2d81af3..7b2d71d 100644
6503 ---- a/arch/x86/include/asm/fixmap.h
6504 -+++ b/arch/x86/include/asm/fixmap.h
6505 -@@ -111,12 +111,9 @@ enum fixed_addresses {
6506 - #ifdef CONFIG_PARAVIRT
6507 - FIX_PARAVIRT_BOOTMAP,
6508 - #endif
6509 -- FIX_TEXT_POKE0, /* reserve 2 pages for text_poke() */
6510 -- FIX_TEXT_POKE1,
6511 -+ FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */
6512 -+ FIX_TEXT_POKE0, /* first page is last, because allocation is backward */
6513 - __end_of_permanent_fixed_addresses,
6514 --#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
6515 -- FIX_OHCI1394_BASE,
6516 --#endif
6517 - /*
6518 - * 256 temporary boot-time mappings, used by early_ioremap(),
6519 - * before ioremap() is functional.
6520 -@@ -129,6 +126,9 @@ enum fixed_addresses {
6521 - FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
6522 - (__end_of_permanent_fixed_addresses & 255),
6523 - FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
6524 -+#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
6525 -+ FIX_OHCI1394_BASE,
6526 -+#endif
6527 - #ifdef CONFIG_X86_32
6528 - FIX_WP_TEST,
6529 - #endif
6530 -diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
6531 -index 9d826e4..667ed7f 100644
6532 ---- a/arch/x86/include/asm/io_apic.h
6533 -+++ b/arch/x86/include/asm/io_apic.h
6534 -@@ -160,6 +160,7 @@ extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
6535 -
6536 - extern int (*ioapic_renumber_irq)(int ioapic, int irq);
6537 - extern void ioapic_init_mappings(void);
6538 -+extern void ioapic_insert_resources(void);
6539 -
6540 - #ifdef CONFIG_X86_64
6541 - extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
6542 -@@ -183,6 +184,7 @@ extern void ioapic_write_entry(int apic, int pin,
6543 - #define io_apic_assign_pci_irqs 0
6544 - static const int timer_through_8259 = 0;
6545 - static inline void ioapic_init_mappings(void) { }
6546 -+static inline void ioapic_insert_resources(void) { }
6547 -
6548 - static inline void probe_nr_irqs_gsi(void) { }
6549 - #endif
6550 -diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
6551 -index b685ece..02c3fc6 100644
6552 ---- a/arch/x86/include/asm/uaccess.h
6553 -+++ b/arch/x86/include/asm/uaccess.h
6554 -@@ -212,9 +212,9 @@ extern int __get_user_bad(void);
6555 - : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
6556 - #else
6557 - #define __put_user_asm_u64(x, ptr, retval, errret) \
6558 -- __put_user_asm(x, ptr, retval, "q", "", "Zr", errret)
6559 -+ __put_user_asm(x, ptr, retval, "q", "", "er", errret)
6560 - #define __put_user_asm_ex_u64(x, addr) \
6561 -- __put_user_asm_ex(x, addr, "q", "", "Zr")
6562 -+ __put_user_asm_ex(x, addr, "q", "", "er")
6563 - #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu)
6564 - #endif
6565 -
6566 -diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
6567 -index 8cc6873..db24b21 100644
6568 ---- a/arch/x86/include/asm/uaccess_64.h
6569 -+++ b/arch/x86/include/asm/uaccess_64.h
6570 -@@ -88,11 +88,11 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
6571 - ret, "l", "k", "ir", 4);
6572 - return ret;
6573 - case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
6574 -- ret, "q", "", "ir", 8);
6575 -+ ret, "q", "", "er", 8);
6576 - return ret;
6577 - case 10:
6578 - __put_user_asm(*(u64 *)src, (u64 __user *)dst,
6579 -- ret, "q", "", "ir", 10);
6580 -+ ret, "q", "", "er", 10);
6581 - if (unlikely(ret))
6582 - return ret;
6583 - asm("":::"memory");
6584 -@@ -101,12 +101,12 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
6585 - return ret;
6586 - case 16:
6587 - __put_user_asm(*(u64 *)src, (u64 __user *)dst,
6588 -- ret, "q", "", "ir", 16);
6589 -+ ret, "q", "", "er", 16);
6590 - if (unlikely(ret))
6591 - return ret;
6592 - asm("":::"memory");
6593 - __put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
6594 -- ret, "q", "", "ir", 8);
6595 -+ ret, "q", "", "er", 8);
6596 - return ret;
6597 - default:
6598 - return copy_user_generic((__force void *)dst, src, size);
6599 -@@ -157,7 +157,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
6600 - ret, "q", "", "=r", 8);
6601 - if (likely(!ret))
6602 - __put_user_asm(tmp, (u64 __user *)dst,
6603 -- ret, "q", "", "ir", 8);
6604 -+ ret, "q", "", "er", 8);
6605 - return ret;
6606 - }
6607 - default:
6608 -diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
6609 -index 30da617..edfc25c 100644
6610 ---- a/arch/x86/kernel/apic/io_apic.c
6611 -+++ b/arch/x86/kernel/apic/io_apic.c
6612 -@@ -4182,28 +4182,20 @@ fake_ioapic_page:
6613 - }
6614 - }
6615 -
6616 --static int __init ioapic_insert_resources(void)
6617 -+void __init ioapic_insert_resources(void)
6618 - {
6619 - int i;
6620 - struct resource *r = ioapic_resources;
6621 -
6622 - if (!r) {
6623 -- if (nr_ioapics > 0) {
6624 -+ if (nr_ioapics > 0)
6625 - printk(KERN_ERR
6626 - "IO APIC resources couldn't be allocated.\n");
6627 -- return -1;
6628 -- }
6629 -- return 0;
6630 -+ return;
6631 - }
6632 -
6633 - for (i = 0; i < nr_ioapics; i++) {
6634 - insert_resource(&iomem_resource, r);
6635 - r++;
6636 - }
6637 --
6638 -- return 0;
6639 - }
6640 --
6641 --/* Insert the IO APIC resources after PCI initialization has occured to handle
6642 -- * IO APICS that are mapped in on a BAR in PCI space. */
6643 --late_initcall(ioapic_insert_resources);
6644 -diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
6645 -index 846510b..2a62d84 100644
6646 ---- a/arch/x86/kernel/mfgpt_32.c
6647 -+++ b/arch/x86/kernel/mfgpt_32.c
6648 -@@ -347,7 +347,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
6649 -
6650 - static struct irqaction mfgptirq = {
6651 - .handler = mfgpt_tick,
6652 -- .flags = IRQF_DISABLED | IRQF_NOBALANCING,
6653 -+ .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
6654 - .name = "mfgpt-timer"
6655 - };
6656 -
6657 -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
6658 -index 0acc6a7..771ffd0 100644
6659 ---- a/arch/x86/kernel/setup.c
6660 -+++ b/arch/x86/kernel/setup.c
6661 -@@ -650,6 +650,19 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
6662 - DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies"),
6663 - },
6664 - },
6665 -+ {
6666 -+ /*
6667 -+ * AMI BIOS with low memory corruption was found on Intel DG45ID board.
6668 -+ * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
6669 -+ * match only DMI_BOARD_NAME and see if there is more bad products
6670 -+ * with this vendor.
6671 -+ */
6672 -+ .callback = dmi_low_memory_corruption,
6673 -+ .ident = "AMI BIOS",
6674 -+ .matches = {
6675 -+ DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
6676 -+ },
6677 -+ },
6678 - #endif
6679 - {}
6680 - };
6681 -diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
6682 -index 6340cef..312e8eb 100644
6683 ---- a/arch/x86/mm/gup.c
6684 -+++ b/arch/x86/mm/gup.c
6685 -@@ -247,10 +247,15 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
6686 - start &= PAGE_MASK;
6687 - addr = start;
6688 - len = (unsigned long) nr_pages << PAGE_SHIFT;
6689 -+
6690 - end = start + len;
6691 -- if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
6692 -- (void __user *)start, len)))
6693 -+ if (end < start)
6694 -+ goto slow_irqon;
6695 -+
6696 -+#ifdef CONFIG_X86_64
6697 -+ if (end >> 47)
6698 - goto slow_irqon;
6699 -+#endif
6700 -
6701 - /*
6702 - * XXX: batch / limit 'nr', to avoid large irq off latency
6703 -diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
6704 -index 0176595..c5c43e0 100644
6705 ---- a/arch/x86/mm/srat_64.c
6706 -+++ b/arch/x86/mm/srat_64.c
6707 -@@ -89,8 +89,10 @@ static __init void bad_srat(void)
6708 - found_add_area = 0;
6709 - for (i = 0; i < MAX_LOCAL_APIC; i++)
6710 - apicid_to_node[i] = NUMA_NO_NODE;
6711 -- for (i = 0; i < MAX_NUMNODES; i++)
6712 -- nodes_add[i].start = nodes[i].end = 0;
6713 -+ for (i = 0; i < MAX_NUMNODES; i++) {
6714 -+ nodes[i].start = nodes[i].end = 0;
6715 -+ nodes_add[i].start = nodes_add[i].end = 0;
6716 -+ }
6717 - remove_all_active_ranges();
6718 - }
6719 -
6720 -diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
6721 -index a85bef2..6dcebb5 100644
6722 ---- a/arch/x86/pci/i386.c
6723 -+++ b/arch/x86/pci/i386.c
6724 -@@ -35,6 +35,7 @@
6725 - #include <asm/pat.h>
6726 - #include <asm/e820.h>
6727 - #include <asm/pci_x86.h>
6728 -+#include <asm/io_apic.h>
6729 -
6730 -
6731 - static int
6732 -@@ -230,6 +231,12 @@ void __init pcibios_resource_survey(void)
6733 - pcibios_allocate_resources(1);
6734 -
6735 - e820_reserve_resources_late();
6736 -+ /*
6737 -+ * Insert the IO APIC resources after PCI initialization has
6738 -+ * occured to handle IO APICS that are mapped in on a BAR in
6739 -+ * PCI space, but before trying to assign unassigned pci res.
6740 -+ */
6741 -+ ioapic_insert_resources();
6742 - }
6743 -
6744 - /**
6745 -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
6746 -index 94919ad..d37808b 100644
6747 ---- a/drivers/ata/libata-eh.c
6748 -+++ b/drivers/ata/libata-eh.c
6749 -@@ -2517,6 +2517,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
6750 -
6751 - ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
6752 - rc = ata_do_reset(link, reset, classes, deadline, true);
6753 -+ if (rc) {
6754 -+ failed_link = link;
6755 -+ goto fail;
6756 -+ }
6757 - }
6758 - } else {
6759 - if (verbose)
6760 -diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
6761 -index d94d25c..c1791a6 100644
6762 ---- a/drivers/char/vc_screen.c
6763 -+++ b/drivers/char/vc_screen.c
6764 -@@ -495,11 +495,15 @@ void vcs_remove_sysfs(int index)
6765 -
6766 - int __init vcs_init(void)
6767 - {
6768 -+ unsigned int i;
6769 -+
6770 - if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
6771 - panic("unable to get major %d for vcs device", VCS_MAJOR);
6772 - vc_class = class_create(THIS_MODULE, "vc");
6773 -
6774 - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
6775 - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
6776 -+ for (i = 0; i < MIN_NR_CONSOLES; i++)
6777 -+ vcs_make_sysfs(i);
6778 - return 0;
6779 - }
6780 -diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
6781 -index e9b436d..39e27f4 100644
6782 ---- a/drivers/hid/usbhid/hiddev.c
6783 -+++ b/drivers/hid/usbhid/hiddev.c
6784 -@@ -527,8 +527,10 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
6785 - goto goodreturn;
6786 -
6787 - case HIDIOCGCOLLECTIONINDEX:
6788 -+ i = field->usage[uref->usage_index].collection_index;
6789 -+ unlock_kernel();
6790 - kfree(uref_multi);
6791 -- return field->usage[uref->usage_index].collection_index;
6792 -+ return i;
6793 - case HIDIOCGUSAGES:
6794 - for (i = 0; i < uref_multi->num_values; i++)
6795 - uref_multi->values[i] =
6796 -diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
6797 -index f27af6a..65cf25f 100644
6798 ---- a/drivers/hwmon/max6650.c
6799 -+++ b/drivers/hwmon/max6650.c
6800 -@@ -407,6 +407,7 @@ static ssize_t set_div(struct device *dev, struct device_attribute *devattr,
6801 - data->count = 3;
6802 - break;
6803 - default:
6804 -+ mutex_unlock(&data->update_lock);
6805 - dev_err(&client->dev,
6806 - "illegal value for fan divider (%d)\n", div);
6807 - return -EINVAL;
6808 -diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
6809 -index 7c8957d..26e17a9 100644
6810 ---- a/drivers/input/misc/wistron_btns.c
6811 -+++ b/drivers/input/misc/wistron_btns.c
6812 -@@ -646,6 +646,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
6813 - },
6814 - {
6815 - .callback = dmi_matched,
6816 -+ .ident = "Maxdata Pro 7000 DX",
6817 -+ .matches = {
6818 -+ DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"),
6819 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"),
6820 -+ },
6821 -+ .driver_data = keymap_fs_amilo_pro_v2000
6822 -+ },
6823 -+ {
6824 -+ .callback = dmi_matched,
6825 - .ident = "Fujitsu N3510",
6826 - .matches = {
6827 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
6828 -diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
6829 -index e582a48..42f1a82 100644
6830 ---- a/drivers/isdn/gigaset/ev-layer.c
6831 -+++ b/drivers/isdn/gigaset/ev-layer.c
6832 -@@ -294,32 +294,33 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
6833 - {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}},
6834 - {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
6835 - {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
6836 -- {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */
6837 -+ {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"},
6838 - {RSP_OK, 607,607, -1, 608,-1},
6839 -- //{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 608, 0, {ACT_ERROR}},//DELETE
6840 - {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}},
6841 - {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}},
6842 -
6843 -- {RSP_ZVLS, 608,608, 17, -1,-1, {ACT_DEBUG}},
6844 -- {RSP_ZCTP, 609,609, -1, -1,-1, {ACT_DEBUG}},
6845 -- {RSP_ZCPN, 609,609, -1, -1,-1, {ACT_DEBUG}},
6846 - {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
6847 - {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
6848 -
6849 -- /* dialing */
6850 -- {RSP_ZCTP, 650,650, -1, -1,-1, {ACT_DEBUG}},
6851 -- {RSP_ZCPN, 650,650, -1, -1,-1, {ACT_DEBUG}},
6852 -- {RSP_ZSAU, 650,650,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, /* some devices don't send this */
6853 --
6854 -- /* connection established */
6855 -- {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
6856 -- {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
6857 --
6858 -- {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, //FIXME new constate + timeout
6859 -+ /* optional dialing responses */
6860 -+ {EV_BC_OPEN, 650,650, -1, 651,-1},
6861 -+ {RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}},
6862 -+ {RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}},
6863 -+ {RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}},
6864 -+ {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}},
6865 -+
6866 -+ /* connect */
6867 -+ {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
6868 -+ {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
6869 -+ ACT_NOTIFY_BC_UP}},
6870 -+ {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
6871 -+ {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
6872 -+ ACT_NOTIFY_BC_UP}},
6873 -+ {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}},
6874 -
6875 - /* remote hangup */
6876 -- {RSP_ZSAU, 650,650,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
6877 -- {RSP_ZSAU, 750,750,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
6878 -+ {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
6879 -+ {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
6880 - {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
6881 -
6882 - /* hangup */
6883 -@@ -358,7 +359,8 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
6884 - {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}},
6885 - {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}},
6886 -
6887 -- {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}},
6888 -+ {EV_BC_OPEN, 750,750, -1, 751,-1},
6889 -+ {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}},
6890 -
6891 - /* B channel closed (general case) */
6892 - {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME
6893 -@@ -876,12 +878,6 @@ static void bchannel_down(struct bc_state *bcs)
6894 -
6895 - static void bchannel_up(struct bc_state *bcs)
6896 - {
6897 -- if (!(bcs->chstate & CHS_D_UP)) {
6898 -- dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
6899 -- bcs->chstate |= CHS_D_UP;
6900 -- gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
6901 -- }
6902 --
6903 - if (bcs->chstate & CHS_B_UP) {
6904 - dev_notice(bcs->cs->dev, "%s: B channel already up\n",
6905 - __func__);
6906 -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
6907 -index 076fbb4..d8d31b8 100644
6908 ---- a/drivers/md/dm-raid1.c
6909 -+++ b/drivers/md/dm-raid1.c
6910 -@@ -638,6 +638,7 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
6911 - spin_lock_irq(&ms->lock);
6912 - bio_list_merge(&ms->writes, &requeue);
6913 - spin_unlock_irq(&ms->lock);
6914 -+ delayed_wake(ms);
6915 - }
6916 -
6917 - /*
6918 -diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
6919 -index b56d72f..34e2348 100644
6920 ---- a/drivers/mmc/host/mvsdio.c
6921 -+++ b/drivers/mmc/host/mvsdio.c
6922 -@@ -384,7 +384,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
6923 - u16 val[2] = {0, 0};
6924 - val[0] = mvsd_read(MVSD_FIFO);
6925 - val[1] = mvsd_read(MVSD_FIFO);
6926 -- memcpy(p, &val, s);
6927 -+ memcpy(p, ((void *)&val) + 4 - s, s);
6928 - s = 0;
6929 - intr_status = mvsd_read(MVSD_NOR_INTR_STATUS);
6930 - }
6931 -@@ -423,7 +423,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
6932 - if (s < 4) {
6933 - if (s && (intr_status & MVSD_NOR_TX_AVAIL)) {
6934 - u16 val[2] = {0, 0};
6935 -- memcpy(&val, p, s);
6936 -+ memcpy(((void *)&val) + 4 - s, p, s);
6937 - mvsd_write(MVSD_FIFO, val[0]);
6938 - mvsd_write(MVSD_FIFO, val[1]);
6939 - s = 0;
6940 -diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
6941 -index 1fc4543..d35cf5b 100644
6942 ---- a/drivers/net/8139too.c
6943 -+++ b/drivers/net/8139too.c
6944 -@@ -917,6 +917,7 @@ static const struct net_device_ops rtl8139_netdev_ops = {
6945 - .ndo_open = rtl8139_open,
6946 - .ndo_stop = rtl8139_close,
6947 - .ndo_get_stats = rtl8139_get_stats,
6948 -+ .ndo_change_mtu = eth_change_mtu,
6949 - .ndo_validate_addr = eth_validate_addr,
6950 - .ndo_set_mac_address = rtl8139_set_mac_address,
6951 - .ndo_start_xmit = rtl8139_start_xmit,
6952 -diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
6953 -index a740053..25aef09 100644
6954 ---- a/drivers/net/arm/ixp4xx_eth.c
6955 -+++ b/drivers/net/arm/ixp4xx_eth.c
6956 -@@ -1140,7 +1140,9 @@ static const struct net_device_ops ixp4xx_netdev_ops = {
6957 - .ndo_start_xmit = eth_xmit,
6958 - .ndo_set_multicast_list = eth_set_mcast_list,
6959 - .ndo_do_ioctl = eth_ioctl,
6960 --
6961 -+ .ndo_change_mtu = eth_change_mtu,
6962 -+ .ndo_set_mac_address = eth_mac_addr,
6963 -+ .ndo_validate_addr = eth_validate_addr,
6964 - };
6965 -
6966 - static int __devinit eth_init_one(struct platform_device *pdev)
6967 -diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
6968 -index b22dab9..0a7a288 100644
6969 ---- a/drivers/net/ehea/ehea_main.c
6970 -+++ b/drivers/net/ehea/ehea_main.c
6971 -@@ -3080,7 +3080,9 @@ static const struct net_device_ops ehea_netdev_ops = {
6972 - .ndo_poll_controller = ehea_netpoll,
6973 - #endif
6974 - .ndo_get_stats = ehea_get_stats,
6975 -+ .ndo_change_mtu = eth_change_mtu,
6976 - .ndo_set_mac_address = ehea_set_mac_addr,
6977 -+ .ndo_validate_addr = eth_validate_addr,
6978 - .ndo_set_multicast_list = ehea_set_multicast_list,
6979 - .ndo_change_mtu = ehea_change_mtu,
6980 - .ndo_vlan_rx_register = ehea_vlan_rx_register,
6981 -diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
6982 -index a051918..d8b2649 100644
6983 ---- a/drivers/net/gianfar.c
6984 -+++ b/drivers/net/gianfar.c
6985 -@@ -155,6 +155,8 @@ static const struct net_device_ops gfar_netdev_ops = {
6986 - .ndo_tx_timeout = gfar_timeout,
6987 - .ndo_do_ioctl = gfar_ioctl,
6988 - .ndo_vlan_rx_register = gfar_vlan_rx_register,
6989 -+ .ndo_set_mac_address = eth_mac_addr,
6990 -+ .ndo_validate_addr = eth_validate_addr,
6991 - #ifdef CONFIG_NET_POLL_CONTROLLER
6992 - .ndo_poll_controller = gfar_netpoll,
6993 - #endif
6994 -diff --git a/drivers/net/plip.c b/drivers/net/plip.c
6995 -index 0be0f0b..5e2d89d 100644
6996 ---- a/drivers/net/plip.c
6997 -+++ b/drivers/net/plip.c
6998 -@@ -270,6 +270,9 @@ static const struct net_device_ops plip_netdev_ops = {
6999 - .ndo_stop = plip_close,
7000 - .ndo_start_xmit = plip_tx_packet,
7001 - .ndo_do_ioctl = plip_ioctl,
7002 -+ .ndo_change_mtu = eth_change_mtu,
7003 -+ .ndo_set_mac_address = eth_mac_addr,
7004 -+ .ndo_validate_addr = eth_validate_addr,
7005 - };
7006 -
7007 - /* Entry point of PLIP driver.
7008 -diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
7009 -index 30900b3..34c53c6 100644
7010 ---- a/drivers/net/ps3_gelic_net.c
7011 -+++ b/drivers/net/ps3_gelic_net.c
7012 -@@ -1410,6 +1410,7 @@ static const struct net_device_ops gelic_netdevice_ops = {
7013 - .ndo_set_multicast_list = gelic_net_set_multi,
7014 - .ndo_change_mtu = gelic_net_change_mtu,
7015 - .ndo_tx_timeout = gelic_net_tx_timeout,
7016 -+ .ndo_set_mac_address = eth_mac_addr,
7017 - .ndo_validate_addr = eth_validate_addr,
7018 - #ifdef CONFIG_NET_POLL_CONTROLLER
7019 - .ndo_poll_controller = gelic_net_poll_controller,
7020 -diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
7021 -index 4f3ada6..4530126 100644
7022 ---- a/drivers/net/ps3_gelic_wireless.c
7023 -+++ b/drivers/net/ps3_gelic_wireless.c
7024 -@@ -2707,6 +2707,7 @@ static const struct net_device_ops gelic_wl_netdevice_ops = {
7025 - .ndo_set_multicast_list = gelic_net_set_multi,
7026 - .ndo_change_mtu = gelic_net_change_mtu,
7027 - .ndo_tx_timeout = gelic_net_tx_timeout,
7028 -+ .ndo_set_mac_address = eth_mac_addr,
7029 - .ndo_validate_addr = eth_validate_addr,
7030 - #ifdef CONFIG_NET_POLL_CONTROLLER
7031 - .ndo_poll_controller = gelic_net_poll_controller,
7032 -diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
7033 -index fdcbaf8..1c70e99 100644
7034 ---- a/drivers/net/smc91x.c
7035 -+++ b/drivers/net/smc91x.c
7036 -@@ -1774,6 +1774,7 @@ static const struct net_device_ops smc_netdev_ops = {
7037 - .ndo_start_xmit = smc_hard_start_xmit,
7038 - .ndo_tx_timeout = smc_timeout,
7039 - .ndo_set_multicast_list = smc_set_multicast_list,
7040 -+ .ndo_change_mtu = eth_change_mtu,
7041 - .ndo_validate_addr = eth_validate_addr,
7042 - .ndo_set_mac_address = eth_mac_addr,
7043 - #ifdef CONFIG_NET_POLL_CONTROLLER
7044 -diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
7045 -index eb7db03..b4e2685 100644
7046 ---- a/drivers/net/smsc911x.c
7047 -+++ b/drivers/net/smsc911x.c
7048 -@@ -1766,6 +1766,7 @@ static const struct net_device_ops smsc911x_netdev_ops = {
7049 - .ndo_get_stats = smsc911x_get_stats,
7050 - .ndo_set_multicast_list = smsc911x_set_multicast_list,
7051 - .ndo_do_ioctl = smsc911x_do_ioctl,
7052 -+ .ndo_change_mtu = eth_change_mtu,
7053 - .ndo_validate_addr = eth_validate_addr,
7054 - .ndo_set_mac_address = smsc911x_set_mac_address,
7055 - #ifdef CONFIG_NET_POLL_CONTROLLER
7056 -diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
7057 -index a82fb2a..f1e5e45 100644
7058 ---- a/drivers/net/sunvnet.c
7059 -+++ b/drivers/net/sunvnet.c
7060 -@@ -1016,7 +1016,9 @@ static const struct net_device_ops vnet_ops = {
7061 - .ndo_open = vnet_open,
7062 - .ndo_stop = vnet_close,
7063 - .ndo_set_multicast_list = vnet_set_rx_mode,
7064 -+ .ndo_change_mtu = eth_change_mtu,
7065 - .ndo_set_mac_address = vnet_set_mac_addr,
7066 -+ .ndo_validate_addr = eth_validate_addr,
7067 - .ndo_tx_timeout = vnet_tx_timeout,
7068 - .ndo_change_mtu = vnet_change_mtu,
7069 - .ndo_start_xmit = vnet_start_xmit,
7070 -diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
7071 -index 3d0d0b0..d837cf1 100644
7072 ---- a/drivers/net/usb/kaweth.c
7073 -+++ b/drivers/net/usb/kaweth.c
7074 -@@ -982,6 +982,9 @@ static const struct net_device_ops kaweth_netdev_ops = {
7075 - .ndo_tx_timeout = kaweth_tx_timeout,
7076 - .ndo_set_multicast_list = kaweth_set_rx_mode,
7077 - .ndo_get_stats = kaweth_netdev_stats,
7078 -+ .ndo_change_mtu = eth_change_mtu,
7079 -+ .ndo_set_mac_address = eth_mac_addr,
7080 -+ .ndo_validate_addr = eth_validate_addr,
7081 - };
7082 -
7083 - static int kaweth_probe(
7084 -diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
7085 -index 73acbd2..631d269 100644
7086 ---- a/drivers/net/usb/pegasus.c
7087 -+++ b/drivers/net/usb/pegasus.c
7088 -@@ -1493,6 +1493,9 @@ static const struct net_device_ops pegasus_netdev_ops = {
7089 - .ndo_set_multicast_list = pegasus_set_multicast,
7090 - .ndo_get_stats = pegasus_netdev_stats,
7091 - .ndo_tx_timeout = pegasus_tx_timeout,
7092 -+ .ndo_change_mtu = eth_change_mtu,
7093 -+ .ndo_set_mac_address = eth_mac_addr,
7094 -+ .ndo_validate_addr = eth_validate_addr,
7095 - };
7096 -
7097 - static struct usb_driver pegasus_driver = {
7098 -diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
7099 -index 45daba7..9d49497 100644
7100 ---- a/drivers/net/via-rhine.c
7101 -+++ b/drivers/net/via-rhine.c
7102 -@@ -622,6 +622,7 @@ static const struct net_device_ops rhine_netdev_ops = {
7103 - .ndo_start_xmit = rhine_start_tx,
7104 - .ndo_get_stats = rhine_get_stats,
7105 - .ndo_set_multicast_list = rhine_set_rx_mode,
7106 -+ .ndo_change_mtu = eth_change_mtu,
7107 - .ndo_validate_addr = eth_validate_addr,
7108 - .ndo_set_mac_address = eth_mac_addr,
7109 - .ndo_do_ioctl = netdev_ioctl,
7110 -diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
7111 -index 345593c..a370e51 100644
7112 ---- a/drivers/net/wireless/orinoco/main.c
7113 -+++ b/drivers/net/wireless/orinoco/main.c
7114 -@@ -2521,6 +2521,8 @@ static const struct net_device_ops orinoco_netdev_ops = {
7115 - .ndo_start_xmit = orinoco_xmit,
7116 - .ndo_set_multicast_list = orinoco_set_multicast_list,
7117 - .ndo_change_mtu = orinoco_change_mtu,
7118 -+ .ndo_set_mac_address = eth_mac_addr,
7119 -+ .ndo_validate_addr = eth_validate_addr,
7120 - .ndo_tx_timeout = orinoco_tx_timeout,
7121 - .ndo_get_stats = orinoco_get_stats,
7122 - };
7123 -@@ -2555,7 +2557,6 @@ struct net_device
7124 - priv->wireless_data.spy_data = &priv->spy_data;
7125 - dev->wireless_data = &priv->wireless_data;
7126 - #endif
7127 -- /* we use the default eth_mac_addr for setting the MAC addr */
7128 -
7129 - /* Reserve space in skb for the SNAP header */
7130 - dev->hard_header_len += ENCAPS_OVERHEAD;
7131 -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
7132 -index e1716f1..ff63279 100644
7133 ---- a/drivers/scsi/sg.c
7134 -+++ b/drivers/scsi/sg.c
7135 -@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
7136 - md->nr_entries = req_schp->k_use_sg;
7137 - md->offset = 0;
7138 - md->null_mapped = hp->dxferp ? 0 : 1;
7139 -+ if (dxfer_dir == SG_DXFER_TO_FROM_DEV)
7140 -+ md->from_user = 1;
7141 -+ else
7142 -+ md->from_user = 0;
7143 - }
7144 -
7145 - if (iov_count) {
7146 -diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
7147 -index 97f3158..27e84e4 100644
7148 ---- a/drivers/scsi/zalon.c
7149 -+++ b/drivers/scsi/zalon.c
7150 -@@ -134,7 +134,7 @@ zalon_probe(struct parisc_device *dev)
7151 -
7152 - host = ncr_attach(&zalon7xx_template, unit, &device);
7153 - if (!host)
7154 -- goto fail;
7155 -+ return -ENODEV;
7156 -
7157 - if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) {
7158 - dev_printk(KERN_ERR, &dev->dev, "irq problem with %d, detaching\n ",
7159 -diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h
7160 -index a69cf33..fef14a4 100644
7161 ---- a/drivers/staging/rt2870/rt2870.h
7162 -+++ b/drivers/staging/rt2870/rt2870.h
7163 -@@ -97,6 +97,7 @@
7164 - {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \
7165 - {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \
7166 - {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \
7167 -+ {USB_DEVICE(0x0DF6,0x003F)}, /* Sitecom WL-608 */ \
7168 - {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \
7169 - {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \
7170 - {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \
7171 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
7172 -index 93af37e..54b4b71 100644
7173 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
7174 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
7175 -@@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee,
7176 - struct iw_request_info *info,
7177 - union iwreq_data *wrqu, char *extra)
7178 - {
7179 -- strcpy(wrqu->name, "802.11");
7180 -+ strlcpy(wrqu->name, "802.11", IFNAMSIZ);
7181 - if(ieee->modulation & IEEE80211_CCK_MODULATION){
7182 -- strcat(wrqu->name, "b");
7183 -+ strlcat(wrqu->name, "b", IFNAMSIZ);
7184 - if(ieee->modulation & IEEE80211_OFDM_MODULATION)
7185 -- strcat(wrqu->name, "/g");
7186 -+ strlcat(wrqu->name, "/g", IFNAMSIZ);
7187 - }else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
7188 -- strcat(wrqu->name, "g");
7189 -+ strlcat(wrqu->name, "g", IFNAMSIZ);
7190 -
7191 - if((ieee->state == IEEE80211_LINKED) ||
7192 - (ieee->state == IEEE80211_LINKED_SCANNING))
7193 -- strcat(wrqu->name," linked");
7194 -+ strlcat(wrqu->name," link", IFNAMSIZ);
7195 - else if(ieee->state != IEEE80211_NOLINK)
7196 -- strcat(wrqu->name," link..");
7197 -+ strlcat(wrqu->name," .....", IFNAMSIZ);
7198 -
7199 -
7200 - return 0;
7201 -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
7202 -index 3086090..ef03927 100644
7203 ---- a/drivers/usb/core/devio.c
7204 -+++ b/drivers/usb/core/devio.c
7205 -@@ -982,7 +982,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7206 - USBDEVFS_URB_ZERO_PACKET |
7207 - USBDEVFS_URB_NO_INTERRUPT))
7208 - return -EINVAL;
7209 -- if (!uurb->buffer)
7210 -+ if (uurb->buffer_length > 0 && !uurb->buffer)
7211 - return -EINVAL;
7212 - if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL &&
7213 - (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
7214 -@@ -1038,11 +1038,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7215 - is_in = 0;
7216 - uurb->endpoint &= ~USB_DIR_IN;
7217 - }
7218 -- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
7219 -- uurb->buffer, uurb->buffer_length)) {
7220 -- kfree(dr);
7221 -- return -EFAULT;
7222 -- }
7223 - snoop(&ps->dev->dev, "control urb: bRequest=%02x "
7224 - "bRrequestType=%02x wValue=%04x "
7225 - "wIndex=%04x wLength=%04x\n",
7226 -@@ -1062,9 +1057,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7227 - uurb->number_of_packets = 0;
7228 - if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
7229 - return -EINVAL;
7230 -- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
7231 -- uurb->buffer, uurb->buffer_length))
7232 -- return -EFAULT;
7233 - snoop(&ps->dev->dev, "bulk urb\n");
7234 - break;
7235 -
7236 -@@ -1106,28 +1098,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7237 - return -EINVAL;
7238 - if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
7239 - return -EINVAL;
7240 -- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
7241 -- uurb->buffer, uurb->buffer_length))
7242 -- return -EFAULT;
7243 - snoop(&ps->dev->dev, "interrupt urb\n");
7244 - break;
7245 -
7246 - default:
7247 - return -EINVAL;
7248 - }
7249 -- as = alloc_async(uurb->number_of_packets);
7250 -- if (!as) {
7251 -+ if (uurb->buffer_length > 0 &&
7252 -+ !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
7253 -+ uurb->buffer, uurb->buffer_length)) {
7254 - kfree(isopkt);
7255 - kfree(dr);
7256 -- return -ENOMEM;
7257 -+ return -EFAULT;
7258 - }
7259 -- as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL);
7260 -- if (!as->urb->transfer_buffer) {
7261 -+ as = alloc_async(uurb->number_of_packets);
7262 -+ if (!as) {
7263 - kfree(isopkt);
7264 - kfree(dr);
7265 -- free_async(as);
7266 - return -ENOMEM;
7267 - }
7268 -+ if (uurb->buffer_length > 0) {
7269 -+ as->urb->transfer_buffer = kmalloc(uurb->buffer_length,
7270 -+ GFP_KERNEL);
7271 -+ if (!as->urb->transfer_buffer) {
7272 -+ kfree(isopkt);
7273 -+ kfree(dr);
7274 -+ free_async(as);
7275 -+ return -ENOMEM;
7276 -+ }
7277 -+ }
7278 - as->urb->dev = ps->dev;
7279 - as->urb->pipe = (uurb->type << 30) |
7280 - __create_pipe(ps->dev, uurb->endpoint & 0xf) |
7281 -@@ -1169,7 +1168,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7282 - kfree(isopkt);
7283 - as->ps = ps;
7284 - as->userurb = arg;
7285 -- if (uurb->endpoint & USB_DIR_IN)
7286 -+ if (is_in && uurb->buffer_length > 0)
7287 - as->userbuffer = uurb->buffer;
7288 - else
7289 - as->userbuffer = NULL;
7290 -@@ -1179,9 +1178,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
7291 - as->uid = cred->uid;
7292 - as->euid = cred->euid;
7293 - security_task_getsecid(current, &as->secid);
7294 -- if (!is_in) {
7295 -+ if (!is_in && uurb->buffer_length > 0) {
7296 - if (copy_from_user(as->urb->transfer_buffer, uurb->buffer,
7297 -- as->urb->transfer_buffer_length)) {
7298 -+ uurb->buffer_length)) {
7299 - free_async(as);
7300 - return -EFAULT;
7301 - }
7302 -@@ -1231,22 +1230,22 @@ static int processcompl(struct async *as, void __user * __user *arg)
7303 - if (as->userbuffer)
7304 - if (copy_to_user(as->userbuffer, urb->transfer_buffer,
7305 - urb->transfer_buffer_length))
7306 -- return -EFAULT;
7307 -+ goto err_out;
7308 - if (put_user(as->status, &userurb->status))
7309 -- return -EFAULT;
7310 -+ goto err_out;
7311 - if (put_user(urb->actual_length, &userurb->actual_length))
7312 -- return -EFAULT;
7313 -+ goto err_out;
7314 - if (put_user(urb->error_count, &userurb->error_count))
7315 -- return -EFAULT;
7316 -+ goto err_out;
7317 -
7318 - if (usb_endpoint_xfer_isoc(&urb->ep->desc)) {
7319 - for (i = 0; i < urb->number_of_packets; i++) {
7320 - if (put_user(urb->iso_frame_desc[i].actual_length,
7321 - &userurb->iso_frame_desc[i].actual_length))
7322 -- return -EFAULT;
7323 -+ goto err_out;
7324 - if (put_user(urb->iso_frame_desc[i].status,
7325 - &userurb->iso_frame_desc[i].status))
7326 -- return -EFAULT;
7327 -+ goto err_out;
7328 - }
7329 - }
7330 -
7331 -@@ -1255,6 +1254,10 @@ static int processcompl(struct async *as, void __user * __user *arg)
7332 - if (put_user(addr, (void __user * __user *)arg))
7333 - return -EFAULT;
7334 - return 0;
7335 -+
7336 -+err_out:
7337 -+ free_async(as);
7338 -+ return -EFAULT;
7339 - }
7340 -
7341 - static struct async *reap_as(struct dev_state *ps)
7342 -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
7343 -index b626283..a94f184 100644
7344 ---- a/drivers/usb/core/message.c
7345 -+++ b/drivers/usb/core/message.c
7346 -@@ -758,6 +758,48 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid,
7347 - return rc;
7348 - }
7349 -
7350 -+static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)
7351 -+{
7352 -+ int err;
7353 -+
7354 -+ if (dev->have_langid)
7355 -+ return 0;
7356 -+
7357 -+ if (dev->string_langid < 0)
7358 -+ return -EPIPE;
7359 -+
7360 -+ err = usb_string_sub(dev, 0, 0, tbuf);
7361 -+
7362 -+ /* If the string was reported but is malformed, default to english
7363 -+ * (0x0409) */
7364 -+ if (err == -ENODATA || (err > 0 && err < 4)) {
7365 -+ dev->string_langid = 0x0409;
7366 -+ dev->have_langid = 1;
7367 -+ dev_err(&dev->dev,
7368 -+ "string descriptor 0 malformed (err = %d), "
7369 -+ "defaulting to 0x%04x\n",
7370 -+ err, dev->string_langid);
7371 -+ return 0;
7372 -+ }
7373 -+
7374 -+ /* In case of all other errors, we assume the device is not able to
7375 -+ * deal with strings at all. Set string_langid to -1 in order to
7376 -+ * prevent any string to be retrieved from the device */
7377 -+ if (err < 0) {
7378 -+ dev_err(&dev->dev, "string descriptor 0 read error: %d\n",
7379 -+ err);
7380 -+ dev->string_langid = -1;
7381 -+ return -EPIPE;
7382 -+ }
7383 -+
7384 -+ /* always use the first langid listed */
7385 -+ dev->string_langid = tbuf[2] | (tbuf[3] << 8);
7386 -+ dev->have_langid = 1;
7387 -+ dev_dbg(&dev->dev, "default language 0x%04x\n",
7388 -+ dev->string_langid);
7389 -+ return 0;
7390 -+}
7391 -+
7392 - /**
7393 - * usb_string - returns ISO 8859-1 version of a string descriptor
7394 - * @dev: the device whose string descriptor is being retrieved
7395 -@@ -797,24 +839,9 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
7396 - if (!tbuf)
7397 - return -ENOMEM;
7398 -
7399 -- /* get langid for strings if it's not yet known */
7400 -- if (!dev->have_langid) {
7401 -- err = usb_string_sub(dev, 0, 0, tbuf);
7402 -- if (err < 0) {
7403 -- dev_err(&dev->dev,
7404 -- "string descriptor 0 read error: %d\n",
7405 -- err);
7406 -- } else if (err < 4) {
7407 -- dev_err(&dev->dev, "string descriptor 0 too short\n");
7408 -- } else {
7409 -- dev->string_langid = tbuf[2] | (tbuf[3] << 8);
7410 -- /* always use the first langid listed */
7411 -- dev_dbg(&dev->dev, "default language 0x%04x\n",
7412 -- dev->string_langid);
7413 -- }
7414 --
7415 -- dev->have_langid = 1;
7416 -- }
7417 -+ err = usb_get_langid(dev, tbuf);
7418 -+ if (err < 0)
7419 -+ goto errout;
7420 -
7421 - err = usb_string_sub(dev, dev->string_langid, index, tbuf);
7422 - if (err < 0)
7423 -diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
7424 -index d006dc6..bd102f5 100644
7425 ---- a/drivers/usb/gadget/ether.c
7426 -+++ b/drivers/usb/gadget/ether.c
7427 -@@ -293,15 +293,16 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
7428 - /* CDC Subset */
7429 - eth_config_driver.label = "CDC Subset/SAFE";
7430 -
7431 -- device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM),
7432 -- device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM),
7433 -- device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
7434 -+ device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM);
7435 -+ device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM);
7436 -+ if (!has_rndis())
7437 -+ device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
7438 - }
7439 -
7440 - if (has_rndis()) {
7441 - /* RNDIS plus ECM-or-Subset */
7442 -- device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM),
7443 -- device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM),
7444 -+ device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM);
7445 -+ device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM);
7446 - device_desc.bNumConfigurations = 2;
7447 - }
7448 -
7449 -diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
7450 -index 556d0ec..a01201a 100644
7451 ---- a/drivers/usb/host/ehci-sched.c
7452 -+++ b/drivers/usb/host/ehci-sched.c
7453 -@@ -1617,11 +1617,14 @@ itd_complete (
7454 - desc->status = -EPROTO;
7455 -
7456 - /* HC need not update length with this error */
7457 -- if (!(t & EHCI_ISOC_BABBLE))
7458 -- desc->actual_length = EHCI_ITD_LENGTH (t);
7459 -+ if (!(t & EHCI_ISOC_BABBLE)) {
7460 -+ desc->actual_length = EHCI_ITD_LENGTH(t);
7461 -+ urb->actual_length += desc->actual_length;
7462 -+ }
7463 - } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) {
7464 - desc->status = 0;
7465 -- desc->actual_length = EHCI_ITD_LENGTH (t);
7466 -+ desc->actual_length = EHCI_ITD_LENGTH(t);
7467 -+ urb->actual_length += desc->actual_length;
7468 - } else {
7469 - /* URB was too late */
7470 - desc->status = -EXDEV;
7471 -@@ -2012,7 +2015,8 @@ sitd_complete (
7472 - desc->status = -EPROTO;
7473 - } else {
7474 - desc->status = 0;
7475 -- desc->actual_length = desc->length - SITD_LENGTH (t);
7476 -+ desc->actual_length = desc->length - SITD_LENGTH(t);
7477 -+ urb->actual_length += desc->actual_length;
7478 - }
7479 - stream->depth -= stream->interval << 3;
7480 -
7481 -diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
7482 -index ef5f756..1b28cae 100644
7483 ---- a/drivers/usb/serial/ti_usb_3410_5052.c
7484 -+++ b/drivers/usb/serial/ti_usb_3410_5052.c
7485 -@@ -192,7 +192,6 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
7486 - { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
7487 - { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
7488 - { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
7489 -- { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
7490 - };
7491 -
7492 - static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = {
7493 -@@ -1660,7 +1659,7 @@ static int ti_do_download(struct usb_device *dev, int pipe,
7494 - u8 cs = 0;
7495 - int done;
7496 - struct ti_firmware_header *header;
7497 -- int status;
7498 -+ int status = 0;
7499 - int len;
7500 -
7501 - for (pos = sizeof(struct ti_firmware_header); pos < size; pos++)
7502 -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
7503 -index 40381df..605b17a 100644
7504 ---- a/fs/binfmt_elf.c
7505 -+++ b/fs/binfmt_elf.c
7506 -@@ -1518,11 +1518,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
7507 - info->thread = NULL;
7508 -
7509 - psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
7510 -- fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
7511 --
7512 - if (psinfo == NULL)
7513 - return 0;
7514 -
7515 -+ fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
7516 -+
7517 - /*
7518 - * Figure out how many notes we're going to need for each thread.
7519 - */
7520 -diff --git a/fs/bio.c b/fs/bio.c
7521 -index 9871164..78b0509 100644
7522 ---- a/fs/bio.c
7523 -+++ b/fs/bio.c
7524 -@@ -706,14 +706,13 @@ static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count,
7525 - }
7526 -
7527 - static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,
7528 -- struct sg_iovec *iov, int iov_count, int uncopy,
7529 -- int do_free_page)
7530 -+ struct sg_iovec *iov, int iov_count,
7531 -+ int to_user, int from_user, int do_free_page)
7532 - {
7533 - int ret = 0, i;
7534 - struct bio_vec *bvec;
7535 - int iov_idx = 0;
7536 - unsigned int iov_off = 0;
7537 -- int read = bio_data_dir(bio) == READ;
7538 -
7539 - __bio_for_each_segment(bvec, bio, i, 0) {
7540 - char *bv_addr = page_address(bvec->bv_page);
7541 -@@ -728,13 +727,14 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,
7542 - iov_addr = iov[iov_idx].iov_base + iov_off;
7543 -
7544 - if (!ret) {
7545 -- if (!read && !uncopy)
7546 -- ret = copy_from_user(bv_addr, iov_addr,
7547 -- bytes);
7548 -- if (read && uncopy)
7549 -+ if (to_user)
7550 - ret = copy_to_user(iov_addr, bv_addr,
7551 - bytes);
7552 -
7553 -+ if (from_user)
7554 -+ ret = copy_from_user(bv_addr, iov_addr,
7555 -+ bytes);
7556 -+
7557 - if (ret)
7558 - ret = -EFAULT;
7559 - }
7560 -@@ -771,7 +771,8 @@ int bio_uncopy_user(struct bio *bio)
7561 -
7562 - if (!bio_flagged(bio, BIO_NULL_MAPPED))
7563 - ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
7564 -- bmd->nr_sgvecs, 1, bmd->is_our_pages);
7565 -+ bmd->nr_sgvecs, bio_data_dir(bio) == READ,
7566 -+ 0, bmd->is_our_pages);
7567 - bio_free_map_data(bmd);
7568 - bio_put(bio);
7569 - return ret;
7570 -@@ -876,8 +877,9 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
7571 - /*
7572 - * success
7573 - */
7574 -- if (!write_to_vm && (!map_data || !map_data->null_mapped)) {
7575 -- ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 0);
7576 -+ if ((!write_to_vm && (!map_data || !map_data->null_mapped)) ||
7577 -+ (map_data && map_data->from_user)) {
7578 -+ ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 1, 0);
7579 - if (ret)
7580 - goto cleanup;
7581 - }
7582 -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
7583 -index 4aa81a5..1dc14f2 100644
7584 ---- a/fs/cifs/connect.c
7585 -+++ b/fs/cifs/connect.c
7586 -@@ -2745,6 +2745,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
7587 - strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
7588 -
7589 - /* mostly informational -- no need to fail on error here */
7590 -+ kfree(tcon->nativeFileSystem);
7591 - tcon->nativeFileSystem = cifs_strndup_from_ucs(bcc_ptr,
7592 - bytes_left, is_unicode,
7593 - nls_codepage);
7594 -diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
7595 -index 3758965..83440ca 100644
7596 ---- a/fs/cifs/dir.c
7597 -+++ b/fs/cifs/dir.c
7598 -@@ -641,6 +641,15 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
7599 - }
7600 - }
7601 -
7602 -+ /*
7603 -+ * O_EXCL: optimize away the lookup, but don't hash the dentry. Let
7604 -+ * the VFS handle the create.
7605 -+ */
7606 -+ if (nd->flags & LOOKUP_EXCL) {
7607 -+ d_instantiate(direntry, NULL);
7608 -+ return 0;
7609 -+ }
7610 -+
7611 - /* can not grab the rename sem here since it would
7612 - deadlock in the cases (beginning of sys_rename itself)
7613 - in which we already have the sb rename sem */
7614 -diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
7615 -index af737bb..259525c 100644
7616 ---- a/fs/ecryptfs/keystore.c
7617 -+++ b/fs/ecryptfs/keystore.c
7618 -@@ -1303,6 +1303,13 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
7619 - }
7620 - (*new_auth_tok)->session_key.encrypted_key_size =
7621 - (body_size - (ECRYPTFS_SALT_SIZE + 5));
7622 -+ if ((*new_auth_tok)->session_key.encrypted_key_size
7623 -+ > ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES) {
7624 -+ printk(KERN_WARNING "Tag 3 packet contains key larger "
7625 -+ "than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES\n");
7626 -+ rc = -EINVAL;
7627 -+ goto out_free;
7628 -+ }
7629 - if (unlikely(data[(*packet_size)++] != 0x04)) {
7630 - printk(KERN_WARNING "Unknown version number [%d]\n",
7631 - data[(*packet_size) - 1]);
7632 -@@ -1449,6 +1456,12 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents,
7633 - rc = -EINVAL;
7634 - goto out;
7635 - }
7636 -+ if (unlikely((*tag_11_contents_size) > max_contents_bytes)) {
7637 -+ printk(KERN_ERR "Literal data section in tag 11 packet exceeds "
7638 -+ "expected size\n");
7639 -+ rc = -EINVAL;
7640 -+ goto out;
7641 -+ }
7642 - if (data[(*packet_size)++] != 0x62) {
7643 - printk(KERN_WARNING "Unrecognizable packet\n");
7644 - rc = -EINVAL;
7645 -diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
7646 -index b660435..7843755 100644
7647 ---- a/fs/nfsd/vfs.c
7648 -+++ b/fs/nfsd/vfs.c
7649 -@@ -677,7 +677,6 @@ __be32
7650 - nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
7651 - int access, struct file **filp)
7652 - {
7653 -- const struct cred *cred = current_cred();
7654 - struct dentry *dentry;
7655 - struct inode *inode;
7656 - int flags = O_RDONLY|O_LARGEFILE;
7657 -@@ -732,7 +731,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
7658 - vfs_dq_init(inode);
7659 - }
7660 - *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
7661 -- flags, cred);
7662 -+ flags, current_cred());
7663 - if (IS_ERR(*filp))
7664 - host_err = PTR_ERR(*filp);
7665 - out_nfserr:
7666 -diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
7667 -index 300f1cd..2d81a4d 100644
7668 ---- a/fs/nilfs2/cpfile.c
7669 -+++ b/fs/nilfs2/cpfile.c
7670 -@@ -311,7 +311,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
7671 - ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
7672 - if (ret < 0) {
7673 - if (ret != -ENOENT)
7674 -- goto out_header;
7675 -+ break;
7676 - /* skip hole */
7677 - ret = 0;
7678 - continue;
7679 -@@ -344,7 +344,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
7680 - continue;
7681 - printk(KERN_ERR "%s: cannot delete block\n",
7682 - __func__);
7683 -- goto out_header;
7684 -+ break;
7685 - }
7686 - }
7687 -
7688 -@@ -362,7 +362,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
7689 - kunmap_atomic(kaddr, KM_USER0);
7690 - }
7691 -
7692 -- out_header:
7693 - brelse(header_bh);
7694 -
7695 - out_sem:
7696 -diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
7697 -index bb8a581..e2646c3 100644
7698 ---- a/fs/nilfs2/dat.c
7699 -+++ b/fs/nilfs2/dat.c
7700 -@@ -149,15 +149,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
7701 - entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
7702 - req->pr_entry_bh, kaddr);
7703 - entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat));
7704 -- if (entry->de_blocknr != cpu_to_le64(0) ||
7705 -- entry->de_end != cpu_to_le64(NILFS_CNO_MAX)) {
7706 -- printk(KERN_CRIT
7707 -- "%s: vbn = %llu, start = %llu, end = %llu, pbn = %llu\n",
7708 -- __func__, (unsigned long long)req->pr_entry_nr,
7709 -- (unsigned long long)le64_to_cpu(entry->de_start),
7710 -- (unsigned long long)le64_to_cpu(entry->de_end),
7711 -- (unsigned long long)le64_to_cpu(entry->de_blocknr));
7712 -- }
7713 - entry->de_blocknr = cpu_to_le64(blocknr);
7714 - kunmap_atomic(kaddr, KM_USER0);
7715 -
7716 -diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
7717 -index 22c7f65..1779ddc 100644
7718 ---- a/fs/nilfs2/segment.c
7719 -+++ b/fs/nilfs2/segment.c
7720 -@@ -1846,26 +1846,13 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci,
7721 - err = nilfs_segbuf_write(segbuf, &wi);
7722 -
7723 - res = nilfs_segbuf_wait(segbuf, &wi);
7724 -- err = unlikely(err) ? : res;
7725 -- if (unlikely(err))
7726 -+ err = err ? : res;
7727 -+ if (err)
7728 - return err;
7729 - }
7730 - return 0;
7731 - }
7732 -
7733 --static int nilfs_page_has_uncleared_buffer(struct page *page)
7734 --{
7735 -- struct buffer_head *head, *bh;
7736 --
7737 -- head = bh = page_buffers(page);
7738 -- do {
7739 -- if (buffer_dirty(bh) && !list_empty(&bh->b_assoc_buffers))
7740 -- return 1;
7741 -- bh = bh->b_this_page;
7742 -- } while (bh != head);
7743 -- return 0;
7744 --}
7745 --
7746 - static void __nilfs_end_page_io(struct page *page, int err)
7747 - {
7748 - if (!err) {
7749 -@@ -1889,12 +1876,11 @@ static void nilfs_end_page_io(struct page *page, int err)
7750 - if (!page)
7751 - return;
7752 -
7753 -- if (buffer_nilfs_node(page_buffers(page)) &&
7754 -- nilfs_page_has_uncleared_buffer(page))
7755 -- /* For b-tree node pages, this function may be called twice
7756 -- or more because they might be split in a segment.
7757 -- This check assures that cleanup has been done for all
7758 -- buffers in a split btnode page. */
7759 -+ if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page))
7760 -+ /*
7761 -+ * For b-tree node pages, this function may be called twice
7762 -+ * or more because they might be split in a segment.
7763 -+ */
7764 - return;
7765 -
7766 - __nilfs_end_page_io(page, err);
7767 -@@ -1957,7 +1943,7 @@ static void nilfs_segctor_abort_write(struct nilfs_sc_info *sci,
7768 - }
7769 - if (bh->b_page != fs_page) {
7770 - nilfs_end_page_io(fs_page, err);
7771 -- if (unlikely(fs_page == failed_page))
7772 -+ if (fs_page && fs_page == failed_page)
7773 - goto done;
7774 - fs_page = bh->b_page;
7775 - }
7776 -diff --git a/fs/partitions/check.c b/fs/partitions/check.c
7777 -index 99e33ef..763c9e2 100644
7778 ---- a/fs/partitions/check.c
7779 -+++ b/fs/partitions/check.c
7780 -@@ -426,7 +426,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
7781 - rcu_assign_pointer(ptbl->part[partno], p);
7782 -
7783 - /* suppress uevent if the disk supresses it */
7784 -- if (!dev_get_uevent_suppress(pdev))
7785 -+ if (!dev_get_uevent_suppress(ddev))
7786 - kobject_uevent(&pdev->kobj, KOBJ_ADD);
7787 -
7788 - return p;
7789 -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
7790 -index b4f71f1..e590df0 100644
7791 ---- a/include/linux/blkdev.h
7792 -+++ b/include/linux/blkdev.h
7793 -@@ -723,6 +723,7 @@ struct rq_map_data {
7794 - int nr_entries;
7795 - unsigned long offset;
7796 - int null_mapped;
7797 -+ int from_user;
7798 - };
7799 -
7800 - struct req_iterator {
7801 -diff --git a/include/linux/sched.h b/include/linux/sched.h
7802 -index b4c38bc..03c6c36 100644
7803 ---- a/include/linux/sched.h
7804 -+++ b/include/linux/sched.h
7805 -@@ -206,7 +206,7 @@ extern unsigned long long time_sync_thresh;
7806 - ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
7807 - #define task_contributes_to_load(task) \
7808 - ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
7809 -- (task->flags & PF_FROZEN) == 0)
7810 -+ (task->flags & PF_FREEZING) == 0)
7811 -
7812 - #define __set_task_state(tsk, state_value) \
7813 - do { (tsk)->state = (state_value); } while (0)
7814 -@@ -1630,6 +1630,7 @@ extern cputime_t task_gtime(struct task_struct *p);
7815 - #define PF_MEMALLOC 0x00000800 /* Allocating memory */
7816 - #define PF_FLUSHER 0x00001000 /* responsible for disk writeback */
7817 - #define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
7818 -+#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
7819 - #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
7820 - #define PF_FROZEN 0x00010000 /* frozen for system suspend */
7821 - #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
7822 -diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
7823 -index 6c3f964..5d9a848 100644
7824 ---- a/include/net/netfilter/nf_conntrack.h
7825 -+++ b/include/net/netfilter/nf_conntrack.h
7826 -@@ -255,8 +255,8 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
7827 - /* Update TCP window tracking data when NAT mangles the packet */
7828 - extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
7829 - unsigned int dataoff,
7830 -- struct nf_conn *ct,
7831 -- int dir);
7832 -+ struct nf_conn *ct, int dir,
7833 -+ s16 offset);
7834 -
7835 - /* Fake conntrack entry for untracked connections */
7836 - extern struct nf_conn nf_conntrack_untracked;
7837 -diff --git a/kernel/freezer.c b/kernel/freezer.c
7838 -index 2f4936c..bd1d42b 100644
7839 ---- a/kernel/freezer.c
7840 -+++ b/kernel/freezer.c
7841 -@@ -44,12 +44,19 @@ void refrigerator(void)
7842 - recalc_sigpending(); /* We sent fake signal, clean it up */
7843 - spin_unlock_irq(&current->sighand->siglock);
7844 -
7845 -+ /* prevent accounting of that task to load */
7846 -+ current->flags |= PF_FREEZING;
7847 -+
7848 - for (;;) {
7849 - set_current_state(TASK_UNINTERRUPTIBLE);
7850 - if (!frozen(current))
7851 - break;
7852 - schedule();
7853 - }
7854 -+
7855 -+ /* Remove the accounting blocker */
7856 -+ current->flags &= ~PF_FREEZING;
7857 -+
7858 - pr_debug("%s left refrigerator\n", current->comm);
7859 - __set_current_state(save);
7860 - }
7861 -diff --git a/kernel/sched.c b/kernel/sched.c
7862 -index 26efa47..0d3d47f 100644
7863 ---- a/kernel/sched.c
7864 -+++ b/kernel/sched.c
7865 -@@ -497,6 +497,7 @@ struct rt_rq {
7866 - #endif
7867 - #ifdef CONFIG_SMP
7868 - unsigned long rt_nr_migratory;
7869 -+ unsigned long rt_nr_total;
7870 - int overloaded;
7871 - struct plist_head pushable_tasks;
7872 - #endif
7873 -diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
7874 -index 9bf0d2a..3918e01 100644
7875 ---- a/kernel/sched_rt.c
7876 -+++ b/kernel/sched_rt.c
7877 -@@ -10,6 +10,8 @@ static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
7878 -
7879 - #ifdef CONFIG_RT_GROUP_SCHED
7880 -
7881 -+#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
7882 -+
7883 - static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
7884 - {
7885 - return rt_rq->rq;
7886 -@@ -22,6 +24,8 @@ static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
7887 -
7888 - #else /* CONFIG_RT_GROUP_SCHED */
7889 -
7890 -+#define rt_entity_is_task(rt_se) (1)
7891 -+
7892 - static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
7893 - {
7894 - return container_of(rt_rq, struct rq, rt);
7895 -@@ -73,7 +77,7 @@ static inline void rt_clear_overload(struct rq *rq)
7896 -
7897 - static void update_rt_migration(struct rt_rq *rt_rq)
7898 - {
7899 -- if (rt_rq->rt_nr_migratory && (rt_rq->rt_nr_running > 1)) {
7900 -+ if (rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1) {
7901 - if (!rt_rq->overloaded) {
7902 - rt_set_overload(rq_of_rt_rq(rt_rq));
7903 - rt_rq->overloaded = 1;
7904 -@@ -86,6 +90,12 @@ static void update_rt_migration(struct rt_rq *rt_rq)
7905 -
7906 - static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
7907 - {
7908 -+ if (!rt_entity_is_task(rt_se))
7909 -+ return;
7910 -+
7911 -+ rt_rq = &rq_of_rt_rq(rt_rq)->rt;
7912 -+
7913 -+ rt_rq->rt_nr_total++;
7914 - if (rt_se->nr_cpus_allowed > 1)
7915 - rt_rq->rt_nr_migratory++;
7916 -
7917 -@@ -94,6 +104,12 @@ static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
7918 -
7919 - static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
7920 - {
7921 -+ if (!rt_entity_is_task(rt_se))
7922 -+ return;
7923 -+
7924 -+ rt_rq = &rq_of_rt_rq(rt_rq)->rt;
7925 -+
7926 -+ rt_rq->rt_nr_total--;
7927 - if (rt_se->nr_cpus_allowed > 1)
7928 - rt_rq->rt_nr_migratory--;
7929 -
7930 -diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
7931 -index 90f1347..01e5c43 100644
7932 ---- a/kernel/trace/trace_functions.c
7933 -+++ b/kernel/trace/trace_functions.c
7934 -@@ -364,7 +364,7 @@ ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
7935 - out_reg:
7936 - ret = register_ftrace_function_probe(glob, ops, count);
7937 -
7938 -- return ret;
7939 -+ return ret < 0 ? ret : 0;
7940 - }
7941 -
7942 - static struct ftrace_func_command ftrace_traceon_cmd = {
7943 -diff --git a/mm/filemap.c b/mm/filemap.c
7944 -index 1b60f30..0b20d1f 100644
7945 ---- a/mm/filemap.c
7946 -+++ b/mm/filemap.c
7947 -@@ -2249,6 +2249,7 @@ again:
7948 - pagefault_enable();
7949 - flush_dcache_page(page);
7950 -
7951 -+ mark_page_accessed(page);
7952 - status = a_ops->write_end(file, mapping, pos, bytes, copied,
7953 - page, fsdata);
7954 - if (unlikely(status < 0))
7955 -diff --git a/mm/internal.h b/mm/internal.h
7956 -index 987bb03..090c267 100644
7957 ---- a/mm/internal.h
7958 -+++ b/mm/internal.h
7959 -@@ -284,4 +284,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
7960 - unsigned long start, int len, int flags,
7961 - struct page **pages, struct vm_area_struct **vmas);
7962 -
7963 -+#define ZONE_RECLAIM_NOSCAN -2
7964 -+#define ZONE_RECLAIM_FULL -1
7965 -+#define ZONE_RECLAIM_SOME 0
7966 -+#define ZONE_RECLAIM_SUCCESS 1
7967 - #endif
7968 -diff --git a/mm/nommu.c b/mm/nommu.c
7969 -index b571ef7..2fd2ad5 100644
7970 ---- a/mm/nommu.c
7971 -+++ b/mm/nommu.c
7972 -@@ -69,6 +69,9 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
7973 - int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS;
7974 - int heap_stack_gap = 0;
7975 -
7976 -+/* amount of vm to protect from userspace access */
7977 -+unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR;
7978 -+
7979 - atomic_long_t mmap_pages_allocated;
7980 -
7981 - EXPORT_SYMBOL(mem_map);
7982 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
7983 -index f820383..480907c 100644
7984 ---- a/mm/page_alloc.c
7985 -+++ b/mm/page_alloc.c
7986 -@@ -1420,20 +1420,38 @@ zonelist_scan:
7987 -
7988 - if (!(alloc_flags & ALLOC_NO_WATERMARKS)) {
7989 - unsigned long mark;
7990 -+ int ret;
7991 - if (alloc_flags & ALLOC_WMARK_MIN)
7992 - mark = zone->pages_min;
7993 - else if (alloc_flags & ALLOC_WMARK_LOW)
7994 - mark = zone->pages_low;
7995 - else
7996 - mark = zone->pages_high;
7997 -- if (!zone_watermark_ok(zone, order, mark,
7998 -- classzone_idx, alloc_flags)) {
7999 -- if (!zone_reclaim_mode ||
8000 -- !zone_reclaim(zone, gfp_mask, order))
8001 -+
8002 -+ if (zone_watermark_ok(zone, order, mark,
8003 -+ classzone_idx, alloc_flags))
8004 -+ goto try_this_zone;
8005 -+
8006 -+ if (zone_reclaim_mode == 0)
8007 -+ goto this_zone_full;
8008 -+
8009 -+ ret = zone_reclaim(zone, gfp_mask, order);
8010 -+ switch (ret) {
8011 -+ case ZONE_RECLAIM_NOSCAN:
8012 -+ /* did not scan */
8013 -+ goto try_next_zone;
8014 -+ case ZONE_RECLAIM_FULL:
8015 -+ /* scanned but unreclaimable */
8016 -+ goto this_zone_full;
8017 -+ default:
8018 -+ /* did we reclaim enough */
8019 -+ if (!zone_watermark_ok(zone, order, mark,
8020 -+ classzone_idx, alloc_flags))
8021 - goto this_zone_full;
8022 - }
8023 - }
8024 -
8025 -+try_this_zone:
8026 - page = buffered_rmqueue(preferred_zone, zone, order, gfp_mask);
8027 - if (page)
8028 - break;
8029 -diff --git a/mm/slab.c b/mm/slab.c
8030 -index 9a90b00..021d69f 100644
8031 ---- a/mm/slab.c
8032 -+++ b/mm/slab.c
8033 -@@ -2592,7 +2592,7 @@ void kmem_cache_destroy(struct kmem_cache *cachep)
8034 - }
8035 -
8036 - if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU))
8037 -- synchronize_rcu();
8038 -+ rcu_barrier();
8039 -
8040 - __kmem_cache_destroy(cachep);
8041 - mutex_unlock(&cache_chain_mutex);
8042 -diff --git a/mm/slob.c b/mm/slob.c
8043 -index f92e66d..c80d982 100644
8044 ---- a/mm/slob.c
8045 -+++ b/mm/slob.c
8046 -@@ -590,6 +590,8 @@ EXPORT_SYMBOL(kmem_cache_create);
8047 -
8048 - void kmem_cache_destroy(struct kmem_cache *c)
8049 - {
8050 -+ if (c->flags & SLAB_DESTROY_BY_RCU)
8051 -+ rcu_barrier();
8052 - slob_free(c, sizeof(struct kmem_cache));
8053 - }
8054 - EXPORT_SYMBOL(kmem_cache_destroy);
8055 -diff --git a/mm/slub.c b/mm/slub.c
8056 -index 65ffda5..253016d 100644
8057 ---- a/mm/slub.c
8058 -+++ b/mm/slub.c
8059 -@@ -2490,6 +2490,8 @@ static inline int kmem_cache_close(struct kmem_cache *s)
8060 - */
8061 - void kmem_cache_destroy(struct kmem_cache *s)
8062 - {
8063 -+ if (s->flags & SLAB_DESTROY_BY_RCU)
8064 -+ rcu_barrier();
8065 - down_write(&slub_lock);
8066 - s->refcount--;
8067 - if (!s->refcount) {
8068 -diff --git a/mm/vmscan.c b/mm/vmscan.c
8069 -index 2500b01..b3e39b5 100644
8070 ---- a/mm/vmscan.c
8071 -+++ b/mm/vmscan.c
8072 -@@ -2426,16 +2426,16 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
8073 - */
8074 - if (zone_pagecache_reclaimable(zone) <= zone->min_unmapped_pages &&
8075 - zone_page_state(zone, NR_SLAB_RECLAIMABLE) <= zone->min_slab_pages)
8076 -- return 0;
8077 -+ return ZONE_RECLAIM_FULL;
8078 -
8079 - if (zone_is_all_unreclaimable(zone))
8080 -- return 0;
8081 -+ return ZONE_RECLAIM_FULL;
8082 -
8083 - /*
8084 - * Do not scan if the allocation should not be delayed.
8085 - */
8086 - if (!(gfp_mask & __GFP_WAIT) || (current->flags & PF_MEMALLOC))
8087 -- return 0;
8088 -+ return ZONE_RECLAIM_NOSCAN;
8089 -
8090 - /*
8091 - * Only run zone reclaim on the local zone or on zones that do not
8092 -@@ -2445,10 +2445,11 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
8093 - */
8094 - node_id = zone_to_nid(zone);
8095 - if (node_state(node_id, N_CPU) && node_id != numa_node_id())
8096 -- return 0;
8097 -+ return ZONE_RECLAIM_NOSCAN;
8098 -
8099 - if (zone_test_and_set_flag(zone, ZONE_RECLAIM_LOCKED))
8100 -- return 0;
8101 -+ return ZONE_RECLAIM_NOSCAN;
8102 -+
8103 - ret = __zone_reclaim(zone, gfp_mask, order);
8104 - zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
8105 -
8106 -diff --git a/net/dsa/mv88e6xxx.c b/net/dsa/mv88e6xxx.c
8107 -index 4e4d8b5..efe661a 100644
8108 ---- a/net/dsa/mv88e6xxx.c
8109 -+++ b/net/dsa/mv88e6xxx.c
8110 -@@ -418,7 +418,7 @@ static int mv88e6xxx_stats_wait(struct dsa_switch *ds)
8111 - int i;
8112 -
8113 - for (i = 0; i < 10; i++) {
8114 -- ret = REG_READ(REG_GLOBAL2, 0x1d);
8115 -+ ret = REG_READ(REG_GLOBAL, 0x1d);
8116 - if ((ret & 0x8000) == 0)
8117 - return 0;
8118 - }
8119 -diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
8120 -index cf7a42b..05ede41 100644
8121 ---- a/net/ipv4/netfilter/nf_nat_helper.c
8122 -+++ b/net/ipv4/netfilter/nf_nat_helper.c
8123 -@@ -191,7 +191,8 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
8124 - ct, ctinfo);
8125 - /* Tell TCP window tracking about seq change */
8126 - nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
8127 -- ct, CTINFO2DIR(ctinfo));
8128 -+ ct, CTINFO2DIR(ctinfo),
8129 -+ (int)rep_len - (int)match_len);
8130 -
8131 - nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
8132 - }
8133 -@@ -377,6 +378,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
8134 - struct tcphdr *tcph;
8135 - int dir;
8136 - __be32 newseq, newack;
8137 -+ s16 seqoff, ackoff;
8138 - struct nf_conn_nat *nat = nfct_nat(ct);
8139 - struct nf_nat_seq *this_way, *other_way;
8140 -
8141 -@@ -390,15 +392,18 @@ nf_nat_seq_adjust(struct sk_buff *skb,
8142 -
8143 - tcph = (void *)skb->data + ip_hdrlen(skb);
8144 - if (after(ntohl(tcph->seq), this_way->correction_pos))
8145 -- newseq = htonl(ntohl(tcph->seq) + this_way->offset_after);
8146 -+ seqoff = this_way->offset_after;
8147 - else
8148 -- newseq = htonl(ntohl(tcph->seq) + this_way->offset_before);
8149 -+ seqoff = this_way->offset_before;
8150 -
8151 - if (after(ntohl(tcph->ack_seq) - other_way->offset_before,
8152 - other_way->correction_pos))
8153 -- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after);
8154 -+ ackoff = other_way->offset_after;
8155 - else
8156 -- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
8157 -+ ackoff = other_way->offset_before;
8158 -+
8159 -+ newseq = htonl(ntohl(tcph->seq) + seqoff);
8160 -+ newack = htonl(ntohl(tcph->ack_seq) - ackoff);
8161 -
8162 - inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
8163 - inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
8164 -@@ -413,7 +418,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
8165 - if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo))
8166 - return 0;
8167 -
8168 -- nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir);
8169 -+ nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir, seqoff);
8170 -
8171 - return 1;
8172 - }
8173 -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
8174 -index 8020db6..0d961ee 100644
8175 ---- a/net/netfilter/nf_conntrack_core.c
8176 -+++ b/net/netfilter/nf_conntrack_core.c
8177 -@@ -295,7 +295,8 @@ begin:
8178 - h = __nf_conntrack_find(net, tuple);
8179 - if (h) {
8180 - ct = nf_ct_tuplehash_to_ctrack(h);
8181 -- if (unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
8182 -+ if (unlikely(nf_ct_is_dying(ct) ||
8183 -+ !atomic_inc_not_zero(&ct->ct_general.use)))
8184 - h = NULL;
8185 - else {
8186 - if (unlikely(!nf_ct_tuple_equal(tuple, &h->tuple))) {
8187 -@@ -385,7 +386,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
8188 - /* Remove from unconfirmed list */
8189 - hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode);
8190 -
8191 -- __nf_conntrack_hash_insert(ct, hash, repl_hash);
8192 - /* Timer relative to confirmation time, not original
8193 - setting time, otherwise we'd get timer wrap in
8194 - weird delay cases. */
8195 -@@ -393,8 +393,16 @@ __nf_conntrack_confirm(struct sk_buff *skb)
8196 - add_timer(&ct->timeout);
8197 - atomic_inc(&ct->ct_general.use);
8198 - set_bit(IPS_CONFIRMED_BIT, &ct->status);
8199 -+
8200 -+ /* Since the lookup is lockless, hash insertion must be done after
8201 -+ * starting the timer and setting the CONFIRMED bit. The RCU barriers
8202 -+ * guarantee that no other CPU can find the conntrack before the above
8203 -+ * stores are visible.
8204 -+ */
8205 -+ __nf_conntrack_hash_insert(ct, hash, repl_hash);
8206 - NF_CT_STAT_INC(net, insert);
8207 - spin_unlock_bh(&nf_conntrack_lock);
8208 -+
8209 - help = nfct_help(ct);
8210 - if (help && help->helper)
8211 - nf_conntrack_event_cache(IPCT_HELPER, ct);
8212 -@@ -467,7 +475,8 @@ static noinline int early_drop(struct net *net, unsigned int hash)
8213 - cnt++;
8214 - }
8215 -
8216 -- if (ct && unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
8217 -+ if (ct && unlikely(nf_ct_is_dying(ct) ||
8218 -+ !atomic_inc_not_zero(&ct->ct_general.use)))
8219 - ct = NULL;
8220 - if (ct || cnt >= NF_CT_EVICTION_RANGE)
8221 - break;
8222 -@@ -516,22 +525,37 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
8223 - }
8224 - }
8225 -
8226 -- ct = kmem_cache_zalloc(nf_conntrack_cachep, gfp);
8227 -+ /*
8228 -+ * Do not use kmem_cache_zalloc(), as this cache uses
8229 -+ * SLAB_DESTROY_BY_RCU.
8230 -+ */
8231 -+ ct = kmem_cache_alloc(nf_conntrack_cachep, gfp);
8232 - if (ct == NULL) {
8233 - pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
8234 - atomic_dec(&net->ct.count);
8235 - return ERR_PTR(-ENOMEM);
8236 - }
8237 --
8238 -- atomic_set(&ct->ct_general.use, 1);
8239 -+ /*
8240 -+ * Let ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.next
8241 -+ * and ct->tuplehash[IP_CT_DIR_REPLY].hnnode.next unchanged.
8242 -+ */
8243 -+ memset(&ct->tuplehash[IP_CT_DIR_MAX], 0,
8244 -+ sizeof(*ct) - offsetof(struct nf_conn, tuplehash[IP_CT_DIR_MAX]));
8245 - ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
8246 -+ ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.pprev = NULL;
8247 - ct->tuplehash[IP_CT_DIR_REPLY].tuple = *repl;
8248 -+ ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL;
8249 - /* Don't set timer yet: wait for confirmation */
8250 - setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct);
8251 - #ifdef CONFIG_NET_NS
8252 - ct->ct_net = net;
8253 - #endif
8254 -
8255 -+ /*
8256 -+ * changes to lookup keys must be done before setting refcnt to 1
8257 -+ */
8258 -+ smp_wmb();
8259 -+ atomic_set(&ct->ct_general.use, 1);
8260 - return ct;
8261 - }
8262 - EXPORT_SYMBOL_GPL(nf_conntrack_alloc);
8263 -diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
8264 -index 97a6e93..a38bc22 100644
8265 ---- a/net/netfilter/nf_conntrack_proto_tcp.c
8266 -+++ b/net/netfilter/nf_conntrack_proto_tcp.c
8267 -@@ -706,8 +706,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
8268 - /* Caller must linearize skb at tcp header. */
8269 - void nf_conntrack_tcp_update(const struct sk_buff *skb,
8270 - unsigned int dataoff,
8271 -- struct nf_conn *ct,
8272 -- int dir)
8273 -+ struct nf_conn *ct, int dir,
8274 -+ s16 offset)
8275 - {
8276 - const struct tcphdr *tcph = (const void *)skb->data + dataoff;
8277 - const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[dir];
8278 -@@ -720,7 +720,7 @@ void nf_conntrack_tcp_update(const struct sk_buff *skb,
8279 - /*
8280 - * We have to worry for the ack in the reply packet only...
8281 - */
8282 -- if (after(end, ct->proto.tcp.seen[dir].td_end))
8283 -+ if (ct->proto.tcp.seen[dir].td_end + offset == end)
8284 - ct->proto.tcp.seen[dir].td_end = end;
8285 - ct->proto.tcp.last_end = end;
8286 - write_unlock_bh(&tcp_lock);
8287 -diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
8288 -index beb3731..4e62030 100644
8289 ---- a/net/netfilter/nf_log.c
8290 -+++ b/net/netfilter/nf_log.c
8291 -@@ -47,7 +47,6 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
8292 - mutex_lock(&nf_log_mutex);
8293 -
8294 - if (pf == NFPROTO_UNSPEC) {
8295 -- int i;
8296 - for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++)
8297 - list_add_tail(&(logger->list[i]), &(nf_loggers_l[i]));
8298 - } else {
8299 -@@ -216,7 +215,7 @@ static const struct file_operations nflog_file_ops = {
8300 - #endif /* PROC_FS */
8301 -
8302 - #ifdef CONFIG_SYSCTL
8303 --struct ctl_path nf_log_sysctl_path[] = {
8304 -+static struct ctl_path nf_log_sysctl_path[] = {
8305 - { .procname = "net", .ctl_name = CTL_NET, },
8306 - { .procname = "netfilter", .ctl_name = NET_NETFILTER, },
8307 - { .procname = "nf_log", .ctl_name = CTL_UNNUMBERED, },
8308 -@@ -228,19 +227,26 @@ static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1];
8309 - static struct ctl_table_header *nf_log_dir_header;
8310 -
8311 - static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
8312 -- void *buffer, size_t *lenp, loff_t *ppos)
8313 -+ void __user *buffer, size_t *lenp, loff_t *ppos)
8314 - {
8315 - const struct nf_logger *logger;
8316 -+ char buf[NFLOGGER_NAME_LEN];
8317 -+ size_t size = *lenp;
8318 - int r = 0;
8319 - int tindex = (unsigned long)table->extra1;
8320 -
8321 - if (write) {
8322 -- if (!strcmp(buffer, "NONE")) {
8323 -+ if (size > sizeof(buf))
8324 -+ size = sizeof(buf);
8325 -+ if (copy_from_user(buf, buffer, size))
8326 -+ return -EFAULT;
8327 -+
8328 -+ if (!strcmp(buf, "NONE")) {
8329 - nf_log_unbind_pf(tindex);
8330 - return 0;
8331 - }
8332 - mutex_lock(&nf_log_mutex);
8333 -- logger = __find_logger(tindex, buffer);
8334 -+ logger = __find_logger(tindex, buf);
8335 - if (logger == NULL) {
8336 - mutex_unlock(&nf_log_mutex);
8337 - return -ENOENT;
8338 -@@ -248,14 +254,14 @@ static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
8339 - rcu_assign_pointer(nf_loggers[tindex], logger);
8340 - mutex_unlock(&nf_log_mutex);
8341 - } else {
8342 -- rcu_read_lock();
8343 -- logger = rcu_dereference(nf_loggers[tindex]);
8344 -+ mutex_lock(&nf_log_mutex);
8345 -+ logger = nf_loggers[tindex];
8346 - if (!logger)
8347 - table->data = "NONE";
8348 - else
8349 - table->data = logger->name;
8350 - r = proc_dostring(table, write, filp, buffer, lenp, ppos);
8351 -- rcu_read_unlock();
8352 -+ mutex_unlock(&nf_log_mutex);
8353 - }
8354 -
8355 - return r;
8356 -diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
8357 -index 01dd07b..98fc190 100644
8358 ---- a/net/netfilter/xt_quota.c
8359 -+++ b/net/netfilter/xt_quota.c
8360 -@@ -54,6 +54,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par)
8361 - if (q->master == NULL)
8362 - return -ENOMEM;
8363 -
8364 -+ q->master->quota = q->quota;
8365 - return true;
8366 - }
8367 -
8368 -diff --git a/net/netfilter/xt_rateest.c b/net/netfilter/xt_rateest.c
8369 -index 220a1d5..4fc6a91 100644
8370 ---- a/net/netfilter/xt_rateest.c
8371 -+++ b/net/netfilter/xt_rateest.c
8372 -@@ -66,7 +66,7 @@ xt_rateest_mt(const struct sk_buff *skb, const struct xt_match_param *par)
8373 - if (info->flags & XT_RATEEST_MATCH_BPS)
8374 - ret &= bps1 == bps2;
8375 - if (info->flags & XT_RATEEST_MATCH_PPS)
8376 -- ret &= pps2 == pps2;
8377 -+ ret &= pps1 == pps2;
8378 - break;
8379 - }
8380 -
8381 -diff --git a/net/wireless/scan.c b/net/wireless/scan.c
8382 -index 1f260c4..bc7f788 100644
8383 ---- a/net/wireless/scan.c
8384 -+++ b/net/wireless/scan.c
8385 -@@ -365,7 +365,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
8386 - found = rb_find_bss(dev, res);
8387 -
8388 - if (found) {
8389 -- kref_get(&found->ref);
8390 - found->pub.beacon_interval = res->pub.beacon_interval;
8391 - found->pub.tsf = res->pub.tsf;
8392 - found->pub.signal = res->pub.signal;
8393 -diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
8394 -index bfac30f..a31412b 100644
8395 ---- a/sound/pci/ca0106/ca0106_main.c
8396 -+++ b/sound/pci/ca0106/ca0106_main.c
8397 -@@ -325,9 +325,9 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = {
8398 - .rate_max = 192000,
8399 - .channels_min = 2,
8400 - .channels_max = 2,
8401 -- .buffer_bytes_max = ((65536 - 64) * 8),
8402 -+ .buffer_bytes_max = 65536 - 128,
8403 - .period_bytes_min = 64,
8404 -- .period_bytes_max = (65536 - 64),
8405 -+ .period_bytes_max = 32768 - 64,
8406 - .periods_min = 2,
8407 - .periods_max = 2,
8408 - .fifo_size = 0,
8409 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
8410 -index f09324a..18e8dad 100644
8411 ---- a/sound/pci/hda/patch_realtek.c
8412 -+++ b/sound/pci/hda/patch_realtek.c
8413 -@@ -10204,6 +10204,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8414 - alc262_lenovo_3000_automute(codec, 1);
8415 - }
8416 -
8417 -+static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
8418 -+ int dir, int idx, long *valp)
8419 -+{
8420 -+ int i, change = 0;
8421 -+
8422 -+ for (i = 0; i < 2; i++, valp++)
8423 -+ change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
8424 -+ HDA_AMP_MUTE,
8425 -+ *valp ? 0 : HDA_AMP_MUTE);
8426 -+ return change;
8427 -+}
8428 -+
8429 - /* bind hp and internal speaker mute (with plug check) */
8430 - static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8431 - struct snd_ctl_elem_value *ucontrol)
8432 -@@ -10212,13 +10224,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8433 - long *valp = ucontrol->value.integer.value;
8434 - int change;
8435 -
8436 -- change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8437 -- HDA_AMP_MUTE,
8438 -- valp ? 0 : HDA_AMP_MUTE);
8439 -- change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8440 -- HDA_AMP_MUTE,
8441 -- valp ? 0 : HDA_AMP_MUTE);
8442 --
8443 -+ change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
8444 -+ change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
8445 - if (change)
8446 - alc262_fujitsu_automute(codec, 0);
8447 - return change;
8448 -@@ -10253,10 +10260,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8449 - long *valp = ucontrol->value.integer.value;
8450 - int change;
8451 -
8452 -- change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8453 -- HDA_AMP_MUTE,
8454 -- valp ? 0 : HDA_AMP_MUTE);
8455 --
8456 -+ change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
8457 - if (change)
8458 - alc262_lenovo_3000_automute(codec, 0);
8459 - return change;
8460 -@@ -11377,12 +11381,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
8461 - long *valp = ucontrol->value.integer.value;
8462 - int change;
8463 -
8464 -- change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8465 -- HDA_AMP_MUTE,
8466 -- valp[0] ? 0 : HDA_AMP_MUTE);
8467 -- change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8468 -- HDA_AMP_MUTE,
8469 -- valp[1] ? 0 : HDA_AMP_MUTE);
8470 -+ change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
8471 - if (change)
8472 - alc268_acer_automute(codec, 0);
8473 - return change;
8474 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
8475 -index d2fd8ef..4e971b6 100644
8476 ---- a/sound/pci/hda/patch_sigmatel.c
8477 -+++ b/sound/pci/hda/patch_sigmatel.c
8478 -@@ -2325,6 +2325,7 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
8479 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
8480 - "Dell Vostro 1500", STAC_9205_DELL_M42),
8481 - /* Gateway */
8482 -+ SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
8483 - SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
8484 - {} /* terminator */
8485 - };
8486 -@@ -5661,6 +5662,8 @@ static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
8487 - };
8488 -
8489 - static struct snd_pci_quirk stac9872_cfg_tbl[] = {
8490 -+ SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
8491 -+ "Sony VAIO F/S", STAC_9872_VAIO),
8492 - {} /* terminator */
8493 - };
8494 -
8495 -@@ -5673,6 +5676,8 @@ static int patch_stac9872(struct hda_codec *codec)
8496 - if (spec == NULL)
8497 - return -ENOMEM;
8498 - codec->spec = spec;
8499 -+ spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
8500 -+ spec->pin_nids = stac9872_pin_nids;
8501 -
8502 - spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
8503 - stac9872_models,
8504 -@@ -5684,8 +5689,6 @@ static int patch_stac9872(struct hda_codec *codec)
8505 - stac92xx_set_config_regs(codec,
8506 - stac9872_brd_tbl[spec->board_config]);
8507 -
8508 -- spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
8509 -- spec->pin_nids = stac9872_pin_nids;
8510 - spec->multiout.dac_nids = spec->dac_nids;
8511 - spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
8512 - spec->adc_nids = stac9872_adc_nids;
8513 -diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
8514 -index bc5ce11..b369504 100644
8515 ---- a/sound/pci/oxygen/virtuoso.c
8516 -+++ b/sound/pci/oxygen/virtuoso.c
8517 -@@ -621,6 +621,8 @@ static void xonar_d2_resume(struct oxygen *chip)
8518 -
8519 - static void xonar_d1_resume(struct oxygen *chip)
8520 - {
8521 -+ oxygen_set_bits8(chip, OXYGEN_FUNCTION, OXYGEN_FUNCTION_RESET_CODEC);
8522 -+ msleep(1);
8523 - cs43xx_init(chip);
8524 - xonar_enable_output(chip);
8525 - }
8526 -diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
8527 -index a6e8f3f..40d4116 100644
8528 ---- a/sound/soc/codecs/wm8753.c
8529 -+++ b/sound/soc/codecs/wm8753.c
8530 -@@ -1664,7 +1664,7 @@ static int wm8753_register(struct wm8753_priv *wm8753)
8531 - codec->reg_cache = &wm8753->reg_cache;
8532 - codec->private_data = wm8753;
8533 -
8534 -- memcpy(codec->reg_cache, wm8753_reg, sizeof(codec->reg_cache));
8535 -+ memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache));
8536 - INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
8537 -
8538 - ret = wm8753_reset(codec);
8539 -diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
8540 -index a6b8848..6ea6868 100644
8541 ---- a/sound/usb/usbaudio.c
8542 -+++ b/sound/usb/usbaudio.c
8543 -@@ -2649,7 +2649,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
8544 - struct usb_interface_descriptor *altsd;
8545 - int i, altno, err, stream;
8546 - int format;
8547 -- struct audioformat *fp;
8548 -+ struct audioformat *fp = NULL;
8549 - unsigned char *fmt, *csep;
8550 - int num;
8551 -
8552 -@@ -2722,6 +2722,18 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
8553 - continue;
8554 - }
8555 -
8556 -+ /*
8557 -+ * Blue Microphones workaround: The last altsetting is identical
8558 -+ * with the previous one, except for a larger packet size, but
8559 -+ * is actually a mislabeled two-channel setting; ignore it.
8560 -+ */
8561 -+ if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 &&
8562 -+ fp && fp->altsetting == 1 && fp->channels == 1 &&
8563 -+ fp->format == SNDRV_PCM_FORMAT_S16_LE &&
8564 -+ le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) ==
8565 -+ fp->maxpacksize * 2)
8566 -+ continue;
8567 -+
8568 - csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT);
8569 - /* Creamware Noah has this descriptor after the 2nd endpoint */
8570 - if (!csep && altsd->bNumEndpoints >= 2)
8571
8572 Deleted: genpatches-2.6/trunk/2.6.31/1004_linux-2.6.30.5.patch
8573 ===================================================================
8574 --- genpatches-2.6/trunk/2.6.31/1004_linux-2.6.30.5.patch 2009-09-09 23:15:13 UTC (rev 1604)
8575 +++ genpatches-2.6/trunk/2.6.31/1004_linux-2.6.30.5.patch 2009-09-09 23:51:20 UTC (rev 1605)
8576 @@ -1,2676 +0,0 @@
8577 -diff --git a/arch/powerpc/boot/dts/asp834x-redboot.dts b/arch/powerpc/boot/dts/asp834x-redboot.dts
8578 -index 7da84fd..261d10c 100644
8579 ---- a/arch/powerpc/boot/dts/asp834x-redboot.dts
8580 -+++ b/arch/powerpc/boot/dts/asp834x-redboot.dts
8581 -@@ -167,7 +167,7 @@
8582 - interrupt-parent = <&ipic>;
8583 - interrupts = <39 0x8>;
8584 - phy_type = "ulpi";
8585 -- port1;
8586 -+ port0;
8587 - };
8588 - /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
8589 - usb@23000 {
8590 -diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
8591 -index 1ae38f0..e540d44 100644
8592 ---- a/arch/powerpc/boot/dts/mpc8349emitx.dts
8593 -+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
8594 -@@ -156,7 +156,7 @@
8595 - interrupt-parent = <&ipic>;
8596 - interrupts = <39 0x8>;
8597 - phy_type = "ulpi";
8598 -- port1;
8599 -+ port0;
8600 - };
8601 -
8602 - usb@23000 {
8603 -diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
8604 -index d9f0a23..a667fe7 100644
8605 ---- a/arch/powerpc/boot/dts/mpc834x_mds.dts
8606 -+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
8607 -@@ -153,7 +153,7 @@
8608 - interrupt-parent = <&ipic>;
8609 - interrupts = <39 0x8>;
8610 - phy_type = "ulpi";
8611 -- port1;
8612 -+ port0;
8613 - };
8614 - /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
8615 - usb@23000 {
8616 -diff --git a/arch/powerpc/boot/dts/sbc8349.dts b/arch/powerpc/boot/dts/sbc8349.dts
8617 -index a36dbbc..c7e1c4b 100644
8618 ---- a/arch/powerpc/boot/dts/sbc8349.dts
8619 -+++ b/arch/powerpc/boot/dts/sbc8349.dts
8620 -@@ -144,7 +144,7 @@
8621 - interrupt-parent = <&ipic>;
8622 - interrupts = <39 0x8>;
8623 - phy_type = "ulpi";
8624 -- port1;
8625 -+ port0;
8626 - };
8627 - /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
8628 - usb@23000 {
8629 -diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
8630 -index 83cfe51..d1dc5b0 100644
8631 ---- a/arch/powerpc/platforms/83xx/mpc83xx.h
8632 -+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
8633 -@@ -22,8 +22,8 @@
8634 - /* system i/o configuration register low */
8635 - #define MPC83XX_SICRL_OFFS 0x114
8636 - #define MPC834X_SICRL_USB_MASK 0x60000000
8637 --#define MPC834X_SICRL_USB0 0x40000000
8638 --#define MPC834X_SICRL_USB1 0x20000000
8639 -+#define MPC834X_SICRL_USB0 0x20000000
8640 -+#define MPC834X_SICRL_USB1 0x40000000
8641 - #define MPC831X_SICRL_USB_MASK 0x00000c00
8642 - #define MPC831X_SICRL_USB_ULPI 0x00000800
8643 - #define MPC8315_SICRL_USB_MASK 0x000000fc
8644 -diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
8645 -index 11e1fac..3ba4bb7 100644
8646 ---- a/arch/powerpc/platforms/83xx/usb.c
8647 -+++ b/arch/powerpc/platforms/83xx/usb.c
8648 -@@ -47,25 +47,25 @@ int mpc834x_usb_cfg(void)
8649 - sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
8650 -
8651 - prop = of_get_property(np, "phy_type", NULL);
8652 -+ port1_is_dr = 1;
8653 - if (prop && (!strcmp(prop, "utmi") ||
8654 - !strcmp(prop, "utmi_wide"))) {
8655 - sicrl |= MPC834X_SICRL_USB0 | MPC834X_SICRL_USB1;
8656 - sicrh |= MPC834X_SICRH_USB_UTMI;
8657 -- port1_is_dr = 1;
8658 -+ port0_is_dr = 1;
8659 - } else if (prop && !strcmp(prop, "serial")) {
8660 - dr_mode = of_get_property(np, "dr_mode", NULL);
8661 - if (dr_mode && !strcmp(dr_mode, "otg")) {
8662 - sicrl |= MPC834X_SICRL_USB0 | MPC834X_SICRL_USB1;
8663 -- port1_is_dr = 1;
8664 -+ port0_is_dr = 1;
8665 - } else {
8666 -- sicrl |= MPC834X_SICRL_USB0;
8667 -+ sicrl |= MPC834X_SICRL_USB1;
8668 - }
8669 - } else if (prop && !strcmp(prop, "ulpi")) {
8670 -- sicrl |= MPC834X_SICRL_USB0;
8671 -+ sicrl |= MPC834X_SICRL_USB1;
8672 - } else {
8673 - printk(KERN_WARNING "834x USB PHY type not supported\n");
8674 - }
8675 -- port0_is_dr = 1;
8676 - of_node_put(np);
8677 - }
8678 - np = of_find_compatible_node(NULL, NULL, "fsl-usb2-mph");
8679 -diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
8680 -index 2bdab21..c6ccbe7 100644
8681 ---- a/arch/x86/include/asm/irqflags.h
8682 -+++ b/arch/x86/include/asm/irqflags.h
8683 -@@ -12,9 +12,15 @@ static inline unsigned long native_save_fl(void)
8684 - {
8685 - unsigned long flags;
8686 -
8687 -+ /*
8688 -+ * Note: this needs to be "=r" not "=rm", because we have the
8689 -+ * stack offset from what gcc expects at the time the "pop" is
8690 -+ * executed, and so a memory reference with respect to the stack
8691 -+ * would end up using the wrong address.
8692 -+ */
8693 - asm volatile("# __raw_save_flags\n\t"
8694 - "pushf ; pop %0"
8695 -- : "=g" (flags)
8696 -+ : "=r" (flags)
8697 - : /* no input */
8698 - : "memory");
8699 -
8700 -diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
8701 -index 95deb9f..c6a61d2 100644
8702 ---- a/arch/x86/kernel/vmi_32.c
8703 -+++ b/arch/x86/kernel/vmi_32.c
8704 -@@ -441,7 +441,7 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
8705 - ap.ds = __USER_DS;
8706 - ap.es = __USER_DS;
8707 - ap.fs = __KERNEL_PERCPU;
8708 -- ap.gs = 0;
8709 -+ ap.gs = __KERNEL_STACK_CANARY;
8710 -
8711 - ap.eflags = 0;
8712 -
8713 -diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
8714 -index e17efed..133bdba 100644
8715 ---- a/arch/x86/mm/pageattr.c
8716 -+++ b/arch/x86/mm/pageattr.c
8717 -@@ -590,9 +590,12 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
8718 - unsigned int level;
8719 - pte_t *kpte, old_pte;
8720 -
8721 -- if (cpa->flags & CPA_PAGES_ARRAY)
8722 -- address = (unsigned long)page_address(cpa->pages[cpa->curpage]);
8723 -- else if (cpa->flags & CPA_ARRAY)
8724 -+ if (cpa->flags & CPA_PAGES_ARRAY) {
8725 -+ struct page *page = cpa->pages[cpa->curpage];
8726 -+ if (unlikely(PageHighMem(page)))
8727 -+ return 0;
8728 -+ address = (unsigned long)page_address(page);
8729 -+ } else if (cpa->flags & CPA_ARRAY)
8730 - address = cpa->vaddr[cpa->curpage];
8731 - else
8732 - address = *cpa->vaddr;
8733 -@@ -695,9 +698,12 @@ static int cpa_process_alias(struct cpa_data *cpa)
8734 - * No need to redo, when the primary call touched the direct
8735 - * mapping already:
8736 - */
8737 -- if (cpa->flags & CPA_PAGES_ARRAY)
8738 -- vaddr = (unsigned long)page_address(cpa->pages[cpa->curpage]);
8739 -- else if (cpa->flags & CPA_ARRAY)
8740 -+ if (cpa->flags & CPA_PAGES_ARRAY) {
8741 -+ struct page *page = cpa->pages[cpa->curpage];
8742 -+ if (unlikely(PageHighMem(page)))
8743 -+ return 0;
8744 -+ vaddr = (unsigned long)page_address(page);
8745 -+ } else if (cpa->flags & CPA_ARRAY)
8746 - vaddr = cpa->vaddr[cpa->curpage];
8747 - else
8748 - vaddr = *cpa->vaddr;
8749 -@@ -996,12 +1002,15 @@ EXPORT_SYMBOL(set_memory_array_uc);
8750 - int _set_memory_wc(unsigned long addr, int numpages)
8751 - {
8752 - int ret;
8753 -+ unsigned long addr_copy = addr;
8754 -+
8755 - ret = change_page_attr_set(&addr, numpages,
8756 - __pgprot(_PAGE_CACHE_UC_MINUS), 0);
8757 --
8758 - if (!ret) {
8759 -- ret = change_page_attr_set(&addr, numpages,
8760 -- __pgprot(_PAGE_CACHE_WC), 0);
8761 -+ ret = change_page_attr_set_clr(&addr_copy, numpages,
8762 -+ __pgprot(_PAGE_CACHE_WC),
8763 -+ __pgprot(_PAGE_CACHE_MASK),
8764 -+ 0, 0, NULL);
8765 - }
8766 - return ret;
8767 - }
8768 -@@ -1118,7 +1127,9 @@ int set_pages_array_uc(struct page **pages, int addrinarray)
8769 - int free_idx;
8770 -
8771 - for (i = 0; i < addrinarray; i++) {
8772 -- start = (unsigned long)page_address(pages[i]);
8773 -+ if (PageHighMem(pages[i]))
8774 -+ continue;
8775 -+ start = page_to_pfn(pages[i]) << PAGE_SHIFT;
8776 - end = start + PAGE_SIZE;
8777 - if (reserve_memtype(start, end, _PAGE_CACHE_UC_MINUS, NULL))
8778 - goto err_out;
8779 -@@ -1131,7 +1142,9 @@ int set_pages_array_uc(struct page **pages, int addrinarray)
8780 - err_out:
8781 - free_idx = i;
8782 - for (i = 0; i < free_idx; i++) {
8783 -- start = (unsigned long)page_address(pages[i]);
8784 -+ if (PageHighMem(pages[i]))
8785 -+ continue;
8786 -+ start = page_to_pfn(pages[i]) << PAGE_SHIFT;
8787 - end = start + PAGE_SIZE;
8788 - free_memtype(start, end);
8789 - }
8790 -@@ -1160,7 +1173,9 @@ int set_pages_array_wb(struct page **pages, int addrinarray)
8791 - return retval;
8792 -
8793 - for (i = 0; i < addrinarray; i++) {
8794 -- start = (unsigned long)page_address(pages[i]);
8795 -+ if (PageHighMem(pages[i]))
8796 -+ continue;
8797 -+ start = page_to_pfn(pages[i]) << PAGE_SHIFT;
8798 - end = start + PAGE_SIZE;
8799 - free_memtype(start, end);
8800 - }
8801 -diff --git a/block/Kconfig b/block/Kconfig
8802 -index e7d1278..f817911 100644
8803 ---- a/block/Kconfig
8804 -+++ b/block/Kconfig
8805 -@@ -45,9 +45,9 @@ config LBD
8806 - If unsure, say N.
8807 -
8808 - config BLK_DEV_BSG
8809 -- bool "Block layer SG support v4 (EXPERIMENTAL)"
8810 -- depends on EXPERIMENTAL
8811 -- ---help---
8812 -+ bool "Block layer SG support v4"
8813 -+ default y
8814 -+ help
8815 - Saying Y here will enable generic SG (SCSI generic) v4 support
8816 - for any block device.
8817 -
8818 -@@ -57,7 +57,10 @@ config BLK_DEV_BSG
8819 - protocols (e.g. Task Management Functions and SMP in Serial
8820 - Attached SCSI).
8821 -
8822 -- If unsure, say N.
8823 -+ This option is required by recent UDEV versions to properly
8824 -+ access device serial numbers, etc.
8825 -+
8826 -+ If unsure, say Y.
8827 -
8828 - config BLK_DEV_INTEGRITY
8829 - bool "Block layer data integrity support"
8830 -diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
8831 -index 01574a0..42159a2 100644
8832 ---- a/drivers/acpi/sleep.c
8833 -+++ b/drivers/acpi/sleep.c
8834 -@@ -397,6 +397,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
8835 - },
8836 - },
8837 - {
8838 -+ .callback = init_set_sci_en_on_resume,
8839 -+ .ident = "Hewlett-Packard HP G7000 Notebook PC",
8840 -+ .matches = {
8841 -+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
8842 -+ DMI_MATCH(DMI_PRODUCT_NAME, "HP G7000 Notebook PC"),
8843 -+ },
8844 -+ },
8845 -+ {
8846 - .callback = init_old_suspend_ordering,
8847 - .ident = "Panasonic CF51-2L",
8848 - .matches = {
8849 -diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
8850 -index 2406c2c..d4ec605 100644
8851 ---- a/drivers/edac/x38_edac.c
8852 -+++ b/drivers/edac/x38_edac.c
8853 -@@ -30,7 +30,7 @@
8854 - /* Intel X38 register addresses - device 0 function 0 - DRAM Controller */
8855 -
8856 - #define X38_MCHBAR_LOW 0x48 /* MCH Memory Mapped Register BAR */
8857 --#define X38_MCHBAR_HIGH 0x4b
8858 -+#define X38_MCHBAR_HIGH 0x4c
8859 - #define X38_MCHBAR_MASK 0xfffffc000ULL /* bits 35:14 */
8860 - #define X38_MMR_WINDOW_SIZE 16384
8861 -
8862 -diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
8863 -index 2bcf515..9b0a094 100644
8864 ---- a/drivers/firewire/fw-sbp2.c
8865 -+++ b/drivers/firewire/fw-sbp2.c
8866 -@@ -190,6 +190,12 @@ struct sbp2_target {
8867 - #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */
8868 -
8869 - /*
8870 -+ * There is no transport protocol limit to the CDB length, but we implement
8871 -+ * a fixed length only. 16 bytes is enough for disks larger than 2 TB.
8872 -+ */
8873 -+#define SBP2_MAX_CDB_SIZE 16
8874 -+
8875 -+/*
8876 - * The default maximum s/g segment size of a FireWire controller is
8877 - * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to
8878 - * be quadlet-aligned, we set the length limit to 0xffff & ~3.
8879 -@@ -301,7 +307,7 @@ struct sbp2_command_orb {
8880 - struct sbp2_pointer next;
8881 - struct sbp2_pointer data_descriptor;
8882 - __be32 misc;
8883 -- u8 command_block[12];
8884 -+ u8 command_block[SBP2_MAX_CDB_SIZE];
8885 - } request;
8886 - struct scsi_cmnd *cmd;
8887 - scsi_done_fn_t done;
8888 -@@ -1135,6 +1141,8 @@ static int sbp2_probe(struct device *dev)
8889 - if (fw_device_enable_phys_dma(device) < 0)
8890 - goto fail_shost_put;
8891 -
8892 -+ shost->max_cmd_len = SBP2_MAX_CDB_SIZE;
8893 -+
8894 - if (scsi_add_host(shost, &unit->device) < 0)
8895 - goto fail_shost_put;
8896 -
8897 -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
8898 -index 0ccb63e..bb58797 100644
8899 ---- a/drivers/gpu/drm/i915/i915_dma.c
8900 -+++ b/drivers/gpu/drm/i915/i915_dma.c
8901 -@@ -1153,8 +1153,11 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
8902 - #endif
8903 -
8904 - dev->driver->get_vblank_counter = i915_get_vblank_counter;
8905 -- if (IS_GM45(dev))
8906 -+ dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
8907 -+ if (IS_G4X(dev)) {
8908 -+ dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
8909 - dev->driver->get_vblank_counter = gm45_get_vblank_counter;
8910 -+ }
8911 -
8912 - i915_gem_load(dev);
8913 -
8914 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
8915 -index c431fa5..fcaa544 100644
8916 ---- a/drivers/gpu/drm/i915/i915_drv.h
8917 -+++ b/drivers/gpu/drm/i915/i915_drv.h
8918 -@@ -285,6 +285,13 @@ typedef struct drm_i915_private {
8919 - u8 saveDACMASK;
8920 - u8 saveCR[37];
8921 - uint64_t saveFENCE[16];
8922 -+ u32 saveCURACNTR;
8923 -+ u32 saveCURAPOS;
8924 -+ u32 saveCURABASE;
8925 -+ u32 saveCURBCNTR;
8926 -+ u32 saveCURBPOS;
8927 -+ u32 saveCURBBASE;
8928 -+ u32 saveCURSIZE;
8929 -
8930 - struct {
8931 - struct drm_mm gtt_space;
8932 -@@ -642,6 +649,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
8933 - void i915_gem_free_all_phys_object(struct drm_device *dev);
8934 - int i915_gem_object_get_pages(struct drm_gem_object *obj);
8935 - void i915_gem_object_put_pages(struct drm_gem_object *obj);
8936 -+void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
8937 -
8938 - /* i915_gem_tiling.c */
8939 - void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
8940 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
8941 -index 39f5c65..91ad93d 100644
8942 ---- a/drivers/gpu/drm/i915/i915_gem.c
8943 -+++ b/drivers/gpu/drm/i915/i915_gem.c
8944 -@@ -4154,6 +4154,7 @@ i915_gem_lastclose(struct drm_device *dev)
8945 - void
8946 - i915_gem_load(struct drm_device *dev)
8947 - {
8948 -+ int i;
8949 - drm_i915_private_t *dev_priv = dev->dev_private;
8950 -
8951 - spin_lock_init(&dev_priv->mm.active_list_lock);
8952 -@@ -4173,6 +4174,18 @@ i915_gem_load(struct drm_device *dev)
8953 - else
8954 - dev_priv->num_fence_regs = 8;
8955 -
8956 -+ /* Initialize fence registers to zero */
8957 -+ if (IS_I965G(dev)) {
8958 -+ for (i = 0; i < 16; i++)
8959 -+ I915_WRITE64(FENCE_REG_965_0 + (i * 8), 0);
8960 -+ } else {
8961 -+ for (i = 0; i < 8; i++)
8962 -+ I915_WRITE(FENCE_REG_830_0 + (i * 4), 0);
8963 -+ if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
8964 -+ for (i = 0; i < 8; i++)
8965 -+ I915_WRITE(FENCE_REG_945_8 + (i * 4), 0);
8966 -+ }
8967 -+
8968 - i915_gem_detect_bit_6_swizzle(dev);
8969 - }
8970 -
8971 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
8972 -index 98bb4c8..8ee0969 100644
8973 ---- a/drivers/gpu/drm/i915/i915_irq.c
8974 -+++ b/drivers/gpu/drm/i915/i915_irq.c
8975 -@@ -572,8 +572,6 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
8976 -
8977 - dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
8978 -
8979 -- dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
8980 --
8981 - /* Unmask the interrupts that we always want on. */
8982 - dev_priv->irq_mask_reg = ~I915_INTERRUPT_ENABLE_FIX;
8983 -
8984 -diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
8985 -index ce8a213..a98e283 100644
8986 ---- a/drivers/gpu/drm/i915/i915_suspend.c
8987 -+++ b/drivers/gpu/drm/i915/i915_suspend.c
8988 -@@ -295,6 +295,16 @@ int i915_save_state(struct drm_device *dev)
8989 - i915_save_palette(dev, PIPE_B);
8990 - dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT);
8991 -
8992 -+ /* Cursor state */
8993 -+ dev_priv->saveCURACNTR = I915_READ(CURACNTR);
8994 -+ dev_priv->saveCURAPOS = I915_READ(CURAPOS);
8995 -+ dev_priv->saveCURABASE = I915_READ(CURABASE);
8996 -+ dev_priv->saveCURBCNTR = I915_READ(CURBCNTR);
8997 -+ dev_priv->saveCURBPOS = I915_READ(CURBPOS);
8998 -+ dev_priv->saveCURBBASE = I915_READ(CURBBASE);
8999 -+ if (!IS_I9XX(dev))
9000 -+ dev_priv->saveCURSIZE = I915_READ(CURSIZE);
9001 -+
9002 - /* CRT state */
9003 - dev_priv->saveADPA = I915_READ(ADPA);
9004 -
9005 -@@ -480,6 +490,16 @@ int i915_restore_state(struct drm_device *dev)
9006 - I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR);
9007 - I915_WRITE(DSPBADDR, I915_READ(DSPBADDR));
9008 -
9009 -+ /* Cursor state */
9010 -+ I915_WRITE(CURAPOS, dev_priv->saveCURAPOS);
9011 -+ I915_WRITE(CURACNTR, dev_priv->saveCURACNTR);
9012 -+ I915_WRITE(CURABASE, dev_priv->saveCURABASE);
9013 -+ I915_WRITE(CURBPOS, dev_priv->saveCURBPOS);
9014 -+ I915_WRITE(CURBCNTR, dev_priv->saveCURBCNTR);
9015 -+ I915_WRITE(CURBBASE, dev_priv->saveCURBBASE);
9016 -+ if (!IS_I9XX(dev))
9017 -+ I915_WRITE(CURSIZE, dev_priv->saveCURSIZE);
9018 -+
9019 - /* CRT state */
9020 - I915_WRITE(ADPA, dev_priv->saveADPA);
9021 -
9022 -diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
9023 -index 9d78cff..cf2a971 100644
9024 ---- a/drivers/gpu/drm/i915/intel_bios.c
9025 -+++ b/drivers/gpu/drm/i915/intel_bios.c
9026 -@@ -185,10 +185,12 @@ parse_general_features(struct drm_i915_private *dev_priv,
9027 - dev_priv->lvds_use_ssc = general->enable_ssc;
9028 -
9029 - if (dev_priv->lvds_use_ssc) {
9030 -- if (IS_I855(dev_priv->dev))
9031 -- dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48;
9032 -- else
9033 -- dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96;
9034 -+ if (IS_I85X(dev_priv->dev))
9035 -+ dev_priv->lvds_ssc_freq =
9036 -+ general->ssc_freq ? 66 : 48;
9037 -+ else
9038 -+ dev_priv->lvds_ssc_freq =
9039 -+ general->ssc_freq ? 100 : 96;
9040 - }
9041 - }
9042 - }
9043 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
9044 -index c9d6f10..5469f2c 100644
9045 ---- a/drivers/gpu/drm/i915/intel_display.c
9046 -+++ b/drivers/gpu/drm/i915/intel_display.c
9047 -@@ -1590,6 +1590,7 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
9048 - }
9049 -
9050 - encoder->crtc = crtc;
9051 -+ intel_output->base.encoder = encoder;
9052 - intel_output->load_detect_temp = true;
9053 -
9054 - intel_crtc = to_intel_crtc(crtc);
9055 -@@ -1625,6 +1626,7 @@ void intel_release_load_detect_pipe(struct intel_output *intel_output, int dpms_
9056 -
9057 - if (intel_output->load_detect_temp) {
9058 - encoder->crtc = NULL;
9059 -+ intel_output->base.encoder = NULL;
9060 - intel_output->load_detect_temp = false;
9061 - crtc->enabled = drm_helper_crtc_in_use(crtc);
9062 - drm_helper_disable_unused_functions(dev);
9063 -diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
9064 -index e4652dc..7a66b91 100644
9065 ---- a/drivers/gpu/drm/i915/intel_fb.c
9066 -+++ b/drivers/gpu/drm/i915/intel_fb.c
9067 -@@ -857,9 +857,15 @@ void intelfb_restore(void)
9068 - drm_crtc_helper_set_config(&kernelfb_mode);
9069 - }
9070 -
9071 -+static void intelfb_restore_work_fn(struct work_struct *ignored)
9072 -+{
9073 -+ intelfb_restore();
9074 -+}
9075 -+static DECLARE_WORK(intelfb_restore_work, intelfb_restore_work_fn);
9076 -+
9077 - static void intelfb_sysrq(int dummy1, struct tty_struct *dummy3)
9078 - {
9079 -- intelfb_restore();
9080 -+ schedule_work(&intelfb_restore_work);
9081 - }
9082 -
9083 - static struct sysrq_key_op sysrq_intelfb_restore_op = {
9084 -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
9085 -index 53cccfa..1e06379 100644
9086 ---- a/drivers/gpu/drm/i915/intel_lvds.c
9087 -+++ b/drivers/gpu/drm/i915/intel_lvds.c
9088 -@@ -420,8 +420,21 @@ static const struct dmi_system_id intel_no_lvds[] = {
9089 - DMI_MATCH(DMI_PRODUCT_NAME, "Studio Hybrid 140g"),
9090 - },
9091 - },
9092 --
9093 -- /* FIXME: add a check for the Aopen Mini PC */
9094 -+ {
9095 -+ .callback = intel_no_lvds_dmi_callback,
9096 -+ .ident = "AOpen Mini PC",
9097 -+ .matches = {
9098 -+ DMI_MATCH(DMI_SYS_VENDOR, "AOpen"),
9099 -+ DMI_MATCH(DMI_PRODUCT_NAME, "i965GMx-IF"),
9100 -+ },
9101 -+ },
9102 -+ {
9103 -+ .callback = intel_no_lvds_dmi_callback,
9104 -+ .ident = "Aopen i945GTt-VFA",
9105 -+ .matches = {
9106 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
9107 -+ },
9108 -+ },
9109 -
9110 - { } /* terminating entry */
9111 - };
9112 -diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
9113 -index bff0103..fe4fa29 100644
9114 ---- a/drivers/hwmon/asus_atk0110.c
9115 -+++ b/drivers/hwmon/asus_atk0110.c
9116 -@@ -593,7 +593,11 @@ static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
9117 - sensor->data = data;
9118 - sensor->id = flags->integer.value;
9119 - sensor->limit1 = limit1->integer.value;
9120 -- sensor->limit2 = limit2->integer.value;
9121 -+ if (data->old_interface)
9122 -+ sensor->limit2 = limit2->integer.value;
9123 -+ else
9124 -+ /* The upper limit is expressed as delta from lower limit */
9125 -+ sensor->limit2 = sensor->limit1 + limit2->integer.value;
9126 -
9127 - snprintf(sensor->input_attr_name, ATTR_NAME_SIZE,
9128 - "%s%d_input", base_name, start + *num);
9129 -diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
9130 -index a92dbb9..ba75bfc 100644
9131 ---- a/drivers/hwmon/smsc47m1.c
9132 -+++ b/drivers/hwmon/smsc47m1.c
9133 -@@ -86,6 +86,7 @@ superio_exit(void)
9134 - #define SUPERIO_REG_ACT 0x30
9135 - #define SUPERIO_REG_BASE 0x60
9136 - #define SUPERIO_REG_DEVID 0x20
9137 -+#define SUPERIO_REG_DEVREV 0x21
9138 -
9139 - /* Logical device registers */
9140 -
9141 -@@ -429,6 +430,9 @@ static int __init smsc47m1_find(unsigned short *addr,
9142 - * The LPC47M292 (device id 0x6B) is somewhat compatible, but it
9143 - * supports a 3rd fan, and the pin configuration registers are
9144 - * unfortunately different.
9145 -+ * The LPC47M233 has the same device id (0x6B) but is not compatible.
9146 -+ * We check the high bit of the device revision register to
9147 -+ * differentiate them.
9148 - */
9149 - switch (val) {
9150 - case 0x51:
9151 -@@ -448,6 +452,13 @@ static int __init smsc47m1_find(unsigned short *addr,
9152 - sio_data->type = smsc47m1;
9153 - break;
9154 - case 0x6B:
9155 -+ if (superio_inb(SUPERIO_REG_DEVREV) & 0x80) {
9156 -+ pr_debug(DRVNAME ": "
9157 -+ "Found SMSC LPC47M233, unsupported\n");
9158 -+ superio_exit();
9159 -+ return -ENODEV;
9160 -+ }
9161 -+
9162 - pr_info(DRVNAME ": Found SMSC LPC47M292\n");
9163 - sio_data->type = smsc47m2;
9164 - break;
9165 -diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
9166 -index 1a9cc13..b96f302 100644
9167 ---- a/drivers/i2c/chips/tsl2550.c
9168 -+++ b/drivers/i2c/chips/tsl2550.c
9169 -@@ -27,7 +27,7 @@
9170 - #include <linux/delay.h>
9171 -
9172 - #define TSL2550_DRV_NAME "tsl2550"
9173 --#define DRIVER_VERSION "1.1.1"
9174 -+#define DRIVER_VERSION "1.1.2"
9175 -
9176 - /*
9177 - * Defines
9178 -@@ -189,13 +189,16 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
9179 - u8 r = 128;
9180 -
9181 - /* Avoid division by 0 and count 1 cannot be greater than count 0 */
9182 -- if (c0 && (c1 <= c0))
9183 -- r = c1 * 128 / c0;
9184 -+ if (c1 <= c0)
9185 -+ if (c0) {
9186 -+ r = c1 * 128 / c0;
9187 -+
9188 -+ /* Calculate LUX */
9189 -+ lux = ((c0 - c1) * ratio_lut[r]) / 256;
9190 -+ } else
9191 -+ lux = 0;
9192 - else
9193 -- return -1;
9194 --
9195 -- /* Calculate LUX */
9196 -- lux = ((c0 - c1) * ratio_lut[r]) / 256;
9197 -+ return -EAGAIN;
9198 -
9199 - /* LUX range check */
9200 - return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;
9201 -diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
9202 -index a9fbe2c..08f0fe0 100644
9203 ---- a/drivers/ide/ide-disk.c
9204 -+++ b/drivers/ide/ide-disk.c
9205 -@@ -413,6 +413,7 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
9206 - rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
9207 - rq->cmd_flags |= REQ_SOFTBARRIER;
9208 - rq->special = cmd;
9209 -+ cmd->rq = rq;
9210 - }
9211 -
9212 - ide_devset_get(multcount, mult_count);
9213 -diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
9214 -index a0b8cab..3194e1d 100644
9215 ---- a/drivers/ide/ide-dma.c
9216 -+++ b/drivers/ide/ide-dma.c
9217 -@@ -362,9 +362,6 @@ static int ide_tune_dma(ide_drive_t *drive)
9218 - if (__ide_dma_bad_drive(drive))
9219 - return 0;
9220 -
9221 -- if (ide_id_dma_bug(drive))
9222 -- return 0;
9223 --
9224 - if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
9225 - return config_drive_for_dma(drive);
9226 -
9227 -@@ -395,24 +392,6 @@ static int ide_dma_check(ide_drive_t *drive)
9228 - return -1;
9229 - }
9230 -
9231 --int ide_id_dma_bug(ide_drive_t *drive)
9232 --{
9233 -- u16 *id = drive->id;
9234 --
9235 -- if (id[ATA_ID_FIELD_VALID] & 4) {
9236 -- if ((id[ATA_ID_UDMA_MODES] >> 8) &&
9237 -- (id[ATA_ID_MWDMA_MODES] >> 8))
9238 -- goto err_out;
9239 -- } else if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
9240 -- (id[ATA_ID_SWDMA_MODES] >> 8))
9241 -- goto err_out;
9242 --
9243 -- return 0;
9244 --err_out:
9245 -- printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
9246 -- return 1;
9247 --}
9248 --
9249 - int ide_set_dma(ide_drive_t *drive)
9250 - {
9251 - int rc;
9252 -diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
9253 -index 06fe002..dd5c557 100644
9254 ---- a/drivers/ide/ide-iops.c
9255 -+++ b/drivers/ide/ide-iops.c
9256 -@@ -306,9 +306,6 @@ int ide_driveid_update(ide_drive_t *drive)
9257 -
9258 - kfree(id);
9259 -
9260 -- if ((drive->dev_flags & IDE_DFLAG_USING_DMA) && ide_id_dma_bug(drive))
9261 -- ide_dma_off(drive);
9262 --
9263 - return 1;
9264 - out_err:
9265 - SELECT_MASK(drive, 0);
9266 -diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
9267 -index c895ed5..34846cc 100644
9268 ---- a/drivers/ide/ide-probe.c
9269 -+++ b/drivers/ide/ide-probe.c
9270 -@@ -830,6 +830,24 @@ static int ide_port_setup_devices(ide_hwif_t *hwif)
9271 - return j;
9272 - }
9273 -
9274 -+static void ide_host_enable_irqs(struct ide_host *host)
9275 -+{
9276 -+ ide_hwif_t *hwif;
9277 -+ int i;
9278 -+
9279 -+ ide_host_for_each_port(i, hwif, host) {
9280 -+ if (hwif == NULL)
9281 -+ continue;
9282 -+
9283 -+ /* clear any pending IRQs */
9284 -+ hwif->tp_ops->read_status(hwif);
9285 -+
9286 -+ /* unmask IRQs */
9287 -+ if (hwif->io_ports.ctl_addr)
9288 -+ hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
9289 -+ }
9290 -+}
9291 -+
9292 - /*
9293 - * This routine sets up the IRQ for an IDE interface.
9294 - */
9295 -@@ -843,9 +861,6 @@ static int init_irq (ide_hwif_t *hwif)
9296 - if (irq_handler == NULL)
9297 - irq_handler = ide_intr;
9298 -
9299 -- if (io_ports->ctl_addr)
9300 -- hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
9301 --
9302 - if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
9303 - goto out_up;
9304 -
9305 -@@ -1389,6 +1404,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
9306 - ide_port_tune_devices(hwif);
9307 - }
9308 -
9309 -+ ide_host_enable_irqs(host);
9310 -+
9311 - ide_host_for_each_port(i, hwif, host) {
9312 - if (hwif == NULL)
9313 - continue;
9314 -diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
9315 -index a51ab23..f599f49 100644
9316 ---- a/drivers/ieee1394/sbp2.c
9317 -+++ b/drivers/ieee1394/sbp2.c
9318 -@@ -880,6 +880,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
9319 - }
9320 -
9321 - shost->hostdata[0] = (unsigned long)lu;
9322 -+ shost->max_cmd_len = SBP2_MAX_CDB_SIZE;
9323 -
9324 - if (!scsi_add_host(shost, &ud->device)) {
9325 - lu->shost = shost;
9326 -diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
9327 -index c5036f1..64a3a66 100644
9328 ---- a/drivers/ieee1394/sbp2.h
9329 -+++ b/drivers/ieee1394/sbp2.h
9330 -@@ -25,6 +25,12 @@
9331 - #define SBP2_DEVICE_NAME "sbp2"
9332 -
9333 - /*
9334 -+ * There is no transport protocol limit to the CDB length, but we implement
9335 -+ * a fixed length only. 16 bytes is enough for disks larger than 2 TB.
9336 -+ */
9337 -+#define SBP2_MAX_CDB_SIZE 16
9338 -+
9339 -+/*
9340 - * SBP-2 specific definitions
9341 - */
9342 -
9343 -@@ -51,7 +57,7 @@ struct sbp2_command_orb {
9344 - u32 data_descriptor_hi;
9345 - u32 data_descriptor_lo;
9346 - u32 misc;
9347 -- u8 cdb[12];
9348 -+ u8 cdb[SBP2_MAX_CDB_SIZE];
9349 - } __attribute__((packed));
9350 -
9351 - #define SBP2_LOGIN_REQUEST 0x0
9352 -diff --git a/drivers/md/md.c b/drivers/md/md.c
9353 -index eb1b73f..751a315 100644
9354 ---- a/drivers/md/md.c
9355 -+++ b/drivers/md/md.c
9356 -@@ -1410,8 +1410,14 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
9357 - if (rdev2->desc_nr+1 > max_dev)
9358 - max_dev = rdev2->desc_nr+1;
9359 -
9360 -- if (max_dev > le32_to_cpu(sb->max_dev))
9361 -+ if (max_dev > le32_to_cpu(sb->max_dev)) {
9362 -+ int bmask;
9363 - sb->max_dev = cpu_to_le32(max_dev);
9364 -+ rdev->sb_size = max_dev * 2 + 256;
9365 -+ bmask = queue_hardsect_size(rdev->bdev->bd_disk->queue)-1;
9366 -+ if (rdev->sb_size & bmask)
9367 -+ rdev->sb_size = (rdev->sb_size | bmask) + 1;
9368 -+ }
9369 - for (i=0; i<max_dev;i++)
9370 - sb->dev_roles[i] = cpu_to_le16(0xfffe);
9371 -
9372 -@@ -2680,6 +2686,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
9373 - ssize_t rv = len;
9374 - struct mdk_personality *pers;
9375 - void *priv;
9376 -+ mdk_rdev_t *rdev;
9377 -
9378 - if (mddev->pers == NULL) {
9379 - if (len == 0)
9380 -@@ -2759,6 +2766,12 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
9381 - mddev_suspend(mddev);
9382 - mddev->pers->stop(mddev);
9383 - module_put(mddev->pers->owner);
9384 -+ /* Invalidate devices that are now superfluous */
9385 -+ list_for_each_entry(rdev, &mddev->disks, same_set)
9386 -+ if (rdev->raid_disk >= mddev->raid_disks) {
9387 -+ rdev->raid_disk = -1;
9388 -+ clear_bit(In_sync, &rdev->flags);
9389 -+ }
9390 - mddev->pers = pers;
9391 - mddev->private = priv;
9392 - strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel));
9393 -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
9394 -index 1f98ea4..75e0ecc 100644
9395 ---- a/drivers/md/raid5.c
9396 -+++ b/drivers/md/raid5.c
9397 -@@ -4310,6 +4310,15 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
9398 - return sectors * (raid_disks - conf->max_degraded);
9399 - }
9400 -
9401 -+static void free_conf(raid5_conf_t *conf)
9402 -+{
9403 -+ shrink_stripes(conf);
9404 -+ safe_put_page(conf->spare_page);
9405 -+ kfree(conf->disks);
9406 -+ kfree(conf->stripe_hashtbl);
9407 -+ kfree(conf);
9408 -+}
9409 -+
9410 - static raid5_conf_t *setup_conf(mddev_t *mddev)
9411 - {
9412 - raid5_conf_t *conf;
9413 -@@ -4439,11 +4448,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
9414 -
9415 - abort:
9416 - if (conf) {
9417 -- shrink_stripes(conf);
9418 -- safe_put_page(conf->spare_page);
9419 -- kfree(conf->disks);
9420 -- kfree(conf->stripe_hashtbl);
9421 -- kfree(conf);
9422 -+ free_conf(conf);
9423 - return ERR_PTR(-EIO);
9424 - } else
9425 - return ERR_PTR(-ENOMEM);
9426 -@@ -4609,12 +4614,8 @@ abort:
9427 - md_unregister_thread(mddev->thread);
9428 - mddev->thread = NULL;
9429 - if (conf) {
9430 -- shrink_stripes(conf);
9431 - print_raid5_conf(conf);
9432 -- safe_put_page(conf->spare_page);
9433 -- kfree(conf->disks);
9434 -- kfree(conf->stripe_hashtbl);
9435 -- kfree(conf);
9436 -+ free_conf(conf);
9437 - }
9438 - mddev->private = NULL;
9439 - printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev));
9440 -@@ -4629,13 +4630,10 @@ static int stop(mddev_t *mddev)
9441 -
9442 - md_unregister_thread(mddev->thread);
9443 - mddev->thread = NULL;
9444 -- shrink_stripes(conf);
9445 -- kfree(conf->stripe_hashtbl);
9446 - mddev->queue->backing_dev_info.congested_fn = NULL;
9447 - blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
9448 - sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
9449 -- kfree(conf->disks);
9450 -- kfree(conf);
9451 -+ free_conf(conf);
9452 - mddev->private = NULL;
9453 - return 0;
9454 - }
9455 -diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
9456 -index e1658ef..2a1120a 100644
9457 ---- a/drivers/net/atl1c/atl1c.h
9458 -+++ b/drivers/net/atl1c/atl1c.h
9459 -@@ -188,14 +188,14 @@ struct atl1c_tpd_ext_desc {
9460 - #define RRS_HDS_TYPE_DATA 2
9461 -
9462 - #define RRS_IS_NO_HDS_TYPE(flag) \
9463 -- (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == 0)
9464 -+ ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == 0)
9465 -
9466 - #define RRS_IS_HDS_HEAD(flag) \
9467 -- (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
9468 -+ ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
9469 - RRS_HDS_TYPE_HEAD)
9470 -
9471 - #define RRS_IS_HDS_DATA(flag) \
9472 -- (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
9473 -+ ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
9474 - RRS_HDS_TYPE_DATA)
9475 -
9476 - /* rrs word 3 bit 0:31 */
9477 -@@ -245,7 +245,7 @@ struct atl1c_tpd_ext_desc {
9478 - #define RRS_PACKET_TYPE_802_3 1
9479 - #define RRS_PACKET_TYPE_ETH 0
9480 - #define RRS_PACKET_IS_ETH(word) \
9481 -- (((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK == \
9482 -+ ((((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK) == \
9483 - RRS_PACKET_TYPE_ETH)
9484 - #define RRS_RXD_IS_VALID(word) \
9485 - ((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1)
9486 -diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
9487 -index 45c5b73..e4afbd6 100644
9488 ---- a/drivers/net/atl1c/atl1c_ethtool.c
9489 -+++ b/drivers/net/atl1c/atl1c_ethtool.c
9490 -@@ -271,7 +271,7 @@ static int atl1c_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
9491 - struct atl1c_adapter *adapter = netdev_priv(netdev);
9492 -
9493 - if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE |
9494 -- WAKE_MCAST | WAKE_BCAST | WAKE_MCAST))
9495 -+ WAKE_UCAST | WAKE_BCAST | WAKE_MCAST))
9496 - return -EOPNOTSUPP;
9497 - /* these settings will always override what we currently have */
9498 - adapter->wol = 0;
9499 -diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
9500 -index 83a1212..6cf3608 100644
9501 ---- a/drivers/net/atl1c/atl1c_main.c
9502 -+++ b/drivers/net/atl1c/atl1c_main.c
9503 -@@ -1701,7 +1701,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que,
9504 - if (likely(RRS_RXD_IS_VALID(rrs->word3))) {
9505 - rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) &
9506 - RRS_RX_RFD_CNT_MASK;
9507 -- if (unlikely(rfd_num) != 1)
9508 -+ if (unlikely(rfd_num != 1))
9509 - /* TODO support mul rfd*/
9510 - if (netif_msg_rx_err(adapter))
9511 - dev_warn(&pdev->dev,
9512 -diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
9513 -index b4bb06f..97e45e0 100644
9514 ---- a/drivers/net/benet/be.h
9515 -+++ b/drivers/net/benet/be.h
9516 -@@ -73,7 +73,7 @@ static inline char *nic_name(struct pci_dev *pdev)
9517 - #define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)
9518 -
9519 - #define BE_MAX_LRO_DESCRIPTORS 16
9520 --#define BE_MAX_FRAGS_PER_FRAME 16
9521 -+#define BE_MAX_FRAGS_PER_FRAME (min((u32) 16, (u32) MAX_SKB_FRAGS))
9522 -
9523 - struct be_dma_mem {
9524 - void *va;
9525 -diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
9526 -index 9592f22..cccc541 100644
9527 ---- a/drivers/net/benet/be_ethtool.c
9528 -+++ b/drivers/net/benet/be_ethtool.c
9529 -@@ -162,8 +162,8 @@ be_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
9530 - return -EINVAL;
9531 -
9532 - adapter->max_rx_coal = coalesce->rx_max_coalesced_frames;
9533 -- if (adapter->max_rx_coal > MAX_SKB_FRAGS)
9534 -- adapter->max_rx_coal = MAX_SKB_FRAGS - 1;
9535 -+ if (adapter->max_rx_coal > BE_MAX_FRAGS_PER_FRAME)
9536 -+ adapter->max_rx_coal = BE_MAX_FRAGS_PER_FRAME;
9537 -
9538 - /* if AIC is being turned on now, start with an EQD of 0 */
9539 - if (rx_eq->enable_aic == 0 &&
9540 -diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
9541 -index 5c378b5..db19d17 100644
9542 ---- a/drivers/net/benet/be_main.c
9543 -+++ b/drivers/net/benet/be_main.c
9544 -@@ -682,7 +682,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
9545 - {
9546 - struct be_queue_info *rxq = &adapter->rx_obj.q;
9547 - struct be_rx_page_info *page_info;
9548 -- u16 rxq_idx, i, num_rcvd;
9549 -+ u16 rxq_idx, i, num_rcvd, j;
9550 - u32 pktsize, hdr_len, curr_frag_len;
9551 - u8 *start;
9552 -
9553 -@@ -725,22 +725,33 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
9554 -
9555 - /* More frags present for this completion */
9556 - pktsize -= curr_frag_len; /* account for above copied frag */
9557 -- for (i = 1; i < num_rcvd; i++) {
9558 -+ for (i = 1, j = 0; i < num_rcvd; i++) {
9559 - index_inc(&rxq_idx, rxq->len);
9560 - page_info = get_rx_page_info(adapter, rxq_idx);
9561 -
9562 - curr_frag_len = min(pktsize, rx_frag_size);
9563 -
9564 -- skb_shinfo(skb)->frags[i].page = page_info->page;
9565 -- skb_shinfo(skb)->frags[i].page_offset = page_info->page_offset;
9566 -- skb_shinfo(skb)->frags[i].size = curr_frag_len;
9567 -+ /* Coalesce all frags from the same physical page in one slot */
9568 -+ if (page_info->page_offset == 0) {
9569 -+ /* Fresh page */
9570 -+ j++;
9571 -+ skb_shinfo(skb)->frags[j].page = page_info->page;
9572 -+ skb_shinfo(skb)->frags[j].page_offset =
9573 -+ page_info->page_offset;
9574 -+ skb_shinfo(skb)->frags[j].size = 0;
9575 -+ skb_shinfo(skb)->nr_frags++;
9576 -+ } else {
9577 -+ put_page(page_info->page);
9578 -+ }
9579 -+
9580 -+ skb_shinfo(skb)->frags[j].size += curr_frag_len;
9581 - skb->len += curr_frag_len;
9582 - skb->data_len += curr_frag_len;
9583 -- skb_shinfo(skb)->nr_frags++;
9584 - pktsize -= curr_frag_len;
9585 -
9586 - memset(page_info, 0, sizeof(*page_info));
9587 - }
9588 -+ BUG_ON(j > MAX_SKB_FRAGS);
9589 -
9590 - be_rx_stats_update(adapter, pktsize, num_rcvd);
9591 - return;
9592 -@@ -803,7 +814,7 @@ static void be_rx_compl_process_lro(struct be_adapter *adapter,
9593 - struct skb_frag_struct rx_frags[BE_MAX_FRAGS_PER_FRAME];
9594 - struct be_queue_info *rxq = &adapter->rx_obj.q;
9595 - u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len;
9596 -- u16 i, rxq_idx = 0, vid;
9597 -+ u16 i, rxq_idx = 0, vid, j;
9598 -
9599 - num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp);
9600 - pkt_size = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp);
9601 -@@ -811,20 +822,28 @@ static void be_rx_compl_process_lro(struct be_adapter *adapter,
9602 - rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp);
9603 -
9604 - remaining = pkt_size;
9605 -- for (i = 0; i < num_rcvd; i++) {
9606 -+ for (i = 0, j = -1; i < num_rcvd; i++) {
9607 - page_info = get_rx_page_info(adapter, rxq_idx);
9608 -
9609 - curr_frag_len = min(remaining, rx_frag_size);
9610 -
9611 -- rx_frags[i].page = page_info->page;
9612 -- rx_frags[i].page_offset = page_info->page_offset;
9613 -- rx_frags[i].size = curr_frag_len;
9614 -- remaining -= curr_frag_len;
9615 -+ /* Coalesce all frags from the same physical page in one slot */
9616 -+ if (i == 0 || page_info->page_offset == 0) {
9617 -+ /* First frag or Fresh page */
9618 -+ j++;
9619 -+ rx_frags[j].page = page_info->page;
9620 -+ rx_frags[j].page_offset = page_info->page_offset;
9621 -+ rx_frags[j].size = 0;
9622 -+ } else {
9623 -+ put_page(page_info->page);
9624 -+ }
9625 -+ rx_frags[j].size += curr_frag_len;
9626 -
9627 -+ remaining -= curr_frag_len;
9628 - index_inc(&rxq_idx, rxq->len);
9629 --
9630 - memset(page_info, 0, sizeof(*page_info));
9631 - }
9632 -+ BUG_ON(j > MAX_SKB_FRAGS);
9633 -
9634 - if (likely(!vlanf)) {
9635 - lro_receive_frags(&adapter->rx_obj.lro_mgr, rx_frags, pkt_size,
9636 -diff --git a/drivers/net/e100.c b/drivers/net/e100.c
9637 -index 0f9ee13..014dfb6 100644
9638 ---- a/drivers/net/e100.c
9639 -+++ b/drivers/net/e100.c
9640 -@@ -1762,6 +1762,9 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
9641 -
9642 - if (ioread8(&nic->csr->scb.status) & rus_no_res)
9643 - nic->ru_running = RU_SUSPENDED;
9644 -+ pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
9645 -+ sizeof(struct rfd),
9646 -+ PCI_DMA_BIDIRECTIONAL);
9647 - return -ENODATA;
9648 - }
9649 -
9650 -diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
9651 -index 6714a9d..bb59ba4 100644
9652 ---- a/drivers/net/sky2.c
9653 -+++ b/drivers/net/sky2.c
9654 -@@ -2441,7 +2441,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
9655 - if (likely(status >> 16 == (status & 0xffff))) {
9656 - skb = sky2->rx_ring[sky2->rx_next].skb;
9657 - skb->ip_summed = CHECKSUM_COMPLETE;
9658 -- skb->csum = status & 0xffff;
9659 -+ skb->csum = le16_to_cpu(status);
9660 - } else {
9661 - printk(KERN_NOTICE PFX "%s: hardware receive "
9662 - "checksum problem (status = %#x)\n",
9663 -diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
9664 -index c66b9c3..ca39ace 100644
9665 ---- a/drivers/net/usb/cdc_subset.c
9666 -+++ b/drivers/net/usb/cdc_subset.c
9667 -@@ -307,9 +307,10 @@ static const struct usb_device_id products [] = {
9668 - USB_DEVICE (0x1286, 0x8001), // "blob" bootloader
9669 - .driver_info = (unsigned long) &blob_info,
9670 - }, {
9671 -- // Linux Ethernet/RNDIS gadget on pxa210/25x/26x, second config
9672 -- // e.g. Gumstix, current OpenZaurus, ...
9673 -- USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
9674 -+ // Linux Ethernet/RNDIS gadget, mostly on PXA, second config
9675 -+ // e.g. Gumstix, current OpenZaurus, ... or anything else
9676 -+ // that just enables this gadget option.
9677 -+ USB_DEVICE (0x0525, 0xa4a2),
9678 - .driver_info = (unsigned long) &linuxdev_info,
9679 - },
9680 - #endif
9681 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
9682 -index f46ba24..cd20df1 100644
9683 ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c
9684 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
9685 -@@ -3101,27 +3101,10 @@ static ssize_t show_power_level(struct device *d,
9686 - struct device_attribute *attr, char *buf)
9687 - {
9688 - struct iwl_priv *priv = dev_get_drvdata(d);
9689 -- int mode = priv->power_data.user_power_setting;
9690 -- int system = priv->power_data.system_power_setting;
9691 - int level = priv->power_data.power_mode;
9692 - char *p = buf;
9693 -
9694 -- switch (system) {
9695 -- case IWL_POWER_SYS_AUTO:
9696 -- p += sprintf(p, "SYSTEM:auto");
9697 -- break;
9698 -- case IWL_POWER_SYS_AC:
9699 -- p += sprintf(p, "SYSTEM:ac");
9700 -- break;
9701 -- case IWL_POWER_SYS_BATTERY:
9702 -- p += sprintf(p, "SYSTEM:battery");
9703 -- break;
9704 -- }
9705 --
9706 -- p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ?
9707 -- "fixed" : "auto");
9708 -- p += sprintf(p, "\tINDEX:%d", level);
9709 -- p += sprintf(p, "\n");
9710 -+ p += sprintf(p, "%d\n", level);
9711 - return p - buf + 1;
9712 - }
9713 -
9714 -diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
9715 -index ff4d0e4..f7cdae6 100644
9716 ---- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
9717 -+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
9718 -@@ -4623,27 +4623,10 @@ static ssize_t show_power_level(struct device *d,
9719 - struct device_attribute *attr, char *buf)
9720 - {
9721 - struct iwl_priv *priv = dev_get_drvdata(d);
9722 -- int mode = priv->power_data.user_power_setting;
9723 -- int system = priv->power_data.system_power_setting;
9724 - int level = priv->power_data.power_mode;
9725 - char *p = buf;
9726 -
9727 -- switch (system) {
9728 -- case IWL_POWER_SYS_AUTO:
9729 -- p += sprintf(p, "SYSTEM:auto");
9730 -- break;
9731 -- case IWL_POWER_SYS_AC:
9732 -- p += sprintf(p, "SYSTEM:ac");
9733 -- break;
9734 -- case IWL_POWER_SYS_BATTERY:
9735 -- p += sprintf(p, "SYSTEM:battery");
9736 -- break;
9737 -- }
9738 --
9739 -- p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ?
9740 -- "fixed" : "auto");
9741 -- p += sprintf(p, "\tINDEX:%d", level);
9742 -- p += sprintf(p, "\n");
9743 -+ p += sprintf(p, "%d\n", level);
9744 - return p - buf + 1;
9745 - }
9746 -
9747 -diff --git a/drivers/parisc/eisa_eeprom.c b/drivers/parisc/eisa_eeprom.c
9748 -index 685d94e..8c0b26e 100644
9749 ---- a/drivers/parisc/eisa_eeprom.c
9750 -+++ b/drivers/parisc/eisa_eeprom.c
9751 -@@ -55,7 +55,7 @@ static ssize_t eisa_eeprom_read(struct file * file,
9752 - ssize_t ret;
9753 - int i;
9754 -
9755 -- if (*ppos >= HPEE_MAX_LENGTH)
9756 -+ if (*ppos < 0 || *ppos >= HPEE_MAX_LENGTH)
9757 - return 0;
9758 -
9759 - count = *ppos + count < HPEE_MAX_LENGTH ? count : HPEE_MAX_LENGTH - *ppos;
9760 -diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
9761 -index 284ebac..0b159b5 100644
9762 ---- a/drivers/platform/x86/Kconfig
9763 -+++ b/drivers/platform/x86/Kconfig
9764 -@@ -265,6 +265,7 @@ config THINKPAD_ACPI_DOCK
9765 - bool "Legacy Docking Station Support"
9766 - depends on THINKPAD_ACPI
9767 - depends on ACPI_DOCK=n
9768 -+ depends on BROKEN
9769 - default n
9770 - ---help---
9771 - Allows the thinkpad_acpi driver to handle docking station events.
9772 -@@ -278,7 +279,8 @@ config THINKPAD_ACPI_DOCK
9773 - config THINKPAD_ACPI_BAY
9774 - bool "Legacy Removable Bay Support"
9775 - depends on THINKPAD_ACPI
9776 -- default y
9777 -+ depends on BROKEN
9778 -+ default n
9779 - ---help---
9780 - Allows the thinkpad_acpi driver to handle removable bays. It will
9781 - electrically disable the device in the bay, and also generate
9782 -diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
9783 -index e6ac59c..fe8b74c 100644
9784 ---- a/drivers/scsi/libsas/sas_port.c
9785 -+++ b/drivers/scsi/libsas/sas_port.c
9786 -@@ -56,7 +56,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
9787 - }
9788 - }
9789 -
9790 -- /* find a port */
9791 -+ /* see if the phy should be part of a wide port */
9792 - spin_lock_irqsave(&sas_ha->phy_port_lock, flags);
9793 - for (i = 0; i < sas_ha->num_phys; i++) {
9794 - port = sas_ha->sas_port[i];
9795 -@@ -69,12 +69,23 @@ static void sas_form_port(struct asd_sas_phy *phy)
9796 - SAS_DPRINTK("phy%d matched wide port%d\n", phy->id,
9797 - port->id);
9798 - break;
9799 -- } else if (*(u64 *) port->sas_addr == 0 && port->num_phys==0) {
9800 -- memcpy(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE);
9801 -- break;
9802 - }
9803 - spin_unlock(&port->phy_list_lock);
9804 - }
9805 -+ /* The phy does not match any existing port, create a new one */
9806 -+ if (i == sas_ha->num_phys) {
9807 -+ for (i = 0; i < sas_ha->num_phys; i++) {
9808 -+ port = sas_ha->sas_port[i];
9809 -+ spin_lock(&port->phy_list_lock);
9810 -+ if (*(u64 *)port->sas_addr == 0
9811 -+ && port->num_phys == 0) {
9812 -+ memcpy(port->sas_addr, phy->sas_addr,
9813 -+ SAS_ADDR_SIZE);
9814 -+ break;
9815 -+ }
9816 -+ spin_unlock(&port->phy_list_lock);
9817 -+ }
9818 -+ }
9819 -
9820 - if (i >= sas_ha->num_phys) {
9821 - printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
9822 -diff --git a/drivers/staging/rt2870/2870_main_dev.c b/drivers/staging/rt2870/2870_main_dev.c
9823 -index 9d59e31..04c764d 100644
9824 ---- a/drivers/staging/rt2870/2870_main_dev.c
9825 -+++ b/drivers/staging/rt2870/2870_main_dev.c
9826 -@@ -265,7 +265,7 @@ INT MlmeThread(
9827 - */
9828 - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__));
9829 -
9830 -- pObj->MLMEThr_task = NULL;
9831 -+ pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
9832 -
9833 - complete_and_exit (&pAd->mlmeComplete, 0);
9834 - return 0;
9835 -@@ -373,7 +373,7 @@ INT RTUSBCmdThread(
9836 - */
9837 - DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n"));
9838 -
9839 -- pObj->RTUSBCmdThr_task = NULL;
9840 -+ pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
9841 -
9842 - complete_and_exit (&pAd->CmdQComplete, 0);
9843 - return 0;
9844 -@@ -467,7 +467,7 @@ INT TimerQThread(
9845 - */
9846 - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__));
9847 -
9848 -- pObj->TimerQThr_task = NULL;
9849 -+ pObj->TimerQThr_pid = THREAD_PID_INIT_VALUE;
9850 -
9851 - complete_and_exit(&pAd->TimerQComplete, 0);
9852 - return 0;
9853 -@@ -944,46 +944,69 @@ VOID RT28xxThreadTerminate(
9854 - RTUSBCancelPendingIRPs(pAd);
9855 -
9856 - // Terminate Threads
9857 -- BUG_ON(pObj->TimerQThr_task == NULL);
9858 -- CHECK_PID_LEGALITY(task_pid(pObj->TimerQThr_task))
9859 -+ CHECK_PID_LEGALITY(pObj->TimerQThr_pid)
9860 - {
9861 - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
9862 -
9863 -- printk(KERN_DEBUG "Terminate the TimerQThr pid=%d!\n",
9864 -- pid_nr(task_pid(pObj->TimerQThr_task)));
9865 -+ printk("Terminate the TimerQThr_pid=%d!\n", GET_PID_NUMBER(pObj->TimerQThr_pid));
9866 - mb();
9867 - pAd->TimerFunc_kill = 1;
9868 - mb();
9869 -- kthread_stop(pObj->TimerQThr_task);
9870 -- pObj->TimerQThr_task = NULL;
9871 -+ ret = KILL_THREAD_PID(pObj->TimerQThr_pid, SIGTERM, 1);
9872 -+ if (ret)
9873 -+ {
9874 -+ printk(KERN_WARNING "%s: unable to stop TimerQThread, pid=%d, ret=%d!\n",
9875 -+ pAd->net_dev->name, GET_PID_NUMBER(pObj->TimerQThr_pid), ret);
9876 -+ }
9877 -+ else
9878 -+ {
9879 -+ wait_for_completion(&pAd->TimerQComplete);
9880 -+ pObj->TimerQThr_pid = THREAD_PID_INIT_VALUE;
9881 -+ }
9882 - }
9883 -
9884 -- BUG_ON(pObj->MLMEThr_task == NULL);
9885 -- CHECK_PID_LEGALITY(task_pid(pObj->MLMEThr_task))
9886 -+ CHECK_PID_LEGALITY(pObj->MLMEThr_pid)
9887 - {
9888 -- printk(KERN_DEBUG "Terminate the MLMEThr pid=%d!\n",
9889 -- pid_nr(task_pid(pObj->MLMEThr_task)));
9890 -+ printk("Terminate the MLMEThr_pid=%d!\n", GET_PID_NUMBER(pObj->MLMEThr_pid));
9891 - mb();
9892 - pAd->mlme_kill = 1;
9893 - //RT28XX_MLME_HANDLER(pAd);
9894 - mb();
9895 -- kthread_stop(pObj->MLMEThr_task);
9896 -- pObj->MLMEThr_task = NULL;
9897 -+ ret = KILL_THREAD_PID(pObj->MLMEThr_pid, SIGTERM, 1);
9898 -+ if (ret)
9899 -+ {
9900 -+ printk (KERN_WARNING "%s: unable to Mlme thread, pid=%d, ret=%d!\n",
9901 -+ pAd->net_dev->name, GET_PID_NUMBER(pObj->MLMEThr_pid), ret);
9902 -+ }
9903 -+ else
9904 -+ {
9905 -+ //wait_for_completion (&pAd->notify);
9906 -+ wait_for_completion (&pAd->mlmeComplete);
9907 -+ pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
9908 -+ }
9909 - }
9910 -
9911 -- BUG_ON(pObj->RTUSBCmdThr_task == NULL);
9912 -- CHECK_PID_LEGALITY(task_pid(pObj->RTUSBCmdThr_task))
9913 -+ CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid)
9914 - {
9915 -- printk(KERN_DEBUG "Terminate the RTUSBCmdThr pid=%d!\n",
9916 -- pid_nr(task_pid(pObj->RTUSBCmdThr_task)));
9917 -+ printk("Terminate the RTUSBCmdThr_pid=%d!\n", GET_PID_NUMBER(pObj->RTUSBCmdThr_pid));
9918 - mb();
9919 - NdisAcquireSpinLock(&pAd->CmdQLock);
9920 - pAd->CmdQ.CmdQState = RT2870_THREAD_STOPED;
9921 - NdisReleaseSpinLock(&pAd->CmdQLock);
9922 - mb();
9923 - //RTUSBCMDUp(pAd);
9924 -- kthread_stop(pObj->RTUSBCmdThr_task);
9925 -- pObj->RTUSBCmdThr_task = NULL;
9926 -+ ret = KILL_THREAD_PID(pObj->RTUSBCmdThr_pid, SIGTERM, 1);
9927 -+ if (ret)
9928 -+ {
9929 -+ printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n",
9930 -+ pAd->net_dev->name, GET_PID_NUMBER(pObj->RTUSBCmdThr_pid), ret);
9931 -+ }
9932 -+ else
9933 -+ {
9934 -+ //wait_for_completion (&pAd->notify);
9935 -+ wait_for_completion (&pAd->CmdQComplete);
9936 -+ pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
9937 -+ }
9938 - }
9939 -
9940 -
9941 -@@ -1044,7 +1067,7 @@ BOOLEAN RT28XXChipsetCheck(
9942 - if (dev_p->descriptor.idVendor == rtusb_usb_id[i].idVendor &&
9943 - dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct)
9944 - {
9945 -- printk(KERN_DEBUG "rt2870: idVendor = 0x%x, idProduct = 0x%x\n",
9946 -+ printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n",
9947 - dev_p->descriptor.idVendor, dev_p->descriptor.idProduct);
9948 - break;
9949 - }
9950 -diff --git a/drivers/staging/rt2870/common/2870_rtmp_init.c b/drivers/staging/rt2870/common/2870_rtmp_init.c
9951 -index cb16d2f..9f5143b 100644
9952 ---- a/drivers/staging/rt2870/common/2870_rtmp_init.c
9953 -+++ b/drivers/staging/rt2870/common/2870_rtmp_init.c
9954 -@@ -727,8 +727,8 @@ NDIS_STATUS AdapterBlockAllocateMemory(
9955 -
9956 - usb_dev = pObj->pUsb_Dev;
9957 -
9958 -- pObj->MLMEThr_task = NULL;
9959 -- pObj->RTUSBCmdThr_task = NULL;
9960 -+ pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
9961 -+ pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
9962 -
9963 - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER));
9964 -
9965 -@@ -765,7 +765,7 @@ NDIS_STATUS CreateThreads(
9966 - {
9967 - PRTMP_ADAPTER pAd = net_dev->ml_priv;
9968 - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
9969 -- struct task_struct *tsk;
9970 -+ pid_t pid_number = -1;
9971 -
9972 - //init_MUTEX(&(pAd->usbdev_semaphore));
9973 -
9974 -@@ -779,39 +779,36 @@ NDIS_STATUS CreateThreads(
9975 - init_completion (&pAd->TimerQComplete);
9976 -
9977 - // Creat MLME Thread
9978 -- pObj->MLMEThr_task = NULL;
9979 -- tsk = kthread_run(MlmeThread, pAd, pAd->net_dev->name);
9980 --
9981 -- if (IS_ERR(tsk)) {
9982 -+ pObj->MLMEThr_pid= THREAD_PID_INIT_VALUE;
9983 -+ pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM);
9984 -+ if (pid_number < 0)
9985 -+ {
9986 - printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name);
9987 - return NDIS_STATUS_FAILURE;
9988 - }
9989 --
9990 -- pObj->MLMEThr_task = tsk;
9991 -+ pObj->MLMEThr_pid = GET_PID(pid_number);
9992 - // Wait for the thread to start
9993 - wait_for_completion(&(pAd->mlmeComplete));
9994 -
9995 - // Creat Command Thread
9996 -- pObj->RTUSBCmdThr_task = NULL;
9997 -- tsk = kthread_run(RTUSBCmdThread, pAd, pAd->net_dev->name);
9998 --
9999 -- if (IS_ERR(tsk) < 0)
10000 -+ pObj->RTUSBCmdThr_pid= THREAD_PID_INIT_VALUE;
10001 -+ pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM);
10002 -+ if (pid_number < 0)
10003 - {
10004 - printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name);
10005 - return NDIS_STATUS_FAILURE;
10006 - }
10007 --
10008 -- pObj->RTUSBCmdThr_task = tsk;
10009 -+ pObj->RTUSBCmdThr_pid = GET_PID(pid_number);
10010 - wait_for_completion(&(pAd->CmdQComplete));
10011 -
10012 -- pObj->TimerQThr_task = NULL;
10013 -- tsk = kthread_run(TimerQThread, pAd, pAd->net_dev->name);
10014 -- if (IS_ERR(tsk) < 0)
10015 -+ pObj->TimerQThr_pid= THREAD_PID_INIT_VALUE;
10016 -+ pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM);
10017 -+ if (pid_number < 0)
10018 - {
10019 - printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name);
10020 - return NDIS_STATUS_FAILURE;
10021 - }
10022 -- pObj->TimerQThr_task = tsk;
10023 -+ pObj->TimerQThr_pid = GET_PID(pid_number);
10024 - // Wait for the thread to start
10025 - wait_for_completion(&(pAd->TimerQComplete));
10026 -
10027 -diff --git a/drivers/staging/rt2870/common/cmm_data.c b/drivers/staging/rt2870/common/cmm_data.c
10028 -index f8e0ebd..fd809ab 100644
10029 ---- a/drivers/staging/rt2870/common/cmm_data.c
10030 -+++ b/drivers/staging/rt2870/common/cmm_data.c
10031 -@@ -709,6 +709,9 @@ BOOLEAN RTMP_FillTxBlkInfo(
10032 - }
10033 -
10034 - return TRUE;
10035 -+
10036 -+FillTxBlkErr:
10037 -+ return FALSE;
10038 - }
10039 -
10040 -
10041 -diff --git a/drivers/staging/rt2870/common/rtmp_init.c b/drivers/staging/rt2870/common/rtmp_init.c
10042 -index 099b6a8..870a00d 100644
10043 ---- a/drivers/staging/rt2870/common/rtmp_init.c
10044 -+++ b/drivers/staging/rt2870/common/rtmp_init.c
10045 -@@ -3655,7 +3655,7 @@ VOID UserCfgInit(
10046 - #ifdef RALINK_28xx_QA
10047 - //pAd->ate.Repeat = 0;
10048 - pAd->ate.TxStatus = 0;
10049 -- pAd->ate.AtePid = NULL;
10050 -+ pAd->ate.AtePid = THREAD_PID_INIT_VALUE;
10051 - #endif // RALINK_28xx_QA //
10052 - #endif // RALINK_ATE //
10053 -
10054 -diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c
10055 -index afde136..6db443e 100644
10056 ---- a/drivers/staging/rt2870/common/rtusb_io.c
10057 -+++ b/drivers/staging/rt2870/common/rtusb_io.c
10058 -@@ -958,8 +958,7 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(
10059 - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
10060 -
10061 -
10062 -- BUG_ON(pObj->RTUSBCmdThr_task == NULL);
10063 -- CHECK_PID_LEGALITY(task_pid(pObj->RTUSBCmdThr_task))
10064 -+ CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid)
10065 - return (NDIS_STATUS_RESOURCES);
10066 -
10067 - status = RTMPAllocateMemory((PVOID *)&cmdqelmt, sizeof(CmdQElmt));
10068 -diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h
10069 -index fef14a4..39fa918 100644
10070 ---- a/drivers/staging/rt2870/rt2870.h
10071 -+++ b/drivers/staging/rt2870/rt2870.h
10072 -@@ -580,16 +580,14 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
10073 - #define RTUSBMlmeUp(pAd) \
10074 - { \
10075 - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
10076 -- BUG_ON(pObj->MLMEThr_task == NULL); \
10077 -- CHECK_PID_LEGALITY(task_pid(pObj->MLMEThr_task)) \
10078 -+ CHECK_PID_LEGALITY(pObj->MLMEThr_pid) \
10079 - up(&(pAd->mlme_semaphore)); \
10080 - }
10081 -
10082 - #define RTUSBCMDUp(pAd) \
10083 - { \
10084 - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
10085 -- BUG_ON(pObj->RTUSBCmdThr_task == NULL); \
10086 -- CHECK_PID_LEGALITY(task_pid(pObj->RTUSBCmdThr_task)) \
10087 -+ CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid) \
10088 - up(&(pAd->RTUSBCmd_semaphore)); \
10089 - }
10090 -
10091 -diff --git a/drivers/staging/rt2870/rt_linux.h b/drivers/staging/rt2870/rt_linux.h
10092 -index 5a6ee6a..49ad37f 100644
10093 ---- a/drivers/staging/rt2870/rt_linux.h
10094 -+++ b/drivers/staging/rt2870/rt_linux.h
10095 -@@ -44,7 +44,6 @@
10096 - #include <linux/module.h>
10097 - #include <linux/version.h>
10098 - #include <linux/kernel.h>
10099 --#include <linux/kthread.h>
10100 -
10101 - #include <linux/spinlock.h>
10102 - #include <linux/init.h>
10103 -@@ -166,12 +165,14 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
10104 -
10105 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
10106 - typedef struct pid * THREAD_PID;
10107 -+#define THREAD_PID_INIT_VALUE NULL
10108 - #define GET_PID(_v) find_get_pid(_v)
10109 - #define GET_PID_NUMBER(_v) pid_nr(_v)
10110 - #define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0)
10111 - #define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C)
10112 - #else
10113 - typedef pid_t THREAD_PID;
10114 -+#define THREAD_PID_INIT_VALUE -1
10115 - #define GET_PID(_v) _v
10116 - #define GET_PID_NUMBER(_v) _v
10117 - #define CHECK_PID_LEGALITY(_pid) if (_pid >= 0)
10118 -@@ -187,11 +188,11 @@ struct os_lock {
10119 - struct os_cookie {
10120 -
10121 - #ifdef RT2870
10122 -- struct usb_device *pUsb_Dev;
10123 -+ struct usb_device *pUsb_Dev;
10124 -
10125 -- struct task_struct *MLMEThr_task;
10126 -- struct task_struct *RTUSBCmdThr_task;
10127 -- struct task_struct *TimerQThr_task;
10128 -+ THREAD_PID MLMEThr_pid;
10129 -+ THREAD_PID RTUSBCmdThr_pid;
10130 -+ THREAD_PID TimerQThr_pid;
10131 - #endif // RT2870 //
10132 -
10133 - struct tasklet_struct rx_done_task;
10134 -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
10135 -index ef03927..096badf 100644
10136 ---- a/drivers/usb/core/devio.c
10137 -+++ b/drivers/usb/core/devio.c
10138 -@@ -582,7 +582,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
10139 - if (!ps)
10140 - goto out;
10141 -
10142 -- ret = -ENOENT;
10143 -+ ret = -ENODEV;
10144 -
10145 - /* usbdev device-node */
10146 - if (imajor(inode) == USB_DEVICE_MAJOR)
10147 -@@ -1308,7 +1308,8 @@ static int get_urb32(struct usbdevfs_urb *kurb,
10148 - struct usbdevfs_urb32 __user *uurb)
10149 - {
10150 - __u32 uptr;
10151 -- if (get_user(kurb->type, &uurb->type) ||
10152 -+ if (!access_ok(VERIFY_READ, uurb, sizeof(*uurb)) ||
10153 -+ __get_user(kurb->type, &uurb->type) ||
10154 - __get_user(kurb->endpoint, &uurb->endpoint) ||
10155 - __get_user(kurb->status, &uurb->status) ||
10156 - __get_user(kurb->flags, &uurb->flags) ||
10157 -@@ -1523,8 +1524,9 @@ static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg)
10158 - u32 udata;
10159 -
10160 - uioc = compat_ptr((long)arg);
10161 -- if (get_user(ctrl.ifno, &uioc->ifno) ||
10162 -- get_user(ctrl.ioctl_code, &uioc->ioctl_code) ||
10163 -+ if (!access_ok(VERIFY_READ, uioc, sizeof(*uioc)) ||
10164 -+ __get_user(ctrl.ifno, &uioc->ifno) ||
10165 -+ __get_user(ctrl.ioctl_code, &uioc->ioctl_code) ||
10166 - __get_user(udata, &uioc->data))
10167 - return -EFAULT;
10168 - ctrl.data = compat_ptr(udata);
10169 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
10170 -index 9722512..91c0e01 100644
10171 ---- a/drivers/usb/serial/ftdi_sio.c
10172 -+++ b/drivers/usb/serial/ftdi_sio.c
10173 -@@ -672,6 +672,9 @@ static struct usb_device_id id_table_combined [] = {
10174 - { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
10175 - { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
10176 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10177 -+ { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
10178 -+ { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
10179 -+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10180 - { }, /* Optional parameter entry */
10181 - { } /* Terminating entry */
10182 - };
10183 -diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
10184 -index 12330fa..3f89e3c 100644
10185 ---- a/drivers/usb/serial/ftdi_sio.h
10186 -+++ b/drivers/usb/serial/ftdi_sio.h
10187 -@@ -926,6 +926,20 @@
10188 - #define MARVELL_SHEEVAPLUG_PID 0x9e8f
10189 -
10190 - /*
10191 -+ * Bayer Ascensia Contour blood glucose meter USB-converter cable.
10192 -+ * http://winglucofacts.com/cables/
10193 -+ */
10194 -+#define BAYER_VID 0x1A79
10195 -+#define BAYER_CONTOUR_CABLE_PID 0x6001
10196 -+
10197 -+/*
10198 -+ * Marvell OpenRD Base, Client
10199 -+ * http://www.open-rd.org
10200 -+ * OpenRD Base, Client use VID 0x0403
10201 -+ */
10202 -+#define MARVELL_OPENRD_PID 0x9e90
10203 -+
10204 -+/*
10205 - * BmRequestType: 1100 0000b
10206 - * bRequest: FTDI_E2_READ
10207 - * wValue: 0
10208 -diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
10209 -index fcb3202..e20dc52 100644
10210 ---- a/drivers/usb/storage/transport.c
10211 -+++ b/drivers/usb/storage/transport.c
10212 -@@ -961,7 +961,7 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
10213 - US_BULK_GET_MAX_LUN,
10214 - USB_DIR_IN | USB_TYPE_CLASS |
10215 - USB_RECIP_INTERFACE,
10216 -- 0, us->ifnum, us->iobuf, 1, HZ);
10217 -+ 0, us->ifnum, us->iobuf, 1, 10*HZ);
10218 -
10219 - US_DEBUGP("GetMaxLUN command result is %d, data is %d\n",
10220 - result, us->iobuf[0]);
10221 -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
10222 -index 4b8b690..1d76bf0 100644
10223 ---- a/drivers/usb/storage/unusual_devs.h
10224 -+++ b/drivers/usb/storage/unusual_devs.h
10225 -@@ -838,6 +838,13 @@ UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
10226 - US_SC_DEVICE, US_PR_DEVICE, NULL,
10227 - US_FL_FIX_CAPACITY ),
10228 -
10229 -+/* Reported by Rogerio Brito <rbrito@×××××××.br> */
10230 -+UNUSUAL_DEV( 0x067b, 0x2317, 0x0001, 0x001,
10231 -+ "Prolific Technology, Inc.",
10232 -+ "Mass Storage Device",
10233 -+ US_SC_DEVICE, US_PR_DEVICE, NULL,
10234 -+ US_FL_NOT_LOCKABLE ),
10235 -+
10236 - /* Reported by Richard -=[]=- <micro_flyer@×××××××.com> */
10237 - /* Change to bcdDeviceMin (0x0100 to 0x0001) reported by
10238 - * Thomas Bartosik <tbartdev@×××××××××××.de> */
10239 -diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
10240 -index 697f6b5..e92f229 100644
10241 ---- a/fs/binfmt_flat.c
10242 -+++ b/fs/binfmt_flat.c
10243 -@@ -828,15 +828,22 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
10244 - if (IS_ERR(bprm.file))
10245 - return res;
10246 -
10247 -+ bprm.cred = prepare_exec_creds();
10248 -+ res = -ENOMEM;
10249 -+ if (!bprm.cred)
10250 -+ goto out;
10251 -+
10252 - res = prepare_binprm(&bprm);
10253 -
10254 - if (res <= (unsigned long)-4096)
10255 - res = load_flat_file(&bprm, libs, id, NULL);
10256 -- if (bprm.file) {
10257 -- allow_write_access(bprm.file);
10258 -- fput(bprm.file);
10259 -- bprm.file = NULL;
10260 -- }
10261 -+
10262 -+ abort_creds(bprm.cred);
10263 -+
10264 -+out:
10265 -+ allow_write_access(bprm.file);
10266 -+ fput(bprm.file);
10267 -+
10268 - return(res);
10269 - }
10270 -
10271 -diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
10272 -index 83d6275..3236d1a 100644
10273 ---- a/fs/cifs/cifs_dfs_ref.c
10274 -+++ b/fs/cifs/cifs_dfs_ref.c
10275 -@@ -55,7 +55,7 @@ void cifs_dfs_release_automount_timer(void)
10276 - * i.e. strips from UNC trailing path that is not part of share
10277 - * name and fixup missing '\' in the begining of DFS node refferal
10278 - * if neccessary.
10279 -- * Returns pointer to share name on success or NULL on error.
10280 -+ * Returns pointer to share name on success or ERR_PTR on error.
10281 - * Caller is responsible for freeing returned string.
10282 - */
10283 - static char *cifs_get_share_name(const char *node_name)
10284 -@@ -68,7 +68,7 @@ static char *cifs_get_share_name(const char *node_name)
10285 - UNC = kmalloc(len+2 /*for term null and additional \ if it's missed */,
10286 - GFP_KERNEL);
10287 - if (!UNC)
10288 -- return NULL;
10289 -+ return ERR_PTR(-ENOMEM);
10290 -
10291 - /* get share name and server name */
10292 - if (node_name[1] != '\\') {
10293 -@@ -87,7 +87,7 @@ static char *cifs_get_share_name(const char *node_name)
10294 - cERROR(1, ("%s: no server name end in node name: %s",
10295 - __func__, node_name));
10296 - kfree(UNC);
10297 -- return NULL;
10298 -+ return ERR_PTR(-EINVAL);
10299 - }
10300 -
10301 - /* find sharename end */
10302 -@@ -133,6 +133,12 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
10303 - return ERR_PTR(-EINVAL);
10304 -
10305 - *devname = cifs_get_share_name(ref->node_name);
10306 -+ if (IS_ERR(*devname)) {
10307 -+ rc = PTR_ERR(*devname);
10308 -+ *devname = NULL;
10309 -+ goto compose_mount_options_err;
10310 -+ }
10311 -+
10312 - rc = dns_resolve_server_name_to_ip(*devname, &srvIP);
10313 - if (rc != 0) {
10314 - cERROR(1, ("%s: Failed to resolve server part of %s to IP: %d",
10315 -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
10316 -index 1dc14f2..0b0b9df 100644
10317 ---- a/fs/cifs/connect.c
10318 -+++ b/fs/cifs/connect.c
10319 -@@ -2563,11 +2563,20 @@ remote_path_check:
10320 -
10321 - if (mount_data != mount_data_global)
10322 - kfree(mount_data);
10323 -+
10324 - mount_data = cifs_compose_mount_options(
10325 - cifs_sb->mountdata, full_path + 1,
10326 - referrals, &fake_devname);
10327 -- kfree(fake_devname);
10328 -+
10329 - free_dfs_info_array(referrals, num_referrals);
10330 -+ kfree(fake_devname);
10331 -+ kfree(full_path);
10332 -+
10333 -+ if (IS_ERR(mount_data)) {
10334 -+ rc = PTR_ERR(mount_data);
10335 -+ mount_data = NULL;
10336 -+ goto mount_fail_check;
10337 -+ }
10338 -
10339 - if (tcon)
10340 - cifs_put_tcon(tcon);
10341 -@@ -2575,8 +2584,6 @@ remote_path_check:
10342 - cifs_put_smb_ses(pSesInfo);
10343 -
10344 - cleanup_volume_info(&volume_info);
10345 -- FreeXid(xid);
10346 -- kfree(full_path);
10347 - referral_walks_count++;
10348 - goto try_mount_again;
10349 - }
10350 -diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
10351 -index b83f6bc..e2a82c1 100644
10352 ---- a/fs/compat_ioctl.c
10353 -+++ b/fs/compat_ioctl.c
10354 -@@ -1915,6 +1915,7 @@ COMPATIBLE_IOCTL(FIONCLEX)
10355 - COMPATIBLE_IOCTL(FIOASYNC)
10356 - COMPATIBLE_IOCTL(FIONBIO)
10357 - COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */
10358 -+COMPATIBLE_IOCTL(FS_IOC_FIEMAP)
10359 - /* 0x00 */
10360 - COMPATIBLE_IOCTL(FIBMAP)
10361 - COMPATIBLE_IOCTL(FIGETBSZ)
10362 -diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
10363 -index 08f6b04..630feb3 100644
10364 ---- a/fs/nfs/direct.c
10365 -+++ b/fs/nfs/direct.c
10366 -@@ -255,7 +255,7 @@ static void nfs_direct_read_release(void *calldata)
10367 -
10368 - if (put_dreq(dreq))
10369 - nfs_direct_complete(dreq);
10370 -- nfs_readdata_release(calldata);
10371 -+ nfs_readdata_free(data);
10372 - }
10373 -
10374 - static const struct rpc_call_ops nfs_read_direct_ops = {
10375 -@@ -311,14 +311,14 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
10376 - data->npages, 1, 0, data->pagevec, NULL);
10377 - up_read(&current->mm->mmap_sem);
10378 - if (result < 0) {
10379 -- nfs_readdata_release(data);
10380 -+ nfs_readdata_free(data);
10381 - break;
10382 - }
10383 - if ((unsigned)result < data->npages) {
10384 - bytes = result * PAGE_SIZE;
10385 - if (bytes <= pgbase) {
10386 - nfs_direct_release_pages(data->pagevec, result);
10387 -- nfs_readdata_release(data);
10388 -+ nfs_readdata_free(data);
10389 - break;
10390 - }
10391 - bytes -= pgbase;
10392 -@@ -331,7 +331,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
10393 - data->inode = inode;
10394 - data->cred = msg.rpc_cred;
10395 - data->args.fh = NFS_FH(inode);
10396 -- data->args.context = get_nfs_open_context(ctx);
10397 -+ data->args.context = ctx;
10398 - data->args.offset = pos;
10399 - data->args.pgbase = pgbase;
10400 - data->args.pages = data->pagevec;
10401 -@@ -438,7 +438,7 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq)
10402 - struct nfs_write_data *data = list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages);
10403 - list_del(&data->pages);
10404 - nfs_direct_release_pages(data->pagevec, data->npages);
10405 -- nfs_writedata_release(data);
10406 -+ nfs_writedata_free(data);
10407 - }
10408 - }
10409 -
10410 -@@ -531,7 +531,7 @@ static void nfs_direct_commit_release(void *calldata)
10411 -
10412 - dprintk("NFS: %5u commit returned %d\n", data->task.tk_pid, status);
10413 - nfs_direct_write_complete(dreq, data->inode);
10414 -- nfs_commitdata_release(calldata);
10415 -+ nfs_commit_free(data);
10416 - }
10417 -
10418 - static const struct rpc_call_ops nfs_commit_direct_ops = {
10419 -@@ -564,7 +564,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
10420 - data->args.fh = NFS_FH(data->inode);
10421 - data->args.offset = 0;
10422 - data->args.count = 0;
10423 -- data->args.context = get_nfs_open_context(dreq->ctx);
10424 -+ data->args.context = dreq->ctx;
10425 - data->res.count = 0;
10426 - data->res.fattr = &data->fattr;
10427 - data->res.verf = &data->verf;
10428 -@@ -725,14 +725,14 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
10429 - data->npages, 0, 0, data->pagevec, NULL);
10430 - up_read(&current->mm->mmap_sem);
10431 - if (result < 0) {
10432 -- nfs_writedata_release(data);
10433 -+ nfs_writedata_free(data);
10434 - break;
10435 - }
10436 - if ((unsigned)result < data->npages) {
10437 - bytes = result * PAGE_SIZE;
10438 - if (bytes <= pgbase) {
10439 - nfs_direct_release_pages(data->pagevec, result);
10440 -- nfs_writedata_release(data);
10441 -+ nfs_writedata_free(data);
10442 - break;
10443 - }
10444 - bytes -= pgbase;
10445 -@@ -747,7 +747,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
10446 - data->inode = inode;
10447 - data->cred = msg.rpc_cred;
10448 - data->args.fh = NFS_FH(inode);
10449 -- data->args.context = get_nfs_open_context(ctx);
10450 -+ data->args.context = ctx;
10451 - data->args.offset = pos;
10452 - data->args.pgbase = pgbase;
10453 - data->args.pages = data->pagevec;
10454 -diff --git a/fs/nfs/read.c b/fs/nfs/read.c
10455 -index 4ace3c5..eea5bd2 100644
10456 ---- a/fs/nfs/read.c
10457 -+++ b/fs/nfs/read.c
10458 -@@ -59,17 +59,15 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
10459 - return p;
10460 - }
10461 -
10462 --static void nfs_readdata_free(struct nfs_read_data *p)
10463 -+void nfs_readdata_free(struct nfs_read_data *p)
10464 - {
10465 - if (p && (p->pagevec != &p->page_array[0]))
10466 - kfree(p->pagevec);
10467 - mempool_free(p, nfs_rdata_mempool);
10468 - }
10469 -
10470 --void nfs_readdata_release(void *data)
10471 -+static void nfs_readdata_release(struct nfs_read_data *rdata)
10472 - {
10473 -- struct nfs_read_data *rdata = data;
10474 --
10475 - put_nfs_open_context(rdata->args.context);
10476 - nfs_readdata_free(rdata);
10477 - }
10478 -diff --git a/fs/nfs/write.c b/fs/nfs/write.c
10479 -index e560a78..9cce370 100644
10480 ---- a/fs/nfs/write.c
10481 -+++ b/fs/nfs/write.c
10482 -@@ -84,17 +84,15 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
10483 - return p;
10484 - }
10485 -
10486 --static void nfs_writedata_free(struct nfs_write_data *p)
10487 -+void nfs_writedata_free(struct nfs_write_data *p)
10488 - {
10489 - if (p && (p->pagevec != &p->page_array[0]))
10490 - kfree(p->pagevec);
10491 - mempool_free(p, nfs_wdata_mempool);
10492 - }
10493 -
10494 --void nfs_writedata_release(void *data)
10495 -+static void nfs_writedata_release(struct nfs_write_data *wdata)
10496 - {
10497 -- struct nfs_write_data *wdata = data;
10498 --
10499 - put_nfs_open_context(wdata->args.context);
10500 - nfs_writedata_free(wdata);
10501 - }
10502 -diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
10503 -index 1779ddc..18ffb2e 100644
10504 ---- a/fs/nilfs2/segment.c
10505 -+++ b/fs/nilfs2/segment.c
10506 -@@ -1876,12 +1876,26 @@ static void nilfs_end_page_io(struct page *page, int err)
10507 - if (!page)
10508 - return;
10509 -
10510 -- if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page))
10511 -+ if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page)) {
10512 - /*
10513 - * For b-tree node pages, this function may be called twice
10514 - * or more because they might be split in a segment.
10515 - */
10516 -+ if (PageDirty(page)) {
10517 -+ /*
10518 -+ * For pages holding split b-tree node buffers, dirty
10519 -+ * flag on the buffers may be cleared discretely.
10520 -+ * In that case, the page is once redirtied for
10521 -+ * remaining buffers, and it must be cancelled if
10522 -+ * all the buffers get cleaned later.
10523 -+ */
10524 -+ lock_page(page);
10525 -+ if (nilfs_page_buffers_clean(page))
10526 -+ __nilfs_clear_page_dirty(page);
10527 -+ unlock_page(page);
10528 -+ }
10529 - return;
10530 -+ }
10531 -
10532 - __nilfs_end_page_io(page, err);
10533 - }
10534 -diff --git a/fs/proc/base.c b/fs/proc/base.c
10535 -index 3326bbf..f705cfd 100644
10536 ---- a/fs/proc/base.c
10537 -+++ b/fs/proc/base.c
10538 -@@ -234,23 +234,20 @@ static int check_mem_permission(struct task_struct *task)
10539 -
10540 - struct mm_struct *mm_for_maps(struct task_struct *task)
10541 - {
10542 -- struct mm_struct *mm = get_task_mm(task);
10543 -- if (!mm)
10544 -+ struct mm_struct *mm;
10545 -+
10546 -+ if (mutex_lock_killable(&task->cred_exec_mutex))
10547 - return NULL;
10548 -- down_read(&mm->mmap_sem);
10549 -- task_lock(task);
10550 -- if (task->mm != mm)
10551 -- goto out;
10552 -- if (task->mm != current->mm &&
10553 -- __ptrace_may_access(task, PTRACE_MODE_READ) < 0)
10554 -- goto out;
10555 -- task_unlock(task);
10556 -+
10557 -+ mm = get_task_mm(task);
10558 -+ if (mm && mm != current->mm &&
10559 -+ !ptrace_may_access(task, PTRACE_MODE_READ)) {
10560 -+ mmput(mm);
10561 -+ mm = NULL;
10562 -+ }
10563 -+ mutex_unlock(&task->cred_exec_mutex);
10564 -+
10565 - return mm;
10566 --out:
10567 -- task_unlock(task);
10568 -- up_read(&mm->mmap_sem);
10569 -- mmput(mm);
10570 -- return NULL;
10571 - }
10572 -
10573 - static int proc_pid_cmdline(struct task_struct *task, char * buffer)
10574 -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
10575 -index 6f61b7c..9bd8be1 100644
10576 ---- a/fs/proc/task_mmu.c
10577 -+++ b/fs/proc/task_mmu.c
10578 -@@ -119,6 +119,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
10579 - mm = mm_for_maps(priv->task);
10580 - if (!mm)
10581 - return NULL;
10582 -+ down_read(&mm->mmap_sem);
10583 -
10584 - tail_vma = get_gate_vma(priv->task);
10585 - priv->tail_vma = tail_vma;
10586 -diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
10587 -index 64a72e2..8f5c05d 100644
10588 ---- a/fs/proc/task_nommu.c
10589 -+++ b/fs/proc/task_nommu.c
10590 -@@ -189,6 +189,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
10591 - priv->task = NULL;
10592 - return NULL;
10593 - }
10594 -+ down_read(&mm->mmap_sem);
10595 -
10596 - /* start from the Nth VMA */
10597 - for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
10598 -diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
10599 -index d88d0fa..14f2d71 100644
10600 ---- a/fs/sysfs/dir.c
10601 -+++ b/fs/sysfs/dir.c
10602 -@@ -939,8 +939,10 @@ again:
10603 - /* Remove from old parent's list and insert into new parent's list. */
10604 - sysfs_unlink_sibling(sd);
10605 - sysfs_get(new_parent_sd);
10606 -+ drop_nlink(old_parent->d_inode);
10607 - sysfs_put(sd->s_parent);
10608 - sd->s_parent = new_parent_sd;
10609 -+ inc_nlink(new_parent->d_inode);
10610 - sysfs_link_sibling(sd);
10611 -
10612 - out_unlock:
10613 -diff --git a/include/linux/ide.h b/include/linux/ide.h
10614 -index 9fed365..ca051f3 100644
10615 ---- a/include/linux/ide.h
10616 -+++ b/include/linux/ide.h
10617 -@@ -1384,7 +1384,6 @@ int ide_in_drive_list(u16 *, const struct drive_list_entry *);
10618 - #ifdef CONFIG_BLK_DEV_IDEDMA
10619 - int ide_dma_good_drive(ide_drive_t *);
10620 - int __ide_dma_bad_drive(ide_drive_t *);
10621 --int ide_id_dma_bug(ide_drive_t *);
10622 -
10623 - u8 ide_find_dma_mode(ide_drive_t *, u8);
10624 -
10625 -@@ -1425,7 +1424,6 @@ void ide_dma_lost_irq(ide_drive_t *);
10626 - ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
10627 -
10628 - #else
10629 --static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
10630 - static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
10631 - static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
10632 - static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
10633 -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
10634 -index 5a96a1a..a28daad 100644
10635 ---- a/include/linux/netdevice.h
10636 -+++ b/include/linux/netdevice.h
10637 -@@ -1856,15 +1856,14 @@ static inline int net_gso_ok(int features, int gso_type)
10638 -
10639 - static inline int skb_gso_ok(struct sk_buff *skb, int features)
10640 - {
10641 -- return net_gso_ok(features, skb_shinfo(skb)->gso_type);
10642 -+ return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
10643 -+ (!skb_shinfo(skb)->frag_list || (features & NETIF_F_FRAGLIST));
10644 - }
10645 -
10646 - static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
10647 - {
10648 - return skb_is_gso(skb) &&
10649 - (!skb_gso_ok(skb, dev->features) ||
10650 -- (skb_shinfo(skb)->frag_list &&
10651 -- !(dev->features & NETIF_F_FRAGLIST)) ||
10652 - unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
10653 - }
10654 -
10655 -diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
10656 -index fdffb41..f6b9024 100644
10657 ---- a/include/linux/nfs_fs.h
10658 -+++ b/include/linux/nfs_fs.h
10659 -@@ -473,7 +473,6 @@ extern int nfs_writepages(struct address_space *, struct writeback_control *);
10660 - extern int nfs_flush_incompatible(struct file *file, struct page *page);
10661 - extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
10662 - extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
10663 --extern void nfs_writedata_release(void *);
10664 -
10665 - /*
10666 - * Try to write back everything synchronously (but check the
10667 -@@ -488,7 +487,6 @@ extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
10668 - extern int nfs_commit_inode(struct inode *, int);
10669 - extern struct nfs_write_data *nfs_commitdata_alloc(void);
10670 - extern void nfs_commit_free(struct nfs_write_data *wdata);
10671 --extern void nfs_commitdata_release(void *wdata);
10672 - #else
10673 - static inline int
10674 - nfs_commit_inode(struct inode *inode, int how)
10675 -@@ -507,6 +505,7 @@ nfs_have_writebacks(struct inode *inode)
10676 - * Allocate nfs_write_data structures
10677 - */
10678 - extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages);
10679 -+extern void nfs_writedata_free(struct nfs_write_data *);
10680 -
10681 - /*
10682 - * linux/fs/nfs/read.c
10683 -@@ -515,7 +514,6 @@ extern int nfs_readpage(struct file *, struct page *);
10684 - extern int nfs_readpages(struct file *, struct address_space *,
10685 - struct list_head *, unsigned);
10686 - extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
10687 --extern void nfs_readdata_release(void *data);
10688 - extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
10689 - struct page *);
10690 -
10691 -@@ -523,6 +521,7 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
10692 - * Allocate nfs_read_data structures
10693 - */
10694 - extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages);
10695 -+extern void nfs_readdata_free(struct nfs_read_data *);
10696 -
10697 - /*
10698 - * linux/fs/nfs3proc.c
10699 -diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
10700 -index 9f80a76..d16a304 100644
10701 ---- a/include/net/sctp/sctp.h
10702 -+++ b/include/net/sctp/sctp.h
10703 -@@ -448,6 +448,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
10704 - {
10705 - struct sctp_ulpevent *event = sctp_skb2event(skb);
10706 -
10707 -+ skb_orphan(skb);
10708 - skb->sk = sk;
10709 - skb->destructor = sctp_sock_rfree;
10710 - atomic_add(event->rmem_len, &sk->sk_rmem_alloc);
10711 -diff --git a/include/net/sock.h b/include/net/sock.h
10712 -index 4bb1ff9..9bc2c83 100644
10713 ---- a/include/net/sock.h
10714 -+++ b/include/net/sock.h
10715 -@@ -103,15 +103,15 @@ struct net;
10716 -
10717 - /**
10718 - * struct sock_common - minimal network layer representation of sockets
10719 -+ * @skc_node: main hash linkage for various protocol lookup tables
10720 -+ * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
10721 -+ * @skc_refcnt: reference count
10722 -+ * @skc_hash: hash value used with various protocol lookup tables
10723 - * @skc_family: network address family
10724 - * @skc_state: Connection state
10725 - * @skc_reuse: %SO_REUSEADDR setting
10726 - * @skc_bound_dev_if: bound device index if != 0
10727 -- * @skc_node: main hash linkage for various protocol lookup tables
10728 -- * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
10729 - * @skc_bind_node: bind hash linkage for various protocol lookup tables
10730 -- * @skc_refcnt: reference count
10731 -- * @skc_hash: hash value used with various protocol lookup tables
10732 - * @skc_prot: protocol handlers inside a network family
10733 - * @skc_net: reference to the network namespace of this socket
10734 - *
10735 -@@ -119,17 +119,21 @@ struct net;
10736 - * for struct sock and struct inet_timewait_sock.
10737 - */
10738 - struct sock_common {
10739 -- unsigned short skc_family;
10740 -- volatile unsigned char skc_state;
10741 -- unsigned char skc_reuse;
10742 -- int skc_bound_dev_if;
10743 -+ /*
10744 -+ * first fields are not copied in sock_copy()
10745 -+ */
10746 - union {
10747 - struct hlist_node skc_node;
10748 - struct hlist_nulls_node skc_nulls_node;
10749 - };
10750 -- struct hlist_node skc_bind_node;
10751 - atomic_t skc_refcnt;
10752 -+
10753 - unsigned int skc_hash;
10754 -+ unsigned short skc_family;
10755 -+ volatile unsigned char skc_state;
10756 -+ unsigned char skc_reuse;
10757 -+ int skc_bound_dev_if;
10758 -+ struct hlist_node skc_bind_node;
10759 - struct proto *skc_prot;
10760 - #ifdef CONFIG_NET_NS
10761 - struct net *skc_net;
10762 -@@ -207,15 +211,17 @@ struct sock {
10763 - * don't add nothing before this first member (__sk_common) --acme
10764 - */
10765 - struct sock_common __sk_common;
10766 -+#define sk_node __sk_common.skc_node
10767 -+#define sk_nulls_node __sk_common.skc_nulls_node
10768 -+#define sk_refcnt __sk_common.skc_refcnt
10769 -+
10770 -+#define sk_copy_start __sk_common.skc_hash
10771 -+#define sk_hash __sk_common.skc_hash
10772 - #define sk_family __sk_common.skc_family
10773 - #define sk_state __sk_common.skc_state
10774 - #define sk_reuse __sk_common.skc_reuse
10775 - #define sk_bound_dev_if __sk_common.skc_bound_dev_if
10776 --#define sk_node __sk_common.skc_node
10777 --#define sk_nulls_node __sk_common.skc_nulls_node
10778 - #define sk_bind_node __sk_common.skc_bind_node
10779 --#define sk_refcnt __sk_common.skc_refcnt
10780 --#define sk_hash __sk_common.skc_hash
10781 - #define sk_prot __sk_common.skc_prot
10782 - #define sk_net __sk_common.skc_net
10783 - unsigned char sk_shutdown : 2,
10784 -@@ -1225,6 +1231,8 @@ static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
10785 -
10786 - static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
10787 - {
10788 -+ skb_orphan(skb);
10789 -+ skb_orphan(skb);
10790 - skb->sk = sk;
10791 - skb->destructor = sock_rfree;
10792 - atomic_add(skb->truesize, &sk->sk_rmem_alloc);
10793 -diff --git a/kernel/fork.c b/kernel/fork.c
10794 -index 875ffbd..9c1f52d 100644
10795 ---- a/kernel/fork.c
10796 -+++ b/kernel/fork.c
10797 -@@ -568,18 +568,18 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
10798 - * the value intact in a core dump, and to save the unnecessary
10799 - * trouble otherwise. Userland only wants this done for a sys_exit.
10800 - */
10801 -- if (tsk->clear_child_tid
10802 -- && !(tsk->flags & PF_SIGNALED)
10803 -- && atomic_read(&mm->mm_users) > 1) {
10804 -- u32 __user * tidptr = tsk->clear_child_tid;
10805 -+ if (tsk->clear_child_tid) {
10806 -+ if (!(tsk->flags & PF_SIGNALED) &&
10807 -+ atomic_read(&mm->mm_users) > 1) {
10808 -+ /*
10809 -+ * We don't check the error code - if userspace has
10810 -+ * not set up a proper pointer then tough luck.
10811 -+ */
10812 -+ put_user(0, tsk->clear_child_tid);
10813 -+ sys_futex(tsk->clear_child_tid, FUTEX_WAKE,
10814 -+ 1, NULL, NULL, 0);
10815 -+ }
10816 - tsk->clear_child_tid = NULL;
10817 --
10818 -- /*
10819 -- * We don't check the error code - if userspace has
10820 -- * not set up a proper pointer then tough luck.
10821 -- */
10822 -- put_user(0, tidptr);
10823 -- sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
10824 - }
10825 - }
10826 -
10827 -diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
10828 -index 052ec4d..d089d05 100644
10829 ---- a/kernel/posix-timers.c
10830 -+++ b/kernel/posix-timers.c
10831 -@@ -202,6 +202,12 @@ static int no_timer_create(struct k_itimer *new_timer)
10832 - return -EOPNOTSUPP;
10833 - }
10834 -
10835 -+static int no_nsleep(const clockid_t which_clock, int flags,
10836 -+ struct timespec *tsave, struct timespec __user *rmtp)
10837 -+{
10838 -+ return -EOPNOTSUPP;
10839 -+}
10840 -+
10841 - /*
10842 - * Return nonzero if we know a priori this clockid_t value is bogus.
10843 - */
10844 -@@ -254,6 +260,7 @@ static __init int init_posix_timers(void)
10845 - .clock_get = posix_get_monotonic_raw,
10846 - .clock_set = do_posix_clock_nosettime,
10847 - .timer_create = no_timer_create,
10848 -+ .nsleep = no_nsleep,
10849 - };
10850 -
10851 - register_posix_clock(CLOCK_REALTIME, &clock_realtime);
10852 -diff --git a/kernel/smp.c b/kernel/smp.c
10853 -index ad63d85..94188b8 100644
10854 ---- a/kernel/smp.c
10855 -+++ b/kernel/smp.c
10856 -@@ -57,7 +57,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
10857 - return NOTIFY_BAD;
10858 - break;
10859 -
10860 --#ifdef CONFIG_CPU_HOTPLUG
10861 -+#ifdef CONFIG_HOTPLUG_CPU
10862 - case CPU_UP_CANCELED:
10863 - case CPU_UP_CANCELED_FROZEN:
10864 -
10865 -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
10866 -index 960cbf4..f99b792 100644
10867 ---- a/kernel/trace/ring_buffer.c
10868 -+++ b/kernel/trace/ring_buffer.c
10869 -@@ -695,6 +695,7 @@ ring_buffer_free(struct ring_buffer *buffer)
10870 -
10871 - put_online_cpus();
10872 -
10873 -+ kfree(buffer->buffers);
10874 - free_cpumask_var(buffer->cpumask);
10875 -
10876 - kfree(buffer);
10877 -@@ -2101,7 +2102,6 @@ rb_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
10878 - * the box. Return the padding, and we will release
10879 - * the current locks, and try again.
10880 - */
10881 -- rb_advance_reader(cpu_buffer);
10882 - return event;
10883 -
10884 - case RINGBUF_TYPE_TIME_EXTEND:
10885 -@@ -2218,6 +2218,8 @@ ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
10886 - again:
10887 - spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
10888 - event = rb_buffer_peek(buffer, cpu, ts);
10889 -+ if (event && event->type == RINGBUF_TYPE_PADDING)
10890 -+ rb_advance_reader(cpu_buffer);
10891 - spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
10892 -
10893 - if (event && event->type == RINGBUF_TYPE_PADDING) {
10894 -@@ -2282,12 +2284,9 @@ ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts)
10895 - spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
10896 -
10897 - event = rb_buffer_peek(buffer, cpu, ts);
10898 -- if (!event)
10899 -- goto out_unlock;
10900 --
10901 -- rb_advance_reader(cpu_buffer);
10902 -+ if (event)
10903 -+ rb_advance_reader(cpu_buffer);
10904 -
10905 -- out_unlock:
10906 - spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
10907 -
10908 - out:
10909 -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
10910 -index cda81ec..3928aee 100644
10911 ---- a/kernel/trace/trace.c
10912 -+++ b/kernel/trace/trace.c
10913 -@@ -2993,7 +2993,8 @@ tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)
10914 - break;
10915 - }
10916 -
10917 -- trace_consume(iter);
10918 -+ if (ret != TRACE_TYPE_NO_CONSUME)
10919 -+ trace_consume(iter);
10920 - rem -= count;
10921 - if (!find_next_entry_inc(iter)) {
10922 - rem = 0;
10923 -@@ -4122,8 +4123,11 @@ static void __ftrace_dump(bool disable_tracing)
10924 - iter.pos = -1;
10925 -
10926 - if (find_next_entry_inc(&iter) != NULL) {
10927 -- print_trace_line(&iter);
10928 -- trace_consume(&iter);
10929 -+ int ret;
10930 -+
10931 -+ ret = print_trace_line(&iter);
10932 -+ if (ret != TRACE_TYPE_NO_CONSUME)
10933 -+ trace_consume(&iter);
10934 - }
10935 -
10936 - trace_printk_seq(&iter.seq);
10937 -diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
10938 -index d28687e..8ef6a93 100644
10939 ---- a/kernel/trace/trace_functions_graph.c
10940 -+++ b/kernel/trace/trace_functions_graph.c
10941 -@@ -798,9 +798,16 @@ print_graph_function(struct trace_iterator *iter)
10942 -
10943 - switch (entry->type) {
10944 - case TRACE_GRAPH_ENT: {
10945 -- struct ftrace_graph_ent_entry *field;
10946 -+ /*
10947 -+ * print_graph_entry() may consume the current event,
10948 -+ * thus @field may become invalid, so we need to save it.
10949 -+ * sizeof(struct ftrace_graph_ent_entry) is very small,
10950 -+ * it can be safely saved at the stack.
10951 -+ */
10952 -+ struct ftrace_graph_ent_entry *field, saved;
10953 - trace_assign_type(field, entry);
10954 -- return print_graph_entry(field, s, iter);
10955 -+ saved = *field;
10956 -+ return print_graph_entry(&saved, s, iter);
10957 - }
10958 - case TRACE_GRAPH_RET: {
10959 - struct ftrace_graph_ret_entry *field;
10960 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
10961 -index e83ad2c..2403eb9 100644
10962 ---- a/mm/hugetlb.c
10963 -+++ b/mm/hugetlb.c
10964 -@@ -2341,7 +2341,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed)
10965 - long chg = region_truncate(&inode->i_mapping->private_list, offset);
10966 -
10967 - spin_lock(&inode->i_lock);
10968 -- inode->i_blocks -= blocks_per_huge_page(h);
10969 -+ inode->i_blocks -= (blocks_per_huge_page(h) * freed);
10970 - spin_unlock(&inode->i_lock);
10971 -
10972 - hugetlb_put_quota(inode->i_mapping, (chg - freed));
10973 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
10974 -index 480907c..6bf3cc4 100644
10975 ---- a/mm/page_alloc.c
10976 -+++ b/mm/page_alloc.c
10977 -@@ -858,7 +858,7 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order,
10978 - */
10979 - static int rmqueue_bulk(struct zone *zone, unsigned int order,
10980 - unsigned long count, struct list_head *list,
10981 -- int migratetype)
10982 -+ int migratetype, int cold)
10983 - {
10984 - int i;
10985 -
10986 -@@ -877,7 +877,10 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
10987 - * merge IO requests if the physical pages are ordered
10988 - * properly.
10989 - */
10990 -- list_add(&page->lru, list);
10991 -+ if (likely(cold == 0))
10992 -+ list_add(&page->lru, list);
10993 -+ else
10994 -+ list_add_tail(&page->lru, list);
10995 - set_page_private(page, migratetype);
10996 - list = &page->lru;
10997 - }
10998 -@@ -1077,7 +1080,8 @@ again:
10999 - local_irq_save(flags);
11000 - if (!pcp->count) {
11001 - pcp->count = rmqueue_bulk(zone, 0,
11002 -- pcp->batch, &pcp->list, migratetype);
11003 -+ pcp->batch, &pcp->list,
11004 -+ migratetype, cold);
11005 - if (unlikely(!pcp->count))
11006 - goto failed;
11007 - }
11008 -@@ -1096,7 +1100,8 @@ again:
11009 - /* Allocate more to the pcp list if necessary */
11010 - if (unlikely(&page->lru == &pcp->list)) {
11011 - pcp->count += rmqueue_bulk(zone, 0,
11012 -- pcp->batch, &pcp->list, migratetype);
11013 -+ pcp->batch, &pcp->list,
11014 -+ migratetype, cold);
11015 - page = list_entry(pcp->list.next, struct page, lru);
11016 - }
11017 -
11018 -diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
11019 -index 5f1d210..de56d39 100644
11020 ---- a/net/ax25/ax25_in.c
11021 -+++ b/net/ax25/ax25_in.c
11022 -@@ -437,8 +437,7 @@ free:
11023 - int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
11024 - struct packet_type *ptype, struct net_device *orig_dev)
11025 - {
11026 -- skb->sk = NULL; /* Initially we don't know who it's for */
11027 -- skb->destructor = NULL; /* Who initializes this, dammit?! */
11028 -+ skb_orphan(skb);
11029 -
11030 - if (!net_eq(dev_net(dev), &init_net)) {
11031 - kfree_skb(skb);
11032 -diff --git a/net/core/dev.c b/net/core/dev.c
11033 -index e2e9e4a..e545067 100644
11034 ---- a/net/core/dev.c
11035 -+++ b/net/core/dev.c
11036 -@@ -2284,8 +2284,6 @@ ncls:
11037 - if (!skb)
11038 - goto out;
11039 -
11040 -- skb_orphan(skb);
11041 --
11042 - type = skb->protocol;
11043 - list_for_each_entry_rcu(ptype,
11044 - &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
11045 -@@ -2788,9 +2786,11 @@ static void net_rx_action(struct softirq_action *h)
11046 - * move the instance around on the list at-will.
11047 - */
11048 - if (unlikely(work == weight)) {
11049 -- if (unlikely(napi_disable_pending(n)))
11050 -- __napi_complete(n);
11051 -- else
11052 -+ if (unlikely(napi_disable_pending(n))) {
11053 -+ local_irq_enable();
11054 -+ napi_complete(n);
11055 -+ local_irq_disable();
11056 -+ } else
11057 - list_move_tail(&n->poll_list, list);
11058 - }
11059 -
11060 -diff --git a/net/core/sock.c b/net/core/sock.c
11061 -index 7dbf3ff..3f5e77e 100644
11062 ---- a/net/core/sock.c
11063 -+++ b/net/core/sock.c
11064 -@@ -915,13 +915,19 @@ static inline void sock_lock_init(struct sock *sk)
11065 - af_family_keys + sk->sk_family);
11066 - }
11067 -
11068 -+/*
11069 -+ * Copy all fields from osk to nsk but nsk->sk_refcnt must not change yet,
11070 -+ * even temporarly, because of RCU lookups. sk_node should also be left as is.
11071 -+ */
11072 - static void sock_copy(struct sock *nsk, const struct sock *osk)
11073 - {
11074 - #ifdef CONFIG_SECURITY_NETWORK
11075 - void *sptr = nsk->sk_security;
11076 - #endif
11077 --
11078 -- memcpy(nsk, osk, osk->sk_prot->obj_size);
11079 -+ BUILD_BUG_ON(offsetof(struct sock, sk_copy_start) !=
11080 -+ sizeof(osk->sk_node) + sizeof(osk->sk_refcnt));
11081 -+ memcpy(&nsk->sk_copy_start, &osk->sk_copy_start,
11082 -+ osk->sk_prot->obj_size - offsetof(struct sock, sk_copy_start));
11083 - #ifdef CONFIG_SECURITY_NETWORK
11084 - nsk->sk_security = sptr;
11085 - security_sk_clone(osk, nsk);
11086 -@@ -935,8 +941,23 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
11087 - struct kmem_cache *slab;
11088 -
11089 - slab = prot->slab;
11090 -- if (slab != NULL)
11091 -- sk = kmem_cache_alloc(slab, priority);
11092 -+ if (slab != NULL) {
11093 -+ sk = kmem_cache_alloc(slab, priority & ~__GFP_ZERO);
11094 -+ if (!sk)
11095 -+ return sk;
11096 -+ if (priority & __GFP_ZERO) {
11097 -+ /*
11098 -+ * caches using SLAB_DESTROY_BY_RCU should let
11099 -+ * sk_node.next un-modified. Special care is taken
11100 -+ * when initializing object to zero.
11101 -+ */
11102 -+ if (offsetof(struct sock, sk_node.next) != 0)
11103 -+ memset(sk, 0, offsetof(struct sock, sk_node.next));
11104 -+ memset(&sk->sk_node.pprev, 0,
11105 -+ prot->obj_size - offsetof(struct sock,
11106 -+ sk_node.pprev));
11107 -+ }
11108 -+ }
11109 - else
11110 - sk = kmalloc(prot->obj_size, priority);
11111 -
11112 -@@ -1103,6 +1124,11 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
11113 -
11114 - newsk->sk_err = 0;
11115 - newsk->sk_priority = 0;
11116 -+ /*
11117 -+ * Before updating sk_refcnt, we must commit prior changes to memory
11118 -+ * (Documentation/RCU/rculist_nulls.txt for details)
11119 -+ */
11120 -+ smp_wmb();
11121 - atomic_set(&newsk->sk_refcnt, 2);
11122 -
11123 - /*
11124 -@@ -1794,6 +1820,11 @@ void sock_init_data(struct socket *sock, struct sock *sk)
11125 -
11126 - sk->sk_stamp = ktime_set(-1L, 0);
11127 -
11128 -+ /*
11129 -+ * Before updating sk_refcnt, we must commit prior changes to memory
11130 -+ * (Documentation/RCU/rculist_nulls.txt for details)
11131 -+ */
11132 -+ smp_wmb();
11133 - atomic_set(&sk->sk_refcnt, 1);
11134 - atomic_set(&sk->sk_drops, 0);
11135 - }
11136 -diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
11137 -index 1a58a6f..0bc7bf5 100644
11138 ---- a/net/ipv4/ip_input.c
11139 -+++ b/net/ipv4/ip_input.c
11140 -@@ -437,6 +437,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
11141 - /* Remove any debris in the socket control block */
11142 - memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
11143 -
11144 -+ /* Must drop socket now because of tproxy. */
11145 -+ skb_orphan(skb);
11146 -+
11147 - return NF_HOOK(PF_INET, NF_INET_PRE_ROUTING, skb, dev, NULL,
11148 - ip_rcv_finish);
11149 -
11150 -diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
11151 -index 8f04bd9..c0cd26a 100644
11152 ---- a/net/ipv6/ip6_input.c
11153 -+++ b/net/ipv6/ip6_input.c
11154 -@@ -139,6 +139,9 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
11155 -
11156 - rcu_read_unlock();
11157 -
11158 -+ /* Must drop socket now because of tproxy. */
11159 -+ skb_orphan(skb);
11160 -+
11161 - return NF_HOOK(PF_INET6, NF_INET_PRE_ROUTING, skb, dev, NULL,
11162 - ip6_rcv_finish);
11163 - err:
11164 -diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
11165 -index 3eb5bcc..e0fbcff 100644
11166 ---- a/net/irda/af_irda.c
11167 -+++ b/net/irda/af_irda.c
11168 -@@ -913,9 +913,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
11169 - /* Clean up the original one to keep it in listen state */
11170 - irttp_listen(self->tsap);
11171 -
11172 -- /* Wow ! What is that ? Jean II */
11173 -- skb->sk = NULL;
11174 -- skb->destructor = NULL;
11175 - kfree_skb(skb);
11176 - sk->sk_ack_backlog--;
11177 -
11178 -diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
11179 -index 67c99d2..7ba9661 100644
11180 ---- a/net/irda/ircomm/ircomm_lmp.c
11181 -+++ b/net/irda/ircomm/ircomm_lmp.c
11182 -@@ -196,6 +196,7 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self,
11183 - /* Don't forget to refcount it - see ircomm_tty_do_softint() */
11184 - skb_get(skb);
11185 -
11186 -+ skb_orphan(skb);
11187 - skb->destructor = ircomm_lmp_flow_control;
11188 -
11189 - if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) {
11190 -diff --git a/net/socket.c b/net/socket.c
11191 -index 791d71a..6d47165 100644
11192 ---- a/net/socket.c
11193 -+++ b/net/socket.c
11194 -@@ -736,7 +736,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
11195 - if (more)
11196 - flags |= MSG_MORE;
11197 -
11198 -- return sock->ops->sendpage(sock, page, offset, size, flags);
11199 -+ return kernel_sendpage(sock, page, offset, size, flags);
11200 - }
11201 -
11202 - static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
11203 -diff --git a/net/wireless/scan.c b/net/wireless/scan.c
11204 -index bc7f788..f5be6a8 100644
11205 ---- a/net/wireless/scan.c
11206 -+++ b/net/wireless/scan.c
11207 -@@ -118,7 +118,7 @@ static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
11208 -
11209 - if (!ie1 && !ie2)
11210 - return 0;
11211 -- if (!ie1)
11212 -+ if (!ie1 || !ie2)
11213 - return -1;
11214 -
11215 - r = memcmp(ie1 + 2, ie2 + 2, min(ie1[1], ie2[1]));
11216 -@@ -171,6 +171,8 @@ static bool is_mesh(struct cfg80211_bss *a,
11217 - ie = find_ie(WLAN_EID_MESH_CONFIG,
11218 - a->information_elements,
11219 - a->len_information_elements);
11220 -+ if (!ie)
11221 -+ return false;
11222 - if (ie[1] != IEEE80211_MESH_CONFIG_LEN)
11223 - return false;
11224 -
11225 -diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
11226 -index 96036cf..79d78f4 100644
11227 ---- a/net/xfrm/xfrm_algo.c
11228 -+++ b/net/xfrm/xfrm_algo.c
11229 -@@ -292,8 +292,8 @@ static struct xfrm_algo_desc ealg_list[] = {
11230 - }
11231 - },
11232 - {
11233 -- .name = "cbc(cast128)",
11234 -- .compat = "cast128",
11235 -+ .name = "cbc(cast5)",
11236 -+ .compat = "cast5",
11237 -
11238 - .uinfo = {
11239 - .encr = {
11240 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
11241 -index 18e8dad..1df7692 100644
11242 ---- a/sound/pci/hda/patch_realtek.c
11243 -+++ b/sound/pci/hda/patch_realtek.c
11244 -@@ -13150,6 +13150,8 @@ static int patch_alc269(struct hda_codec *codec)
11245 - set_capture_mixer(spec);
11246 - set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11247 -
11248 -+ spec->vmaster_nid = 0x02;
11249 -+
11250 - codec->patch_ops = alc_patch_ops;
11251 - if (board_config == ALC269_AUTO)
11252 - spec->init_hook = alc269_auto_init;
11253
11254 Deleted: genpatches-2.6/trunk/2.6.31/1005_linux-2.6.30.6.patch
11255 ===================================================================
11256 --- genpatches-2.6/trunk/2.6.31/1005_linux-2.6.30.6.patch 2009-09-09 23:15:13 UTC (rev 1604)
11257 +++ genpatches-2.6/trunk/2.6.31/1005_linux-2.6.30.6.patch 2009-09-09 23:51:20 UTC (rev 1605)
11258 @@ -1,3878 +0,0 @@
11259 -diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
11260 -index eb98738..391f637 100644
11261 ---- a/arch/ia64/kernel/pci-dma.c
11262 -+++ b/arch/ia64/kernel/pci-dma.c
11263 -@@ -67,11 +67,6 @@ iommu_dma_init(void)
11264 -
11265 - int iommu_dma_supported(struct device *dev, u64 mask)
11266 - {
11267 -- struct dma_map_ops *ops = platform_dma_get_ops(dev);
11268 --
11269 -- if (ops->dma_supported)
11270 -- return ops->dma_supported(dev, mask);
11271 --
11272 - /* Copied from i386. Doesn't make much sense, because it will
11273 - only work for pci_alloc_coherent.
11274 - The caller just has to use GFP_DMA in this case. */
11275 -diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
11276 -index b178a1e..40b5cb4 100644
11277 ---- a/arch/powerpc/platforms/ps3/time.c
11278 -+++ b/arch/powerpc/platforms/ps3/time.c
11279 -@@ -21,6 +21,7 @@
11280 - #include <linux/kernel.h>
11281 - #include <linux/platform_device.h>
11282 -
11283 -+#include <asm/firmware.h>
11284 - #include <asm/rtc.h>
11285 - #include <asm/lv1call.h>
11286 - #include <asm/ps3.h>
11287 -@@ -84,6 +85,9 @@ static int __init ps3_rtc_init(void)
11288 - {
11289 - struct platform_device *pdev;
11290 -
11291 -+ if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
11292 -+ return -ENODEV;
11293 -+
11294 - pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
11295 - if (IS_ERR(pdev))
11296 - return PTR_ERR(pdev);
11297 -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
11298 -index a93d1cc..9a9efb0 100644
11299 ---- a/arch/x86/include/asm/kvm_host.h
11300 -+++ b/arch/x86/include/asm/kvm_host.h
11301 -@@ -185,6 +185,7 @@ union kvm_mmu_page_role {
11302 - unsigned access:3;
11303 - unsigned invalid:1;
11304 - unsigned cr4_pge:1;
11305 -+ unsigned nxe:1;
11306 - };
11307 - };
11308 -
11309 -@@ -513,6 +514,8 @@ struct kvm_x86_ops {
11310 - void (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run);
11311 - int (*handle_exit)(struct kvm_run *run, struct kvm_vcpu *vcpu);
11312 - void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
11313 -+ void (*set_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask);
11314 -+ u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask);
11315 - void (*patch_hypercall)(struct kvm_vcpu *vcpu,
11316 - unsigned char *hypercall_addr);
11317 - int (*get_irq)(struct kvm_vcpu *vcpu);
11318 -diff --git a/arch/x86/include/asm/kvm_x86_emulate.h b/arch/x86/include/asm/kvm_x86_emulate.h
11319 -index 6a15973..b7ed2c4 100644
11320 ---- a/arch/x86/include/asm/kvm_x86_emulate.h
11321 -+++ b/arch/x86/include/asm/kvm_x86_emulate.h
11322 -@@ -143,6 +143,9 @@ struct decode_cache {
11323 - struct fetch_cache fetch;
11324 - };
11325 -
11326 -+#define X86_SHADOW_INT_MOV_SS 1
11327 -+#define X86_SHADOW_INT_STI 2
11328 -+
11329 - struct x86_emulate_ctxt {
11330 - /* Register state before/after emulation. */
11331 - struct kvm_vcpu *vcpu;
11332 -@@ -152,6 +155,9 @@ struct x86_emulate_ctxt {
11333 - int mode;
11334 - u32 cs_base;
11335 -
11336 -+ /* interruptibility state, as a result of execution of STI or MOV SS */
11337 -+ int interruptibility;
11338 -+
11339 - /* decode cache */
11340 - struct decode_cache decode;
11341 - };
11342 -diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
11343 -index dbf5445..6ef00ba 100644
11344 ---- a/arch/x86/kernel/apic/ipi.c
11345 -+++ b/arch/x86/kernel/apic/ipi.c
11346 -@@ -106,6 +106,9 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
11347 - unsigned long mask = cpumask_bits(cpumask)[0];
11348 - unsigned long flags;
11349 -
11350 -+ if (WARN_ONCE(!mask, "empty IPI mask"))
11351 -+ return;
11352 -+
11353 - local_irq_save(flags);
11354 - WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]);
11355 - __default_send_IPI_dest_field(mask, vector, apic->dest_logical);
11356 -diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
11357 -index d869b3b..61a592e 100644
11358 ---- a/arch/x86/kernel/cpu/amd.c
11359 -+++ b/arch/x86/kernel/cpu/amd.c
11360 -@@ -356,7 +356,7 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
11361 - #endif
11362 - #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_PCI)
11363 - /* check CPU config space for extended APIC ID */
11364 -- if (c->x86 >= 0xf) {
11365 -+ if (cpu_has_apic && c->x86 >= 0xf) {
11366 - unsigned int val;
11367 - val = read_pci_config(0, 24, 0, 0x68);
11368 - if ((val & ((1 << 17) | (1 << 18))) == ((1 << 17) | (1 << 18)))
11369 -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
11370 -index 32cf11e..d7ce26b 100644
11371 ---- a/arch/x86/kvm/mmu.c
11372 -+++ b/arch/x86/kvm/mmu.c
11373 -@@ -490,16 +490,20 @@ static unsigned long *gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int lpage)
11374 - *
11375 - * If rmapp bit zero is one, (then rmap & ~1) points to a struct kvm_rmap_desc
11376 - * containing more mappings.
11377 -+ *
11378 -+ * Returns the number of rmap entries before the spte was added or zero if
11379 -+ * the spte was not added.
11380 -+ *
11381 - */
11382 --static void rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn, int lpage)
11383 -+static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn, int lpage)
11384 - {
11385 - struct kvm_mmu_page *sp;
11386 - struct kvm_rmap_desc *desc;
11387 - unsigned long *rmapp;
11388 -- int i;
11389 -+ int i, count = 0;
11390 -
11391 - if (!is_rmap_pte(*spte))
11392 -- return;
11393 -+ return count;
11394 - gfn = unalias_gfn(vcpu->kvm, gfn);
11395 - sp = page_header(__pa(spte));
11396 - sp->gfns[spte - sp->spt] = gfn;
11397 -@@ -516,8 +520,10 @@ static void rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn, int lpage)
11398 - } else {
11399 - rmap_printk("rmap_add: %p %llx many->many\n", spte, *spte);
11400 - desc = (struct kvm_rmap_desc *)(*rmapp & ~1ul);
11401 -- while (desc->shadow_ptes[RMAP_EXT-1] && desc->more)
11402 -+ while (desc->shadow_ptes[RMAP_EXT-1] && desc->more) {
11403 - desc = desc->more;
11404 -+ count += RMAP_EXT;
11405 -+ }
11406 - if (desc->shadow_ptes[RMAP_EXT-1]) {
11407 - desc->more = mmu_alloc_rmap_desc(vcpu);
11408 - desc = desc->more;
11409 -@@ -526,6 +532,7 @@ static void rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn, int lpage)
11410 - ;
11411 - desc->shadow_ptes[i] = spte;
11412 - }
11413 -+ return count;
11414 - }
11415 -
11416 - static void rmap_desc_remove_entry(unsigned long *rmapp,
11417 -@@ -755,6 +762,19 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp)
11418 - return young;
11419 - }
11420 -
11421 -+#define RMAP_RECYCLE_THRESHOLD 1000
11422 -+
11423 -+static void rmap_recycle(struct kvm_vcpu *vcpu, gfn_t gfn, int lpage)
11424 -+{
11425 -+ unsigned long *rmapp;
11426 -+
11427 -+ gfn = unalias_gfn(vcpu->kvm, gfn);
11428 -+ rmapp = gfn_to_rmap(vcpu->kvm, gfn, lpage);
11429 -+
11430 -+ kvm_unmap_rmapp(vcpu->kvm, rmapp);
11431 -+ kvm_flush_remote_tlbs(vcpu->kvm);
11432 -+}
11433 -+
11434 - int kvm_age_hva(struct kvm *kvm, unsigned long hva)
11435 - {
11436 - return kvm_handle_hva(kvm, hva, kvm_age_rmapp);
11437 -@@ -1417,24 +1437,25 @@ static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
11438 - */
11439 - void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages)
11440 - {
11441 -+ int used_pages;
11442 -+
11443 -+ used_pages = kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages;
11444 -+ used_pages = max(0, used_pages);
11445 -+
11446 - /*
11447 - * If we set the number of mmu pages to be smaller be than the
11448 - * number of actived pages , we must to free some mmu pages before we
11449 - * change the value
11450 - */
11451 -
11452 -- if ((kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages) >
11453 -- kvm_nr_mmu_pages) {
11454 -- int n_used_mmu_pages = kvm->arch.n_alloc_mmu_pages
11455 -- - kvm->arch.n_free_mmu_pages;
11456 --
11457 -- while (n_used_mmu_pages > kvm_nr_mmu_pages) {
11458 -+ if (used_pages > kvm_nr_mmu_pages) {
11459 -+ while (used_pages > kvm_nr_mmu_pages) {
11460 - struct kvm_mmu_page *page;
11461 -
11462 - page = container_of(kvm->arch.active_mmu_pages.prev,
11463 - struct kvm_mmu_page, link);
11464 - kvm_mmu_zap_page(kvm, page);
11465 -- n_used_mmu_pages--;
11466 -+ used_pages--;
11467 - }
11468 - kvm->arch.n_free_mmu_pages = 0;
11469 - }
11470 -@@ -1770,6 +1791,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
11471 - {
11472 - int was_rmapped = 0;
11473 - int was_writeble = is_writeble_pte(*shadow_pte);
11474 -+ int rmap_count;
11475 -
11476 - pgprintk("%s: spte %llx access %x write_fault %d"
11477 - " user_fault %d gfn %lx\n",
11478 -@@ -1811,9 +1833,11 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
11479 -
11480 - page_header_update_slot(vcpu->kvm, shadow_pte, gfn);
11481 - if (!was_rmapped) {
11482 -- rmap_add(vcpu, shadow_pte, gfn, largepage);
11483 -+ rmap_count = rmap_add(vcpu, shadow_pte, gfn, largepage);
11484 - if (!is_rmap_pte(*shadow_pte))
11485 - kvm_release_pfn_clean(pfn);
11486 -+ if (rmap_count > RMAP_RECYCLE_THRESHOLD)
11487 -+ rmap_recycle(vcpu, gfn, largepage);
11488 - } else {
11489 - if (was_writeble)
11490 - kvm_release_pfn_dirty(pfn);
11491 -@@ -1942,7 +1966,19 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
11492 - vcpu->arch.mmu.root_hpa = INVALID_PAGE;
11493 - }
11494 -
11495 --static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
11496 -+static int mmu_check_root(struct kvm_vcpu *vcpu, gfn_t root_gfn)
11497 -+{
11498 -+ int ret = 0;
11499 -+
11500 -+ if (!kvm_is_visible_gfn(vcpu->kvm, root_gfn)) {
11501 -+ set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
11502 -+ ret = 1;
11503 -+ }
11504 -+
11505 -+ return ret;
11506 -+}
11507 -+
11508 -+static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
11509 - {
11510 - int i;
11511 - gfn_t root_gfn;
11512 -@@ -1957,13 +1993,15 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
11513 - ASSERT(!VALID_PAGE(root));
11514 - if (tdp_enabled)
11515 - direct = 1;
11516 -+ if (mmu_check_root(vcpu, root_gfn))
11517 -+ return 1;
11518 - sp = kvm_mmu_get_page(vcpu, root_gfn, 0,
11519 - PT64_ROOT_LEVEL, direct,
11520 - ACC_ALL, NULL);
11521 - root = __pa(sp->spt);
11522 - ++sp->root_count;
11523 - vcpu->arch.mmu.root_hpa = root;
11524 -- return;
11525 -+ return 0;
11526 - }
11527 - direct = !is_paging(vcpu);
11528 - if (tdp_enabled)
11529 -@@ -1980,6 +2018,8 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
11530 - root_gfn = vcpu->arch.pdptrs[i] >> PAGE_SHIFT;
11531 - } else if (vcpu->arch.mmu.root_level == 0)
11532 - root_gfn = 0;
11533 -+ if (mmu_check_root(vcpu, root_gfn))
11534 -+ return 1;
11535 - sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
11536 - PT32_ROOT_LEVEL, direct,
11537 - ACC_ALL, NULL);
11538 -@@ -1988,6 +2028,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
11539 - vcpu->arch.mmu.pae_root[i] = root | PT_PRESENT_MASK;
11540 - }
11541 - vcpu->arch.mmu.root_hpa = __pa(vcpu->arch.mmu.pae_root);
11542 -+ return 0;
11543 - }
11544 -
11545 - static void mmu_sync_roots(struct kvm_vcpu *vcpu)
11546 -@@ -2006,7 +2047,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)
11547 - for (i = 0; i < 4; ++i) {
11548 - hpa_t root = vcpu->arch.mmu.pae_root[i];
11549 -
11550 -- if (root) {
11551 -+ if (root && VALID_PAGE(root)) {
11552 - root &= PT64_BASE_ADDR_MASK;
11553 - sp = page_header(root);
11554 - mmu_sync_children(vcpu, sp);
11555 -@@ -2290,9 +2331,11 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu)
11556 - goto out;
11557 - spin_lock(&vcpu->kvm->mmu_lock);
11558 - kvm_mmu_free_some_pages(vcpu);
11559 -- mmu_alloc_roots(vcpu);
11560 -+ r = mmu_alloc_roots(vcpu);
11561 - mmu_sync_roots(vcpu);
11562 - spin_unlock(&vcpu->kvm->mmu_lock);
11563 -+ if (r)
11564 -+ goto out;
11565 - kvm_x86_ops->set_cr3(vcpu, vcpu->arch.mmu.root_hpa);
11566 - kvm_mmu_flush_tlb(vcpu);
11567 - out:
11568 -@@ -2638,14 +2681,6 @@ EXPORT_SYMBOL_GPL(kvm_disable_tdp);
11569 -
11570 - static void free_mmu_pages(struct kvm_vcpu *vcpu)
11571 - {
11572 -- struct kvm_mmu_page *sp;
11573 --
11574 -- while (!list_empty(&vcpu->kvm->arch.active_mmu_pages)) {
11575 -- sp = container_of(vcpu->kvm->arch.active_mmu_pages.next,
11576 -- struct kvm_mmu_page, link);
11577 -- kvm_mmu_zap_page(vcpu->kvm, sp);
11578 -- cond_resched();
11579 -- }
11580 - free_page((unsigned long)vcpu->arch.mmu.pae_root);
11581 - }
11582 -
11583 -@@ -2710,7 +2745,6 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
11584 - {
11585 - struct kvm_mmu_page *sp;
11586 -
11587 -- spin_lock(&kvm->mmu_lock);
11588 - list_for_each_entry(sp, &kvm->arch.active_mmu_pages, link) {
11589 - int i;
11590 - u64 *pt;
11591 -@@ -2725,7 +2759,6 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
11592 - pt[i] &= ~PT_WRITABLE_MASK;
11593 - }
11594 - kvm_flush_remote_tlbs(kvm);
11595 -- spin_unlock(&kvm->mmu_lock);
11596 - }
11597 -
11598 - void kvm_mmu_zap_all(struct kvm *kvm)
11599 -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
11600 -index 1f8510c..5700009 100644
11601 ---- a/arch/x86/kvm/svm.c
11602 -+++ b/arch/x86/kvm/svm.c
11603 -@@ -227,6 +227,27 @@ static int is_external_interrupt(u32 info)
11604 - return info == (SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR);
11605 - }
11606 -
11607 -+static u32 svm_get_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
11608 -+{
11609 -+ struct vcpu_svm *svm = to_svm(vcpu);
11610 -+ u32 ret = 0;
11611 -+
11612 -+ if (svm->vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK)
11613 -+ ret |= X86_SHADOW_INT_STI | X86_SHADOW_INT_MOV_SS;
11614 -+ return ret & mask;
11615 -+}
11616 -+
11617 -+static void svm_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
11618 -+{
11619 -+ struct vcpu_svm *svm = to_svm(vcpu);
11620 -+
11621 -+ if (mask == 0)
11622 -+ svm->vmcb->control.int_state &= ~SVM_INTERRUPT_SHADOW_MASK;
11623 -+ else
11624 -+ svm->vmcb->control.int_state |= SVM_INTERRUPT_SHADOW_MASK;
11625 -+
11626 -+}
11627 -+
11628 - static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
11629 - {
11630 - struct vcpu_svm *svm = to_svm(vcpu);
11631 -@@ -240,7 +261,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
11632 - __func__, kvm_rip_read(vcpu), svm->next_rip);
11633 -
11634 - kvm_rip_write(vcpu, svm->next_rip);
11635 -- svm->vmcb->control.int_state &= ~SVM_INTERRUPT_SHADOW_MASK;
11636 -+ svm_set_interrupt_shadow(vcpu, 0);
11637 -
11638 - vcpu->arch.interrupt_window_open = (svm->vcpu.arch.hflags & HF_GIF_MASK);
11639 - }
11640 -@@ -715,6 +736,7 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
11641 - svm->vmcb->control.tsc_offset += delta;
11642 - vcpu->cpu = cpu;
11643 - kvm_migrate_timers(vcpu);
11644 -+ svm->asid_generation = 0;
11645 - }
11646 -
11647 - for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
11648 -@@ -1025,7 +1047,6 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *svm_data)
11649 - svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID;
11650 - }
11651 -
11652 -- svm->vcpu.cpu = svm_data->cpu;
11653 - svm->asid_generation = svm_data->asid_generation;
11654 - svm->vmcb->control.asid = svm_data->next_asid++;
11655 - }
11656 -@@ -2237,8 +2258,8 @@ static void pre_svm_run(struct vcpu_svm *svm)
11657 - struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu);
11658 -
11659 - svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
11660 -- if (svm->vcpu.cpu != cpu ||
11661 -- svm->asid_generation != svm_data->asid_generation)
11662 -+ /* FIXME: handle wraparound of asid_generation */
11663 -+ if (svm->asid_generation != svm_data->asid_generation)
11664 - new_asid(svm, svm_data);
11665 - }
11666 -
11667 -@@ -2667,6 +2688,8 @@ static struct kvm_x86_ops svm_x86_ops = {
11668 - .run = svm_vcpu_run,
11669 - .handle_exit = handle_exit,
11670 - .skip_emulated_instruction = skip_emulated_instruction,
11671 -+ .set_interrupt_shadow = svm_set_interrupt_shadow,
11672 -+ .get_interrupt_shadow = svm_get_interrupt_shadow,
11673 - .patch_hypercall = svm_patch_hypercall,
11674 - .get_irq = svm_get_irq,
11675 - .set_irq = svm_set_irq,
11676 -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
11677 -index fa0adcd..1a0d5cd 100644
11678 ---- a/arch/x86/kvm/vmx.c
11679 -+++ b/arch/x86/kvm/vmx.c
11680 -@@ -732,23 +732,45 @@ static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
11681 - vmcs_writel(GUEST_RFLAGS, rflags);
11682 - }
11683 -
11684 -+static u32 vmx_get_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
11685 -+{
11686 -+ u32 interruptibility = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
11687 -+ int ret = 0;
11688 -+
11689 -+ if (interruptibility & GUEST_INTR_STATE_STI)
11690 -+ ret |= X86_SHADOW_INT_STI;
11691 -+ if (interruptibility & GUEST_INTR_STATE_MOV_SS)
11692 -+ ret |= X86_SHADOW_INT_MOV_SS;
11693 -+
11694 -+ return ret & mask;
11695 -+}
11696 -+
11697 -+static void vmx_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
11698 -+{
11699 -+ u32 interruptibility_old = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
11700 -+ u32 interruptibility = interruptibility_old;
11701 -+
11702 -+ interruptibility &= ~(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS);
11703 -+
11704 -+ if (mask & X86_SHADOW_INT_MOV_SS)
11705 -+ interruptibility |= GUEST_INTR_STATE_MOV_SS;
11706 -+ if (mask & X86_SHADOW_INT_STI)
11707 -+ interruptibility |= GUEST_INTR_STATE_STI;
11708 -+
11709 -+ if ((interruptibility != interruptibility_old))
11710 -+ vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, interruptibility);
11711 -+}
11712 -+
11713 - static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
11714 - {
11715 - unsigned long rip;
11716 -- u32 interruptibility;
11717 -
11718 - rip = kvm_rip_read(vcpu);
11719 - rip += vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
11720 - kvm_rip_write(vcpu, rip);
11721 -
11722 -- /*
11723 -- * We emulated an instruction, so temporary interrupt blocking
11724 -- * should be removed, if set.
11725 -- */
11726 -- interruptibility = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
11727 -- if (interruptibility & 3)
11728 -- vmcs_write32(GUEST_INTERRUPTIBILITY_INFO,
11729 -- interruptibility & ~3);
11730 -+ /* skipping an emulated instruction also counts */
11731 -+ vmx_set_interrupt_shadow(vcpu, 0);
11732 - vcpu->arch.interrupt_window_open = 1;
11733 - }
11734 -
11735 -@@ -3738,6 +3760,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
11736 - .run = vmx_vcpu_run,
11737 - .handle_exit = kvm_handle_exit,
11738 - .skip_emulated_instruction = skip_emulated_instruction,
11739 -+ .set_interrupt_shadow = vmx_set_interrupt_shadow,
11740 -+ .get_interrupt_shadow = vmx_get_interrupt_shadow,
11741 - .patch_hypercall = vmx_patch_hypercall,
11742 - .get_irq = vmx_get_irq,
11743 - .set_irq = vmx_inject_irq,
11744 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
11745 -index ee4714b..0b1bfc6 100644
11746 ---- a/arch/x86/kvm/x86.c
11747 -+++ b/arch/x86/kvm/x86.c
11748 -@@ -523,6 +523,9 @@ static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
11749 - efer |= vcpu->arch.shadow_efer & EFER_LMA;
11750 -
11751 - vcpu->arch.shadow_efer = efer;
11752 -+
11753 -+ vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;
11754 -+ kvm_mmu_reset_context(vcpu);
11755 - }
11756 -
11757 - void kvm_enable_efer_bits(u64 mask)
11758 -@@ -703,11 +706,48 @@ static bool msr_mtrr_valid(unsigned msr)
11759 - return false;
11760 - }
11761 -
11762 -+static bool valid_pat_type(unsigned t)
11763 -+{
11764 -+ return t < 8 && (1 << t) & 0xf3; /* 0, 1, 4, 5, 6, 7 */
11765 -+}
11766 -+
11767 -+static bool valid_mtrr_type(unsigned t)
11768 -+{
11769 -+ return t < 8 && (1 << t) & 0x73; /* 0, 1, 4, 5, 6 */
11770 -+}
11771 -+
11772 -+static bool mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data)
11773 -+{
11774 -+ int i;
11775 -+
11776 -+ if (!msr_mtrr_valid(msr))
11777 -+ return false;
11778 -+
11779 -+ if (msr == MSR_IA32_CR_PAT) {
11780 -+ for (i = 0; i < 8; i++)
11781 -+ if (!valid_pat_type((data >> (i * 8)) & 0xff))
11782 -+ return false;
11783 -+ return true;
11784 -+ } else if (msr == MSR_MTRRdefType) {
11785 -+ if (data & ~0xcff)
11786 -+ return false;
11787 -+ return valid_mtrr_type(data & 0xff);
11788 -+ } else if (msr >= MSR_MTRRfix64K_00000 && msr <= MSR_MTRRfix4K_F8000) {
11789 -+ for (i = 0; i < 8 ; i++)
11790 -+ if (!valid_mtrr_type((data >> (i * 8)) & 0xff))
11791 -+ return false;
11792 -+ return true;
11793 -+ }
11794 -+
11795 -+ /* variable MTRRs */
11796 -+ return valid_mtrr_type(data & 0xff);
11797 -+}
11798 -+
11799 - static int set_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 data)
11800 - {
11801 - u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges;
11802 -
11803 -- if (!msr_mtrr_valid(msr))
11804 -+ if (!mtrr_valid(vcpu, msr, data))
11805 - return 1;
11806 -
11807 - if (msr == MSR_MTRRdefType) {
11808 -@@ -895,6 +935,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
11809 - case MSR_IA32_LASTINTFROMIP:
11810 - case MSR_IA32_LASTINTTOIP:
11811 - case MSR_VM_HSAVE_PA:
11812 -+ case MSR_P6_EVNTSEL0:
11813 -+ case MSR_P6_EVNTSEL1:
11814 -+ case MSR_K7_EVNTSEL0:
11815 - data = 0;
11816 - break;
11817 - case MSR_MTRRcap:
11818 -@@ -1074,14 +1117,13 @@ long kvm_arch_dev_ioctl(struct file *filp,
11819 - if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list))
11820 - goto out;
11821 - r = -E2BIG;
11822 -- if (n < num_msrs_to_save)
11823 -+ if (n < msr_list.nmsrs)
11824 - goto out;
11825 - r = -EFAULT;
11826 - if (copy_to_user(user_msr_list->indices, &msrs_to_save,
11827 - num_msrs_to_save * sizeof(u32)))
11828 - goto out;
11829 -- if (copy_to_user(user_msr_list->indices
11830 -- + num_msrs_to_save * sizeof(u32),
11831 -+ if (copy_to_user(user_msr_list->indices + num_msrs_to_save,
11832 - &emulated_msrs,
11833 - ARRAY_SIZE(emulated_msrs) * sizeof(u32)))
11834 - goto out;
11835 -@@ -1250,9 +1292,12 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
11836 - bit(X86_FEATURE_VME) | bit(X86_FEATURE_DE) |
11837 - bit(X86_FEATURE_PSE) | bit(X86_FEATURE_TSC) |
11838 - bit(X86_FEATURE_MSR) | bit(X86_FEATURE_PAE) |
11839 -+ bit(X86_FEATURE_MCE) |
11840 - bit(X86_FEATURE_CX8) | bit(X86_FEATURE_APIC) |
11841 -- bit(X86_FEATURE_SEP) | bit(X86_FEATURE_PGE) |
11842 -- bit(X86_FEATURE_CMOV) | bit(X86_FEATURE_PSE36) |
11843 -+ bit(X86_FEATURE_SEP) | bit(X86_FEATURE_MTRR) |
11844 -+ bit(X86_FEATURE_PGE) | bit(X86_FEATURE_MCA) |
11845 -+ bit(X86_FEATURE_CMOV) | bit(X86_FEATURE_PAT) |
11846 -+ bit(X86_FEATURE_PSE36) |
11847 - bit(X86_FEATURE_CLFLSH) | bit(X86_FEATURE_MMX) |
11848 - bit(X86_FEATURE_FXSR) | bit(X86_FEATURE_XMM) |
11849 - bit(X86_FEATURE_XMM2) | bit(X86_FEATURE_SELFSNOOP);
11850 -@@ -1608,10 +1653,12 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
11851 - return -EINVAL;
11852 -
11853 - down_write(&kvm->slots_lock);
11854 -+ spin_lock(&kvm->mmu_lock);
11855 -
11856 - kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages);
11857 - kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages;
11858 -
11859 -+ spin_unlock(&kvm->mmu_lock);
11860 - up_write(&kvm->slots_lock);
11861 - return 0;
11862 - }
11863 -@@ -1787,7 +1834,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
11864 -
11865 - /* If nothing is dirty, don't bother messing with page tables. */
11866 - if (is_dirty) {
11867 -+ spin_lock(&kvm->mmu_lock);
11868 - kvm_mmu_slot_remove_write_access(kvm, log->slot);
11869 -+ spin_unlock(&kvm->mmu_lock);
11870 - kvm_flush_remote_tlbs(kvm);
11871 - memslot = &kvm->memslots[log->slot];
11872 - n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;
11873 -@@ -2362,7 +2411,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
11874 - u16 error_code,
11875 - int emulation_type)
11876 - {
11877 -- int r;
11878 -+ int r, shadow_mask;
11879 - struct decode_cache *c;
11880 -
11881 - kvm_clear_exception_queue(vcpu);
11882 -@@ -2411,6 +2460,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
11883 - }
11884 -
11885 - r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
11886 -+ shadow_mask = vcpu->arch.emulate_ctxt.interruptibility;
11887 -+
11888 -+ if (r == 0)
11889 -+ kvm_x86_ops->set_interrupt_shadow(vcpu, shadow_mask);
11890 -
11891 - if (vcpu->arch.pio.string)
11892 - return EMULATE_DO_MMIO;
11893 -@@ -4419,12 +4472,14 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
11894 - }
11895 - }
11896 -
11897 -+ spin_lock(&kvm->mmu_lock);
11898 - if (!kvm->arch.n_requested_mmu_pages) {
11899 - unsigned int nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm);
11900 - kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages);
11901 - }
11902 -
11903 - kvm_mmu_slot_remove_write_access(kvm, mem->slot);
11904 -+ spin_unlock(&kvm->mmu_lock);
11905 - kvm_flush_remote_tlbs(kvm);
11906 -
11907 - return 0;
11908 -@@ -4433,6 +4488,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
11909 - void kvm_arch_flush_shadow(struct kvm *kvm)
11910 - {
11911 - kvm_mmu_zap_all(kvm);
11912 -+ kvm_reload_remote_mmus(kvm);
11913 - }
11914 -
11915 - int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
11916 -diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
11917 -index ca91749..d80126f 100644
11918 ---- a/arch/x86/kvm/x86_emulate.c
11919 -+++ b/arch/x86/kvm/x86_emulate.c
11920 -@@ -1349,6 +1349,20 @@ static inline int writeback(struct x86_emulate_ctxt *ctxt,
11921 - return 0;
11922 - }
11923 -
11924 -+void toggle_interruptibility(struct x86_emulate_ctxt *ctxt, u32 mask)
11925 -+{
11926 -+ u32 int_shadow = kvm_x86_ops->get_interrupt_shadow(ctxt->vcpu, mask);
11927 -+ /*
11928 -+ * an sti; sti; sequence only disable interrupts for the first
11929 -+ * instruction. So, if the last instruction, be it emulated or
11930 -+ * not, left the system with the INT_STI flag enabled, it
11931 -+ * means that the last instruction is an sti. We should not
11932 -+ * leave the flag on in this case. The same goes for mov ss
11933 -+ */
11934 -+ if (!(int_shadow & mask))
11935 -+ ctxt->interruptibility = mask;
11936 -+}
11937 -+
11938 - int
11939 - x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
11940 - {
11941 -@@ -1360,6 +1374,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
11942 - int io_dir_in;
11943 - int rc = 0;
11944 -
11945 -+ ctxt->interruptibility = 0;
11946 -+
11947 - /* Shadow copy of register state. Committed on successful emulation.
11948 - * NOTE: we can copy them from vcpu as x86_decode_insn() doesn't
11949 - * modify them.
11950 -@@ -1609,6 +1625,9 @@ special_insn:
11951 - int err;
11952 -
11953 - sel = c->src.val;
11954 -+ if (c->modrm_reg == VCPU_SREG_SS)
11955 -+ toggle_interruptibility(ctxt, X86_SHADOW_INT_MOV_SS);
11956 -+
11957 - if (c->modrm_reg <= 5) {
11958 - type_bits = (c->modrm_reg == 1) ? 9 : 1;
11959 - err = kvm_load_segment_descriptor(ctxt->vcpu, sel,
11960 -@@ -1865,6 +1884,7 @@ special_insn:
11961 - c->dst.type = OP_NONE; /* Disable writeback. */
11962 - break;
11963 - case 0xfb: /* sti */
11964 -+ toggle_interruptibility(ctxt, X86_SHADOW_INT_STI);
11965 - ctxt->eflags |= X86_EFLAGS_IF;
11966 - c->dst.type = OP_NONE; /* Disable writeback. */
11967 - break;
11968 -diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
11969 -index 821e970..c814e14 100644
11970 ---- a/arch/x86/mm/tlb.c
11971 -+++ b/arch/x86/mm/tlb.c
11972 -@@ -183,18 +183,17 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask,
11973 -
11974 - f->flush_mm = mm;
11975 - f->flush_va = va;
11976 -- cpumask_andnot(to_cpumask(f->flush_cpumask),
11977 -- cpumask, cpumask_of(smp_processor_id()));
11978 --
11979 -- /*
11980 -- * We have to send the IPI only to
11981 -- * CPUs affected.
11982 -- */
11983 -- apic->send_IPI_mask(to_cpumask(f->flush_cpumask),
11984 -- INVALIDATE_TLB_VECTOR_START + sender);
11985 -+ if (cpumask_andnot(to_cpumask(f->flush_cpumask), cpumask, cpumask_of(smp_processor_id()))) {
11986 -+ /*
11987 -+ * We have to send the IPI only to
11988 -+ * CPUs affected.
11989 -+ */
11990 -+ apic->send_IPI_mask(to_cpumask(f->flush_cpumask),
11991 -+ INVALIDATE_TLB_VECTOR_START + sender);
11992 -
11993 -- while (!cpumask_empty(to_cpumask(f->flush_cpumask)))
11994 -- cpu_relax();
11995 -+ while (!cpumask_empty(to_cpumask(f->flush_cpumask)))
11996 -+ cpu_relax();
11997 -+ }
11998 -
11999 - f->flush_mm = NULL;
12000 - f->flush_va = 0;
12001 -diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
12002 -index 39838c6..31adda1 100644
12003 ---- a/drivers/acpi/processor_thermal.c
12004 -+++ b/drivers/acpi/processor_thermal.c
12005 -@@ -66,7 +66,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
12006 - if (pr->limit.thermal.tx > tx)
12007 - tx = pr->limit.thermal.tx;
12008 -
12009 -- result = acpi_processor_set_throttling(pr, tx);
12010 -+ result = acpi_processor_set_throttling(pr, tx, false);
12011 - if (result)
12012 - goto end;
12013 - }
12014 -@@ -421,12 +421,12 @@ processor_set_cur_state(struct thermal_cooling_device *cdev,
12015 -
12016 - if (state <= max_pstate) {
12017 - if (pr->flags.throttling && pr->throttling.state)
12018 -- result = acpi_processor_set_throttling(pr, 0);
12019 -+ result = acpi_processor_set_throttling(pr, 0, false);
12020 - cpufreq_set_cur_state(pr->id, state);
12021 - } else {
12022 - cpufreq_set_cur_state(pr->id, max_pstate);
12023 - result = acpi_processor_set_throttling(pr,
12024 -- state - max_pstate);
12025 -+ state - max_pstate, false);
12026 - }
12027 - return result;
12028 - }
12029 -diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
12030 -index 2275437..841be4e 100644
12031 ---- a/drivers/acpi/processor_throttling.c
12032 -+++ b/drivers/acpi/processor_throttling.c
12033 -@@ -62,7 +62,8 @@ struct throttling_tstate {
12034 - #define THROTTLING_POSTCHANGE (2)
12035 -
12036 - static int acpi_processor_get_throttling(struct acpi_processor *pr);
12037 --int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
12038 -+int acpi_processor_set_throttling(struct acpi_processor *pr,
12039 -+ int state, bool force);
12040 -
12041 - static int acpi_processor_update_tsd_coord(void)
12042 - {
12043 -@@ -361,7 +362,7 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
12044 - */
12045 - target_state = throttling_limit;
12046 - }
12047 -- return acpi_processor_set_throttling(pr, target_state);
12048 -+ return acpi_processor_set_throttling(pr, target_state, false);
12049 - }
12050 -
12051 - /*
12052 -@@ -842,7 +843,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
12053 - ACPI_WARNING((AE_INFO,
12054 - "Invalid throttling state, reset"));
12055 - state = 0;
12056 -- ret = acpi_processor_set_throttling(pr, state);
12057 -+ ret = acpi_processor_set_throttling(pr, state, true);
12058 - if (ret)
12059 - return ret;
12060 - }
12061 -@@ -915,7 +916,7 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
12062 - }
12063 -
12064 - static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
12065 -- int state)
12066 -+ int state, bool force)
12067 - {
12068 - u32 value = 0;
12069 - u32 duty_mask = 0;
12070 -@@ -930,7 +931,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
12071 - if (!pr->flags.throttling)
12072 - return -ENODEV;
12073 -
12074 -- if (state == pr->throttling.state)
12075 -+ if (!force && (state == pr->throttling.state))
12076 - return 0;
12077 -
12078 - if (state < pr->throttling_platform_limit)
12079 -@@ -988,7 +989,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
12080 - }
12081 -
12082 - static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
12083 -- int state)
12084 -+ int state, bool force)
12085 - {
12086 - int ret;
12087 - acpi_integer value;
12088 -@@ -1002,7 +1003,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
12089 - if (!pr->flags.throttling)
12090 - return -ENODEV;
12091 -
12092 -- if (state == pr->throttling.state)
12093 -+ if (!force && (state == pr->throttling.state))
12094 - return 0;
12095 -
12096 - if (state < pr->throttling_platform_limit)
12097 -@@ -1018,7 +1019,8 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
12098 - return 0;
12099 - }
12100 -
12101 --int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
12102 -+int acpi_processor_set_throttling(struct acpi_processor *pr,
12103 -+ int state, bool force)
12104 - {
12105 - cpumask_var_t saved_mask;
12106 - int ret = 0;
12107 -@@ -1070,7 +1072,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
12108 - /* FIXME: use work_on_cpu() */
12109 - set_cpus_allowed_ptr(current, cpumask_of(pr->id));
12110 - ret = p_throttling->acpi_processor_set_throttling(pr,
12111 -- t_state.target_state);
12112 -+ t_state.target_state, force);
12113 - } else {
12114 - /*
12115 - * When the T-state coordination is SW_ALL or HW_ALL,
12116 -@@ -1103,7 +1105,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
12117 - set_cpus_allowed_ptr(current, cpumask_of(i));
12118 - ret = match_pr->throttling.
12119 - acpi_processor_set_throttling(
12120 -- match_pr, t_state.target_state);
12121 -+ match_pr, t_state.target_state, force);
12122 - }
12123 - }
12124 - /*
12125 -@@ -1201,7 +1203,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
12126 - ACPI_DEBUG_PRINT((ACPI_DB_INFO,
12127 - "Disabling throttling (was T%d)\n",
12128 - pr->throttling.state));
12129 -- result = acpi_processor_set_throttling(pr, 0);
12130 -+ result = acpi_processor_set_throttling(pr, 0, false);
12131 - if (result)
12132 - goto end;
12133 - }
12134 -@@ -1307,7 +1309,7 @@ static ssize_t acpi_processor_write_throttling(struct file *file,
12135 - if (strcmp(tmpbuf, charp) != 0)
12136 - return -EINVAL;
12137 -
12138 -- result = acpi_processor_set_throttling(pr, state_val);
12139 -+ result = acpi_processor_set_throttling(pr, state_val, false);
12140 - if (result)
12141 - return result;
12142 -
12143 -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
12144 -index c924230..7b2f499 100644
12145 ---- a/drivers/ata/libata-core.c
12146 -+++ b/drivers/ata/libata-core.c
12147 -@@ -4271,6 +4271,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
12148 - { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA },
12149 - { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA },
12150 -
12151 -+ /* this one allows HPA unlocking but fails IOs on the area */
12152 -+ { "OCZ-VERTEX", "1.30", ATA_HORKAGE_BROKEN_HPA },
12153 -+
12154 - /* Devices which report 1 sector over size HPA */
12155 - { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, },
12156 - { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
12157 -diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
12158 -index 19e0bc6..504f849 100644
12159 ---- a/drivers/media/video/gspca/ov534.c
12160 -+++ b/drivers/media/video/gspca/ov534.c
12161 -@@ -832,9 +832,11 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame,
12162 - __u32 this_pts;
12163 - u16 this_fid;
12164 - int remaining_len = len;
12165 -+ int payload_len;
12166 -
12167 -+ payload_len = (sd->sensor == SENSOR_OV772X) ? 2048 : 2040;
12168 - do {
12169 -- len = min(remaining_len, 2040); /*fixme: was 2048*/
12170 -+ len = min(remaining_len, payload_len);
12171 -
12172 - /* Payloads are prefixed with a UVC-style header. We
12173 - consider a frame to start when the FID toggles, or the PTS
12174 -diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
12175 -index 16a4138..4567e90 100644
12176 ---- a/drivers/net/ehea/ehea.h
12177 -+++ b/drivers/net/ehea/ehea.h
12178 -@@ -40,7 +40,7 @@
12179 - #include <asm/io.h>
12180 -
12181 - #define DRV_NAME "ehea"
12182 --#define DRV_VERSION "EHEA_0101"
12183 -+#define DRV_VERSION "EHEA_0102"
12184 -
12185 - /* eHEA capability flags */
12186 - #define DLPAR_PORT_ADD_REM 1
12187 -diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
12188 -index 0a7a288..9bc4775 100644
12189 ---- a/drivers/net/ehea/ehea_main.c
12190 -+++ b/drivers/net/ehea/ehea_main.c
12191 -@@ -1545,6 +1545,9 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
12192 - {
12193 - int ret, i;
12194 -
12195 -+ if (pr->qp)
12196 -+ netif_napi_del(&pr->napi);
12197 -+
12198 - ret = ehea_destroy_qp(pr->qp);
12199 -
12200 - if (!ret) {
12201 -diff --git a/drivers/net/wireless/ar9170/main.c b/drivers/net/wireless/ar9170/main.c
12202 -index 5996ff9..f839c83 100644
12203 ---- a/drivers/net/wireless/ar9170/main.c
12204 -+++ b/drivers/net/wireless/ar9170/main.c
12205 -@@ -1486,13 +1486,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue,
12206 - int ret;
12207 -
12208 - mutex_lock(&ar->mutex);
12209 -- if ((param) && !(queue > ar->hw->queues)) {
12210 -+ if (queue < __AR9170_NUM_TXQ) {
12211 - memcpy(&ar->edcf[ar9170_qos_hwmap[queue]],
12212 - param, sizeof(*param));
12213 -
12214 - ret = ar9170_set_qos(ar);
12215 -- } else
12216 -+ } else {
12217 - ret = -EINVAL;
12218 -+ }
12219 -
12220 - mutex_unlock(&ar->mutex);
12221 - return ret;
12222 -diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
12223 -index 2ad9faf..fc3a95f 100644
12224 ---- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
12225 -+++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
12226 -@@ -53,22 +53,31 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
12227 - switch (state) {
12228 - case RFKILL_STATE_UNBLOCKED:
12229 - if (iwl_is_rfkill_hw(priv)) {
12230 -+ /* pass error to rfkill core, make it state HARD
12231 -+ * BLOCKED (rfkill->mutex taken) and disable
12232 -+ * software kill switch */
12233 - err = -EBUSY;
12234 -- goto out_unlock;
12235 -+ priv->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
12236 - }
12237 - iwl_radio_kill_sw_enable_radio(priv);
12238 - break;
12239 - case RFKILL_STATE_SOFT_BLOCKED:
12240 - iwl_radio_kill_sw_disable_radio(priv);
12241 -+ /* rfkill->mutex is taken */
12242 -+ if (priv->rfkill->state == RFKILL_STATE_HARD_BLOCKED) {
12243 -+ /* force rfkill core state to be SOFT BLOCKED,
12244 -+ * otherwise core will be unable to disable software
12245 -+ * kill switch */
12246 -+ priv->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
12247 -+ }
12248 - break;
12249 - default:
12250 - IWL_WARN(priv, "we received unexpected RFKILL state %d\n",
12251 - state);
12252 - break;
12253 - }
12254 --out_unlock:
12255 -- mutex_unlock(&priv->mutex);
12256 -
12257 -+ mutex_unlock(&priv->mutex);
12258 - return err;
12259 - }
12260 -
12261 -@@ -132,14 +141,11 @@ void iwl_rfkill_set_hw_state(struct iwl_priv *priv)
12262 - if (!priv->rfkill)
12263 - return;
12264 -
12265 -- if (iwl_is_rfkill_hw(priv)) {
12266 -+ if (iwl_is_rfkill_sw(priv))
12267 -+ rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED);
12268 -+ else if (iwl_is_rfkill_hw(priv))
12269 - rfkill_force_state(priv->rfkill, RFKILL_STATE_HARD_BLOCKED);
12270 -- return;
12271 -- }
12272 --
12273 -- if (!iwl_is_rfkill_sw(priv))
12274 -- rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED);
12275 - else
12276 -- rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED);
12277 -+ rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED);
12278 - }
12279 - EXPORT_SYMBOL(iwl_rfkill_set_hw_state);
12280 -diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
12281 -index 44ab03a..da2e2d4 100644
12282 ---- a/drivers/net/wireless/iwlwifi/iwl-sta.c
12283 -+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
12284 -@@ -560,6 +560,8 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
12285 - unsigned long flags;
12286 -
12287 - spin_lock_irqsave(&priv->sta_lock, flags);
12288 -+ IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
12289 -+ keyconf->keyidx);
12290 -
12291 - if (!test_and_clear_bit(keyconf->keyidx, &priv->ucode_key_table))
12292 - IWL_ERR(priv, "index %d not used in uCode key table.\n",
12293 -@@ -567,6 +569,11 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
12294 -
12295 - priv->default_wep_key--;
12296 - memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0]));
12297 -+ if (iwl_is_rfkill(priv)) {
12298 -+ IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n");
12299 -+ spin_unlock_irqrestore(&priv->sta_lock, flags);
12300 -+ return 0;
12301 -+ }
12302 - ret = iwl_send_static_wepkey_cmd(priv, 1);
12303 - IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n",
12304 - keyconf->keyidx, ret);
12305 -@@ -847,6 +854,11 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
12306 - priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
12307 - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
12308 -
12309 -+ if (iwl_is_rfkill(priv)) {
12310 -+ IWL_DEBUG_WEP(priv, "Not sending REPLY_ADD_STA command because RFKILL enabled. \n");
12311 -+ spin_unlock_irqrestore(&priv->sta_lock, flags);
12312 -+ return 0;
12313 -+ }
12314 - ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
12315 - spin_unlock_irqrestore(&priv->sta_lock, flags);
12316 - return ret;
12317 -diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
12318 -index 84bd6f1..c242b54 100644
12319 ---- a/drivers/net/wireless/rt2x00/rt2x00.h
12320 -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
12321 -@@ -814,13 +814,15 @@ struct rt2x00_dev {
12322 - static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
12323 - const unsigned int word, u32 *data)
12324 - {
12325 -- *data = rt2x00dev->rf[word];
12326 -+ BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
12327 -+ *data = rt2x00dev->rf[word - 1];
12328 - }
12329 -
12330 - static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
12331 - const unsigned int word, u32 data)
12332 - {
12333 -- rt2x00dev->rf[word] = data;
12334 -+ BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
12335 -+ rt2x00dev->rf[word - 1] = data;
12336 - }
12337 -
12338 - /*
12339 -diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
12340 -index 043b208..f215a59 100644
12341 ---- a/drivers/platform/x86/wmi.c
12342 -+++ b/drivers/platform/x86/wmi.c
12343 -@@ -270,7 +270,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
12344 - acpi_status status;
12345 - struct acpi_object_list input;
12346 - union acpi_object params[3];
12347 -- char method[4] = "WM";
12348 -+ char method[5] = "WM";
12349 -
12350 - if (!find_guid(guid_string, &wblock))
12351 - return AE_ERROR;
12352 -@@ -328,8 +328,8 @@ struct acpi_buffer *out)
12353 - acpi_status status, wc_status = AE_ERROR;
12354 - struct acpi_object_list input, wc_input;
12355 - union acpi_object wc_params[1], wq_params[1];
12356 -- char method[4];
12357 -- char wc_method[4] = "WC";
12358 -+ char method[5];
12359 -+ char wc_method[5] = "WC";
12360 -
12361 - if (!guid_string || !out)
12362 - return AE_BAD_PARAMETER;
12363 -@@ -410,7 +410,7 @@ const struct acpi_buffer *in)
12364 - acpi_handle handle;
12365 - struct acpi_object_list input;
12366 - union acpi_object params[2];
12367 -- char method[4] = "WS";
12368 -+ char method[5] = "WS";
12369 -
12370 - if (!guid_string || !in)
12371 - return AE_BAD_DATA;
12372 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
12373 -index f3da592..35a1386 100644
12374 ---- a/drivers/scsi/mpt2sas/mpt2sas_base.c
12375 -+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
12376 -@@ -119,6 +119,64 @@ _base_fault_reset_work(struct work_struct *work)
12377 - spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
12378 - }
12379 -
12380 -+/**
12381 -+ * mpt2sas_base_start_watchdog - start the fault_reset_work_q
12382 -+ * @ioc: pointer to scsi command object
12383 -+ * Context: sleep.
12384 -+ *
12385 -+ * Return nothing.
12386 -+ */
12387 -+void
12388 -+mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc)
12389 -+{
12390 -+ unsigned long flags;
12391 -+
12392 -+ if (ioc->fault_reset_work_q)
12393 -+ return;
12394 -+
12395 -+ /* initialize fault polling */
12396 -+ INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work);
12397 -+ snprintf(ioc->fault_reset_work_q_name,
12398 -+ sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id);
12399 -+ ioc->fault_reset_work_q =
12400 -+ create_singlethread_workqueue(ioc->fault_reset_work_q_name);
12401 -+ if (!ioc->fault_reset_work_q) {
12402 -+ printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n",
12403 -+ ioc->name, __func__, __LINE__);
12404 -+ return;
12405 -+ }
12406 -+ spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
12407 -+ if (ioc->fault_reset_work_q)
12408 -+ queue_delayed_work(ioc->fault_reset_work_q,
12409 -+ &ioc->fault_reset_work,
12410 -+ msecs_to_jiffies(FAULT_POLLING_INTERVAL));
12411 -+ spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
12412 -+}
12413 -+
12414 -+/**
12415 -+ * mpt2sas_base_stop_watchdog - stop the fault_reset_work_q
12416 -+ * @ioc: pointer to scsi command object
12417 -+ * Context: sleep.
12418 -+ *
12419 -+ * Return nothing.
12420 -+ */
12421 -+void
12422 -+mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc)
12423 -+{
12424 -+ unsigned long flags;
12425 -+ struct workqueue_struct *wq;
12426 -+
12427 -+ spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
12428 -+ wq = ioc->fault_reset_work_q;
12429 -+ ioc->fault_reset_work_q = NULL;
12430 -+ spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
12431 -+ if (wq) {
12432 -+ if (!cancel_delayed_work(&ioc->fault_reset_work))
12433 -+ flush_workqueue(wq);
12434 -+ destroy_workqueue(wq);
12435 -+ }
12436 -+}
12437 -+
12438 - #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
12439 - /**
12440 - * _base_sas_ioc_info - verbose translation of the ioc status
12441 -@@ -440,6 +498,10 @@ _base_sas_log_info(struct MPT2SAS_ADAPTER *ioc , u32 log_info)
12442 - if (sas_loginfo.dw.bus_type != 3 /*SAS*/)
12443 - return;
12444 -
12445 -+ /* each nexus loss loginfo */
12446 -+ if (log_info == 0x31170000)
12447 -+ return;
12448 -+
12449 - /* eat the loginfos associated with task aborts */
12450 - if (ioc->ignore_loginfos && (log_info == 30050000 || log_info ==
12451 - 0x31140000 || log_info == 0x31130000))
12452 -@@ -1109,7 +1171,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
12453 - }
12454 - }
12455 -
12456 -- pci_set_drvdata(pdev, ioc->shost);
12457 - _base_mask_interrupts(ioc);
12458 - r = _base_enable_msix(ioc);
12459 - if (r)
12460 -@@ -1132,7 +1193,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
12461 - ioc->pci_irq = -1;
12462 - pci_release_selected_regions(ioc->pdev, ioc->bars);
12463 - pci_disable_device(pdev);
12464 -- pci_set_drvdata(pdev, NULL);
12465 - return r;
12466 - }
12467 -
12468 -@@ -3191,7 +3251,6 @@ mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc)
12469 - ioc->chip_phys = 0;
12470 - pci_release_selected_regions(ioc->pdev, ioc->bars);
12471 - pci_disable_device(pdev);
12472 -- pci_set_drvdata(pdev, NULL);
12473 - return;
12474 - }
12475 -
12476 -@@ -3205,7 +3264,6 @@ int
12477 - mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
12478 - {
12479 - int r, i;
12480 -- unsigned long flags;
12481 -
12482 - dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
12483 - __func__));
12484 -@@ -3214,6 +3272,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
12485 - if (r)
12486 - return r;
12487 -
12488 -+ pci_set_drvdata(ioc->pdev, ioc->shost);
12489 - r = _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET);
12490 - if (r)
12491 - goto out_free_resources;
12492 -@@ -3288,23 +3347,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
12493 - if (r)
12494 - goto out_free_resources;
12495 -
12496 -- /* initialize fault polling */
12497 -- INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work);
12498 -- snprintf(ioc->fault_reset_work_q_name,
12499 -- sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id);
12500 -- ioc->fault_reset_work_q =
12501 -- create_singlethread_workqueue(ioc->fault_reset_work_q_name);
12502 -- if (!ioc->fault_reset_work_q) {
12503 -- printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n",
12504 -- ioc->name, __func__, __LINE__);
12505 -- goto out_free_resources;
12506 -- }
12507 -- spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
12508 -- if (ioc->fault_reset_work_q)
12509 -- queue_delayed_work(ioc->fault_reset_work_q,
12510 -- &ioc->fault_reset_work,
12511 -- msecs_to_jiffies(FAULT_POLLING_INTERVAL));
12512 -- spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
12513 -+ mpt2sas_base_start_watchdog(ioc);
12514 - return 0;
12515 -
12516 - out_free_resources:
12517 -@@ -3312,6 +3355,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
12518 - ioc->remove_host = 1;
12519 - mpt2sas_base_free_resources(ioc);
12520 - _base_release_memory_pools(ioc);
12521 -+ pci_set_drvdata(ioc->pdev, NULL);
12522 - kfree(ioc->tm_cmds.reply);
12523 - kfree(ioc->transport_cmds.reply);
12524 - kfree(ioc->config_cmds.reply);
12525 -@@ -3337,22 +3381,14 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
12526 - void
12527 - mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc)
12528 - {
12529 -- unsigned long flags;
12530 -- struct workqueue_struct *wq;
12531 -
12532 - dexitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
12533 - __func__));
12534 -
12535 -- spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
12536 -- wq = ioc->fault_reset_work_q;
12537 -- ioc->fault_reset_work_q = NULL;
12538 -- spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
12539 -- if (!cancel_delayed_work(&ioc->fault_reset_work))
12540 -- flush_workqueue(wq);
12541 -- destroy_workqueue(wq);
12542 --
12543 -+ mpt2sas_base_stop_watchdog(ioc);
12544 - mpt2sas_base_free_resources(ioc);
12545 - _base_release_memory_pools(ioc);
12546 -+ pci_set_drvdata(ioc->pdev, NULL);
12547 - kfree(ioc->pfacts);
12548 - kfree(ioc->ctl_cmds.reply);
12549 - kfree(ioc->base_cmds.reply);
12550 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
12551 -index 36b1d10..1dd7c9a 100644
12552 ---- a/drivers/scsi/mpt2sas/mpt2sas_base.h
12553 -+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
12554 -@@ -672,6 +672,8 @@ typedef void (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID,
12555 -
12556 - /* base shared API */
12557 - extern struct list_head mpt2sas_ioc_list;
12558 -+void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
12559 -+void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
12560 -
12561 - int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
12562 - void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
12563 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c
12564 -index 58cfb97..6ddee16 100644
12565 ---- a/drivers/scsi/mpt2sas/mpt2sas_config.c
12566 -+++ b/drivers/scsi/mpt2sas/mpt2sas_config.c
12567 -@@ -236,17 +236,25 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
12568 - Mpi2ConfigRequest_t *config_request;
12569 - int r;
12570 - u8 retry_count;
12571 -- u8 issue_reset;
12572 -+ u8 issue_host_reset = 0;
12573 - u16 wait_state_count;
12574 -
12575 -+ mutex_lock(&ioc->config_cmds.mutex);
12576 - if (ioc->config_cmds.status != MPT2_CMD_NOT_USED) {
12577 - printk(MPT2SAS_ERR_FMT "%s: config_cmd in use\n",
12578 - ioc->name, __func__);
12579 -+ mutex_unlock(&ioc->config_cmds.mutex);
12580 - return -EAGAIN;
12581 - }
12582 - retry_count = 0;
12583 -
12584 - retry_config:
12585 -+ if (retry_count) {
12586 -+ if (retry_count > 2) /* attempt only 2 retries */
12587 -+ return -EFAULT;
12588 -+ printk(MPT2SAS_INFO_FMT "%s: attempting retry (%d)\n",
12589 -+ ioc->name, __func__, retry_count);
12590 -+ }
12591 - wait_state_count = 0;
12592 - ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
12593 - while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
12594 -@@ -254,8 +262,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
12595 - printk(MPT2SAS_ERR_FMT
12596 - "%s: failed due to ioc not operational\n",
12597 - ioc->name, __func__);
12598 -- ioc->config_cmds.status = MPT2_CMD_NOT_USED;
12599 -- return -EFAULT;
12600 -+ r = -EFAULT;
12601 -+ goto out;
12602 - }
12603 - ssleep(1);
12604 - ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
12605 -@@ -271,8 +279,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
12606 - if (!smid) {
12607 - printk(MPT2SAS_ERR_FMT "%s: failed obtaining a smid\n",
12608 - ioc->name, __func__);
12609 -- ioc->config_cmds.status = MPT2_CMD_NOT_USED;
12610 -- return -EAGAIN;
12611 -+ r = -EAGAIN;
12612 -+ goto out;
12613 - }
12614 -
12615 - r = 0;
12616 -@@ -292,9 +300,15 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
12617 - ioc->name, __func__);
12618 - _debug_dump_mf(mpi_request,
12619 - sizeof(Mpi2ConfigRequest_t)/4);
12620 -- if (!(ioc->config_cmds.status & MPT2_CMD_RESET))
12621 -- issue_reset = 1;
12622 -- goto issue_host_reset;
12623 -+ retry_count++;
12624 -+ if (ioc->config_cmds.smid == smid)
12625 -+ mpt2sas_base_free_smid(ioc, smid);
12626 -+ if ((ioc->shost_recovery) ||
12627 -+ (ioc->config_cmds.status & MPT2_CMD_RESET))
12628 -+ goto retry_config;
12629 -+ issue_host_reset = 1;
12630 -+ r = -EFAULT;
12631 -+ goto out;
12632 - }
12633 - if (ioc->config_cmds.status & MPT2_CMD_REPLY_VALID)
12634 - memcpy(mpi_reply, ioc->config_cmds.reply,
12635 -@@ -302,21 +316,13 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
12636 - if (retry_count)
12637 - printk(MPT2SAS_INFO_FMT "%s: retry completed!!\n",
12638 - ioc->name, __func__);
12639 -+out:
12640 - ioc->config_cmds.status = MPT2_CMD_NOT_USED;
12641 -- return r;
12642 --
12643 -- issue_host_reset:
12644 -- if (issue_reset)
12645 -+ mutex_unlock(&ioc->config_cmds.mutex);
12646 -+ if (issue_host_reset)
12647 - mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP,
12648 - FORCE_BIG_HAMMER);
12649 -- ioc->config_cmds.status = MPT2_CMD_NOT_USED;
12650 -- if (!retry_count) {
12651 -- printk(MPT2SAS_INFO_FMT "%s: attempting retry\n",
12652 -- ioc->name, __func__);
12653 -- retry_count++;
12654 -- goto retry_config;
12655 -- }
12656 -- return -EFAULT;
12657 -+ return r;
12658 - }
12659 -
12660 - /**
12661 -@@ -375,7 +381,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
12662 - int r;
12663 - struct config_request mem;
12664 -
12665 -- mutex_lock(&ioc->config_cmds.mutex);
12666 - memset(config_page, 0, sizeof(Mpi2ManufacturingPage0_t));
12667 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12668 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12669 -@@ -417,7 +422,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
12670 - _config_free_config_dma_memory(ioc, &mem);
12671 -
12672 - out:
12673 -- mutex_unlock(&ioc->config_cmds.mutex);
12674 - return r;
12675 - }
12676 -
12677 -@@ -438,7 +442,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc,
12678 - int r;
12679 - struct config_request mem;
12680 -
12681 -- mutex_lock(&ioc->config_cmds.mutex);
12682 - memset(config_page, 0, sizeof(Mpi2BiosPage2_t));
12683 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12684 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12685 -@@ -480,7 +483,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc,
12686 - _config_free_config_dma_memory(ioc, &mem);
12687 -
12688 - out:
12689 -- mutex_unlock(&ioc->config_cmds.mutex);
12690 - return r;
12691 - }
12692 -
12693 -@@ -501,7 +503,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12694 - int r;
12695 - struct config_request mem;
12696 -
12697 -- mutex_lock(&ioc->config_cmds.mutex);
12698 - memset(config_page, 0, sizeof(Mpi2BiosPage3_t));
12699 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12700 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12701 -@@ -543,7 +544,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12702 - _config_free_config_dma_memory(ioc, &mem);
12703 -
12704 - out:
12705 -- mutex_unlock(&ioc->config_cmds.mutex);
12706 - return r;
12707 - }
12708 -
12709 -@@ -564,7 +564,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc,
12710 - int r;
12711 - struct config_request mem;
12712 -
12713 -- mutex_lock(&ioc->config_cmds.mutex);
12714 - memset(config_page, 0, sizeof(Mpi2IOUnitPage0_t));
12715 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12716 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12717 -@@ -606,7 +605,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc,
12718 - _config_free_config_dma_memory(ioc, &mem);
12719 -
12720 - out:
12721 -- mutex_unlock(&ioc->config_cmds.mutex);
12722 - return r;
12723 - }
12724 -
12725 -@@ -627,7 +625,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
12726 - int r;
12727 - struct config_request mem;
12728 -
12729 -- mutex_lock(&ioc->config_cmds.mutex);
12730 - memset(config_page, 0, sizeof(Mpi2IOUnitPage1_t));
12731 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12732 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12733 -@@ -669,7 +666,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
12734 - _config_free_config_dma_memory(ioc, &mem);
12735 -
12736 - out:
12737 -- mutex_unlock(&ioc->config_cmds.mutex);
12738 - return r;
12739 - }
12740 -
12741 -@@ -690,7 +686,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
12742 - int r;
12743 - struct config_request mem;
12744 -
12745 -- mutex_lock(&ioc->config_cmds.mutex);
12746 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12747 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12748 - mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
12749 -@@ -732,7 +727,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
12750 - _config_free_config_dma_memory(ioc, &mem);
12751 -
12752 - out:
12753 -- mutex_unlock(&ioc->config_cmds.mutex);
12754 - return r;
12755 - }
12756 -
12757 -@@ -753,7 +747,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc,
12758 - int r;
12759 - struct config_request mem;
12760 -
12761 -- mutex_lock(&ioc->config_cmds.mutex);
12762 - memset(config_page, 0, sizeof(Mpi2IOCPage8_t));
12763 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12764 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12765 -@@ -795,7 +788,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc,
12766 - _config_free_config_dma_memory(ioc, &mem);
12767 -
12768 - out:
12769 -- mutex_unlock(&ioc->config_cmds.mutex);
12770 - return r;
12771 - }
12772 -
12773 -@@ -818,7 +810,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12774 - int r;
12775 - struct config_request mem;
12776 -
12777 -- mutex_lock(&ioc->config_cmds.mutex);
12778 - memset(config_page, 0, sizeof(Mpi2SasDevicePage0_t));
12779 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12780 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12781 -@@ -863,7 +854,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12782 - _config_free_config_dma_memory(ioc, &mem);
12783 -
12784 - out:
12785 -- mutex_unlock(&ioc->config_cmds.mutex);
12786 - return r;
12787 - }
12788 -
12789 -@@ -886,7 +876,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12790 - int r;
12791 - struct config_request mem;
12792 -
12793 -- mutex_lock(&ioc->config_cmds.mutex);
12794 - memset(config_page, 0, sizeof(Mpi2SasDevicePage1_t));
12795 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12796 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12797 -@@ -931,7 +920,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12798 - _config_free_config_dma_memory(ioc, &mem);
12799 -
12800 - out:
12801 -- mutex_unlock(&ioc->config_cmds.mutex);
12802 - return r;
12803 - }
12804 -
12805 -@@ -953,7 +941,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys)
12806 - Mpi2ConfigReply_t mpi_reply;
12807 - Mpi2SasIOUnitPage0_t config_page;
12808 -
12809 -- mutex_lock(&ioc->config_cmds.mutex);
12810 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12811 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12812 - mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
12813 -@@ -1002,7 +989,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys)
12814 - _config_free_config_dma_memory(ioc, &mem);
12815 -
12816 - out:
12817 -- mutex_unlock(&ioc->config_cmds.mutex);
12818 - return r;
12819 - }
12820 -
12821 -@@ -1026,8 +1012,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12822 - Mpi2ConfigRequest_t mpi_request;
12823 - int r;
12824 - struct config_request mem;
12825 --
12826 -- mutex_lock(&ioc->config_cmds.mutex);
12827 - memset(config_page, 0, sz);
12828 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12829 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12830 -@@ -1070,7 +1054,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12831 - _config_free_config_dma_memory(ioc, &mem);
12832 -
12833 - out:
12834 -- mutex_unlock(&ioc->config_cmds.mutex);
12835 - return r;
12836 - }
12837 -
12838 -@@ -1095,7 +1078,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12839 - int r;
12840 - struct config_request mem;
12841 -
12842 -- mutex_lock(&ioc->config_cmds.mutex);
12843 - memset(config_page, 0, sz);
12844 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12845 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12846 -@@ -1138,7 +1120,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12847 - _config_free_config_dma_memory(ioc, &mem);
12848 -
12849 - out:
12850 -- mutex_unlock(&ioc->config_cmds.mutex);
12851 - return r;
12852 - }
12853 -
12854 -@@ -1161,7 +1142,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12855 - int r;
12856 - struct config_request mem;
12857 -
12858 -- mutex_lock(&ioc->config_cmds.mutex);
12859 - memset(config_page, 0, sizeof(Mpi2ExpanderPage0_t));
12860 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12861 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12862 -@@ -1206,7 +1186,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12863 - _config_free_config_dma_memory(ioc, &mem);
12864 -
12865 - out:
12866 -- mutex_unlock(&ioc->config_cmds.mutex);
12867 - return r;
12868 - }
12869 -
12870 -@@ -1230,7 +1209,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12871 - int r;
12872 - struct config_request mem;
12873 -
12874 -- mutex_lock(&ioc->config_cmds.mutex);
12875 - memset(config_page, 0, sizeof(Mpi2ExpanderPage1_t));
12876 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12877 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12878 -@@ -1277,7 +1255,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12879 - _config_free_config_dma_memory(ioc, &mem);
12880 -
12881 - out:
12882 -- mutex_unlock(&ioc->config_cmds.mutex);
12883 - return r;
12884 - }
12885 -
12886 -@@ -1300,7 +1277,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12887 - int r;
12888 - struct config_request mem;
12889 -
12890 -- mutex_lock(&ioc->config_cmds.mutex);
12891 - memset(config_page, 0, sizeof(Mpi2SasEnclosurePage0_t));
12892 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12893 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12894 -@@ -1345,7 +1321,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12895 - _config_free_config_dma_memory(ioc, &mem);
12896 -
12897 - out:
12898 -- mutex_unlock(&ioc->config_cmds.mutex);
12899 - return r;
12900 - }
12901 -
12902 -@@ -1367,7 +1342,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12903 - int r;
12904 - struct config_request mem;
12905 -
12906 -- mutex_lock(&ioc->config_cmds.mutex);
12907 - memset(config_page, 0, sizeof(Mpi2SasPhyPage0_t));
12908 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12909 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12910 -@@ -1413,7 +1387,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12911 - _config_free_config_dma_memory(ioc, &mem);
12912 -
12913 - out:
12914 -- mutex_unlock(&ioc->config_cmds.mutex);
12915 - return r;
12916 - }
12917 -
12918 -@@ -1435,7 +1408,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12919 - int r;
12920 - struct config_request mem;
12921 -
12922 -- mutex_lock(&ioc->config_cmds.mutex);
12923 - memset(config_page, 0, sizeof(Mpi2SasPhyPage1_t));
12924 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12925 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12926 -@@ -1481,7 +1453,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12927 - _config_free_config_dma_memory(ioc, &mem);
12928 -
12929 - out:
12930 -- mutex_unlock(&ioc->config_cmds.mutex);
12931 - return r;
12932 - }
12933 -
12934 -@@ -1505,7 +1476,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc,
12935 - int r;
12936 - struct config_request mem;
12937 -
12938 -- mutex_lock(&ioc->config_cmds.mutex);
12939 - memset(config_page, 0, sizeof(Mpi2RaidVolPage1_t));
12940 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12941 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12942 -@@ -1548,7 +1518,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc,
12943 - _config_free_config_dma_memory(ioc, &mem);
12944 -
12945 - out:
12946 -- mutex_unlock(&ioc->config_cmds.mutex);
12947 - return r;
12948 - }
12949 -
12950 -@@ -1572,7 +1541,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle,
12951 - struct config_request mem;
12952 - u16 ioc_status;
12953 -
12954 -- mutex_lock(&ioc->config_cmds.mutex);
12955 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12956 - *num_pds = 0;
12957 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12958 -@@ -1620,7 +1588,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle,
12959 - _config_free_config_dma_memory(ioc, &mem);
12960 -
12961 - out:
12962 -- mutex_unlock(&ioc->config_cmds.mutex);
12963 - return r;
12964 - }
12965 -
12966 -@@ -1645,7 +1612,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc,
12967 - int r;
12968 - struct config_request mem;
12969 -
12970 -- mutex_lock(&ioc->config_cmds.mutex);
12971 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12972 - memset(config_page, 0, sz);
12973 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12974 -@@ -1687,7 +1653,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc,
12975 - _config_free_config_dma_memory(ioc, &mem);
12976 -
12977 - out:
12978 -- mutex_unlock(&ioc->config_cmds.mutex);
12979 - return r;
12980 - }
12981 -
12982 -@@ -1711,7 +1676,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12983 - int r;
12984 - struct config_request mem;
12985 -
12986 -- mutex_lock(&ioc->config_cmds.mutex);
12987 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
12988 - memset(config_page, 0, sizeof(Mpi2RaidPhysDiskPage0_t));
12989 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
12990 -@@ -1754,7 +1718,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
12991 - _config_free_config_dma_memory(ioc, &mem);
12992 -
12993 - out:
12994 -- mutex_unlock(&ioc->config_cmds.mutex);
12995 - return r;
12996 - }
12997 -
12998 -@@ -1778,7 +1741,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
12999 - struct config_request mem;
13000 - u16 ioc_status;
13001 -
13002 -- mutex_lock(&ioc->config_cmds.mutex);
13003 - *volume_handle = 0;
13004 - memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
13005 - mpi_request.Function = MPI2_FUNCTION_CONFIG;
13006 -@@ -1842,7 +1804,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
13007 - _config_free_config_dma_memory(ioc, &mem);
13008 -
13009 - out:
13010 -- mutex_unlock(&ioc->config_cmds.mutex);
13011 - return r;
13012 - }
13013 -
13014 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
13015 -index e3a7967..7dacc68 100644
13016 ---- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
13017 -+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
13018 -@@ -2560,6 +2560,10 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
13019 - char *desc_ioc_state = NULL;
13020 - char *desc_scsi_status = NULL;
13021 - char *desc_scsi_state = ioc->tmp_string;
13022 -+ u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
13023 -+
13024 -+ if (log_info == 0x31170000)
13025 -+ return;
13026 -
13027 - switch (ioc_status) {
13028 - case MPI2_IOCSTATUS_SUCCESS:
13029 -@@ -3205,7 +3209,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
13030 - __le64 sas_address;
13031 - int i;
13032 - unsigned long flags;
13033 -- struct _sas_port *mpt2sas_port;
13034 -+ struct _sas_port *mpt2sas_port = NULL;
13035 - int rc = 0;
13036 -
13037 - if (!handle)
13038 -@@ -3297,12 +3301,20 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
13039 - &expander_pg1, i, handle))) {
13040 - printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13041 - ioc->name, __FILE__, __LINE__, __func__);
13042 -- continue;
13043 -+ rc = -1;
13044 -+ goto out_fail;
13045 - }
13046 - sas_expander->phy[i].handle = handle;
13047 - sas_expander->phy[i].phy_id = i;
13048 -- mpt2sas_transport_add_expander_phy(ioc, &sas_expander->phy[i],
13049 -- expander_pg1, sas_expander->parent_dev);
13050 -+
13051 -+ if ((mpt2sas_transport_add_expander_phy(ioc,
13052 -+ &sas_expander->phy[i], expander_pg1,
13053 -+ sas_expander->parent_dev))) {
13054 -+ printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13055 -+ ioc->name, __FILE__, __LINE__, __func__);
13056 -+ rc = -1;
13057 -+ goto out_fail;
13058 -+ }
13059 - }
13060 -
13061 - if (sas_expander->enclosure_handle) {
13062 -@@ -3319,8 +3331,9 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
13063 -
13064 - out_fail:
13065 -
13066 -- if (sas_expander)
13067 -- kfree(sas_expander->phy);
13068 -+ if (mpt2sas_port)
13069 -+ mpt2sas_transport_port_remove(ioc, sas_expander->sas_address,
13070 -+ sas_expander->parent_handle);
13071 - kfree(sas_expander);
13072 - return rc;
13073 - }
13074 -@@ -3442,12 +3455,11 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd)
13075 - sas_device->hidden_raid_component = is_pd;
13076 -
13077 - /* get enclosure_logical_id */
13078 -- if (!(mpt2sas_config_get_enclosure_pg0(ioc, &mpi_reply, &enclosure_pg0,
13079 -- MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE,
13080 -- sas_device->enclosure_handle))) {
13081 -+ if (sas_device->enclosure_handle && !(mpt2sas_config_get_enclosure_pg0(
13082 -+ ioc, &mpi_reply, &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE,
13083 -+ sas_device->enclosure_handle)))
13084 - sas_device->enclosure_logical_id =
13085 - le64_to_cpu(enclosure_pg0.EnclosureLogicalID);
13086 -- }
13087 -
13088 - /* get device name */
13089 - sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName);
13090 -@@ -4029,12 +4041,6 @@ _scsih_sas_volume_add(struct MPT2SAS_ADAPTER *ioc,
13091 - u16 handle = le16_to_cpu(element->VolDevHandle);
13092 - int rc;
13093 -
13094 --#if 0 /* RAID_HACKS */
13095 -- if (le32_to_cpu(event_data->Flags) &
13096 -- MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
13097 -- return;
13098 --#endif
13099 --
13100 - mpt2sas_config_get_volume_wwid(ioc, handle, &wwid);
13101 - if (!wwid) {
13102 - printk(MPT2SAS_ERR_FMT
13103 -@@ -4089,12 +4095,6 @@ _scsih_sas_volume_delete(struct MPT2SAS_ADAPTER *ioc,
13104 - unsigned long flags;
13105 - struct MPT2SAS_TARGET *sas_target_priv_data;
13106 -
13107 --#if 0 /* RAID_HACKS */
13108 -- if (le32_to_cpu(event_data->Flags) &
13109 -- MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
13110 -- return;
13111 --#endif
13112 --
13113 - spin_lock_irqsave(&ioc->raid_device_lock, flags);
13114 - raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
13115 - spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
13116 -@@ -4207,14 +4207,38 @@ _scsih_sas_pd_add(struct MPT2SAS_ADAPTER *ioc,
13117 - struct _sas_device *sas_device;
13118 - unsigned long flags;
13119 - u16 handle = le16_to_cpu(element->PhysDiskDevHandle);
13120 -+ Mpi2ConfigReply_t mpi_reply;
13121 -+ Mpi2SasDevicePage0_t sas_device_pg0;
13122 -+ u32 ioc_status;
13123 -
13124 - spin_lock_irqsave(&ioc->sas_device_lock, flags);
13125 - sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
13126 - spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
13127 -- if (sas_device)
13128 -+ if (sas_device) {
13129 - sas_device->hidden_raid_component = 1;
13130 -- else
13131 -- _scsih_add_device(ioc, handle, 0, 1);
13132 -+ return;
13133 -+ }
13134 -+
13135 -+ if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
13136 -+ MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
13137 -+ printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13138 -+ ioc->name, __FILE__, __LINE__, __func__);
13139 -+ return;
13140 -+ }
13141 -+
13142 -+ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
13143 -+ MPI2_IOCSTATUS_MASK;
13144 -+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
13145 -+ printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13146 -+ ioc->name, __FILE__, __LINE__, __func__);
13147 -+ return;
13148 -+ }
13149 -+
13150 -+ _scsih_link_change(ioc,
13151 -+ le16_to_cpu(sas_device_pg0.ParentDevHandle),
13152 -+ handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
13153 -+
13154 -+ _scsih_add_device(ioc, handle, 0, 1);
13155 - }
13156 -
13157 - #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
13158 -@@ -4314,12 +4338,15 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
13159 - {
13160 - Mpi2EventIrConfigElement_t *element;
13161 - int i;
13162 -+ u8 foreign_config;
13163 -
13164 - #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
13165 - if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
13166 - _scsih_sas_ir_config_change_event_debug(ioc, event_data);
13167 -
13168 - #endif
13169 -+ foreign_config = (le32_to_cpu(event_data->Flags) &
13170 -+ MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0;
13171 -
13172 - element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
13173 - for (i = 0; i < event_data->NumElements; i++, element++) {
13174 -@@ -4327,11 +4354,13 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
13175 - switch (element->ReasonCode) {
13176 - case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED:
13177 - case MPI2_EVENT_IR_CHANGE_RC_ADDED:
13178 -- _scsih_sas_volume_add(ioc, element);
13179 -+ if (!foreign_config)
13180 -+ _scsih_sas_volume_add(ioc, element);
13181 - break;
13182 - case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED:
13183 - case MPI2_EVENT_IR_CHANGE_RC_REMOVED:
13184 -- _scsih_sas_volume_delete(ioc, element);
13185 -+ if (!foreign_config)
13186 -+ _scsih_sas_volume_delete(ioc, element);
13187 - break;
13188 - case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED:
13189 - _scsih_sas_pd_hide(ioc, element);
13190 -@@ -4450,6 +4479,9 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
13191 - u32 state;
13192 - struct _sas_device *sas_device;
13193 - unsigned long flags;
13194 -+ Mpi2ConfigReply_t mpi_reply;
13195 -+ Mpi2SasDevicePage0_t sas_device_pg0;
13196 -+ u32 ioc_status;
13197 -
13198 - if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED)
13199 - return;
13200 -@@ -4466,22 +4498,40 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
13201 - spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
13202 -
13203 - switch (state) {
13204 --#if 0
13205 -- case MPI2_RAID_PD_STATE_OFFLINE:
13206 -- if (sas_device)
13207 -- _scsih_remove_device(ioc, handle);
13208 -- break;
13209 --#endif
13210 - case MPI2_RAID_PD_STATE_ONLINE:
13211 - case MPI2_RAID_PD_STATE_DEGRADED:
13212 - case MPI2_RAID_PD_STATE_REBUILDING:
13213 - case MPI2_RAID_PD_STATE_OPTIMAL:
13214 -- if (sas_device)
13215 -+ if (sas_device) {
13216 - sas_device->hidden_raid_component = 1;
13217 -- else
13218 -- _scsih_add_device(ioc, handle, 0, 1);
13219 -+ return;
13220 -+ }
13221 -+
13222 -+ if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply,
13223 -+ &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
13224 -+ handle))) {
13225 -+ printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13226 -+ ioc->name, __FILE__, __LINE__, __func__);
13227 -+ return;
13228 -+ }
13229 -+
13230 -+ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
13231 -+ MPI2_IOCSTATUS_MASK;
13232 -+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
13233 -+ printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
13234 -+ ioc->name, __FILE__, __LINE__, __func__);
13235 -+ return;
13236 -+ }
13237 -+
13238 -+ _scsih_link_change(ioc,
13239 -+ le16_to_cpu(sas_device_pg0.ParentDevHandle),
13240 -+ handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
13241 -+
13242 -+ _scsih_add_device(ioc, handle, 0, 1);
13243 -+
13244 - break;
13245 -
13246 -+ case MPI2_RAID_PD_STATE_OFFLINE:
13247 - case MPI2_RAID_PD_STATE_NOT_CONFIGURED:
13248 - case MPI2_RAID_PD_STATE_NOT_COMPATIBLE:
13249 - case MPI2_RAID_PD_STATE_HOT_SPARE:
13250 -@@ -5549,6 +5599,7 @@ scsih_suspend(struct pci_dev *pdev, pm_message_t state)
13251 - struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
13252 - u32 device_state;
13253 -
13254 -+ mpt2sas_base_stop_watchdog(ioc);
13255 - flush_scheduled_work();
13256 - scsi_block_requests(shost);
13257 - device_state = pci_choose_state(pdev, state);
13258 -@@ -5591,6 +5642,7 @@ scsih_resume(struct pci_dev *pdev)
13259 -
13260 - mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET);
13261 - scsi_unblock_requests(shost);
13262 -+ mpt2sas_base_start_watchdog(ioc);
13263 - return 0;
13264 - }
13265 - #endif /* CONFIG_PM */
13266 -diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
13267 -index e7d4479..798f362 100644
13268 ---- a/drivers/usb/core/hcd.h
13269 -+++ b/drivers/usb/core/hcd.h
13270 -@@ -224,6 +224,10 @@ struct hc_driver {
13271 - void (*relinquish_port)(struct usb_hcd *, int);
13272 - /* has a port been handed over to a companion? */
13273 - int (*port_handed_over)(struct usb_hcd *, int);
13274 -+
13275 -+ /* CLEAR_TT_BUFFER completion callback */
13276 -+ void (*clear_tt_buffer_complete)(struct usb_hcd *,
13277 -+ struct usb_host_endpoint *);
13278 - };
13279 -
13280 - extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
13281 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
13282 -index be86ae3..2fc5b57 100644
13283 ---- a/drivers/usb/core/hub.c
13284 -+++ b/drivers/usb/core/hub.c
13285 -@@ -448,10 +448,10 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
13286 - * talking to TTs must queue control transfers (not just bulk and iso), so
13287 - * both can talk to the same hub concurrently.
13288 - */
13289 --static void hub_tt_kevent (struct work_struct *work)
13290 -+static void hub_tt_work(struct work_struct *work)
13291 - {
13292 - struct usb_hub *hub =
13293 -- container_of(work, struct usb_hub, tt.kevent);
13294 -+ container_of(work, struct usb_hub, tt.clear_work);
13295 - unsigned long flags;
13296 - int limit = 100;
13297 -
13298 -@@ -460,6 +460,7 @@ static void hub_tt_kevent (struct work_struct *work)
13299 - struct list_head *temp;
13300 - struct usb_tt_clear *clear;
13301 - struct usb_device *hdev = hub->hdev;
13302 -+ const struct hc_driver *drv;
13303 - int status;
13304 -
13305 - temp = hub->tt.clear_list.next;
13306 -@@ -469,21 +470,25 @@ static void hub_tt_kevent (struct work_struct *work)
13307 - /* drop lock so HCD can concurrently report other TT errors */
13308 - spin_unlock_irqrestore (&hub->tt.lock, flags);
13309 - status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt);
13310 -- spin_lock_irqsave (&hub->tt.lock, flags);
13311 --
13312 - if (status)
13313 - dev_err (&hdev->dev,
13314 - "clear tt %d (%04x) error %d\n",
13315 - clear->tt, clear->devinfo, status);
13316 -+
13317 -+ /* Tell the HCD, even if the operation failed */
13318 -+ drv = clear->hcd->driver;
13319 -+ if (drv->clear_tt_buffer_complete)
13320 -+ (drv->clear_tt_buffer_complete)(clear->hcd, clear->ep);
13321 -+
13322 - kfree(clear);
13323 -+ spin_lock_irqsave(&hub->tt.lock, flags);
13324 - }
13325 - spin_unlock_irqrestore (&hub->tt.lock, flags);
13326 - }
13327 -
13328 - /**
13329 -- * usb_hub_tt_clear_buffer - clear control/bulk TT state in high speed hub
13330 -- * @udev: the device whose split transaction failed
13331 -- * @pipe: identifies the endpoint of the failed transaction
13332 -+ * usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub
13333 -+ * @urb: an URB associated with the failed or incomplete split transaction
13334 - *
13335 - * High speed HCDs use this to tell the hub driver that some split control or
13336 - * bulk transaction failed in a way that requires clearing internal state of
13337 -@@ -493,8 +498,10 @@ static void hub_tt_kevent (struct work_struct *work)
13338 - * It may not be possible for that hub to handle additional full (or low)
13339 - * speed transactions until that state is fully cleared out.
13340 - */
13341 --void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
13342 -+int usb_hub_clear_tt_buffer(struct urb *urb)
13343 - {
13344 -+ struct usb_device *udev = urb->dev;
13345 -+ int pipe = urb->pipe;
13346 - struct usb_tt *tt = udev->tt;
13347 - unsigned long flags;
13348 - struct usb_tt_clear *clear;
13349 -@@ -506,7 +513,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
13350 - if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) {
13351 - dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
13352 - /* FIXME recover somehow ... RESET_TT? */
13353 -- return;
13354 -+ return -ENOMEM;
13355 - }
13356 -
13357 - /* info that CLEAR_TT_BUFFER needs */
13358 -@@ -518,14 +525,19 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
13359 - : (USB_ENDPOINT_XFER_BULK << 11);
13360 - if (usb_pipein (pipe))
13361 - clear->devinfo |= 1 << 15;
13362 --
13363 -+
13364 -+ /* info for completion callback */
13365 -+ clear->hcd = bus_to_hcd(udev->bus);
13366 -+ clear->ep = urb->ep;
13367 -+
13368 - /* tell keventd to clear state for this TT */
13369 - spin_lock_irqsave (&tt->lock, flags);
13370 - list_add_tail (&clear->clear_list, &tt->clear_list);
13371 -- schedule_work (&tt->kevent);
13372 -+ schedule_work(&tt->clear_work);
13373 - spin_unlock_irqrestore (&tt->lock, flags);
13374 -+ return 0;
13375 - }
13376 --EXPORT_SYMBOL_GPL(usb_hub_tt_clear_buffer);
13377 -+EXPORT_SYMBOL_GPL(usb_hub_clear_tt_buffer);
13378 -
13379 - /* If do_delay is false, return the number of milliseconds the caller
13380 - * needs to delay.
13381 -@@ -816,7 +828,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
13382 - if (hub->has_indicators)
13383 - cancel_delayed_work_sync(&hub->leds);
13384 - if (hub->tt.hub)
13385 -- cancel_work_sync(&hub->tt.kevent);
13386 -+ cancel_work_sync(&hub->tt.clear_work);
13387 - }
13388 -
13389 - /* caller has locked the hub device */
13390 -@@ -933,7 +945,7 @@ static int hub_configure(struct usb_hub *hub,
13391 -
13392 - spin_lock_init (&hub->tt.lock);
13393 - INIT_LIST_HEAD (&hub->tt.clear_list);
13394 -- INIT_WORK (&hub->tt.kevent, hub_tt_kevent);
13395 -+ INIT_WORK(&hub->tt.clear_work, hub_tt_work);
13396 - switch (hdev->descriptor.bDeviceProtocol) {
13397 - case 0:
13398 - break;
13399 -diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
13400 -index 2a116ce..528c411 100644
13401 ---- a/drivers/usb/core/hub.h
13402 -+++ b/drivers/usb/core/hub.h
13403 -@@ -185,16 +185,18 @@ struct usb_tt {
13404 - /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
13405 - spinlock_t lock;
13406 - struct list_head clear_list; /* of usb_tt_clear */
13407 -- struct work_struct kevent;
13408 -+ struct work_struct clear_work;
13409 - };
13410 -
13411 - struct usb_tt_clear {
13412 - struct list_head clear_list;
13413 - unsigned tt;
13414 - u16 devinfo;
13415 -+ struct usb_hcd *hcd;
13416 -+ struct usb_host_endpoint *ep;
13417 - };
13418 -
13419 --extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe);
13420 -+extern int usb_hub_clear_tt_buffer(struct urb *urb);
13421 - extern void usb_ep0_reinit(struct usb_device *);
13422 -
13423 - #endif /* __LINUX_HUB_H */
13424 -diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
13425 -index bf69f47..5c25b1a 100644
13426 ---- a/drivers/usb/host/ehci-au1xxx.c
13427 -+++ b/drivers/usb/host/ehci-au1xxx.c
13428 -@@ -112,6 +112,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
13429 - .bus_resume = ehci_bus_resume,
13430 - .relinquish_port = ehci_relinquish_port,
13431 - .port_handed_over = ehci_port_handed_over,
13432 -+
13433 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13434 - };
13435 -
13436 - static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
13437 -diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
13438 -index 01c3da3..7fb1ef0 100644
13439 ---- a/drivers/usb/host/ehci-fsl.c
13440 -+++ b/drivers/usb/host/ehci-fsl.c
13441 -@@ -324,6 +324,8 @@ static const struct hc_driver ehci_fsl_hc_driver = {
13442 - .bus_resume = ehci_bus_resume,
13443 - .relinquish_port = ehci_relinquish_port,
13444 - .port_handed_over = ehci_port_handed_over,
13445 -+
13446 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13447 - };
13448 -
13449 - static int ehci_fsl_drv_probe(struct platform_device *pdev)
13450 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
13451 -index c637207..d75b8cf 100644
13452 ---- a/drivers/usb/host/ehci-hcd.c
13453 -+++ b/drivers/usb/host/ehci-hcd.c
13454 -@@ -903,7 +903,8 @@ static int ehci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
13455 - /* already started */
13456 - break;
13457 - case QH_STATE_IDLE:
13458 -- WARN_ON(1);
13459 -+ /* QH might be waiting for a Clear-TT-Buffer */
13460 -+ qh_completions(ehci, qh);
13461 - break;
13462 - }
13463 - break;
13464 -@@ -1003,6 +1004,8 @@ idle_timeout:
13465 - schedule_timeout_uninterruptible(1);
13466 - goto rescan;
13467 - case QH_STATE_IDLE: /* fully unlinked */
13468 -+ if (qh->clearing_tt)
13469 -+ goto idle_timeout;
13470 - if (list_empty (&qh->qtd_list)) {
13471 - qh_put (qh);
13472 - break;
13473 -diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
13474 -index 9c32063..8573b03 100644
13475 ---- a/drivers/usb/host/ehci-ixp4xx.c
13476 -+++ b/drivers/usb/host/ehci-ixp4xx.c
13477 -@@ -60,6 +60,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = {
13478 - #endif
13479 - .relinquish_port = ehci_relinquish_port,
13480 - .port_handed_over = ehci_port_handed_over,
13481 -+
13482 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13483 - };
13484 -
13485 - static int ixp4xx_ehci_probe(struct platform_device *pdev)
13486 -diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
13487 -index 9d48790..64ab30a 100644
13488 ---- a/drivers/usb/host/ehci-orion.c
13489 -+++ b/drivers/usb/host/ehci-orion.c
13490 -@@ -164,6 +164,8 @@ static const struct hc_driver ehci_orion_hc_driver = {
13491 - .bus_resume = ehci_bus_resume,
13492 - .relinquish_port = ehci_relinquish_port,
13493 - .port_handed_over = ehci_port_handed_over,
13494 -+
13495 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13496 - };
13497 -
13498 - static void __init
13499 -diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
13500 -index 5aa8bce..a26b7f7 100644
13501 ---- a/drivers/usb/host/ehci-pci.c
13502 -+++ b/drivers/usb/host/ehci-pci.c
13503 -@@ -408,6 +408,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
13504 - .bus_resume = ehci_bus_resume,
13505 - .relinquish_port = ehci_relinquish_port,
13506 - .port_handed_over = ehci_port_handed_over,
13507 -+
13508 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13509 - };
13510 -
13511 - /*-------------------------------------------------------------------------*/
13512 -diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
13513 -index ef732b7..8b6556e 100644
13514 ---- a/drivers/usb/host/ehci-ppc-of.c
13515 -+++ b/drivers/usb/host/ehci-ppc-of.c
13516 -@@ -78,6 +78,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = {
13517 - #endif
13518 - .relinquish_port = ehci_relinquish_port,
13519 - .port_handed_over = ehci_port_handed_over,
13520 -+
13521 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13522 - };
13523 -
13524 -
13525 -diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
13526 -index 1ba9f9a..efefc91 100644
13527 ---- a/drivers/usb/host/ehci-ps3.c
13528 -+++ b/drivers/usb/host/ehci-ps3.c
13529 -@@ -74,6 +74,8 @@ static const struct hc_driver ps3_ehci_hc_driver = {
13530 - #endif
13531 - .relinquish_port = ehci_relinquish_port,
13532 - .port_handed_over = ehci_port_handed_over,
13533 -+
13534 -+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
13535 - };
13536 -
13537 - static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
13538 -diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
13539 -index 1976b1b..a39f2c6 100644
13540 ---- a/drivers/usb/host/ehci-q.c
13541 -+++ b/drivers/usb/host/ehci-q.c
13542 -@@ -139,6 +139,55 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
13543 -
13544 - /*-------------------------------------------------------------------------*/
13545 -
13546 -+static void qh_link_async(struct ehci_hcd *ehci, struct ehci_qh *qh);
13547 -+
13548 -+static void ehci_clear_tt_buffer_complete(struct usb_hcd *hcd,
13549 -+ struct usb_host_endpoint *ep)
13550 -+{
13551 -+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
13552 -+ struct ehci_qh *qh = ep->hcpriv;
13553 -+ unsigned long flags;
13554 -+
13555 -+ spin_lock_irqsave(&ehci->lock, flags);
13556 -+ qh->clearing_tt = 0;
13557 -+ if (qh->qh_state == QH_STATE_IDLE && !list_empty(&qh->qtd_list)
13558 -+ && HC_IS_RUNNING(hcd->state))
13559 -+ qh_link_async(ehci, qh);
13560 -+ spin_unlock_irqrestore(&ehci->lock, flags);
13561 -+}
13562 -+
13563 -+static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh,
13564 -+ struct urb *urb, u32 token)
13565 -+{
13566 -+
13567 -+ /* If an async split transaction gets an error or is unlinked,
13568 -+ * the TT buffer may be left in an indeterminate state. We
13569 -+ * have to clear the TT buffer.
13570 -+ *
13571 -+ * Note: this routine is never called for Isochronous transfers.
13572 -+ */
13573 -+ if (urb->dev->tt && !usb_pipeint(urb->pipe) && !qh->clearing_tt) {
13574 -+#ifdef DEBUG
13575 -+ struct usb_device *tt = urb->dev->tt->hub;
13576 -+ dev_dbg(&tt->dev,
13577 -+ "clear tt buffer port %d, a%d ep%d t%08x\n",
13578 -+ urb->dev->ttport, urb->dev->devnum,
13579 -+ usb_pipeendpoint(urb->pipe), token);
13580 -+#endif /* DEBUG */
13581 -+ if (!ehci_is_TDI(ehci)
13582 -+ || urb->dev->tt->hub !=
13583 -+ ehci_to_hcd(ehci)->self.root_hub) {
13584 -+ if (usb_hub_clear_tt_buffer(urb) == 0)
13585 -+ qh->clearing_tt = 1;
13586 -+ } else {
13587 -+
13588 -+ /* REVISIT ARC-derived cores don't clear the root
13589 -+ * hub TT buffer in this way...
13590 -+ */
13591 -+ }
13592 -+ }
13593 -+}
13594 -+
13595 - static int qtd_copy_status (
13596 - struct ehci_hcd *ehci,
13597 - struct urb *urb,
13598 -@@ -195,28 +244,6 @@ static int qtd_copy_status (
13599 - usb_pipeendpoint (urb->pipe),
13600 - usb_pipein (urb->pipe) ? "in" : "out",
13601 - token, status);
13602 --
13603 -- /* if async CSPLIT failed, try cleaning out the TT buffer */
13604 -- if (status != -EPIPE
13605 -- && urb->dev->tt
13606 -- && !usb_pipeint(urb->pipe)
13607 -- && ((token & QTD_STS_MMF) != 0
13608 -- || QTD_CERR(token) == 0)
13609 -- && (!ehci_is_TDI(ehci)
13610 -- || urb->dev->tt->hub !=
13611 -- ehci_to_hcd(ehci)->self.root_hub)) {
13612 --#ifdef DEBUG
13613 -- struct usb_device *tt = urb->dev->tt->hub;
13614 -- dev_dbg (&tt->dev,
13615 -- "clear tt buffer port %d, a%d ep%d t%08x\n",
13616 -- urb->dev->ttport, urb->dev->devnum,
13617 -- usb_pipeendpoint (urb->pipe), token);
13618 --#endif /* DEBUG */
13619 -- /* REVISIT ARC-derived cores don't clear the root
13620 -- * hub TT buffer in this way...
13621 -- */
13622 -- usb_hub_tt_clear_buffer (urb->dev, urb->pipe);
13623 -- }
13624 - }
13625 -
13626 - return status;
13627 -@@ -407,9 +434,16 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
13628 - /* qh unlinked; token in overlay may be most current */
13629 - if (state == QH_STATE_IDLE
13630 - && cpu_to_hc32(ehci, qtd->qtd_dma)
13631 -- == qh->hw_current)
13632 -+ == qh->hw_current) {
13633 - token = hc32_to_cpu(ehci, qh->hw_token);
13634 -
13635 -+ /* An unlink may leave an incomplete
13636 -+ * async transaction in the TT buffer.
13637 -+ * We have to clear it.
13638 -+ */
13639 -+ ehci_clear_tt_buffer(ehci, qh, urb, token);
13640 -+ }
13641 -+
13642 - /* force halt for unlinked or blocked qh, so we'll
13643 - * patch the qh later and so that completions can't
13644 - * activate it while we "know" it's stopped.
13645 -@@ -435,6 +469,13 @@ halt:
13646 - && (qtd->hw_alt_next
13647 - & EHCI_LIST_END(ehci)))
13648 - last_status = -EINPROGRESS;
13649 -+
13650 -+ /* As part of low/full-speed endpoint-halt processing
13651 -+ * we must clear the TT buffer (11.17.5).
13652 -+ */
13653 -+ if (unlikely(last_status != -EINPROGRESS &&
13654 -+ last_status != -EREMOTEIO))
13655 -+ ehci_clear_tt_buffer(ehci, qh, urb, token);
13656 - }
13657 -
13658 - /* if we're removing something not at the queue head,
13659 -@@ -864,6 +905,10 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
13660 - __hc32 dma = QH_NEXT(ehci, qh->qh_dma);
13661 - struct ehci_qh *head;
13662 -
13663 -+ /* Don't link a QH if there's a Clear-TT-Buffer pending */
13664 -+ if (unlikely(qh->clearing_tt))
13665 -+ return;
13666 -+
13667 - /* (re)start the async schedule? */
13668 - head = ehci->async;
13669 - timer_action_done (ehci, TIMER_ASYNC_OFF);
13670 -@@ -893,6 +938,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
13671 - head->qh_next.qh = qh;
13672 - head->hw_next = dma;
13673 -
13674 -+ qh_get(qh);
13675 - qh->xacterrs = QH_XACTERR_MAX;
13676 - qh->qh_state = QH_STATE_LINKED;
13677 - /* qtd completions reported later by interrupt */
13678 -@@ -1033,7 +1079,7 @@ submit_async (
13679 - * the HC and TT handle it when the TT has a buffer ready.
13680 - */
13681 - if (likely (qh->qh_state == QH_STATE_IDLE))
13682 -- qh_link_async (ehci, qh_get (qh));
13683 -+ qh_link_async(ehci, qh);
13684 - done:
13685 - spin_unlock_irqrestore (&ehci->lock, flags);
13686 - if (unlikely (qh == NULL))
13687 -@@ -1068,8 +1114,6 @@ static void end_unlink_async (struct ehci_hcd *ehci)
13688 - && HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
13689 - qh_link_async (ehci, qh);
13690 - else {
13691 -- qh_put (qh); // refcount from async list
13692 --
13693 - /* it's not free to turn the async schedule on/off; leave it
13694 - * active but idle for a while once it empties.
13695 - */
13696 -@@ -1077,6 +1121,7 @@ static void end_unlink_async (struct ehci_hcd *ehci)
13697 - && ehci->async->qh_next.qh == NULL)
13698 - timer_action (ehci, TIMER_ASYNC_OFF);
13699 - }
13700 -+ qh_put(qh); /* refcount from async list */
13701 -
13702 - if (next) {
13703 - ehci->reclaim = NULL;
13704 -diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
13705 -index 6cff195..ec5af22 100644
13706 ---- a/drivers/usb/host/ehci.h
13707 -+++ b/drivers/usb/host/ehci.h
13708 -@@ -353,7 +353,9 @@ struct ehci_qh {
13709 - unsigned short period; /* polling interval */
13710 - unsigned short start; /* where polling starts */
13711 - #define NO_FRAME ((unsigned short)~0) /* pick new start */
13712 -+
13713 - struct usb_device *dev; /* access to TT */
13714 -+ unsigned clearing_tt:1; /* Clear-TT-Buf in progress */
13715 - } __attribute__ ((aligned (32)));
13716 -
13717 - /*-------------------------------------------------------------------------*/
13718 -diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
13719 -index 2493f05..d886bf9 100644
13720 ---- a/drivers/video/xen-fbfront.c
13721 -+++ b/drivers/video/xen-fbfront.c
13722 -@@ -454,6 +454,10 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
13723 -
13724 - xenfb_init_shared_page(info, fb_info);
13725 -
13726 -+ ret = xenfb_connect_backend(dev, info);
13727 -+ if (ret < 0)
13728 -+ goto error;
13729 -+
13730 - ret = register_framebuffer(fb_info);
13731 - if (ret) {
13732 - fb_deferred_io_cleanup(fb_info);
13733 -@@ -464,10 +468,6 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
13734 - }
13735 - info->fb_info = fb_info;
13736 -
13737 -- ret = xenfb_connect_backend(dev, info);
13738 -- if (ret < 0)
13739 -- goto error;
13740 --
13741 - xenfb_make_preferred_console();
13742 - return 0;
13743 -
13744 -diff --git a/fs/buffer.c b/fs/buffer.c
13745 -index 4910612..941c78b 100644
13746 ---- a/fs/buffer.c
13747 -+++ b/fs/buffer.c
13748 -@@ -1165,8 +1165,11 @@ void mark_buffer_dirty(struct buffer_head *bh)
13749 -
13750 - if (!test_set_buffer_dirty(bh)) {
13751 - struct page *page = bh->b_page;
13752 -- if (!TestSetPageDirty(page))
13753 -- __set_page_dirty(page, page_mapping(page), 0);
13754 -+ if (!TestSetPageDirty(page)) {
13755 -+ struct address_space *mapping = page_mapping(page);
13756 -+ if (mapping)
13757 -+ __set_page_dirty(page, mapping, 0);
13758 -+ }
13759 - }
13760 - }
13761 -
13762 -diff --git a/fs/exec.c b/fs/exec.c
13763 -index 895823d..42414e5 100644
13764 ---- a/fs/exec.c
13765 -+++ b/fs/exec.c
13766 -@@ -677,8 +677,8 @@ exit:
13767 - }
13768 - EXPORT_SYMBOL(open_exec);
13769 -
13770 --int kernel_read(struct file *file, unsigned long offset,
13771 -- char *addr, unsigned long count)
13772 -+int kernel_read(struct file *file, loff_t offset,
13773 -+ char *addr, unsigned long count)
13774 - {
13775 - mm_segment_t old_fs;
13776 - loff_t pos = offset;
13777 -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
13778 -index c1462d4..7ae4e4b 100644
13779 ---- a/fs/hugetlbfs/inode.c
13780 -+++ b/fs/hugetlbfs/inode.c
13781 -@@ -934,26 +934,28 @@ static int can_do_hugetlb_shm(void)
13782 - return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
13783 - }
13784 -
13785 --struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
13786 -+struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
13787 -+ struct user_struct **user)
13788 - {
13789 - int error = -ENOMEM;
13790 -- int unlock_shm = 0;
13791 - struct file *file;
13792 - struct inode *inode;
13793 - struct dentry *dentry, *root;
13794 - struct qstr quick_string;
13795 -- struct user_struct *user = current_user();
13796 -
13797 -+ *user = NULL;
13798 - if (!hugetlbfs_vfsmount)
13799 - return ERR_PTR(-ENOENT);
13800 -
13801 - if (!can_do_hugetlb_shm()) {
13802 -- if (user_shm_lock(size, user)) {
13803 -- unlock_shm = 1;
13804 -+ *user = current_user();
13805 -+ if (user_shm_lock(size, *user)) {
13806 - WARN_ONCE(1,
13807 - "Using mlock ulimits for SHM_HUGETLB deprecated\n");
13808 -- } else
13809 -+ } else {
13810 -+ *user = NULL;
13811 - return ERR_PTR(-EPERM);
13812 -+ }
13813 - }
13814 -
13815 - root = hugetlbfs_vfsmount->mnt_root;
13816 -@@ -994,8 +996,10 @@ out_inode:
13817 - out_dentry:
13818 - dput(dentry);
13819 - out_shm_unlock:
13820 -- if (unlock_shm)
13821 -- user_shm_unlock(size, user);
13822 -+ if (*user) {
13823 -+ user_shm_unlock(size, *user);
13824 -+ *user = NULL;
13825 -+ }
13826 - return ERR_PTR(error);
13827 - }
13828 -
13829 -diff --git a/fs/inode.c b/fs/inode.c
13830 -index bca0c61..a9e8ef0 100644
13831 ---- a/fs/inode.c
13832 -+++ b/fs/inode.c
13833 -@@ -118,12 +118,11 @@ static void wake_up_inode(struct inode *inode)
13834 - * These are initializations that need to be done on every inode
13835 - * allocation as the fields are not initialised by slab allocation.
13836 - */
13837 --struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
13838 -+int inode_init_always(struct super_block *sb, struct inode *inode)
13839 - {
13840 - static const struct address_space_operations empty_aops;
13841 - static struct inode_operations empty_iops;
13842 - static const struct file_operations empty_fops;
13843 --
13844 - struct address_space *const mapping = &inode->i_data;
13845 -
13846 - inode->i_sb = sb;
13847 -@@ -150,7 +149,7 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
13848 - inode->dirtied_when = 0;
13849 -
13850 - if (security_inode_alloc(inode))
13851 -- goto out_free_inode;
13852 -+ goto out;
13853 -
13854 - /* allocate and initialize an i_integrity */
13855 - if (ima_inode_alloc(inode))
13856 -@@ -189,16 +188,12 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
13857 - inode->i_private = NULL;
13858 - inode->i_mapping = mapping;
13859 -
13860 -- return inode;
13861 -+ return 0;
13862 -
13863 - out_free_security:
13864 - security_inode_free(inode);
13865 --out_free_inode:
13866 -- if (inode->i_sb->s_op->destroy_inode)
13867 -- inode->i_sb->s_op->destroy_inode(inode);
13868 -- else
13869 -- kmem_cache_free(inode_cachep, (inode));
13870 -- return NULL;
13871 -+out:
13872 -+ return -ENOMEM;
13873 - }
13874 - EXPORT_SYMBOL(inode_init_always);
13875 -
13876 -@@ -211,23 +206,36 @@ static struct inode *alloc_inode(struct super_block *sb)
13877 - else
13878 - inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL);
13879 -
13880 -- if (inode)
13881 -- return inode_init_always(sb, inode);
13882 -- return NULL;
13883 -+ if (!inode)
13884 -+ return NULL;
13885 -+
13886 -+ if (unlikely(inode_init_always(sb, inode))) {
13887 -+ if (inode->i_sb->s_op->destroy_inode)
13888 -+ inode->i_sb->s_op->destroy_inode(inode);
13889 -+ else
13890 -+ kmem_cache_free(inode_cachep, inode);
13891 -+ return NULL;
13892 -+ }
13893 -+
13894 -+ return inode;
13895 - }
13896 -
13897 --void destroy_inode(struct inode *inode)
13898 -+void __destroy_inode(struct inode *inode)
13899 - {
13900 - BUG_ON(inode_has_buffers(inode));
13901 - ima_inode_free(inode);
13902 - security_inode_free(inode);
13903 -+}
13904 -+EXPORT_SYMBOL(__destroy_inode);
13905 -+
13906 -+void destroy_inode(struct inode *inode)
13907 -+{
13908 -+ __destroy_inode(inode);
13909 - if (inode->i_sb->s_op->destroy_inode)
13910 - inode->i_sb->s_op->destroy_inode(inode);
13911 - else
13912 - kmem_cache_free(inode_cachep, (inode));
13913 - }
13914 --EXPORT_SYMBOL(destroy_inode);
13915 --
13916 -
13917 - /*
13918 - * These are initializations that only need to be done
13919 -diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
13920 -index b2c52b3..044990a 100644
13921 ---- a/fs/ocfs2/aops.c
13922 -+++ b/fs/ocfs2/aops.c
13923 -@@ -894,18 +894,17 @@ struct ocfs2_write_cluster_desc {
13924 - */
13925 - unsigned c_new;
13926 - unsigned c_unwritten;
13927 -+ unsigned c_needs_zero;
13928 - };
13929 -
13930 --static inline int ocfs2_should_zero_cluster(struct ocfs2_write_cluster_desc *d)
13931 --{
13932 -- return d->c_new || d->c_unwritten;
13933 --}
13934 --
13935 - struct ocfs2_write_ctxt {
13936 - /* Logical cluster position / len of write */
13937 - u32 w_cpos;
13938 - u32 w_clen;
13939 -
13940 -+ /* First cluster allocated in a nonsparse extend */
13941 -+ u32 w_first_new_cpos;
13942 -+
13943 - struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE];
13944 -
13945 - /*
13946 -@@ -983,6 +982,7 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp,
13947 - return -ENOMEM;
13948 -
13949 - wc->w_cpos = pos >> osb->s_clustersize_bits;
13950 -+ wc->w_first_new_cpos = UINT_MAX;
13951 - cend = (pos + len - 1) >> osb->s_clustersize_bits;
13952 - wc->w_clen = cend - wc->w_cpos + 1;
13953 - get_bh(di_bh);
13954 -@@ -1217,20 +1217,18 @@ out:
13955 - */
13956 - static int ocfs2_write_cluster(struct address_space *mapping,
13957 - u32 phys, unsigned int unwritten,
13958 -+ unsigned int should_zero,
13959 - struct ocfs2_alloc_context *data_ac,
13960 - struct ocfs2_alloc_context *meta_ac,
13961 - struct ocfs2_write_ctxt *wc, u32 cpos,
13962 - loff_t user_pos, unsigned user_len)
13963 - {
13964 -- int ret, i, new, should_zero = 0;
13965 -+ int ret, i, new;
13966 - u64 v_blkno, p_blkno;
13967 - struct inode *inode = mapping->host;
13968 - struct ocfs2_extent_tree et;
13969 -
13970 - new = phys == 0 ? 1 : 0;
13971 -- if (new || unwritten)
13972 -- should_zero = 1;
13973 --
13974 - if (new) {
13975 - u32 tmp_pos;
13976 -
13977 -@@ -1341,7 +1339,9 @@ static int ocfs2_write_cluster_by_desc(struct address_space *mapping,
13978 - local_len = osb->s_clustersize - cluster_off;
13979 -
13980 - ret = ocfs2_write_cluster(mapping, desc->c_phys,
13981 -- desc->c_unwritten, data_ac, meta_ac,
13982 -+ desc->c_unwritten,
13983 -+ desc->c_needs_zero,
13984 -+ data_ac, meta_ac,
13985 - wc, desc->c_cpos, pos, local_len);
13986 - if (ret) {
13987 - mlog_errno(ret);
13988 -@@ -1391,14 +1391,14 @@ static void ocfs2_set_target_boundaries(struct ocfs2_super *osb,
13989 - * newly allocated cluster.
13990 - */
13991 - desc = &wc->w_desc[0];
13992 -- if (ocfs2_should_zero_cluster(desc))
13993 -+ if (desc->c_needs_zero)
13994 - ocfs2_figure_cluster_boundaries(osb,
13995 - desc->c_cpos,
13996 - &wc->w_target_from,
13997 - NULL);
13998 -
13999 - desc = &wc->w_desc[wc->w_clen - 1];
14000 -- if (ocfs2_should_zero_cluster(desc))
14001 -+ if (desc->c_needs_zero)
14002 - ocfs2_figure_cluster_boundaries(osb,
14003 - desc->c_cpos,
14004 - NULL,
14005 -@@ -1466,13 +1466,28 @@ static int ocfs2_populate_write_desc(struct inode *inode,
14006 - phys++;
14007 - }
14008 -
14009 -+ /*
14010 -+ * If w_first_new_cpos is < UINT_MAX, we have a non-sparse
14011 -+ * file that got extended. w_first_new_cpos tells us
14012 -+ * where the newly allocated clusters are so we can
14013 -+ * zero them.
14014 -+ */
14015 -+ if (desc->c_cpos >= wc->w_first_new_cpos) {
14016 -+ BUG_ON(phys == 0);
14017 -+ desc->c_needs_zero = 1;
14018 -+ }
14019 -+
14020 - desc->c_phys = phys;
14021 - if (phys == 0) {
14022 - desc->c_new = 1;
14023 -+ desc->c_needs_zero = 1;
14024 - *clusters_to_alloc = *clusters_to_alloc + 1;
14025 - }
14026 -- if (ext_flags & OCFS2_EXT_UNWRITTEN)
14027 -+
14028 -+ if (ext_flags & OCFS2_EXT_UNWRITTEN) {
14029 - desc->c_unwritten = 1;
14030 -+ desc->c_needs_zero = 1;
14031 -+ }
14032 -
14033 - num_clusters--;
14034 - }
14035 -@@ -1632,10 +1647,13 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos,
14036 - if (newsize <= i_size_read(inode))
14037 - return 0;
14038 -
14039 -- ret = ocfs2_extend_no_holes(inode, newsize, newsize - len);
14040 -+ ret = ocfs2_extend_no_holes(inode, newsize, pos);
14041 - if (ret)
14042 - mlog_errno(ret);
14043 -
14044 -+ wc->w_first_new_cpos =
14045 -+ ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode));
14046 -+
14047 - return ret;
14048 - }
14049 -
14050 -@@ -1644,7 +1662,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
14051 - struct page **pagep, void **fsdata,
14052 - struct buffer_head *di_bh, struct page *mmap_page)
14053 - {
14054 -- int ret, credits = OCFS2_INODE_UPDATE_CREDITS;
14055 -+ int ret, cluster_of_pages, credits = OCFS2_INODE_UPDATE_CREDITS;
14056 - unsigned int clusters_to_alloc, extents_to_split;
14057 - struct ocfs2_write_ctxt *wc;
14058 - struct inode *inode = mapping->host;
14059 -@@ -1722,8 +1740,19 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
14060 -
14061 - }
14062 -
14063 -- ocfs2_set_target_boundaries(osb, wc, pos, len,
14064 -- clusters_to_alloc + extents_to_split);
14065 -+ /*
14066 -+ * We have to zero sparse allocated clusters, unwritten extent clusters,
14067 -+ * and non-sparse clusters we just extended. For non-sparse writes,
14068 -+ * we know zeros will only be needed in the first and/or last cluster.
14069 -+ */
14070 -+ if (clusters_to_alloc || extents_to_split ||
14071 -+ (wc->w_clen && (wc->w_desc[0].c_needs_zero ||
14072 -+ wc->w_desc[wc->w_clen - 1].c_needs_zero)))
14073 -+ cluster_of_pages = 1;
14074 -+ else
14075 -+ cluster_of_pages = 0;
14076 -+
14077 -+ ocfs2_set_target_boundaries(osb, wc, pos, len, cluster_of_pages);
14078 -
14079 - handle = ocfs2_start_trans(osb, credits);
14080 - if (IS_ERR(handle)) {
14081 -@@ -1756,8 +1785,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
14082 - * extent.
14083 - */
14084 - ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos,
14085 -- clusters_to_alloc + extents_to_split,
14086 -- mmap_page);
14087 -+ cluster_of_pages, mmap_page);
14088 - if (ret) {
14089 - mlog_errno(ret);
14090 - goto out_quota;
14091 -diff --git a/fs/select.c b/fs/select.c
14092 -index 0fe0e14..6d76b82 100644
14093 ---- a/fs/select.c
14094 -+++ b/fs/select.c
14095 -@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq)
14096 - {
14097 - init_poll_funcptr(&pwq->pt, __pollwait);
14098 - pwq->polling_task = current;
14099 -+ pwq->triggered = 0;
14100 - pwq->error = 0;
14101 - pwq->table = NULL;
14102 - pwq->inline_index = 0;
14103 -diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
14104 -index 89b81ee..1863b0d 100644
14105 ---- a/fs/xfs/xfs_iget.c
14106 -+++ b/fs/xfs/xfs_iget.c
14107 -@@ -63,6 +63,10 @@ xfs_inode_alloc(
14108 - ip = kmem_zone_alloc(xfs_inode_zone, KM_SLEEP);
14109 - if (!ip)
14110 - return NULL;
14111 -+ if (inode_init_always(mp->m_super, VFS_I(ip))) {
14112 -+ kmem_zone_free(xfs_inode_zone, ip);
14113 -+ return NULL;
14114 -+ }
14115 -
14116 - ASSERT(atomic_read(&ip->i_iocount) == 0);
14117 - ASSERT(atomic_read(&ip->i_pincount) == 0);
14118 -@@ -104,17 +108,6 @@ xfs_inode_alloc(
14119 - #ifdef XFS_DIR2_TRACE
14120 - ip->i_dir_trace = ktrace_alloc(XFS_DIR2_KTRACE_SIZE, KM_NOFS);
14121 - #endif
14122 -- /*
14123 -- * Now initialise the VFS inode. We do this after the xfs_inode
14124 -- * initialisation as internal failures will result in ->destroy_inode
14125 -- * being called and that will pass down through the reclaim path and
14126 -- * free the XFS inode. This path requires the XFS inode to already be
14127 -- * initialised. Hence if this call fails, the xfs_inode has already
14128 -- * been freed and we should not reference it at all in the error
14129 -- * handling.
14130 -- */
14131 -- if (!inode_init_always(mp->m_super, VFS_I(ip)))
14132 -- return NULL;
14133 -
14134 - /* prevent anyone from using this yet */
14135 - VFS_I(ip)->i_state = I_NEW|I_LOCK;
14136 -@@ -122,6 +115,71 @@ xfs_inode_alloc(
14137 - return ip;
14138 - }
14139 -
14140 -+STATIC void
14141 -+xfs_inode_free(
14142 -+ struct xfs_inode *ip)
14143 -+{
14144 -+ switch (ip->i_d.di_mode & S_IFMT) {
14145 -+ case S_IFREG:
14146 -+ case S_IFDIR:
14147 -+ case S_IFLNK:
14148 -+ xfs_idestroy_fork(ip, XFS_DATA_FORK);
14149 -+ break;
14150 -+ }
14151 -+
14152 -+ if (ip->i_afp)
14153 -+ xfs_idestroy_fork(ip, XFS_ATTR_FORK);
14154 -+
14155 -+#ifdef XFS_INODE_TRACE
14156 -+ ktrace_free(ip->i_trace);
14157 -+#endif
14158 -+#ifdef XFS_BMAP_TRACE
14159 -+ ktrace_free(ip->i_xtrace);
14160 -+#endif
14161 -+#ifdef XFS_BTREE_TRACE
14162 -+ ktrace_free(ip->i_btrace);
14163 -+#endif
14164 -+#ifdef XFS_RW_TRACE
14165 -+ ktrace_free(ip->i_rwtrace);
14166 -+#endif
14167 -+#ifdef XFS_ILOCK_TRACE
14168 -+ ktrace_free(ip->i_lock_trace);
14169 -+#endif
14170 -+#ifdef XFS_DIR2_TRACE
14171 -+ ktrace_free(ip->i_dir_trace);
14172 -+#endif
14173 -+
14174 -+ if (ip->i_itemp) {
14175 -+ /*
14176 -+ * Only if we are shutting down the fs will we see an
14177 -+ * inode still in the AIL. If it is there, we should remove
14178 -+ * it to prevent a use-after-free from occurring.
14179 -+ */
14180 -+ xfs_log_item_t *lip = &ip->i_itemp->ili_item;
14181 -+ struct xfs_ail *ailp = lip->li_ailp;
14182 -+
14183 -+ ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
14184 -+ XFS_FORCED_SHUTDOWN(ip->i_mount));
14185 -+ if (lip->li_flags & XFS_LI_IN_AIL) {
14186 -+ spin_lock(&ailp->xa_lock);
14187 -+ if (lip->li_flags & XFS_LI_IN_AIL)
14188 -+ xfs_trans_ail_delete(ailp, lip);
14189 -+ else
14190 -+ spin_unlock(&ailp->xa_lock);
14191 -+ }
14192 -+ xfs_inode_item_destroy(ip);
14193 -+ ip->i_itemp = NULL;
14194 -+ }
14195 -+
14196 -+ /* asserts to verify all state is correct here */
14197 -+ ASSERT(atomic_read(&ip->i_iocount) == 0);
14198 -+ ASSERT(atomic_read(&ip->i_pincount) == 0);
14199 -+ ASSERT(!spin_is_locked(&ip->i_flags_lock));
14200 -+ ASSERT(completion_done(&ip->i_flush));
14201 -+
14202 -+ kmem_zone_free(xfs_inode_zone, ip);
14203 -+}
14204 -+
14205 - /*
14206 - * Check the validity of the inode we just found it the cache
14207 - */
14208 -@@ -166,7 +224,7 @@ xfs_iget_cache_hit(
14209 - * errors cleanly, then tag it so it can be set up correctly
14210 - * later.
14211 - */
14212 -- if (!inode_init_always(mp->m_super, VFS_I(ip))) {
14213 -+ if (inode_init_always(mp->m_super, VFS_I(ip))) {
14214 - error = ENOMEM;
14215 - goto out_error;
14216 - }
14217 -@@ -298,7 +356,8 @@ out_preload_end:
14218 - if (lock_flags)
14219 - xfs_iunlock(ip, lock_flags);
14220 - out_destroy:
14221 -- xfs_destroy_inode(ip);
14222 -+ __destroy_inode(VFS_I(ip));
14223 -+ xfs_inode_free(ip);
14224 - return error;
14225 - }
14226 -
14227 -@@ -506,62 +565,7 @@ xfs_ireclaim(
14228 - XFS_QM_DQDETACH(ip->i_mount, ip);
14229 - xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
14230 -
14231 -- switch (ip->i_d.di_mode & S_IFMT) {
14232 -- case S_IFREG:
14233 -- case S_IFDIR:
14234 -- case S_IFLNK:
14235 -- xfs_idestroy_fork(ip, XFS_DATA_FORK);
14236 -- break;
14237 -- }
14238 --
14239 -- if (ip->i_afp)
14240 -- xfs_idestroy_fork(ip, XFS_ATTR_FORK);
14241 --
14242 --#ifdef XFS_INODE_TRACE
14243 -- ktrace_free(ip->i_trace);
14244 --#endif
14245 --#ifdef XFS_BMAP_TRACE
14246 -- ktrace_free(ip->i_xtrace);
14247 --#endif
14248 --#ifdef XFS_BTREE_TRACE
14249 -- ktrace_free(ip->i_btrace);
14250 --#endif
14251 --#ifdef XFS_RW_TRACE
14252 -- ktrace_free(ip->i_rwtrace);
14253 --#endif
14254 --#ifdef XFS_ILOCK_TRACE
14255 -- ktrace_free(ip->i_lock_trace);
14256 --#endif
14257 --#ifdef XFS_DIR2_TRACE
14258 -- ktrace_free(ip->i_dir_trace);
14259 --#endif
14260 -- if (ip->i_itemp) {
14261 -- /*
14262 -- * Only if we are shutting down the fs will we see an
14263 -- * inode still in the AIL. If it is there, we should remove
14264 -- * it to prevent a use-after-free from occurring.
14265 -- */
14266 -- xfs_log_item_t *lip = &ip->i_itemp->ili_item;
14267 -- struct xfs_ail *ailp = lip->li_ailp;
14268 --
14269 -- ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
14270 -- XFS_FORCED_SHUTDOWN(ip->i_mount));
14271 -- if (lip->li_flags & XFS_LI_IN_AIL) {
14272 -- spin_lock(&ailp->xa_lock);
14273 -- if (lip->li_flags & XFS_LI_IN_AIL)
14274 -- xfs_trans_ail_delete(ailp, lip);
14275 -- else
14276 -- spin_unlock(&ailp->xa_lock);
14277 -- }
14278 -- xfs_inode_item_destroy(ip);
14279 -- ip->i_itemp = NULL;
14280 -- }
14281 -- /* asserts to verify all state is correct here */
14282 -- ASSERT(atomic_read(&ip->i_iocount) == 0);
14283 -- ASSERT(atomic_read(&ip->i_pincount) == 0);
14284 -- ASSERT(!spin_is_locked(&ip->i_flags_lock));
14285 -- ASSERT(completion_done(&ip->i_flush));
14286 -- kmem_zone_free(xfs_inode_zone, ip);
14287 -+ xfs_inode_free(ip);
14288 - }
14289 -
14290 - /*
14291 -diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
14292 -index f879c1b..71c20ec 100644
14293 ---- a/fs/xfs/xfs_inode.h
14294 -+++ b/fs/xfs/xfs_inode.h
14295 -@@ -309,23 +309,6 @@ static inline struct inode *VFS_I(struct xfs_inode *ip)
14296 - }
14297 -
14298 - /*
14299 -- * Get rid of a partially initialized inode.
14300 -- *
14301 -- * We have to go through destroy_inode to make sure allocations
14302 -- * from init_inode_always like the security data are undone.
14303 -- *
14304 -- * We mark the inode bad so that it takes the short cut in
14305 -- * the reclaim path instead of going through the flush path
14306 -- * which doesn't make sense for an inode that has never seen the
14307 -- * light of day.
14308 -- */
14309 --static inline void xfs_destroy_inode(struct xfs_inode *ip)
14310 --{
14311 -- make_bad_inode(VFS_I(ip));
14312 -- return destroy_inode(VFS_I(ip));
14313 --}
14314 --
14315 --/*
14316 - * i_flags helper functions
14317 - */
14318 - static inline void
14319 -diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
14320 -index 3750f04..9dbdff3 100644
14321 ---- a/fs/xfs/xfs_log.c
14322 -+++ b/fs/xfs/xfs_log.c
14323 -@@ -3180,7 +3180,7 @@ try_again:
14324 - STATIC void
14325 - xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog)
14326 - {
14327 -- ASSERT(spin_is_locked(&log->l_icloglock));
14328 -+ assert_spin_locked(&log->l_icloglock);
14329 -
14330 - if (iclog->ic_state == XLOG_STATE_ACTIVE) {
14331 - xlog_state_switch_iclogs(log, iclog, 0);
14332 -diff --git a/include/acpi/processor.h b/include/acpi/processor.h
14333 -index 4927c06..e498c79 100644
14334 ---- a/include/acpi/processor.h
14335 -+++ b/include/acpi/processor.h
14336 -@@ -174,7 +174,7 @@ struct acpi_processor_throttling {
14337 - cpumask_var_t shared_cpu_map;
14338 - int (*acpi_processor_get_throttling) (struct acpi_processor * pr);
14339 - int (*acpi_processor_set_throttling) (struct acpi_processor * pr,
14340 -- int state);
14341 -+ int state, bool force);
14342 -
14343 - u32 address;
14344 - u8 duty_offset;
14345 -@@ -320,7 +320,8 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
14346 - /* in processor_throttling.c */
14347 - int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
14348 - int acpi_processor_get_throttling_info(struct acpi_processor *pr);
14349 --extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
14350 -+extern int acpi_processor_set_throttling(struct acpi_processor *pr,
14351 -+ int state, bool force);
14352 - extern const struct file_operations acpi_processor_throttling_fops;
14353 - extern void acpi_processor_throttling_init(void);
14354 - /* in processor_idle.c */
14355 -diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
14356 -index 2878811..756d78b 100644
14357 ---- a/include/linux/bitmap.h
14358 -+++ b/include/linux/bitmap.h
14359 -@@ -94,13 +94,13 @@ extern void __bitmap_shift_right(unsigned long *dst,
14360 - const unsigned long *src, int shift, int bits);
14361 - extern void __bitmap_shift_left(unsigned long *dst,
14362 - const unsigned long *src, int shift, int bits);
14363 --extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
14364 -+extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
14365 - const unsigned long *bitmap2, int bits);
14366 - extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
14367 - const unsigned long *bitmap2, int bits);
14368 - extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
14369 - const unsigned long *bitmap2, int bits);
14370 --extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
14371 -+extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
14372 - const unsigned long *bitmap2, int bits);
14373 - extern int __bitmap_intersects(const unsigned long *bitmap1,
14374 - const unsigned long *bitmap2, int bits);
14375 -@@ -171,13 +171,12 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
14376 - }
14377 - }
14378 -
14379 --static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
14380 -+static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
14381 - const unsigned long *src2, int nbits)
14382 - {
14383 - if (small_const_nbits(nbits))
14384 -- *dst = *src1 & *src2;
14385 -- else
14386 -- __bitmap_and(dst, src1, src2, nbits);
14387 -+ return (*dst = *src1 & *src2) != 0;
14388 -+ return __bitmap_and(dst, src1, src2, nbits);
14389 - }
14390 -
14391 - static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
14392 -@@ -198,13 +197,12 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
14393 - __bitmap_xor(dst, src1, src2, nbits);
14394 - }
14395 -
14396 --static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
14397 -+static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
14398 - const unsigned long *src2, int nbits)
14399 - {
14400 - if (small_const_nbits(nbits))
14401 -- *dst = *src1 & ~(*src2);
14402 -- else
14403 -- __bitmap_andnot(dst, src1, src2, nbits);
14404 -+ return (*dst = *src1 & ~(*src2)) != 0;
14405 -+ return __bitmap_andnot(dst, src1, src2, nbits);
14406 - }
14407 -
14408 - static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
14409 -diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
14410 -index c5ac87c..796df12 100644
14411 ---- a/include/linux/cpumask.h
14412 -+++ b/include/linux/cpumask.h
14413 -@@ -43,10 +43,10 @@
14414 - * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
14415 - * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
14416 - *
14417 -- * void cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
14418 -+ * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
14419 - * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
14420 - * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
14421 -- * void cpus_andnot(dst, src1, src2) dst = src1 & ~src2
14422 -+ * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2
14423 - * void cpus_complement(dst, src) dst = ~src
14424 - *
14425 - * int cpus_equal(mask1, mask2) Does mask1 == mask2?
14426 -@@ -179,10 +179,10 @@ static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
14427 - }
14428 -
14429 - #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
14430 --static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
14431 -+static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
14432 - const cpumask_t *src2p, int nbits)
14433 - {
14434 -- bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
14435 -+ return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
14436 - }
14437 -
14438 - #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
14439 -@@ -201,10 +201,10 @@ static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
14440 -
14441 - #define cpus_andnot(dst, src1, src2) \
14442 - __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
14443 --static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
14444 -+static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
14445 - const cpumask_t *src2p, int nbits)
14446 - {
14447 -- bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
14448 -+ return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
14449 - }
14450 -
14451 - #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
14452 -@@ -738,11 +738,11 @@ static inline void cpumask_clear(struct cpumask *dstp)
14453 - * @src1p: the first input
14454 - * @src2p: the second input
14455 - */
14456 --static inline void cpumask_and(struct cpumask *dstp,
14457 -+static inline int cpumask_and(struct cpumask *dstp,
14458 - const struct cpumask *src1p,
14459 - const struct cpumask *src2p)
14460 - {
14461 -- bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p),
14462 -+ return bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p),
14463 - cpumask_bits(src2p), nr_cpumask_bits);
14464 - }
14465 -
14466 -@@ -779,11 +779,11 @@ static inline void cpumask_xor(struct cpumask *dstp,
14467 - * @src1p: the first input
14468 - * @src2p: the second input
14469 - */
14470 --static inline void cpumask_andnot(struct cpumask *dstp,
14471 -+static inline int cpumask_andnot(struct cpumask *dstp,
14472 - const struct cpumask *src1p,
14473 - const struct cpumask *src2p)
14474 - {
14475 -- bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p),
14476 -+ return bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p),
14477 - cpumask_bits(src2p), nr_cpumask_bits);
14478 - }
14479 -
14480 -diff --git a/include/linux/fs.h b/include/linux/fs.h
14481 -index 3b534e5..53618df 100644
14482 ---- a/include/linux/fs.h
14483 -+++ b/include/linux/fs.h
14484 -@@ -2121,7 +2121,7 @@ extern struct file *do_filp_open(int dfd, const char *pathname,
14485 - int open_flag, int mode, int acc_mode);
14486 - extern int may_open(struct path *, int, int);
14487 -
14488 --extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
14489 -+extern int kernel_read(struct file *, loff_t, char *, unsigned long);
14490 - extern struct file * open_exec(const char *);
14491 -
14492 - /* fs/dcache.c -- generic fs support functions */
14493 -@@ -2135,7 +2135,7 @@ extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
14494 -
14495 - extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
14496 -
14497 --extern struct inode * inode_init_always(struct super_block *, struct inode *);
14498 -+extern int inode_init_always(struct super_block *, struct inode *);
14499 - extern void inode_init_once(struct inode *);
14500 - extern void inode_add_to_lists(struct super_block *, struct inode *);
14501 - extern void iput(struct inode *);
14502 -@@ -2162,6 +2162,7 @@ extern void __iget(struct inode * inode);
14503 - extern void iget_failed(struct inode *);
14504 - extern void clear_inode(struct inode *);
14505 - extern void destroy_inode(struct inode *);
14506 -+extern void __destroy_inode(struct inode *);
14507 - extern struct inode *new_inode(struct super_block *);
14508 - extern int should_remove_suid(struct dentry *);
14509 - extern int file_remove_suid(struct file *);
14510 -diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
14511 -index 03be7f2..7e2f1ef 100644
14512 ---- a/include/linux/hugetlb.h
14513 -+++ b/include/linux/hugetlb.h
14514 -@@ -10,6 +10,7 @@
14515 - #include <asm/tlbflush.h>
14516 -
14517 - struct ctl_table;
14518 -+struct user_struct;
14519 -
14520 - static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
14521 - {
14522 -@@ -139,7 +140,8 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
14523 -
14524 - extern const struct file_operations hugetlbfs_file_operations;
14525 - extern struct vm_operations_struct hugetlb_vm_ops;
14526 --struct file *hugetlb_file_setup(const char *name, size_t, int);
14527 -+struct file *hugetlb_file_setup(const char *name, size_t size, int acct,
14528 -+ struct user_struct **user);
14529 - int hugetlb_get_quota(struct address_space *mapping, long delta);
14530 - void hugetlb_put_quota(struct address_space *mapping, long delta);
14531 -
14532 -@@ -161,7 +163,7 @@ static inline void set_file_hugepages(struct file *file)
14533 -
14534 - #define is_file_hugepages(file) 0
14535 - #define set_file_hugepages(file) BUG()
14536 --#define hugetlb_file_setup(name,size,acctflag) ERR_PTR(-ENOSYS)
14537 -+#define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS)
14538 -
14539 - #endif /* !CONFIG_HUGETLBFS */
14540 -
14541 -diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
14542 -index 5eed8fa..340e909 100644
14543 ---- a/include/linux/kvm_host.h
14544 -+++ b/include/linux/kvm_host.h
14545 -@@ -110,6 +110,7 @@ struct kvm_memory_slot {
14546 -
14547 - struct kvm_kernel_irq_routing_entry {
14548 - u32 gsi;
14549 -+ u32 type;
14550 - int (*set)(struct kvm_kernel_irq_routing_entry *e,
14551 - struct kvm *kvm, int level);
14552 - union {
14553 -diff --git a/init/main.c b/init/main.c
14554 -index d721dad..303903c 100644
14555 ---- a/init/main.c
14556 -+++ b/init/main.c
14557 -@@ -702,13 +702,14 @@ asmlinkage void __init start_kernel(void)
14558 - int initcall_debug;
14559 - core_param(initcall_debug, initcall_debug, bool, 0644);
14560 -
14561 -+static char msgbuf[64];
14562 -+static struct boot_trace_call call;
14563 -+static struct boot_trace_ret ret;
14564 -+
14565 - int do_one_initcall(initcall_t fn)
14566 - {
14567 - int count = preempt_count();
14568 - ktime_t calltime, delta, rettime;
14569 -- char msgbuf[64];
14570 -- struct boot_trace_call call;
14571 -- struct boot_trace_ret ret;
14572 -
14573 - if (initcall_debug) {
14574 - call.caller = task_pid_nr(current);
14575 -diff --git a/ipc/shm.c b/ipc/shm.c
14576 -index 4259716..30b1265 100644
14577 ---- a/ipc/shm.c
14578 -+++ b/ipc/shm.c
14579 -@@ -174,7 +174,7 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
14580 - shm_unlock(shp);
14581 - if (!is_file_hugepages(shp->shm_file))
14582 - shmem_lock(shp->shm_file, 0, shp->mlock_user);
14583 -- else
14584 -+ else if (shp->mlock_user)
14585 - user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size,
14586 - shp->mlock_user);
14587 - fput (shp->shm_file);
14588 -@@ -369,8 +369,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
14589 - /* hugetlb_file_setup applies strict accounting */
14590 - if (shmflg & SHM_NORESERVE)
14591 - acctflag = VM_NORESERVE;
14592 -- file = hugetlb_file_setup(name, size, acctflag);
14593 -- shp->mlock_user = current_user();
14594 -+ file = hugetlb_file_setup(name, size, acctflag,
14595 -+ &shp->mlock_user);
14596 - } else {
14597 - /*
14598 - * Do not allow no accounting for OVERCOMMIT_NEVER, even
14599 -@@ -411,6 +411,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
14600 - return error;
14601 -
14602 - no_id:
14603 -+ if (shp->mlock_user) /* shmflg & SHM_HUGETLB case */
14604 -+ user_shm_unlock(size, shp->mlock_user);
14605 - fput(file);
14606 - no_file:
14607 - security_shm_free(shp);
14608 -diff --git a/kernel/fork.c b/kernel/fork.c
14609 -index 9c1f52d..f4be1ee 100644
14610 ---- a/kernel/fork.c
14611 -+++ b/kernel/fork.c
14612 -@@ -816,11 +816,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
14613 - {
14614 - struct signal_struct *sig;
14615 -
14616 -- if (clone_flags & CLONE_THREAD) {
14617 -- atomic_inc(&current->signal->count);
14618 -- atomic_inc(&current->signal->live);
14619 -+ if (clone_flags & CLONE_THREAD)
14620 - return 0;
14621 -- }
14622 -
14623 - sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
14624 - tsk->signal = sig;
14625 -@@ -878,16 +875,6 @@ void __cleanup_signal(struct signal_struct *sig)
14626 - kmem_cache_free(signal_cachep, sig);
14627 - }
14628 -
14629 --static void cleanup_signal(struct task_struct *tsk)
14630 --{
14631 -- struct signal_struct *sig = tsk->signal;
14632 --
14633 -- atomic_dec(&sig->live);
14634 --
14635 -- if (atomic_dec_and_test(&sig->count))
14636 -- __cleanup_signal(sig);
14637 --}
14638 --
14639 - static void copy_flags(unsigned long clone_flags, struct task_struct *p)
14640 - {
14641 - unsigned long new_flags = p->flags;
14642 -@@ -1237,6 +1224,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
14643 - }
14644 -
14645 - if (clone_flags & CLONE_THREAD) {
14646 -+ atomic_inc(&current->signal->count);
14647 -+ atomic_inc(&current->signal->live);
14648 - p->group_leader = current->group_leader;
14649 - list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
14650 - }
14651 -@@ -1281,7 +1270,8 @@ bad_fork_cleanup_mm:
14652 - if (p->mm)
14653 - mmput(p->mm);
14654 - bad_fork_cleanup_signal:
14655 -- cleanup_signal(p);
14656 -+ if (!(clone_flags & CLONE_THREAD))
14657 -+ __cleanup_signal(p->signal);
14658 - bad_fork_cleanup_sighand:
14659 - __cleanup_sighand(p->sighand);
14660 - bad_fork_cleanup_fs:
14661 -diff --git a/kernel/kthread.c b/kernel/kthread.c
14662 -index 4ebaf85..7fbaa09 100644
14663 ---- a/kernel/kthread.c
14664 -+++ b/kernel/kthread.c
14665 -@@ -216,12 +216,12 @@ int kthread_stop(struct task_struct *k)
14666 - /* Now set kthread_should_stop() to true, and wake it up. */
14667 - kthread_stop_info.k = k;
14668 - wake_up_process(k);
14669 -- put_task_struct(k);
14670 -
14671 - /* Once it dies, reset stop ptr, gather result and we're done. */
14672 - wait_for_completion(&kthread_stop_info.done);
14673 - kthread_stop_info.k = NULL;
14674 - ret = kthread_stop_info.err;
14675 -+ put_task_struct(k);
14676 - mutex_unlock(&kthread_stop_lock);
14677 -
14678 - trace_sched_kthread_stop_ret(ret);
14679 -diff --git a/kernel/signal.c b/kernel/signal.c
14680 -index d803473..2dfc931 100644
14681 ---- a/kernel/signal.c
14682 -+++ b/kernel/signal.c
14683 -@@ -2414,11 +2414,9 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
14684 - stack_t oss;
14685 - int error;
14686 -
14687 -- if (uoss) {
14688 -- oss.ss_sp = (void __user *) current->sas_ss_sp;
14689 -- oss.ss_size = current->sas_ss_size;
14690 -- oss.ss_flags = sas_ss_flags(sp);
14691 -- }
14692 -+ oss.ss_sp = (void __user *) current->sas_ss_sp;
14693 -+ oss.ss_size = current->sas_ss_size;
14694 -+ oss.ss_flags = sas_ss_flags(sp);
14695 -
14696 - if (uss) {
14697 - void __user *ss_sp;
14698 -@@ -2461,13 +2459,16 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
14699 - current->sas_ss_size = ss_size;
14700 - }
14701 -
14702 -+ error = 0;
14703 - if (uoss) {
14704 - error = -EFAULT;
14705 -- if (copy_to_user(uoss, &oss, sizeof(oss)))
14706 -+ if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
14707 - goto out;
14708 -+ error = __put_user(oss.ss_sp, &uoss->ss_sp) |
14709 -+ __put_user(oss.ss_size, &uoss->ss_size) |
14710 -+ __put_user(oss.ss_flags, &uoss->ss_flags);
14711 - }
14712 -
14713 -- error = 0;
14714 - out:
14715 - return error;
14716 - }
14717 -diff --git a/lib/bitmap.c b/lib/bitmap.c
14718 -index 35a1f7f..7025658 100644
14719 ---- a/lib/bitmap.c
14720 -+++ b/lib/bitmap.c
14721 -@@ -179,14 +179,16 @@ void __bitmap_shift_left(unsigned long *dst,
14722 - }
14723 - EXPORT_SYMBOL(__bitmap_shift_left);
14724 -
14725 --void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
14726 -+int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
14727 - const unsigned long *bitmap2, int bits)
14728 - {
14729 - int k;
14730 - int nr = BITS_TO_LONGS(bits);
14731 -+ unsigned long result = 0;
14732 -
14733 - for (k = 0; k < nr; k++)
14734 -- dst[k] = bitmap1[k] & bitmap2[k];
14735 -+ result |= (dst[k] = bitmap1[k] & bitmap2[k]);
14736 -+ return result != 0;
14737 - }
14738 - EXPORT_SYMBOL(__bitmap_and);
14739 -
14740 -@@ -212,14 +214,16 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
14741 - }
14742 - EXPORT_SYMBOL(__bitmap_xor);
14743 -
14744 --void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
14745 -+int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
14746 - const unsigned long *bitmap2, int bits)
14747 - {
14748 - int k;
14749 - int nr = BITS_TO_LONGS(bits);
14750 -+ unsigned long result = 0;
14751 -
14752 - for (k = 0; k < nr; k++)
14753 -- dst[k] = bitmap1[k] & ~bitmap2[k];
14754 -+ result |= (dst[k] = bitmap1[k] & ~bitmap2[k]);
14755 -+ return result != 0;
14756 - }
14757 - EXPORT_SYMBOL(__bitmap_andnot);
14758 -
14759 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
14760 -index 6bf3cc4..b91020e 100644
14761 ---- a/mm/page_alloc.c
14762 -+++ b/mm/page_alloc.c
14763 -@@ -2342,7 +2342,6 @@ static void build_zonelists(pg_data_t *pgdat)
14764 - prev_node = local_node;
14765 - nodes_clear(used_mask);
14766 -
14767 -- memset(node_load, 0, sizeof(node_load));
14768 - memset(node_order, 0, sizeof(node_order));
14769 - j = 0;
14770 -
14771 -@@ -2451,6 +2450,9 @@ static int __build_all_zonelists(void *dummy)
14772 - {
14773 - int nid;
14774 -
14775 -+#ifdef CONFIG_NUMA
14776 -+ memset(node_load, 0, sizeof(node_load));
14777 -+#endif
14778 - for_each_online_node(nid) {
14779 - pg_data_t *pgdat = NODE_DATA(nid);
14780 -
14781 -diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
14782 -index d6a9243..e8e9bad 100644
14783 ---- a/net/appletalk/ddp.c
14784 -+++ b/net/appletalk/ddp.c
14785 -@@ -1242,6 +1242,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
14786 - return -ENOBUFS;
14787 -
14788 - *uaddr_len = sizeof(struct sockaddr_at);
14789 -+ memset(&sat.sat_zero, 0, sizeof(sat.sat_zero));
14790 -
14791 - if (peer) {
14792 - if (sk->sk_state != TCP_ESTABLISHED)
14793 -diff --git a/net/can/raw.c b/net/can/raw.c
14794 -index 6aa154e..5df3bf6 100644
14795 ---- a/net/can/raw.c
14796 -+++ b/net/can/raw.c
14797 -@@ -397,6 +397,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr,
14798 - if (peer)
14799 - return -EOPNOTSUPP;
14800 -
14801 -+ memset(addr, 0, sizeof(*addr));
14802 - addr->can_family = AF_CAN;
14803 - addr->can_ifindex = ro->ifindex;
14804 -
14805 -diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
14806 -index 6f479fa..3bafb21 100644
14807 ---- a/net/econet/af_econet.c
14808 -+++ b/net/econet/af_econet.c
14809 -@@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
14810 - if (peer)
14811 - return -EOPNOTSUPP;
14812 -
14813 -+ memset(sec, 0, sizeof(*sec));
14814 - mutex_lock(&econet_mutex);
14815 -
14816 - sk = sock->sk;
14817 -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
14818 -index 3e7e910..d1d88e6 100644
14819 ---- a/net/ipv4/ip_output.c
14820 -+++ b/net/ipv4/ip_output.c
14821 -@@ -814,6 +814,8 @@ int ip_append_data(struct sock *sk,
14822 - inet->cork.addr = ipc->addr;
14823 - }
14824 - rt = *rtp;
14825 -+ if (unlikely(!rt))
14826 -+ return -EFAULT;
14827 - /*
14828 - * We steal reference to this route, caller should not release it
14829 - */
14830 -diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
14831 -index 61f5538..55e315a 100644
14832 ---- a/net/ipv6/af_inet6.c
14833 -+++ b/net/ipv6/af_inet6.c
14834 -@@ -294,8 +294,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
14835 - v4addr != htonl(INADDR_ANY) &&
14836 - chk_addr_ret != RTN_LOCAL &&
14837 - chk_addr_ret != RTN_MULTICAST &&
14838 -- chk_addr_ret != RTN_BROADCAST)
14839 -+ chk_addr_ret != RTN_BROADCAST) {
14840 -+ err = -EADDRNOTAVAIL;
14841 - goto out;
14842 -+ }
14843 - } else {
14844 - if (addr_type != IPV6_ADDR_ANY) {
14845 - struct net_device *dev = NULL;
14846 -diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
14847 -index e0fbcff..b06224b 100644
14848 ---- a/net/irda/af_irda.c
14849 -+++ b/net/irda/af_irda.c
14850 -@@ -714,6 +714,7 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr,
14851 - struct sock *sk = sock->sk;
14852 - struct irda_sock *self = irda_sk(sk);
14853 -
14854 -+ memset(&saddr, 0, sizeof(saddr));
14855 - if (peer) {
14856 - if (sk->sk_state != TCP_ESTABLISHED)
14857 - return -ENOTCONN;
14858 -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
14859 -index febae70..515d556 100644
14860 ---- a/net/llc/af_llc.c
14861 -+++ b/net/llc/af_llc.c
14862 -@@ -914,6 +914,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
14863 - struct llc_sock *llc = llc_sk(sk);
14864 - int rc = 0;
14865 -
14866 -+ memset(&sllc, 0, sizeof(sllc));
14867 - lock_sock(sk);
14868 - if (sock_flag(sk, SOCK_ZAPPED))
14869 - goto out;
14870 -diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
14871 -index 947aaaa..baf0f77 100644
14872 ---- a/net/mac80211/agg-tx.c
14873 -+++ b/net/mac80211/agg-tx.c
14874 -@@ -376,6 +376,14 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local,
14875 - &local->hw, queue,
14876 - IEEE80211_QUEUE_STOP_REASON_AGGREGATION);
14877 -
14878 -+ if (!(sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK))
14879 -+ return;
14880 -+
14881 -+ if (WARN(!sta->ampdu_mlme.tid_tx[tid],
14882 -+ "TID %d gone but expected when splicing aggregates from"
14883 -+ "the pending queue\n", tid))
14884 -+ return;
14885 -+
14886 - if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) {
14887 - spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
14888 - /* mark queue as pending, it is stopped already */
14889 -diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
14890 -index 3be0e01..0c3e755 100644
14891 ---- a/net/netrom/af_netrom.c
14892 -+++ b/net/netrom/af_netrom.c
14893 -@@ -848,6 +848,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
14894 - sax->fsa_ax25.sax25_family = AF_NETROM;
14895 - sax->fsa_ax25.sax25_ndigis = 1;
14896 - sax->fsa_ax25.sax25_call = nr->user_addr;
14897 -+ memset(sax->fsa_digipeater, 0, sizeof(sax->fsa_digipeater));
14898 - sax->fsa_digipeater[0] = nr->dest_addr;
14899 - *uaddr_len = sizeof(struct full_sockaddr_ax25);
14900 - } else {
14901 -diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
14902 -index 877a7f6..ebe1cc9 100644
14903 ---- a/net/rose/af_rose.c
14904 -+++ b/net/rose/af_rose.c
14905 -@@ -957,6 +957,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr,
14906 - struct rose_sock *rose = rose_sk(sk);
14907 - int n;
14908 -
14909 -+ memset(srose, 0, sizeof(*srose));
14910 - if (peer != 0) {
14911 - if (sk->sk_state != TCP_ESTABLISHED)
14912 - return -ENOTCONN;
14913 -diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
14914 -index 5abab09..8d02e05 100644
14915 ---- a/net/sunrpc/clnt.c
14916 -+++ b/net/sunrpc/clnt.c
14917 -@@ -876,6 +876,7 @@ static inline void
14918 - rpc_task_force_reencode(struct rpc_task *task)
14919 - {
14920 - task->tk_rqstp->rq_snd_buf.len = 0;
14921 -+ task->tk_rqstp->rq_bytes_sent = 0;
14922 - }
14923 -
14924 - static inline void
14925 -diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
14926 -index 50d572b..2ae3aff 100644
14927 ---- a/security/integrity/ima/ima_crypto.c
14928 -+++ b/security/integrity/ima/ima_crypto.c
14929 -@@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest)
14930 - {
14931 - struct hash_desc desc;
14932 - struct scatterlist sg[1];
14933 -- loff_t i_size;
14934 -+ loff_t i_size, offset = 0;
14935 - char *rbuf;
14936 -- int rc, offset = 0;
14937 -+ int rc;
14938 -
14939 - rc = init_desc(&desc);
14940 - if (rc != 0)
14941 -@@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest)
14942 - rc = rbuf_len;
14943 - break;
14944 - }
14945 -+ if (rbuf_len == 0)
14946 -+ break;
14947 - offset += rbuf_len;
14948 - sg_init_one(sg, rbuf, rbuf_len);
14949 -
14950 -diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
14951 -index d659995..2a2c2ca 100644
14952 ---- a/sound/core/pcm_lib.c
14953 -+++ b/sound/core/pcm_lib.c
14954 -@@ -876,47 +876,24 @@ static int snd_interval_ratden(struct snd_interval *i,
14955 - int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask)
14956 - {
14957 - unsigned int k;
14958 -- int changed = 0;
14959 -+ struct snd_interval list_range;
14960 -
14961 - if (!count) {
14962 - i->empty = 1;
14963 - return -EINVAL;
14964 - }
14965 -+ snd_interval_any(&list_range);
14966 -+ list_range.min = UINT_MAX;
14967 -+ list_range.max = 0;
14968 - for (k = 0; k < count; k++) {
14969 - if (mask && !(mask & (1 << k)))
14970 - continue;
14971 -- if (i->min == list[k] && !i->openmin)
14972 -- goto _l1;
14973 -- if (i->min < list[k]) {
14974 -- i->min = list[k];
14975 -- i->openmin = 0;
14976 -- changed = 1;
14977 -- goto _l1;
14978 -- }
14979 -- }
14980 -- i->empty = 1;
14981 -- return -EINVAL;
14982 -- _l1:
14983 -- for (k = count; k-- > 0;) {
14984 -- if (mask && !(mask & (1 << k)))
14985 -+ if (!snd_interval_test(i, list[k]))
14986 - continue;
14987 -- if (i->max == list[k] && !i->openmax)
14988 -- goto _l2;
14989 -- if (i->max > list[k]) {
14990 -- i->max = list[k];
14991 -- i->openmax = 0;
14992 -- changed = 1;
14993 -- goto _l2;
14994 -- }
14995 -+ list_range.min = min(list_range.min, list[k]);
14996 -+ list_range.max = max(list_range.max, list[k]);
14997 - }
14998 -- i->empty = 1;
14999 -- return -EINVAL;
15000 -- _l2:
15001 -- if (snd_interval_checkempty(i)) {
15002 -- i->empty = 1;
15003 -- return -EINVAL;
15004 -- }
15005 -- return changed;
15006 -+ return snd_interval_refine(i, &list_range);
15007 - }
15008 -
15009 - EXPORT_SYMBOL(snd_interval_list);
15010 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
15011 -index 1df7692..c734840 100644
15012 ---- a/sound/pci/hda/patch_realtek.c
15013 -+++ b/sound/pci/hda/patch_realtek.c
15014 -@@ -6186,9 +6186,9 @@ static struct hda_verb alc885_mbp_ch2_init[] = {
15015 - };
15016 -
15017 - /*
15018 -- * 6ch mode
15019 -+ * 4ch mode
15020 - */
15021 --static struct hda_verb alc885_mbp_ch6_init[] = {
15022 -+static struct hda_verb alc885_mbp_ch4_init[] = {
15023 - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15024 - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15025 - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15026 -@@ -6197,9 +6197,9 @@ static struct hda_verb alc885_mbp_ch6_init[] = {
15027 - { } /* end */
15028 - };
15029 -
15030 --static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
15031 -+static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
15032 - { 2, alc885_mbp_ch2_init },
15033 -- { 6, alc885_mbp_ch6_init },
15034 -+ { 4, alc885_mbp_ch4_init },
15035 - };
15036 -
15037 -
15038 -@@ -6232,10 +6232,11 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {
15039 - };
15040 -
15041 - static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
15042 -- HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
15043 -- HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
15044 -- HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
15045 -- HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
15046 -+ HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
15047 -+ HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
15048 -+ HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
15049 -+ HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
15050 -+ HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
15051 - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15052 - HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15053 - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
15054 -@@ -6481,14 +6482,18 @@ static struct hda_verb alc885_mbp3_init_verbs[] = {
15055 - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15056 - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15057 - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15058 -+ /* HP mixer */
15059 -+ {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15060 -+ {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15061 -+ {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15062 - /* Front Pin: output 0 (0x0c) */
15063 - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15064 - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15065 - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15066 -- /* HP Pin: output 0 (0x0d) */
15067 -+ /* HP Pin: output 0 (0x0e) */
15068 - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
15069 -- {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15070 -- {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
15071 -+ {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15072 -+ {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
15073 - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
15074 - /* Mic (rear) pin: input vref at 80% */
15075 - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15076 -@@ -6885,10 +6890,11 @@ static struct alc_config_preset alc882_presets[] = {
15077 - .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
15078 - .init_verbs = { alc885_mbp3_init_verbs,
15079 - alc880_gpio1_init_verbs },
15080 -- .num_dacs = ARRAY_SIZE(alc882_dac_nids),
15081 -+ .num_dacs = 2,
15082 - .dac_nids = alc882_dac_nids,
15083 -- .channel_mode = alc885_mbp_6ch_modes,
15084 -- .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
15085 -+ .hp_nid = 0x04,
15086 -+ .channel_mode = alc885_mbp_4ch_modes,
15087 -+ .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
15088 - .input_mux = &alc882_capture_source,
15089 - .dig_out_nid = ALC882_DIGOUT_NID,
15090 - .dig_in_nid = ALC882_DIGIN_NID,
15091 -diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
15092 -index 864ac54..8f2018a 100644
15093 ---- a/virt/kvm/irq_comm.c
15094 -+++ b/virt/kvm/irq_comm.c
15095 -@@ -141,7 +141,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
15096 - unsigned gsi = pin;
15097 -
15098 - list_for_each_entry(e, &kvm->irq_routing, link)
15099 -- if (e->irqchip.irqchip == irqchip &&
15100 -+ if (e->type == KVM_IRQ_ROUTING_IRQCHIP &&
15101 -+ e->irqchip.irqchip == irqchip &&
15102 - e->irqchip.pin == pin) {
15103 - gsi = e->gsi;
15104 - break;
15105 -@@ -240,6 +241,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
15106 - int delta;
15107 -
15108 - e->gsi = ue->gsi;
15109 -+ e->type = ue->type;
15110 - switch (ue->type) {
15111 - case KVM_IRQ_ROUTING_IRQCHIP:
15112 - delta = 0;
15113 -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
15114 -index 1489829..ad38135 100644
15115 ---- a/virt/kvm/kvm_main.c
15116 -+++ b/virt/kvm/kvm_main.c
15117 -@@ -881,6 +881,8 @@ static void kvm_destroy_vm(struct kvm *kvm)
15118 - #endif
15119 - #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
15120 - mmu_notifier_unregister(&kvm->mmu_notifier, kvm->mm);
15121 -+#else
15122 -+ kvm_arch_flush_shadow(kvm);
15123 - #endif
15124 - kvm_arch_destroy_vm(kvm);
15125 - mmdrop(mm);
15126 -@@ -1055,8 +1057,10 @@ int __kvm_set_memory_region(struct kvm *kvm,
15127 -
15128 - kvm_free_physmem_slot(&old, npages ? &new : NULL);
15129 - /* Slot deletion case: we have to update the current slot */
15130 -+ spin_lock(&kvm->mmu_lock);
15131 - if (!npages)
15132 - *memslot = old;
15133 -+ spin_unlock(&kvm->mmu_lock);
15134 - #ifdef CONFIG_DMAR
15135 - /* map the pages in iommu page table */
15136 - r = kvm_iommu_map_pages(kvm, base_gfn, npages);
15137
15138 Deleted: genpatches-2.6/trunk/2.6.31/1510_hid-move-deref-below-null-test.patch
15139 ===================================================================
15140 --- genpatches-2.6/trunk/2.6.31/1510_hid-move-deref-below-null-test.patch 2009-09-09 23:15:13 UTC (rev 1604)
15141 +++ genpatches-2.6/trunk/2.6.31/1510_hid-move-deref-below-null-test.patch 2009-09-09 23:51:20 UTC (rev 1605)
15142 @@ -1,58 +0,0 @@
15143 -From: Julia Lawall <julia@××××.dk>
15144 -Date: Sun, 19 Jul 2009 15:26:13 +0000 (+0200)
15145 -Subject: HID: Move dereferences below a NULL test
15146 -X-Git-Tag: v2.6.31-rc4~14^2
15147 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=76c317d6e5cb7f58541879006d39774596962715
15148 -
15149 -HID: Move dereferences below a NULL test
15150 -
15151 -If the NULL test is necessary, then the dereferences should be moved below
15152 -the NULL test.
15153 -
15154 -The semantic patch that makes this change is as follows:
15155 -(http://www.emn.fr/x-info/coccinelle/)
15156 -
15157 -// <smpl>
15158 -@@
15159 -type T;
15160 -expression E,E1;
15161 -identifier i,fld;
15162 -statement S;
15163 -@@
15164 -
15165 -- T i = E->fld;
15166 -+ T i;
15167 - ... when != E=E1
15168 - when != i
15169 - if (E == NULL||...) S
15170 -+ i = E->fld;
15171 -// </smpl>
15172 -
15173 -Signed-off-by: Julia Lawall <julia@××××.dk>
15174 -Signed-off-by: Jiri Kosina <jkosina@××××.cz>
15175 ----
15176 -
15177 -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
15178 -index f2c21d5..5eb10c2 100644
15179 ---- a/drivers/hid/hid-core.c
15180 -+++ b/drivers/hid/hid-core.c
15181 -@@ -1075,14 +1075,16 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
15182 - */
15183 - int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
15184 - {
15185 -- struct hid_report_enum *report_enum = hid->report_enum + type;
15186 -- struct hid_driver *hdrv = hid->driver;
15187 -+ struct hid_report_enum *report_enum;
15188 -+ struct hid_driver *hdrv;
15189 - struct hid_report *report;
15190 - unsigned int i;
15191 - int ret;
15192 -
15193 - if (!hid || !hid->driver)
15194 - return -ENODEV;
15195 -+ report_enum = hid->report_enum + type;
15196 -+ hdrv = hid->driver;
15197 -
15198 - if (!size) {
15199 - dbg_hid("empty report\n");
15200 -
15201
15202 Deleted: genpatches-2.6/trunk/2.6.31/2500_ide-cd-handle-fragmented-patckets.patch
15203 ===================================================================
15204 --- genpatches-2.6/trunk/2.6.31/2500_ide-cd-handle-fragmented-patckets.patch 2009-09-09 23:15:13 UTC (rev 1604)
15205 +++ genpatches-2.6/trunk/2.6.31/2500_ide-cd-handle-fragmented-patckets.patch 2009-09-09 23:51:20 UTC (rev 1605)
15206 @@ -1,49 +0,0 @@
15207 -From: Borislav Petkov <petkovbb@×××××.com>
15208 -Date: Fri, 26 Jun 2009 18:22:37 +0000 (-0700)
15209 -Subject: ide-cd: handle fragmented packet commands gracefully
15210 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=9c72ebef5aabf3532469d602a9d87beceea268b1
15211 -
15212 -ide-cd: handle fragmented packet commands gracefully
15213 -
15214 -There are some devices in the wild that clear the DRQ bit during the
15215 -last word of a packet command and therefore could use a "second chance"
15216 -for that last word of data to be xferred instead of simply failing the
15217 -request. Do that by attempting to suck in those last bytes in PIO mode.
15218 -
15219 -In addition, the ATA_ERR bit has to be cleared for we cannot be sure the
15220 -data is valid otherwise.
15221 -
15222 -See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
15223 -
15224 -Signed-off-by: Borislav Petkov <petkovbb@×××××.com>
15225 -Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@×××××.com>
15226 -Signed-off-by: David S. Miller <davem@×××××××××.net>
15227 ----
15228 -
15229 -diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
15230 -index f0ede59..6a9a769 100644
15231 ---- a/drivers/ide/ide-cd.c
15232 -+++ b/drivers/ide/ide-cd.c
15233 -@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
15234 - }
15235 - } else if (!blk_pc_request(rq)) {
15236 - ide_cd_request_sense_fixup(drive, cmd);
15237 -- /* complain if we still have data left to transfer */
15238 -+
15239 - uptodate = cmd->nleft ? 0 : 1;
15240 -- if (uptodate == 0)
15241 -+
15242 -+ /*
15243 -+ * suck out the remaining bytes from the drive in an
15244 -+ * attempt to complete the data xfer. (see BZ#13399)
15245 -+ */
15246 -+ if (!(stat & ATA_ERR) && !uptodate && thislen) {
15247 -+ ide_pio_bytes(drive, cmd, write, thislen);
15248 -+ uptodate = cmd->nleft ? 0 : 1;
15249 -+ }
15250 -+
15251 -+ if (!uptodate)
15252 - rq->cmd_flags |= REQ_FAILED;
15253 - }
15254 - goto out_end;
15255 -
15256
15257 Deleted: genpatches-2.6/trunk/2.6.31/2900_makefile-no-delete-null-pointer-checks-fix.patch
15258 ===================================================================
15259 --- genpatches-2.6/trunk/2.6.31/2900_makefile-no-delete-null-pointer-checks-fix.patch 2009-09-09 23:15:13 UTC (rev 1604)
15260 +++ genpatches-2.6/trunk/2.6.31/2900_makefile-no-delete-null-pointer-checks-fix.patch 2009-09-09 23:51:20 UTC (rev 1605)
15261 @@ -1,21 +0,0 @@
15262 ---- a/Makefile 2009-07-20 15:03:31.000000000 -0400
15263 -+++ b/Makefile 2009-07-20 15:03:10.000000000 -0400
15264 -@@ -351,7 +351,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__
15265 -
15266 - KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
15267 - -fno-strict-aliasing -fno-common \
15268 -- -Werror-implicit-function-declaration
15269 -+ -Werror-implicit-function-declaration \
15270 -+ -fno-delete-null-pointer-checks
15271 - KBUILD_AFLAGS := -D__ASSEMBLY__
15272 -
15273 - # Read KERNELRELEASE from include/config/kernel.release (if it exists)
15274 -@@ -573,7 +574,7 @@ KBUILD_CFLAGS += $(call cc-option,-Wdecl
15275 - KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
15276 -
15277 - # disable invalid "can't wrap" optimizations for signed / pointers
15278 --KBUILD_CFLAGS += $(call cc-option,-fwrapv)
15279 -+KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
15280 -
15281 - # revert to pre-gcc-4.4 behaviour of .eh_frame
15282 - KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
15283
15284 Deleted: genpatches-2.6/trunk/2.6.31/2910_add-sysrq-h-needs-errno-h-include.patch
15285 ===================================================================
15286 --- genpatches-2.6/trunk/2.6.31/2910_add-sysrq-h-needs-errno-h-include.patch 2009-09-09 23:15:13 UTC (rev 1604)
15287 +++ genpatches-2.6/trunk/2.6.31/2910_add-sysrq-h-needs-errno-h-include.patch 2009-09-09 23:51:20 UTC (rev 1605)
15288 @@ -1,32 +0,0 @@
15289 -From: Tobias Doerffel <tobias.doerffel@×××××.com>
15290 -Date: Sun, 5 Jul 2009 19:08:23 +0000 (-0700)
15291 -Subject: linux/sysrq.h needs linux/errno.h
15292 -X-Git-Tag: v2.6.31-rc3~79
15293 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=82e3310ace59794ecf0f531eca94647b2863dfda
15294 -
15295 -linux/sysrq.h needs linux/errno.h
15296 -
15297 -In include/linux/sysrq.h the constant EINVAL is being used but is undefined
15298 -if include/linux/errno.h is not included before.
15299 -
15300 -Fix this by adding #include <linux/errno.h> at the beginning.
15301 -
15302 -Signed-off-by: Tobias Doerffel <tobias.doerffel@×××××.com>
15303 -Signed-off-by: Andrew Morton <akpm@××××××××××××××××.org>
15304 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
15305 ----
15306 -
15307 -diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
15308 -index 98a1d8c..99adcdc 100644
15309 ---- a/include/linux/sysrq.h
15310 -+++ b/include/linux/sysrq.h
15311 -@@ -14,6 +14,8 @@
15312 - #ifndef _LINUX_SYSRQ_H
15313 - #define _LINUX_SYSRQ_H
15314 -
15315 -+#include <linux/errno.h>
15316 -+
15317 - struct pt_regs;
15318 - struct tty_struct;
15319 -
15320 -