Linux 3.8.13.8 stable review
Subsystems (48)
This is the start of the review cycle for the Linux 3.8.13.8 stable kernel.
This version contains 58 new patches, summarized below. The new patches are posted as replies to this message and also available in this git branch:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.8.y-review;a=shortlog
git://kernel.ubuntu.com/ubuntu/linux.git linux-3.8.y-review
The review period for version 3.8.13.8 will be open for the next three days. To report a problem, please reply to the relevant follow-up patch message.
For more information about the Linux 3.8.y.z extended stable kernel version, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .
-Kamal
--
arch/arm/boot/dts/at91sam9n12ek.dts | 4 +- arch/arm/include/asm/tlb.h | 34 +++------- arch/arm/kernel/entry-armv.S | 3 + arch/arm/kernel/perf_event.c | 3 + arch/arm/kernel/traps.c | 23 ++++--- arch/arm/mach-davinci/board-dm355-leopard.c | 1 + arch/arm/mach-davinci/board-dm644x-evm.c | 1 + arch/arm/mach-davinci/board-dm646x-evm.c | 1 + arch/arm/mach-davinci/board-neuros-osd2.c | 1 + arch/arm/mm/Kconfig | 37 ++++++++++ arch/arm64/include/asm/tlb.h | 7 +- arch/arm64/kernel/perf_event.c | 10 ++- arch/ia64/include/asm/tlb.h | 50 ++++---------- arch/m68k/emu/natfeat.c | 23 +++++-- arch/m68k/include/asm/div64.h | 9 +-- arch/s390/include/asm/tlb.h | 8 ++- arch/sh/include/asm/tlb.h | 6 +- arch/um/include/asm/tlb.h | 6 +- arch/x86/kernel/sys_x86_64.c | 2 +- arch/x86/mm/mmap.c | 6 +- drivers/ata/libata-pmp.c | 12 ++-- drivers/ata/sata_fsl.c | 5 +- drivers/block/rbd.c | 2 +- drivers/bluetooth/ath3k.c | 10 +++ drivers/bluetooth/btusb.c | 5 ++ drivers/gpu/drm/i915/i915_dma.c | 9 +-- drivers/gpu/drm/i915/i915_drv.c | 48 ++++++------- drivers/gpu/drm/i915/i915_drv.h | 4 +- drivers/gpu/drm/i915/i915_irq.c | 3 +- drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/intel_display.c | 102 ++++++++++++++++++---------- drivers/gpu/drm/i915/intel_fb.c | 2 +- drivers/gpu/drm/i915/intel_panel.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++ drivers/md/raid1.c | 2 +- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- drivers/net/wireless/hostap/hostap_ioctl.c | 4 +- drivers/net/wireless/iwlegacy/4965-mac.c | 16 ++--- drivers/net/wireless/iwlegacy/common.c | 1 + drivers/net/wireless/iwlwifi/dvm/mac80211.c | 5 +- drivers/net/wireless/iwlwifi/pcie/trans.c | 10 +-- drivers/net/wireless/zd1201.c | 4 +- drivers/of/fdt.c | 2 + drivers/platform/olpc/olpc-ec.c | 2 +- drivers/s390/scsi/zfcp_erp.c | 29 ++++++-- drivers/s390/scsi/zfcp_qdio.c | 8 +-- drivers/usb/core/quirks.c | 6 ++ drivers/usb/host/ehci-sched.c | 13 ++-- drivers/usb/misc/adutux.c | 2 +- drivers/usb/serial/keyspan.c | 2 +- drivers/usb/serial/mos7720.c | 21 ++++-- drivers/usb/serial/mos7840.c | 2 +- drivers/usb/serial/ti_usb_3410_5052.c | 9 +-- drivers/usb/serial/usb_wwan.c | 20 +++--- drivers/xen/events.c | 13 +++- fs/bio.c | 32 ++++++--- fs/exec.c | 4 +- fs/exofs/ore.c | 2 +- fs/exofs/ore_raid.c | 2 +- fs/ext4/ext4_jbd2.c | 8 +-- fs/nilfs2/segbuf.c | 5 +- include/asm-generic/tlb.h | 19 +----- include/linux/bio.h | 17 ++++- include/linux/mm_types.h | 1 + include/linux/wait.h | 57 ++++++++++++++++ mm/bounce.c | 2 +- mm/hugetlb.c | 2 +- mm/memory.c | 42 ++++++------ mm/mmap.c | 4 +- net/mac80211/mlme.c | 2 +- net/mac80211/pm.c | 2 +- net/wireless/core.c | 74 +++++++++++--------- net/wireless/core.h | 3 + net/wireless/rdev-ops.h | 7 +- net/wireless/sysfs.c | 25 +++++-- sound/pci/hda/patch_realtek.c | 1 + sound/soc/codecs/cs42l52.c | 2 +- sound/soc/tegra/tegra30_i2s.c | 2 +- sound/usb/6fire/midi.c | 16 ++++- sound/usb/6fire/midi.h | 6 +- sound/usb/6fire/pcm.c | 41 ++++++++++- sound/usb/6fire/pcm.h | 2 +- 82 files changed, 649 insertions(+), 357 deletions(-)
AceLan Kao (2):
Bluetooth: Add support for Atheros [0cf3:3121]
Bluetooth: Add support for Atheros [0cf3:e003]
Alan Stern (1):
USB: EHCI: accept very late isochronous URBs
Andreas Schwab (1):
m68k: Truncate base in do_div()
Anthony Foiani (1):
sata_fsl: save irqs while coalescing
Ben Widawsky (1):
drm/i915: Move num_pipes to intel info
Brian Austin (1):
ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume
Chris Wilson (2):
drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code drm/i915: Invalidate TLBs for the rings after a reset
Chris Wright (1):
mac80211: fix infinite loop in ieee80211_determine_chantype
Dan Carpenter (1):
Hostap: copying wrong data prism2_ioctl_giwaplist()
Daniel Drake (1):
drivers/platform/olpc/olpc-ec.c: initialise earlier
David Vrabel (2):
xen/events: initialize local per-cpu mask for all possible events xen/events: mask events when changing their VCPU binding
Emmanuel Grumbach (1):
iwlwifi: pcie: disable L1 Active after pci_enable_device
Geert Uytterhoeven (1):
m68k/atari: ARAnyM - Fix NatFeat module support
Guenter Roeck (1):
s390: Fix broken build
Jan Kara (1):
jbd2: Fix use after free after error in jbd2_journal_dirty_metadata()
Johan Hovold (5):
USB: mos7840: fix big-endian probe
USB: adutux: fix big-endian device-type reporting
USB: ti_usb_3410_5052: fix big-endian firmware handling
USB: mos7720: fix broken control requests
USB: keyspan: fix null-deref at disconnect and release
Johannes Berg (1):
cfg80211: fix P2P GO interface teardown
Jussi Kivilinna (1):
zd1201: do not use stack as URB transfer_buffer
Kent Overstreet (1):
block: Add bio_for_each_segment_all()
Linus Torvalds (1):
Fix TLB gather virtual address range invalidation corner cases
Martin Peschke (2):
[SCSI] zfcp: fix lock imbalance by reworking request queue locking [SCSI] zfcp: fix schedule-inside-lock in scsi_device list loops
Matt Burtch (1):
USB-Serial: Fix error handling of usb_wwan
Nicolas Ferre (1):
ARM: at91/DT: fix at91sam9n12ek memory node
Nicolas Pitre (1):
ARM: 7816/1: CONFIG_KUSER_HELPERS: fix help text
Noguchi Kazutosi (1):
Bluetooth: Add support for Foxconn/Hon Hai [0489:e04d]
Oliver Neukum (1):
usb: add two quirky touchscreen
Peter Zijlstra (1):
arch, mm: Remove tlb_fast_mode()
Radu Caragea (1):
x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member
Roland Dreier (1):
[SCSI] sg: Fix user memory corruption when SG_IO is interrupted by a signal
Russell King (1):
ARM: allow kuser helpers to be removed from the vector page
Sekhar Nori (1):
ARM: davinci: nand: specify ecc strength
Stanislaw Gruszka (4):
cfg80211/mac80211: disconnect on suspend
iwl4965: set power mode early
iwl4965: reset firmware after rfkill off
iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL
Stephane Grosjean (1):
can: pcan_usb: fix wrong memcpy() bytes length
Stephen Warren (1):
ASoC: tegra: fix Tegra30 I2S capture parameter setup
Sujith Manoharan (1):
Bluetooth: ath3k: Add support for ID 0x13d3/0x3402
Takashi Iwai (1):
ALSA: hda - Add a fixup for Gateway LT27
Terry Suereth (1):
libata: apply behavioral quirks to sil3826 PMP
Thomas Loo (1):
Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330]
Torsten Schenk (2):
ALSA: 6fire: make buffers DMA-able (pcm)
ALSA: 6fire: make buffers DMA-able (midi)
Vineet Gupta (1):
mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots
Vyacheslav Dubeyko (2):
nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection
Will Deacon (3):
ARM: 7809/1: perf: fix event validation for software group leaders
arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
arm64: perf: fix event validation for software group leaders
Wladislav Wiebe (1):
of: fdt: fix memory initialization for expanded DT
PATCH 1/58 mac80211: fix infinite loop in ieee80211_determine_chantype
3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wright <[email protected]>
commit b56e4b857c5210e848bfb80e074e5756a36cd523 upstream.
Commit "3d9646d mac80211: fix channel selection bug" introduced a possible infinite loop by moving the out target above the chandef_downgrade while loop. When we downgrade to NL80211_CHAN_WIDTH_20_NOHT, we jump back up to re-run the while loop...indefinitely. Replace goto with break and carry on. This may not be sufficient to connect to the AP, but will at least keep the cpu from livelocking. Thanks to Derek Atkins as an extra pair of debugging eyes.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -3410,7 +3410,7 @@ out:if (WARN_ON (chandef->width ==NL80211_CHAN_WIDTH_20_NOHT )) { ret =IEEE80211_STA_DISABLE_HT |IEEE80211_STA_DISABLE_VHT ; - goto out; +break ; } ret |=chandef_downgrade (chandef);
Signature · 1 line
1.8.1.2
PATCH 2/58 cfg80211/mac80211: disconnect on suspend
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 8125696991194aacb1173b6e8196d19098b44e17 upstream.
If possible that after suspend, cfg80211 will receive request to disconnect what require action on interface that was removed during suspend.
Problem can manifest itself by various warnings similar to below one:
WARNING: at net/mac80211/driver-ops.h:12 ieee80211_bss_info_change_notify+0x2f9/0x300 [mac80211]() wlan0: Failed check-sdata-in-driver check, flags: 0x4 Call Trace: [<c043e0b3>] warn_slowpath_fmt+0x33/0x40 [<f83707c9>] ieee80211_bss_info_change_notify+0x2f9/0x300 [mac80211] [<f83a660a>] ieee80211_recalc_ps_vif+0x2a/0x30 [mac80211] [<f83a6706>] ieee80211_set_disassoc+0xf6/0x500 [mac80211] [<f83a9441>] ieee80211_mgd_deauth+0x1f1/0x280 [mac80211] [<f8381b36>] ieee80211_deauth+0x16/0x20 [mac80211] [<f8261e70>] cfg80211_mlme_down+0x70/0xc0 [cfg80211] [<f8264de1>] __cfg80211_disconnect+0x1b1/0x1d0 [cfg80211]
To fix the problem disconnect from any associated network before suspend. User space is responsible to establish connection again after resume. This basically need to be done by user space anyway, because associated stations can go away during suspend (for example NetworkManager disconnects on suspend and connect on resume by default).
Patch also handle situation when driver refuse to suspend with wowlan configured and try to suspend again without it.
--- net/mac80211/pm.c | 2 +- net/wireless/core.c | 73 +++++++++++++++++++++++++++---------------------- net/wireless/core.h | 3 ++ net/wireless/rdev-ops.h | 7 +++-- net/wireless/sysfs.c | 25 +++++++++++++---- 5 files changed, 69 insertions(+), 41 deletions(-)
net/mac80211/pm.c +1 -1
@@ -92,7 +92,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)return err; }else if (err >0 ) {WARN_ON (err !=1 ); - local->wowlan = false; +return err; }else {list_for_each_entry (sdata, &local->interfaces, list) {cancel_work_sync (&sdata->work);
net/wireless/core.c +41 -32
85 lines not on this page · raw message
net/wireless/core.h +3 -0
@@ -481,6 +481,9 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,void cfg80211_update_iface_num (struct cfg80211_registered_device *rdev,enum nl80211_iftype iftype,int num); +void cfg80211_leave (struct cfg80211_registered_device *rdev, +struct wireless_dev *wdev); +#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10#ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS
net/wireless/rdev-ops.h +4 -3
@@ -6,11 +6,12 @@#include "core.h" #include "trace.h" -static inline int rdev_suspend (struct cfg80211_registered_device *rdev) +static inline int rdev_suspend (struct cfg80211_registered_device *rdev, +struct cfg80211_wowlan *wowlan) {int ret; -trace_rdev_suspend (&rdev->wiphy, rdev->wowlan); - ret = rdev->ops->suspend (&rdev->wiphy, rdev->wowlan); +trace_rdev_suspend (&rdev->wiphy, wowlan); + ret = rdev->ops->suspend (&rdev->wiphy, wowlan);trace_rdev_return_int (&rdev->wiphy, ret);return ret; }
net/wireless/sysfs.c +20 -5
@@ -83,6 +83,14 @@ static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static void cfg80211_leave_all (struct cfg80211_registered_device *rdev) +{ +struct wireless_dev *wdev; + +list_for_each_entry (wdev, &rdev->wdev_list, list) +cfg80211_leave (rdev, wdev); +} +static int wiphy_suspend (struct device *dev,pm_message_t state) {struct cfg80211_registered_device *rdev =dev_to_rdev (dev);
@@ -90,12 +98,19 @@ static int wiphy_suspend(struct device *dev, pm_message_t state) rdev->suspend_at =get_seconds (); -if (rdev->ops->suspend) { -rtnl_lock (); -if (rdev->wiphy.registered) - ret =rdev_suspend (rdev); -rtnl_unlock (); +rtnl_lock (); +if (rdev->wiphy.registered) { +if (!rdev->wowlan) +cfg80211_leave_all (rdev); +if (rdev->ops->suspend) + ret =rdev_suspend (rdev, rdev->wowlan); +if (ret ==1 ) { +/* Driver refuse to configure wowlan */ +cfg80211_leave_all (rdev); + ret =rdev_suspend (rdev,NULL ); + } } +rtnl_unlock ();return ret; }
Signature · 1 line
1.8.1.2
PATCH 3/58 cfg80211: fix P2P GO interface teardown
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 74418edec915d0f446debebde08d170c7b8ba0ee upstream.
When a P2P GO interface goes down, cfg80211 doesn't properly tear it down, leading to warnings later. Add the GO interface type to the enumeration to tear it down like AP interfaces. Otherwise, we leave it pending and mac80211's state can get very confused, leading to warnings later.
--- net/wireless/core.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/core.c +1 -0
@@ -841,6 +841,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,cfg80211_leave_mesh (rdev, dev);break ;case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_P2P_GO :cfg80211_stop_ap (rdev, dev);break ;default :
Signature · 1 line
1.8.1.2
PATCH 4/58 iwl4965: set power mode early
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit eca396d7a5bdcc1fd67b1b12f737c213ac78a6f4 upstream.
If device was put into a sleep and system was restarted or module reloaded, we have to wake device up before sending other commands. Otherwise it will fail to start with Microcode error.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +3 -3
@@ -5287,6 +5287,9 @@ il4965_alive_start(struct il_priv *il) il->active_rate =RATES_MASK ; +il_power_update_mode (il, true); +D_INFO ("Updated power mode\n" ); +if (il_is_associated (il)) {struct il_rxon_cmd *active_rxon = (struct il_rxon_cmd *)&il->active;
@@ -5317,9 +5320,6 @@ il4965_alive_start(struct il_priv *il)D_INFO ("ALIVE processing complete.\n" );wake_up (&il->wait_command_queue); -il_power_update_mode (il, true); -D_INFO ("Updated power mode\n" ); -return ; restart:
Signature · 1 line
1.8.1.2
PATCH 5/58 iwl4965: reset firmware after rfkill off
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 788f7a56fce1bcb2067b62b851a086fca48a0056 upstream.
Using rfkill switch can make firmware unstable, what cause various Microcode errors and kernel warnings. Reseting firmware just after rfkill off (radio on) helped with that.
Resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=977053
--- drivers/net/wireless/iwlegacy/4965-mac.c | 10 +++++----- drivers/net/wireless/iwlegacy/common.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +5 -5
@@ -4413,12 +4413,12 @@ il4965_irq_tasklet(struct il_priv *il)* is killed. Hence update the killswitch state here. The * rfkill handler will care about restarting if needed. */ -if (!test_bit (S_ALIVE , &il->status)) { -if (hw_rf_kill) -set_bit (S_RFKILL , &il->status); -else -clear_bit (S_RFKILL , &il->status); +if (hw_rf_kill) { +set_bit (S_RFKILL , &il->status); + }else { +clear_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rf_kill); +il_force_reset (il, true); } handled |=CSR_INT_BIT_RF_KILL ;
drivers/net/wireless/iwlegacy/common.c +1 -0
@@ -4659,6 +4659,7 @@ il_force_reset(struct il_priv *il, bool external)return 0 ; } +EXPORT_SYMBOL (il_force_reset); int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
Signature · 1 line
1.8.1.2
PATCH 6/58 ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Austin <[email protected]>
commit e2c98a8bba958045bde861fe1d66be54315c7790 upstream.
Beep Volume Min/Max was backwards.
Change to SOC_SONGLE_SX_TLV for correct volume representation
--- sound/soc/codecs/cs42l52.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42l52.c +1 -1
@@ -449,7 +449,7 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {SOC_ENUM ("Beep Pitch" , beep_pitch_enum),SOC_ENUM ("Beep on Time" , beep_ontime_enum),SOC_ENUM ("Beep off Time" , beep_offtime_enum), -SOC_SINGLE_TLV ("Beep Volume" ,CS42L52_BEEP_VOL ,0 ,0x1f ,0x07 , hl_tlv), +SOC_SINGLE_SX_TLV ("Beep Volume" ,CS42L52_BEEP_VOL ,0 ,0x07 ,0x1f , hl_tlv),SOC_SINGLE ("Beep Mixer Switch" ,CS42L52_BEEP_TONE_CTL ,5 ,1 ,1 ),SOC_ENUM ("Beep Treble Corner Freq" , beep_treble_enum), SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum),
Signature · 1 line
1.8.1.2
PATCH 7/58 can: pcan_usb: fix wrong memcpy() bytes length
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Grosjean <[email protected]>
commit 3c322a56b01695df15c70bfdc2d02e0ccd80654e upstream.
Fix possibly wrong memcpy() bytes length since some CAN records received from PCAN-USB could define a DLC field in range [9..15].
In that case, the real DLC value MUST be used to move forward the record pointer but, only 8 bytes max. MUST be copied into the data field of the struct can_frame object of the skb given to the network core.
--- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb.c +1 -1
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)if ((mc->ptr + rec_len) > mc->end) goto decode_failed; -memcpy (cf->data, mc->ptr, rec_len); +memcpy (cf->data, mc->ptr, cf->can_dlc); mc->ptr += rec_len; }
Signature · 1 line
1.8.1.2
PATCH 8/58 ALSA: 6fire: make buffers DMA-able (pcm)
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Torsten Schenk <[email protected]>
commit 5ece263f1d93fba8d992e67e3ab8a71acf674db9 upstream.
Patch makes pcm buffers DMA-able by allocating each one separately.
--- sound/usb/6fire/pcm.c | 41 ++++++++++++++++++++++++++++++++++++++++- sound/usb/6fire/pcm.h | 2 +- 2 files changed, 41 insertions(+), 2 deletions(-)
sound/usb/6fire/pcm.c +40 -1
@@ -580,6 +580,33 @@ static void usb6fire_pcm_init_urb(struct pcm_urb *urb, urb->instance.number_of_packets =PCM_N_PACKETS_PER_URB ; } +static int usb6fire_pcm_buffers_init (struct pcm_runtime *rt) +{ +int i; + +for (i =0 ; i <PCM_N_URBS ; i++) { + rt->out_urbs[i].buffer =kzalloc (PCM_N_PACKETS_PER_URB + *PCM_MAX_PACKET_SIZE ,GFP_KERNEL ); +if (!rt->out_urbs[i].buffer) +return -ENOMEM ; + rt->in_urbs[i].buffer =kzalloc (PCM_N_PACKETS_PER_URB + *PCM_MAX_PACKET_SIZE ,GFP_KERNEL ); +if (!rt->in_urbs[i].buffer) +return -ENOMEM ; + } +return 0 ; +} + +static void usb6fire_pcm_buffers_destroy (struct pcm_runtime *rt) +{ +int i; + +for (i =0 ; i <PCM_N_URBS ; i++) { +kfree (rt->out_urbs[i].buffer); +kfree (rt->in_urbs[i].buffer); + } +} +int usb6fire_pcm_init (struct sfire_chip *chip) {int i;
@@ -591,6 +618,13 @@ int usb6fire_pcm_init(struct sfire_chip *chip)if (!rt)return -ENOMEM ; + ret =usb6fire_pcm_buffers_init (rt); +if (ret) { +usb6fire_pcm_buffers_destroy (rt); +kfree (rt); +return ret; + } + rt->chip = chip; rt->stream_state =STREAM_DISABLED ; rt->rate =ARRAY_SIZE (rates);
@@ -612,6 +646,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip) ret =snd_pcm_new (chip->card,"DMX6FireUSB" ,0 ,1 ,1 , &pcm);if (ret <0 ) { +usb6fire_pcm_buffers_destroy (rt);kfree (rt); snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n");return ret;
@@ -627,6 +662,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)snd_dma_continuous_data (GFP_KERNEL ), MAX_BUFSIZE, MAX_BUFSIZE);if (ret) { +usb6fire_pcm_buffers_destroy (rt);kfree (rt); snd_printk(KERN_ERR PREFIX "error preallocating pcm buffers.\n");
@@ -671,6 +707,9 @@ void usb6fire_pcm_abort(struct sfire_chip *chip)void usb6fire_pcm_destroy (struct sfire_chip *chip) { -kfree (chip->pcm); +struct pcm_runtime *rt = chip->pcm; + +usb6fire_pcm_buffers_destroy (rt); +kfree (rt); chip->pcm =NULL ; }
sound/usb/6fire/pcm.h +1 -1
@@ -32,7 +32,7 @@ struct pcm_urb {struct urb instance;struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB ];/* END DO NOT SEPARATE */ -u8 buffer[PCM_N_PACKETS_PER_URB *PCM_MAX_PACKET_SIZE ]; +u8 *buffer;struct pcm_urb *peer; };
Signature · 1 line
1.8.1.2
PATCH 9/58 ALSA: 6fire: make buffers DMA-able (midi)
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Torsten Schenk <[email protected]>
commit 4c2aee0032b70083dafebd733ed9c774633b2fa3 upstream.
Patch makes midi output buffer DMA-able by allocating it separately.
--- sound/usb/6fire/midi.c | 16 +++++++++++++++- sound/usb/6fire/midi.h | 6 +----- 2 files changed, 16 insertions(+), 6 deletions(-)
sound/usb/6fire/midi.c +15 -1
@@ -19,6 +19,10 @@#include "chip.h" #include "comm.h" +enum { +MIDI_BUFSIZE =64 +}; +static void usb6fire_midi_out_handler (struct urb *urb) {struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip)if (!rt)return -ENOMEM ; + rt->out_buffer =kzalloc (MIDI_BUFSIZE ,GFP_KERNEL ); +if (!rt->out_buffer) { +kfree (rt); +return -ENOMEM ; + } + rt->chip = chip; rt->in_received = usb6fire_midi_in_received; rt->out_buffer[0 ] =0x80 ;/* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip) ret =snd_rawmidi_new (chip->card,"6FireUSB" ,0 ,1 ,1 , &rt->instance);if (ret <0 ) { +kfree (rt->out_buffer);kfree (rt); snd_printk(KERN_ERR PREFIX "unable to create midi.\n");return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)void usb6fire_midi_destroy (struct sfire_chip *chip) { -kfree (chip->midi); +struct midi_runtime *rt = chip->midi; + +kfree (rt->out_buffer); +kfree (rt); chip->midi =NULL ; }
sound/usb/6fire/midi.h +1 -5
@@ -16,10 +16,6 @@#include "common.h" -enum { -MIDI_BUFSIZE =64 -}; -struct midi_runtime {struct sfire_chip *chip;struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime {struct snd_rawmidi_substream *out;struct urb out_urb;u8 out_serial;/* serial number of out packet */ -u8 out_buffer[MIDI_BUFSIZE ]; +u8 *out_buffer;int buffer_offset;void (*in_received)(struct midi_runtime *rt,u8 *data,int length);
Signature · 1 line
1.8.1.2
PATCH 10/58 jbd2: Fix use after free after error in jbd2_journal_dirty_metadata()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 91aa11fae1cf8c2fd67be0609692ea9741cdcc43 upstream.
When jbd2_journal_dirty_metadata() returns error, __ext4_handle_dirty_metadata() stops the handle. However callers of this function do not count with that fact and still happily used now freed handle. This use after free can result in various issues but very likely we oops soon.
The motivation of adding __ext4_journal_stop() into __ext4_handle_dirty_metadata() in commit 9ea7a0df seems to be only to improve error reporting. So replace __ext4_journal_stop() with ext4_journal_abort_handle() which was there before that commit and add WARN_ON_ONCE() to dump stack to provide useful information.
--- fs/ext4/ext4_jbd2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ext4/ext4_jbd2.c +4 -4
@@ -109,10 +109,10 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,if (ext4_handle_valid (handle)) { err =jbd2_journal_dirty_metadata (handle, bh); -if (err) { -/* Errors can only happen if there is a bug */ - handle->h_err = err; -__ext4_journal_stop (where, line, handle); +/* Errors can only happen if there is a bug */ +if (WARN_ON_ONCE (err)) { +ext4_journal_abort_handle (where, line, __func__, bh, + handle, err); } }else {if (inode)
Signature · 1 line
1.8.1.2
PATCH 11/58 USB: EHCI: accept very late isochronous URBs
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 24f531371de17010f2b1b57d90e42240032e7733 upstream.
Since commits 4005ad4390bf (EHCI: implement new semantics for URB_ISO_ASAP) and c75c5ab575af (ALSA: USB: adjust for changed 3.8 USB API) became widely distributed, people have been experiencing problems with audio transfers. The slightest underrun causes complete failure, requiring the audio stream to be restarted.
It turns out that the current isochronous API doesn't handle underruns in the best way. The ALSA developers would much rather have transfers that are submitted too late be accepted and complete in the normal fashion, rather than being refused outright.
This patch implements the requested approach. When an isochronous URB submission is so late that all its scheduled slots have already expired, a debugging message will be printed in the log and the URB will be accepted as usual. Assuming it was submitted by a completion handler (which is normally the case), it will complete shortly thereafter with all the usb_iso_packet_descriptor status fields marked -EXDEV.
This fixes (for ehci-hcd)
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1191603
It should be applied to all kernels that include commit 4005ad4390bf.
--- drivers/usb/host/ehci-sched.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-sched.c +6 -7
@@ -1394,21 +1394,20 @@ iso_stream_schedule (/* Behind the scheduling threshold? */ if (unlikely (start < next)) { +unsigned now2 = (now - base) & (mod -1 );/* USB_ISO_ASAP: Round up to the first available slot */ if (urb->transfer_flags &URB_ISO_ASAP ) start += (next - start + period -1 ) & -period;/* -* Not ASAP: Use the next slot in the stream. If -* the entire URB falls before the threshold, fail. +* Not ASAP: Use the next slot in the stream, +* no matter what. */ -else if (start + span - period < next) { -ehci_dbg (ehci,"iso urb late %p (%u+%u < %u)\n" , +else if (start + span - period < now2) { +ehci_dbg (ehci,"iso underrun %p (%u+%u < %u)\n" , urb, start + base, - span - period, next + base); - status = -EXDEV ; - goto fail; + span - period, now2 + base); } }
Signature · 1 line
1.8.1.2
PATCH 12/58 USB-Serial: Fix error handling of usb_wwan
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Burtch <[email protected]>
commit 6c1ee66a0b2bdbd64c078fba684d640cf2fd38a9 upstream.
This fixes an issue where the bulk-in urb used for incoming data transfer is not resubmitted if the packet recieved contains an error status. This results in the driver locking until the port is closed and re-opened.
Tested on a custom board with a Cinterion GSM module.
--- drivers/usb/serial/usb_wwan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/usb/serial/usb_wwan.c +10 -10
@@ -296,18 +296,18 @@ static void usb_wwan_indat_callback(struct urb *urb)dev_dbg (dev,"%s: empty read urb received\n" , __func__);tty_kref_put (tty); } - -/* Resubmit urb so we continue receiving */ - err =usb_submit_urb (urb,GFP_ATOMIC ); -if (err) { -if (err != -EPERM ) { -dev_err (dev,"%s: resubmit read urb failed. (%d)\n" , __func__, err); -/* busy also in error unless we are killed */ -usb_mark_last_busy (port->serial->dev); - } - }else { + } +/* Resubmit urb so we continue receiving */ + err =usb_submit_urb (urb,GFP_ATOMIC ); +if (err) { +if (err != -EPERM ) { +dev_err (dev,"%s: resubmit read urb failed. (%d)\n" , + __func__, err); +/* busy also in error unless we are killed */ usb_mark_last_busy (port->serial->dev); } + }else { +usb_mark_last_busy (port->serial->dev); } }
Signature · 1 line
1.8.1.2
PATCH 13/58 USB: mos7840: fix big-endian probe
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d551ec9b690f3de65b0091a2e767f1382adc792d upstream.
Fix bug in device-type detection on big-endian machines originally introduced by commit 0eafe4de ("USB: serial: mos7840: add support for MCS7810 devices") which always matched on little-endian product ids.
--- drivers/usb/serial/mos7840.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/mos7840.c +1 -1
@@ -2325,7 +2325,7 @@ static int mos7810_check(struct usb_serial *serial)static int mos7840_probe (struct usb_serial *serial,const struct usb_device_id *id) { -u16 product = serial->dev->descriptor.idProduct; +u16 product =le16_to_cpu (serial->dev->descriptor.idProduct);u8 *buf;int device_type;
Signature · 1 line
1.8.1.2
PATCH 14/58 USB: adutux: fix big-endian device-type reporting
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d482b9d558602a9cacab063b1c8779f9b5214da7 upstream.
Make sure the reported device-type on big-endian machines is the same as on little-endian ones.
--- drivers/usb/misc/adutux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/adutux.c +1 -1
@@ -829,7 +829,7 @@ static int adu_probe(struct usb_interface *interface,/* let the user know what node this device is now attached to */ dev_info (&interface->dev,"ADU%d %s now attached to /dev/usb/adutux%d\n" , - udev->descriptor.idProduct, dev->serial_number, +le16_to_cpu (udev->descriptor.idProduct), dev->serial_number, (dev->minor -ADU_MINOR_BASE )); exit:dbg (2 ," %s : leave, return value %p (dev)" , __func__, dev);
Signature · 1 line
1.8.1.2
PATCH 15/58 USB: ti_usb_3410_5052: fix big-endian firmware handling
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e877dd2f2581628b7119df707d4cf03d940cff49 upstream.
Fix endianess bugs in firmware handling introduced by commits cb7a7c6a ("ti_usb_3410_5052: add Multi-Tech modem support") and 05a3d905 ("ti_usb_3410_5052: support alternate firmware") which made the driver use the wrong firmware for certain devices on big-endian machines.
--- drivers/usb/serial/ti_usb_3410_5052.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/ti_usb_3410_5052.c +5 -4
@@ -1627,14 +1627,15 @@ static int ti_download_firmware(struct ti_device *tdev)char buf[32 ];/* try ID specific firmware first, then try generic firmware */ -sprintf (buf,"ti_usb-v%04x-p%04x.fw" , dev->descriptor.idVendor, - dev->descriptor.idProduct); +sprintf (buf,"ti_usb-v%04x-p%04x.fw" , +le16_to_cpu (dev->descriptor.idVendor), +le16_to_cpu (dev->descriptor.idProduct)); status =request_firmware (&fw_p, buf, &dev->dev);if (status !=0 ) { buf[0 ] ='\0' ; -if (dev->descriptor.idVendor ==MTS_VENDOR_ID ) { -switch (dev->descriptor.idProduct) { +if (le16_to_cpu (dev->descriptor.idVendor) ==MTS_VENDOR_ID ) { +switch (le16_to_cpu (dev->descriptor.idProduct)) {case MTS_CDMA_PRODUCT_ID :strcpy (buf,"mts_cdma.fw" );break ;
Signature · 1 line
1.8.1.2
PATCH 16/58 ARM: 7809/1: perf: fix event validation for software group leaders
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit c95eb3184ea1a3a2551df57190c81da695e2144b upstream.
It is possible to construct an event group with a software event as a group leader and then subsequently add a hardware event to the group. This results in the event group being validated by adding all members of the group to a fake PMU and attempting to allocate each event on their respective PMU.
Unfortunately, for software events wthout a corresponding arm_pmu, this results in a kernel crash attempting to dereference the ->get_event_idx function pointer.
This patch fixes the problem by checking explicitly for software events and ignoring those in event validation (since they can always be scheduled). We will probably want to revisit this for 3.12, since the validation checks don't appear to work correctly when dealing with multiple hardware PMUs anyway.
--- arch/arm/kernel/perf_event.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/kernel/perf_event.c +3 -0
@@ -266,6 +266,9 @@ validate_event(struct pmu_hw_events *hw_events,struct arm_pmu *armpmu =to_arm_pmu (event->pmu);struct pmu *leader_pmu = event->group_leader->pmu; +if (is_software_event (event)) +return 1 ; +if (event->pmu != leader_pmu || event->state <PERF_EVENT_STATE_OFF )return 1 ;
Signature · 1 line
1.8.1.2
PATCH 17/58 m68k/atari: ARAnyM - Fix NatFeat module support
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit e8184e10f89736a23ea6eea8e24cd524c5c513d2 upstream.
As pointed out by Andreas Schwab, pointers passed to ARAnyM NatFeat calls should be physical addresses, not virtual addresses.
Fortunately on Atari, physical and virtual kernel addresses are the same, as long as normal kernel memory is concerned, so this usually worked fine without conversion.
But for modules, pointers to literal strings are located in vmalloc()ed memory. Depending on the version of ARAnyM, this causes the nf_get_id() call to just fail, or worse, crash ARAnyM itself with e.g.
Gotcha! Illegal memory access. Atari PC = $968c
This is a big issue for distro kernels, who want to have all drivers as loadable modules in an initrd.
Add a wrapper for nf_get_id() that copies the literal to the stack to work around this issue.
--- arch/m68k/emu/natfeat.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
arch/m68k/emu/natfeat.c +19 -4
@@ -18,9 +18,11 @@#include <asm/machdep.h> #include <asm/natfeat.h> +extern long nf_get_id2 (const char *feature_name); + asm("\n" -" .global nf_get_id,nf_call\n" -"nf_get_id:\n" +" .global nf_get_id2,nf_call\n" +"nf_get_id2:\n" " .short 0x7300\n" " rts\n" "nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n""1: moveq.l #0,%d0\n" " rts\n" " .section __ex_table,\"a\"\n" -" .long nf_get_id,1b\n" +" .long nf_get_id2,1b\n" " .long nf_call,1b\n" " .previous"); -EXPORT_SYMBOL_GPL (nf_get_id);EXPORT_SYMBOL_GPL (nf_call); +long nf_get_id (const char *feature_name) +{ +/* feature_name may be in vmalloc()ed memory, so make a copy */ +char name_copy[32 ]; +size_t n; + + n =strlcpy (name_copy, feature_name,sizeof (name_copy)); +if (n >=sizeof (name_copy)) +return 0 ; + +return nf_get_id2 (name_copy); +} +EXPORT_SYMBOL_GPL (nf_get_id); +void nfprint (const char *fmt, ...) {static char buf[256 ];
Signature · 1 line
1.8.1.2
PATCH 18/58 m68k: Truncate base in do_div()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit ea077b1b96e073eac5c3c5590529e964767fc5f7 upstream.
Explicitly truncate the second operand of do_div() to 32 bits to guard against bogus code calling it with a 64-bit divisor.
[Thorsten]
After upgrading from 3.2 to 3.10, mounting a btrfs volume fails with:
btrfs: setting nodatacow, compression disabled
btrfs: enabling auto recovery
btrfs: disk space caching is enabled
*** ZERO DIVIDE *** FORMAT=2
Current process id is 722
BAD KERNEL TRAP: 00000000
Modules linked in: evdev mac_hid ext4 crc16 jbd2 mbcache btrfs xor lzo_compress zlib_deflate raid6_pq crc32c libcrc32c
PC: [<319535b2>] __btrfs_map_block+0x11c/0x119a [btrfs]
SR: 2000 SP: 30c1fab4 a2: 30f0faf0
d0: 00000000 d1: 00001000 d2: 00000000 d3: 00000000
d4: 00010000 d5: 00000000 a0: 3085c72c a1: 3085c72c
Process mount (pid: 722, task=30f0faf0)
Frame format=2 instr addr=319535ae
Stack from 30c1faec:
00000000 00000020 00000000 00001000 00000000 01401000 30253928 300ffc00
00a843ac 3026f640 00000000 00010000 0009e250 00d106c0 00011220 00000000
00001000 301c6830 0009e32a 000000ff 00000009 3085c72c 00000000 00000000
30c1fd14 00000000 00000020 00000000 30c1fd14 0009e26c 00000020 00000003
00000000 0009dd8a 300b0b6c 30253928 00a843ac 00001000 00000000 00000000
0000a008 3194e76a 30253928 00a843ac 00001000 00000000 00000000 00000002
Call Trace: [<00001000>] kernel_pg_dir+0x0/0x1000[...]
Code: 222e ff74 2a2e ff5c 2c2e ff60 4c45 1402 <2d40> ff64 2d41 ff68 2205 4c2e 1800 ff68 4c04 0800 2041 d1c0 2206 4c2e 1400 ff68
[Geert]
As diagnosed by Andreas, fs/btrfs/volumes.c:__btrfs_map_block() calls
do_div(stripe_nr, stripe_len);
with stripe_len u64, while do_div() assumes the divisor is a 32-bit number.
Due to the lack of truncation in the m68k-specific implementation of do_div(), the division is performed using the upper 32-bit word of stripe_len, which is zero.
This was introduced by commit 53b381b3abeb86f12787a6c40fee9b2f71edc23b ("Btrfs: RAID5 and RAID6"), which changed the divisor from map->stripe_len (struct map_lookup.stripe_len is int) to a 64-bit temporary.
--- arch/m68k/include/asm/div64.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/m68k/include/asm/div64.h +5 -4
@@ -15,16 +15,17 @@unsigned long long n64; \ } __n; \unsigned long __rem, __upper; \ +unsigned long __base = (base); \ \ __n.n64 = (n); \if ((__upper = __n.n32[0 ])) { \ asm ("divul.l %2,%1:%0" \ - :"=d" (__n.n32[0 ]),"=d" (__upper) \ - :"d" (base),"0" (__n.n32[0 ])); \ + :"=d" (__n.n32[0 ]),"=d" (__upper) \ + :"d" (__base),"0" (__n.n32[0 ])); \ } \ asm ("divu.l %2,%1:%0" \ - :"=d" (__n.n32[1 ]),"=d" (__rem) \ - :"d" (base),"1" (__upper),"0" (__n.n32[1 ])); \ + :"=d" (__n.n32[1 ]),"=d" (__rem) \ + :"d" (__base),"1" (__upper),"0" (__n.n32[1 ])); \ (n) = __n.n64; \ __rem; \ })
Signature · 1 line
1.8.1.2
PATCH 19/58 usb: add two quirky touchscreen
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 304ab4ab079a8ed03ce39f1d274964a532db036b upstream.
These devices tend to become unresponsive after S3
--- drivers/usb/core/quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/core/quirks.c +6 -0
@@ -78,6 +78,12 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x04d8, 0x000c), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* CarrolTouch 4000U */ + { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME }, + + /* CarrolTouch 4500U */ + { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Samsung Android phone modem - ID conflict with SPH-I500 */ { USB_DEVICE(0x04e8, 0x6601), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Signature · 1 line
1.8.1.2
PATCH 20/58 USB: mos7720: fix broken control requests
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit ef6c8c1d733e244f0499035be0dabe1f4ed98c6f upstream.
The parallel-port code of the drivers used a stack allocated control-request buffer for asynchronous (and possibly deferred) control requests. This not only violates the no-DMA-from-stack requirement but could also lead to corrupt control requests being submitted.
--- drivers/usb/serial/mos7720.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/usb/serial/mos7720.c +14 -7
@@ -91,6 +91,7 @@ struct urbtracker {struct list_head urblist_entry;struct kref ref_count;struct urb *urb; +struct usb_ctrlrequest *setup; };enum mos7715_pp_modes {
@@ -272,6 +273,7 @@ static void destroy_urbtracker(struct kref *kref)struct mos7715_parport *mos_parport = urbtrack->mos_parport;usb_free_urb (urbtrack->urb); +kfree (urbtrack->setup);kfree (urbtrack);kref_put (&mos_parport->ref_count, destroy_mos_parport); }
@@ -356,7 +358,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,struct urbtracker *urbtrack;int ret_val;unsigned long flags; -struct usb_ctrlrequest setup;struct usb_serial *serial = mos_parport->serial;struct usb_device *usbdev = serial->dev;
@@ -374,14 +375,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,kfree (urbtrack);return -ENOMEM ; } - setup.bRequestType = (__u8 )0x40 ; - setup.bRequest = (__u8 )0x0e ; - setup.wValue =get_reg_value (reg, dummy); - setup.wIndex =get_reg_index (reg); - setup.wLength =0 ; + urbtrack->setup =kmalloc (sizeof (*urbtrack->setup),GFP_KERNEL ); +if (!urbtrack->setup) { +usb_free_urb (urbtrack->urb); +kfree (urbtrack); +return -ENOMEM ; + } + urbtrack->setup->bRequestType = (__u8 )0x40 ; + urbtrack->setup->bRequest = (__u8 )0x0e ; + urbtrack->setup->wValue =get_reg_value (reg, dummy); + urbtrack->setup->wIndex =get_reg_index (reg); + urbtrack->setup->wLength =0 ;usb_fill_control_urb (urbtrack->urb, usbdev,usb_sndctrlpipe (usbdev,0 ), - (unsigned char *)&setup, + (unsigned char *)urbtrack->setup,NULL ,0 , async_complete, urbtrack);kref_init (&urbtrack->ref_count);INIT_LIST_HEAD (&urbtrack->urblist_entry);
Signature · 1 line
1.8.1.2
PATCH 21/58 USB: keyspan: fix null-deref at disconnect and release
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit ff8a43c10f1440f07a5faca0c1556921259f7f76 upstream.
Make sure to fail properly if the device is not accepted during attach in order to avoid null-pointer derefs (of missing interface private data) at disconnect or release.
--- drivers/usb/serial/keyspan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/keyspan.c +1 -1
@@ -2370,7 +2370,7 @@ static int keyspan_startup(struct usb_serial *serial)if (d_details ==NULL ) {dev_err (&serial->dev->dev,"%s - unknown product id %x\n" , __func__,le16_to_cpu (serial->dev->descriptor.idProduct)); -return 1 ; +return -ENODEV ; }/* Setup private data for serial driver */
Signature · 1 line
1.8.1.2
PATCH 22/58 ASoC: tegra: fix Tegra30 I2S capture parameter setup
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit c90c0d7a96e634a73ef1580f1d20993606545647 upstream.
The Tegra30 I2S driver was writing the AHUB interface parameters to the playback path register rather than the capture path register. This caused the capture parameters not to be configured at all, so if capturing using non-HW-default parameters (e.g. 16-bit stereo rather than 8-bit mono) the audio would be corrupted.
With this fixed, audio capture from an analog microphone works correctly on the Cardhu board.
--- sound/soc/tegra/tegra30_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/tegra/tegra30_i2s.c +1 -1
@@ -227,7 +227,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, reg =TEGRA30_I2S_CIF_RX_CTRL ; }else { val |=TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX ; - reg =TEGRA30_I2S_CIF_RX_CTRL ; + reg =TEGRA30_I2S_CIF_TX_CTRL ; }regmap_write (i2s->regmap, reg, val);
Signature · 1 line
1.8.1.2
PATCH 23/58 ALSA: hda - Add a fixup for Gateway LT27
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 1801928e0f99d94c55e33c584c5eb2ff5e246ee6 upstream.
Gateway LT27 needs a fixup for the inverted digital mic.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6932,6 +6932,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x0308 ,"Acer Aspire 8942G" ,ALC662_FIXUP_ASPIRE ),SND_PCI_QUIRK (0x1025 ,0x031c ,"Gateway NV79" ,ALC662_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x1025 ,0x0349 ,"eMachines eM250" ,ALC662_FIXUP_INV_DMIC ), +SND_PCI_QUIRK (0x1025 ,0x034a ,"Gateway LT27" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x038b ,"Acer Aspire 8943G" ,ALC662_FIXUP_ASPIRE ),SND_PCI_QUIRK (0x103c ,0x1632 ,"HP RP5800" ,ALC662_FIXUP_HP_RP5800 ), SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Signature · 1 line
1.8.1.2
PATCH 24/58 mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit e6c495a96ce02574e765d5140039a64c8d4e8c9e upstream.
zap_pte_range loops from @addr to @end. In the middle, if it runs out of batching slots, TLB entries needs to be flushed for @start to @interim, NOT @interim to @end.
Since ARC port doesn't use page free batching I can't test it myself but this seems like the right thing to do.
Observed this when working on a fix for the issue at thread:
http://www.spinics.net/lists/linux-arch/msg21736.html
[ kamal: 3.8.y-stable prereq for:
2b04725 Fix TLB gather virtual address range invalidation corner cases ]
--- mm/memory.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/memory.c +6 -3
@@ -1106,6 +1106,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,spinlock_t *ptl;pte_t *start_pte;pte_t *pte; +unsigned long range_start = addr; again:init_rss_vec (rss);
@@ -1211,12 +1212,14 @@ again: force_flush =0 ;#ifdef HAVE_GENERIC_MMU_GATHER - tlb->start = addr; - tlb->end = end; + tlb->start = range_start; + tlb->end = addr;#endif tlb_flush_mmu (tlb); -if (addr != end) +if (addr != end) { + range_start = addr; goto again; + } }return addr;
Signature · 1 line
1.8.1.2
PATCH 25/58 arch, mm: Remove tlb_fast_mode()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 29eb77825cc7da8d45b642de2de3d423dc8a363f upstream.
Since the introduction of preemptible mmu_gather TLB fast mode has been broken. TLB fast mode relies on there being absolutely no concurrency; it frees pages first and invalidates TLBs later.
However now we can get concurrency and stuff goes *bang*.
This patch removes all tlb_fast_mode() code; it was found the better option vs trying to patch the hole by entangling tlb invalidation with the scheduler.
[ kamal: 3.8.y-stable prereq for:
2b04725 Fix TLB gather virtual address range invalidation corner cases ]
--- arch/arm/include/asm/tlb.h | 27 ++++----------------------- arch/ia64/include/asm/tlb.h | 41 ++++++++--------------------------------- include/asm-generic/tlb.h | 17 +---------------- mm/memory.c | 9 --------- 4 files changed, 13 insertions(+), 81 deletions(-)
arch/arm/include/asm/tlb.h +4 -23
@@ -33,18 +33,6 @@#include <asm/pgalloc.h> #include <asm/tlbflush.h> -/* -* We need to delay page freeing for SMP as other CPUs can access pages -* which have been removed but not yet had their TLB entries invalidated. -* Also, as ARMv7 speculative prefetch can drag new entries into the TLB, -* we need to apply this same delaying tactic to ensure correct operation. -*/ -#if defined(CONFIG_SMP ) || defined(CONFIG_CPU_32v7) -#define tlb_fast_mode (tlb) 0 -#else -#define tlb_fast_mode (tlb) 1 -#endif -#define MMU_GATHER_BUNDLE 8/*
@@ -112,12 +100,10 @@ static inline void __tlb_alloc_page(struct mmu_gather *tlb)static inline void tlb_flush_mmu (struct mmu_gather *tlb) {tlb_flush (tlb); -if (!tlb_fast_mode (tlb)) { -free_pages_and_swap_cache (tlb->pages, tlb->nr); - tlb->nr =0 ; -if (tlb->pages == tlb->local) -__tlb_alloc_page (tlb); - } +free_pages_and_swap_cache (tlb->pages, tlb->nr); + tlb->nr =0 ; +if (tlb->pages == tlb->local) +__tlb_alloc_page (tlb); } static inline void
@@ -178,11 +164,6 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)static inline int __tlb_remove_page (struct mmu_gather *tlb,struct page *page) { -if (tlb_fast_mode (tlb)) { -free_page_and_swap_cache (page); -return 1 ;/* avoid calling tlb_flush_mmu */ - } - tlb->pages[tlb->nr++] = page;VM_BUG_ON (tlb->nr > tlb->max);return tlb->max - tlb->nr;
arch/ia64/include/asm/tlb.h +8 -33
77 lines not on this page · raw message
include/asm-generic/tlb.h +1 -16
@@ -97,11 +97,9 @@ struct mmu_gather {unsigned long start;unsigned long end; unsigned int need_flush : 1, /* Did free PTEs */ - fast_mode : 1; /* No batching */ -/* we are in the middle of an operation to clear * a full mm and can make some optimizations */ - unsigned int fullmm : 1, + fullmm : 1,/* we have performed an operation which * requires a complete flush of the tlb */ need_flush_all : 1;
@@ -114,19 +112,6 @@ struct mmu_gather {#define HAVE_GENERIC_MMU_GATHER -static inline int tlb_fast_mode (struct mmu_gather *tlb) -{ -#ifdef CONFIG_SMP -return tlb->fast_mode; -#else -/* -* For UP we don't need to worry about TLB flush -* and page free order so much.. -*/ -return 1 ; -#endif -} -void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,bool fullmm);void tlb_flush_mmu (struct mmu_gather *tlb); void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start,
mm/memory.c +0 -9
@@ -216,7 +216,6 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm) tlb->start =-1UL ; tlb->end =0 ; tlb->need_flush =0 ; - tlb->fast_mode = (num_possible_cpus () ==1 ); tlb->local.next =NULL ; tlb->local.nr =0 ; tlb->local.max =ARRAY_SIZE (tlb->__pages);
@@ -240,9 +239,6 @@ void tlb_flush_mmu(struct mmu_gather *tlb)tlb_table_flush (tlb);#endif -if (tlb_fast_mode (tlb)) -return ; -for (batch = &tlb->local; batch; batch = batch->next) {free_pages_and_swap_cache (batch->pages, batch->nr); batch->nr =0 ;
@@ -284,11 +280,6 @@ int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)VM_BUG_ON (!tlb->need_flush); -if (tlb_fast_mode (tlb)) { -free_page_and_swap_cache (page); -return 1 ;/* avoid calling tlb_flush_mmu() */ - } - batch = tlb->active; batch->pages[batch->nr++] = page;if (batch->nr == batch->max) {
Signature · 1 line
1.8.1.2
PATCH 26/58 Fix TLB gather virtual address range invalidation corner cases
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 2b047252d087be7f2ba088b4933cd904f92e6fce upstream.
Ben Tebulin reported:
"Since v3.7.2 on two independent machines a very specific Git
repository fails in 9/10 cases on git-fsck due to an SHA1/memory failures. This only occurs on a very specific repository and can be reproduced stably on two independent laptops. Git mailing list ran out of ideas and for me this looks like some very exotic kernel issue"
and bisected the failure to the backport of commit 53a59fc67f97 ("mm:
limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT").
That commit itself is not actually buggy, but what it does is to make it much more likely to hit the partial TLB invalidation case, since it introduces a new case in tlb_next_batch() that previously only ever happened when running out of memory.
The real bug is that the TLB gather virtual memory range setup is subtly buggered. It was introduced in commit 597e1c3580b7 ("mm/mmu_gather:
enable tlb flush range in generic mmu_gather"), and the range handling was already fixed at least once in commit e6c495a96ce0 ("mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots"), but that fix was not complete.
The problem with the TLB gather virtual address range is that it isn't set up by the initial tlb_gather_mmu() initialization (which didn't get the TLB range information), but it is set up ad-hoc later by the functions that actually flush the TLB. And so any such case that forgot to update the TLB range entries would potentially miss TLB invalidates.
Rather than try to figure out exactly which particular ad-hoc range setup was missing (I personally suspect it's the hugetlb case in zap_huge_pmd(), which didn't have the same logic as zap_pte_range() did), this patch just gets rid of the problem at the source: make the TLB range information available to tlb_gather_mmu(), and initialize it when initializing all the other tlb gather fields.
This makes the patch larger, but conceptually much simpler. And the end result is much more understandable; even if you want to play games with partial ranges when invalidating the TLB contents in chunks, now the range information is always there, and anybody who doesn't want to bother with it won't introduce subtle bugs.
Ben verified that this fixes his problem.
--- arch/arm/include/asm/tlb.h | 7 +++++-- arch/arm64/include/asm/tlb.h | 7 +++++-- arch/ia64/include/asm/tlb.h | 9 ++++++--- arch/s390/include/asm/tlb.h | 8 ++++++-- arch/sh/include/asm/tlb.h | 6 ++++-- arch/um/include/asm/tlb.h | 6 ++++-- fs/exec.c | 4 ++-- include/asm-generic/tlb.h | 2 +- mm/hugetlb.c | 2 +- mm/memory.c | 36 +++++++++++++++++++++--------------- mm/mmap.c | 4 ++-- 11 files changed, 57 insertions(+), 34 deletions(-)
arch/arm/include/asm/tlb.h +5 -2
@@ -43,6 +43,7 @@ struct mmu_gather {struct mm_struct *mm;unsigned int fullmm;struct vm_area_struct *vma; +unsigned long start, end;unsigned long range_start;unsigned long range_end;unsigned int nr;
@@ -107,10 +108,12 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb) }static inline void -tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned int fullmm) +tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; - tlb->fullmm = fullmm; + tlb->fullmm = !(start | (end+1 )); + tlb->start = start; + tlb->end = end; tlb->vma =NULL ; tlb->max =ARRAY_SIZE (tlb->local); tlb->pages = tlb->local;
arch/arm64/include/asm/tlb.h +5 -2
@@ -35,6 +35,7 @@ struct mmu_gather {struct mm_struct *mm;unsigned int fullmm;struct vm_area_struct *vma; +unsigned long start, end;unsigned long range_start;unsigned long range_end;unsigned int nr;
@@ -97,10 +98,12 @@ static inline void tlb_flush_mmu(struct mmu_gather *tlb) }static inline void -tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned int fullmm) +tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; - tlb->fullmm = fullmm; + tlb->fullmm = !(start | (end+1 )); + tlb->start = start; + tlb->end = end; tlb->vma =NULL ; tlb->max =ARRAY_SIZE (tlb->local); tlb->pages = tlb->local;
arch/ia64/include/asm/tlb.h +6 -3
@@ -22,7 +22,7 @@* unmapping a portion of the virtual address space, these hooks are called according to * the following template: * -* tlb <- tlb_gather_mmu(mm, full_mm_flush); // start unmap for address space MM +* tlb <- tlb_gather_mmu(mm, start, end); // start unmap for address space MM * { * for each vma that needs a shootdown do { * tlb_start_vma(tlb, vma);
@@ -58,6 +58,7 @@ struct mmu_gather {unsigned int max;unsigned char fullmm;/* non-zero means full mm flush */ unsigned char need_flush;/* really unmapped some PTEs? */ +unsigned long start, end;unsigned long start_addr;unsigned long end_addr;struct page **pages;
@@ -155,13 +156,15 @@ static inline void __tlb_alloc_page(struct mmu_gather *tlb)static inline void -tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned int full_mm_flush) +tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; tlb->max =ARRAY_SIZE (tlb->local); tlb->pages = tlb->local; tlb->nr =0 ; - tlb->fullmm = full_mm_flush; + tlb->fullmm = !(start | (end+1 )); + tlb->start = start; + tlb->end = end; tlb->start_addr = ~0UL ; }
arch/s390/include/asm/tlb.h +6 -2
@@ -32,6 +32,7 @@ struct mmu_gather {struct mm_struct *mm;struct mmu_table_batch *batch;unsigned int fullmm; + unsigned long start, unsigned long end; };struct mmu_table_batch {
@@ -48,10 +49,13 @@ extern void tlb_remove_table(struct mmu_gather *tlb, void *table);static inline void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm, -unsigned int full_mm_flush) +unsigned long start, +unsigned long end) { tlb->mm = mm; - tlb->fullmm = full_mm_flush; + tlb->start = start; + tlb->end = end; + tlb->fullmm = !(start | (end+1 )); tlb->batch =NULL ;if (tlb->fullmm)__tlb_flush_mm (mm);
arch/sh/include/asm/tlb.h +4 -2
@@ -36,10 +36,12 @@ static inline void init_tlb_gather(struct mmu_gather *tlb) }static inline void -tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned int full_mm_flush) +tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; - tlb->fullmm = full_mm_flush; + tlb->start = start; + tlb->end = end; + tlb->fullmm = !(start | (end+1 ));init_tlb_gather (tlb); }
arch/um/include/asm/tlb.h +4 -2
@@ -45,10 +45,12 @@ static inline void init_tlb_gather(struct mmu_gather *tlb) }static inline void -tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned int full_mm_flush) +tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; - tlb->fullmm = full_mm_flush; + tlb->start = start; + tlb->end = end; + tlb->fullmm = !(start | (end+1 ));init_tlb_gather (tlb); }
fs/exec.c +2 -2
@@ -607,7 +607,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)return -ENOMEM ;lru_add_drain (); -tlb_gather_mmu (&tlb, mm,0 ); +tlb_gather_mmu (&tlb, mm, old_start, old_end);if (new_end > old_start) {/* * when the old and new regions overlap clear from new_end.
@@ -624,7 +624,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)free_pgd_range (&tlb, old_start, old_end, new_end, vma->vm_next ? vma->vm_next->vm_start :USER_PGTABLES_CEILING ); } -tlb_finish_mmu (&tlb, new_end, old_end); +tlb_finish_mmu (&tlb, old_start, old_end);/* * Shrink the vma to just the new range. Always succeeds.
include/asm-generic/tlb.h +1 -1
@@ -112,7 +112,7 @@ struct mmu_gather {#define HAVE_GENERIC_MMU_GATHER -void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,bool fullmm); +void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end);void tlb_flush_mmu (struct mmu_gather *tlb);void tlb_finish_mmu (struct mmu_gather *tlb,unsigned long start,unsigned long end);
mm/hugetlb.c +1 -1
@@ -2477,7 +2477,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, mm = vma->vm_mm; -tlb_gather_mmu (&tlb, mm,0 ); +tlb_gather_mmu (&tlb, mm, start, end);__unmap_hugepage_range (&tlb, vma, start, end, ref_page);tlb_finish_mmu (&tlb, start, end); }
mm/memory.c +21 -15
@@ -207,14 +207,15 @@ static int tlb_next_batch(struct mmu_gather *tlb)* tear-down from @mm. The @fullmm argument is used when @mm is without * users and we're going to destroy the full address space (exit/execve). */ -void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,bool fullmm) +void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm,unsigned long start,unsigned long end) { tlb->mm = mm; - tlb->fullmm = fullmm; +/* Is it from 0 to ~0? */ + tlb->fullmm = !(start | (end+1 )); tlb->need_flush_all =0 ; - tlb->start =-1UL ; - tlb->end =0 ; + tlb->start = start; + tlb->end = end; tlb->need_flush =0 ; tlb->local.next =NULL ; tlb->local.nr =0 ;
@@ -254,8 +255,6 @@ void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long e {struct mmu_gather_batch *batch, *next; - tlb->start = start; - tlb->end = end;tlb_flush_mmu (tlb);/* keep the page table cache within bounds */
@@ -1097,7 +1096,6 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,spinlock_t *ptl;pte_t *start_pte;pte_t *pte; -unsigned long range_start = addr; again:init_rss_vec (rss);
@@ -1200,17 +1198,25 @@ again:* and page-free while holding it. */ if (force_flush) { +unsigned long old_end; + force_flush =0 ; -#ifdef HAVE_GENERIC_MMU_GATHER - tlb->start = range_start; +/* +* Flush the TLB just for the previous segment, +* then update the range to be the remaining +* TLB range. +*/ + old_end = tlb->end; tlb->end = addr; -#endif +tlb_flush_mmu (tlb); -if (addr != end) { - range_start = addr; + + tlb->start = addr; + tlb->end = old_end; + +if (addr != end) goto again; - } }return addr;
@@ -1395,7 +1401,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start,unsigned long end = start + size;lru_add_drain (); -tlb_gather_mmu (&tlb, mm,0 ); +tlb_gather_mmu (&tlb, mm, start, end);update_hiwater_rss (mm);mmu_notifier_invalidate_range_start (mm, start, end);for ( ; vma && vma->vm_start < end; vma = vma->vm_next)
@@ -1421,7 +1427,7 @@ static void zap_page_range_single(struct vm_area_struct *vma, unsigned long addrunsigned long end = address + size;lru_add_drain (); -tlb_gather_mmu (&tlb, mm,0 ); +tlb_gather_mmu (&tlb, mm, address, end);update_hiwater_rss (mm);mmu_notifier_invalidate_range_start (mm, address, end);unmap_single_vma (&tlb, vma, address, end, details);
mm/mmap.c +2 -2
@@ -2294,7 +2294,7 @@ static void unmap_region(struct mm_struct *mm,struct mmu_gather tlb;lru_add_drain (); -tlb_gather_mmu (&tlb, mm,0 ); +tlb_gather_mmu (&tlb, mm, start, end);update_hiwater_rss (mm);unmap_vmas (&tlb, vma, start, end); free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
@@ -2671,7 +2671,7 @@ void exit_mmap(struct mm_struct *mm)lru_add_drain ();flush_cache_mm (mm); -tlb_gather_mmu (&tlb, mm,1 ); +tlb_gather_mmu (&tlb, mm,0 ,-1 );/* update_hiwater_rss(mm) here? but nobody should be looking */ /* Use -1 here to ensure all VMAs in the mm are unmapped */ unmap_vmas (&tlb, vma,0 ,-1 );
Signature · 1 line
1.8.1.2
PATCH 27/58 s390: Fix broken build
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 215b28a5308f3d332df2ee09ef11fda45d7e4a92 upstream.
Fix this build error:
In file included from fs/exec.c:61:0:
arch/s390/include/asm/tlb.h:35:23: error: expected identifier or '(' before 'unsigned' arch/s390/include/asm/tlb.h:36:1: warning: no semicolon at end of struct or union [enabled by default] arch/s390/include/asm/tlb.h: In function 'tlb_gather_mmu':
arch/s390/include/asm/tlb.h:57:5: error: 'struct mmu_gather' has no member named 'end'
Broken due to commit 2b047252d0 ("Fix TLB gather virtual address range invalidation corner cases").
--- arch/s390/include/asm/tlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/tlb.h +1 -1
@@ -32,7 +32,7 @@ struct mmu_gather {struct mm_struct *mm;struct mmu_table_batch *batch;unsigned int fullmm; - unsigned long start, unsigned long end; +unsigned long start, end; };struct mmu_table_batch {
Signature · 1 line
1.8.1.2
PATCH 28/58 x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Caragea <[email protected]>
commit 41aacc1eea645c99edbe8fbcf78a97dc9b862adc upstream.
This is the updated version of df54d6fa5427 ("x86 get_unmapped_area():
use proper mmap base for bottom-up direction") that only randomizes the mmap base address once.
--- arch/x86/kernel/sys_x86_64.c | 2 +- arch/x86/mm/mmap.c | 6 ++++-- include/linux/mm_types.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/sys_x86_64.c +1 -1
@@ -101,7 +101,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin, *begin = new_begin; } }else { - *begin =TASK_UNMAPPED_BASE ; + *begin = current->mm->mmap_legacy_base; *end =TASK_SIZE ; } }
arch/x86/mm/mmap.c +4 -2
@@ -112,12 +112,14 @@ static unsigned long mmap_legacy_base(void)*/ void arch_pick_mmap_layout (struct mm_struct *mm) { + mm->mmap_legacy_base =mmap_legacy_base (); + mm->mmap_base =mmap_base (); +if (mmap_is_legacy ()) { - mm->mmap_base =mmap_legacy_base (); + mm->mmap_base = mm->mmap_legacy_base; mm->get_unmapped_area = arch_get_unmapped_area; mm->unmap_area = arch_unmap_area; }else { - mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; mm->unmap_area = arch_unmap_area_topdown; }
include/linux/mm_types.h +1 -0
@@ -332,6 +332,7 @@ struct mm_struct {void (*unmap_area) (struct mm_struct *mm,unsigned long addr);#endif unsigned long mmap_base;/* base of mmap area */ +unsigned long mmap_legacy_base;/* base of mmap area in bottom-up allocations */ unsigned long task_size;/* size of task vm space */ unsigned long cached_hole_size;/* if non-zero, the largest hole below free_area_cache */ unsigned long free_area_cache;/* first hole of size cached_hole_size or larger */
Signature · 1 line
1.8.1.2
PATCH 29/58 Bluetooth: Add support for Foxconn/Hon Hai [0489:e04d]
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Noguchi Kazutosi <[email protected]>
commit 0fc110f4e4f569e12c472f73f0af485e05631403 upstream.
Add support for the AR3012 chip.
T: Bus=01 Lev=02 Prnt=02 Port=05 Cnt=03 Dev#= 21 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e04d Rev=00.02 S: Manufacturer=Atheros Communications S: Product=Bluetooth USB Host Controller S: SerialNumber=Alaska Day 2006 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -90,6 +90,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x13d3, 0x3393) }, { USB_DEVICE(0x0489, 0xe04e) }, { USB_DEVICE(0x0489, 0xe056) }, + { USB_DEVICE(0x0489, 0xe04d) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -126,6 +127,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -148,6 +148,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Signature · 1 line
1.8.1.2
PATCH 30/58 Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330]
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Loo <[email protected]>
commit 84eb2ae1807dd1467bf6f500fc69ae61f1907b75 upstream.
The Fujitsu Lifebook UH552/UH572 ships with a Qualcomm AR9462/AR3012 WLAN/BT-Combo card.
Add device ID to the ath3k driver to enable the bluetooth side of things. Patch against v3.10.
T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 3 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04c5 ProdID=1330 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -91,6 +91,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe04e) }, { USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe04d) }, + { USB_DEVICE(0x04c5, 0x1330) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -128,6 +129,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -149,6 +149,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Signature · 1 line
1.8.1.2
PATCH 31/58 Bluetooth: ath3k: Add support for ID 0x13d3/0x3402
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sujith Manoharan <[email protected]>
commit 5b77a1f3d7b7360dc2b7c6d2188d39b9f8432907 upstream.
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3402 Rev= 0.02 S: Manufacturer=Atheros Communications S: Product=Bluetooth USB Host Controller S: SerialNumber=Alaska Day 2006
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -92,6 +92,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe04d) }, { USB_DEVICE(0x04c5, 0x1330) }, + { USB_DEVICE(0x13d3, 0x3402) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -130,6 +131,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -150,6 +150,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Signature · 1 line
1.8.1.2
PATCH 32/58 Bluetooth: Add support for Atheros [0cf3:3121]
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: AceLan Kao <[email protected]>
commit 1ebd0b21ab14efb75950079840eac29afea2a26e upstream.
Add support for the AR3012 chip.
T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#= 6 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0cf3 ProdID=3121 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -93,6 +93,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe04d) }, { USB_DEVICE(0x04c5, 0x1330) }, { USB_DEVICE(0x13d3, 0x3402) }, + { USB_DEVICE(0x0cf3, 0x3121) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -132,6 +133,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -151,6 +151,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Signature · 1 line
1.8.1.2
PATCH 33/58 Bluetooth: Add support for Atheros [0cf3:e003]
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: AceLan Kao <[email protected]>
commit 1d5b569ef85d013a775560a90050dc630614c045 upstream.
Add support for the AR9462 chip
T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0cf3 ProdID=e003 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -94,6 +94,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x04c5, 0x1330) }, { USB_DEVICE(0x13d3, 0x3402) }, { USB_DEVICE(0x0cf3, 0x3121) }, + { USB_DEVICE(0x0cf3, 0xe003) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -134,6 +135,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -152,6 +152,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
Signature · 1 line
1.8.1.2
PATCH 34/58 iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 9186a1fd9ed190739423db84bc344d258ef3e3d7 upstream.
If channel switch is pending and we remove interface we can crash like showed below due to passing NULL vif to mac80211:
BUG: unable to handle kernel paging request at fffffffffffff8cc IP: [<ffffffff8130924d>] strnlen+0xd/0x40 Call Trace: [<ffffffff8130ad2e>] string.isra.3+0x3e/0xd0 [<ffffffff8130bf99>] vsnprintf+0x219/0x640 [<ffffffff8130c481>] vscnprintf+0x11/0x30 [<ffffffff81061585>] vprintk_emit+0x115/0x4f0 [<ffffffff81657bd5>] printk+0x61/0x63 [<ffffffffa048987f>] ieee80211_chswitch_done+0xaf/0xd0 [mac80211] [<ffffffffa04e7b34>] iwl_chswitch_done+0x34/0x40 [iwldvm] [<ffffffffa04f83c3>] iwlagn_commit_rxon+0x2a3/0xdc0 [iwldvm] [<ffffffffa04ebc50>] ? iwlagn_set_rxon_chain+0x180/0x2c0 [iwldvm] [<ffffffffa04e5e76>] iwl_set_mode+0x36/0x40 [iwldvm] [<ffffffffa04e5f0d>] iwlagn_mac_remove_interface+0x8d/0x1b0 [iwldvm] [<ffffffffa0459b3d>] ieee80211_do_stop+0x29d/0x7f0 [mac80211]
This is because we nulify ctx->vif in iwlagn_mac_remove_interface() before calling some other functions that teardown interface. To fix just check ctx->vif on iwl_chswitch_done(). We should not call ieee80211_chswitch_done() as channel switch works were already canceled by mac80211 in ieee80211_do_stop() -> ieee80211_mgd_stop().
Resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=979581
--- drivers/net/wireless/iwlwifi/dvm/mac80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/dvm/mac80211.c +4 -1
@@ -961,7 +961,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)if (test_bit (STATUS_EXIT_PENDING , &priv->status))return ; -if (test_and_clear_bit (STATUS_CHANNEL_SWITCH_PENDING , &priv->status)) +if (!test_and_clear_bit (STATUS_CHANNEL_SWITCH_PENDING , &priv->status)) +return ; + +if (ctx->vif)ieee80211_chswitch_done (ctx->vif, is_success); }
Signature · 1 line
1.8.1.2
PATCH 35/58 iwlwifi: pcie: disable L1 Active after pci_enable_device
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit eabc4ac5d7606a57ee2b7308cb7323ea8f60183b upstream.
As Arjan pointed out, we mustn't do anything related to PCI configuration until the device is properly enabled with pci_enable_device().
--- drivers/net/wireless/iwlwifi/pcie/trans.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/pcie/trans.c +5 -5
@@ -1262,16 +1262,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,spin_lock_init (&trans_pcie->irq_lock);init_waitqueue_head (&trans_pcie->ucode_write_waitq); -/* W/A - seems to solve weird behavior. We need to remove this if we -* don't want to stay in L1 all the time. This wastes a lot of power */ -pci_disable_link_state (pdev,PCIE_LINK_STATE_L0S |PCIE_LINK_STATE_L1 | -PCIE_LINK_STATE_CLKPM ); -if (pci_enable_device (pdev)) { err = -ENODEV ; goto out_no_pci; } +/* W/A - seems to solve weird behavior. We need to remove this if we +* don't want to stay in L1 all the time. This wastes a lot of power */ +pci_disable_link_state (pdev,PCIE_LINK_STATE_L0S |PCIE_LINK_STATE_L1 | +PCIE_LINK_STATE_CLKPM ); +pci_set_master (pdev); err =pci_set_dma_mask (pdev,DMA_BIT_MASK (36 ));
Signature · 1 line
1.8.1.2
PATCH 36/58 zd1201: do not use stack as URB transfer_buffer
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jussi Kivilinna <[email protected]>
commit 1206ff4ff9d2ef7468a355328bc58ac6ebf5be44 upstream.
Patch fixes zd1201 not to use stack as URB transfer_buffer. URB buffers need to be DMA-able, which stack is not.
Patch is only compile tested.
--- drivers/net/wireless/zd1201.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/zd1201.c +3 -1
@@ -98,10 +98,12 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) goto exit; err =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ),0x4 , -USB_DIR_IN |0x40 ,0 ,0 , &ret,sizeof (ret),ZD1201_FW_TIMEOUT ); +USB_DIR_IN |0x40 ,0 ,0 , buf,sizeof (ret),ZD1201_FW_TIMEOUT );if (err <0 ) goto exit; +memcpy (&ret, buf,sizeof (ret)); +if (ret &0x80 ) { err = -EIO ; goto exit;
Signature · 1 line
1.8.1.2
PATCH 37/58 Hostap: copying wrong data prism2_ioctl_giwaplist()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 909bd5926d474e275599094acad986af79671ac9 upstream.
We want the data stored in "addr" and "qual", but the extra ampersands mean we are copying stack data instead.
--- drivers/net/wireless/hostap/hostap_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/hostap/hostap_ioctl.c +2 -2
@@ -523,9 +523,9 @@ static int prism2_ioctl_giwaplist(struct net_device *dev, data->length =prism2_ap_get_sta_qual (local, addr, qual,IW_MAX_AP ,1 ); -memcpy (extra, &addr,sizeof (struct sockaddr ) * data->length); +memcpy (extra, addr,sizeof (struct sockaddr ) * data->length); data->flags =1 ;/* has quality information */ -memcpy (extra +sizeof (struct sockaddr ) * data->length, &qual, +memcpy (extra +sizeof (struct sockaddr ) * data->length, qual,sizeof (struct iw_quality ) * data->length);kfree (addr);
Signature · 1 line
1.8.1.2
PATCH 38/58 ARM: at91/DT: fix at91sam9n12ek memory node
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit a57603ca2871ee0773b00839c1ea35c4a2d3eeb0 upstream.
--- arch/arm/boot/dts/at91sam9n12ek.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91sam9n12ek.dts +2 -2
@@ -14,11 +14,11 @@ compatible = "atmel,at91sam9n12ek", "atmel,at91sam9n12", "atmel,at91sam9"; chosen { - bootargs = "mem=128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; + bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; }; memory { - reg = <0x20000000 0x10000000>; + reg = <0x20000000 0x8000000>; }; clocks {
Signature · 1 line
1.8.1.2
PATCH 39/58 drm/i915: Move num_pipes to intel info
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Widawsky <[email protected]>
commit 7eb552aeae058a88eece91b902dd51fde45b1f41 upstream.
Requested by Daniel.
v2: Fix incorrect num_pipe settings. (Chris)
[ kamal: backport to 3.8 (context); 3.8.y-stable prereq for:
63b66e5 drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code ]
--- drivers/gpu/drm/i915/i915_dma.c | 9 +------ drivers/gpu/drm/i915/i915_drv.c | 48 ++++++++++++++++++------------------ drivers/gpu/drm/i915/i915_drv.h | 4 +-- drivers/gpu/drm/i915/i915_irq.c | 3 +-- drivers/gpu/drm/i915/intel_display.c | 19 +++++++------- drivers/gpu/drm/i915/intel_fb.c | 2 +- drivers/gpu/drm/i915/intel_panel.c | 2 +- 7 files changed, 40 insertions(+), 47 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +1 -8
@@ -1588,14 +1588,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)if (!IS_I945G (dev) && !IS_I945GM (dev))pci_enable_msi (dev->pdev); -if (IS_IVYBRIDGE (dev) ||IS_HASWELL (dev)) - dev_priv->num_pipe =3 ; -else if (IS_MOBILE (dev) || !IS_GEN2 (dev)) - dev_priv->num_pipe =2 ; -else - dev_priv->num_pipe =1 ; - - ret =drm_vblank_init (dev, dev_priv->num_pipe); + ret =drm_vblank_init (dev,INTEL_INFO (dev)->num_pipes);if (ret) goto out_gem_unload;
drivers/gpu/drm/i915/i915_drv.c +24 -24
173 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drv.h +2 -2
@@ -85,7 +85,7 @@ enum port {#define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT)) -#define for_each_pipe (p) for ((p) = 0; (p) < dev_priv->num_pipe; (p)++) +#define for_each_pipe (p) for ((p) = 0; (p) < INTEL_INFO(dev)->num_pipes; (p)++)#define for_each_encoder_on_crtc (dev, __crtc, intel_encoder) \ list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
@@ -318,6 +318,7 @@ struct drm_i915_gt_funcs {DEV_INFO_FLAG (has_llc) struct intel_device_info { + u8 num_pipes:3;u8 gen; u8 is_mobile:1; u8 is_i85x:1;
@@ -674,7 +675,6 @@ typedef struct drm_i915_private {u32 hotplug_supported_mask;struct work_struct hotplug_work; -int num_pipe;int num_pch_pll;/* For hangcheck timer */
drivers/gpu/drm/i915/i915_irq.c +1 -2
@@ -250,10 +250,9 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, struct timeval *vblank_time, unsigned flags) { -struct drm_i915_private *dev_priv = dev->dev_private;struct drm_crtc *crtc; -if (pipe <0 || pipe >= dev_priv->num_pipe) { +if (pipe <0 || pipe >=INTEL_INFO (dev)->num_pipes) {DRM_ERROR ("Invalid crtc %d\n" , pipe);return -EINVAL ; }
drivers/gpu/drm/i915/intel_display.c +10 -9
@@ -2315,10 +2315,10 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,return 0 ; } -if (intel_crtc->plane > dev_priv->num_pipe) { +if (intel_crtc->plane >INTEL_INFO (dev)->num_pipes) {DRM_ERROR ("no plane for crtc: plane %d, num_pipes %d\n" , intel_crtc->plane, - dev_priv->num_pipe); +INTEL_INFO (dev)->num_pipes);return -EINVAL ; }
@@ -5360,7 +5360,7 @@ static bool ironlake_check_fdi_lanes(struct intel_crtc *intel_crtc)return false; } -if (dev_priv->num_pipe ==2 ) +if (INTEL_INFO (dev)->num_pipes ==2 )return true;switch (intel_crtc->pipe) {
@@ -9034,9 +9034,10 @@ void intel_modeset_init(struct drm_device *dev) dev->mode_config.fb_base = dev_priv->mm.gtt_base_addr;DRM_DEBUG_KMS ("%d display pipe%s available.\n" , - dev_priv->num_pipe, dev_priv->num_pipe >1 ?"s" :"" ); +INTEL_INFO (dev)->num_pipes, +INTEL_INFO (dev)->num_pipes >1 ?"s" :"" ); -for (i =0 ; i < dev_priv->num_pipe; i++) { +for (i =0 ; i <INTEL_INFO (dev)->num_pipes; i++) {intel_crtc_init (dev, i); ret =intel_plane_init (dev, i);if (ret)
@@ -9090,10 +9091,11 @@ static void intel_enable_pipe_a(struct drm_device *dev)static bool intel_check_plane_mapping (struct intel_crtc *crtc) { -struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;u32 reg, val; -if (dev_priv->num_pipe ==1 ) +if (INTEL_INFO (dev)->num_pipes ==1 )return true; reg =DSPCNTR (!crtc->plane);
@@ -9536,10 +9538,9 @@ intel_display_print_error_state(struct seq_file *m,struct drm_device *dev, struct intel_display_error_state *error) { - drm_i915_private_t *dev_priv = dev->dev_private; int i; -seq_printf (m,"Num Pipes: %d\n" , dev_priv->num_pipe); +seq_printf (m,"Num Pipes: %d\n" ,INTEL_INFO (dev)->num_pipes);for_each_pipe (i) {seq_printf (m,"Pipe [%d]:\n" , i);seq_printf (m," CONF: %08x\n" , error->pipe[i].conf);
drivers/gpu/drm/i915/intel_fb.c +1 -1
@@ -233,7 +233,7 @@ int intel_fbdev_init(struct drm_device *dev) ifbdev->helper.funcs = &intel_fb_helper_funcs; ret =drm_fb_helper_init (dev, &ifbdev->helper, - dev_priv->num_pipe, +INTEL_INFO (dev)->num_pipes,INTELFB_CONN_LIMIT );if (ret) {kfree (ifbdev);
drivers/gpu/drm/i915/intel_panel.c +1 -1
@@ -346,7 +346,7 @@ void intel_panel_enable_backlight(struct drm_device *dev,if (tmp &BLM_PWM_ENABLE ) goto set_level; -if (dev_priv->num_pipe ==3 ) +if (INTEL_INFO (dev)->num_pipes ==3 ) tmp &= ~BLM_PIPE_SELECT_IVB ;else tmp &= ~BLM_PIPE_SELECT ;
Signature · 1 line
1.8.1.2
PATCH 40/58 drm/i915: Don't deref pipe->cpu_transcoder in the hangcheck code
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 63b66e5ba54b15a6592be00555d762db6db739ce upstream.
If we get an error event really early in the driver setup sequence, which gen3 is especially prone to with various display GTT faults we Oops. So try to avoid this.
Additionally with Haswell the transcoders are a separate bank of registers from the pipes (4 transcoders, 3 pipes). In event of an error, we want to be sure we have a complete and accurate picture of the machine state, so record all the transcoders in addition to all the active pipes.
This regression has been introduced in
commit 702e7a56af3780d8b3a717f698209bef44187bb0
Author: Paulo Zanoni <[email protected]> Date: Tue Oct 23 18:29:59 2012 -0200
drm/i915: convert PIPECONF to use transcoder instead of pipe
Based on the patch "drm/i915: Dump all transcoder registers on error" from Chris Wilson:
v2: Rebase so that we don't try to be clever and try to figure out the cpu transcoder from hw state. That exercise should be done when we analyze the error state offline.
The actual bugfix is to not call intel_pipe_to_cpu_transcoder in the error state capture code in case the pipes aren't fully set up yet.
v3: Simplifiy the err->num_transcoders computation a bit. While at it make the error capture stuff save on systems without a display block.
v4: Fix fail, spotted by Jani.
v5: Completely new commit message, cc: stable.
Cc: Paulo Zanoni <[email protected]>
Cc: Damien Lespiau <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Chris Wilson <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60021
Conflicts:
drivers/gpu/drm/i915/intel_display.c
--- drivers/gpu/drm/i915/intel_display.c | 83 +++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/intel_display.c +58 -25
@@ -9461,6 +9461,9 @@ int intel_modeset_vga_set_state(struct drm_device *dev, bool state)#include <linux/seq_file.h> struct intel_display_error_state { + +int num_transcoders; +struct intel_cursor_error_state {u32 control;u32 position;
@@ -9469,15 +9472,7 @@ struct intel_display_error_state { } cursor[I915_MAX_PIPES ];struct intel_pipe_error_state { -u32 conf;u32 source; - -u32 htotal; -u32 hblank; -u32 hsync; -u32 vtotal; -u32 vblank; -u32 vsync; } pipe[I915_MAX_PIPES ];struct intel_plane_error_state {
@@ -9489,6 +9484,19 @@ struct intel_display_error_state {u32 surface;u32 tile_offset; } plane[I915_MAX_PIPES ]; + +struct intel_transcoder_error_state { +enum transcoder cpu_transcoder; + +u32 conf; + +u32 htotal; +u32 hblank; +u32 hsync; +u32 vtotal; +u32 vblank; +u32 vsync; + } transcoder[4 ]; }; struct intel_display_error_state *
@@ -9496,16 +9504,22 @@ intel_display_capture_error_state(struct drm_device *dev) {drm_i915_private_t *dev_priv = dev->dev_private;struct intel_display_error_state *error; -enum transcoder cpu_transcoder; +int transcoders[] = { +TRANSCODER_A , +TRANSCODER_B , +TRANSCODER_C , +TRANSCODER_EDP , + };int i; +if (INTEL_INFO (dev)->num_pipes ==0 ) +return NULL ; + error =kmalloc (sizeof (*error),GFP_ATOMIC );if (error ==NULL )return NULL ;for_each_pipe (i) { - cpu_transcoder =intel_pipe_to_cpu_transcoder (dev_priv, i); - error->cursor[i].control =I915_READ (CURCNTR (i)); error->cursor[i].position =I915_READ (CURPOS (i)); error->cursor[i].base =I915_READ (CURBASE (i));
@@ -9520,14 +9534,25 @@ intel_display_capture_error_state(struct drm_device *dev) error->plane[i].tile_offset =I915_READ (DSPTILEOFF (i)); } - error->pipe[i].conf =I915_READ (PIPECONF (cpu_transcoder)); error->pipe[i].source =I915_READ (PIPESRC (i)); - error->pipe[i].htotal =I915_READ (HTOTAL (cpu_transcoder)); - error->pipe[i].hblank =I915_READ (HBLANK (cpu_transcoder)); - error->pipe[i].hsync =I915_READ (HSYNC (cpu_transcoder)); - error->pipe[i].vtotal =I915_READ (VTOTAL (cpu_transcoder)); - error->pipe[i].vblank =I915_READ (VBLANK (cpu_transcoder)); - error->pipe[i].vsync =I915_READ (VSYNC (cpu_transcoder)); + } + + error->num_transcoders =INTEL_INFO (dev)->num_pipes; +if (HAS_DDI (dev_priv->dev)) + error->num_transcoders++;/* Account for eDP. */ + +for (i =0 ; i < error->num_transcoders; i++) { +enum transcoder cpu_transcoder = transcoders[i]; + + error->transcoder[i].cpu_transcoder = cpu_transcoder; + + error->transcoder[i].conf =I915_READ (PIPECONF (cpu_transcoder)); + error->transcoder[i].htotal =I915_READ (HTOTAL (cpu_transcoder)); + error->transcoder[i].hblank =I915_READ (HBLANK (cpu_transcoder)); + error->transcoder[i].hsync =I915_READ (HSYNC (cpu_transcoder)); + error->transcoder[i].vtotal =I915_READ (VTOTAL (cpu_transcoder)); + error->transcoder[i].vblank =I915_READ (VBLANK (cpu_transcoder)); + error->transcoder[i].vsync =I915_READ (VSYNC (cpu_transcoder)); }return error;
@@ -9540,17 +9565,13 @@ intel_display_print_error_state(struct seq_file *m, {int i; +if (!error) +return ; +seq_printf (m,"Num Pipes: %d\n" ,INTEL_INFO (dev)->num_pipes);for_each_pipe (i) {seq_printf (m,"Pipe [%d]:\n" , i); -seq_printf (m," CONF: %08x\n" , error->pipe[i].conf);seq_printf (m," SRC: %08x\n" , error->pipe[i].source); -seq_printf (m," HTOTAL: %08x\n" , error->pipe[i].htotal); -seq_printf (m," HBLANK: %08x\n" , error->pipe[i].hblank); -seq_printf (m," HSYNC: %08x\n" , error->pipe[i].hsync); -seq_printf (m," VTOTAL: %08x\n" , error->pipe[i].vtotal); -seq_printf (m," VBLANK: %08x\n" , error->pipe[i].vblank); -seq_printf (m," VSYNC: %08x\n" , error->pipe[i].vsync);seq_printf (m,"Plane [%d]:\n" , i);seq_printf (m," CNTR: %08x\n" , error->plane[i].control);
@@ -9568,5 +9589,17 @@ intel_display_print_error_state(struct seq_file *m,seq_printf (m," POS: %08x\n" , error->cursor[i].position);seq_printf (m," BASE: %08x\n" , error->cursor[i].base); } + +for (i =0 ; i < error->num_transcoders; i++) { +seq_printf (m," CPU transcoder: %c\n" , +transcoder_name (error->transcoder[i].cpu_transcoder)); +seq_printf (m," CONF: %08x\n" , error->transcoder[i].conf); +seq_printf (m," HTOTAL: %08x\n" , error->transcoder[i].htotal); +seq_printf (m," HBLANK: %08x\n" , error->transcoder[i].hblank); +seq_printf (m," HSYNC: %08x\n" , error->transcoder[i].hsync); +seq_printf (m," VTOTAL: %08x\n" , error->transcoder[i].vtotal); +seq_printf (m," VBLANK: %08x\n" , error->transcoder[i].vblank); +seq_printf (m," VSYNC: %08x\n" , error->transcoder[i].vsync); + } }#endif
Signature · 1 line
1.8.1.2
PATCH 41/58 drm/i915: Invalidate TLBs for the rings after a reset
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 884020bf3d2a3787a1cc6df902e98e0eec60330b upstream.
After any "soft gfx reset" we must manually invalidate the TLBs associated with each ring. Empirically, it seems that a suspend/resume or D3-D0 cycle count as a "soft reset". The symptom is that the hardware would fail to note the new address for its status page, and so it would continue to write the shadow registers and breadcrumbs into the old physical address (now used by something completely different, scary). Whereas the driver would read the new status page and never see any progress, it would appear that the GPU hung immediately upon resume.
Based on a patch by naresh kumar kachhi <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64725
--- drivers/gpu/drm/i915/i915_reg.h | 2 ++ drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++++++++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -596,6 +596,8 @@will not assert AGPBUSY# and will only be delivered when out of C3. */ #define INSTPM_FORCE_ORDERING (1<<7)/* GEN6+ */ +#define INSTPM_TLB_INVALIDATE (1<<9) +#define INSTPM_SYNC_FLUSH (1<<5)#define ACTHD 0x020c8#define FW_BLC 0x020d8#define FW_BLC2 0x020dc
drivers/gpu/drm/i915/intel_ringbuffer.c +12 -0
@@ -874,6 +874,18 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)I915_WRITE (mmio, (u32 )ring->status_page.gfx_addr);POSTING_READ (mmio); + +/* Flush the TLB for this page */ +if (INTEL_INFO (dev)->gen >=6 ) { +u32 reg =RING_INSTPM (ring->mmio_base); +I915_WRITE (reg, +_MASKED_BIT_ENABLE (INSTPM_TLB_INVALIDATE | +INSTPM_SYNC_FLUSH )); +if (wait_for ((I915_READ (reg) &INSTPM_SYNC_FLUSH ) ==0 , +1000 )) +DRM_ERROR ("%s: wait for SyncFlush to complete for TLB invalidation timed out\n" , + ring->name); + } } static int
Signature · 1 line
1.8.1.2
PATCH 42/58 libata: apply behavioral quirks to sil3826 PMP
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Suereth <[email protected]>
commit 8ffff94d20b7eb446e848e0046107d51b17a20a8 upstream.
Fixing support for the Silicon Image 3826 port multiplier, by applying to it the same quirks applied to the Silicon Image 3726. Specifically fixes the repeated timeout/reset process which previously afflicted the 3726, as described from line 290. Slightly based on notes from:
https://bugzilla.redhat.com/show_bug.cgi?id=890237
--- drivers/ata/libata-pmp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/ata/libata-pmp.c +6 -6
@@ -289,24 +289,24 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)/* Disable sending Early R_OK. * With "cached read" HDD testing and multiple ports busy on a SATA -* host controller, 3726 PMP will very rarely drop a deferred +* host controller, 3x26 PMP will very rarely drop a deferred * R_OK that was intended for the host. Symptom will be all * 5 drives under test will timeout, get reset, and recover. */ -if (vendor ==0x1095 && devid ==0x3726 ) { +if (vendor ==0x1095 && (devid ==0x3726 || devid ==0x3826 )) {u32 reg; err_mask =sata_pmp_read (&ap->link,PMP_GSCR_SII_POL , ®);if (err_mask) { rc = -EIO ; - reason ="failed to read Sil3726 Private Register" ; + reason ="failed to read Sil3x26 Private Register" ; goto fail; } reg &= ~0x1 ; err_mask =sata_pmp_write (&ap->link,PMP_GSCR_SII_POL , reg);if (err_mask) { rc = -EIO ; - reason ="failed to write Sil3726 Private Register" ; + reason ="failed to write Sil3x26 Private Register" ; goto fail; } }
@@ -383,8 +383,8 @@ static void sata_pmp_quirks(struct ata_port *ap)u16 devid =sata_pmp_gscr_devid (gscr);struct ata_link *link; -if (vendor ==0x1095 && devid ==0x3726 ) { -/* sil3726 quirks */ +if (vendor ==0x1095 && (devid ==0x3726 || devid ==0x3826 )) { +/* sil3x26 quirks */ ata_for_each_link (link, ap,EDGE ) {/* link reports offline after LPM */ link->flags |=ATA_LFLAG_NO_LPM ;
Signature · 1 line
1.8.1.2
PATCH 43/58 ARM: davinci: nand: specify ecc strength
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
commit acd36357edc08649e85ff15dc4ed62353c912eff upstream.
Starting with kernel v3.5, it is mandatory to specify ECC strength when using hardware ECC. Without this, kernel panics with a warning of the sort:
Driver must set ecc.strength when using hardware ECC
------------[ cut here ]------------ kernel BUG at drivers/mtd/nand/nand_base.c:3519!
Fix this by specifying ECC strength for the boards which were missing this.
--- arch/arm/mach-davinci/board-dm355-leopard.c | 1 + arch/arm/mach-davinci/board-dm644x-evm.c | 1 + arch/arm/mach-davinci/board-dm646x-evm.c | 1 + arch/arm/mach-davinci/board-neuros-osd2.c | 1 + 4 files changed, 4 insertions(+)
arch/arm/mach-davinci/board-dm355-leopard.c +1 -0
@@ -75,6 +75,7 @@ static struct davinci_nand_pdata davinci_nand_data = { .parts = davinci_nand_partitions, .nr_parts = ARRAY_SIZE(davinci_nand_partitions), .ecc_mode = NAND_ECC_HW_SYNDROME, + .ecc_bits = 4, .bbt_options = NAND_BBT_USE_FLASH, };
arch/arm/mach-davinci/board-dm644x-evm.c +1 -0
@@ -153,6 +153,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = { .parts = davinci_evm_nandflash_partition, .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .bbt_options = NAND_BBT_USE_FLASH, .timing = &davinci_evm_nandflash_timing, };
arch/arm/mach-davinci/board-dm646x-evm.c +1 -0
@@ -90,6 +90,7 @@ static struct davinci_nand_pdata davinci_nand_data = { .parts = davinci_nand_partitions, .nr_parts = ARRAY_SIZE(davinci_nand_partitions), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .options = 0, };
arch/arm/mach-davinci/board-neuros-osd2.c +1 -0
@@ -88,6 +88,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = { .parts = davinci_ntosd2_nandflash_partition, .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .bbt_options = NAND_BBT_USE_FLASH, };
Signature · 1 line
1.8.1.2
PATCH 44/58 ARM: allow kuser helpers to be removed from the vector page
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit f6f91b0d9fd971c630cef908dde8fe8795aefbf8 upstream.
Provide a kernel configuration option to allow the kernel user helpers to be removed from the vector page, thereby preventing their use with ROP (return orientated programming) attacks. This option is only visible for CPU architectures which natively support all the operations which kernel user helpers would normally provide, and must be enabled with caution.
--- arch/arm/kernel/entry-armv.S | 3 +++ arch/arm/kernel/traps.c | 23 ++++++++++++++--------- arch/arm/mm/Kconfig | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-)
arch/arm/kernel/entry-armv.S +3 -0
@@ -795,6 +795,7 @@ ENDPROC(__switch_to) .endr .endm +#ifdef CONFIG_KUSER_HELPERS .align 5 .globl __kuser_helper_start __kuser_helper_start:
@@ -981,6 +982,8 @@ __kuser_helper_version: @ 0xffff0ffc .globl __kuser_helper_end __kuser_helper_end: +#endif + THUMB( .thumb ) /*
arch/arm/kernel/traps.c +14 -9
@@ -807,23 +807,32 @@ void __init trap_init(void)return ; } -static void __init kuser_get_tls_init (unsigned long vectors) +#ifdef CONFIG_KUSER_HELPERS +static void __init kuser_init (void *vectors) { +extern char __kuser_helper_start[], __kuser_helper_end[]; +int kuser_sz = __kuser_helper_end - __kuser_helper_start; + +memcpy (vectors +0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); +/* * vectors + 0xfe0 = __kuser_get_tls * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8 */ if (tls_emu || has_tls_reg) -memcpy ((void *)vectors +0xfe0 , (void *)vectors +0xfe8 ,4 ); +memcpy (vectors +0xfe0 , vectors +0xfe8 ,4 ); +} +#else +static void __init kuser_init (void *vectors) +{ } +#endif void __init early_trap_init (void *vectors_base) {unsigned long vectors = (unsigned long )vectors_base;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[]; -extern char __kuser_helper_start[], __kuser_helper_end[]; -int kuser_sz = __kuser_helper_end - __kuser_helper_start;unsigned i; vectors_page = vectors_base;
@@ -844,12 +853,8 @@ void __init early_trap_init(void *vectors_base)*/ memcpy ((void *)vectors, __vectors_start, __vectors_end - __vectors_start);memcpy ((void *)vectors +0x1000 , __stubs_start, __stubs_end - __stubs_start); -memcpy ((void *)vectors +0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); -/* -* Do processor specific fixups for the kuser helpers -*/ -kuser_get_tls_init (vectors); +kuser_init (vectors_base);/* * Copy signal return handlers into the vector page, and
arch/arm/mm/Kconfig +34 -0
@@ -404,24 +404,28 @@ config CPU_32v3 select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v4 bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v4T bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v5 bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v6 bool
@@ -756,6 +760,7 @@ config CPU_BPREDICT_DISABLE config TLS_REG_EMUL bool + select NEED_KUSER_HELPERS help An SMP system using a pre-ARMv6 processor (there are apparently a few prototypes like that in existence) and therefore access to
@@ -763,11 +768,40 @@ config TLS_REG_EMUL config NEEDS_SYSCALL_FOR_CMPXCHG bool + select NEED_KUSER_HELPERS help SMP on a pre-ARMv6 processor? Well OK then. Forget about fast user space cmpxchg support. It is just not possible. +config NEED_KUSER_HELPERS + bool + +config KUSER_HELPERS + bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS + default y + help + Warning: disabling this option may break user programs. + + Provide kuser helpers in the vector page. The kernel provides + helper code to userspace in read only form at a fixed location + in the high vector page to allow userspace to be independent of + the CPU type fitted to the system. This permits binaries to be + run on ARMv4 through to ARMv7 without modification. + + However, the fixed address nature of these helpers can be used + by ROP (return orientated programming) authors when creating + exploits. + + If all of the binaries and libraries which run on your platform + are built specifically for your platform, and make no use of + these helpers, then you can turn this option off. However, + when such an binary or library is run, it will receive a SIGILL + signal, which will terminate the program. + + Say N here only if you are absolutely certain that you do not + need these helpers; otherwise, the safe option is to say Y. + config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" depends on CPU_V6K && SMP
Signature · 1 line
1.8.1.2
PATCH 45/58 ARM: 7816/1: CONFIG_KUSER_HELPERS: fix help text
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit ac124504ecf6b20a2457d873d0728a8b991a5b0c upstream.
Commit f6f91b0d9fd9 ("ARM: allow kuser helpers to be removed from the vector page") introduced some help text for the CONFIG_KUSER_HELPERS option which is rather contradictory.
Let's fix that, and improve it a little.
--- arch/arm/mm/Kconfig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/mm/Kconfig +6 -3
@@ -789,15 +789,18 @@ config KUSER_HELPERS the CPU type fitted to the system. This permits binaries to be run on ARMv4 through to ARMv7 without modification. + See Documentation/arm/kernel_user_helpers.txt for details. + However, the fixed address nature of these helpers can be used by ROP (return orientated programming) authors when creating exploits. If all of the binaries and libraries which run on your platform are built specifically for your platform, and make no use of - these helpers, then you can turn this option off. However, - when such an binary or library is run, it will receive a SIGILL - signal, which will terminate the program. + these helpers, then you can turn this option off to hinder + such exploits. However, in that case, if a binary or library + relying on those helpers is run, it will receive a SIGILL signal, + which will terminate the program. Say N here only if you are absolutely certain that you do not need these helpers; otherwise, the safe option is to say Y.
Signature · 1 line
1.8.1.2
PATCH 46/58 arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 868f6fea8fa63f09acbfa93256d0d2abdcabff79 upstream.
This is a port of d9f966357b14 ("ARM: 7810/1: perf: Fix array out of bounds access in armpmu_map_hw_event()") to arm64, which fixes an oops in the arm64 perf backend found as a result of Vince's fuzzing tool.
--- arch/arm64/kernel/perf_event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm64/kernel/perf_event.c +6 -1
@@ -107,7 +107,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)static int armpmu_map_event (const unsigned (*event_map)[PERF_COUNT_HW_MAX ],u64 config) { -int mapping = (*event_map)[config]; +int mapping; + +if (config >=PERF_COUNT_HW_MAX ) +return -EINVAL ; + + mapping = (*event_map)[config];return mapping ==HW_OP_UNSUPPORTED ? -ENOENT : mapping; }
Signature · 1 line
1.8.1.2
PATCH 47/58 arm64: perf: fix event validation for software group leaders
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit ee7538a008a45050c8f706d38b600f55953169f9 upstream.
This is a port of c95eb3184ea1 ("ARM: 7809/1: perf: fix event validation for software group leaders") to arm64, which fixes a panic in the arm64 perf backend found as a result of Vince's fuzzing tool.
--- arch/arm64/kernel/perf_event.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kernel/perf_event.c +3 -0
@@ -322,6 +322,9 @@ validate_event(struct pmu_hw_events *hw_events,struct hw_perf_event fake_event = event->hw;struct pmu *leader_pmu = event->group_leader->pmu; +if (is_software_event (event)) +return 1 ; +if (event->pmu != leader_pmu || event->state <=PERF_EVENT_STATE_OFF )return 1 ;
Signature · 1 line
1.8.1.2
PATCH 48/58 sata_fsl: save irqs while coalescing
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Anthony Foiani <[email protected]>
commit 99bbdfa6bdcb4bdf5be914a48e9b46941bf30819 upstream.
Before this patch, I was seeing the following lockdep splat on my MPC8315 (PPC32) target:
[ 9.086051] =================================
[ 9.090393] [ INFO: inconsistent lock state ]
[ 9.094744] 3.9.7-ajf-gc39503d #1 Not tainted
[ 9.099087] ---------------------------------
[ 9.103432] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
[ 9.109431] scsi_eh_1/39 [HC1[1]:SC0[0]:HE0:SE1] takes:
[ 9.114642] (&(&host->lock)->rlock){?.+...}, at: [<c02f4168>] sata_fsl_interrupt+0x50/0x250
[ 9.123137] {HARDIRQ-ON-W} state was registered at:
[ 9.128004] [<c006cdb8>] lock_acquire+0x90/0xf4
[ 9.132737] [<c043ef04>] _raw_spin_lock+0x34/0x4c
[ 9.137645] [<c02f3560>] fsl_sata_set_irq_coalescing+0x68/0x100
[ 9.143750] [<c02f36a0>] sata_fsl_init_controller+0xa8/0xc0
[ 9.149505] [<c02f3f10>] sata_fsl_probe+0x17c/0x2e8
[ 9.154568] [<c02acc90>] driver_probe_device+0x90/0x248
[ 9.159987] [<c02acf0c>] __driver_attach+0xc4/0xc8
[ 9.164964] [<c02aae74>] bus_for_each_dev+0x5c/0xa8
[ 9.170028] [<c02ac218>] bus_add_driver+0x100/0x26c
[ 9.175091] [<c02ad638>] driver_register+0x88/0x198
[ 9.180155] [<c0003a24>] do_one_initcall+0x58/0x1b4
[ 9.185226] [<c05aeeac>] kernel_init_freeable+0x118/0x1c0
[ 9.190823] [<c0004110>] kernel_init+0x18/0x108
[ 9.195542] [<c000f6b8>] ret_from_kernel_thread+0x64/0x6c
[ 9.201142] irq event stamp: 160
[ 9.204366] hardirqs last enabled at (159): [<c043f778>] _raw_spin_unlock_irq+0x30/0x50
[ 9.212469] hardirqs last disabled at (160): [<c000f414>] reenable_mmu+0x30/0x88
[ 9.219867] softirqs last enabled at (144): [<c002ae5c>] __do_softirq+0x168/0x218
[ 9.227435] softirqs last disabled at (137): [<c002b0d4>] irq_exit+0xa8/0xb4
[ 9.234481]
[ 9.234481] other info that might help us debug this:
[ 9.240995] Possible unsafe locking scenario:
[ 9.240995]
[ 9.246898] CPU0
[ 9.249337] ----
[ 9.251776] lock(&(&host->lock)->rlock);
[ 9.255878] <Interrupt>
[ 9.258492] lock(&(&host->lock)->rlock);
[ 9.262765]
[ 9.262765] *** DEADLOCK ***
[ 9.262765]
[ 9.268684] no locks held by scsi_eh_1/39.
[ 9.272767]
[ 9.272767] stack backtrace:
[ 9.277117] Call Trace:
[ 9.279589] [cfff9da0] [c0008504] show_stack+0x48/0x150 (unreliable)
[ 9.285972] [cfff9de0] [c0447d5c] print_usage_bug.part.35+0x268/0x27c
[ 9.292425] [cfff9e10] [c006ace4] mark_lock+0x2ac/0x658
[ 9.297660] [cfff9e40] [c006b7e4] __lock_acquire+0x754/0x1840
[ 9.303414] [cfff9ee0] [c006cdb8] lock_acquire+0x90/0xf4
[ 9.308745] [cfff9f20] [c043ef04] _raw_spin_lock+0x34/0x4c
[ 9.314250] [cfff9f30] [c02f4168] sata_fsl_interrupt+0x50/0x250
[ 9.320187] [cfff9f70] [c0079ff0] handle_irq_event_percpu+0x90/0x254
[ 9.326547] [cfff9fc0] [c007a1fc] handle_irq_event+0x48/0x78
[ 9.332220] [cfff9fe0] [c007c95c] handle_level_irq+0x9c/0x104
[ 9.337981] [cfff9ff0] [c000d978] call_handle_irq+0x18/0x28
[ 9.343568] [cc7139f0] [c000608c] do_IRQ+0xf0/0x1a8
[ 9.348464] [cc713a20] [c000fc8c] ret_from_except+0x0/0x14
[ 9.353983] --- Exception: 501 at _raw_spin_unlock_irq+0x40/0x50
[ 9.353983] LR = _raw_spin_unlock_irq+0x30/0x50
[ 9.364839] [cc713af0] [c043db10] wait_for_common+0xac/0x188
[ 9.370513] [cc713b30] [c02ddee4] ata_exec_internal_sg+0x2b0/0x4f0
[ 9.376699] [cc713be0] [c02de18c] ata_exec_internal+0x68/0xa8
[ 9.382454] [cc713c20] [c02de4b8] ata_dev_read_id+0x158/0x594
[ 9.388205] [cc713ca0] [c02ec244] ata_eh_recover+0xd88/0x13d0
[ 9.393962] [cc713d20] [c02f2520] sata_pmp_error_handler+0xc0/0x8ac
[ 9.400234] [cc713dd0] [c02ecdc8] ata_scsi_port_error_handler+0x464/0x5e8
[ 9.407023] [cc713e10] [c02ecfd0] ata_scsi_error+0x84/0xb8
[ 9.412528] [cc713e40] [c02c4974] scsi_error_handler+0xd8/0x47c
[ 9.418457] [cc713eb0] [c004737c] kthread+0xa8/0xac
[ 9.423355] [cc713f40] [c000f6b8] ret_from_kernel_thread+0x64/0x6cThis fix was suggested by Bhushan Bharat <[email protected]>, and was discussed in email at:
Same patch successfully tested with 3.9.7. linux-next compiled but not tested on hardware.
This patch is based off linux-next tag next-20130819 (which is commit 66a01bae29d11916c09f9f5a937cafe7d402e4a5 )
--- drivers/ata/sata_fsl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/sata_fsl.c +3 -2
@@ -292,6 +292,7 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, {struct sata_fsl_host_priv *host_priv = host->private_data;void __iomem *hcr_base = host_priv->hcr_base; +unsigned long flags;if (count >ICC_MAX_INT_COUNT_THRESHOLD ) count =ICC_MAX_INT_COUNT_THRESHOLD ;
@@ -304,12 +305,12 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, (count > ICC_MIN_INT_COUNT_THRESHOLD)) ticks =ICC_SAFE_INT_TICKS ; -spin_lock (&host->lock); +spin_lock_irqsave (&host->lock, flags);iowrite32 ((count <<24 | ticks), hcr_base +ICC ); intr_coalescing_count = count; intr_coalescing_ticks = ticks; -spin_unlock (&host->lock); +spin_unlock_irqrestore (&host->lock, flags);DPRINTK ("intrrupt coalescing, count = 0x%x, ticks = %x\n" , intr_coalescing_count, intr_coalescing_ticks);
Signature · 1 line
1.8.1.2
PATCH 49/58 xen/events: initialize local per-cpu mask for all possible events
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit 84ca7a8e45dafb49cd5ca90a343ba033e2885c17 upstream.
The sizeof() argument in init_evtchn_cpu_bindings() is incorrect resulting in only the first 64 (or 32 in 32-bit guests) ports having their bindings being initialized to VCPU 0.
In most cases this does not cause a problem as request_irq() will set the irq affinity which will set the correct local per-cpu mask. However, if the request_irq() is called on a VCPU other than 0, there is a window between the unmasking of the event and the affinity being set were an event may be lost because it is not locally unmasked on any VCPU. If request_irq() is called on VCPU 0 then local irqs are disabled during the window and the race does not occur.
Fix this by initializing all NR_EVENT_CHANNEL bits in the local per-cpu masks.
--- drivers/xen/events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/events.c +1 -1
@@ -333,7 +333,7 @@ static void init_evtchn_cpu_bindings(void)for_each_possible_cpu (i)memset (per_cpu (cpu_evtchn_mask, i), - (i ==0 ) ? ~0 :0 ,sizeof (*per_cpu (cpu_evtchn_mask, i))); + (i ==0 ) ? ~0 :0 ,NR_EVENT_CHANNELS /8 ); }static inline void clear_evtchn (int port)
Signature · 1 line
1.8.1.2
PATCH 50/58 xen/events: mask events when changing their VCPU binding
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit 4704fe4f03a5ab27e3c36184af85d5000e0f8a48 upstream.
When a event is being bound to a VCPU there is a window between the EVTCHNOP_bind_vpcu call and the adjustment of the local per-cpu masks where an event may be lost. The hypervisor upcalls the new VCPU but the kernel thinks that event is still bound to the old VCPU and ignores it.
There is even a problem when the event is being bound to the same VCPU as there is a small window beween the clear_bit() and set_bit() calls in bind_evtchn_to_cpu(). When scanning for pending events, the kernel may read the bit when it is momentarily clear and ignore the event.
Avoid this by masking the event during the whole bind operation.
--- drivers/xen/events.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/xen/events.c +11 -0
@@ -1464,8 +1464,10 @@ void rebind_evtchn_irq(int evtchn, int irq)/* Rebind an evtchn so that it gets delivered to a specific cpu */ static int rebind_irq_to_cpu (unsigned irq,unsigned tcpu) { +struct shared_info *s = HYPERVISOR_shared_info;struct evtchn_bind_vcpu bind_vcpu;int evtchn =evtchn_from_irq (irq); +int masked;if (!VALID_EVTCHN (evtchn))return -1 ;
@@ -1482,6 +1484,12 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) bind_vcpu.vcpu = tcpu;/* +* Mask the event while changing the VCPU binding to prevent +* it being delivered on an unexpected VCPU. +*/ + masked =sync_test_and_set_bit (evtchn, s->evtchn_mask); + +/* * If this fails, it usually just indicates that we're dealing with a * virq or IPI channel, which don't actually need to be rebound. Ignore * it, but don't do the xenlinux-level rebind in that case.
@@ -1489,6 +1497,9 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)if (HYPERVISOR_event_channel_op (EVTCHNOP_bind_vcpu, &bind_vcpu) >=0 )bind_evtchn_to_cpu (evtchn, tcpu); +if (!masked) +unmask_evtchn (evtchn); +return 0 ; }
Signature · 1 line
1.8.1.2
PATCH 51/58 block: Add bio_for_each_segment_all()
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit d74c6d514fe314b8bdab58b487b25992291577ec upstream.
__bio_for_each_segment() iterates bvecs from the specified index instead of bio->bv_idx. Currently, the only usage is to walk all the bvecs after the bio has been advanced by specifying 0 index.
For immutable bvecs, we need to split these apart; bio_for_each_segment() is going to have a different implementation. This will also help document the intent of code that's using it - bio_for_each_segment_all() is only legal to use for code that owns the bio.
[ kamal: 3.8.y-prereq for:
35dc248 [SCSI] sg: Fix user memory corruption when SG_IO is interrupted by a signal ]
--- drivers/block/rbd.c | 2 +- drivers/md/raid1.c | 2 +- fs/bio.c | 12 ++++++------ fs/exofs/ore.c | 2 +- fs/exofs/ore_raid.c | 2 +- include/linux/bio.h | 17 ++++++++++++++--- mm/bounce.c | 2 +- 7 files changed, 25 insertions(+), 14 deletions(-)
drivers/block/rbd.c +1 -1
@@ -867,7 +867,7 @@ static struct bio *bio_clone_range(struct bio *bio_src,/* Find first affected segment... */ resid = offset; -__bio_for_each_segment (bv, bio_src, idx,0 ) { +bio_for_each_segment (bv, bio_src, idx) {if (resid < bv->bv_len)break ; resid -= bv->bv_len;
drivers/md/raid1.c +1 -1
@@ -1306,7 +1306,7 @@ read_again:* know the original bi_idx, so we just free * them all */ -__bio_for_each_segment (bvec, mbio, j,0 ) +bio_for_each_segment_all (bvec, mbio, j) bvec->bv_page = r1_bio->behind_bvecs[j].bv_page;if (test_bit (WriteMostly, &conf->mirrors[i].rdev->flags))atomic_inc (&r1_bio->behind_remaining);
fs/bio.c +6 -6
@@ -714,7 +714,7 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,int iov_idx =0 ;unsigned int iov_off =0 ; -__bio_for_each_segment (bvec, bio, i,0 ) { +bio_for_each_segment_all (bvec, bio, i) {char *bv_addr =page_address (bvec->bv_page);unsigned int bv_len = iovecs[i].bv_len;
@@ -896,7 +896,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,return bio; cleanup:if (!map_data) -bio_for_each_segment (bvec, bio, i) +bio_for_each_segment_all (bvec, bio, i)__free_page (bvec->bv_page);bio_put (bio);
@@ -1110,7 +1110,7 @@ static void __bio_unmap_user(struct bio *bio)/* * make sure we dirty pages we wrote to */ -__bio_for_each_segment (bvec, bio, i,0 ) { +bio_for_each_segment_all (bvec, bio, i) {if (bio_data_dir (bio) ==READ )set_page_dirty_lock (bvec->bv_page);
@@ -1216,7 +1216,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)int i;char *p = bmd->sgvecs[0 ].iov_base; -__bio_for_each_segment (bvec, bio, i,0 ) { +bio_for_each_segment_all (bvec, bio, i) {char *addr =page_address (bvec->bv_page);int len = bmd->iovecs[i].bv_len;
@@ -1256,7 +1256,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len,if (!reading) {void *p = data; -bio_for_each_segment (bvec, bio, i) { +bio_for_each_segment_all (bvec, bio, i) {char *addr =page_address (bvec->bv_page);memcpy (addr, p, bvec->bv_len);
@@ -1541,7 +1541,7 @@ sector_t bio_sector_offset(struct bio *bio, unsigned short index,if (index >= bio->bi_idx) index = bio->bi_vcnt -1 ; -__bio_for_each_segment (bv, bio, i,0 ) { +bio_for_each_segment_all (bv, bio, i) {if (i == index) {if (offset > bv->bv_offset) sectors += (offset - bv->bv_offset) / sector_sz;
fs/exofs/ore.c +1 -1
@@ -401,7 +401,7 @@ static void _clear_bio(struct bio *bio)struct bio_vec *bv;unsigned i; -__bio_for_each_segment (bv, bio, i,0 ) { +bio_for_each_segment_all (bv, bio, i) {unsigned this_count = bv->bv_len;if (likely (PAGE_SIZE == this_count))
fs/exofs/ore_raid.c +1 -1
@@ -432,7 +432,7 @@ static void _mark_read4write_pages_uptodate(struct ore_io_state *ios, int ret)if (!bio)continue ; -__bio_for_each_segment (bv, bio, i,0 ) { +bio_for_each_segment_all (bv, bio, i) {struct page *page = bv->bv_page;SetPageUptodate (page);
include/linux/bio.h +14 -3
@@ -136,16 +136,27 @@ static inline int bio_has_allocated_vec(struct bio *bio)#define bio_io_error (bio) bio_endio((bio), -EIO)/* -* drivers should not use the __ version unless they _really_ want to -* run through the entire bio and not just pending pieces +* drivers should not use the __ version unless they _really_ know what +* they're doing */ #define __bio_for_each_segment (bvl, bio, i, start_idx) \ for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \ i < (bio)->bi_vcnt; \ bvl++, i++) +/* +* drivers should _never_ use the all version - the bio may have been split +* before it got to the driver and the driver won't own all of it +*/ +#define bio_for_each_segment_all (bvl, bio, i) \ + for (i = 0; \ + bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ + i++) +#define bio_for_each_segment (bvl, bio, i) \ - __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx) + for (i = (bio)->bi_idx; \ + bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ + i++)/* * get a reference to a bio, so it won't disappear. the intended use is
mm/bounce.c +1 -1
@@ -134,7 +134,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err)/* * free up bounce indirect pages used */ -__bio_for_each_segment (bvec, bio, i,0 ) { +bio_for_each_segment_all (bvec, bio, i) { org_vec = bio_orig->bi_io_vec + i;if (bvec->bv_page == org_vec->bv_page)continue ;
Signature · 1 line
1.8.1.2
PATCH 52/58 sg: Fix user memory corruption when SG_IO is interrupted by a signal
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit 35dc248383bbab0a7203fca4d722875bc81ef091 upstream.
There is a nasty bug in the SCSI SG_IO ioctl that in some circumstances leads to one process writing data into the address space of some other random unrelated process if the ioctl is interrupted by a signal. What happens is the following:
- A process issues an SG_IO ioctl with direction DXFER_FROM_DEV (ie the underlying SCSI command will transfer data from the SCSI device to the buffer provided in the ioctl)
- Before the command finishes, a signal is sent to the process waiting in the ioctl. This will end up waking up the sg_ioctl() code:
result = wait_event_interruptible(sfp->read_wait, (srp_done(sfp, srp) || sdp->detached));
but neither srp_done() nor sdp->detached is true, so we end up just setting srp->orphan and returning to userspace:
srp->orphan = 1; write_unlock_irq(&sfp->rq_list_lock); return result; /* -ERESTARTSYS because signal hit process */
At this point the original process is done with the ioctl and blithely goes ahead handling the signal, reissuing the ioctl, etc.
- Eventually, the SCSI command issued by the first ioctl finishes and ends up in sg_rq_end_io(). At the end of that function, we run through:
write_lock_irqsave(&sfp->rq_list_lock, iflags);
if (unlikely(srp->orphan)) {
if (sfp->keep_orphan)
srp->sg_io_owned = 0;
else
done = 0;
}
srp->done = done;
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
if (likely(done)) {
/* Now wake up any sg_read() that is waiting for this
* packet.
*/
wake_up_interruptible(&sfp->read_wait);
kill_fasync(&sfp->async_qp, SIGPOLL, POLL_IN);
kref_put(&sfp->f_ref, sg_remove_sfp);
} else {
INIT_WORK(&srp->ew.work, sg_rq_end_io_usercontext);
schedule_work(&srp->ew.work);
} Since srp->orphan *is* set, we set done to 0 (assuming the userspace app has not set keep_orphan via an SG_SET_KEEP_ORPHAN ioctl), and therefore we end up scheduling sg_rq_end_io_usercontext() to run in a workqueue.
- In workqueue context we go through sg_rq_end_io_usercontext() -> sg_finish_rem_req() -> blk_rq_unmap_user() -> ... -> bio_uncopy_user() -> __bio_copy_iov() -> copy_to_user().
The key point here is that we are doing copy_to_user() on a workqueue -- that is, we're on a kernel thread with current->mm equal to whatever random previous user process was scheduled before this kernel thread. So we end up copying whatever data the SCSI command returned to the virtual address of the buffer passed into the original ioctl, but it's quite likely we do this copying into a different address space!
As suggested by James Bottomley <[email protected]>, add a check for current->mm (which is NULL if we're on a kernel thread without a real userspace address space) in bio_uncopy_user(), and skip the copy if we're on a kernel thread.
There's no reason that I can think of for any caller of bio_uncopy_user() to want to do copying on a kernel thread with a random active userspace address space.
Huge thanks to Costa Sapuntzakis <[email protected]> for the original pointer to this bug in the sg code.
--- fs/bio.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
fs/bio.c +15 -5
@@ -767,12 +767,22 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,int bio_uncopy_user (struct bio *bio) {struct bio_map_data *bmd = bio->bi_private; -int ret =0 ; +struct bio_vec *bvec; +int ret =0 , i; -if (!bio_flagged (bio,BIO_NULL_MAPPED )) - ret =__bio_copy_iov (bio, bmd->iovecs, bmd->sgvecs, - bmd->nr_sgvecs,bio_data_dir (bio) ==READ , -0 , bmd->is_our_pages); +if (!bio_flagged (bio,BIO_NULL_MAPPED )) { +/* +* if we're in a workqueue, the request is orphaned, so +* don't copy into a random user address space, just free. +*/ +if (current->mm) + ret =__bio_copy_iov (bio, bmd->iovecs, bmd->sgvecs, + bmd->nr_sgvecs,bio_data_dir (bio) ==READ , +0 , bmd->is_our_pages); +else if (bmd->is_our_pages) +bio_for_each_segment_all (bvec, bio, i) +__free_page (bvec->bv_page); + }bio_free_map_data (bmd);bio_put (bio);return ret;
Signature · 1 line
1.8.1.2
PATCH 53/58 of: fdt: fix memory initialization for expanded DT
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Wladislav Wiebe <[email protected]>
commit 9e40127526e857fa3f29d51e83277204fbdfc6ba upstream.
Already existing property flags are filled wrong for properties created from initial FDT. This could cause problems if this DYNAMIC device-tree functions are used later, i.e. properties are attached/detached/replaced. Simply dumping flags from the running system show, that some initial static (not allocated via kzmalloc()) nodes are marked as dynamic.
I putted some debug extensions to property_proc_show(..) :
..
+ if (OF_IS_DYNAMIC(pp))
+ pr_err("DEBUG: xxx : OF_IS_DYNAMIC\n");
+ if (OF_IS_DETACHED(pp))
+ pr_err("DEBUG: xxx : OF_IS_DETACHED\n");
when you operate on the nodes (e.g.: ~$ cat /proc/device-tree/*some_node*) you will see that those flags are filled wrong, basically in most cases it will dump a DYNAMIC or DETACHED status, which is in not true.
(BTW. this OF_IS_DETACHED is a own define for debug purposes which which just make a test_bit(OF_DETACHED, &x->_flags)
If nodes are dynamic kernel is allowed to kfree() them. But it will crash attempting to do so on the nodes from FDT -- they are not allocated via kzmalloc().
--- drivers/of/fdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/fdt.c +2 -0
@@ -392,6 +392,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob, mem = (unsigned long )dt_alloc (size +4 , __alignof__(struct device_node )); +memset ((void *)mem,0 , size); + ((__be32 *)mem)[size /4 ] =cpu_to_be32 (0xdeadbeef );pr_debug (" unflattening %lx...\n" , mem);
Signature · 1 line
1.8.1.2
PATCH 54/58 zfcp: fix lock imbalance by reworking request queue locking
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Peschke <[email protected]>
commit d79ff142624e1be080ad8d09101f7004d79c36e1 upstream.
This patch adds wait_event_interruptible_lock_irq_timeout(), which is a straight-forward descendant of wait_event_interruptible_timeout() and wait_event_interruptible_lock_irq().
The zfcp driver used to call wait_event_interruptible_timeout() in combination with some intricate and error-prone locking. Using wait_event_interruptible_lock_irq_timeout() as a replacement nicely cleans up that locking.
This rework removes a situation that resulted in a locking imbalance in zfcp_qdio_sbal_get():
BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]It was introduced by commit c2af7545aaff3495d9bf9a7608c52f0af86fb194 "[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit without a required lock being held. The problem occured when a special, non-SCSI I/O request was being submitted in process context, when the adapter's queues had been torn down. In this case the bug surfaced when the Fibre Channel port connection for a well-known address was closed during a concurrent adapter shut-down procedure, which is a rare constellation.
This patch also fixes these warnings from the sparse tool (make C=1):
drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
'zfcp_qdio_sbal_check' - wrong count at exitdrivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
'zfcp_qdio_sbal_get' - unexpected unlock
Last but not least, we get rid of that crappy lock-unlock-lock sequence at the beginning of the critical section.
It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.
--- drivers/s390/scsi/zfcp_qdio.c | 8 ++---- include/linux/wait.h | 57 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 6 deletions(-)
drivers/s390/scsi/zfcp_qdio.c +2 -6
@@ -224,11 +224,9 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,static int zfcp_qdio_sbal_check (struct zfcp_qdio *qdio) { -spin_lock_irq (&qdio->req_q_lock);if (atomic_read (&qdio->req_q_free) || !(atomic_read (&qdio->adapter->status) &ZFCP_STATUS_ADAPTER_QDIOUP ))return 1 ; -spin_unlock_irq (&qdio->req_q_lock);return 0 ; }
@@ -246,9 +244,8 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio) {long ret; -spin_unlock_irq (&qdio->req_q_lock); - ret =wait_event_interruptible_timeout (qdio->req_q_wq, -zfcp_qdio_sbal_check (qdio),5 *HZ ); + ret =wait_event_interruptible_lock_irq_timeout (qdio->req_q_wq, +zfcp_qdio_sbal_check (qdio), qdio->req_q_lock,5 *HZ );if (!(atomic_read (&qdio->adapter->status) &ZFCP_STATUS_ADAPTER_QDIOUP ))return -EIO ;
@@ -262,7 +259,6 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio)zfcp_erp_adapter_reopen (qdio->adapter,0 ,"qdsbg_1" ); } -spin_lock_irq (&qdio->req_q_lock);return -EIO ; }
include/linux/wait.h +57 -0
63 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH 55/58 zfcp: fix schedule-inside-lock in scsi_device list loops
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Peschke <[email protected]>
commit 924dd584b198a58aa7cb3efefd8a03326550ce8f upstream.
BUG: sleeping function called from invalid context at kernel/workqueue.c:2752 in_atomic(): 1, irqs_disabled(): 1, pid: 360, name: zfcperp0.0.1700 CPU: 1 Not tainted 3.9.3+ #69 Process zfcperp0.0.1700 (pid: 360, task: 0000000075b7e080, ksp: 000000007476bc30) <snip> Call Trace: ([<00000000001165de>] show_trace+0x106/0x154) [<00000000001166a0>] show_stack+0x74/0xf4 [<00000000006ff646>] dump_stack+0xc6/0xd4 [<000000000017f3a0>] __might_sleep+0x128/0x148 [<000000000015ece8>] flush_work+0x54/0x1f8 [<00000000001630de>] __cancel_work_timer+0xc6/0x128 [<00000000005067ac>] scsi_device_dev_release_usercontext+0x164/0x23c [<0000000000161816>] execute_in_process_context+0x96/0xa8 [<00000000004d33d8>] device_release+0x60/0xc0 [<000000000048af48>] kobject_release+0xa8/0x1c4 [<00000000004f4bf2>] __scsi_iterate_devices+0xfa/0x130 [<000003ff801b307a>] zfcp_erp_strategy+0x4da/0x1014 [zfcp] [<000003ff801b3caa>] zfcp_erp_thread+0xf6/0x2b0 [zfcp] [<000000000016b75a>] kthread+0xf2/0xfc [<000000000070c9de>] kernel_thread_starter+0x6/0xc [<000000000070c9d8>] kernel_thread_starter+0x0/0xc
Apparently, the ref_count for some scsi_device drops down to zero, triggering device removal through execute_in_process_context(), while the lldd error recovery thread iterates through a scsi device list. Unfortunately, execute_in_process_context() decides to immediately execute that device removal function, instead of scheduling asynchronous execution, since it detects process context and thinks it is safe to do so. But almost all calls to shost_for_each_device() in our lldd are inside spin_lock_irq, even in thread context. Obviously, schedule() inside spin_lock_irq sections is a bad idea.
Change the lldd to use the proper iterator function, __shost_for_each_device(), in combination with required locking.
Occurences that need to be changed include all calls in zfcp_erp.c, since those might be executed in zfcp error recovery thread context with a lock held.
Other occurences of shost_for_each_device() in zfcp_fsf.c do not need to be changed (no process context, no surrounding locking).
The problem was introduced in Linux 2.6.37 by commit b62a8d9b45b971a67a0f8413338c230e3117dff5
"[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit".
--- drivers/s390/scsi/zfcp_erp.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/s390/scsi/zfcp_erp.c +22 -7
@@ -102,10 +102,13 @@ static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_INUSE )zfcp_erp_action_dismiss (&port->erp_action); -else -shost_for_each_device (sdev, port->adapter->scsi_host) +else { +spin_lock (port->adapter->scsi_host->host_lock); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)zfcp_erp_action_dismiss_lun (sdev); +spin_unlock (port->adapter->scsi_host->host_lock); + } }static void zfcp_erp_action_dismiss_adapter (struct zfcp_adapter *adapter)
@@ -592,9 +595,11 @@ static void _zfcp_erp_lun_reopen_all(struct zfcp_port *port, int clear, {struct scsi_device *sdev; -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock (port->adapter->scsi_host->host_lock); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)_zfcp_erp_lun_reopen (sdev, clear, id,0 ); +spin_unlock (port->adapter->scsi_host->host_lock); }static void zfcp_erp_strategy_followup_failed (struct zfcp_erp_action *act)
@@ -1435,8 +1440,10 @@ void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask)atomic_set_mask (common_mask, &port->status);read_unlock_irqrestore (&adapter->port_list_lock, flags); -shost_for_each_device (sdev, adapter->scsi_host) +spin_lock_irqsave (adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, adapter->scsi_host)atomic_set_mask (common_mask, &sdev_to_zfcp (sdev)->status); +spin_unlock_irqrestore (adapter->scsi_host->host_lock, flags); }/**
@@ -1470,11 +1477,13 @@ void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask) }read_unlock_irqrestore (&adapter->port_list_lock, flags); -shost_for_each_device (sdev, adapter->scsi_host) { +spin_lock_irqsave (adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, adapter->scsi_host) {atomic_clear_mask (common_mask, &sdev_to_zfcp (sdev)->status);if (clear_counter)atomic_set (&sdev_to_zfcp (sdev)->erp_counter,0 ); } +spin_unlock_irqrestore (adapter->scsi_host->host_lock, flags); }/**
@@ -1488,16 +1497,19 @@ void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask) {struct scsi_device *sdev;u32 common_mask = mask &ZFCP_COMMON_FLAGS ; +unsigned long flags;atomic_set_mask (mask, &port->status);if (!common_mask)return ; -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock_irqsave (port->adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)atomic_set_mask (common_mask, &sdev_to_zfcp (sdev)->status); +spin_unlock_irqrestore (port->adapter->scsi_host->host_lock, flags); }/**
@@ -1512,6 +1524,7 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)struct scsi_device *sdev;u32 common_mask = mask &ZFCP_COMMON_FLAGS ;u32 clear_counter = mask &ZFCP_STATUS_COMMON_ERP_FAILED ; +unsigned long flags;atomic_clear_mask (mask, &port->status);
@@ -1521,13 +1534,15 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)if (clear_counter)atomic_set (&port->erp_counter,0 ); -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock_irqsave (port->adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port) {atomic_clear_mask (common_mask, &sdev_to_zfcp (sdev)->status);if (clear_counter)atomic_set (&sdev_to_zfcp (sdev)->erp_counter,0 ); } +spin_unlock_irqrestore (port->adapter->scsi_host->host_lock, flags); }/**
Signature · 1 line
1.8.1.2
PATCH 56/58 drivers/platform/olpc/olpc-ec.c: initialise earlier
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
commit 93dbc1b3b506e16c1f6d5b5dcfe756a85cb1dc58 upstream.
Being a low-level component, various drivers (e.g. olpc-battery) assume that it is ok to communicate with the OLPC Embedded Controller during probe. Therefore the OLPC EC driver must be initialised before other drivers try to use it. This was the case until it was recently moved out of arch/x86 and restructured around commits ac2504151f5a ("Platform:
OLPC: turn EC driver into a platform_driver") and 85f90cf6ca56 ("x86:
OLPC: switch over to using new EC driver on x86").
Use arch_initcall so that olpc-ec is readied earlier, matching the previous behaviour.
Fixes a regression introduced in Linux-3.6 where various drivers such as olpc-battery and olpc-xo1-sci failed to load due to an inability to communicate with the EC. The user-visible effect was a lack of battery monitoring, missing ebook/lid switch input devices, etc.
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/olpc/olpc-ec.c +1 -1
@@ -330,7 +330,7 @@ static int __init olpc_ec_init_module(void)return platform_driver_register (&olpc_ec_plat_driver); } -module_init (olpc_ec_init_module); +arch_initcall (olpc_ec_init_module);MODULE_AUTHOR ("Andres Salomon <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.8.1.2
PATCH 57/58 nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vyacheslav Dubeyko <[email protected]>
commit 2df37a19c686c2d7c4e9b4ce1505b5141e3e5552 upstream.
Remove double call of bio_put() in nilfs_end_bio_write() for the case of BIO_EOPNOTSUPP error detection. The issue was found by Dan Carpenter and he suggests first version of the fix too.
--- fs/nilfs2/segbuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nilfs2/segbuf.c +1 -2
@@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)if (err == -EOPNOTSUPP ) {set_bit (BIO_EOPNOTSUPP , &bio->bi_flags); -bio_put (bio); -/* to be detected by submit_seg_bio() */ +/* to be detected by nilfs_segbuf_submit_bio() */ }if (!uptodate)
Signature · 1 line
1.8.1.2
PATCH 58/58 nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection
In reply to Kamal Mostafa3.8.13.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vyacheslav Dubeyko <[email protected]>
commit 4bf93b50fd04118ac7f33a3c2b8a0a1f9fa80bc9 upstream.
Fix the issue with improper counting number of flying bio requests for BIO_EOPNOTSUPP error detection case.
The sb_nbio must be incremented exactly the same number of times as complete() function was called (or will be called) because nilfs_segbuf_wait() will call wail_for_completion() for the number of times set to sb_nbio:
do {
wait_for_completion(&segbuf->sb_bio_event);
} while (--segbuf->sb_nbio > 0);Two functions complete() and wait_for_completion() must be called the same number of times for the same sb_bio_event. Otherwise, wait_for_completion() will hang or leak.
--- fs/nilfs2/segbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/segbuf.c +1 -1
@@ -376,12 +376,12 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, bio->bi_private = segbuf;bio_get (bio);submit_bio (mode, bio); + segbuf->sb_nbio++;if (bio_flagged (bio,BIO_EOPNOTSUPP )) {bio_put (bio); err = -EOPNOTSUPP ; goto failed; } - segbuf->sb_nbio++;bio_put (bio); wi->bio =NULL ;
Signature · 1 line
1.8.1.2