Magellan Linux

Contents of /trunk/kernel-lts/patches-3.4/0126-3.4.27-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2046 - (show annotations) (download)
Mon Jan 28 08:16:37 2013 UTC (11 years, 3 months ago) by niro
File size: 28869 byte(s)
-linux-3.4.27
1 diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
2 index c447a27..945b7cd 100644
3 --- a/arch/s390/include/asm/timex.h
4 +++ b/arch/s390/include/asm/timex.h
5 @@ -137,4 +137,32 @@ static inline unsigned long long get_clock_monotonic(void)
6 return get_clock_xt() - sched_clock_base_cc;
7 }
8
9 +/**
10 + * tod_to_ns - convert a TOD format value to nanoseconds
11 + * @todval: to be converted TOD format value
12 + * Returns: number of nanoseconds that correspond to the TOD format value
13 + *
14 + * Converting a 64 Bit TOD format value to nanoseconds means that the value
15 + * must be divided by 4.096. In order to achieve that we multiply with 125
16 + * and divide by 512:
17 + *
18 + * ns = (todval * 125) >> 9;
19 + *
20 + * In order to avoid an overflow with the multiplication we can rewrite this.
21 + * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
22 + * we end up with
23 + *
24 + * ns = ((2^32 * th + tl) * 125 ) >> 9;
25 + * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
26 + *
27 + */
28 +static inline unsigned long long tod_to_ns(unsigned long long todval)
29 +{
30 + unsigned long long ns;
31 +
32 + ns = ((todval >> 32) << 23) * 125;
33 + ns += ((todval & 0xffffffff) * 125) >> 9;
34 + return ns;
35 +}
36 +
37 #endif
38 diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
39 index d4e1cb1..c5531db 100644
40 --- a/arch/s390/kernel/time.c
41 +++ b/arch/s390/kernel/time.c
42 @@ -64,7 +64,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);
43 */
44 unsigned long long notrace __kprobes sched_clock(void)
45 {
46 - return (get_clock_monotonic() * 125) >> 9;
47 + return tod_to_ns(get_clock_monotonic());
48 }
49
50 /*
51 diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
52 index 2d9f9a7..10e13b3 100644
53 --- a/arch/s390/kvm/interrupt.c
54 +++ b/arch/s390/kvm/interrupt.c
55 @@ -390,7 +390,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
56 return 0;
57 }
58
59 - sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9;
60 + sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
61
62 hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
63 VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
64 diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
65 index f38112b..978b7fd 100644
66 --- a/arch/sh/include/asm/elf.h
67 +++ b/arch/sh/include/asm/elf.h
68 @@ -202,9 +202,9 @@ extern void __kernel_vsyscall;
69 if (vdso_enabled) \
70 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
71 else \
72 - NEW_AUX_ENT(AT_IGNORE, 0);
73 + NEW_AUX_ENT(AT_IGNORE, 0)
74 #else
75 -#define VSYSCALL_AUX_ENT
76 +#define VSYSCALL_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0)
77 #endif /* CONFIG_VSYSCALL */
78
79 #ifdef CONFIG_SH_FPU
80 diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
81 index 6d4f7ba..2af4ccd 100644
82 --- a/arch/x86/kernel/entry_32.S
83 +++ b/arch/x86/kernel/entry_32.S
84 @@ -1074,7 +1074,6 @@ ENTRY(xen_failsafe_callback)
85 lea 16(%esp),%esp
86 CFI_ADJUST_CFA_OFFSET -16
87 jz 5f
88 - addl $16,%esp
89 jmp iret_exc
90 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
91 SAVE_ALL
92 diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
93 index ae98dbb..d289ee7 100644
94 --- a/arch/x86/kernel/setup.c
95 +++ b/arch/x86/kernel/setup.c
96 @@ -620,6 +620,81 @@ static __init void reserve_ibft_region(void)
97
98 static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
99
100 +static bool __init snb_gfx_workaround_needed(void)
101 +{
102 + int i;
103 + u16 vendor, devid;
104 + static const u16 snb_ids[] = {
105 + 0x0102,
106 + 0x0112,
107 + 0x0122,
108 + 0x0106,
109 + 0x0116,
110 + 0x0126,
111 + 0x010a,
112 + };
113 +
114 + /* Assume no if something weird is going on with PCI */
115 + if (!early_pci_allowed())
116 + return false;
117 +
118 + vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
119 + if (vendor != 0x8086)
120 + return false;
121 +
122 + devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
123 + for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
124 + if (devid == snb_ids[i])
125 + return true;
126 +
127 + return false;
128 +}
129 +
130 +/*
131 + * Sandy Bridge graphics has trouble with certain ranges, exclude
132 + * them from allocation.
133 + */
134 +static void __init trim_snb_memory(void)
135 +{
136 + static const unsigned long bad_pages[] = {
137 + 0x20050000,
138 + 0x20110000,
139 + 0x20130000,
140 + 0x20138000,
141 + 0x40004000,
142 + };
143 + int i;
144 +
145 + if (!snb_gfx_workaround_needed())
146 + return;
147 +
148 + printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
149 +
150 + /*
151 + * Reserve all memory below the 1 MB mark that has not
152 + * already been reserved.
153 + */
154 + memblock_reserve(0, 1<<20);
155 +
156 + for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
157 + if (memblock_reserve(bad_pages[i], PAGE_SIZE))
158 + printk(KERN_WARNING "failed to reserve 0x%08lx\n",
159 + bad_pages[i]);
160 + }
161 +}
162 +
163 +/*
164 + * Here we put platform-specific memory range workarounds, i.e.
165 + * memory known to be corrupt or otherwise in need to be reserved on
166 + * specific platforms.
167 + *
168 + * If this gets used more widely it could use a real dispatch mechanism.
169 + */
170 +static void __init trim_platform_memory_ranges(void)
171 +{
172 + trim_snb_memory();
173 +}
174 +
175 static void __init trim_bios_range(void)
176 {
177 /*
178 @@ -640,6 +715,7 @@ static void __init trim_bios_range(void)
179 * take them out.
180 */
181 e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
182 +
183 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
184 }
185
186 @@ -919,6 +995,8 @@ void __init setup_arch(char **cmdline_p)
187
188 setup_trampolines();
189
190 + trim_platform_memory_ranges();
191 +
192 init_gbpages();
193
194 /* max_pfn_mapped is updated here */
195 diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
196 index 4a0f314..be984e0 100644
197 --- a/drivers/block/drbd/drbd_req.c
198 +++ b/drivers/block/drbd/drbd_req.c
199 @@ -37,6 +37,7 @@ static void _drbd_start_io_acct(struct drbd_conf *mdev, struct drbd_request *req
200 const int rw = bio_data_dir(bio);
201 int cpu;
202 cpu = part_stat_lock();
203 + part_round_stats(cpu, &mdev->vdisk->part0);
204 part_stat_inc(cpu, &mdev->vdisk->part0, ios[rw]);
205 part_stat_add(cpu, &mdev->vdisk->part0, sectors[rw], bio_sectors(bio));
206 part_inc_in_flight(&mdev->vdisk->part0, rw);
207 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
208 index 9c34db8..be66606 100644
209 --- a/drivers/iommu/intel-iommu.c
210 +++ b/drivers/iommu/intel-iommu.c
211 @@ -2321,8 +2321,39 @@ static int domain_add_dev_info(struct dmar_domain *domain,
212 return 0;
213 }
214
215 +static bool device_has_rmrr(struct pci_dev *dev)
216 +{
217 + struct dmar_rmrr_unit *rmrr;
218 + int i;
219 +
220 + for_each_rmrr_units(rmrr) {
221 + for (i = 0; i < rmrr->devices_cnt; i++) {
222 + /*
223 + * Return TRUE if this RMRR contains the device that
224 + * is passed in.
225 + */
226 + if (rmrr->devices[i] == dev)
227 + return true;
228 + }
229 + }
230 + return false;
231 +}
232 +
233 static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
234 {
235 +
236 + /*
237 + * We want to prevent any device associated with an RMRR from
238 + * getting placed into the SI Domain. This is done because
239 + * problems exist when devices are moved in and out of domains
240 + * and their respective RMRR info is lost. We exempt USB devices
241 + * from this process due to their usage of RMRRs that are known
242 + * to not be needed after BIOS hand-off to OS.
243 + */
244 + if (device_has_rmrr(pdev) &&
245 + (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
246 + return 0;
247 +
248 if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
249 return 1;
250
251 diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
252 index 8683ca4..6b4f014 100644
253 --- a/drivers/net/ethernet/intel/igb/igb_main.c
254 +++ b/drivers/net/ethernet/intel/igb/igb_main.c
255 @@ -951,17 +951,18 @@ static int igb_request_msix(struct igb_adapter *adapter)
256 {
257 struct net_device *netdev = adapter->netdev;
258 struct e1000_hw *hw = &adapter->hw;
259 - int i, err = 0, vector = 0;
260 + int i, err = 0, vector = 0, free_vector = 0;
261
262 err = request_irq(adapter->msix_entries[vector].vector,
263 igb_msix_other, 0, netdev->name, adapter);
264 if (err)
265 - goto out;
266 - vector++;
267 + goto err_out;
268
269 for (i = 0; i < adapter->num_q_vectors; i++) {
270 struct igb_q_vector *q_vector = adapter->q_vector[i];
271
272 + vector++;
273 +
274 q_vector->itr_register = hw->hw_addr + E1000_EITR(vector);
275
276 if (q_vector->rx.ring && q_vector->tx.ring)
277 @@ -980,13 +981,22 @@ static int igb_request_msix(struct igb_adapter *adapter)
278 igb_msix_ring, 0, q_vector->name,
279 q_vector);
280 if (err)
281 - goto out;
282 - vector++;
283 + goto err_free;
284 }
285
286 igb_configure_msix(adapter);
287 return 0;
288 -out:
289 +
290 +err_free:
291 + /* free already assigned IRQs */
292 + free_irq(adapter->msix_entries[free_vector++].vector, adapter);
293 +
294 + vector--;
295 + for (i = 0; i < vector; i++) {
296 + free_irq(adapter->msix_entries[free_vector++].vector,
297 + adapter->q_vector[i]);
298 + }
299 +err_out:
300 return err;
301 }
302
303 diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
304 index 0dc70c2..06ee243 100644
305 --- a/drivers/net/ethernet/realtek/r8169.c
306 +++ b/drivers/net/ethernet/realtek/r8169.c
307 @@ -5516,11 +5516,7 @@ static void rtl_slow_event_work(struct rtl8169_private *tp)
308 if (status & LinkChg)
309 __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
310
311 - napi_disable(&tp->napi);
312 - rtl_irq_disable(tp);
313 -
314 - napi_enable(&tp->napi);
315 - napi_schedule(&tp->napi);
316 + rtl_irq_enable_all(tp);
317 }
318
319 static void rtl_task(struct work_struct *work)
320 diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h
321 index a8f97eb..991ce3e 100644
322 --- a/drivers/staging/vt6656/bssdb.h
323 +++ b/drivers/staging/vt6656/bssdb.h
324 @@ -92,7 +92,6 @@ typedef struct tagSRSNCapObject {
325 } SRSNCapObject, *PSRSNCapObject;
326
327 // BSS info(AP)
328 -#pragma pack(1)
329 typedef struct tagKnownBSS {
330 // BSS info
331 BOOL bActive;
332 diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
333 index a5d96b9..27bc7f5 100644
334 --- a/drivers/staging/vt6656/int.h
335 +++ b/drivers/staging/vt6656/int.h
336 @@ -34,7 +34,6 @@
337 #include "device.h"
338
339 /*--------------------- Export Definitions -------------------------*/
340 -#pragma pack(1)
341 typedef struct tagSINTData {
342 BYTE byTSR0;
343 BYTE byPkt0;
344 diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h
345 index 22710ce..ae6e2d2 100644
346 --- a/drivers/staging/vt6656/iocmd.h
347 +++ b/drivers/staging/vt6656/iocmd.h
348 @@ -95,13 +95,12 @@ typedef enum tagWZONETYPE {
349 // Ioctl interface structure
350 // Command structure
351 //
352 -#pragma pack(1)
353 typedef struct tagSCmdRequest {
354 u8 name[16];
355 void *data;
356 u16 wResult;
357 u16 wCmdCode;
358 -} SCmdRequest, *PSCmdRequest;
359 +} __packed SCmdRequest, *PSCmdRequest;
360
361 //
362 // Scan
363 @@ -111,7 +110,7 @@ typedef struct tagSCmdScan {
364
365 u8 ssid[SSID_MAXLEN + 2];
366
367 -} SCmdScan, *PSCmdScan;
368 +} __packed SCmdScan, *PSCmdScan;
369
370 //
371 // BSS Join
372 @@ -126,7 +125,7 @@ typedef struct tagSCmdBSSJoin {
373 BOOL bPSEnable;
374 BOOL bShareKeyAuth;
375
376 -} SCmdBSSJoin, *PSCmdBSSJoin;
377 +} __packed SCmdBSSJoin, *PSCmdBSSJoin;
378
379 //
380 // Zonetype Setting
381 @@ -137,7 +136,7 @@ typedef struct tagSCmdZoneTypeSet {
382 BOOL bWrite;
383 WZONETYPE ZoneType;
384
385 -} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
386 +} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet;
387
388 typedef struct tagSWPAResult {
389 char ifname[100];
390 @@ -145,7 +144,7 @@ typedef struct tagSWPAResult {
391 u8 key_mgmt;
392 u8 eap_type;
393 BOOL authenticated;
394 -} SWPAResult, *PSWPAResult;
395 +} __packed SWPAResult, *PSWPAResult;
396
397 typedef struct tagSCmdStartAP {
398
399 @@ -157,7 +156,7 @@ typedef struct tagSCmdStartAP {
400 BOOL bShareKeyAuth;
401 u8 byBasicRate;
402
403 -} SCmdStartAP, *PSCmdStartAP;
404 +} __packed SCmdStartAP, *PSCmdStartAP;
405
406 typedef struct tagSCmdSetWEP {
407
408 @@ -167,7 +166,7 @@ typedef struct tagSCmdSetWEP {
409 BOOL bWepKeyAvailable[WEP_NKEYS];
410 u32 auWepKeyLength[WEP_NKEYS];
411
412 -} SCmdSetWEP, *PSCmdSetWEP;
413 +} __packed SCmdSetWEP, *PSCmdSetWEP;
414
415 typedef struct tagSBSSIDItem {
416
417 @@ -180,14 +179,14 @@ typedef struct tagSBSSIDItem {
418 BOOL bWEPOn;
419 u32 uRSSI;
420
421 -} SBSSIDItem;
422 +} __packed SBSSIDItem;
423
424
425 typedef struct tagSBSSIDList {
426
427 u32 uItem;
428 SBSSIDItem sBSSIDList[0];
429 -} SBSSIDList, *PSBSSIDList;
430 +} __packed SBSSIDList, *PSBSSIDList;
431
432
433 typedef struct tagSNodeItem {
434 @@ -208,7 +207,7 @@ typedef struct tagSNodeItem {
435 u32 uTxAttempts;
436 u16 wFailureRatio;
437
438 -} SNodeItem;
439 +} __packed SNodeItem;
440
441
442 typedef struct tagSNodeList {
443 @@ -216,7 +215,7 @@ typedef struct tagSNodeList {
444 u32 uItem;
445 SNodeItem sNodeList[0];
446
447 -} SNodeList, *PSNodeList;
448 +} __packed SNodeList, *PSNodeList;
449
450
451 typedef struct tagSCmdLinkStatus {
452 @@ -229,7 +228,7 @@ typedef struct tagSCmdLinkStatus {
453 u32 uChannel;
454 u32 uLinkRate;
455
456 -} SCmdLinkStatus, *PSCmdLinkStatus;
457 +} __packed SCmdLinkStatus, *PSCmdLinkStatus;
458
459 //
460 // 802.11 counter
461 @@ -247,7 +246,7 @@ typedef struct tagSDot11MIBCount {
462 u32 ReceivedFragmentCount;
463 u32 MulticastReceivedFrameCount;
464 u32 FCSErrorCount;
465 -} SDot11MIBCount, *PSDot11MIBCount;
466 +} __packed SDot11MIBCount, *PSDot11MIBCount;
467
468
469
470 @@ -355,13 +354,13 @@ typedef struct tagSStatMIBCount {
471 u32 ullTxBroadcastBytes[2];
472 u32 ullTxMulticastBytes[2];
473 u32 ullTxDirectedBytes[2];
474 -} SStatMIBCount, *PSStatMIBCount;
475 +} __packed SStatMIBCount, *PSStatMIBCount;
476
477 typedef struct tagSCmdValue {
478
479 u32 dwValue;
480
481 -} SCmdValue, *PSCmdValue;
482 +} __packed SCmdValue, *PSCmdValue;
483
484 //
485 // hostapd & viawget ioctl related
486 @@ -431,7 +430,7 @@ struct viawget_hostapd_param {
487 u8 ssid[32];
488 } scan_req;
489 } u;
490 -};
491 +} __packed;
492
493 /*--------------------- Export Classes ----------------------------*/
494
495 diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h
496 index 959c886..2522dde 100644
497 --- a/drivers/staging/vt6656/iowpa.h
498 +++ b/drivers/staging/vt6656/iowpa.h
499 @@ -67,12 +67,11 @@ enum {
500
501
502
503 -#pragma pack(1)
504 typedef struct viawget_wpa_header {
505 u8 type;
506 u16 req_ie_len;
507 u16 resp_ie_len;
508 -} viawget_wpa_header;
509 +} __packed viawget_wpa_header;
510
511 struct viawget_wpa_param {
512 u32 cmd;
513 @@ -113,9 +112,8 @@ struct viawget_wpa_param {
514 u8 *buf;
515 } scan_results;
516 } u;
517 -};
518 +} __packed;
519
520 -#pragma pack(1)
521 struct viawget_scan_result {
522 u8 bssid[6];
523 u8 ssid[32];
524 @@ -130,7 +128,7 @@ struct viawget_scan_result {
525 int noise;
526 int level;
527 int maxrate;
528 -};
529 +} __packed;
530
531 /*--------------------- Export Classes ----------------------------*/
532
533 diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
534 index c3bb05d..4110a2f 100644
535 --- a/drivers/staging/wlan-ng/prism2mgmt.c
536 +++ b/drivers/staging/wlan-ng/prism2mgmt.c
537 @@ -406,7 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
538 /* SSID */
539 req->ssid.status = P80211ENUM_msgitem_status_data_ok;
540 req->ssid.data.len = le16_to_cpu(item->ssid.len);
541 - req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN);
542 + req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_SSID_MAXLEN);
543 memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len);
544
545 /* supported rates */
546 diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
547 index 4df8022..26c62f0 100644
548 --- a/drivers/target/target_core_device.c
549 +++ b/drivers/target/target_core_device.c
550 @@ -1665,6 +1665,7 @@ int core_dev_setup_virtual_lun0(void)
551 ret = PTR_ERR(dev);
552 goto out;
553 }
554 + dev->dev_link_magic = SE_DEV_LINK_MAGIC;
555 se_dev->se_dev_ptr = dev;
556 g_lun0_dev = dev;
557
558 diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
559 index 405cc98..b009b89 100644
560 --- a/drivers/target/target_core_fabric_configfs.c
561 +++ b/drivers/target/target_core_fabric_configfs.c
562 @@ -72,6 +72,12 @@ static int target_fabric_mappedlun_link(
563 struct se_portal_group *se_tpg;
564 struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s;
565 int ret = 0, lun_access;
566 +
567 + if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) {
568 + pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:"
569 + " %p to struct lun: %p\n", lun_ci, lun);
570 + return -EFAULT;
571 + }
572 /*
573 * Ensure that the source port exists
574 */
575 @@ -746,6 +752,12 @@ static int target_fabric_port_link(
576 struct target_fabric_configfs *tf;
577 int ret;
578
579 + if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
580 + pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
581 + " %p to struct se_device: %p\n", se_dev_ci, dev);
582 + return -EFAULT;
583 + }
584 +
585 tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;
586 se_tpg = container_of(to_config_group(tpg_ci),
587 struct se_portal_group, tpg_group);
588 diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
589 index e320ec2..ba537b6 100644
590 --- a/drivers/target/target_core_tpg.c
591 +++ b/drivers/target/target_core_tpg.c
592 @@ -677,6 +677,7 @@ int core_tpg_register(
593 for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
594 lun = se_tpg->tpg_lun_list[i];
595 lun->unpacked_lun = i;
596 + lun->lun_link_magic = SE_LUN_LINK_MAGIC;
597 lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
598 atomic_set(&lun->lun_acl_count, 0);
599 init_completion(&lun->lun_shutdown_comp);
600 diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
601 index 69f3f7d..f687892 100644
602 --- a/drivers/target/target_core_transport.c
603 +++ b/drivers/target/target_core_transport.c
604 @@ -1341,6 +1341,7 @@ struct se_device *transport_add_device_to_core_hba(
605 dev->se_hba = hba;
606 dev->se_sub_dev = se_dev;
607 dev->transport = transport;
608 + dev->dev_link_magic = SE_DEV_LINK_MAGIC;
609 INIT_LIST_HEAD(&dev->dev_list);
610 INIT_LIST_HEAD(&dev->dev_sep_list);
611 INIT_LIST_HEAD(&dev->dev_tmr_list);
612 @@ -1748,6 +1749,8 @@ static void target_complete_tmr_failure(struct work_struct *work)
613
614 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
615 se_cmd->se_tfo->queue_tm_rsp(se_cmd);
616 +
617 + transport_cmd_check_stop_to_fabric(se_cmd);
618 }
619
620 /**
621 diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
622 index a426c40..9249998 100644
623 --- a/drivers/target/tcm_fc/tfc_sess.c
624 +++ b/drivers/target/tcm_fc/tfc_sess.c
625 @@ -356,11 +356,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
626
627 tport = ft_tport_create(rdata->local_port);
628 if (!tport)
629 - return 0; /* not a target for this local port */
630 + goto not_target; /* not a target for this local port */
631
632 acl = ft_acl_get(tport->tpg, rdata);
633 if (!acl)
634 - return 0;
635 + goto not_target; /* no target for this remote */
636
637 if (!rspp)
638 goto fill;
639 @@ -397,12 +397,18 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
640
641 /*
642 * OR in our service parameters with other provider (initiator), if any.
643 - * TBD XXX - indicate RETRY capability?
644 */
645 fill:
646 fcp_parm = ntohl(spp->spp_params);
647 + fcp_parm &= ~FCP_SPPF_RETRY;
648 spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
649 return FC_SPP_RESP_ACK;
650 +
651 +not_target:
652 + fcp_parm = ntohl(spp->spp_params);
653 + fcp_parm &= ~FCP_SPPF_TARG_FCN;
654 + spp->spp_params = htonl(fcp_parm);
655 + return 0;
656 }
657
658 /**
659 diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
660 index f574eef..b6dc908 100644
661 --- a/drivers/tty/serial/8250/8250_dw.c
662 +++ b/drivers/tty/serial/8250/8250_dw.c
663 @@ -79,7 +79,7 @@ static int dw8250_handle_irq(struct uart_port *p)
664 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
665 /* Clear the USR and write the LCR again. */
666 (void)p->serial_in(p, UART_USR);
667 - p->serial_out(p, d->last_lcr, UART_LCR);
668 + p->serial_out(p, UART_LCR, d->last_lcr);
669
670 return 1;
671 }
672 diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
673 index 144cd39..17f587c 100644
674 --- a/drivers/tty/serial/ifx6x60.c
675 +++ b/drivers/tty/serial/ifx6x60.c
676 @@ -552,6 +552,7 @@ static void ifx_port_shutdown(struct tty_port *port)
677 container_of(port, struct ifx_spi_device, tty_port);
678
679 mrdy_set_low(ifx_dev);
680 + del_timer(&ifx_dev->spi_timer);
681 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
682 tasklet_kill(&ifx_dev->io_work_tasklet);
683 }
684 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
685 index ba23ad5..0778cd0 100644
686 --- a/drivers/usb/serial/option.c
687 +++ b/drivers/usb/serial/option.c
688 @@ -449,6 +449,10 @@ static void option_instat_callback(struct urb *urb);
689 #define PETATEL_VENDOR_ID 0x1ff4
690 #define PETATEL_PRODUCT_NP10T 0x600e
691
692 +/* TP-LINK Incorporated products */
693 +#define TPLINK_VENDOR_ID 0x2357
694 +#define TPLINK_PRODUCT_MA180 0x0201
695 +
696 /* some devices interfaces need special handling due to a number of reasons */
697 enum option_blacklist_reason {
698 OPTION_BLACKLIST_NONE = 0,
699 @@ -930,7 +934,8 @@ static const struct usb_device_id option_ids[] = {
700 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) },
701 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
702 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
703 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) },
704 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */
705 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
706 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */
707 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
708 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) },
709 @@ -1311,6 +1316,8 @@ static const struct usb_device_id option_ids[] = {
710 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
711 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
712 { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
713 + { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
714 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
715 { } /* Terminating entry */
716 };
717 MODULE_DEVICE_TABLE(usb, option_ids);
718 diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
719 index fda491c..7e34bee 100644
720 --- a/drivers/xen/grant-table.c
721 +++ b/drivers/xen/grant-table.c
722 @@ -53,10 +53,6 @@
723 /* External tools reserve first few grant table entries. */
724 #define NR_RESERVED_ENTRIES 8
725 #define GNTTAB_LIST_END 0xffffffff
726 -#define GREFS_PER_GRANT_FRAME \
727 -(grant_table_version == 1 ? \
728 -(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \
729 -(PAGE_SIZE / sizeof(union grant_entry_v2)))
730
731 static grant_ref_t **gnttab_list;
732 static unsigned int nr_grant_frames;
733 @@ -151,6 +147,7 @@ static struct gnttab_ops *gnttab_interface;
734 static grant_status_t *grstatus;
735
736 static int grant_table_version;
737 +static int grefs_per_grant_frame;
738
739 static struct gnttab_free_callback *gnttab_free_callback_list;
740
741 @@ -679,12 +676,14 @@ static int grow_gnttab_list(unsigned int more_frames)
742 unsigned int new_nr_grant_frames, extra_entries, i;
743 unsigned int nr_glist_frames, new_nr_glist_frames;
744
745 + BUG_ON(grefs_per_grant_frame == 0);
746 +
747 new_nr_grant_frames = nr_grant_frames + more_frames;
748 - extra_entries = more_frames * GREFS_PER_GRANT_FRAME;
749 + extra_entries = more_frames * grefs_per_grant_frame;
750
751 - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
752 + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
753 new_nr_glist_frames =
754 - (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
755 + (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
756 for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
757 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
758 if (!gnttab_list[i])
759 @@ -692,12 +691,12 @@ static int grow_gnttab_list(unsigned int more_frames)
760 }
761
762
763 - for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames;
764 - i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++)
765 + for (i = grefs_per_grant_frame * nr_grant_frames;
766 + i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++)
767 gnttab_entry(i) = i + 1;
768
769 gnttab_entry(i) = gnttab_free_head;
770 - gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames;
771 + gnttab_free_head = grefs_per_grant_frame * nr_grant_frames;
772 gnttab_free_count += extra_entries;
773
774 nr_grant_frames = new_nr_grant_frames;
775 @@ -799,7 +798,8 @@ EXPORT_SYMBOL_GPL(gnttab_unmap_refs);
776
777 static unsigned nr_status_frames(unsigned nr_grant_frames)
778 {
779 - return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP;
780 + BUG_ON(grefs_per_grant_frame == 0);
781 + return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP;
782 }
783
784 static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes)
785 @@ -957,6 +957,7 @@ static void gnttab_request_version(void)
786 rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
787 if (rc == 0 && gsv.version == 2) {
788 grant_table_version = 2;
789 + grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2);
790 gnttab_interface = &gnttab_v2_ops;
791 } else if (grant_table_version == 2) {
792 /*
793 @@ -969,17 +970,17 @@ static void gnttab_request_version(void)
794 panic("we need grant tables version 2, but only version 1 is available");
795 } else {
796 grant_table_version = 1;
797 + grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1);
798 gnttab_interface = &gnttab_v1_ops;
799 }
800 printk(KERN_INFO "Grant tables using version %d layout.\n",
801 grant_table_version);
802 }
803
804 -int gnttab_resume(void)
805 +static int gnttab_setup(void)
806 {
807 unsigned int max_nr_gframes;
808
809 - gnttab_request_version();
810 max_nr_gframes = gnttab_max_grant_frames();
811 if (max_nr_gframes < nr_grant_frames)
812 return -ENOSYS;
813 @@ -1002,6 +1003,12 @@ int gnttab_resume(void)
814 return 0;
815 }
816
817 +int gnttab_resume(void)
818 +{
819 + gnttab_request_version();
820 + return gnttab_setup();
821 +}
822 +
823 int gnttab_suspend(void)
824 {
825 gnttab_interface->unmap_frames();
826 @@ -1013,9 +1020,10 @@ static int gnttab_expand(unsigned int req_entries)
827 int rc;
828 unsigned int cur, extra;
829
830 + BUG_ON(grefs_per_grant_frame == 0);
831 cur = nr_grant_frames;
832 - extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) /
833 - GREFS_PER_GRANT_FRAME);
834 + extra = ((req_entries + (grefs_per_grant_frame-1)) /
835 + grefs_per_grant_frame);
836 if (cur + extra > gnttab_max_grant_frames())
837 return -ENOSPC;
838
839 @@ -1033,21 +1041,23 @@ int gnttab_init(void)
840 unsigned int nr_init_grefs;
841 int ret;
842
843 + gnttab_request_version();
844 nr_grant_frames = 1;
845 boot_max_nr_grant_frames = __max_nr_grant_frames();
846
847 /* Determine the maximum number of frames required for the
848 * grant reference free list on the current hypervisor.
849 */
850 + BUG_ON(grefs_per_grant_frame == 0);
851 max_nr_glist_frames = (boot_max_nr_grant_frames *
852 - GREFS_PER_GRANT_FRAME / RPP);
853 + grefs_per_grant_frame / RPP);
854
855 gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
856 GFP_KERNEL);
857 if (gnttab_list == NULL)
858 return -ENOMEM;
859
860 - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
861 + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
862 for (i = 0; i < nr_glist_frames; i++) {
863 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
864 if (gnttab_list[i] == NULL) {
865 @@ -1056,12 +1066,12 @@ int gnttab_init(void)
866 }
867 }
868
869 - if (gnttab_resume() < 0) {
870 + if (gnttab_setup() < 0) {
871 ret = -ENODEV;
872 goto ini_nomem;
873 }
874
875 - nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;
876 + nr_init_grefs = nr_grant_frames * grefs_per_grant_frame;
877
878 for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++)
879 gnttab_entry(i) = i + 1;
880 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
881 index dcd08e4..a0d7e26 100644
882 --- a/fs/ext4/inode.c
883 +++ b/fs/ext4/inode.c
884 @@ -1424,6 +1424,8 @@ static void ext4_da_block_invalidatepages(struct mpage_da_data *mpd)
885
886 index = mpd->first_page;
887 end = mpd->next_page - 1;
888 +
889 + pagevec_init(&pvec, 0);
890 while (index <= end) {
891 nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE);
892 if (nr_pages == 0)
893 diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
894 index 3ad5b33..569c282 100644
895 --- a/include/target/target_core_base.h
896 +++ b/include/target/target_core_base.h
897 @@ -779,6 +779,8 @@ struct se_subsystem_dev {
898 };
899
900 struct se_device {
901 +#define SE_DEV_LINK_MAGIC 0xfeeddeef
902 + u32 dev_link_magic;
903 /* RELATIVE TARGET PORT IDENTIFER Counter */
904 u16 dev_rpti_counter;
905 /* Used for SAM Task Attribute ordering */
906 @@ -869,6 +871,8 @@ struct se_port_stat_grps {
907 };
908
909 struct se_lun {
910 +#define SE_LUN_LINK_MAGIC 0xffff7771
911 + u32 lun_link_magic;
912 /* See transport_lun_status_table */
913 enum transport_lun_status_table lun_status;
914 u32 lun_access;
915 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
916 index 2781726..c46171a 100644
917 --- a/sound/usb/quirks.c
918 +++ b/sound/usb/quirks.c
919 @@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
920 * rules
921 */
922 err = usb_driver_set_configuration(dev, 2);
923 - if (err < 0) {
924 + if (err < 0)
925 snd_printdd("error usb_driver_set_configuration: %d\n",
926 err);
927 - return -ENODEV;
928 - }
929 + /* Always return an error, so that we stop creating a device
930 + that will just be destroyed and recreated with a new
931 + configuration */
932 + return -ENODEV;
933 } else
934 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
935