bcache: Minor journal fix
Subsystems (2)
PATCH 1/56 bcache: Minor journal fix
From: Kent Overstreet <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b3fa7e77e67e647db3db2166b65083a427d84ed3 upstream.
The real fix is where we check the bytes we need against how much is remaining - we also need to check for a journal entry bigger than our buffer, we'll never write those and it would be bad if we tried to read one.
Also improve the diagnostic messages.
--- drivers/md/bcache/journal.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/md/bcache/journal.c +14 -5
@@ -42,11 +42,11 @@ static int journal_read_bucket(struct cache *ca, struct list_head *list,int ret =0 ;sector_t bucket =bucket_to_sector (ca->set, ca->sb.d[bucket_index]); -pr_debug ("reading %llu" , (uint64_t ) bucket); +pr_debug ("reading %u" , bucket_index);while (offset < ca->sb.bucket_size) { reread: left = ca->sb.bucket_size - offset; - len =min_t (unsigned, left,PAGE_SECTORS *8 ); + len =min_t (unsigned, left,PAGE_SECTORS <<JSET_BITS );bio_reset (bio); bio->bi_sector = bucket + offset;
@@ -72,17 +72,26 @@ reread: left = ca->sb.bucket_size - offset;struct list_head *where;size_t blocks, bytes =set_bytes (j); -if (j->magic !=jset_magic (ca->set)) +if (j->magic !=jset_magic (ca->set)) { +pr_debug ("%u: bad magic" , bucket_index);return ret; + } -if (bytes > left <<9 ) +if (bytes > left <<9 || + bytes >PAGE_SIZE <<JSET_BITS ) { +pr_info ("%u: too big, %zu bytes, offset %u" , + bucket_index, bytes, offset);return ret; + }if (bytes > len <<9 ) goto reread; -if (j->csum !=csum_set (j)) +if (j->csum !=csum_set (j)) { +pr_info ("%u: bad csum, %zu bytes, offset %u" , + bucket_index, bytes, offset);return ret; + } blocks =set_blocks (j, ca->set);
Signature · 1 line
2.1.0
PATCH 2/56 usb: musb: cppi41: fire hrtimer according to programmed channel length
From: Daniel Mack <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 50aea6fca771d6daf3ec24f771da866f7fd836e4 upstream.
The musb/cppi41 code installs a hrtimer to work around DMA completion interrupts that have fired too early on AM335x hardware. This timer is currently programmed to first fire 140 microseconds after the DMA completion callback. According to the commit which introduced it (a655f481d83, "usb: musb: musb_cppi41: handle pre-mature TX complete interrupt"), that value is is considered a 'rule of thumb' that worked well with the test case described in the commit log.
Test show, however, that for USB audio devices and much smaller packet sizes, the timer has to fire earlier in order to correctly handle the audio stream. The original test case had output transfer sizes of 1514 bytes, and a delay of 140 microseconds. For audio devices with 24 bytes channel size, 3 microseconds seem to work well.
Hence, let's assume that the time it takes to clear the bit correlates with the number of bytes transferred. The referenced commit log mentions such a suspicion as well. Let the timer fire in cppi41_channel->total_len/10 microseconds to correctly handle both cases.
Also, shorten the interval in which the timer fires again in case of a non-empty early_tx list.
With these changes in place, both FS and HS audio devices appear to work well on AM335x hardware.
--- drivers/usb/musb/musb_cppi41.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_cppi41.c +4 -2
@@ -193,7 +193,7 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer)if (!list_empty (&controller->early_tx_list)) { ret =HRTIMER_RESTART ;hrtimer_forward_now (&controller->early_tx, -ktime_set (0 ,150 *NSEC_PER_USEC )); +ktime_set (0 ,50 *NSEC_PER_USEC )); }spin_unlock_irqrestore (&musb->lock, flags);
@@ -267,8 +267,10 @@ static void cppi41_dma_callback(void *private_data)list_add_tail (&cppi41_channel->tx_check, &controller->early_tx_list);if (!hrtimer_is_queued (&controller->early_tx)) { +unsigned long usecs = cppi41_channel->total_len /10 ; +hrtimer_start_range_ns (&controller->early_tx, -ktime_set (0 ,140 *NSEC_PER_USEC ), +ktime_set (0 , usecs *NSEC_PER_USEC ),40 *NSEC_PER_USEC ,HRTIMER_MODE_REL ); }
Signature · 1 line
2.1.0
PATCH 3/56 USB: serial: cp210x: Removing unncessary `usb_reset_device` on startup
In reply to Jiri SlabyFrom: Preston Fick <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 934ef5aca9daea10507eebcbd0fb8f6d57d55359 upstream.
This usb_reset_device command has been around since the driver was originally reverse engineered. It doesn't cause much issue on single interface CP210x devices, but on the CP2105 and CP2108 with 2 and 4 interfaces respectively it will cause instability on enumeration and delays enumeration noticably. There should be no reason to reset a device at startup, per the CP210x AN571 spec.
--- drivers/usb/serial/cp210x.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/serial/cp210x.c +0 -3
@@ -860,9 +860,6 @@ static int cp210x_startup(struct usb_serial *serial)struct usb_host_interface *cur_altsetting;struct cp210x_serial_private *spriv; -/* cp210x buffers behave strangely unless device is reset */ -usb_reset_device (serial->dev); - spriv =kzalloc (sizeof (*spriv),GFP_KERNEL );if (!spriv)return -ENOMEM ;
Signature · 1 line
2.1.0
PATCH 4/56 USB: add reset resume quirk for usb3503
In reply to Jiri SlabyFrom: Joonyoung Shim <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 526a4045c60fbaede88ec95a69a73059dff02160 upstream.
The usb device will autoresume from choose_wakeup() if it is autosuspended with the wrong wakeup setting, but below errors occur because usb3503 misc driver will switch to standby mode when suspended.
As add USB_QUIRK_RESET_RESUME, it can stop setting wrong wakeup from autosuspend_check().
[ 7.734717] usb 1-3: reset high-speed USB device number 3 using exynos-ehci [ 7.854658] usb 1-3: device descriptor read/64, error -71 [ 8.079657] usb 1-3: device descriptor read/64, error -71 [ 8.294664] usb 1-3: reset high-speed USB device number 3 using exynos-ehci [ 8.414658] usb 1-3: device descriptor read/64, error -71 [ 8.639657] usb 1-3: device descriptor read/64, error -71 [ 8.854667] usb 1-3: reset high-speed USB device number 3 using exynos-ehci [ 9.264598] usb 1-3: device not accepting address 3, error -71 [ 9.374655] usb 1-3: reset high-speed USB device number 3 using exynos-ehci [ 9.784601] usb 1-3: device not accepting address 3, error -71 [ 9.784838] usb usb1-port3: device 1-3 not suspended yet
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -154,6 +154,9 @@ static const struct usb_device_id usb_quirk_list[] = {/* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + /* USB3503 */ + { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, + { }/* terminating entry must be last */ };
Signature · 1 line
2.1.0
PATCH 5/56 usb-core bInterval quirk
In reply to Jiri SlabyFrom: James P Michels III <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cd83ce9e6195aa3ea15ab4db92892802c20df5d0 upstream.
This patch adds a usb quirk to support devices with interupt endpoints and bInterval values expressed as microframes. The quirk causes the parse endpoint function to modify the reported bInterval to a standards conforming value.
There is currently code in the endpoint parser that checks for bIntervals that are outside of the valid range (1-16 for USB 2+ high speed and super speed interupt endpoints). In this case, the code assumes the bInterval is being reported in 1ms frames. As well, the correction is only applied if the original bInterval value is out of the 1-16 range.
With this quirk applied to the device, the bInterval will be accurately adjusted from microframes to an exponent.
--- drivers/usb/core/config.c | 11 +++++++++++ drivers/usb/core/quirks.c | 4 ++++ include/linux/usb/quirks.h | 11 +++++++++++ 3 files changed, 26 insertions(+)
drivers/usb/core/config.c +11 -0
@@ -201,6 +201,17 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,if (n ==0 ) n =9 ;/* 32 ms = 2^(9-1) uframes */ j =16 ; + +/* +* Adjust bInterval for quirked devices. +* This quirk fixes bIntervals reported in +* linear microframes. +*/ +if (to_usb_device (ddev)->quirks & +USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL ) { + n =clamp (fls (d->bInterval), i, j); + i = j = n; + }break ;default :/* USB_SPEED_FULL or _LOW */ /* For low-speed, 10 ms is the official minimum.
drivers/usb/core/quirks.c +4 -0
@@ -147,6 +147,10 @@ static const struct usb_device_id usb_quirk_list[] = {/* SKYMEDI USB_DRIVE */ { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Razer - Razer Blade Keyboard */ + { USB_DEVICE(0x1532, 0x0116), .driver_info = + USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* BUILDWIN Photo Frame */ { USB_DEVICE(0x1908, 0x1315), .driver_info = USB_QUIRK_HONOR_BNUMINTERFACES },
include/linux/usb/quirks.h +11 -0
@@ -30,4 +30,15 @@descriptor */ #define USB_QUIRK_DELAY_INIT 0x00000040 +/* +* For high speed and super speed interupt endpoints, the USB 2.0 and +* USB 3.0 spec require the interval in microframes +* (1 microframe = 125 microseconds) to be calculated as +* interval = 2 ^ (bInterval-1). +* +* Devices with this quirk report their bInterval as the result of this +* calculation instead of the exponent variable used in the calculation. +*/ +#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080 +#endif /* __LINUX_USB_QUIRKS_H */
Signature · 1 line
2.1.0
PATCH 6/56 USB: core: hcd-pci: free IRQ before disabling PCI device when shutting down
In reply to Jiri SlabyFrom: Jiang Liu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c5946f9d286ad368329c79107fdf4d825d2091bd upstream.
The assigned IRQ should be freed before calling pci_disable_device() when shutting down system, otherwise it will cause following warning.
[ 568.879482] ------------[ cut here ]------------ [ 568.884236] WARNING: CPU: 1 PID: 3300 at /home/konrad/ssd/konrad/xtt-i386/bootstrap/linux-usb/fs/proc/generic.c:521 remove_proc_entry+0x165/0x170() [ 568.897846] remove_proc_entry: removing non-empty directory 'irq/16', leaking at least 'ohci_hcd:usb4' [ 568.907430] Modules linked in: dm_multipath dm_mod iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi libcrc32c crc32c_generic sg sd_mod crct10dif_generic crc_t10dif crct10dif_common radeon fbcon tileblit ttm font bitblit softcursor ata_generic ahci libahci drm_kms_helper skge r8169 libata mii scsi_mod wmi acpi_cpufreq [ 568.938539] CPU: 1 PID: 3300 Comm: init Tainted: G W 3.16.0-rc5upstream-01651-g03b9189 #1 [ 568.947946] Hardware name: ECS A780GM-A Ultra/A780GM-A Ultra, BIOS 080015 04/01/2010 [ 568.956008] 00000209 ed0f1cd0 c1617946 c175403c ed0f1d00 c1090c3f c1754084 ed0f1d2c [ 568.964068] 00000ce4 c175403c 00000209 c11f22a5 c11f22a5 f755e8c0 ed0f1d78 f755e90d [ 568.972128] ed0f1d18 c1090cde 00000009 ed0f1d10 c1754084 ed0f1d2c ed0f1d60 c11f22a5 [ 568.980194] Call Trace: [ 568.982715] [<c1617946>] dump_stack+0x48/0x60 [ 568.987294] [<c1090c3f>] warn_slowpath_common+0x7f/0xa0 [ 569.003887] [<c1090cde>] warn_slowpath_fmt+0x2e/0x30 [ 569.009092] [<c11f22a5>] remove_proc_entry+0x165/0x170 [ 569.014476] [<c10da6ca>] unregister_irq_proc+0xaa/0xc0 [ 569.019858] [<c10d582f>] free_desc+0x1f/0x60 [ 569.024346] [<c10d58aa>] irq_free_descs+0x3a/0x80 [ 569.029283] [<c10d9e9d>] irq_dispose_mapping+0x2d/0x50 [ 569.034666] [<c1078fd3>] mp_unmap_irq+0x73/0xa0 [ 569.039423] [<c107196b>] acpi_unregister_gsi_ioapic+0x2b/0x40 [ 569.045431] [<c107180f>] acpi_unregister_gsi+0xf/0x20 [ 569.050725] [<c1339cad>] acpi_pci_irq_disable+0x4b/0x50 [ 569.056196] [<c14daa38>] pcibios_disable_device+0x18/0x20 [ 569.061848] [<c130123d>] do_pci_disable_device+0x4d/0x60 [ 569.067410] [<c13012b7>] pci_disable_device+0x47/0xb0 [ 569.077814] [<c14800b1>] usb_hcd_pci_shutdown+0x31/0x40 [ 569.083285] [<c1304b19>] pci_device_shutdown+0x19/0x50 [ 569.088667] [<c13fda64>] device_shutdown+0x14/0x120 [ 569.093777] [<c10ac29d>] kernel_restart_prepare+0x2d/0x30 [ 569.099429] [<c10ac41e>] kernel_restart+0xe/0x60 [ 569.109028] [<c10ac611>] SYSC_reboot+0x191/0x220 [ 569.159269] [<c10ac6ba>] SyS_reboot+0x1a/0x20 [ 569.163843] [<c161c718>] sysenter_do_call+0x12/0x16 [ 569.168951] ---[ end trace ccc1ec4471c289c9 ]---
--- drivers/usb/core/hcd-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/hcd-pci.c +2 -0
@@ -377,6 +377,8 @@ void usb_hcd_pci_shutdown(struct pci_dev *dev)if (test_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags) && hcd->driver->shutdown) { hcd->driver->shutdown (hcd); +if (usb_hcd_is_primary_hcd (hcd) && hcd->irq >0 ) +free_irq (hcd->irq, hcd);pci_disable_device (dev); } }
Signature · 1 line
2.1.0
PATCH 7/56 HID: add quirk for 0x04d9:0xa096 device
In reply to Jiri SlabyFrom: Wangzhao Cai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 30c6fd4277ebab2a32ae5635d34283354b1bc8f2 upstream.
I am using a USB keyborad that give me "usb_submit_urb(ctrl) failed: -1" error when I plugin it. and I need to wait for 10s for this device to be ready.
By adding this quirks, the usb keyborad is usable right after plugin
--- drivers/hid/hid-ids.h | 1 + drivers/hid/usbhid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -457,6 +457,7 @@#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072 0xa072#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 +#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096 0xa096#define USB_VENDOR_ID_IMATION 0x0718#define USB_DEVICE_ID_DISC_STAKKA 0xd000
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -120,6 +120,7 @@ static const struct hid_blacklist { { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103, HID_QUIRK_NO_INIT_REPORTS }, + { USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096, HID_QUIRK_NO_INIT_INPUT_REPORTS }, { 0, 0 } };
Signature · 1 line
2.1.0
PATCH 8/56 PM / hibernate: avoid unsafe pages in e820 reserved regions
In reply to Jiri SlabyFrom: "Lee, Chun-Yi" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 84c91b7ae07c62cf6dee7fde3277f4be21331f85 upstream.
When the machine doesn't well handle the e820 persistent when hibernate resuming, then it may cause page fault when writing image to snapshot buffer:
[ 17.929495] BUG: unable to handle kernel paging request at ffff880069d4f000 [ 17.933469] IP: [<ffffffff810a1cf0>] load_image_lzo+0x810/0xe40 [ 17.933469] PGD 2194067 PUD 77ffff067 PMD 2197067 PTE 0 [ 17.933469] Oops: 0002 [#1] SMP
...
The ffff880069d4f000 page is in e820 reserved region of resume boot kernel:
[ 0.000000] BIOS-e820: [mem 0x0000000069d4f000-0x0000000069e12fff] reserved ... [ 0.000000] PM: Registered nosave memory: [mem 0x69d4f000-0x69e12fff]
So snapshot.c mark the pfn to forbidden pages map. But, this page is also in the memory bitmap in snapshot image because it's an original page used by image kernel, so it will also mark as an unsafe(free) page in prepare_image().
That means the page in e820 when resuming mark as "forbidden" and "free", it causes get_buffer() treat it as an allocated unsafe page. Then snapshot_write_next() return this page to load_image, load_image writing content to this address, but this page didn't really allocated . So, we got page fault.
Although the root cause is from BIOS, I think aggressive check and significant message in kernel will better then a page fault for issue tracking, especially when serial console unavailable.
This patch adds code in mark_unsafe_pages() for check does free pages in nosave region. If so, then it print message and return fault to stop whole S4 resume process:
[ 8.166004] PM: Image loading progress: 0% [ 8.658717] PM: 0x6796c000 in e820 nosave region: [mem 0x6796c000-0x6796cfff] [ 8.918737] PM: Read 2511940 kbytes in 1.04 seconds (2415.32 MB/s) [ 8.926633] PM: Error -14 resuming [ 8.933534] PM: Failed to load hibernation image, recovering.
--- kernel/power/snapshot.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +20 -1
@@ -730,6 +730,25 @@ static void mark_nosave_pages(struct memory_bitmap *bm) } } +static bool is_nosave_page (unsigned long pfn) +{ +struct nosave_region *region; + +list_for_each_entry (region, &nosave_regions, list) { +if (pfn >= region->start_pfn && pfn < region->end_pfn) { +pr_err ("PM: %#010llx in e820 nosave region: " +"[mem %#010llx-%#010llx]\n" , + (unsigned long long ) pfn <<PAGE_SHIFT , + (unsigned long long ) region->start_pfn <<PAGE_SHIFT , + ((unsigned long long ) region->end_pfn <<PAGE_SHIFT ) + -1 ); +return true; + } + } + +return false; +} +/** * create_basic_memory_bitmaps - create bitmaps needed for marking page * frames that should not be saved and free page frames. The pointers
@@ -1774,7 +1793,7 @@ static int mark_unsafe_pages(struct memory_bitmap *bm) do { pfn = memory_bm_next_pfn(bm); if (likely(pfn != BM_END_OF_MAP)) { - if (likely(pfn_valid(pfn))) + if (likely(pfn_valid(pfn)) && !is_nosave_page(pfn)) swsusp_set_page_free(pfn_to_page(pfn)); else return -EFAULT;
Signature · 1 line
2.1.0
PATCH 9/56 bio-integrity: add "bip_max_vcnt" into struct bio_integrity_payload
In reply to Jiri SlabyFrom: Gu Zheng <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cbcd1054a1fd2aa980fc11ff28e436fc4aaa2d54 upstream.
Commit 08778795 ("block: Fix nr_vecs for inline integrity vectors") from Martin introduces the function bip_integrity_vecs(get the useful vectors) to fix the issue about nr_vecs for inline integrity vectors that reported by David Milburn.
But it seems that bip_integrity_vecs() will return the wrong number if the bio is not based on any bio_set for some reason(bio->bi_pool == NULL), because in that case, the bip_inline_vecs[0] is malloced directly. So here we add the bip_max_vcnt to record the count of vector slots, and cleanup the function bip_integrity_vecs().
--- fs/bio-integrity.c | 12 +++--------- include/linux/bio.h | 1 + 2 files changed, 4 insertions(+), 9 deletions(-)
fs/bio-integrity.c +3 -9
@@ -70,8 +70,10 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, bs->bvec_integrity_pool);if (!bip->bip_vec) goto err; + bip->bip_max_vcnt =bvec_nr_vecs (idx); }else { bip->bip_vec = bip->bip_inline_vecs; + bip->bip_max_vcnt = inline_vecs; } bip->bip_slab = idx;
@@ -114,14 +116,6 @@ void bio_integrity_free(struct bio *bio) }EXPORT_SYMBOL (bio_integrity_free); -static inline unsigned int bip_integrity_vecs (struct bio_integrity_payload *bip) -{ -if (bip->bip_slab ==BIO_POOL_NONE ) -return BIP_INLINE_VECS ; - -return bvec_nr_vecs (bip->bip_slab); -} -/** * bio_integrity_add_page - Attach integrity metadata * @bio: bio to update
@@ -137,7 +131,7 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,struct bio_integrity_payload *bip = bio->bi_integrity;struct bio_vec *iv; -if (bip->bip_vcnt >=bip_integrity_vecs (bip)) { +if (bip->bip_vcnt >= bip->bip_max_vcnt) {printk (KERN_ERR "%s: bip_vec full\n" , __func__);return 0 ; }
include/linux/bio.h +1 -0
@@ -187,6 +187,7 @@ struct bio_integrity_payload {unsigned short bip_slab;/* slab the bip came from */ unsigned short bip_vcnt;/* # of integrity bio_vecs */ unsigned short bip_idx;/* current bip_vec index */ +unsigned short bip_max_vcnt;/* integrity bio_vec slots */ unsigned bip_owns_buf:1; /* should free bip_buf */struct work_struct bip_work;/* I/O completion */
Signature · 1 line
2.1.0
PATCH 10/56 PCI: Add pci_upstream_bridge()
In reply to Jiri SlabyFrom: Bjorn Helgaas <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c6bde215acfd637708142ae671843b6f0eadbc6d upstream.
This adds a pci_upstream_bridge() interface to find the PCI-to-PCI bridge upstream from a device. This is typically just "dev->bus->self", but in the case of a VF on a virtual bus, we have to start from the corresponding PF. Returns NULL if there is no upstream PCI bridge, i.e., if the device is on a root bus.
--- include/linux/pci.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/pci.h +9 -0
@@ -478,6 +478,15 @@ static inline bool pci_is_root_bus(struct pci_bus *pbus)return !(pbus->parent); } +static inline struct pci_dev *pci_upstream_bridge (struct pci_dev *dev) +{ + dev =pci_physfn (dev); +if (pci_is_root_bus (dev->bus)) +return NULL ; + +return dev->bus->self; +} +#ifdef CONFIG_PCI_MSI static inline bool pci_dev_msi_enabled (struct pci_dev *pci_dev) {
Signature · 1 line
2.1.0
PATCH 11/56 HID: logitech: perform bounds checking on device_id early enough
In reply to Jiri SlabyFrom: Jiri Kosina <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ad3e14d7c5268c2e24477c6ef54bbdf88add5d36 upstream.
device_index is a char type and the size of paired_dj_deivces is 7 elements, therefore proper bounds checking has to be applied to device_index before it is used.
We are currently performing the bounds checking in logi_dj_recv_add_djhid_device(), which is too late, as malicious device could send REPORT_TYPE_NOTIF_DEVICE_UNPAIRED early enough and trigger the problem in one of the report forwarding functions called from logi_dj_raw_event().
Fix this by performing the check at the earliest possible ocasion in logi_dj_raw_event().
--- drivers/hid/hid-logitech-dj.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/hid/hid-logitech-dj.c +6 -7
@@ -237,13 +237,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,return ; } -if ((dj_report->device_index <DJ_DEVICE_INDEX_MIN ) || - (dj_report->device_index >DJ_DEVICE_INDEX_MAX )) { -dev_err (&djrcv_hdev->dev,"%s: invalid device index:%d\n" , - __func__, dj_report->device_index); -return ; - } -if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {/* The device is already known. No need to reallocate it. */ dbg_hid ("%s: device is already known\n" , __func__);
@@ -721,6 +714,12 @@ static int logi_dj_raw_event(struct hid_device *hdev,* device (via hid_input_report() ) and return 1 so hid-core does not do * anything else with it. */ +if ((dj_report->device_index <DJ_DEVICE_INDEX_MIN ) || + (dj_report->device_index >DJ_DEVICE_INDEX_MAX )) { +dev_err (&hdev->dev,"%s: invalid device index:%d\n" , + __func__, dj_report->device_index); +return false; + }spin_lock_irqsave (&djrcv_dev->lock, flags);if (dj_report->report_id ==REPORT_ID_DJ_SHORT ) {
Signature · 1 line
2.1.0
PATCH 12/56 HID: fix a couple of off-by-ones
In reply to Jiri SlabyFrom: Jiri Kosina <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4ab25786c87eb20857bbb715c3ae34ec8fd6a214 upstream.
There are a few very theoretical off-by-one bugs in report descriptor size checking when performing a pre-parsing fixup. Fix those.
--- drivers/hid/hid-cherry.c | 2 +- drivers/hid/hid-kye.c | 2 +- drivers/hid/hid-lg.c | 4 ++-- drivers/hid/hid-monterey.c | 2 +- drivers/hid/hid-petalynx.c | 2 +- drivers/hid/hid-sunplus.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/hid/hid-cherry.c +1 -1
@@ -28,7 +28,7 @@static __u8 *ch_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (*rsize >=17 && rdesc[11 ] ==0x3c && rdesc[12 ] ==0x02 ) { +if (*rsize >=18 && rdesc[11 ] ==0x3c && rdesc[12 ] ==0x02 ) {hid_info (hdev,"fixing up Cherry Cymotion report descriptor\n" ); rdesc[11 ] = rdesc[16 ] =0xff ; rdesc[12 ] = rdesc[17 ] =0x03 ;
drivers/hid/hid-kye.c +1 -1
@@ -300,7 +300,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,* - change the button usage range to 4-7 for the extra * buttons */ - if (*rsize >= 74 && + if (*rsize >= 75 && rdesc[61] == 0x05 && rdesc[62] == 0x08 && rdesc[63] == 0x19 && rdesc[64] == 0x08 && rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
drivers/hid/hid-lg.c +2 -2
@@ -345,14 +345,14 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,struct usb_device_descriptor *udesc;__u16 bcdDevice, rev_maj, rev_min; -if ((drv_data->quirks &LG_RDESC ) && *rsize >=90 && rdesc[83 ] ==0x26 && +if ((drv_data->quirks &LG_RDESC ) && *rsize >=91 && rdesc[83 ] ==0x26 && rdesc[84 ] ==0x8c && rdesc[85 ] ==0x02 ) {hid_info (hdev,"fixing up Logitech keyboard report descriptor\n" ); rdesc[84 ] = rdesc[89 ] =0x4d ; rdesc[85 ] = rdesc[90 ] =0x10 ; } -if ((drv_data->quirks &LG_RDESC_REL_ABS ) && *rsize >=50 && +if ((drv_data->quirks &LG_RDESC_REL_ABS ) && *rsize >=51 && rdesc[32 ] ==0x81 && rdesc[33 ] ==0x06 && rdesc[49 ] ==0x81 && rdesc[50 ] ==0x06 ) { hid_info(hdev,
drivers/hid/hid-monterey.c +1 -1
@@ -24,7 +24,7 @@static __u8 *mr_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (*rsize >=30 && rdesc[29 ] ==0x05 && rdesc[30 ] ==0x09 ) { +if (*rsize >=31 && rdesc[29 ] ==0x05 && rdesc[30 ] ==0x09 ) {hid_info (hdev,"fixing up button/consumer in HID report descriptor\n" ); rdesc[30 ] =0x0c ; }
drivers/hid/hid-petalynx.c +1 -1
@@ -25,7 +25,7 @@static __u8 *pl_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (*rsize >=60 && rdesc[39 ] ==0x2a && rdesc[40 ] ==0xf5 && +if (*rsize >=62 && rdesc[39 ] ==0x2a && rdesc[40 ] ==0xf5 && rdesc[41 ] ==0x00 && rdesc[59 ] ==0x26 && rdesc[60 ] ==0xf9 && rdesc[61 ] ==0x00 ) {hid_info (hdev,"fixing up Petalynx Maxter Remote report descriptor\n" );
drivers/hid/hid-sunplus.c +1 -1
@@ -24,7 +24,7 @@static __u8 *sp_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (*rsize >=107 && rdesc[104 ] ==0x26 && rdesc[105 ] ==0x80 && +if (*rsize >=112 && rdesc[104 ] ==0x26 && rdesc[105 ] ==0x80 && rdesc[106 ] ==0x03 ) {hid_info (hdev,"fixing up Sunplus Wireless Desktop report descriptor\n" ); rdesc[105 ] = rdesc[110 ] =0x03 ;
Signature · 1 line
2.1.0
PATCH 13/56 isofs: Fix unbounded recursion when processing relocated directories
In reply to Jiri SlabyFrom: Jan Kara <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 410dd3cf4c9b36f27ed4542ee18b1af5e68645a4 upstream.
We did not check relocated directory in any way when processing Rock Ridge 'CL' tag. Thus a corrupted isofs image can possibly have a CL entry pointing to another CL entry leading to possibly unbounded recursion in kernel code and thus stack overflow or deadlocks (if there is a loop created from CL entries).
Fix the problem by not allowing CL entry to point to a directory entry with CL entry (such use makes no good sense anyway) and by checking whether CL entry doesn't point to itself.
--- fs/isofs/inode.c | 15 ++++++++------- fs/isofs/isofs.h | 23 +++++++++++++++++++---- fs/isofs/rock.c | 39 ++++++++++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 22 deletions(-)
fs/isofs/inode.c +8 -7
@@ -61,7 +61,7 @@ static void isofs_put_super(struct super_block *sb)return ; } -static int isofs_read_inode (struct inode *); +static int isofs_read_inode (struct inode *,int relocated);static int isofs_statfs (struct dentry *,struct kstatfs *);static struct kmem_cache *isofs_inode_cachep;
@@ -1258,7 +1258,7 @@ out_toomany: goto out; } -static int isofs_read_inode (struct inode *inode) +static int isofs_read_inode (struct inode *inode,int relocated) {struct super_block *sb = inode->i_sb;struct isofs_sb_info *sbi =ISOFS_SB (sb);
@@ -1403,7 +1403,7 @@ static int isofs_read_inode(struct inode *inode)*/ if (!high_sierra) { -parse_rock_ridge_inode (de, inode); +parse_rock_ridge_inode (de, inode, relocated);/* if we want uid/gid set, override the rock ridge setting */ if (sbi->s_uid_set) inode->i_uid = sbi->s_uid;
@@ -1482,9 +1482,10 @@ static int isofs_iget5_set(struct inode *ino, void *data)* offset that point to the underlying meta-data for the inode. The * code below is otherwise similar to the iget() code in * include/linux/fs.h */ -struct inode *isofs_iget (struct super_block *sb, -unsigned long block, -unsigned long offset) +struct inode *__isofs_iget (struct super_block *sb, +unsigned long block, +unsigned long offset, +int relocated) {unsigned long hashval;struct inode *inode;
@@ -1506,7 +1507,7 @@ struct inode *isofs_iget(struct super_block *sb,return ERR_PTR (-ENOMEM );if (inode->i_state &I_NEW ) { - ret =isofs_read_inode (inode); + ret =isofs_read_inode (inode, relocated);if (ret <0 ) {iget_failed (inode); inode =ERR_PTR (ret);
fs/isofs/isofs.h +19 -4
@@ -107,7 +107,7 @@ extern int iso_date(char *, int);struct inode ;/* To make gcc happy */ -extern int parse_rock_ridge_inode (struct iso_directory_record *,struct inode *); +extern int parse_rock_ridge_inode (struct iso_directory_record *,struct inode *,int relocated);extern int get_rock_ridge_filename (struct iso_directory_record *,char *,struct inode *);extern int isofs_name_translate (struct iso_directory_record *,char *,struct inode *);
@@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned intextern struct buffer_head *isofs_bread (struct inode *,sector_t );extern int isofs_get_blocks (struct inode *,sector_t ,struct buffer_head **,unsigned long ); -extern struct inode *isofs_iget (struct super_block *sb, -unsigned long block, -unsigned long offset); +struct inode *__isofs_iget (struct super_block *sb, +unsigned long block, +unsigned long offset, +int relocated); + +static inline struct inode *isofs_iget (struct super_block *sb, +unsigned long block, +unsigned long offset) +{ +return __isofs_iget (sb, block, offset,0 ); +} + +static inline struct inode *isofs_iget_reloc (struct super_block *sb, +unsigned long block, +unsigned long offset) +{ +return __isofs_iget (sb, block, offset,1 ); +}/* Because the inode number is no longer relevant to finding the * underlying meta-data for an inode, we are free to choose a more
fs/isofs/rock.c +28 -11
@@ -288,12 +288,16 @@ eio: goto out; } +#define RR_REGARD_XA 1 +#define RR_RELOC_DE 2 +static int parse_rock_ridge_inode_internal (struct iso_directory_record *de, -struct inode *inode,int regard_xa) +struct inode *inode,int flags) {int symlink_len =0 ;int cnt, sig; +unsigned int reloc_block;struct inode *reloc;struct rock_ridge *rr;int rootflag;
@@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,init_rock_state (&rs, inode);setup_rock_ridge (de, inode, &rs); -if (regard_xa) { +if (flags &RR_REGARD_XA ) { rs.chr +=14 ; rs.len -=14 ;if (rs.len <0 )
@@ -485,12 +489,22 @@ repeat: "relocated directory\n"); goto out;case SIG ('C' ,'L' ): -ISOFS_I (inode)->i_first_extent = -isonum_733 (rr->u.CL.location); - reloc = -isofs_iget (inode->i_sb, -ISOFS_I (inode)->i_first_extent, -0 ); +if (flags &RR_RELOC_DE ) { +printk (KERN_ERR +"ISOFS: Recursive directory relocation " +"is not supported\n" ); + goto eio; + } + reloc_block =isonum_733 (rr->u.CL.location); +if (reloc_block ==ISOFS_I (inode)->i_iget5_block && +ISOFS_I (inode)->i_iget5_offset ==0 ) { +printk (KERN_ERR +"ISOFS: Directory relocation points to " +"itself\n" ); + goto eio; + } +ISOFS_I (inode)->i_first_extent = reloc_block; + reloc =isofs_iget_reloc (inode->i_sb, reloc_block,0 );if (IS_ERR (reloc)) { ret =PTR_ERR (reloc); goto out;
@@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)return rpnt; } -int parse_rock_ridge_inode (struct iso_directory_record *de,struct inode *inode) +int parse_rock_ridge_inode (struct iso_directory_record *de,struct inode *inode, +int relocated) { -int result =parse_rock_ridge_inode_internal (de, inode,0 ); +int flags = relocated ?RR_RELOC_DE :0 ; +int result =parse_rock_ridge_inode_internal (de, inode, flags);/* * if rockridge flag was reset and we didn't look for attributes
@@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)*/ if ((ISOFS_SB (inode->i_sb)->s_rock_offset ==-1 ) && (ISOFS_SB (inode->i_sb)->s_rock ==2 )) { - result =parse_rock_ridge_inode_internal (de, inode,14 ); + result =parse_rock_ridge_inode_internal (de, inode, + flags |RR_REGARD_XA ); }return result; }
Signature · 1 line
2.1.0
PATCH 14/56 USB: OHCI: fix bugs in debug routines
In reply to Jiri SlabyFrom: Alan Stern <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 256dbcd80f1ccf8abf421c1d72ba79a4e29941dd upstream.
The debug routine fill_async_buffer() in ohci-hcd is buggy: It never produces any output because it forgets to initialize the output buffer size. Also, the debug routine ohci_dump() has an unused argument.
This patch adds the correct initialization and removes the unused argument.
--- drivers/usb/host/ohci-dbg.c | 9 +++++---- drivers/usb/host/ohci-hcd.c | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/usb/host/ohci-dbg.c +5 -4
@@ -289,7 +289,7 @@ ohci_dump_roothub ( } } -static void ohci_dump (struct ohci_hcd *controller,int verbose) +static void ohci_dump (struct ohci_hcd *controller) {ohci_dbg (controller,"OHCI controller state\n" );
@@ -531,15 +531,16 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)static ssize_t fill_async_buffer (struct debug_buffer *buf) {struct ohci_hcd *ohci; -size_t temp; +size_t temp, size;unsigned long flags; ohci = buf->ohci; + size =PAGE_SIZE ;/* display control and bulk lists together, for simplicity */ spin_lock_irqsave (&ohci->lock, flags); - temp =show_list (ohci, buf->page, buf->count, ohci->ed_controltail); - temp +=show_list (ohci, buf->page + temp, buf->count - temp, + temp =show_list (ohci, buf->page, size, ohci->ed_controltail); + temp +=show_list (ohci, buf->page + temp, size - temp, ohci->ed_bulktail);spin_unlock_irqrestore (&ohci->lock, flags);
drivers/usb/host/ohci-hcd.c +5 -5
@@ -78,8 +78,8 @@ static const char hcd_name [] = "ohci_hcd";#include "ohci.h" #include "pci-quirks.h" -static void ohci_dump (struct ohci_hcd *ohci,int verbose); -static void ohci_stop (struct usb_hcd *hcd); +static void ohci_dump (struct ohci_hcd *ohci); +static void ohci_stop (struct usb_hcd *hcd);#include "ohci-hub.c" #include "ohci-dbg.c"
@@ -754,7 +754,7 @@ retry: ohci->ed_to_check =NULL ; } -ohci_dump (ohci,1 ); +ohci_dump (ohci);return 0 ; }
@@ -835,7 +835,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)usb_hc_died (hcd); } -ohci_dump (ohci,1 ); +ohci_dump (ohci);ohci_usb_reset (ohci); }
@@ -935,7 +935,7 @@ static void ohci_stop (struct usb_hcd *hcd) {struct ohci_hcd *ohci =hcd_to_ohci (hcd); -ohci_dump (ohci,1 ); +ohci_dump (ohci);if (quirk_nec (ohci))flush_work (&ohci->nec_work);
Signature · 1 line
2.1.0
PATCH 15/56 USB: OHCI: don't lose track of EDs when a controller dies
In reply to Jiri SlabyFrom: Alan Stern <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 977dcfdc60311e7aa571cabf6f39c36dde13339e upstream.
This patch fixes a bug in ohci-hcd. When an URB is unlinked, the corresponding Endpoint Descriptor is added to the ed_rm_list and taken off the hardware schedule. Once the ED is no longer visible to the hardware, finish_unlinks() handles the URBs that were unlinked or have completed. If any URBs remain attached to the ED, the ED is added back to the hardware schedule -- but only if the controller is running.
This fails when a controller dies. A non-empty ED does not get added back to the hardware schedule and does not remain on the ed_rm_list; ohci-hcd loses track of it. The remaining URBs cannot be unlinked, which causes the USB stack to hang.
The patch changes finish_unlinks() so that non-empty EDs remain on the ed_rm_list if the controller isn't running. This requires moving some of the existing code around, to avoid modifying the ED's hardware fields more than once.
--- drivers/usb/host/ohci-q.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-)
drivers/usb/host/ohci-q.c +29 -17
@@ -315,8 +315,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed)* - ED_OPER: when there's any request queued, the ED gets rescheduled * immediately. HC should be working on them. * -* - ED_IDLE: when there's no TD queue. there's no reason for the HC -* to care about this ED; safe to disable the endpoint. +* - ED_IDLE: when there's no TD queue or the HC isn't running. * * When finish_unlinks() runs later, after SOF interrupt, it will often * complete one or more URB unlinks before making that state change.
@@ -930,6 +929,10 @@ rescan_all:int completed, modified;__hc32 *prev; +/* Is this ED already invisible to the hardware? */ +if (ed->state ==ED_IDLE ) + goto ed_idle; +/* only take off EDs that the HC isn't using, accounting for * frame counter wraps and EDs with partially retired TDs */
@@ -959,12 +962,20 @@ skip_ed: } } +/* ED's now officially unlinked, hc doesn't see */ + ed->state =ED_IDLE ; +if (quirk_zfmicro (ohci) && ed->type ==PIPE_INTERRUPT ) + ohci->eds_scheduled--; + ed->hwHeadP &= ~cpu_to_hc32 (ohci,ED_H ); + ed->hwNextED =0 ; +wmb (); + ed->hwINFO &= ~cpu_to_hc32 (ohci,ED_SKIP |ED_DEQUEUE ); +ed_idle: +/* reentrancy: if we drop the schedule lock, someone might * have modified this list. normally it's just prepending * entries (which we'd ignore), but paranoia won't hurt. */ - *last = ed->ed_next; - ed->ed_next =NULL ; modified =0 ;/* unlink urbs as requested, but rescan the list after
@@ -1022,19 +1033,20 @@ rescan_this:if (completed && !list_empty (&ed->td_list)) goto rescan_this; -/* ED's now officially unlinked, hc doesn't see */ - ed->state =ED_IDLE ; -if (quirk_zfmicro (ohci) && ed->type ==PIPE_INTERRUPT ) - ohci->eds_scheduled--; - ed->hwHeadP &= ~cpu_to_hc32 (ohci,ED_H ); - ed->hwNextED =0 ; -wmb (); - ed->hwINFO &= ~cpu_to_hc32 (ohci,ED_SKIP |ED_DEQUEUE ); - -/* but if there's work queued, reschedule */ -if (!list_empty (&ed->td_list)) { -if (ohci->rh_state ==OHCI_RH_RUNNING ) -ed_schedule (ohci, ed); +/* +* If no TDs are queued, take ED off the ed_rm_list. +* Otherwise, if the HC is running, reschedule. +* If not, leave it on the list for further dequeues. +*/ +if (list_empty (&ed->td_list)) { + *last = ed->ed_next; + ed->ed_next =NULL ; + }else if (ohci->rh_state ==OHCI_RH_RUNNING ) { + *last = ed->ed_next; + ed->ed_next =NULL ; +ed_schedule (ohci, ed); + }else { + last = &ed->ed_next; }if (modified)
Signature · 1 line
2.1.0
PATCH 16/56 USB: devio: fix issue with log flooding
In reply to Jiri SlabyFrom: Oliver Neukum <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d310d05f1225d1f6f2bf505255fdf593bfbb3051 upstream.
usbfs allows user space to pass down an URB which sets URB_SHORT_NOT_OK for output URBs. That causes usbcore to log messages without limit for a nonsensical disallowed combination. The fix is to silently drop the attribute in usbfs.
The problem is reported to exist since 3.14
https://www.virtualbox.org/ticket/13085
--- drivers/usb/core/devio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/devio.c +1 -1
@@ -1413,7 +1413,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, u = (is_in ?URB_DIR_IN :URB_DIR_OUT );if (uurb->flags &USBDEVFS_URB_ISO_ASAP ) u |=URB_ISO_ASAP ; -if (uurb->flags &USBDEVFS_URB_SHORT_NOT_OK ) +if (uurb->flags &USBDEVFS_URB_SHORT_NOT_OK && is_in) u |=URB_SHORT_NOT_OK ;if (uurb->flags &USBDEVFS_URB_NO_FSBR ) u |=URB_NO_FSBR ;
Signature · 1 line
2.1.0
PATCH 17/56 USB: serial: ftdi_sio: Annotate the current Xsens PID assignments
In reply to Jiri SlabyFrom: Patrick Riphagen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9273b8a270878906540349422ab24558b9d65716 upstream.
The converters are used in specific products. It can be useful to know which they are exactly.
--- drivers/usb/serial/ftdi_sio_ids.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/serial/ftdi_sio_ids.h +5 -5
@@ -140,12 +140,12 @@/* * Xsens Technologies BV products (http://www.xsens.com). */ -#define XSENS_CONVERTER_0_PID 0xD388 -#define XSENS_CONVERTER_1_PID 0xD389 +#define XSENS_CONVERTER_0_PID 0xD388/* Xsens USB converter */ +#define XSENS_CONVERTER_1_PID 0xD389/* Xsens Wireless Receiver */ #define XSENS_CONVERTER_2_PID 0xD38A -#define XSENS_CONVERTER_3_PID 0xD38B -#define XSENS_CONVERTER_4_PID 0xD38C -#define XSENS_CONVERTER_5_PID 0xD38D +#define XSENS_CONVERTER_3_PID 0xD38B/* Xsens USB-serial converter */ +#define XSENS_CONVERTER_4_PID 0xD38C/* Xsens Wireless Receiver */ +#define XSENS_CONVERTER_5_PID 0xD38D/* Xsens Awinda Station */ #define XSENS_CONVERTER_6_PID 0xD38E#define XSENS_CONVERTER_7_PID 0xD38F
Signature · 1 line
2.1.0
PATCH 18/56 USB: serial: ftdi_sio: Add support for new Xsens devices
In reply to Jiri SlabyFrom: Patrick Riphagen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4bdcde358b4bda74e356841d351945ca3f2245dd upstream.
This adds support for new Xsens devices, using Xsens' own Vendor ID.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -674,6 +674,8 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, + { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, + { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
drivers/usb/serial/ftdi_sio_ids.h +3 -0
@@ -140,6 +140,9 @@/* * Xsens Technologies BV products (http://www.xsens.com). */ +#define XSENS_VID 0x2639 +#define XSENS_CONVERTER_PID 0xD00D/* Xsens USB-serial converter */ +#define XSENS_MTW_PID 0x0200/* Xsens MTw */ #define XSENS_CONVERTER_0_PID 0xD388/* Xsens USB converter */ #define XSENS_CONVERTER_1_PID 0xD389/* Xsens Wireless Receiver */ #define XSENS_CONVERTER_2_PID 0xD38A
Signature · 1 line
2.1.0
PATCH 19/56 USB: ehci-pci: USB host controller support for Intel Quark X1000
In reply to Jiri SlabyFrom: Bryan O'Donoghue <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6e693739e9b603b3ca9ce0d4f4178f0633458465 upstream.
The EHCI packet buffer in/out threshold is programmable for Intel Quark X1000 USB host controller, and the default value is 0x20 dwords. The in/out threshold can be programmed to 0x80 dwords (512 Bytes) to maximize the perfomrance, but only when isochronous/interrupt transactions are not initiated by the USB host controller. This patch is to reconfigure the packet buffer in/out threshold as maximal as possible to maximize the performance, and 0x7F dwords (508 Bytes) should be used because the USB host controller initiates isochronous/interrupt transactions.
--- drivers/usb/host/ehci-pci.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/usb/host/ehci-pci.c +25 -0
@@ -35,6 +35,21 @@ static const char hcd_name[] = "ehci-pci";#define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70/*-------------------------------------------------------------------------*/ +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +static inline bool is_intel_quark_x1000 (struct pci_dev *pdev) +{ +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; +} + +/* +* 0x84 is the offset of in/out threshold register, +* and it is the same offset as the register of 'hostpc'. +*/ +#define intel_quark_x1000_insnreg01 hostpc + +/* Maximum usable threshold value is 0x7f dwords for both IN and OUT */ +#define INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD 0x007f007f/* called after powerup, by probe or system-pm "wakeup" */ static int ehci_pci_reinit (struct ehci_hcd *ehci,struct pci_dev *pdev)
@@ -50,6 +65,16 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (is_intel_quark_x1000 (pdev)) { +/* +* For the Intel QUARK X1000, raise the I/O threshold to the +* maximum usable value in order to improve performance. +*/ +ehci_writel (ehci,INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD , + ehci->regs->intel_quark_x1000_insnreg01); + } +return 0 ; }
Signature · 1 line
2.1.0
PATCH 20/56 USB: Fix persist resume of some SS USB devices
In reply to Jiri SlabyFrom: Pratyush Anand <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a40178b2fa6ad87670fb1e5fa4024db00c149629 upstream.
Problem Summary: Problem has been observed generally with PM states where VBUS goes off during suspend. There are some SS USB devices which take longer time for link training compared to many others. Such devices fail to reconnect with same old address which was associated with it before suspend.
When system resumes, at some point of time (dpm_run_callback-> usb_dev_resume->usb_resume->usb_resume_both->usb_resume_device-> usb_port_resume) SW reads hub status. If device is present, then it finishes port resume and re-enumerates device with same address. If device is not present then, SW thinks that device was removed during suspend and therefore does logical disconnection and removes all the resource allocated for this device.
Now, if I put sufficient delay just before root hub status read in usb_resume_device then, SW sees always that device is present. In normal course(without any delay) SW sees that no device is present and then SW removes all resource associated with the device at this port. In the latter case, after sometime, device says that hey I am here, now host enumerates it, but with new address.
Problem had been reproduced when I connect verbatim USB3.0 hard disc with my STiH407 XHCI host running with 3.10 kernel.
I see that similar problem has been reported here.
https://bugzilla.kernel.org/show_bug.cgi?id=53211
Reading above it seems that bug was not in 3.6.6 and was present in 3.8 and again it was not present for some in 3.12.6, while it was present for few others. I tested with 3.13-FC19 running at i686 desktop, problem was still there. However, I was failed to reproduce it with 3.16-RC4 running at same i686 machine. I would say it is just a random observation. Problem for few devices is always there, as I am unable to find a proper fix for the issue.
So, now question is what should be the amount of delay so that host is always able to recognize suspended device after resume.
XHCI specs 4.19.4 says that when Link training is successful, port sets CSC bit to 1. So if SW reads port status before successful link training, then it will not find device to be present. USB Analyzer log with such buggy devices show that in some cases device switch on the RX termination after long delay of host enabling the VBUS. In few other cases it has been seen that device fails to negotiate link training in first attempt. It has been reported till now that few devices take as long as 2000 ms to train the link after host enabling its VBUS and RX termination. This patch implements a 2000 ms timeout for CSC bit to set ie for link training. If in a case link trains before timeout, loop will exit earlier.
This patch implements above delay, but only for SS device and when persist is enabled.
So, for the good device overhead is almost none. While for the bad devices penalty could be the time which it take for link training. But, If a device was connected before suspend, and was removed while system was asleep, then the penalty would be the timeout ie 2000 ms.
Results:
Verbatim USB SS hard disk connected with STiH407 USB host running 3.10 Kernel resumes in 461 msecs without this patch, but hard disk is assigned a new device address. Same system resumes in 790 msecs with this patch, but with old device address.
--- drivers/usb/core/hub.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/usb/core/hub.c +41 -0
@@ -3168,6 +3168,43 @@ static int finish_port_resume(struct usb_device *udev) }/* +* There are some SS USB devices which take longer time for link training. +* XHCI specs 4.19.4 says that when Link training is successful, port +* sets CSC bit to 1. So if SW reads port status before successful link +* training, then it will not find device to be present. +* USB Analyzer log with such buggy devices show that in some cases +* device switch on the RX termination after long delay of host enabling +* the VBUS. In few other cases it has been seen that device fails to +* negotiate link training in first attempt. It has been +* reported till now that few devices take as long as 2000 ms to train +* the link after host enabling its VBUS and termination. Following +* routine implements a 2000 ms timeout for link training. If in a case +* link trains before timeout, loop will exit earlier. +* +* FIXME: If a device was connected before suspend, but was removed +* while system was asleep, then the loop in the following routine will +* only exit at timeout. +* +* This routine should only be called when persist is enabled for a SS +* device. +*/ +static int wait_for_ss_port_enable (struct usb_device *udev, +struct usb_hub *hub,int *port1, +u16 *portchange,u16 *portstatus) +{ +int status =0 , delay_ms =0 ; + +while (delay_ms <2000 ) { +if (status || *portstatus &USB_PORT_STAT_CONNECTION ) +break ; +msleep (20 ); + delay_ms +=20 ; + status =hub_port_status (hub, *port1, portstatus, portchange); + } +return status; +} + +/* * usb_port_resume - re-activate a suspended usb device's upstream port * @udev: device to re-activate, not a root hub * Context: must be able to sleep; device not locked; pm locks held
@@ -3269,6 +3306,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)clear_bit (port1, hub->busy_bits); +if (udev->persist_enabled &&hub_is_superspeed (hub->hdev)) + status =wait_for_ss_port_enable (udev, hub, &port1, &portchange, + &portstatus); + status =check_port_resume_type (udev, hub, port1, status, portchange, portstatus);if (status ==0 )
Signature · 1 line
2.1.0
PATCH 21/56 ALSA: hda - fix an external mic jack problem on a HP machine
In reply to Jiri SlabyFrom: Hui Wang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7440850c20b69658f322119d20a94dc914127cc7 upstream.
ON the machine, two pin complex (0xb and 0xe) are both routed to the same external right-side mic jack, this makes the jack can't work.
To fix this problem, set the 0xe to "not connected".
--- sound/pci/hda/patch_sigmatel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_sigmatel.c +12 -0
@@ -84,6 +84,7 @@ enum {STAC_DELL_EQ ,STAC_ALIENWARE_M17X ,STAC_92HD89XX_HP_FRONT_JACK , +STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK , STAC_92HD73XX_MODELS };
@@ -1792,6 +1793,11 @@ static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = { {} }; +static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = { + {0x0e ,0x400000f0 }, + {} +}; +static void stac92hd73xx_fixup_ref (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -1914,6 +1920,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { [STAC_92HD89XX_HP_FRONT_JACK ] = { .type =HDA_FIXUP_PINS , .v.pins = stac92hd89xx_hp_front_jack_pin_configs, + }, + [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK ] = { + .type =HDA_FIXUP_PINS , + .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, } };
@@ -1974,6 +1984,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { "Alienware M17x", STAC_ALIENWARE_M17X),SND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x0490 ,"Alienware M17x R3" ,STAC_DELL_EQ ), +SND_PCI_QUIRK (PCI_VENDOR_ID_HP ,0x1927 , +"HP Z1 G2" ,STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK ),SND_PCI_QUIRK (PCI_VENDOR_ID_HP ,0x2b17 , "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), {} /* terminator */
Signature · 1 line
2.1.0
PATCH 22/56 ALSA: virtuoso: add Xonar Essence STX II support
In reply to Jiri SlabyFrom: Clemens Ladisch <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f42bb22243d2ae264d721b055f836059fe35321f upstream.
Just add the PCI ID for the STX II. It appears to work the same as the STX, except for the addition of the not-yet-supported daughterboard.
--- Documentation/sound/alsa/ALSA-Configuration.txt | 4 ++-- sound/pci/Kconfig | 4 ++-- sound/pci/oxygen/virtuoso.c | 1 + sound/pci/oxygen/xonar_pcm179x.c | 12 ++++++++++-- 4 files changed, 15 insertions(+), 6 deletions(-)
Documentation/sound/alsa/ALSA-Configuration.txt +2 -2
@@ -2026,8 +2026,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ------------------- Module for sound cards based on the Asus AV66/AV100/AV200 chips, - i.e., Xonar D1, DX, D2, D2X, DS, Essence ST (Deluxe), Essence STX, - HDAV1.3 (Deluxe), and HDAV1.3 Slim. + i.e., Xonar D1, DX, D2, D2X, DS, DSX, Essence ST (Deluxe), + Essence STX (II), HDAV1.3 (Deluxe), and HDAV1.3 Slim. This module supports autoprobe and multiple cards.
sound/pci/Kconfig +2 -2
@@ -858,8 +858,8 @@ config SND_VIRTUOSO select SND_JACK if INPUT=y || INPUT=SND help Say Y here to include support for sound cards based on the - Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS, - Essence ST (Deluxe), and Essence STX. + Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS, DSX, + Essence ST (Deluxe), and Essence STX (II). Support for the HDAV1.3 (Deluxe) and HDAV1.3 Slim is experimental; for the Xense, missing.
sound/pci/oxygen/virtuoso.c +1 -0
@@ -53,6 +53,7 @@ static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = { { OXYGEN_PCI_SUBID(0x1043, 0x835e) }, { OXYGEN_PCI_SUBID(0x1043, 0x838e) }, { OXYGEN_PCI_SUBID(0x1043, 0x8522) }, + { OXYGEN_PCI_SUBID(0x1043, 0x85f4) }, { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, { } };
sound/pci/oxygen/xonar_pcm179x.c +10 -2
@@ -100,8 +100,8 @@*/ /* -* Xonar Essence ST (Deluxe)/STX -* ----------------------------- +* Xonar Essence ST (Deluxe)/STX (II) +* ---------------------------------- * * CMI8788: *
@@ -1138,6 +1138,14 @@ int get_xonar_pcm179x_model(struct oxygen *chip, chip->model.resume = xonar_stx_resume; chip->model.set_dac_params = set_pcm1796_params;break ; +case 0x85f4 : + chip->model = model_xonar_st; +/* TODO: daughterboard support */ + chip->model.shortname ="Xonar STX II" ; + chip->model.init = xonar_stx_init; + chip->model.resume = xonar_stx_resume; + chip->model.set_dac_params = set_pcm1796_params; +break ;default :return -EINVAL ; }
Signature · 1 line
2.1.0
PATCH 23/56 ALSA: hda/ca0132 - Don't try loading firmware at resume when already failed
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e24aa0a4c5ac92a171d9dd74a8d3dbf652990d36 upstream.
CA0132 driver tries to reload the firmware at resume. Usually this works since the firmware loader core caches the firmware contents by itself. However, if the driver failed to load the firmwares (e.g. missing files), reloading the firmware at resume goes through the actual file loading code path, and triggers a kernel WARNING like:
WARNING: CPU: 10 PID:11371 at drivers/base/firmware_class.c:1105 _request_firmware+0x9ab/0x9d0()
For avoiding this situation, this patch makes CA0132 skipping the f/w loading at resume when it failed at probe time.
--- sound/pci/hda/patch_ca0132.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +6 -1
@@ -4379,6 +4379,9 @@ static void ca0132_download_dsp(struct hda_codec *codec)return ;/* NOP */ #endif +if (spec->dsp_state ==DSP_DOWNLOAD_FAILED ) +return ;/* don't retry failures */ +chipio_enable_clocks (codec); spec->dsp_state =DSP_DOWNLOADING ;if (!ca0132_download_dsp_images (codec))
@@ -4555,7 +4558,8 @@ static int ca0132_init(struct hda_codec *codec)struct auto_pin_cfg *cfg = &spec->autocfg;int i; - spec->dsp_state =DSP_DOWNLOAD_INIT ; +if (spec->dsp_state !=DSP_DOWNLOAD_FAILED ) + spec->dsp_state =DSP_DOWNLOAD_INIT ; spec->curr_chip_addx =INVALID_CHIP_ADDRESS ;snd_hda_power_up (codec);
@@ -4666,6 +4670,7 @@ static int patch_ca0132(struct hda_codec *codec) codec->spec = spec; spec->codec = codec; + spec->dsp_state =DSP_DOWNLOAD_INIT ; spec->num_mixers =1 ; spec->mixers[0 ] = ca0132_mixer;
Signature · 1 line
2.1.0
PATCH 24/56 ALSA: usb-audio: fix BOSS ME-25 MIDI regression
In reply to Jiri SlabyFrom: Clemens Ladisch <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 53da5ebfef66ea6e478ad9c6add3781472b79475 upstream.
The BOSS ME-25 turns out not to have any useful descriptors in its MIDI interface, so its needs a quirk entry after all.
--- sound/usb/quirks-table.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
sound/usb/quirks-table.h +29 -0
@@ -1582,6 +1582,35 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, { +/* BOSS ME-25 */ + USB_DEVICE(0x0582, 0x0113), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum =1 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum =2 , + .type =QUIRK_MIDI_FIXED_ENDPOINT , + .data = & (const struct snd_usb_midi_endpoint_info ) { + .out_cables =0x0001 , + .in_cables =0x0001 + } + }, + { + .ifnum =-1 + } + } + } +}, +{ /* only 44.1 kHz works at the moment */ USB_DEVICE(0x0582, 0x0120), .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) {
Signature · 1 line
2.1.0
PATCH 25/56 ALSA: hda - restore the gpio led after resume
In reply to Jiri SlabyFrom: Hui Wang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f475371aa65de84fa483a998ab7594531026b9d9 upstream.
On some HP laptops, the mute led is controlled by codec gpio.
When some machine resume from s3/s4, the codec gpio data will be cleared to 0 by BIOS:
Before suspend:
IO[3]: enable=1, dir=1, wake=0, sticky=0, data=1, unsol=0
After resume:
IO[3]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0
To skip the AFG node to enter D3 can't fix this problem.
A workaround is to restore the gpio data when the system resume back from s3/s4. It is safe even on the machines without this problem.
--- sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_realtek.c +9 -0
@@ -2902,6 +2902,15 @@ static int alc269_resume(struct hda_codec *codec)snd_hda_codec_resume_cache (codec);alc_inv_dmic_sync (codec, true);hda_call_check_power_status (codec,0x01 ); + +/* on some machine, the BIOS will clear the codec gpio data when enter +* suspend, and won't restore the data after resume, so we restore it +* in the driver. +*/ +if (spec->gpio_led) +snd_hda_codec_write (codec, codec->afg,0 ,AC_VERB_SET_GPIO_DATA , + spec->gpio_led); +if (spec->has_alc5505_dsp)alc5505_dsp_resume (codec);
Signature · 1 line
2.1.0
PATCH 26/56 ALSA: hda/realtek - Avoid setting wrong COEF on ALC269 & co
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f3ee07d8b6e061bf34a7167c3f564e8da4360a99 upstream.
ALC269 & co have many vendor-specific setups with COEF verbs. However, some verbs seem specific to some codec versions and they result in the codec stalling. Typically, such a case can be avoided by checking the return value from reading a COEF. If the return value is -1, it implies that the COEF is invalid, thus it shouldn't be written.
This patch adds the invalid COEF checks in appropriate places accessing ALC269 and its variants. The patch actually fixes the resume problem on Acer AO725 laptop.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=52181
--- sound/pci/hda/patch_realtek.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c +12 -5
@@ -179,6 +179,8 @@ static void alc_fix_pll(struct hda_codec *codec) spec->pll_coef_idx); val =snd_hda_codec_read (codec, spec->pll_nid,0 ,AC_VERB_GET_PROC_COEF ,0 ); +if (val ==-1 ) +return ;snd_hda_codec_write (codec, spec->pll_nid,0 ,AC_VERB_SET_COEF_INDEX , spec->pll_coef_idx); snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
@@ -2688,6 +2690,8 @@ static int alc269_parse_auto_config(struct hda_codec *codec)static void alc269vb_toggle_power_output (struct hda_codec *codec,int power_up) {int val =alc_read_coef_idx (codec,0x04 ); +if (val ==-1 ) +return ;if (power_up) val |=1 <<11 ;else
@@ -4234,27 +4238,30 @@ static void alc269_fill_coef(struct hda_codec *codec)if ((alc_get_coef0 (codec) &0x00ff ) ==0x017 ) { val =alc_read_coef_idx (codec,0x04 );/* Power up output pin */ -alc_write_coef_idx (codec,0x04 , val | (1 <<11 )); +if (val !=-1 ) +alc_write_coef_idx (codec,0x04 , val | (1 <<11 )); }if ((alc_get_coef0 (codec) &0x00ff ) ==0x018 ) { val =alc_read_coef_idx (codec,0xd ); -if ((val &0x0c00 ) >>10 !=0x1 ) { +if (val !=-1 && (val &0x0c00 ) >>10 !=0x1 ) {/* Capless ramp up clock control */ alc_write_coef_idx (codec,0xd , val | (1 <<10 )); } val =alc_read_coef_idx (codec,0x17 ); -if ((val &0x01c0 ) >>6 !=0x4 ) { +if (val !=-1 && (val &0x01c0 ) >>6 !=0x4 ) {/* Class D power on reset */ alc_write_coef_idx (codec,0x17 , val | (1 <<7 )); } } val =alc_read_coef_idx (codec,0xd );/* Class D */ -alc_write_coef_idx (codec,0xd , val | (1 <<14 )); +if (val !=-1 ) +alc_write_coef_idx (codec,0xd , val | (1 <<14 )); val =alc_read_coef_idx (codec,0x4 );/* HP */ -alc_write_coef_idx (codec,0x4 , val | (1 <<11 )); +if (val !=-1 ) +alc_write_coef_idx (codec,0x4 , val | (1 <<11 )); }/*
Signature · 1 line
2.1.0
PATCH 27/56 mei: start disconnect request timer consistently
In reply to Jiri SlabyFrom: Alexander Usyskin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 22b987a325701223f9a37db700c6eb20b9924c6f upstream.
Link must be reset in case the fw doesn't respond to client disconnect request.
We did charge the timer only in irq path from mei_cl_irq_close and not in mei_cl_disconnect
--- drivers/misc/mei/client.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/mei/client.c +1 -0
@@ -451,6 +451,7 @@ int mei_cl_disconnect(struct mei_cl *cl)dev_err (&dev->pdev->dev,"failed to disconnect.\n" ); goto free; } + cl->timer_count =MEI_CONNECT_TIMEOUT ;mdelay (10 );/* Wait for hardware disconnection ready */ list_add_tail (&cb->list, &dev->ctrl_rd_list.list); }else {
Signature · 1 line
2.1.0
PATCH 28/56 ARM: OMAP3: Fix choice of omap3_restore_es function in OMAP34XX rev3.1.2 case.
In reply to Jiri SlabyFrom: Jeremy Vial <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9b5f7428f8b16bd8980213f2b70baf1dd0b9e36c upstream.
According to the comment “restore_es3: applies to 34xx >= ES3.0" in "arch/arm/mach-omap2/sleep34xx.S”, omap3_restore_es3 should be used if the revision of an OMAP34xx is ES3.1.2.
--- arch/arm/mach-omap2/control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/control.c +2 -1
@@ -324,7 +324,8 @@ void omap3_save_scratchpad_contents(void) scratchpad_contents.public_restore_ptr =virt_to_phys (omap3_restore_3630); else if (omap_rev() != OMAP3430_REV_ES3_0 && - omap_rev() != OMAP3430_REV_ES3_1) + omap_rev() != OMAP3430_REV_ES3_1 && + omap_rev() != OMAP3430_REV_ES3_1_2) scratchpad_contents.public_restore_ptr =virt_to_phys (omap3_restore); else
Signature · 1 line
2.1.0
PATCH 29/56 drm: omapdrm: fix compiler errors
In reply to Jiri SlabyFrom: Russell King <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2d31ca3ad7d5d44c8adc7f253c96ce33f3a2e931 upstream.
Regular randconfig nightly testing has detected problems with omapdrm.
omapdrm fails to build when the kernel is built to support 64-bit DMA addresses and/or 64-bit physical addresses due to an assumption about the width of these types.
Use %pad to print DMA addresses, rather than %x or %Zx (which is even more wrong than %x). Avoid passing a uint32_t pointer into a function which expects dma_addr_t pointer.
drivers/gpu/drm/omapdrm/omap_plane.c: In function 'omap_plane_pre_apply':drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t' [-Werror=format] make[5]: *** [drivers/gpu/drm/omapdrm/omap_plane.o] Error 1drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_get_paddr':drivers/gpu/drm/omapdrm/omap_gem.c:794:4: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_describe':drivers/gpu/drm/omapdrm/omap_gem.c:991:4: error: format '%Zx' expects argument of type 'size_t', but argument 7 has type 'dma_addr_t' [-Werror=format] drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_init':drivers/gpu/drm/omapdrm/omap_gem.c:1470:4: error: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Werror=format] make[5]: *** [drivers/gpu/drm/omapdrm/omap_gem.o] Error 1drivers/gpu/drm/omapdrm/omap_dmm_tiler.c: In function 'dmm_txn_append':drivers/gpu/drm/omapdrm/omap_dmm_tiler.c:226:2: error: passing argument 3 of 'alloc_dma' from incompatible pointer type [-Werror] make[5]: *** [drivers/gpu/drm/omapdrm/omap_dmm_tiler.o] Error 1
make[5]: Target `__build' not remade because of errors.
make[4]: *** [drivers/gpu/drm/omapdrm] Error 2
--- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 6 ++++-- drivers/gpu/drm/omapdrm/omap_gem.c | 10 +++++----- drivers/gpu/drm/omapdrm/omap_plane.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +4 -2
@@ -199,7 +199,7 @@ static struct dmm_txn *dmm_txn_init(struct dmm *dmm, struct tcm *tcm)static void dmm_txn_append (struct dmm_txn *txn,struct pat_area *area,struct page **pages,uint32_t npages,uint32_t roll) { -dma_addr_t pat_pa =0 ; +dma_addr_t pat_pa =0 , data_pa =0 ;uint32_t *data;struct pat *pat;struct refill_engine *engine = txn->engine_handle;
@@ -223,7 +223,9 @@ static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area, .lut_id = engine->tcm->lut_id, }; - data =alloc_dma (txn,4 *i, &pat->data_pa); + data =alloc_dma (txn,4 *i, &data_pa); +/* FIXME: what if data_pa is more than 32-bit ? */ + pat->data_pa = data_pa;while (i--) {int n = i + roll;
drivers/gpu/drm/omapdrm/omap_gem.c +5 -5
@@ -791,7 +791,7 @@ int omap_gem_get_paddr(struct drm_gem_object *obj, omap_obj->paddr =tiler_ssptr (block); omap_obj->block = block; -DBG ("got paddr: %08x" , omap_obj->paddr); +DBG ("got paddr: %pad" , &omap_obj->paddr); } omap_obj->paddr_cnt++;
@@ -988,9 +988,9 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) off =drm_vma_node_start (&obj->vma_node); -seq_printf (m,"%08x: %2d (%2d) %08llx %08Zx (%2d) %p %4d" , +seq_printf (m,"%08x: %2d (%2d) %08llx %pad (%2d) %p %4d" , omap_obj->flags, obj->name, obj->refcount.refcount.counter, - off, omap_obj->paddr, omap_obj->paddr_cnt, + off, &omap_obj->paddr, omap_obj->paddr_cnt, omap_obj->vaddr, omap_obj->roll);if (omap_obj->flags &OMAP_BO_TILED ) {
@@ -1473,8 +1473,8 @@ void omap_gem_init(struct drm_device *dev) entry->paddr =tiler_ssptr (block); entry->block = block; -DBG ("%d:%d: %dx%d: paddr=%08x stride=%d" , i, j, w, h, - entry->paddr, +DBG ("%d:%d: %dx%d: paddr=%pad stride=%d" , i, j, w, h, + &entry->paddr, usergart[i].stride_pfn <<PAGE_SHIFT ); } }
drivers/gpu/drm/omapdrm/omap_plane.c +2 -2
@@ -142,8 +142,8 @@ static void omap_plane_pre_apply(struct omap_drm_apply *apply)DBG ("%dx%d -> %dx%d (%d)" , info->width, info->height, info->out_width, info->out_height, info->screen_width); -DBG ("%d,%d %08x %08x" , info->pos_x, info->pos_y, - info->paddr, info->p_uv_addr); +DBG ("%d,%d %pad %pad" , info->pos_x, info->pos_y, + &info->paddr, &info->p_uv_addr);/* TODO: */ ilace = false;
Signature · 1 line
2.1.0
PATCH 30/56 hwmon: (sis5595) Prevent overflow problem when writing large limits
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cc336546ddca8c22de83720632431c16a5f9fe9a upstream.
On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from long to int to fix the problem.
--- drivers/hwmon/sis5595.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sis5595.c +1 -1
@@ -159,7 +159,7 @@ static inline int TEMP_FROM_REG(s8 val) {return val *830 +52120 ; } -static inline s8 TEMP_TO_REG (int val) +static inline s8 TEMP_TO_REG (long val) {int nval =clamp_val (val,-54120 ,157530 ) ;return nval <0 ? (nval -5212 -415 ) /830 : (nval -5212 +415 ) /830 ;
Signature · 1 line
2.1.0
PATCH 31/56 hwmon: (amc6821) Fix possible race condition bug
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cf44819c98db11163f58f08b822d626c7a8f5188 upstream.
Ensure mutex lock protects the read-modify-write period to prevent possible race condition bug.
In additional, update data->valid should also be protected by the mutex lock.
--- drivers/hwmon/amc6821.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/hwmon/amc6821.c +11 -6
@@ -360,11 +360,13 @@ static ssize_t set_pwm1_enable(if (config)return config; +mutex_lock (&data->update_lock); config =i2c_smbus_read_byte_data (client,AMC6821_REG_CONF1 );if (config <0 ) {dev_err (&client->dev,"Error reading configuration register, aborting.\n" ); -return config; + count = config; + goto unlock; }switch (val) {
@@ -381,14 +383,15 @@ static ssize_t set_pwm1_enable( config |=AMC6821_CONF1_FDRC1 ;break ;default : -return -EINVAL ; + count = -EINVAL ; + goto unlock; } -mutex_lock (&data->update_lock);if (i2c_smbus_write_byte_data (client,AMC6821_REG_CONF1 , config)) {dev_err (&client->dev,"Configuration register write error, aborting.\n" ); count = -EIO ; } +unlock:mutex_unlock (&data->update_lock);return count; }
@@ -493,8 +496,9 @@ static ssize_t set_temp_auto_point_temp(return -EINVAL ; } - data->valid =0 ;mutex_lock (&data->update_lock); + data->valid =0 ; +switch (ix) {case 0 : ptemp[0] = clamp_val(val / 1000, 0,
@@ -658,13 +662,14 @@ static ssize_t set_fan1_div(if (config)return config; +mutex_lock (&data->update_lock); config =i2c_smbus_read_byte_data (client,AMC6821_REG_CONF4 );if (config <0 ) {dev_err (&client->dev,"Error reading configuration register, aborting.\n" ); -return config; + count = config; + goto EXIT; } -mutex_lock (&data->update_lock);switch (val) {case 2 : config &= ~AMC6821_CONF4_PSPR ;
Signature · 1 line
2.1.0
PATCH 32/56 hwmon: (lm78) Fix overflow problems seen when writing large temperature limits
In reply to Jiri SlabyFrom: Guenter Roeck <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1074d683a51f1aded3562add9ef313e75d557327 upstream.
On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from long to int to fix the problem.
--- drivers/hwmon/lm78.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm78.c +1 -1
@@ -108,7 +108,7 @@ static inline int FAN_FROM_REG(u8 val, int div)* TEMP: mC (-128C to +127C) * REG: 1C/bit, two's complement */ -static inline s8 TEMP_TO_REG (int val) +static inline s8 TEMP_TO_REG (long val) {int nval =clamp_val (val,-128000 ,127000 ) ;return nval <0 ? (nval -500 ) /1000 : (nval +500 ) /1000 ;
Signature · 1 line
2.1.0
PATCH 33/56 hwmon: (gpio-fan) Prevent overflow problem when writing large limits
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2565fb05d1e9fc0831f7b1c083bcfcb1cba1f020 upstream.
On platforms with sizeof(int) < sizeof(unsigned long), writing a rpm value larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from unsigned long to int to fix the problem.
--- drivers/hwmon/gpio-fan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/gpio-fan.c +1 -1
@@ -172,7 +172,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data)return -EINVAL ; } -static int rpm_to_speed_index (struct gpio_fan_data *fan_data,int rpm) +static int rpm_to_speed_index (struct gpio_fan_data *fan_data,unsigned long rpm) {struct gpio_fan_speed *speed = fan_data->speed;int i;
Signature · 1 line
2.1.0
PATCH 34/56 hwmon: (ads1015) Fix off-by-one for valid channel index checking
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 56de1377ad92f72ee4e5cb0faf7a9b6048fdf0bf upstream.
Current code uses channel as array index, so the valid channel value is 0 .. ADS1015_CHANNELS - 1.
--- drivers/hwmon/ads1015.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/ads1015.c +1 -1
@@ -198,7 +198,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) } channel =be32_to_cpup (property); -if (channel >ADS1015_CHANNELS ) { +if (channel >=ADS1015_CHANNELS ) {dev_err (&client->dev,"invalid channel index %d on %s\n" , channel, node->full_name);
Signature · 1 line
2.1.0
PATCH 35/56 hwmon: (lm85) Fix various errors on attribute writes
In reply to Jiri SlabyFrom: Guenter Roeck <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3248c3b771ddd9d31695da17ba350eb6e1b80a53 upstream.
Temperature limit register writes did not account for negative numbers. As a result, writing -127000 resulted in -126000 written into the temperature limit register. This problem affected temp[1-3]_min, temp[1-3]_max, temp[1-3]_auto_temp_crit, and temp[1-3]_auto_temp_min.
When writing pwm[1-3]_freq, a long variable was auto-converted into an int without range check. Wiring values larger than MAXINT resulted in unexpected register values.
When writing temp[1-3]_auto_temp_max, an unsigned long variable was auto-converted into an int without range check. Writing values larger than MAXINT resulted in unexpected register values.
vrm is an u8, so the written value needs to be limited to [0, 255].
--- drivers/hwmon/lm85.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hwmon/lm85.c +6 -3
@@ -158,7 +158,7 @@ static inline u16 FAN_TO_REG(unsigned long val)/* Temperature is reported in .001 degC increments */ #define TEMP_TO_REG (val) \ - clamp_val(SCALE(val, 1000, 1), -127, 127) + DIV_ROUND_CLOSEST(clamp_val((val), -127000, 127000), 1000)#define TEMPEXT_FROM_REG (val, ext) \ SCALE(((val) << 4) + (ext), 16, 1000)#define TEMP_FROM_REG (val) ((val) * 1000)
@@ -192,7 +192,7 @@ static const int lm85_range_map[] = { 13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000 }; -static int RANGE_TO_REG (int range) +static int RANGE_TO_REG (long range) {int i;
@@ -214,7 +214,7 @@ static const int adm1027_freq_map[8] = { /* 1 Hz */ 11, 15, 22, 29, 35, 44, 59, 88 }; -static int FREQ_TO_REG (const int *map,int freq) +static int FREQ_TO_REG (const int *map,unsigned long freq) {int i;
@@ -463,6 +463,9 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,if (err)return err; +if (val >255 ) +return -EINVAL ; + data->vrm = val;return count; }
Signature · 1 line
2.1.0
PATCH 36/56 hwmon: (ads1015) Fix out-of-bounds array access
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e981429557cbe10c780fab1c1a237cb832757652 upstream.
Current code uses data_rate as array index in ads1015_read_adc() and uses pga as array index in ads1015_reg_to_mv, so we must make sure both data_rate and pga settings are in valid value range.
Return -EINVAL if the setting is out-of-range.
--- drivers/hwmon/ads1015.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/ads1015.c +2 -0
@@ -212,6 +212,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)dev_err (&client->dev,"invalid gain on %s\n" , node->full_name); +return -EINVAL ; } }
@@ -222,6 +223,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)dev_err (&client->dev,"invalid data_rate on %s\n" , node->full_name); +return -EINVAL ; } }
Signature · 1 line
2.1.0
PATCH 37/56 hwmon: (dme1737) Prevent overflow problem when writing large limits
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d58e47d787c09fe5c61af3c6ce7d784762f29c3d upstream.
On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Avoid auto-conversion from long to int to fix the problem.
Voltage limits, fan minimum speed, pwm frequency, pwm ramp rate, and other attributes have the same problem, fix them as well.
Zone temperature limits are signed, but were cached as u8, causing unepected values to be reported for negative temperatures. Cache as s8 to fix the problem.
vrm is an u8, so the written value needs to be limited to [0, 255].
--- drivers/hwmon/dme1737.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/hwmon/dme1737.c +18 -15
@@ -247,8 +247,8 @@ struct dme1737_data {u8 pwm_acz[3 ];u8 pwm_freq[6 ];u8 pwm_rr[2 ]; -u8 zone_low[3 ]; -u8 zone_abs[3 ]; +s8 zone_low[3 ]; +s8 zone_abs[3 ];u8 zone_hyst[2 ];u32 alarms; };
@@ -277,7 +277,7 @@ static inline int IN_FROM_REG(int reg, int nominal, int res)return (reg * nominal + (3 << (res -3 ))) / (3 << (res -2 )); } -static inline int IN_TO_REG (int val,int nominal) +static inline int IN_TO_REG (long val,int nominal) {return clamp_val ((val *192 + nominal /2 ) / nominal,0 ,255 ); }
@@ -293,7 +293,7 @@ static inline int TEMP_FROM_REG(int reg, int res)return (reg *1000 ) >> (res -8 ); } -static inline int TEMP_TO_REG (int val) +static inline int TEMP_TO_REG (long val) {return clamp_val ((val <0 ? val -500 : val +500 ) /1000 ,-128 ,127 ); }
@@ -308,7 +308,7 @@ static inline int TEMP_RANGE_FROM_REG(int reg)return TEMP_RANGE [(reg >>4 ) &0x0f ]; } -static int TEMP_RANGE_TO_REG (int val,int reg) +static int TEMP_RANGE_TO_REG (long val,int reg) {int i;
@@ -331,7 +331,7 @@ static inline int TEMP_HYST_FROM_REG(int reg, int ix)return (((ix ==1 ) ? reg : reg >>4 ) &0x0f ) *1000 ; } -static inline int TEMP_HYST_TO_REG (int val,int ix,int reg) +static inline int TEMP_HYST_TO_REG (long val,int ix,int reg) {int hyst =clamp_val ((val +500 ) /1000 ,0 ,15 );
@@ -347,7 +347,7 @@ static inline int FAN_FROM_REG(int reg, int tpc)return (reg ==0 || reg ==0xffff ) ?0 :90000 *60 / reg; } -static inline int FAN_TO_REG (int val,int tpc) +static inline int FAN_TO_REG (long val,int tpc) {if (tpc) {return clamp_val (val / tpc,0 ,0xffff );
@@ -379,7 +379,7 @@ static inline int FAN_TYPE_FROM_REG(int reg)return (edge >0 ) ?1 << (edge -1 ) :0 ; } -static inline int FAN_TYPE_TO_REG (int val,int reg) +static inline int FAN_TYPE_TO_REG (long val,int reg) {int edge = (val ==4 ) ?3 : val;
@@ -402,7 +402,7 @@ static int FAN_MAX_FROM_REG(int reg)return 1000 + i *500 ; } -static int FAN_MAX_TO_REG (int val) +static int FAN_MAX_TO_REG (long val) {int i;
@@ -460,7 +460,7 @@ static inline int PWM_ACZ_FROM_REG(int reg)return acz[(reg >>5 ) &0x07 ]; } -static inline int PWM_ACZ_TO_REG (int val,int reg) +static inline int PWM_ACZ_TO_REG (long val,int reg) {int acz = (val ==4 ) ?2 : val -1 ;
@@ -476,7 +476,7 @@ static inline int PWM_FREQ_FROM_REG(int reg)return PWM_FREQ [reg &0x0f ]; } -static int PWM_FREQ_TO_REG (int val,int reg) +static int PWM_FREQ_TO_REG (long val,int reg) {int i;
@@ -510,7 +510,7 @@ static inline int PWM_RR_FROM_REG(int reg, int ix)return (rr &0x08 ) ?PWM_RR [rr &0x07 ] :0 ; } -static int PWM_RR_TO_REG (int val,int ix,int reg) +static int PWM_RR_TO_REG (long val,int ix,int reg) {int i;
@@ -528,7 +528,7 @@ static inline int PWM_RR_EN_FROM_REG(int reg, int ix)return PWM_RR_FROM_REG (reg, ix) ?1 :0 ; } -static inline int PWM_RR_EN_TO_REG (int val,int ix,int reg) +static inline int PWM_RR_EN_TO_REG (long val,int ix,int reg) {int en = (ix ==1 ) ?0x80 :0x08 ;
@@ -1481,13 +1481,16 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {struct dme1737_data *data =dev_get_drvdata (dev); -long val; +unsigned long val;int err; - err =kstrtol (buf,10 , &val); + err =kstrtoul (buf,10 , &val);if (err)return err; +if (val >255 ) +return -EINVAL ; + data->vrm = val;return count; }
Signature · 1 line
2.1.0
PATCH 38/56 tpm: Add missing tpm_do_selftest to ST33 I2C driver
In reply to Jiri SlabyFrom: Jason Gunthorpe <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f07a5e9a331045e976a3d317ba43d14859d9407c upstream.
Most device drivers do call 'tpm_do_selftest' which executes a TPM_ContinueSelfTest. tpm_i2c_stm_st33 is just pointlessly different, I think it is bug.
These days we have the general assumption that the TPM is usable by the kernel immediately after the driver is finished, so we can no longer defer the mandatory self test to userspace.
--- drivers/char/tpm/tpm_i2c_stm_st33.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm_i2c_stm_st33.c +1 -0
@@ -750,6 +750,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) }tpm_get_timeouts (chip); +tpm_do_selftest (chip);i2c_set_clientdata (client, chip);
Signature · 1 line
2.1.0
PATCH 39/56 drivers/i2c/busses: use correct type for dma_map/unmap
In reply to Jiri SlabyFrom: Wolfram Sang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 28772ac8711e4d7268c06e765887dd8cb6924f98 upstream.
dma_{un}map_* uses 'enum dma_data_direction' not 'enum dma_transfer_direction'.
--- drivers/i2c/busses/i2c-at91.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-at91.c +2 -2
@@ -210,7 +210,7 @@ static void at91_twi_write_data_dma_callback(void *data)struct at91_twi_dev *dev = (struct at91_twi_dev *)data;dma_unmap_single (dev->dev,sg_dma_address (&dev->dma.sg), - dev->buf_len,DMA_MEM_TO_DEV ); + dev->buf_len,DMA_TO_DEVICE );at91_twi_write (dev,AT91_TWI_CR ,AT91_TWI_STOP ); }
@@ -289,7 +289,7 @@ static void at91_twi_read_data_dma_callback(void *data)struct at91_twi_dev *dev = (struct at91_twi_dev *)data;dma_unmap_single (dev->dev,sg_dma_address (&dev->dma.sg), - dev->buf_len,DMA_DEV_TO_MEM ); + dev->buf_len,DMA_FROM_DEVICE );/* The last two bytes have to be read without using dma */ dev->buf += dev->buf_len -2 ;
Signature · 1 line
2.1.0
PATCH 40/56 ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa struct
In reply to Jiri SlabyFrom: Theodore Ts'o <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 86f0afd463215fc3e58020493482faa4ac3a4d69 upstream.
If there is a failure while allocating the preallocation structure, a number of blocks can end up getting marked in the in-memory buddy bitmap, and then not getting released. This can result in the following corruption getting reported by the kernel:
EXT4-fs error (device sda3): ext4_mb_generate_buddy:758: group 1126, 12793 clusters in bitmap, 12729 in gd
In that case, we need to release the blocks using mb_free_blocks().
Tested: fs smoke test; also demonstrated that with injected errors,
the file system is no longer getting corrupted
Google-Bug-Id: 16657874
--- fs/ext4/mballoc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +20 -1
@@ -3196,8 +3196,27 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)static void ext4_discard_allocated_blocks (struct ext4_allocation_context *ac) {struct ext4_prealloc_space *pa = ac->ac_pa; +struct ext4_buddy e4b; +int err; -if (pa && pa->pa_type ==MB_INODE_PA ) +if (pa ==NULL ) { + err =ext4_mb_load_buddy (ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); +if (err) { +/* +* This should never happen since we pin the +* pages in the ext4_allocation_context so +* ext4_mb_load_buddy() should never fail. +*/ +WARN (1 ,"mb_load_buddy failed (%d)" , err); +return ; + } +ext4_lock_group (ac->ac_sb, ac->ac_f_ex.fe_group); +mb_free_blocks (ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, + ac->ac_f_ex.fe_len); +ext4_unlock_group (ac->ac_sb, ac->ac_f_ex.fe_group); +return ; + } +if (pa->pa_type ==MB_INODE_PA ) pa->pa_free += ac->ac_b_ex.fe_len; }
Signature · 1 line
2.1.0
Re: [PATCH 3.12 40/56] ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa struct
Quoted 18 lines · Jiri Slaby
From: Theodore Ts'o <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit
86f0afd463215fc3e58020493482faa4ac3a4d69upstream.If there is a failure while allocating the preallocation structure, a number of blocks can end up getting marked in the in-memory buddy bitmap, and then not getting released. This can result in the following corruption getting reported by the kernel:
EXT4-fs error (device sda3): ext4_mb_generate_buddy:758: group 1126, 12793 clusters in bitmap, 12729 in gd
In that case, we need to release the blocks using
mb_free_blocks().
Quoted 7 lines
Tested: fs smoke test; also demonstrated that with injected errors,
the file system is no longer getting corruptedGoogle-Bug-Id: 16657874
Signed-off-by "Theodore Ts'o" <[email protected]>Signed-off-by Jiri Slaby <[email protected]>
[...]
It's a bit late now, but Ted said this introduced a regression that's fixed by commit c99d1e6e83b0 ("ext4: fix BUG_ON in mb_free_blocks()").
(I just made the same mistake in 3.2.63.)
Ben.
Signature · 2 lines
Ben Hutchings Make three consecutive correct guesses and you will be considered an expert.
Re: [PATCH 3.12 40/56] ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa struct
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 27 lines · Ben Hutchings
Quoted 26 lines · Jiri Slaby
From: Theodore Ts'o <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit
86f0afd463215fc3e58020493482faa4ac3a4d69upstream.If there is a failure while allocating the preallocation structure, a number of blocks can end up getting marked in the in-memory buddy bitmap, and then not getting released. This can result in the following corruption getting reported by the kernel:
EXT4-fs error (device sda3): ext4_mb_generate_buddy:758: group 1126, 12793 clusters in bitmap, 12729 in gd
In that case, we need to release the blocks using
mb_free_blocks().Tested: fs smoke test; also demonstrated that with injected errors, the file system is no longer getting corrupted
Google-Bug-Id: 16657874
Quoted 7 lines
Quoted 2 lines
Signed-off-by "Theodore Ts'o" <[email protected]> Signed-off-by:Jiri Slaby <[email protected]>
[...]
It's a bit late now, but Ted said this introduced a regression that's fixed by commit
c99d1e6e83b0("ext4: fixBUG_ONinmb_free_blocks()").
Oh, now queued for 3.12. Thanks!
- --
js
suse labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBAgAGBQJUFpfqAAoJEL0lsQQGtHBJOBsP/2sJ9vMgzDwOLpA5VTxJLUUP 9D4Jn6F4Z2TVR+l0pwaHIKgWjnMA1WEEr/FL5WxOSyGq0Rx10pqeOmI8U6wFq/K8 dhmFQfV5WZxYzCzB9ozae3fwzt7ap0V7yINXq7AkLIfZA1uhB/L5xuX7ZMuqM7ec h4/+ylkLuhQg8LrF43+S8PQNRvgLcn/4XsiCLwR1fvJYFgcz6/i2uiBlG8eS5F0k WKL/Rg/B66DrLD+RloJnvpshGJY8XGEqu2wx+a/QNiDV2n9aKWzDNcjX0Y+YEsdd 8Or9J5h018BgB3ktNJB4sd85mkrjhrzTkCyNQoKBc3NjqeJv2Eei1rB4Ds1oLiaH wjgWRXNhYC3h5ifDBazEtAu7fH2fWuMeaAtX+t/4r1DitW9H0FpRNy28lYbYzoV/ HMKAhUCePdWe96TWcbiL7GovbagdcD8HqOqQpYLX9SWb8uEQFKzYCCFNvgFe489o R89uARU49K6EQRFr9rj36YyQm/OkPpiJByrEGcbEMTYiQb6FiNkKsV2iznXHJ75y kfTje9K6RpKRl0RSaQUK7F7+rP+IH+ajtJD5Umw1eWQ4y+kGQg9RT9Z12SCBpHjF s0hkIZp71loIWqlS45+EPCez/Yr0szmqyvZthz87hGL1BlXmwN8tyzhdSkpe1bFy cBVtTov4saNk84Z72Foe
=egHB
-----END PGP SIGNATURE-----
PATCH 41/56 serial: core: Preserve termios c_cflag for console resume
In reply to Jiri SlabyFrom: Peter Hurley <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ae84db9661cafc63d179e1d985a2c5b841ff0ac4 upstream.
When a tty is opened for the serial console, the termios c_cflag settings are inherited from the console line settings. However, if the tty is subsequently closed, the termios settings are lost. This results in a garbled console if the console is later suspended and resumed.
Preserve the termios c_cflag for the serial console when the tty is shutdown; this reflects the most recent line settings.
--- drivers/tty/serial/serial_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/serial_core.c +3 -0
@@ -235,6 +235,9 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)/* * Turn off DTR and RTS early. */ +if (uart_console (uport) && tty) + uport->cons->cflag = tty->termios.c_cflag; +if (!tty || (tty->termios.c_cflag &HUPCL ))uart_clear_mctrl (uport,TIOCM_DTR |TIOCM_RTS );
Signature · 1 line
2.1.0
PATCH 42/56 crypto: ux500 - make interrupt mode plausible
In reply to Jiri SlabyFrom: Arnd Bergmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e1f8859ee265fc89bd21b4dca79e8e983a044892 upstream.
The interrupt handler in the ux500 crypto driver has an obviously incorrect way to access the data buffer, which for a while has caused this build warning:
../ux500/cryp/cryp_core.c: In function 'cryp_interrupt_handler':../ux500/cryp/cryp_core.c:234:5: warning: passing argument 1 of '__fswab32' makes integer from pointer without a cast [enabled by default]
writel_relaxed(ctx->indata,
^
In file included from ../include/linux/swab.h:4:0,
from ../include/uapi/linux/byteorder/big_endian.h:12,
from ../include/linux/byteorder/big_endian.h:4,
from ../arch/arm/include/uapi/asm/byteorder.h:19,
from ../include/asm-generic/bitops/le.h:5,
from ../arch/arm/include/asm/bitops.h:340,
from ../include/linux/bitops.h:33,
from ../include/linux/kernel.h:10,
from ../include/linux/clk.h:16,
from ../drivers/crypto/ux500/cryp/cryp_core.c:12:../include/uapi/linux/swab.h:57:119: note: expected '__u32' but argument is of type 'const u8 *'
static inline __attribute_const__ __u32 __fswab32(__u32 val)
There are at least two, possibly three problems here:
a) when writing into the FIFO, we copy the pointer rather than the actual data we want to give to the hardware
b) the data pointer is an array of 8-bit values, while the FIFO is 32-bit wide, so both the read and write access fail to do a proper type conversion
c) This seems incorrect for big-endian kernels, on which we need to byte-swap any register access, but not normally FIFO accesses, at least the DMA case doesn't do it either.
This converts the bogus loop to use the same readsl/writesl pair that we use for the two other modes (DMA and polling). This is more efficient and consistent, and probably correct for endianess.
The bug has existed since the driver was first merged, and was probably never detected because nobody tried to use interrupt mode. It might make sense to backport this fix to stable kernels, depending on how the crypto maintainers feel about that.
--- drivers/crypto/ux500/cryp/cryp_core.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/crypto/ux500/cryp/cryp_core.c +12 -13
@@ -190,7 +190,7 @@ static void add_session_id(struct cryp_ctx *ctx)static irqreturn_t cryp_interrupt_handler (int irq,void *param) {struct cryp_ctx *ctx; -int i; +int count;struct cryp_device_data *device_data;if (param ==NULL ) {
@@ -215,12 +215,11 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param)if (cryp_pending_irq_src (device_data,CRYP_IRQ_SRC_OUTPUT_FIFO )) {if (ctx->outlen / ctx->blocksize >0 ) { -for (i =0 ; i < ctx->blocksize /4 ; i++) { - *(ctx->outdata) =readl_relaxed ( - &device_data->base->dout); - ctx->outdata +=4 ; - ctx->outlen -=4 ; - } + count = ctx->blocksize /4 ; + +readsl (&device_data->base->dout, ctx->outdata, count); + ctx->outdata += count; + ctx->outlen -= count;if (ctx->outlen ==0 ) { cryp_disable_irq_src(device_data,
@@ -230,12 +229,12 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param) }else if (cryp_pending_irq_src (device_data,CRYP_IRQ_SRC_INPUT_FIFO )) {if (ctx->datalen / ctx->blocksize >0 ) { -for (i =0 ; i < ctx->blocksize /4 ; i++) { -writel_relaxed (ctx->indata, - &device_data->base->din); - ctx->indata +=4 ; - ctx->datalen -=4 ; - } + count = ctx->blocksize /4 ; + +writesl (&device_data->base->din, ctx->indata, count); + + ctx->indata += count; + ctx->datalen -= count;if (ctx->datalen ==0 ) cryp_disable_irq_src(device_data,
Signature · 1 line
2.1.0
PATCH 43/56 debugfs: Fix corrupted loop in debugfs_remove_recursive
In reply to Jiri SlabyFrom: Steven Rostedt <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 485d44022a152c0254dd63445fdb81c4194cbf0e upstream.
[ I'm currently running my tests on it now, and so far, after a few
hours it has yet to blow up. I'll run it for 24 hours which it never succeeded in the past. ]
The tracing code has a way to make directories within the debugfs file system as well as deleting them using mkdir/rmdir in the instance directory. This is very limited in functionality, such as there is no renames, and the parent directory "instance" can not be modified. The tracing code creates the instance directory from the debugfs code and then replaces the dentry->d_inode->i_op with its own to allow for mkdir/rmdir to work.
When these are called, the d_entry and inode locks need to be released to call the instance creation and deletion code. That code has its own accounting and locking to serialize everything to prevent multiple users from causing harm. As the parent "instance" directory can not be modified this simplifies things.
I created a stress test that creates several threads that randomly creates and deletes directories thousands of times a second. The code stood up to this test and I submitted it a while ago.
Recently I added a new test that adds readers to the mix. While the instance directories were being added and deleted, readers would read from these directories and even enable tracing within them. This test was able to trigger a bug:
general protection fault: 0000 [#1] PREEMPT SMP Modules linked in: ... CPU: 3 PID: 17789 Comm: rmdir Tainted: G W 3.15.0-rc2-test+ #41 Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007 task: ffff88003786ca60 ti: ffff880077018000 task.ti: ffff880077018000 RIP: 0010:[<ffffffff811ed5eb>] [<ffffffff811ed5eb>] debugfs_remove_recursive+0x1bd/0x367 RSP: 0018:ffff880077019df8 EFLAGS: 00010246 RAX: 0000000000000002 RBX: ffff88006f0fe490 RCX: 0000000000000000 RDX: dead000000100058 RSI: 0000000000000246 RDI: ffff88003786d454 RBP: ffff88006f0fe640 R08: 0000000000000628 R09: 0000000000000000 R10: 0000000000000628 R11: ffff8800795110a0 R12: ffff88006f0fe640 R13: ffff88006f0fe640 R14: ffffffff81817d0b R15: ffffffff818188b7 FS: 00007ff13ae24700(0000) GS:ffff88007d580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000003054ec7be0 CR3: 0000000076d51000 CR4: 00000000000007e0 Stack: ffff88007a41ebe0 dead000000100058 00000000fffffffe ffff88006f0fe640 0000000000000000 ffff88006f0fe678 ffff88007a41ebe0 ffff88003793a000 00000000fffffffe ffffffff810bde82 ffff88006f0fe640 ffff88007a41eb28 Call Trace: [<ffffffff810bde82>] ? instance_rmdir+0x15b/0x1de [<ffffffff81132e2d>] ? vfs_rmdir+0x80/0xd3 [<ffffffff81132f51>] ? do_rmdir+0xd1/0x139 [<ffffffff8124ad9e>] ? trace_hardirqs_on_thunk+0x3a/0x3c [<ffffffff814fea62>] ? system_call_fastpath+0x16/0x1b Code: fe ff ff 48 8d 75 30 48 89 df e8 c9 fd ff ff 85 c0 75 13 48 c7 c6 b8 cc d2 81 48 c7 c7 b0 cc d2 81 e8 8c 7a f5 ff 48 8b 54 24 08 <48> 8b 82 a8 00 00 00 48 89 d3 48 2d a8 00 00 00 48 89 44 24 08 RIP [<ffffffff811ed5eb>] debugfs_remove_recursive+0x1bd/0x367 RSP <ffff880077019df8>
It took a while, but every time it triggered, it was always in the same place:
list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {Where the child->d_u.d_child seemed to be corrupted. I added lots of trace_printk()s to see what was wrong, and sure enough, it was always the child's d_u.d_child field. I looked around to see what touches it and noticed that in __dentry_kill() which calls dentry_free():
static void dentry_free(struct dentry *dentry)
{
/* if dentry was never visible to RCU, immediate free is OK */
if (!(dentry->d_flags & DCACHE_RCUACCESS))
__d_free(&dentry->d_u.d_rcu);
else
call_rcu(&dentry->d_u.d_rcu, __d_free);
}I also noticed that __dentry_kill() unlinks the child->d_u.child under the parent->d_lock spin_lock.
Looking back at the loop in debugfs_remove_recursive() it never takes the parent->d_lock to do the list walk. Adding more tracing, I was able to prove this was the issue:
ftrace-t-15385 1.... 246662024us : dentry_kill <ffffffff81138b91>: free ffff88006d573600
rmdir-15409 2.... 246662024us : debugfs_remove_recursive <ffffffff811ec7e5>: child=ffff88006d573600 next=dead000000100058
The dentry_kill freed ffff88006d573600 just as the remove recursive was walking it.
In order to fix this, the list walk needs to be modified a bit to take the parent->d_lock. The safe version is no longer necessary, as every time we remove a child, the parent->d_lock must be released and the list walk must start over. Each time a child is removed, even though it may still be on the list, it should be skipped by the first check in the loop:
if (!debugfs_positive(child)) continue;
--- fs/debugfs/inode.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
fs/debugfs/inode.c +26 -8
@@ -533,7 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);*/ void debugfs_remove_recursive (struct dentry *dentry) { -struct dentry *child, *next, *parent; +struct dentry *child, *parent;if (IS_ERR_OR_NULL (dentry))return ;
@@ -545,31 +545,49 @@ void debugfs_remove_recursive(struct dentry *dentry) parent = dentry; down:mutex_lock (&parent->d_inode->i_mutex); -list_for_each_entry_safe (child, next, &parent->d_subdirs, d_u.d_child) { + loop: +/* +* The parent->d_subdirs is protected by the d_lock. Outside that +* lock, the child can be unlinked and set to be freed which can +* use the d_u.d_child as the rcu head and corrupt this list. +*/ +spin_lock (&parent->d_lock); +list_for_each_entry (child, &parent->d_subdirs, d_u.d_child) {if (!debugfs_positive (child))continue ;/* perhaps simple_empty(child) makes more sense */ if (!list_empty (&child->d_subdirs)) { +spin_unlock (&parent->d_lock);mutex_unlock (&parent->d_inode->i_mutex); parent = child; goto down; } - up: + +spin_unlock (&parent->d_lock); +if (!__debugfs_remove (child, parent))simple_release_fs (&debugfs_mount, &debugfs_mount_count); + +/* +* The parent->d_lock protects agaist child from unlinking +* from d_subdirs. When releasing the parent->d_lock we can +* no longer trust that the next pointer is valid. +* Restart the loop. We'll skip this one with the +* debugfs_positive() check. +*/ + goto loop; } +spin_unlock (&parent->d_lock);mutex_unlock (&parent->d_inode->i_mutex); child = parent; parent = parent->d_parent;mutex_lock (&parent->d_inode->i_mutex); -if (child != dentry) { - next = list_entry(child->d_u.d_child.next, struct dentry, - d_u.d_child); - goto up; - } +if (child != dentry) +/* go up */ + goto loop;if (!__debugfs_remove (child, parent))simple_release_fs (&debugfs_mount, &debugfs_mount_count);
Signature · 1 line
2.1.0
PATCH 44/56 KVM: x86: Inter-privilege level ret emulation is not implemeneted
In reply to Jiri SlabyFrom: Nadav Amit <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9e8919ae793f4edfaa29694a70f71a515ae9942a upstream.
Return unhandlable error on inter-privilege level ret instruction. This is since the current emulation does not check the privilege level correctly when loading the CS, and does not pop RSP/SS as needed.
--- arch/x86/kvm/emulate.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/emulate.c +4 -0
@@ -2012,6 +2012,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) {int rc;unsigned long cs; +int cpl = ctxt->ops->cpl (ctxt); rc =emulate_pop (ctxt, &ctxt->_eip, ctxt->op_bytes);if (rc !=X86EMUL_CONTINUE )
@@ -2021,6 +2022,9 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) rc =emulate_pop (ctxt, &cs, ctxt->op_bytes);if (rc !=X86EMUL_CONTINUE )return rc; +/* Outer-privilege level return is not implemented */ +if (ctxt->mode >=X86EMUL_MODE_PROT16 && (cs &3 ) > cpl) +return X86EMUL_UNHANDLEABLE ; rc =load_segment_descriptor (ctxt, (u16 )cs,VCPU_SREG_CS );return rc; }
Signature · 1 line
2.1.0
PATCH 45/56 KVM: x86: always exit on EOIs for interrupts listed in the IOAPIC redir table
In reply to Jiri SlabyFrom: Paolo Bonzini <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0f6c0a740b7d3e1f3697395922d674000f83d060 upstream.
Currently, the EOI exit bitmap (used for APICv) does not include interrupts that are masked. However, this can cause a bug that manifests as an interrupt storm inside the guest. Alex Williamson reported the bug and is the one who really debugged this; I only wrote the patch. :)
The scenario involves a multi-function PCI device with OHCI and EHCI USB functions and an audio function, all assigned to the guest, where both USB functions use legacy INTx interrupts.
As soon as the guest boots, interrupts for these devices turn into an interrupt storm in the guest; the host does not see the interrupt storm. Basically the EOI path does not work, and the guest continues to see the interrupt over and over, even after it attempts to mask it at the APIC. The bug is only visible with older kernels (RHEL6.5, based on 2.6.32 with not many changes in the area of APIC/IOAPIC handling).
Alex then tried forcing bit 59 (corresponding to the USB functions' IRQ) on in the eoi_exit_bitmap and TMR, and things then work. What happens is that VFIO asserts IRQ11, then KVM recomputes the EOI exit bitmap. It does not have set bit 59 because the RTE was masked, so the IOAPIC never sees the EOI and the interrupt continues to fire in the guest.
My guess was that the guest is masking the interrupt in the redirection table in the interrupt routine, i.e. while the interrupt is set in a LAPIC's ISR, The simplest fix is to ignore the masking state, we would rather have an unnecessary exit rather than a missed IRQ ACK and anyway IOAPIC interrupts are not as performance-sensitive as for example MSIs. Alex tested this patch and it fixed his bug.
[Thanks to Alex for his precise description of the problem
and initial debugging effort. A lot of the text above is based on emails exchanged with him.]
--- virt/kvm/ioapic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
virt/kvm/ioapic.c +3 -4
@@ -203,10 +203,9 @@ void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap,spin_lock (&ioapic->lock);for (index =0 ; index <IOAPIC_NUM_PINS ; index++) { e = &ioapic->redirtbl[index]; -if (!e->fields.mask && - (e->fields.trig_mode ==IOAPIC_LEVEL_TRIG || -kvm_irq_has_notifier (ioapic->kvm,KVM_IRQCHIP_IOAPIC , - index) || index ==RTC_GSI )) { +if (e->fields.trig_mode ==IOAPIC_LEVEL_TRIG || +kvm_irq_has_notifier (ioapic->kvm,KVM_IRQCHIP_IOAPIC , index) || + index ==RTC_GSI ) {if (kvm_apic_match_dest (vcpu,NULL ,0 , e->fields.dest_id, e->fields.dest_mode)) { __set_bit(e->fields.vector,
Signature · 1 line
2.1.0
PATCH 46/56 Revert "KVM: x86: Increase the number of fixed MTRR regs to 10"
In reply to Jiri SlabyFrom: Paolo Bonzini <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0d234daf7e0a3290a3a20c8087eefbd6335a5bd4 upstream.
This reverts commit 682367c494869008eb89ef733f196e99415ae862, which causes 32-bit SMP Windows 7 guests to panic.
SeaBIOS has a limit on the number of MTRRs that it can handle, and this patch exceeded the limit. Better revert it. Thanks to Nadav Amit for debugging the cause.
--- arch/x86/include/asm/kvm_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -92,7 +92,7 @@#define KVM_REFILL_PAGES 25#define KVM_MAX_CPUID_ENTRIES 80#define KVM_NR_FIXED_MTRR_REGION 88 -#define KVM_NR_VAR_MTRR 10 +#define KVM_NR_VAR_MTRR 8#define ASYNC_PF_PER_VCPU 64
Signature · 1 line
2.1.0
PATCH 47/56 kvm: iommu: fix the third parameter of kvm_iommu_put_pages (CVE-2014-3601)
In reply to Jiri SlabyFrom: "Michael S. Tsirkin" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 350b8bdd689cd2ab2c67c8a86a0be86cfa0751a7 upstream.
The third parameter of kvm_iommu_put_pages is wrong, It should be 'gfn - slot->base_gfn'.
By making gfn very large, malicious guest or userspace can cause kvm to go to this error path, and subsequently to pass a huge value as size. Alternatively if gfn is small, then pages would be pinned but never unpinned, causing host memory leak and local DOS.
Passing a reasonable but large value could be the most dangerous case, because it would unpin a page that should have stayed pinned, and thus allow the device to DMA into arbitrary memory. However, this cannot happen because of the condition that can trigger the error:
- out of memory (where you can't allocate even a single page) should not be possible for the attacker to trigger
- when exceeding the iommu's address space, guest pages after gfn will also exceed the iommu's address space, and inside kvm_iommu_put_pages() the iommu_iova_to_phys() will fail. The page thus would not be unpinned at all.
--- virt/kvm/iommu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
virt/kvm/iommu.c +10 -9
@@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn,return pfn; } +static void kvm_unpin_pages (struct kvm *kvm,pfn_t pfn,unsigned long npages) +{ +unsigned long i; + +for (i =0 ; i < npages; ++i) +kvm_release_pfn_clean (pfn + i); +} +int kvm_iommu_map_pages (struct kvm *kvm,struct kvm_memory_slot *slot) {gfn_t gfn, end_gfn;
@@ -123,6 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)if (r) {printk (KERN_ERR "kvm_iommu_map_address:" "iommu failed to map pfn=%llx\n" , pfn); +kvm_unpin_pages (kvm, pfn, page_size); goto unmap_pages; }
@@ -134,7 +143,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)return 0 ; unmap_pages: -kvm_iommu_put_pages (kvm, slot->base_gfn, gfn); +kvm_iommu_put_pages (kvm, slot->base_gfn, gfn - slot->base_gfn);return r; }
@@ -272,14 +281,6 @@ out_unlock:return r; } -static void kvm_unpin_pages (struct kvm *kvm,pfn_t pfn,unsigned long npages) -{ -unsigned long i; - -for (i =0 ; i < npages; ++i) -kvm_release_pfn_clean (pfn + i); -} -static void kvm_iommu_put_pages (struct kvm *kvm,gfn_t base_gfn,unsigned long npages) {
Signature · 1 line
2.1.0
PATCH 48/56 drm/radeon: add new KV pci id
In reply to Jiri SlabyFrom: Alex Deucher <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6dc14baf4ced769017c7a7045019c7a19f373865 upstream.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=82912
--- drivers/gpu/drm/radeon/cik.c | 1 + include/drm/drm_pciids.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/radeon/cik.c +1 -0
@@ -2745,6 +2745,7 @@ static void cik_gpu_init(struct radeon_device *rdev) (rdev->pdev->device ==0x130B ) || (rdev->pdev->device ==0x130E ) || (rdev->pdev->device ==0x1315 ) || + (rdev->pdev->device ==0x1318 ) || (rdev->pdev->device == 0x131B)) { rdev->config.cik.max_cu_per_sh = 4; rdev->config.cik.max_backends_per_se =1 ;
include/drm/drm_pciids.h +1 -0
@@ -17,6 +17,7 @@ {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
Signature · 1 line
2.1.0
PATCH 49/56 drm/radeon: add new bonaire pci ids
In reply to Jiri SlabyFrom: Alex Deucher <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5fc540edc8ea1297c76685f74bc82a2107fe6731 upstream.
--- include/drm/drm_pciids.h | 2 ++ 1 file changed, 2 insertions(+)
include/drm/drm_pciids.h +2 -0
@@ -176,6 +176,8 @@ {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
Signature · 1 line
2.1.0
PATCH 50/56 drm/radeon: add additional SI pci ids
In reply to Jiri SlabyFrom: Alex Deucher <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 37dbeab788a8f23fd946c0be083e5484d6f929a1 upstream.
--- include/drm/drm_pciids.h | 4 ++++ 1 file changed, 4 insertions(+)
include/drm/drm_pciids.h +4 -0
@@ -165,8 +165,11 @@ {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
@@ -288,6 +291,7 @@ {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
Signature · 1 line
2.1.0
PATCH 51/56 PCI: Configure ASPM when enabling device
In reply to Jiri SlabyFrom: Vidya Sagar <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1f6ae47ecff7f23da73417e068018b311f3b5583 upstream.
We can't do ASPM configuration at enumeration-time because enabling it makes some defective hardware unresponsive, even if ASPM is disabled later (see 41cd766b0659 ("PCI: Don't enable aspm before drivers have had a chance to veto it"). Therefore, we have to do it after a driver claims the device.
We previously configured ASPM in pci_set_power_state(), but that's not a very good place because it's not really related to setting the PCI device power state, and doing it there means:
- We incorrectly skipped ASPM config when setting a device that's already in D0 to D0.
- We unnecessarily configured ASPM when setting a device to a low-power state (the ASPM feature only applies when the device is in D0).
- We unnecessarily configured ASPM when called from a .resume() method (ASPM configuration needs to be restored during resume, but pci_restore_pcie_state() should already do this).
Move ASPM configuration from pci_set_power_state() to do_pci_enable_device() so we do it when a driver enables a device.
--- drivers/pci/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/pci.c +6 -6
@@ -782,12 +782,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)if (!__pci_complete_power_transition (dev, state)) error =0 ; -/* -* When aspm_policy is "powersave" this call ensures -* that ASPM is configured. -*/ -if (!error && dev->bus->self) -pcie_aspm_powersave_config_link (dev->bus->self);return error; }
@@ -1120,12 +1114,18 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state);static int do_pci_enable_device (struct pci_dev *dev,int bars) {int err; +struct pci_dev *bridge;u16 cmd;u8 pin; err =pci_set_power_state (dev,PCI_D0 );if (err <0 && err != -EIO )return err; + + bridge =pci_upstream_bridge (dev); +if (bridge) +pcie_aspm_powersave_config_link (bridge); + err =pcibios_enable_device (dev, bars);if (err <0 )return err;
Signature · 1 line
2.1.0
PATCH 52/56 x86: don't exclude low BIOS area when allocating address space for non-PCI cards
In reply to Jiri SlabyFrom: Christoph Schulz <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cbace46a9710a480cae51e4611697df5de41713e upstream.
Commit 30919b0bf356 ("x86: avoid low BIOS area when allocating address space") moved the test for resource allocations that fall within the first 1MB of address space from the PCI-specific path to a generic path, such that all resource allocations will avoid this area. However, this breaks ISA cards which need to allocate a memory region within the first 1MB. An example is the i82365 PCMCIA controller and derivatives like the Ricoh RF5C296/396 which map part of the PCMCIA socket memory address space into the first 1MB of system memory address space. They do not work anymore as no usable memory region exists due to this change:
Intel ISA PCIC probe: Ricoh RF5C296/396 ISA-to-PCMCIA at port 0x3e0 ofs 0x00, 2 sockets
host opts [0]: none
host opts [1]: none
ISA irqs (scanned) = 3,4,5,9,10 status change on irq 10
pcmcia_socket pcmcia_socket1: pccard: PCMCIA card inserted into slot 1
pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff
pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: clean.
pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff pcmcia_socket pcmcia_socket0: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff
pcmcia_socket pcmcia_socket0: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff
pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff
pcmcia_socket pcmcia_socket0: cs: memory probe 0x0d0000-0x0dffff: clean.
pcmcia_socket pcmcia_socket0: cs: memory probe 0x0e0000-0x0effff: clean.
pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean.
pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean.
pcmcia_socket pcmcia_socket1: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff
pcmcia_socket pcmcia_socket1: cs: IO port probe 0xa00-0xaff: clean.
pcmcia_socket pcmcia_socket1: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff pcmcia_socket pcmcia_socket1: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff
pcmcia_socket pcmcia_socket1: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff
pcmcia_socket pcmcia_socket1: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff
pcmcia_socket pcmcia_socket1: cs: memory probe 0x0d0000-0x0dffff: clean.
pcmcia_socket pcmcia_socket1: cs: memory probe 0x0e0000-0x0effff: clean.
pcmcia_socket pcmcia_socket1: cs: memory probe 0x60000000-0x60ffffff: clean.
pcmcia_socket pcmcia_socket1: cs: memory probe 0xa0000000-0xa0ffffff: clean.
pcmcia_socket pcmcia_socket1: cs: memory probe 0x0cc000-0x0effff: excluding 0xe0000-0xeffff
pcmcia_socket pcmcia_socket1: cs: unable to map card memory!
If filtering out the first 1MB is reverted, everything works as expected.
--- arch/x86/kernel/resource.c | 8 +++++--- arch/x86/pci/i386.c | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/kernel/resource.c +5 -3
@@ -37,10 +37,12 @@ static void remove_e820_regions(struct resource *avail)void arch_remove_reservations (struct resource *avail) { -/* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ +/* +* Trim out BIOS area (high 2MB) and E820 regions. We do not remove +* the low 1MB unconditionally, as this area is needed for some ISA +* cards requiring a memory range, e.g. the i82365 PCMCIA controller. +*/ if (avail->flags &IORESOURCE_MEM ) { -if (avail->start <BIOS_END ) - avail->start =BIOS_END ;resource_clip (avail,BIOS_ROM_BASE ,BIOS_ROM_END );remove_e820_regions (avail);
arch/x86/pci/i386.c +4 -0
@@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const struct resource *res,return start;if (start &0x300 ) start = (start +0x3ff ) & ~0x3ff ; + }else if (res->flags &IORESOURCE_MEM ) { +/* The low 1MB range is reserved for ISA cards */ +if (start <BIOS_END ) + start =BIOS_END ; }return start; }
Signature · 1 line
2.1.0
PATCH 53/56 x86_64/vsyscall: Fix warn_bad_vsyscall log output
In reply to Jiri SlabyFrom: Andy Lutomirski <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 53b884ac3745353de220d92ef792515c3ae692f0 upstream.
This commit in Linux 3.6:
commit c767a54ba0657e52e6edaa97cbe0b0a8bf1c1655
Author: Joe Perches <[email protected]>
Date: Mon May 21 19:50:07 2012 -0700
x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
caused warn_bad_vsyscall to output garbage in the middle of the line. Revert the bad part of it.
The printk in question isn't actually bare; the level is "%s".
The bug this fixes is purely cosmetic; backports are optional.
--- arch/x86/kernel/vsyscall_64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/vsyscall_64.c +4 -4
@@ -125,10 +125,10 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,if (!show_unhandled_signals)return ; -pr_notice_ratelimited ("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n" , - level, current->comm,task_pid_nr (current), - message, regs->ip, regs->cs, - regs->sp, regs->ax, regs->si, regs->di); +printk_ratelimited ("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n" , + level, current->comm,task_pid_nr (current), + message, regs->ip, regs->cs, + regs->sp, regs->ax, regs->si, regs->di); }static int addr_to_vsyscall_nr (unsigned long addr)
Signature · 1 line
2.1.0
PATCH 54/56 x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
In reply to Jiri SlabyFrom: Matt Fleming <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7b2a583afb4ab894f78bc0f8bd136e96b6499a7e upstream.
Without CONFIG_RELOCATABLE the early boot code will decompress the kernel to LOAD_PHYSICAL_ADDR. While this may have been fine in the BIOS days, that isn't going to fly with UEFI since parts of the firmware code/data may be located at LOAD_PHYSICAL_ADDR.
Straying outside of the bounds of the regions we've explicitly requested from the firmware will cause all sorts of trouble. Bruno reports that his machine resets while trying to decompress the kernel image.
We already go to great pains to ensure the kernel is loaded into a suitably aligned buffer, it's just that the address isn't necessarily LOAD_PHYSICAL_ADDR, because we can't guarantee that address isn't in-use by the firmware.
Explicitly enforce CONFIG_RELOCATABLE for the EFI boot stub, so that we can load the kernel at any address with the correct alignment.
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -1608,6 +1608,7 @@ config EFI config EFI_STUB bool "EFI stub support" depends on EFI + select RELOCATABLE ---help--- This kernel feature allows a bzImage to be loaded directly by EFI firmware without the use of a bootloader.
Signature · 1 line
2.1.0
PATCH 55/56 x86/xen: resume timer irqs early
In reply to Jiri SlabyFrom: David Vrabel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8d5999df35314607c38fbd6bdd709e25c3a4eeab upstream.
If the timer irqs are resumed during device resume it is possible in certain circumstances for the resume to hang early on, before device interrupts are resumed. For an Ubuntu 14.04 PVHVM guest this would occur in ~0.5% of resume attempts.
It is not entirely clear what is occuring the point of the hang but I think a task necessary for the resume calls schedule_timeout(), waiting for a timer interrupt (which never arrives). This failure may require specific tasks to be running on the other VCPUs to trigger (processes are not frozen during a suspend/resume if PREEMPT is disabled).
Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in syscore_resume().
--- arch/x86/xen/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/time.c +1 -1
@@ -445,7 +445,7 @@ void xen_setup_timer(int cpu) irq =bind_virq_to_irqhandler (VIRQ_TIMER , cpu, xen_timer_interrupt,IRQF_DISABLED |IRQF_PERCPU |IRQF_NOBALANCING |IRQF_TIMER | -IRQF_FORCE_RESUME , +IRQF_FORCE_RESUME |IRQF_EARLY_RESUME , name,NULL );memcpy (evt, xen_clockevent,sizeof (*evt));
Signature · 1 line
2.1.0
PATCH 56/56 hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl
In reply to Jiri SlabyFrom: "Stephen M. Cameron" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0758f4f732b08b6ef07f2e5f735655cf69fea477 upstream.
When copy_from_user fails, return -EFAULT, not -ENOMEM
Reviewed by: Mike MIller <[email protected]>
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -3140,7 +3140,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) }if (ioc->Request.Type.Direction ==XFER_WRITE ) {if (copy_from_user (buff[sg_used], data_ptr, sz)) { - status = -ENOMEM ; + status = -EFAULT ; goto cleanup1; } }else
Signature · 1 line
2.1.0
cover 3.12.28-stable review
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.28-rc1.xz
and the diffstat can be found below.
thanks,
js
===============
Alan Stern (2):
USB: OHCI: fix bugs in debug routines
USB: OHCI: don't lose track of EDs when a controller dies
Alex Deucher (3):
drm/radeon: add new KV pci id
drm/radeon: add new bonaire pci ids
drm/radeon: add additional SI pci ids
Alexander Usyskin (1):
mei: start disconnect request timer consistently
Andy Lutomirski (1):
x86_64/vsyscall: Fix warn_bad_vsyscall log output
Arnd Bergmann (1):
crypto: ux500 - make interrupt mode plausible
Axel Lin (6):
hwmon: (sis5595) Prevent overflow problem when writing large limits
hwmon: (amc6821) Fix possible race condition bug
hwmon: (gpio-fan) Prevent overflow problem when writing large limits
hwmon: (ads1015) Fix off-by-one for valid channel index checking
hwmon: (ads1015) Fix out-of-bounds array access
hwmon: (dme1737) Prevent overflow problem when writing large limits
Bjorn Helgaas (1):
PCI: Add pci_upstream_bridge()
Bryan O'Donoghue (1):
USB: ehci-pci: USB host controller support for Intel Quark X1000
Christoph Schulz (1):
x86: don't exclude low BIOS area when allocating address space for
non-PCI cards
Clemens Ladisch (2):
ALSA: virtuoso: add Xonar Essence STX II support
ALSA: usb-audio: fix BOSS ME-25 MIDI regression
Daniel Mack (1):
usb: musb: cppi41: fire hrtimer according to programmed channel length
David Vrabel (1):
x86/xen: resume timer irqs early
Gu Zheng (1):
bio-integrity: add "bip_max_vcnt" into struct bio_integrity_payload
Guenter Roeck (2):
hwmon: (lm78) Fix overflow problems seen when writing large
temperature limits
hwmon: (lm85) Fix various errors on attribute writes
Hui Wang (2):
ALSA: hda - fix an external mic jack problem on a HP machine
ALSA: hda - restore the gpio led after resume
James P Michels III (1):
usb-core bInterval quirk
Jan Kara (1):
isofs: Fix unbounded recursion when processing relocated directories
Jason Gunthorpe (1):
tpm: Add missing tpm_do_selftest to ST33 I2C driver
Jeremy Vial (1):
ARM: OMAP3: Fix choice of omap3_restore_es function in OMAP34XX
rev3.1.2 case.
Jiang Liu (1):
USB: core: hcd-pci: free IRQ before disabling PCI device when shutting
down
Jiri Kosina (2):
HID: logitech: perform bounds checking on device_id early enough
HID: fix a couple of off-by-ones
Joonyoung Shim (1):
USB: add reset resume quirk for usb3503
Kent Overstreet (1):
bcache: Minor journal fix
Lee, Chun-Yi (1):
PM / hibernate: avoid unsafe pages in e820 reserved regions
Matt Fleming (1):
x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
Michael S. Tsirkin (1):
kvm: iommu: fix the third parameter of kvm_iommu_put_pages
(CVE-2014-3601)
Nadav Amit (1):
KVM: x86: Inter-privilege level ret emulation is not implemeneted
Oliver Neukum (1):
USB: devio: fix issue with log flooding
Paolo Bonzini (2):
KVM: x86: always exit on EOIs for interrupts listed in the IOAPIC
redir table
Revert "KVM: x86: Increase the number of fixed MTRR regs to 10"
Patrick Riphagen (2):
USB: serial: ftdi_sio: Annotate the current Xsens PID assignments
USB: serial: ftdi_sio: Add support for new Xsens devices
Peter Hurley (1):
serial: core: Preserve termios c_cflag for console resume
Pratyush Anand (1):
USB: Fix persist resume of some SS USB devices
Preston Fick (1):
USB: serial: cp210x: Removing unncessary usb_reset_device on startup
Russell King (1):
drm: omapdrm: fix compiler errors
Stephen M. Cameron (1):
hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl
Steven Rostedt (1):
debugfs: Fix corrupted loop in debugfs_remove_recursive
Takashi Iwai (2):
ALSA: hda/ca0132 - Don't try loading firmware at resume when already
failed
ALSA: hda/realtek - Avoid setting wrong COEF on ALC269 & co
Theodore Ts'o (1):
ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa
struct
Vidya Sagar (1):
PCI: Configure ASPM when enabling device
Wangzhao Cai (1):
HID: add quirk for 0x04d9:0xa096 device
Wolfram Sang (1):
drivers/i2c/busses: use correct type for dma_map/unmap
Documentation/sound/alsa/ALSA-Configuration.txt | 4 +-- arch/arm/mach-omap2/control.c | 3 +- arch/x86/Kconfig | 1 + arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kernel/resource.c | 8 +++-- arch/x86/kernel/vsyscall_64.c | 8 ++--- arch/x86/kvm/emulate.c | 4 +++ arch/x86/pci/i386.c | 4 +++ arch/x86/xen/time.c | 2 +- drivers/char/tpm/tpm_i2c_stm_st33.c | 1 + drivers/crypto/ux500/cryp/cryp_core.c | 25 +++++++------- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 6 ++-- drivers/gpu/drm/omapdrm/omap_gem.c | 10 +++--- drivers/gpu/drm/omapdrm/omap_plane.c | 4 +-- drivers/gpu/drm/radeon/cik.c | 1 + drivers/hid/hid-cherry.c | 2 +- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-kye.c | 2 +- drivers/hid/hid-lg.c | 4 +-- drivers/hid/hid-logitech-dj.c | 13 ++++--- drivers/hid/hid-monterey.c | 2 +- drivers/hid/hid-petalynx.c | 2 +- drivers/hid/hid-sunplus.c | 2 +- drivers/hid/usbhid/hid-quirks.c | 1 + drivers/hwmon/ads1015.c | 4 ++- drivers/hwmon/amc6821.c | 17 +++++---- drivers/hwmon/dme1737.c | 33 ++++++++++-------- drivers/hwmon/gpio-fan.c | 2 +- drivers/hwmon/lm78.c | 2 +- drivers/hwmon/lm85.c | 9 +++-- drivers/hwmon/sis5595.c | 2 +- drivers/i2c/busses/i2c-at91.c | 4 +-- drivers/md/bcache/journal.c | 19 +++++++--- drivers/misc/mei/client.c | 1 + drivers/pci/pci.c | 12 +++---- drivers/scsi/hpsa.c | 2 +- drivers/tty/serial/serial_core.c | 3 ++ drivers/usb/core/config.c | 11 ++++++ drivers/usb/core/devio.c | 2 +- drivers/usb/core/hcd-pci.c | 2 ++ drivers/usb/core/hub.c | 41 ++++++++++++++++++++++ drivers/usb/core/quirks.c | 7 ++++ drivers/usb/host/ehci-pci.c | 25 ++++++++++++++ drivers/usb/host/ohci-dbg.c | 9 ++--- drivers/usb/host/ohci-hcd.c | 10 +++--- drivers/usb/host/ohci-q.c | 46 ++++++++++++++++--------- drivers/usb/musb/musb_cppi41.c | 6 ++-- drivers/usb/serial/cp210x.c | 3 -- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 13 ++++--- fs/bio-integrity.c | 12 ++----- fs/debugfs/inode.c | 34 +++++++++++++----- fs/ext4/mballoc.c | 21 ++++++++++- fs/isofs/inode.c | 15 ++++---- fs/isofs/isofs.h | 23 ++++++++++--- fs/isofs/rock.c | 39 +++++++++++++++------ include/drm/drm_pciids.h | 7 ++++ include/linux/bio.h | 1 + include/linux/pci.h | 9 +++++ include/linux/usb/quirks.h | 11 ++++++ kernel/power/snapshot.c | 21 ++++++++++- sound/pci/Kconfig | 4 +-- sound/pci/hda/patch_ca0132.c | 7 +++- sound/pci/hda/patch_realtek.c | 26 +++++++++++--- sound/pci/hda/patch_sigmatel.c | 12 +++++++ sound/pci/oxygen/virtuoso.c | 1 + sound/pci/oxygen/xonar_pcm179x.c | 12 +++++-- sound/usb/quirks-table.h | 29 ++++++++++++++++ virt/kvm/ioapic.c | 7 ++-- virt/kvm/iommu.c | 19 +++++----- 70 files changed, 518 insertions(+), 191 deletions(-)
Signature · 1 line
2.1.0
Re: [PATCH 3.12 00/56] 3.12.28-stable review
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
Jiri,
I get a large number of build failures.
total: 135 pass: 104 fail: 31
Failed builds:
arm:s3c2410_defconfig
arm:ixp4xx_defconfig
arm:mini2440_defconfig
arm:at91_dt_defconfig
arm:s3c6400_defconfig
arm:lpc32xx_defconfig
arm:sama5_defconfig
arm:cm_x2xx_defconfig
arm:at91rm9200_defconfig
ia64:defconfig
mips:bcm47xx_defconfig
mips:bcm63xx_defconfig
mips:ath79_defconfig
mips:fuloong2e_defconfig
mips:powertv_defconfig
parisc:defconfig
powerpc:defconfig
powerpc:ppc64e_defconfig
powerpc:cell_defconfig
powerpc:maple_defconfig
powerpc:mpc85xx_defconfig
powerpc:mpc85xx_smp_defconfig
powerpc:defconfig
powerpc:ppc64e_defconfig
powerpc:cell_defconfig
powerpc:maple_defconfig
powerpc:mpc85xx_defconfig
powerpc:mpc85xx_smp_defconfig
sparc32:defconfig
sparc64:defconfig
tile:tilegx_defconfig
In file included from drivers/usb/host/ohci-hcd.c:85:0:drivers/usb/host/ohci-dbg.c:411:20: error: conflicting types for 'ohci_dump' drivers/usb/host/ohci-hcd.c:81:13: note: previous declaration of 'ohci_dump' was here drivers/usb/host/ohci-hcd.c: In function 'ohci_run':drivers/usb/host/ohci-hcd.c:757:2: error: too few arguments to function 'ohci_dump'
Guenter
Re: [PATCH 3.12 00/56] 3.12.28-stable review
Quoted 13 lines · Guenter Roeck
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
Jiri,
I get a large number of build failures.
...
Quoted 8 lines
In file included from
drivers/usb/host/ohci-hcd.c:85:0:drivers/usb/host/ohci-dbg.c:411:20: error: conflicting types for 'ohci_dump'drivers/usb/host/ohci-hcd.c:81:13: note: previous declaration of 'ohci_dump' was heredrivers/usb/host/ohci-hcd.c: In function 'ohci_run':drivers/usb/host/ohci-hcd.c:757:2: error: too few arguments to function 'ohci_dump'
Oh, !USB_DEBUG. It should be fixed, could you retry?
thanks,
Signature · 2 lines
js suse labs
Re: [PATCH 3.12 00/56] 3.12.28-stable review
Quoted 24 lines · Jiri Slaby
Quoted 13 lines · Guenter Roeck
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
Jiri,
I get a large number of build failures.
...
Quoted 8 lines
In file included from
drivers/usb/host/ohci-hcd.c:85:0:drivers/usb/host/ohci-dbg.c:411:20: error: conflicting types for 'ohci_dump'drivers/usb/host/ohci-hcd.c:81:13: note: previous declaration of 'ohci_dump' was heredrivers/usb/host/ohci-hcd.c: In function 'ohci_run':drivers/usb/host/ohci-hcd.c:757:2: error: too few arguments to function 'ohci_dump'
Quoted 2 lines
Oh, !USB_DEBUG. It should be fixed, could you retry?
I triggered a rebuild. I'll let you know after it is complete.
Guenter
Re: [PATCH 3.12 00/56] 3.12.28-stable review
In reply to Jiri SlabyQuoted 24 lines · Jiri Slaby
Quoted 13 lines · Guenter Roeck
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
Jiri,
I get a large number of build failures.
...
Quoted 8 lines
In file included from
drivers/usb/host/ohci-hcd.c:85:0:drivers/usb/host/ohci-dbg.c:411:20: error: conflicting types for 'ohci_dump'drivers/usb/host/ohci-hcd.c:81:13: note: previous declaration of 'ohci_dump' was heredrivers/usb/host/ohci-hcd.c: In function 'ohci_run':drivers/usb/host/ohci-hcd.c:757:2: error: too few arguments to function 'ohci_dump'
Quoted 2 lines
Oh, !USB_DEBUG. It should be fixed, could you retry?
Much better.
Build results:
total: 135 pass: 135 fail: 0
Qemu tests all passed.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Re: [PATCH 3.12 00/56] 3.12.28-stable review
Quoted 4 lines · Guenter Roeck
Build results:
total: 135 pass: 135 fail: 0Qemu tests all passed.
Quoted 1 line · Shuah Khan
Compiled and booted on my test system. No dmesg regressions.
Thank you both!
Signature · 2 lines
js suse labs
Re: [PATCH 3.12 00/56] 3.12.28-stable review
In reply to Jiri SlabyQuoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.28 release. There are 56 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Sep 5 11:17:45 CEST 2014. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.28-rc1.xzand the diffstat can be found below.
thanks,
js
Compiled and booted on my test system. No dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Sr. Linux Kernel Developer Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978