Magellan Linux

Annotation of /trunk/kernel-magellan/patches-3.1/0108-3.1.9-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1620 - (hide annotations) (download)
Mon Jan 16 18:48:12 2012 UTC (12 years, 4 months ago) by niro
File size: 47857 byte(s)
-added incr patch up to 3.1.9
1 niro 1620 diff --git a/Documentation/HOWTO b/Documentation/HOWTO
2     index 81bc1a9..f7ade3b 100644
3     --- a/Documentation/HOWTO
4     +++ b/Documentation/HOWTO
5     @@ -275,8 +275,8 @@ versions.
6     If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
7     kernel is the current stable kernel.
8    
9     -2.6.x.y are maintained by the "stable" team <stable@kernel.org>, and are
10     -released as needs dictate. The normal release period is approximately
11     +2.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
12     +are released as needs dictate. The normal release period is approximately
13     two weeks, but it can be longer if there are no pressing problems. A
14     security-related problem, instead, can cause a release to happen almost
15     instantly.
16     diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting
17     index 903a254..8a48c9b 100644
18     --- a/Documentation/development-process/5.Posting
19     +++ b/Documentation/development-process/5.Posting
20     @@ -271,10 +271,10 @@ copies should go to:
21     the linux-kernel list.
22    
23     - If you are fixing a bug, think about whether the fix should go into the
24     - next stable update. If so, stable@kernel.org should get a copy of the
25     - patch. Also add a "Cc: stable@kernel.org" to the tags within the patch
26     - itself; that will cause the stable team to get a notification when your
27     - fix goes into the mainline.
28     + next stable update. If so, stable@vger.kernel.org should get a copy of
29     + the patch. Also add a "Cc: stable@vger.kernel.org" to the tags within
30     + the patch itself; that will cause the stable team to get a notification
31     + when your fix goes into the mainline.
32    
33     When selecting recipients for a patch, it is good to have an idea of who
34     you think will eventually accept the patch and get it merged. While it
35     diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
36     index a4efa04..5335fa8 100644
37     --- a/Documentation/usb/usbmon.txt
38     +++ b/Documentation/usb/usbmon.txt
39     @@ -47,10 +47,11 @@ This allows to filter away annoying devices that talk continuously.
40    
41     2. Find which bus connects to the desired device
42    
43     -Run "cat /proc/bus/usb/devices", and find the T-line which corresponds to
44     -the device. Usually you do it by looking for the vendor string. If you have
45     -many similar devices, unplug one and compare two /proc/bus/usb/devices outputs.
46     -The T-line will have a bus number. Example:
47     +Run "cat /sys/kernel/debug/usb/devices", and find the T-line which corresponds
48     +to the device. Usually you do it by looking for the vendor string. If you have
49     +many similar devices, unplug one and compare the two
50     +/sys/kernel/debug/usb/devices outputs. The T-line will have a bus number.
51     +Example:
52    
53     T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
54     D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
55     @@ -58,7 +59,10 @@ P: Vendor=0557 ProdID=2004 Rev= 1.00
56     S: Manufacturer=ATEN
57     S: Product=UC100KM V2.00
58    
59     -Bus=03 means it's bus 3.
60     +"Bus=03" means it's bus 3. Alternatively, you can look at the output from
61     +"lsusb" and get the bus number from the appropriate line. Example:
62     +
63     +Bus 003 Device 002: ID 0557:2004 ATEN UC100KM V2.00
64    
65     3. Start 'cat'
66    
67     diff --git a/MAINTAINERS b/MAINTAINERS
68     index e608038..c0bb916 100644
69     --- a/MAINTAINERS
70     +++ b/MAINTAINERS
71     @@ -6129,7 +6129,7 @@ F: arch/alpha/kernel/srm_env.c
72    
73     STABLE BRANCH
74     M: Greg Kroah-Hartman <greg@kroah.com>
75     -L: stable@kernel.org
76     +L: stable@vger.kernel.org
77     S: Maintained
78    
79     STAGING SUBSYSTEM
80     diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
81     index fe6f7c2..bc3c745 100644
82     --- a/arch/powerpc/include/asm/time.h
83     +++ b/arch/powerpc/include/asm/time.h
84     @@ -219,5 +219,7 @@ DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
85     extern void secondary_cpu_time_init(void);
86     extern void iSeries_time_init_early(void);
87    
88     +extern void decrementer_check_overflow(void);
89     +
90     #endif /* __KERNEL__ */
91     #endif /* __POWERPC_TIME_H */
92     diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
93     index d281fb6..4b1e82a 100644
94     --- a/arch/powerpc/kernel/irq.c
95     +++ b/arch/powerpc/kernel/irq.c
96     @@ -164,16 +164,13 @@ notrace void arch_local_irq_restore(unsigned long en)
97     */
98     local_paca->hard_enabled = en;
99    
100     -#ifndef CONFIG_BOOKE
101     - /* On server, re-trigger the decrementer if it went negative since
102     - * some processors only trigger on edge transitions of the sign bit.
103     - *
104     - * BookE has a level sensitive decrementer (latches in TSR) so we
105     - * don't need that
106     + /*
107     + * Trigger the decrementer if we have a pending event. Some processors
108     + * only trigger on edge transitions of the sign bit. We might also
109     + * have disabled interrupts long enough that the decrementer wrapped
110     + * to positive.
111     */
112     - if ((int)mfspr(SPRN_DEC) < 0)
113     - mtspr(SPRN_DEC, 1);
114     -#endif /* CONFIG_BOOKE */
115     + decrementer_check_overflow();
116    
117     /*
118     * Force the delivery of pending soft-disabled interrupts on PS3.
119     diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
120     index 03b29a6..2de304a 100644
121     --- a/arch/powerpc/kernel/time.c
122     +++ b/arch/powerpc/kernel/time.c
123     @@ -889,6 +889,15 @@ static void __init clocksource_init(void)
124     clock->name, clock->mult, clock->shift);
125     }
126    
127     +void decrementer_check_overflow(void)
128     +{
129     + u64 now = get_tb_or_rtc();
130     + struct decrementer_clock *decrementer = &__get_cpu_var(decrementers);
131     +
132     + if (now >= decrementer->next_tb)
133     + set_dec(1);
134     +}
135     +
136     static int decrementer_set_next_event(unsigned long evt,
137     struct clock_event_device *dev)
138     {
139     diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
140     index f106662..c9311cf 100644
141     --- a/arch/powerpc/platforms/pseries/hvCall_inst.c
142     +++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
143     @@ -109,7 +109,7 @@ static void probe_hcall_entry(void *ignored, unsigned long opcode, unsigned long
144     if (opcode > MAX_HCALL_OPCODE)
145     return;
146    
147     - h = &get_cpu_var(hcall_stats)[opcode / 4];
148     + h = &__get_cpu_var(hcall_stats)[opcode / 4];
149     h->tb_start = mftb();
150     h->purr_start = mfspr(SPRN_PURR);
151     }
152     @@ -126,8 +126,6 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, unsigned long
153     h->num_calls++;
154     h->tb_total += mftb() - h->tb_start;
155     h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
156     -
157     - put_cpu_var(hcall_stats);
158     }
159    
160     static int __init hcall_inst_init(void)
161     diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
162     index c9a29da..2178cc4 100644
163     --- a/arch/powerpc/platforms/pseries/lpar.c
164     +++ b/arch/powerpc/platforms/pseries/lpar.c
165     @@ -553,6 +553,7 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
166     goto out;
167    
168     (*depth)++;
169     + preempt_disable();
170     trace_hcall_entry(opcode, args);
171     (*depth)--;
172    
173     @@ -575,6 +576,7 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
174    
175     (*depth)++;
176     trace_hcall_exit(opcode, retval, retbuf);
177     + preempt_enable();
178     (*depth)--;
179    
180     out:
181     diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
182     index 06ed6b4..3719c94 100644
183     --- a/drivers/base/firmware_class.c
184     +++ b/drivers/base/firmware_class.c
185     @@ -226,13 +226,13 @@ static ssize_t firmware_loading_store(struct device *dev,
186     int loading = simple_strtol(buf, NULL, 10);
187     int i;
188    
189     + mutex_lock(&fw_lock);
190     +
191     + if (!fw_priv->fw)
192     + goto out;
193     +
194     switch (loading) {
195     case 1:
196     - mutex_lock(&fw_lock);
197     - if (!fw_priv->fw) {
198     - mutex_unlock(&fw_lock);
199     - break;
200     - }
201     firmware_free_data(fw_priv->fw);
202     memset(fw_priv->fw, 0, sizeof(struct firmware));
203     /* If the pages are not owned by 'struct firmware' */
204     @@ -243,7 +243,6 @@ static ssize_t firmware_loading_store(struct device *dev,
205     fw_priv->page_array_size = 0;
206     fw_priv->nr_pages = 0;
207     set_bit(FW_STATUS_LOADING, &fw_priv->status);
208     - mutex_unlock(&fw_lock);
209     break;
210     case 0:
211     if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
212     @@ -274,7 +273,8 @@ static ssize_t firmware_loading_store(struct device *dev,
213     fw_load_abort(fw_priv);
214     break;
215     }
216     -
217     +out:
218     + mutex_unlock(&fw_lock);
219     return count;
220     }
221    
222     diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c
223     index d8ca0a0..65df26c 100644
224     --- a/drivers/infiniband/hw/qib/qib_iba6120.c
225     +++ b/drivers/infiniband/hw/qib/qib_iba6120.c
226     @@ -2076,9 +2076,11 @@ static void qib_6120_config_ctxts(struct qib_devdata *dd)
227     static void qib_update_6120_usrhead(struct qib_ctxtdata *rcd, u64 hd,
228     u32 updegr, u32 egrhd, u32 npkts)
229     {
230     - qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
231     if (updegr)
232     qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
233     + mmiowb();
234     + qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
235     + mmiowb();
236     }
237    
238     static u32 qib_6120_hdrqempty(struct qib_ctxtdata *rcd)
239     diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c
240     index e1f9474..4250c05 100644
241     --- a/drivers/infiniband/hw/qib/qib_iba7220.c
242     +++ b/drivers/infiniband/hw/qib/qib_iba7220.c
243     @@ -2724,9 +2724,11 @@ static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what)
244     static void qib_update_7220_usrhead(struct qib_ctxtdata *rcd, u64 hd,
245     u32 updegr, u32 egrhd, u32 npkts)
246     {
247     - qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
248     if (updegr)
249     qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
250     + mmiowb();
251     + qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
252     + mmiowb();
253     }
254    
255     static u32 qib_7220_hdrqempty(struct qib_ctxtdata *rcd)
256     diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
257     index 5ea9ece..b7c3c7d 100644
258     --- a/drivers/infiniband/hw/qib/qib_iba7322.c
259     +++ b/drivers/infiniband/hw/qib/qib_iba7322.c
260     @@ -4084,10 +4084,12 @@ static void qib_update_7322_usrhead(struct qib_ctxtdata *rcd, u64 hd,
261     */
262     if (hd >> IBA7322_HDRHEAD_PKTINT_SHIFT)
263     adjust_rcv_timeout(rcd, npkts);
264     - qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
265     - qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
266     if (updegr)
267     qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
268     + mmiowb();
269     + qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
270     + qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
271     + mmiowb();
272     }
273    
274     static u32 qib_7322_hdrqempty(struct qib_ctxtdata *rcd)
275     diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
276     index de3d351..ba0e065 100644
277     --- a/drivers/net/bonding/bond_main.c
278     +++ b/drivers/net/bonding/bond_main.c
279     @@ -1839,7 +1839,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
280     "but new slave device does not support netpoll.\n",
281     bond_dev->name);
282     res = -EBUSY;
283     - goto err_close;
284     + goto err_detach;
285     }
286     }
287     #endif
288     @@ -1848,7 +1848,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
289    
290     res = bond_create_slave_symlinks(bond_dev, slave_dev);
291     if (res)
292     - goto err_close;
293     + goto err_detach;
294    
295     res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
296     new_slave);
297     @@ -1869,6 +1869,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
298     err_dest_symlinks:
299     bond_destroy_slave_symlinks(bond_dev, slave_dev);
300    
301     +err_detach:
302     + write_lock_bh(&bond->lock);
303     + bond_detach_slave(bond, new_slave);
304     + write_unlock_bh(&bond->lock);
305     +
306     err_close:
307     dev_close(slave_dev);
308    
309     diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
310     index c5c4b4d..7105577 100644
311     --- a/drivers/net/usb/asix.c
312     +++ b/drivers/net/usb/asix.c
313     @@ -371,7 +371,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
314    
315     skb_pull(skb, (size + 1) & 0xfffe);
316    
317     - if (skb->len == 0)
318     + if (skb->len < sizeof(header))
319     break;
320    
321     head = (u8 *) skb->data;
322     @@ -1560,6 +1560,10 @@ static const struct usb_device_id products [] = {
323     // ASIX 88772a
324     USB_DEVICE(0x0db0, 0xa877),
325     .driver_info = (unsigned long) &ax88772_info,
326     +}, {
327     + // Asus USB Ethernet Adapter
328     + USB_DEVICE (0x0b95, 0x7e2b),
329     + .driver_info = (unsigned long) &ax88772_info,
330     },
331     { }, // END
332     };
333     diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
334     index dbf501c..05f9769 100644
335     --- a/drivers/net/wireless/rt2x00/rt2800usb.c
336     +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
337     @@ -970,6 +970,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
338     { USB_DEVICE(0x13b1, 0x0031) },
339     { USB_DEVICE(0x1737, 0x0070) },
340     { USB_DEVICE(0x1737, 0x0071) },
341     + { USB_DEVICE(0x1737, 0x0077) },
342     /* Logitec */
343     { USB_DEVICE(0x0789, 0x0162) },
344     { USB_DEVICE(0x0789, 0x0163) },
345     @@ -1165,7 +1166,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
346     { USB_DEVICE(0x1740, 0x0605) },
347     { USB_DEVICE(0x1740, 0x0615) },
348     /* Linksys */
349     - { USB_DEVICE(0x1737, 0x0077) },
350     { USB_DEVICE(0x1737, 0x0078) },
351     /* Logitec */
352     { USB_DEVICE(0x0789, 0x0168) },
353     diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
354     index 5ebc64d..454e913 100644
355     --- a/drivers/net/wireless/wl12xx/boot.c
356     +++ b/drivers/net/wireless/wl12xx/boot.c
357     @@ -358,6 +358,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
358     nvs_ptr += 3;
359    
360     for (i = 0; i < burst_len; i++) {
361     + if (nvs_ptr + 3 >= (u8 *) wl->nvs + nvs_len)
362     + goto out_badnvs;
363     +
364     val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
365     | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
366    
367     @@ -369,6 +372,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
368     nvs_ptr += 4;
369     dest_addr += 4;
370     }
371     +
372     + if (nvs_ptr >= (u8 *) wl->nvs + nvs_len)
373     + goto out_badnvs;
374     }
375    
376     /*
377     @@ -380,6 +386,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
378     */
379     nvs_ptr = (u8 *)wl->nvs +
380     ALIGN(nvs_ptr - (u8 *)wl->nvs + 7, 4);
381     +
382     + if (nvs_ptr >= (u8 *) wl->nvs + nvs_len)
383     + goto out_badnvs;
384     +
385     nvs_len -= nvs_ptr - (u8 *)wl->nvs;
386    
387     /* Now we must set the partition correctly */
388     @@ -395,6 +405,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
389    
390     kfree(nvs_aligned);
391     return 0;
392     +
393     +out_badnvs:
394     + wl1271_error("nvs data is malformed");
395     + return -EILSEQ;
396     }
397    
398     static void wl1271_boot_enable_interrupts(struct wl1271 *wl)
399     diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
400     index 97dd237..2144f60 100644
401     --- a/drivers/net/wireless/wl12xx/cmd.c
402     +++ b/drivers/net/wireless/wl12xx/cmd.c
403     @@ -120,6 +120,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
404     if (!wl->nvs)
405     return -ENODEV;
406    
407     + if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
408     + wl1271_warning("FEM index from INI out of bounds");
409     + return -EINVAL;
410     + }
411     +
412     gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
413     if (!gen_parms)
414     return -ENOMEM;
415     @@ -148,6 +153,12 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
416     gp->tx_bip_fem_manufacturer =
417     gen_parms->general_params.tx_bip_fem_manufacturer;
418    
419     + if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
420     + wl1271_warning("FEM index from FW out of bounds");
421     + ret = -EINVAL;
422     + goto out;
423     + }
424     +
425     wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
426     answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
427    
428     @@ -167,6 +178,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
429     if (!wl->nvs)
430     return -ENODEV;
431    
432     + if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
433     + wl1271_warning("FEM index from ini out of bounds");
434     + return -EINVAL;
435     + }
436     +
437     gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
438     if (!gen_parms)
439     return -ENOMEM;
440     @@ -191,6 +207,12 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
441     gp->tx_bip_fem_manufacturer =
442     gen_parms->general_params.tx_bip_fem_manufacturer;
443    
444     + if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
445     + wl1271_warning("FEM index from FW out of bounds");
446     + ret = -EINVAL;
447     + goto out;
448     + }
449     +
450     wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
451     answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
452    
453     diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
454     index 4ae8eff..abfb120 100644
455     --- a/drivers/net/wireless/wl12xx/testmode.c
456     +++ b/drivers/net/wireless/wl12xx/testmode.c
457     @@ -36,6 +36,7 @@ enum wl1271_tm_commands {
458     WL1271_TM_CMD_TEST,
459     WL1271_TM_CMD_INTERROGATE,
460     WL1271_TM_CMD_CONFIGURE,
461     + WL1271_TM_CMD_NVS_PUSH, /* Not in use. Keep to not break ABI */
462     WL1271_TM_CMD_SET_PLT_MODE,
463     WL1271_TM_CMD_RECOVER,
464    
465     diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
466     index d3b3567..7375124 100644
467     --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
468     +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
469     @@ -7354,6 +7354,7 @@ _scsih_remove(struct pci_dev *pdev)
470     }
471    
472     sas_remove_host(shost);
473     + mpt2sas_base_detach(ioc);
474     list_del(&ioc->list);
475     scsi_remove_host(shost);
476     scsi_host_put(shost);
477     diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
478     index b922f5d..948fc77 100644
479     --- a/drivers/tty/serial/atmel_serial.c
480     +++ b/drivers/tty/serial/atmel_serial.c
481     @@ -199,8 +199,9 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
482     {
483     struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
484     unsigned int mode;
485     + unsigned long flags;
486    
487     - spin_lock(&port->lock);
488     + spin_lock_irqsave(&port->lock, flags);
489    
490     /* Disable interrupts */
491     UART_PUT_IDR(port, atmel_port->tx_done_mask);
492     @@ -231,7 +232,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
493     /* Enable interrupts */
494     UART_PUT_IER(port, atmel_port->tx_done_mask);
495    
496     - spin_unlock(&port->lock);
497     + spin_unlock_irqrestore(&port->lock, flags);
498    
499     }
500    
501     diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
502     index 8faa23c..158f631 100644
503     --- a/drivers/usb/class/cdc-acm.c
504     +++ b/drivers/usb/class/cdc-acm.c
505     @@ -554,10 +554,18 @@ static void acm_port_down(struct acm *acm)
506    
507     static void acm_tty_hangup(struct tty_struct *tty)
508     {
509     - struct acm *acm = tty->driver_data;
510     - tty_port_hangup(&acm->port);
511     + struct acm *acm;
512     +
513     mutex_lock(&open_mutex);
514     + acm = tty->driver_data;
515     +
516     + if (!acm)
517     + goto out;
518     +
519     + tty_port_hangup(&acm->port);
520     acm_port_down(acm);
521     +
522     +out:
523     mutex_unlock(&open_mutex);
524     }
525    
526     @@ -1183,6 +1191,8 @@ made_compressed_probe:
527     i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
528     if (i < 0) {
529     kfree(acm->country_codes);
530     + acm->country_codes = NULL;
531     + acm->country_code_size = 0;
532     goto skip_countries;
533     }
534    
535     @@ -1191,6 +1201,8 @@ made_compressed_probe:
536     if (i < 0) {
537     device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
538     kfree(acm->country_codes);
539     + acm->country_codes = NULL;
540     + acm->country_code_size = 0;
541     goto skip_countries;
542     }
543     }
544     diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
545     index 73cbbd8..ea47c13 100644
546     --- a/drivers/usb/core/hcd.c
547     +++ b/drivers/usb/core/hcd.c
548     @@ -1398,11 +1398,10 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
549     ret = -EAGAIN;
550     else
551     urb->transfer_flags |= URB_DMA_MAP_SG;
552     - if (n != urb->num_sgs) {
553     - urb->num_sgs = n;
554     + urb->num_mapped_sgs = n;
555     + if (n != urb->num_sgs)
556     urb->transfer_flags |=
557     URB_DMA_SG_COMBINED;
558     - }
559     } else if (urb->sg) {
560     struct scatterlist *sg = urb->sg;
561     urb->transfer_dma = dma_map_page(
562     diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
563     index ecf12e1..4c65eb6 100644
564     --- a/drivers/usb/core/quirks.c
565     +++ b/drivers/usb/core/quirks.c
566     @@ -117,9 +117,12 @@ static const struct usb_device_id usb_quirk_list[] = {
567     { USB_DEVICE(0x06a3, 0x0006), .driver_info =
568     USB_QUIRK_CONFIG_INTF_STRINGS },
569    
570     - /* Guillemot Webcam Hercules Dualpix Exchange*/
571     + /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
572     { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
573    
574     + /* Guillemot Webcam Hercules Dualpix Exchange*/
575     + { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
576     +
577     /* M-Systems Flash Disk Pioneers */
578     { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
579    
580     diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
581     index 0917e3a..2499b3b 100644
582     --- a/drivers/usb/host/ehci-q.c
583     +++ b/drivers/usb/host/ehci-q.c
584     @@ -649,7 +649,7 @@ qh_urb_transaction (
585     /*
586     * data transfer stage: buffer setup
587     */
588     - i = urb->num_sgs;
589     + i = urb->num_mapped_sgs;
590     if (len > 0 && i > 0) {
591     sg = urb->sg;
592     buf = sg_dma_address(sg);
593     diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
594     index f9cf3f0..23107e2 100644
595     --- a/drivers/usb/host/ohci-hcd.c
596     +++ b/drivers/usb/host/ohci-hcd.c
597     @@ -389,17 +389,14 @@ ohci_shutdown (struct usb_hcd *hcd)
598     struct ohci_hcd *ohci;
599    
600     ohci = hcd_to_ohci (hcd);
601     - ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
602     - ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
603     + ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable);
604    
605     - /* If the SHUTDOWN quirk is set, don't put the controller in RESET */
606     - ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ?
607     - OHCI_CTRL_RWC | OHCI_CTRL_HCFS :
608     - OHCI_CTRL_RWC);
609     - ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
610     + /* Software reset, after which the controller goes into SUSPEND */
611     + ohci_writel(ohci, OHCI_HCR, &ohci->regs->cmdstatus);
612     + ohci_readl(ohci, &ohci->regs->cmdstatus); /* flush the writes */
613     + udelay(10);
614    
615     - /* flush the writes */
616     - (void) ohci_readl (ohci, &ohci->regs->control);
617     + ohci_writel(ohci, ohci->fminterval, &ohci->regs->fminterval);
618     }
619    
620     static int check_ed(struct ohci_hcd *ohci, struct ed *ed)
621     diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
622     index ad8166c..bc01b06 100644
623     --- a/drivers/usb/host/ohci-pci.c
624     +++ b/drivers/usb/host/ohci-pci.c
625     @@ -175,28 +175,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
626     return 0;
627     }
628    
629     -/* nVidia controllers continue to drive Reset signalling on the bus
630     - * even after system shutdown, wasting power. This flag tells the
631     - * shutdown routine to leave the controller OPERATIONAL instead of RESET.
632     - */
633     -static int ohci_quirk_nvidia_shutdown(struct usb_hcd *hcd)
634     -{
635     - struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
636     - struct ohci_hcd *ohci = hcd_to_ohci(hcd);
637     -
638     - /* Evidently nVidia fixed their later hardware; this is a guess at
639     - * the changeover point.
640     - */
641     -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB 0x026d
642     -
643     - if (pdev->device < PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB) {
644     - ohci->flags |= OHCI_QUIRK_SHUTDOWN;
645     - ohci_dbg(ohci, "enabled nVidia shutdown quirk\n");
646     - }
647     -
648     - return 0;
649     -}
650     -
651     static void sb800_prefetch(struct ohci_hcd *ohci, int on)
652     {
653     struct pci_dev *pdev;
654     @@ -260,10 +238,6 @@ static const struct pci_device_id ohci_pci_quirks[] = {
655     PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
656     .driver_data = (unsigned long)ohci_quirk_amd700,
657     },
658     - {
659     - PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
660     - .driver_data = (unsigned long) ohci_quirk_nvidia_shutdown,
661     - },
662    
663     /* FIXME for some of the early AMD 760 southbridges, OHCI
664     * won't work at all. blacklist them.
665     diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
666     index 35e5fd6..0795b93 100644
667     --- a/drivers/usb/host/ohci.h
668     +++ b/drivers/usb/host/ohci.h
669     @@ -403,7 +403,6 @@ struct ohci_hcd {
670     #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
671     #define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/
672     #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
673     -#define OHCI_QUIRK_SHUTDOWN 0x800 /* nVidia power bug */
674     // there are also chip quirks/bugs in init logic
675    
676     struct work_struct nec_work; /* Worker for NEC quirk */
677     diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
678     index a495d48..23e04fb 100644
679     --- a/drivers/usb/host/pci-quirks.c
680     +++ b/drivers/usb/host/pci-quirks.c
681     @@ -36,6 +36,7 @@
682     #define OHCI_INTRENABLE 0x10
683     #define OHCI_INTRDISABLE 0x14
684     #define OHCI_FMINTERVAL 0x34
685     +#define OHCI_HCFS (3 << 6) /* hc functional state */
686     #define OHCI_HCR (1 << 0) /* host controller reset */
687     #define OHCI_OCR (1 << 3) /* ownership change request */
688     #define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
689     @@ -465,6 +466,8 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
690     {
691     void __iomem *base;
692     u32 control;
693     + u32 fminterval;
694     + int cnt;
695    
696     if (!mmio_resource_enabled(pdev, 0))
697     return;
698     @@ -497,41 +500,32 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
699     }
700     #endif
701    
702     - /* reset controller, preserving RWC (and possibly IR) */
703     - writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
704     - readl(base + OHCI_CONTROL);
705     + /* disable interrupts */
706     + writel((u32) ~0, base + OHCI_INTRDISABLE);
707    
708     - /* Some NVIDIA controllers stop working if kept in RESET for too long */
709     - if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) {
710     - u32 fminterval;
711     - int cnt;
712     + /* Reset the USB bus, if the controller isn't already in RESET */
713     + if (control & OHCI_HCFS) {
714     + /* Go into RESET, preserving RWC (and possibly IR) */
715     + writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
716     + readl(base + OHCI_CONTROL);
717    
718     - /* drive reset for at least 50 ms (7.1.7.5) */
719     + /* drive bus reset for at least 50 ms (7.1.7.5) */
720     msleep(50);
721     + }
722    
723     - /* software reset of the controller, preserving HcFmInterval */
724     - fminterval = readl(base + OHCI_FMINTERVAL);
725     - writel(OHCI_HCR, base + OHCI_CMDSTATUS);
726     + /* software reset of the controller, preserving HcFmInterval */
727     + fminterval = readl(base + OHCI_FMINTERVAL);
728     + writel(OHCI_HCR, base + OHCI_CMDSTATUS);
729    
730     - /* reset requires max 10 us delay */
731     - for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */
732     - if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0)
733     - break;
734     - udelay(1);
735     - }
736     - writel(fminterval, base + OHCI_FMINTERVAL);
737     -
738     - /* Now we're in the SUSPEND state with all devices reset
739     - * and wakeups and interrupts disabled
740     - */
741     + /* reset requires max 10 us delay */
742     + for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */
743     + if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0)
744     + break;
745     + udelay(1);
746     }
747     + writel(fminterval, base + OHCI_FMINTERVAL);
748    
749     - /*
750     - * disable interrupts
751     - */
752     - writel(~(u32)0, base + OHCI_INTRDISABLE);
753     - writel(~(u32)0, base + OHCI_INTRSTATUS);
754     -
755     + /* Now the controller is safely in SUSPEND and nothing can wake it up */
756     iounmap(base);
757     }
758    
759     diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
760     index 84ed28b..8253991 100644
761     --- a/drivers/usb/host/uhci-q.c
762     +++ b/drivers/usb/host/uhci-q.c
763     @@ -943,7 +943,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
764     if (usb_pipein(urb->pipe))
765     status |= TD_CTRL_SPD;
766    
767     - i = urb->num_sgs;
768     + i = urb->num_mapped_sgs;
769     if (len > 0 && i > 0) {
770     sg = urb->sg;
771     data = sg_dma_address(sg);
772     diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
773     index a403b53..76083ae 100644
774     --- a/drivers/usb/host/whci/qset.c
775     +++ b/drivers/usb/host/whci/qset.c
776     @@ -443,7 +443,7 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
777    
778     remaining = urb->transfer_buffer_length;
779    
780     - for_each_sg(urb->sg, sg, urb->num_sgs, i) {
781     + for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) {
782     dma_addr_t dma_addr;
783     size_t dma_remaining;
784     dma_addr_t sp, ep;
785     @@ -561,7 +561,7 @@ static int qset_add_urb_sg_linearize(struct whc *whc, struct whc_qset *qset,
786    
787     remaining = urb->transfer_buffer_length;
788    
789     - for_each_sg(urb->sg, sg, urb->num_sgs, i) {
790     + for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) {
791     size_t len;
792     size_t sg_remaining;
793     void *orig;
794     diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
795     index 2c07fff..daddfb3 100644
796     --- a/drivers/usb/host/xhci-ring.c
797     +++ b/drivers/usb/host/xhci-ring.c
798     @@ -2562,7 +2562,7 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb)
799     struct scatterlist *sg;
800    
801     sg = NULL;
802     - num_sgs = urb->num_sgs;
803     + num_sgs = urb->num_mapped_sgs;
804     temp = urb->transfer_buffer_length;
805    
806     xhci_dbg(xhci, "count sg list trbs: \n");
807     @@ -2746,7 +2746,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
808     return -EINVAL;
809    
810     num_trbs = count_sg_trbs_needed(xhci, urb);
811     - num_sgs = urb->num_sgs;
812     + num_sgs = urb->num_mapped_sgs;
813     total_packet_count = roundup(urb->transfer_buffer_length,
814     le16_to_cpu(urb->ep->desc.wMaxPacketSize));
815    
816     diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
817     index 10dc1bd..5fc595f 100644
818     --- a/drivers/usb/host/xhci.c
819     +++ b/drivers/usb/host/xhci.c
820     @@ -1568,6 +1568,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
821     /* FIXME: can we allocate more resources for the HC? */
822     break;
823     case COMP_BW_ERR:
824     + case COMP_2ND_BW_ERR:
825     dev_warn(&udev->dev, "Not enough bandwidth "
826     "for new device state.\n");
827     ret = -ENOSPC;
828     @@ -2182,8 +2183,7 @@ static int xhci_calculate_streams_and_bitmask(struct xhci_hcd *xhci,
829     if (ret < 0)
830     return ret;
831    
832     - max_streams = USB_SS_MAX_STREAMS(
833     - eps[i]->ss_ep_comp.bmAttributes);
834     + max_streams = usb_ss_max_streams(&eps[i]->ss_ep_comp);
835     if (max_streams < (*num_streams - 1)) {
836     xhci_dbg(xhci, "Ep 0x%x only supports %u stream IDs.\n",
837     eps[i]->desc.bEndpointAddress,
838     diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
839     index 1fb0549..c149d20 100644
840     --- a/drivers/usb/host/xhci.h
841     +++ b/drivers/usb/host/xhci.h
842     @@ -900,7 +900,6 @@ struct xhci_transfer_event {
843     /* Invalid Stream ID Error */
844     #define COMP_STRID_ERR 34
845     /* Secondary Bandwidth Error - may be returned by a Configure Endpoint cmd */
846     -/* FIXME - check for this */
847     #define COMP_2ND_BW_ERR 35
848     /* Split Transaction Error */
849     #define COMP_SPLIT_ERR 36
850     diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c
851     index fe1d443..8f725f6 100644
852     --- a/drivers/usb/misc/isight_firmware.c
853     +++ b/drivers/usb/misc/isight_firmware.c
854     @@ -55,8 +55,9 @@ static int isight_firmware_load(struct usb_interface *intf,
855    
856     ptr = firmware->data;
857    
858     + buf[0] = 0x01;
859     if (usb_control_msg
860     - (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1,
861     + (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1,
862     300) != 1) {
863     printk(KERN_ERR
864     "Failed to initialise isight firmware loader\n");
865     @@ -100,8 +101,9 @@ static int isight_firmware_load(struct usb_interface *intf,
866     }
867     }
868    
869     + buf[0] = 0x00;
870     if (usb_control_msg
871     - (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1,
872     + (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1,
873     300) != 1) {
874     printk(KERN_ERR "isight firmware loading completion failed\n");
875     ret = -ENODEV;
876     diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
877     index a057a5a..96c5dbd 100644
878     --- a/drivers/usb/musb/musb_core.c
879     +++ b/drivers/usb/musb/musb_core.c
880     @@ -2013,8 +2013,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
881     if (status < 0)
882     goto fail3;
883    
884     - pm_runtime_put(musb->controller);
885     -
886     status = musb_init_debugfs(musb);
887     if (status < 0)
888     goto fail4;
889     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
890     index fd67cc5..a1a324b 100644
891     --- a/drivers/usb/serial/cp210x.c
892     +++ b/drivers/usb/serial/cp210x.c
893     @@ -92,6 +92,7 @@ static const struct usb_device_id id_table[] = {
894     { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
895     { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
896     { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
897     + { USB_DEVICE(0x10C4, 0x81A9) }, /* Multiplex RC Interface */
898     { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
899     { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
900     { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
901     diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
902     index 60f38d5..0a8c1e6 100644
903     --- a/drivers/usb/serial/omninet.c
904     +++ b/drivers/usb/serial/omninet.c
905     @@ -315,7 +315,7 @@ static int omninet_write_room(struct tty_struct *tty)
906     int room = 0; /* Default: no room */
907    
908     /* FIXME: no consistent locking for write_urb_busy */
909     - if (wport->write_urb_busy)
910     + if (!wport->write_urb_busy)
911     room = wport->bulk_out_size - OMNINET_HEADERLEN;
912    
913     dbg("%s - returns %d", __func__, room);
914     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
915     index d2becb9..c96b6b6 100644
916     --- a/drivers/usb/serial/option.c
917     +++ b/drivers/usb/serial/option.c
918     @@ -472,6 +472,14 @@ static void option_instat_callback(struct urb *urb);
919     #define YUGA_PRODUCT_CLU528 0x260D
920     #define YUGA_PRODUCT_CLU526 0x260F
921    
922     +/* Viettel products */
923     +#define VIETTEL_VENDOR_ID 0x2262
924     +#define VIETTEL_PRODUCT_VT1000 0x0002
925     +
926     +/* ZD Incorporated */
927     +#define ZD_VENDOR_ID 0x0685
928     +#define ZD_PRODUCT_7000 0x7000
929     +
930     /* some devices interfaces need special handling due to a number of reasons */
931     enum option_blacklist_reason {
932     OPTION_BLACKLIST_NONE = 0,
933     @@ -1173,6 +1181,8 @@ static const struct usb_device_id option_ids[] = {
934     { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) },
935     { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) },
936     { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
937     + { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
938     + { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
939     { } /* Terminating entry */
940     };
941     MODULE_DEVICE_TABLE(usb, option_ids);
942     diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
943     index c325e69..9e069ef 100644
944     --- a/drivers/usb/storage/usb.c
945     +++ b/drivers/usb/storage/usb.c
946     @@ -1073,6 +1073,7 @@ static struct usb_driver usb_storage_driver = {
947     .id_table = usb_storage_usb_ids,
948     .supports_autosuspend = 1,
949     .soft_unbind = 1,
950     + .no_dynamic_id = 1,
951     };
952    
953     static int __init usb_stor_init(void)
954     diff --git a/drivers/video/offb.c b/drivers/video/offb.c
955     index cb163a5..3251a02 100644
956     --- a/drivers/video/offb.c
957     +++ b/drivers/video/offb.c
958     @@ -100,36 +100,32 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
959     u_int transp, struct fb_info *info)
960     {
961     struct offb_par *par = (struct offb_par *) info->par;
962     - int i, depth;
963     - u32 *pal = info->pseudo_palette;
964     -
965     - depth = info->var.bits_per_pixel;
966     - if (depth == 16)
967     - depth = (info->var.green.length == 5) ? 15 : 16;
968     -
969     - if (regno > 255 ||
970     - (depth == 16 && regno > 63) ||
971     - (depth == 15 && regno > 31))
972     - return 1;
973     -
974     - if (regno < 16) {
975     - switch (depth) {
976     - case 15:
977     - pal[regno] = (regno << 10) | (regno << 5) | regno;
978     - break;
979     - case 16:
980     - pal[regno] = (regno << 11) | (regno << 5) | regno;
981     - break;
982     - case 24:
983     - pal[regno] = (regno << 16) | (regno << 8) | regno;
984     - break;
985     - case 32:
986     - i = (regno << 8) | regno;
987     - pal[regno] = (i << 16) | i;
988     - break;
989     +
990     + if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
991     + u32 *pal = info->pseudo_palette;
992     + u32 cr = red >> (16 - info->var.red.length);
993     + u32 cg = green >> (16 - info->var.green.length);
994     + u32 cb = blue >> (16 - info->var.blue.length);
995     + u32 value;
996     +
997     + if (regno >= 16)
998     + return -EINVAL;
999     +
1000     + value = (cr << info->var.red.offset) |
1001     + (cg << info->var.green.offset) |
1002     + (cb << info->var.blue.offset);
1003     + if (info->var.transp.length > 0) {
1004     + u32 mask = (1 << info->var.transp.length) - 1;
1005     + mask <<= info->var.transp.offset;
1006     + value |= mask;
1007     }
1008     + pal[regno] = value;
1009     + return 0;
1010     }
1011    
1012     + if (regno > 255)
1013     + return -EINVAL;
1014     +
1015     red >>= 8;
1016     green >>= 8;
1017     blue >>= 8;
1018     @@ -381,7 +377,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
1019     int pitch, unsigned long address,
1020     int foreign_endian, struct device_node *dp)
1021     {
1022     - unsigned long res_size = pitch * height * (depth + 7) / 8;
1023     + unsigned long res_size = pitch * height;
1024     struct offb_par *par = &default_par;
1025     unsigned long res_start = address;
1026     struct fb_fix_screeninfo *fix;
1027     diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
1028     index 12661e1..2ce3c52 100644
1029     --- a/fs/ext3/inode.c
1030     +++ b/fs/ext3/inode.c
1031     @@ -1617,7 +1617,13 @@ static int ext3_ordered_writepage(struct page *page,
1032     int err;
1033    
1034     J_ASSERT(PageLocked(page));
1035     - WARN_ON_ONCE(IS_RDONLY(inode));
1036     + /*
1037     + * We don't want to warn for emergency remount. The condition is
1038     + * ordered to avoid dereferencing inode->i_sb in non-error case to
1039     + * avoid slow-downs.
1040     + */
1041     + WARN_ON_ONCE(IS_RDONLY(inode) &&
1042     + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1043    
1044     /*
1045     * We give up here if we're reentered, because it might be for a
1046     @@ -1692,7 +1698,13 @@ static int ext3_writeback_writepage(struct page *page,
1047     int err;
1048    
1049     J_ASSERT(PageLocked(page));
1050     - WARN_ON_ONCE(IS_RDONLY(inode));
1051     + /*
1052     + * We don't want to warn for emergency remount. The condition is
1053     + * ordered to avoid dereferencing inode->i_sb in non-error case to
1054     + * avoid slow-downs.
1055     + */
1056     + WARN_ON_ONCE(IS_RDONLY(inode) &&
1057     + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1058    
1059     if (ext3_journal_current_handle())
1060     goto out_fail;
1061     @@ -1735,7 +1747,13 @@ static int ext3_journalled_writepage(struct page *page,
1062     int err;
1063    
1064     J_ASSERT(PageLocked(page));
1065     - WARN_ON_ONCE(IS_RDONLY(inode));
1066     + /*
1067     + * We don't want to warn for emergency remount. The condition is
1068     + * ordered to avoid dereferencing inode->i_sb in non-error case to
1069     + * avoid slow-downs.
1070     + */
1071     + WARN_ON_ONCE(IS_RDONLY(inode) &&
1072     + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1073    
1074     if (ext3_journal_current_handle())
1075     goto no_write;
1076     diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
1077     index 14363b9..5e3527b 100644
1078     --- a/fs/reiserfs/super.c
1079     +++ b/fs/reiserfs/super.c
1080     @@ -453,16 +453,20 @@ int remove_save_link(struct inode *inode, int truncate)
1081     static void reiserfs_kill_sb(struct super_block *s)
1082     {
1083     if (REISERFS_SB(s)) {
1084     - if (REISERFS_SB(s)->xattr_root) {
1085     - d_invalidate(REISERFS_SB(s)->xattr_root);
1086     - dput(REISERFS_SB(s)->xattr_root);
1087     - REISERFS_SB(s)->xattr_root = NULL;
1088     - }
1089     - if (REISERFS_SB(s)->priv_root) {
1090     - d_invalidate(REISERFS_SB(s)->priv_root);
1091     - dput(REISERFS_SB(s)->priv_root);
1092     - REISERFS_SB(s)->priv_root = NULL;
1093     - }
1094     + /*
1095     + * Force any pending inode evictions to occur now. Any
1096     + * inodes to be removed that have extended attributes
1097     + * associated with them need to clean them up before
1098     + * we can release the extended attribute root dentries.
1099     + * shrink_dcache_for_umount will BUG if we don't release
1100     + * those before it's called so ->put_super is too late.
1101     + */
1102     + shrink_dcache_sb(s);
1103     +
1104     + dput(REISERFS_SB(s)->xattr_root);
1105     + REISERFS_SB(s)->xattr_root = NULL;
1106     + dput(REISERFS_SB(s)->priv_root);
1107     + REISERFS_SB(s)->priv_root = NULL;
1108     }
1109    
1110     kill_block_super(s);
1111     @@ -1164,7 +1168,8 @@ static void handle_quota_files(struct super_block *s, char **qf_names,
1112     kfree(REISERFS_SB(s)->s_qf_names[i]);
1113     REISERFS_SB(s)->s_qf_names[i] = qf_names[i];
1114     }
1115     - REISERFS_SB(s)->s_jquota_fmt = *qfmt;
1116     + if (*qfmt)
1117     + REISERFS_SB(s)->s_jquota_fmt = *qfmt;
1118     }
1119     #endif
1120    
1121     diff --git a/fs/udf/file.c b/fs/udf/file.c
1122     index d8ffa7c..dca0c38 100644
1123     --- a/fs/udf/file.c
1124     +++ b/fs/udf/file.c
1125     @@ -125,7 +125,6 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1126     err = udf_expand_file_adinicb(inode);
1127     if (err) {
1128     udf_debug("udf_expand_adinicb: err=%d\n", err);
1129     - up_write(&iinfo->i_data_sem);
1130     return err;
1131     }
1132     } else {
1133     @@ -133,9 +132,10 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1134     iinfo->i_lenAlloc = pos + count;
1135     else
1136     iinfo->i_lenAlloc = inode->i_size;
1137     + up_write(&iinfo->i_data_sem);
1138     }
1139     - }
1140     - up_write(&iinfo->i_data_sem);
1141     + } else
1142     + up_write(&iinfo->i_data_sem);
1143    
1144     retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
1145     if (retval > 0)
1146     diff --git a/fs/udf/inode.c b/fs/udf/inode.c
1147     index 1d1358e..262050f 100644
1148     --- a/fs/udf/inode.c
1149     +++ b/fs/udf/inode.c
1150     @@ -145,6 +145,12 @@ const struct address_space_operations udf_aops = {
1151     .bmap = udf_bmap,
1152     };
1153    
1154     +/*
1155     + * Expand file stored in ICB to a normal one-block-file
1156     + *
1157     + * This function requires i_data_sem for writing and releases it.
1158     + * This function requires i_mutex held
1159     + */
1160     int udf_expand_file_adinicb(struct inode *inode)
1161     {
1162     struct page *page;
1163     @@ -163,9 +169,15 @@ int udf_expand_file_adinicb(struct inode *inode)
1164     iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
1165     /* from now on we have normal address_space methods */
1166     inode->i_data.a_ops = &udf_aops;
1167     + up_write(&iinfo->i_data_sem);
1168     mark_inode_dirty(inode);
1169     return 0;
1170     }
1171     + /*
1172     + * Release i_data_sem so that we can lock a page - page lock ranks
1173     + * above i_data_sem. i_mutex still protects us against file changes.
1174     + */
1175     + up_write(&iinfo->i_data_sem);
1176    
1177     page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS);
1178     if (!page)
1179     @@ -181,6 +193,7 @@ int udf_expand_file_adinicb(struct inode *inode)
1180     SetPageUptodate(page);
1181     kunmap(page);
1182     }
1183     + down_write(&iinfo->i_data_sem);
1184     memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00,
1185     iinfo->i_lenAlloc);
1186     iinfo->i_lenAlloc = 0;
1187     @@ -190,17 +203,20 @@ int udf_expand_file_adinicb(struct inode *inode)
1188     iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
1189     /* from now on we have normal address_space methods */
1190     inode->i_data.a_ops = &udf_aops;
1191     + up_write(&iinfo->i_data_sem);
1192     err = inode->i_data.a_ops->writepage(page, &udf_wbc);
1193     if (err) {
1194     /* Restore everything back so that we don't lose data... */
1195     lock_page(page);
1196     kaddr = kmap(page);
1197     + down_write(&iinfo->i_data_sem);
1198     memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr,
1199     inode->i_size);
1200     kunmap(page);
1201     unlock_page(page);
1202     iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
1203     inode->i_data.a_ops = &udf_adinicb_aops;
1204     + up_write(&iinfo->i_data_sem);
1205     }
1206     page_cache_release(page);
1207     mark_inode_dirty(inode);
1208     @@ -1105,10 +1121,9 @@ int udf_setsize(struct inode *inode, loff_t newsize)
1209     if (bsize <
1210     (udf_file_entry_alloc_offset(inode) + newsize)) {
1211     err = udf_expand_file_adinicb(inode);
1212     - if (err) {
1213     - up_write(&iinfo->i_data_sem);
1214     + if (err)
1215     return err;
1216     - }
1217     + down_write(&iinfo->i_data_sem);
1218     } else
1219     iinfo->i_lenAlloc = newsize;
1220     }
1221     diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
1222     index b6c4b37..ac702a6 100644
1223     --- a/fs/xfs/xfs_acl.c
1224     +++ b/fs/xfs/xfs_acl.c
1225     @@ -39,9 +39,11 @@ xfs_acl_from_disk(struct xfs_acl *aclp)
1226     struct posix_acl_entry *acl_e;
1227     struct posix_acl *acl;
1228     struct xfs_acl_entry *ace;
1229     - int count, i;
1230     + unsigned int count, i;
1231    
1232     count = be32_to_cpu(aclp->acl_cnt);
1233     + if (count > XFS_ACL_MAX_ENTRIES)
1234     + return ERR_PTR(-EFSCORRUPTED);
1235    
1236     acl = posix_acl_alloc(count, GFP_KERNEL);
1237     if (!acl)
1238     diff --git a/include/linux/usb.h b/include/linux/usb.h
1239     index 73c7df4..b08e04c 100644
1240     --- a/include/linux/usb.h
1241     +++ b/include/linux/usb.h
1242     @@ -1202,6 +1202,7 @@ struct urb {
1243     void *transfer_buffer; /* (in) associated data buffer */
1244     dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1245     struct scatterlist *sg; /* (in) scatter gather buffer list */
1246     + int num_mapped_sgs; /* (internal) mapped sg entries */
1247     int num_sgs; /* (in) number of entries in the sg list */
1248     u32 transfer_buffer_length; /* (in) data buffer length */
1249     u32 actual_length; /* (return) actual transfer length */
1250     diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
1251     index 0fd3fbd..cf65b5c 100644
1252     --- a/include/linux/usb/ch9.h
1253     +++ b/include/linux/usb/ch9.h
1254     @@ -583,8 +583,26 @@ struct usb_ss_ep_comp_descriptor {
1255     } __attribute__ ((packed));
1256    
1257     #define USB_DT_SS_EP_COMP_SIZE 6
1258     +
1259     /* Bits 4:0 of bmAttributes if this is a bulk endpoint */
1260     -#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
1261     +static inline int
1262     +usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
1263     +{
1264     + int max_streams;
1265     +
1266     + if (!comp)
1267     + return 0;
1268     +
1269     + max_streams = comp->bmAttributes & 0x1f;
1270     +
1271     + if (!max_streams)
1272     + return 0;
1273     +
1274     + max_streams = 1 << max_streams;
1275     +
1276     + return max_streams;
1277     +}
1278     +
1279     /* Bits 1:0 of bmAttributes if this is an isoc endpoint */
1280     #define USB_SS_MULT(p) (1 + ((p) & 0x3))
1281    
1282     diff --git a/kernel/cgroup.c b/kernel/cgroup.c
1283     index b7ab0b8..e4cbdfb 100644
1284     --- a/kernel/cgroup.c
1285     +++ b/kernel/cgroup.c
1286     @@ -1175,10 +1175,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
1287    
1288     /*
1289     * If the 'all' option was specified select all the subsystems,
1290     - * otherwise 'all, 'none' and a subsystem name options were not
1291     - * specified, let's default to 'all'
1292     + * otherwise if 'none', 'name=' and a subsystem name options
1293     + * were not specified, let's default to 'all'
1294     */
1295     - if (all_ss || (!all_ss && !one_ss && !opts->none)) {
1296     + if (all_ss || (!one_ss && !opts->none && !opts->name)) {
1297     for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
1298     struct cgroup_subsys *ss = subsys[i];
1299     if (ss == NULL)
1300     diff --git a/kernel/cpu.c b/kernel/cpu.c
1301     index 12b7458..aa39dd7 100644
1302     --- a/kernel/cpu.c
1303     +++ b/kernel/cpu.c
1304     @@ -15,6 +15,7 @@
1305     #include <linux/stop_machine.h>
1306     #include <linux/mutex.h>
1307     #include <linux/gfp.h>
1308     +#include <linux/suspend.h>
1309    
1310     #ifdef CONFIG_SMP
1311     /* Serializes the updates to cpu_online_mask, cpu_present_mask */
1312     @@ -476,6 +477,79 @@ static int alloc_frozen_cpus(void)
1313     return 0;
1314     }
1315     core_initcall(alloc_frozen_cpus);
1316     +
1317     +/*
1318     + * Prevent regular CPU hotplug from racing with the freezer, by disabling CPU
1319     + * hotplug when tasks are about to be frozen. Also, don't allow the freezer
1320     + * to continue until any currently running CPU hotplug operation gets
1321     + * completed.
1322     + * To modify the 'cpu_hotplug_disabled' flag, we need to acquire the
1323     + * 'cpu_add_remove_lock'. And this same lock is also taken by the regular
1324     + * CPU hotplug path and released only after it is complete. Thus, we
1325     + * (and hence the freezer) will block here until any currently running CPU
1326     + * hotplug operation gets completed.
1327     + */
1328     +void cpu_hotplug_disable_before_freeze(void)
1329     +{
1330     + cpu_maps_update_begin();
1331     + cpu_hotplug_disabled = 1;
1332     + cpu_maps_update_done();
1333     +}
1334     +
1335     +
1336     +/*
1337     + * When tasks have been thawed, re-enable regular CPU hotplug (which had been
1338     + * disabled while beginning to freeze tasks).
1339     + */
1340     +void cpu_hotplug_enable_after_thaw(void)
1341     +{
1342     + cpu_maps_update_begin();
1343     + cpu_hotplug_disabled = 0;
1344     + cpu_maps_update_done();
1345     +}
1346     +
1347     +/*
1348     + * When callbacks for CPU hotplug notifications are being executed, we must
1349     + * ensure that the state of the system with respect to the tasks being frozen
1350     + * or not, as reported by the notification, remains unchanged *throughout the
1351     + * duration* of the execution of the callbacks.
1352     + * Hence we need to prevent the freezer from racing with regular CPU hotplug.
1353     + *
1354     + * This synchronization is implemented by mutually excluding regular CPU
1355     + * hotplug and Suspend/Hibernate call paths by hooking onto the Suspend/
1356     + * Hibernate notifications.
1357     + */
1358     +static int
1359     +cpu_hotplug_pm_callback(struct notifier_block *nb,
1360     + unsigned long action, void *ptr)
1361     +{
1362     + switch (action) {
1363     +
1364     + case PM_SUSPEND_PREPARE:
1365     + case PM_HIBERNATION_PREPARE:
1366     + cpu_hotplug_disable_before_freeze();
1367     + break;
1368     +
1369     + case PM_POST_SUSPEND:
1370     + case PM_POST_HIBERNATION:
1371     + cpu_hotplug_enable_after_thaw();
1372     + break;
1373     +
1374     + default:
1375     + return NOTIFY_DONE;
1376     + }
1377     +
1378     + return NOTIFY_OK;
1379     +}
1380     +
1381     +
1382     +int cpu_hotplug_pm_sync_init(void)
1383     +{
1384     + pm_notifier(cpu_hotplug_pm_callback, 0);
1385     + return 0;
1386     +}
1387     +core_initcall(cpu_hotplug_pm_sync_init);
1388     +
1389     #endif /* CONFIG_PM_SLEEP_SMP */
1390    
1391     /**
1392     diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
1393     index d577199..e0d42db 100644
1394     --- a/net/ipv4/igmp.c
1395     +++ b/net/ipv4/igmp.c
1396     @@ -875,6 +875,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
1397     * to be intended in a v3 query.
1398     */
1399     max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE);
1400     + if (!max_delay)
1401     + max_delay = 1; /* can't mod w/ 0 */
1402     } else { /* v3 */
1403     if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)))
1404     return;
1405     diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
1406     index 6c164dc..bf54c48 100644
1407     --- a/tools/perf/util/trace-event-parse.c
1408     +++ b/tools/perf/util/trace-event-parse.c
1409     @@ -1582,6 +1582,8 @@ process_symbols(struct event *event, struct print_arg *arg, char **tok)
1410     field = malloc_or_die(sizeof(*field));
1411    
1412     type = process_arg(event, field, &token);
1413     + while (type == EVENT_OP)
1414     + type = process_op(event, field, &token);
1415     if (test_type_token(type, token, EVENT_DELIM, ","))
1416     goto out_free;
1417