3.4.12-stable review
Subsystems (125)
Greg Kroah-Hartman
maintainerPATCH 160/218 drm/radeon: force dma32 to fix regression rs4xx,rs6xx,rs740
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 4a2b6662c3632176b4fdf012243dd3751367bf1f upstream.
It seems some of those IGP dislike non dma32 page despite what documentation says. Fix regression since we allowed non dma32 pages. It seems it only affect some revision of those IGP chips as we don't know which one just force dma32 for all of them.
https://bugzilla.redhat.com/show_bug.cgi?id=785375
--- drivers/gpu/drm/radeon/radeon_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_device.c +1 -1
@@ -772,7 +772,7 @@ int radeon_device_init(struct radeon_devif (rdev->flags &RADEON_IS_AGP ) rdev->need_dma32 = true;if ((rdev->flags &RADEON_IS_PCI ) && - (rdev->family <CHIP_RS400 )) + (rdev->family <=CHIP_RS740 )) rdev->need_dma32 = true; dma_bits = rdev->need_dma32 ?32 :40 ;
Greg Kroah-Hartman
maintainerPATCH 161/218 drm/radeon: fix dig encoder selection on DCE61
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 41fa54377057ab38bc3e08ebb46168a7daf2e63b upstream.
Was using the DCE41 code which was wrong. Fixes
blank displays on a number of Trinity systems.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +26 -5
@@ -1769,13 +1769,34 @@ static int radeon_atom_pick_dig_encoder(struct radeon_crtc *radeon_crtc =to_radeon_crtc (encoder->crtc);struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct drm_encoder *test_encoder; -struct radeon_encoder_atom_dig *dig; +struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;uint32_t dig_enc_in_use =0 ; -/* DCE4/5 */ -if (ASIC_IS_DCE4 (rdev)) { - dig = radeon_encoder->enc_priv; -if (ASIC_IS_DCE41 (rdev)) { +if (ASIC_IS_DCE6 (rdev)) { +/* DCE6 */ +switch (radeon_encoder->encoder_id) { +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY : +if (dig->linkb) +return 1 ; +else +return 0 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 : +if (dig->linkb) +return 3 ; +else +return 2 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 : +if (dig->linkb) +return 5 ; +else +return 4 ; +break ; + } + }else if (ASIC_IS_DCE4 (rdev)) { +/* DCE4/5 */ +if (ASIC_IS_DCE41 (rdev) && !ASIC_IS_DCE61 (rdev)) {/* ontario follows DCE4 */ if (rdev->family ==CHIP_PALM ) {if (dig->linkb)
Greg Kroah-Hartman
maintainerPATCH 162/218 drm/nouveau: fix booting with plymouth + dumb support
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 610bd7da160f76f1644ecb4cd7f39511b49a22cc upstream.
We noticed a plymouth bug on Fedora 18, and I then noticed this stupid thinko, fixing it fixed the problem with plymouth.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_display.c +1 -1
@@ -586,7 +586,7 @@ nouveau_display_dumb_create(struct drm_f args->size = args->pitch * args->height; args->size =roundup (args->size,PAGE_SIZE ); - ret =nouveau_gem_new (dev, args->size,0 ,TTM_PL_FLAG_VRAM ,0 ,0 , &bo); + ret =nouveau_gem_new (dev, args->size,0 ,NOUVEAU_GEM_DOMAIN_VRAM ,0 ,0 , &bo);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 163/218 drm/i915: HDMI - Clear Audio Enable bit for Hot Plug
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Xingchao <[email protected]>
commit b98b60167279df3acac9422c3c9820d9ebbcf9fb upstream.
Clear Audio Enable bit to trigger unsolicated event to notify Audio Driver part the HDMI hot plug change. The patch fixed the bug when remove HDMI cable the bit was not cleared correctly.
In intel_hdmi_dpms(), if intel_hdmi->has_audio been true, the "Audio enable bit" will be set to trigger unsolicated event to notify Alsa driver the change.
intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after remove the hdmi cable, here's debug log:
[ 187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2 [ 187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0
so when comes back to intel_hdmi_dpms(), the "Audio enable bit" will not be cleared. And this cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.
This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:
[ 187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1 [ 187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -271,7 +271,7 @@ static void intel_hdmi_dpms(struct drm_eu32 temp;u32 enable_bits =SDVO_ENABLE ; -if (intel_hdmi->has_audio) +if (intel_hdmi->has_audio || mode !=DRM_MODE_DPMS_ON ) enable_bits |=SDVO_AUDIO_ENABLE ; temp =I915_READ (intel_hdmi->sdvox_reg);
Greg Kroah-Hartman
maintainerPATCH 164/218 md/raid10: fix problem with on-stack allocation of r10bio structure.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit e0ee778528bbaad28a5c69d2e219269a3a096607 upstream.
A 'struct r10bio' has an array of per-copy information at the end. This array is declared with size [0] and r10bio_pool_alloc allocates enough extra space to store the per-copy information depending on the number of copies needed.
So declaring a 'struct r10bio on the stack isn't going to work. It won't allocate enough space, and memory corruption will ensue.
So in the two places where this is done, declare a sufficiently large structure and use that instead.
The two call-sites of this bug were introduced in 3.4 and 3.5 so this is suitable for both those kernels. The patch will have to be modified for 3.4 as it only has one bug.
--- drivers/md/raid10.c | 16 ++++++++++------ drivers/md/raid10.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/md/raid10.c +10 -6
@@ -612,20 +612,24 @@ static int raid10_mergeable_bvec(struct max = biovec->bv_len;if (mddev->merge_check_needed) { -struct r10bio r10_bio; +struct { +struct r10bio r10_bio; +struct r10dev devs[conf->copies]; + } on_stack; +struct r10bio *r10_bio = &on_stack.r10_bio;int s; - r10_bio.sector = sector; -raid10_find_phys (conf, &r10_bio); + r10_bio->sector = sector; +raid10_find_phys (conf, r10_bio);rcu_read_lock ();for (s =0 ; s < conf->copies; s++) { -int disk = r10_bio.devs[s].devnum; +int disk = r10_bio->devs[s].devnum;struct md_rdev *rdev =rcu_dereference ( conf->mirrors[disk].rdev);if (rdev && !test_bit (Faulty, &rdev->flags)) {struct request_queue *q =bdev_get_queue (rdev->bdev);if (q->merge_bvec_fn) { - bvm->bi_sector = r10_bio.devs[s].addr + bvm->bi_sector = r10_bio->devs[s].addr + rdev->data_offset; bvm->bi_bdev = rdev->bdev; max = min(max, q->merge_bvec_fn(
@@ -637,7 +641,7 @@ static int raid10_mergeable_bvec(structstruct request_queue *q =bdev_get_queue (rdev->bdev);if (q->merge_bvec_fn) { - bvm->bi_sector = r10_bio.devs[s].addr + bvm->bi_sector = r10_bio->devs[s].addr + rdev->data_offset; bvm->bi_bdev = rdev->bdev; max = min(max, q->merge_bvec_fn(
drivers/md/raid10.h +1 -1
@@ -104,7 +104,7 @@ struct r10bio {* We choose the number when they are allocated. * We sometimes need an extra bio to write to the replacement. */ -struct { +struct r10dev {struct bio *bio;union {struct bio *repl_bio;/* used for resync and
Greg Kroah-Hartman
maintainerPATCH 165/218 workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
commit 96e65306b81351b656835c15931d1d237b252f27 upstream.
The compiler may compile the following code into TWO write/modify instructions.
worker->flags &= ~WORKER_UNBOUND; worker->flags |= WORKER_REBIND;
so the other CPU may temporarily see worker->flags which doesn't have either WORKER_UNBOUND or WORKER_REBIND set and perform local wakeup prematurely.
Fix it by using single explicit assignment via ACCESS_ONCE().
Because idle workers have another WORKER_NOT_RUNNING flag, this bug doesn't exist for them; however, update it to use the same pattern for consistency.
tj: Applied the change to idle workers too and updated comments and
patch description a bit.
--- kernel/workqueue.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/workqueue.c +6 -3
@@ -3433,14 +3433,17 @@ static int __cpuinit trustee_thread(voidfor_each_busy_worker (worker, i, pos, gcwq) {struct work_struct *rebind_work = &worker->rebind_work; +unsigned long worker_flags = worker->flags;/* * Rebind_work may race with future cpu hotplug * operations. Use a separate flag to mark that -* rebinding is scheduled. +* rebinding is scheduled. The morphing should +* be atomic. */ - worker->flags |=WORKER_REBIND ; - worker->flags &= ~WORKER_ROGUE ; + worker_flags |=WORKER_REBIND ; + worker_flags &= ~WORKER_ROGUE ; +ACCESS_ONCE (worker->flags) = worker_flags;/* queue rebind_work, wq doesn't matter, use the default one */ if (test_and_set_bit(WORK_STRUCT_PENDING_BIT,
Greg Kroah-Hartman
maintainerPATCH 166/218 x86: Fix boot on Twinhead H12Y
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 80b3e557371205566a71e569fbfcce5b11f92dbe upstream.
Despite lots of investigation into why this is needed we don't know or have an elegant cure. The only answer found on this laptop is to mark a problem region as used so that Linux doesn't put anything there.
Currently all the users add reserve= command lines and anyone not knowing this needs to find the magic page that documents it. Automate it instead.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=10231
--- arch/x86/pci/fixup.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/x86/pci/fixup.c +17 -0
@@ -519,3 +519,20 @@ static void sb600_disable_hpet_bar(struc } }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_ATI ,0x4385 , sb600_disable_hpet_bar); + +/* +* Twinhead H12Y needs us to block out a region otherwise we map devices +* there and any access kills the box. +* +* See: https://bugzilla.kernel.org/show_bug.cgi?id=10231 +* +* Match off the LPC and svid/sdid (older kernels lose the bridge subvendor) +*/ +static void __devinit twinhead_reserve_killing_zone (struct pci_dev *dev) +{ +if (dev->subsystem_vendor ==0x14FF && dev->subsystem_device ==0xA003 ) { +pr_info ("Reserving memory on Twinhead H12Y\n" ); +request_mem_region (0xFFB00000 ,0x100000 ,"twinhead" ); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x27B9 , twinhead_reserve_killing_zone);
Greg Kroah-Hartman
maintainerPATCH 167/218 macvtap: zerocopy: fix offset calculation when building skb
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 3afc9621f15701c557e60f61eba9242bac2771dd upstream.
This patch fixes the offset calculation when building skb:
- offset1 were used as skb data offset not vector offset
- reset offset to zero only when we advance to next vector
--- drivers/net/macvtap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/macvtap.c +7 -6
@@ -506,10 +506,11 @@ static int zerocopy_sg_from_iovec(structif (copy > size) { ++from; --count; - } + offset =0 ; + }else + offset += size; copy -= size; offset1 += size; - offset =0 ; }if (len == offset1)
@@ -520,13 +521,13 @@ static int zerocopy_sg_from_iovec(structint num_pages;unsigned long base; - len = from->iov_len - offset1; + len = from->iov_len - offset;if (!len) { - offset1 =0 ; + offset =0 ; ++from;continue ; } - base = (unsigned long )from->iov_base + offset1; + base = (unsigned long )from->iov_base + offset; size = ((base & ~PAGE_MASK ) + len + ~PAGE_MASK ) >>PAGE_SHIFT ;if (i + size >MAX_SKB_FRAGS )return -EMSGSIZE ;
@@ -548,7 +549,7 @@ static int zerocopy_sg_from_iovec(struct len -= size; i++; } - offset1 =0 ; + offset =0 ; ++from; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 168/218 macvtap: zerocopy: fix truesize underestimation
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 4ef67ebedffa44ed9939b34708ac2fee06d2f65f upstream.
As the skb fragment were pinned/built from user pages, we should account the page instead of length for truesize.
--- drivers/net/macvtap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/macvtap.c +4 -2
@@ -520,6 +520,7 @@ static int zerocopy_sg_from_iovec(structstruct page *page[MAX_SKB_FRAGS ];int num_pages;unsigned long base; +unsigned long truesize; len = from->iov_len - offset;if (!len) {
@@ -535,10 +536,11 @@ static int zerocopy_sg_from_iovec(structif (num_pages != size)/* put_page is in skb free */ return -EFAULT ; + truesize = size *PAGE_SIZE ; skb->data_len += len; skb->len += len; - skb->truesize += len; -atomic_add (len, &skb->sk->sk_wmem_alloc); + skb->truesize += truesize; +atomic_add (truesize, &skb->sk->sk_wmem_alloc);while (len) {int off = base & ~PAGE_MASK ;int size =min_t (int, len,PAGE_SIZE - off);
Greg Kroah-Hartman
maintainerPATCH 169/218 macvtap: zerocopy: put page when fail to get all requested user pages
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 02ce04bb3d28c3333231f43bca677228dbc686fe upstream.
When get_user_pages_fast() fails to get all requested pages, we could not use kfree_skb() to free it as it has not been put in the skb fragments. So we need to call put_page() instead.
--- drivers/net/macvtap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/macvtap.c +4 -3
@@ -533,9 +533,10 @@ static int zerocopy_sg_from_iovec(structif (i + size >MAX_SKB_FRAGS )return -EMSGSIZE ; num_pages =get_user_pages_fast (base, size,0 , &page[i]); -if (num_pages != size) -/* put_page is in skb free */ -return -EFAULT ; +if (num_pages != size) { +for (i =0 ; i < num_pages; i++) +put_page (page[i]); + } truesize = size *PAGE_SIZE ; skb->data_len += len; skb->len += len;
Greg Kroah-Hartman
maintainerPATCH 170/218 macvtap: zerocopy: set SKBTX_DEV_ZEROCOPY only when skb is built successfully
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 01d6657b388438def19c8baaea28e742b6ed32ec upstream.
Current the SKBTX_DEV_ZEROCOPY is set unconditionally after zerocopy_sg_from_iovec(), this would lead NULL pointer when macvtap fails to build zerocopy skb because destructor_arg was not initialized. Solve this by set this flag after the skb were built successfully.
--- drivers/net/macvtap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/macvtap.c +5 -4
@@ -716,10 +716,9 @@ static ssize_t macvtap_get_user(struct mif (!skb) goto err; -if (zerocopy) { +if (zerocopy) err =zerocopy_sg_from_iovec (skb, iv, vnet_hdr_len, count); -skb_shinfo (skb)->tx_flags |=SKBTX_DEV_ZEROCOPY ; - }else +else err =skb_copy_datagram_from_iovec (skb,0 , iv, vnet_hdr_len, len);if (err)
@@ -738,8 +737,10 @@ static ssize_t macvtap_get_user(struct mrcu_read_lock_bh (); vlan =rcu_dereference_bh (q->vlan);/* copy skb_ubuf_info for callback when skb has no error */ -if (zerocopy) +if (zerocopy) {skb_shinfo (skb)->destructor_arg = m->msg_control; +skb_shinfo (skb)->tx_flags |=SKBTX_DEV_ZEROCOPY ; + }if (vlan)macvlan_start_xmit (skb, vlan->dev);else
Greg Kroah-Hartman
maintainerPATCH 171/218 Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manoj Iyer <[email protected]>
commit 61c964ba1748e984cb232b431582815899bf10fe upstream.
Patch adds support for BCM20702A0 device id (0a5c:21f4).
usb-devices after patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
usb-devices before patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -106,6 +106,7 @@ static struct usb_device_id btusb_table[ { USB_DEVICE(0x0a5c, 0x21e6) }, { USB_DEVICE(0x0a5c, 0x21e8) }, { USB_DEVICE(0x0a5c, 0x21f3) }, + { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */
Greg Kroah-Hartman
maintainerPATCH 172/218 Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Padovan <[email protected]>
commit 92c385f46b30f4954e9dd2d2005c12d233b479ea upstream.
Many Broadcom devices has a vendor specific devices class, with this rule we match all existent and future controllers with this behavior.
We also remove old rules to that matches product id for Broadcom devices.
--- drivers/bluetooth/btusb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/bluetooth/btusb.c +3 -5
@@ -102,16 +102,14 @@ static struct usb_device_id btusb_table[/* Broadcom BCM20702A0 */ { USB_DEVICE(0x0489, 0xe042) }, - { USB_DEVICE(0x0a5c, 0x21e3) }, - { USB_DEVICE(0x0a5c, 0x21e6) }, - { USB_DEVICE(0x0a5c, 0x21e8) }, - { USB_DEVICE(0x0a5c, 0x21f3) }, - { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */ { USB_DEVICE(0x0489, 0xe033) }, +/*Broadcom devices with vendor specific id */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, + { } /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 173/218 Bluetooth: Add support for Apple vendor-specific devices
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrik Rydberg <[email protected]>
commit 1fa6535faf055cd71311ab887e94fc234f04ee18 upstream.
As pointed out by Gustavo and Marcel, all Apple-specific Broadcom devices seen so far have the same interface class, subclass and protocol numbers. This patch adds an entry which matches all of them, using the new USB_VENDOR_AND_INTERFACE_INFO() macro.
In particular, this patch adds support for the MacBook Pro Retina (05ac:8286), which is not in the present list.
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -60,6 +60,9 @@ static struct usb_device_id btusb_table[/* Generic Bluetooth USB device */ { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, +/* Apple-specific (Broadcom) devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) }, +/* Broadcom SoftSailing reporting vendor specific */ { USB_DEVICE(0x0a5c, 0x21e1) },
Greg Kroah-Hartman
maintainerPATCH 174/218 Bluetooth: Fix use-after-free bug in SMP
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Guedes <[email protected]>
commit 61a0cfb008f57ecf7eb28ee762952fb42dc15d15 upstream.
If SMP fails, we should always cancel security_timer delayed work. Otherwise, security_timer function may run after l2cap_conn object has been freed.
This patch fixes the following warning reported by ODEBUG:
WARNING: at lib/debugobjects.c:261 debug_print_object+0x7c/0x8d() Hardware name: Bochs ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x27 Modules linked in: btusb bluetooth Pid: 440, comm: kworker/u:2 Not tainted 3.5.0-rc1+ #4 Call Trace: [<ffffffff81174600>] ? free_obj_work+0x4a/0x7f [<ffffffff81023eb8>] warn_slowpath_common+0x7e/0x97 [<ffffffff81023f65>] warn_slowpath_fmt+0x41/0x43 [<ffffffff811746b1>] debug_print_object+0x7c/0x8d [<ffffffff810394f0>] ? __queue_work+0x241/0x241 [<ffffffff81174fdd>] debug_check_no_obj_freed+0x92/0x159 [<ffffffff810ac08e>] slab_free_hook+0x6f/0x77 [<ffffffffa0019145>] ? l2cap_conn_del+0x148/0x157 [bluetooth] [<ffffffff810ae408>] kfree+0x59/0xac [<ffffffffa0019145>] l2cap_conn_del+0x148/0x157 [bluetooth] [<ffffffffa001b9a2>] l2cap_recv_frame+0xa77/0xfa4 [bluetooth] [<ffffffff810592f9>] ? trace_hardirqs_on_caller+0x112/0x1ad [<ffffffffa001c86c>] l2cap_recv_acldata+0xe2/0x264 [bluetooth] [<ffffffffa0002b2f>] hci_rx_work+0x235/0x33c [bluetooth] [<ffffffff81038dc3>] ? process_one_work+0x126/0x2fe [<ffffffff81038e22>] process_one_work+0x185/0x2fe [<ffffffff81038dc3>] ? process_one_work+0x126/0x2fe [<ffffffff81059f2e>] ? lock_acquired+0x1b5/0x1cf [<ffffffffa00028fa>] ? le_scan_work+0x11d/0x11d [bluetooth] [<ffffffff81036fb6>] ? spin_lock_irq+0x9/0xb [<ffffffff81039209>] worker_thread+0xcf/0x175 [<ffffffff8103913a>] ? rescuer_thread+0x175/0x175 [<ffffffff8103cfe0>] kthread+0x95/0x9d [<ffffffff812c5054>] kernel_threadi_helper+0x4/0x10 [<ffffffff812c36b0>] ? retint_restore_args+0x13/0x13 [<ffffffff8103cf4b>] ? flush_kthread_worker+0xdb/0xdb [<ffffffff812c5050>] ? gs_change+0x13/0x13
This bug can be reproduced using hctool lecc or l2test tools and bluetoothd not running.
--- net/bluetooth/smp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/smp.c +3 -3
@@ -266,10 +266,10 @@ static void smp_failure(struct l2cap_conmgmt_auth_failed (conn->hcon->hdev, conn->dst, hcon->type, hcon->dst_type, reason); -if (test_and_clear_bit (HCI_CONN_LE_SMP_PEND , &conn->hcon->flags)) { -cancel_delayed_work_sync (&conn->security_timer); +cancel_delayed_work_sync (&conn->security_timer); + +if (test_and_clear_bit (HCI_CONN_LE_SMP_PEND , &conn->hcon->flags))smp_chan_destroy (conn); - } }#define JUST_WORKS 0x00
Re: [ 174/218] Bluetooth: Fix use-after-free bug in SMP
Quoted 11 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Guedes <[email protected]>
commit
61a0cfb008f57ecf7eb28ee762952fb42dc15d15upstream.If SMP fails, we should always cancel
security_timerdelayed work. Otherwise,security_timerfunction may run afterl2cap_connobject has been freed.
[...]
This particular bug doesn't appear to exist in earlier kernel versions, but it led me to find some related bugs in teardown that do.
I'm attaching two patches:
- bluetooth-fix-l2cap_conn_del-locking.patch seems to be needed for both 3.0 and 3.2. It's very different from the upstream changes, and is compile-tested only.
- bluetooth-fix-deadlock-and-crash-when-smp-pairing-times-out.patch (commit d06cc416f517a25713dedd9e2a9ccf4f3086c09a upstream) seems to be needed for 3.2 only.
What do you think?
Ben.
Signature · 3 lines
Ben Hutchings
Usenet is essentially a HUGE group of people passing notes in class.
- Rachel Kadel, `A Quick Guide to Newsgroup Etiquette'From: Ben Hutchings <[email protected]>
Date: Sat, 29 Sep 2012 17:53:28 +0200
Subject: Bluetooth: Fix l2cap_conn_del() locking
This is covered by commit 3df91ea20e744344100b10ae69a17211fcf5b207 ('Bluetooth: Revert to mutexes from RCU list') upstream.
l2cap_conn_del() can race with various other functions that walk the channel list; in particular l2cap_conn_start() which is called from l2cap_info_timeout(). l2cap_chan_del() itself takes the chan_lock for writing, so instead of locking here we must move all channels onto a temporary list.
---
net/bluetooth/l2cap_core.c +7 -1
@@ -968,6 +968,7 @@ static void l2cap_info_timeout(unsignedstatic void l2cap_conn_del (struct hci_conn *hcon,int err) {struct l2cap_conn *conn = hcon->l2cap_data; +struct list_head chan_l;struct l2cap_chan *chan, *l;struct sock *sk;
@@ -978,8 +979,13 @@ static void l2cap_conn_del(struct hci_cokfree_skb (conn->rx_skb); +INIT_LIST_HEAD (&chan_l); +write_lock_bh (&conn->chan_lock); +list_splice_init (&conn->chan_l, &chan_l); +write_unlock_bh (&conn->chan_lock); +/* Kill channels */ -list_for_each_entry_safe (chan, l, &conn->chan_l, list) { +list_for_each_entry_safe (chan, l, &chan_l, list) { sk = chan->sk;bh_lock_sock (sk);l2cap_chan_del (chan, err);
From: Johan Hedberg <[email protected]>
Date: Wed, 6 Jun 2012 18:44:11 +0800
Subject: Bluetooth: Fix deadlock and crash when SMP pairing times out
commit d06cc416f517a25713dedd9e2a9ccf4f3086c09a upstream.
The l2cap_conn_del function tries to cancel_sync the security timer, but when it's called from the timeout function itself a deadlock occurs. Subsequently the "hcon->l2cap_data = NULL" that's supposed to protect multiple calls to l2cap_conn_del never gets cleared and when the connection finally drops we double free's etc which will crash the kernel.
This patch fixes the issue by using the HCI_CONN_LE_SMP_PEND for protecting against this. The same flag is also used for the same purpose in other places in the SMP code.
--- net/bluetooth/l2cap_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +6 -1
@@ -1009,7 +1009,12 @@ static void security_timeout(unsigned lo {struct l2cap_conn *conn = (void *) arg; -l2cap_conn_del (conn->hcon,ETIMEDOUT ); +BT_DBG ("conn %p" , conn); + +if (test_and_clear_bit (HCI_CONN_LE_SMP_PEND , &conn->hcon->pend)) { +smp_chan_destroy (conn); +l2cap_conn_del (conn->hcon,ETIMEDOUT ); + } }static struct l2cap_conn *l2cap_conn_add (struct hci_conn *hcon,u8 status)
Greg Kroah-Hartman
maintainerPATCH 175/218 Bluetooth: Change signature of smp_conn_security()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit cc110922da7e902b62d18641a370fec01a9fa794 upstream.
To make it clear that it may be called from contexts that may not have any knowledge of L2CAP, we change the connection parameter, to receive a hci_conn.
This also makes it clear that it is checking the security of the link.
--- include/net/bluetooth/smp.h | 2 +- net/bluetooth/l2cap_core.c | 11 ++++++----- net/bluetooth/l2cap_sock.c | 2 +- net/bluetooth/smp.c | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-)
include/net/bluetooth/smp.h +1 -1
@@ -136,7 +136,7 @@ struct smp_chan { };/* SMP Commands */ -int smp_conn_security (struct l2cap_conn *conn,__u8 sec_level); +int smp_conn_security (struct hci_conn *hcon,__u8 sec_level);int smp_sig_channel (struct l2cap_conn *conn,struct sk_buff *skb);int smp_distribute_keys (struct l2cap_conn *conn,__u8 force);int smp_user_confirm_reply (struct hci_conn *conn,u16 mgmt_op,__le32 passkey);
net/bluetooth/l2cap_core.c +6 -5
@@ -937,14 +937,15 @@ static void l2cap_chan_ready(struct l2castatic void l2cap_conn_ready (struct l2cap_conn *conn) {struct l2cap_chan *chan; +struct hci_conn *hcon = conn->hcon;BT_DBG ("conn %p" , conn); -if (!conn->hcon->out && conn->hcon->type ==LE_LINK ) +if (!hcon->out && hcon->type ==LE_LINK )l2cap_le_conn_ready (conn); -if (conn->hcon->out && conn->hcon->type ==LE_LINK ) -smp_conn_security (conn, conn->hcon->pending_sec_level); +if (hcon->out && hcon->type ==LE_LINK ) +smp_conn_security (hcon, hcon->pending_sec_level);mutex_lock (&conn->chan_lock);
@@ -952,8 +953,8 @@ static void l2cap_conn_ready(struct l2cal2cap_chan_lock (chan); -if (conn->hcon->type ==LE_LINK ) { -if (smp_conn_security (conn, chan->sec_level)) +if (hcon->type ==LE_LINK ) { +if (smp_conn_security (hcon, chan->sec_level))l2cap_chan_ready (chan); }else if (chan->chan_type !=L2CAP_CHAN_CONN_ORIENTED ) {
net/bluetooth/l2cap_sock.c +1 -1
@@ -588,7 +588,7 @@ static int l2cap_sock_setsockopt(structbreak ; } -if (smp_conn_security (conn, sec.level)) +if (smp_conn_security (conn->hcon, sec.level))break ; sk->sk_state =BT_CONFIG ; chan->state =BT_CONFIG ;
net/bluetooth/smp.c +2 -2
@@ -753,9 +753,9 @@ static u8 smp_cmd_security_req(struct l2return 0 ; } -int smp_conn_security (struct l2cap_conn *conn,__u8 sec_level) +int smp_conn_security (struct hci_conn *hcon,__u8 sec_level) { -struct hci_conn *hcon = conn->hcon; +struct l2cap_conn *conn = hcon->l2cap_data;struct smp_chan *smp = conn->smp_chan;__u8 authreq;
Greg Kroah-Hartman
maintainerPATCH 176/218 Bluetooth: Fix sending a HCI Authorization Request over LE links
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit d8343f125710fb596f7a88cd756679f14f4e77b9 upstream.
In the case that the link is already in the connected state and a Pairing request arrives from the mgmt interface, hci_conn_security() would be called but it was not considering LE links.
--- net/bluetooth/hci_conn.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/hci_conn.c +4 -0
@@ -42,6 +42,7 @@#include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h> +#include <net/bluetooth/smp.h> static void hci_le_connect (struct hci_conn *conn) {
@@ -661,6 +662,9 @@ int hci_conn_security(struct hci_conn *c {BT_DBG ("conn %p" , conn); +if (conn->type ==LE_LINK ) +return smp_conn_security (conn, sec_level); +/* For sdp we don't need the link key. */ if (sec_level ==BT_SECURITY_SDP )return 1 ;
Greg Kroah-Hartman
maintainerPATCH 177/218 net: Statically initialize init_net.dev_base_head
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rustad, Mark D" <[email protected]>
commit 734b65417b24d6eea3e3d7457e1f11493890ee1d upstream.
This change eliminates an initialization-order hazard most recently seen when netprio_cgroup is built into the kernel.
With thanks to Eric Dumazet for catching a bug.
--- net/core/dev.c | 3 ++- net/core/net_namespace.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
net/core/dev.c +2 -1
@@ -6303,7 +6303,8 @@ static struct hlist_head *netdev_create_/* Initialize per network namespace state */ static int __net_init netdev_init (struct net *net) { -INIT_LIST_HEAD (&net->dev_base_head); +if (net != &init_net) +INIT_LIST_HEAD (&net->dev_base_head); net->dev_name_head =netdev_create_hash ();if (net->dev_name_head ==NULL )
net/core/net_namespace.c +3 -1
@@ -25,7 +25,9 @@ static DEFINE_MUTEX(net_mutex);LIST_HEAD (net_namespace_list);EXPORT_SYMBOL_GPL (net_namespace_list); -struct net init_net; +struct net init_net = { + .dev_base_head =LIST_HEAD_INIT (init_net.dev_base_head), +};EXPORT_SYMBOL (init_net);#define INITIAL_NET_GEN_PTRS 13/* +1 for len +2 for rcu_head */
Greg Kroah-Hartman
maintainerPATCH 178/218 media: cx25821: Remove bad strcpy to read-only char*
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ezequiel Garcia <[email protected]>
commit c854d8883fec59332f0662917f8c94dcfb1c405d upstream.
The strcpy was being used to set the name of the board. This was both wrong and redundant,
since the destination char* was read-only and the name is set statically at compile time.
The type of the name field is changed to const char* to prevent future errors.
--- drivers/media/video/cx25821/cx25821-core.c | 3 --- drivers/media/video/cx25821/cx25821.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/media/video/cx25821/cx25821-core.c +0 -3
@@ -912,9 +912,6 @@ static int cx25821_dev_setup(struct cx25list_add_tail (&dev->devlist, &cx25821_devlist);mutex_unlock (&cx25821_devlist_mutex); -strcpy (cx25821_boards[UNKNOWN_BOARD ].name,"unknown" ); -strcpy (cx25821_boards[CX25821_BOARD ].name,"cx25821" ); -if (dev->pci->device !=0x8210 ) {pr_info ("%s(): Exiting. Incorrect Hardware device = 0x%02x\n" , __func__, dev->pci->device);
drivers/media/video/cx25821/cx25821.h +1 -1
@@ -187,7 +187,7 @@ enum port { };struct cx25821_board { -char *name; +const char *name;enum port porta;enum port portb;enum port portc;
Greg Kroah-Hartman
maintainerPATCH 179/218 Fix a dead loop in async_synchronize_full()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhong <[email protected]>
[Fixed upstream by commits 2955b47d2c1983998a8c5915cb96884e67f7cb53 and a4683487f90bfe3049686fc5c566bdc1ad03ace6 from Dan Williams, but they are much more intrusive than this tiny fix, according to Andrew - gregkh]
This patch tries to fix a dead loop in async_synchronize_full(), which could be seen when preemption is disabled on a single cpu machine.
void async_synchronize_full(void)
{
do {
async_synchronize_cookie(next_cookie);
} while (!list_empty(&async_running) || !list_empty(&async_pending));
}
async_synchronize_cookie() calls async_synchronize_cookie_domain() with &async_running as the default domain to synchronize.
However, there might be some works in the async_pending list from other domains. On a single cpu system, without preemption, there is no chance for the other works to finish, so async_synchronize_full() enters a dead loop.
It seems async_synchronize_full() wants to synchronize all entries in all running lists(domains), so maybe we could just check the entry_count to know whether all works are finished.
Currently, async_synchronize_cookie_domain() expects a non-NULL running list ( if NULL, there would be NULL pointer dereference ), so maybe a NULL pointer could be used as an indication for the functions to synchronize all works in all domains.
--- kernel/async.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/async.c +9 -4
@@ -86,6 +86,13 @@ static async_cookie_t __lowest_in_progress(struct list_head *running) {struct async_entry *entry; +if (!running) {/* just check the entry count */ +if (atomic_read (&entry_count)) +return 0 ;/* smaller than any cookie */ +else +return next_cookie; + } +if (!list_empty (running)) { entry =list_first_entry (running, struct async_entry, list);
@@ -236,9 +243,7 @@ EXPORT_SYMBOL_GPL(async_schedule_domain);*/ void async_synchronize_full (void ) { -do { -async_synchronize_cookie (next_cookie); - }while (!list_empty (&async_running) || !list_empty (&async_pending)); +async_synchronize_cookie_domain (next_cookie,NULL ); }EXPORT_SYMBOL_GPL (async_synchronize_full);
@@ -258,7 +263,7 @@ EXPORT_SYMBOL_GPL(async_synchronize_full_domain);/** * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing * @cookie: async_cookie_t to use as checkpoint -* @running: running list to synchronize on +* @running: running list to synchronize on, NULL indicates all lists * * This function waits until all asynchronous function calls for the * synchronization domain specified by the running list @list submitted
Signature · 1 line
1.7.9.5
Greg Kroah-Hartman
maintainerPATCH 180/218 rds: set correct msg_namelen
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiping Pan <[email protected]>
commit 06b6a1cf6e776426766298d055bb3991957d90a7 upstream.
Jay Fenlason ([email protected]) found a bug,
that recvfrom() on an RDS socket can return the contents of random kernel memory to userspace if it was called with a address length larger than sizeof(struct sockaddr_in).rds_recvmsg() also fails to set the addr_len paramater properly before returning, but that's just a bug.
There are also a number of cases wher recvfrom() can return an entirely bogus address. Anything in rds_recvmsg() that returns a non-negative value but does not go through the "sin = (struct sockaddr_in *)msg->msg_name;" code path at the end of the while(1) loop will return up to 128 bytes of kernel memory to userspace.
And I write two test programs to reproduce this bug, you will see that in rds_server, fromAddr will be overwritten and the following sock_fd will be destroyed.
Yes, it is the programmer's fault to set msg_namelen incorrectly, but it is better to make the kernel copy the real length of address to user space in such case.
How to run the test programs ?
I test them on 32bit x86 system, 3.5.0-rc7.
1 compile
gcc -o rds_client rds_client.c
gcc -o rds_server rds_server.c
2 run ./rds_server on one console
3 run ./rds_client on another console
4 you will see something like:
server is waiting to receive data...
old socket fd=3
server received data from client:data from client
msg.msg_namelen=32
new socket fd=-1067277685sendmsg()
: Bad file descriptor
/***************** rds_client.c ********************/
int main(void)
{
int sock_fd;
struct sockaddr_in serverAddr;
struct sockaddr_in toAddr;
char recvBuffer[128] = "data from client";
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if (sock_fd < 0) {
perror("create socket error\n");
exit(1);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4001);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind() error\n");
close(sock_fd);
exit(1);
}
memset(&toAddr, 0, sizeof(toAddr));
toAddr.sin_family = AF_INET;
toAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
toAddr.sin_port = htons(4000);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = strlen(recvBuffer) + 1;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendto() error\n");
close(sock_fd);
exit(1);
}
printf("client send data:%s\n", recvBuffer);
memset(recvBuffer, '\0', 128);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("receive data from server:%s\n", recvBuffer);
close(sock_fd);
return 0;
}/***************** rds_server.c ********************/
int main(void)
{
struct sockaddr_in fromAddr;
int sock_fd;
struct sockaddr_in serverAddr;
unsigned int addrLen;
char recvBuffer[128];
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if(sock_fd < 0) {
perror("create socket error\n");
exit(0);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4000);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind error\n");
close(sock_fd);
exit(1);
}
printf("server is waiting to receive data...\n");
msg.msg_name = &fromAddr;
/*
* I add 16 to sizeof(fromAddr), ie 32,
* and pay attention to the definition of fromAddr,
* recvmsg() will overwrite sock_fd,
* since kernel will copy 32 bytes to userspace.
*
* If you just use sizeof(fromAddr), it works fine.
* */
msg.msg_namelen = sizeof(fromAddr) + 16;
/* msg.msg_namelen = sizeof(fromAddr); */
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
while (1) {
printf("old socket fd=%d\n", sock_fd);
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("server received data from client:%s\n", recvBuffer);
printf("msg.msg_namelen=%d\n", msg.msg_namelen);
printf("new socket fd=%d\n", sock_fd);
strcat(recvBuffer, "--data from server");
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendmsg()\n");
close(sock_fd);
exit(1);
}
}
close(sock_fd);
return 0;
}--- net/rds/recv.c | 3 +++ 1 file changed, 3 insertions(+)
net/rds/recv.c +3 -0
@@ -410,6 +410,8 @@ int rds_recvmsg(struct kiocb *iocb, strurdsdebug ("size %zu flags 0x%x timeo %ld\n" , size, msg_flags, timeo); + msg->msg_namelen =0 ; +if (msg_flags &MSG_OOB ) goto out;
@@ -485,6 +487,7 @@ int rds_recvmsg(struct kiocb *iocb, stru sin->sin_port = inc->i_hdr.h_sport; sin->sin_addr.s_addr = inc->i_saddr;memset (sin->sin_zero,0 ,sizeof (sin->sin_zero)); + msg->msg_namelen =sizeof (*sin); }break ; }
Greg Kroah-Hartman
maintainerPATCH 181/218 libata: Prevent interface errors with Seagate FreeAgent GoFlex
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel J Blueman <[email protected]>
commit c531077f40abc9f2129c4c83a30b3f8d6ce1c0e7 upstream.
When using my Seagate FreeAgent GoFlex eSATAp external disk enclosure, interface errors are always seen until 1.5Gbps is negotiated [1]. This occurs using any disk in the enclosure, and when the disk is connected directly with a generic passive eSATAp cable, we see stable 3Gbps operation as expected.
Blacklist 3Gbps mode to avoid dataloss and the ~30s delay bus reset and renegotiation incurs.
--- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-core.c +1 -0
@@ -4125,6 +4125,7 @@ static const struct ata_blacklist_entry/* Devices which aren't very happy with higher link speeds */ { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, + { "Seagate FreeAgent GoFlex", NULL, ATA_HORKAGE_1_5_GBPS, },/* * Devices which choke on SETXFER. Applies only if both the
Greg Kroah-Hartman
maintainerPATCH 182/218 r8169: RxConfig hack for the 8168evl.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francois Romieu <[email protected]>
commit eb2dc35d99028b698cdedba4f5522bc43e576bd2 upstream.
The 8168evl (RTL_GIGA_MAC_VER_34) based Gigabyte GA-990FXA motherboards are very prone to NETDEV watchdog problems without this change. See
https://bugzilla.kernel.org/show_bug.cgi?id=42899 for instance.
I don't know why it *works*. It's depressingly effective though.
For the record:
- the problem may go along IOMMU (AMD-Vi) errors but it really looks like a red herring.
- the patch sets the RX_MULTI_EN bit. If the 8168c doc is any guide, the chipset now fetches several Rx descriptors at a time.
- long ago the driver ignored the RX_MULTI_EN bit. e542a2269f232d61270ceddd42b73a4348dee2bb changed the RxConfig settings. Whatever the problem it's now labeled a regression.
- Realtek's own driver can identify two different 8168evl devices (CFG_METHOD_16 and CFG_METHOD_17) where the r8169 driver only sees one. It sucks.
--- drivers/net/ethernet/realtek/r8169.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/r8169.c +1 -0
@@ -3737,6 +3737,7 @@ static void rtl_init_rxcfg(struct rtl816case RTL_GIGA_MAC_VER_22 :case RTL_GIGA_MAC_VER_23 :case RTL_GIGA_MAC_VER_24 : +case RTL_GIGA_MAC_VER_34 :RTL_W32 (RxConfig,RX128_INT_EN |RX_MULTI_EN |RX_DMA_BURST );break ;default :
Greg Kroah-Hartman
maintainerPATCH 183/218 sched: Fix race in task_group()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 8323f26ce3425460769605a6aece7a174edaa7d1 upstream.
Stefan reported a crash on a kernel before a3e5d1091c1 ("sched:
Don't call task_group() too many times in set_task_rq()"), he found the reason to be that the multiple task_group() invocations in set_task_rq() returned different values.
Looking at all that I found a lack of serialization and plain wrong comments.
The below tries to fix it using an extra pointer which is updated under the appropriate scheduler locks. Its not pretty, but I can't really see another way given how all the cgroup stuff works.
--- include/linux/init_task.h | 12 +++++++++++- include/linux/sched.h | 5 ++++- kernel/sched/core.c | 9 ++++++++- kernel/sched/sched.h | 23 ++++++++++------------- 4 files changed, 33 insertions(+), 16 deletions(-)
include/linux/init_task.h +11 -1
@@ -123,8 +123,17 @@ extern struct group_info init_groups;extern struct cred init_cred; +extern struct task_group root_task_group; + +#ifdef CONFIG_CGROUP_SCHED +# define INIT_CGROUP_SCHED (tsk) \ + .sched_task_group = &root_task_group, +#else +# define INIT_CGROUP_SCHED (tsk) +#endif +#ifdef CONFIG_PERF_EVENTS -# define INIT_PERF_EVENTS (tsk) \ +# define INIT_PERF_EVENTS (tsk) \ .perf_event_mutex = \ __MUTEX_INITIALIZER(tsk.perf_event_mutex), \ .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
@@ -161,6 +170,7 @@ extern struct cred init_cred; }, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \ INIT_PUSHABLE_TASKS(tsk) \ +INIT_CGROUP_SCHED (tsk) \ .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ .real_parent = &tsk, \
include/linux/sched.h +4 -1
@@ -1279,6 +1279,9 @@ struct task_struct {const struct sched_class *sched_class;struct sched_entity se;struct sched_rt_entity rt; +#ifdef CONFIG_CGROUP_SCHED +struct task_group *sched_task_group; +#endif #ifdef CONFIG_PREEMPT_NOTIFIERS /* list of struct preempt_notifier: */
@@ -2744,7 +2747,7 @@ extern int sched_group_set_rt_period(strextern long sched_group_rt_period (struct task_group *tg);extern int sched_rt_can_attach (struct task_group *tg,struct task_struct *tsk);#endif -#endif +#endif /* CONFIG_CGROUP_SCHED */ extern int task_can_switch_user (struct user_struct *up,struct task_struct *tsk);
kernel/sched/core.c +8 -1
@@ -1098,7 +1098,7 @@ void set_task_cpu(struct task_struct *p,* a task's CPU. ->pi_lock for waking tasks, rq->lock for runnable tasks. * * sched_move_task() holds both and thus holding either pins the cgroup, -* see set_task_rq(). +* see task_group(). * * Furthermore, all task_rq users should acquire both locks, see * task_rq_lock().
@@ -7427,6 +7427,7 @@ void sched_destroy_group(struct task_gro*/ void sched_move_task (struct task_struct *tsk) { +struct task_group *tg;int on_rq, running;unsigned long flags;struct rq *rq;
@@ -7441,6 +7442,12 @@ void sched_move_task(struct task_structif (unlikely (running)) tsk->sched_class->put_prev_task (rq, tsk); + tg =container_of (task_subsys_state_check (tsk, cpu_cgroup_subsys_id, +lockdep_is_held (&tsk->sighand->siglock)), + struct task_group, css); + tg =autogroup_task_group (tsk, tg); + tsk->sched_task_group = tg; +#ifdef CONFIG_FAIR_GROUP_SCHED if (tsk->sched_class->task_move_group) tsk->sched_class->task_move_group (tsk, on_rq);
kernel/sched/sched.h +10 -13
@@ -536,22 +536,19 @@ DECLARE_PER_CPU(int, sd_llc_id);/* * Return the group to which this tasks belongs. * -* We use task_subsys_state_check() and extend the RCU verification with -* pi->lock and rq->lock because cpu_cgroup_attach() holds those locks for each -* task it moves into the cgroup. Therefore by holding either of those locks, -* we pin the task to the current cgroup. +* We cannot use task_subsys_state() and friends because the cgroup +* subsystem changes that value before the cgroup_subsys::attach() method +* is called, therefore we cannot pin it and might observe the wrong value. +* +* The same is true for autogroup's p->signal->autogroup->tg, the autogroup +* core changes this before calling sched_move_task(). +* +* Instead we use a 'copy' which is updated from sched_move_task() while +* holding both task_struct::pi_lock and rq::lock. */ static inline struct task_group *task_group (struct task_struct *p) { -struct task_group *tg; -struct cgroup_subsys_state *css; - - css =task_subsys_state_check (p, cpu_cgroup_subsys_id, -lockdep_is_held (&p->pi_lock) || -lockdep_is_held (&task_rq (p)->lock)); - tg = container_of(css, struct task_group, css); - -return autogroup_task_group (p, tg); +return p->sched_task_group; }/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
Greg Kroah-Hartman
maintainerPATCH 184/218 mm: sparse: fix usemap allocation above node descriptor section
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit 99ab7b19440a72ebdf225f99b20f8ef40decee86 upstream.
After commit f5bf18fa22f8 ("bootmem/sparsemem: remove limit constraint in alloc_bootmem_section"), usemap allocations may easily be placed outside the optimal section that holds the node descriptor, even if there is space available in that section. This results in unnecessary hotplug dependencies that need to have the node unplugged before the section holding the usemap.
The reason is that the bootmem allocator doesn't guarantee a linear search starting from the passed allocation goal but may start out at a much higher address absent an upper limit.
Fix this by trying the allocation with the limit at the section end, then retry without if that fails. This keeps the fix from f5bf18fa22f8 of not panicking if the allocation does not fit in the section, but still makes sure to try to stay within the section at first.
[rewritten massively by Johannes to apply to 3.4]
--- mm/bootmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
mm/bootmem.c +6 -2
@@ -766,13 +766,17 @@ void * __init alloc_bootmem_section(unsi unsigned long section_nr) {bootmem_data_t *bdata; -unsigned long pfn, goal; +unsigned long pfn, goal, limit; pfn =section_nr_to_pfn (section_nr); goal = pfn <<PAGE_SHIFT ; + limit =section_nr_to_pfn (section_nr +1 ) <<PAGE_SHIFT ; bdata = &bootmem_node_data[early_pfn_to_nid (pfn)]; -return alloc_bootmem_core (bdata, size,SMP_CACHE_BYTES , goal,0 ); +if (goal + size > limit) + limit =0 ; + +return alloc_bootmem_core (bdata, size,SMP_CACHE_BYTES , goal, limit); }#endif
Greg Kroah-Hartman
maintainerPATCH 185/218 media: lirc_sir: make device registration work
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarod Wilson <[email protected]>
commit 4b71ca6bce8fab3d08c61bf330e781f957934ae1 upstream.
For one, the driver device pointer needs to be filled in, or the lirc core will refuse to load the driver. And we really need to wire up all the platform_device bits. This has been tested via the lirc sourceforge tree and verified to work, been sitting there for months, finally getting around to sending it. :\
--- drivers/staging/media/lirc/lirc_sir.c | 60 ++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-)
drivers/staging/media/lirc/lirc_sir.c +58 -2
@@ -52,6 +52,7 @@#include <linux/io.h> #include <asm/irq.h> #include <linux/fcntl.h> +#include <linux/platform_device.h> #ifdef LIRC_ON_SA1100 #include <asm/hardware.h> #ifdef CONFIG_SA1100_COLLIE
@@ -487,9 +488,11 @@ static struct lirc_driver driver = { .owner = THIS_MODULE, }; +static struct platform_device *lirc_sir_dev;static int init_chrdev (void ) { + driver.dev = &lirc_sir_dev->dev; driver.minor =lirc_register_driver (&driver);if (driver.minor <0 ) { printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n");
@@ -1215,20 +1218,71 @@ static int init_lirc_sir(void)return 0 ; } +static int __devinit lirc_sir_probe (struct platform_device *dev) +{ +return 0 ; +} + +static int __devexit lirc_sir_remove(struct platform_device *dev) +{ +return 0 ; +} + +static struct platform_driver lirc_sir_driver = { + .probe = lirc_sir_probe, + .remove =__devexit_p (lirc_sir_remove), + .driver = { + .name ="lirc_sir" , + .owner =THIS_MODULE , + }, +};static int __init lirc_sir_init (void ) {int retval; + retval =platform_driver_register (&lirc_sir_driver); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform driver register " + "failed!\n"); +return -ENODEV ; + } + + lirc_sir_dev =platform_device_alloc ("lirc_dev" ,0 ); +if (!lirc_sir_dev) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device alloc " + "failed!\n"); + retval = -ENOMEM ; + goto pdev_alloc_fail; + } + + retval =platform_device_add (lirc_sir_dev); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device add " + "failed!\n"); + retval = -ENODEV ; + goto pdev_add_fail; + } + retval =init_chrdev ();if (retval <0 ) -return retval; + goto fail; + retval =init_lirc_sir ();if (retval) {drop_chrdev (); -return retval; + goto fail; } +return 0 ; + +fail: +platform_device_del (lirc_sir_dev); +pdev_add_fail: +platform_device_put (lirc_sir_dev); +pdev_alloc_fail: +platform_driver_unregister (&lirc_sir_driver); +return retval; } static void __exit lirc_sir_exit(void)
@@ -1236,6 +1290,8 @@ static void __exit lirc_sir_exit(void)drop_hardware ();drop_chrdev ();drop_port (); +platform_device_unregister (lirc_sir_dev); +platform_driver_unregister (&lirc_sir_driver); printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n"); }
Greg Kroah-Hartman
maintainerPATCH 186/218 time: Improve sanity checking of timekeeping inputs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 4e8b14526ca7fb046a81c94002c1c43b6fdf0e9b upstream.
Unexpected behavior could occur if the time is set to a value large enough to overflow a 64bit ktime_t (which is something larger then the year 2262).
Also unexpected behavior could occur if large negative offsets are injected via adjtimex.
So this patch improves the sanity check timekeeping inputs by improving the timespec_valid() check, and then makes better use of timespec_valid() to make sure we don't set the time to an invalid negative value or one that overflows ktime_t.
Note: This does not protect from setting the time close to overflowing ktime_t and then letting natural accumulation cause the overflow.
--- include/linux/ktime.h | 7 ------- include/linux/time.h | 22 ++++++++++++++++++++-- kernel/time/timekeeping.c | 26 ++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 11 deletions(-)
include/linux/ktime.h +0 -7
@@ -58,13 +58,6 @@ union ktime {typedef union ktime ktime_t ;/* Kill this */ -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#if (BITS_PER_LONG ==64 ) -# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) -#else -# define KTIME_SEC_MAX LONG_MAX -#endif -/* * ktime_t definitions when using the 64-bit scalar representation: */
include/linux/time.h +20 -2
@@ -107,11 +107,29 @@ static inline struct timespec timespec_sreturn ts_delta; } +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#if (BITS_PER_LONG ==64 ) +# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#else +# define KTIME_SEC_MAX LONG_MAX +#endif +/* * Returns true if the timespec is norm, false if denorm: */ -#define timespec_valid (ts) \ - (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) +static inline bool timespec_valid (const struct timespec *ts) +{ +/* Dates before 1970 are bogus */ +if (ts->tv_sec <0 ) +return false; +/* Can't have more nanoseconds then a second */ +if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC ) +return false; +/* Disallow values that could overflow ktime_t */ +if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX ) +return false; +return true; +}extern void read_persistent_clock (struct timespec *ts);extern void read_boot_clock (struct timespec *ts);
kernel/time/timekeeping.c +24 -2
@@ -385,7 +385,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if ((unsigned long )tv->tv_nsec >=NSEC_PER_SEC ) +if (!timespec_valid (tv))return -EINVAL ;write_seqlock_irqsave (&timekeeper.lock, flags);
@@ -420,6 +420,8 @@ EXPORT_SYMBOL(do_settimeofday);int timekeeping_inject_offset (struct timespec *ts) {unsigned long flags; +struct timespec tmp; +int ret =0 ;if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return -EINVAL ;
@@ -428,10 +430,17 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); + tmp =timespec_add (timekeeper.xtime, *ts); +if (!timespec_valid (&tmp)) { + ret = -EINVAL ; + goto error; + } + timekeeper.xtime =timespec_add (timekeeper.xtime, *ts); timekeeper.wall_to_monotonic =timespec_sub (timekeeper.wall_to_monotonic, *ts); +error:/* even if we error out, we forwarded the time, so call update */ timekeeping_update (true);write_sequnlock_irqrestore (&timekeeper.lock, flags);
@@ -439,7 +448,7 @@ int timekeeping_inject_offset(struct tim/* signal hrtimers about time change */ clock_was_set (); -return 0 ; +return ret; }EXPORT_SYMBOL (timekeeping_inject_offset);
@@ -599,7 +608,20 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); +if (!timespec_valid (&now)) { +pr_warn ("WARNING: Persistent clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + now.tv_sec =0 ; + now.tv_nsec =0 ; + } +read_boot_clock (&boot); +if (!timespec_valid (&boot)) { +pr_warn ("WARNING: Boot clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + boot.tv_sec =0 ; + boot.tv_nsec =0 ; + }seqlock_init (&timekeeper.lock);
Greg Kroah-Hartman
maintainerPATCH 187/218 time: Avoid making adjustments if we havent accumulated anything
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit bf2ac312195155511a0f79325515cbb61929898a upstream.
If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE.
--- kernel/time/timekeeping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/time/timekeeping.c +4 -1
@@ -1057,9 +1057,12 @@ static void update_wall_time(void)#else offset = (clock->read (clock) - clock->cycle_last) & clock->mask;#endif +/* Check if there's really nothing to do */ +if (offset < timekeeper.cycle_interval) + goto out; + timekeeper.xtime_nsec = (s64 )timekeeper.xtime.tv_nsec << timekeeper.shift; -/* * With NO_HZ we may have to accumulate many cycle_intervals * (think "ticks") worth of time at once. To do this efficiently,
Greg Kroah-Hartman
maintainerPATCH 188/218 time: Move ktime_t overflow checking into timespec_valid_strict
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit cee58483cf56e0ba355fdd97ff5e8925329aa936 upstream
Andreas Bombe reported that the added ktime_t overflow checking added to timespec_valid in commit 4e8b14526ca7 ("time: Improve sanity checking of timekeeping inputs") was causing problems with X.org because it caused timeouts larger then KTIME_T to be invalid.
Previously, these large timeouts would be clamped to KTIME_MAX and would never expire, which is valid.
This patch splits the ktime_t overflow checking into a new timespec_valid_strict function, and converts the timekeeping codes internal checking to use this more strict function.
--- include/linux/time.h | 7 +++++++ kernel/time/timekeeping.c | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-)
include/linux/time.h +7 -0
@@ -125,6 +125,13 @@ static inline bool timespec_valid(const/* Can't have more nanoseconds then a second */ if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return false; +return true; +} + +static inline bool timespec_valid_strict (const struct timespec *ts) +{ +if (!timespec_valid (ts)) +return false;/* Disallow values that could overflow ktime_t */ if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX )return false;
kernel/time/timekeeping.c +5 -5
@@ -385,7 +385,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if (!timespec_valid (tv)) +if (!timespec_valid_strict (tv))return -EINVAL ;write_seqlock_irqsave (&timekeeper.lock, flags);
@@ -431,7 +431,7 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); tmp =timespec_add (timekeeper.xtime, *ts); -if (!timespec_valid (&tmp)) { +if (!timespec_valid_strict (&tmp)) { ret = -EINVAL ; goto error; }
@@ -608,7 +608,7 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); -if (!timespec_valid (&now)) { +if (!timespec_valid_strict (&now)) {pr_warn ("WARNING: Persistent clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); now.tv_sec =0 ;
@@ -616,7 +616,7 @@ void __init timekeeping_init(void) }read_boot_clock (&boot); -if (!timespec_valid (&boot)) { +if (!timespec_valid_strict (&boot)) {pr_warn ("WARNING: Boot clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); boot.tv_sec =0 ;
@@ -667,7 +667,7 @@ static void update_sleep_time(struct tim*/ static void __timekeeping_inject_sleeptime (struct timespec *delta) { -if (!timespec_valid (delta)) { +if (!timespec_valid_strict (delta)) {printk (KERN_WARNING "__timekeeping_inject_sleeptime: Invalid " "sleep delta value!\n" );return ;
Greg Kroah-Hartman
maintainerPATCH 189/218 media: Avoid sysfs oops when an rc_devs raw device is absent
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Bagnall <[email protected]>
commit 720bb6436ff30fccad05cf5bdf961ea5b1f5686d upstream.
For some reason, when the lirc daemon learns that a usb remote control has been unplugged, it wants to read the sysfs attributes of the disappearing device. This is useful for uncovering transient inconsistencies, but less so for keeping the system running when such inconsistencies exist.
Under some circumstances (like every time I unplug my dvb stick from my laptop), lirc catches an rc_dev whose raw event handler has been removed (presumably by ir_raw_event_unregister), and proceeds to interrogate the raw protocols supported by the NULL pointer.
This patch avoids the NULL dereference, and ignores the issue of how this state of affairs came about in the first place.
Version 2 incorporates changes recommended by Mauro Carvalho Chehab (-ENODEV instead of -EINVAL, and a signed-off-by).
--- drivers/media/rc/rc-main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
@@ -775,10 +775,11 @@ static ssize_t show_protocols(struct devif (dev->driver_type ==RC_DRIVER_SCANCODE ) { enabled = dev->rc_map.rc_type; allowed = dev->allowed_protos; - }else { + }else if (dev->raw) { enabled = dev->raw->enabled_protocols; allowed =ir_raw_get_allowed_protocols (); - } + }else +return -ENODEV ; IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", (long long)allowed,
Greg Kroah-Hartman
maintainerPATCH 190/218 pch_uart: Fix missing break for 16 byte fifo
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 9bc03743fff0770dc5a5324ba92e67cc377f16ca upstream.
Otherwise we fall back to the wrong value.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44091
--- drivers/tty/serial/pch_uart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/pch_uart.c +1 -0
@@ -1255,6 +1255,7 @@ static int pch_uart_startup(struct uart_break ;case 16 : fifo_size =PCH_UART_HAL_FIFO16 ; +break ;case 1 :default : fifo_size =PCH_UART_HAL_FIFO_DIS ;
Greg Kroah-Hartman
maintainerPATCH 191/218 pch_uart: Fix rx error interrupt setting issue
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 9539dfb7ac1c84522fe1f79bb7dac2990f3de44a upstream.
Rx Error interrupt(E.G. parity error) is not enabled. So, when parity error occurs, error interrupt is not occurred. As a result, the received data is not dropped.
This patch adds enable/disable rx error interrupt code.
--- drivers/tty/serial/pch_uart.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/tty/serial/pch_uart.c +12 -6
@@ -754,7 +754,8 @@ static void pch_dma_rx_complete(void *artty_flip_buffer_push (tty);tty_kref_put (tty);async_tx_ack (priv->desc_rx); -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }static void pch_dma_tx_complete (void *arg)
@@ -809,7 +810,8 @@ static int handle_rx_to(struct eg20t_porint rx_size;int ret;if (!priv->start_rx) { -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );return 0 ; } buf = &priv->rxbuf;
@@ -1071,11 +1073,13 @@ static irqreturn_t pch_uart_interrupt(incase PCH_UART_IID_RDR :/* Received Data Ready */ if (priv->use_dma) {pch_uart_hal_disable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); ret =dma_handle_rx (priv);if (!ret)pch_uart_hal_enable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }else { ret =handle_rx (priv); }
@@ -1199,7 +1203,8 @@ static void pch_uart_stop_rx(struct uartstruct eg20t_port *priv; priv = container_of(port, struct eg20t_port, port); priv->start_rx =0 ; -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); priv->int_dis_flag =1 ; }
@@ -1293,7 +1298,8 @@ static int pch_uart_startup(struct uart_pch_request_dma (port); priv->start_rx =1 ; -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );uart_update_timeout (port,CS8 , default_baud);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 192/218 pch_uart: Fix parity setting issue
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 38bd2a1ac736901d1cf4971c78ef952ba92ef78b upstream.
Parity Setting value is reverse.
E.G. In case of setting ODD parity, EVEN value is set. This patch inverts "if" condition.
--- drivers/tty/serial/pch_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +1 -1
@@ -1357,7 +1357,7 @@ static void pch_uart_set_termios(struct stb =PCH_UART_HAL_STB1 ;if (termios->c_cflag &PARENB ) { -if (!(termios->c_cflag &PARODD )) +if (termios->c_cflag &PARODD ) parity =PCH_UART_HAL_PARITY_ODD ;else parity =PCH_UART_HAL_PARITY_EVEN ;
Greg Kroah-Hartman
maintainerPATCH 193/218 powerpc/85xx: p1022ds: disable the NAND flash node if video is enabled
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit 6269f2584a359766f53005c676daff8aee60cbed upstream.
The Freescale P1022 has a unique pin muxing "feature" where the DIU video controller's video signals are muxed with 24 of the local bus address signals. When the DIU is enabled, the bulk of the local bus is disabled, preventing access to memory-mapped devices like NAND flash and the pixis FPGA.
Therefore, if the DIU is going to be enabled, then memory-mapped devices on the localbus, like NAND flash, need to be disabled.
This patch is similar to "powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled", except that it disables the NAND flash node instead. This PIXIS node needs to remain enabled because it is used by platform code to switch into indirect mode.
--- arch/powerpc/platforms/85xx/p1022_ds.c | 38 +++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-)
arch/powerpc/platforms/85xx/p1022_ds.c +29 -9
@@ -435,6 +435,8 @@ static void __init disable_one_node(struprom_update_property (np, new, old); elseprom_add_property (np ,new ); + +pr_info ("p1022ds: disabling %s node\n" , np->full_name); }/* TRUE if there is a "video=fslfb" command-line parameter. */
@@ -499,28 +501,46 @@ static void __init p1022_ds_setup_arch(v diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;/* -* Disable the NOR flash node if there is video=fslfb... command-line -* parameter. When the DIU is active, NOR flash is unavailable, so we -* have to disable the node before the MTD driver loads. +* Disable the NOR and NAND flash nodes if there is video=fslfb... +* command-line parameter. When the DIU is active, the localbus is +* unavailable, so we have to disable these nodes before the MTD +* driver loads. */ if (fslfb) {struct device_node *np =of_find_compatible_node (NULL ,NULL ,"fsl,p1022-elbc" );if (np) { - np =of_find_compatible_node (np,NULL ,"cfi-flash" ); -if (np) { +struct device_node *np2; + +of_node_get (np); + np2 =of_find_compatible_node (np,NULL ,"cfi-flash" ); +if (np2) {static struct property nor_status = { .name ="status" , .value ="disabled" , .length =sizeof ("disabled" ), }; -pr_info ("p1022ds: disabling %s node" , - np->full_name); -disable_one_node (np, &nor_status); -of_node_put (np); +disable_one_node (np2, &nor_status); +of_node_put (np2); + } + +of_node_get (np); + np2 =of_find_compatible_node (np,NULL , +"fsl,elbc-fcm-nand" ); +if (np2) { +static struct property nand_status = { + .name ="status" , + .value ="disabled" , + .length =sizeof ("disabled" ), + }; + +disable_one_node (np2, &nand_status); +of_node_put (np2); } + +of_node_put (np); } }
Greg Kroah-Hartman
maintainerPATCH 194/218 powerpc/85xx: p1022ds: fix DIU/LBC switching with NAND enabled
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit 896c01cb4bb3cfc2c0ea9873fa7a9f8bd0a7c8d8 upstream.
In order for indirect mode on the PIXIS to work properly, both chip selects need to be set to GPCM mode, otherwise writes to the chip select base addresses will not actually post to the local bus -- they'll go to the NAND controller instead. Therefore, we need to set BR0 and BR1 to GPCM mode before switching to indirect mode.
--- arch/powerpc/platforms/85xx/p1022_ds.c | 64 +++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/p1022_ds.c +62 -2
@@ -208,6 +208,7 @@ static void p1022ds_set_monitor_port(enuu8 __iomem *lbc_lcs0_ba =NULL ;u8 __iomem *lbc_lcs1_ba =NULL ;phys_addr_t cs0_addr, cs1_addr; +u32 br0, or0, br1, or1;const __be32 *iprop;unsigned int num_laws;u8 b;
@@ -256,11 +257,70 @@ static void p1022ds_set_monitor_port(enu } num_laws =be32_to_cpup (iprop); - cs0_addr =lbc_br_to_phys (ecm, num_laws,in_be32 (&lbc->bank[0 ].br)); - cs1_addr =lbc_br_to_phys (ecm, num_laws,in_be32 (&lbc->bank[1 ].br)); +/* +* Indirect mode requires both BR0 and BR1 to be set to "GPCM", +* otherwise writes to these addresses won't actually appear on the +* local bus, and so the PIXIS won't see them. +* +* In FCM mode, writes go to the NAND controller, which does not pass +* them to the localbus directly. So we force BR0 and BR1 into GPCM +* mode, since we don't care about what's behind the localbus any +* more. +*/ + br0 =in_be32 (&lbc->bank[0 ].br); + br1 =in_be32 (&lbc->bank[1 ].br); + or0 =in_be32 (&lbc->bank[0 ].or); + or1 =in_be32 (&lbc->bank[1 ].or); + +/* Make sure CS0 and CS1 are programmed */ +if (!(br0 &BR_V ) || !(br1 &BR_V )) { +pr_err ("p1022ds: CS0 and/or CS1 is not programmed\n" ); + goto exit; + } + +/* +* Use the existing BRx/ORx values if it's already GPCM. Otherwise, +* force the values to simple 32KB GPCM windows with the most +* conservative timing. +*/ +if ((br0 &BR_MSEL ) !=BR_MS_GPCM ) { + br0 = (br0 &BR_BA ) |BR_V ; + or0 =0xFFFF8000 |0xFF7 ; +out_be32 (&lbc->bank[0 ].br, br0); +out_be32 (&lbc->bank[0 ].or, or0); + } +if ((br1 &BR_MSEL ) !=BR_MS_GPCM ) { + br1 = (br1 &BR_BA ) |BR_V ; + or1 =0xFFFF8000 |0xFF7 ; +out_be32 (&lbc->bank[1 ].br, br1); +out_be32 (&lbc->bank[1 ].or, or1); + } + + cs0_addr =lbc_br_to_phys (ecm, num_laws, br0); +if (!cs0_addr) { +pr_err ("p1022ds: could not determine physical address for CS0" +" (BR0=%08x)\n" , br0); + goto exit; + } + cs1_addr =lbc_br_to_phys (ecm, num_laws, br1); +if (!cs0_addr) { +pr_err ("p1022ds: could not determine physical address for CS1" +" (BR1=%08x)\n" , br1); + goto exit; + } lbc_lcs0_ba =ioremap (cs0_addr,1 ); +if (!lbc_lcs0_ba) { +pr_err ("p1022ds: could not ioremap CS0 address %llx\n" , + (unsigned long long )cs0_addr); + goto exit; + } lbc_lcs1_ba =ioremap (cs1_addr,1 ); +if (!lbc_lcs1_ba) { +pr_err ("p1022ds: could not ioremap CS1 address %llx\n" , + (unsigned long long )cs1_addr); + goto exit; + }/* Make sure we're in indirect mode first. */ if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
Greg Kroah-Hartman
maintainerPATCH 195/218 pch_uart: Add eg20t_port lock field, avoid recursive spinlocks
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit 2588aba002d14e938c2f56d299ecf3e7ce1302a5 upstream.
pch_uart_interrupt() takes priv->port.lock which leads to two recursive spinlock calls if low_latency==1 or CONFIG_PREEMPT_RT_FULL=y (one otherwise):
pch_uart_interrupt
spin_lock_irqsave(priv->port.lock, flags)
case PCH_UART_IID_RDR_TO (data ready)
handle_rx_to
push_rx
tty_port_tty_get
spin_lock_irqsave(&port->lock, flags) <--- already hold this lock
...
tty_flip_buffer_push
...
flush_to_ldisc
spin_lock_irqsave(&tty->buf.lock)
spin_lock_irqsave(&tty->buf.lock)
disc->ops->receive_buf(tty, char_buf)
n_tty_receive_buf
tty->ops->flush_chars()
uart_flush_chars
uart_start
spin_lock_irqsave(&port->lock) <--- already hold this lockAvoid this by using a dedicated lock to protect the eg20t_port structure and IO access to its membase. This is more consistent with the 8250 driver. Ensure priv->lock is always take prior to priv->port.lock when taken at the same time.
V2: Remove inadvertent whitespace change.
V3: Account for oops_in_progress for the private lock in
pch_console_write().
Note: Like the 8250 driver, if a printk is introduced anywhere inside
the pch_console_write() critical section, the kernel will hang on a recursive spinlock on the private lock. The oops case is handled by using a trylock in the oops_in_progress case.
--- drivers/tty/serial/pch_uart.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
drivers/tty/serial/pch_uart.c +26 -12
@@ -252,6 +252,9 @@ struct eg20t_port {dma_addr_t rx_buf_dma;struct dentry *debugfs; + +/* protect the eg20t_port private structure and io access to membase */ +spinlock_t lock; };/**
@@ -1058,7 +1061,7 @@ static irqreturn_t pch_uart_interrupt(inunsigned int iid;unsigned long flags; -spin_lock_irqsave (&priv->port.lock, flags); +spin_lock_irqsave (&priv->lock, flags); handled =0 ;while ((iid =pch_uart_hal_get_iid (priv)) >1 ) {switch (iid) {
@@ -1111,7 +1114,7 @@ static irqreturn_t pch_uart_interrupt(in priv->int_dis_flag =0 ; } -spin_unlock_irqrestore (&priv->port.lock, flags); +spin_unlock_irqrestore (&priv->lock, flags);return IRQ_RETVAL (handled); }
@@ -1223,9 +1226,9 @@ static void pch_uart_break_ctl(struct uaunsigned long flags; priv = container_of(port, struct eg20t_port, port); -spin_lock_irqsave (&port->lock, flags); +spin_lock_irqsave (&priv->lock, flags);pch_uart_hal_set_break (priv, ctl); -spin_unlock_irqrestore (&port->lock, flags); +spin_unlock_irqrestore (&priv->lock, flags); }/* Grab any interrupt resources and initialise any low level driver state. */
@@ -1375,7 +1378,8 @@ static void pch_uart_set_termios(struct baud =uart_get_baud_rate (port, termios, old,0 , port->uartclk /16 ); -spin_lock_irqsave (&port->lock, flags); +spin_lock_irqsave (&priv->lock, flags); +spin_lock (&port->lock);uart_update_timeout (port, termios->c_cflag, baud); rtn =pch_uart_hal_set_line (priv, baud, parity, bits, stb);
@@ -1388,7 +1392,8 @@ static void pch_uart_set_termios(structtty_termios_encode_baud_rate (termios, baud, baud); out: -spin_unlock_irqrestore (&port->lock, flags); +spin_unlock (&port->lock); +spin_unlock_irqrestore (&priv->lock, flags); }static const char *pch_uart_type (struct uart_port *port)
@@ -1538,8 +1543,9 @@ pch_console_write(struct console *co, co {struct eg20t_port *priv;unsigned long flags; +int priv_locked =1 ; +int port_locked =1 ;u8 ier; -int locked =1 ; priv = pch_uart_ports[co->index];
@@ -1547,12 +1553,16 @@ pch_console_write(struct console *co, colocal_irq_save (flags);if (priv->port.sysrq) { -/* serial8250_handle_port() already took the lock */ - locked =0 ; +spin_lock (&priv->lock); +/* serial8250_handle_port() already took the port lock */ + port_locked =0 ; }else if (oops_in_progress) { - locked =spin_trylock (&priv->port.lock); - }else + priv_locked =spin_trylock (&priv->lock); + port_locked =spin_trylock (&priv->port.lock); + }else { +spin_lock (&priv->lock);spin_lock (&priv->port.lock); + }/* * First save the IER then disable the interrupts
@@ -1570,8 +1580,10 @@ pch_console_write(struct console *co, cowait_for_xmitr (priv,BOTH_EMPTY );iowrite8 (ier, priv->membase +UART_IER ); -if (locked) +if (port_locked)spin_unlock (&priv->port.lock); +if (priv_locked) +spin_unlock (&priv->lock);local_irq_restore (flags); }
@@ -1669,6 +1681,8 @@ static struct eg20t_port *pch_uart_init_pci_enable_msi (pdev);pci_set_master (pdev); +spin_lock_init (&priv->lock); + iobase =pci_resource_start (pdev,0 ); mapbase =pci_resource_start (pdev,1 ); priv->mapbase = mapbase;
Greg Kroah-Hartman
maintainerPATCH 196/218 net: qmi_wwan: Add Vodafone/Huawei K5005 support
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 88c16dc3bb61a1c1e9d4c78f45cc2107bc8d5249 upstream.
--- drivers/net/usb/qmi_wwan.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/usb/qmi_wwan.c +8 -0
@@ -407,6 +407,14 @@ static const struct usb_device_id produc .bInterfaceProtocol = 8, /* NOTE: This is the *slave* interface of the CDC Union! */ .driver_info = (unsigned long)&qmi_wwan_info, }, + {/* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = HUAWEI_VENDOR_ID, + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 56, /* NOTE: This is the *slave* interface of the CDC Union! */ + .driver_info = (unsigned long)&qmi_wwan_info, + }, {/* Huawei E392, E398 and possibly others in "Windows mode" * using a combined control and data interface without any CDC * functional descriptors
Greg Kroah-Hartman
maintainerPATCH 197/218 USB: qmi_wwan: Add ZTE (Vodafone) K3765-Z
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Andrew Bird (Sphere Systems)" <[email protected]>
commit 8965c98fdebedce077257241957b205515dd1a5f upstream.
Add the ZTE (Vodafone) K3765-Z to the whitelist. This requires the previous patch to make the whitelist with forced interface 4 generic or the device fails to initialise. After applying this patch and loading the Option driver without usb-modeswitch's bind all interfaces trick, a wwan0 net interface and /dev/cdc-wdm0 device file were created. Using Bjorn Mork's perl connection script a connection was made to a mobile network using QMI and the network interface's IPv4 address was configured OK.
--- drivers/net/usb/qmi_wwan.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/usb/qmi_wwan.c +9 -0
@@ -480,6 +480,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE (Vodafone) K3765-Z */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x2002, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int4, + }, { /* ZTE (Vodafone) K4505-Z */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
Greg Kroah-Hartman
maintainerPATCH 198/218 net: qmi_wwan: Add Sierra Wireless device IDs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 5e071b5d1aa6928f8d695c15f52a949d70b8d7fb upstream.
Some additional Gobi3K IDs found in the BSD/GPL licensed out-of-tree GobiNet driver from Sierra Wireless.
--- drivers/net/usb/qmi_wwan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/qmi_wwan.c +2 -0
@@ -548,6 +548,8 @@ static const struct usb_device_id produc {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ + {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ + {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ { } /* END */ };MODULE_DEVICE_TABLE (usb, products);
Greg Kroah-Hartman
maintainerPATCH 199/218 net: qmi_wwan: add ZTE MF60
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 6fecd35d4cd79fc75e8290abb86734c18500d2a2 upstream.
Adding a device with limited QMI support. It does not support normal QMI_WDS commands for connection management. Instead, sending a QMI_CTL SET_INSTANCE_ID command is required to enable the network interface:
01 0f 00 00 00 00 00 00 20 00 04 00 01 01 00 00
A number of QMI_DMS and QMI_NAS commands are also supported for optional device management.
--- drivers/net/usb/qmi_wwan.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/usb/qmi_wwan.c +18 -0
@@ -346,6 +346,15 @@ static const struct driver_info qmi_wwan .data = BIT(1), /* interface whitelist bitmap */ }; +static const struct driver_info qmi_wwan_force_int2 = { + .description ="Qualcomm WWAN/QMI device" , + .flags =FLAG_WWAN , + .bind = qmi_wwan_bind_shared, + .unbind = qmi_wwan_unbind_shared, + .manage_power = qmi_wwan_manage_power, + .data =BIT (2 ),/* interface whitelist bitmap */ +}; +static const struct driver_info qmi_wwan_force_int3 = { .description ="Qualcomm WWAN/QMI device" , .flags =FLAG_WWAN ,
@@ -498,6 +507,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE MF60 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x1402, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int2, + }, { /* Sierra Wireless MC77xx in QMI mode */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x1199,
Greg Kroah-Hartman
maintainerPATCH 200/218 net: qmi_wwan: add ZTE MF821D
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit db8dacf953a70274172236957a4b97d4fdb376f0 upstream.
Sold by O2 (telefonica germany) under the name "LTE4G"
--- drivers/net/usb/qmi_wwan.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/usb/qmi_wwan.c +9 -0
@@ -453,6 +453,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE MF821D */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x0326, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int4, + }, { /* ZTE (Vodafone) K3520-Z */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
Greg Kroah-Hartman
maintainerPATCH 201/218 net: qmi_wwan: add Sierra Wireless devices
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bj�rn Mork <[email protected]>
commit 9b469a60d68b13c288d5c3fc23de29d9d482dbe6 upstream.
Add 6 new devices and one modified device, based on information from laptop vendor Windows drivers.
Sony provides a driver with two new devices using a Gobi 2k+ layout (1199:68a5 and 1199:68a9). The Sony driver also adds a non-standard QMI/net interface to the already supported 1199:9011 Gobi device. We do not know whether this is an alternate interface number or an additional interface which might be present, but that doesn't really matter.
Lenovo provides a driver supporting 4 new devices:
- MC7770 (1199:901b) with standard Gobi 2k+ layout
- MC7700 (0f3d:68a2) with layout similar to MC7710
- MC7750 (114f:68a2) with layout similar to MC7710
- EM7700 (1199:901c) with layout similar to MC7710
Note regaring the three devices similar to MC7710:
The Windows drivers only support interface #8 on these devices. The MC7710 can support QMI/net functions on interface #19 and #20 as well, and this driver is verified to work on interface #19 (a firmware bug is suspected to prevent #20 from working).
We do not enable these additional interfaces until they either show up in a Windows driver or are verified to work in some other way. Therefore limiting the new devices to interface #8 for now.
---
for stable: v3.4 and v3.5
drivers/net/usb/qmi_wwan.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/net/usb/qmi_wwan.c +31 -0
@@ -534,6 +534,33 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_sierra, }, + { /* Sierra Wireless MC7700 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x0f3d, + .idProduct = 0x68a2, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, + { /* Sierra Wireless MC7750 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x114f, + .idProduct = 0x68a2, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, + { /* Sierra Wireless EM7700 */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x1199, + .idProduct = 0x901c, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_sierra, + }, /* Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
@@ -561,6 +588,8 @@ static const struct usb_device_id produc {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ + {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ + {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
@@ -577,6 +606,8 @@ static const struct usb_device_id produc {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ + {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ + { } /* END */ };MODULE_DEVICE_TABLE (usb, products);
Greg Kroah-Hartman
maintainerPATCH 202/218 net: qmi_wwan: new devices: UML290 and K5006-Z
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bj�rn Mork <[email protected]>
commit 10cbc1d97a7c7f9ae862fffe27b771ef0da9c461 upstream.
Newer firmware versions for the Pantech UML290 use a different subclass ID. The Windows driver match on both IDs, so we do that as well.
The ZTE (Vodafone) K5006-Z is a new device.
---
for stable: v3.4 and v3.5
drivers/net/usb/qmi_wwan.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/usb/qmi_wwan.c +18 -0
@@ -444,6 +444,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_shared, }, + {/* Pantech UML290 - newer firmware */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x106c, + .idProduct = 0x3718, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xf1, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_shared, + }, { /* ZTE MF820D */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
@@ -516,6 +525,15 @@ static const struct usb_device_id produc .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_force_int4, }, + {/* ZTE (Vodafone) K5006-Z */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x1018, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int3, + }, { /* ZTE MF60 */ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x19d2,
Greg Kroah-Hartman
maintainerPATCH 203/218 mm: avoid swapping out with swappiness==0
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Satoru Moriya <[email protected]>
commit fe35004fbf9eaf67482b074a2e032abb9c89b1dd upstream.
Sometimes we'd like to avoid swapping out anonymous memory. In particular, avoid swapping out pages of important process or process groups while there is a reasonable amount of pagecache on RAM so that we can satisfy our customers' requirements.
OTOH, we can control how aggressive the kernel will swap memory pages with /proc/sys/vm/swappiness for global and /sys/fs/cgroup/memory/memory.swappiness for each memcg.
But with current reclaim implementation, the kernel may swap out even if we set swappiness=0 and there is pagecache in RAM.
This patch changes the behavior with swappiness==0. If we set swappiness==0, the kernel does not swap out completely (for global reclaim until the amount of free pages and filebacked pages in a zone has been reduced to something very very small (nr_free + nr_filebacked < high watermark)).
--- mm/vmscan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/vmscan.c +3 -3
@@ -1983,10 +1983,10 @@ static void get_scan_count(struct mem_cg* proportional to the fraction of recently scanned pages on * each list that were recently referenced and in active use. */ - ap = (anon_prio +1 ) * (reclaim_stat->recent_scanned[0 ] +1 ); + ap = anon_prio * (reclaim_stat->recent_scanned[0 ] +1 ); ap /= reclaim_stat->recent_rotated[0 ] +1 ; - fp = (file_prio +1 ) * (reclaim_stat->recent_scanned[1 ] +1 ); + fp = file_prio * (reclaim_stat->recent_scanned[1 ] +1 ); fp /= reclaim_stat->recent_rotated[1 ] +1 ;spin_unlock_irq (&mz->zone->lru_lock);
@@ -1999,7 +1999,7 @@ out:unsigned long scan; scan =zone_nr_lru_pages (mz, lru); -if (priority || noswap) { +if (priority || noswap || !vmscan_swappiness (mz, sc)) { scan >>= priority;if (!scan && force_scan) scan =SWAP_CLUSTER_MAX ;
Greg Kroah-Hartman
maintainerPATCH 204/218 irq_remap: disable IRQ remapping if any IOAPIC lacks an IOMMU
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit 32ab31e01e2def6f48294d872d9bb42573aae00f upstream.
The ACPI tables in the Macbook Air 5,1 define a single IOAPIC with id 2, but the only remapping unit described in the DMAR table matches id 0. Interrupt remapping fails as a result, and the kernel panics with the message "timer doesn't work through Interrupt-remapped IO-APIC."
To fix this, check each IOAPIC for a corresponding IOMMU. If an IOMMU is not found, do not allow IRQ remapping to be enabled.
v2: Move check to parse_ioapics_under_ir(), raise log level to KERN_ERR,
and add FW_BUG to the log message
v3: Skip check if IOMMU doesn't support interrupt remapping and remove
existing check that the IOMMU count equals the IOAPIC count
--- drivers/iommu/intr_remapping.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/iommu/intr_remapping.c +13 -5
@@ -752,6 +752,7 @@ int __init parse_ioapics_under_ir(void) {struct dmar_drhd_unit *drhd;int ir_supported =0 ; +int ioapic_idx;for_each_drhd_unit (drhd) {struct intel_iommu *iommu = drhd->iommu;
@@ -764,13 +765,20 @@ int __init parse_ioapics_under_ir(void) } } -if (ir_supported && ir_ioapic_num != nr_ioapics) { -printk (KERN_WARNING -"Not all IO-APIC's listed under remapping hardware\n" ); -return -1 ; +if (!ir_supported) +return 0 ; + +for (ioapic_idx =0 ; ioapic_idx < nr_ioapics; ioapic_idx++) { +int ioapic_id =mpc_ioapic_id (ioapic_idx); +if (!map_ioapic_to_ir (ioapic_id)) { +pr_err (FW_BUG "ioapic %d has no mapping iommu, " +"interrupt remapping will be disabled\n" , + ioapic_id); +return -1 ; + } } -return ir_supported; +return 1 ; }int __init ir_dev_scope_init (void )
Greg Kroah-Hartman
maintainerPATCH 205/218 UBI: fix a horrible memory deallocation bug
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit 78b495c39add820ab66ab897af9bd77a5f2e91f6 upstream
UBI was mistakingly using 'kfree()' instead of 'kmem_cache_free()' when freeing "attach eraseblock" structures in vtbl.c. Thankfully, this happened only when we were doing auto-format, so many systems were unaffected. However, there are still many users affected.
It is strange, but the system did not crash and nothing bad happened when the SLUB memory allocator was used. However, in case of SLOB we observed an crash right away.
This problem was introduced in 2.6.39 by commit "6c1e875 UBI: add slab cache for ubi_scan_leb objects"
--- drivers/mtd/ubi/vtbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/ubi/vtbl.c +2 -2
@@ -346,7 +346,7 @@ retry:*/ err =ubi_scan_add_used (ubi, si, new_seb->pnum, new_seb->ec, vid_hdr,0 ); -kfree (new_seb); +kmem_cache_free (si->scan_leb_slab, new_seb);ubi_free_vid_hdr (ubi, vid_hdr);return err;
@@ -359,7 +359,7 @@ write_error:list_add (&new_seb->u.list, &si->erase); goto retry; } -kfree (new_seb); +kmem_cache_free (si->scan_leb_slab, new_seb); out_free:ubi_free_vid_hdr (ubi, vid_hdr);return err;
Greg Kroah-Hartman
maintainerPATCH 206/218 NFSd: introduce nfsd_destroy() helper
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 19f7e2ca44dfc3c1b3f499fc46801f98d403500f upstream.
--- fs/nfsd/nfsctl.c | 8 ++------ fs/nfsd/nfsd.h | 9 +++++++++ fs/nfsd/nfssvc.c | 14 +++----------- 3 files changed, 14 insertions(+), 17 deletions(-)
fs/nfsd/nfsctl.c +2 -6
@@ -663,9 +663,7 @@ static ssize_t __write_ports_addfd(char err =svc_addsock (nfsd_serv, fd, buf,SIMPLE_TRANSACTION_LIMIT );if (err <0 ) { -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);return err; }
@@ -734,9 +732,7 @@ out_close:svc_xprt_put (xprt); } out_err: -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);return err; }
fs/nfsd/nfsd.h +9 -0
@@ -73,6 +73,15 @@ int nfsd_nrpools(void);int nfsd_get_nrthreads (int n,int *);int nfsd_set_nrthreads (int n,int *); +static inline void nfsd_destroy (struct net *net) +{ +int destroy = (nfsd_serv->sv_nrthreads ==1 ); + +if (destroy) +svc_shutdown_net (nfsd_serv, net); +svc_destroy (nfsd_serv); +} +#if defined(CONFIG_NFSD_V2_ACL ) || defined(CONFIG_NFSD_V3_ACL )#ifdef CONFIG_NFSD_V2_ACL extern struct svc_version nfsd_acl_version2;
fs/nfsd/nfssvc.c +3 -11
@@ -427,11 +427,7 @@ int nfsd_set_nrthreads(int n, int *nthreif (err)break ; } - -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); - +nfsd_destroy (net);return err; }
@@ -478,9 +474,7 @@ out_shutdown:if (error <0 && !nfsd_up_before)nfsd_shutdown (); out_destroy: -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv);/* Release server */ +nfsd_destroy (net);/* Release server */ out:mutex_unlock (&nfsd_mutex);return error;
@@ -682,9 +676,7 @@ int nfsd_pool_stats_release(struct inodemutex_lock (&nfsd_mutex);/* this function really, really should have been called svc_put() */ -if (nfsd_serv->sv_nrthreads ==1 ) -svc_shutdown_net (nfsd_serv, net); -svc_destroy (nfsd_serv); +nfsd_destroy (net);mutex_unlock (&nfsd_mutex);return ret; }
Greg Kroah-Hartman
maintainerPATCH 207/218 NFSd: set nfsd_serv to NULL after service destruction
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 57c8b13e3cd0f94944c9691ce7f58e5fcef8a12d upstream.
In nfsd_destroy():
if (destroy) svc_shutdown_net(nfsd_serv, net); svc_destroy(nfsd_server);
svc_shutdown_net(nfsd_serv, net) calls nfsd_last_thread(), which sets nfsd_serv to NULL, causing a NULL dereference on the following line.
--- fs/nfsd/nfsd.h | 2 ++ fs/nfsd/nfssvc.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-)
fs/nfsd/nfsd.h +2 -0
@@ -80,6 +80,8 @@ static inline void nfsd_destroy(struct nif (destroy)svc_shutdown_net (nfsd_serv, net);svc_destroy (nfsd_serv); +if (destroy) + nfsd_serv =NULL ; }#if defined(CONFIG_NFSD_V2_ACL ) || defined(CONFIG_NFSD_V3_ACL )
fs/nfsd/nfssvc.c +5 -5
@@ -254,8 +254,6 @@ static void nfsd_shutdown(void)static void nfsd_last_thread (struct svc_serv *serv,struct net *net) { -/* When last nfsd thread exits we need to do some clean-up */ - nfsd_serv =NULL ;nfsd_shutdown ();svc_rpcb_cleanup (serv, net);
@@ -332,6 +330,7 @@ static int nfsd_get_default_max_blksize(int nfsd_create_serv (void ) {int error; +struct net *net = current->nsproxy->net_ns;WARN_ON (!mutex_is_locked (&nfsd_mutex));if (nfsd_serv) {
@@ -346,7 +345,7 @@ int nfsd_create_serv(void)if (nfsd_serv ==NULL )return -ENOMEM ; - error =svc_bind (nfsd_serv, current->nsproxy->net_ns); + error =svc_bind (nfsd_serv, net);if (error <0 ) {svc_destroy (nfsd_serv);return error;
@@ -557,12 +556,13 @@ nfsd(void *vrqstp) nfsdstats.th_cnt --; out: -if (rqstp->rq_server->sv_nrthreads ==1 ) -svc_shutdown_net (rqstp->rq_server, &init_net); + rqstp->rq_server =NULL ;/* Release the thread */ svc_exit_thread (rqstp); +nfsd_destroy (&init_net); +/* Release module */ mutex_unlock (&nfsd_mutex);module_put_and_exit (0 );
Greg Kroah-Hartman
maintainerPATCH 208/218 kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 9a2e03d8ed518a61154f18d83d6466628e519f94 upstream.
Make the following two non-functional changes.
* Separate out insert_kthread_work() from queue_kthread_work().
* Relocate struct kthread_flush_work and kthread_flush_work_fn() definitions above flush_kthread_work().
v2: Added lockdep_assert_held() in insert_kthread_work() as suggested
by Andy Walls.
--- kernel/kthread.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-)
kernel/kthread.c +26 -16
@@ -378,6 +378,19 @@ repeat: }EXPORT_SYMBOL_GPL (kthread_worker_fn); +/* insert @work before @pos in @worker */ +static void insert_kthread_work (struct kthread_worker *worker, +struct kthread_work *work, +struct list_head *pos) +{ +lockdep_assert_held (&worker->lock); + +list_add_tail (&work->node, pos); + work->queue_seq++; +if (likely (worker->task)) +wake_up_process (worker->task); +} +/** * queue_kthread_work - queue a kthread_work * @worker: target kthread_worker
@@ -395,10 +408,7 @@ bool queue_kthread_work(struct kthread_wspin_lock_irqsave (&worker->lock, flags);if (list_empty (&work->node)) { -list_add_tail (&work->node, &worker->work_list); - work->queue_seq++; -if (likely (worker->task)) -wake_up_process (worker->task); +insert_kthread_work (worker, work, &worker->work_list); ret = true; }spin_unlock_irqrestore (&worker->lock, flags);
@@ -406,6 +416,18 @@ bool queue_kthread_work(struct kthread_w }EXPORT_SYMBOL_GPL (queue_kthread_work); +struct kthread_flush_work { +struct kthread_work work; +struct completion done; +}; + +static void kthread_flush_work_fn (struct kthread_work *work) +{ +struct kthread_flush_work *fwork = + container_of(work, struct kthread_flush_work, work); +complete (&fwork->done); +} +/** * flush_kthread_work - flush a kthread_work * @work: work to flush
@@ -436,18 +458,6 @@ void flush_kthread_work(struct kthread_w }EXPORT_SYMBOL_GPL (flush_kthread_work); -struct kthread_flush_work { -struct kthread_work work; -struct completion done; -}; - -static void kthread_flush_work_fn (struct kthread_work *work) -{ -struct kthread_flush_work *fwork = - container_of(work, struct kthread_flush_work, work); -complete (&fwork->done); -} -/** * flush_kthread_worker - flush all current works on a kthread_worker * @worker: worker to flush
Greg Kroah-Hartman
maintainerPATCH 209/218 kthread_worker: reimplement flush_kthread_work() to allow freeing the work item being executed
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 46f3d976213452350f9d10b0c2780c2681f7075b upstream.
kthread_worker provides minimalistic workqueue-like interface for users which need a dedicated worker thread (e.g. for realtime priority). It has basic queue, flush_work, flush_worker operations which mostly match the workqueue counterparts; however, due to the way flush_work() is implemented, it has a noticeable difference of not allowing work items to be freed while being executed.
While the current users of kthread_worker are okay with the current behavior, the restriction does impede some valid use cases. Also, removing this difference isn't difficult and actually makes the code easier to understand.
This patch reimplements flush_kthread_work() such that it uses a flush_work item instead of queue/done sequence numbers.
--- include/linux/kthread.h | 8 +------ kernel/kthread.c | 52 ++++++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 29 deletions(-)
include/linux/kthread.h +2 -6
@@ -49,8 +49,6 @@ extern int tsk_fork_get_node(struct task* can be queued and flushed using queue/flush_kthread_work() * respectively. Queued kthread_works are processed by a kthread * running kthread_worker_fn(). -* -* A kthread_work can't be freed while it is executing. */ struct kthread_work ;typedef void (*kthread_work_func_t )(struct kthread_work *work);
@@ -59,15 +57,14 @@ struct kthread_worker {spinlock_t lock;struct list_head work_list;struct task_struct *task; +struct kthread_work *current_work; };struct kthread_work {struct list_head node;kthread_work_func_t func;wait_queue_head_t done; -atomic_t flushing; -int queue_seq; -int done_seq; +struct kthread_worker *worker; };#define KTHREAD_WORKER_INIT (worker) { \
@@ -79,7 +76,6 @@ struct kthread_work { .node = LIST_HEAD_INIT((work).node), \ .func = (fn), \ .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ - .flushing = ATOMIC_INIT(0), \ }#define DEFINE_KTHREAD_WORKER (worker) \
kernel/kthread.c +29 -23
77 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 210/218 LockD: pass service to per-net up and down functions
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 4db77695bf5738bdafa83d1b58b64cbecc6f55e7 upstream.
--- fs/lockd/svc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/lockd/svc.c +5 -7
@@ -251,10 +251,9 @@ out_err:return err; } -static int lockd_up_net (struct net *net) +static int lockd_up_net (struct svc_serv *serv,struct net *net) {struct lockd_net *ln =net_generic (net, lockd_net_id); -struct svc_serv *serv = nlmsvc_rqst->rq_server;int error;if (ln->nlmsvc_users++)
@@ -276,10 +275,9 @@ err_rpcb:return error; } -static void lockd_down_net (struct net *net) +static void lockd_down_net (struct svc_serv *serv,struct net *net) {struct lockd_net *ln =net_generic (net, lockd_net_id); -struct svc_serv *serv = nlmsvc_rqst->rq_server;if (ln->nlmsvc_users) {if (--ln->nlmsvc_users ==0 ) {
@@ -307,7 +305,7 @@ int lockd_up(struct net *net)* Check whether we're already up and running. */ if (nlmsvc_rqst) { - error =lockd_up_net (net); + error =lockd_up_net (nlmsvc_rqst->rq_server, net); goto out; }
@@ -378,7 +376,7 @@ out:return error; err_start: -lockd_down_net (net); +lockd_down_net (serv, net); goto destroy_and_out; }EXPORT_SYMBOL_GPL (lockd_up);
@@ -390,7 +388,7 @@ void lockd_down(struct net *net) {mutex_lock (&nlmsvc_mutex); -lockd_down_net (net); +lockd_down_net (nlmsvc_rqst->rq_server, net);if (nlmsvc_users) {if (--nlmsvc_users) goto out;
Greg Kroah-Hartman
maintainerPATCH 211/218 USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joachim Eastwood <[email protected]>
commit 01bb6501779ed0b6dc6c55be34b49eaa6306fdd8 upstream.
Fixes the following NULL pointer dereference:
[ 7.740000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 7.810000] Unable to handle kernel NULL pointer dereference at virtual address 00000028 [ 7.810000] pgd = c3a38000 [ 7.810000] [00000028] *pgd=23a8c831, *pte=00000000, *ppte=00000000 [ 7.810000] Internal error: Oops: 17 [#1] PREEMPT ARM [ 7.810000] Modules linked in: ohci_hcd(+) regmap_i2c snd_pcm usbcore snd_page_alloc at91_cf snd_timer pcmcia_rsrc snd soundcore gpio_keys regmap_spi pcmcia_core usb_common nls_base [ 7.810000] CPU: 0 Not tainted (3.6.0-rc6-mpa+ #264) [ 7.810000] PC is at __gpio_to_irq+0x18/0x40 [ 7.810000] LR is at ohci_hcd_at91_overcurrent_irq+0x24/0xb4 [ohci_hcd] [ 7.810000] pc : [<c01392d4>] lr : [<bf08f694>] psr: 40000093 [ 7.810000] sp : c3a11c40 ip : c3a11c50 fp : c3a11c4c [ 7.810000] r10: 00000000 r9 : c02dcd6e r8 : fefff400 [ 7.810000] r7 : 00000000 r6 : c02cc928 r5 : 00000030 r4 : c02dd168 [ 7.810000] r3 : c02e7350 r2 : ffffffea r1 : c02cc928 r0 : 00000000 [ 7.810000] Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user [ 7.810000] Control: c000717f Table: 23a38000 DAC: 00000015 [ 7.810000] Process modprobe (pid: 285, stack limit = 0xc3a10270) [ 7.810000] Stack: (0xc3a11c40 to 0xc3a12000) [ 7.810000] 1c40: c3a11c6c c3a11c50 bf08f694 c01392cc c3a11c84 c2c38b00 c3806900 00000030 [ 7.810000] 1c60: c3a11ca4 c3a11c70 c0051264 bf08f680 c3a11cac c3a11c80 c003e764 c3806900 [ 7.810000] 1c80: c2c38b00 c02cb05c c02cb000 fefff400 c3806930 c3a11cf4 c3a11cbc c3a11ca8 [ 7.810000] 1ca0: c005142c c005123c c3806900 c3805a00 c3a11cd4 c3a11cc0 c0053f24 c00513e4 [ 7.810000] 1cc0: c3a11cf4 00000030 c3a11cec c3a11cd8 c005120c c0053e88 00000000 00000000 [ 7.810000] 1ce0: c3a11d1c c3a11cf0 c00124d0 c00511e0 01400000 00000001 00000012 00000000 [ 7.810000] 1d00: ffffffff c3a11d94 00000030 00000000 c3a11d34 c3a11d20 c005120c c0012438 [ 7.810000] 1d20: c001dac4 00000012 c3a11d4c c3a11d38 c0009b08 c00511e0 c00523fc 60000013 [ 7.810000] 1d40: c3a11d5c c3a11d50 c0008510 c0009ab4 c3a11ddc c3a11d60 c0008eb4 c00084f0 [ 7.810000] 1d60: 00000000 00000030 00000000 00000080 60000013 bf08f670 c3806900 c2c38b00 [ 7.810000] 1d80: 00000030 c3806930 00000000 c3a11ddc c3a11d88 c3a11da8 c0054190 c00523fc [ 7.810000] 1da0: 60000013 ffffffff c3a11dec c3a11db8 00000000 c2c38b00 bf08f670 c3806900 [ 7.810000] 1dc0: 00000000 00000080 c02cc928 00000030 c3a11e0c c3a11de0 c0052764 c00520d8 [ 7.810000] 1de0: c3a11dfc 00000000 00000000 00000002 bf090f61 00000004 c02cc930 c02cc928 [ 7.810000] 1e00: c3a11e4c c3a11e10 bf090978 c005269c bf090f61 c02cc928 bf093000 c02dd170 [ 7.810000] 1e20: c3a11e3c c02cc930 c02cc930 bf0911d0 bf0911d0 bf093000 c3a10000 00000000 [ 7.810000] 1e40: c3a11e5c c3a11e50 c0155b7c bf090808 c3a11e7c c3a11e60 c0154690 c0155b6c [ 7.810000] 1e60: c02cc930 c02cc964 bf0911d0 c3a11ea0 c3a11e9c c3a11e80 c015484c c01545e8 [ 7.810000] 1e80: 00000000 00000000 c01547e4 bf0911d0 c3a11ec4 c3a11ea0 c0152e58 c01547f4 [ 7.810000] 1ea0: c381b88c c384ab10 c2c10540 bf0911d0 00000000 c02d7518 c3a11ed4 c3a11ec8 [ 7.810000] 1ec0: c01544c0 c0152e0c c3a11efc c3a11ed8 c01536cc c01544b0 bf091075 c3a11ee8 [ 7.810000] 1ee0: bf049af0 bf09120c bf0911d0 00000000 c3a11f1c c3a11f00 c0154e9c c0153628 [ 7.810000] 1f00: bf049af0 bf09120c 000ae190 00000000 c3a11f2c c3a11f20 c0155f58 c0154e04 [ 7.810000] 1f20: c3a11f44 c3a11f30 bf093054 c0155f1c 00000000 00006a4f c3a11f7c c3a11f48 [ 7.810000] 1f40: c0008638 bf093010 bf09120c 000ae190 00000000 c00093c4 00006a4f bf09120c [ 7.810000] 1f60: 000ae190 00000000 c00093c4 00000000 c3a11fa4 c3a11f80 c004fdc4 c000859c [ 7.810000] 1f80: c3a11fa4 000ae190 00006a4f 00016eb8 000ad018 00000080 00000000 c3a11fa8 [ 7.810000] 1fa0: c0009260 c004fd58 00006a4f 00016eb8 000ae190 00006a4f 000ae100 00000000 [ 7.810000] 1fc0: 00006a4f 00016eb8 000ad018 00000080 000adba0 000ad208 00000000 000ad3d8 [ 7.810000] 1fe0: beaf7ae8 beaf7ad8 000172b8 b6e4e940 20000010 000ae190 00000000 00000000 [ 7.810000] Backtrace: [ 7.810000] [<c01392bc>] (__gpio_to_irq+0x0/0x40) from [<bf08f694>] (ohci_hcd_at91_overcurrent_irq+0x24/0xb4 [ohci_hcd]) [ 7.810000] [<bf08f670>] (ohci_hcd_at91_overcurrent_irq+0x0/0xb4 [ohci_hcd]) from [<c0051264>] (handle_irq_event_percpu+0x38/0x1a8) [ 7.810000] r6:00000030 r5:c3806900 r4:c2c38b00 [ 7.810000] [<c005122c>] (handle_irq_event_percpu+0x0/0x1a8) from [<c005142c>] (handle_irq_event+0x58/0x7c) [ 7.810000] [<c00513d4>] (handle_irq_event+0x0/0x7c) from [<c0053f24>] (handle_simple_irq+0xac/0xd8) [ 7.810000] r5:c3805a00 r4:c3806900 [ 7.810000] [<c0053e78>] (handle_simple_irq+0x0/0xd8) from [<c005120c>] (generic_handle_irq+0x3c/0x48) [ 7.810000] r4:00000030 [ 7.810000] [<c00511d0>] (generic_handle_irq+0x0/0x48) from [<c00124d0>] (gpio_irq_handler+0xa8/0xfc) [ 7.810000] r4:00000000 [ 7.810000] [<c0012428>] (gpio_irq_handler+0x0/0xfc) from [<c005120c>] (generic_handle_irq+0x3c/0x48) [ 7.810000] [<c00511d0>] (generic_handle_irq+0x0/0x48) from [<c0009b08>] (handle_IRQ+0x64/0x88) [ 7.810000] r4:00000012 [ 7.810000] [<c0009aa4>] (handle_IRQ+0x0/0x88) from [<c0008510>] (at91_aic_handle_irq+0x30/0x38) [ 7.810000] r5:60000013 r4:c00523fc [ 7.810000] [<c00084e0>] (at91_aic_handle_irq+0x0/0x38) from [<c0008eb4>] (__irq_svc+0x34/0x60) [ 7.810000] Exception stack(0xc3a11d60 to 0xc3a11da8) [ 7.810000] 1d60: 00000000 00000030 00000000 00000080 60000013 bf08f670 c3806900 c2c38b00 [ 7.810000] 1d80: 00000030 c3806930 00000000 c3a11ddc c3a11d88 c3a11da8 c0054190 c00523fc [ 7.810000] 1da0: 60000013 ffffffff [ 7.810000] [<c00520c8>] (__setup_irq+0x0/0x458) from [<c0052764>] (request_threaded_irq+0xd8/0x134) [ 7.810000] [<c005268c>] (request_threaded_irq+0x0/0x134) from [<bf090978>] (ohci_hcd_at91_drv_probe+0x180/0x41c [ohci_hcd]) [ 7.810000] [<bf0907f8>] (ohci_hcd_at91_drv_probe+0x0/0x41c [ohci_hcd]) from [<c0155b7c>] (platform_drv_probe+0x20/0x24) [ 7.810000] [<c0155b5c>] (platform_drv_probe+0x0/0x24) from [<c0154690>] (driver_probe_device+0xb8/0x20c) [ 7.810000] [<c01545d8>] (driver_probe_device+0x0/0x20c) from [<c015484c>] (__driver_attach+0x68/0x88) [ 7.810000] r7:c3a11ea0 r6:bf0911d0 r5:c02cc964 r4:c02cc930 [ 7.810000] [<c01547e4>] (__driver_attach+0x0/0x88) from [<c0152e58>] (bus_for_each_dev+0x5c/0x9c) [ 7.810000] r6:bf0911d0 r5:c01547e4 r4:00000000 [ 7.810000] [<c0152dfc>] (bus_for_each_dev+0x0/0x9c) from [<c01544c0>] (driver_attach+0x20/0x28) [ 7.810000] r7:c02d7518 r6:00000000 r5:bf0911d0 r4:c2c10540 [ 7.810000] [<c01544a0>] (driver_attach+0x0/0x28) from [<c01536cc>] (bus_add_driver+0xb4/0x22c) [ 7.810000] [<c0153618>] (bus_add_driver+0x0/0x22c) from [<c0154e9c>] (driver_register+0xa8/0x144) [ 7.810000] r7:00000000 r6:bf0911d0 r5:bf09120c r4:bf049af0 [ 7.810000] [<c0154df4>] (driver_register+0x0/0x144) from [<c0155f58>] (platform_driver_register+0x4c/0x60) [ 7.810000] r7:00000000 r6:000ae190 r5:bf09120c r4:bf049af0 [ 7.810000] [<c0155f0c>] (platform_driver_register+0x0/0x60) from [<bf093054>] (ohci_hcd_mod_init+0x54/0x8c [ohci_hcd]) [ 7.810000] [<bf093000>] (ohci_hcd_mod_init+0x0/0x8c [ohci_hcd]) from [<c0008638>] (do_one_initcall+0xac/0x174) [ 7.810000] r4:00006a4f [ 7.810000] [<c000858c>] (do_one_initcall+0x0/0x174) from [<c004fdc4>] (sys_init_module+0x7c/0x1a0) [ 7.810000] [<c004fd48>] (sys_init_module+0x0/0x1a0) from [<c0009260>] (ret_fast_syscall+0x0/0x2c) [ 7.810000] r7:00000080 r6:000ad018 r5:00016eb8 r4:00006a4f [ 7.810000] Code: e24cb004 e59f3028 e1a02000 e7930180 (e5903028) [ 7.810000] ---[ end trace 85aa37ed128143b5 ]--- [ 7.810000] Kernel panic - not syncing: Fatal exception in interrupt
Commit 6fffb77c (USB: ohci-at91: fix PIO handling in relation with number of ports) started setting unused pins to EINVAL. But this exposed a bug in the ohci_hcd_at91_overcurrent_irq function where the gpio was used without being checked to see if it is valid.
This patches fixed the issue by adding the gpio valid check.
--- drivers/usb/host/ohci-at91.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-at91.c +2 -1
@@ -466,7 +466,8 @@ static irqreturn_t ohci_hcd_at91_overcur/* From the GPIO notifying the over-current situation, find * out the corresponding port */ at91_for_each_port (port) { -if (gpio_to_irq (pdata->overcurrent_pin[port]) == irq) { +if (gpio_is_valid (pdata->overcurrent_pin[port]) && +gpio_to_irq (pdata->overcurrent_pin[port]) == irq) { gpio = pdata->overcurrent_pin[port];break ; }
Greg Kroah-Hartman
maintainerPATCH 212/218 USB: Fix race condition when removing host controllers
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 0d00dc2611abbe6ad244d50569c2ee82ce42846c upstream.
This patch (as1607) fixes a race that can occur if a USB host controller is removed while a process is reading the /sys/kernel/debug/usb/devices file.
The usb_device_read() routine uses the bus->root_hub pointer to determine whether or not the root hub is registered. The is not a valid test, because the pointer is set before the root hub gets registered and remains set even after the root hub is unregistered and deallocated. As a result, usb_device_read() or usb_device_dump() can access freed memory, causing an oops.
The patch changes the test to use the hcd->rh_registered flag, which does get set and cleared at the appropriate times. It also makes sure to hold the usb_bus_list_lock mutex while setting the flag, so that usb_device_read() will become aware of new root hubs as soon as they are registered.
--- drivers/usb/core/devices.c | 2 +- drivers/usb/core/hcd.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/core/devices.c +1 -1
@@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct fi/* print devices for all busses */ list_for_each_entry (bus, &usb_bus_list, bus_list) {/* recurse through all children of the root hub */ -if (!bus->root_hub) +if (!bus_to_hcd (bus)->rh_registered)continue ;usb_lock_device (bus->root_hub); ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos,
drivers/usb/core/hcd.c +2 -4
@@ -1002,10 +1002,7 @@ static int register_root_hub(struct usb_if (retval) {dev_err (parent_dev,"can't register root hub for %s, %d\n" ,dev_name (&usb_dev->dev), retval); - } -mutex_unlock (&usb_bus_list_lock); - -if (retval ==0 ) { + }else {spin_lock_irq (&hcd_root_hub_lock); hcd->rh_registered =1 ;spin_unlock_irq (&hcd_root_hub_lock);
@@ -1014,6 +1011,7 @@ static int register_root_hub(struct usb_if (HCD_DEAD (hcd))usb_hc_died (hcd);/* This time clean up */ } +mutex_unlock (&usb_bus_list_lock);return retval; }
Greg Kroah-Hartman
maintainerPATCH 213/218 ASoC: wm2000: Correct register size
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d0e12f3ff3472cbd8f52d3c0e6ee07a841787c40 upstream.
--- sound/soc/codecs/wm2000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm2000.c +1 -1
@@ -692,7 +692,7 @@ static int wm2000_resume(struct snd_soc_#endif static const struct regmap_config wm2000_regmap = { - .reg_bits =8 , + .reg_bits =16 , .val_bits =8 , };
Greg Kroah-Hartman
maintainerPATCH 214/218 gpio-lpc32xx: Fix value handling of gpio_direction_output()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Stigge <[email protected]>
commit b1268d3737c6316016026245eef276eda6b0a621 upstream.
For GPIOs of gpio-lpc32xx, gpio_direction_output() ignores the value argument (initial value of output). This patch fixes this by setting the level accordingly.
--- drivers/gpio/gpio-lpc32xx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpio-lpc32xx.c +5 -0
@@ -304,6 +304,7 @@ static int lpc32xx_gpio_dir_output_p012( {struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); +__set_gpio_level_p012 (group, pin, value);__set_gpio_dir_p012 (group, pin,0 );return 0 ;
@@ -314,6 +315,7 @@ static int lpc32xx_gpio_dir_output_p3(st {struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); +__set_gpio_level_p3 (group, pin, value);__set_gpio_dir_p3 (group, pin,0 );return 0 ;
@@ -322,6 +324,9 @@ static int lpc32xx_gpio_dir_output_p3(ststatic int lpc32xx_gpio_dir_out_always (struct gpio_chip *chip,unsigned pin,int value) { +struct lpc32xx_gpio_chip *group =to_lpc32xx_gpio (chip); + +__set_gpo_level_p3 (group, pin, value);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 215/218 drm/udl: limit modes to the sku pixel limits.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 3a75885848996baab5276ff37ebf7295c3c753f0 upstream.
Otherwise when X starts we commonly get a black screen scanning out nothing, its wierd dpms on/off from userspace brings it back,
With this on F18, multi-seat works again with my 1920x1200 monitor which is above the sku limit for the device I have.
--- drivers/gpu/drm/udl/udl_connector.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/udl/udl_connector.c +7 -0
@@ -69,6 +69,13 @@ static int udl_get_modes(struct drm_connstatic int udl_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { +struct udl_device *udl = connector->dev->dev_private; +if (!udl->sku_pixel_limit) +return 0 ; + +if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit) +return MODE_VIRTUAL_Y ; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 216/218 drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID reads
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6 upstream.
GMBUS was enabled over bit-banging as the default in commits:
commit c3dfefa0a6d235bd465309e12f4c56ea16e71111
Author: Daniel Vetter <[email protected]> Date: Tue Feb 14 22:37:25 2012 +0100
drm/i915: reenable gmbus on gen3+ again
and
commit 0fb3f969c8683505fb7323c06bf8a999a5a45a15
Author: Daniel Vetter <[email protected]> Date: Fri Mar 2 19:38:30 2012 +0100
drm/i915: enable gmbus on gen2
Unfortunately, GMBUS seems to fail on some CRT displays. Add a bit-banging fallback to CRT EDID reads.
LKML-Reference: <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=45881
--- drivers/gpu/drm/i915/intel_crt.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +33 -3
@@ -266,6 +266,36 @@ static bool intel_crt_detect_hotplug(strreturn ret; } +static struct edid *intel_crt_get_edid (struct drm_connector *connector, +struct i2c_adapter *i2c) +{ +struct edid *edid; + + edid =drm_get_edid (connector, i2c); + +if (!edid && !intel_gmbus_is_forced_bit (i2c)) { +DRM_DEBUG_KMS ("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n" ); +intel_gmbus_force_bit (i2c, true); + edid =drm_get_edid (connector, i2c); +intel_gmbus_force_bit (i2c, false); + } + +return edid; +} + +/* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */ +static int intel_crt_ddc_get_modes (struct drm_connector *connector, +struct i2c_adapter *adapter) +{ +struct edid *edid; + + edid =intel_crt_get_edid (connector, adapter); +if (!edid) +return 0 ; + +return intel_connector_update_modes (connector, edid); +} +static bool intel_crt_detect_ddc (struct drm_connector *connector) {struct intel_crt *crt =intel_attached_crt (connector);
@@ -279,7 +309,7 @@ static bool intel_crt_detect_ddc(structstruct edid *edid;bool is_digital = false; - edid =drm_get_edid (connector, + edid =intel_crt_get_edid (connector, &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);/* * This may be a DVI-I connector with a shared DDC
@@ -477,13 +507,13 @@ static int intel_crt_get_modes(struct drstruct drm_i915_private *dev_priv = dev->dev_private;int ret; - ret =intel_ddc_get_modes (connector, + ret =intel_crt_ddc_get_modes (connector, &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);if (ret || !IS_G4X (dev))return ret;/* Try to probe digital port for output in DVI-I -> VGA mode. */ -return intel_ddc_get_modes (connector, +return intel_crt_ddc_get_modes (connector, &dev_priv->gmbus[GMBUS_PORT_DPB ].adapter); }
Greg Kroah-Hartman
maintainerPATCH 217/218 vmwgfx: corruption in vmw_event_fence_action_create()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 68c4fce737c4b963e336435f225621dc21138397 upstream.
We don't allocate enough data for this struct. As soon as we start modifying event->event on the next lines, then we're going beyond the end of the memory we allocated.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
@@ -1018,7 +1018,7 @@ int vmw_event_fence_action_create(struct } - event =kzalloc (sizeof (event->event),GFP_KERNEL ); + event =kzalloc (sizeof (*event),GFP_KERNEL );if (unlikely (event ==NULL )) {DRM_ERROR ("Failed to allocate an event.\n" ); ret = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 218/218 Revert: drm/i915: correctly order the ring init sequence
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 57ecc93ce680b1ace1f9e79d588dabe32353202c which really is commit 0d8957c8a90bbb5d34fab9a304459448a5131e06 upstream as it has been reported to cause problems in the 3.4.y kernel series.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -5
@@ -258,6 +258,8 @@ static int init_ring_common(struct intelI915_WRITE_HEAD (ring,0 ); ring->write_tail (ring,0 ); +/* Initialize the ring. */ +I915_WRITE_START (ring, obj->gtt_offset); head =I915_READ_HEAD (ring) &HEAD_ADDR ;/* G45 ring initialization fails to reset head to zero */
@@ -283,11 +285,6 @@ static int init_ring_common(struct intel } } -/* Initialize the ring. This must happen _after_ we've cleared the ring -* registers with the above sequence (the readback of the HEAD registers -* also enforces ordering), otherwise the hw might lose the new ring -* register values. */ -I915_WRITE_START (ring, obj->gtt_offset);I915_WRITE_CTL (ring, ((ring->size -PAGE_SIZE ) &RING_NR_PAGES ) |RING_VALID );