Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:master commit in: 3.2.55/, 3.13.7/, 3.13.8/, 3.2.56/
Date: Wed, 02 Apr 2014 15:26:36
Message-Id: 1396449815.c1faec9b8277521f644395aac444fa8517a351db.blueness@gentoo
1 commit: c1faec9b8277521f644395aac444fa8517a351db
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 2 14:43:35 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 2 14:43:35 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=c1faec9b
7
8 Grsec/PaX: 3.0-{3.2.56,3.13.8}-201404012135
9
10 ---
11 {3.13.7 => 3.13.8}/0000_README | 2 +-
12 .../4420_grsecurity-3.0-3.13.8-201404011912.patch | 204 +-
13 {3.13.7 => 3.13.8}/4425_grsec_remove_EI_PAX.patch | 0
14 .../4427_force_XATTR_PAX_tmpfs.patch | 0
15 .../4430_grsec-remove-localversion-grsec.patch | 0
16 {3.13.7 => 3.13.8}/4435_grsec-mute-warnings.patch | 0
17 .../4440_grsec-remove-protected-paths.patch | 0
18 .../4450_grsec-kconfig-default-gids.patch | 0
19 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
20 {3.13.7 => 3.13.8}/4470_disable-compat_vdso.patch | 0
21 {3.13.7 => 3.13.8}/4475_emutramp_default_on.patch | 0
22 {3.2.55 => 3.2.56}/0000_README | 6 +-
23 {3.2.55 => 3.2.56}/1021_linux-3.2.22.patch | 0
24 {3.2.55 => 3.2.56}/1022_linux-3.2.23.patch | 0
25 {3.2.55 => 3.2.56}/1023_linux-3.2.24.patch | 0
26 {3.2.55 => 3.2.56}/1024_linux-3.2.25.patch | 0
27 {3.2.55 => 3.2.56}/1025_linux-3.2.26.patch | 0
28 {3.2.55 => 3.2.56}/1026_linux-3.2.27.patch | 0
29 {3.2.55 => 3.2.56}/1027_linux-3.2.28.patch | 0
30 {3.2.55 => 3.2.56}/1028_linux-3.2.29.patch | 0
31 {3.2.55 => 3.2.56}/1029_linux-3.2.30.patch | 0
32 {3.2.55 => 3.2.56}/1030_linux-3.2.31.patch | 0
33 {3.2.55 => 3.2.56}/1031_linux-3.2.32.patch | 0
34 {3.2.55 => 3.2.56}/1032_linux-3.2.33.patch | 0
35 {3.2.55 => 3.2.56}/1033_linux-3.2.34.patch | 0
36 {3.2.55 => 3.2.56}/1034_linux-3.2.35.patch | 0
37 {3.2.55 => 3.2.56}/1035_linux-3.2.36.patch | 0
38 {3.2.55 => 3.2.56}/1036_linux-3.2.37.patch | 0
39 {3.2.55 => 3.2.56}/1037_linux-3.2.38.patch | 0
40 {3.2.55 => 3.2.56}/1038_linux-3.2.39.patch | 0
41 {3.2.55 => 3.2.56}/1039_linux-3.2.40.patch | 0
42 {3.2.55 => 3.2.56}/1040_linux-3.2.41.patch | 0
43 {3.2.55 => 3.2.56}/1041_linux-3.2.42.patch | 0
44 {3.2.55 => 3.2.56}/1042_linux-3.2.43.patch | 0
45 {3.2.55 => 3.2.56}/1043_linux-3.2.44.patch | 0
46 {3.2.55 => 3.2.56}/1044_linux-3.2.45.patch | 0
47 {3.2.55 => 3.2.56}/1045_linux-3.2.46.patch | 0
48 {3.2.55 => 3.2.56}/1046_linux-3.2.47.patch | 0
49 {3.2.55 => 3.2.56}/1047_linux-3.2.48.patch | 0
50 {3.2.55 => 3.2.56}/1048_linux-3.2.49.patch | 0
51 {3.2.55 => 3.2.56}/1049_linux-3.2.50.patch | 0
52 {3.2.55 => 3.2.56}/1050_linux-3.2.51.patch | 0
53 {3.2.55 => 3.2.56}/1051_linux-3.2.52.patch | 0
54 {3.2.55 => 3.2.56}/1052_linux-3.2.53.patch | 0
55 {3.2.55 => 3.2.56}/1053_linux-3.2.54.patch | 0
56 {3.2.55 => 3.2.56}/1054_linux-3.2.55.patch | 0
57 3.2.56/1055_linux-3.2.56.patch | 6904 ++++++++++++++++++++
58 .../4420_grsecurity-3.0-3.2.56-201404012135.patch | 477 +-
59 {3.2.55 => 3.2.56}/4425_grsec_remove_EI_PAX.patch | 0
60 .../4427_force_XATTR_PAX_tmpfs.patch | 0
61 .../4430_grsec-remove-localversion-grsec.patch | 0
62 {3.2.55 => 3.2.56}/4435_grsec-mute-warnings.patch | 0
63 .../4440_grsec-remove-protected-paths.patch | 0
64 .../4450_grsec-kconfig-default-gids.patch | 0
65 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
66 {3.2.55 => 3.2.56}/4470_disable-compat_vdso.patch | 0
67 {3.2.55 => 3.2.56}/4475_emutramp_default_on.patch | 0
68 57 files changed, 7215 insertions(+), 378 deletions(-)
69
70 diff --git a/3.13.7/0000_README b/3.13.8/0000_README
71 similarity index 96%
72 rename from 3.13.7/0000_README
73 rename to 3.13.8/0000_README
74 index f9125d0..c7f2d48 100644
75 --- a/3.13.7/0000_README
76 +++ b/3.13.8/0000_README
77 @@ -2,7 +2,7 @@ README
78 -----------------------------------------------------------------------------
79 Individual Patch Descriptions:
80 -----------------------------------------------------------------------------
81 -Patch: 4420_grsecurity-3.0-3.13.7-201403281902.patch
82 +Patch: 4420_grsecurity-3.0-3.13.8-201404011912.patch
83 From: http://www.grsecurity.net
84 Desc: hardened-sources base patch from upstream grsecurity
85
86
87 diff --git a/3.13.7/4420_grsecurity-3.0-3.13.7-201403281902.patch b/3.13.8/4420_grsecurity-3.0-3.13.8-201404011912.patch
88 similarity index 99%
89 rename from 3.13.7/4420_grsecurity-3.0-3.13.7-201403281902.patch
90 rename to 3.13.8/4420_grsecurity-3.0-3.13.8-201404011912.patch
91 index 8e4e492..9c4aaac 100644
92 --- a/3.13.7/4420_grsecurity-3.0-3.13.7-201403281902.patch
93 +++ b/3.13.8/4420_grsecurity-3.0-3.13.8-201404011912.patch
94 @@ -287,7 +287,7 @@ index b9e9bd8..bf49b92 100644
95
96 pcd. [PARIDE]
97 diff --git a/Makefile b/Makefile
98 -index 9f214b4..8c9c622 100644
99 +index 4cab13b..b7d5e41 100644
100 --- a/Makefile
101 +++ b/Makefile
102 @@ -244,8 +244,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
103 @@ -4097,7 +4097,7 @@ index cf08bdf..772656c 100644
104 unsigned long search_exception_table(unsigned long addr);
105
106 diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
107 -index 3e8f106..a0a1fe4 100644
108 +index ac1d883..5a7bb91 100644
109 --- a/arch/arm/mm/init.c
110 +++ b/arch/arm/mm/init.c
111 @@ -30,6 +30,8 @@
112 @@ -4109,7 +4109,7 @@ index 3e8f106..a0a1fe4 100644
113
114 #include <asm/mach/arch.h>
115 #include <asm/mach/map.h>
116 -@@ -681,7 +683,46 @@ void free_initmem(void)
117 +@@ -682,7 +684,46 @@ void free_initmem(void)
118 {
119 #ifdef CONFIG_HAVE_TCM
120 extern char __tcm_start, __tcm_end;
121 @@ -6662,18 +6662,9 @@ index 25da651..ae2a259 100644
122
123 #endif /* __ASM_SMTC_PROC_H */
124 diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
125 -index 81c8913..81d8432 100644
126 +index 33e8dbf..81d8432 100644
127 --- a/arch/mips/include/asm/syscall.h
128 +++ b/arch/mips/include/asm/syscall.h
129 -@@ -29,7 +29,7 @@ static inline long syscall_get_nr(struct task_struct *task,
130 - static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
131 - struct task_struct *task, struct pt_regs *regs, unsigned int n)
132 - {
133 -- unsigned long usp = regs->regs[29];
134 -+ unsigned long usp __maybe_unused = regs->regs[29];
135 -
136 - switch (n) {
137 - case 0: case 1: case 2: case 3:
138 @@ -39,14 +39,14 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
139
140 #ifdef CONFIG_32BIT
141 @@ -28104,7 +28095,7 @@ index d86ff15..e77b023 100644
142 #define APIC_LVT_NUM 6
143 /* 14 is the version for Xeon and Pentium 8.4.8*/
144 diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
145 -index ad75d77..a679d32 100644
146 +index cba218a..1cc1bed 100644
147 --- a/arch/x86/kvm/paging_tmpl.h
148 +++ b/arch/x86/kvm/paging_tmpl.h
149 @@ -331,7 +331,7 @@ retry_walk:
150 @@ -28144,7 +28135,7 @@ index 532add1..59eb241 100644
151
152 local_irq_disable();
153 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
154 -index dcc4de3..6bf73f4 100644
155 +index 31c3e8b..ca3acc6 100644
156 --- a/arch/x86/kvm/vmx.c
157 +++ b/arch/x86/kvm/vmx.c
158 @@ -1316,12 +1316,12 @@ static void vmcs_write64(unsigned long field, u64 value)
159 @@ -33546,7 +33537,7 @@ index 0000000..dace51c
160 +EXPORT_SYMBOL(__pax_close_userland);
161 +#endif
162 diff --git a/arch/x86/net/bpf_jit.S b/arch/x86/net/bpf_jit.S
163 -index 877b9a1..f746de8 100644
164 +index 0149575..f746de8 100644
165 --- a/arch/x86/net/bpf_jit.S
166 +++ b/arch/x86/net/bpf_jit.S
167 @@ -9,6 +9,7 @@
168 @@ -33620,15 +33611,6 @@ index 877b9a1..f746de8 100644
169 ret
170
171 #define sk_negative_common(SIZE) \
172 -@@ -140,7 +149,7 @@ bpf_slow_path_byte_msh:
173 - push %r9; \
174 - push SKBDATA; \
175 - /* rsi already has offset */ \
176 -- mov $SIZE,%ecx; /* size */ \
177 -+ mov $SIZE,%edx; /* size */ \
178 - call bpf_internal_load_pointer_neg_helper; \
179 - test %rax,%rax; \
180 - pop SKBDATA; \
181 @@ -157,6 +166,7 @@ sk_load_word_negative_offset:
182 sk_negative_common(4)
183 mov (%rax), %eax
184 @@ -40134,7 +40116,7 @@ index 3c59584..500f2e9 100644
185
186 return ret;
187 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
188 -index a209177..842a89a 100644
189 +index 9702704..3fb9e40 100644
190 --- a/drivers/gpu/drm/i915/i915_irq.c
191 +++ b/drivers/gpu/drm/i915/i915_irq.c
192 @@ -1419,7 +1419,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
193 @@ -40191,7 +40173,7 @@ index a209177..842a89a 100644
194
195 I915_WRITE(GEN8_MASTER_IRQ, 0);
196 POSTING_READ(GEN8_MASTER_IRQ);
197 -@@ -2998,7 +2998,7 @@ static void gen8_irq_uninstall(struct drm_device *dev)
198 +@@ -2996,7 +2996,7 @@ static void gen8_irq_uninstall(struct drm_device *dev)
199 if (!dev_priv)
200 return;
201
202 @@ -40200,7 +40182,7 @@ index a209177..842a89a 100644
203
204 I915_WRITE(GEN8_MASTER_IRQ, 0);
205
206 -@@ -3092,7 +3092,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
207 +@@ -3090,7 +3090,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
208 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
209 int pipe;
210
211 @@ -40209,7 +40191,7 @@ index a209177..842a89a 100644
212
213 for_each_pipe(pipe)
214 I915_WRITE(PIPESTAT(pipe), 0);
215 -@@ -3178,7 +3178,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
216 +@@ -3176,7 +3176,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
217 I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
218 I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
219
220 @@ -40218,7 +40200,7 @@ index a209177..842a89a 100644
221
222 iir = I915_READ16(IIR);
223 if (iir == 0)
224 -@@ -3253,7 +3253,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
225 +@@ -3251,7 +3251,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
226 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
227 int pipe;
228
229 @@ -40227,7 +40209,7 @@ index a209177..842a89a 100644
230
231 if (I915_HAS_HOTPLUG(dev)) {
232 I915_WRITE(PORT_HOTPLUG_EN, 0);
233 -@@ -3360,7 +3360,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
234 +@@ -3358,7 +3358,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
235 I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
236 int pipe, ret = IRQ_NONE;
237
238 @@ -40236,7 +40218,7 @@ index a209177..842a89a 100644
239
240 iir = I915_READ(IIR);
241 do {
242 -@@ -3487,7 +3487,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
243 +@@ -3485,7 +3485,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
244 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
245 int pipe;
246
247 @@ -40245,7 +40227,7 @@ index a209177..842a89a 100644
248
249 I915_WRITE(PORT_HOTPLUG_EN, 0);
250 I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT));
251 -@@ -3603,7 +3603,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
252 +@@ -3601,7 +3601,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
253 I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
254 I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
255
256 @@ -41475,7 +41457,7 @@ index cea623c..73011b0 100644
257 ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
258 if (ret)
259 diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
260 -index f0c5e07..399256e 100644
261 +index f0c5e07..49a4d4a 100644
262 --- a/drivers/hv/hv.c
263 +++ b/drivers/hv/hv.c
264 @@ -112,7 +112,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
265 @@ -41487,6 +41469,15 @@ index f0c5e07..399256e 100644
266
267 __asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
268 "=a"(hv_status_lo) : "d" (control_hi),
269 +@@ -154,7 +154,7 @@ int hv_init(void)
270 + /* See if the hypercall page is already set */
271 + rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
272 +
273 +- virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
274 ++ virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_RX);
275 +
276 + if (!virtaddr)
277 + goto cleanup;
278 diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
279 index 7e17a54..a50a33d 100644
280 --- a/drivers/hv/hv_balloon.c
281 @@ -44527,10 +44518,10 @@ index 46da365..3ba4206 100644
282 dev_set_drvdata(&dev->dev, dev);
283 rc = device_add(&dev->dev);
284 diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
285 -index 20e345d..da56fe4 100644
286 +index a1c641e..3007da9 100644
287 --- a/drivers/media/usb/dvb-usb/cxusb.c
288 +++ b/drivers/media/usb/dvb-usb/cxusb.c
289 -@@ -1101,7 +1101,7 @@ static struct dib0070_config dib7070p_dib0070_config = {
290 +@@ -1112,7 +1112,7 @@ static struct dib0070_config dib7070p_dib0070_config = {
291
292 struct dib0700_adapter_state {
293 int (*set_param_save) (struct dvb_frontend *);
294 @@ -44540,7 +44531,7 @@ index 20e345d..da56fe4 100644
295 static int dib7070_set_param_override(struct dvb_frontend *fe)
296 {
297 diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
298 -index c1a63b2..dbcbfb6 100644
299 +index f272ed8..6289f9c 100644
300 --- a/drivers/media/usb/dvb-usb/dw2102.c
301 +++ b/drivers/media/usb/dvb-usb/dw2102.c
302 @@ -121,7 +121,7 @@ struct su3000_state {
303 @@ -45520,19 +45511,6 @@ index 7b5424f..ed1d6ac 100644
304 err = -EFAULT;
305 goto cmd_rel_host;
306 }
307 -diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
308 -index 357bbc5..3e049c1 100644
309 ---- a/drivers/mmc/card/queue.c
310 -+++ b/drivers/mmc/card/queue.c
311 -@@ -197,7 +197,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
312 - struct mmc_queue_req *mqrq_prev = &mq->mqrq[1];
313 -
314 - if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
315 -- limit = dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
316 -+ limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
317 -
318 - mq->card = card;
319 - mq->queue = blk_init_queue(mmc_request_fn, lock);
320 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
321 index e5b5eeb..7bf2212 100644
322 --- a/drivers/mmc/core/mmc_ops.c
323 @@ -48233,10 +48211,10 @@ index 84419af..268ede8 100644
324 &dev_attr_energy_uj.attr;
325 }
326 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
327 -index 75dffb79..df850cd 100644
328 +index 7271299..20217a5 100644
329 --- a/drivers/regulator/core.c
330 +++ b/drivers/regulator/core.c
331 -@@ -3370,7 +3370,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
332 +@@ -3366,7 +3366,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
333 {
334 const struct regulation_constraints *constraints = NULL;
335 const struct regulator_init_data *init_data;
336 @@ -48245,7 +48223,7 @@ index 75dffb79..df850cd 100644
337 struct regulator_dev *rdev;
338 struct device *dev;
339 int ret, i;
340 -@@ -3440,7 +3440,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
341 +@@ -3436,7 +3436,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
342 rdev->dev.of_node = config->of_node;
343 rdev->dev.parent = dev;
344 dev_set_name(&rdev->dev, "regulator.%d",
345 @@ -49380,7 +49358,7 @@ index fe0bcb1..c9255be 100644
346 /* check if the device is still usable */
347 if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
348 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
349 -index 7bd7f0d..93159d8 100644
350 +index 62ec84b..93159d8 100644
351 --- a/drivers/scsi/scsi_lib.c
352 +++ b/drivers/scsi/scsi_lib.c
353 @@ -1474,7 +1474,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
354 @@ -49404,15 +49382,6 @@ index 7bd7f0d..93159d8 100644
355
356 disposition = scsi_decide_disposition(cmd);
357 if (disposition != SUCCESS &&
358 -@@ -1684,7 +1684,7 @@ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
359 -
360 - host_dev = scsi_get_device(shost);
361 - if (host_dev && host_dev->dma_mask)
362 -- bounce_limit = dma_max_pfn(host_dev) << PAGE_SHIFT;
363 -+ bounce_limit = (u64)dma_max_pfn(host_dev) << PAGE_SHIFT;
364 -
365 - return bounce_limit;
366 - }
367 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
368 index 8ff62c2..693b6f7 100644
369 --- a/drivers/scsi/scsi_sysfs.c
370 @@ -52136,6 +52105,38 @@ index 1eab4ac..e21efc9 100644
371 iommu_group_id(group->iommu_group));
372
373 return 0;
374 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
375 +index b12176f..e5522d9 100644
376 +--- a/drivers/vhost/net.c
377 ++++ b/drivers/vhost/net.c
378 +@@ -528,6 +528,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
379 + *iovcount = seg;
380 + if (unlikely(log))
381 + *log_num = nlogs;
382 ++
383 ++ /* Detect overrun */
384 ++ if (unlikely(datalen > 0)) {
385 ++ r = UIO_MAXIOV + 1;
386 ++ goto err;
387 ++ }
388 + return headcount;
389 + err:
390 + vhost_discard_vq_desc(vq, headcount);
391 +@@ -583,6 +589,14 @@ static void handle_rx(struct vhost_net *net)
392 + /* On error, stop handling until the next kick. */
393 + if (unlikely(headcount < 0))
394 + break;
395 ++ /* On overrun, truncate and discard */
396 ++ if (unlikely(headcount > UIO_MAXIOV)) {
397 ++ msg.msg_iovlen = 1;
398 ++ err = sock->ops->recvmsg(NULL, sock, &msg,
399 ++ 1, MSG_DONTWAIT | MSG_TRUNC);
400 ++ pr_debug("Discarded rx packet: len %zd\n", sock_len);
401 ++ continue;
402 ++ }
403 + /* OK, now we need to know about added descriptors. */
404 + if (!headcount) {
405 + if (unlikely(vhost_enable_notify(&net->dev, vq))) {
406 diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
407 index 5174eba..451e6bc 100644
408 --- a/drivers/vhost/vringh.c
409 @@ -87855,7 +87856,7 @@ index 06ec886..9dba35e 100644
410
411 if (pm_wakeup_pending()) {
412 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
413 -index be7c86b..b972b27 100644
414 +index 97fb834..b972b27 100644
415 --- a/kernel/printk/printk.c
416 +++ b/kernel/printk/printk.c
417 @@ -385,6 +385,11 @@ static int check_syslog_permissions(int type, bool from_file)
418 @@ -87870,22 +87871,6 @@ index be7c86b..b972b27 100644
419 if (syslog_action_restricted(type)) {
420 if (capable(CAP_SYSLOG))
421 return 0;
422 -@@ -1080,7 +1085,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
423 - next_seq = log_next_seq;
424 -
425 - len = 0;
426 -- prev = 0;
427 - while (len >= 0 && seq < next_seq) {
428 - struct printk_log *msg = log_from_idx(idx);
429 - int textlen;
430 -@@ -2789,7 +2793,6 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
431 - next_idx = idx;
432 -
433 - l = 0;
434 -- prev = 0;
435 - while (seq < dumper->next_seq) {
436 - struct printk_log *msg = log_from_idx(idx);
437 -
438 diff --git a/kernel/profile.c b/kernel/profile.c
439 index 6631e1e..310c266 100644
440 --- a/kernel/profile.c
441 @@ -90311,10 +90296,10 @@ index 26dc348..8708ca7 100644
442 + return atomic64_inc_return_unchecked(&trace_counter);
443 }
444 diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
445 -index 2e58196..fdd3d61 100644
446 +index ba983dc..911aaf9 100644
447 --- a/kernel/trace/trace_events.c
448 +++ b/kernel/trace/trace_events.c
449 -@@ -1681,7 +1681,6 @@ __trace_early_add_new_event(struct ftrace_event_call *call,
450 +@@ -1675,7 +1675,6 @@ __trace_early_add_new_event(struct ftrace_event_call *call,
451 return 0;
452 }
453
454 @@ -91016,7 +91001,7 @@ index 7811ed3..f80ca19 100644
455 static inline void *ptr_to_indirect(void *ptr)
456 {
457 diff --git a/lib/random32.c b/lib/random32.c
458 -index 1e5b2df..fb616c7 100644
459 +index 1e5b2df..009bfe8 100644
460 --- a/lib/random32.c
461 +++ b/lib/random32.c
462 @@ -44,7 +44,7 @@
463 @@ -91028,6 +91013,27 @@ index 1e5b2df..fb616c7 100644
464
465 /**
466 * prandom_u32_state - seeded pseudo-random number generator.
467 +@@ -244,8 +244,19 @@ static void __prandom_reseed(bool late)
468 + static bool latch = false;
469 + static DEFINE_SPINLOCK(lock);
470 +
471 ++ /* Asking for random bytes might result in bytes getting
472 ++ * moved into the nonblocking pool and thus marking it
473 ++ * as initialized. In this case we would double back into
474 ++ * this function and attempt to do a late reseed.
475 ++ * Ignore the pointless attempt to reseed again if we're
476 ++ * already waiting for bytes when the nonblocking pool
477 ++ * got initialized.
478 ++ */
479 ++
480 + /* only allow initial seeding (late == false) once */
481 +- spin_lock_irqsave(&lock, flags);
482 ++ if (!spin_trylock_irqsave(&lock, flags))
483 ++ return;
484 ++
485 + if (latch && !late)
486 + goto out;
487 + latch = true;
488 diff --git a/lib/rbtree.c b/lib/rbtree.c
489 index 65f4eff..2cfa167 100644
490 --- a/lib/rbtree.c
491 @@ -96649,7 +96655,7 @@ index 3f9b0f3..fc6d4fa 100644
492
493 if (__rtnl_register(PF_CAN, RTM_GETROUTE, NULL, cgw_dump_jobs, NULL)) {
494 diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
495 -index 4a5df7b..9ad1f1d 100644
496 +index 464303f..9c30218 100644
497 --- a/net/ceph/messenger.c
498 +++ b/net/ceph/messenger.c
499 @@ -186,7 +186,7 @@ static void con_fault(struct ceph_connection *con);
500 @@ -101525,24 +101531,6 @@ index e83c416..f87df4c 100644
501
502 set_fs(KERNEL_DS);
503 if (level == SOL_SOCKET)
504 -diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
505 -index a642fd616..1eebf22 100644
506 ---- a/net/sunrpc/auth_gss/auth_gss.c
507 -+++ b/net/sunrpc/auth_gss/auth_gss.c
508 -@@ -500,10 +500,12 @@ gss_alloc_msg(struct gss_auth *gss_auth,
509 - default:
510 - err = gss_encode_v1_msg(gss_msg, service_name, gss_auth->target_name);
511 - if (err)
512 -- goto err_free_msg;
513 -+ goto err_put_pipe_version;
514 - };
515 - kref_get(&gss_auth->kref);
516 - return gss_msg;
517 -+err_put_pipe_version:
518 -+ put_pipe_version(gss_auth->net);
519 - err_free_msg:
520 - kfree(gss_msg);
521 - err:
522 diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
523 index 1b94a9c..496f7f5 100644
524 --- a/net/sunrpc/auth_gss/svcauth_gss.c
525 @@ -102544,16 +102532,16 @@ index 078fe1d..fbdb363 100644
526 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
527 diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh
528 new file mode 100644
529 -index 0000000..ed4c19a
530 +index 0000000..3c23999
531 --- /dev/null
532 +++ b/scripts/gcc-plugin.sh
533 @@ -0,0 +1,16 @@
534 +#!/bin/bash
535 +srctree=$(dirname "$0")
536 -+gccplugins_dir=$("$1" -print-file-name=plugin)
537 ++gccplugins_dir=$("$3" -print-file-name=plugin)
538 +plugincc=$("$1" -E -shared - -o /dev/null -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF
539 +#include "gcc-common.h"
540 -+#if __GNUC__ > 4 || __GNUC_MINOR__ >= 8 || defined(ENABLE_BUILD_WITH_CXX)
541 ++#if BUILDING_GCC_VERSION >= 4008 || defined(ENABLE_BUILD_WITH_CXX)
542 +#warning $2
543 +#else
544 +#warning $1
545 @@ -102788,7 +102776,7 @@ index 0865b3e..7235dd4 100644
546 __ksymtab_gpl : { *(SORT(___ksymtab_gpl+*)) }
547 __ksymtab_unused : { *(SORT(___ksymtab_unused+*)) }
548 diff --git a/scripts/package/builddeb b/scripts/package/builddeb
549 -index 90e521f..e9eaf8f 100644
550 +index c1bb9be..63aed853 100644
551 --- a/scripts/package/builddeb
552 +++ b/scripts/package/builddeb
553 @@ -281,6 +281,7 @@ fi
554 @@ -107087,7 +107075,7 @@ index 0000000..dd73713
555 +}
556 diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c
557 new file mode 100644
558 -index 0000000..c96f80f
559 +index 0000000..319229d
560 --- /dev/null
561 +++ b/tools/gcc/latent_entropy_plugin.c
562 @@ -0,0 +1,457 @@
563 @@ -107119,7 +107107,7 @@ index 0000000..c96f80f
564 +static tree latent_entropy_decl;
565 +
566 +static struct plugin_info latent_entropy_plugin_info = {
567 -+ .version = "201403042150",
568 ++ .version = "201403280150",
569 + .help = NULL
570 +};
571 +
572
573 diff --git a/3.13.7/4425_grsec_remove_EI_PAX.patch b/3.13.8/4425_grsec_remove_EI_PAX.patch
574 similarity index 100%
575 rename from 3.13.7/4425_grsec_remove_EI_PAX.patch
576 rename to 3.13.8/4425_grsec_remove_EI_PAX.patch
577
578 diff --git a/3.13.7/4427_force_XATTR_PAX_tmpfs.patch b/3.13.8/4427_force_XATTR_PAX_tmpfs.patch
579 similarity index 100%
580 rename from 3.13.7/4427_force_XATTR_PAX_tmpfs.patch
581 rename to 3.13.8/4427_force_XATTR_PAX_tmpfs.patch
582
583 diff --git a/3.13.7/4430_grsec-remove-localversion-grsec.patch b/3.13.8/4430_grsec-remove-localversion-grsec.patch
584 similarity index 100%
585 rename from 3.13.7/4430_grsec-remove-localversion-grsec.patch
586 rename to 3.13.8/4430_grsec-remove-localversion-grsec.patch
587
588 diff --git a/3.13.7/4435_grsec-mute-warnings.patch b/3.13.8/4435_grsec-mute-warnings.patch
589 similarity index 100%
590 rename from 3.13.7/4435_grsec-mute-warnings.patch
591 rename to 3.13.8/4435_grsec-mute-warnings.patch
592
593 diff --git a/3.13.7/4440_grsec-remove-protected-paths.patch b/3.13.8/4440_grsec-remove-protected-paths.patch
594 similarity index 100%
595 rename from 3.13.7/4440_grsec-remove-protected-paths.patch
596 rename to 3.13.8/4440_grsec-remove-protected-paths.patch
597
598 diff --git a/3.13.7/4450_grsec-kconfig-default-gids.patch b/3.13.8/4450_grsec-kconfig-default-gids.patch
599 similarity index 100%
600 rename from 3.13.7/4450_grsec-kconfig-default-gids.patch
601 rename to 3.13.8/4450_grsec-kconfig-default-gids.patch
602
603 diff --git a/3.13.7/4465_selinux-avc_audit-log-curr_ip.patch b/3.13.8/4465_selinux-avc_audit-log-curr_ip.patch
604 similarity index 100%
605 rename from 3.13.7/4465_selinux-avc_audit-log-curr_ip.patch
606 rename to 3.13.8/4465_selinux-avc_audit-log-curr_ip.patch
607
608 diff --git a/3.13.7/4470_disable-compat_vdso.patch b/3.13.8/4470_disable-compat_vdso.patch
609 similarity index 100%
610 rename from 3.13.7/4470_disable-compat_vdso.patch
611 rename to 3.13.8/4470_disable-compat_vdso.patch
612
613 diff --git a/3.13.7/4475_emutramp_default_on.patch b/3.13.8/4475_emutramp_default_on.patch
614 similarity index 100%
615 rename from 3.13.7/4475_emutramp_default_on.patch
616 rename to 3.13.8/4475_emutramp_default_on.patch
617
618 diff --git a/3.2.55/0000_README b/3.2.56/0000_README
619 similarity index 97%
620 rename from 3.2.55/0000_README
621 rename to 3.2.56/0000_README
622 index d6fed9e..ce219c9 100644
623 --- a/3.2.55/0000_README
624 +++ b/3.2.56/0000_README
625 @@ -138,7 +138,11 @@ Patch: 1054_linux-3.2.55.patch
626 From: http://www.kernel.org
627 Desc: Linux 3.2.55
628
629 -Patch: 4420_grsecurity-3.0-3.2.55-201403300851.patch
630 +Patch: 1055_linux-3.2.56.patch
631 +From: http://www.kernel.org
632 +Desc: Linux 3.2.56
633 +
634 +Patch: 4420_grsecurity-3.0-3.2.56-201404012135.patch
635 From: http://www.grsecurity.net
636 Desc: hardened-sources base patch from upstream grsecurity
637
638
639 diff --git a/3.2.55/1021_linux-3.2.22.patch b/3.2.56/1021_linux-3.2.22.patch
640 similarity index 100%
641 rename from 3.2.55/1021_linux-3.2.22.patch
642 rename to 3.2.56/1021_linux-3.2.22.patch
643
644 diff --git a/3.2.55/1022_linux-3.2.23.patch b/3.2.56/1022_linux-3.2.23.patch
645 similarity index 100%
646 rename from 3.2.55/1022_linux-3.2.23.patch
647 rename to 3.2.56/1022_linux-3.2.23.patch
648
649 diff --git a/3.2.55/1023_linux-3.2.24.patch b/3.2.56/1023_linux-3.2.24.patch
650 similarity index 100%
651 rename from 3.2.55/1023_linux-3.2.24.patch
652 rename to 3.2.56/1023_linux-3.2.24.patch
653
654 diff --git a/3.2.55/1024_linux-3.2.25.patch b/3.2.56/1024_linux-3.2.25.patch
655 similarity index 100%
656 rename from 3.2.55/1024_linux-3.2.25.patch
657 rename to 3.2.56/1024_linux-3.2.25.patch
658
659 diff --git a/3.2.55/1025_linux-3.2.26.patch b/3.2.56/1025_linux-3.2.26.patch
660 similarity index 100%
661 rename from 3.2.55/1025_linux-3.2.26.patch
662 rename to 3.2.56/1025_linux-3.2.26.patch
663
664 diff --git a/3.2.55/1026_linux-3.2.27.patch b/3.2.56/1026_linux-3.2.27.patch
665 similarity index 100%
666 rename from 3.2.55/1026_linux-3.2.27.patch
667 rename to 3.2.56/1026_linux-3.2.27.patch
668
669 diff --git a/3.2.55/1027_linux-3.2.28.patch b/3.2.56/1027_linux-3.2.28.patch
670 similarity index 100%
671 rename from 3.2.55/1027_linux-3.2.28.patch
672 rename to 3.2.56/1027_linux-3.2.28.patch
673
674 diff --git a/3.2.55/1028_linux-3.2.29.patch b/3.2.56/1028_linux-3.2.29.patch
675 similarity index 100%
676 rename from 3.2.55/1028_linux-3.2.29.patch
677 rename to 3.2.56/1028_linux-3.2.29.patch
678
679 diff --git a/3.2.55/1029_linux-3.2.30.patch b/3.2.56/1029_linux-3.2.30.patch
680 similarity index 100%
681 rename from 3.2.55/1029_linux-3.2.30.patch
682 rename to 3.2.56/1029_linux-3.2.30.patch
683
684 diff --git a/3.2.55/1030_linux-3.2.31.patch b/3.2.56/1030_linux-3.2.31.patch
685 similarity index 100%
686 rename from 3.2.55/1030_linux-3.2.31.patch
687 rename to 3.2.56/1030_linux-3.2.31.patch
688
689 diff --git a/3.2.55/1031_linux-3.2.32.patch b/3.2.56/1031_linux-3.2.32.patch
690 similarity index 100%
691 rename from 3.2.55/1031_linux-3.2.32.patch
692 rename to 3.2.56/1031_linux-3.2.32.patch
693
694 diff --git a/3.2.55/1032_linux-3.2.33.patch b/3.2.56/1032_linux-3.2.33.patch
695 similarity index 100%
696 rename from 3.2.55/1032_linux-3.2.33.patch
697 rename to 3.2.56/1032_linux-3.2.33.patch
698
699 diff --git a/3.2.55/1033_linux-3.2.34.patch b/3.2.56/1033_linux-3.2.34.patch
700 similarity index 100%
701 rename from 3.2.55/1033_linux-3.2.34.patch
702 rename to 3.2.56/1033_linux-3.2.34.patch
703
704 diff --git a/3.2.55/1034_linux-3.2.35.patch b/3.2.56/1034_linux-3.2.35.patch
705 similarity index 100%
706 rename from 3.2.55/1034_linux-3.2.35.patch
707 rename to 3.2.56/1034_linux-3.2.35.patch
708
709 diff --git a/3.2.55/1035_linux-3.2.36.patch b/3.2.56/1035_linux-3.2.36.patch
710 similarity index 100%
711 rename from 3.2.55/1035_linux-3.2.36.patch
712 rename to 3.2.56/1035_linux-3.2.36.patch
713
714 diff --git a/3.2.55/1036_linux-3.2.37.patch b/3.2.56/1036_linux-3.2.37.patch
715 similarity index 100%
716 rename from 3.2.55/1036_linux-3.2.37.patch
717 rename to 3.2.56/1036_linux-3.2.37.patch
718
719 diff --git a/3.2.55/1037_linux-3.2.38.patch b/3.2.56/1037_linux-3.2.38.patch
720 similarity index 100%
721 rename from 3.2.55/1037_linux-3.2.38.patch
722 rename to 3.2.56/1037_linux-3.2.38.patch
723
724 diff --git a/3.2.55/1038_linux-3.2.39.patch b/3.2.56/1038_linux-3.2.39.patch
725 similarity index 100%
726 rename from 3.2.55/1038_linux-3.2.39.patch
727 rename to 3.2.56/1038_linux-3.2.39.patch
728
729 diff --git a/3.2.55/1039_linux-3.2.40.patch b/3.2.56/1039_linux-3.2.40.patch
730 similarity index 100%
731 rename from 3.2.55/1039_linux-3.2.40.patch
732 rename to 3.2.56/1039_linux-3.2.40.patch
733
734 diff --git a/3.2.55/1040_linux-3.2.41.patch b/3.2.56/1040_linux-3.2.41.patch
735 similarity index 100%
736 rename from 3.2.55/1040_linux-3.2.41.patch
737 rename to 3.2.56/1040_linux-3.2.41.patch
738
739 diff --git a/3.2.55/1041_linux-3.2.42.patch b/3.2.56/1041_linux-3.2.42.patch
740 similarity index 100%
741 rename from 3.2.55/1041_linux-3.2.42.patch
742 rename to 3.2.56/1041_linux-3.2.42.patch
743
744 diff --git a/3.2.55/1042_linux-3.2.43.patch b/3.2.56/1042_linux-3.2.43.patch
745 similarity index 100%
746 rename from 3.2.55/1042_linux-3.2.43.patch
747 rename to 3.2.56/1042_linux-3.2.43.patch
748
749 diff --git a/3.2.55/1043_linux-3.2.44.patch b/3.2.56/1043_linux-3.2.44.patch
750 similarity index 100%
751 rename from 3.2.55/1043_linux-3.2.44.patch
752 rename to 3.2.56/1043_linux-3.2.44.patch
753
754 diff --git a/3.2.55/1044_linux-3.2.45.patch b/3.2.56/1044_linux-3.2.45.patch
755 similarity index 100%
756 rename from 3.2.55/1044_linux-3.2.45.patch
757 rename to 3.2.56/1044_linux-3.2.45.patch
758
759 diff --git a/3.2.55/1045_linux-3.2.46.patch b/3.2.56/1045_linux-3.2.46.patch
760 similarity index 100%
761 rename from 3.2.55/1045_linux-3.2.46.patch
762 rename to 3.2.56/1045_linux-3.2.46.patch
763
764 diff --git a/3.2.55/1046_linux-3.2.47.patch b/3.2.56/1046_linux-3.2.47.patch
765 similarity index 100%
766 rename from 3.2.55/1046_linux-3.2.47.patch
767 rename to 3.2.56/1046_linux-3.2.47.patch
768
769 diff --git a/3.2.55/1047_linux-3.2.48.patch b/3.2.56/1047_linux-3.2.48.patch
770 similarity index 100%
771 rename from 3.2.55/1047_linux-3.2.48.patch
772 rename to 3.2.56/1047_linux-3.2.48.patch
773
774 diff --git a/3.2.55/1048_linux-3.2.49.patch b/3.2.56/1048_linux-3.2.49.patch
775 similarity index 100%
776 rename from 3.2.55/1048_linux-3.2.49.patch
777 rename to 3.2.56/1048_linux-3.2.49.patch
778
779 diff --git a/3.2.55/1049_linux-3.2.50.patch b/3.2.56/1049_linux-3.2.50.patch
780 similarity index 100%
781 rename from 3.2.55/1049_linux-3.2.50.patch
782 rename to 3.2.56/1049_linux-3.2.50.patch
783
784 diff --git a/3.2.55/1050_linux-3.2.51.patch b/3.2.56/1050_linux-3.2.51.patch
785 similarity index 100%
786 rename from 3.2.55/1050_linux-3.2.51.patch
787 rename to 3.2.56/1050_linux-3.2.51.patch
788
789 diff --git a/3.2.55/1051_linux-3.2.52.patch b/3.2.56/1051_linux-3.2.52.patch
790 similarity index 100%
791 rename from 3.2.55/1051_linux-3.2.52.patch
792 rename to 3.2.56/1051_linux-3.2.52.patch
793
794 diff --git a/3.2.55/1052_linux-3.2.53.patch b/3.2.56/1052_linux-3.2.53.patch
795 similarity index 100%
796 rename from 3.2.55/1052_linux-3.2.53.patch
797 rename to 3.2.56/1052_linux-3.2.53.patch
798
799 diff --git a/3.2.55/1053_linux-3.2.54.patch b/3.2.56/1053_linux-3.2.54.patch
800 similarity index 100%
801 rename from 3.2.55/1053_linux-3.2.54.patch
802 rename to 3.2.56/1053_linux-3.2.54.patch
803
804 diff --git a/3.2.55/1054_linux-3.2.55.patch b/3.2.56/1054_linux-3.2.55.patch
805 similarity index 100%
806 rename from 3.2.55/1054_linux-3.2.55.patch
807 rename to 3.2.56/1054_linux-3.2.55.patch
808
809 diff --git a/3.2.56/1055_linux-3.2.56.patch b/3.2.56/1055_linux-3.2.56.patch
810 new file mode 100644
811 index 0000000..2e8239c
812 --- /dev/null
813 +++ b/3.2.56/1055_linux-3.2.56.patch
814 @@ -0,0 +1,6904 @@
815 +diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
816 +index 0ec91f0..404a097 100644
817 +--- a/Documentation/filesystems/proc.txt
818 ++++ b/Documentation/filesystems/proc.txt
819 +@@ -1293,8 +1293,8 @@ may allocate from based on an estimation of its current memory and swap use.
820 + For example, if a task is using all allowed memory, its badness score will be
821 + 1000. If it is using half of its allowed memory, its score will be 500.
822 +
823 +-There is an additional factor included in the badness score: root
824 +-processes are given 3% extra memory over other tasks.
825 ++There is an additional factor included in the badness score: the current memory
826 ++and swap usage is discounted by 3% for root processes.
827 +
828 + The amount of "allowed" memory depends on the context in which the oom killer
829 + was called. If it is due to the memory assigned to the allocating task's cpuset
830 +diff --git a/Documentation/i2c/busses/i2c-piix4 b/Documentation/i2c/busses/i2c-piix4
831 +index 65da157..0982e72 100644
832 +--- a/Documentation/i2c/busses/i2c-piix4
833 ++++ b/Documentation/i2c/busses/i2c-piix4
834 +@@ -8,7 +8,7 @@ Supported adapters:
835 + Datasheet: Only available via NDA from ServerWorks
836 + * ATI IXP200, IXP300, IXP400, SB600, SB700 and SB800 southbridges
837 + Datasheet: Not publicly available
838 +- * AMD Hudson-2, CZ
839 ++ * AMD Hudson-2, ML, CZ
840 + Datasheet: Not publicly available
841 + * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
842 + Datasheet: Publicly available at the SMSC website http://www.smsc.com
843 +diff --git a/Makefile b/Makefile
844 +index 538463e..ec90bfb 100644
845 +--- a/Makefile
846 ++++ b/Makefile
847 +@@ -1,6 +1,6 @@
848 + VERSION = 3
849 + PATCHLEVEL = 2
850 +-SUBLEVEL = 55
851 ++SUBLEVEL = 56
852 + EXTRAVERSION =
853 + NAME = Saber-toothed Squirrel
854 +
855 +diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
856 +index 40736da..1d2ef5a 100644
857 +--- a/arch/alpha/lib/csum_partial_copy.c
858 ++++ b/arch/alpha/lib/csum_partial_copy.c
859 +@@ -373,6 +373,11 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
860 + __wsum
861 + csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
862 + {
863 +- return csum_partial_copy_from_user((__force const void __user *)src,
864 +- dst, len, sum, NULL);
865 ++ __wsum checksum;
866 ++ mm_segment_t oldfs = get_fs();
867 ++ set_fs(KERNEL_DS);
868 ++ checksum = csum_partial_copy_from_user((__force const void __user *)src,
869 ++ dst, len, sum, NULL);
870 ++ set_fs(oldfs);
871 ++ return checksum;
872 + }
873 +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
874 +index 1397408..b1e0e07 100644
875 +--- a/arch/arm/include/asm/cacheflush.h
876 ++++ b/arch/arm/include/asm/cacheflush.h
877 +@@ -202,6 +202,7 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *,
878 + static inline void __flush_icache_all(void)
879 + {
880 + __flush_icache_preferred();
881 ++ dsb();
882 + }
883 +
884 + #define flush_cache_all() __cpuc_flush_kern_all()
885 +diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
886 +index 65fa3c8..095a9a3 100644
887 +--- a/arch/arm/include/asm/spinlock.h
888 ++++ b/arch/arm/include/asm/spinlock.h
889 +@@ -44,18 +44,9 @@
890 +
891 + static inline void dsb_sev(void)
892 + {
893 +-#if __LINUX_ARM_ARCH__ >= 7
894 +- __asm__ __volatile__ (
895 +- "dsb\n"
896 +- SEV
897 +- );
898 +-#else
899 +- __asm__ __volatile__ (
900 +- "mcr p15, 0, %0, c7, c10, 4\n"
901 +- SEV
902 +- : : "r" (0)
903 +- );
904 +-#endif
905 ++
906 ++ dsb();
907 ++ __asm__(SEV);
908 + }
909 +
910 + /*
911 +diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
912 +index 8168d99..85a5348 100644
913 +--- a/arch/arm/mm/proc-v6.S
914 ++++ b/arch/arm/mm/proc-v6.S
915 +@@ -199,7 +199,6 @@ __v6_setup:
916 + mcr p15, 0, r0, c7, c14, 0 @ clean+invalidate D cache
917 + mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
918 + mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache
919 +- mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
920 + #ifdef CONFIG_MMU
921 + mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs
922 + mcr p15, 0, r0, c2, c0, 2 @ TTB control register
923 +@@ -209,6 +208,8 @@ __v6_setup:
924 + ALT_UP(orr r8, r8, #TTB_FLAGS_UP)
925 + mcr p15, 0, r8, c2, c0, 1 @ load TTB1
926 + #endif /* CONFIG_MMU */
927 ++ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer and
928 ++ @ complete invalidations
929 + adr r5, v6_crval
930 + ldmia r5, {r5, r6}
931 + #ifdef CONFIG_CPU_ENDIAN_BE8
932 +diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
933 +index 785365e..19d21ff 100644
934 +--- a/arch/arm/mm/proc-v7.S
935 ++++ b/arch/arm/mm/proc-v7.S
936 +@@ -368,7 +368,6 @@ __v7_setup:
937 +
938 + 3: mov r10, #0
939 + mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate
940 +- dsb
941 + #ifdef CONFIG_MMU
942 + mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs
943 + mcr p15, 0, r10, c2, c0, 2 @ TTB control register
944 +@@ -382,6 +381,7 @@ __v7_setup:
945 + mcr p15, 0, r5, c10, c2, 0 @ write PRRR
946 + mcr p15, 0, r6, c10, c2, 1 @ write NMRR
947 + #endif
948 ++ dsb @ Complete invalidations
949 + #ifndef CONFIG_ARM_THUMBEE
950 + mrc p15, 0, r0, c0, c1, 0 @ read ID_PFR0 for ThumbEE
951 + and r0, r0, #(0xf << 12) @ ThumbEE enabled field
952 +diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
953 +index 22fb665..dba48a5 100644
954 +--- a/arch/avr32/Makefile
955 ++++ b/arch/avr32/Makefile
956 +@@ -11,7 +11,7 @@ all: uImage vmlinux.elf
957 +
958 + KBUILD_DEFCONFIG := atstk1002_defconfig
959 +
960 +-KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic
961 ++KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic -D__linux__
962 + KBUILD_AFLAGS += -mrelax -mno-pic
963 + KBUILD_CFLAGS_MODULE += -mno-relax
964 + LDFLAGS_vmlinux += --relax
965 +diff --git a/arch/avr32/boards/mimc200/fram.c b/arch/avr32/boards/mimc200/fram.c
966 +index 9764a1a..c1466a8 100644
967 +--- a/arch/avr32/boards/mimc200/fram.c
968 ++++ b/arch/avr32/boards/mimc200/fram.c
969 +@@ -11,6 +11,7 @@
970 + #define FRAM_VERSION "1.0"
971 +
972 + #include <linux/miscdevice.h>
973 ++#include <linux/module.h>
974 + #include <linux/proc_fs.h>
975 + #include <linux/mm.h>
976 + #include <linux/io.h>
977 +diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
978 +index a79fe9a..7d5ac0b 100644
979 +--- a/arch/mips/mm/c-r4k.c
980 ++++ b/arch/mips/mm/c-r4k.c
981 +@@ -633,9 +633,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
982 + if (size >= scache_size)
983 + r4k_blast_scache();
984 + else {
985 +- unsigned long lsize = cpu_scache_line_size();
986 +- unsigned long almask = ~(lsize - 1);
987 +-
988 + /*
989 + * There is no clearly documented alignment requirement
990 + * for the cache instruction on MIPS processors and
991 +@@ -644,9 +641,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
992 + * hit ops with insufficient alignment. Solved by
993 + * aligning the address to cache line size.
994 + */
995 +- cache_op(Hit_Writeback_Inv_SD, addr & almask);
996 +- cache_op(Hit_Writeback_Inv_SD,
997 +- (addr + size - 1) & almask);
998 + blast_inv_scache_range(addr, addr + size);
999 + }
1000 + __sync();
1001 +@@ -656,12 +650,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
1002 + if (cpu_has_safe_index_cacheops && size >= dcache_size) {
1003 + r4k_blast_dcache();
1004 + } else {
1005 +- unsigned long lsize = cpu_dcache_line_size();
1006 +- unsigned long almask = ~(lsize - 1);
1007 +-
1008 + R4600_HIT_CACHEOP_WAR_IMPL;
1009 +- cache_op(Hit_Writeback_Inv_D, addr & almask);
1010 +- cache_op(Hit_Writeback_Inv_D, (addr + size - 1) & almask);
1011 + blast_inv_dcache_range(addr, addr + size);
1012 + }
1013 +
1014 +diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
1015 +index a3c684b..02ebe1a 100644
1016 +--- a/arch/powerpc/kernel/cacheinfo.c
1017 ++++ b/arch/powerpc/kernel/cacheinfo.c
1018 +@@ -788,6 +788,9 @@ static void remove_cache_dir(struct cache_dir *cache_dir)
1019 + {
1020 + remove_index_dirs(cache_dir);
1021 +
1022 ++ /* Remove cache dir from sysfs */
1023 ++ kobject_del(cache_dir->kobj);
1024 ++
1025 + kobject_put(cache_dir->kobj);
1026 +
1027 + kfree(cache_dir);
1028 +diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
1029 +index 424afb6..39787c9 100644
1030 +--- a/arch/powerpc/kernel/crash_dump.c
1031 ++++ b/arch/powerpc/kernel/crash_dump.c
1032 +@@ -108,17 +108,19 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
1033 + size_t csize, unsigned long offset, int userbuf)
1034 + {
1035 + void *vaddr;
1036 ++ phys_addr_t paddr;
1037 +
1038 + if (!csize)
1039 + return 0;
1040 +
1041 + csize = min_t(size_t, csize, PAGE_SIZE);
1042 ++ paddr = pfn << PAGE_SHIFT;
1043 +
1044 +- if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
1045 +- vaddr = __va(pfn << PAGE_SHIFT);
1046 ++ if (memblock_is_region_memory(paddr, csize)) {
1047 ++ vaddr = __va(paddr);
1048 + csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
1049 + } else {
1050 +- vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
1051 ++ vaddr = __ioremap(paddr, PAGE_SIZE, 0);
1052 + csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
1053 + iounmap(vaddr);
1054 + }
1055 +diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S
1056 +index b47a0e1..c712ece 100644
1057 +--- a/arch/powerpc/kernel/reloc_64.S
1058 ++++ b/arch/powerpc/kernel/reloc_64.S
1059 +@@ -81,6 +81,7 @@ _GLOBAL(relocate)
1060 +
1061 + 6: blr
1062 +
1063 ++.balign 8
1064 + p_dyn: .llong __dynamic_start - 0b
1065 + p_rela: .llong __rela_dyn_start - 0b
1066 + p_st: .llong _stext - 0b
1067 +diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
1068 +index 13c432e..844fc83 100644
1069 +--- a/arch/powerpc/kvm/e500_tlb.c
1070 ++++ b/arch/powerpc/kvm/e500_tlb.c
1071 +@@ -481,7 +481,7 @@ static inline void kvmppc_e500_priv_release(struct tlbe_priv *priv)
1072 + }
1073 +
1074 + static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu,
1075 +- unsigned int eaddr, int as)
1076 ++ gva_t eaddr, int as)
1077 + {
1078 + struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
1079 + unsigned int victim, pidsel, tsized;
1080 +diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
1081 +index 3ec8b39..51fb1ef 100644
1082 +--- a/arch/s390/crypto/aes_s390.c
1083 ++++ b/arch/s390/crypto/aes_s390.c
1084 +@@ -25,6 +25,7 @@
1085 + #include <linux/err.h>
1086 + #include <linux/module.h>
1087 + #include <linux/init.h>
1088 ++#include <linux/spinlock.h>
1089 + #include "crypt_s390.h"
1090 +
1091 + #define AES_KEYLEN_128 1
1092 +@@ -32,6 +33,7 @@
1093 + #define AES_KEYLEN_256 4
1094 +
1095 + static u8 *ctrblk;
1096 ++static DEFINE_SPINLOCK(ctrblk_lock);
1097 + static char keylen_flag;
1098 +
1099 + struct s390_aes_ctx {
1100 +@@ -324,7 +326,8 @@ static int ecb_aes_crypt(struct blkcipher_desc *desc, long func, void *param,
1101 + u8 *in = walk->src.virt.addr;
1102 +
1103 + ret = crypt_s390_km(func, param, out, in, n);
1104 +- BUG_ON((ret < 0) || (ret != n));
1105 ++ if (ret < 0 || ret != n)
1106 ++ return -EIO;
1107 +
1108 + nbytes &= AES_BLOCK_SIZE - 1;
1109 + ret = blkcipher_walk_done(desc, walk, nbytes);
1110 +@@ -463,7 +466,8 @@ static int cbc_aes_crypt(struct blkcipher_desc *desc, long func,
1111 + u8 *in = walk->src.virt.addr;
1112 +
1113 + ret = crypt_s390_kmc(func, &param, out, in, n);
1114 +- BUG_ON((ret < 0) || (ret != n));
1115 ++ if (ret < 0 || ret != n)
1116 ++ return -EIO;
1117 +
1118 + nbytes &= AES_BLOCK_SIZE - 1;
1119 + ret = blkcipher_walk_done(desc, walk, nbytes);
1120 +@@ -636,7 +640,8 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
1121 + memcpy(pcc_param.tweak, walk->iv, sizeof(pcc_param.tweak));
1122 + memcpy(pcc_param.key, xts_ctx->pcc_key, 32);
1123 + ret = crypt_s390_pcc(func, &pcc_param.key[offset]);
1124 +- BUG_ON(ret < 0);
1125 ++ if (ret < 0)
1126 ++ return -EIO;
1127 +
1128 + memcpy(xts_param.key, xts_ctx->key, 32);
1129 + memcpy(xts_param.init, pcc_param.xts, 16);
1130 +@@ -647,7 +652,8 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
1131 + in = walk->src.virt.addr;
1132 +
1133 + ret = crypt_s390_km(func, &xts_param.key[offset], out, in, n);
1134 +- BUG_ON(ret < 0 || ret != n);
1135 ++ if (ret < 0 || ret != n)
1136 ++ return -EIO;
1137 +
1138 + nbytes &= AES_BLOCK_SIZE - 1;
1139 + ret = blkcipher_walk_done(desc, walk, nbytes);
1140 +@@ -756,42 +762,67 @@ static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
1141 + return aes_set_key(tfm, in_key, key_len);
1142 + }
1143 +
1144 ++static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes)
1145 ++{
1146 ++ unsigned int i, n;
1147 ++
1148 ++ /* only use complete blocks, max. PAGE_SIZE */
1149 ++ n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1);
1150 ++ for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) {
1151 ++ memcpy(ctrptr + i, ctrptr + i - AES_BLOCK_SIZE,
1152 ++ AES_BLOCK_SIZE);
1153 ++ crypto_inc(ctrptr + i, AES_BLOCK_SIZE);
1154 ++ }
1155 ++ return n;
1156 ++}
1157 ++
1158 + static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
1159 + struct s390_aes_ctx *sctx, struct blkcipher_walk *walk)
1160 + {
1161 + int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE);
1162 +- unsigned int i, n, nbytes;
1163 +- u8 buf[AES_BLOCK_SIZE];
1164 +- u8 *out, *in;
1165 ++ unsigned int n, nbytes;
1166 ++ u8 buf[AES_BLOCK_SIZE], ctrbuf[AES_BLOCK_SIZE];
1167 ++ u8 *out, *in, *ctrptr = ctrbuf;
1168 +
1169 + if (!walk->nbytes)
1170 + return ret;
1171 +
1172 +- memcpy(ctrblk, walk->iv, AES_BLOCK_SIZE);
1173 ++ if (spin_trylock(&ctrblk_lock))
1174 ++ ctrptr = ctrblk;
1175 ++
1176 ++ memcpy(ctrptr, walk->iv, AES_BLOCK_SIZE);
1177 + while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) {
1178 + out = walk->dst.virt.addr;
1179 + in = walk->src.virt.addr;
1180 + while (nbytes >= AES_BLOCK_SIZE) {
1181 +- /* only use complete blocks, max. PAGE_SIZE */
1182 +- n = (nbytes > PAGE_SIZE) ? PAGE_SIZE :
1183 +- nbytes & ~(AES_BLOCK_SIZE - 1);
1184 +- for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) {
1185 +- memcpy(ctrblk + i, ctrblk + i - AES_BLOCK_SIZE,
1186 +- AES_BLOCK_SIZE);
1187 +- crypto_inc(ctrblk + i, AES_BLOCK_SIZE);
1188 ++ if (ctrptr == ctrblk)
1189 ++ n = __ctrblk_init(ctrptr, nbytes);
1190 ++ else
1191 ++ n = AES_BLOCK_SIZE;
1192 ++ ret = crypt_s390_kmctr(func, sctx->key, out, in,
1193 ++ n, ctrptr);
1194 ++ if (ret < 0 || ret != n) {
1195 ++ if (ctrptr == ctrblk)
1196 ++ spin_unlock(&ctrblk_lock);
1197 ++ return -EIO;
1198 + }
1199 +- ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk);
1200 +- BUG_ON(ret < 0 || ret != n);
1201 + if (n > AES_BLOCK_SIZE)
1202 +- memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE,
1203 ++ memcpy(ctrptr, ctrptr + n - AES_BLOCK_SIZE,
1204 + AES_BLOCK_SIZE);
1205 +- crypto_inc(ctrblk, AES_BLOCK_SIZE);
1206 ++ crypto_inc(ctrptr, AES_BLOCK_SIZE);
1207 + out += n;
1208 + in += n;
1209 + nbytes -= n;
1210 + }
1211 + ret = blkcipher_walk_done(desc, walk, nbytes);
1212 + }
1213 ++ if (ctrptr == ctrblk) {
1214 ++ if (nbytes)
1215 ++ memcpy(ctrbuf, ctrptr, AES_BLOCK_SIZE);
1216 ++ else
1217 ++ memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
1218 ++ spin_unlock(&ctrblk_lock);
1219 ++ }
1220 + /*
1221 + * final block may be < AES_BLOCK_SIZE, copy only nbytes
1222 + */
1223 +@@ -799,13 +830,15 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
1224 + out = walk->dst.virt.addr;
1225 + in = walk->src.virt.addr;
1226 + ret = crypt_s390_kmctr(func, sctx->key, buf, in,
1227 +- AES_BLOCK_SIZE, ctrblk);
1228 +- BUG_ON(ret < 0 || ret != AES_BLOCK_SIZE);
1229 ++ AES_BLOCK_SIZE, ctrbuf);
1230 ++ if (ret < 0 || ret != AES_BLOCK_SIZE)
1231 ++ return -EIO;
1232 + memcpy(out, buf, nbytes);
1233 +- crypto_inc(ctrblk, AES_BLOCK_SIZE);
1234 ++ crypto_inc(ctrbuf, AES_BLOCK_SIZE);
1235 + ret = blkcipher_walk_done(desc, walk, 0);
1236 ++ memcpy(walk->iv, ctrbuf, AES_BLOCK_SIZE);
1237 + }
1238 +- memcpy(walk->iv, ctrblk, AES_BLOCK_SIZE);
1239 ++
1240 + return ret;
1241 + }
1242 +
1243 +diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
1244 +index a52bfd1..991fb7d 100644
1245 +--- a/arch/s390/crypto/des_s390.c
1246 ++++ b/arch/s390/crypto/des_s390.c
1247 +@@ -25,6 +25,7 @@
1248 + #define DES3_KEY_SIZE (3 * DES_KEY_SIZE)
1249 +
1250 + static u8 *ctrblk;
1251 ++static DEFINE_SPINLOCK(ctrblk_lock);
1252 +
1253 + struct s390_des_ctx {
1254 + u8 iv[DES_BLOCK_SIZE];
1255 +@@ -95,7 +96,8 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func,
1256 + u8 *in = walk->src.virt.addr;
1257 +
1258 + ret = crypt_s390_km(func, key, out, in, n);
1259 +- BUG_ON((ret < 0) || (ret != n));
1260 ++ if (ret < 0 || ret != n)
1261 ++ return -EIO;
1262 +
1263 + nbytes &= DES_BLOCK_SIZE - 1;
1264 + ret = blkcipher_walk_done(desc, walk, nbytes);
1265 +@@ -105,28 +107,35 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func,
1266 + }
1267 +
1268 + static int cbc_desall_crypt(struct blkcipher_desc *desc, long func,
1269 +- u8 *iv, struct blkcipher_walk *walk)
1270 ++ struct blkcipher_walk *walk)
1271 + {
1272 ++ struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
1273 + int ret = blkcipher_walk_virt(desc, walk);
1274 + unsigned int nbytes = walk->nbytes;
1275 ++ struct {
1276 ++ u8 iv[DES_BLOCK_SIZE];
1277 ++ u8 key[DES3_KEY_SIZE];
1278 ++ } param;
1279 +
1280 + if (!nbytes)
1281 + goto out;
1282 +
1283 +- memcpy(iv, walk->iv, DES_BLOCK_SIZE);
1284 ++ memcpy(param.iv, walk->iv, DES_BLOCK_SIZE);
1285 ++ memcpy(param.key, ctx->key, DES3_KEY_SIZE);
1286 + do {
1287 + /* only use complete blocks */
1288 + unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1);
1289 + u8 *out = walk->dst.virt.addr;
1290 + u8 *in = walk->src.virt.addr;
1291 +
1292 +- ret = crypt_s390_kmc(func, iv, out, in, n);
1293 +- BUG_ON((ret < 0) || (ret != n));
1294 ++ ret = crypt_s390_kmc(func, &param, out, in, n);
1295 ++ if (ret < 0 || ret != n)
1296 ++ return -EIO;
1297 +
1298 + nbytes &= DES_BLOCK_SIZE - 1;
1299 + ret = blkcipher_walk_done(desc, walk, nbytes);
1300 + } while ((nbytes = walk->nbytes));
1301 +- memcpy(walk->iv, iv, DES_BLOCK_SIZE);
1302 ++ memcpy(walk->iv, param.iv, DES_BLOCK_SIZE);
1303 +
1304 + out:
1305 + return ret;
1306 +@@ -179,22 +188,20 @@ static int cbc_des_encrypt(struct blkcipher_desc *desc,
1307 + struct scatterlist *dst, struct scatterlist *src,
1308 + unsigned int nbytes)
1309 + {
1310 +- struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
1311 + struct blkcipher_walk walk;
1312 +
1313 + blkcipher_walk_init(&walk, dst, src, nbytes);
1314 +- return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, ctx->iv, &walk);
1315 ++ return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, &walk);
1316 + }
1317 +
1318 + static int cbc_des_decrypt(struct blkcipher_desc *desc,
1319 + struct scatterlist *dst, struct scatterlist *src,
1320 + unsigned int nbytes)
1321 + {
1322 +- struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
1323 + struct blkcipher_walk walk;
1324 +
1325 + blkcipher_walk_init(&walk, dst, src, nbytes);
1326 +- return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, ctx->iv, &walk);
1327 ++ return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, &walk);
1328 + }
1329 +
1330 + static struct crypto_alg cbc_des_alg = {
1331 +@@ -331,22 +338,20 @@ static int cbc_des3_encrypt(struct blkcipher_desc *desc,
1332 + struct scatterlist *dst, struct scatterlist *src,
1333 + unsigned int nbytes)
1334 + {
1335 +- struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
1336 + struct blkcipher_walk walk;
1337 +
1338 + blkcipher_walk_init(&walk, dst, src, nbytes);
1339 +- return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, ctx->iv, &walk);
1340 ++ return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, &walk);
1341 + }
1342 +
1343 + static int cbc_des3_decrypt(struct blkcipher_desc *desc,
1344 + struct scatterlist *dst, struct scatterlist *src,
1345 + unsigned int nbytes)
1346 + {
1347 +- struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
1348 + struct blkcipher_walk walk;
1349 +
1350 + blkcipher_walk_init(&walk, dst, src, nbytes);
1351 +- return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, ctx->iv, &walk);
1352 ++ return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, &walk);
1353 + }
1354 +
1355 + static struct crypto_alg cbc_des3_alg = {
1356 +@@ -372,52 +377,80 @@ static struct crypto_alg cbc_des3_alg = {
1357 + }
1358 + };
1359 +
1360 ++static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes)
1361 ++{
1362 ++ unsigned int i, n;
1363 ++
1364 ++ /* align to block size, max. PAGE_SIZE */
1365 ++ n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(DES_BLOCK_SIZE - 1);
1366 ++ for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) {
1367 ++ memcpy(ctrptr + i, ctrptr + i - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
1368 ++ crypto_inc(ctrptr + i, DES_BLOCK_SIZE);
1369 ++ }
1370 ++ return n;
1371 ++}
1372 ++
1373 + static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
1374 +- struct s390_des_ctx *ctx, struct blkcipher_walk *walk)
1375 ++ struct s390_des_ctx *ctx,
1376 ++ struct blkcipher_walk *walk)
1377 + {
1378 + int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE);
1379 +- unsigned int i, n, nbytes;
1380 +- u8 buf[DES_BLOCK_SIZE];
1381 +- u8 *out, *in;
1382 ++ unsigned int n, nbytes;
1383 ++ u8 buf[DES_BLOCK_SIZE], ctrbuf[DES_BLOCK_SIZE];
1384 ++ u8 *out, *in, *ctrptr = ctrbuf;
1385 ++
1386 ++ if (!walk->nbytes)
1387 ++ return ret;
1388 ++
1389 ++ if (spin_trylock(&ctrblk_lock))
1390 ++ ctrptr = ctrblk;
1391 +
1392 +- memcpy(ctrblk, walk->iv, DES_BLOCK_SIZE);
1393 ++ memcpy(ctrptr, walk->iv, DES_BLOCK_SIZE);
1394 + while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) {
1395 + out = walk->dst.virt.addr;
1396 + in = walk->src.virt.addr;
1397 + while (nbytes >= DES_BLOCK_SIZE) {
1398 +- /* align to block size, max. PAGE_SIZE */
1399 +- n = (nbytes > PAGE_SIZE) ? PAGE_SIZE :
1400 +- nbytes & ~(DES_BLOCK_SIZE - 1);
1401 +- for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) {
1402 +- memcpy(ctrblk + i, ctrblk + i - DES_BLOCK_SIZE,
1403 +- DES_BLOCK_SIZE);
1404 +- crypto_inc(ctrblk + i, DES_BLOCK_SIZE);
1405 ++ if (ctrptr == ctrblk)
1406 ++ n = __ctrblk_init(ctrptr, nbytes);
1407 ++ else
1408 ++ n = DES_BLOCK_SIZE;
1409 ++ ret = crypt_s390_kmctr(func, ctx->key, out, in,
1410 ++ n, ctrptr);
1411 ++ if (ret < 0 || ret != n) {
1412 ++ if (ctrptr == ctrblk)
1413 ++ spin_unlock(&ctrblk_lock);
1414 ++ return -EIO;
1415 + }
1416 +- ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk);
1417 +- BUG_ON((ret < 0) || (ret != n));
1418 + if (n > DES_BLOCK_SIZE)
1419 +- memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE,
1420 ++ memcpy(ctrptr, ctrptr + n - DES_BLOCK_SIZE,
1421 + DES_BLOCK_SIZE);
1422 +- crypto_inc(ctrblk, DES_BLOCK_SIZE);
1423 ++ crypto_inc(ctrptr, DES_BLOCK_SIZE);
1424 + out += n;
1425 + in += n;
1426 + nbytes -= n;
1427 + }
1428 + ret = blkcipher_walk_done(desc, walk, nbytes);
1429 + }
1430 +-
1431 ++ if (ctrptr == ctrblk) {
1432 ++ if (nbytes)
1433 ++ memcpy(ctrbuf, ctrptr, DES_BLOCK_SIZE);
1434 ++ else
1435 ++ memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
1436 ++ spin_unlock(&ctrblk_lock);
1437 ++ }
1438 + /* final block may be < DES_BLOCK_SIZE, copy only nbytes */
1439 + if (nbytes) {
1440 + out = walk->dst.virt.addr;
1441 + in = walk->src.virt.addr;
1442 + ret = crypt_s390_kmctr(func, ctx->key, buf, in,
1443 +- DES_BLOCK_SIZE, ctrblk);
1444 +- BUG_ON(ret < 0 || ret != DES_BLOCK_SIZE);
1445 ++ DES_BLOCK_SIZE, ctrbuf);
1446 ++ if (ret < 0 || ret != DES_BLOCK_SIZE)
1447 ++ return -EIO;
1448 + memcpy(out, buf, nbytes);
1449 +- crypto_inc(ctrblk, DES_BLOCK_SIZE);
1450 ++ crypto_inc(ctrbuf, DES_BLOCK_SIZE);
1451 + ret = blkcipher_walk_done(desc, walk, 0);
1452 ++ memcpy(walk->iv, ctrbuf, DES_BLOCK_SIZE);
1453 + }
1454 +- memcpy(walk->iv, ctrblk, DES_BLOCK_SIZE);
1455 + return ret;
1456 + }
1457 +
1458 +diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c
1459 +index b1bd170..f6373f0 100644
1460 +--- a/arch/s390/crypto/ghash_s390.c
1461 ++++ b/arch/s390/crypto/ghash_s390.c
1462 +@@ -72,14 +72,16 @@ static int ghash_update(struct shash_desc *desc,
1463 + if (!dctx->bytes) {
1464 + ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf,
1465 + GHASH_BLOCK_SIZE);
1466 +- BUG_ON(ret != GHASH_BLOCK_SIZE);
1467 ++ if (ret != GHASH_BLOCK_SIZE)
1468 ++ return -EIO;
1469 + }
1470 + }
1471 +
1472 + n = srclen & ~(GHASH_BLOCK_SIZE - 1);
1473 + if (n) {
1474 + ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n);
1475 +- BUG_ON(ret != n);
1476 ++ if (ret != n)
1477 ++ return -EIO;
1478 + src += n;
1479 + srclen -= n;
1480 + }
1481 +@@ -92,7 +94,7 @@ static int ghash_update(struct shash_desc *desc,
1482 + return 0;
1483 + }
1484 +
1485 +-static void ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)
1486 ++static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)
1487 + {
1488 + u8 *buf = dctx->buffer;
1489 + int ret;
1490 +@@ -103,21 +105,24 @@ static void ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)
1491 + memset(pos, 0, dctx->bytes);
1492 +
1493 + ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE);
1494 +- BUG_ON(ret != GHASH_BLOCK_SIZE);
1495 ++ if (ret != GHASH_BLOCK_SIZE)
1496 ++ return -EIO;
1497 + }
1498 +
1499 + dctx->bytes = 0;
1500 ++ return 0;
1501 + }
1502 +
1503 + static int ghash_final(struct shash_desc *desc, u8 *dst)
1504 + {
1505 + struct ghash_desc_ctx *dctx = shash_desc_ctx(desc);
1506 + struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
1507 ++ int ret;
1508 +
1509 +- ghash_flush(ctx, dctx);
1510 +- memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE);
1511 +-
1512 +- return 0;
1513 ++ ret = ghash_flush(ctx, dctx);
1514 ++ if (!ret)
1515 ++ memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE);
1516 ++ return ret;
1517 + }
1518 +
1519 + static struct shash_alg ghash_alg = {
1520 +diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c
1521 +index bd37d09..8620b0e 100644
1522 +--- a/arch/s390/crypto/sha_common.c
1523 ++++ b/arch/s390/crypto/sha_common.c
1524 +@@ -36,7 +36,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
1525 + if (index) {
1526 + memcpy(ctx->buf + index, data, bsize - index);
1527 + ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, bsize);
1528 +- BUG_ON(ret != bsize);
1529 ++ if (ret != bsize)
1530 ++ return -EIO;
1531 + data += bsize - index;
1532 + len -= bsize - index;
1533 + index = 0;
1534 +@@ -46,7 +47,8 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
1535 + if (len >= bsize) {
1536 + ret = crypt_s390_kimd(ctx->func, ctx->state, data,
1537 + len & ~(bsize - 1));
1538 +- BUG_ON(ret != (len & ~(bsize - 1)));
1539 ++ if (ret != (len & ~(bsize - 1)))
1540 ++ return -EIO;
1541 + data += ret;
1542 + len -= ret;
1543 + }
1544 +@@ -88,7 +90,8 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)
1545 + memcpy(ctx->buf + end - 8, &bits, sizeof(bits));
1546 +
1547 + ret = crypt_s390_kimd(ctx->func, ctx->state, ctx->buf, end);
1548 +- BUG_ON(ret != end);
1549 ++ if (ret != end)
1550 ++ return -EIO;
1551 +
1552 + /* copy digest to out */
1553 + memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm));
1554 +diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c
1555 +index a90d45e..27c50f4 100644
1556 +--- a/arch/s390/mm/page-states.c
1557 ++++ b/arch/s390/mm/page-states.c
1558 +@@ -12,6 +12,8 @@
1559 + #include <linux/mm.h>
1560 + #include <linux/gfp.h>
1561 + #include <linux/init.h>
1562 ++#include <asm/setup.h>
1563 ++#include <asm/ipl.h>
1564 +
1565 + #define ESSA_SET_STABLE 1
1566 + #define ESSA_SET_UNUSED 2
1567 +@@ -41,6 +43,14 @@ void __init cmma_init(void)
1568 +
1569 + if (!cmma_flag)
1570 + return;
1571 ++ /*
1572 ++ * Disable CMM for dump, otherwise the tprot based memory
1573 ++ * detection can fail because of unstable pages.
1574 ++ */
1575 ++ if (OLDMEM_BASE || ipl_info.type == IPL_TYPE_FCP_DUMP) {
1576 ++ cmma_flag = 0;
1577 ++ return;
1578 ++ }
1579 + asm volatile(
1580 + " .insn rrf,0xb9ab0000,%1,%1,0,0\n"
1581 + "0: la %0,0\n"
1582 +diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
1583 +index ba870bb..f97134a 100644
1584 +--- a/arch/x86/include/asm/irq.h
1585 ++++ b/arch/x86/include/asm/irq.h
1586 +@@ -25,6 +25,7 @@ extern void irq_ctx_init(int cpu);
1587 +
1588 + #ifdef CONFIG_HOTPLUG_CPU
1589 + #include <linux/cpumask.h>
1590 ++extern int check_irq_vectors_for_cpu_disable(void);
1591 + extern void fixup_irqs(void);
1592 + extern void irq_force_complete_move(int);
1593 + #endif
1594 +diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
1595 +index 2bda212..1c041e0 100644
1596 +--- a/arch/x86/kernel/cpu/perf_event.c
1597 ++++ b/arch/x86/kernel/cpu/perf_event.c
1598 +@@ -971,6 +971,9 @@ static void x86_pmu_del(struct perf_event *event, int flags)
1599 + for (i = 0; i < cpuc->n_events; i++) {
1600 + if (event == cpuc->event_list[i]) {
1601 +
1602 ++ if (i >= cpuc->n_events - cpuc->n_added)
1603 ++ --cpuc->n_added;
1604 ++
1605 + if (x86_pmu.put_event_constraints)
1606 + x86_pmu.put_event_constraints(cpuc, event);
1607 +
1608 +diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
1609 +index fb2eb32..687637b 100644
1610 +--- a/arch/x86/kernel/irq.c
1611 ++++ b/arch/x86/kernel/irq.c
1612 +@@ -222,6 +222,76 @@ void smp_x86_platform_ipi(struct pt_regs *regs)
1613 + EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
1614 +
1615 + #ifdef CONFIG_HOTPLUG_CPU
1616 ++/*
1617 ++ * This cpu is going to be removed and its vectors migrated to the remaining
1618 ++ * online cpus. Check to see if there are enough vectors in the remaining cpus.
1619 ++ * This function is protected by stop_machine().
1620 ++ */
1621 ++int check_irq_vectors_for_cpu_disable(void)
1622 ++{
1623 ++ int irq, cpu;
1624 ++ unsigned int this_cpu, vector, this_count, count;
1625 ++ struct irq_desc *desc;
1626 ++ struct irq_data *data;
1627 ++ struct cpumask affinity_new, online_new;
1628 ++
1629 ++ this_cpu = smp_processor_id();
1630 ++ cpumask_copy(&online_new, cpu_online_mask);
1631 ++ cpu_clear(this_cpu, online_new);
1632 ++
1633 ++ this_count = 0;
1634 ++ for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
1635 ++ irq = __this_cpu_read(vector_irq[vector]);
1636 ++ if (irq >= 0) {
1637 ++ desc = irq_to_desc(irq);
1638 ++ data = irq_desc_get_irq_data(desc);
1639 ++ cpumask_copy(&affinity_new, data->affinity);
1640 ++ cpu_clear(this_cpu, affinity_new);
1641 ++
1642 ++ /* Do not count inactive or per-cpu irqs. */
1643 ++ if (!irq_has_action(irq) || irqd_is_per_cpu(data))
1644 ++ continue;
1645 ++
1646 ++ /*
1647 ++ * A single irq may be mapped to multiple
1648 ++ * cpu's vector_irq[] (for example IOAPIC cluster
1649 ++ * mode). In this case we have two
1650 ++ * possibilities:
1651 ++ *
1652 ++ * 1) the resulting affinity mask is empty; that is
1653 ++ * this the down'd cpu is the last cpu in the irq's
1654 ++ * affinity mask, or
1655 ++ *
1656 ++ * 2) the resulting affinity mask is no longer
1657 ++ * a subset of the online cpus but the affinity
1658 ++ * mask is not zero; that is the down'd cpu is the
1659 ++ * last online cpu in a user set affinity mask.
1660 ++ */
1661 ++ if (cpumask_empty(&affinity_new) ||
1662 ++ !cpumask_subset(&affinity_new, &online_new))
1663 ++ this_count++;
1664 ++ }
1665 ++ }
1666 ++
1667 ++ count = 0;
1668 ++ for_each_online_cpu(cpu) {
1669 ++ if (cpu == this_cpu)
1670 ++ continue;
1671 ++ for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
1672 ++ vector++) {
1673 ++ if (per_cpu(vector_irq, cpu)[vector] < 0)
1674 ++ count++;
1675 ++ }
1676 ++ }
1677 ++
1678 ++ if (count < this_count) {
1679 ++ pr_warn("CPU %d disable failed: CPU has %u vectors assigned and there are only %u available.\n",
1680 ++ this_cpu, this_count, count);
1681 ++ return -ERANGE;
1682 ++ }
1683 ++ return 0;
1684 ++}
1685 ++
1686 + /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
1687 + void fixup_irqs(void)
1688 + {
1689 +diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
1690 +index 03920a1..28a3e62 100644
1691 +--- a/arch/x86/kernel/quirks.c
1692 ++++ b/arch/x86/kernel/quirks.c
1693 +@@ -525,7 +525,7 @@ static void __init quirk_amd_nb_node(struct pci_dev *dev)
1694 + return;
1695 +
1696 + pci_read_config_dword(nb_ht, 0x60, &val);
1697 +- node = val & 7;
1698 ++ node = pcibus_to_node(dev->bus) | (val & 7);
1699 + /*
1700 + * Some hardware may return an invalid node ID,
1701 + * so check it first:
1702 +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
1703 +index 9f548cb..b88eadb 100644
1704 +--- a/arch/x86/kernel/smpboot.c
1705 ++++ b/arch/x86/kernel/smpboot.c
1706 +@@ -1278,6 +1278,7 @@ void cpu_disable_common(void)
1707 + int native_cpu_disable(void)
1708 + {
1709 + int cpu = smp_processor_id();
1710 ++ int ret;
1711 +
1712 + /*
1713 + * Perhaps use cpufreq to drop frequency, but that could go
1714 +@@ -1290,6 +1291,10 @@ int native_cpu_disable(void)
1715 + if (cpu == 0)
1716 + return -EBUSY;
1717 +
1718 ++ ret = check_irq_vectors_for_cpu_disable();
1719 ++ if (ret)
1720 ++ return ret;
1721 ++
1722 + clear_local_APIC();
1723 +
1724 + cpu_disable_common();
1725 +diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
1726 +index 405f262..139415e 100644
1727 +--- a/arch/x86/kvm/i8254.c
1728 ++++ b/arch/x86/kvm/i8254.c
1729 +@@ -38,6 +38,7 @@
1730 +
1731 + #include "irq.h"
1732 + #include "i8254.h"
1733 ++#include "x86.h"
1734 +
1735 + #ifndef CONFIG_X86_64
1736 + #define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
1737 +@@ -364,6 +365,23 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period)
1738 + atomic_set(&pt->pending, 0);
1739 + ps->irq_ack = 1;
1740 +
1741 ++ /*
1742 ++ * Do not allow the guest to program periodic timers with small
1743 ++ * interval, since the hrtimers are not throttled by the host
1744 ++ * scheduler.
1745 ++ */
1746 ++ if (ps->is_periodic) {
1747 ++ s64 min_period = min_timer_period_us * 1000LL;
1748 ++
1749 ++ if (pt->period < min_period) {
1750 ++ pr_info_ratelimited(
1751 ++ "kvm: requested %lld ns "
1752 ++ "i8254 timer period limited to %lld ns\n",
1753 ++ pt->period, min_period);
1754 ++ pt->period = min_period;
1755 ++ }
1756 ++ }
1757 ++
1758 + hrtimer_start(&pt->timer, ktime_add_ns(ktime_get(), interval),
1759 + HRTIMER_MODE_ABS);
1760 + }
1761 +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
1762 +index 757c716..176205a 100644
1763 +--- a/arch/x86/kvm/lapic.c
1764 ++++ b/arch/x86/kvm/lapic.c
1765 +@@ -68,9 +68,6 @@
1766 + #define VEC_POS(v) ((v) & (32 - 1))
1767 + #define REG_POS(v) (((v) >> 5) << 4)
1768 +
1769 +-static unsigned int min_timer_period_us = 500;
1770 +-module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
1771 +-
1772 + static inline u32 apic_get_reg(struct kvm_lapic *apic, int reg_off)
1773 + {
1774 + return *((u32 *) (apic->regs + reg_off));
1775 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
1776 +index 94a4672..2102a17 100644
1777 +--- a/arch/x86/kvm/svm.c
1778 ++++ b/arch/x86/kvm/svm.c
1779 +@@ -2904,10 +2904,8 @@ static int cr8_write_interception(struct vcpu_svm *svm)
1780 + u8 cr8_prev = kvm_get_cr8(&svm->vcpu);
1781 + /* instruction emulation calls kvm_set_cr8() */
1782 + r = cr_interception(svm);
1783 +- if (irqchip_in_kernel(svm->vcpu.kvm)) {
1784 +- clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
1785 ++ if (irqchip_in_kernel(svm->vcpu.kvm))
1786 + return r;
1787 +- }
1788 + if (cr8_prev <= kvm_get_cr8(&svm->vcpu))
1789 + return r;
1790 + kvm_run->exit_reason = KVM_EXIT_SET_TPR;
1791 +@@ -3462,6 +3460,8 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
1792 + if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK))
1793 + return;
1794 +
1795 ++ clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
1796 ++
1797 + if (irr == -1)
1798 + return;
1799 +
1800 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
1801 +index 7774cca..b9fefaf 100644
1802 +--- a/arch/x86/kvm/x86.c
1803 ++++ b/arch/x86/kvm/x86.c
1804 +@@ -92,6 +92,9 @@ EXPORT_SYMBOL_GPL(kvm_x86_ops);
1805 + int ignore_msrs = 0;
1806 + module_param_named(ignore_msrs, ignore_msrs, bool, S_IRUGO | S_IWUSR);
1807 +
1808 ++unsigned int min_timer_period_us = 500;
1809 ++module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
1810 ++
1811 + bool kvm_has_tsc_control;
1812 + EXPORT_SYMBOL_GPL(kvm_has_tsc_control);
1813 + u32 kvm_max_guest_tsc_khz;
1814 +diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
1815 +index d36fe23..0e22f64 100644
1816 +--- a/arch/x86/kvm/x86.h
1817 ++++ b/arch/x86/kvm/x86.h
1818 +@@ -125,4 +125,6 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
1819 + gva_t addr, void *val, unsigned int bytes,
1820 + struct x86_exception *exception);
1821 +
1822 ++extern unsigned int min_timer_period_us;
1823 ++
1824 + #endif
1825 +diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
1826 +index bee75a6..e56da77 100644
1827 +--- a/arch/x86/platform/efi/efi.c
1828 ++++ b/arch/x86/platform/efi/efi.c
1829 +@@ -424,7 +424,7 @@ void __init efi_reserve_boot_services(void)
1830 + * - Not within any part of the kernel
1831 + * - Not the bios reserved area
1832 + */
1833 +- if ((start+size >= virt_to_phys(_text)
1834 ++ if ((start + size > virt_to_phys(_text)
1835 + && start <= virt_to_phys(_end)) ||
1836 + !e820_all_mapped(start, start+size, E820_RAM) ||
1837 + memblock_x86_check_reserved_size(&start, &size,
1838 +diff --git a/block/blk-lib.c b/block/blk-lib.c
1839 +index 2b461b4..36751e2 100644
1840 +--- a/block/blk-lib.c
1841 ++++ b/block/blk-lib.c
1842 +@@ -101,6 +101,14 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
1843 +
1844 + atomic_inc(&bb.done);
1845 + submit_bio(type, bio);
1846 ++
1847 ++ /*
1848 ++ * We can loop for a long time in here, if someone does
1849 ++ * full device discards (like mkfs). Be nice and allow
1850 ++ * us to schedule out to avoid softlocking if preempt
1851 ++ * is disabled.
1852 ++ */
1853 ++ cond_resched();
1854 + }
1855 +
1856 + /* Wait for bios in-flight */
1857 +diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
1858 +index 5016de5..f324429 100644
1859 +--- a/drivers/acpi/bus.c
1860 ++++ b/drivers/acpi/bus.c
1861 +@@ -33,6 +33,7 @@
1862 + #include <linux/proc_fs.h>
1863 + #include <linux/acpi.h>
1864 + #include <linux/slab.h>
1865 ++#include <linux/regulator/machine.h>
1866 + #ifdef CONFIG_X86
1867 + #include <asm/mpspec.h>
1868 + #endif
1869 +@@ -917,6 +918,14 @@ void __init acpi_early_init(void)
1870 + goto error0;
1871 + }
1872 +
1873 ++ /*
1874 ++ * If the system is using ACPI then we can be reasonably
1875 ++ * confident that any regulators are managed by the firmware
1876 ++ * so tell the regulator core it has everything it needs to
1877 ++ * know.
1878 ++ */
1879 ++ regulator_has_full_constraints();
1880 ++
1881 + return;
1882 +
1883 + error0:
1884 +diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
1885 +index 605a295..abe45cb 100644
1886 +--- a/drivers/acpi/processor_throttling.c
1887 ++++ b/drivers/acpi/processor_throttling.c
1888 +@@ -59,6 +59,12 @@ struct throttling_tstate {
1889 + int target_state; /* target T-state */
1890 + };
1891 +
1892 ++struct acpi_processor_throttling_arg {
1893 ++ struct acpi_processor *pr;
1894 ++ int target_state;
1895 ++ bool force;
1896 ++};
1897 ++
1898 + #define THROTTLING_PRECHANGE (1)
1899 + #define THROTTLING_POSTCHANGE (2)
1900 +
1901 +@@ -1063,16 +1069,24 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
1902 + return 0;
1903 + }
1904 +
1905 ++static long acpi_processor_throttling_fn(void *data)
1906 ++{
1907 ++ struct acpi_processor_throttling_arg *arg = data;
1908 ++ struct acpi_processor *pr = arg->pr;
1909 ++
1910 ++ return pr->throttling.acpi_processor_set_throttling(pr,
1911 ++ arg->target_state, arg->force);
1912 ++}
1913 ++
1914 + int acpi_processor_set_throttling(struct acpi_processor *pr,
1915 + int state, bool force)
1916 + {
1917 +- cpumask_var_t saved_mask;
1918 + int ret = 0;
1919 + unsigned int i;
1920 + struct acpi_processor *match_pr;
1921 + struct acpi_processor_throttling *p_throttling;
1922 ++ struct acpi_processor_throttling_arg arg;
1923 + struct throttling_tstate t_state;
1924 +- cpumask_var_t online_throttling_cpus;
1925 +
1926 + if (!pr)
1927 + return -EINVAL;
1928 +@@ -1083,14 +1097,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
1929 + if ((state < 0) || (state > (pr->throttling.state_count - 1)))
1930 + return -EINVAL;
1931 +
1932 +- if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
1933 +- return -ENOMEM;
1934 +-
1935 +- if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {
1936 +- free_cpumask_var(saved_mask);
1937 +- return -ENOMEM;
1938 +- }
1939 +-
1940 + if (cpu_is_offline(pr->id)) {
1941 + /*
1942 + * the cpu pointed by pr->id is offline. Unnecessary to change
1943 +@@ -1099,17 +1105,15 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
1944 + return -ENODEV;
1945 + }
1946 +
1947 +- cpumask_copy(saved_mask, &current->cpus_allowed);
1948 + t_state.target_state = state;
1949 + p_throttling = &(pr->throttling);
1950 +- cpumask_and(online_throttling_cpus, cpu_online_mask,
1951 +- p_throttling->shared_cpu_map);
1952 ++
1953 + /*
1954 + * The throttling notifier will be called for every
1955 + * affected cpu in order to get one proper T-state.
1956 + * The notifier event is THROTTLING_PRECHANGE.
1957 + */
1958 +- for_each_cpu(i, online_throttling_cpus) {
1959 ++ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {
1960 + t_state.cpu = i;
1961 + acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
1962 + &t_state);
1963 +@@ -1121,21 +1125,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
1964 + * it can be called only for the cpu pointed by pr.
1965 + */
1966 + if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
1967 +- /* FIXME: use work_on_cpu() */
1968 +- if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) {
1969 +- /* Can't migrate to the pr->id CPU. Exit */
1970 +- ret = -ENODEV;
1971 +- goto exit;
1972 +- }
1973 +- ret = p_throttling->acpi_processor_set_throttling(pr,
1974 +- t_state.target_state, force);
1975 ++ arg.pr = pr;
1976 ++ arg.target_state = state;
1977 ++ arg.force = force;
1978 ++ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg);
1979 + } else {
1980 + /*
1981 + * When the T-state coordination is SW_ALL or HW_ALL,
1982 + * it is necessary to set T-state for every affected
1983 + * cpus.
1984 + */
1985 +- for_each_cpu(i, online_throttling_cpus) {
1986 ++ for_each_cpu_and(i, cpu_online_mask,
1987 ++ p_throttling->shared_cpu_map) {
1988 + match_pr = per_cpu(processors, i);
1989 + /*
1990 + * If the pointer is invalid, we will report the
1991 +@@ -1156,13 +1157,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
1992 + "on CPU %d\n", i));
1993 + continue;
1994 + }
1995 +- t_state.cpu = i;
1996 +- /* FIXME: use work_on_cpu() */
1997 +- if (set_cpus_allowed_ptr(current, cpumask_of(i)))
1998 +- continue;
1999 +- ret = match_pr->throttling.
2000 +- acpi_processor_set_throttling(
2001 +- match_pr, t_state.target_state, force);
2002 ++
2003 ++ arg.pr = match_pr;
2004 ++ arg.target_state = state;
2005 ++ arg.force = force;
2006 ++ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn,
2007 ++ &arg);
2008 + }
2009 + }
2010 + /*
2011 +@@ -1171,17 +1171,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
2012 + * affected cpu to update the T-states.
2013 + * The notifier event is THROTTLING_POSTCHANGE
2014 + */
2015 +- for_each_cpu(i, online_throttling_cpus) {
2016 ++ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {
2017 + t_state.cpu = i;
2018 + acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE,
2019 + &t_state);
2020 + }
2021 +- /* restore the previous state */
2022 +- /* FIXME: use work_on_cpu() */
2023 +- set_cpus_allowed_ptr(current, saved_mask);
2024 +-exit:
2025 +- free_cpumask_var(online_throttling_cpus);
2026 +- free_cpumask_var(saved_mask);
2027 ++
2028 + return ret;
2029 + }
2030 +
2031 +diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
2032 +index e19898d..2ebfdd2 100644
2033 +--- a/drivers/acpi/video.c
2034 ++++ b/drivers/acpi/video.c
2035 +@@ -646,6 +646,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
2036 + union acpi_object *o;
2037 + struct acpi_video_device_brightness *br = NULL;
2038 + int result = -EINVAL;
2039 ++ u32 value;
2040 +
2041 + if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
2042 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
2043 +@@ -676,7 +677,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
2044 + printk(KERN_ERR PREFIX "Invalid data\n");
2045 + continue;
2046 + }
2047 +- br->levels[count] = (u32) o->integer.value;
2048 ++ value = (u32) o->integer.value;
2049 ++ /* Skip duplicate entries */
2050 ++ if (count > 2 && br->levels[count - 1] == value)
2051 ++ continue;
2052 ++
2053 ++ br->levels[count] = value;
2054 +
2055 + if (br->levels[count] > max_level)
2056 + max_level = br->levels[count];
2057 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
2058 +index f4000ee..0feffc3 100644
2059 +--- a/drivers/ata/ahci.c
2060 ++++ b/drivers/ata/ahci.c
2061 +@@ -61,6 +61,7 @@ enum board_ids {
2062 + /* board IDs by feature in alphabetical order */
2063 + board_ahci,
2064 + board_ahci_ign_iferr,
2065 ++ board_ahci_noncq,
2066 + board_ahci_nosntf,
2067 + board_ahci_yes_fbs,
2068 +
2069 +@@ -123,6 +124,13 @@ static const struct ata_port_info ahci_port_info[] = {
2070 + .udma_mask = ATA_UDMA6,
2071 + .port_ops = &ahci_ops,
2072 + },
2073 ++ [board_ahci_noncq] = {
2074 ++ AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ),
2075 ++ .flags = AHCI_FLAG_COMMON,
2076 ++ .pio_mask = ATA_PIO4,
2077 ++ .udma_mask = ATA_UDMA6,
2078 ++ .port_ops = &ahci_ops,
2079 ++ },
2080 + [board_ahci_nosntf] =
2081 + {
2082 + AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF),
2083 +@@ -458,6 +466,12 @@ static const struct pci_device_id ahci_pci_tbl[] = {
2084 + { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */
2085 + { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */
2086 +
2087 ++ /*
2088 ++ * Samsung SSDs found on some macbooks. NCQ times out.
2089 ++ * https://bugzilla.kernel.org/show_bug.cgi?id=60731
2090 ++ */
2091 ++ { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq },
2092 ++
2093 + /* Enmotus */
2094 + { PCI_DEVICE(0x1c44, 0x8000), board_ahci },
2095 +
2096 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
2097 +index 72bbb5e..b3f0f5a 100644
2098 +--- a/drivers/ata/libata-core.c
2099 ++++ b/drivers/ata/libata-core.c
2100 +@@ -2188,6 +2188,16 @@ int ata_dev_configure(struct ata_device *dev)
2101 + if (rc)
2102 + return rc;
2103 +
2104 ++ /* some WD SATA-1 drives have issues with LPM, turn on NOLPM for them */
2105 ++ if ((dev->horkage & ATA_HORKAGE_WD_BROKEN_LPM) &&
2106 ++ (id[76] & 0xe) == 0x2)
2107 ++ dev->horkage |= ATA_HORKAGE_NOLPM;
2108 ++
2109 ++ if (dev->horkage & ATA_HORKAGE_NOLPM) {
2110 ++ ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
2111 ++ dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
2112 ++ }
2113 ++
2114 + /* let ACPI work its magic */
2115 + rc = ata_acpi_on_devcfg(dev);
2116 + if (rc)
2117 +@@ -4099,6 +4109,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
2118 +
2119 + /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
2120 + { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
2121 ++ { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA },
2122 +
2123 + /* Blacklist entries taken from Silicon Image 3124/3132
2124 + Windows driver .inf file - also several Linux problem reports */
2125 +@@ -4143,6 +4154,23 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
2126 + { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
2127 + { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
2128 +
2129 ++ /*
2130 ++ * Some WD SATA-I drives spin up and down erratically when the link
2131 ++ * is put into the slumber mode. We don't have full list of the
2132 ++ * affected devices. Disable LPM if the device matches one of the
2133 ++ * known prefixes and is SATA-1. As a side effect LPM partial is
2134 ++ * lost too.
2135 ++ *
2136 ++ * https://bugzilla.kernel.org/show_bug.cgi?id=57211
2137 ++ */
2138 ++ { "WDC WD800JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2139 ++ { "WDC WD1200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2140 ++ { "WDC WD1600JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2141 ++ { "WDC WD2000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2142 ++ { "WDC WD2500JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2143 ++ { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2144 ++ { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
2145 ++
2146 + /* End Marker */
2147 + { }
2148 + };
2149 +diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
2150 +index f5c35be..0ba32fe 100644
2151 +--- a/drivers/ata/libata-pmp.c
2152 ++++ b/drivers/ata/libata-pmp.c
2153 +@@ -447,8 +447,11 @@ static void sata_pmp_quirks(struct ata_port *ap)
2154 + * otherwise. Don't try hard to recover it.
2155 + */
2156 + ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY;
2157 +- } else if (vendor == 0x197b && devid == 0x2352) {
2158 +- /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */
2159 ++ } else if (vendor == 0x197b && (devid == 0x2352 || devid == 0x0325)) {
2160 ++ /*
2161 ++ * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350?
2162 ++ * 0x0325: jmicron JMB394.
2163 ++ */
2164 + ata_for_each_link(link, ap, EDGE) {
2165 + /* SRST breaks detection and disks get misclassified
2166 + * LPM disabled to avoid potential problems
2167 +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
2168 +index dd332e5..8460e62 100644
2169 +--- a/drivers/ata/libata-scsi.c
2170 ++++ b/drivers/ata/libata-scsi.c
2171 +@@ -111,12 +111,14 @@ static const char *ata_lpm_policy_names[] = {
2172 + [ATA_LPM_MIN_POWER] = "min_power",
2173 + };
2174 +
2175 +-static ssize_t ata_scsi_lpm_store(struct device *dev,
2176 ++static ssize_t ata_scsi_lpm_store(struct device *device,
2177 + struct device_attribute *attr,
2178 + const char *buf, size_t count)
2179 + {
2180 +- struct Scsi_Host *shost = class_to_shost(dev);
2181 ++ struct Scsi_Host *shost = class_to_shost(device);
2182 + struct ata_port *ap = ata_shost_to_port(shost);
2183 ++ struct ata_link *link;
2184 ++ struct ata_device *dev;
2185 + enum ata_lpm_policy policy;
2186 + unsigned long flags;
2187 +
2188 +@@ -132,10 +134,20 @@ static ssize_t ata_scsi_lpm_store(struct device *dev,
2189 + return -EINVAL;
2190 +
2191 + spin_lock_irqsave(ap->lock, flags);
2192 ++
2193 ++ ata_for_each_link(link, ap, EDGE) {
2194 ++ ata_for_each_dev(dev, &ap->link, ENABLED) {
2195 ++ if (dev->horkage & ATA_HORKAGE_NOLPM) {
2196 ++ count = -EOPNOTSUPP;
2197 ++ goto out_unlock;
2198 ++ }
2199 ++ }
2200 ++ }
2201 ++
2202 + ap->target_lpm_policy = policy;
2203 + ata_port_schedule_eh(ap);
2204 ++out_unlock:
2205 + spin_unlock_irqrestore(ap->lock, flags);
2206 +-
2207 + return count;
2208 + }
2209 +
2210 +diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
2211 +index 9dfb40b..0c4ed89 100644
2212 +--- a/drivers/ata/sata_sil.c
2213 ++++ b/drivers/ata/sata_sil.c
2214 +@@ -157,6 +157,7 @@ static const struct sil_drivelist {
2215 + { "ST380011ASL", SIL_QUIRK_MOD15WRITE },
2216 + { "ST3120022ASL", SIL_QUIRK_MOD15WRITE },
2217 + { "ST3160021ASL", SIL_QUIRK_MOD15WRITE },
2218 ++ { "TOSHIBA MK2561GSYN", SIL_QUIRK_MOD15WRITE },
2219 + { "Maxtor 4D060H3", SIL_QUIRK_UDMA5MAX },
2220 + { }
2221 + };
2222 +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
2223 +index 7b2ec59..96b8cb7 100644
2224 +--- a/drivers/block/xen-blkfront.c
2225 ++++ b/drivers/block/xen-blkfront.c
2226 +@@ -1281,13 +1281,16 @@ static void blkback_changed(struct xenbus_device *dev,
2227 + case XenbusStateReconfiguring:
2228 + case XenbusStateReconfigured:
2229 + case XenbusStateUnknown:
2230 +- case XenbusStateClosed:
2231 + break;
2232 +
2233 + case XenbusStateConnected:
2234 + blkfront_connect(info);
2235 + break;
2236 +
2237 ++ case XenbusStateClosed:
2238 ++ if (dev->state == XenbusStateClosed)
2239 ++ break;
2240 ++ /* Missed the backend's Closing state -- fallthrough */
2241 + case XenbusStateClosing:
2242 + blkfront_closing(info);
2243 + break;
2244 +diff --git a/drivers/char/raw.c b/drivers/char/raw.c
2245 +index b6de2c0..5ded1a5 100644
2246 +--- a/drivers/char/raw.c
2247 ++++ b/drivers/char/raw.c
2248 +@@ -190,7 +190,7 @@ static int bind_get(int number, dev_t *dev)
2249 + struct raw_device_data *rawdev;
2250 + struct block_device *bdev;
2251 +
2252 +- if (number <= 0 || number >= MAX_RAW_MINORS)
2253 ++ if (number <= 0 || number >= max_raw_minors)
2254 + return -EINVAL;
2255 +
2256 + rawdev = &raw_devices[number];
2257 +diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
2258 +index 6595180..3f89386 100644
2259 +--- a/drivers/dma/ioat/dma.c
2260 ++++ b/drivers/dma/ioat/dma.c
2261 +@@ -75,7 +75,8 @@ static irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
2262 + attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET);
2263 + for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) {
2264 + chan = ioat_chan_by_index(instance, bit);
2265 +- tasklet_schedule(&chan->cleanup_task);
2266 ++ if (test_bit(IOAT_RUN, &chan->state))
2267 ++ tasklet_schedule(&chan->cleanup_task);
2268 + }
2269 +
2270 + writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET);
2271 +@@ -91,7 +92,8 @@ static irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data)
2272 + {
2273 + struct ioat_chan_common *chan = data;
2274 +
2275 +- tasklet_schedule(&chan->cleanup_task);
2276 ++ if (test_bit(IOAT_RUN, &chan->state))
2277 ++ tasklet_schedule(&chan->cleanup_task);
2278 +
2279 + return IRQ_HANDLED;
2280 + }
2281 +@@ -113,7 +115,6 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c
2282 + chan->timer.function = device->timer_fn;
2283 + chan->timer.data = data;
2284 + tasklet_init(&chan->cleanup_task, device->cleanup_fn, data);
2285 +- tasklet_disable(&chan->cleanup_task);
2286 + }
2287 +
2288 + /**
2289 +@@ -356,13 +357,43 @@ static int ioat1_dma_alloc_chan_resources(struct dma_chan *c)
2290 + writel(((u64) chan->completion_dma) >> 32,
2291 + chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH);
2292 +
2293 +- tasklet_enable(&chan->cleanup_task);
2294 ++ set_bit(IOAT_RUN, &chan->state);
2295 + ioat1_dma_start_null_desc(ioat); /* give chain to dma device */
2296 + dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n",
2297 + __func__, ioat->desccount);
2298 + return ioat->desccount;
2299 + }
2300 +
2301 ++void ioat_stop(struct ioat_chan_common *chan)
2302 ++{
2303 ++ struct ioatdma_device *device = chan->device;
2304 ++ struct pci_dev *pdev = device->pdev;
2305 ++ int chan_id = chan_num(chan);
2306 ++
2307 ++ /* 1/ stop irq from firing tasklets
2308 ++ * 2/ stop the tasklet from re-arming irqs
2309 ++ */
2310 ++ clear_bit(IOAT_RUN, &chan->state);
2311 ++
2312 ++ /* flush inflight interrupts */
2313 ++#ifdef CONFIG_PCI_MSI
2314 ++ if (pdev->msix_enabled) {
2315 ++ struct msix_entry *msix = &device->msix_entries[chan_id];
2316 ++ synchronize_irq(msix->vector);
2317 ++ } else
2318 ++#endif
2319 ++ synchronize_irq(pdev->irq);
2320 ++
2321 ++ /* flush inflight timers */
2322 ++ del_timer_sync(&chan->timer);
2323 ++
2324 ++ /* flush inflight tasklet runs */
2325 ++ tasklet_kill(&chan->cleanup_task);
2326 ++
2327 ++ /* final cleanup now that everything is quiesced and can't re-arm */
2328 ++ device->cleanup_fn((unsigned long) &chan->common);
2329 ++}
2330 ++
2331 + /**
2332 + * ioat1_dma_free_chan_resources - release all the descriptors
2333 + * @chan: the channel to be cleaned
2334 +@@ -381,9 +412,7 @@ static void ioat1_dma_free_chan_resources(struct dma_chan *c)
2335 + if (ioat->desccount == 0)
2336 + return;
2337 +
2338 +- tasklet_disable(&chan->cleanup_task);
2339 +- del_timer_sync(&chan->timer);
2340 +- ioat1_cleanup(ioat);
2341 ++ ioat_stop(chan);
2342 +
2343 + /* Delay 100ms after reset to allow internal DMA logic to quiesce
2344 + * before removing DMA descriptor resources.
2345 +@@ -528,8 +557,11 @@ ioat1_dma_prep_memcpy(struct dma_chan *c, dma_addr_t dma_dest,
2346 + static void ioat1_cleanup_event(unsigned long data)
2347 + {
2348 + struct ioat_dma_chan *ioat = to_ioat_chan((void *) data);
2349 ++ struct ioat_chan_common *chan = &ioat->base;
2350 +
2351 + ioat1_cleanup(ioat);
2352 ++ if (!test_bit(IOAT_RUN, &chan->state))
2353 ++ return;
2354 + writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET);
2355 + }
2356 +
2357 +diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
2358 +index 8bebddd..466e0f34c 100644
2359 +--- a/drivers/dma/ioat/dma.h
2360 ++++ b/drivers/dma/ioat/dma.h
2361 +@@ -344,6 +344,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
2362 + dma_addr_t *phys_complete);
2363 + void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type);
2364 + void ioat_kobject_del(struct ioatdma_device *device);
2365 ++void ioat_stop(struct ioat_chan_common *chan);
2366 + extern const struct sysfs_ops ioat_sysfs_ops;
2367 + extern struct ioat_sysfs_entry ioat_version_attr;
2368 + extern struct ioat_sysfs_entry ioat_cap_attr;
2369 +diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
2370 +index cb8864d..e60933e 100644
2371 +--- a/drivers/dma/ioat/dma_v2.c
2372 ++++ b/drivers/dma/ioat/dma_v2.c
2373 +@@ -189,8 +189,11 @@ static void ioat2_cleanup(struct ioat2_dma_chan *ioat)
2374 + void ioat2_cleanup_event(unsigned long data)
2375 + {
2376 + struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data);
2377 ++ struct ioat_chan_common *chan = &ioat->base;
2378 +
2379 + ioat2_cleanup(ioat);
2380 ++ if (!test_bit(IOAT_RUN, &chan->state))
2381 ++ return;
2382 + writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET);
2383 + }
2384 +
2385 +@@ -542,10 +545,10 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
2386 + ioat->issued = 0;
2387 + ioat->tail = 0;
2388 + ioat->alloc_order = order;
2389 ++ set_bit(IOAT_RUN, &chan->state);
2390 + spin_unlock_bh(&ioat->prep_lock);
2391 + spin_unlock_bh(&chan->cleanup_lock);
2392 +
2393 +- tasklet_enable(&chan->cleanup_task);
2394 + ioat2_start_null_desc(ioat);
2395 +
2396 + /* check that we got off the ground */
2397 +@@ -555,7 +558,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
2398 + } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status));
2399 +
2400 + if (is_ioat_active(status) || is_ioat_idle(status)) {
2401 +- set_bit(IOAT_RUN, &chan->state);
2402 + return 1 << ioat->alloc_order;
2403 + } else {
2404 + u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
2405 +@@ -798,11 +800,8 @@ void ioat2_free_chan_resources(struct dma_chan *c)
2406 + if (!ioat->ring)
2407 + return;
2408 +
2409 +- tasklet_disable(&chan->cleanup_task);
2410 +- del_timer_sync(&chan->timer);
2411 +- device->cleanup_fn((unsigned long) c);
2412 ++ ioat_stop(chan);
2413 + device->reset_hw(chan);
2414 +- clear_bit(IOAT_RUN, &chan->state);
2415 +
2416 + spin_lock_bh(&chan->cleanup_lock);
2417 + spin_lock_bh(&ioat->prep_lock);
2418 +diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
2419 +index 714560f..8680031 100644
2420 +--- a/drivers/dma/ioat/dma_v3.c
2421 ++++ b/drivers/dma/ioat/dma_v3.c
2422 +@@ -325,8 +325,11 @@ static void ioat3_cleanup(struct ioat2_dma_chan *ioat)
2423 + static void ioat3_cleanup_event(unsigned long data)
2424 + {
2425 + struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data);
2426 ++ struct ioat_chan_common *chan = &ioat->base;
2427 +
2428 + ioat3_cleanup(ioat);
2429 ++ if (!test_bit(IOAT_RUN, &chan->state))
2430 ++ return;
2431 + writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET);
2432 + }
2433 +
2434 +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
2435 +index 13259ca..4b27c54 100644
2436 +--- a/drivers/dma/ste_dma40.c
2437 ++++ b/drivers/dma/ste_dma40.c
2438 +@@ -1202,6 +1202,7 @@ static void dma_tasklet(unsigned long data)
2439 + struct d40_chan *d40c = (struct d40_chan *) data;
2440 + struct d40_desc *d40d;
2441 + unsigned long flags;
2442 ++ bool callback_active;
2443 + dma_async_tx_callback callback;
2444 + void *callback_param;
2445 +
2446 +@@ -1225,6 +1226,7 @@ static void dma_tasklet(unsigned long data)
2447 + }
2448 +
2449 + /* Callback to client */
2450 ++ callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT);
2451 + callback = d40d->txd.callback;
2452 + callback_param = d40d->txd.callback_param;
2453 +
2454 +@@ -1249,7 +1251,7 @@ static void dma_tasklet(unsigned long data)
2455 +
2456 + spin_unlock_irqrestore(&d40c->lock, flags);
2457 +
2458 +- if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT))
2459 ++ if (callback_active && callback)
2460 + callback(callback_param);
2461 +
2462 + return;
2463 +diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
2464 +index d69144a..7db101b 100644
2465 +--- a/drivers/edac/edac_mc.c
2466 ++++ b/drivers/edac/edac_mc.c
2467 +@@ -323,7 +323,8 @@ static void edac_mc_workq_function(struct work_struct *work_req)
2468 + *
2469 + * called with the mem_ctls_mutex held
2470 + */
2471 +-static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
2472 ++static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec,
2473 ++ bool init)
2474 + {
2475 + debugf0("%s()\n", __func__);
2476 +
2477 +@@ -331,7 +332,9 @@ static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
2478 + if (mci->op_state != OP_RUNNING_POLL)
2479 + return;
2480 +
2481 +- INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
2482 ++ if (init)
2483 ++ INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
2484 ++
2485 + queue_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec));
2486 + }
2487 +
2488 +@@ -391,7 +394,7 @@ void edac_mc_reset_delay_period(int value)
2489 + list_for_each(item, &mc_devices) {
2490 + mci = list_entry(item, struct mem_ctl_info, link);
2491 +
2492 +- edac_mc_workq_setup(mci, (unsigned long) value);
2493 ++ edac_mc_workq_setup(mci, value, false);
2494 + }
2495 +
2496 + mutex_unlock(&mem_ctls_mutex);
2497 +@@ -539,7 +542,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
2498 + /* This instance is NOW RUNNING */
2499 + mci->op_state = OP_RUNNING_POLL;
2500 +
2501 +- edac_mc_workq_setup(mci, edac_mc_get_poll_msec());
2502 ++ edac_mc_workq_setup(mci, edac_mc_get_poll_msec(), true);
2503 + } else {
2504 + mci->op_state = OP_RUNNING_INTERRUPT;
2505 + }
2506 +diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
2507 +index 2244df0..1e08426 100644
2508 +--- a/drivers/edac/i7300_edac.c
2509 ++++ b/drivers/edac/i7300_edac.c
2510 +@@ -962,33 +962,35 @@ static int __devinit i7300_get_devices(struct mem_ctl_info *mci)
2511 +
2512 + /* Attempt to 'get' the MCH register we want */
2513 + pdev = NULL;
2514 +- while (!pvt->pci_dev_16_1_fsb_addr_map ||
2515 +- !pvt->pci_dev_16_2_fsb_err_regs) {
2516 +- pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
2517 +- PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev);
2518 +- if (!pdev) {
2519 +- /* End of list, leave */
2520 +- i7300_printk(KERN_ERR,
2521 +- "'system address,Process Bus' "
2522 +- "device not found:"
2523 +- "vendor 0x%x device 0x%x ERR funcs "
2524 +- "(broken BIOS?)\n",
2525 +- PCI_VENDOR_ID_INTEL,
2526 +- PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);
2527 +- goto error;
2528 +- }
2529 +-
2530 ++ while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
2531 ++ PCI_DEVICE_ID_INTEL_I7300_MCH_ERR,
2532 ++ pdev))) {
2533 + /* Store device 16 funcs 1 and 2 */
2534 + switch (PCI_FUNC(pdev->devfn)) {
2535 + case 1:
2536 +- pvt->pci_dev_16_1_fsb_addr_map = pdev;
2537 ++ if (!pvt->pci_dev_16_1_fsb_addr_map)
2538 ++ pvt->pci_dev_16_1_fsb_addr_map =
2539 ++ pci_dev_get(pdev);
2540 + break;
2541 + case 2:
2542 +- pvt->pci_dev_16_2_fsb_err_regs = pdev;
2543 ++ if (!pvt->pci_dev_16_2_fsb_err_regs)
2544 ++ pvt->pci_dev_16_2_fsb_err_regs =
2545 ++ pci_dev_get(pdev);
2546 + break;
2547 + }
2548 + }
2549 +
2550 ++ if (!pvt->pci_dev_16_1_fsb_addr_map ||
2551 ++ !pvt->pci_dev_16_2_fsb_err_regs) {
2552 ++ /* At least one device was not found */
2553 ++ i7300_printk(KERN_ERR,
2554 ++ "'system address,Process Bus' device not found:"
2555 ++ "vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n",
2556 ++ PCI_VENDOR_ID_INTEL,
2557 ++ PCI_DEVICE_ID_INTEL_I7300_MCH_ERR);
2558 ++ goto error;
2559 ++ }
2560 ++
2561 + debugf1("System Address, processor bus- PCI Bus ID: %s %x:%x\n",
2562 + pci_name(pvt->pci_dev_16_0_fsb_ctlr),
2563 + pvt->pci_dev_16_0_fsb_ctlr->vendor,
2564 +diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
2565 +index b3ccefa..4c18b3c 100644
2566 +--- a/drivers/edac/i7core_edac.c
2567 ++++ b/drivers/edac/i7core_edac.c
2568 +@@ -1365,14 +1365,19 @@ static int i7core_get_onedevice(struct pci_dev **prev,
2569 + * is at addr 8086:2c40, instead of 8086:2c41. So, we need
2570 + * to probe for the alternate address in case of failure
2571 + */
2572 +- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev)
2573 ++ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) {
2574 ++ pci_dev_get(*prev); /* pci_get_device will put it */
2575 + pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
2576 + PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev);
2577 ++ }
2578 +
2579 +- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev)
2580 ++ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE &&
2581 ++ !pdev) {
2582 ++ pci_dev_get(*prev); /* pci_get_device will put it */
2583 + pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
2584 + PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT,
2585 + *prev);
2586 ++ }
2587 +
2588 + if (!pdev) {
2589 + if (*prev) {
2590 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
2591 +index 61b708b..2ea8a96 100644
2592 +--- a/drivers/gpu/drm/i915/intel_display.c
2593 ++++ b/drivers/gpu/drm/i915/intel_display.c
2594 +@@ -7252,6 +7252,20 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
2595 + goto err_unpin;
2596 + }
2597 +
2598 ++ /*
2599 ++ * BSpec MI_DISPLAY_FLIP for IVB:
2600 ++ * "The full packet must be contained within the same cache line."
2601 ++ *
2602 ++ * Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same
2603 ++ * cacheline, if we ever start emitting more commands before
2604 ++ * the MI_DISPLAY_FLIP we may need to first emit everything else,
2605 ++ * then do the cacheline alignment, and finally emit the
2606 ++ * MI_DISPLAY_FLIP.
2607 ++ */
2608 ++ ret = intel_ring_cacheline_align(ring);
2609 ++ if (ret)
2610 ++ goto err_unpin;
2611 ++
2612 + ret = intel_ring_begin(ring, 4);
2613 + if (ret)
2614 + goto err_unpin;
2615 +diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
2616 +index 72163e8..ca75076 100644
2617 +--- a/drivers/gpu/drm/i915/intel_dp.c
2618 ++++ b/drivers/gpu/drm/i915/intel_dp.c
2619 +@@ -483,6 +483,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
2620 + uint8_t msg[20];
2621 + int msg_bytes;
2622 + uint8_t ack;
2623 ++ int retry;
2624 +
2625 + intel_dp_check_edp(intel_dp);
2626 + if (send_bytes > 16)
2627 +@@ -493,18 +494,20 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
2628 + msg[3] = send_bytes - 1;
2629 + memcpy(&msg[4], send, send_bytes);
2630 + msg_bytes = send_bytes + 4;
2631 +- for (;;) {
2632 ++ for (retry = 0; retry < 7; retry++) {
2633 + ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1);
2634 + if (ret < 0)
2635 + return ret;
2636 + if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
2637 +- break;
2638 ++ return send_bytes;
2639 + else if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_DEFER)
2640 +- udelay(100);
2641 ++ usleep_range(400, 500);
2642 + else
2643 + return -EIO;
2644 + }
2645 +- return send_bytes;
2646 ++
2647 ++ DRM_ERROR("too many retries, giving up\n");
2648 ++ return -EIO;
2649 + }
2650 +
2651 + /* Write a single byte to the aux channel in native mode */
2652 +@@ -526,6 +529,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
2653 + int reply_bytes;
2654 + uint8_t ack;
2655 + int ret;
2656 ++ int retry;
2657 +
2658 + intel_dp_check_edp(intel_dp);
2659 + msg[0] = AUX_NATIVE_READ << 4;
2660 +@@ -536,7 +540,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
2661 + msg_bytes = 4;
2662 + reply_bytes = recv_bytes + 1;
2663 +
2664 +- for (;;) {
2665 ++ for (retry = 0; retry < 7; retry++) {
2666 + ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,
2667 + reply, reply_bytes);
2668 + if (ret == 0)
2669 +@@ -549,10 +553,13 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
2670 + return ret - 1;
2671 + }
2672 + else if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_DEFER)
2673 +- udelay(100);
2674 ++ usleep_range(400, 500);
2675 + else
2676 + return -EIO;
2677 + }
2678 ++
2679 ++ DRM_ERROR("too many retries, giving up\n");
2680 ++ return -EIO;
2681 + }
2682 +
2683 + static int
2684 +diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
2685 +index 3c55cf6..8ee068e 100644
2686 +--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
2687 ++++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
2688 +@@ -1213,6 +1213,27 @@ int intel_ring_begin(struct intel_ring_buffer *ring,
2689 + return 0;
2690 + }
2691 +
2692 ++/* Align the ring tail to a cacheline boundary */
2693 ++int intel_ring_cacheline_align(struct intel_ring_buffer *ring)
2694 ++{
2695 ++ int num_dwords = (64 - (ring->tail & 63)) / sizeof(uint32_t);
2696 ++ int ret;
2697 ++
2698 ++ if (num_dwords == 0)
2699 ++ return 0;
2700 ++
2701 ++ ret = intel_ring_begin(ring, num_dwords);
2702 ++ if (ret)
2703 ++ return ret;
2704 ++
2705 ++ while (num_dwords--)
2706 ++ intel_ring_emit(ring, MI_NOOP);
2707 ++
2708 ++ intel_ring_advance(ring);
2709 ++
2710 ++ return 0;
2711 ++}
2712 ++
2713 + void intel_ring_advance(struct intel_ring_buffer *ring)
2714 + {
2715 + ring->tail &= ring->size - 1;
2716 +diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
2717 +index 68281c9..d83cc97 100644
2718 +--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
2719 ++++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
2720 +@@ -174,6 +174,7 @@ static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
2721 + }
2722 +
2723 + int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n);
2724 ++int __must_check intel_ring_cacheline_align(struct intel_ring_buffer *ring);
2725 +
2726 + static inline void intel_ring_emit(struct intel_ring_buffer *ring,
2727 + u32 data)
2728 +diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
2729 +index 038570a..cd98c06 100644
2730 +--- a/drivers/gpu/drm/radeon/atombios_crtc.c
2731 ++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
2732 +@@ -956,10 +956,13 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
2733 + ss_enabled =
2734 + radeon_atombios_get_ppll_ss_info(rdev, &ss,
2735 + ATOM_DP_SS_ID1);
2736 +- } else
2737 ++ } else {
2738 + ss_enabled =
2739 + radeon_atombios_get_ppll_ss_info(rdev, &ss,
2740 + ATOM_DP_SS_ID1);
2741 ++ }
2742 ++ /* disable spread spectrum on DCE3 DP */
2743 ++ ss_enabled = false;
2744 + }
2745 + break;
2746 + case ATOM_ENCODER_MODE_LVDS:
2747 +diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
2748 +index 57e45c6..f7e3cc0 100644
2749 +--- a/drivers/gpu/drm/radeon/r600.c
2750 ++++ b/drivers/gpu/drm/radeon/r600.c
2751 +@@ -2315,14 +2315,18 @@ int r600_ring_test(struct radeon_device *rdev)
2752 + void r600_fence_ring_emit(struct radeon_device *rdev,
2753 + struct radeon_fence *fence)
2754 + {
2755 ++ u32 cp_coher_cntl = PACKET3_TC_ACTION_ENA | PACKET3_VC_ACTION_ENA |
2756 ++ PACKET3_SH_ACTION_ENA;
2757 ++
2758 ++ if (rdev->family >= CHIP_RV770)
2759 ++ cp_coher_cntl |= PACKET3_FULL_CACHE_ENA;
2760 ++
2761 + if (rdev->wb.use_event) {
2762 + u64 addr = rdev->wb.gpu_addr + R600_WB_EVENT_OFFSET +
2763 + (u64)(rdev->fence_drv.scratch_reg - rdev->scratch.reg_base);
2764 + /* flush read cache over gart */
2765 + radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_SYNC, 3));
2766 +- radeon_ring_write(rdev, PACKET3_TC_ACTION_ENA |
2767 +- PACKET3_VC_ACTION_ENA |
2768 +- PACKET3_SH_ACTION_ENA);
2769 ++ radeon_ring_write(rdev, cp_coher_cntl);
2770 + radeon_ring_write(rdev, 0xFFFFFFFF);
2771 + radeon_ring_write(rdev, 0);
2772 + radeon_ring_write(rdev, 10); /* poll interval */
2773 +@@ -2336,9 +2340,7 @@ void r600_fence_ring_emit(struct radeon_device *rdev,
2774 + } else {
2775 + /* flush read cache over gart */
2776 + radeon_ring_write(rdev, PACKET3(PACKET3_SURFACE_SYNC, 3));
2777 +- radeon_ring_write(rdev, PACKET3_TC_ACTION_ENA |
2778 +- PACKET3_VC_ACTION_ENA |
2779 +- PACKET3_SH_ACTION_ENA);
2780 ++ radeon_ring_write(rdev, cp_coher_cntl);
2781 + radeon_ring_write(rdev, 0xFFFFFFFF);
2782 + radeon_ring_write(rdev, 0);
2783 + radeon_ring_write(rdev, 10); /* poll interval */
2784 +diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
2785 +index d4d23a8d..cb29480 100644
2786 +--- a/drivers/gpu/drm/radeon/r600d.h
2787 ++++ b/drivers/gpu/drm/radeon/r600d.h
2788 +@@ -838,6 +838,7 @@
2789 + #define PACKET3_INDIRECT_BUFFER 0x32
2790 + #define PACKET3_SURFACE_SYNC 0x43
2791 + # define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
2792 ++# define PACKET3_FULL_CACHE_ENA (1 << 20) /* r7xx+ only */
2793 + # define PACKET3_TC_ACTION_ENA (1 << 23)
2794 + # define PACKET3_VC_ACTION_ENA (1 << 24)
2795 + # define PACKET3_CB_ACTION_ENA (1 << 25)
2796 +diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
2797 +index cda89c6b..e4e455e 100644
2798 +--- a/drivers/gpu/drm/radeon/radeon_atombios.c
2799 ++++ b/drivers/gpu/drm/radeon/radeon_atombios.c
2800 +@@ -2735,6 +2735,10 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
2801 + /* tell the bios not to handle mode switching */
2802 + bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH;
2803 +
2804 ++ /* clear the vbios dpms state */
2805 ++ if (ASIC_IS_DCE4(rdev))
2806 ++ bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE;
2807 ++
2808 + if (rdev->family >= CHIP_R600) {
2809 + WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
2810 + WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
2811 +diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
2812 +index cf20351..894b5f0 100644
2813 +--- a/drivers/gpu/drm/radeon/radeon_i2c.c
2814 ++++ b/drivers/gpu/drm/radeon/radeon_i2c.c
2815 +@@ -998,6 +998,9 @@ void radeon_i2c_destroy(struct radeon_i2c_chan *i2c)
2816 + /* Add the default buses */
2817 + void radeon_i2c_init(struct radeon_device *rdev)
2818 + {
2819 ++ if (radeon_hw_i2c)
2820 ++ DRM_INFO("hw_i2c forced on, you may experience display detection problems!\n");
2821 ++
2822 + if (rdev->is_atom_bios)
2823 + radeon_atombios_i2c_init(rdev);
2824 + else
2825 +diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
2826 +index d58eccb..b0a0ee4 100644
2827 +--- a/drivers/gpu/drm/radeon/radeon_pm.c
2828 ++++ b/drivers/gpu/drm/radeon/radeon_pm.c
2829 +@@ -573,8 +573,10 @@ void radeon_pm_resume(struct radeon_device *rdev)
2830 + rdev->pm.current_clock_mode_index = 0;
2831 + rdev->pm.current_sclk = rdev->pm.default_sclk;
2832 + rdev->pm.current_mclk = rdev->pm.default_mclk;
2833 +- rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
2834 +- rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.vddci;
2835 ++ if (rdev->pm.power_state) {
2836 ++ rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
2837 ++ rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.vddci;
2838 ++ }
2839 + if (rdev->pm.pm_method == PM_METHOD_DYNPM
2840 + && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
2841 + rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
2842 +diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
2843 +index 650c9f0..d7f3df9 100644
2844 +--- a/drivers/hv/connection.c
2845 ++++ b/drivers/hv/connection.c
2846 +@@ -45,7 +45,6 @@ struct vmbus_connection vmbus_connection = {
2847 + int vmbus_connect(void)
2848 + {
2849 + int ret = 0;
2850 +- int t;
2851 + struct vmbus_channel_msginfo *msginfo = NULL;
2852 + struct vmbus_channel_initiate_contact *msg;
2853 + unsigned long flags;
2854 +@@ -132,16 +131,7 @@ int vmbus_connect(void)
2855 + }
2856 +
2857 + /* Wait for the connection response */
2858 +- t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ);
2859 +- if (t == 0) {
2860 +- spin_lock_irqsave(&vmbus_connection.channelmsg_lock,
2861 +- flags);
2862 +- list_del(&msginfo->msglistentry);
2863 +- spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
2864 +- flags);
2865 +- ret = -ETIMEDOUT;
2866 +- goto cleanup;
2867 +- }
2868 ++ wait_for_completion(&msginfo->waitevent);
2869 +
2870 + spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
2871 + list_del(&msginfo->msglistentry);
2872 +diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
2873 +index 20d1b2d..e19fef7 100644
2874 +--- a/drivers/hwmon/max1668.c
2875 ++++ b/drivers/hwmon/max1668.c
2876 +@@ -243,7 +243,7 @@ static ssize_t set_temp_min(struct device *dev,
2877 + data->temp_min[index] = SENSORS_LIMIT(temp/1000, -128, 127);
2878 + if (i2c_smbus_write_byte_data(client,
2879 + MAX1668_REG_LIML_WR(index),
2880 +- data->temp_max[index]))
2881 ++ data->temp_min[index]))
2882 + count = -EIO;
2883 + mutex_unlock(&data->update_lock);
2884 +
2885 +diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
2886 +index dbd4fa5..949ea640 100644
2887 +--- a/drivers/i2c/busses/Kconfig
2888 ++++ b/drivers/i2c/busses/Kconfig
2889 +@@ -137,6 +137,7 @@ config I2C_PIIX4
2890 + ATI SB700
2891 + ATI SB800
2892 + AMD Hudson-2
2893 ++ AMD ML
2894 + AMD CZ
2895 + Serverworks OSB4
2896 + Serverworks CSB5
2897 +diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
2898 +index 14b588c..c60f8e1 100644
2899 +--- a/drivers/i2c/busses/i2c-piix4.c
2900 ++++ b/drivers/i2c/busses/i2c-piix4.c
2901 +@@ -22,7 +22,7 @@
2902 + Intel PIIX4, 440MX
2903 + Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100
2904 + ATI IXP200, IXP300, IXP400, SB600, SB700, SB800
2905 +- AMD Hudson-2, CZ
2906 ++ AMD Hudson-2, ML, CZ
2907 + SMSC Victory66
2908 +
2909 + Note: we assume there can only be one device, with one SMBus interface.
2910 +@@ -231,7 +231,8 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
2911 + const struct pci_device_id *id)
2912 + {
2913 + unsigned short smba_idx = 0xcd6;
2914 +- u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en = 0x2c;
2915 ++ u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status;
2916 ++ u8 i2ccfg, i2ccfg_offset = 0x10;
2917 +
2918 + /* SB800 and later SMBus does not support forcing address */
2919 + if (force || force_addr) {
2920 +@@ -241,6 +242,16 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
2921 + }
2922 +
2923 + /* Determine the address of the SMBus areas */
2924 ++ if ((PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
2925 ++ PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
2926 ++ PIIX4_dev->revision >= 0x41) ||
2927 ++ (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
2928 ++ PIIX4_dev->device == 0x790b &&
2929 ++ PIIX4_dev->revision >= 0x49))
2930 ++ smb_en = 0x00;
2931 ++ else
2932 ++ smb_en = 0x2c;
2933 ++
2934 + if (!request_region(smba_idx, 2, "smba_idx")) {
2935 + dev_err(&PIIX4_dev->dev, "SMBus base address index region "
2936 + "0x%x already in use!\n", smba_idx);
2937 +@@ -252,13 +263,20 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
2938 + smba_en_hi = inb_p(smba_idx + 1);
2939 + release_region(smba_idx, 2);
2940 +
2941 +- if ((smba_en_lo & 1) == 0) {
2942 ++ if (!smb_en) {
2943 ++ smb_en_status = smba_en_lo & 0x10;
2944 ++ piix4_smba = smba_en_hi << 8;
2945 ++ } else {
2946 ++ smb_en_status = smba_en_lo & 0x01;
2947 ++ piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
2948 ++ }
2949 ++
2950 ++ if (!smb_en_status) {
2951 + dev_err(&PIIX4_dev->dev,
2952 + "Host SMBus controller not enabled!\n");
2953 + return -ENODEV;
2954 + }
2955 +
2956 +- piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
2957 + if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
2958 + return -ENODEV;
2959 +
2960 +diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
2961 +index 4fa2b11..44fde43 100644
2962 +--- a/drivers/idle/intel_idle.c
2963 ++++ b/drivers/idle/intel_idle.c
2964 +@@ -584,8 +584,9 @@ static int __init intel_idle_init(void)
2965 + intel_idle_cpuidle_driver_init();
2966 + retval = cpuidle_register_driver(&intel_idle_driver);
2967 + if (retval) {
2968 ++ struct cpuidle_driver *drv = cpuidle_get_driver();
2969 + printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
2970 +- cpuidle_get_driver()->name);
2971 ++ drv ? drv->name : "none");
2972 + return retval;
2973 + }
2974 +
2975 +diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
2976 +index 5a070e8..d8517fc 100644
2977 +--- a/drivers/infiniband/hw/qib/qib_iba7322.c
2978 ++++ b/drivers/infiniband/hw/qib/qib_iba7322.c
2979 +@@ -2279,6 +2279,11 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd)
2980 + qib_write_kreg_port(ppd, krp_ibcctrl_a, ppd->cpspec->ibcctrl_a);
2981 + qib_write_kreg(dd, kr_scratch, 0ULL);
2982 +
2983 ++ /* ensure previous Tx parameters are not still forced */
2984 ++ qib_write_kreg_port(ppd, krp_tx_deemph_override,
2985 ++ SYM_MASK(IBSD_TX_DEEMPHASIS_OVERRIDE_0,
2986 ++ reset_tx_deemphasis_override));
2987 ++
2988 + if (qib_compat_ddr_negotiate) {
2989 + ppd->cpspec->ibdeltainprog = 1;
2990 + ppd->cpspec->ibsymsnap = read_7322_creg32_port(ppd,
2991 +diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c
2992 +index 828609f..c0d93d4 100644
2993 +--- a/drivers/infiniband/hw/qib/qib_ud.c
2994 ++++ b/drivers/infiniband/hw/qib/qib_ud.c
2995 +@@ -57,13 +57,20 @@ static void qib_ud_loopback(struct qib_qp *sqp, struct qib_swqe *swqe)
2996 + struct qib_sge *sge;
2997 + struct ib_wc wc;
2998 + u32 length;
2999 ++ enum ib_qp_type sqptype, dqptype;
3000 +
3001 + qp = qib_lookup_qpn(ibp, swqe->wr.wr.ud.remote_qpn);
3002 + if (!qp) {
3003 + ibp->n_pkt_drops++;
3004 + return;
3005 + }
3006 +- if (qp->ibqp.qp_type != sqp->ibqp.qp_type ||
3007 ++
3008 ++ sqptype = sqp->ibqp.qp_type == IB_QPT_GSI ?
3009 ++ IB_QPT_UD : sqp->ibqp.qp_type;
3010 ++ dqptype = qp->ibqp.qp_type == IB_QPT_GSI ?
3011 ++ IB_QPT_UD : qp->ibqp.qp_type;
3012 ++
3013 ++ if (dqptype != sqptype ||
3014 + !(ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK)) {
3015 + ibp->n_pkt_drops++;
3016 + goto drop;
3017 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
3018 +index b4a4aaf..1a51b3d 100644
3019 +--- a/drivers/iommu/intel-iommu.c
3020 ++++ b/drivers/iommu/intel-iommu.c
3021 +@@ -884,7 +884,7 @@ static void dma_pte_free_level(struct dmar_domain *domain, int level,
3022 +
3023 + /* If range covers entire pagetable, free it */
3024 + if (!(start_pfn > level_pfn ||
3025 +- last_pfn < level_pfn + level_size(level))) {
3026 ++ last_pfn < level_pfn + level_size(level) - 1)) {
3027 + dma_clear_pte(pte);
3028 + domain_flush_cache(domain, pte, sizeof(*pte));
3029 + free_pgtable_page(level_pte);
3030 +diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
3031 +index faa4741..e10b6bb 100644
3032 +--- a/drivers/md/Kconfig
3033 ++++ b/drivers/md/Kconfig
3034 +@@ -185,8 +185,12 @@ config MD_FAULTY
3035 +
3036 + In unsure, say N.
3037 +
3038 ++config BLK_DEV_DM_BUILTIN
3039 ++ boolean
3040 ++
3041 + config BLK_DEV_DM
3042 + tristate "Device mapper support"
3043 ++ select BLK_DEV_DM_BUILTIN
3044 + ---help---
3045 + Device-mapper is a low level volume manager. It works by allowing
3046 + people to specify mappings for ranges of logical sectors. Various
3047 +diff --git a/drivers/md/Makefile b/drivers/md/Makefile
3048 +index 046860c..f67dec3 100644
3049 +--- a/drivers/md/Makefile
3050 ++++ b/drivers/md/Makefile
3051 +@@ -28,6 +28,7 @@ obj-$(CONFIG_MD_MULTIPATH) += multipath.o
3052 + obj-$(CONFIG_MD_FAULTY) += faulty.o
3053 + obj-$(CONFIG_BLK_DEV_MD) += md-mod.o
3054 + obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o
3055 ++obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o
3056 + obj-$(CONFIG_DM_BUFIO) += dm-bufio.o
3057 + obj-$(CONFIG_DM_CRYPT) += dm-crypt.o
3058 + obj-$(CONFIG_DM_DELAY) += dm-delay.o
3059 +diff --git a/drivers/md/dm-builtin.c b/drivers/md/dm-builtin.c
3060 +new file mode 100644
3061 +index 0000000..8b82788
3062 +--- /dev/null
3063 ++++ b/drivers/md/dm-builtin.c
3064 +@@ -0,0 +1,49 @@
3065 ++#include <linux/export.h>
3066 ++#include "dm.h"
3067 ++
3068 ++/*
3069 ++ * The kobject release method must not be placed in the module itself,
3070 ++ * otherwise we are subject to module unload races.
3071 ++ *
3072 ++ * The release method is called when the last reference to the kobject is
3073 ++ * dropped. It may be called by any other kernel code that drops the last
3074 ++ * reference.
3075 ++ *
3076 ++ * The release method suffers from module unload race. We may prevent the
3077 ++ * module from being unloaded at the start of the release method (using
3078 ++ * increased module reference count or synchronizing against the release
3079 ++ * method), however there is no way to prevent the module from being
3080 ++ * unloaded at the end of the release method.
3081 ++ *
3082 ++ * If this code were placed in the dm module, the following race may
3083 ++ * happen:
3084 ++ * 1. Some other process takes a reference to dm kobject
3085 ++ * 2. The user issues ioctl function to unload the dm device
3086 ++ * 3. dm_sysfs_exit calls kobject_put, however the object is not released
3087 ++ * because of the other reference taken at step 1
3088 ++ * 4. dm_sysfs_exit waits on the completion
3089 ++ * 5. The other process that took the reference in step 1 drops it,
3090 ++ * dm_kobject_release is called from this process
3091 ++ * 6. dm_kobject_release calls complete()
3092 ++ * 7. a reschedule happens before dm_kobject_release returns
3093 ++ * 8. dm_sysfs_exit continues, the dm device is unloaded, module reference
3094 ++ * count is decremented
3095 ++ * 9. The user unloads the dm module
3096 ++ * 10. The other process that was rescheduled in step 7 continues to run,
3097 ++ * it is now executing code in unloaded module, so it crashes
3098 ++ *
3099 ++ * Note that if the process that takes the foreign reference to dm kobject
3100 ++ * has a low priority and the system is sufficiently loaded with
3101 ++ * higher-priority processes that prevent the low-priority process from
3102 ++ * being scheduled long enough, this bug may really happen.
3103 ++ *
3104 ++ * In order to fix this module unload race, we place the release method
3105 ++ * into a helper code that is compiled directly into the kernel.
3106 ++ */
3107 ++
3108 ++void dm_kobject_release(struct kobject *kobj)
3109 ++{
3110 ++ complete(dm_get_completion_from_kobject(kobj));
3111 ++}
3112 ++
3113 ++EXPORT_SYMBOL(dm_kobject_release);
3114 +diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c
3115 +index 84d2b91..c62c5ab 100644
3116 +--- a/drivers/md/dm-sysfs.c
3117 ++++ b/drivers/md/dm-sysfs.c
3118 +@@ -86,6 +86,7 @@ static const struct sysfs_ops dm_sysfs_ops = {
3119 + static struct kobj_type dm_ktype = {
3120 + .sysfs_ops = &dm_sysfs_ops,
3121 + .default_attrs = dm_attrs,
3122 ++ .release = dm_kobject_release,
3123 + };
3124 +
3125 + /*
3126 +@@ -104,5 +105,7 @@ int dm_sysfs_init(struct mapped_device *md)
3127 + */
3128 + void dm_sysfs_exit(struct mapped_device *md)
3129 + {
3130 +- kobject_put(dm_kobject(md));
3131 ++ struct kobject *kobj = dm_kobject(md);
3132 ++ kobject_put(kobj);
3133 ++ wait_for_completion(dm_get_completion_from_kobject(kobj));
3134 + }
3135 +diff --git a/drivers/md/dm.c b/drivers/md/dm.c
3136 +index 8953630..7ead065 100644
3137 +--- a/drivers/md/dm.c
3138 ++++ b/drivers/md/dm.c
3139 +@@ -192,8 +192,8 @@ struct mapped_device {
3140 + /* forced geometry settings */
3141 + struct hd_geometry geometry;
3142 +
3143 +- /* sysfs handle */
3144 +- struct kobject kobj;
3145 ++ /* kobject and completion */
3146 ++ struct dm_kobject_holder kobj_holder;
3147 +
3148 + /* zero-length flush that will be cloned and submitted to targets */
3149 + struct bio flush_bio;
3150 +@@ -1891,6 +1891,7 @@ static struct mapped_device *alloc_dev(int minor)
3151 + init_waitqueue_head(&md->wait);
3152 + INIT_WORK(&md->work, dm_wq_work);
3153 + init_waitqueue_head(&md->eventq);
3154 ++ init_completion(&md->kobj_holder.completion);
3155 +
3156 + md->disk->major = _major;
3157 + md->disk->first_minor = minor;
3158 +@@ -2682,7 +2683,7 @@ struct gendisk *dm_disk(struct mapped_device *md)
3159 +
3160 + struct kobject *dm_kobject(struct mapped_device *md)
3161 + {
3162 +- return &md->kobj;
3163 ++ return &md->kobj_holder.kobj;
3164 + }
3165 +
3166 + /*
3167 +@@ -2693,9 +2694,7 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
3168 + {
3169 + struct mapped_device *md;
3170 +
3171 +- md = container_of(kobj, struct mapped_device, kobj);
3172 +- if (&md->kobj != kobj)
3173 +- return NULL;
3174 ++ md = container_of(kobj, struct mapped_device, kobj_holder.kobj);
3175 +
3176 + if (test_bit(DMF_FREEING, &md->flags) ||
3177 + dm_deleting_md(md))
3178 +diff --git a/drivers/md/dm.h b/drivers/md/dm.h
3179 +index b7dacd5..9db80c9 100644
3180 +--- a/drivers/md/dm.h
3181 ++++ b/drivers/md/dm.h
3182 +@@ -15,6 +15,8 @@
3183 + #include <linux/list.h>
3184 + #include <linux/blkdev.h>
3185 + #include <linux/hdreg.h>
3186 ++#include <linux/completion.h>
3187 ++#include <linux/kobject.h>
3188 +
3189 + /*
3190 + * Suspend feature flags
3191 +@@ -119,12 +121,27 @@ void dm_interface_exit(void);
3192 + /*
3193 + * sysfs interface
3194 + */
3195 ++struct dm_kobject_holder {
3196 ++ struct kobject kobj;
3197 ++ struct completion completion;
3198 ++};
3199 ++
3200 ++static inline struct completion *dm_get_completion_from_kobject(struct kobject *kobj)
3201 ++{
3202 ++ return &container_of(kobj, struct dm_kobject_holder, kobj)->completion;
3203 ++}
3204 ++
3205 + int dm_sysfs_init(struct mapped_device *md);
3206 + void dm_sysfs_exit(struct mapped_device *md);
3207 + struct kobject *dm_kobject(struct mapped_device *md);
3208 + struct mapped_device *dm_get_from_kobject(struct kobject *kobj);
3209 +
3210 + /*
3211 ++ * The kobject helper
3212 ++ */
3213 ++void dm_kobject_release(struct kobject *kobj);
3214 ++
3215 ++/*
3216 + * Targets for linear and striped mappings
3217 + */
3218 + int dm_linear_init(void);
3219 +diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c
3220 +index df2494c..8c5b824 100644
3221 +--- a/drivers/md/persistent-data/dm-space-map-common.c
3222 ++++ b/drivers/md/persistent-data/dm-space-map-common.c
3223 +@@ -244,6 +244,10 @@ int sm_ll_extend(struct ll_disk *ll, dm_block_t extra_blocks)
3224 + return -EINVAL;
3225 + }
3226 +
3227 ++ /*
3228 ++ * We need to set this before the dm_tm_new_block() call below.
3229 ++ */
3230 ++ ll->nr_blocks = nr_blocks;
3231 + for (i = old_blocks; i < blocks; i++) {
3232 + struct dm_block *b;
3233 + struct disk_index_entry idx;
3234 +@@ -251,6 +255,7 @@ int sm_ll_extend(struct ll_disk *ll, dm_block_t extra_blocks)
3235 + r = dm_tm_new_block(ll->tm, &dm_sm_bitmap_validator, &b);
3236 + if (r < 0)
3237 + return r;
3238 ++
3239 + idx.blocknr = cpu_to_le64(dm_block_location(b));
3240 +
3241 + r = dm_tm_unlock(ll->tm, b);
3242 +@@ -265,7 +270,6 @@ int sm_ll_extend(struct ll_disk *ll, dm_block_t extra_blocks)
3243 + return r;
3244 + }
3245 +
3246 +- ll->nr_blocks = nr_blocks;
3247 + return 0;
3248 + }
3249 +
3250 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
3251 +index fb67833..7c963c4 100644
3252 +--- a/drivers/md/raid5.c
3253 ++++ b/drivers/md/raid5.c
3254 +@@ -1693,6 +1693,7 @@ static void raid5_end_write_request(struct bio *bi, int error)
3255 + }
3256 +
3257 + if (!uptodate) {
3258 ++ set_bit(STRIPE_DEGRADED, &sh->state);
3259 + set_bit(WriteErrorSeen, &conf->disks[i].rdev->flags);
3260 + set_bit(R5_WriteError, &sh->dev[i].flags);
3261 + } else if (is_badblock(conf->disks[i].rdev, sh->sector, STRIPE_SECTORS,
3262 +@@ -4449,23 +4450,43 @@ raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks)
3263 + return sectors * (raid_disks - conf->max_degraded);
3264 + }
3265 +
3266 ++static void free_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu)
3267 ++{
3268 ++ safe_put_page(percpu->spare_page);
3269 ++ kfree(percpu->scribble);
3270 ++ percpu->spare_page = NULL;
3271 ++ percpu->scribble = NULL;
3272 ++}
3273 ++
3274 ++static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu)
3275 ++{
3276 ++ if (conf->level == 6 && !percpu->spare_page)
3277 ++ percpu->spare_page = alloc_page(GFP_KERNEL);
3278 ++ if (!percpu->scribble)
3279 ++ percpu->scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
3280 ++
3281 ++ if (!percpu->scribble || (conf->level == 6 && !percpu->spare_page)) {
3282 ++ free_scratch_buffer(conf, percpu);
3283 ++ return -ENOMEM;
3284 ++ }
3285 ++
3286 ++ return 0;
3287 ++}
3288 ++
3289 + static void raid5_free_percpu(struct r5conf *conf)
3290 + {
3291 +- struct raid5_percpu *percpu;
3292 + unsigned long cpu;
3293 +
3294 + if (!conf->percpu)
3295 + return;
3296 +
3297 +- get_online_cpus();
3298 +- for_each_possible_cpu(cpu) {
3299 +- percpu = per_cpu_ptr(conf->percpu, cpu);
3300 +- safe_put_page(percpu->spare_page);
3301 +- kfree(percpu->scribble);
3302 +- }
3303 + #ifdef CONFIG_HOTPLUG_CPU
3304 + unregister_cpu_notifier(&conf->cpu_notify);
3305 + #endif
3306 ++
3307 ++ get_online_cpus();
3308 ++ for_each_possible_cpu(cpu)
3309 ++ free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
3310 + put_online_cpus();
3311 +
3312 + free_percpu(conf->percpu);
3313 +@@ -4491,15 +4512,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
3314 + switch (action) {
3315 + case CPU_UP_PREPARE:
3316 + case CPU_UP_PREPARE_FROZEN:
3317 +- if (conf->level == 6 && !percpu->spare_page)
3318 +- percpu->spare_page = alloc_page(GFP_KERNEL);
3319 +- if (!percpu->scribble)
3320 +- percpu->scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
3321 +-
3322 +- if (!percpu->scribble ||
3323 +- (conf->level == 6 && !percpu->spare_page)) {
3324 +- safe_put_page(percpu->spare_page);
3325 +- kfree(percpu->scribble);
3326 ++ if (alloc_scratch_buffer(conf, percpu)) {
3327 + pr_err("%s: failed memory allocation for cpu%ld\n",
3328 + __func__, cpu);
3329 + return notifier_from_errno(-ENOMEM);
3330 +@@ -4507,10 +4520,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
3331 + break;
3332 + case CPU_DEAD:
3333 + case CPU_DEAD_FROZEN:
3334 +- safe_put_page(percpu->spare_page);
3335 +- kfree(percpu->scribble);
3336 +- percpu->spare_page = NULL;
3337 +- percpu->scribble = NULL;
3338 ++ free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
3339 + break;
3340 + default:
3341 + break;
3342 +@@ -4522,40 +4532,29 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
3343 + static int raid5_alloc_percpu(struct r5conf *conf)
3344 + {
3345 + unsigned long cpu;
3346 +- struct page *spare_page;
3347 +- struct raid5_percpu __percpu *allcpus;
3348 +- void *scribble;
3349 +- int err;
3350 ++ int err = 0;
3351 +
3352 +- allcpus = alloc_percpu(struct raid5_percpu);
3353 +- if (!allcpus)
3354 ++ conf->percpu = alloc_percpu(struct raid5_percpu);
3355 ++ if (!conf->percpu)
3356 + return -ENOMEM;
3357 +- conf->percpu = allcpus;
3358 ++
3359 ++#ifdef CONFIG_HOTPLUG_CPU
3360 ++ conf->cpu_notify.notifier_call = raid456_cpu_notify;
3361 ++ conf->cpu_notify.priority = 0;
3362 ++ err = register_cpu_notifier(&conf->cpu_notify);
3363 ++ if (err)
3364 ++ return err;
3365 ++#endif
3366 +
3367 + get_online_cpus();
3368 +- err = 0;
3369 + for_each_present_cpu(cpu) {
3370 +- if (conf->level == 6) {
3371 +- spare_page = alloc_page(GFP_KERNEL);
3372 +- if (!spare_page) {
3373 +- err = -ENOMEM;
3374 +- break;
3375 +- }
3376 +- per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page;
3377 +- }
3378 +- scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
3379 +- if (!scribble) {
3380 +- err = -ENOMEM;
3381 ++ err = alloc_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
3382 ++ if (err) {
3383 ++ pr_err("%s: failed memory allocation for cpu%ld\n",
3384 ++ __func__, cpu);
3385 + break;
3386 + }
3387 +- per_cpu_ptr(conf->percpu, cpu)->scribble = scribble;
3388 + }
3389 +-#ifdef CONFIG_HOTPLUG_CPU
3390 +- conf->cpu_notify.notifier_call = raid456_cpu_notify;
3391 +- conf->cpu_notify.priority = 0;
3392 +- if (err == 0)
3393 +- err = register_cpu_notifier(&conf->cpu_notify);
3394 +-#endif
3395 + put_online_cpus();
3396 +
3397 + return err;
3398 +diff --git a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.h b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.h
3399 +index ff33396..10b93c4 100644
3400 +--- a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.h
3401 ++++ b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.h
3402 +@@ -69,7 +69,7 @@ struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
3403 + #else
3404 + static inline
3405 + struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
3406 +- struct mxl111sf_state *mxl_state
3407 ++ struct mxl111sf_state *mxl_state,
3408 + struct mxl111sf_tuner_config *cfg)
3409 + {
3410 + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
3411 +diff --git a/drivers/media/dvb/frontends/dib8000.c b/drivers/media/dvb/frontends/dib8000.c
3412 +index fe284d5..a542db1 100644
3413 +--- a/drivers/media/dvb/frontends/dib8000.c
3414 ++++ b/drivers/media/dvb/frontends/dib8000.c
3415 +@@ -114,15 +114,10 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg)
3416 + return ret;
3417 + }
3418 +
3419 +-static u16 dib8000_read_word(struct dib8000_state *state, u16 reg)
3420 ++static u16 __dib8000_read_word(struct dib8000_state *state, u16 reg)
3421 + {
3422 + u16 ret;
3423 +
3424 +- if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
3425 +- dprintk("could not acquire lock");
3426 +- return 0;
3427 +- }
3428 +-
3429 + state->i2c_write_buffer[0] = reg >> 8;
3430 + state->i2c_write_buffer[1] = reg & 0xff;
3431 +
3432 +@@ -140,6 +135,21 @@ static u16 dib8000_read_word(struct dib8000_state *state, u16 reg)
3433 + dprintk("i2c read error on %d", reg);
3434 +
3435 + ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1];
3436 ++
3437 ++ return ret;
3438 ++}
3439 ++
3440 ++static u16 dib8000_read_word(struct dib8000_state *state, u16 reg)
3441 ++{
3442 ++ u16 ret;
3443 ++
3444 ++ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
3445 ++ dprintk("could not acquire lock");
3446 ++ return 0;
3447 ++ }
3448 ++
3449 ++ ret = __dib8000_read_word(state, reg);
3450 ++
3451 + mutex_unlock(&state->i2c_buffer_lock);
3452 +
3453 + return ret;
3454 +@@ -149,8 +159,15 @@ static u32 dib8000_read32(struct dib8000_state *state, u16 reg)
3455 + {
3456 + u16 rw[2];
3457 +
3458 +- rw[0] = dib8000_read_word(state, reg + 0);
3459 +- rw[1] = dib8000_read_word(state, reg + 1);
3460 ++ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
3461 ++ dprintk("could not acquire lock");
3462 ++ return 0;
3463 ++ }
3464 ++
3465 ++ rw[0] = __dib8000_read_word(state, reg + 0);
3466 ++ rw[1] = __dib8000_read_word(state, reg + 1);
3467 ++
3468 ++ mutex_unlock(&state->i2c_buffer_lock);
3469 +
3470 + return ((rw[0] << 16) | (rw[1]));
3471 + }
3472 +diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
3473 +index 10460fd..dbcdfbf 100644
3474 +--- a/drivers/media/video/saa7134/saa7134-alsa.c
3475 ++++ b/drivers/media/video/saa7134/saa7134-alsa.c
3476 +@@ -172,7 +172,9 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
3477 + dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->dmasound.read_count,
3478 + dev->dmasound.bufsize, dev->dmasound.blocks);
3479 + spin_unlock(&dev->slock);
3480 ++ snd_pcm_stream_lock(dev->dmasound.substream);
3481 + snd_pcm_stop(dev->dmasound.substream,SNDRV_PCM_STATE_XRUN);
3482 ++ snd_pcm_stream_unlock(dev->dmasound.substream);
3483 + return;
3484 + }
3485 +
3486 +diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
3487 +index 83790f2..fd61f63 100644
3488 +--- a/drivers/mmc/host/atmel-mci.c
3489 ++++ b/drivers/mmc/host/atmel-mci.c
3490 +@@ -1014,11 +1014,22 @@ static void atmci_start_request(struct atmel_mci *host,
3491 + iflags |= ATMCI_CMDRDY;
3492 + cmd = mrq->cmd;
3493 + cmdflags = atmci_prepare_command(slot->mmc, cmd);
3494 +- atmci_send_command(host, cmd, cmdflags);
3495 ++
3496 ++ /*
3497 ++ * DMA transfer should be started before sending the command to avoid
3498 ++ * unexpected errors especially for read operations in SDIO mode.
3499 ++ * Unfortunately, in PDC mode, command has to be sent before starting
3500 ++ * the transfer.
3501 ++ */
3502 ++ if (host->submit_data != &atmci_submit_data_dma)
3503 ++ atmci_send_command(host, cmd, cmdflags);
3504 +
3505 + if (data)
3506 + host->submit_data(host, data);
3507 +
3508 ++ if (host->submit_data == &atmci_submit_data_dma)
3509 ++ atmci_send_command(host, cmd, cmdflags);
3510 ++
3511 + if (mrq->stop) {
3512 + host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
3513 + host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;
3514 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
3515 +index aaeaff2..9f68b82 100644
3516 +--- a/drivers/mmc/host/sdhci.c
3517 ++++ b/drivers/mmc/host/sdhci.c
3518 +@@ -1670,12 +1670,12 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
3519 + int tuning_loop_counter = MAX_TUNING_LOOP;
3520 + unsigned long timeout;
3521 + int err = 0;
3522 ++ unsigned long flags;
3523 +
3524 + host = mmc_priv(mmc);
3525 +
3526 + sdhci_runtime_pm_get(host);
3527 +- disable_irq(host->irq);
3528 +- spin_lock(&host->lock);
3529 ++ spin_lock_irqsave(&host->lock, flags);
3530 +
3531 + ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
3532 +
3533 +@@ -1689,8 +1689,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
3534 + (host->flags & SDHCI_SDR50_NEEDS_TUNING)))
3535 + ctrl |= SDHCI_CTRL_EXEC_TUNING;
3536 + else {
3537 +- spin_unlock(&host->lock);
3538 +- enable_irq(host->irq);
3539 ++ spin_unlock_irqrestore(&host->lock, flags);
3540 + sdhci_runtime_pm_put(host);
3541 + return 0;
3542 + }
3543 +@@ -1752,15 +1751,12 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
3544 + host->cmd = NULL;
3545 + host->mrq = NULL;
3546 +
3547 +- spin_unlock(&host->lock);
3548 +- enable_irq(host->irq);
3549 +-
3550 ++ spin_unlock_irqrestore(&host->lock, flags);
3551 + /* Wait for Buffer Read Ready interrupt */
3552 + wait_event_interruptible_timeout(host->buf_ready_int,
3553 + (host->tuning_done == 1),
3554 + msecs_to_jiffies(50));
3555 +- disable_irq(host->irq);
3556 +- spin_lock(&host->lock);
3557 ++ spin_lock_irqsave(&host->lock, flags);
3558 +
3559 + if (!host->tuning_done) {
3560 + pr_info(DRIVER_NAME ": Timeout waiting for "
3561 +@@ -1833,8 +1829,7 @@ out:
3562 + err = 0;
3563 +
3564 + sdhci_clear_set_irqs(host, SDHCI_INT_DATA_AVAIL, ier);
3565 +- spin_unlock(&host->lock);
3566 +- enable_irq(host->irq);
3567 ++ spin_unlock_irqrestore(&host->lock, flags);
3568 + sdhci_runtime_pm_put(host);
3569 +
3570 + return err;
3571 +diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
3572 +index 74a43b8..baf8356 100644
3573 +--- a/drivers/mtd/nand/mxc_nand.c
3574 ++++ b/drivers/mtd/nand/mxc_nand.c
3575 +@@ -596,7 +596,6 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
3576 + ecc_stat >>= 4;
3577 + } while (--no_subpages);
3578 +
3579 +- mtd->ecc_stats.corrected += ret;
3580 + pr_debug("%d Symbol Correctable RS-ECC Error\n", ret);
3581 +
3582 + return ret;
3583 +diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
3584 +index 0ae0d7c..aaa7999 100644
3585 +--- a/drivers/net/bonding/bond_3ad.c
3586 ++++ b/drivers/net/bonding/bond_3ad.c
3587 +@@ -1854,8 +1854,6 @@ void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout)
3588 + BOND_AD_INFO(bond).agg_select_timer = timeout;
3589 + }
3590 +
3591 +-static u16 aggregator_identifier;
3592 +-
3593 + /**
3594 + * bond_3ad_initialize - initialize a bond's 802.3ad parameters and structures
3595 + * @bond: bonding struct to work on
3596 +@@ -1869,7 +1867,7 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
3597 + if (MAC_ADDRESS_COMPARE(&(BOND_AD_INFO(bond).system.sys_mac_addr),
3598 + bond->dev->dev_addr)) {
3599 +
3600 +- aggregator_identifier = 0;
3601 ++ BOND_AD_INFO(bond).aggregator_identifier = 0;
3602 +
3603 + BOND_AD_INFO(bond).system.sys_priority = 0xFFFF;
3604 + BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
3605 +@@ -1941,7 +1939,7 @@ int bond_3ad_bind_slave(struct slave *slave)
3606 + ad_initialize_agg(aggregator);
3607 +
3608 + aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr);
3609 +- aggregator->aggregator_identifier = (++aggregator_identifier);
3610 ++ aggregator->aggregator_identifier = ++BOND_AD_INFO(bond).aggregator_identifier;
3611 + aggregator->slave = slave;
3612 + aggregator->is_active = 0;
3613 + aggregator->num_of_ports = 0;
3614 +diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
3615 +index 235b2cc..20d9c78 100644
3616 +--- a/drivers/net/bonding/bond_3ad.h
3617 ++++ b/drivers/net/bonding/bond_3ad.h
3618 +@@ -253,6 +253,7 @@ struct ad_system {
3619 + struct ad_bond_info {
3620 + struct ad_system system; /* 802.3ad system structure */
3621 + u32 agg_select_timer; // Timer to select aggregator after all adapter's hand shakes
3622 ++ u16 aggregator_identifier;
3623 + };
3624 +
3625 + struct ad_slave_info {
3626 +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
3627 +index bb828c2..7c6bb5a 100644
3628 +--- a/drivers/net/can/flexcan.c
3629 ++++ b/drivers/net/can/flexcan.c
3630 +@@ -777,14 +777,16 @@ static void flexcan_chip_stop(struct net_device *dev)
3631 + struct flexcan_regs __iomem *regs = priv->base;
3632 + u32 reg;
3633 +
3634 +- /* Disable all interrupts */
3635 +- flexcan_write(0, &regs->imask1);
3636 +-
3637 + /* Disable + halt module */
3638 + reg = flexcan_read(&regs->mcr);
3639 + reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
3640 + flexcan_write(reg, &regs->mcr);
3641 +
3642 ++ /* Disable all interrupts */
3643 ++ flexcan_write(0, &regs->imask1);
3644 ++ flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
3645 ++ &regs->ctrl);
3646 ++
3647 + flexcan_transceiver_switch(priv, 0);
3648 + priv->can.state = CAN_STATE_STOPPED;
3649 +
3650 +@@ -809,12 +811,14 @@ static int flexcan_open(struct net_device *dev)
3651 + /* start chip and queuing */
3652 + err = flexcan_chip_start(dev);
3653 + if (err)
3654 +- goto out_close;
3655 ++ goto out_free_irq;
3656 + napi_enable(&priv->napi);
3657 + netif_start_queue(dev);
3658 +
3659 + return 0;
3660 +
3661 ++ out_free_irq:
3662 ++ free_irq(dev->irq, dev);
3663 + out_close:
3664 + close_candev(dev);
3665 + out:
3666 +@@ -1023,6 +1027,7 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
3667 + struct resource *mem;
3668 +
3669 + unregister_flexcandev(dev);
3670 ++ netif_napi_del(&priv->napi);
3671 + platform_set_drvdata(pdev, NULL);
3672 + iounmap(priv->base);
3673 +
3674 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
3675 +index d5793d3..c77c462 100644
3676 +--- a/drivers/net/ethernet/broadcom/tg3.c
3677 ++++ b/drivers/net/ethernet/broadcom/tg3.c
3678 +@@ -5637,8 +5637,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
3679 +
3680 + work_mask |= opaque_key;
3681 +
3682 +- if ((desc->err_vlan & RXD_ERR_MASK) != 0 &&
3683 +- (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) {
3684 ++ if (desc->err_vlan & RXD_ERR_MASK) {
3685 + drop_it:
3686 + tg3_recycle_rx(tnapi, tpr, opaque_key,
3687 + desc_idx, *post_ptr);
3688 +@@ -7103,12 +7102,12 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
3689 +
3690 + tg3_netif_stop(tp);
3691 +
3692 ++ tg3_set_mtu(dev, tp, new_mtu);
3693 ++
3694 + tg3_full_lock(tp, 1);
3695 +
3696 + tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
3697 +
3698 +- tg3_set_mtu(dev, tp, new_mtu);
3699 +-
3700 + err = tg3_restart_hw(tp, 0);
3701 +
3702 + if (!err)
3703 +diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
3704 +index da90ba5..a398a6f 100644
3705 +--- a/drivers/net/ethernet/broadcom/tg3.h
3706 ++++ b/drivers/net/ethernet/broadcom/tg3.h
3707 +@@ -2477,7 +2477,11 @@ struct tg3_rx_buffer_desc {
3708 + #define RXD_ERR_TOO_SMALL 0x00400000
3709 + #define RXD_ERR_NO_RESOURCES 0x00800000
3710 + #define RXD_ERR_HUGE_FRAME 0x01000000
3711 +-#define RXD_ERR_MASK 0xffff0000
3712 ++
3713 ++#define RXD_ERR_MASK (RXD_ERR_BAD_CRC | RXD_ERR_COLLISION | \
3714 ++ RXD_ERR_LINK_LOST | RXD_ERR_PHY_DECODE | \
3715 ++ RXD_ERR_MAC_ABRT | RXD_ERR_TOO_SMALL | \
3716 ++ RXD_ERR_NO_RESOURCES | RXD_ERR_HUGE_FRAME)
3717 +
3718 + u32 reserved;
3719 + u32 opaque;
3720 +diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
3721 +index c4cfd1d..75d9040 100644
3722 +--- a/drivers/net/usb/gl620a.c
3723 ++++ b/drivers/net/usb/gl620a.c
3724 +@@ -86,6 +86,10 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3725 + u32 size;
3726 + u32 count;
3727 +
3728 ++ /* This check is no longer done by usbnet */
3729 ++ if (skb->len < dev->net->hard_header_len)
3730 ++ return 0;
3731 ++
3732 + header = (struct gl_header *) skb->data;
3733 +
3734 + // get the packet count of the received skb
3735 +diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
3736 +index db2cb74..a2f7579 100644
3737 +--- a/drivers/net/usb/mcs7830.c
3738 ++++ b/drivers/net/usb/mcs7830.c
3739 +@@ -601,8 +601,9 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3740 + {
3741 + u8 status;
3742 +
3743 +- if (skb->len == 0) {
3744 +- dev_err(&dev->udev->dev, "unexpected empty rx frame\n");
3745 ++ /* This check is no longer done by usbnet */
3746 ++ if (skb->len < dev->net->hard_header_len) {
3747 ++ dev_err(&dev->udev->dev, "unexpected tiny rx frame\n");
3748 + return 0;
3749 + }
3750 +
3751 +diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
3752 +index 01db460..c9e3278 100644
3753 +--- a/drivers/net/usb/net1080.c
3754 ++++ b/drivers/net/usb/net1080.c
3755 +@@ -419,6 +419,10 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3756 + struct nc_trailer *trailer;
3757 + u16 hdr_len, packet_len;
3758 +
3759 ++ /* This check is no longer done by usbnet */
3760 ++ if (skb->len < dev->net->hard_header_len)
3761 ++ return 0;
3762 ++
3763 + if (!(skb->len & 0x01)) {
3764 + #ifdef DEBUG
3765 + struct net_device *net = dev->net;
3766 +diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
3767 +index 255d6a4..13b40e3 100644
3768 +--- a/drivers/net/usb/rndis_host.c
3769 ++++ b/drivers/net/usb/rndis_host.c
3770 +@@ -490,6 +490,10 @@ EXPORT_SYMBOL_GPL(rndis_unbind);
3771 + */
3772 + int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3773 + {
3774 ++ /* This check is no longer done by usbnet */
3775 ++ if (skb->len < dev->net->hard_header_len)
3776 ++ return 0;
3777 ++
3778 + /* peripheral may have batched packets to us... */
3779 + while (likely(skb->len)) {
3780 + struct rndis_data_hdr *hdr = (void *)skb->data;
3781 +diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
3782 +index a8e4640..c41b42b 100644
3783 +--- a/drivers/net/usb/smsc75xx.c
3784 ++++ b/drivers/net/usb/smsc75xx.c
3785 +@@ -1079,6 +1079,10 @@ static void smsc75xx_rx_csum_offload(struct usbnet *dev, struct sk_buff *skb,
3786 +
3787 + static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3788 + {
3789 ++ /* This check is no longer done by usbnet */
3790 ++ if (skb->len < dev->net->hard_header_len)
3791 ++ return 0;
3792 ++
3793 + while (skb->len > 0) {
3794 + u32 rx_cmd_a, rx_cmd_b, align_count, size;
3795 + struct sk_buff *ax_skb;
3796 +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
3797 +index 55b3218..6617325 100644
3798 +--- a/drivers/net/usb/smsc95xx.c
3799 ++++ b/drivers/net/usb/smsc95xx.c
3800 +@@ -1039,6 +1039,10 @@ static void smsc95xx_rx_csum_offload(struct sk_buff *skb)
3801 +
3802 + static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
3803 + {
3804 ++ /* This check is no longer done by usbnet */
3805 ++ if (skb->len < dev->net->hard_header_len)
3806 ++ return 0;
3807 ++
3808 + while (skb->len > 0) {
3809 + u32 header, align_count;
3810 + struct sk_buff *ax_skb;
3811 +diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
3812 +index dc53a8f..3d21742 100644
3813 +--- a/drivers/net/usb/usbnet.c
3814 ++++ b/drivers/net/usb/usbnet.c
3815 +@@ -414,17 +414,19 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
3816 + }
3817 + // else network stack removes extra byte if we forced a short packet
3818 +
3819 +- if (skb->len) {
3820 +- /* all data was already cloned from skb inside the driver */
3821 +- if (dev->driver_info->flags & FLAG_MULTI_PACKET)
3822 +- dev_kfree_skb_any(skb);
3823 +- else
3824 +- usbnet_skb_return(dev, skb);
3825 ++ /* all data was already cloned from skb inside the driver */
3826 ++ if (dev->driver_info->flags & FLAG_MULTI_PACKET)
3827 ++ goto done;
3828 ++
3829 ++ if (skb->len < ETH_HLEN) {
3830 ++ dev->net->stats.rx_errors++;
3831 ++ dev->net->stats.rx_length_errors++;
3832 ++ netif_dbg(dev, rx_err, dev->net, "rx length %d\n", skb->len);
3833 ++ } else {
3834 ++ usbnet_skb_return(dev, skb);
3835 + return;
3836 + }
3837 +
3838 +- netif_dbg(dev, rx_err, dev->net, "drop\n");
3839 +- dev->net->stats.rx_errors++;
3840 + done:
3841 + skb_queue_tail(&dev->done, skb);
3842 + }
3843 +@@ -446,13 +448,6 @@ static void rx_complete (struct urb *urb)
3844 + switch (urb_status) {
3845 + /* success */
3846 + case 0:
3847 +- if (skb->len < dev->net->hard_header_len) {
3848 +- state = rx_cleanup;
3849 +- dev->net->stats.rx_errors++;
3850 +- dev->net->stats.rx_length_errors++;
3851 +- netif_dbg(dev, rx_err, dev->net,
3852 +- "rx length %d\n", skb->len);
3853 +- }
3854 + break;
3855 +
3856 + /* stalls need manual reset. this is rare ... except that
3857 +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
3858 +index 43a6a11..f13a673 100644
3859 +--- a/drivers/net/virtio_net.c
3860 ++++ b/drivers/net/virtio_net.c
3861 +@@ -1029,7 +1029,8 @@ static int virtnet_probe(struct virtio_device *vdev)
3862 + /* If we can receive ANY GSO packets, we must allocate large ones. */
3863 + if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
3864 + virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
3865 +- virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))
3866 ++ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||
3867 ++ virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))
3868 + vi->big_packets = true;
3869 +
3870 + if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
3871 +diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
3872 +index d426261..28ceef2 100644
3873 +--- a/drivers/net/vmxnet3/vmxnet3_drv.c
3874 ++++ b/drivers/net/vmxnet3/vmxnet3_drv.c
3875 +@@ -1734,11 +1734,20 @@ vmxnet3_netpoll(struct net_device *netdev)
3876 + {
3877 + struct vmxnet3_adapter *adapter = netdev_priv(netdev);
3878 +
3879 +- if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
3880 +- vmxnet3_disable_all_intrs(adapter);
3881 +-
3882 +- vmxnet3_do_poll(adapter, adapter->rx_queue[0].rx_ring[0].size);
3883 +- vmxnet3_enable_all_intrs(adapter);
3884 ++ switch (adapter->intr.type) {
3885 ++#ifdef CONFIG_PCI_MSI
3886 ++ case VMXNET3_IT_MSIX: {
3887 ++ int i;
3888 ++ for (i = 0; i < adapter->num_rx_queues; i++)
3889 ++ vmxnet3_msix_rx(0, &adapter->rx_queue[i]);
3890 ++ break;
3891 ++ }
3892 ++#endif
3893 ++ case VMXNET3_IT_MSI:
3894 ++ default:
3895 ++ vmxnet3_intr(0, adapter->netdev);
3896 ++ break;
3897 ++ }
3898 +
3899 + }
3900 + #endif /* CONFIG_NET_POLL_CONTROLLER */
3901 +diff --git a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h
3902 +index 9c51b39..eabf374 100644
3903 +--- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h
3904 ++++ b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h
3905 +@@ -55,7 +55,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = {
3906 + {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3039605e, 0x33795d5e},
3907 + {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
3908 + {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
3909 +- {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
3910 ++ {0x00009e20, 0x000003a5, 0x000003a5, 0x000003a5, 0x000003a5},
3911 + {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
3912 + {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c782},
3913 + {0x00009e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27},
3914 +@@ -85,7 +85,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = {
3915 + {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000},
3916 + {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
3917 + {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
3918 +- {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
3919 ++ {0x0000ae20, 0x000001a6, 0x000001a6, 0x000001aa, 0x000001aa},
3920 + {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550},
3921 + };
3922 +
3923 +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3924 +index ef921e1..c6c3e1c 100644
3925 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3926 ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3927 +@@ -28,6 +28,10 @@ int htc_modparam_nohwcrypt;
3928 + module_param_named(nohwcrypt, htc_modparam_nohwcrypt, int, 0444);
3929 + MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
3930 +
3931 ++static int ath9k_ps_enable;
3932 ++module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
3933 ++MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
3934 ++
3935 + #define CHAN2G(_freq, _idx) { \
3936 + .center_freq = (_freq), \
3937 + .hw_value = (_idx), \
3938 +@@ -729,11 +733,13 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
3939 + IEEE80211_HW_SPECTRUM_MGMT |
3940 + IEEE80211_HW_HAS_RATE_CONTROL |
3941 + IEEE80211_HW_RX_INCLUDES_FCS |
3942 +- IEEE80211_HW_SUPPORTS_PS |
3943 + IEEE80211_HW_PS_NULLFUNC_STACK |
3944 + IEEE80211_HW_REPORTS_TX_ACK_STATUS |
3945 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
3946 +
3947 ++ if (ath9k_ps_enable)
3948 ++ hw->flags |= IEEE80211_HW_SUPPORTS_PS;
3949 ++
3950 + hw->wiphy->interface_modes =
3951 + BIT(NL80211_IFTYPE_STATION) |
3952 + BIT(NL80211_IFTYPE_ADHOC) |
3953 +diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
3954 +index ba6a49c..1355d71 100644
3955 +--- a/drivers/net/wireless/ath/ath9k/init.c
3956 ++++ b/drivers/net/wireless/ath/ath9k/init.c
3957 +@@ -44,6 +44,10 @@ static int ath9k_btcoex_enable;
3958 + module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444);
3959 + MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
3960 +
3961 ++static int ath9k_ps_enable;
3962 ++module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
3963 ++MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
3964 ++
3965 + bool is_ath9k_unloaded;
3966 + /* We use the hw_value as an index into our private channel structure */
3967 +
3968 +@@ -671,11 +675,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
3969 + hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
3970 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
3971 + IEEE80211_HW_SIGNAL_DBM |
3972 +- IEEE80211_HW_SUPPORTS_PS |
3973 + IEEE80211_HW_PS_NULLFUNC_STACK |
3974 + IEEE80211_HW_SPECTRUM_MGMT |
3975 + IEEE80211_HW_REPORTS_TX_ACK_STATUS;
3976 +
3977 ++ if (ath9k_ps_enable)
3978 ++ hw->flags |= IEEE80211_HW_SUPPORTS_PS;
3979 ++
3980 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
3981 + hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
3982 +
3983 +diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
3984 +index 126ed31..2e88af1 100644
3985 +--- a/drivers/net/wireless/ath/ath9k/xmit.c
3986 ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
3987 +@@ -1176,14 +1176,16 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
3988 + for (tidno = 0, tid = &an->tid[tidno];
3989 + tidno < WME_NUM_TID; tidno++, tid++) {
3990 +
3991 +- if (!tid->sched)
3992 +- continue;
3993 +-
3994 + ac = tid->ac;
3995 + txq = ac->txq;
3996 +
3997 + spin_lock_bh(&txq->axq_lock);
3998 +
3999 ++ if (!tid->sched) {
4000 ++ spin_unlock_bh(&txq->axq_lock);
4001 ++ continue;
4002 ++ }
4003 ++
4004 + buffered = !skb_queue_empty(&tid->buf_q);
4005 +
4006 + tid->sched = false;
4007 +diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
4008 +index 5f77cbe..c6c34bf 100644
4009 +--- a/drivers/net/wireless/b43/xmit.c
4010 ++++ b/drivers/net/wireless/b43/xmit.c
4011 +@@ -819,10 +819,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
4012 + * channel number in b43. */
4013 + if (chanstat & B43_RX_CHAN_5GHZ) {
4014 + status.band = IEEE80211_BAND_5GHZ;
4015 +- status.freq = b43_freq_to_channel_5ghz(chanid);
4016 ++ status.freq = b43_channel_to_freq_5ghz(chanid);
4017 + } else {
4018 + status.band = IEEE80211_BAND_2GHZ;
4019 +- status.freq = b43_freq_to_channel_2ghz(chanid);
4020 ++ status.freq = b43_channel_to_freq_2ghz(chanid);
4021 + }
4022 + break;
4023 + default:
4024 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
4025 +index df1540c..5fe4602 100644
4026 +--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
4027 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
4028 +@@ -854,8 +854,6 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
4029 + struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
4030 + struct iwl_ht_agg *agg;
4031 + struct sk_buff_head reclaimed_skbs;
4032 +- struct ieee80211_tx_info *info;
4033 +- struct ieee80211_hdr *hdr;
4034 + struct sk_buff *skb;
4035 + unsigned long flags;
4036 + int sta_id;
4037 +@@ -941,24 +939,32 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
4038 + 0, &reclaimed_skbs);
4039 + freed = 0;
4040 + while (!skb_queue_empty(&reclaimed_skbs)) {
4041 ++ struct ieee80211_hdr *hdr;
4042 ++ struct ieee80211_tx_info *info;
4043 +
4044 + skb = __skb_dequeue(&reclaimed_skbs);
4045 +- hdr = (struct ieee80211_hdr *)skb->data;
4046 ++ hdr = (void *)skb->data;
4047 ++ info = IEEE80211_SKB_CB(skb);
4048 +
4049 + if (ieee80211_is_data_qos(hdr->frame_control))
4050 + freed++;
4051 + else
4052 + WARN_ON_ONCE(1);
4053 +
4054 +- info = IEEE80211_SKB_CB(skb);
4055 + kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
4056 +
4057 ++ memset(&info->status, 0, sizeof(info->status));
4058 ++ /* Packet was transmitted successfully, failures come as single
4059 ++ * frames because before failing a frame the firmware transmits
4060 ++ * it without aggregation at least once.
4061 ++ */
4062 ++ info->flags |= IEEE80211_TX_STAT_ACK;
4063 ++
4064 + if (freed == 1) {
4065 + /* this is the first skb we deliver in this batch */
4066 + /* put the rate scaling data there */
4067 + info = IEEE80211_SKB_CB(skb);
4068 + memset(&info->status, 0, sizeof(info->status));
4069 +- info->flags |= IEEE80211_TX_STAT_ACK;
4070 + info->flags |= IEEE80211_TX_STAT_AMPDU;
4071 + info->status.ampdu_ack_len = ba_resp->txed_2_done;
4072 + info->status.ampdu_len = ba_resp->txed;
4073 +diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
4074 +index 34bba52..6543f4f 100644
4075 +--- a/drivers/net/wireless/mwifiex/11n.c
4076 ++++ b/drivers/net/wireless/mwifiex/11n.c
4077 +@@ -343,8 +343,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
4078 + ht_cap->header.len =
4079 + cpu_to_le16(sizeof(struct ieee80211_ht_cap));
4080 + memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header),
4081 +- (u8 *) bss_desc->bcn_ht_cap +
4082 +- sizeof(struct ieee_types_header),
4083 ++ (u8 *)bss_desc->bcn_ht_cap,
4084 + le16_to_cpu(ht_cap->header.len));
4085 +
4086 + mwifiex_fill_cap_info(priv, radio_type, ht_cap);
4087 +diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
4088 +index f1cc907..6d3d653 100644
4089 +--- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
4090 ++++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
4091 +@@ -15,6 +15,8 @@
4092 + #ifndef RTL8187_H
4093 + #define RTL8187_H
4094 +
4095 ++#include <linux/cache.h>
4096 ++
4097 + #include "rtl818x.h"
4098 + #include "leds.h"
4099 +
4100 +@@ -131,7 +133,10 @@ struct rtl8187_priv {
4101 + u8 aifsn[4];
4102 + u8 rfkill_mask;
4103 + struct {
4104 +- __le64 buf;
4105 ++ union {
4106 ++ __le64 buf;
4107 ++ u8 dummy1[L1_CACHE_BYTES];
4108 ++ } ____cacheline_aligned;
4109 + struct sk_buff_head queue;
4110 + } b_tx_status; /* This queue is used by both -b and non-b devices */
4111 + struct mutex io_mutex;
4112 +@@ -139,7 +144,8 @@ struct rtl8187_priv {
4113 + u8 bits8;
4114 + __le16 bits16;
4115 + __le32 bits32;
4116 +- } *io_dmabuf;
4117 ++ u8 dummy2[L1_CACHE_BYTES];
4118 ++ } *io_dmabuf ____cacheline_aligned;
4119 + bool rfkill_off;
4120 + };
4121 +
4122 +diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
4123 +index 3f0f056..4fa987b 100644
4124 +--- a/drivers/net/wireless/rtlwifi/core.c
4125 ++++ b/drivers/net/wireless/rtlwifi/core.c
4126 +@@ -131,6 +131,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
4127 + rtlpriv->cfg->maps
4128 + [RTL_IBSS_INT_MASKS]);
4129 + }
4130 ++ mac->link_state = MAC80211_LINKED;
4131 + break;
4132 + case NL80211_IFTYPE_ADHOC:
4133 + RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
4134 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4135 +index cb480d8..ce1fdbe 100644
4136 +--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4137 ++++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4138 +@@ -905,14 +905,26 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
4139 + bool is92c;
4140 + int err;
4141 + u8 tmp_u1b;
4142 ++ unsigned long flags;
4143 +
4144 + rtlpci->being_init_adapter = true;
4145 ++
4146 ++ /* Since this function can take a very long time (up to 350 ms)
4147 ++ * and can be called with irqs disabled, reenable the irqs
4148 ++ * to let the other devices continue being serviced.
4149 ++ *
4150 ++ * It is safe doing so since our own interrupts will only be enabled
4151 ++ * in a subsequent step.
4152 ++ */
4153 ++ local_save_flags(flags);
4154 ++ local_irq_enable();
4155 ++
4156 + rtlpriv->intf_ops->disable_aspm(hw);
4157 + rtstatus = _rtl92ce_init_mac(hw);
4158 + if (rtstatus != true) {
4159 + RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Init MAC failed\n"));
4160 + err = 1;
4161 +- return err;
4162 ++ goto exit;
4163 + }
4164 +
4165 + err = rtl92c_download_fw(hw);
4166 +@@ -922,7 +934,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
4167 + "without FW now..\n"));
4168 + err = 1;
4169 + rtlhal->fw_ready = false;
4170 +- return err;
4171 ++ goto exit;
4172 + } else {
4173 + rtlhal->fw_ready = true;
4174 + }
4175 +@@ -985,6 +997,8 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
4176 + RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("under 1.5V\n"));
4177 + }
4178 + rtl92c_dm_init(hw);
4179 ++exit:
4180 ++ local_irq_restore(flags);
4181 + rtlpci->being_init_adapter = false;
4182 + return err;
4183 + }
4184 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
4185 +index 17a8e96..d984867 100644
4186 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
4187 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
4188 +@@ -85,17 +85,15 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
4189 + if (mac->act_scanning) {
4190 + tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
4191 + tx_agc[RF90_PATH_B] = 0x3f3f3f3f;
4192 +- if (turbo_scanoff) {
4193 +- for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
4194 +- tx_agc[idx1] = ppowerlevel[idx1] |
4195 +- (ppowerlevel[idx1] << 8) |
4196 +- (ppowerlevel[idx1] << 16) |
4197 +- (ppowerlevel[idx1] << 24);
4198 +- if (rtlhal->interface == INTF_USB) {
4199 +- if (tx_agc[idx1] > 0x20 &&
4200 +- rtlefuse->external_pa)
4201 +- tx_agc[idx1] = 0x20;
4202 +- }
4203 ++ for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
4204 ++ tx_agc[idx1] = ppowerlevel[idx1] |
4205 ++ (ppowerlevel[idx1] << 8) |
4206 ++ (ppowerlevel[idx1] << 16) |
4207 ++ (ppowerlevel[idx1] << 24);
4208 ++ if (rtlhal->interface == INTF_USB) {
4209 ++ if (tx_agc[idx1] > 0x20 &&
4210 ++ rtlefuse->external_pa)
4211 ++ tx_agc[idx1] = 0x20;
4212 + }
4213 + }
4214 + } else {
4215 +@@ -107,7 +105,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
4216 + TXHIGHPWRLEVEL_LEVEL2) {
4217 + tx_agc[RF90_PATH_A] = 0x00000000;
4218 + tx_agc[RF90_PATH_B] = 0x00000000;
4219 +- } else{
4220 ++ } else {
4221 + for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
4222 + tx_agc[idx1] = ppowerlevel[idx1] |
4223 + (ppowerlevel[idx1] << 8) |
4224 +@@ -380,7 +378,12 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
4225 + regoffset == RTXAGC_B_MCS07_MCS04)
4226 + regoffset = 0xc98;
4227 + for (i = 0; i < 3; i++) {
4228 +- writeVal = (writeVal > 6) ? (writeVal - 6) : 0;
4229 ++ if (i != 2)
4230 ++ writeVal = (writeVal > 8) ?
4231 ++ (writeVal - 8) : 0;
4232 ++ else
4233 ++ writeVal = (writeVal > 6) ?
4234 ++ (writeVal - 6) : 0;
4235 + rtl_write_byte(rtlpriv, (u32)(regoffset + i),
4236 + (u8)writeVal);
4237 + }
4238 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
4239 +index 016ef86..c184253 100644
4240 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
4241 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
4242 +@@ -316,6 +316,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
4243 + {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
4244 + {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
4245 + {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
4246 ++ {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/
4247 + {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
4248 + {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
4249 + /* HP - Lite-On ,8188CUS Slim Combo */
4250 +diff --git a/drivers/of/address.c b/drivers/of/address.c
4251 +index 72c33fb..45c1727 100644
4252 +--- a/drivers/of/address.c
4253 ++++ b/drivers/of/address.c
4254 +@@ -97,8 +97,13 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
4255 +
4256 + static int of_bus_pci_match(struct device_node *np)
4257 + {
4258 +- /* "vci" is for the /chaos bridge on 1st-gen PCI powermacs */
4259 +- return !strcmp(np->type, "pci") || !strcmp(np->type, "vci");
4260 ++ /*
4261 ++ * "pciex" is PCI Express
4262 ++ * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
4263 ++ * "ht" is hypertransport
4264 ++ */
4265 ++ return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
4266 ++ !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
4267 + }
4268 +
4269 + static void of_bus_pci_count_cells(struct device_node *np,
4270 +diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
4271 +index d0b597b..5a4432d 100644
4272 +--- a/drivers/parport/parport_pc.c
4273 ++++ b/drivers/parport/parport_pc.c
4274 +@@ -2875,8 +2875,6 @@ enum parport_pc_pci_cards {
4275 + syba_2p_epp,
4276 + syba_1p_ecp,
4277 + titan_010l,
4278 +- titan_1284p1,
4279 +- titan_1284p2,
4280 + avlab_1p,
4281 + avlab_2p,
4282 + oxsemi_952,
4283 +@@ -2935,8 +2933,6 @@ static struct parport_pc_pci {
4284 + /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } },
4285 + /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } },
4286 + /* titan_010l */ { 1, { { 3, -1 }, } },
4287 +- /* titan_1284p1 */ { 1, { { 0, 1 }, } },
4288 +- /* titan_1284p2 */ { 2, { { 0, 1 }, { 2, 3 }, } },
4289 + /* avlab_1p */ { 1, { { 0, 1}, } },
4290 + /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} },
4291 + /* The Oxford Semi cards are unusual: 954 doesn't support ECP,
4292 +@@ -2952,8 +2948,8 @@ static struct parport_pc_pci {
4293 + /* netmos_9705 */ { 1, { { 0, -1 }, } },
4294 + /* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} },
4295 + /* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} },
4296 +- /* netmos_9805 */ { 1, { { 0, -1 }, } },
4297 +- /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } },
4298 ++ /* netmos_9805 */ { 1, { { 0, 1 }, } },
4299 ++ /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } },
4300 + /* netmos_9901 */ { 1, { { 0, -1 }, } },
4301 + /* netmos_9865 */ { 1, { { 0, -1 }, } },
4302 + /* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
4303 +@@ -2997,8 +2993,6 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
4304 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_1p_ecp },
4305 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_010L,
4306 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_010l },
4307 +- { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 },
4308 +- { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 },
4309 + /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
4310 + /* AFAVLAB_TK9902 */
4311 + { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p},
4312 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
4313 +index 9f1fec1..4c3a9e9 100644
4314 +--- a/drivers/pci/pci.c
4315 ++++ b/drivers/pci/pci.c
4316 +@@ -1078,6 +1078,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state);
4317 + static int do_pci_enable_device(struct pci_dev *dev, int bars)
4318 + {
4319 + int err;
4320 ++ u16 cmd;
4321 ++ u8 pin;
4322 +
4323 + err = pci_set_power_state(dev, PCI_D0);
4324 + if (err < 0 && err != -EIO)
4325 +@@ -1087,6 +1089,17 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
4326 + return err;
4327 + pci_fixup_device(pci_fixup_enable, dev);
4328 +
4329 ++ if (dev->msi_enabled || dev->msix_enabled)
4330 ++ return 0;
4331 ++
4332 ++ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
4333 ++ if (pin) {
4334 ++ pci_read_config_word(dev, PCI_COMMAND, &cmd);
4335 ++ if (cmd & PCI_COMMAND_INTX_DISABLE)
4336 ++ pci_write_config_word(dev, PCI_COMMAND,
4337 ++ cmd & ~PCI_COMMAND_INTX_DISABLE);
4338 ++ }
4339 ++
4340 + return 0;
4341 + }
4342 +
4343 +diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
4344 +index fdacfce..0076fea 100644
4345 +--- a/drivers/platform/x86/hp_accel.c
4346 ++++ b/drivers/platform/x86/hp_accel.c
4347 +@@ -77,6 +77,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
4348 + static struct acpi_device_id lis3lv02d_device_ids[] = {
4349 + {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
4350 + {"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */
4351 ++ {"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */
4352 + {"", 0},
4353 + };
4354 + MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
4355 +diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
4356 +index 2f2f9a6..39d3697 100644
4357 +--- a/drivers/power/max17040_battery.c
4358 ++++ b/drivers/power/max17040_battery.c
4359 +@@ -148,7 +148,7 @@ static void max17040_get_online(struct i2c_client *client)
4360 + {
4361 + struct max17040_chip *chip = i2c_get_clientdata(client);
4362 +
4363 +- if (chip->pdata->battery_online)
4364 ++ if (chip->pdata && chip->pdata->battery_online)
4365 + chip->online = chip->pdata->battery_online();
4366 + else
4367 + chip->online = 1;
4368 +@@ -158,7 +158,8 @@ static void max17040_get_status(struct i2c_client *client)
4369 + {
4370 + struct max17040_chip *chip = i2c_get_clientdata(client);
4371 +
4372 +- if (!chip->pdata->charger_online || !chip->pdata->charger_enable) {
4373 ++ if (!chip->pdata || !chip->pdata->charger_online
4374 ++ || !chip->pdata->charger_enable) {
4375 + chip->status = POWER_SUPPLY_STATUS_UNKNOWN;
4376 + return;
4377 + }
4378 +diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
4379 +index e3eed18..cae8985 100644
4380 +--- a/drivers/rtc/rtc-cmos.c
4381 ++++ b/drivers/rtc/rtc-cmos.c
4382 +@@ -34,11 +34,11 @@
4383 + #include <linux/interrupt.h>
4384 + #include <linux/spinlock.h>
4385 + #include <linux/platform_device.h>
4386 +-#include <linux/mod_devicetable.h>
4387 + #include <linux/log2.h>
4388 + #include <linux/pm.h>
4389 + #include <linux/of.h>
4390 + #include <linux/of_platform.h>
4391 ++#include <linux/dmi.h>
4392 +
4393 + /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
4394 + #include <asm-generic/rtc.h>
4395 +@@ -377,6 +377,51 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
4396 + return 0;
4397 + }
4398 +
4399 ++/*
4400 ++ * Do not disable RTC alarm on shutdown - workaround for b0rked BIOSes.
4401 ++ */
4402 ++static bool alarm_disable_quirk;
4403 ++
4404 ++static int __init set_alarm_disable_quirk(const struct dmi_system_id *id)
4405 ++{
4406 ++ alarm_disable_quirk = true;
4407 ++ pr_info("rtc-cmos: BIOS has alarm-disable quirk. ");
4408 ++ pr_info("RTC alarms disabled\n");
4409 ++ return 0;
4410 ++}
4411 ++
4412 ++static const struct dmi_system_id rtc_quirks[] __initconst = {
4413 ++ /* https://bugzilla.novell.com/show_bug.cgi?id=805740 */
4414 ++ {
4415 ++ .callback = set_alarm_disable_quirk,
4416 ++ .ident = "IBM Truman",
4417 ++ .matches = {
4418 ++ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
4419 ++ DMI_MATCH(DMI_PRODUCT_NAME, "4852570"),
4420 ++ },
4421 ++ },
4422 ++ /* https://bugzilla.novell.com/show_bug.cgi?id=812592 */
4423 ++ {
4424 ++ .callback = set_alarm_disable_quirk,
4425 ++ .ident = "Gigabyte GA-990XA-UD3",
4426 ++ .matches = {
4427 ++ DMI_MATCH(DMI_SYS_VENDOR,
4428 ++ "Gigabyte Technology Co., Ltd."),
4429 ++ DMI_MATCH(DMI_PRODUCT_NAME, "GA-990XA-UD3"),
4430 ++ },
4431 ++ },
4432 ++ /* http://permalink.gmane.org/gmane.linux.kernel/1604474 */
4433 ++ {
4434 ++ .callback = set_alarm_disable_quirk,
4435 ++ .ident = "Toshiba Satellite L300",
4436 ++ .matches = {
4437 ++ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
4438 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L300"),
4439 ++ },
4440 ++ },
4441 ++ {}
4442 ++};
4443 ++
4444 + static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled)
4445 + {
4446 + struct cmos_rtc *cmos = dev_get_drvdata(dev);
4447 +@@ -385,6 +430,9 @@ static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled)
4448 + if (!is_valid_irq(cmos->irq))
4449 + return -EINVAL;
4450 +
4451 ++ if (alarm_disable_quirk)
4452 ++ return 0;
4453 ++
4454 + spin_lock_irqsave(&rtc_lock, flags);
4455 +
4456 + if (enabled)
4457 +@@ -1166,6 +1214,8 @@ static int __init cmos_init(void)
4458 + platform_driver_registered = true;
4459 + }
4460 +
4461 ++ dmi_check_system(rtc_quirks);
4462 ++
4463 + if (retval == 0)
4464 + return 0;
4465 +
4466 +diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
4467 +index 66fb725..633048b 100644
4468 +--- a/drivers/scsi/bfa/bfad.c
4469 ++++ b/drivers/scsi/bfa/bfad.c
4470 +@@ -1613,7 +1613,7 @@ out:
4471 + static u32 *
4472 + bfad_load_fwimg(struct pci_dev *pdev)
4473 + {
4474 +- if (pdev->device == BFA_PCI_DEVICE_ID_CT2) {
4475 ++ if (bfa_asic_id_ct2(pdev->device)) {
4476 + if (bfi_image_ct2_size == 0)
4477 + bfad_read_firmware(pdev, &bfi_image_ct2,
4478 + &bfi_image_ct2_size, BFAD_FW_FILE_CT2);
4479 +@@ -1623,12 +1623,14 @@ bfad_load_fwimg(struct pci_dev *pdev)
4480 + bfad_read_firmware(pdev, &bfi_image_ct,
4481 + &bfi_image_ct_size, BFAD_FW_FILE_CT);
4482 + return bfi_image_ct;
4483 +- } else {
4484 ++ } else if (bfa_asic_id_cb(pdev->device)) {
4485 + if (bfi_image_cb_size == 0)
4486 + bfad_read_firmware(pdev, &bfi_image_cb,
4487 + &bfi_image_cb_size, BFAD_FW_FILE_CB);
4488 + return bfi_image_cb;
4489 + }
4490 ++
4491 ++ return NULL;
4492 + }
4493 +
4494 + static void
4495 +diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
4496 +index 646051a..ef84778 100644
4497 +--- a/drivers/scsi/isci/host.h
4498 ++++ b/drivers/scsi/isci/host.h
4499 +@@ -309,9 +309,8 @@ static inline struct isci_pci_info *to_pci_info(struct pci_dev *pdev)
4500 + }
4501 +
4502 + #define for_each_isci_host(id, ihost, pdev) \
4503 +- for (id = 0, ihost = to_pci_info(pdev)->hosts[id]; \
4504 +- id < ARRAY_SIZE(to_pci_info(pdev)->hosts) && ihost; \
4505 +- ihost = to_pci_info(pdev)->hosts[++id])
4506 ++ for (id = 0; id < SCI_MAX_CONTROLLERS && \
4507 ++ (ihost = to_pci_info(pdev)->hosts[id]); id++)
4508 +
4509 + static inline enum isci_status isci_host_get_state(struct isci_host *isci_host)
4510 + {
4511 +diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c
4512 +index 38a99d2..21a6769 100644
4513 +--- a/drivers/scsi/isci/port_config.c
4514 ++++ b/drivers/scsi/isci/port_config.c
4515 +@@ -610,13 +610,6 @@ static void sci_apc_agent_link_up(struct isci_host *ihost,
4516 + sci_apc_agent_configure_ports(ihost, port_agent, iphy, true);
4517 + } else {
4518 + /* the phy is already the part of the port */
4519 +- u32 port_state = iport->sm.current_state_id;
4520 +-
4521 +- /* if the PORT'S state is resetting then the link up is from
4522 +- * port hard reset in this case, we need to tell the port
4523 +- * that link up is recieved
4524 +- */
4525 +- BUG_ON(port_state != SCI_PORT_RESETTING);
4526 + port_agent->phy_ready_mask |= 1 << phy_index;
4527 + sci_port_link_up(iport, iphy);
4528 + }
4529 +diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
4530 +index e294d11..60a530f 100644
4531 +--- a/drivers/scsi/isci/task.c
4532 ++++ b/drivers/scsi/isci/task.c
4533 +@@ -1390,7 +1390,7 @@ int isci_task_I_T_nexus_reset(struct domain_device *dev)
4534 + spin_unlock_irqrestore(&ihost->scic_lock, flags);
4535 +
4536 + if (!idev || !test_bit(IDEV_EH, &idev->flags)) {
4537 +- ret = TMF_RESP_FUNC_COMPLETE;
4538 ++ ret = -ENODEV;
4539 + goto out;
4540 + }
4541 +
4542 +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
4543 +index fcf052c..c491a94 100644
4544 +--- a/drivers/scsi/qla2xxx/qla_def.h
4545 ++++ b/drivers/scsi/qla2xxx/qla_def.h
4546 +@@ -2568,8 +2568,7 @@ struct qla_hw_data {
4547 + IS_QLA25XX(ha) || IS_QLA81XX(ha) || \
4548 + IS_QLA82XX(ha))
4549 + #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha))
4550 +-#define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && \
4551 +- (ha)->flags.msix_enabled)
4552 ++#define IS_NOPOLLING_TYPE(ha) (IS_QLA81XX(ha) && (ha)->flags.msix_enabled)
4553 + #define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha))
4554 + #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha))
4555 + #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha))
4556 +diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
4557 +index da2b75b..672538e 100644
4558 +--- a/drivers/staging/comedi/drivers/adv_pci1710.c
4559 ++++ b/drivers/staging/comedi/drivers/adv_pci1710.c
4560 +@@ -414,6 +414,7 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
4561 + struct comedi_subdevice *s,
4562 + struct comedi_insn *insn, unsigned int *data)
4563 + {
4564 ++ unsigned int val;
4565 + int n, chan, range, ofs;
4566 +
4567 + chan = CR_CHAN(insn->chanspec);
4568 +@@ -429,11 +430,14 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
4569 + outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
4570 + ofs = PCI171x_DA1;
4571 + }
4572 ++ val = devpriv->ao_data[chan];
4573 +
4574 +- for (n = 0; n < insn->n; n++)
4575 +- outw(data[n], dev->iobase + ofs);
4576 ++ for (n = 0; n < insn->n; n++) {
4577 ++ val = data[n];
4578 ++ outw(val, dev->iobase + ofs);
4579 ++ }
4580 +
4581 +- devpriv->ao_data[chan] = data[n];
4582 ++ devpriv->ao_data[chan] = val;
4583 +
4584 + return n;
4585 +
4586 +@@ -582,6 +586,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
4587 + struct comedi_subdevice *s,
4588 + struct comedi_insn *insn, unsigned int *data)
4589 + {
4590 ++ unsigned int val;
4591 + int n, rangereg, chan;
4592 +
4593 + chan = CR_CHAN(insn->chanspec);
4594 +@@ -591,13 +596,15 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
4595 + outb(rangereg, dev->iobase + PCI1720_RANGE);
4596 + devpriv->da_ranges = rangereg;
4597 + }
4598 ++ val = devpriv->ao_data[chan];
4599 +
4600 + for (n = 0; n < insn->n; n++) {
4601 +- outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
4602 ++ val = data[n];
4603 ++ outw(val, dev->iobase + PCI1720_DA0 + (chan << 1));
4604 + outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
4605 + }
4606 +
4607 +- devpriv->ao_data[chan] = data[n];
4608 ++ devpriv->ao_data[chan] = val;
4609 +
4610 + return n;
4611 + }
4612 +diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c
4613 +index b2c2c89..6c25bd3 100644
4614 +--- a/drivers/staging/comedi/drivers/pcmuio.c
4615 ++++ b/drivers/staging/comedi/drivers/pcmuio.c
4616 +@@ -464,13 +464,13 @@ static int pcmuio_detach(struct comedi_device *dev)
4617 + if (dev->iobase)
4618 + release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics);
4619 +
4620 +- for (i = 0; i < MAX_ASICS; ++i) {
4621 +- if (devpriv->asics[i].irq)
4622 +- free_irq(devpriv->asics[i].irq, dev);
4623 +- }
4624 +-
4625 +- if (devpriv && devpriv->sprivs)
4626 ++ if (devpriv) {
4627 ++ for (i = 0; i < MAX_ASICS; ++i) {
4628 ++ if (devpriv->asics[i].irq)
4629 ++ free_irq(devpriv->asics[i].irq, dev);
4630 ++ }
4631 + kfree(devpriv->sprivs);
4632 ++ }
4633 +
4634 + return 0;
4635 + }
4636 +diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c
4637 +index 526de2e..0316780 100644
4638 +--- a/drivers/staging/comedi/drivers/ssv_dnp.c
4639 ++++ b/drivers/staging/comedi/drivers/ssv_dnp.c
4640 +@@ -251,11 +251,11 @@ static int dnp_dio_insn_bits(struct comedi_device *dev,
4641 +
4642 + /* on return, data[1] contains the value of the digital input lines. */
4643 + outb(PADR, CSCIR);
4644 +- data[0] = inb(CSCDR);
4645 ++ data[1] = inb(CSCDR);
4646 + outb(PBDR, CSCIR);
4647 +- data[0] += inb(CSCDR) << 8;
4648 ++ data[1] += inb(CSCDR) << 8;
4649 + outb(PCDR, CSCIR);
4650 +- data[0] += ((inb(CSCDR) & 0xF0) << 12);
4651 ++ data[1] += ((inb(CSCDR) & 0xF0) << 12);
4652 +
4653 + return 2;
4654 +
4655 +diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
4656 +index ee6cd79..f79d0cb 100644
4657 +--- a/drivers/staging/iio/adc/ad799x_core.c
4658 ++++ b/drivers/staging/iio/adc/ad799x_core.c
4659 +@@ -873,7 +873,8 @@ static int __devinit ad799x_probe(struct i2c_client *client,
4660 + return 0;
4661 +
4662 + error_free_irq:
4663 +- free_irq(client->irq, indio_dev);
4664 ++ if (client->irq > 0)
4665 ++ free_irq(client->irq, indio_dev);
4666 + error_cleanup_ring:
4667 + ad799x_ring_cleanup(indio_dev);
4668 + error_disable_reg:
4669 +diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
4670 +index 88d1d35..a74e83d 100644
4671 +--- a/drivers/staging/rtl8712/usb_intf.c
4672 ++++ b/drivers/staging/rtl8712/usb_intf.c
4673 +@@ -363,6 +363,10 @@ static u8 key_2char2num(u8 hch, u8 lch)
4674 + return (hex_to_bin(hch) << 4) | hex_to_bin(lch);
4675 + }
4676 +
4677 ++static const struct device_type wlan_type = {
4678 ++ .name = "wlan",
4679 ++};
4680 ++
4681 + /*
4682 + * drv_init() - a device potentially for us
4683 + *
4684 +@@ -398,6 +402,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
4685 + padapter->pusb_intf = pusb_intf;
4686 + usb_set_intfdata(pusb_intf, pnetdev);
4687 + SET_NETDEV_DEV(pnetdev, &pusb_intf->dev);
4688 ++ pnetdev->dev.type = &wlan_type;
4689 + /* step 2. */
4690 + padapter->dvobj_init = &r8712_usb_dvobj_init;
4691 + padapter->dvobj_deinit = &r8712_usb_dvobj_deinit;
4692 +diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
4693 +index 0d11147..59cf674 100644
4694 +--- a/drivers/staging/vt6656/baseband.c
4695 ++++ b/drivers/staging/vt6656/baseband.c
4696 +@@ -1656,7 +1656,6 @@ BBvUpdatePreEDThreshold(
4697 +
4698 + if( bScanning )
4699 + { // need Max sensitivity //RSSI -69, -70,....
4700 +- if(pDevice->byBBPreEDIndex == 0) break;
4701 + pDevice->byBBPreEDIndex = 0;
4702 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
4703 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE)
4704 +@@ -1799,7 +1798,6 @@ BBvUpdatePreEDThreshold(
4705 +
4706 + if( bScanning )
4707 + { // need Max sensitivity //RSSI -69, -70, ...
4708 +- if(pDevice->byBBPreEDIndex == 0) break;
4709 + pDevice->byBBPreEDIndex = 0;
4710 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
4711 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE)
4712 +@@ -1951,7 +1949,6 @@ BBvUpdatePreEDThreshold(
4713 + case RF_VT3342A0: //RobertYu:20060627, testing table
4714 + if( bScanning )
4715 + { // need Max sensitivity //RSSI -67, -68, ...
4716 +- if(pDevice->byBBPreEDIndex == 0) break;
4717 + pDevice->byBBPreEDIndex = 0;
4718 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9)
4719 + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE)
4720 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
4721 +index 45c13a6..4a88eea 100644
4722 +--- a/drivers/target/iscsi/iscsi_target.c
4723 ++++ b/drivers/target/iscsi/iscsi_target.c
4724 +@@ -50,7 +50,7 @@
4725 + static LIST_HEAD(g_tiqn_list);
4726 + static LIST_HEAD(g_np_list);
4727 + static DEFINE_SPINLOCK(tiqn_lock);
4728 +-static DEFINE_SPINLOCK(np_lock);
4729 ++static DEFINE_MUTEX(np_lock);
4730 +
4731 + static struct idr tiqn_idr;
4732 + struct idr sess_idr;
4733 +@@ -262,6 +262,9 @@ int iscsit_deaccess_np(struct iscsi_np *np, struct iscsi_portal_group *tpg)
4734 + return 0;
4735 + }
4736 +
4737 ++/*
4738 ++ * Called with mutex np_lock held
4739 ++ */
4740 + static struct iscsi_np *iscsit_get_np(
4741 + struct __kernel_sockaddr_storage *sockaddr,
4742 + int network_transport)
4743 +@@ -272,11 +275,10 @@ static struct iscsi_np *iscsit_get_np(
4744 + int ip_match = 0;
4745 + u16 port;
4746 +
4747 +- spin_lock_bh(&np_lock);
4748 + list_for_each_entry(np, &g_np_list, np_list) {
4749 +- spin_lock(&np->np_thread_lock);
4750 ++ spin_lock_bh(&np->np_thread_lock);
4751 + if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) {
4752 +- spin_unlock(&np->np_thread_lock);
4753 ++ spin_unlock_bh(&np->np_thread_lock);
4754 + continue;
4755 + }
4756 +
4757 +@@ -309,13 +311,11 @@ static struct iscsi_np *iscsit_get_np(
4758 + * while iscsi_tpg_add_network_portal() is called.
4759 + */
4760 + np->np_exports++;
4761 +- spin_unlock(&np->np_thread_lock);
4762 +- spin_unlock_bh(&np_lock);
4763 ++ spin_unlock_bh(&np->np_thread_lock);
4764 + return np;
4765 + }
4766 +- spin_unlock(&np->np_thread_lock);
4767 ++ spin_unlock_bh(&np->np_thread_lock);
4768 + }
4769 +- spin_unlock_bh(&np_lock);
4770 +
4771 + return NULL;
4772 + }
4773 +@@ -329,16 +329,22 @@ struct iscsi_np *iscsit_add_np(
4774 + struct sockaddr_in6 *sock_in6;
4775 + struct iscsi_np *np;
4776 + int ret;
4777 ++
4778 ++ mutex_lock(&np_lock);
4779 ++
4780 + /*
4781 + * Locate the existing struct iscsi_np if already active..
4782 + */
4783 + np = iscsit_get_np(sockaddr, network_transport);
4784 +- if (np)
4785 ++ if (np) {
4786 ++ mutex_unlock(&np_lock);
4787 + return np;
4788 ++ }
4789 +
4790 + np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL);
4791 + if (!np) {
4792 + pr_err("Unable to allocate memory for struct iscsi_np\n");
4793 ++ mutex_unlock(&np_lock);
4794 + return ERR_PTR(-ENOMEM);
4795 + }
4796 +
4797 +@@ -361,6 +367,7 @@ struct iscsi_np *iscsit_add_np(
4798 + ret = iscsi_target_setup_login_socket(np, sockaddr);
4799 + if (ret != 0) {
4800 + kfree(np);
4801 ++ mutex_unlock(&np_lock);
4802 + return ERR_PTR(ret);
4803 + }
4804 +
4805 +@@ -369,6 +376,7 @@ struct iscsi_np *iscsit_add_np(
4806 + pr_err("Unable to create kthread: iscsi_np\n");
4807 + ret = PTR_ERR(np->np_thread);
4808 + kfree(np);
4809 ++ mutex_unlock(&np_lock);
4810 + return ERR_PTR(ret);
4811 + }
4812 + /*
4813 +@@ -379,10 +387,10 @@ struct iscsi_np *iscsit_add_np(
4814 + * point because iscsi_np has not been added to g_np_list yet.
4815 + */
4816 + np->np_exports = 1;
4817 ++ np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
4818 +
4819 +- spin_lock_bh(&np_lock);
4820 + list_add_tail(&np->np_list, &g_np_list);
4821 +- spin_unlock_bh(&np_lock);
4822 ++ mutex_unlock(&np_lock);
4823 +
4824 + pr_debug("CORE[0] - Added Network Portal: %s:%hu on %s\n",
4825 + np->np_ip, np->np_port, (np->np_network_transport == ISCSI_TCP) ?
4826 +@@ -453,9 +461,9 @@ int iscsit_del_np(struct iscsi_np *np)
4827 + }
4828 + iscsit_del_np_comm(np);
4829 +
4830 +- spin_lock_bh(&np_lock);
4831 ++ mutex_lock(&np_lock);
4832 + list_del(&np->np_list);
4833 +- spin_unlock_bh(&np_lock);
4834 ++ mutex_unlock(&np_lock);
4835 +
4836 + pr_debug("CORE[0] - Removed Network Portal: %s:%hu on %s\n",
4837 + np->np_ip, np->np_port, (np->np_network_transport == ISCSI_TCP) ?
4838 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
4839 +index d190269..643a0a0 100644
4840 +--- a/drivers/tty/n_gsm.c
4841 ++++ b/drivers/tty/n_gsm.c
4842 +@@ -1090,6 +1090,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
4843 + {
4844 + unsigned int addr = 0;
4845 + unsigned int modem = 0;
4846 ++ unsigned int brk = 0;
4847 + struct gsm_dlci *dlci;
4848 + int len = clen;
4849 + u8 *dp = data;
4850 +@@ -1116,6 +1117,16 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
4851 + if (len == 0)
4852 + return;
4853 + }
4854 ++ len--;
4855 ++ if (len > 0) {
4856 ++ while (gsm_read_ea(&brk, *dp++) == 0) {
4857 ++ len--;
4858 ++ if (len == 0)
4859 ++ return;
4860 ++ }
4861 ++ modem <<= 7;
4862 ++ modem |= (brk & 0x7f);
4863 ++ }
4864 + tty = tty_port_tty_get(&dlci->port);
4865 + gsm_process_modem(tty, dlci, modem, clen);
4866 + if (tty) {
4867 +diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
4868 +index cff03e5..33601f8 100644
4869 +--- a/drivers/tty/serial/8250.c
4870 ++++ b/drivers/tty/serial/8250.c
4871 +@@ -2701,6 +2701,10 @@ static void serial8250_config_port(struct uart_port *port, int flags)
4872 + if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU)
4873 + up->bugs |= UART_BUG_NOMSR;
4874 +
4875 ++ /* HW bugs may trigger IRQ while IIR == NO_INT */
4876 ++ if (up->port.type == PORT_TEGRA)
4877 ++ up->bugs |= UART_BUG_NOMSR;
4878 ++
4879 + if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ)
4880 + autoconfig_irq(up);
4881 +
4882 +diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
4883 +index 6c9bcdf..ef24e96 100644
4884 +--- a/drivers/tty/serial/8250_pci.c
4885 ++++ b/drivers/tty/serial/8250_pci.c
4886 +@@ -1147,6 +1147,11 @@ pci_xr17c154_setup(struct serial_private *priv,
4887 + #define PCI_DEVICE_ID_TITAN_800E 0xA014
4888 + #define PCI_DEVICE_ID_TITAN_200EI 0xA016
4889 + #define PCI_DEVICE_ID_TITAN_200EISI 0xA017
4890 ++#define PCI_DEVICE_ID_TITAN_200V3 0xA306
4891 ++#define PCI_DEVICE_ID_TITAN_400V3 0xA310
4892 ++#define PCI_DEVICE_ID_TITAN_410V3 0xA312
4893 ++#define PCI_DEVICE_ID_TITAN_800V3 0xA314
4894 ++#define PCI_DEVICE_ID_TITAN_800V3B 0xA315
4895 + #define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
4896 + #define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6
4897 + #define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001
4898 +@@ -3465,6 +3470,21 @@ static struct pci_device_id serial_pci_tbl[] = {
4899 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
4900 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4901 + pbn_oxsemi_2_4000000 },
4902 ++ { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200V3,
4903 ++ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4904 ++ pbn_b0_bt_2_921600 },
4905 ++ { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3,
4906 ++ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4907 ++ pbn_b0_4_921600 },
4908 ++ { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_410V3,
4909 ++ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4910 ++ pbn_b0_4_921600 },
4911 ++ { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3,
4912 ++ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4913 ++ pbn_b0_4_921600 },
4914 ++ { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800V3B,
4915 ++ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4916 ++ pbn_b0_4_921600 },
4917 +
4918 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
4919 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4920 +diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
4921 +index 086f7fe..a6caf62 100644
4922 +--- a/drivers/tty/serial/pmac_zilog.c
4923 ++++ b/drivers/tty/serial/pmac_zilog.c
4924 +@@ -2198,6 +2198,9 @@ static int __init pmz_console_init(void)
4925 + /* Probe ports */
4926 + pmz_probe();
4927 +
4928 ++ if (pmz_ports_count == 0)
4929 ++ return -ENODEV;
4930 ++
4931 + /* TODO: Autoprobe console based on OF */
4932 + /* pmz_console.index = i; */
4933 + register_console(&pmz_console);
4934 +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
4935 +index 78609d3..1e3e211 100644
4936 +--- a/drivers/usb/core/config.c
4937 ++++ b/drivers/usb/core/config.c
4938 +@@ -722,6 +722,10 @@ int usb_get_configuration(struct usb_device *dev)
4939 + result = -ENOMEM;
4940 + goto err;
4941 + }
4942 ++
4943 ++ if (dev->quirks & USB_QUIRK_DELAY_INIT)
4944 ++ msleep(100);
4945 ++
4946 + result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
4947 + bigbuffer, length);
4948 + if (result < 0) {
4949 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
4950 +index bcde6f6..3677d22 100644
4951 +--- a/drivers/usb/core/quirks.c
4952 ++++ b/drivers/usb/core/quirks.c
4953 +@@ -46,6 +46,10 @@ static const struct usb_device_id usb_quirk_list[] = {
4954 + /* Microsoft LifeCam-VX700 v2.0 */
4955 + { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
4956 +
4957 ++ /* Logitech HD Pro Webcams C920 and C930e */
4958 ++ { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
4959 ++ { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
4960 ++
4961 + /* Logitech Quickcam Fusion */
4962 + { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
4963 +
4964 +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
4965 +index 339be10..2abdad6 100644
4966 +--- a/drivers/usb/host/ehci-hcd.c
4967 ++++ b/drivers/usb/host/ehci-hcd.c
4968 +@@ -807,8 +807,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
4969 + struct ehci_hcd *ehci = hcd_to_ehci (hcd);
4970 + u32 status, masked_status, pcd_status = 0, cmd;
4971 + int bh;
4972 ++ unsigned long flags;
4973 +
4974 +- spin_lock (&ehci->lock);
4975 ++ /*
4976 ++ * For threadirqs option we use spin_lock_irqsave() variant to prevent
4977 ++ * deadlock with ehci hrtimer callback, because hrtimer callbacks run
4978 ++ * in interrupt context even when threadirqs is specified. We can go
4979 ++ * back to spin_lock() variant when hrtimer callbacks become threaded.
4980 ++ */
4981 ++ spin_lock_irqsave(&ehci->lock, flags);
4982 +
4983 + status = ehci_readl(ehci, &ehci->regs->status);
4984 +
4985 +@@ -826,7 +833,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
4986 +
4987 + /* Shared IRQ? */
4988 + if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
4989 +- spin_unlock(&ehci->lock);
4990 ++ spin_unlock_irqrestore(&ehci->lock, flags);
4991 + return IRQ_NONE;
4992 + }
4993 +
4994 +@@ -929,7 +936,7 @@ dead:
4995 +
4996 + if (bh)
4997 + ehci_work (ehci);
4998 +- spin_unlock (&ehci->lock);
4999 ++ spin_unlock_irqrestore(&ehci->lock, flags);
5000 + if (pcd_status)
5001 + usb_hcd_poll_rh_status(hcd);
5002 + return IRQ_HANDLED;
5003 +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
5004 +index 77bbb23..4527b90 100644
5005 +--- a/drivers/usb/host/ehci-hub.c
5006 ++++ b/drivers/usb/host/ehci-hub.c
5007 +@@ -207,6 +207,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
5008 + int port;
5009 + int mask;
5010 + int changed;
5011 ++ bool fs_idle_delay;
5012 +
5013 + ehci_dbg(ehci, "suspend root hub\n");
5014 +
5015 +@@ -249,6 +250,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
5016 + ehci->bus_suspended = 0;
5017 + ehci->owned_ports = 0;
5018 + changed = 0;
5019 ++ fs_idle_delay = false;
5020 + port = HCS_N_PORTS(ehci->hcs_params);
5021 + while (port--) {
5022 + u32 __iomem *reg = &ehci->regs->port_status [port];
5023 +@@ -279,16 +281,34 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
5024 + if (t1 != t2) {
5025 + ehci_vdbg (ehci, "port %d, %08x -> %08x\n",
5026 + port + 1, t1, t2);
5027 ++ /*
5028 ++ * On some controllers, Wake-On-Disconnect will
5029 ++ * generate false wakeup signals until the bus
5030 ++ * switches over to full-speed idle. For their
5031 ++ * sake, add a delay if we need one.
5032 ++ */
5033 ++ if ((t2 & PORT_WKDISC_E) &&
5034 ++ ehci_port_speed(ehci, t2) ==
5035 ++ USB_PORT_STAT_HIGH_SPEED)
5036 ++ fs_idle_delay = true;
5037 + ehci_writel(ehci, t2, reg);
5038 + changed = 1;
5039 + }
5040 + }
5041 ++ spin_unlock_irq(&ehci->lock);
5042 ++
5043 ++ if ((changed && ehci->has_hostpc) || fs_idle_delay) {
5044 ++ /*
5045 ++ * Wait for HCD to enter low-power mode or for the bus
5046 ++ * to switch to full-speed idle.
5047 ++ */
5048 ++ usleep_range(5000, 5500);
5049 ++ }
5050 ++
5051 ++ spin_lock_irq(&ehci->lock);
5052 +
5053 + if (changed && ehci->has_hostpc) {
5054 +- spin_unlock_irq(&ehci->lock);
5055 +- msleep(5); /* 5 ms for HCD to enter low-power mode */
5056 + spin_lock_irq(&ehci->lock);
5057 +-
5058 + port = HCS_N_PORTS(ehci->hcs_params);
5059 + while (port--) {
5060 + u32 __iomem *hostpc_reg;
5061 +diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
5062 +index 0a5fda7..b65912d 100644
5063 +--- a/drivers/usb/host/ehci.h
5064 ++++ b/drivers/usb/host/ehci.h
5065 +@@ -147,6 +147,7 @@ struct ehci_hcd { /* one per controller */
5066 + unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/
5067 + unsigned has_synopsys_hc_bug:1; /* Synopsys HC */
5068 + unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
5069 ++ unsigned imx28_write_fix:1; /* For Freescale i.MX28 */
5070 +
5071 + /* required for usb32 quirk */
5072 + #define OHCI_CTRL_HCFS (3 << 6)
5073 +@@ -654,6 +655,18 @@ static inline unsigned int ehci_readl(const struct ehci_hcd *ehci,
5074 + #endif
5075 + }
5076 +
5077 ++#ifdef CONFIG_SOC_IMX28
5078 ++static inline void imx28_ehci_writel(const unsigned int val,
5079 ++ volatile __u32 __iomem *addr)
5080 ++{
5081 ++ __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
5082 ++}
5083 ++#else
5084 ++static inline void imx28_ehci_writel(const unsigned int val,
5085 ++ volatile __u32 __iomem *addr)
5086 ++{
5087 ++}
5088 ++#endif
5089 + static inline void ehci_writel(const struct ehci_hcd *ehci,
5090 + const unsigned int val, __u32 __iomem *regs)
5091 + {
5092 +@@ -662,7 +675,10 @@ static inline void ehci_writel(const struct ehci_hcd *ehci,
5093 + writel_be(val, regs) :
5094 + writel(val, regs);
5095 + #else
5096 +- writel(val, regs);
5097 ++ if (ehci->imx28_write_fix)
5098 ++ imx28_ehci_writel(val, regs);
5099 ++ else
5100 ++ writel(val, regs);
5101 + #endif
5102 + }
5103 +
5104 +diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
5105 +index b461311..ce13e61 100644
5106 +--- a/drivers/usb/serial/cypress_m8.h
5107 ++++ b/drivers/usb/serial/cypress_m8.h
5108 +@@ -63,7 +63,7 @@
5109 + #define UART_DSR 0x20 /* data set ready - flow control - device to host */
5110 + #define CONTROL_RTS 0x10 /* request to send - flow control - host to device */
5111 + #define UART_CTS 0x10 /* clear to send - flow control - device to host */
5112 +-#define UART_RI 0x10 /* ring indicator - modem - device to host */
5113 ++#define UART_RI 0x80 /* ring indicator - modem - device to host */
5114 + #define UART_CD 0x40 /* carrier detect - modem - device to host */
5115 + #define CYP_ERROR 0x08 /* received from input report - device to host */
5116 + /* Note - the below has nothing to do with the "feature report" reset */
5117 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
5118 +index 85504bb..5c97d9f 100644
5119 +--- a/drivers/usb/serial/ftdi_sio.c
5120 ++++ b/drivers/usb/serial/ftdi_sio.c
5121 +@@ -163,6 +163,7 @@ static struct usb_device_id id_table_combined [] = {
5122 + { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
5123 + { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
5124 + { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
5125 ++ { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) },
5126 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
5127 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) },
5128 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) },
5129 +@@ -202,6 +203,8 @@ static struct usb_device_id id_table_combined [] = {
5130 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
5131 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
5132 + { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
5133 ++ { USB_DEVICE(FTDI_VID, FTDI_TAGSYS_LP101_PID) },
5134 ++ { USB_DEVICE(FTDI_VID, FTDI_TAGSYS_P200X_PID) },
5135 + { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) },
5136 + { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
5137 + { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) },
5138 +@@ -914,6 +917,9 @@ static struct usb_device_id id_table_combined [] = {
5139 + { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) },
5140 + /* Crucible Devices */
5141 + { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
5142 ++ { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) },
5143 ++ /* Cressi Devices */
5144 ++ { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) },
5145 + { }, /* Optional parameter entry */
5146 + { } /* Terminating entry */
5147 + };
5148 +@@ -2193,10 +2199,20 @@ static void ftdi_set_termios(struct tty_struct *tty,
5149 + }
5150 +
5151 + /*
5152 +- * All FTDI UART chips are limited to CS7/8. We won't pretend to
5153 ++ * All FTDI UART chips are limited to CS7/8. We shouldn't pretend to
5154 + * support CS5/6 and revert the CSIZE setting instead.
5155 ++ *
5156 ++ * CS5 however is used to control some smartcard readers which abuse
5157 ++ * this limitation to switch modes. Original FTDI chips fall back to
5158 ++ * eight data bits.
5159 ++ *
5160 ++ * TODO: Implement a quirk to only allow this with mentioned
5161 ++ * readers. One I know of (Argolis Smartreader V1)
5162 ++ * returns "USB smartcard server" as iInterface string.
5163 ++ * The vendor didn't bother with a custom VID/PID of
5164 ++ * course.
5165 + */
5166 +- if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) {
5167 ++ if (C_CSIZE(tty) == CS6) {
5168 + dev_warn(&port->dev, "requested CSIZE setting not supported\n");
5169 +
5170 + termios->c_cflag &= ~CSIZE;
5171 +@@ -2243,6 +2259,9 @@ no_skip:
5172 + urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
5173 + }
5174 + switch (cflag & CSIZE) {
5175 ++ case CS5:
5176 ++ dev_dbg(&port->dev, "Setting CS5 quirk\n");
5177 ++ break;
5178 + case CS7:
5179 + urb_value |= 7;
5180 + dev_dbg(&port->dev, "Setting CS7\n");
5181 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
5182 +index 61685ed..71fe2de 100644
5183 +--- a/drivers/usb/serial/ftdi_sio_ids.h
5184 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
5185 +@@ -50,6 +50,7 @@
5186 + #define TI_XDS100V2_PID 0xa6d0
5187 +
5188 + #define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */
5189 ++#define FTDI_EV3CON_PID 0xABB9 /* Mindstorms EV3 Console Adapter */
5190 +
5191 + /* US Interface Navigator (http://www.usinterface.com/) */
5192 + #define FTDI_USINT_CAT_PID 0xb810 /* Navigator CAT and 2nd PTT lines */
5193 +@@ -363,6 +364,12 @@
5194 + /* Sprog II (Andrew Crosland's SprogII DCC interface) */
5195 + #define FTDI_SPROG_II 0xF0C8
5196 +
5197 ++/*
5198 ++ * Two of the Tagsys RFID Readers
5199 ++ */
5200 ++#define FTDI_TAGSYS_LP101_PID 0xF0E9 /* Tagsys L-P101 RFID*/
5201 ++#define FTDI_TAGSYS_P200X_PID 0xF0EE /* Tagsys Medio P200x RFID*/
5202 ++
5203 + /* an infrared receiver for user access control with IR tags */
5204 + #define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
5205 +
5206 +@@ -1307,3 +1314,15 @@
5207 + * Manufacturer: Crucible Technologies
5208 + */
5209 + #define FTDI_CT_COMET_PID 0x8e08
5210 ++
5211 ++/*
5212 ++ * Product: Z3X Box
5213 ++ * Manufacturer: Smart GSM Team
5214 ++ */
5215 ++#define FTDI_Z3X_PID 0x0011
5216 ++
5217 ++/*
5218 ++ * Product: Cressi PC Interface
5219 ++ * Manufacturer: Cressi
5220 ++ */
5221 ++#define FTDI_CRESSI_PID 0x87d0
5222 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
5223 +index d6d0fb4..5f5047f 100644
5224 +--- a/drivers/usb/serial/option.c
5225 ++++ b/drivers/usb/serial/option.c
5226 +@@ -325,6 +325,9 @@ static void option_instat_callback(struct urb *urb);
5227 + * It seems to contain a Qualcomm QSC6240/6290 chipset */
5228 + #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
5229 +
5230 ++/* iBall 3.5G connect wireless modem */
5231 ++#define IBALL_3_5G_CONNECT 0x9605
5232 ++
5233 + /* Zoom */
5234 + #define ZOOM_PRODUCT_4597 0x9607
5235 +
5236 +@@ -1373,7 +1376,8 @@ static const struct usb_device_id option_ids[] = {
5237 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1267, 0xff, 0xff, 0xff) },
5238 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1268, 0xff, 0xff, 0xff) },
5239 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1269, 0xff, 0xff, 0xff) },
5240 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff) },
5241 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff),
5242 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
5243 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1271, 0xff, 0xff, 0xff) },
5244 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
5245 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
5246 +@@ -1461,6 +1465,17 @@ static const struct usb_device_id option_ids[] = {
5247 + .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
5248 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
5249 + .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
5250 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) },
5251 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8b, 0xff, 0xff, 0xff) },
5252 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8c, 0xff, 0xff, 0xff) },
5253 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8d, 0xff, 0xff, 0xff) },
5254 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8e, 0xff, 0xff, 0xff) },
5255 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8f, 0xff, 0xff, 0xff) },
5256 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff90, 0xff, 0xff, 0xff) },
5257 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff91, 0xff, 0xff, 0xff) },
5258 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) },
5259 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) },
5260 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) },
5261 +
5262 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
5263 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
5264 +@@ -1509,6 +1524,7 @@ static const struct usb_device_id option_ids[] = {
5265 + .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
5266 + },
5267 + { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
5268 ++ { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
5269 + { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
5270 + /* Pirelli */
5271 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)},
5272 +@@ -1530,7 +1546,8 @@ static const struct usb_device_id option_ids[] = {
5273 + /* Cinterion */
5274 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
5275 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
5276 +- { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
5277 ++ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8),
5278 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
5279 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
5280 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
5281 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
5282 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
5283 +index e3936c1..7b29317 100644
5284 +--- a/drivers/usb/serial/pl2303.c
5285 ++++ b/drivers/usb/serial/pl2303.c
5286 +@@ -153,6 +153,8 @@ struct pl2303_private {
5287 + u8 line_control;
5288 + u8 line_status;
5289 + enum pl2303_type type;
5290 ++
5291 ++ u8 line_settings[7];
5292 + };
5293 +
5294 + static int pl2303_vendor_read(__u16 value, __u16 index,
5295 +@@ -266,10 +268,6 @@ static void pl2303_set_termios(struct tty_struct *tty,
5296 +
5297 + dbg("%s - port %d", __func__, port->number);
5298 +
5299 +- /* The PL2303 is reported to lose bytes if you change
5300 +- serial settings even to the same values as before. Thus
5301 +- we actually need to filter in this specific case */
5302 +-
5303 + if (old_termios && !tty_termios_hw_change(tty->termios, old_termios))
5304 + return;
5305 +
5306 +@@ -407,10 +405,29 @@ static void pl2303_set_termios(struct tty_struct *tty,
5307 + dbg("%s - parity = none", __func__);
5308 + }
5309 +
5310 +- i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
5311 +- SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
5312 +- 0, 0, buf, 7, 100);
5313 +- dbg("0x21:0x20:0:0 %d", i);
5314 ++ /*
5315 ++ * Some PL2303 are known to lose bytes if you change serial settings
5316 ++ * even to the same values as before. Thus we actually need to filter
5317 ++ * in this specific case.
5318 ++ *
5319 ++ * Note that the tty_termios_hw_change check above is not sufficient
5320 ++ * as a previously requested baud rate may differ from the one
5321 ++ * actually used (and stored in old_termios).
5322 ++ *
5323 ++ * NOTE: No additional locking needed for line_settings as it is
5324 ++ * only used in set_termios, which is serialised against itself.
5325 ++ */
5326 ++ if (!old_termios || memcmp(buf, priv->line_settings, 7)) {
5327 ++ i = usb_control_msg(serial->dev,
5328 ++ usb_sndctrlpipe(serial->dev, 0),
5329 ++ SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
5330 ++ 0, 0, buf, 7, 100);
5331 ++
5332 ++ dbg("0x21:0x20:0:0 %d", i);
5333 ++
5334 ++ if (i == 7)
5335 ++ memcpy(priv->line_settings, buf, 7);
5336 ++ }
5337 +
5338 + /* change control lines if we are switching to or from B0 */
5339 + spin_lock_irqsave(&priv->lock, flags);
5340 +diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
5341 +index 303c34b..3460ee8 100644
5342 +--- a/drivers/usb/storage/Kconfig
5343 ++++ b/drivers/usb/storage/Kconfig
5344 +@@ -19,7 +19,9 @@ config USB_STORAGE
5345 +
5346 + This option depends on 'SCSI' support being enabled, but you
5347 + probably also need 'SCSI device support: SCSI disk support'
5348 +- (BLK_DEV_SD) for most USB storage devices.
5349 ++ (BLK_DEV_SD) for most USB storage devices. Some devices also
5350 ++ will require 'Probe all LUNs on each SCSI device'
5351 ++ (SCSI_MULTI_LUN).
5352 +
5353 + To compile this driver as a module, choose M here: the
5354 + module will be called usb-storage.
5355 +diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
5356 +index 13b8bcd..eb660bb 100644
5357 +--- a/drivers/usb/storage/scsiglue.c
5358 ++++ b/drivers/usb/storage/scsiglue.c
5359 +@@ -116,6 +116,10 @@ static int slave_alloc (struct scsi_device *sdev)
5360 + if (us->subclass == USB_SC_UFI)
5361 + sdev->sdev_target->pdt_1f_for_no_lun = 1;
5362 +
5363 ++ /* Tell the SCSI layer if we know there is more than one LUN */
5364 ++ if (us->protocol == USB_PR_BULK && us->max_lun > 0)
5365 ++ sdev->sdev_bflags |= BLIST_FORCELUN;
5366 ++
5367 + return 0;
5368 + }
5369 +
5370 +diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h
5371 +index 65a6a75..82e8ed0 100644
5372 +--- a/drivers/usb/storage/unusual_cypress.h
5373 ++++ b/drivers/usb/storage/unusual_cypress.h
5374 +@@ -31,7 +31,7 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
5375 + "Cypress ISD-300LP",
5376 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
5377 +
5378 +-UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x0219,
5379 ++UNUSUAL_DEV( 0x14cd, 0x6116, 0x0160, 0x0160,
5380 + "Super Top",
5381 + "USB 2.0 SATA BRIDGE",
5382 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
5383 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
5384 +index 8a3b531..08711bc 100644
5385 +--- a/drivers/usb/storage/unusual_devs.h
5386 ++++ b/drivers/usb/storage/unusual_devs.h
5387 +@@ -226,6 +226,13 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
5388 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5389 + US_FL_MAX_SECTORS_64 ),
5390 +
5391 ++/* Patch submitted by Mikhail Zolotaryov <lebon@×××××××××.ua> */
5392 ++UNUSUAL_DEV( 0x0421, 0x06aa, 0x1110, 0x1110,
5393 ++ "Nokia",
5394 ++ "502",
5395 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5396 ++ US_FL_MAX_SECTORS_64 ),
5397 ++
5398 + #ifdef NO_SDDR09
5399 + UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
5400 + "Microtech",
5401 +@@ -1434,6 +1441,13 @@ UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100,
5402 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5403 + US_FL_FIX_CAPACITY ),
5404 +
5405 ++/* Reported by Moritz Moeller-Herrmann <moritz-kernel@××××××××××××××××.de> */
5406 ++UNUSUAL_DEV( 0x0fca, 0x8004, 0x0201, 0x0201,
5407 ++ "Research In Motion",
5408 ++ "BlackBerry Bold 9000",
5409 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5410 ++ US_FL_MAX_SECTORS_64 ),
5411 ++
5412 + /* Reported by Michael Stattmann <michael@×××××××××.com> */
5413 + UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
5414 + "Sony Ericsson",
5415 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
5416 +index 49eefdb..f63719a 100644
5417 +--- a/fs/btrfs/extent-tree.c
5418 ++++ b/fs/btrfs/extent-tree.c
5419 +@@ -6725,7 +6725,7 @@ out:
5420 + */
5421 + if (root_dropped == false)
5422 + btrfs_add_dead_root(root);
5423 +- if (err)
5424 ++ if (err && err != -EAGAIN)
5425 + btrfs_std_error(root->fs_info, err);
5426 + return;
5427 + }
5428 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
5429 +index 1372634..622d322 100644
5430 +--- a/fs/btrfs/inode.c
5431 ++++ b/fs/btrfs/inode.c
5432 +@@ -56,7 +56,7 @@
5433 + #include "inode-map.h"
5434 +
5435 + struct btrfs_iget_args {
5436 +- u64 ino;
5437 ++ struct btrfs_key *location;
5438 + struct btrfs_root *root;
5439 + };
5440 +
5441 +@@ -3847,7 +3847,9 @@ again:
5442 + static int btrfs_init_locked_inode(struct inode *inode, void *p)
5443 + {
5444 + struct btrfs_iget_args *args = p;
5445 +- inode->i_ino = args->ino;
5446 ++ inode->i_ino = args->location->objectid;
5447 ++ memcpy(&BTRFS_I(inode)->location, args->location,
5448 ++ sizeof(*args->location));
5449 + BTRFS_I(inode)->root = args->root;
5450 + btrfs_set_inode_space_info(args->root, inode);
5451 + return 0;
5452 +@@ -3856,20 +3858,20 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
5453 + static int btrfs_find_actor(struct inode *inode, void *opaque)
5454 + {
5455 + struct btrfs_iget_args *args = opaque;
5456 +- return args->ino == btrfs_ino(inode) &&
5457 ++ return args->location->objectid == BTRFS_I(inode)->location.objectid &&
5458 + args->root == BTRFS_I(inode)->root;
5459 + }
5460 +
5461 + static struct inode *btrfs_iget_locked(struct super_block *s,
5462 +- u64 objectid,
5463 ++ struct btrfs_key *location,
5464 + struct btrfs_root *root)
5465 + {
5466 + struct inode *inode;
5467 + struct btrfs_iget_args args;
5468 +- args.ino = objectid;
5469 ++ args.location = location;
5470 + args.root = root;
5471 +
5472 +- inode = iget5_locked(s, objectid, btrfs_find_actor,
5473 ++ inode = iget5_locked(s, location->objectid, btrfs_find_actor,
5474 + btrfs_init_locked_inode,
5475 + (void *)&args);
5476 + return inode;
5477 +@@ -3883,13 +3885,11 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
5478 + {
5479 + struct inode *inode;
5480 +
5481 +- inode = btrfs_iget_locked(s, location->objectid, root);
5482 ++ inode = btrfs_iget_locked(s, location, root);
5483 + if (!inode)
5484 + return ERR_PTR(-ENOMEM);
5485 +
5486 + if (inode->i_state & I_NEW) {
5487 +- BTRFS_I(inode)->root = root;
5488 +- memcpy(&BTRFS_I(inode)->location, location, sizeof(*location));
5489 + btrfs_read_locked_inode(inode);
5490 + if (!is_bad_inode(inode)) {
5491 + inode_tree_add(inode);
5492 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
5493 +index 618ae6f..7cbe2f8 100644
5494 +--- a/fs/btrfs/ioctl.c
5495 ++++ b/fs/btrfs/ioctl.c
5496 +@@ -1327,12 +1327,17 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
5497 + printk(KERN_INFO "btrfs: Snapshot src from "
5498 + "another FS\n");
5499 + ret = -EINVAL;
5500 +- fput(src_file);
5501 +- goto out;
5502 ++ } else if (!inode_owner_or_capable(src_inode)) {
5503 ++ /*
5504 ++ * Subvolume creation is not restricted, but snapshots
5505 ++ * are limited to own subvolumes only
5506 ++ */
5507 ++ ret = -EPERM;
5508 ++ } else {
5509 ++ ret = btrfs_mksubvol(&file->f_path, name, namelen,
5510 ++ BTRFS_I(src_inode)->root,
5511 ++ transid, readonly);
5512 + }
5513 +- ret = btrfs_mksubvol(&file->f_path, name, namelen,
5514 +- BTRFS_I(src_inode)->root,
5515 +- transid, readonly);
5516 + fput(src_file);
5517 + }
5518 + out:
5519 +diff --git a/fs/buffer.c b/fs/buffer.c
5520 +index 19a4f0b..5f4bde2 100644
5521 +--- a/fs/buffer.c
5522 ++++ b/fs/buffer.c
5523 +@@ -663,14 +663,16 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
5524 + static void __set_page_dirty(struct page *page,
5525 + struct address_space *mapping, int warn)
5526 + {
5527 +- spin_lock_irq(&mapping->tree_lock);
5528 ++ unsigned long flags;
5529 ++
5530 ++ spin_lock_irqsave(&mapping->tree_lock, flags);
5531 + if (page->mapping) { /* Race with truncate? */
5532 + WARN_ON_ONCE(warn && !PageUptodate(page));
5533 + account_page_dirtied(page, mapping);
5534 + radix_tree_tag_set(&mapping->page_tree,
5535 + page_index(page), PAGECACHE_TAG_DIRTY);
5536 + }
5537 +- spin_unlock_irq(&mapping->tree_lock);
5538 ++ spin_unlock_irqrestore(&mapping->tree_lock, flags);
5539 + __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
5540 + }
5541 +
5542 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
5543 +index 56c152d..49d6e21 100644
5544 +--- a/fs/cifs/connect.c
5545 ++++ b/fs/cifs/connect.c
5546 +@@ -1113,7 +1113,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
5547 + cERROR(1, "Krb5 cifs privacy not supported");
5548 + goto cifs_parse_mount_err;
5549 + } else if (strnicmp(value, "krb5", 4) == 0) {
5550 +- vol->secFlg |= CIFSSEC_MAY_KRB5;
5551 ++ vol->secFlg |= CIFSSEC_MAY_KRB5 |
5552 ++ CIFSSEC_MAY_SIGN;
5553 + } else if (strnicmp(value, "ntlmsspi", 8) == 0) {
5554 + vol->secFlg |= CIFSSEC_MAY_NTLMSSP |
5555 + CIFSSEC_MUST_SIGN;
5556 +diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
5557 +index 26bb512..df4a10f 100644
5558 +--- a/fs/exofs/ore.c
5559 ++++ b/fs/exofs/ore.c
5560 +@@ -103,7 +103,7 @@ int ore_verify_layout(unsigned total_comps, struct ore_layout *layout)
5561 +
5562 + layout->max_io_length =
5563 + (BIO_MAX_PAGES_KMALLOC * PAGE_SIZE - layout->stripe_unit) *
5564 +- layout->group_width;
5565 ++ (layout->group_width - layout->parity);
5566 + if (layout->parity) {
5567 + unsigned stripe_length =
5568 + (layout->group_width - layout->parity) *
5569 +@@ -286,7 +286,8 @@ int ore_get_rw_state(struct ore_layout *layout, struct ore_components *oc,
5570 + if (length) {
5571 + ore_calc_stripe_info(layout, offset, length, &ios->si);
5572 + ios->length = ios->si.length;
5573 +- ios->nr_pages = (ios->length + PAGE_SIZE - 1) / PAGE_SIZE;
5574 ++ ios->nr_pages = ((ios->offset & (PAGE_SIZE - 1)) +
5575 ++ ios->length + PAGE_SIZE - 1) / PAGE_SIZE;
5576 + if (layout->parity)
5577 + _ore_post_alloc_raid_stuff(ios);
5578 + }
5579 +@@ -536,6 +537,7 @@ void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset,
5580 + u64 H = LmodS - G * T;
5581 +
5582 + u32 N = div_u64(H, U);
5583 ++ u32 Nlast;
5584 +
5585 + /* "H - (N * U)" is just "H % U" so it's bound to u32 */
5586 + u32 C = (u32)(H - (N * U)) / stripe_unit + G * group_width;
5587 +@@ -568,6 +570,10 @@ void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset,
5588 + si->length = T - H;
5589 + if (si->length > length)
5590 + si->length = length;
5591 ++
5592 ++ Nlast = div_u64(H + si->length + U - 1, U);
5593 ++ si->maxdevUnits = Nlast - N;
5594 ++
5595 + si->M = M;
5596 + }
5597 + EXPORT_SYMBOL(ore_calc_stripe_info);
5598 +@@ -583,13 +589,16 @@ int _ore_add_stripe_unit(struct ore_io_state *ios, unsigned *cur_pg,
5599 + int ret;
5600 +
5601 + if (per_dev->bio == NULL) {
5602 +- unsigned pages_in_stripe = ios->layout->group_width *
5603 +- (ios->layout->stripe_unit / PAGE_SIZE);
5604 +- unsigned nr_pages = ios->nr_pages * ios->layout->group_width /
5605 +- (ios->layout->group_width -
5606 +- ios->layout->parity);
5607 +- unsigned bio_size = (nr_pages + pages_in_stripe) /
5608 +- ios->layout->group_width;
5609 ++ unsigned bio_size;
5610 ++
5611 ++ if (!ios->reading) {
5612 ++ bio_size = ios->si.maxdevUnits;
5613 ++ } else {
5614 ++ bio_size = (ios->si.maxdevUnits + 1) *
5615 ++ (ios->layout->group_width - ios->layout->parity) /
5616 ++ ios->layout->group_width;
5617 ++ }
5618 ++ bio_size *= (ios->layout->stripe_unit / PAGE_SIZE);
5619 +
5620 + per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);
5621 + if (unlikely(!per_dev->bio)) {
5622 +@@ -609,8 +618,12 @@ int _ore_add_stripe_unit(struct ore_io_state *ios, unsigned *cur_pg,
5623 + added_len = bio_add_pc_page(q, per_dev->bio, pages[pg],
5624 + pglen, pgbase);
5625 + if (unlikely(pglen != added_len)) {
5626 +- ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=%u\n",
5627 +- per_dev->bio->bi_vcnt);
5628 ++ /* If bi_vcnt == bi_max then this is a SW BUG */
5629 ++ ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=0x%x "
5630 ++ "bi_max=0x%x BIO_MAX=0x%x cur_len=0x%x\n",
5631 ++ per_dev->bio->bi_vcnt,
5632 ++ per_dev->bio->bi_max_vecs,
5633 ++ BIO_MAX_PAGES_KMALLOC, cur_len);
5634 + ret = -ENOMEM;
5635 + goto out;
5636 + }
5637 +@@ -1099,7 +1112,7 @@ int ore_truncate(struct ore_layout *layout, struct ore_components *oc,
5638 + size_attr->attr = g_attr_logical_length;
5639 + size_attr->attr.val_ptr = &size_attr->newsize;
5640 +
5641 +- ORE_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",
5642 ++ ORE_DBGMSG2("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",
5643 + _LLU(oc->comps->obj.id), _LLU(obj_size), i);
5644 + ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1,
5645 + &size_attr->attr);
5646 +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
5647 +index 68b1602..40f4d06 100644
5648 +--- a/fs/ext4/ext4.h
5649 ++++ b/fs/ext4/ext4.h
5650 +@@ -745,6 +745,8 @@ do { \
5651 + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
5652 + (einode)->xtime.tv_sec = \
5653 + (signed)le32_to_cpu((raw_inode)->xtime); \
5654 ++ else \
5655 ++ (einode)->xtime.tv_sec = 0; \
5656 + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
5657 + ext4_decode_extra_time(&(einode)->xtime, \
5658 + raw_inode->xtime ## _extra); \
5659 +diff --git a/fs/file.c b/fs/file.c
5660 +index 4c6992d..30bfc99 100644
5661 +--- a/fs/file.c
5662 ++++ b/fs/file.c
5663 +@@ -47,7 +47,7 @@ static void *alloc_fdmem(unsigned int size)
5664 + * vmalloc() if the allocation size will be considered "large" by the VM.
5665 + */
5666 + if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
5667 +- void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);
5668 ++ void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY);
5669 + if (data != NULL)
5670 + return data;
5671 + }
5672 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
5673 +index 5c029fb..cf0098d 100644
5674 +--- a/fs/fuse/dev.c
5675 ++++ b/fs/fuse/dev.c
5676 +@@ -1199,22 +1199,6 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
5677 + return fuse_dev_do_read(fc, file, &cs, iov_length(iov, nr_segs));
5678 + }
5679 +
5680 +-static int fuse_dev_pipe_buf_steal(struct pipe_inode_info *pipe,
5681 +- struct pipe_buffer *buf)
5682 +-{
5683 +- return 1;
5684 +-}
5685 +-
5686 +-static const struct pipe_buf_operations fuse_dev_pipe_buf_ops = {
5687 +- .can_merge = 0,
5688 +- .map = generic_pipe_buf_map,
5689 +- .unmap = generic_pipe_buf_unmap,
5690 +- .confirm = generic_pipe_buf_confirm,
5691 +- .release = generic_pipe_buf_release,
5692 +- .steal = fuse_dev_pipe_buf_steal,
5693 +- .get = generic_pipe_buf_get,
5694 +-};
5695 +-
5696 + static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
5697 + struct pipe_inode_info *pipe,
5698 + size_t len, unsigned int flags)
5699 +@@ -1261,7 +1245,11 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
5700 + buf->page = bufs[page_nr].page;
5701 + buf->offset = bufs[page_nr].offset;
5702 + buf->len = bufs[page_nr].len;
5703 +- buf->ops = &fuse_dev_pipe_buf_ops;
5704 ++ /*
5705 ++ * Need to be careful about this. Having buf->ops in module
5706 ++ * code can Oops if the buffer persists after module unload.
5707 ++ */
5708 ++ buf->ops = &nosteal_pipe_buf_ops;
5709 +
5710 + pipe->nrbufs++;
5711 + page_nr++;
5712 +diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c
5713 +index 7a5eb2c..e0d57c0 100644
5714 +--- a/fs/hpfs/alloc.c
5715 ++++ b/fs/hpfs/alloc.c
5716 +@@ -8,6 +8,58 @@
5717 +
5718 + #include "hpfs_fn.h"
5719 +
5720 ++static void hpfs_claim_alloc(struct super_block *s, secno sec)
5721 ++{
5722 ++ struct hpfs_sb_info *sbi = hpfs_sb(s);
5723 ++ if (sbi->sb_n_free != (unsigned)-1) {
5724 ++ if (unlikely(!sbi->sb_n_free)) {
5725 ++ hpfs_error(s, "free count underflow, allocating sector %08x", sec);
5726 ++ sbi->sb_n_free = -1;
5727 ++ return;
5728 ++ }
5729 ++ sbi->sb_n_free--;
5730 ++ }
5731 ++}
5732 ++
5733 ++static void hpfs_claim_free(struct super_block *s, secno sec)
5734 ++{
5735 ++ struct hpfs_sb_info *sbi = hpfs_sb(s);
5736 ++ if (sbi->sb_n_free != (unsigned)-1) {
5737 ++ if (unlikely(sbi->sb_n_free >= sbi->sb_fs_size)) {
5738 ++ hpfs_error(s, "free count overflow, freeing sector %08x", sec);
5739 ++ sbi->sb_n_free = -1;
5740 ++ return;
5741 ++ }
5742 ++ sbi->sb_n_free++;
5743 ++ }
5744 ++}
5745 ++
5746 ++static void hpfs_claim_dirband_alloc(struct super_block *s, secno sec)
5747 ++{
5748 ++ struct hpfs_sb_info *sbi = hpfs_sb(s);
5749 ++ if (sbi->sb_n_free_dnodes != (unsigned)-1) {
5750 ++ if (unlikely(!sbi->sb_n_free_dnodes)) {
5751 ++ hpfs_error(s, "dirband free count underflow, allocating sector %08x", sec);
5752 ++ sbi->sb_n_free_dnodes = -1;
5753 ++ return;
5754 ++ }
5755 ++ sbi->sb_n_free_dnodes--;
5756 ++ }
5757 ++}
5758 ++
5759 ++static void hpfs_claim_dirband_free(struct super_block *s, secno sec)
5760 ++{
5761 ++ struct hpfs_sb_info *sbi = hpfs_sb(s);
5762 ++ if (sbi->sb_n_free_dnodes != (unsigned)-1) {
5763 ++ if (unlikely(sbi->sb_n_free_dnodes >= sbi->sb_dirband_size / 4)) {
5764 ++ hpfs_error(s, "dirband free count overflow, freeing sector %08x", sec);
5765 ++ sbi->sb_n_free_dnodes = -1;
5766 ++ return;
5767 ++ }
5768 ++ sbi->sb_n_free_dnodes++;
5769 ++ }
5770 ++}
5771 ++
5772 + /*
5773 + * Check if a sector is allocated in bitmap
5774 + * This is really slow. Turned on only if chk==2
5775 +@@ -203,9 +255,15 @@ secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forwa
5776 + }
5777 + sec = 0;
5778 + ret:
5779 ++ if (sec) {
5780 ++ i = 0;
5781 ++ do
5782 ++ hpfs_claim_alloc(s, sec + i);
5783 ++ while (unlikely(++i < n));
5784 ++ }
5785 + if (sec && f_p) {
5786 + for (i = 0; i < forward; i++) {
5787 +- if (!hpfs_alloc_if_possible(s, sec + i + 1)) {
5788 ++ if (!hpfs_alloc_if_possible(s, sec + n + i)) {
5789 + hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i);
5790 + sec = 0;
5791 + break;
5792 +@@ -228,6 +286,7 @@ static secno alloc_in_dirband(struct super_block *s, secno near)
5793 + nr >>= 2;
5794 + sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0);
5795 + if (!sec) return 0;
5796 ++ hpfs_claim_dirband_alloc(s, sec);
5797 + return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start;
5798 + }
5799 +
5800 +@@ -242,6 +301,7 @@ int hpfs_alloc_if_possible(struct super_block *s, secno sec)
5801 + bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f)));
5802 + hpfs_mark_4buffers_dirty(&qbh);
5803 + hpfs_brelse4(&qbh);
5804 ++ hpfs_claim_alloc(s, sec);
5805 + return 1;
5806 + }
5807 + hpfs_brelse4(&qbh);
5808 +@@ -275,6 +335,7 @@ void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n)
5809 + return;
5810 + }
5811 + bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f));
5812 ++ hpfs_claim_free(s, sec);
5813 + if (!--n) {
5814 + hpfs_mark_4buffers_dirty(&qbh);
5815 + hpfs_brelse4(&qbh);
5816 +@@ -359,6 +420,7 @@ void hpfs_free_dnode(struct super_block *s, dnode_secno dno)
5817 + bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f));
5818 + hpfs_mark_4buffers_dirty(&qbh);
5819 + hpfs_brelse4(&qbh);
5820 ++ hpfs_claim_dirband_free(s, dno);
5821 + }
5822 + }
5823 +
5824 +@@ -366,7 +428,7 @@ struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near,
5825 + dnode_secno *dno, struct quad_buffer_head *qbh)
5826 + {
5827 + struct dnode *d;
5828 +- if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) {
5829 ++ if (hpfs_get_free_dnodes(s) > FREE_DNODES_ADD) {
5830 + if (!(*dno = alloc_in_dirband(s, near)))
5831 + if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL;
5832 + } else {
5833 +diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
5834 +index 2fa0089..46549c7 100644
5835 +--- a/fs/hpfs/dir.c
5836 ++++ b/fs/hpfs/dir.c
5837 +@@ -33,25 +33,27 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
5838 + if (whence == SEEK_DATA || whence == SEEK_HOLE)
5839 + return -EINVAL;
5840 +
5841 ++ mutex_lock(&i->i_mutex);
5842 + hpfs_lock(s);
5843 +
5844 + /*printk("dir lseek\n");*/
5845 + if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
5846 +- mutex_lock(&i->i_mutex);
5847 + pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1;
5848 + while (pos != new_off) {
5849 + if (map_pos_dirent(i, &pos, &qbh)) hpfs_brelse4(&qbh);
5850 + else goto fail;
5851 + if (pos == 12) goto fail;
5852 + }
5853 +- mutex_unlock(&i->i_mutex);
5854 ++ hpfs_add_pos(i, &filp->f_pos);
5855 + ok:
5856 ++ filp->f_pos = new_off;
5857 + hpfs_unlock(s);
5858 +- return filp->f_pos = new_off;
5859 +-fail:
5860 + mutex_unlock(&i->i_mutex);
5861 ++ return new_off;
5862 ++fail:
5863 + /*printk("illegal lseek: %016llx\n", new_off);*/
5864 + hpfs_unlock(s);
5865 ++ mutex_unlock(&i->i_mutex);
5866 + return -ESPIPE;
5867 + }
5868 +
5869 +diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
5870 +index de94617..f1f2ca7 100644
5871 +--- a/fs/hpfs/hpfs_fn.h
5872 ++++ b/fs/hpfs/hpfs_fn.h
5873 +@@ -314,7 +314,7 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
5874 + __printf(2, 3)
5875 + void hpfs_error(struct super_block *, const char *, ...);
5876 + int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
5877 +-unsigned hpfs_count_one_bitmap(struct super_block *, secno);
5878 ++unsigned hpfs_get_free_dnodes(struct super_block *);
5879 +
5880 + /*
5881 + * local time (HPFS) to GMT (Unix)
5882 +diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
5883 +index f760c15..b03e766 100644
5884 +--- a/fs/hpfs/super.c
5885 ++++ b/fs/hpfs/super.c
5886 +@@ -115,7 +115,7 @@ static void hpfs_put_super(struct super_block *s)
5887 + kfree(sbi);
5888 + }
5889 +
5890 +-unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
5891 ++static unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
5892 + {
5893 + struct quad_buffer_head qbh;
5894 + unsigned long *bits;
5895 +@@ -123,7 +123,7 @@ unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
5896 +
5897 + bits = hpfs_map_4sectors(s, secno, &qbh, 4);
5898 + if (!bits)
5899 +- return 0;
5900 ++ return (unsigned)-1;
5901 + count = bitmap_weight(bits, 2048 * BITS_PER_BYTE);
5902 + hpfs_brelse4(&qbh);
5903 + return count;
5904 +@@ -134,29 +134,45 @@ static unsigned count_bitmaps(struct super_block *s)
5905 + unsigned n, count, n_bands;
5906 + n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
5907 + count = 0;
5908 +- for (n = 0; n < n_bands; n++)
5909 +- count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n]));
5910 ++ for (n = 0; n < n_bands; n++) {
5911 ++ unsigned c;
5912 ++ c = hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n]));
5913 ++ if (c != (unsigned)-1)
5914 ++ count += c;
5915 ++ }
5916 + return count;
5917 + }
5918 +
5919 ++unsigned hpfs_get_free_dnodes(struct super_block *s)
5920 ++{
5921 ++ struct hpfs_sb_info *sbi = hpfs_sb(s);
5922 ++ if (sbi->sb_n_free_dnodes == (unsigned)-1) {
5923 ++ unsigned c = hpfs_count_one_bitmap(s, sbi->sb_dmap);
5924 ++ if (c == (unsigned)-1)
5925 ++ return 0;
5926 ++ sbi->sb_n_free_dnodes = c;
5927 ++ }
5928 ++ return sbi->sb_n_free_dnodes;
5929 ++}
5930 ++
5931 + static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf)
5932 + {
5933 + struct super_block *s = dentry->d_sb;
5934 + struct hpfs_sb_info *sbi = hpfs_sb(s);
5935 + u64 id = huge_encode_dev(s->s_bdev->bd_dev);
5936 ++
5937 + hpfs_lock(s);
5938 +
5939 +- /*if (sbi->sb_n_free == -1) {*/
5940 ++ if (sbi->sb_n_free == (unsigned)-1)
5941 + sbi->sb_n_free = count_bitmaps(s);
5942 +- sbi->sb_n_free_dnodes = hpfs_count_one_bitmap(s, sbi->sb_dmap);
5943 +- /*}*/
5944 ++
5945 + buf->f_type = s->s_magic;
5946 + buf->f_bsize = 512;
5947 + buf->f_blocks = sbi->sb_fs_size;
5948 + buf->f_bfree = sbi->sb_n_free;
5949 + buf->f_bavail = sbi->sb_n_free;
5950 + buf->f_files = sbi->sb_dirband_size / 4;
5951 +- buf->f_ffree = sbi->sb_n_free_dnodes;
5952 ++ buf->f_ffree = hpfs_get_free_dnodes(s);
5953 + buf->f_fsid.val[0] = (u32)id;
5954 + buf->f_fsid.val[1] = (u32)(id >> 32);
5955 + buf->f_namelen = 254;
5956 +diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
5957 +index cd8703d..cb7b186 100644
5958 +--- a/fs/lockd/svclock.c
5959 ++++ b/fs/lockd/svclock.c
5960 +@@ -741,6 +741,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)
5961 + struct nlm_file *file = block->b_file;
5962 + struct nlm_lock *lock = &block->b_call->a_args.lock;
5963 + int error;
5964 ++ loff_t fl_start, fl_end;
5965 +
5966 + dprintk("lockd: grant blocked lock %p\n", block);
5967 +
5968 +@@ -758,9 +759,16 @@ nlmsvc_grant_blocked(struct nlm_block *block)
5969 + }
5970 +
5971 + /* Try the lock operation again */
5972 ++ /* vfs_lock_file() can mangle fl_start and fl_end, but we need
5973 ++ * them unchanged for the GRANT_MSG
5974 ++ */
5975 + lock->fl.fl_flags |= FL_SLEEP;
5976 ++ fl_start = lock->fl.fl_start;
5977 ++ fl_end = lock->fl.fl_end;
5978 + error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);
5979 + lock->fl.fl_flags &= ~FL_SLEEP;
5980 ++ lock->fl.fl_start = fl_start;
5981 ++ lock->fl.fl_end = fl_end;
5982 +
5983 + switch (error) {
5984 + case 0:
5985 +diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c
5986 +index 4e2ee99..bb15ccc 100644
5987 +--- a/fs/nfs/blocklayout/extents.c
5988 ++++ b/fs/nfs/blocklayout/extents.c
5989 +@@ -44,7 +44,7 @@
5990 + static inline sector_t normalize(sector_t s, int base)
5991 + {
5992 + sector_t tmp = s; /* Since do_div modifies its argument */
5993 +- return s - do_div(tmp, base);
5994 ++ return s - sector_div(tmp, base);
5995 + }
5996 +
5997 + static inline sector_t normalize_up(sector_t s, int base)
5998 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
5999 +index 3d02931..5aea30a 100644
6000 +--- a/fs/nfs/nfs4proc.c
6001 ++++ b/fs/nfs/nfs4proc.c
6002 +@@ -6197,7 +6197,7 @@ nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle,
6003 + switch (err) {
6004 + case 0:
6005 + case -NFS4ERR_WRONGSEC:
6006 +- case -NFS4ERR_NOTSUPP:
6007 ++ case -ENOTSUPP:
6008 + goto out;
6009 + default:
6010 + err = nfs4_handle_exception(server, err, &exception);
6011 +@@ -6229,7 +6229,7 @@ nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
6012 + * Fall back on "guess and check" method if
6013 + * the server doesn't support SECINFO_NO_NAME
6014 + */
6015 +- if (err == -NFS4ERR_WRONGSEC || err == -NFS4ERR_NOTSUPP) {
6016 ++ if (err == -NFS4ERR_WRONGSEC || err == -ENOTSUPP) {
6017 + err = nfs4_find_root_sec(server, fhandle, info);
6018 + goto out_freepage;
6019 + }
6020 +diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
6021 +index 00818c8..4479f66 100644
6022 +--- a/fs/nfs/nfs4xdr.c
6023 ++++ b/fs/nfs/nfs4xdr.c
6024 +@@ -3056,7 +3056,8 @@ out_overflow:
6025 + return -EIO;
6026 + }
6027 +
6028 +-static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
6029 ++static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
6030 ++ int *nfs_retval)
6031 + {
6032 + __be32 *p;
6033 + uint32_t opnum;
6034 +@@ -3066,19 +3067,32 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
6035 + if (unlikely(!p))
6036 + goto out_overflow;
6037 + opnum = be32_to_cpup(p++);
6038 +- if (opnum != expected) {
6039 +- dprintk("nfs: Server returned operation"
6040 +- " %d but we issued a request for %d\n",
6041 +- opnum, expected);
6042 +- return -EIO;
6043 +- }
6044 ++ if (unlikely(opnum != expected))
6045 ++ goto out_bad_operation;
6046 + nfserr = be32_to_cpup(p);
6047 +- if (nfserr != NFS_OK)
6048 +- return nfs4_stat_to_errno(nfserr);
6049 +- return 0;
6050 ++ if (nfserr == NFS_OK)
6051 ++ *nfs_retval = 0;
6052 ++ else
6053 ++ *nfs_retval = nfs4_stat_to_errno(nfserr);
6054 ++ return true;
6055 ++out_bad_operation:
6056 ++ dprintk("nfs: Server returned operation"
6057 ++ " %d but we issued a request for %d\n",
6058 ++ opnum, expected);
6059 ++ *nfs_retval = -EREMOTEIO;
6060 ++ return false;
6061 + out_overflow:
6062 + print_overflow_msg(__func__, xdr);
6063 +- return -EIO;
6064 ++ *nfs_retval = -EIO;
6065 ++ return false;
6066 ++}
6067 ++
6068 ++static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
6069 ++{
6070 ++ int retval;
6071 ++
6072 ++ __decode_op_hdr(xdr, expected, &retval);
6073 ++ return retval;
6074 + }
6075 +
6076 + /* Dummy routine */
6077 +@@ -4744,11 +4758,12 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
6078 + uint32_t savewords, bmlen, i;
6079 + int status;
6080 +
6081 +- status = decode_op_hdr(xdr, OP_OPEN);
6082 +- if (status != -EIO)
6083 +- nfs_increment_open_seqid(status, res->seqid);
6084 +- if (!status)
6085 +- status = decode_stateid(xdr, &res->stateid);
6086 ++ if (!__decode_op_hdr(xdr, OP_OPEN, &status))
6087 ++ return status;
6088 ++ nfs_increment_open_seqid(status, res->seqid);
6089 ++ if (status)
6090 ++ return status;
6091 ++ status = decode_stateid(xdr, &res->stateid);
6092 + if (unlikely(status))
6093 + return status;
6094 +
6095 +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
6096 +index 1c7d45e..d20d64c 100644
6097 +--- a/fs/ocfs2/file.c
6098 ++++ b/fs/ocfs2/file.c
6099 +@@ -2389,8 +2389,8 @@ out_dio:
6100 +
6101 + if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
6102 + ((file->f_flags & O_DIRECT) && !direct_io)) {
6103 +- ret = filemap_fdatawrite_range(file->f_mapping, pos,
6104 +- pos + count - 1);
6105 ++ ret = filemap_fdatawrite_range(file->f_mapping, *ppos,
6106 ++ *ppos + count - 1);
6107 + if (ret < 0)
6108 + written = ret;
6109 +
6110 +@@ -2403,8 +2403,8 @@ out_dio:
6111 + }
6112 +
6113 + if (!ret)
6114 +- ret = filemap_fdatawait_range(file->f_mapping, pos,
6115 +- pos + count - 1);
6116 ++ ret = filemap_fdatawait_range(file->f_mapping, *ppos,
6117 ++ *ppos + count - 1);
6118 + }
6119 +
6120 + /*
6121 +diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
6122 +index 92fcd57..a40e5ce 100644
6123 +--- a/fs/ocfs2/quota_global.c
6124 ++++ b/fs/ocfs2/quota_global.c
6125 +@@ -712,6 +712,12 @@ static int ocfs2_release_dquot(struct dquot *dquot)
6126 + */
6127 + if (status < 0)
6128 + mlog_errno(status);
6129 ++ /*
6130 ++ * Clear dq_off so that we search for the structure in quota file next
6131 ++ * time we acquire it. The structure might be deleted and reallocated
6132 ++ * elsewhere by another node while our dquot structure is on freelist.
6133 ++ */
6134 ++ dquot->dq_off = 0;
6135 + clear_bit(DQ_ACTIVE_B, &dquot->dq_flags);
6136 + out_trans:
6137 + ocfs2_commit_trans(osb, handle);
6138 +@@ -750,16 +756,17 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
6139 + status = ocfs2_lock_global_qf(info, 1);
6140 + if (status < 0)
6141 + goto out;
6142 +- if (!test_bit(DQ_READ_B, &dquot->dq_flags)) {
6143 +- status = ocfs2_qinfo_lock(info, 0);
6144 +- if (status < 0)
6145 +- goto out_dq;
6146 +- status = qtree_read_dquot(&info->dqi_gi, dquot);
6147 +- ocfs2_qinfo_unlock(info, 0);
6148 +- if (status < 0)
6149 +- goto out_dq;
6150 +- }
6151 +- set_bit(DQ_READ_B, &dquot->dq_flags);
6152 ++ status = ocfs2_qinfo_lock(info, 0);
6153 ++ if (status < 0)
6154 ++ goto out_dq;
6155 ++ /*
6156 ++ * We always want to read dquot structure from disk because we don't
6157 ++ * know what happened with it while it was on freelist.
6158 ++ */
6159 ++ status = qtree_read_dquot(&info->dqi_gi, dquot);
6160 ++ ocfs2_qinfo_unlock(info, 0);
6161 ++ if (status < 0)
6162 ++ goto out_dq;
6163 +
6164 + OCFS2_DQUOT(dquot)->dq_use_count++;
6165 + OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
6166 +diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
6167 +index f100bf7..b6cfcf2 100644
6168 +--- a/fs/ocfs2/quota_local.c
6169 ++++ b/fs/ocfs2/quota_local.c
6170 +@@ -1300,10 +1300,6 @@ int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot)
6171 + ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh);
6172 +
6173 + out:
6174 +- /* Clear the read bit so that next time someone uses this
6175 +- * dquot he reads fresh info from disk and allocates local
6176 +- * dquot structure */
6177 +- clear_bit(DQ_READ_B, &dquot->dq_flags);
6178 + return status;
6179 + }
6180 +
6181 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
6182 +index 5b572c8..3d5d717 100644
6183 +--- a/fs/quota/dquot.c
6184 ++++ b/fs/quota/dquot.c
6185 +@@ -580,9 +580,17 @@ int dquot_scan_active(struct super_block *sb,
6186 + dqstats_inc(DQST_LOOKUPS);
6187 + dqput(old_dquot);
6188 + old_dquot = dquot;
6189 +- ret = fn(dquot, priv);
6190 +- if (ret < 0)
6191 +- goto out;
6192 ++ /*
6193 ++ * ->release_dquot() can be racing with us. Our reference
6194 ++ * protects us from new calls to it so just wait for any
6195 ++ * outstanding call and recheck the DQ_ACTIVE_B after that.
6196 ++ */
6197 ++ wait_on_dquot(dquot);
6198 ++ if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
6199 ++ ret = fn(dquot, priv);
6200 ++ if (ret < 0)
6201 ++ goto out;
6202 ++ }
6203 + spin_lock(&dq_list_lock);
6204 + /* We are safe to continue now because our dquot could not
6205 + * be moved out of the inuse list while we hold the reference */
6206 +diff --git a/fs/splice.c b/fs/splice.c
6207 +index 58ab918..714471d 100644
6208 +--- a/fs/splice.c
6209 ++++ b/fs/splice.c
6210 +@@ -554,6 +554,24 @@ static const struct pipe_buf_operations default_pipe_buf_ops = {
6211 + .get = generic_pipe_buf_get,
6212 + };
6213 +
6214 ++static int generic_pipe_buf_nosteal(struct pipe_inode_info *pipe,
6215 ++ struct pipe_buffer *buf)
6216 ++{
6217 ++ return 1;
6218 ++}
6219 ++
6220 ++/* Pipe buffer operations for a socket and similar. */
6221 ++const struct pipe_buf_operations nosteal_pipe_buf_ops = {
6222 ++ .can_merge = 0,
6223 ++ .map = generic_pipe_buf_map,
6224 ++ .unmap = generic_pipe_buf_unmap,
6225 ++ .confirm = generic_pipe_buf_confirm,
6226 ++ .release = generic_pipe_buf_release,
6227 ++ .steal = generic_pipe_buf_nosteal,
6228 ++ .get = generic_pipe_buf_get,
6229 ++};
6230 ++EXPORT_SYMBOL(nosteal_pipe_buf_ops);
6231 ++
6232 + static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
6233 + unsigned long vlen, loff_t offset)
6234 + {
6235 +diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
6236 +index 643d6c4..e2a360a 100644
6237 +--- a/include/linux/compiler-gcc4.h
6238 ++++ b/include/linux/compiler-gcc4.h
6239 +@@ -39,11 +39,7 @@
6240 + *
6241 + * (asm goto is automatically volatile - the naming reflects this.)
6242 + */
6243 +-#if GCC_VERSION <= 40801
6244 +-# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
6245 +-#else
6246 +-# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
6247 +-#endif
6248 ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
6249 +
6250 + #if __GNUC_MINOR__ >= 5
6251 + /*
6252 +diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
6253 +index 265e2c3..f5df3dc 100644
6254 +--- a/include/linux/jiffies.h
6255 ++++ b/include/linux/jiffies.h
6256 +@@ -106,13 +106,13 @@ static inline u64 get_jiffies_64(void)
6257 + #define time_after(a,b) \
6258 + (typecheck(unsigned long, a) && \
6259 + typecheck(unsigned long, b) && \
6260 +- ((long)(b) - (long)(a) < 0))
6261 ++ ((long)((b) - (a)) < 0))
6262 + #define time_before(a,b) time_after(b,a)
6263 +
6264 + #define time_after_eq(a,b) \
6265 + (typecheck(unsigned long, a) && \
6266 + typecheck(unsigned long, b) && \
6267 +- ((long)(a) - (long)(b) >= 0))
6268 ++ ((long)((a) - (b)) >= 0))
6269 + #define time_before_eq(a,b) time_after_eq(b,a)
6270 +
6271 + /*
6272 +@@ -135,13 +135,13 @@ static inline u64 get_jiffies_64(void)
6273 + #define time_after64(a,b) \
6274 + (typecheck(__u64, a) && \
6275 + typecheck(__u64, b) && \
6276 +- ((__s64)(b) - (__s64)(a) < 0))
6277 ++ ((__s64)((b) - (a)) < 0))
6278 + #define time_before64(a,b) time_after64(b,a)
6279 +
6280 + #define time_after_eq64(a,b) \
6281 + (typecheck(__u64, a) && \
6282 + typecheck(__u64, b) && \
6283 +- ((__s64)(a) - (__s64)(b) >= 0))
6284 ++ ((__s64)((a) - (b)) >= 0))
6285 + #define time_before_eq64(a,b) time_after_eq64(b,a)
6286 +
6287 + /*
6288 +diff --git a/include/linux/libata.h b/include/linux/libata.h
6289 +index 62467ca..b1fcdba 100644
6290 +--- a/include/linux/libata.h
6291 ++++ b/include/linux/libata.h
6292 +@@ -393,6 +393,8 @@ enum {
6293 + ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
6294 + ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
6295 + ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
6296 ++ ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */
6297 ++ ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */
6298 +
6299 + /* DMA mask for user DMA control: User visible values; DO NOT
6300 + renumber */
6301 +diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
6302 +index 0072a53..8778c26 100644
6303 +--- a/include/linux/pipe_fs_i.h
6304 ++++ b/include/linux/pipe_fs_i.h
6305 +@@ -160,6 +160,8 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
6306 + int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
6307 + void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
6308 +
6309 ++extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
6310 ++
6311 + /* for F_SETPIPE_SZ and F_GETPIPE_SZ */
6312 + long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
6313 + struct pipe_inode_info *get_pipe_info(struct file *file);
6314 +diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
6315 +index df0a779..f3680aa 100644
6316 +--- a/include/linux/tracepoint.h
6317 ++++ b/include/linux/tracepoint.h
6318 +@@ -60,6 +60,12 @@ struct tp_module {
6319 + unsigned int num_tracepoints;
6320 + struct tracepoint * const *tracepoints_ptrs;
6321 + };
6322 ++bool trace_module_has_bad_taint(struct module *mod);
6323 ++#else
6324 ++static inline bool trace_module_has_bad_taint(struct module *mod)
6325 ++{
6326 ++ return false;
6327 ++}
6328 + #endif /* CONFIG_MODULES */
6329 +
6330 + struct tracepoint_iter {
6331 +diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
6332 +index f05fa82..47b458c 100644
6333 +--- a/include/scsi/osd_ore.h
6334 ++++ b/include/scsi/osd_ore.h
6335 +@@ -101,6 +101,7 @@ struct ore_striping_info {
6336 + unsigned unit_off;
6337 + unsigned cur_pg;
6338 + unsigned cur_comp;
6339 ++ unsigned maxdevUnits;
6340 + };
6341 +
6342 + struct ore_io_state;
6343 +diff --git a/include/xen/Kbuild b/include/xen/Kbuild
6344 +index 84ad8f0..563161a 100644
6345 +--- a/include/xen/Kbuild
6346 ++++ b/include/xen/Kbuild
6347 +@@ -1,2 +1,4 @@
6348 + header-y += evtchn.h
6349 ++header-y += gntalloc.h
6350 ++header-y += gntdev.h
6351 + header-y += privcmd.h
6352 +diff --git a/kernel/cgroup.c b/kernel/cgroup.c
6353 +index 2a1ffb7..93fc15e 100644
6354 +--- a/kernel/cgroup.c
6355 ++++ b/kernel/cgroup.c
6356 +@@ -2785,9 +2785,14 @@ static void cgroup_enable_task_cg_lists(void)
6357 + * We should check if the process is exiting, otherwise
6358 + * it will race with cgroup_exit() in that the list
6359 + * entry won't be deleted though the process has exited.
6360 ++ * Do it while holding siglock so that we don't end up
6361 ++ * racing against cgroup_exit().
6362 + */
6363 ++ spin_lock_irq(&p->sighand->siglock);
6364 + if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list))
6365 + list_add(&p->cg_list, &p->cgroups->tasks);
6366 ++ spin_unlock_irq(&p->sighand->siglock);
6367 ++
6368 + task_unlock(p);
6369 + } while_each_thread(g, p);
6370 + write_unlock(&css_set_lock);
6371 +diff --git a/kernel/cpuset.c b/kernel/cpuset.c
6372 +index 57eb98d..1e2c5f0 100644
6373 +--- a/kernel/cpuset.c
6374 ++++ b/kernel/cpuset.c
6375 +@@ -2366,9 +2366,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
6376 +
6377 + task_lock(current);
6378 + cs = nearest_hardwall_ancestor(task_cs(current));
6379 ++ allowed = node_isset(node, cs->mems_allowed);
6380 + task_unlock(current);
6381 +
6382 +- allowed = node_isset(node, cs->mems_allowed);
6383 + mutex_unlock(&callback_mutex);
6384 + return allowed;
6385 + }
6386 +diff --git a/kernel/events/core.c b/kernel/events/core.c
6387 +index 83d5621..b15b4f7 100644
6388 +--- a/kernel/events/core.c
6389 ++++ b/kernel/events/core.c
6390 +@@ -7101,14 +7101,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu)
6391 + static void __perf_event_exit_context(void *__info)
6392 + {
6393 + struct perf_event_context *ctx = __info;
6394 +- struct perf_event *event, *tmp;
6395 ++ struct perf_event *event;
6396 +
6397 + perf_pmu_rotate_stop(ctx->pmu);
6398 +
6399 +- list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
6400 +- __perf_remove_from_context(event);
6401 +- list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry)
6402 ++ rcu_read_lock();
6403 ++ list_for_each_entry_rcu(event, &ctx->event_list, event_entry)
6404 + __perf_remove_from_context(event);
6405 ++ rcu_read_unlock();
6406 + }
6407 +
6408 + static void perf_event_exit_cpu_context(int cpu)
6409 +@@ -7132,11 +7132,11 @@ static void perf_event_exit_cpu(int cpu)
6410 + {
6411 + struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
6412 +
6413 ++ perf_event_exit_cpu_context(cpu);
6414 ++
6415 + mutex_lock(&swhash->hlist_mutex);
6416 + swevent_hlist_release(swhash);
6417 + mutex_unlock(&swhash->hlist_mutex);
6418 +-
6419 +- perf_event_exit_cpu_context(cpu);
6420 + }
6421 + #else
6422 + static inline void perf_event_exit_cpu(int cpu) { }
6423 +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
6424 +index 52bdd58..4775229 100644
6425 +--- a/kernel/irq/manage.c
6426 ++++ b/kernel/irq/manage.c
6427 +@@ -819,7 +819,7 @@ static int irq_thread(void *data)
6428 +
6429 + wake = atomic_dec_and_test(&desc->threads_active);
6430 +
6431 +- if (wake && waitqueue_active(&desc->wait_for_threads))
6432 ++ if (wake)
6433 + wake_up(&desc->wait_for_threads);
6434 + }
6435 +
6436 +diff --git a/kernel/printk.c b/kernel/printk.c
6437 +index 16688ec..8fac434 100644
6438 +--- a/kernel/printk.c
6439 ++++ b/kernel/printk.c
6440 +@@ -1165,7 +1165,6 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
6441 + switch (action) {
6442 + case CPU_ONLINE:
6443 + case CPU_DEAD:
6444 +- case CPU_DYING:
6445 + case CPU_DOWN_FAILED:
6446 + case CPU_UP_CANCELED:
6447 + console_lock();
6448 +diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
6449 +index 37f3f39..4c6dae1 100644
6450 +--- a/kernel/sched_fair.c
6451 ++++ b/kernel/sched_fair.c
6452 +@@ -4953,15 +4953,15 @@ static void switched_from_fair(struct rq *rq, struct task_struct *p)
6453 + struct cfs_rq *cfs_rq = cfs_rq_of(se);
6454 +
6455 + /*
6456 +- * Ensure the task's vruntime is normalized, so that when its
6457 ++ * Ensure the task's vruntime is normalized, so that when it's
6458 + * switched back to the fair class the enqueue_entity(.flags=0) will
6459 + * do the right thing.
6460 + *
6461 +- * If it was on_rq, then the dequeue_entity(.flags=0) will already
6462 +- * have normalized the vruntime, if it was !on_rq, then only when
6463 ++ * If it's on_rq, then the dequeue_entity(.flags=0) will already
6464 ++ * have normalized the vruntime, if it's !on_rq, then only when
6465 + * the task is sleeping will it still have non-normalized vruntime.
6466 + */
6467 +- if (!se->on_rq && p->state != TASK_RUNNING) {
6468 ++ if (!p->on_rq && p->state != TASK_RUNNING) {
6469 + /*
6470 + * Fix up our vruntime so that the current sleep doesn't
6471 + * cause 'unlimited' sleep bonus.
6472 +diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
6473 +index a470154..955560e 100644
6474 +--- a/kernel/time/jiffies.c
6475 ++++ b/kernel/time/jiffies.c
6476 +@@ -51,7 +51,13 @@
6477 + * HZ shrinks, so values greater than 8 overflow 32bits when
6478 + * HZ=100.
6479 + */
6480 ++#if HZ < 34
6481 ++#define JIFFIES_SHIFT 6
6482 ++#elif HZ < 67
6483 ++#define JIFFIES_SHIFT 7
6484 ++#else
6485 + #define JIFFIES_SHIFT 8
6486 ++#endif
6487 +
6488 + static cycle_t jiffies_read(struct clocksource *cs)
6489 + {
6490 +diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
6491 +index cb7f33e..068c092 100644
6492 +--- a/kernel/time/timekeeping.c
6493 ++++ b/kernel/time/timekeeping.c
6494 +@@ -1161,7 +1161,7 @@ void get_monotonic_boottime(struct timespec *ts)
6495 + } while (read_seqretry(&xtime_lock, seq));
6496 +
6497 + set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec,
6498 +- ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec + nsecs);
6499 ++ (s64)ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec + nsecs);
6500 + }
6501 + EXPORT_SYMBOL_GPL(get_monotonic_boottime);
6502 +
6503 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
6504 +index cf8b439..a65fa36 100644
6505 +--- a/kernel/trace/ftrace.c
6506 ++++ b/kernel/trace/ftrace.c
6507 +@@ -190,6 +190,12 @@ static void update_global_ops(void)
6508 + global_ops.func = func;
6509 + }
6510 +
6511 ++#ifdef CONFIG_FUNCTION_GRAPH_TRACER
6512 ++static void update_function_graph_func(void);
6513 ++#else
6514 ++static inline void update_function_graph_func(void) { }
6515 ++#endif
6516 ++
6517 + static void update_ftrace_function(void)
6518 + {
6519 + ftrace_func_t func;
6520 +@@ -237,6 +243,8 @@ static int remove_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops)
6521 + {
6522 + struct ftrace_ops **p;
6523 +
6524 ++ update_function_graph_func();
6525 ++
6526 + /*
6527 + * If we are removing the last function, then simply point
6528 + * to the ftrace_stub.
6529 +@@ -283,6 +291,17 @@ static int __register_ftrace_function(struct ftrace_ops *ops)
6530 + return 0;
6531 + }
6532 +
6533 ++static void ftrace_sync(struct work_struct *work)
6534 ++{
6535 ++ /*
6536 ++ * This function is just a stub to implement a hard force
6537 ++ * of synchronize_sched(). This requires synchronizing
6538 ++ * tasks even in userspace and idle.
6539 ++ *
6540 ++ * Yes, function tracing is rude.
6541 ++ */
6542 ++}
6543 ++
6544 + static int __unregister_ftrace_function(struct ftrace_ops *ops)
6545 + {
6546 + int ret;
6547 +@@ -308,13 +327,6 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops)
6548 + if (ftrace_enabled)
6549 + update_ftrace_function();
6550 +
6551 +- /*
6552 +- * Dynamic ops may be freed, we must make sure that all
6553 +- * callers are done before leaving this function.
6554 +- */
6555 +- if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
6556 +- synchronize_sched();
6557 +-
6558 + return 0;
6559 + }
6560 +
6561 +@@ -1775,6 +1787,24 @@ static int ftrace_shutdown(struct ftrace_ops *ops, int command)
6562 + return 0;
6563 +
6564 + ftrace_run_update_code(command);
6565 ++
6566 ++ /*
6567 ++ * Dynamic ops may be freed, we must make sure that all
6568 ++ * callers are done before leaving this function.
6569 ++ * The same goes for freeing the per_cpu data of the control
6570 ++ * ops.
6571 ++ *
6572 ++ * Again, normal synchronize_sched() is not good enough.
6573 ++ * We need to do a hard force of sched synchronization.
6574 ++ * This is because we use preempt_disable() to do RCU, but
6575 ++ * the function tracers can be called where RCU is not watching
6576 ++ * (like before user_exit()). We can not rely on the RCU
6577 ++ * infrastructure to do the synchronization, thus we must do it
6578 ++ * ourselves.
6579 ++ */
6580 ++ if (ops->flags & (FTRACE_OPS_FL_DYNAMIC))
6581 ++ schedule_on_each_cpu(ftrace_sync);
6582 ++
6583 + return 0;
6584 + }
6585 +
6586 +@@ -4045,6 +4075,7 @@ int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
6587 + trace_func_graph_ret_t ftrace_graph_return =
6588 + (trace_func_graph_ret_t)ftrace_stub;
6589 + trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub;
6590 ++static trace_func_graph_ent_t __ftrace_graph_entry = ftrace_graph_entry_stub;
6591 +
6592 + /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */
6593 + static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list)
6594 +@@ -4185,6 +4216,30 @@ static struct ftrace_ops fgraph_ops __read_mostly = {
6595 + .flags = FTRACE_OPS_FL_GLOBAL,
6596 + };
6597 +
6598 ++static int ftrace_graph_entry_test(struct ftrace_graph_ent *trace)
6599 ++{
6600 ++ if (!ftrace_ops_test(&global_ops, trace->func))
6601 ++ return 0;
6602 ++ return __ftrace_graph_entry(trace);
6603 ++}
6604 ++
6605 ++/*
6606 ++ * The function graph tracer should only trace the functions defined
6607 ++ * by set_ftrace_filter and set_ftrace_notrace. If another function
6608 ++ * tracer ops is registered, the graph tracer requires testing the
6609 ++ * function against the global ops, and not just trace any function
6610 ++ * that any ftrace_ops registered.
6611 ++ */
6612 ++static void update_function_graph_func(void)
6613 ++{
6614 ++ if (ftrace_ops_list == &ftrace_list_end ||
6615 ++ (ftrace_ops_list == &global_ops &&
6616 ++ global_ops.next == &ftrace_list_end))
6617 ++ ftrace_graph_entry = __ftrace_graph_entry;
6618 ++ else
6619 ++ ftrace_graph_entry = ftrace_graph_entry_test;
6620 ++}
6621 ++
6622 + int register_ftrace_graph(trace_func_graph_ret_t retfunc,
6623 + trace_func_graph_ent_t entryfunc)
6624 + {
6625 +@@ -4209,7 +4264,16 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
6626 + }
6627 +
6628 + ftrace_graph_return = retfunc;
6629 +- ftrace_graph_entry = entryfunc;
6630 ++
6631 ++ /*
6632 ++ * Update the indirect function to the entryfunc, and the
6633 ++ * function that gets called to the entry_test first. Then
6634 ++ * call the update fgraph entry function to determine if
6635 ++ * the entryfunc should be called directly or not.
6636 ++ */
6637 ++ __ftrace_graph_entry = entryfunc;
6638 ++ ftrace_graph_entry = ftrace_graph_entry_test;
6639 ++ update_function_graph_func();
6640 +
6641 + ret = ftrace_startup(&fgraph_ops, FTRACE_START_FUNC_RET);
6642 +
6643 +@@ -4228,6 +4292,7 @@ void unregister_ftrace_graph(void)
6644 + ftrace_graph_active--;
6645 + ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
6646 + ftrace_graph_entry = ftrace_graph_entry_stub;
6647 ++ __ftrace_graph_entry = ftrace_graph_entry_stub;
6648 + ftrace_shutdown(&fgraph_ops, FTRACE_STOP_FUNC_RET);
6649 + unregister_pm_notifier(&ftrace_suspend_notifier);
6650 + unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
6651 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
6652 +index 6fdc629..648f25a 100644
6653 +--- a/kernel/trace/ring_buffer.c
6654 ++++ b/kernel/trace/ring_buffer.c
6655 +@@ -2040,6 +2040,13 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
6656 + write &= RB_WRITE_MASK;
6657 + tail = write - length;
6658 +
6659 ++ /*
6660 ++ * If this is the first commit on the page, then it has the same
6661 ++ * timestamp as the page itself.
6662 ++ */
6663 ++ if (!tail)
6664 ++ delta = 0;
6665 ++
6666 + /* See if we shot pass the end of this buffer page */
6667 + if (unlikely(write > BUF_PAGE_SIZE))
6668 + return rb_move_tail(cpu_buffer, length, tail,
6669 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
6670 +index c212a7f..875fed4 100644
6671 +--- a/kernel/trace/trace_events.c
6672 ++++ b/kernel/trace/trace_events.c
6673 +@@ -1345,6 +1345,16 @@ static void trace_module_add_events(struct module *mod)
6674 + struct ftrace_module_file_ops *file_ops = NULL;
6675 + struct ftrace_event_call **call, **start, **end;
6676 +
6677 ++ if (!mod->num_trace_events)
6678 ++ return;
6679 ++
6680 ++ /* Don't add infrastructure for mods without tracepoints */
6681 ++ if (trace_module_has_bad_taint(mod)) {
6682 ++ pr_err("%s: module has bad taint, not creating trace events\n",
6683 ++ mod->name);
6684 ++ return;
6685 ++ }
6686 ++
6687 + start = mod->trace_events;
6688 + end = mod->trace_events + mod->num_trace_events;
6689 +
6690 +diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
6691 +index f1539de..41b25a0 100644
6692 +--- a/kernel/tracepoint.c
6693 ++++ b/kernel/tracepoint.c
6694 +@@ -628,6 +628,11 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter)
6695 + EXPORT_SYMBOL_GPL(tracepoint_iter_reset);
6696 +
6697 + #ifdef CONFIG_MODULES
6698 ++bool trace_module_has_bad_taint(struct module *mod)
6699 ++{
6700 ++ return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP));
6701 ++}
6702 ++
6703 + static int tracepoint_module_coming(struct module *mod)
6704 + {
6705 + struct tp_module *tp_mod, *iter;
6706 +@@ -638,7 +643,7 @@ static int tracepoint_module_coming(struct module *mod)
6707 + * module headers (for forced load), to make sure we don't cause a crash.
6708 + * Staging and out-of-tree GPL modules are fine.
6709 + */
6710 +- if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)))
6711 ++ if (trace_module_has_bad_taint(mod))
6712 + return 0;
6713 + mutex_lock(&tracepoints_mutex);
6714 + tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL);
6715 +diff --git a/kernel/workqueue.c b/kernel/workqueue.c
6716 +index 0bc9ff0..563820c 100644
6717 +--- a/kernel/workqueue.c
6718 ++++ b/kernel/workqueue.c
6719 +@@ -1474,12 +1474,19 @@ static void destroy_worker(struct worker *worker)
6720 + if (worker->flags & WORKER_IDLE)
6721 + gcwq->nr_idle--;
6722 +
6723 ++ /*
6724 ++ * Once WORKER_DIE is set, the kworker may destroy itself at any
6725 ++ * point. Pin to ensure the task stays until we're done with it.
6726 ++ */
6727 ++ get_task_struct(worker->task);
6728 ++
6729 + list_del_init(&worker->entry);
6730 + worker->flags |= WORKER_DIE;
6731 +
6732 + spin_unlock_irq(&gcwq->lock);
6733 +
6734 + kthread_stop(worker->task);
6735 ++ put_task_struct(worker->task);
6736 + kfree(worker);
6737 +
6738 + spin_lock_irq(&gcwq->lock);
6739 +diff --git a/lib/Makefile b/lib/Makefile
6740 +index a4da283..c06efca 100644
6741 +--- a/lib/Makefile
6742 ++++ b/lib/Makefile
6743 +@@ -40,6 +40,7 @@ obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o
6744 + lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
6745 + lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
6746 +
6747 ++GCOV_PROFILE_hweight.o := n
6748 + CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
6749 + obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
6750 +
6751 +diff --git a/mm/oom_kill.c b/mm/oom_kill.c
6752 +index 069b64e..4dda948 100644
6753 +--- a/mm/oom_kill.c
6754 ++++ b/mm/oom_kill.c
6755 +@@ -213,7 +213,7 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
6756 + * implementation used by LSMs.
6757 + */
6758 + if (has_capability_noaudit(p, CAP_SYS_ADMIN))
6759 +- points -= 30;
6760 ++ points -= (points * 3) / 100;
6761 +
6762 + /*
6763 + * /proc/pid/oom_score_adj ranges from -1000 to +1000 such that it may
6764 +diff --git a/mm/page-writeback.c b/mm/page-writeback.c
6765 +index ea3f83b..b5cd796 100644
6766 +--- a/mm/page-writeback.c
6767 ++++ b/mm/page-writeback.c
6768 +@@ -1776,11 +1776,12 @@ int __set_page_dirty_nobuffers(struct page *page)
6769 + if (!TestSetPageDirty(page)) {
6770 + struct address_space *mapping = page_mapping(page);
6771 + struct address_space *mapping2;
6772 ++ unsigned long flags;
6773 +
6774 + if (!mapping)
6775 + return 1;
6776 +
6777 +- spin_lock_irq(&mapping->tree_lock);
6778 ++ spin_lock_irqsave(&mapping->tree_lock, flags);
6779 + mapping2 = page_mapping(page);
6780 + if (mapping2) { /* Race with truncate? */
6781 + BUG_ON(mapping2 != mapping);
6782 +@@ -1789,7 +1790,7 @@ int __set_page_dirty_nobuffers(struct page *page)
6783 + radix_tree_tag_set(&mapping->page_tree,
6784 + page_index(page), PAGECACHE_TAG_DIRTY);
6785 + }
6786 +- spin_unlock_irq(&mapping->tree_lock);
6787 ++ spin_unlock_irqrestore(&mapping->tree_lock, flags);
6788 + if (mapping->host) {
6789 + /* !PageAnon && !swapper_space */
6790 + __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
6791 +diff --git a/mm/rmap.c b/mm/rmap.c
6792 +index 8685697..52a2f36 100644
6793 +--- a/mm/rmap.c
6794 ++++ b/mm/rmap.c
6795 +@@ -581,7 +581,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm,
6796 + spinlock_t *ptl;
6797 +
6798 + if (unlikely(PageHuge(page))) {
6799 ++ /* when pud is not present, pte will be NULL */
6800 + pte = huge_pte_offset(mm, address);
6801 ++ if (!pte)
6802 ++ return NULL;
6803 ++
6804 + ptl = &mm->page_table_lock;
6805 + goto check;
6806 + }
6807 +diff --git a/mm/slub.c b/mm/slub.c
6808 +index 5710788..fc719f7 100644
6809 +--- a/mm/slub.c
6810 ++++ b/mm/slub.c
6811 +@@ -4483,7 +4483,13 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
6812 + page = c->partial;
6813 +
6814 + if (page) {
6815 +- x = page->pobjects;
6816 ++ node = page_to_nid(page);
6817 ++ if (flags & SO_TOTAL)
6818 ++ WARN_ON_ONCE(1);
6819 ++ else if (flags & SO_OBJECTS)
6820 ++ WARN_ON_ONCE(1);
6821 ++ else
6822 ++ x = page->pages;
6823 + total += x;
6824 + nodes[node] += x;
6825 + }
6826 +diff --git a/mm/swapfile.c b/mm/swapfile.c
6827 +index fad1830..dbd2b67 100644
6828 +--- a/mm/swapfile.c
6829 ++++ b/mm/swapfile.c
6830 +@@ -1649,7 +1649,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
6831 + p->max = 0;
6832 + swap_map = p->swap_map;
6833 + p->swap_map = NULL;
6834 +- p->flags = 0;
6835 + spin_unlock(&swap_lock);
6836 + mutex_unlock(&swapon_mutex);
6837 + vfree(swap_map);
6838 +@@ -1667,6 +1666,16 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
6839 + mutex_unlock(&inode->i_mutex);
6840 + }
6841 + filp_close(swap_file, NULL);
6842 ++
6843 ++ /*
6844 ++ * Clear the SWP_USED flag after all resources are freed so that swapon
6845 ++ * can reuse this swap_info in alloc_swap_info() safely. It is ok to
6846 ++ * not hold p->lock after we cleared its SWP_WRITEOK.
6847 ++ */
6848 ++ spin_lock(&swap_lock);
6849 ++ p->flags = 0;
6850 ++ spin_unlock(&swap_lock);
6851 ++
6852 + err = 0;
6853 + atomic_inc(&proc_poll_event);
6854 + wake_up_interruptible(&proc_poll_wait);
6855 +diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
6856 +index c0c21b1..6af54f2 100644
6857 +--- a/net/core/fib_rules.c
6858 ++++ b/net/core/fib_rules.c
6859 +@@ -718,6 +718,13 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event,
6860 + attach_rules(&ops->rules_list, dev);
6861 + break;
6862 +
6863 ++ case NETDEV_CHANGENAME:
6864 ++ list_for_each_entry(ops, &net->rules_ops, list) {
6865 ++ detach_rules(&ops->rules_list, dev);
6866 ++ attach_rules(&ops->rules_list, dev);
6867 ++ }
6868 ++ break;
6869 ++
6870 + case NETDEV_UNREGISTER:
6871 + list_for_each_entry(ops, &net->rules_ops, list)
6872 + detach_rules(&ops->rules_list, dev);
6873 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
6874 +index af9c3c6..5d6cb54 100644
6875 +--- a/net/core/skbuff.c
6876 ++++ b/net/core/skbuff.c
6877 +@@ -74,36 +74,6 @@
6878 + static struct kmem_cache *skbuff_head_cache __read_mostly;
6879 + static struct kmem_cache *skbuff_fclone_cache __read_mostly;
6880 +
6881 +-static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
6882 +- struct pipe_buffer *buf)
6883 +-{
6884 +- put_page(buf->page);
6885 +-}
6886 +-
6887 +-static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
6888 +- struct pipe_buffer *buf)
6889 +-{
6890 +- get_page(buf->page);
6891 +-}
6892 +-
6893 +-static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
6894 +- struct pipe_buffer *buf)
6895 +-{
6896 +- return 1;
6897 +-}
6898 +-
6899 +-
6900 +-/* Pipe buffer operations for a socket. */
6901 +-static const struct pipe_buf_operations sock_pipe_buf_ops = {
6902 +- .can_merge = 0,
6903 +- .map = generic_pipe_buf_map,
6904 +- .unmap = generic_pipe_buf_unmap,
6905 +- .confirm = generic_pipe_buf_confirm,
6906 +- .release = sock_pipe_buf_release,
6907 +- .steal = sock_pipe_buf_steal,
6908 +- .get = sock_pipe_buf_get,
6909 +-};
6910 +-
6911 + /*
6912 + * Keep out-of-line to prevent kernel bloat.
6913 + * __builtin_return_address is not used because it is not always
6914 +@@ -1665,7 +1635,7 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
6915 + .partial = partial,
6916 + .nr_pages_max = MAX_SKB_FRAGS,
6917 + .flags = flags,
6918 +- .ops = &sock_pipe_buf_ops,
6919 ++ .ops = &nosteal_pipe_buf_ops,
6920 + .spd_release = sock_spd_release,
6921 + };
6922 + struct sk_buff *frag_iter;
6923 +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
6924 +index 488600c..1914f5a 100644
6925 +--- a/net/mac80211/sta_info.c
6926 ++++ b/net/mac80211/sta_info.c
6927 +@@ -292,6 +292,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
6928 + return NULL;
6929 +
6930 + spin_lock_init(&sta->lock);
6931 ++ spin_lock_init(&sta->ps_lock);
6932 + INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
6933 + INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
6934 + mutex_init(&sta->ampdu_mlme.mtx);
6935 +@@ -1141,6 +1142,8 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
6936 +
6937 + skb_queue_head_init(&pending);
6938 +
6939 ++ /* sync with ieee80211_tx_h_unicast_ps_buf */
6940 ++ spin_lock(&sta->ps_lock);
6941 + /* Send all buffered frames to the station */
6942 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
6943 + int count = skb_queue_len(&pending), tmp;
6944 +@@ -1160,6 +1163,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
6945 + }
6946 +
6947 + ieee80211_add_pending_skbs_fn(local, &pending, clear_sta_ps_flags, sta);
6948 ++ spin_unlock(&sta->ps_lock);
6949 +
6950 + local->total_ps_buffered -= buffered;
6951 +
6952 +@@ -1207,6 +1211,7 @@ static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata,
6953 + memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN);
6954 + memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN);
6955 + memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN);
6956 ++ nullfunc->seq_ctrl = 0;
6957 +
6958 + skb->priority = tid;
6959 + skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]);
6960 +diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
6961 +index 8c8ce05..a68155f 100644
6962 +--- a/net/mac80211/sta_info.h
6963 ++++ b/net/mac80211/sta_info.h
6964 +@@ -216,6 +216,7 @@ struct sta_ampdu_mlme {
6965 + * @drv_unblock_wk: used for driver PS unblocking
6966 + * @listen_interval: listen interval of this station, when we're acting as AP
6967 + * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
6968 ++ * @ps_lock: used for powersave (when mac80211 is the AP) related locking
6969 + * @ps_tx_buf: buffers (per AC) of frames to transmit to this station
6970 + * when it leaves power saving state or polls
6971 + * @tx_filtered: buffers (per AC) of frames we already tried to
6972 +@@ -284,10 +285,8 @@ struct sta_info {
6973 + /* use the accessors defined below */
6974 + unsigned long _flags;
6975 +
6976 +- /*
6977 +- * STA powersave frame queues, no more than the internal
6978 +- * locking required.
6979 +- */
6980 ++ /* STA powersave lock and frame queues */
6981 ++ spinlock_t ps_lock;
6982 + struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
6983 + struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
6984 + unsigned long driver_buffered_tids;
6985 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
6986 +index 4ff35bf..25bbb2e 100644
6987 +--- a/net/mac80211/tx.c
6988 ++++ b/net/mac80211/tx.c
6989 +@@ -464,6 +464,20 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
6990 + #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
6991 + if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
6992 + purge_old_ps_buffers(tx->local);
6993 ++
6994 ++ /* sync with ieee80211_sta_ps_deliver_wakeup */
6995 ++ spin_lock(&sta->ps_lock);
6996 ++ /*
6997 ++ * STA woke up the meantime and all the frames on ps_tx_buf have
6998 ++ * been queued to pending queue. No reordering can happen, go
6999 ++ * ahead and Tx the packet.
7000 ++ */
7001 ++ if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
7002 ++ !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
7003 ++ spin_unlock(&sta->ps_lock);
7004 ++ return TX_CONTINUE;
7005 ++ }
7006 ++
7007 + if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) {
7008 + struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);
7009 + #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
7010 +@@ -480,6 +494,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
7011 + info->control.vif = &tx->sdata->vif;
7012 + info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
7013 + skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb);
7014 ++ spin_unlock(&sta->ps_lock);
7015 +
7016 + if (!timer_pending(&local->sta_cleanup))
7017 + mod_timer(&local->sta_cleanup,
7018 +@@ -884,7 +899,7 @@ static int ieee80211_fragment(struct ieee80211_local *local,
7019 + pos += fraglen;
7020 + }
7021 +
7022 +- skb->len = hdrlen + per_fragm;
7023 ++ skb_trim(skb, hdrlen + per_fragm);
7024 + return 0;
7025 + }
7026 +
7027 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
7028 +index cb1c430..f131caf 100644
7029 +--- a/net/sctp/sm_statefuns.c
7030 ++++ b/net/sctp/sm_statefuns.c
7031 +@@ -747,6 +747,13 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep,
7032 + struct sctp_chunk auth;
7033 + sctp_ierror_t ret;
7034 +
7035 ++ /* Make sure that we and the peer are AUTH capable */
7036 ++ if (!sctp_auth_enable || !new_asoc->peer.auth_capable) {
7037 ++ kfree_skb(chunk->auth_chunk);
7038 ++ sctp_association_free(new_asoc);
7039 ++ return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
7040 ++ }
7041 ++
7042 + /* set-up our fake chunk so that we can process it */
7043 + auth.skb = chunk->auth_chunk;
7044 + auth.asoc = chunk->asoc;
7045 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
7046 +index c53d01e..c28eb7b 100644
7047 +--- a/net/sctp/socket.c
7048 ++++ b/net/sctp/socket.c
7049 +@@ -70,6 +70,7 @@
7050 + #include <linux/init.h>
7051 + #include <linux/crypto.h>
7052 + #include <linux/slab.h>
7053 ++#include <linux/compat.h>
7054 +
7055 + #include <net/ip.h>
7056 + #include <net/icmp.h>
7057 +@@ -1376,11 +1377,19 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk,
7058 + /*
7059 + * New (hopefully final) interface for the API.
7060 + * We use the sctp_getaddrs_old structure so that use-space library
7061 +- * can avoid any unnecessary allocations. The only defferent part
7062 ++ * can avoid any unnecessary allocations. The only different part
7063 + * is that we store the actual length of the address buffer into the
7064 +- * addrs_num structure member. That way we can re-use the existing
7065 ++ * addrs_num structure member. That way we can re-use the existing
7066 + * code.
7067 + */
7068 ++#ifdef CONFIG_COMPAT
7069 ++struct compat_sctp_getaddrs_old {
7070 ++ sctp_assoc_t assoc_id;
7071 ++ s32 addr_num;
7072 ++ compat_uptr_t addrs; /* struct sockaddr * */
7073 ++};
7074 ++#endif
7075 ++
7076 + SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
7077 + char __user *optval,
7078 + int __user *optlen)
7079 +@@ -1389,16 +1398,30 @@ SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
7080 + sctp_assoc_t assoc_id = 0;
7081 + int err = 0;
7082 +
7083 +- if (len < sizeof(param))
7084 +- return -EINVAL;
7085 ++#ifdef CONFIG_COMPAT
7086 ++ if (is_compat_task()) {
7087 ++ struct compat_sctp_getaddrs_old param32;
7088 +
7089 +- if (copy_from_user(&param, optval, sizeof(param)))
7090 +- return -EFAULT;
7091 ++ if (len < sizeof(param32))
7092 ++ return -EINVAL;
7093 ++ if (copy_from_user(&param32, optval, sizeof(param32)))
7094 ++ return -EFAULT;
7095 +
7096 +- err = __sctp_setsockopt_connectx(sk,
7097 +- (struct sockaddr __user *)param.addrs,
7098 +- param.addr_num, &assoc_id);
7099 ++ param.assoc_id = param32.assoc_id;
7100 ++ param.addr_num = param32.addr_num;
7101 ++ param.addrs = compat_ptr(param32.addrs);
7102 ++ } else
7103 ++#endif
7104 ++ {
7105 ++ if (len < sizeof(param))
7106 ++ return -EINVAL;
7107 ++ if (copy_from_user(&param, optval, sizeof(param)))
7108 ++ return -EFAULT;
7109 ++ }
7110 +
7111 ++ err = __sctp_setsockopt_connectx(sk, (struct sockaddr __user *)
7112 ++ param.addrs, param.addr_num,
7113 ++ &assoc_id);
7114 + if (err == 0 || err == -EINPROGRESS) {
7115 + if (copy_to_user(optval, &assoc_id, sizeof(assoc_id)))
7116 + return -EFAULT;
7117 +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
7118 +index b2250da..a0e55e5 100644
7119 +--- a/net/sunrpc/clnt.c
7120 ++++ b/net/sunrpc/clnt.c
7121 +@@ -1002,9 +1002,13 @@ call_refreshresult(struct rpc_task *task)
7122 + task->tk_action = call_refresh;
7123 + switch (status) {
7124 + case 0:
7125 +- if (rpcauth_uptodatecred(task))
7126 ++ if (rpcauth_uptodatecred(task)) {
7127 + task->tk_action = call_allocate;
7128 +- return;
7129 ++ return;
7130 ++ }
7131 ++ /* Use rate-limiting and a max number of retries if refresh
7132 ++ * had status 0 but failed to update the cred.
7133 ++ */
7134 + case -ETIMEDOUT:
7135 + rpc_delay(task, 3*HZ);
7136 + case -EAGAIN:
7137 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
7138 +index bfb78fa..d77a4f0 100644
7139 +--- a/net/sunrpc/xprtsock.c
7140 ++++ b/net/sunrpc/xprtsock.c
7141 +@@ -501,6 +501,7 @@ static int xs_nospace(struct rpc_task *task)
7142 + struct rpc_rqst *req = task->tk_rqstp;
7143 + struct rpc_xprt *xprt = req->rq_xprt;
7144 + struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
7145 ++ struct sock *sk = transport->inet;
7146 + int ret = -EAGAIN;
7147 +
7148 + dprintk("RPC: %5u xmit incomplete (%u left of %u)\n",
7149 +@@ -518,7 +519,7 @@ static int xs_nospace(struct rpc_task *task)
7150 + * window size
7151 + */
7152 + set_bit(SOCK_NOSPACE, &transport->sock->flags);
7153 +- transport->inet->sk_write_pending++;
7154 ++ sk->sk_write_pending++;
7155 + /* ...and wait for more buffer space */
7156 + xprt_wait_for_buffer_space(task, xs_nospace_callback);
7157 + }
7158 +@@ -528,6 +529,9 @@ static int xs_nospace(struct rpc_task *task)
7159 + }
7160 +
7161 + spin_unlock_bh(&xprt->transport_lock);
7162 ++
7163 ++ /* Race breaker in case memory is freed before above code is called */
7164 ++ sk->sk_write_space(sk);
7165 + return ret;
7166 + }
7167 +
7168 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
7169 +index eddfdec..54fc90b 100644
7170 +--- a/net/unix/af_unix.c
7171 ++++ b/net/unix/af_unix.c
7172 +@@ -149,8 +149,8 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
7173 +
7174 + static inline unsigned unix_hash_fold(__wsum n)
7175 + {
7176 +- unsigned hash = (__force unsigned)n;
7177 +- hash ^= hash>>16;
7178 ++ unsigned int hash = (__force unsigned int)csum_fold(n);
7179 ++
7180 + hash ^= hash>>8;
7181 + return hash&(UNIX_HASH_SIZE-1);
7182 + }
7183 +diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
7184 +index d1d0ae8..98ff331 100644
7185 +--- a/scripts/mod/file2alias.c
7186 ++++ b/scripts/mod/file2alias.c
7187 +@@ -130,8 +130,8 @@ static void do_usb_entry(struct usb_device_id *id,
7188 + range_lo < 0x9 ? "[%X-9" : "[%X",
7189 + range_lo);
7190 + sprintf(alias + strlen(alias),
7191 +- range_hi > 0xA ? "a-%X]" : "%X]",
7192 +- range_lo);
7193 ++ range_hi > 0xA ? "A-%X]" : "%X]",
7194 ++ range_hi);
7195 + }
7196 + }
7197 + if (bcdDevice_initial_digits < (sizeof(id->bcdDevice_lo) * 2 - 1))
7198 +diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
7199 +index bcf1d73..4fa7939 100644
7200 +--- a/security/selinux/hooks.c
7201 ++++ b/security/selinux/hooks.c
7202 +@@ -4676,22 +4676,31 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex,
7203 + * as fast and as clean as possible. */
7204 + if (!selinux_policycap_netpeer)
7205 + return selinux_ip_postroute_compat(skb, ifindex, family);
7206 ++
7207 ++ secmark_active = selinux_secmark_enabled();
7208 ++ peerlbl_active = netlbl_enabled() || selinux_xfrm_enabled();
7209 ++ if (!secmark_active && !peerlbl_active)
7210 ++ return NF_ACCEPT;
7211 ++
7212 ++ sk = skb->sk;
7213 ++
7214 + #ifdef CONFIG_XFRM
7215 + /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec
7216 + * packet transformation so allow the packet to pass without any checks
7217 + * since we'll have another chance to perform access control checks
7218 + * when the packet is on it's final way out.
7219 + * NOTE: there appear to be some IPv6 multicast cases where skb->dst
7220 +- * is NULL, in this case go ahead and apply access control. */
7221 +- if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL)
7222 ++ * is NULL, in this case go ahead and apply access control.
7223 ++ * NOTE: if this is a local socket (skb->sk != NULL) that is in the
7224 ++ * TCP listening state we cannot wait until the XFRM processing
7225 ++ * is done as we will miss out on the SA label if we do;
7226 ++ * unfortunately, this means more work, but it is only once per
7227 ++ * connection. */
7228 ++ if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL &&
7229 ++ !(sk != NULL && sk->sk_state == TCP_LISTEN))
7230 + return NF_ACCEPT;
7231 + #endif
7232 +- secmark_active = selinux_secmark_enabled();
7233 +- peerlbl_active = netlbl_enabled() || selinux_xfrm_enabled();
7234 +- if (!secmark_active && !peerlbl_active)
7235 +- return NF_ACCEPT;
7236 +
7237 +- sk = skb->sk;
7238 + if (sk == NULL) {
7239 + /* Without an associated socket the packet is either coming
7240 + * from the kernel or it is being forwarded; check the packet
7241 +@@ -4719,6 +4728,25 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex,
7242 + struct sk_security_struct *sksec = sk->sk_security;
7243 + if (selinux_skb_peerlbl_sid(skb, family, &skb_sid))
7244 + return NF_DROP;
7245 ++ /* At this point, if the returned skb peerlbl is SECSID_NULL
7246 ++ * and the packet has been through at least one XFRM
7247 ++ * transformation then we must be dealing with the "final"
7248 ++ * form of labeled IPsec packet; since we've already applied
7249 ++ * all of our access controls on this packet we can safely
7250 ++ * pass the packet. */
7251 ++ if (skb_sid == SECSID_NULL) {
7252 ++ switch (family) {
7253 ++ case PF_INET:
7254 ++ if (IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED)
7255 ++ return NF_ACCEPT;
7256 ++ break;
7257 ++ case PF_INET6:
7258 ++ if (IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED)
7259 ++ return NF_ACCEPT;
7260 ++ default:
7261 ++ return NF_DROP_ERR(-ECONNREFUSED);
7262 ++ }
7263 ++ }
7264 + if (selinux_conn_sid(sksec->sid, skb_sid, &peer_sid))
7265 + return NF_DROP;
7266 + secmark_perm = PACKET__SEND;
7267 +diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
7268 +index a7f61d5..23e9cba 100644
7269 +--- a/security/selinux/ss/policydb.c
7270 ++++ b/security/selinux/ss/policydb.c
7271 +@@ -1914,7 +1914,19 @@ static int filename_trans_read(struct policydb *p, void *fp)
7272 + if (rc)
7273 + goto out;
7274 +
7275 +- hashtab_insert(p->filename_trans, ft, otype);
7276 ++ rc = hashtab_insert(p->filename_trans, ft, otype);
7277 ++ if (rc) {
7278 ++ /*
7279 ++ * Do not return -EEXIST to the caller, or the system
7280 ++ * will not boot.
7281 ++ */
7282 ++ if (rc != -EEXIST)
7283 ++ goto out;
7284 ++ /* But free memory to avoid memory leak. */
7285 ++ kfree(ft);
7286 ++ kfree(name);
7287 ++ kfree(otype);
7288 ++ }
7289 + }
7290 + hash_eval(p->filename_trans, "filenametr");
7291 + return 0;
7292 +@@ -3202,10 +3214,10 @@ static int filename_write_helper(void *key, void *data, void *ptr)
7293 + if (rc)
7294 + return rc;
7295 +
7296 +- buf[0] = ft->stype;
7297 +- buf[1] = ft->ttype;
7298 +- buf[2] = ft->tclass;
7299 +- buf[3] = otype->otype;
7300 ++ buf[0] = cpu_to_le32(ft->stype);
7301 ++ buf[1] = cpu_to_le32(ft->ttype);
7302 ++ buf[2] = cpu_to_le32(ft->tclass);
7303 ++ buf[3] = cpu_to_le32(otype->otype);
7304 +
7305 + rc = put_entry(buf, sizeof(u32), 4, fp);
7306 + if (rc)
7307 +diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
7308 +index 185f849..72b20b1 100644
7309 +--- a/security/selinux/ss/services.c
7310 ++++ b/security/selinux/ss/services.c
7311 +@@ -1229,6 +1229,10 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
7312 + struct context context;
7313 + int rc = 0;
7314 +
7315 ++ /* An empty security context is never valid. */
7316 ++ if (!scontext_len)
7317 ++ return -EINVAL;
7318 ++
7319 + if (!ss_initialized) {
7320 + int i;
7321 +
7322 +diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
7323 +index 8816804..e7244ac 100644
7324 +--- a/sound/pci/Kconfig
7325 ++++ b/sound/pci/Kconfig
7326 +@@ -30,6 +30,7 @@ config SND_ALS300
7327 + select SND_PCM
7328 + select SND_AC97_CODEC
7329 + select SND_OPL3_LIB
7330 ++ select ZONE_DMA
7331 + help
7332 + Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+
7333 +
7334 +@@ -54,6 +55,7 @@ config SND_ALI5451
7335 + tristate "ALi M5451 PCI Audio Controller"
7336 + select SND_MPU401_UART
7337 + select SND_AC97_CODEC
7338 ++ select ZONE_DMA
7339 + help
7340 + Say Y here to include support for the integrated AC97 sound
7341 + device on motherboards using the ALi M5451 Audio Controller
7342 +@@ -158,6 +160,7 @@ config SND_AZT3328
7343 + select SND_PCM
7344 + select SND_RAWMIDI
7345 + select SND_AC97_CODEC
7346 ++ select ZONE_DMA
7347 + help
7348 + Say Y here to include support for Aztech AZF3328 (PCI168)
7349 + soundcards.
7350 +@@ -463,6 +466,7 @@ config SND_EMU10K1
7351 + select SND_HWDEP
7352 + select SND_RAWMIDI
7353 + select SND_AC97_CODEC
7354 ++ select ZONE_DMA
7355 + help
7356 + Say Y to include support for Sound Blaster PCI 512, Live!,
7357 + Audigy and E-mu APS (partially supported) soundcards.
7358 +@@ -478,6 +482,7 @@ config SND_EMU10K1X
7359 + tristate "Emu10k1X (Dell OEM Version)"
7360 + select SND_AC97_CODEC
7361 + select SND_RAWMIDI
7362 ++ select ZONE_DMA
7363 + help
7364 + Say Y here to include support for the Dell OEM version of the
7365 + Sound Blaster Live!.
7366 +@@ -511,6 +516,7 @@ config SND_ES1938
7367 + select SND_OPL3_LIB
7368 + select SND_MPU401_UART
7369 + select SND_AC97_CODEC
7370 ++ select ZONE_DMA
7371 + help
7372 + Say Y here to include support for soundcards based on ESS Solo-1
7373 + (ES1938, ES1946, ES1969) chips.
7374 +@@ -522,6 +528,7 @@ config SND_ES1968
7375 + tristate "ESS ES1968/1978 (Maestro-1/2/2E)"
7376 + select SND_MPU401_UART
7377 + select SND_AC97_CODEC
7378 ++ select ZONE_DMA
7379 + help
7380 + Say Y here to include support for soundcards based on ESS Maestro
7381 + 1/2/2E chips.
7382 +@@ -602,6 +609,7 @@ config SND_ICE1712
7383 + select SND_MPU401_UART
7384 + select SND_AC97_CODEC
7385 + select BITREVERSE
7386 ++ select ZONE_DMA
7387 + help
7388 + Say Y here to include support for soundcards based on the
7389 + ICE1712 (Envy24) chip.
7390 +@@ -688,6 +696,7 @@ config SND_LX6464ES
7391 + config SND_MAESTRO3
7392 + tristate "ESS Allegro/Maestro3"
7393 + select SND_AC97_CODEC
7394 ++ select ZONE_DMA
7395 + help
7396 + Say Y here to include support for soundcards based on ESS Maestro 3
7397 + (Allegro) chips.
7398 +@@ -782,6 +791,7 @@ config SND_SIS7019
7399 + tristate "SiS 7019 Audio Accelerator"
7400 + depends on X86 && !X86_64
7401 + select SND_AC97_CODEC
7402 ++ select ZONE_DMA
7403 + help
7404 + Say Y here to include support for the SiS 7019 Audio Accelerator.
7405 +
7406 +@@ -793,6 +803,7 @@ config SND_SONICVIBES
7407 + select SND_OPL3_LIB
7408 + select SND_MPU401_UART
7409 + select SND_AC97_CODEC
7410 ++ select ZONE_DMA
7411 + help
7412 + Say Y here to include support for soundcards based on the S3
7413 + SonicVibes chip.
7414 +@@ -804,6 +815,7 @@ config SND_TRIDENT
7415 + tristate "Trident 4D-Wave DX/NX; SiS 7018"
7416 + select SND_MPU401_UART
7417 + select SND_AC97_CODEC
7418 ++ select ZONE_DMA
7419 + help
7420 + Say Y here to include support for soundcards based on Trident
7421 + 4D-Wave DX/NX or SiS 7018 chips.
7422 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
7423 +index 1f78ca6..36bce68 100644
7424 +--- a/sound/pci/hda/patch_realtek.c
7425 ++++ b/sound/pci/hda/patch_realtek.c
7426 +@@ -5157,6 +5157,9 @@ static int alc269_fill_coef(struct hda_codec *codec)
7427 +
7428 + if (spec->codec_variant != ALC269_TYPE_ALC269VB)
7429 + return 0;
7430 ++ /* ALC271X doesn't seem to support these COEFs (bko#52181) */
7431 ++ if (!strcmp(codec->chip_name, "ALC271X"))
7432 ++ return 0;
7433 +
7434 + if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7435 + alc_write_coef_idx(codec, 0xf, 0x960b);
7436 +diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
7437 +index bc6eb58..59eda0a 100644
7438 +--- a/sound/pci/oxygen/xonar_dg.c
7439 ++++ b/sound/pci/oxygen/xonar_dg.c
7440 +@@ -294,6 +294,16 @@ static int output_switch_put(struct snd_kcontrol *ctl,
7441 + oxygen_write16_masked(chip, OXYGEN_GPIO_DATA,
7442 + data->output_sel == 1 ? GPIO_HP_REAR : 0,
7443 + GPIO_HP_REAR);
7444 ++ oxygen_write8_masked(chip, OXYGEN_PLAY_ROUTING,
7445 ++ data->output_sel == 0 ?
7446 ++ OXYGEN_PLAY_MUTE01 :
7447 ++ OXYGEN_PLAY_MUTE23 |
7448 ++ OXYGEN_PLAY_MUTE45 |
7449 ++ OXYGEN_PLAY_MUTE67,
7450 ++ OXYGEN_PLAY_MUTE01 |
7451 ++ OXYGEN_PLAY_MUTE23 |
7452 ++ OXYGEN_PLAY_MUTE45 |
7453 ++ OXYGEN_PLAY_MUTE67);
7454 + }
7455 + mutex_unlock(&chip->mutex);
7456 + return changed;
7457 +@@ -597,7 +607,7 @@ struct oxygen_model model_xonar_dg = {
7458 + .model_data_size = sizeof(struct dg),
7459 + .device_config = PLAYBACK_0_TO_I2S |
7460 + PLAYBACK_1_TO_SPDIF |
7461 +- CAPTURE_0_FROM_I2S_2,
7462 ++ CAPTURE_0_FROM_I2S_1,
7463 + .dac_channels_pcm = 6,
7464 + .dac_channels_mixer = 0,
7465 + .function_flags = OXYGEN_FUNCTION_SPI,
7466 +diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
7467 +index 732c5e8..1b35864 100644
7468 +--- a/sound/pci/rme9652/rme9652.c
7469 ++++ b/sound/pci/rme9652/rme9652.c
7470 +@@ -285,7 +285,7 @@ static char channel_map_9636_ds[26] = {
7471 + /* ADAT channels are remapped */
7472 + 1, 3, 5, 7, 9, 11, 13, 15,
7473 + /* channels 8 and 9 are S/PDIF */
7474 +- 24, 25
7475 ++ 24, 25,
7476 + /* others don't exist */
7477 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
7478 + };
7479 +diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
7480 +index 8b7e1c5..3cca558 100644
7481 +--- a/sound/soc/codecs/adau1701.c
7482 ++++ b/sound/soc/codecs/adau1701.c
7483 +@@ -64,7 +64,7 @@
7484 +
7485 + #define ADAU1701_SEROCTL_WORD_LEN_24 0x0000
7486 + #define ADAU1701_SEROCTL_WORD_LEN_20 0x0001
7487 +-#define ADAU1701_SEROCTL_WORD_LEN_16 0x0010
7488 ++#define ADAU1701_SEROCTL_WORD_LEN_16 0x0002
7489 + #define ADAU1701_SEROCTL_WORD_LEN_MASK 0x0003
7490 +
7491 + #define ADAU1701_AUXNPOW_VBPD 0x40
7492 +diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
7493 +index d2f3715..25ae059 100644
7494 +--- a/sound/soc/codecs/sta32x.c
7495 ++++ b/sound/soc/codecs/sta32x.c
7496 +@@ -143,42 +143,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = {
7497 + 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),
7498 + };
7499 +
7500 +-static const struct soc_enum sta32x_drc_ac_enum =
7501 +- SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
7502 +- 2, sta32x_drc_ac);
7503 +-static const struct soc_enum sta32x_auto_eq_enum =
7504 +- SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
7505 +- 3, sta32x_auto_eq_mode);
7506 +-static const struct soc_enum sta32x_auto_gc_enum =
7507 +- SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
7508 +- 4, sta32x_auto_gc_mode);
7509 +-static const struct soc_enum sta32x_auto_xo_enum =
7510 +- SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
7511 +- 16, sta32x_auto_xo_mode);
7512 +-static const struct soc_enum sta32x_preset_eq_enum =
7513 +- SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
7514 +- 32, sta32x_preset_eq_mode);
7515 +-static const struct soc_enum sta32x_limiter_ch1_enum =
7516 +- SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
7517 +- 3, sta32x_limiter_select);
7518 +-static const struct soc_enum sta32x_limiter_ch2_enum =
7519 +- SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
7520 +- 3, sta32x_limiter_select);
7521 +-static const struct soc_enum sta32x_limiter_ch3_enum =
7522 +- SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
7523 +- 3, sta32x_limiter_select);
7524 +-static const struct soc_enum sta32x_limiter1_attack_rate_enum =
7525 +- SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT,
7526 +- 16, sta32x_limiter_attack_rate);
7527 +-static const struct soc_enum sta32x_limiter2_attack_rate_enum =
7528 +- SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT,
7529 +- 16, sta32x_limiter_attack_rate);
7530 +-static const struct soc_enum sta32x_limiter1_release_rate_enum =
7531 +- SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT,
7532 +- 16, sta32x_limiter_release_rate);
7533 +-static const struct soc_enum sta32x_limiter2_release_rate_enum =
7534 +- SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT,
7535 +- 16, sta32x_limiter_release_rate);
7536 ++static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum,
7537 ++ STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
7538 ++ sta32x_drc_ac);
7539 ++static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum,
7540 ++ STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
7541 ++ sta32x_auto_eq_mode);
7542 ++static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum,
7543 ++ STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
7544 ++ sta32x_auto_gc_mode);
7545 ++static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum,
7546 ++ STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
7547 ++ sta32x_auto_xo_mode);
7548 ++static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum,
7549 ++ STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
7550 ++ sta32x_preset_eq_mode);
7551 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum,
7552 ++ STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
7553 ++ sta32x_limiter_select);
7554 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum,
7555 ++ STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
7556 ++ sta32x_limiter_select);
7557 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum,
7558 ++ STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
7559 ++ sta32x_limiter_select);
7560 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum,
7561 ++ STA32X_L1AR, STA32X_LxA_SHIFT,
7562 ++ sta32x_limiter_attack_rate);
7563 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum,
7564 ++ STA32X_L2AR, STA32X_LxA_SHIFT,
7565 ++ sta32x_limiter_attack_rate);
7566 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum,
7567 ++ STA32X_L1AR, STA32X_LxR_SHIFT,
7568 ++ sta32x_limiter_release_rate);
7569 ++static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum,
7570 ++ STA32X_L2AR, STA32X_LxR_SHIFT,
7571 ++ sta32x_limiter_release_rate);
7572 +
7573 + /* byte array controls for setting biquad, mixer, scaling coefficients;
7574 + * for biquads all five coefficients need to be set in one go,
7575 +@@ -350,7 +350,7 @@ SOC_SINGLE_TLV("Treble Tone Control", STA32X_TONE, STA32X_TONE_TTC_SHIFT, 15, 0,
7576 + SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum),
7577 + SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum),
7578 + SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum),
7579 +-SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum),
7580 ++SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter2_release_rate_enum),
7581 +
7582 + /* depending on mode, the attack/release thresholds have
7583 + * two different enum definitions; provide both
7584 +diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
7585 +index aa05e65..d5f7d8d 100644
7586 +--- a/sound/soc/codecs/wm8770.c
7587 ++++ b/sound/soc/codecs/wm8770.c
7588 +@@ -163,8 +163,8 @@ static const char *ain_text[] = {
7589 + "AIN5", "AIN6", "AIN7", "AIN8"
7590 + };
7591 +
7592 +-static const struct soc_enum ain_enum =
7593 +- SOC_ENUM_DOUBLE(WM8770_ADCMUX, 0, 4, 8, ain_text);
7594 ++static SOC_ENUM_DOUBLE_DECL(ain_enum,
7595 ++ WM8770_ADCMUX, 0, 4, ain_text);
7596 +
7597 + static const struct snd_kcontrol_new ain_mux =
7598 + SOC_DAPM_ENUM("Capture Mux", ain_enum);
7599 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
7600 +index 41b9fe0..4f7b330 100644
7601 +--- a/sound/usb/mixer.c
7602 ++++ b/sound/usb/mixer.c
7603 +@@ -831,6 +831,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
7604 + }
7605 + break;
7606 +
7607 ++ case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */
7608 + case USB_ID(0x046d, 0x0808):
7609 + case USB_ID(0x046d, 0x0809):
7610 + case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
7611 +diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
7612 +index f1324c4..0e4e909 100644
7613 +--- a/sound/usb/mixer_maps.c
7614 ++++ b/sound/usb/mixer_maps.c
7615 +@@ -304,6 +304,11 @@ static struct usbmix_name_map hercules_usb51_map[] = {
7616 + { 0 } /* terminator */
7617 + };
7618 +
7619 ++static const struct usbmix_name_map kef_x300a_map[] = {
7620 ++ { 10, NULL }, /* firmware locks up (?) when we try to access this FU */
7621 ++ { 0 }
7622 ++};
7623 ++
7624 + /*
7625 + * Control map entries
7626 + */
7627 +@@ -371,6 +376,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
7628 + .map = scratch_live_map,
7629 + .ignore_ctl_error = 1,
7630 + },
7631 ++ {
7632 ++ .id = USB_ID(0x27ac, 0x1000),
7633 ++ .map = kef_x300a_map,
7634 ++ },
7635 + { 0 } /* terminator */
7636 + };
7637 +
7638 +diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
7639 +index 3c6f780..279a2f1 100644
7640 +--- a/tools/power/x86/turbostat/turbostat.c
7641 ++++ b/tools/power/x86/turbostat/turbostat.c
7642 +@@ -32,6 +32,7 @@
7643 + #include <dirent.h>
7644 + #include <string.h>
7645 + #include <ctype.h>
7646 ++#include <cpuid.h>
7647 +
7648 + #define MSR_TSC 0x10
7649 + #define MSR_NEHALEM_PLATFORM_INFO 0xCE
7650 +@@ -847,7 +848,7 @@ void check_cpuid()
7651 +
7652 + eax = ebx = ecx = edx = 0;
7653 +
7654 +- asm("cpuid" : "=a" (max_level), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0));
7655 ++ __get_cpuid(0, &max_level, &ebx, &ecx, &edx);
7656 +
7657 + if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e)
7658 + genuine_intel = 1;
7659 +@@ -856,7 +857,7 @@ void check_cpuid()
7660 + fprintf(stderr, "%.4s%.4s%.4s ",
7661 + (char *)&ebx, (char *)&edx, (char *)&ecx);
7662 +
7663 +- asm("cpuid" : "=a" (fms), "=c" (ecx), "=d" (edx) : "a" (1) : "ebx");
7664 ++ __get_cpuid(1, &fms, &ebx, &ecx, &edx);
7665 + family = (fms >> 8) & 0xf;
7666 + model = (fms >> 4) & 0xf;
7667 + stepping = fms & 0xf;
7668 +@@ -878,7 +879,7 @@ void check_cpuid()
7669 + * This check is valid for both Intel and AMD.
7670 + */
7671 + ebx = ecx = edx = 0;
7672 +- asm("cpuid" : "=a" (max_level), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x80000000));
7673 ++ __get_cpuid(0x80000000, &max_level, &ebx, &ecx, &edx);
7674 +
7675 + if (max_level < 0x80000007) {
7676 + fprintf(stderr, "CPUID: no invariant TSC (max_level 0x%x)\n", max_level);
7677 +@@ -889,7 +890,7 @@ void check_cpuid()
7678 + * Non-Stop TSC is advertised by CPUID.EAX=0x80000007: EDX.bit8
7679 + * this check is valid for both Intel and AMD
7680 + */
7681 +- asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x80000007));
7682 ++ __get_cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
7683 + has_invariant_tsc = edx & (1 << 8);
7684 +
7685 + if (!has_invariant_tsc) {
7686 +@@ -902,7 +903,7 @@ void check_cpuid()
7687 + * this check is valid for both Intel and AMD
7688 + */
7689 +
7690 +- asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (0x6));
7691 ++ __get_cpuid(0x6, &eax, &ebx, &ecx, &edx);
7692 + has_aperf = ecx & (1 << 0);
7693 + if (!has_aperf) {
7694 + fprintf(stderr, "No APERF MSR\n");
7695 +diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
7696 +index a6ec206..e56b240 100644
7697 +--- a/virt/kvm/coalesced_mmio.c
7698 ++++ b/virt/kvm/coalesced_mmio.c
7699 +@@ -148,17 +148,13 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
7700 + list_add_tail(&dev->list, &kvm->coalesced_zones);
7701 + mutex_unlock(&kvm->slots_lock);
7702 +
7703 +- return ret;
7704 ++ return 0;
7705 +
7706 + out_free_dev:
7707 + mutex_unlock(&kvm->slots_lock);
7708 +-
7709 + kfree(dev);
7710 +
7711 +- if (dev == NULL)
7712 +- return -ENXIO;
7713 +-
7714 +- return 0;
7715 ++ return ret;
7716 + }
7717 +
7718 + int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
7719
7720 diff --git a/3.2.55/4420_grsecurity-3.0-3.2.55-201403300851.patch b/3.2.56/4420_grsecurity-3.0-3.2.56-201404012135.patch
7721 similarity index 99%
7722 rename from 3.2.55/4420_grsecurity-3.0-3.2.55-201403300851.patch
7723 rename to 3.2.56/4420_grsecurity-3.0-3.2.56-201404012135.patch
7724 index 73a3dcc..4f4f0f9 100644
7725 --- a/3.2.55/4420_grsecurity-3.0-3.2.55-201403300851.patch
7726 +++ b/3.2.56/4420_grsecurity-3.0-3.2.56-201404012135.patch
7727 @@ -273,7 +273,7 @@ index 88fd7f5..b318a78 100644
7728 ==============================================================
7729
7730 diff --git a/Makefile b/Makefile
7731 -index 538463e..aa55228 100644
7732 +index ec90bfb..3e09b31 100644
7733 --- a/Makefile
7734 +++ b/Makefile
7735 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
7736 @@ -1563,7 +1563,7 @@ index 75fe66b..2255c86 100644
7737 /*
7738 * Memory returned by kmalloc() may be used for DMA, so we must make
7739 diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
7740 -index 1397408..c4f6969 100644
7741 +index b1e0e07..071fe7c 100644
7742 --- a/arch/arm/include/asm/cacheflush.h
7743 +++ b/arch/arm/include/asm/cacheflush.h
7744 @@ -108,7 +108,7 @@ struct cpu_cache_fns {
7745 @@ -17832,10 +17832,10 @@ index df5e41f..816c719 100644
7746 extern int generic_get_free_region(unsigned long base, unsigned long size,
7747 int replace_reg);
7748 diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
7749 -index 2bda212..78cc605 100644
7750 +index 1c041e0..ec625d2 100644
7751 --- a/arch/x86/kernel/cpu/perf_event.c
7752 +++ b/arch/x86/kernel/cpu/perf_event.c
7753 -@@ -1529,7 +1529,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
7754 +@@ -1532,7 +1532,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
7755 break;
7756
7757 perf_callchain_store(entry, frame.return_address);
7758 @@ -21090,7 +21090,7 @@ index 8c96897..060ff2d 100644
7759 regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
7760 t->iopl = level << 12;
7761 diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
7762 -index fb2eb32..62793bd 100644
7763 +index 687637b..3e626d9 100644
7764 --- a/arch/x86/kernel/irq.c
7765 +++ b/arch/x86/kernel/irq.c
7766 @@ -18,7 +18,7 @@
7767 @@ -23040,7 +23040,7 @@ index 16204dc..0e7d4b7 100644
7768 .smp_prepare_cpus = native_smp_prepare_cpus,
7769 .smp_cpus_done = native_smp_cpus_done,
7770 diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
7771 -index 9f548cb..053b7e5 100644
7772 +index b88eadb..ac6663c 100644
7773 --- a/arch/x86/kernel/smpboot.c
7774 +++ b/arch/x86/kernel/smpboot.c
7775 @@ -692,7 +692,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
7776 @@ -24363,7 +24363,7 @@ index f5302da..6ee193e 100644
7777
7778 /* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */
7779 diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
7780 -index 757c716..11c70cf 100644
7781 +index 176205a..920cd58 100644
7782 --- a/arch/x86/kvm/lapic.c
7783 +++ b/arch/x86/kvm/lapic.c
7784 @@ -53,7 +53,7 @@
7785 @@ -24420,10 +24420,10 @@ index 9299410..ade2f9b 100644
7786 spin_unlock(&vcpu->kvm->mmu_lock);
7787
7788 diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
7789 -index 94a4672..5c6b853 100644
7790 +index 2102a17..16e1531 100644
7791 --- a/arch/x86/kvm/svm.c
7792 +++ b/arch/x86/kvm/svm.c
7793 -@@ -3405,7 +3405,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
7794 +@@ -3403,7 +3403,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
7795 int cpu = raw_smp_processor_id();
7796
7797 struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
7798 @@ -24566,10 +24566,10 @@ index aac5ea7..266eda9 100644
7799
7800 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
7801 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
7802 -index 7774cca..97dedc9 100644
7803 +index b9fefaf..32b0407 100644
7804 --- a/arch/x86/kvm/x86.c
7805 +++ b/arch/x86/kvm/x86.c
7806 -@@ -1341,8 +1341,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
7807 +@@ -1344,8 +1344,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
7808 {
7809 struct kvm *kvm = vcpu->kvm;
7810 int lm = is_long_mode(vcpu);
7811 @@ -24580,7 +24580,7 @@ index 7774cca..97dedc9 100644
7812 u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
7813 : kvm->arch.xen_hvm_config.blob_size_32;
7814 u32 page_num = data & ~PAGE_MASK;
7815 -@@ -2159,6 +2159,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
7816 +@@ -2162,6 +2162,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
7817 if (n < msr_list.nmsrs)
7818 goto out;
7819 r = -EFAULT;
7820 @@ -24589,7 +24589,7 @@ index 7774cca..97dedc9 100644
7821 if (copy_to_user(user_msr_list->indices, &msrs_to_save,
7822 num_msrs_to_save * sizeof(u32)))
7823 goto out;
7824 -@@ -2334,15 +2336,20 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
7825 +@@ -2337,15 +2339,20 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
7826 struct kvm_cpuid2 *cpuid,
7827 struct kvm_cpuid_entry2 __user *entries)
7828 {
7829 @@ -24613,7 +24613,7 @@ index 7774cca..97dedc9 100644
7830 vcpu->arch.cpuid_nent = cpuid->nent;
7831 kvm_apic_set_version(vcpu);
7832 kvm_x86_ops->cpuid_update(vcpu);
7833 -@@ -2357,15 +2364,19 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
7834 +@@ -2360,15 +2367,19 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
7835 struct kvm_cpuid2 *cpuid,
7836 struct kvm_cpuid_entry2 __user *entries)
7837 {
7838 @@ -24636,7 +24636,7 @@ index 7774cca..97dedc9 100644
7839 return 0;
7840
7841 out:
7842 -@@ -2740,7 +2751,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
7843 +@@ -2743,7 +2754,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
7844 static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
7845 struct kvm_interrupt *irq)
7846 {
7847 @@ -24645,7 +24645,7 @@ index 7774cca..97dedc9 100644
7848 return -EINVAL;
7849 if (irqchip_in_kernel(vcpu->kvm))
7850 return -ENXIO;
7851 -@@ -5181,7 +5192,7 @@ static void kvm_set_mmio_spte_mask(void)
7852 +@@ -5184,7 +5195,7 @@ static void kvm_set_mmio_spte_mask(void)
7853 kvm_mmu_set_mmio_spte_mask(mask);
7854 }
7855
7856 @@ -32367,10 +32367,10 @@ index de2802c..2260da9 100644
7857 unsigned long timeout_msec)
7858 {
7859 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
7860 -index 72bbb5e..19f16d3 100644
7861 +index b3f0f5a..b6bc0a7 100644
7862 --- a/drivers/ata/libata-core.c
7863 +++ b/drivers/ata/libata-core.c
7864 -@@ -4749,7 +4749,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
7865 +@@ -4777,7 +4777,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
7866 struct ata_port *ap;
7867 unsigned int tag;
7868
7869 @@ -32379,7 +32379,7 @@ index 72bbb5e..19f16d3 100644
7870 ap = qc->ap;
7871
7872 qc->flags = 0;
7873 -@@ -4765,7 +4765,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
7874 +@@ -4793,7 +4793,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
7875 struct ata_port *ap;
7876 struct ata_link *link;
7877
7878 @@ -32388,7 +32388,7 @@ index 72bbb5e..19f16d3 100644
7879 WARN_ON_ONCE(!(qc->flags & ATA_QCFLAG_ACTIVE));
7880 ap = qc->ap;
7881 link = qc->dev->link;
7882 -@@ -5770,6 +5770,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
7883 +@@ -5798,6 +5798,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
7884 return;
7885
7886 spin_lock(&lock);
7887 @@ -32396,7 +32396,7 @@ index 72bbb5e..19f16d3 100644
7888
7889 for (cur = ops->inherits; cur; cur = cur->inherits) {
7890 void **inherit = (void **)cur;
7891 -@@ -5783,8 +5784,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
7892 +@@ -5811,8 +5812,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
7893 if (IS_ERR(*pp))
7894 *pp = NULL;
7895
7896 @@ -36739,10 +36739,10 @@ index 74d6ec34..baff517 100644
7897 {0,} /* 0 terminated list. */
7898 };
7899 diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
7900 -index 2244df0..8a3b7a9 100644
7901 +index 1e08426..87e8c13 100644
7902 --- a/drivers/edac/i7300_edac.c
7903 +++ b/drivers/edac/i7300_edac.c
7904 -@@ -1192,7 +1192,7 @@ static void __devexit i7300_remove_one(struct pci_dev *pdev)
7905 +@@ -1194,7 +1194,7 @@ static void __devexit i7300_remove_one(struct pci_dev *pdev)
7906 *
7907 * Has only 8086:360c PCI ID
7908 */
7909 @@ -36752,7 +36752,7 @@ index 2244df0..8a3b7a9 100644
7910 {0,} /* 0 terminated list. */
7911 };
7912 diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
7913 -index b3ccefa..d39303b 100644
7914 +index 4c18b3c..f256adc 100644
7915 --- a/drivers/edac/i7core_edac.c
7916 +++ b/drivers/edac/i7core_edac.c
7917 @@ -391,7 +391,7 @@ static const struct pci_id_table pci_dev_table[] = {
7918 @@ -37691,7 +37691,7 @@ index 93e74fb..4a1182d 100644
7919 INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
7920 INIT_WORK(&dev_priv->error_work, i915_error_work_func);
7921 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
7922 -index 61b708b..c8ca0e9 100644
7923 +index 2ea8a96..65e685e 100644
7924 --- a/drivers/gpu/drm/i915/intel_display.c
7925 +++ b/drivers/gpu/drm/i915/intel_display.c
7926 @@ -2215,7 +2215,7 @@ intel_finish_fb(struct drm_framebuffer *old_fb)
7927 @@ -37728,7 +37728,7 @@ index 61b708b..c8ca0e9 100644
7928 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff;
7929 OUT_RING(pf | pipesrc);
7930
7931 -@@ -7333,7 +7338,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7932 +@@ -7347,7 +7352,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7933 /* Block clients from rendering to the new back buffer until
7934 * the flip occurs and the object is no longer visible.
7935 */
7936 @@ -37737,7 +37737,7 @@ index 61b708b..c8ca0e9 100644
7937
7938 ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);
7939 if (ret)
7940 -@@ -7347,7 +7352,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7941 +@@ -7361,7 +7366,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7942 return 0;
7943
7944 cleanup_pending:
7945 @@ -37746,7 +37746,7 @@ index 61b708b..c8ca0e9 100644
7946 crtc->fb = old_fb;
7947 drm_gem_object_unreference(&work->old_fb_obj->base);
7948 drm_gem_object_unreference(&obj->base);
7949 -@@ -7482,11 +7487,15 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
7950 +@@ -7496,11 +7501,15 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
7951 if (HAS_PCH_SPLIT(dev)) {
7952 if (pipe == 2 && IS_IVYBRIDGE(dev))
7953 intel_crtc->no_pll = true;
7954 @@ -37766,7 +37766,7 @@ index 61b708b..c8ca0e9 100644
7955 }
7956
7957 drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs);
7958 -@@ -8862,7 +8871,7 @@ struct intel_quirk {
7959 +@@ -8876,7 +8885,7 @@ struct intel_quirk {
7960 int subsystem_vendor;
7961 int subsystem_device;
7962 void (*hook)(struct drm_device *dev);
7963 @@ -38230,10 +38230,10 @@ index 441570b..8896094 100644
7964 }
7965
7966 diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
7967 -index 57e45c6..73bf8a5 100644
7968 +index f7e3cc0..d9878ef 100644
7969 --- a/drivers/gpu/drm/radeon/r600.c
7970 +++ b/drivers/gpu/drm/radeon/r600.c
7971 -@@ -2440,7 +2440,9 @@ int r600_startup(struct radeon_device *rdev)
7972 +@@ -2442,7 +2442,9 @@ int r600_startup(struct radeon_device *rdev)
7973 r = r600_blit_init(rdev);
7974 if (r) {
7975 r600_blit_fini(rdev);
7976 @@ -38954,7 +38954,7 @@ index f4c3d28..82f45a9 100644
7977 ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
7978 if (ret)
7979 diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
7980 -index 0fb100e..baf87e5 100644
7981 +index 0fb100e..8a1a2a4 100644
7982 --- a/drivers/hv/hv.c
7983 +++ b/drivers/hv/hv.c
7984 @@ -132,7 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
7985 @@ -38966,6 +38966,15 @@ index 0fb100e..baf87e5 100644
7986
7987 __asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
7988 "=a"(hv_status_lo) : "d" (control_hi),
7989 +@@ -176,7 +176,7 @@ int hv_init(void)
7990 + /* See if the hypercall page is already set */
7991 + rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
7992 +
7993 +- virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
7994 ++ virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_RX);
7995 +
7996 + if (!virtaddr)
7997 + goto cleanup;
7998 diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
7999 index 0aee112..b72d21f 100644
8000 --- a/drivers/hv/hyperv_vmbus.h
8001 @@ -41676,7 +41685,7 @@ index 237571a..fb6d19b 100644
8002 pmd->bl_info.value_type.inc = data_block_inc;
8003 pmd->bl_info.value_type.dec = data_block_dec;
8004 diff --git a/drivers/md/dm.c b/drivers/md/dm.c
8005 -index 8953630..29b12d9 100644
8006 +index 7ead065..832d24d 100644
8007 --- a/drivers/md/dm.c
8008 +++ b/drivers/md/dm.c
8009 @@ -177,9 +177,9 @@ struct mapped_device {
8010 @@ -41702,7 +41711,7 @@ index 8953630..29b12d9 100644
8011 INIT_LIST_HEAD(&md->uevent_list);
8012 spin_lock_init(&md->uevent_lock);
8013
8014 -@@ -2006,7 +2006,7 @@ static void event_callback(void *context)
8015 +@@ -2007,7 +2007,7 @@ static void event_callback(void *context)
8016
8017 dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj);
8018
8019 @@ -41711,7 +41720,7 @@ index 8953630..29b12d9 100644
8020 wake_up(&md->eventq);
8021 }
8022
8023 -@@ -2648,18 +2648,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
8024 +@@ -2649,18 +2649,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
8025
8026 uint32_t dm_next_uevent_seq(struct mapped_device *md)
8027 {
8028 @@ -41991,7 +42000,7 @@ index 6d05e26..a579e8c 100644
8029
8030 rdev_dec_pending(rdev, mddev);
8031 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
8032 -index fb67833..09c4732 100644
8033 +index 7c963c4..1204886 100644
8034 --- a/drivers/md/raid5.c
8035 +++ b/drivers/md/raid5.c
8036 @@ -1618,19 +1618,19 @@ static void raid5_end_read_request(struct bio * bi, int error)
8037 @@ -43493,7 +43502,7 @@ index 9a517c2..6d245e1 100644
8038 /**
8039 * Send and RX_MODE ramrod according to the provided parameters.
8040 diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
8041 -index da90ba5..dcba1fd 100644
8042 +index a398a6f..4b6f6df 100644
8043 --- a/drivers/net/ethernet/broadcom/tg3.h
8044 +++ b/drivers/net/ethernet/broadcom/tg3.h
8045 @@ -134,6 +134,7 @@
8046 @@ -44429,7 +44438,7 @@ index e773250..9ee61ab 100644
8047
8048 /* we will have to manufacture ethernet headers, prepare template */
8049 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
8050 -index dc53a8f..2b66cc1 100644
8051 +index 3d21742..ddf9899 100644
8052 --- a/drivers/net/usb/usbnet.c
8053 +++ b/drivers/net/usb/usbnet.c
8054 @@ -344,6 +344,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
8055 @@ -44445,7 +44454,7 @@ index dc53a8f..2b66cc1 100644
8056 if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) {
8057 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
8058 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
8059 -@@ -503,6 +509,17 @@ block:
8060 +@@ -498,6 +504,17 @@ block:
8061 break;
8062 }
8063
8064 @@ -44463,7 +44472,7 @@ index dc53a8f..2b66cc1 100644
8065 state = defer_bh(dev, skb, &dev->rxq, state);
8066
8067 if (urb) {
8068 -@@ -789,6 +806,11 @@ int usbnet_open (struct net_device *net)
8069 +@@ -784,6 +801,11 @@ int usbnet_open (struct net_device *net)
8070 (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" :
8071 "simple");
8072
8073 @@ -44475,7 +44484,7 @@ index dc53a8f..2b66cc1 100644
8074 // delay posting reads until we're fully open
8075 tasklet_schedule (&dev->bh);
8076 if (info->manage_power) {
8077 -@@ -1227,6 +1249,9 @@ static void usbnet_bh (unsigned long param)
8078 +@@ -1222,6 +1244,9 @@ static void usbnet_bh (unsigned long param)
8079 }
8080 }
8081
8082 @@ -44681,7 +44690,7 @@ index ac1176a..79e93d4 100644
8083
8084 /* Only super-user can write RIDs */
8085 diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
8086 -index 4045e5a..506f1cf 100644
8087 +index 4045e5a..506f1cfd 100644
8088 --- a/drivers/net/wireless/at76c50x-usb.c
8089 +++ b/drivers/net/wireless/at76c50x-usb.c
8090 @@ -353,7 +353,7 @@ static u8 at76_dfu_get_state(struct usb_device *udev, u8 *state)
8091 @@ -46145,10 +46154,10 @@ index 023d17d..74ef35b 100644
8092 init_data = &pdata->regulators[i];
8093 priv->regulators[i] = regulator_register(
8094 diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
8095 -index e3eed18..155946b 100644
8096 +index cae8985..8027fa7 100644
8097 --- a/drivers/rtc/rtc-cmos.c
8098 +++ b/drivers/rtc/rtc-cmos.c
8099 -@@ -724,7 +724,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
8100 +@@ -772,7 +772,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
8101 hpet_rtc_timer_init();
8102
8103 /* export at least the first block of NVRAM */
8104 @@ -47889,10 +47898,10 @@ index ed147c4..94fc3c6 100644
8105
8106 /* core tmem accessor functions */
8107 diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
8108 -index 45c13a6..f8c847c 100644
8109 +index 4a88eea..f00e986 100644
8110 --- a/drivers/target/iscsi/iscsi_target.c
8111 +++ b/drivers/target/iscsi/iscsi_target.c
8112 -@@ -1349,7 +1349,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
8113 +@@ -1357,7 +1357,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
8114 * outstanding_r2ts reaches zero, go ahead and send the delayed
8115 * TASK_ABORTED status.
8116 */
8117 @@ -48333,10 +48342,10 @@ index ef92869..f4ebd88 100644
8118 ipwireless_disassociate_network_ttys(network,
8119 ttyj->channel_idx);
8120 diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
8121 -index d190269..f59727e 100644
8122 +index 643a0a0..4da1c03 100644
8123 --- a/drivers/tty/n_gsm.c
8124 +++ b/drivers/tty/n_gsm.c
8125 -@@ -1638,7 +1638,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
8126 +@@ -1649,7 +1649,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
8127 kref_init(&dlci->ref);
8128 mutex_init(&dlci->mutex);
8129 dlci->fifo = &dlci->_fifo;
8130 @@ -49317,6 +49326,38 @@ index 5f6df6e..0a16602 100644
8131 }
8132
8133 /*
8134 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
8135 +index 5c58128..92c839d 100644
8136 +--- a/drivers/vhost/net.c
8137 ++++ b/drivers/vhost/net.c
8138 +@@ -346,6 +346,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
8139 + *iovcount = seg;
8140 + if (unlikely(log))
8141 + *log_num = nlogs;
8142 ++
8143 ++ /* Detect overrun */
8144 ++ if (unlikely(datalen > 0)) {
8145 ++ r = UIO_MAXIOV + 1;
8146 ++ goto err;
8147 ++ }
8148 + return headcount;
8149 + err:
8150 + vhost_discard_vq_desc(vq, headcount);
8151 +@@ -400,6 +406,14 @@ static void handle_rx(struct vhost_net *net)
8152 + /* On error, stop handling until the next kick. */
8153 + if (unlikely(headcount < 0))
8154 + break;
8155 ++ /* On overrun, truncate and discard */
8156 ++ if (unlikely(headcount > UIO_MAXIOV)) {
8157 ++ msg.msg_iovlen = 1;
8158 ++ err = sock->ops->recvmsg(NULL, sock, &msg,
8159 ++ 1, MSG_DONTWAIT | MSG_TRUNC);
8160 ++ pr_debug("Discarded rx packet: len %zd\n", sock_len);
8161 ++ continue;
8162 ++ }
8163 + /* OK, now we need to know about added descriptors. */
8164 + if (!headcount) {
8165 + if (unlikely(vhost_enable_notify(&net->dev, vq))) {
8166 diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
8167 index be32b1b..b5f6c08 100644
8168 --- a/drivers/vhost/vhost.c
8169 @@ -54392,7 +54433,7 @@ index dede441..f2a2507 100644
8170
8171 WARN_ON(trans->transid != btrfs_header_generation(parent));
8172 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
8173 -index 49eefdb..547693e 100644
8174 +index f63719a..5f00ed6 100644
8175 --- a/fs/btrfs/extent-tree.c
8176 +++ b/fs/btrfs/extent-tree.c
8177 @@ -5642,7 +5642,7 @@ again:
8178 @@ -54405,25 +54446,10 @@ index 49eefdb..547693e 100644
8179 do_chunk_alloc(trans, root->fs_info->extent_root,
8180 num_bytes, data, CHUNK_ALLOC_FORCE);
8181 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
8182 -index 618ae6f..82d0bc6 100644
8183 +index 7cbe2f8..2e2ed72 100644
8184 --- a/fs/btrfs/ioctl.c
8185 +++ b/fs/btrfs/ioctl.c
8186 -@@ -1329,6 +1329,14 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
8187 - ret = -EINVAL;
8188 - fput(src_file);
8189 - goto out;
8190 -+ } else if (!inode_owner_or_capable(src_inode)) {
8191 -+ /*
8192 -+ * Subvolume creation is not restricted, but snapshots
8193 -+ * are limited to own subvolumes only
8194 -+ */
8195 -+ ret = -EPERM;
8196 -+ fput(src_file);
8197 -+ goto out;
8198 - }
8199 - ret = btrfs_mksubvol(&file->f_path, name, namelen,
8200 - BTRFS_I(src_inode)->root,
8201 -@@ -2733,9 +2741,12 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
8202 +@@ -2738,9 +2738,12 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
8203 for (i = 0; i < num_types; i++) {
8204 struct btrfs_space_info *tmp;
8205
8206 @@ -54436,7 +54462,7 @@ index 618ae6f..82d0bc6 100644
8207 info = NULL;
8208 rcu_read_lock();
8209 list_for_each_entry_rcu(tmp, &root->fs_info->space_info,
8210 -@@ -2757,15 +2768,12 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
8211 +@@ -2762,15 +2765,12 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
8212 memcpy(dest, &space, sizeof(space));
8213 dest++;
8214 space_args.total_spaces++;
8215 @@ -54493,10 +54519,10 @@ index 200f63b..490b833 100644
8216 /*
8217 * used by btrfsctl to scan devices when no FS is mounted
8218 diff --git a/fs/buffer.c b/fs/buffer.c
8219 -index 19a4f0b..6638f5c 100644
8220 +index 5f4bde2..9dffef0 100644
8221 --- a/fs/buffer.c
8222 +++ b/fs/buffer.c
8223 -@@ -3314,7 +3314,7 @@ void __init buffer_init(void)
8224 +@@ -3316,7 +3316,7 @@ void __init buffer_init(void)
8225 bh_cachep = kmem_cache_create("buffer_head",
8226 sizeof(struct buffer_head), 0,
8227 (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
8228 @@ -56709,19 +56735,10 @@ index 2845a1f..f29de63 100644
8229 if (free_clusters >= (nclusters + dirty_clusters))
8230 return 1;
8231 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
8232 -index 68b1602..7f3507d 100644
8233 +index 40f4d06..7f3507d 100644
8234 --- a/fs/ext4/ext4.h
8235 +++ b/fs/ext4/ext4.h
8236 -@@ -745,6 +745,8 @@ do { \
8237 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
8238 - (einode)->xtime.tv_sec = \
8239 - (signed)le32_to_cpu((raw_inode)->xtime); \
8240 -+ else \
8241 -+ (einode)->xtime.tv_sec = 0; \
8242 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
8243 - ext4_decode_extra_time(&(einode)->xtime, \
8244 - raw_inode->xtime ## _extra); \
8245 -@@ -1216,19 +1218,19 @@ struct ext4_sb_info {
8246 +@@ -1218,19 +1218,19 @@ struct ext4_sb_info {
8247 unsigned long s_mb_last_start;
8248
8249 /* stats for buddy allocator */
8250 @@ -57119,7 +57136,7 @@ index cf6f434..3d7942c 100644
8251
8252 err_nocleanup:
8253 diff --git a/fs/file.c b/fs/file.c
8254 -index 4c6992d..41c1f84 100644
8255 +index 30bfc99..b4b9a12 100644
8256 --- a/fs/file.c
8257 +++ b/fs/file.c
8258 @@ -15,6 +15,7 @@
8259 @@ -58652,10 +58669,10 @@ index 3426521..3b75162 100644
8260 cuse_class = class_create(THIS_MODULE, "cuse");
8261 if (IS_ERR(cuse_class))
8262 diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
8263 -index 5c029fb..96e676c 100644
8264 +index cf0098d..a849907 100644
8265 --- a/fs/fuse/dev.c
8266 +++ b/fs/fuse/dev.c
8267 -@@ -1242,7 +1242,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
8268 +@@ -1226,7 +1226,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
8269 ret = 0;
8270 pipe_lock(pipe);
8271
8272 @@ -58773,10 +58790,10 @@ index 2f72da5..7ee87b1 100644
8273 static int __init init_hostfs(void)
8274 {
8275 diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
8276 -index f760c15..61b7191 100644
8277 +index b03e766..0b5cb61 100644
8278 --- a/fs/hpfs/super.c
8279 +++ b/fs/hpfs/super.c
8280 -@@ -691,6 +691,7 @@ static struct file_system_type hpfs_fs_type = {
8281 +@@ -707,6 +707,7 @@ static struct file_system_type hpfs_fs_type = {
8282 .kill_sb = kill_block_super,
8283 .fs_flags = FS_REQUIRES_DEV,
8284 };
8285 @@ -59884,7 +59901,7 @@ index b78b5b6..c64d84f 100644
8286
8287 void nfs_fattr_init(struct nfs_fattr *fattr)
8288 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
8289 -index 3d02931..e2b575a 100644
8290 +index 5aea30a..5dcc620 100644
8291 --- a/fs/nfs/nfs4proc.c
8292 +++ b/fs/nfs/nfs4proc.c
8293 @@ -1037,7 +1037,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
8294 @@ -62580,7 +62597,7 @@ index dba43c3..4e25536 100644
8295
8296 if (op) {
8297 diff --git a/fs/splice.c b/fs/splice.c
8298 -index 58ab918..24425c2 100644
8299 +index 714471d..2ca7fb5 100644
8300 --- a/fs/splice.c
8301 +++ b/fs/splice.c
8302 @@ -195,7 +195,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
8303 @@ -62604,7 +62621,7 @@ index 58ab918..24425c2 100644
8304 }
8305
8306 pipe_unlock(pipe);
8307 -@@ -564,7 +564,7 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
8308 +@@ -582,7 +582,7 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
8309 old_fs = get_fs();
8310 set_fs(get_ds());
8311 /* The cast to a user pointer is valid due to the set_fs() */
8312 @@ -62613,7 +62630,7 @@ index 58ab918..24425c2 100644
8313 set_fs(old_fs);
8314
8315 return res;
8316 -@@ -579,7 +579,7 @@ static ssize_t kernel_write(struct file *file, const char *buf, size_t count,
8317 +@@ -597,7 +597,7 @@ static ssize_t kernel_write(struct file *file, const char *buf, size_t count,
8318 old_fs = get_fs();
8319 set_fs(get_ds());
8320 /* The cast to a user pointer is valid due to the set_fs() */
8321 @@ -62622,7 +62639,7 @@ index 58ab918..24425c2 100644
8322 set_fs(old_fs);
8323
8324 return res;
8325 -@@ -631,7 +631,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
8326 +@@ -649,7 +649,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
8327 goto err;
8328
8329 this_len = min_t(size_t, len, PAGE_CACHE_SIZE - offset);
8330 @@ -62631,7 +62648,7 @@ index 58ab918..24425c2 100644
8331 vec[i].iov_len = this_len;
8332 spd.pages[i] = page;
8333 spd.nr_pages++;
8334 -@@ -855,10 +855,10 @@ EXPORT_SYMBOL(splice_from_pipe_feed);
8335 +@@ -873,10 +873,10 @@ EXPORT_SYMBOL(splice_from_pipe_feed);
8336 int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc *sd)
8337 {
8338 while (!pipe->nrbufs) {
8339 @@ -62644,7 +62661,7 @@ index 58ab918..24425c2 100644
8340 return 0;
8341
8342 if (sd->flags & SPLICE_F_NONBLOCK)
8343 -@@ -1191,7 +1191,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
8344 +@@ -1209,7 +1209,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
8345 * out of the pipe right after the splice_to_pipe(). So set
8346 * PIPE_READERS appropriately.
8347 */
8348 @@ -62653,7 +62670,7 @@ index 58ab918..24425c2 100644
8349
8350 current->splice_pipe = pipe;
8351 }
8352 -@@ -1459,6 +1459,7 @@ static int get_iovec_page_array(const struct iovec __user *iov,
8353 +@@ -1477,6 +1477,7 @@ static int get_iovec_page_array(const struct iovec __user *iov,
8354
8355 partial[buffers].offset = off;
8356 partial[buffers].len = plen;
8357 @@ -62661,7 +62678,7 @@ index 58ab918..24425c2 100644
8358
8359 off = 0;
8360 len -= plen;
8361 -@@ -1744,9 +1745,9 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8362 +@@ -1762,9 +1763,9 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8363 ret = -ERESTARTSYS;
8364 break;
8365 }
8366 @@ -62673,7 +62690,7 @@ index 58ab918..24425c2 100644
8367 if (flags & SPLICE_F_NONBLOCK) {
8368 ret = -EAGAIN;
8369 break;
8370 -@@ -1778,7 +1779,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8371 +@@ -1796,7 +1797,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8372 pipe_lock(pipe);
8373
8374 while (pipe->nrbufs >= pipe->buffers) {
8375 @@ -62682,7 +62699,7 @@ index 58ab918..24425c2 100644
8376 send_sig(SIGPIPE, current, 0);
8377 ret = -EPIPE;
8378 break;
8379 -@@ -1791,9 +1792,9 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8380 +@@ -1809,9 +1810,9 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
8381 ret = -ERESTARTSYS;
8382 break;
8383 }
8384 @@ -62694,7 +62711,7 @@ index 58ab918..24425c2 100644
8385 }
8386
8387 pipe_unlock(pipe);
8388 -@@ -1829,14 +1830,14 @@ retry:
8389 +@@ -1847,14 +1848,14 @@ retry:
8390 pipe_double_lock(ipipe, opipe);
8391
8392 do {
8393 @@ -62711,7 +62728,7 @@ index 58ab918..24425c2 100644
8394 break;
8395
8396 /*
8397 -@@ -1933,7 +1934,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
8398 +@@ -1951,7 +1952,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
8399 pipe_double_lock(ipipe, opipe);
8400
8401 do {
8402 @@ -62720,7 +62737,7 @@ index 58ab918..24425c2 100644
8403 send_sig(SIGPIPE, current, 0);
8404 if (!ret)
8405 ret = -EPIPE;
8406 -@@ -1978,7 +1979,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
8407 +@@ -1996,7 +1997,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
8408 * return EAGAIN if we have the potential of some data in the
8409 * future, otherwise just return 0
8410 */
8411 @@ -75610,18 +75627,11 @@ index d42bd48..554dcd5 100644
8412 /*
8413 * epoll (fs/eventpoll.c) compat bits follow ...
8414 diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
8415 -index 643d6c4..3c5171b 100644
8416 +index e2a360a..1d61efb 100644
8417 --- a/include/linux/compiler-gcc4.h
8418 +++ b/include/linux/compiler-gcc4.h
8419 -@@ -39,13 +39,29 @@
8420 - *
8421 - * (asm goto is automatically volatile - the naming reflects this.)
8422 - */
8423 --#if GCC_VERSION <= 40801
8424 - # define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
8425 --#else
8426 --# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
8427 --#endif
8428 +@@ -42,6 +42,26 @@
8429 + #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
8430
8431 #if __GNUC_MINOR__ >= 5
8432 +
8433 @@ -75647,7 +75657,7 @@ index 643d6c4..3c5171b 100644
8434 /*
8435 * Mark a position in code as unreachable. This can be used to
8436 * suppress control flow warnings after asm blocks that transfer
8437 -@@ -61,6 +77,11 @@
8438 +@@ -57,6 +77,11 @@
8439 #define __noclone __attribute__((__noclone__))
8440
8441 #endif
8442 @@ -78098,7 +78108,7 @@ index f1e2527..9a323d1 100644
8443 irq_flow_handler_t handle_irq;
8444 #ifdef CONFIG_IRQ_PREFLOW_FASTEOI
8445 diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
8446 -index 265e2c3..cdd6f29 100644
8447 +index f5df3dc..116cbeb 100644
8448 --- a/include/linux/jiffies.h
8449 +++ b/include/linux/jiffies.h
8450 @@ -295,9 +295,9 @@ extern unsigned long preset_lpj;
8451 @@ -78337,10 +78347,10 @@ index e6796c1..350d338 100644
8452
8453 int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
8454 diff --git a/include/linux/libata.h b/include/linux/libata.h
8455 -index 62467ca..3d65d7d 100644
8456 +index b1fcdba..855901a 100644
8457 --- a/include/linux/libata.h
8458 +++ b/include/linux/libata.h
8459 -@@ -910,7 +910,7 @@ struct ata_port_operations {
8460 +@@ -912,7 +912,7 @@ struct ata_port_operations {
8461 * fields must be pointers.
8462 */
8463 const struct ata_port_operations *inherits;
8464 @@ -79338,7 +79348,7 @@ index 38d1032..d3f6744 100644
8465 extern struct pid_namespace init_pid_ns;
8466
8467 diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
8468 -index 0072a53..c5dcca5 100644
8469 +index 8778c26..732cf42 100644
8470 --- a/include/linux/pipe_fs_i.h
8471 +++ b/include/linux/pipe_fs_i.h
8472 @@ -47,9 +47,9 @@ struct pipe_buffer {
8473 @@ -83846,10 +83856,10 @@ index b463871..59495fd 100644
8474 * nsown_capable - Check superior capability to one's own user_ns
8475 * @cap: The capability in question
8476 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
8477 -index 2a1ffb7..b99a595 100644
8478 +index 93fc15e..6e62dfa 100644
8479 --- a/kernel/cgroup.c
8480 +++ b/kernel/cgroup.c
8481 -@@ -5164,7 +5164,7 @@ static int cgroup_css_links_read(struct cgroup *cont,
8482 +@@ -5169,7 +5169,7 @@ static int cgroup_css_links_read(struct cgroup *cont,
8483 struct css_set *cg = link->cg;
8484 struct task_struct *task;
8485 int count = 0;
8486 @@ -84267,7 +84277,7 @@ index 63786e7..0780cac 100644
8487 #ifdef CONFIG_MODULE_UNLOAD
8488 {
8489 diff --git a/kernel/events/core.c b/kernel/events/core.c
8490 -index 83d5621..8c6738d 100644
8491 +index b15b4f7..dc15ea9 100644
8492 --- a/kernel/events/core.c
8493 +++ b/kernel/events/core.c
8494 @@ -145,8 +145,15 @@ static struct srcu_struct pmus_srcu;
8495 @@ -85045,7 +85055,7 @@ index 60f7e32..d703ad4 100644
8496 };
8497
8498 diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
8499 -index 52bdd58..56002b5 100644
8500 +index 47752298..4d8aa3c 100644
8501 --- a/kernel/irq/manage.c
8502 +++ b/kernel/irq/manage.c
8503 @@ -900,22 +900,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
8504 @@ -86934,7 +86944,7 @@ index 3d4b954..11af930 100644
8505
8506 if (pm_wakeup_pending()) {
8507 diff --git a/kernel/printk.c b/kernel/printk.c
8508 -index 16688ec..327729b 100644
8509 +index 8fac434..7759a11 100644
8510 --- a/kernel/printk.c
8511 +++ b/kernel/printk.c
8512 @@ -313,6 +313,11 @@ static int check_syslog_permissions(int type, bool from_file)
8513 @@ -87893,7 +87903,7 @@ index f280df1..da1281d 100644
8514 #ifdef CONFIG_RT_GROUP_SCHED
8515 /*
8516 diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
8517 -index 37f3f39..6d3b6e1 100644
8518 +index 4c6dae1..0050e446 100644
8519 --- a/kernel/sched_fair.c
8520 +++ b/kernel/sched_fair.c
8521 @@ -4803,7 +4803,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle) { }
8522 @@ -89398,7 +89408,7 @@ index c3509fb..ebec319 100644
8523 cpumask_clear_cpu(cpu, tick_get_broadcast_mask());
8524 tick_broadcast_clear_oneshot(cpu);
8525 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
8526 -index cb7f33e..7504d61 100644
8527 +index 068c092..13b1bff 100644
8528 --- a/kernel/time/timekeeping.c
8529 +++ b/kernel/time/timekeeping.c
8530 @@ -14,6 +14,7 @@
8531 @@ -89599,10 +89609,10 @@ index 16fc34a..efd8bb8 100644
8532 ret = -EIO;
8533 bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt,
8534 diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
8535 -index cf8b439..fe97a05 100644
8536 +index a65fa36..ca1b827 100644
8537 --- a/kernel/trace/ftrace.c
8538 +++ b/kernel/trace/ftrace.c
8539 -@@ -1598,12 +1598,17 @@ ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
8540 +@@ -1610,12 +1610,17 @@ ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
8541 if (unlikely(ftrace_disabled))
8542 return 0;
8543
8544 @@ -89622,7 +89632,7 @@ index cf8b439..fe97a05 100644
8545 }
8546
8547 /*
8548 -@@ -2665,7 +2670,7 @@ static void ftrace_free_entry_rcu(struct rcu_head *rhp)
8549 +@@ -2695,7 +2700,7 @@ static void ftrace_free_entry_rcu(struct rcu_head *rhp)
8550
8551 int
8552 register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
8553 @@ -89631,7 +89641,7 @@ index cf8b439..fe97a05 100644
8554 {
8555 struct ftrace_func_probe *entry;
8556 struct ftrace_page *pg;
8557 -@@ -4034,8 +4039,6 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
8558 +@@ -4064,8 +4069,6 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
8559 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
8560
8561 static int ftrace_graph_active;
8562 @@ -89640,7 +89650,7 @@ index cf8b439..fe97a05 100644
8563 int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
8564 {
8565 return 0;
8566 -@@ -4179,6 +4182,10 @@ ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state,
8567 +@@ -4210,6 +4213,10 @@ ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state,
8568 return NOTIFY_DONE;
8569 }
8570
8571 @@ -89651,7 +89661,7 @@ index cf8b439..fe97a05 100644
8572 /* Just a place holder for function graph */
8573 static struct ftrace_ops fgraph_ops __read_mostly = {
8574 .func = ftrace_stub,
8575 -@@ -4198,7 +4205,6 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
8576 +@@ -4253,7 +4260,6 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
8577 goto out;
8578 }
8579
8580 @@ -89660,7 +89670,7 @@ index cf8b439..fe97a05 100644
8581
8582 ftrace_graph_active++;
8583 diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
8584 -index 6fdc629..55739fe 100644
8585 +index 648f25a..5971796 100644
8586 --- a/kernel/trace/ring_buffer.c
8587 +++ b/kernel/trace/ring_buffer.c
8588 @@ -376,9 +376,9 @@ struct buffer_data_page {
8589 @@ -89789,7 +89799,7 @@ index 6fdc629..55739fe 100644
8590
8591 /* set write to only the index of the write */
8592 write &= RB_WRITE_MASK;
8593 -@@ -2051,7 +2051,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
8594 +@@ -2058,7 +2058,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
8595 kmemcheck_annotate_bitfield(event, bitfield);
8596 rb_update_event(cpu_buffer, event, length, add_timestamp, delta);
8597
8598 @@ -89798,7 +89808,7 @@ index 6fdc629..55739fe 100644
8599
8600 /*
8601 * If this is the first commit on the page, then update
8602 -@@ -2084,7 +2084,7 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
8603 +@@ -2091,7 +2091,7 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
8604
8605 if (bpage->page == (void *)addr && rb_page_write(bpage) == old_index) {
8606 unsigned long write_mask =
8607 @@ -89807,7 +89817,7 @@ index 6fdc629..55739fe 100644
8608 unsigned long event_length = rb_event_length(event);
8609 /*
8610 * This is on the tail page. It is possible that
8611 -@@ -2094,7 +2094,7 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
8612 +@@ -2101,7 +2101,7 @@ rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer,
8613 */
8614 old_index += write_mask;
8615 new_index += write_mask;
8616 @@ -89816,7 +89826,7 @@ index 6fdc629..55739fe 100644
8617 if (index == old_index) {
8618 /* update counters */
8619 local_sub(event_length, &cpu_buffer->entries_bytes);
8620 -@@ -2433,7 +2433,7 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer,
8621 +@@ -2440,7 +2440,7 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer,
8622
8623 /* Do the likely case first */
8624 if (likely(bpage->page == (void *)addr)) {
8625 @@ -89825,7 +89835,7 @@ index 6fdc629..55739fe 100644
8626 return;
8627 }
8628
8629 -@@ -2445,7 +2445,7 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer,
8630 +@@ -2452,7 +2452,7 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer,
8631 start = bpage;
8632 do {
8633 if (bpage->page == (void *)addr) {
8634 @@ -89834,7 +89844,7 @@ index 6fdc629..55739fe 100644
8635 return;
8636 }
8637 rb_inc_page(cpu_buffer, &bpage);
8638 -@@ -2670,7 +2670,7 @@ static inline unsigned long
8639 +@@ -2677,7 +2677,7 @@ static inline unsigned long
8640 rb_num_of_entries(struct ring_buffer_per_cpu *cpu_buffer)
8641 {
8642 return local_read(&cpu_buffer->entries) -
8643 @@ -89843,7 +89853,7 @@ index 6fdc629..55739fe 100644
8644 }
8645
8646 /**
8647 -@@ -2758,7 +2758,7 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu)
8648 +@@ -2765,7 +2765,7 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu)
8649 return 0;
8650
8651 cpu_buffer = buffer->buffers[cpu];
8652 @@ -89852,7 +89862,7 @@ index 6fdc629..55739fe 100644
8653
8654 return ret;
8655 }
8656 -@@ -2779,7 +2779,7 @@ ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
8657 +@@ -2786,7 +2786,7 @@ ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
8658 return 0;
8659
8660 cpu_buffer = buffer->buffers[cpu];
8661 @@ -89861,7 +89871,7 @@ index 6fdc629..55739fe 100644
8662
8663 return ret;
8664 }
8665 -@@ -2824,7 +2824,7 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer)
8666 +@@ -2831,7 +2831,7 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer)
8667 /* if you care about this being correct, lock the buffer */
8668 for_each_buffer_cpu(buffer, cpu) {
8669 cpu_buffer = buffer->buffers[cpu];
8670 @@ -89870,7 +89880,7 @@ index 6fdc629..55739fe 100644
8671 }
8672
8673 return overruns;
8674 -@@ -2996,8 +2996,8 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
8675 +@@ -3003,8 +3003,8 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
8676 /*
8677 * Reset the reader page to size zero.
8678 */
8679 @@ -89881,7 +89891,7 @@ index 6fdc629..55739fe 100644
8680 local_set(&cpu_buffer->reader_page->page->commit, 0);
8681 cpu_buffer->reader_page->real_end = 0;
8682
8683 -@@ -3031,7 +3031,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
8684 +@@ -3038,7 +3038,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
8685 * want to compare with the last_overrun.
8686 */
8687 smp_mb();
8688 @@ -89890,7 +89900,7 @@ index 6fdc629..55739fe 100644
8689
8690 /*
8691 * Here's the tricky part.
8692 -@@ -3579,8 +3579,8 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
8693 +@@ -3586,8 +3586,8 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
8694
8695 cpu_buffer->head_page
8696 = list_entry(cpu_buffer->pages, struct buffer_page, list);
8697 @@ -89901,7 +89911,7 @@ index 6fdc629..55739fe 100644
8698 local_set(&cpu_buffer->head_page->page->commit, 0);
8699
8700 cpu_buffer->head_page->read = 0;
8701 -@@ -3589,14 +3589,14 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
8702 +@@ -3596,14 +3596,14 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
8703 cpu_buffer->commit_page = cpu_buffer->head_page;
8704
8705 INIT_LIST_HEAD(&cpu_buffer->reader_page->list);
8706 @@ -89920,7 +89930,7 @@ index 6fdc629..55739fe 100644
8707 local_set(&cpu_buffer->entries, 0);
8708 local_set(&cpu_buffer->committing, 0);
8709 local_set(&cpu_buffer->commits, 0);
8710 -@@ -3994,8 +3994,8 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
8711 +@@ -4001,8 +4001,8 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
8712 rb_init_page(bpage);
8713 bpage = reader->page;
8714 reader->page = *data_page;
8715 @@ -90002,7 +90012,7 @@ index 3947835..8c0488b 100644
8716 + return atomic64_add_return_unchecked(1, &trace_counter);
8717 }
8718 diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
8719 -index c212a7f..a2560bc 100644
8720 +index 875fed4..7a76cbb 100644
8721 --- a/kernel/trace/trace_events.c
8722 +++ b/kernel/trace/trace_events.c
8723 @@ -1299,10 +1299,6 @@ static LIST_HEAD(ftrace_module_file_list);
8724 @@ -90040,7 +90050,7 @@ index c212a7f..a2560bc 100644
8725
8726 list_add(&file_ops->list, &ftrace_module_file_list);
8727
8728 -@@ -1357,8 +1348,8 @@ static void trace_module_add_events(struct module *mod)
8729 +@@ -1367,8 +1358,8 @@ static void trace_module_add_events(struct module *mod)
8730
8731 for_each_event(call, start, end) {
8732 __trace_add_event_call(*call, mod,
8733 @@ -90236,10 +90246,10 @@ index a8bc4d9..eae8357 100644
8734 };
8735
8736 diff --git a/kernel/workqueue.c b/kernel/workqueue.c
8737 -index 0bc9ff0..4722738 100644
8738 +index 563820c..1548b9b 100644
8739 --- a/kernel/workqueue.c
8740 +++ b/kernel/workqueue.c
8741 -@@ -3499,7 +3499,7 @@ static int __cpuinit trustee_thread(void *__gcwq)
8742 +@@ -3506,7 +3506,7 @@ static int __cpuinit trustee_thread(void *__gcwq)
8743 */
8744 worker_flags |= WORKER_REBIND;
8745 worker_flags &= ~WORKER_ROGUE;
8746 @@ -90306,10 +90316,10 @@ index 82928f5..a3c7bb1 100644
8747 This option lets you use the FireWire bus for remote debugging
8748 with help of the firewire-ohci driver. It enables unfiltered
8749 diff --git a/lib/Makefile b/lib/Makefile
8750 -index a4da283..57fec5e 100644
8751 +index c06efca..bcafc28 100644
8752 --- a/lib/Makefile
8753 +++ b/lib/Makefile
8754 -@@ -45,7 +45,7 @@ obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
8755 +@@ -46,7 +46,7 @@ obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
8756
8757 obj-$(CONFIG_BTREE) += btree.o
8758 obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
8759 @@ -90792,7 +90802,7 @@ index d9df745..e73c2fe 100644
8760 static inline void *ptr_to_indirect(void *ptr)
8761 {
8762 diff --git a/lib/random32.c b/lib/random32.c
8763 -index 1f44bdc..fb616c7 100644
8764 +index 1f44bdc..009bfe8 100644
8765 --- a/lib/random32.c
8766 +++ b/lib/random32.c
8767 @@ -2,19 +2,19 @@
8768 @@ -90991,7 +91001,7 @@ index 1f44bdc..fb616c7 100644
8769 {
8770 int i;
8771 /*
8772 -@@ -92,59 +179,264 @@ void srandom32(u32 entropy)
8773 +@@ -92,59 +179,275 @@ void srandom32(u32 entropy)
8774 */
8775 for_each_possible_cpu (i) {
8776 struct rnd_state *state = &per_cpu(net_rand_state, i);
8777 @@ -91078,8 +91088,19 @@ index 1f44bdc..fb616c7 100644
8778 + static bool latch = false;
8779 + static DEFINE_SPINLOCK(lock);
8780 +
8781 ++ /* Asking for random bytes might result in bytes getting
8782 ++ * moved into the nonblocking pool and thus marking it
8783 ++ * as initialized. In this case we would double back into
8784 ++ * this function and attempt to do a late reseed.
8785 ++ * Ignore the pointless attempt to reseed again if we're
8786 ++ * already waiting for bytes when the nonblocking pool
8787 ++ * got initialized.
8788 ++ */
8789 ++
8790 + /* only allow initial seeding (late == false) once */
8791 -+ spin_lock_irqsave(&lock, flags);
8792 ++ if (!spin_trylock_irqsave(&lock, flags))
8793 ++ return;
8794 ++
8795 + if (latch && !late)
8796 + goto out;
8797 + latch = true;
8798 @@ -94815,7 +94836,7 @@ index 1db7971..5dba7b6 100644
8799 struct mm_struct *mm;
8800
8801 diff --git a/mm/page-writeback.c b/mm/page-writeback.c
8802 -index ea3f83b..001a216 100644
8803 +index b5cd796..9e4ec7c 100644
8804 --- a/mm/page-writeback.c
8805 +++ b/mm/page-writeback.c
8806 @@ -522,7 +522,7 @@ unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, unsigned long dirty)
8807 @@ -95033,7 +95054,7 @@ index cbcbb02..dfdc1de 100644
8808 pgoff_t offset, unsigned long max)
8809 {
8810 diff --git a/mm/rmap.c b/mm/rmap.c
8811 -index 8685697..7c99a3c 100644
8812 +index 52a2f36..7c99a3c 100644
8813 --- a/mm/rmap.c
8814 +++ b/mm/rmap.c
8815 @@ -153,6 +153,10 @@ int anon_vma_prepare(struct vm_area_struct *vma)
8816 @@ -95138,18 +95159,6 @@ index 8685697..7c99a3c 100644
8817 }
8818
8819 /*
8820 -@@ -581,7 +620,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm,
8821 - spinlock_t *ptl;
8822 -
8823 - if (unlikely(PageHuge(page))) {
8824 -+ /* when pud is not present, pte will be NULL */
8825 - pte = huge_pte_offset(mm, address);
8826 -+ if (!pte)
8827 -+ return NULL;
8828 -+
8829 - ptl = &mm->page_table_lock;
8830 - goto check;
8831 - }
8832 diff --git a/mm/shmem.c b/mm/shmem.c
8833 index a78acf0..a31df98 100644
8834 --- a/mm/shmem.c
8835 @@ -95870,7 +95879,7 @@ index 8105be4..8c1ce34 100644
8836 EXPORT_SYMBOL(kmem_cache_free);
8837
8838 diff --git a/mm/slub.c b/mm/slub.c
8839 -index 5710788..3d095c0 100644
8840 +index fc719f7..47b3df4 100644
8841 --- a/mm/slub.c
8842 +++ b/mm/slub.c
8843 @@ -186,7 +186,7 @@ static enum {
8844 @@ -96158,7 +96167,7 @@ index 5710788..3d095c0 100644
8845 enum slab_stat_type {
8846 SL_ALL, /* All slabs */
8847 SL_PARTIAL, /* Only partially allocated slabs */
8848 -@@ -4670,7 +4760,7 @@ SLAB_ATTR_RO(ctor);
8849 +@@ -4676,7 +4766,7 @@ SLAB_ATTR_RO(ctor);
8850
8851 static ssize_t aliases_show(struct kmem_cache *s, char *buf)
8852 {
8853 @@ -96167,7 +96176,7 @@ index 5710788..3d095c0 100644
8854 }
8855 SLAB_ATTR_RO(aliases);
8856
8857 -@@ -5237,6 +5327,7 @@ static char *create_unique_id(struct kmem_cache *s)
8858 +@@ -5243,6 +5333,7 @@ static char *create_unique_id(struct kmem_cache *s)
8859 return name;
8860 }
8861
8862 @@ -96175,7 +96184,7 @@ index 5710788..3d095c0 100644
8863 static int sysfs_slab_add(struct kmem_cache *s)
8864 {
8865 int err;
8866 -@@ -5265,7 +5356,7 @@ static int sysfs_slab_add(struct kmem_cache *s)
8867 +@@ -5271,7 +5362,7 @@ static int sysfs_slab_add(struct kmem_cache *s)
8868 }
8869
8870 s->kobj.kset = slab_kset;
8871 @@ -96184,7 +96193,7 @@ index 5710788..3d095c0 100644
8872 if (err) {
8873 kobject_put(&s->kobj);
8874 return err;
8875 -@@ -5299,6 +5390,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
8876 +@@ -5305,6 +5396,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
8877 kobject_del(&s->kobj);
8878 kobject_put(&s->kobj);
8879 }
8880 @@ -96192,7 +96201,7 @@ index 5710788..3d095c0 100644
8881
8882 /*
8883 * Need to buffer aliases during bootup until sysfs becomes
8884 -@@ -5312,6 +5404,7 @@ struct saved_alias {
8885 +@@ -5318,6 +5410,7 @@ struct saved_alias {
8886
8887 static struct saved_alias *alias_list;
8888
8889 @@ -96200,7 +96209,7 @@ index 5710788..3d095c0 100644
8890 static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
8891 {
8892 struct saved_alias *al;
8893 -@@ -5334,6 +5427,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
8894 +@@ -5340,6 +5433,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
8895 alias_list = al;
8896 return 0;
8897 }
8898 @@ -96249,7 +96258,7 @@ index a4b9016..d1a1b68 100644
8899 }
8900
8901 diff --git a/mm/swapfile.c b/mm/swapfile.c
8902 -index fad1830..6aa3a7f 100644
8903 +index dbd2b67..a1eac8c 100644
8904 --- a/mm/swapfile.c
8905 +++ b/mm/swapfile.c
8906 @@ -61,7 +61,7 @@ static DEFINE_MUTEX(swapon_mutex);
8907 @@ -96261,16 +96270,16 @@ index fad1830..6aa3a7f 100644
8908
8909 static inline unsigned char swap_count(unsigned char ent)
8910 {
8911 -@@ -1668,7 +1668,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
8912 - }
8913 - filp_close(swap_file, NULL);
8914 +@@ -1677,7 +1677,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
8915 + spin_unlock(&swap_lock);
8916 +
8917 err = 0;
8918 - atomic_inc(&proc_poll_event);
8919 + atomic_inc_unchecked(&proc_poll_event);
8920 wake_up_interruptible(&proc_poll_wait);
8921
8922 out_dput:
8923 -@@ -1684,8 +1684,8 @@ static unsigned swaps_poll(struct file *file, poll_table *wait)
8924 +@@ -1693,8 +1693,8 @@ static unsigned swaps_poll(struct file *file, poll_table *wait)
8925
8926 poll_wait(file, &proc_poll_wait, wait);
8927
8928 @@ -96281,7 +96290,7 @@ index fad1830..6aa3a7f 100644
8929 return POLLIN | POLLRDNORM | POLLERR | POLLPRI;
8930 }
8931
8932 -@@ -1783,7 +1783,7 @@ static int swaps_open(struct inode *inode, struct file *file)
8933 +@@ -1792,7 +1792,7 @@ static int swaps_open(struct inode *inode, struct file *file)
8934 return ret;
8935
8936 seq = file->private_data;
8937 @@ -96290,7 +96299,7 @@ index fad1830..6aa3a7f 100644
8938 return 0;
8939 }
8940
8941 -@@ -2117,7 +2117,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
8942 +@@ -2126,7 +2126,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
8943 (p->flags & SWP_DISCARDABLE) ? "D" : "");
8944
8945 mutex_unlock(&swapon_mutex);
8946 @@ -98111,10 +98120,10 @@ index 925991a..209a505 100644
8947 #ifdef CONFIG_INET
8948 static u32 seq_scale(u32 seq)
8949 diff --git a/net/core/skbuff.c b/net/core/skbuff.c
8950 -index af9c3c6..76914a3 100644
8951 +index 5d6cb54..6367e1e 100644
8952 --- a/net/core/skbuff.c
8953 +++ b/net/core/skbuff.c
8954 -@@ -2902,13 +2902,15 @@ void __init skb_init(void)
8955 +@@ -2872,13 +2872,15 @@ void __init skb_init(void)
8956 skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
8957 sizeof(struct sk_buff),
8958 0,
8959 @@ -102468,29 +102477,11 @@ index 76388b0..a967f68 100644
8960 NULL,
8961 sctp_generate_t1_cookie_event,
8962 sctp_generate_t1_init_event,
8963 -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
8964 -index cb1c430..f131caf 100644
8965 ---- a/net/sctp/sm_statefuns.c
8966 -+++ b/net/sctp/sm_statefuns.c
8967 -@@ -747,6 +747,13 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep,
8968 - struct sctp_chunk auth;
8969 - sctp_ierror_t ret;
8970 -
8971 -+ /* Make sure that we and the peer are AUTH capable */
8972 -+ if (!sctp_auth_enable || !new_asoc->peer.auth_capable) {
8973 -+ kfree_skb(chunk->auth_chunk);
8974 -+ sctp_association_free(new_asoc);
8975 -+ return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
8976 -+ }
8977 -+
8978 - /* set-up our fake chunk so that we can process it */
8979 - auth.skb = chunk->auth_chunk;
8980 - auth.asoc = chunk->asoc;
8981 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
8982 -index c53d01e..9659111 100644
8983 +index c28eb7b..7afe73d 100644
8984 --- a/net/sctp/socket.c
8985 +++ b/net/sctp/socket.c
8986 -@@ -2160,11 +2160,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
8987 +@@ -2183,11 +2183,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
8988 {
8989 struct sctp_association *asoc;
8990 struct sctp_ulpevent *event;
8991 @@ -102505,7 +102496,7 @@ index c53d01e..9659111 100644
8992
8993 /*
8994 * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
8995 -@@ -4150,13 +4152,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
8996 +@@ -4173,13 +4175,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
8997 static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
8998 int __user *optlen)
8999 {
9000 @@ -102523,7 +102514,7 @@ index c53d01e..9659111 100644
9001 return -EFAULT;
9002 return 0;
9003 }
9004 -@@ -4174,6 +4179,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
9005 +@@ -4197,6 +4202,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
9006 */
9007 static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
9008 {
9009 @@ -102532,7 +102523,7 @@ index c53d01e..9659111 100644
9010 /* Applicable to UDP-style socket only */
9011 if (sctp_style(sk, TCP))
9012 return -EOPNOTSUPP;
9013 -@@ -4182,7 +4189,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
9014 +@@ -4205,7 +4212,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
9015 len = sizeof(int);
9016 if (put_user(len, optlen))
9017 return -EFAULT;
9018 @@ -102542,7 +102533,7 @@ index c53d01e..9659111 100644
9019 return -EFAULT;
9020 return 0;
9021 }
9022 -@@ -4546,12 +4554,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
9023 +@@ -4569,12 +4577,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
9024 */
9025 static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
9026 {
9027 @@ -102559,7 +102550,7 @@ index c53d01e..9659111 100644
9028 return -EFAULT;
9029 return 0;
9030 }
9031 -@@ -4592,6 +4603,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
9032 +@@ -4615,6 +4626,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
9033 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
9034 if (space_left < addrlen)
9035 return -ENOMEM;
9036 @@ -102929,7 +102920,7 @@ index d4faade..002025a 100644
9037 set_fs(KERNEL_DS);
9038 if (level == SOL_SOCKET)
9039 diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
9040 -index b2250da..2680674 100644
9041 +index a0e55e5..2680674 100644
9042 --- a/net/sunrpc/clnt.c
9043 +++ b/net/sunrpc/clnt.c
9044 @@ -163,10 +163,8 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
9045 @@ -102967,22 +102958,6 @@ index b2250da..2680674 100644
9046 clnt->cl_stats->rpccnt++;
9047 task->tk_action = call_reserve;
9048 }
9049 -@@ -1002,9 +1001,13 @@ call_refreshresult(struct rpc_task *task)
9050 - task->tk_action = call_refresh;
9051 - switch (status) {
9052 - case 0:
9053 -- if (rpcauth_uptodatecred(task))
9054 -+ if (rpcauth_uptodatecred(task)) {
9055 - task->tk_action = call_allocate;
9056 -- return;
9057 -+ return;
9058 -+ }
9059 -+ /* Use rate-limiting and a max number of retries if refresh
9060 -+ * had status 0 but failed to update the cred.
9061 -+ */
9062 - case -ETIMEDOUT:
9063 - rpc_delay(task, 3*HZ);
9064 - case -EAGAIN:
9065 diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
9066 index bfddd68..567429b 100644
9067 --- a/net/sunrpc/rpc_pipe.c
9068 @@ -103750,7 +103725,7 @@ index 1983717..4d6102c 100644
9069
9070 sub->evt.event = htohl(event, sub->swap);
9071 diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
9072 -index eddfdec..9eb64a4 100644
9073 +index 54fc90b..fb87ef6 100644
9074 --- a/net/unix/af_unix.c
9075 +++ b/net/unix/af_unix.c
9076 @@ -768,6 +768,12 @@ static struct sock *unix_find_other(struct net *net,
9077 @@ -104417,16 +104392,16 @@ index cb1f50c..cef2a7c 100644
9078 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
9079 diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh
9080 new file mode 100644
9081 -index 0000000..ed4c19a
9082 +index 0000000..3c23999
9083 --- /dev/null
9084 +++ b/scripts/gcc-plugin.sh
9085 @@ -0,0 +1,16 @@
9086 +#!/bin/bash
9087 +srctree=$(dirname "$0")
9088 -+gccplugins_dir=$("$1" -print-file-name=plugin)
9089 ++gccplugins_dir=$("$3" -print-file-name=plugin)
9090 +plugincc=$("$1" -E -shared - -o /dev/null -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF
9091 +#include "gcc-common.h"
9092 -+#if __GNUC__ > 4 || __GNUC_MINOR__ >= 8 || defined(ENABLE_BUILD_WITH_CXX)
9093 ++#if BUILDING_GCC_VERSION >= 4008 || defined(ENABLE_BUILD_WITH_CXX)
9094 +#warning $2
9095 +#else
9096 +#warning $1
9097 @@ -104450,7 +104425,7 @@ index 48462be..3e08f94 100644
9098 $line =~ s/\s__attribute_const__$//g;
9099 $line =~ s/\b__packed\b/__attribute__((packed))/g;
9100 diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
9101 -index d1d0ae8..6b73b2a 100644
9102 +index 98ff331..9a48619 100644
9103 --- a/scripts/mod/file2alias.c
9104 +++ b/scripts/mod/file2alias.c
9105 @@ -72,7 +72,7 @@ static void device_id_check(const char *modname, const char *device_id,
9106 @@ -107086,7 +107061,7 @@ index dca1c22..4fa4591 100644
9107 lock = &avc_cache.slots_lock[hvalue];
9108
9109 diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
9110 -index bcf1d73..04f8b47 100644
9111 +index 4fa7939..bf547c8 100644
9112 --- a/security/selinux/hooks.c
9113 +++ b/security/selinux/hooks.c
9114 @@ -95,8 +95,6 @@
9115 @@ -107122,7 +107097,7 @@ index bcf1d73..04f8b47 100644
9116 new_tsec->sid = old_tsec->sid;
9117
9118 if (new_tsec->sid == old_tsec->sid) {
9119 -@@ -5526,7 +5532,7 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer)
9120 +@@ -5554,7 +5560,7 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer)
9121
9122 #endif
9123
9124 @@ -107131,7 +107106,7 @@ index bcf1d73..04f8b47 100644
9125 .name = "selinux",
9126
9127 .ptrace_access_check = selinux_ptrace_access_check,
9128 -@@ -5872,6 +5878,9 @@ static void selinux_nf_ip_exit(void)
9129 +@@ -5900,6 +5906,9 @@ static void selinux_nf_ip_exit(void)
9130 #ifdef CONFIG_SECURITY_SELINUX_DISABLE
9131 static int selinux_disabled;
9132
9133 @@ -107141,7 +107116,7 @@ index bcf1d73..04f8b47 100644
9134 int selinux_disable(void)
9135 {
9136 if (ss_initialized) {
9137 -@@ -5889,7 +5898,9 @@ int selinux_disable(void)
9138 +@@ -5917,7 +5926,9 @@ int selinux_disable(void)
9139 selinux_disabled = 1;
9140 selinux_enabled = 0;
9141
9142 @@ -107165,40 +107140,6 @@ index b43813c..74be837 100644
9143 }
9144 #else
9145 static inline int selinux_xfrm_enabled(void)
9146 -diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
9147 -index a7f61d5..4d7c0b4 100644
9148 ---- a/security/selinux/ss/policydb.c
9149 -+++ b/security/selinux/ss/policydb.c
9150 -@@ -3202,10 +3202,10 @@ static int filename_write_helper(void *key, void *data, void *ptr)
9151 - if (rc)
9152 - return rc;
9153 -
9154 -- buf[0] = ft->stype;
9155 -- buf[1] = ft->ttype;
9156 -- buf[2] = ft->tclass;
9157 -- buf[3] = otype->otype;
9158 -+ buf[0] = cpu_to_le32(ft->stype);
9159 -+ buf[1] = cpu_to_le32(ft->ttype);
9160 -+ buf[2] = cpu_to_le32(ft->tclass);
9161 -+ buf[3] = cpu_to_le32(otype->otype);
9162 -
9163 - rc = put_entry(buf, sizeof(u32), 4, fp);
9164 - if (rc)
9165 -diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
9166 -index 185f849..72b20b1 100644
9167 ---- a/security/selinux/ss/services.c
9168 -+++ b/security/selinux/ss/services.c
9169 -@@ -1229,6 +1229,10 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
9170 - struct context context;
9171 - int rc = 0;
9172 -
9173 -+ /* An empty security context is never valid. */
9174 -+ if (!scontext_len)
9175 -+ return -EINVAL;
9176 -+
9177 - if (!ss_initialized) {
9178 - int i;
9179 -
9180 diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
9181 index 7db62b4..ee4d949 100644
9182 --- a/security/smack/smack_lsm.c
9183 @@ -109984,7 +109925,7 @@ index 0000000..dd73713
9184 +}
9185 diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c
9186 new file mode 100644
9187 -index 0000000..c96f80f
9188 +index 0000000..319229d
9189 --- /dev/null
9190 +++ b/tools/gcc/latent_entropy_plugin.c
9191 @@ -0,0 +1,457 @@
9192 @@ -110016,7 +109957,7 @@ index 0000000..c96f80f
9193 +static tree latent_entropy_decl;
9194 +
9195 +static struct plugin_info latent_entropy_plugin_info = {
9196 -+ .version = "201403042150",
9197 ++ .version = "201403280150",
9198 + .help = NULL
9199 +};
9200 +
9201
9202 diff --git a/3.2.55/4425_grsec_remove_EI_PAX.patch b/3.2.56/4425_grsec_remove_EI_PAX.patch
9203 similarity index 100%
9204 rename from 3.2.55/4425_grsec_remove_EI_PAX.patch
9205 rename to 3.2.56/4425_grsec_remove_EI_PAX.patch
9206
9207 diff --git a/3.2.55/4427_force_XATTR_PAX_tmpfs.patch b/3.2.56/4427_force_XATTR_PAX_tmpfs.patch
9208 similarity index 100%
9209 rename from 3.2.55/4427_force_XATTR_PAX_tmpfs.patch
9210 rename to 3.2.56/4427_force_XATTR_PAX_tmpfs.patch
9211
9212 diff --git a/3.2.55/4430_grsec-remove-localversion-grsec.patch b/3.2.56/4430_grsec-remove-localversion-grsec.patch
9213 similarity index 100%
9214 rename from 3.2.55/4430_grsec-remove-localversion-grsec.patch
9215 rename to 3.2.56/4430_grsec-remove-localversion-grsec.patch
9216
9217 diff --git a/3.2.55/4435_grsec-mute-warnings.patch b/3.2.56/4435_grsec-mute-warnings.patch
9218 similarity index 100%
9219 rename from 3.2.55/4435_grsec-mute-warnings.patch
9220 rename to 3.2.56/4435_grsec-mute-warnings.patch
9221
9222 diff --git a/3.2.55/4440_grsec-remove-protected-paths.patch b/3.2.56/4440_grsec-remove-protected-paths.patch
9223 similarity index 100%
9224 rename from 3.2.55/4440_grsec-remove-protected-paths.patch
9225 rename to 3.2.56/4440_grsec-remove-protected-paths.patch
9226
9227 diff --git a/3.2.55/4450_grsec-kconfig-default-gids.patch b/3.2.56/4450_grsec-kconfig-default-gids.patch
9228 similarity index 100%
9229 rename from 3.2.55/4450_grsec-kconfig-default-gids.patch
9230 rename to 3.2.56/4450_grsec-kconfig-default-gids.patch
9231
9232 diff --git a/3.2.55/4465_selinux-avc_audit-log-curr_ip.patch b/3.2.56/4465_selinux-avc_audit-log-curr_ip.patch
9233 similarity index 100%
9234 rename from 3.2.55/4465_selinux-avc_audit-log-curr_ip.patch
9235 rename to 3.2.56/4465_selinux-avc_audit-log-curr_ip.patch
9236
9237 diff --git a/3.2.55/4470_disable-compat_vdso.patch b/3.2.56/4470_disable-compat_vdso.patch
9238 similarity index 100%
9239 rename from 3.2.55/4470_disable-compat_vdso.patch
9240 rename to 3.2.56/4470_disable-compat_vdso.patch
9241
9242 diff --git a/3.2.55/4475_emutramp_default_on.patch b/3.2.56/4475_emutramp_default_on.patch
9243 similarity index 100%
9244 rename from 3.2.55/4475_emutramp_default_on.patch
9245 rename to 3.2.56/4475_emutramp_default_on.patch