Magellan Linux

Contents of /trunk/kernel-lts/patches-3.4/0135-3.4.36-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2119 - (show annotations) (download)
Mon Mar 18 13:00:55 2013 UTC (11 years, 1 month ago) by niro
File size: 42160 byte(s)
-linux-3.4.36
1 diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
2 index 00755d8..7deaa7f 100644
3 --- a/arch/arm/kernel/perf_event_v7.c
4 +++ b/arch/arm/kernel/perf_event_v7.c
5 @@ -775,7 +775,7 @@ static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
6 /*
7 * PMXEVTYPER: Event selection reg
8 */
9 -#define ARMV7_EVTYPE_MASK 0xc00000ff /* Mask for writable bits */
10 +#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
11 #define ARMV7_EVTYPE_EVENT 0xff /* Mask for EVENT bits */
12
13 /*
14 diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
15 index 9107231..fc000e3 100644
16 --- a/arch/arm/mm/alignment.c
17 +++ b/arch/arm/mm/alignment.c
18 @@ -750,7 +750,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
19 unsigned long instr = 0, instrptr;
20 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
21 unsigned int type;
22 - mm_segment_t fs;
23 unsigned int fault;
24 u16 tinstr = 0;
25 int isize = 4;
26 @@ -761,16 +760,15 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
27
28 instrptr = instruction_pointer(regs);
29
30 - fs = get_fs();
31 - set_fs(KERNEL_DS);
32 if (thumb_mode(regs)) {
33 - fault = __get_user(tinstr, (u16 *)(instrptr & ~1));
34 + u16 *ptr = (u16 *)(instrptr & ~1);
35 + fault = probe_kernel_address(ptr, tinstr);
36 if (!fault) {
37 if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
38 IS_T32(tinstr)) {
39 /* Thumb-2 32-bit */
40 u16 tinst2 = 0;
41 - fault = __get_user(tinst2, (u16 *)(instrptr+2));
42 + fault = probe_kernel_address(ptr + 1, tinst2);
43 instr = (tinstr << 16) | tinst2;
44 thumb2_32b = 1;
45 } else {
46 @@ -779,8 +777,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
47 }
48 }
49 } else
50 - fault = __get_user(instr, (u32 *)instrptr);
51 - set_fs(fs);
52 + fault = probe_kernel_address(instrptr, instr);
53
54 if (fault) {
55 type = TYPE_FAULT;
56 diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
57 index 3b36062..eede545 100644
58 --- a/arch/arm/vfp/vfpmodule.c
59 +++ b/arch/arm/vfp/vfpmodule.c
60 @@ -413,7 +413,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
61 * If there isn't a second FP instruction, exit now. Note that
62 * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1.
63 */
64 - if (fpexc ^ (FPEXC_EX | FPEXC_FP2V))
65 + if ((fpexc & (FPEXC_EX | FPEXC_FP2V)) != (FPEXC_EX | FPEXC_FP2V))
66 goto exit;
67
68 /*
69 diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
70 index 56ab749..94e7662 100644
71 --- a/arch/x86/pci/xen.c
72 +++ b/arch/x86/pci/xen.c
73 @@ -162,6 +162,9 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
74 struct msi_desc *msidesc;
75 int *v;
76
77 + if (type == PCI_CAP_ID_MSI && nvec > 1)
78 + return 1;
79 +
80 v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
81 if (!v)
82 return -ENOMEM;
83 @@ -220,6 +223,9 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
84 struct msi_desc *msidesc;
85 struct msi_msg msg;
86
87 + if (type == PCI_CAP_ID_MSI && nvec > 1)
88 + return 1;
89 +
90 list_for_each_entry(msidesc, &dev->msi_list, list) {
91 __read_msi_msg(msidesc, &msg);
92 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
93 @@ -263,6 +269,9 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
94 int ret = 0;
95 struct msi_desc *msidesc;
96
97 + if (type == PCI_CAP_ID_MSI && nvec > 1)
98 + return 1;
99 +
100 list_for_each_entry(msidesc, &dev->msi_list, list) {
101 struct physdev_map_pirq map_irq;
102 domid_t domid;
103 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
104 index 5910054..194dbcd 100644
105 --- a/arch/x86/xen/enlighten.c
106 +++ b/arch/x86/xen/enlighten.c
107 @@ -64,6 +64,7 @@
108 #include <asm/hypervisor.h>
109 #include <asm/mwait.h>
110 #include <asm/pci_x86.h>
111 +#include <asm/pat.h>
112
113 #ifdef CONFIG_ACPI
114 #include <linux/acpi.h>
115 @@ -1355,7 +1356,14 @@ asmlinkage void __init xen_start_kernel(void)
116 */
117 acpi_numa = -1;
118 #endif
119 -
120 +#ifdef CONFIG_X86_PAT
121 + /*
122 + * For right now disable the PAT. We should remove this once
123 + * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
124 + * (xen/pat: Disable PAT support for now) is reverted.
125 + */
126 + pat_enabled = 0;
127 +#endif
128 pgd = (pgd_t *)xen_start_info->pt_base;
129
130 /* Don't do the full vcpu_info placement stuff until we have a
131 diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
132 index 8d3a056..45fe410 100644
133 --- a/crypto/ablkcipher.c
134 +++ b/crypto/ablkcipher.c
135 @@ -388,9 +388,9 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
136 {
137 struct crypto_report_blkcipher rblkcipher;
138
139 - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "ablkcipher");
140 - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s",
141 - alg->cra_ablkcipher.geniv ?: "<default>");
142 + strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
143 + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>",
144 + sizeof(rblkcipher.geniv));
145
146 rblkcipher.blocksize = alg->cra_blocksize;
147 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
148 @@ -469,9 +469,9 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
149 {
150 struct crypto_report_blkcipher rblkcipher;
151
152 - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "givcipher");
153 - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s",
154 - alg->cra_ablkcipher.geniv ?: "<built-in>");
155 + strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type));
156 + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>",
157 + sizeof(rblkcipher.geniv));
158
159 rblkcipher.blocksize = alg->cra_blocksize;
160 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
161 diff --git a/crypto/aead.c b/crypto/aead.c
162 index e4cb351..c706d74 100644
163 --- a/crypto/aead.c
164 +++ b/crypto/aead.c
165 @@ -117,9 +117,8 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg)
166 struct crypto_report_aead raead;
167 struct aead_alg *aead = &alg->cra_aead;
168
169 - snprintf(raead.type, CRYPTO_MAX_ALG_NAME, "%s", "aead");
170 - snprintf(raead.geniv, CRYPTO_MAX_ALG_NAME, "%s",
171 - aead->geniv ?: "<built-in>");
172 + strncpy(raead.type, "aead", sizeof(raead.type));
173 + strncpy(raead.geniv, aead->geniv ?: "<built-in>", sizeof(raead.geniv));
174
175 raead.blocksize = alg->cra_blocksize;
176 raead.maxauthsize = aead->maxauthsize;
177 @@ -203,8 +202,8 @@ static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg)
178 struct crypto_report_aead raead;
179 struct aead_alg *aead = &alg->cra_aead;
180
181 - snprintf(raead.type, CRYPTO_MAX_ALG_NAME, "%s", "nivaead");
182 - snprintf(raead.geniv, CRYPTO_MAX_ALG_NAME, "%s", aead->geniv);
183 + strncpy(raead.type, "nivaead", sizeof(raead.type));
184 + strncpy(raead.geniv, aead->geniv, sizeof(raead.geniv));
185
186 raead.blocksize = alg->cra_blocksize;
187 raead.maxauthsize = aead->maxauthsize;
188 diff --git a/crypto/ahash.c b/crypto/ahash.c
189 index 33bc9b6..0ec05fe 100644
190 --- a/crypto/ahash.c
191 +++ b/crypto/ahash.c
192 @@ -404,7 +404,7 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg)
193 {
194 struct crypto_report_hash rhash;
195
196 - snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "ahash");
197 + strncpy(rhash.type, "ahash", sizeof(rhash.type));
198
199 rhash.blocksize = alg->cra_blocksize;
200 rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize;
201 diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
202 index 4dd80c7..0a1ebea 100644
203 --- a/crypto/blkcipher.c
204 +++ b/crypto/blkcipher.c
205 @@ -499,9 +499,9 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
206 {
207 struct crypto_report_blkcipher rblkcipher;
208
209 - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "blkcipher");
210 - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s",
211 - alg->cra_blkcipher.geniv ?: "<default>");
212 + strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type));
213 + strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>",
214 + sizeof(rblkcipher.geniv));
215
216 rblkcipher.blocksize = alg->cra_blocksize;
217 rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
218 diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
219 index f1ea0a0..910497b 100644
220 --- a/crypto/crypto_user.c
221 +++ b/crypto/crypto_user.c
222 @@ -75,7 +75,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)
223 {
224 struct crypto_report_cipher rcipher;
225
226 - snprintf(rcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "cipher");
227 + strncpy(rcipher.type, "cipher", sizeof(rcipher.type));
228
229 rcipher.blocksize = alg->cra_blocksize;
230 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
231 @@ -94,8 +94,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
232 {
233 struct crypto_report_comp rcomp;
234
235 - snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression");
236 -
237 + strncpy(rcomp.type, "compression", sizeof(rcomp.type));
238 NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS,
239 sizeof(struct crypto_report_comp), &rcomp);
240
241 @@ -108,12 +107,14 @@ nla_put_failure:
242 static int crypto_report_one(struct crypto_alg *alg,
243 struct crypto_user_alg *ualg, struct sk_buff *skb)
244 {
245 - memcpy(&ualg->cru_name, &alg->cra_name, sizeof(ualg->cru_name));
246 - memcpy(&ualg->cru_driver_name, &alg->cra_driver_name,
247 - sizeof(ualg->cru_driver_name));
248 - memcpy(&ualg->cru_module_name, module_name(alg->cra_module),
249 - CRYPTO_MAX_ALG_NAME);
250 -
251 + strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name));
252 + strncpy(ualg->cru_driver_name, alg->cra_driver_name,
253 + sizeof(ualg->cru_driver_name));
254 + strncpy(ualg->cru_module_name, module_name(alg->cra_module),
255 + sizeof(ualg->cru_module_name));
256 +
257 + ualg->cru_type = 0;
258 + ualg->cru_mask = 0;
259 ualg->cru_flags = alg->cra_flags;
260 ualg->cru_refcnt = atomic_read(&alg->cra_refcnt);
261
262 @@ -122,8 +123,7 @@ static int crypto_report_one(struct crypto_alg *alg,
263 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
264 struct crypto_report_larval rl;
265
266 - snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval");
267 -
268 + strncpy(rl.type, "larval", sizeof(rl.type));
269 NLA_PUT(skb, CRYPTOCFGA_REPORT_LARVAL,
270 sizeof(struct crypto_report_larval), &rl);
271
272 diff --git a/crypto/pcompress.c b/crypto/pcompress.c
273 index 2e458e5..6f2a361 100644
274 --- a/crypto/pcompress.c
275 +++ b/crypto/pcompress.c
276 @@ -53,8 +53,7 @@ static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg)
277 {
278 struct crypto_report_comp rpcomp;
279
280 - snprintf(rpcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "pcomp");
281 -
282 + strncpy(rpcomp.type, "pcomp", sizeof(rpcomp.type));
283 NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS,
284 sizeof(struct crypto_report_comp), &rpcomp);
285
286 diff --git a/crypto/rng.c b/crypto/rng.c
287 index 64f864f..1966c1d 100644
288 --- a/crypto/rng.c
289 +++ b/crypto/rng.c
290 @@ -65,7 +65,7 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg)
291 {
292 struct crypto_report_rng rrng;
293
294 - snprintf(rrng.type, CRYPTO_MAX_ALG_NAME, "%s", "rng");
295 + strncpy(rrng.type, "rng", sizeof(rrng.type));
296
297 rrng.seedsize = alg->cra_rng.seedsize;
298
299 diff --git a/crypto/shash.c b/crypto/shash.c
300 index 21fc12e..3b2a71f 100644
301 --- a/crypto/shash.c
302 +++ b/crypto/shash.c
303 @@ -530,7 +530,8 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg)
304 struct crypto_report_hash rhash;
305 struct shash_alg *salg = __crypto_shash_alg(alg);
306
307 - snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "shash");
308 + strncpy(rhash.type, "shash", sizeof(rhash.type));
309 +
310 rhash.blocksize = alg->cra_blocksize;
311 rhash.digestsize = salg->digestsize;
312
313 diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
314 index 88f6908..47bd6ab 100644
315 --- a/drivers/ata/ata_piix.c
316 +++ b/drivers/ata/ata_piix.c
317 @@ -1594,12 +1594,31 @@ static void piix_ignore_devices_quirk(struct ata_host *host)
318 },
319 { } /* terminate list */
320 };
321 - const struct dmi_system_id *dmi = dmi_first_match(ignore_hyperv);
322 + static const struct dmi_system_id allow_virtual_pc[] = {
323 + {
324 + /* In MS Virtual PC guests the DMI ident is nearly
325 + * identical to a Hyper-V guest. One difference is the
326 + * product version which is used here to identify
327 + * a Virtual PC guest. This entry allows ata_piix to
328 + * drive the emulated hardware.
329 + */
330 + .ident = "MS Virtual PC 2007",
331 + .matches = {
332 + DMI_MATCH(DMI_SYS_VENDOR,
333 + "Microsoft Corporation"),
334 + DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
335 + DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
336 + },
337 + },
338 + { } /* terminate list */
339 + };
340 + const struct dmi_system_id *ignore = dmi_first_match(ignore_hyperv);
341 + const struct dmi_system_id *allow = dmi_first_match(allow_virtual_pc);
342
343 - if (dmi && prefer_ms_hyperv) {
344 + if (ignore && !allow && prefer_ms_hyperv) {
345 host->flags |= ATA_HOST_IGNORE_ATA;
346 dev_info(host->dev, "%s detected, ATA device ignore set\n",
347 - dmi->ident);
348 + ignore->ident);
349 }
350 #endif
351 }
352 diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
353 index 1bafb40..69ae597 100644
354 --- a/drivers/char/hw_random/core.c
355 +++ b/drivers/char/hw_random/core.c
356 @@ -40,6 +40,7 @@
357 #include <linux/init.h>
358 #include <linux/miscdevice.h>
359 #include <linux/delay.h>
360 +#include <linux/slab.h>
361 #include <asm/uaccess.h>
362
363
364 @@ -52,8 +53,12 @@ static struct hwrng *current_rng;
365 static LIST_HEAD(rng_list);
366 static DEFINE_MUTEX(rng_mutex);
367 static int data_avail;
368 -static u8 rng_buffer[SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES]
369 - __cacheline_aligned;
370 +static u8 *rng_buffer;
371 +
372 +static size_t rng_buffer_size(void)
373 +{
374 + return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
375 +}
376
377 static inline int hwrng_init(struct hwrng *rng)
378 {
379 @@ -116,7 +121,7 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
380
381 if (!data_avail) {
382 bytes_read = rng_get_data(current_rng, rng_buffer,
383 - sizeof(rng_buffer),
384 + rng_buffer_size(),
385 !(filp->f_flags & O_NONBLOCK));
386 if (bytes_read < 0) {
387 err = bytes_read;
388 @@ -307,6 +312,14 @@ int hwrng_register(struct hwrng *rng)
389
390 mutex_lock(&rng_mutex);
391
392 + /* kmalloc makes this safe for virt_to_page() in virtio_rng.c */
393 + err = -ENOMEM;
394 + if (!rng_buffer) {
395 + rng_buffer = kmalloc(rng_buffer_size(), GFP_KERNEL);
396 + if (!rng_buffer)
397 + goto out_unlock;
398 + }
399 +
400 /* Must not register two RNGs with the same name. */
401 err = -EEXIST;
402 list_for_each_entry(tmp, &rng_list, list) {
403 diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
404 index b40ee14..3998316 100644
405 --- a/drivers/cpufreq/cpufreq_stats.c
406 +++ b/drivers/cpufreq/cpufreq_stats.c
407 @@ -328,6 +328,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
408 cpufreq_update_policy(cpu);
409 break;
410 case CPU_DOWN_PREPARE:
411 + case CPU_DOWN_PREPARE_FROZEN:
412 cpufreq_stats_free_sysfs(cpu);
413 break;
414 case CPU_DEAD:
415 diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
416 index 982f1f5..4cd392d 100644
417 --- a/drivers/firmware/dmi_scan.c
418 +++ b/drivers/firmware/dmi_scan.c
419 @@ -442,7 +442,6 @@ static int __init dmi_present(const char __iomem *p)
420 static int __init smbios_present(const char __iomem *p)
421 {
422 u8 buf[32];
423 - int offset = 0;
424
425 memcpy_fromio(buf, p, 32);
426 if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
427 @@ -461,9 +460,9 @@ static int __init smbios_present(const char __iomem *p)
428 dmi_ver = 0x0206;
429 break;
430 }
431 - offset = 16;
432 + return memcmp(p + 16, "_DMI_", 5) || dmi_present(p + 16);
433 }
434 - return dmi_present(buf + offset);
435 + return 1;
436 }
437
438 void __init dmi_scan_machine(void)
439 diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
440 index a2470d9..2b2c557 100644
441 --- a/drivers/gpu/drm/radeon/radeon_combios.c
442 +++ b/drivers/gpu/drm/radeon/radeon_combios.c
443 @@ -958,6 +958,15 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
444 found = 1;
445 }
446
447 + /* quirks */
448 + /* Radeon 9100 (R200) */
449 + if ((dev->pdev->device == 0x514D) &&
450 + (dev->pdev->subsystem_vendor == 0x174B) &&
451 + (dev->pdev->subsystem_device == 0x7149)) {
452 + /* vbios value is bad, use the default */
453 + found = 0;
454 + }
455 +
456 if (!found) /* fallback to defaults */
457 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
458
459 diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
460 index 88d2010..73b67ab 100644
461 --- a/drivers/hid/hid-logitech-dj.c
462 +++ b/drivers/hid/hid-logitech-dj.c
463 @@ -451,19 +451,25 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
464 struct dj_report *dj_report)
465 {
466 struct hid_device *hdev = djrcv_dev->hdev;
467 - int sent_bytes;
468 + struct hid_report *report;
469 + struct hid_report_enum *output_report_enum;
470 + u8 *data = (u8 *)(&dj_report->device_index);
471 + int i;
472
473 - if (!hdev->hid_output_raw_report) {
474 - dev_err(&hdev->dev, "%s:"
475 - "hid_output_raw_report is null\n", __func__);
476 + output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT];
477 + report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT];
478 +
479 + if (!report) {
480 + dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__);
481 return -ENODEV;
482 }
483
484 - sent_bytes = hdev->hid_output_raw_report(hdev, (u8 *) dj_report,
485 - sizeof(struct dj_report),
486 - HID_OUTPUT_REPORT);
487 + for (i = 0; i < report->field[0]->report_count; i++)
488 + report->field[0]->value[i] = data[i];
489 +
490 + usbhid_submit_report(hdev, report, USB_DIR_OUT);
491
492 - return (sent_bytes < 0) ? sent_bytes : 0;
493 + return 0;
494 }
495
496 static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
497 diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
498 index 9652a2c..a58de38 100644
499 --- a/drivers/hwmon/pmbus/ltc2978.c
500 +++ b/drivers/hwmon/pmbus/ltc2978.c
501 @@ -62,7 +62,7 @@ struct ltc2978_data {
502 int temp_min, temp_max;
503 int vout_min[8], vout_max[8];
504 int iout_max[2];
505 - int temp2_max[2];
506 + int temp2_max;
507 struct pmbus_driver_info info;
508 };
509
510 @@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg)
511 ret = pmbus_read_word_data(client, page,
512 LTC3880_MFR_TEMPERATURE2_PEAK);
513 if (ret >= 0) {
514 - if (lin11_to_val(ret)
515 - > lin11_to_val(data->temp2_max[page]))
516 - data->temp2_max[page] = ret;
517 - ret = data->temp2_max[page];
518 + if (lin11_to_val(ret) > lin11_to_val(data->temp2_max))
519 + data->temp2_max = ret;
520 + ret = data->temp2_max;
521 }
522 break;
523 case PMBUS_VIRT_READ_VIN_MIN:
524 @@ -248,11 +247,11 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
525
526 switch (reg) {
527 case PMBUS_VIRT_RESET_IOUT_HISTORY:
528 - data->iout_max[page] = 0x7fff;
529 + data->iout_max[page] = 0x7c00;
530 ret = ltc2978_clear_peaks(client, page, data->id);
531 break;
532 case PMBUS_VIRT_RESET_TEMP2_HISTORY:
533 - data->temp2_max[page] = 0x7fff;
534 + data->temp2_max = 0x7c00;
535 ret = ltc2978_clear_peaks(client, page, data->id);
536 break;
537 case PMBUS_VIRT_RESET_VOUT_HISTORY:
538 @@ -262,12 +261,12 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
539 break;
540 case PMBUS_VIRT_RESET_VIN_HISTORY:
541 data->vin_min = 0x7bff;
542 - data->vin_max = 0;
543 + data->vin_max = 0x7c00;
544 ret = ltc2978_clear_peaks(client, page, data->id);
545 break;
546 case PMBUS_VIRT_RESET_TEMP_HISTORY:
547 data->temp_min = 0x7bff;
548 - data->temp_max = 0x7fff;
549 + data->temp_max = 0x7c00;
550 ret = ltc2978_clear_peaks(client, page, data->id);
551 break;
552 default:
553 @@ -321,12 +320,13 @@ static int ltc2978_probe(struct i2c_client *client,
554 info = &data->info;
555 info->write_word_data = ltc2978_write_word_data;
556
557 - data->vout_min[0] = 0xffff;
558 data->vin_min = 0x7bff;
559 + data->vin_max = 0x7c00;
560 data->temp_min = 0x7bff;
561 - data->temp_max = 0x7fff;
562 + data->temp_max = 0x7c00;
563 + data->temp2_max = 0x7c00;
564
565 - switch (id->driver_data) {
566 + switch (data->id) {
567 case ltc2978:
568 info->read_word_data = ltc2978_read_word_data;
569 info->pages = 8;
570 @@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_client *client,
571 for (i = 1; i < 8; i++) {
572 info->func[i] = PMBUS_HAVE_VOUT
573 | PMBUS_HAVE_STATUS_VOUT;
574 - data->vout_min[i] = 0xffff;
575 }
576 break;
577 case ltc3880:
578 @@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_client *client,
579 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
580 | PMBUS_HAVE_POUT
581 | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
582 - data->vout_min[1] = 0xffff;
583 + data->iout_max[0] = 0x7c00;
584 + data->iout_max[1] = 0x7c00;
585 break;
586 default:
587 return -ENODEV;
588 }
589 + for (i = 0; i < info->pages; i++)
590 + data->vout_min[i] = 0xffff;
591
592 return pmbus_do_probe(client, id, info);
593 }
594 diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
595 index 8b011d0..eb01802 100644
596 --- a/drivers/hwmon/sht15.c
597 +++ b/drivers/hwmon/sht15.c
598 @@ -926,7 +926,13 @@ static int __devinit sht15_probe(struct platform_device *pdev)
599 if (voltage)
600 data->supply_uV = voltage;
601
602 - regulator_enable(data->reg);
603 + ret = regulator_enable(data->reg);
604 + if (ret != 0) {
605 + dev_err(&pdev->dev,
606 + "failed to enable regulator: %d\n", ret);
607 + return ret;
608 + }
609 +
610 /*
611 * Setup a notifier block to update this if another device
612 * causes the voltage to change
613 diff --git a/drivers/md/md.c b/drivers/md/md.c
614 index 0a447a1..e0930bb 100644
615 --- a/drivers/md/md.c
616 +++ b/drivers/md/md.c
617 @@ -344,6 +344,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
618 bio_io_error(bio);
619 return;
620 }
621 + if (mddev->ro == 1 && unlikely(rw == WRITE)) {
622 + bio_endio(bio, bio_sectors(bio) == 0 ? 0 : -EROFS);
623 + return;
624 + }
625 smp_rmb(); /* Ensure implications of 'active' are visible */
626 rcu_read_lock();
627 if (mddev->suspended) {
628 @@ -2882,6 +2886,9 @@ rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len)
629 } else if (!sectors)
630 sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) -
631 rdev->data_offset;
632 + if (!my_mddev->pers->resize)
633 + /* Cannot change size for RAID0 or Linear etc */
634 + return -EINVAL;
635 }
636 if (sectors < my_mddev->dev_sectors)
637 return -EINVAL; /* component must fit device */
638 diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
639 index de63a1f..06a0257 100644
640 --- a/drivers/md/raid0.c
641 +++ b/drivers/md/raid0.c
642 @@ -280,7 +280,7 @@ abort:
643 kfree(conf->strip_zone);
644 kfree(conf->devlist);
645 kfree(conf);
646 - *private_conf = NULL;
647 + *private_conf = ERR_PTR(err);
648 return err;
649 }
650
651 @@ -402,7 +402,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks
652 "%s does not support generic reshape\n", __func__);
653
654 rdev_for_each(rdev, mddev)
655 - array_sectors += rdev->sectors;
656 + array_sectors += (rdev->sectors &
657 + ~(sector_t)(mddev->chunk_sectors-1));
658
659 return array_sectors;
660 }
661 diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
662 index 7e88aaf..c80b4b4 100644
663 --- a/drivers/net/ethernet/intel/e1000e/netdev.c
664 +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
665 @@ -5535,7 +5535,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake,
666 */
667 e1000e_release_hw_control(adapter);
668
669 - pci_disable_device(pdev);
670 + pci_clear_master(pdev);
671
672 return 0;
673 }
674 diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
675 index ad14fec..f1c32a5 100644
676 --- a/drivers/net/wireless/ath/ath9k/common.h
677 +++ b/drivers/net/wireless/ath/ath9k/common.h
678 @@ -35,7 +35,7 @@
679 #define WME_AC_BK 3
680 #define WME_NUM_AC 4
681
682 -#define ATH_RSSI_DUMMY_MARKER 0x127
683 +#define ATH_RSSI_DUMMY_MARKER 127
684 #define ATH_RSSI_LPF_LEN 10
685 #define RSSI_LPF_THRESHOLD -20
686 #define ATH_RSSI_EP_MULTIPLIER (1<<7)
687 diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
688 index 28a0edd..20baf70 100644
689 --- a/drivers/net/wireless/ath/ath9k/hw.c
690 +++ b/drivers/net/wireless/ath/ath9k/hw.c
691 @@ -1404,7 +1404,9 @@ static bool ath9k_hw_chip_reset(struct ath_hw *ah,
692 reset_type = ATH9K_RESET_POWER_ON;
693 else
694 reset_type = ATH9K_RESET_COLD;
695 - }
696 + } else if (ah->chip_fullsleep || REG_READ(ah, AR_Q_TXE) ||
697 + (REG_READ(ah, AR_CR) & AR_CR_RXE))
698 + reset_type = ATH9K_RESET_COLD;
699
700 if (!ath9k_hw_set_reset_reg(ah, reset_type))
701 return false;
702 diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
703 index 6ca3d8a..9abb8f5 100644
704 --- a/drivers/net/wireless/mwifiex/pcie.c
705 +++ b/drivers/net/wireless/mwifiex/pcie.c
706 @@ -288,7 +288,7 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
707 i++;
708 usleep_range(10, 20);
709 /* 50ms max wait */
710 - if (i == 50000)
711 + if (i == 5000)
712 break;
713 }
714
715 diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
716 index 13aeca3..48105fc 100644
717 --- a/drivers/scsi/dc395x.c
718 +++ b/drivers/scsi/dc395x.c
719 @@ -3747,13 +3747,13 @@ static struct DeviceCtlBlk *device_alloc(struct AdapterCtlBlk *acb,
720 dcb->max_command = 1;
721 dcb->target_id = target;
722 dcb->target_lun = lun;
723 + dcb->dev_mode = eeprom->target[target].cfg0;
724 #ifndef DC395x_NO_DISCONNECT
725 dcb->identify_msg =
726 IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun);
727 #else
728 dcb->identify_msg = IDENTIFY(0, lun);
729 #endif
730 - dcb->dev_mode = eeprom->target[target].cfg0;
731 dcb->inquiry7 = 0;
732 dcb->sync_mode = 0;
733 dcb->min_nego_period = clock_period[period_index];
734 diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
735 index 40a4570..f9986cc 100644
736 --- a/drivers/scsi/storvsc_drv.c
737 +++ b/drivers/scsi/storvsc_drv.c
738 @@ -467,6 +467,7 @@ static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
739 if (!bounce_sgl)
740 return NULL;
741
742 + sg_init_table(bounce_sgl, num_pages);
743 for (i = 0; i < num_pages; i++) {
744 page_buf = alloc_page(GFP_ATOMIC);
745 if (!page_buf)
746 diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
747 index 94c905f..d084ba3 100644
748 --- a/drivers/target/target_core_pscsi.c
749 +++ b/drivers/target/target_core_pscsi.c
750 @@ -1042,7 +1042,6 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
751 bio = NULL;
752 }
753
754 - page++;
755 len -= bytes;
756 data_len -= bytes;
757 off = 0;
758 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
759 index 67dda0d..49b139c 100644
760 --- a/drivers/usb/core/hub.c
761 +++ b/drivers/usb/core/hub.c
762 @@ -2207,70 +2207,35 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
763 if ((portstatus & USB_PORT_STAT_RESET))
764 goto delay;
765
766 - /*
767 - * Some buggy devices require a warm reset to be issued even
768 - * when the port appears not to be connected.
769 + if (hub_port_warm_reset_required(hub, portstatus))
770 + return -ENOTCONN;
771 +
772 + /* Device went away? */
773 + if (!(portstatus & USB_PORT_STAT_CONNECTION))
774 + return -ENOTCONN;
775 +
776 + /* bomb out completely if the connection bounced. A USB 3.0
777 + * connection may bounce if multiple warm resets were issued,
778 + * but the device may have successfully re-connected. Ignore it.
779 */
780 - if (!warm) {
781 - /*
782 - * Some buggy devices can cause an NEC host controller
783 - * to transition to the "Error" state after a hot port
784 - * reset. This will show up as the port state in
785 - * "Inactive", and the port may also report a
786 - * disconnect. Forcing a warm port reset seems to make
787 - * the device work.
788 - *
789 - * See https://bugzilla.kernel.org/show_bug.cgi?id=41752
790 - */
791 - if (hub_port_warm_reset_required(hub, portstatus)) {
792 - int ret;
793 -
794 - if ((portchange & USB_PORT_STAT_C_CONNECTION))
795 - clear_port_feature(hub->hdev, port1,
796 - USB_PORT_FEAT_C_CONNECTION);
797 - if (portchange & USB_PORT_STAT_C_LINK_STATE)
798 - clear_port_feature(hub->hdev, port1,
799 - USB_PORT_FEAT_C_PORT_LINK_STATE);
800 - if (portchange & USB_PORT_STAT_C_RESET)
801 - clear_port_feature(hub->hdev, port1,
802 - USB_PORT_FEAT_C_RESET);
803 - dev_dbg(hub->intfdev, "hot reset failed, warm reset port %d\n",
804 - port1);
805 - ret = hub_port_reset(hub, port1,
806 - udev, HUB_BH_RESET_TIME,
807 - true);
808 - if ((portchange & USB_PORT_STAT_C_CONNECTION))
809 - clear_port_feature(hub->hdev, port1,
810 - USB_PORT_FEAT_C_CONNECTION);
811 - return ret;
812 - }
813 - /* Device went away? */
814 - if (!(portstatus & USB_PORT_STAT_CONNECTION))
815 - return -ENOTCONN;
816 -
817 - /* bomb out completely if the connection bounced */
818 - if ((portchange & USB_PORT_STAT_C_CONNECTION))
819 - return -ENOTCONN;
820 -
821 - if ((portstatus & USB_PORT_STAT_ENABLE)) {
822 - if (hub_is_wusb(hub))
823 - udev->speed = USB_SPEED_WIRELESS;
824 - else if (hub_is_superspeed(hub->hdev))
825 - udev->speed = USB_SPEED_SUPER;
826 - else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
827 - udev->speed = USB_SPEED_HIGH;
828 - else if (portstatus & USB_PORT_STAT_LOW_SPEED)
829 - udev->speed = USB_SPEED_LOW;
830 - else
831 - udev->speed = USB_SPEED_FULL;
832 + if (!hub_is_superspeed(hub->hdev) &&
833 + (portchange & USB_PORT_STAT_C_CONNECTION))
834 + return -ENOTCONN;
835 +
836 + if ((portstatus & USB_PORT_STAT_ENABLE)) {
837 + if (!udev)
838 return 0;
839 - }
840 - } else {
841 - if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
842 - hub_port_warm_reset_required(hub,
843 - portstatus))
844 - return -ENOTCONN;
845
846 + if (hub_is_wusb(hub))
847 + udev->speed = USB_SPEED_WIRELESS;
848 + else if (hub_is_superspeed(hub->hdev))
849 + udev->speed = USB_SPEED_SUPER;
850 + else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
851 + udev->speed = USB_SPEED_HIGH;
852 + else if (portstatus & USB_PORT_STAT_LOW_SPEED)
853 + udev->speed = USB_SPEED_LOW;
854 + else
855 + udev->speed = USB_SPEED_FULL;
856 return 0;
857 }
858
859 @@ -2288,16 +2253,16 @@ delay:
860 }
861
862 static void hub_port_finish_reset(struct usb_hub *hub, int port1,
863 - struct usb_device *udev, int *status, bool warm)
864 + struct usb_device *udev, int *status)
865 {
866 switch (*status) {
867 case 0:
868 - if (!warm) {
869 - struct usb_hcd *hcd;
870 - /* TRSTRCY = 10 ms; plus some extra */
871 - msleep(10 + 40);
872 + /* TRSTRCY = 10 ms; plus some extra */
873 + msleep(10 + 40);
874 + if (udev) {
875 + struct usb_hcd *hcd = bus_to_hcd(udev->bus);
876 +
877 update_devnum(udev, 0);
878 - hcd = bus_to_hcd(udev->bus);
879 /* The xHC may think the device is already reset,
880 * so ignore the status.
881 */
882 @@ -2309,14 +2274,15 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
883 case -ENODEV:
884 clear_port_feature(hub->hdev,
885 port1, USB_PORT_FEAT_C_RESET);
886 - /* FIXME need disconnect() for NOTATTACHED device */
887 if (hub_is_superspeed(hub->hdev)) {
888 clear_port_feature(hub->hdev, port1,
889 USB_PORT_FEAT_C_BH_PORT_RESET);
890 clear_port_feature(hub->hdev, port1,
891 USB_PORT_FEAT_C_PORT_LINK_STATE);
892 + clear_port_feature(hub->hdev, port1,
893 + USB_PORT_FEAT_C_CONNECTION);
894 }
895 - if (!warm)
896 + if (udev)
897 usb_set_device_state(udev, *status
898 ? USB_STATE_NOTATTACHED
899 : USB_STATE_DEFAULT);
900 @@ -2329,18 +2295,30 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
901 struct usb_device *udev, unsigned int delay, bool warm)
902 {
903 int i, status;
904 + u16 portchange, portstatus;
905
906 - if (!warm) {
907 - /* Block EHCI CF initialization during the port reset.
908 - * Some companion controllers don't like it when they mix.
909 - */
910 - down_read(&ehci_cf_port_reset_rwsem);
911 - } else {
912 - if (!hub_is_superspeed(hub->hdev)) {
913 + if (!hub_is_superspeed(hub->hdev)) {
914 + if (warm) {
915 dev_err(hub->intfdev, "only USB3 hub support "
916 "warm reset\n");
917 return -EINVAL;
918 }
919 + /* Block EHCI CF initialization during the port reset.
920 + * Some companion controllers don't like it when they mix.
921 + */
922 + down_read(&ehci_cf_port_reset_rwsem);
923 + } else if (!warm) {
924 + /*
925 + * If the caller hasn't explicitly requested a warm reset,
926 + * double check and see if one is needed.
927 + */
928 + status = hub_port_status(hub, port1,
929 + &portstatus, &portchange);
930 + if (status < 0)
931 + goto done;
932 +
933 + if (hub_port_warm_reset_required(hub, portstatus))
934 + warm = true;
935 }
936
937 /* Reset the port */
938 @@ -2361,10 +2339,33 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
939 status);
940 }
941
942 - /* return on disconnect or reset */
943 + /* Check for disconnect or reset */
944 if (status == 0 || status == -ENOTCONN || status == -ENODEV) {
945 - hub_port_finish_reset(hub, port1, udev, &status, warm);
946 - goto done;
947 + hub_port_finish_reset(hub, port1, udev, &status);
948 +
949 + if (!hub_is_superspeed(hub->hdev))
950 + goto done;
951 +
952 + /*
953 + * If a USB 3.0 device migrates from reset to an error
954 + * state, re-issue the warm reset.
955 + */
956 + if (hub_port_status(hub, port1,
957 + &portstatus, &portchange) < 0)
958 + goto done;
959 +
960 + if (!hub_port_warm_reset_required(hub, portstatus))
961 + goto done;
962 +
963 + /*
964 + * If the port is in SS.Inactive or Compliance Mode, the
965 + * hot or warm reset failed. Try another warm reset.
966 + */
967 + if (!warm) {
968 + dev_dbg(hub->intfdev, "hot reset failed, warm reset port %d\n",
969 + port1);
970 + warm = true;
971 + }
972 }
973
974 dev_dbg (hub->intfdev,
975 @@ -2378,7 +2379,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
976 port1);
977
978 done:
979 - if (!warm)
980 + if (!hub_is_superspeed(hub->hdev))
981 up_read(&ehci_cf_port_reset_rwsem);
982
983 return status;
984 @@ -3876,12 +3877,21 @@ static void hub_events(void)
985 */
986 if (hub_port_warm_reset_required(hub, portstatus)) {
987 int status;
988 + struct usb_device *udev =
989 + hub->hdev->children[i - 1];
990
991 dev_dbg(hub_dev, "warm reset port %d\n", i);
992 - status = hub_port_reset(hub, i, NULL,
993 - HUB_BH_RESET_TIME, true);
994 - if (status < 0)
995 - hub_port_disable(hub, i, 1);
996 + if (!udev) {
997 + status = hub_port_reset(hub, i,
998 + NULL, HUB_BH_RESET_TIME,
999 + true);
1000 + if (status < 0)
1001 + hub_port_disable(hub, i, 1);
1002 + } else {
1003 + usb_lock_device(udev);
1004 + status = usb_reset_device(udev);
1005 + usb_unlock_device(udev);
1006 + }
1007 connect_change = 0;
1008 }
1009
1010 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
1011 index 1411b99..3ad7ee9 100644
1012 --- a/fs/btrfs/volumes.c
1013 +++ b/fs/btrfs/volumes.c
1014 @@ -557,6 +557,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
1015 new_device->writeable = 0;
1016 new_device->in_fs_metadata = 0;
1017 new_device->can_discard = 0;
1018 + spin_lock_init(&new_device->io_lock);
1019 list_replace_rcu(&device->dev_list, &new_device->dev_list);
1020
1021 call_rcu(&device->rcu, free_device);
1022 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
1023 index 541ef81..d7561e0 100644
1024 --- a/fs/cifs/cifsfs.c
1025 +++ b/fs/cifs/cifsfs.c
1026 @@ -557,6 +557,11 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
1027 dentry = ERR_PTR(-ENOENT);
1028 break;
1029 }
1030 + if (!S_ISDIR(dir->i_mode)) {
1031 + dput(dentry);
1032 + dentry = ERR_PTR(-ENOTDIR);
1033 + break;
1034 + }
1035
1036 /* skip separators */
1037 while (*s == sep)
1038 diff --git a/fs/compat.c b/fs/compat.c
1039 index 2b371b3..56acdcb 100644
1040 --- a/fs/compat.c
1041 +++ b/fs/compat.c
1042 @@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int type,
1043 }
1044 *ret_pointer = iov;
1045
1046 + ret = -EFAULT;
1047 + if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
1048 + goto out;
1049 +
1050 /*
1051 * Single unix specification:
1052 * We should -EINVAL if an element length is not >= 0 and fitting an
1053 @@ -1089,17 +1093,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
1054 if (!file->f_op)
1055 goto out;
1056
1057 - ret = -EFAULT;
1058 - if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
1059 - goto out;
1060 -
1061 - tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1062 + ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1063 UIO_FASTIOV, iovstack, &iov, 1);
1064 - if (tot_len == 0) {
1065 - ret = 0;
1066 + if (ret <= 0)
1067 goto out;
1068 - }
1069
1070 + tot_len = ret;
1071 ret = rw_verify_area(type, file, pos, tot_len);
1072 if (ret < 0)
1073 goto out;
1074 diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
1075 index 3210a03..2781563 100644
1076 --- a/fs/nfs/unlink.c
1077 +++ b/fs/nfs/unlink.c
1078 @@ -336,20 +336,14 @@ static void nfs_async_rename_done(struct rpc_task *task, void *calldata)
1079 struct inode *old_dir = data->old_dir;
1080 struct inode *new_dir = data->new_dir;
1081 struct dentry *old_dentry = data->old_dentry;
1082 - struct dentry *new_dentry = data->new_dentry;
1083
1084 if (!NFS_PROTO(old_dir)->rename_done(task, old_dir, new_dir)) {
1085 rpc_restart_call_prepare(task);
1086 return;
1087 }
1088
1089 - if (task->tk_status != 0) {
1090 + if (task->tk_status != 0)
1091 nfs_cancel_async_unlink(old_dentry);
1092 - return;
1093 - }
1094 -
1095 - d_drop(old_dentry);
1096 - d_drop(new_dentry);
1097 }
1098
1099 /**
1100 @@ -550,6 +544,18 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
1101 error = rpc_wait_for_completion_task(task);
1102 if (error == 0)
1103 error = task->tk_status;
1104 + switch (error) {
1105 + case 0:
1106 + /* The rename succeeded */
1107 + nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1108 + d_move(dentry, sdentry);
1109 + break;
1110 + case -ERESTARTSYS:
1111 + /* The result of the rename is unknown. Play it safe by
1112 + * forcing a new lookup */
1113 + d_drop(dentry);
1114 + d_drop(sdentry);
1115 + }
1116 rpc_put_task(task);
1117 out_dput:
1118 dput(sdentry);
1119 diff --git a/fs/pipe.c b/fs/pipe.c
1120 index fec5e4a..1667e6f 100644
1121 --- a/fs/pipe.c
1122 +++ b/fs/pipe.c
1123 @@ -860,6 +860,9 @@ pipe_rdwr_open(struct inode *inode, struct file *filp)
1124 {
1125 int ret = -ENOENT;
1126
1127 + if (!(filp->f_mode & (FMODE_READ|FMODE_WRITE)))
1128 + return -EINVAL;
1129 +
1130 mutex_lock(&inode->i_mutex);
1131
1132 if (inode->i_pipe) {
1133 diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
1134 index a1d2849..b659cd6 100644
1135 --- a/kernel/trace/Kconfig
1136 +++ b/kernel/trace/Kconfig
1137 @@ -386,24 +386,28 @@ config KPROBE_EVENT
1138 If you want to use perf tools, this option is strongly recommended.
1139
1140 config DYNAMIC_FTRACE
1141 - bool "enable/disable ftrace tracepoints dynamically"
1142 + bool "enable/disable function tracing dynamically"
1143 depends on FUNCTION_TRACER
1144 depends on HAVE_DYNAMIC_FTRACE
1145 default y
1146 help
1147 - This option will modify all the calls to ftrace dynamically
1148 - (will patch them out of the binary image and replace them
1149 - with a No-Op instruction) as they are called. A table is
1150 - created to dynamically enable them again.
1151 + This option will modify all the calls to function tracing
1152 + dynamically (will patch them out of the binary image and
1153 + replace them with a No-Op instruction) on boot up. During
1154 + compile time, a table is made of all the locations that ftrace
1155 + can function trace, and this table is linked into the kernel
1156 + image. When this is enabled, functions can be individually
1157 + enabled, and the functions not enabled will not affect
1158 + performance of the system.
1159 +
1160 + See the files in /sys/kernel/debug/tracing:
1161 + available_filter_functions
1162 + set_ftrace_filter
1163 + set_ftrace_notrace
1164
1165 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
1166 otherwise has native performance as long as no tracing is active.
1167
1168 - The changes to the code are done by a kernel thread that
1169 - wakes up once a second and checks to see if any ftrace calls
1170 - were made. If so, it runs stop_machine (stops all CPUS)
1171 - and modifies the code to jump over the call to ftrace.
1172 -
1173 config FUNCTION_PROFILER
1174 bool "Kernel function profiler"
1175 depends on FUNCTION_TRACER
1176 diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
1177 index c20ff48..b63e84a 100644
1178 --- a/mm/process_vm_access.c
1179 +++ b/mm/process_vm_access.c
1180 @@ -429,12 +429,6 @@ compat_process_vm_rw(compat_pid_t pid,
1181 if (flags != 0)
1182 return -EINVAL;
1183
1184 - if (!access_ok(VERIFY_READ, lvec, liovcnt * sizeof(*lvec)))
1185 - goto out;
1186 -
1187 - if (!access_ok(VERIFY_READ, rvec, riovcnt * sizeof(*rvec)))
1188 - goto out;
1189 -
1190 if (vm_write)
1191 rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt,
1192 UIO_FASTIOV, iovstack_l,
1193 @@ -459,8 +453,6 @@ free_iovecs:
1194 kfree(iov_r);
1195 if (iov_l != iovstack_l)
1196 kfree(iov_l);
1197 -
1198 -out:
1199 return rc;
1200 }
1201
1202 diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
1203 index feea474..f1a63c1 100644
1204 --- a/net/sunrpc/xprt.c
1205 +++ b/net/sunrpc/xprt.c
1206 @@ -485,13 +485,17 @@ EXPORT_SYMBOL_GPL(xprt_wake_pending_tasks);
1207 * xprt_wait_for_buffer_space - wait for transport output buffer to clear
1208 * @task: task to be put to sleep
1209 * @action: function pointer to be executed after wait
1210 + *
1211 + * Note that we only set the timer for the case of RPC_IS_SOFT(), since
1212 + * we don't in general want to force a socket disconnection due to
1213 + * an incomplete RPC call transmission.
1214 */
1215 void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action)
1216 {
1217 struct rpc_rqst *req = task->tk_rqstp;
1218 struct rpc_xprt *xprt = req->rq_xprt;
1219
1220 - task->tk_timeout = req->rq_timeout;
1221 + task->tk_timeout = RPC_IS_SOFT(task) ? req->rq_timeout : 0;
1222 rpc_sleep_on(&xprt->pending, task, action);
1223 }
1224 EXPORT_SYMBOL_GPL(xprt_wait_for_buffer_space);
1225 diff --git a/security/keys/compat.c b/security/keys/compat.c
1226 index 4c48e13..1b0b7bf 100644
1227 --- a/security/keys/compat.c
1228 +++ b/security/keys/compat.c
1229 @@ -40,12 +40,12 @@ long compat_keyctl_instantiate_key_iov(
1230 ARRAY_SIZE(iovstack),
1231 iovstack, &iov, 1);
1232 if (ret < 0)
1233 - return ret;
1234 + goto err;
1235 if (ret == 0)
1236 goto no_payload_free;
1237
1238 ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid);
1239 -
1240 +err:
1241 if (iov != iovstack)
1242 kfree(iov);
1243 return ret;
1244 diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
1245 index be7ecb2..adbfddd 100644
1246 --- a/security/keys/process_keys.c
1247 +++ b/security/keys/process_keys.c
1248 @@ -54,7 +54,7 @@ int install_user_keyrings(void)
1249
1250 kenter("%p{%u}", user, user->uid);
1251
1252 - if (user->uid_keyring) {
1253 + if (user->uid_keyring && user->session_keyring) {
1254 kleave(" = 0 [exist]");
1255 return 0;
1256 }
1257 diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
1258 index 8575861..0097f36 100644
1259 --- a/sound/core/vmaster.c
1260 +++ b/sound/core/vmaster.c
1261 @@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol *kcontrol,
1262 }
1263 if (!changed)
1264 return 0;
1265 - return slave_put_val(slave, ucontrol);
1266 + err = slave_put_val(slave, ucontrol);
1267 + if (err < 0)
1268 + return err;
1269 + return 1;
1270 }
1271
1272 static int slave_tlv_cmd(struct snd_kcontrol *kcontrol,
1273 diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1274 index fa2ce0c..02a6e3f 100644
1275 --- a/sound/pci/hda/patch_hdmi.c
1276 +++ b/sound/pci/hda/patch_hdmi.c
1277 @@ -1244,9 +1244,6 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
1278
1279 if (pcmdev > 0)
1280 sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
1281 - if (!is_jack_detectable(codec, per_pin->pin_nid))
1282 - strncat(hdmi_str, " Phantom",
1283 - sizeof(hdmi_str) - strlen(hdmi_str) - 1);
1284
1285 return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0);
1286 }
1287 diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
1288 index 132a86e..08c7f3a 100644
1289 --- a/sound/pci/ice1712/ice1712.c
1290 +++ b/sound/pci/ice1712/ice1712.c
1291 @@ -2595,6 +2595,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
1292 snd_ice1712_proc_init(ice);
1293 synchronize_irq(pci->irq);
1294
1295 + card->private_data = ice;
1296 +
1297 err = pci_request_regions(pci, "ICE1712");
1298 if (err < 0) {
1299 kfree(ice);