3.10.39-stable review
Greg Kroah-Hartman
maintainercover 3.10.39-stable review
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.39-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.39-rc1
Aaron Sanders <[email protected]>
USB: pl2303: add ids for Hewlett-Packard HP POS pole displays
Theodore Ts'o <[email protected]>
ext4: use i_size_read in ext4_unaligned_aio()
Jan Kara <[email protected]>
ext4: fix jbd2 warning under heavy xattr load
alex chen <[email protected]>
ocfs2: do not put bh when buffer_uptodate failed
Junxiao Bi <[email protected]>
ocfs2: dlm: fix recovery hung
Junxiao Bi <[email protected]>
ocfs2: dlm: fix lock migration crash
Liu Hua <[email protected]>
hung_task: check the value of "sysctl_hung_task_timeout_sec"
Mizuma, Masayoshi <[email protected]>
mm: hugetlb: fix softlockup when a large number of hugepages are freed.
Vlastimil Babka <[email protected]>
mm: try_to_unmap_cluster() should lock_page() before mlocking
Matt Fleming <[email protected]>
sh: fix format string bug in stack tracer
Felipe Franciosi <[email protected]>
mtip32xx: Set queue bounce limit
Alan Stern <[email protected]>
USB: unbind all interfaces before rebinding any
Michal Simek <[email protected]>
usb: phy: Add ulpi IDs for SMSC USB3320 and TI TUSB1210
Paul Gortmaker <[email protected]>
hvc: ensure hvc_init is only ever called once in hvc_console.c
Felipe Balbi <[email protected]>
usb: musb: avoid NULL pointer dereference
Huang Rui <[email protected]>
usb: dwc3: fix wrong bit mask in dwc3_event_devt
Wolfram Sang <[email protected]>
media: media: gspca: sn9c20x: add ID for Genius Look 1320 V2
Florian Vaussard <[email protected]>
media: omap3isp: preview: Fix the crop margins
Hans Verkuil <[email protected]>
media: saa7134: fix WARN_ON during resume
Antti Palosaari <[email protected]>
media: em28xx: fix PCTV 290e LNA oops
Malcolm Priestley <[email protected]>
media: m88rs2000: add caps FE_CAN_INVERSION_AUTO
Malcolm Priestley <[email protected]>
media: m88rs2000: prevent frontend crash on continuous transponder scans
Hans Verkuil <[email protected]>
media: v4l2-compat-ioctl32: fix wrong VIDIOC_SUBDEV_G/S_EDID32 support
Oleksij Rempel <[email protected]>
media: uvcvideo: Do not use usb_set_interface on bulk EP
David Cohen <[email protected]>
usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM
Igor Gnatenko <[email protected]>
xhci: extend quirk for Renesas cards
Mathias Nyman <[email protected]>
xhci: Prevent runtime pm from autosuspending during initialization
Roger Quadros <[email protected]>
usb: gadget: zero: Fix SuperSpeed enumeration for alternate setting 1
Kees Cook <[email protected]>
usb: gadget: tcm_usb_gadget: stop format strings
Jeff Mahoney <[email protected]>
reiserfs: fix race in readdir
Matt Fleming <[email protected]>
x86/efi: Correct EFI boot stub use of code32_start
Andy Grover <[email protected]>
target/tcm_fc: Fix use-after-free of ft_tpg
Nicholas Bellinger <[email protected]>
iscsi-target: Fix ERL=2 ASYNC_EVENT connection pointer bug
Dan Carpenter <[email protected]>
SCSI: arcmsr: upper 32 of dma address lost
Dan Carpenter <[email protected]>
SCSI: qla2xxx: fix error handling of qla2x00_mem_alloc()
Mike Marciniszyn <[email protected]>
ib_srpt: Use correct ib_sg_dma primitives
Yann Droneaud <[email protected]>
IB/ehca: Returns an error on ib_copy_to_udata() failure
Yann Droneaud <[email protected]>
IB/mthca: Return an error on ib_copy_to_udata() failure
Yann Droneaud <[email protected]>
IB/nes: Return an error on ib_copy_from_udata() failure instead of NULL
Dennis Dalessandro <[email protected]>
IB/ipath: Fix potential buffer overrun in sending diag packet routine
Jeff Layton <[email protected]>
nfsd: set timeparms.to_maxval in setup_callback_client
Kinglong Mee <[email protected]>
NFSD: Traverse unconfirmed client through hash-table
J. Bruce Fields <[email protected]>
nfsd4: fix setclientid encode size
Stanislav Kinsbursky <[email protected]>
nfsd: check passed socket's net matches NFSd superblock's one
J. Bruce Fields <[email protected]>
nfsd: notify_change needs elevated write count
J. Bruce Fields <[email protected]>
nfsd4: fix test_stateid error reply encoding
J. Bruce Fields <[email protected]>
nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
J. Bruce Fields <[email protected]>
nfsd4: session needs room for following op to error out
Alec Berg <[email protected]>
iio: querying buffer scan_mask should return 0/1
Alan Stern <[email protected]>
USB: fix crash during hotplug of PCI USB controller card
H. Peter Anvin <[email protected]>
x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
Petr Mladek <[email protected]>
ftrace/x86: One more missing sync after fixup of function modification failure
Mark Tinguely <[email protected]>
xfs: fix directory hash ordering bug
Larry Finger <[email protected]>
staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0
Himangi Saraogi <[email protected]>
staging:serqt_usb2: Fix sparse warning restricted __le16 degrades to integer
David Fries <[email protected]>
w1: fix w1_send_slave dropping a slave id
Krzysztof Kozlowski <[email protected]>
mfd: tps65910: Fix possible invalid pointer dereference on regmap_add_irq_chip fail
Krzysztof Kozlowski <[email protected]>
mfd: max8997: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: max8998: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: max8925: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: max77693: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: max77686: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: 88pm860x: Fix I2C device resource leak on regmap init fail
Krzysztof Kozlowski <[email protected]>
mfd: 88pm860x: Fix possible NULL pointer dereference on i2c_new_dummy error
Krzysztof Kozlowski <[email protected]>
mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error
Tomas Winkler <[email protected]>
mei: me: do not load the driver if the FW doesn't support MEI interface
Sebastian Ott <[email protected]>
s390/cio: fix driver callback initialization for ccw consoles
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add support of ALC288 codec
Takashi Iwai <[email protected]>
ALSA: hda - Fix silent speaker output due to mute LED fixup
Takashi Iwai <[email protected]>
ALSA: ice1712: Fix boundary checks in PCM pointer ops
W. Trevor King <[email protected]>
ALSA: hda - Enable beep for ASUS 1015E
Laura Abbott <[email protected]>
ARM: 7728/1: mm: Use phys_addr_t properly for ioremap functions
Thomas Petazzoni <[email protected]>
ARM: mvebu: ensure the mdio node has a clock reference on Armada 370/XP
Liu Hua <[email protected]>
ARM: 8030/1: ARM : kdump : add arch_crash_save_vmcoreinfo
Xiangyu Lu <[email protected]>
ARM: 8027/1: fix do_div() bug in big-endian systems
Christopher Covington <[email protected]>
ARM: 8007/1: Remove extraneous kcmp syscall ignore
Will Deacon <[email protected]>
ARM: 7954/1: mm: remove remaining domain support from ARMv6
Tomasz Figa <[email protected]>
ARM: dts: Keep G3D regulator always on for exynos5250-arndale
Roger Quadros <[email protected]>
ARM: OMAP3: hwmod data: Correct clock domains for USB modules
Nishanth Menon <[email protected]>
ARM: OMAP4: Fix definition of IS_PM44XX_ERRATUM
Stefan Sørensen <[email protected]>
ARM: OMAP2+: INTC: Acknowledge stuck active interrupts
Brian Austin <[email protected]>
ASoC: cs42l73: Fix mask bits for SOC_VALUE_ENUM_SINGLE
Brian Austin <[email protected]>
ASoC: cs42l52: Fix mask bits for SOC_VALUE_ENUM_SINGLE
Brian Austin <[email protected]>
ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
Catalin Marinas <[email protected]>
arm64: Make DMA coherent and strongly ordered mappings not executable
Catalin Marinas <[email protected]>
arm64: Do not synchronise I and D caches for special ptes
-------------
Diffstat:
Documentation/video4linux/gspca.txt | 1 + Makefile | 4 +- arch/arm/boot/dts/armada-370-xp.dtsi | 1 + arch/arm/boot/dts/exynos5250-arndale.dts | 1 + arch/arm/include/asm/div64.h | 2 +- arch/arm/include/asm/futex.h | 6 -- arch/arm/include/asm/io.h | 8 +-- arch/arm/include/asm/pgtable-2level.h | 1 + arch/arm/include/asm/unistd.h | 1 - arch/arm/kernel/machine_kexec.c | 7 ++ arch/arm/mach-ebsa110/core.c | 2 +- arch/arm/mach-imx/mm-imx3.c | 2 +- arch/arm/mach-iop13xx/io.c | 2 +- arch/arm/mach-ixp4xx/common.c | 2 +- arch/arm/mach-msm/common.h | 2 +- arch/arm/mach-msm/io.c | 2 +- arch/arm/mach-omap2/irq.c | 8 +++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 4 +- arch/arm/mach-omap2/pm.h | 2 +- arch/arm/mm/Kconfig | 3 +- arch/arm/mm/ioremap.c | 10 +-- arch/arm/mm/mmu.c | 10 +++ arch/arm/mm/nommu.c | 6 +- arch/arm/mm/proc-macros.S | 19 ++---- arch/arm/mm/proc-v7-2level.S | 7 -- arch/arm64/include/asm/pgtable.h | 8 +-- arch/s390/include/asm/ccwdev.h | 2 +- arch/sh/kernel/dumpstack.c | 2 +- arch/x86/boot/compressed/eboot.c | 5 +- arch/x86/boot/compressed/head_32.S | 14 ++-- arch/x86/boot/compressed/head_64.S | 9 +-- arch/x86/kernel/ftrace.c | 2 +- arch/x86/kernel/ldt.c | 11 ++++ drivers/block/mtip32xx/mtip32xx.c | 1 + drivers/iio/industrialio-buffer.c | 6 +- drivers/infiniband/hw/ehca/ehca_cq.c | 1 + drivers/infiniband/hw/ipath/ipath_diag.c | 66 +++++++------------ drivers/infiniband/hw/mthca/mthca_provider.c | 1 + drivers/infiniband/hw/nes/nes_verbs.c | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 16 +++-- drivers/media/dvb-frontends/m88rs2000.c | 19 +++++- drivers/media/pci/saa7134/saa7134-cards.c | 4 +- drivers/media/platform/omap3isp/isppreview.c | 9 +++ drivers/media/usb/em28xx/em28xx-dvb.c | 3 +- drivers/media/usb/gspca/sn9c20x.c | 1 + drivers/media/usb/uvc/uvc_video.c | 20 +++++- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 +- drivers/mfd/88pm860x-core.c | 6 ++ drivers/mfd/max77686.c | 4 ++ drivers/mfd/max77693.c | 12 +++- drivers/mfd/max8925-i2c.c | 9 +++ drivers/mfd/max8997.c | 18 +++++ drivers/mfd/max8998.c | 4 ++ drivers/mfd/sec-core.c | 4 ++ drivers/mfd/tps65910.c | 4 +- drivers/misc/mei/hw-me-regs.h | 5 ++ drivers/misc/mei/pci-me.c | 30 +++++++-- drivers/s390/char/con3215.c | 2 +- drivers/s390/char/con3270.c | 6 +- drivers/s390/char/raw3270.c | 10 ++- drivers/s390/char/raw3270.h | 2 +- drivers/s390/cio/device.c | 3 +- drivers/scsi/arcmsr/arcmsr_hba.c | 7 +- drivers/scsi/qla2xxx/qla_os.c | 6 +- drivers/staging/rtl8712/rtl871x_recv.c | 13 ++-- drivers/staging/serqt_usb2/serqt_usb2.c | 2 +- drivers/target/iscsi/iscsi_target.c | 4 +- drivers/target/tcm_fc/tfc_sess.c | 1 + drivers/tty/hvc/hvc_console.c | 6 +- drivers/usb/core/driver.c | 94 ++++++++++++++++----------- drivers/usb/core/hcd-pci.c | 2 +- drivers/usb/core/hub.c | 5 +- drivers/usb/core/usb.h | 2 +- drivers/usb/dwc3/core.h | 6 +- drivers/usb/gadget/tcm_usb_gadget.c | 2 +- drivers/usb/gadget/zero.c | 2 +- drivers/usb/host/xhci-pci.c | 15 +++-- drivers/usb/host/xhci.c | 6 +- drivers/usb/musb/musb_core.c | 5 +- drivers/usb/phy/phy-ulpi.c | 2 + drivers/usb/serial/pl2303.c | 3 + drivers/usb/serial/pl2303.h | 5 +- drivers/w1/w1_netlink.c | 25 +++---- fs/ext4/file.c | 2 +- fs/ext4/xattr.c | 23 +++++-- fs/nfsd/nfs4callback.c | 4 +- fs/nfsd/nfs4proc.c | 9 ++- fs/nfsd/nfs4state.c | 13 ++-- fs/nfsd/nfs4xdr.c | 5 ++ fs/nfsd/nfsctl.c | 5 ++ fs/nfsd/vfs.c | 9 +++ fs/ocfs2/buffer_head_io.c | 2 - fs/ocfs2/dlm/dlmrecovery.c | 29 ++++++--- fs/reiserfs/dir.c | 6 +- fs/xfs/xfs_da_btree.c | 2 +- include/linux/sunrpc/svcsock.h | 1 + kernel/sysctl.c | 6 ++ mm/hugetlb.c | 1 + mm/mlock.c | 2 + mm/rmap.c | 14 +++- net/sunrpc/svcsock.c | 16 +++++ sound/pci/hda/patch_realtek.c | 8 ++- sound/pci/ice1712/ice1712.c | 15 +++-- sound/soc/codecs/cs42l51.c | 9 ++- sound/soc/codecs/cs42l52.c | 8 +-- sound/soc/codecs/cs42l73.c | 6 +- 106 files changed, 561 insertions(+), 285 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/86 arm64: Do not synchronise I and D caches for special ptes
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit 71fdb6bf61bf0692f004f9daf5650392c0cfe300 upstream.
Special pte mappings are not intended to be executable and do not even have an associated struct page. This patch ensures that we do not call __sync_icache_dcache() on such ptes.
--- arch/arm64/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +1 -1
@@ -161,7 +161,7 @@ static inline void set_pte_at(struct mm_ pte_t *ptep, pte_t pte) { if (pte_valid_user(pte)) { - if (pte_exec(pte)) +if (!pte_special (pte) &&pte_exec (pte))__sync_icache_dcache (pte, addr);if (!pte_dirty (pte)) pte =pte_wrprotect (pte);
Greg Kroah-Hartman
maintainerPATCH 2/86 arm64: Make DMA coherent and strongly ordered mappings not executable
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit de2db7432917a82b62d55bb59635586eeca6d1bd upstream.
pgprot_{dmacoherent,writecombine,noncached} don't need to generate executable mappings with side-effects like __sync_icache_dcache() being called when the mapping is in user space.
--- arch/arm64/include/asm/pgtable.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/pgtable.h +3 -3
@@ -182,11 +182,11 @@ static inline void set_pte_at(struct mm_* Mark the prot value as uncacheable and unbufferable. */ #define pgprot_noncached (prot) \ - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE)) + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)#define pgprot_writecombine (prot) \ - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC)) + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)#define pgprot_dmacoherent (prot) \ - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC)) + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)#define __HAVE_PHYS_MEM_ACCESS_PROTstruct file ; extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
Greg Kroah-Hartman
maintainerPATCH 3/86 ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Austin <[email protected]>
commit 7272e051157ccd5871b5d939548d0ba5a94a2965 upstream.
The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros Fixed the TLV for aout_tlv to show -102dB correctly
--- sound/soc/codecs/cs42l51.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/soc/codecs/cs42l51.c +4 -5
@@ -124,9 +124,8 @@ static int cs42l51_set_chan_mix(struct s static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0); static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0); -/* This is a lie. after -102 db, it stays at -102 */ -/* maybe a range would be better */ -static const DECLARE_TLV_DB_SCALE(aout_tlv, -11550, 50, 0); + +static const DECLARE_TLV_DB_SCALE(aout_tlv, -10200, 50, 0); static const DECLARE_TLV_DB_SCALE(boost_tlv, 1600, 1600, 0);static const char *chan_mix[] = {
@@ -141,7 +140,7 @@ static const struct soc_enum cs42l51_chastatic const struct snd_kcontrol_new cs42l51_snd_controls[] = {SOC_DOUBLE_R_SX_TLV ("PCM Playback Volume" ,CS42L51_PCMA_VOL ,CS42L51_PCMB_VOL , -6 ,0x19 ,0x7F , adc_pcm_tlv), +0 ,0x19 ,0x7F , adc_pcm_tlv),SOC_DOUBLE_R ("PCM Playback Switch" ,CS42L51_PCMA_VOL ,CS42L51_PCMB_VOL ,7 ,1 ,1 ), SOC_DOUBLE_R_SX_TLV("Analog Playback Volume",
@@ -149,7 +148,7 @@ static const struct snd_kcontrol_new cs4 0, 0x34, 0xE4, aout_tlv),SOC_DOUBLE_R_SX_TLV ("ADC Mixer Volume" ,CS42L51_ADCA_VOL ,CS42L51_ADCB_VOL , -6 ,0x19 ,0x7F , adc_pcm_tlv), +0 ,0x19 ,0x7F , adc_pcm_tlv),SOC_DOUBLE_R ("ADC Mixer Switch" ,CS42L51_ADCA_VOL ,CS42L51_ADCB_VOL ,7 ,1 ,1 ), SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0),
Greg Kroah-Hartman
maintainerPATCH 4/86 ASoC: cs42l52: Fix mask bits for SOC_VALUE_ENUM_SINGLE
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Austin <[email protected]>
commit d31a33dd7792c7d6c11fda226a3b9e4fb7f86f95 upstream.
The mask bits values were wrong for the SOC_VALUE_ENUM_SINGLE for the PCM/ADC Swap controls
--- sound/soc/codecs/cs42l52.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/cs42l52.c +4 -4
@@ -350,7 +350,7 @@ static const char * const right_swap_texstatic const unsigned int swap_values[] = {0 ,1 ,3 };static const struct soc_enum adca_swap_enum = -SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,2 ,1 , +SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,2 ,3 ,ARRAY_SIZE (left_swap_text), left_swap_text, swap_values);
@@ -359,7 +359,7 @@ static const struct snd_kcontrol_new adcSOC_DAPM_ENUM ("Route" , adca_swap_enum);static const struct soc_enum pcma_swap_enum = -SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,6 ,1 , +SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,6 ,3 ,ARRAY_SIZE (left_swap_text), left_swap_text, swap_values);
@@ -368,7 +368,7 @@ static const struct snd_kcontrol_new pcmSOC_DAPM_ENUM ("Route" , pcma_swap_enum);static const struct soc_enum adcb_swap_enum = -SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,0 ,1 , +SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,0 ,3 ,ARRAY_SIZE (right_swap_text), right_swap_text, swap_values);
@@ -377,7 +377,7 @@ static const struct snd_kcontrol_new adcSOC_DAPM_ENUM ("Route" , adcb_swap_enum);static const struct soc_enum pcmb_swap_enum = -SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,4 ,1 , +SOC_VALUE_ENUM_SINGLE (CS42L52_ADC_PCM_MIXER ,4 ,3 ,ARRAY_SIZE (right_swap_text), right_swap_text, swap_values);
Greg Kroah-Hartman
maintainerPATCH 5/86 ASoC: cs42l73: Fix mask bits for SOC_VALUE_ENUM_SINGLE
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Austin <[email protected]>
commit 1555b652970e541fa1cb80c61ffc696bbfb92bb7 upstream.
The mask bits values were wrong for the SOC_VALUE_ENUM_SINGLE for the mono mix controls.
--- sound/soc/codecs/cs42l73.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/cs42l73.c +3 -3
@@ -325,7 +325,7 @@ static const char * const cs42l73_mono_mstatic const unsigned int cs42l73_mono_mix_values[] = {0 ,1 ,2 };static const struct soc_enum spk_asp_enum = -SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,6 ,1 , +SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,6 ,3 ,ARRAY_SIZE (cs42l73_mono_mix_texts), cs42l73_mono_mix_texts, cs42l73_mono_mix_values);
@@ -343,7 +343,7 @@ static const struct snd_kcontrol_new spkSOC_DAPM_ENUM ("Route" , spk_xsp_enum);static const struct soc_enum esl_asp_enum = -SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,2 ,5 , +SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,2 ,3 ,ARRAY_SIZE (cs42l73_mono_mix_texts), cs42l73_mono_mix_texts, cs42l73_mono_mix_values);
@@ -352,7 +352,7 @@ static const struct snd_kcontrol_new eslSOC_DAPM_ENUM ("Route" , esl_asp_enum);static const struct soc_enum esl_xsp_enum = -SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,0 ,7 , +SOC_VALUE_ENUM_SINGLE (CS42L73_MMIXCTL ,0 ,3 ,ARRAY_SIZE (cs42l73_mono_mix_texts), cs42l73_mono_mix_texts, cs42l73_mono_mix_values);
Greg Kroah-Hartman
maintainerPATCH 6/86 ARM: OMAP2+: INTC: Acknowledge stuck active interrupts
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Sørensen <[email protected]>
commit 698b48532539484b012fb7c4176b959d32a17d00 upstream.
When an interrupt has become active on the INTC it will stay active until it is acked, even if masked or de-asserted. The INTC_PENDING_IRQn registers are however updated and since these are used by omap_intc_handle_irq to determine which interrupt to handle, it will never see the active interrupt. This will result in a storm of useless interrupts that is only stopped when another higher priority interrupt is asserted.
Fix by sending the INTC an acknowledge if we find no interrupts to handle.
--- arch/arm/mach-omap2/irq.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/mach-omap2/irq.c +8 -0
@@ -222,6 +222,7 @@ void __init ti81xx_init_irq(void)static inline void omap_intc_handle_irq (void __iomem *base_addr,struct pt_regs *regs) {u32 irqnr; +int handled_irq =0 ; do { irqnr = readl_relaxed(base_addr + 0x98);
@@ -249,8 +250,15 @@ out:if (irqnr) { irqnr =irq_find_mapping (domain, irqnr);handle_IRQ (irqnr, regs); + handled_irq =1 ; } }while (irqnr); + +/* If an irq is masked or deasserted while active, we will +* keep ending up here with no irq handled. So remove it from +* the INTC with an ack.*/ +if (!handled_irq) +omap_ack_irq (NULL ); } asmlinkage void __exception_irq_entry omap2_intc_handle_irq(struct pt_regs *regs)
Greg Kroah-Hartman
maintainerPATCH 7/86 ARM: OMAP4: Fix definition of IS_PM44XX_ERRATUM
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit 07484ca33ef83900f5cfbde075c1a19e5a237aa1 upstream.
Just like IS_PM34XX_ERRATUM, IS_PM44XX_ERRATUM is valid only if CONFIG_PM is enabled, else, disabling CONFIG_PM results in build failure complaining about the following:arch/arm/mach-omap2/built-in.o: In function `omap4_boot_secondary':
:(.text+0x8a70): undefined reference to `pm44xx_errata'
--- arch/arm/mach-omap2/pm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/pm.h +1 -1
@@ -103,7 +103,7 @@ static inline void enable_omap3630_toggl#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) -#if defined(CONFIG_ARCH_OMAP4 ) +#if defined(CONFIG_PM ) && defined(CONFIG_ARCH_OMAP4 )extern u16 pm44xx_errata;#define IS_PM44XX_ERRATUM (id) (pm44xx_errata & (id))#else
Greg Kroah-Hartman
maintainerPATCH 8/86 ARM: OMAP3: hwmod data: Correct clock domains for USB modules
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit c6c56697ae4bf1226263c19e8353343d7083f40e upstream.
OMAP3 doesn't contain "l3_init_clkdm" clock domain. Use the proper clock domains for USB Host and USB TLL modules.
Gets rid of the following warnings during boot
omap_hwmod: usb_host_hs: could not associate to clkdm l3_init_clkdm
omap_hwmod: usb_tll_hs: could not associate to clkdm l3_init_clkdm
--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +2 -2
@@ -1955,7 +1955,7 @@ static struct omap_hwmod_irq_info omap3xstatic struct omap_hwmod omap3xxx_usb_host_hs_hwmod = { .name ="usb_host_hs" , .class = &omap3xxx_usb_host_hs_hwmod_class, - .clkdm_name ="l3_init_clkdm" , + .clkdm_name ="usbhost_clkdm" , .mpu_irqs = omap3xxx_usb_host_hs_irqs, .main_clk ="usbhost_48m_fck" , .prcm = {
@@ -2040,7 +2040,7 @@ static struct omap_hwmod_irq_info omap3xstatic struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = { .name ="usb_tll_hs" , .class = &omap3xxx_usb_tll_hs_hwmod_class, - .clkdm_name ="l3_init_clkdm" , + .clkdm_name ="core_l4_clkdm" , .mpu_irqs = omap3xxx_usb_tll_hs_irqs, .main_clk ="usbtll_fck" , .prcm = {
Greg Kroah-Hartman
maintainerPATCH 9/86 ARM: dts: Keep G3D regulator always on for exynos5250-arndale
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Figa <[email protected]>
commit bfeda827278f09f4db35877e5f1ca9c149ca2890 upstream.
Apparently, if G3D regulator is powered off, the SoC cannot enter low power modes and just hangs. This patch fixes this by keeping the regulator always on when the system is running, as suggested by Exynos 4 User's Manual in case of Exynos4210/4x12 SoCs (Exynos5250 UM does not have such note, but observed behavior seems to confirm that it is true for this SoC as well).
This fixes an issue preventing Arndale board from entering sleep mode observed since commit
346f372f7b72a0 clk: exynos5250: Add CLK_IGNORE_UNUSED flag for pmu clock
that landed in kernel 3.10, which has fixed the clock driver to make the SoC actually try to enter the sleep mode.
--- arch/arm/boot/dts/exynos5250-arndale.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/exynos5250-arndale.dts +1 -0
@@ -263,6 +263,7 @@ regulator-name = "vdd_g3d"; regulator-min-microvolt = <1000000>; regulator-max-microvolt = <1000000>; + regulator-always-on; regulator-boot-on; op_mode = <1>; };
Greg Kroah-Hartman
maintainerPATCH 10/86 ARM: 7954/1: mm: remove remaining domain support from ARMv6
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit b6ccb9803e90c16b212cf4ed62913a7591e79a39 upstream.
CPU_32v6 currently selects CPU_USE_DOMAINS if CPU_V6 and MMU. This is because ARM 1136 r0pX CPUs lack the v6k extensions, and therefore do not have hardware thread registers. The lack of these registers requires the kernel to update the vectors page at each context switch in order to write a new TLS pointer. This write must be done via the userspace mapping, since aliasing caches can lead to expensive flushing when using kmap. Finally, this requires the vectors page to be mapped r/w for kernel and r/o for user, which has implications for things like put_user which must trigger CoW appropriately when targetting user pages.
The upshot of all this is that a v6/v7 kernel makes use of domains to segregate kernel and user memory accesses. This has the nasty side-effect of making device mappings executable, which has been observed to cause subtle bugs on recent cores (e.g. Cortex-A15 performing a speculative instruction fetch from the GIC and acking an interrupt in the process).
This patch solves this problem by removing the remaining domain support from ARMv6. A new memory type is added specifically for the vectors page which allows that page (and only that page) to be mapped as user r/o, kernel r/w. All other user r/o pages are mapped also as kernel r/o. Patch co-developed with Russell King.
--- arch/arm/include/asm/futex.h | 6 ------ arch/arm/include/asm/pgtable-2level.h | 1 + arch/arm/mm/Kconfig | 3 +-- arch/arm/mm/mmu.c | 10 ++++++++++ arch/arm/mm/proc-macros.S | 19 ++++++------------- arch/arm/mm/proc-v7-2level.S | 7 ------- 6 files changed, 18 insertions(+), 28 deletions(-)
arch/arm/include/asm/futex.h +0 -6
@@ -3,11 +3,6 @@#ifdef __KERNEL__ -#if defined(CONFIG_CPU_USE_DOMAINS ) && defined(CONFIG_SMP ) -/* ARM doesn't provide unprivileged exclusive memory accessors */ -#include <asm-generic/futex.h> -#else -#include <linux/futex.h> #include <linux/uaccess.h> #include <asm/errno.h>
@@ -164,6 +159,5 @@ futex_atomic_op_inuser (int encoded_op,return ret; } -#endif /* !(CPU_USE_DOMAINS && SMP) */ #endif /* __KERNEL__ */ #endif /* _ASM_ARM_FUTEX_H */
arch/arm/include/asm/pgtable-2level.h +1 -0
@@ -140,6 +140,7 @@#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2)/* 1100 */ #define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2)/* 1001 */ #define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2)/* 1011 */ +#define L_PTE_MT_VECTORS (_AT(pteval_t, 0x0f) << 2)/* 1111 */ #define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)#ifndef __ASSEMBLY__
arch/arm/mm/Kconfig +1 -2
@@ -436,7 +436,6 @@ config CPU_32v5 config CPU_32v6 bool - select CPU_USE_DOMAINS if CPU_V6 && MMU select TLS_REG_EMUL if !CPU_32v6K && !MMU config CPU_32v6K
@@ -651,7 +650,7 @@ config ARM_VIRT_EXT config SWP_EMULATE bool "Emulate SWP/SWPB instructions" - depends on !CPU_USE_DOMAINS && CPU_V7 + depends on CPU_V7 default y if SMP select HAVE_PROC_CPU if PROC_FS help
arch/arm/mm/mmu.c +10 -0
@@ -459,6 +459,16 @@ static void __init build_mem_type_table( hyp_device_pgprot = s2_device_pgprot = mem_types[MT_DEVICE ].prot_pte;/* +* We don't use domains on ARMv6 (since this causes problems with +* v6/v7 kernels), so we must use a separate memory type for user +* r/o, kernel r/w to map the vectors page. +*/ +#ifndef CONFIG_ARM_LPAE +if (cpu_arch == CPU_ARCH_ARMv6) + vecs_pgprot |=L_PTE_MT_VECTORS ; +#endif + +/* * ARMv6 and above have extended page tables. */ if (cpu_arch >= CPU_ARCH_ARMv6 && (cr &CR_XP )) {
arch/arm/mm/proc-macros.S +6 -13
@@ -112,13 +112,9 @@ * 100x 1 0 1 r/o no acc * 10x0 1 0 1 r/o no acc * 1011 0 0 1 r/w no acc - * 110x 0 1 0 r/w r/o - * 11x0 0 1 0 r/w r/o - * 1111 0 1 1 r/w r/w - * - * If !CONFIG_CPU_USE_DOMAINS, the following permissions are changed: * 110x 1 1 1 r/o r/o * 11x0 1 1 1 r/o r/o + * 1111 0 1 1 r/w r/w */ .macro armv6_mt_table pfx \pfx\()_mt_table:
@@ -137,7 +133,7 @@ .long PTE_EXT_TEX(2) @ L_PTE_MT_DEV_NONSHARED .long 0x00 @ unused .long 0x00 @ unused - .long 0x00 @ unused + .long PTE_CACHEABLE | PTE_BUFFERABLE | PTE_EXT_APX @ L_PTE_MT_VECTORS .endm .macro armv6_set_pte_ext pfx
@@ -158,24 +154,21 @@ tst r1, #L_PTE_USER orrne r3, r3, #PTE_EXT_AP1 -#ifdef CONFIG_CPU_USE_DOMAINS - @ allow kernel read/write access to read-only user pages tstne r3, #PTE_EXT_APX - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 -#endif + + @ user read-only -> kernel read-only + bicne r3, r3, #PTE_EXT_AP0 tst r1, #L_PTE_XN orrne r3, r3, #PTE_EXT_XN - orr r3, r3, r2 + eor r3, r3, r2 tst r1, #L_PTE_YOUNG tstne r1, #L_PTE_PRESENT moveq r3, #0 -#ifndef CONFIG_CPU_USE_DOMAINS tstne r1, #L_PTE_NONE movne r3, #0 -#endif str r3, [r0] mcr p15, 0, r0, c7, c10, 1 @ flush_pte
arch/arm/mm/proc-v7-2level.S +0 -7
@@ -90,21 +90,14 @@ ENTRY(cpu_v7_set_pte_ext) tst r1, #L_PTE_USER orrne r3, r3, #PTE_EXT_AP1 -#ifdef CONFIG_CPU_USE_DOMAINS - @ allow kernel read/write access to read-only user pages - tstne r3, #PTE_EXT_APX - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 -#endif tst r1, #L_PTE_XN orrne r3, r3, #PTE_EXT_XN tst r1, #L_PTE_YOUNG tstne r1, #L_PTE_VALID -#ifndef CONFIG_CPU_USE_DOMAINS eorne r1, r1, #L_PTE_NONE tstne r1, #L_PTE_NONE -#endif moveq r3, #0 ARM( str r3, [r0, #2048]! )
Greg Kroah-Hartman
maintainerPATCH 11/86 ARM: 8007/1: Remove extraneous kcmp syscall ignore
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Covington <[email protected]>
commit 95c52fe063351192e0f4ffb70ef9bac1aa26f5a4 upstream.
The kcmp system call was ported to ARM in
commit 3f7d1fe108dbaefd0c57a41753fc2c90b395f458 "ARM: 7665/1: Wire up kcmp syscall".
--- arch/arm/include/asm/unistd.h | 1 - 1 file changed, 1 deletion(-)
arch/arm/include/asm/unistd.h +0 -1
@@ -48,6 +48,5 @@*/ #define __IGNORE_fadvise64_64#define __IGNORE_migrate_pages -#define __IGNORE_kcmp#endif /* __ASM_ARM_UNISTD_H */
Greg Kroah-Hartman
maintainerPATCH 12/86 ARM: 8027/1: fix do_div() bug in big-endian systems
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiangyu Lu <[email protected]>
commit 80bb3ef109ff40a7593d9481c17de9bbc4d7c0e2 upstream.
In big-endian systems, "%1" get the most significant part of the value, cause the instruction to get the wrong result.
When viewing ftrace record in big-endian ARM systems, we found that the timestamp errors:
swapper-0 [001] 1325.970000: 0:120:R ==> [001] 16:120:R events/1 events/1-16 [001] 1325.970000: 16:120:S ==> [001] 0:120:R swapper swapper-0 [000] 1325.1000000: 0:120:R + [000] 15:120:R events/0 swapper-0 [000] 1325.1000000: 0:120:R ==> [000] 15:120:R events/0 swapper-0 [000] 1326.030000: 0:120:R + [000] 1150:120:R sshd swapper-0 [000] 1326.030000: 0:120:R ==> [000] 1150:120:R sshd
When viewed ftrace records, it will call the do_div(n, base) function, which achieved arch/arm/include/asm/div64.h in. When n = 10000000, base = 1000000, in do_div(n, base) will execute "umull %Q0, %R0, %1, %Q2".
--- arch/arm/include/asm/div64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/div64.h +1 -1
@@ -156,7 +156,7 @@/* Select the best insn combination to perform the */ \/* actual __m * __n / (__p << 64) operation. */ \if (!__c) { \ - asm ("umull %Q0, %R0, %1, %Q2\n\t" \ + asm ("umull %Q0, %R0, %Q1, %Q2\n\t" \"mov %Q0, #0" \ :"=&r" (__res) \ : "r" (__m), "r" (__n) \
Greg Kroah-Hartman
maintainerPATCH 13/86 ARM: 8030/1: ARM : kdump : add arch_crash_save_vmcoreinfo
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Hua <[email protected]>
commit 56b700fd6f1e49149880fb1b6ffee0dca5be45fb upstream.
For vmcore generated by LPAE enabled kernel, user space utility such as crash needs additional infomation to parse.
So this patch add arch_crash_save_vmcoreinfo as what PAE enabled i386 linux does.
--- arch/arm/kernel/machine_kexec.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/kernel/machine_kexec.c +7 -0
@@ -169,3 +169,10 @@ void machine_kexec(struct kimage *image)soft_restart (reboot_code_buffer_phys); } + +void arch_crash_save_vmcoreinfo (void ) +{ +#ifdef CONFIG_ARM_LPAE +VMCOREINFO_CONFIG (ARM_LPAE ); +#endif +}
Greg Kroah-Hartman
maintainerPATCH 14/86 ARM: mvebu: ensure the mdio node has a clock reference on Armada 370/XP
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit a6e03dd451c724f785277d8ecca5d1a0b886d892 upstream.
The mvmdio driver accesses some register of the Ethernet unit. It therefore takes a reference and enables a clock. However, on Armada 370/XP, no clock specification was given in the Device Tree, which leads the mvmdio driver to fail when being used as a module and loaded before the mvneta driver: it tries to access a register from a hardware unit that isn't clocked.
--- arch/arm/boot/dts/armada-370-xp.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/armada-370-xp.dtsi +1 -0
@@ -92,6 +92,7 @@ #size-cells = <0>; compatible = "marvell,orion-mdio"; reg = <0x72004 0x4>; + clocks = <&gateclk 4>; }; ethernet@70000 {
Greg Kroah-Hartman
maintainerPATCH 15/86 ARM: 7728/1: mm: Use phys_addr_t properly for ioremap functions
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit 9b97173e785a54c5df0aa23d1e1f680f61e36e43 upstream.
Several of the ioremap functions use unsigned long in places resulting in truncation if physical addresses greater than 4G are passed in. Change the types of the functions and the callers accordingly.
--- arch/arm/include/asm/io.h | 8 ++++---- arch/arm/mach-ebsa110/core.c | 2 +- arch/arm/mach-imx/mm-imx3.c | 2 +- arch/arm/mach-iop13xx/io.c | 2 +- arch/arm/mach-ixp4xx/common.c | 2 +- arch/arm/mach-msm/common.h | 2 +- arch/arm/mach-msm/io.c | 2 +- arch/arm/mm/ioremap.c | 10 +++++----- arch/arm/mm/nommu.c | 6 +++--- 9 files changed, 18 insertions(+), 18 deletions(-)
arch/arm/include/asm/io.h +4 -4
@@ -130,16 +130,16 @@ static inline u32 __raw_readl(const vola*/ extern void __iomem *__arm_ioremap_pfn_caller (unsigned long ,unsigned long ,size_t ,unsigned int ,void *); -extern void __iomem *__arm_ioremap_caller (unsigned long ,size_t ,unsigned int , +extern void __iomem *__arm_ioremap_caller (phys_addr_t ,size_t ,unsigned int ,void *);extern void __iomem *__arm_ioremap_pfn (unsigned long ,unsigned long ,size_t ,unsigned int ); -extern void __iomem *__arm_ioremap (unsigned long ,size_t ,unsigned int ); -extern void __iomem *__arm_ioremap_exec (unsigned long ,size_t ,bool cached); +extern void __iomem *__arm_ioremap (phys_addr_t ,size_t ,unsigned int ); +extern void __iomem *__arm_ioremap_exec (phys_addr_t ,size_t ,bool cached);extern void __iounmap (volatile void __iomem *addr);extern void __arm_iounmap (volatile void __iomem *addr); -extern void __iomem * (*arch_ioremap_caller)(unsigned long ,size_t , +extern void __iomem * (*arch_ioremap_caller)(phys_addr_t ,size_t ,unsigned int ,void *);extern void (*arch_iounmap)(volatile void __iomem *);
arch/arm/mach-ebsa110/core.c +1 -1
@@ -116,7 +116,7 @@ static void __init ebsa110_map_io(void)iotable_init (ebsa110_io_desc,ARRAY_SIZE (ebsa110_io_desc)); } -static void __iomem *ebsa110_ioremap_caller (unsigned long cookie,size_t size, +static void __iomem *ebsa110_ioremap_caller (phys_addr_t cookie,size_t size,unsigned int flags,void *caller) {return (void __iomem *)cookie;
arch/arm/mach-imx/mm-imx3.c +1 -1
@@ -65,7 +65,7 @@ static void imx3_idle(void) : "=r" (reg)); } -static void __iomem *imx3_ioremap_caller (unsigned long phys_addr,size_t size, +static void __iomem *imx3_ioremap_caller (phys_addr_t phys_addr,size_t size,unsigned int mtype,void *caller) {if (mtype ==MT_DEVICE ) {
arch/arm/mach-iop13xx/io.c +1 -1
@@ -23,7 +23,7 @@#include "pci.h" -static void __iomem *__iop13xx_ioremap_caller (unsigned long cookie, +static void __iomem *__iop13xx_ioremap_caller (phys_addr_t cookie,size_t size,unsigned int mtype,void *caller) {void __iomem * retval;
arch/arm/mach-ixp4xx/common.c +1 -1
@@ -559,7 +559,7 @@ void ixp4xx_restart(char mode, const cha* fallback to the default. */ -static void __iomem *ixp4xx_ioremap_caller (unsigned long addr,size_t size, +static void __iomem *ixp4xx_ioremap_caller (phys_addr_t addr,size_t size,unsigned int mtype,void *caller) {if (!is_pci_memory (addr))
arch/arm/mach-msm/common.h +1 -1
@@ -23,7 +23,7 @@ extern void msm_map_msm8x60_io(void);extern void msm_map_msm8960_io (void );extern void msm_map_qsd8x50_io (void ); -extern void __iomem *__msm_ioremap_caller (unsigned long phys_addr,size_t size, +extern void __iomem *__msm_ioremap_caller (phys_addr_t phys_addr,size_t size,unsigned int mtype,void *caller);extern struct smp_operations msm_smp_ops;
arch/arm/mach-msm/io.c +1 -1
@@ -172,7 +172,7 @@ void __init msm_map_msm7x30_io(void) }#endif /* CONFIG_ARCH_MSM7X30 */ -void __iomem *__msm_ioremap_caller (unsigned long phys_addr,size_t size, +void __iomem *__msm_ioremap_caller (phys_addr_t phys_addr,size_t size,unsigned int mtype,void *caller) {if (mtype ==MT_DEVICE ) {
arch/arm/mm/ioremap.c +5 -5
@@ -331,10 +331,10 @@ void __iomem * __arm_ioremap_pfn_caller(return (void __iomem *) (offset + addr); } -void __iomem *__arm_ioremap_caller (unsigned long phys_addr,size_t size, +void __iomem *__arm_ioremap_caller (phys_addr_t phys_addr,size_t size,unsigned int mtype,void *caller) { -unsigned long last_addr; +phys_addr_t last_addr;unsigned long offset = phys_addr & ~PAGE_MASK ;unsigned long pfn =__phys_to_pfn (phys_addr);
@@ -367,12 +367,12 @@ __arm_ioremap_pfn(unsigned long pfn, uns }EXPORT_SYMBOL (__arm_ioremap_pfn); -void __iomem * (*arch_ioremap_caller)(unsigned long ,size_t , +void __iomem * (*arch_ioremap_caller)(phys_addr_t ,size_t ,unsigned int ,void *) = __arm_ioremap_caller;void __iomem * -__arm_ioremap (unsigned long phys_addr,size_t size,unsigned int mtype) +__arm_ioremap (phys_addr_t phys_addr,size_t size,unsigned int mtype) {return arch_ioremap_caller (phys_addr, size, mtype,__builtin_return_address (0 ));
@@ -387,7 +387,7 @@ EXPORT_SYMBOL(__arm_ioremap);* CONFIG_GENERIC_ALLOCATOR for allocating external memory. */ void __iomem * -__arm_ioremap_exec (unsigned long phys_addr,size_t size,bool cached) +__arm_ioremap_exec (phys_addr_t phys_addr,size_t size,bool cached) {unsigned int mtype;
arch/arm/mm/nommu.c +3 -3
@@ -87,16 +87,16 @@ void __iomem *__arm_ioremap_pfn_caller(ureturn __arm_ioremap_pfn (pfn, offset, size, mtype); } -void __iomem *__arm_ioremap (unsigned long phys_addr,size_t size, +void __iomem *__arm_ioremap (phys_addr_t phys_addr,size_t size,unsigned int mtype) {return (void __iomem *)phys_addr; }EXPORT_SYMBOL (__arm_ioremap); -void __iomem * (*arch_ioremap_caller)(unsigned long ,size_t ,unsigned int ,void *); +void __iomem * (*arch_ioremap_caller)(phys_addr_t ,size_t ,unsigned int ,void *); -void __iomem *__arm_ioremap_caller (unsigned long phys_addr,size_t size, +void __iomem *__arm_ioremap_caller (phys_addr_t phys_addr,size_t size,unsigned int mtype,void *caller) {return __arm_ioremap (phys_addr, size, mtype);
Greg Kroah-Hartman
maintainerPATCH 16/86 ALSA: hda - Enable beep for ASUS 1015E
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "W. Trevor King" <[email protected]>
commit a4b7f21d7b42b33609df3f86992a8deff80abfaf upstream.
The lspci -nnvv output contains (wrapped for line length):
00:1b.0 Audio device [0403]:
Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller [8086:1e20] (rev 04)
Subsystem: ASUSTeK Computer Inc. Device [1043:115d]
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -937,6 +937,7 @@ static int alc_codec_rename_from_preset(static const struct snd_pci_quirk beep_white_list[] = {SND_PCI_QUIRK (0x1043 ,0x103c ,"ASUS" ,1 ), +SND_PCI_QUIRK (0x1043 ,0x115d ,"ASUS" ,1 ),SND_PCI_QUIRK (0x1043 ,0x829f ,"ASUS" ,1 ),SND_PCI_QUIRK (0x1043 ,0x8376 ,"EeePC" ,1 ),SND_PCI_QUIRK (0x1043 ,0x83ce ,"EeePC" ,1 ),
Greg Kroah-Hartman
maintainerPATCH 17/86 ALSA: ice1712: Fix boundary checks in PCM pointer ops
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 4f8e940095536bc002a81666a4107a581c84e9b9 upstream.
PCM pointer callbacks in ice1712 driver check the buffer size boundary wrongly between bytes and frames. This leads to PCM core warnings
like:
snd_pcm_update_hw_ptr0: 105 callbacks suppressed
ALSA pcm_lib.c:352 BUG: pcmC3D0c:0, pos = 5461, buffer size = 5461, period size = 2730
This patch fixes these checks to be placed after the proper unit conversions.
--- sound/pci/ice1712/ice1712.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
sound/pci/ice1712/ice1712.c +10 -5
@@ -685,9 +685,10 @@ static snd_pcm_uframes_t snd_ice1712_plaif (!(snd_ice1712_read (ice,ICE1712_IREG_PBK_CTRL ) &1 ))return 0 ; ptr = runtime->buffer_size -inw (ice->ddma_port +4 ); + ptr =bytes_to_frames (substream->runtime, ptr);if (ptr == runtime->buffer_size) ptr =0 ; -return bytes_to_frames (substream->runtime, ptr); +return ptr; }static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer (struct snd_pcm_substream *substream)
@@ -704,9 +705,10 @@ static snd_pcm_uframes_t snd_ice1712_pla addr =ICE1712_DSC_ADDR0 ; ptr =snd_ice1712_ds_read (ice, substream->number *2 , addr) - ice->playback_con_virt_addr[substream->number]; + ptr =bytes_to_frames (substream->runtime, ptr);if (ptr == substream->runtime->buffer_size) ptr =0 ; -return bytes_to_frames (substream->runtime, ptr); +return ptr; }static snd_pcm_uframes_t snd_ice1712_capture_pointer (struct snd_pcm_substream *substream)
@@ -717,9 +719,10 @@ static snd_pcm_uframes_t snd_ice1712_capif (!(snd_ice1712_read (ice,ICE1712_IREG_CAP_CTRL ) &1 ))return 0 ; ptr =inl (ICEREG (ice,CONCAP_ADDR )) - ice->capture_con_virt_addr; + ptr =bytes_to_frames (substream->runtime, ptr);if (ptr == substream->runtime->buffer_size) ptr =0 ; -return bytes_to_frames (substream->runtime, ptr); +return ptr; }static const struct snd_pcm_hardware snd_ice1712_playback = {
@@ -1113,9 +1116,10 @@ static snd_pcm_uframes_t snd_ice1712_plaif (!(inl (ICEMT (ice,PLAYBACK_CONTROL )) &ICE1712_PLAYBACK_START ))return 0 ; ptr = ice->playback_pro_size - (inw (ICEMT (ice,PLAYBACK_SIZE )) <<2 ); + ptr =bytes_to_frames (substream->runtime, ptr);if (ptr == substream->runtime->buffer_size) ptr =0 ; -return bytes_to_frames (substream->runtime, ptr); +return ptr; }static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer (struct snd_pcm_substream *substream)
@@ -1126,9 +1130,10 @@ static snd_pcm_uframes_t snd_ice1712_capif (!(inl (ICEMT (ice,PLAYBACK_CONTROL )) &ICE1712_CAPTURE_START_SHADOW ))return 0 ; ptr = ice->capture_pro_size - (inw (ICEMT (ice,CAPTURE_SIZE )) <<2 ); + ptr =bytes_to_frames (substream->runtime, ptr);if (ptr == substream->runtime->buffer_size) ptr =0 ; -return bytes_to_frames (substream->runtime, ptr); +return ptr; }static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
Greg Kroah-Hartman
maintainerPATCH 18/86 ALSA: hda - Fix silent speaker output due to mute LED fixup
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 415d555e6b398b00fc1733f0113065a54df9106a upstream.
The recent fixups for HP laptops to support the mute LED made the speaker output silent on some machines. It turned out that they use the NID 0x18 for the speaker while it's also used for controlling the LED via VREF bits although the current driver code blindly assumes that such a node is a mic pin (where 0x18 is usually so).
This patch fixes the problem by only changing the VREF bits and keeping the other pin ctl bits.
--- sound/pci/hda/patch_realtek.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +3 -2
@@ -2859,8 +2859,9 @@ static void alc269_fixup_mic_mute_hook(vif (spec->mute_led_polarity) enabled = !enabled; - pinval =AC_PINCTL_IN_EN | - (enabled ?AC_PINCTL_VREF_HIZ :AC_PINCTL_VREF_80 ); + pinval =snd_hda_codec_get_pin_target (codec, spec->mute_led_nid); + pinval &= ~AC_PINCTL_VREFEN ; + pinval |= enabled ?AC_PINCTL_VREF_HIZ :AC_PINCTL_VREF_80 ;if (spec->mute_led_nid)snd_hda_set_pin_ctl_cache (codec, spec->mute_led_nid, pinval); }
Greg Kroah-Hartman
maintainerPATCH 19/86 ALSA: hda/realtek - Add support of ALC288 codec
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 7c66593286bcd153e4868383e675673a27071bd5 upstream.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -3903,6 +3903,7 @@ static int patch_alc269(struct hda_codec spec->codec_variant =ALC269_TYPE_ALC284 ;break ;case 0x10ec0286 : +case 0x10ec0288 : spec->codec_variant =ALC269_TYPE_ALC286 ;break ;case 0x10ec0255 :
@@ -4645,6 +4646,7 @@ static const struct hda_codec_preset snd { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 }, + { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 }, { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
Greg Kroah-Hartman
maintainerPATCH 20/86 s390/cio: fix driver callback initialization for ccw consoles
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit 2253e8d79237c69086ded391e6767afe16972527 upstream.
ccw consoles are in use before they can be properly registered with the driver core. For devices which are in use by a device driver we rely on the ccw_device's pointer to the driver callbacks to be valid. For ccw consoles this pointer is NULL until they are registered later during boot and we dereferenced this pointer. This worked by chance on 64 bit builds (cdev->drv was NULL but the optional callback cdev->drv->path_event was also NULL by coincidence) and was unnoticed until we received reports about boot failures on 31 bit systems. Fix it by initializing the driver pointer for ccw consoles.
--- arch/s390/include/asm/ccwdev.h | 2 +- drivers/s390/char/con3215.c | 2 +- drivers/s390/char/con3270.c | 6 +----- drivers/s390/char/raw3270.c | 10 +++++++++- drivers/s390/char/raw3270.h | 2 +- drivers/s390/cio/device.c | 3 ++- 6 files changed, 15 insertions(+), 10 deletions(-)
arch/s390/include/asm/ccwdev.h +1 -1
@@ -219,7 +219,7 @@ extern void ccw_device_get_id(struct ccw#define to_ccwdev (n) container_of(n, struct ccw_device, dev)#define to_ccwdrv (n) container_of(n, struct ccw_driver, driver) -extern struct ccw_device *ccw_device_probe_console (void ); +extern struct ccw_device *ccw_device_probe_console (struct ccw_driver *);extern void ccw_device_wait_idle (struct ccw_device *);extern int ccw_device_force_console (struct ccw_device *);
drivers/s390/char/con3215.c +1 -1
@@ -922,7 +922,7 @@ static int __init con3215_init(void) raw3215_freelist = req; } - cdev =ccw_device_probe_console (); + cdev =ccw_device_probe_console (&raw3215_ccw_driver);if (IS_ERR (cdev))return -ENODEV ;
drivers/s390/char/con3270.c +1 -5
@@ -576,7 +576,6 @@ static struct console con3270 = {static int __init con3270_init (void ) { -struct ccw_device *cdev;struct raw3270 *rp;void *cbuf;int i;
@@ -591,10 +590,7 @@ con3270_init(void)cpcmd ("TERM AUTOCR OFF" ,NULL ,0 ,NULL ); } - cdev =ccw_device_probe_console (); -if (IS_ERR (cdev)) -return -ENODEV ; - rp =raw3270_setup_console (cdev); + rp =raw3270_setup_console ();if (IS_ERR (rp))return PTR_ERR (rp);
drivers/s390/char/raw3270.c +9 -1
@@ -776,16 +776,24 @@ raw3270_setup_device(struct ccw_device * }#ifdef CONFIG_TN3270_CONSOLE +/* Tentative definition - see below for actual definition. */ +static struct ccw_driver raw3270_ccw_driver; +/* * Setup 3270 device configured as console. */ -struct raw3270 __init *raw3270_setup_console (struct ccw_device *cdev) +struct raw3270 __init *raw3270_setup_console (void ) { +struct ccw_device *cdev;unsigned long flags;struct raw3270 *rp;char *ascebc;int rc; + cdev =ccw_device_probe_console (&raw3270_ccw_driver); +if (IS_ERR (cdev)) +return ERR_CAST (cdev); + rp =kzalloc (sizeof (struct raw3270 ),GFP_KERNEL |GFP_DMA ); ascebc =kzalloc (256 ,GFP_KERNEL ); rc =raw3270_setup_device (cdev, rp, ascebc);
drivers/s390/char/raw3270.h +1 -1
@@ -190,7 +190,7 @@ raw3270_put_view(struct raw3270_view *viwake_up (&raw3270_wait_queue); } -struct raw3270 *raw3270_setup_console (struct ccw_device *cdev); +struct raw3270 *raw3270_setup_console (void );void raw3270_wait_cons_dev (struct raw3270 *);/* Notifier for device addition/removal */
drivers/s390/cio/device.c +2 -1
@@ -1610,7 +1610,7 @@ out_unlock:return rc; } -struct ccw_device *ccw_device_probe_console (void ) +struct ccw_device *ccw_device_probe_console (struct ccw_driver *drv) {struct io_subchannel_private *io_priv;struct ccw_device *cdev;
@@ -1632,6 +1632,7 @@ struct ccw_device *ccw_device_probe_conskfree (io_priv);return cdev; } + cdev->drv = drv;set_io_private (sch, io_priv); ret =ccw_device_console_enable (cdev, sch);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 21/86 mei: me: do not load the driver if the FW doesnt support MEI interface
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit 5e6533a6f52f1a8283b2f818f5828be99a417dd6 upstream.
NM and SPS FW types that may run on ME device on server platforms do not have valid MEI/HECI interface and driver should not be bound to it as this might lead to system hung.
In practice not all BIOSes effectively hide such devices from the OS and in some cases it is not possible.
We determine FW type by examining Host FW status registers in order to unbind the driver.
In this patch we are adding check for ME on Cougar Point, Lynx Point Devices
--- drivers/misc/mei/hw-me-regs.h | 5 +++++ drivers/misc/mei/pci-me.c | 30 +++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-)
drivers/misc/mei/hw-me-regs.h +5 -0
@@ -115,6 +115,11 @@#define MEI_DEV_ID_LPT_HR 0x8CBA/* Lynx Point H Refresh */ #define MEI_DEV_ID_WPT_LP 0x9CBA/* Wildcat Point LP */ + +/* Host Firmware Status Registers in PCI Config Space */ +#define PCI_CFG_HFS_1 0x40 +#define PCI_CFG_HFS_2 0x48 +/* * MEI HW Section */
drivers/misc/mei/pci-me.c +23 -7
@@ -105,15 +105,31 @@ static bool mei_me_quirk_probe(struct pc const struct pci_device_id *ent) {u32 reg; -if (ent->device ==MEI_DEV_ID_PBG_1 ) { -pci_read_config_dword (pdev,0x48 , ®); -/* make sure that bit 9 is up and bit 10 is down */ -if ((reg &0x600 ) ==0x200 ) { -dev_info (&pdev->dev,"Device doesn't have valid ME Interface\n" ); -return false; - } +/* Cougar Point || Patsburg */ +if (ent->device ==MEI_DEV_ID_CPT_1 || + ent->device ==MEI_DEV_ID_PBG_1 ) { +pci_read_config_dword (pdev,PCI_CFG_HFS_2 , ®); +/* make sure that bit 9 (NM) is up and bit 10 (DM) is down */ +if ((reg &0x600 ) ==0x200 ) + goto no_mei; } + +/* Lynx Point */ +if (ent->device ==MEI_DEV_ID_LPT_H || + ent->device ==MEI_DEV_ID_LPT_W || + ent->device ==MEI_DEV_ID_LPT_HR ) { +/* Read ME FW Status check for SPS Firmware */ +pci_read_config_dword (pdev,PCI_CFG_HFS_1 , ®); +/* if bits [19:16] = 15, running SPS Firmware */ +if ((reg &0xf0000 ) ==0xf0000 ) + goto no_mei; + } +return true; + +no_mei: +dev_info (&pdev->dev,"Device doesn't have valid ME Interface\n" ); +return false; }/** * mei_probe - Device Initialization Routine
Greg Kroah-Hartman
maintainerPATCH 22/86 mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 65aba1e04916d72b30c028730a1e31860c225412 upstream.
During probe the sec-core driver allocates dummy I2C device for RTC with i2c_new_dummy() but return value is not checked. In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by devm_regmap_init_i2c() or i2c_unregister_device().
If i2c_new_dummy() fails for RTC device, fail also the probe for main MFD driver.
--- drivers/mfd/sec-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mfd/sec-core.c +4 -0
@@ -199,6 +199,10 @@ static int sec_pmic_probe(struct i2c_cli } sec_pmic->rtc =i2c_new_dummy (i2c->adapter,RTC_I2C_ADDR ); +if (!sec_pmic->rtc) { +dev_err (&i2c->dev,"Failed to allocate I2C for RTC\n" ); +return -ENODEV ; + }i2c_set_clientdata (sec_pmic->rtc, sec_pmic);if (pdata && pdata->cfg_pmic_irq)
Greg Kroah-Hartman
maintainerPATCH 23/86 mfd: 88pm860x: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 159ce52a6b777fc82fa0b51c7440e25f9e4c6feb upstream.
During probe the driver allocates dummy I2C device for companion chip with i2c_new_dummy() but it does not check the return value of this call.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by regmap_init_i2c().
If i2c_new_dummy() fails for companion device, fail also the probe for main MFD driver.
--- drivers/mfd/88pm860x-core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mfd/88pm860x-core.c +5 -0
@@ -1179,6 +1179,11 @@ static int pm860x_probe(struct i2c_clien chip->companion_addr = pdata->companion_addr; chip->companion =i2c_new_dummy (chip->client->adapter, chip->companion_addr); +if (!chip->companion) { +dev_err (&client->dev, +"Failed to allocate I2C companion device\n" ); +return -ENODEV ; + } chip->regmap_companion =regmap_init_i2c (chip->companion, &pm860x_regmap_config);if (IS_ERR (chip->regmap_companion)) {
Greg Kroah-Hartman
maintainerPATCH 24/86 mfd: 88pm860x: Fix I2C device resource leak on regmap init fail
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit a7ab1c8b261305af583ce26bb4a14f555fdaa73e upstream.
During probe the driver allocates dummy I2C device for companion chip and then allocates a regmap for it. If regmap_init_i2c() fails then the I2C driver (allocated with i2c_new_dummy()) is not freed and this resource leaks.
--- drivers/mfd/88pm860x-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/88pm860x-core.c +1 -0
@@ -1190,6 +1190,7 @@ static int pm860x_probe(struct i2c_clien ret =PTR_ERR (chip->regmap_companion);dev_err (&chip->companion->dev,"Failed to allocate register map: %d\n" , ret); +i2c_unregister_device (chip->companion);return ret; }i2c_set_clientdata (chip->companion, chip);
Greg Kroah-Hartman
maintainerPATCH 25/86 mfd: max77686: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit b9e183a1d495cd65412abe0f9df19b151716bfe7 upstream.
During probe the driver allocates dummy I2C device for RTC with i2c_new_dummy() but it does not check the return value of this call.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by i2c_unregister_device().
If i2c_new_dummy() fails for RTC device, fail also the probe for main MFD driver.
--- drivers/mfd/max77686.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mfd/max77686.c +4 -0
@@ -121,6 +121,10 @@ static int max77686_i2c_probe(struct i2cdev_info (max77686->dev,"device found\n" ); max77686->rtc =i2c_new_dummy (i2c->adapter,I2C_ADDR_RTC ); +if (!max77686->rtc) { +dev_err (max77686->dev,"Failed to allocate I2C device for RTC\n" ); +return -ENODEV ; + }i2c_set_clientdata (max77686->rtc, max77686);max77686_irq_init (max77686);
Greg Kroah-Hartman
maintainerPATCH 26/86 mfd: max77693: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit ad09dd6a1f5d6244bd89314015af506ba7f9810a upstream.
During probe the driver allocates dummy I2C devices for MUIC and haptic with i2c_new_dummy() but it does not check the return value of this calls.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by devm_regmap_init_i2c() and i2c_unregister_device().
If i2c_new_dummy() fails for MUIC or haptic devices, fail also the probe for main MFD driver.
--- drivers/mfd/max77693.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/mfd/max77693.c +11 -1
@@ -149,9 +149,18 @@ static int max77693_i2c_probe(struct i2cdev_info (max77693->dev,"device ID: 0x%x\n" , reg_data); max77693->muic =i2c_new_dummy (i2c->adapter,I2C_ADDR_MUIC ); +if (!max77693->muic) { +dev_err (max77693->dev,"Failed to allocate I2C device for MUIC\n" ); +return -ENODEV ; + }i2c_set_clientdata (max77693->muic, max77693); max77693->haptic =i2c_new_dummy (i2c->adapter,I2C_ADDR_HAPTIC ); +if (!max77693->haptic) { +dev_err (max77693->dev,"Failed to allocate I2C device for Haptic\n" ); + ret = -ENODEV ; + goto err_i2c_haptic; + }i2c_set_clientdata (max77693->haptic, max77693);/*
@@ -187,8 +196,9 @@ err_mfd:max77693_irq_exit (max77693); err_irq: err_regmap_muic: -i2c_unregister_device (max77693->muic);i2c_unregister_device (max77693->haptic); +err_i2c_haptic: +i2c_unregister_device (max77693->muic);return ret; }
Greg Kroah-Hartman
maintainerPATCH 27/86 mfd: max8925: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 96cf3dedc491d2f1f66cc26217f2b06b0c7b6797 upstream.
During probe the driver allocates dummy I2C devices for RTC and ADC with i2c_new_dummy() but it does not check the return value of this calls.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by i2c_unregister_device().
If i2c_new_dummy() fails for RTC or ADC devices, fail also the probe for main MFD driver.
--- drivers/mfd/max8925-i2c.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mfd/max8925-i2c.c +9 -0
@@ -180,9 +180,18 @@ static int max8925_probe(struct i2c_cliemutex_init (&chip->io_lock); chip->rtc =i2c_new_dummy (chip->i2c->adapter,RTC_I2C_ADDR ); +if (!chip->rtc) { +dev_err (chip->dev,"Failed to allocate I2C device for RTC\n" ); +return -ENODEV ; + }i2c_set_clientdata (chip->rtc, chip); chip->adc =i2c_new_dummy (chip->i2c->adapter,ADC_I2C_ADDR ); +if (!chip->adc) { +dev_err (chip->dev,"Failed to allocate I2C device for ADC\n" ); +i2c_unregister_device (chip->rtc); +return -ENODEV ; + }i2c_set_clientdata (chip->adc, chip);device_init_wakeup (&client->dev,1 );
Greg Kroah-Hartman
maintainerPATCH 28/86 mfd: max8998: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit ed26f87b9f71693a1d1ee85f5e6209601505080f upstream.
During probe the driver allocates dummy I2C device for RTC with i2c_new_dummy() but it does not check the return value of this call.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by i2c_unregister_device().
If i2c_new_dummy() fails for RTC device, fail also the probe for main MFD driver.
--- drivers/mfd/max8998.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mfd/max8998.c +4 -0
@@ -152,6 +152,10 @@ static int max8998_i2c_probe(struct i2c_mutex_init (&max8998->iolock); max8998->rtc =i2c_new_dummy (i2c->adapter,RTC_I2C_ADDR ); +if (!max8998->rtc) { +dev_err (&i2c->dev,"Failed to allocate I2C device for RTC\n" ); +return -ENODEV ; + }i2c_set_clientdata (max8998->rtc, max8998);max8998_irq_init (max8998);
Greg Kroah-Hartman
maintainerPATCH 29/86 mfd: max8997: Fix possible NULL pointer dereference on i2c_new_dummy error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 97dc4ed3fa377ec91bb60ba98b70d645c2099384 upstream.
During probe the driver allocates dummy I2C devices for RTC, haptic and MUIC with i2c_new_dummy() but it does not check the return value of this calls.
In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by i2c_unregister_device().
If i2c_new_dummy() fails for RTC, haptic or MUIC devices, fail also the probe for main MFD driver.
--- drivers/mfd/max8997.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mfd/max8997.c +18 -0
@@ -218,10 +218,26 @@ static int max8997_i2c_probe(struct i2c_mutex_init (&max8997->iolock); max8997->rtc =i2c_new_dummy (i2c->adapter,I2C_ADDR_RTC ); +if (!max8997->rtc) { +dev_err (max8997->dev,"Failed to allocate I2C device for RTC\n" ); +return -ENODEV ; + }i2c_set_clientdata (max8997->rtc, max8997); + max8997->haptic =i2c_new_dummy (i2c->adapter,I2C_ADDR_HAPTIC ); +if (!max8997->haptic) { +dev_err (max8997->dev,"Failed to allocate I2C device for Haptic\n" ); + ret = -ENODEV ; + goto err_i2c_haptic; + }i2c_set_clientdata (max8997->haptic, max8997); + max8997->muic =i2c_new_dummy (i2c->adapter,I2C_ADDR_MUIC ); +if (!max8997->muic) { +dev_err (max8997->dev,"Failed to allocate I2C device for MUIC\n" ); + ret = -ENODEV ; + goto err_i2c_muic; + }i2c_set_clientdata (max8997->muic, max8997);pm_runtime_set_active (max8997->dev);
@@ -248,7 +264,9 @@ static int max8997_i2c_probe(struct i2c_ err_mfd:mfd_remove_devices (max8997->dev);i2c_unregister_device (max8997->muic); +err_i2c_muic:i2c_unregister_device (max8997->haptic); +err_i2c_haptic:i2c_unregister_device (max8997->rtc); err:kfree (max8997);
Greg Kroah-Hartman
maintainerPATCH 30/86 mfd: tps65910: Fix possible invalid pointer dereference on regmap_add_irq_chip fail
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 483e2dfdbc94751430e41db9973985f5b054d322 upstream.
tps65910_irq_init() sets 'tps65910->chip_irq' before calling regmap_add_irq_chip(). If the regmap_add_irq_chip() call fails in memory allocation of regmap_irq_chip_data members then:
1. The 'tps65910->chip_irq' will still hold some value
2. 'tps65910->irq_data' will be pointing to already freed memory (because regmap_add_irq_chip() will free it on error)
This results in invalid memory access during driver remove because the tps65910_irq_exit() tests whether 'tps65910->chip_irq' is not zero.
--- drivers/mfd/tps65910.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/tps65910.c +3 -1
@@ -254,8 +254,10 @@ static int tps65910_irq_init(struct tps6 ret =regmap_add_irq_chip (tps65910->regmap, tps65910->chip_irq,IRQF_ONESHOT , pdata->irq_base, tps6591x_irqs_chip, &tps65910->irq_data); -if (ret <0 ) +if (ret <0 ) {dev_warn (tps65910->dev,"Failed to add irq_chip %d\n" , ret); + tps65910->chip_irq =0 ; + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 31/86 w1: fix w1_send_slave dropping a slave id
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Fries <[email protected]>
commit 6b355b33a64fd6d8ead2b838ec16fb9b551f71e8 upstream.
Previous logic,
if (avail > 8) {
store slave;
return;
}send data; clear;
The logic error is, if there isn't space send the buffer and clear, but the slave wasn't added to the now empty buffer loosing that slave id. It also should have been "if (avail >= 8)" because when it is 8, there is space.
Instead, if there isn't space send and clear the buffer, then there is always space for the slave id.
--- drivers/w1/w1_netlink.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/w1/w1_netlink.c +14 -13
@@ -54,28 +54,29 @@ static void w1_send_slave(struct w1_maststruct w1_netlink_msg *hdr = (struct w1_netlink_msg *)(msg +1 );struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr +1 );int avail; +u64 *data;/* update kernel slave list */ w1_slave_found (dev, rn); avail = dev->priv_size - cmd->len; -if (avail >8 ) { -u64 *data = (void *)(cmd +1 ) + cmd->len; - - *data = rn; - cmd->len +=8 ; - hdr->len +=8 ; - msg->len +=8 ; -return ; +if (avail <8 ) { + msg->ack++; +cn_netlink_send (msg,0 ,GFP_KERNEL ); + + msg->len =sizeof (struct w1_netlink_msg ) + +sizeof (struct w1_netlink_cmd ); + hdr->len =sizeof (struct w1_netlink_cmd ); + cmd->len =0 ; } - msg->ack++; -cn_netlink_send (msg,0 ,GFP_KERNEL ); + data = (void *)(cmd +1 ) + cmd->len; - msg->len =sizeof (struct w1_netlink_msg ) +sizeof (struct w1_netlink_cmd ); - hdr->len =sizeof (struct w1_netlink_cmd ); - cmd->len =0 ; + *data = rn; + cmd->len +=8 ; + hdr->len +=8 ; + msg->len +=8 ; } static int w1_process_search_command(struct w1_master *dev, struct cn_msg *msg,
Greg Kroah-Hartman
maintainerPATCH 32/86 staging:serqt_usb2: Fix sparse warning restricted __le16 degrades to integer
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Himangi Saraogi <[email protected]>
commit abe5d64d1a74195a44cd14624f8178b9f48b7cc7 upstream.
This patch fixes the following sparse warning :drivers/staging/serqt_usb2/serqt_usb2.c:727:40: warning: restricted __le16 degrades to integer
--- drivers/staging/serqt_usb2/serqt_usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/serqt_usb2/serqt_usb2.c +1 -1
@@ -725,7 +725,7 @@ static int qt_startup(struct usb_serial goto startup_error; } -switch (serial->dev->descriptor.idProduct) { +switch (le16_to_cpu (serial->dev->descriptor.idProduct)) {case QUATECH_DSU100 :case QUATECH_QSU100 :case QUATECH_ESU100A :
Greg Kroah-Hartman
maintainerPATCH 33/86 staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f764cd68d9036498f08fe8834deb6a367b5c2542 upstream.
Zero-initializing ether_type masked that the ether type would never be obtained for 8021x packets and the comparison against eapol_type would always fail.
--- drivers/staging/rtl8712/rtl871x_recv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.c +6 -7
@@ -254,7 +254,7 @@ union recv_frame *r8712_portctrl(structstruct sta_info *psta;struct sta_priv *pstapriv;union recv_frame *prtnframe; -u16 ether_type =0 ; +u16 ether_type; pstapriv = &adapter->stapriv; ptr =get_recvframe_data (precv_frame);
@@ -263,15 +263,14 @@ union recv_frame *r8712_portctrl(struct psta =r8712_get_stainfo (pstapriv, psta_addr); auth_alg = adapter->securitypriv.AuthAlgrthm;if (auth_alg ==2 ) { +/* get ether_type */ + ptr = ptr + pfhdr->attrib.hdrlen +LLC_HEADER_SIZE ; +memcpy (ðer_type, ptr,2 ); + ether_type =ntohs ((unsigned short )ether_type); +if ((psta !=NULL ) && (psta->ieee8021x_blocked)) {/* blocked * only accept EAPOL frame */ - prtnframe = precv_frame; -/*get ether_type */ - ptr = ptr + pfhdr->attrib.hdrlen + - pfhdr->attrib.iv_len +LLC_HEADER_SIZE ; -memcpy (ðer_type, ptr,2 ); - ether_type =ntohs ((unsigned short )ether_type);if (ether_type ==0x888e ) prtnframe = precv_frame;else {
Greg Kroah-Hartman
maintainerPATCH 34/86 xfs: fix directory hash ordering bug
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tinguely <[email protected]>
commit c88547a8119e3b581318ab65e9b72f27f23e641d upstream.
Commit f5ea1100 ("xfs: add CRCs to dir2/da node blocks") introduced in 3.10 incorrectly converted the btree hash index array pointer in xfs_da3_fixhashpath(). It resulted in the the current hash always being compared against the first entry in the btree rather than the current block index into the btree block's hash entry array. As a result, it was comparing the wrong hashes, and so could misorder the entries in the btree.
For most cases, this doesn't cause any problems as it requires hash collisions to expose the ordering problem. However, when there are hash collisions within a directory there is a very good probability that the entries will be ordered incorrectly and that actually matters when duplicate hashes are placed into or removed from the btree block hash entry array.
This bug results in an on-disk directory corruption and that results in directory verifier functions throwing corruption warnings into the logs. While no data or directory entries are lost, access to them may be compromised, and attempts to remove entries from a directory that has suffered from this corruption may result in a filesystem shutdown. xfs_repair will fix the directory hash ordering without data loss occuring.
[dchinner: wrote useful a commit message]
--- fs/xfs/xfs_da_btree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_da_btree.c +1 -1
@@ -1334,7 +1334,7 @@ xfs_da3_fixhashpath( node = blk->bp->b_addr;xfs_da3_node_hdr_from_disk (&nodehdr, node); btree =xfs_da3_node_tree_p (node); -if (be32_to_cpu (btree->hashval) == lasthash) +if (be32_to_cpu (btree[blk->index].hashval) == lasthash)break ; blk->hashval = lasthash; btree[blk->index].hashval =cpu_to_be32 (lasthash);
Greg Kroah-Hartman
maintainerPATCH 35/86 ftrace/x86: One more missing sync after fixup of function modification failure
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Mladek <[email protected]>
commit 12729f14d8357fb845d75155228b21e76360272d upstream.
If a failure occurs while modifying ftrace function, it bails out and will remove the tracepoints to be back to what the code originally was.
There is missing the final sync run across the CPUs after the fix up is done and before the ftrace int3 handler flag is reset.
Here's the description of the problem:
CPU0 CPU1 ---- ----
remove_breakpoint();
modifying_ftrace_code = 0;
[still sees breakpoint] <takes trap>
[sees modifying_ftrace_code as zero] [no breakpoint handler] [goto failed case]
[trap exception - kernel breakpoint, no
handler]
BUG()
--- arch/x86/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/ftrace.c +1 -1
@@ -659,8 +659,8 @@ ftrace_modify_code(unsigned long ip, uns ret = -EPERM ; goto out; } -run_sync (); out: +run_sync ();return ret; fail_update:
Greg Kroah-Hartman
maintainerPATCH 36/86 x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit b3b42ac2cbae1f3cecbb6229964a4d48af31d382 upstream.
The IRET instruction, when returning to a 16-bit segment, only restores the bottom 16 bits of the user space stack pointer. We have a software workaround for that ("espfix") for the 32-bit kernel, but it relies on a nonzero stack segment base which is not available in 32-bit mode.
Since 16-bit support is somewhat crippled anyway on a 64-bit kernel (no V86 mode), and most (if not quite all) 64-bit processors support virtualization for the users who really need it, simply reject attempts at creating a 16-bit segment when running on top of a 64-bit kernel.
--- arch/x86/kernel/ldt.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/ldt.c +11 -0
@@ -229,6 +229,17 @@ static int write_ldt(void __user *ptr, u } } +/* +* On x86-64 we do not support 16-bit segments due to +* IRET leaking the high bits of the kernel stack address. +*/ +#ifdef CONFIG_X86_64 +if (!ldt_info.seg_32bit) { + error = -EINVAL ; + goto out_unlock; + } +#endif +fill_ldt (&ldt, &ldt_info);if (oldmode) ldt.avl =0 ;
Greg Kroah-Hartman
maintainerPATCH 37/86 USB: fix crash during hotplug of PCI USB controller card
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit a2ff864b53eac9a0e9b05bfe9d1781ccd6c2af71 upstream.
The code in hcd-pci.c that matches up EHCI controllers with their companion UHCI or OHCI controllers assumes that the private drvdata fields don't get set too early. However, it turns out that this field gets set by usb_create_hcd(), before hcd-pci expects it, and this can result in a crash when two controllers are probed in parallel (as can happen when a new controller card is hotplugged).
The companions_rwsem lock was supposed to prevent this sort of thing, but usb_create_hcd() is called outside the scope of the rwsem.
A simple solution is to check that the root-hub pointer has been initialized as well as the drvdata field. This doesn't happen until usb_add_hcd() is called; that call and the check are both protected by the rwsem.
This patch should be applied to stable kernels from 3.10 onward.
--- drivers/usb/core/hcd-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/hcd-pci.c +1 -1
@@ -75,7 +75,7 @@ static void for_each_companion(struct pc PCI_SLOT(companion->devfn) != slot)continue ; companion_hcd =pci_get_drvdata (companion); -if (!companion_hcd) +if (!companion_hcd || !companion_hcd->self.root_hub)continue ;fn (pdev, hcd, companion, companion_hcd); }
Greg Kroah-Hartman
maintainerPATCH 38/86 iio: querying buffer scan_mask should return 0/1
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alec Berg <[email protected]>
commit 2076a20fc1a06f7b0333c62a2bb4eeeac7ed1bcb upstream.
Ensure that querying the IIO buffer scan_mask returns a value of 0 or 1. Currently querying the scan mask has the value returned by test_bit(), which returns either true or false. For some architectures test_bit() may return -1 for true, which will appear to return an error when returning from iio_scan_mask_query().
Additionally, it's important for the sysfs interface to consistently return the same thing when querying the scan_mask.
--- drivers/iio/industrialio-buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/industrialio-buffer.c +4 -2
@@ -119,7 +119,8 @@ static ssize_t iio_scan_el_show(struct dint ret;struct iio_dev *indio_dev =dev_to_iio_dev (dev); - ret =test_bit (to_iio_dev_attr (attr)->address, +/* Ensure ret is 0 or 1. */ + ret = !!test_bit (to_iio_dev_attr (attr)->address, indio_dev->buffer->scan_mask);return sprintf (buf,"%d\n" , ret);
@@ -762,7 +763,8 @@ int iio_scan_mask_query(struct iio_dev *if (!buffer->scan_mask)return 0 ; -return test_bit (bit, buffer->scan_mask); +/* Ensure return value is 0 or 1. */ +return !!test_bit (bit, buffer->scan_mask); };EXPORT_SYMBOL_GPL (iio_scan_mask_query);
Greg Kroah-Hartman
maintainerPATCH 39/86 nfsd4: session needs room for following op to error out
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 4c69d5855a16f7378648c5733632628fa10431db upstream.
--- fs/nfsd/nfs4proc.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/nfsd/nfs4proc.c +6 -0
@@ -1307,6 +1307,12 @@ nfsd4_proc_compound(struct svc_rqst *rqs/* If op is non-idempotent */ if (opdesc->op_flags &OP_MODIFIES_SOMETHING ) { plen = opdesc->op_rsize_bop (rqstp, op); +/* +* If there's still another operation, make sure +* we'll have space to at least encode an error: +*/ +if (resp->opcnt < args->opcnt) + plen +=COMPOUND_ERR_SLACK_SPACE ; op->status =nfsd4_check_resp_size (resp, plen); }
Greg Kroah-Hartman
maintainerPATCH 40/86 nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit de3997a7eeb9ea286b15879fdf8a95aae065b4f7 upstream.
This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39 "nfsd41: SUPPATTR_EXCLCREAT attribute".
--- fs/nfsd/nfs4xdr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/nfs4xdr.c +2 -0
@@ -2401,6 +2401,8 @@ out_acl:WRITE64 (stat.ino); }if (bmval2 &FATTR4_WORD2_SUPPATTR_EXCLCREAT ) { +if ((buflen -=16 ) <0 ) + goto out_resource;WRITE32 (3 );WRITE32 (NFSD_SUPPATTR_EXCLCREAT_WORD0 );WRITE32 (NFSD_SUPPATTR_EXCLCREAT_WORD1 );
Greg Kroah-Hartman
maintainerPATCH 41/86 nfsd4: fix test_stateid error reply encoding
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit a11fcce1544df08c723d950ff0edef3adac40405 upstream.
If the entire operation fails then there's nothing to encode.
--- fs/nfsd/nfs4xdr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfsd/nfs4xdr.c +3 -0
@@ -3384,6 +3384,9 @@ nfsd4_encode_test_stateid(struct nfsd4_cstruct nfsd4_test_stateid_id *stateid, *next;__be32 *p; +if (nfserr) +return nfserr; +RESERVE_SPACE (4 + (4 * test_stateid->ts_num_ids)); *p++ =htonl (test_stateid->ts_num_ids);
Greg Kroah-Hartman
maintainerPATCH 42/86 nfsd: notify_change needs elevated write count
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 9f67f189939eccaa54f3d2c9cf10788abaf2d584 upstream.
Looks like this bug has been here since these write counts were introduced, not sure why it was just noticed now.
Thanks also to Jan Kara for pointing out the problem.
--- fs/nfsd/vfs.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/nfsd/vfs.c +9 -0
@@ -406,6 +406,7 @@ nfsd_setattr(struct svc_rqst *rqstp, strumode_t ftype =0 ;__be32 err;int host_err; +bool get_write_count;int size_change =0 ;if (iap->ia_valid & (ATTR_ATIME |ATTR_MTIME |ATTR_SIZE ))
@@ -413,10 +414,18 @@ nfsd_setattr(struct svc_rqst *rqstp, strif (iap->ia_valid &ATTR_SIZE ) ftype =S_IFREG ; +/* Callers that do fh_verify should do the fh_want_write: */ + get_write_count = !fhp->fh_dentry; +/* Get inode */ err =fh_verify (rqstp, fhp, ftype, accmode);if (err) goto out; +if (get_write_count) { + host_err =fh_want_write (fhp); +if (host_err) +return nfserrno (host_err); + } dentry = fhp->fh_dentry; inode = dentry->d_inode;
Greg Kroah-Hartman
maintainerPATCH 43/86 nfsd: check passed sockets net matches NFSd superblocks one
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 3064639423c48d6e0eb9ecc27c512a58e38c6c57 upstream.
There could be a case, when NFSd file system is mounted in network, different to socket's one, like below:
"ip netns exec" creates new network and mount namespace, which duplicates NFSd mount point, created in init_net context. And thus NFS server stop in nested network context leads to RPCBIND client destruction in init_net. Then, on NFSd start in nested network context, rpc.nfsd process creates socket in nested net and passes it into "write_ports", which leads to RPCBIND sockets creation in init_net context because of the same reason (NFSd monut point was created in init_net context). An attempt to register passed socket in nested net leads to panic, because no RPCBIND client present in nexted network namespace.
This patch add check that passed socket's net matches NFSd superblock's one. And returns -EINVAL error to user psace otherwise.
v2: Put socket on exit.
--- fs/nfsd/nfsctl.c | 5 +++++ include/linux/sunrpc/svcsock.h | 1 + net/sunrpc/svcsock.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+)
fs/nfsd/nfsctl.c +5 -0
@@ -699,6 +699,11 @@ static ssize_t __write_ports_addfd(charif (err !=0 || fd <0 )return -EINVAL ; +if (svc_alien_sock (net, fd)) { +printk (KERN_ERR "%s: socket net is different to NFSd's one\n" , __func__); +return -EINVAL ; + } + err =nfsd_create_serv (net);if (err !=0 )return err;
include/linux/sunrpc/svcsock.h +1 -0
@@ -56,6 +56,7 @@ int svc_recv(struct svc_rqst *, long);int svc_send (struct svc_rqst *);void svc_drop (struct svc_rqst *);void svc_sock_update_bufs (struct svc_serv *serv); +bool svc_alien_sock (struct net *net,int fd);int svc_addsock (struct svc_serv *serv,const int fd,char *name_return,const size_t len);void svc_init_xprt_sock (void );
net/sunrpc/svcsock.c +16 -0
@@ -1393,6 +1393,22 @@ static struct svc_sock *svc_setup_socketreturn svsk; } +bool svc_alien_sock (struct net *net,int fd) +{ +int err; +struct socket *sock =sockfd_lookup (fd, &err); +bool ret = false; + +if (!sock) + goto out; +if (sock_net (sock->sk) != net) + ret = true; +sockfd_put (sock); +out: +return ret; +} +EXPORT_SYMBOL_GPL (svc_alien_sock); +/** * svc_addsock - add a listener socket to an RPC service * @serv: pointer to RPC service to which to add a new listener
Greg Kroah-Hartman
maintainerPATCH 44/86 nfsd4: fix setclientid encode size
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 480efaee085235bb848f1063f959bf144103c342 upstream.
--- fs/nfsd/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4proc.c +2 -1
@@ -1477,7 +1477,8 @@ static inline u32 nfsd4_setattr_rsize(ststatic inline u32 nfsd4_setclientid_rsize (struct svc_rqst *rqstp,struct nfsd4_op *op) { -return (op_encode_hdr_size +2 +1024 ) *sizeof (__be32); +return (op_encode_hdr_size +2 +XDR_QUADLEN (NFS4_VERIFIER_SIZE )) * +sizeof (__be32); }static inline u32 nfsd4_write_rsize (struct svc_rqst *rqstp,struct nfsd4_op *op)
Greg Kroah-Hartman
maintainerPATCH 45/86 NFSD: Traverse unconfirmed client through hash-table
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kinglong Mee <[email protected]>
commit 2b9056359889c78ea5decb5b654a512c2e8a945c upstream.
When stopping nfsd, I got BUG messages, and soft lockup messages, The problem is cuased by double rb_erase() in nfs4_state_destroy_net() and destroy_client().
This patch just let nfsd traversing unconfirmed client through hash-table instead of rbtree.
[ 2325.021995] BUG: unable to handle kernel NULL pointer dereference at
(null)
[ 2325.022809] IP: [<ffffffff8133c18c>] rb_erase+0x14c/0x390
[ 2325.022982] PGD 7a91b067 PUD 7a33d067 PMD 0
[ 2325.022982] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[ 2325.022982] Modules linked in: nfsd(OF) cfg80211 rfkill bridge stpllc snd_intel8x0 snd_ac97_codec ac97_bus auth_rpcgss nfs_acl serio_raw e1000 i2c_piix4 ppdev snd_pcm snd_timer lockd pcspkr joydev parport_pc snd parport i2c_core soundcore microcode sunrpc ata_generic pata_acpi [last unloaded: nfsd]
[ 2325.022982] CPU: 1 PID: 2123 Comm: nfsd Tainted: GF O 3.14.0-rc8+ #2 [ 2325.022982] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 2325.022982] task: ffff88007b384800 ti: ffff8800797f6000 task.ti: ffff8800797f6000 [ 2325.022982] RIP: 0010:[<ffffffff8133c18c>] [<ffffffff8133c18c>] rb_erase+0x14c/0x390 [ 2325.022982] RSP: 0018:ffff8800797f7d98 EFLAGS: 00010246 [ 2325.022982] RAX: ffff880079c1f010 RBX: ffff880079f4c828 RCX: 0000000000000000 [ 2325.022982] RDX: 0000000000000000 RSI: ffff880079bcb070 RDI: ffff880079f4c810 [ 2325.022982] RBP: ffff8800797f7d98 R08: 0000000000000000 R09: ffff88007964fc70 [ 2325.022982] R10: 0000000000000000 R11: 0000000000000400 R12: ffff880079f4c800 [ 2325.022982] R13: ffff880079bcb000 R14: ffff8800797f7da8 R15: ffff880079f4c860 [ 2325.022982] FS: 0000000000000000(0000) GS:ffff88007f900000(0000) knlGS:0000000000000000 [ 2325.022982] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2325.022982] CR2: 0000000000000000 CR3: 000000007a3ef000 CR4: 00000000000006e0 [ 2325.022982] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2325.022982] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2325.022982] Stack: [ 2325.022982] ffff8800797f7de0 ffffffffa0191c6e ffff8800797f7da8 ffff8800797f7da8 [ 2325.022982] ffff880079f4c810 ffff880079bcb000 ffffffff81cc26c0 ffff880079c1f010 [ 2325.022982] ffff880079bcb070 ffff8800797f7e28 ffffffffa01977f2 ffff8800797f7df0 [ 2325.022982] Call Trace: [ 2325.022982] [<ffffffffa0191c6e>] destroy_client+0x32e/0x3b0 [nfsd] [ 2325.022982] [<ffffffffa01977f2>] nfs4_state_shutdown_net+0x1a2/0x220 [nfsd] [ 2325.022982] [<ffffffffa01700b8>] nfsd_shutdown_net+0x38/0x70 [nfsd] [ 2325.022982] [<ffffffffa017013e>] nfsd_last_thread+0x4e/0x80 [nfsd] [ 2325.022982] [<ffffffffa001f1eb>] svc_shutdown_net+0x2b/0x30 [sunrpc] [ 2325.022982] [<ffffffffa017064b>] nfsd_destroy+0x5b/0x80 [nfsd] [ 2325.022982] [<ffffffffa0170773>] nfsd+0x103/0x130 [nfsd] [ 2325.022982] [<ffffffffa0170670>] ? nfsd_destroy+0x80/0x80 [nfsd] [ 2325.022982] [<ffffffff810a8232>] kthread+0xd2/0xf0 [ 2325.022982] [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40 [ 2325.022982] [<ffffffff816c493c>] ret_from_fork+0x7c/0xb0 [ 2325.022982] [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40 [ 2325.022982] Code: 48 83 e1 fc 48 89 10 0f 84 02 01 00 00 48 3b 41 10 0f 84 08 01 00 00 48 89 51 08 48 89 fa e9 74 ff ff ff 0f 1f 40 00 48 8b 50 10 <f6> 02 01 0f 84 93 00 00 00 48 8b 7a 10 48 85 ff 74 05 f6 07 01 [ 2325.022982] RIP [<ffffffff8133c18c>] rb_erase+0x14c/0x390 [ 2325.022982] RSP <ffff8800797f7d98> [ 2325.022982] CR2: 0000000000000000 [ 2325.022982] ---[ end trace 28c27ed011655e57 ]---
[ 228.064071] BUG: soft lockup - CPU#0 stuck for 22s! [nfsd:558] [ 228.064428] Modules linked in: ip6t_rpfilter ip6t_REJECT cfg80211
xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw nfsd(OF) auth_rpcgss nfs_acl lockd snd_intel8x0 snd_ac97_codec ac97_bus joydev snd_pcm snd_timer e1000 sunrpc snd ppdev parport_pc serio_raw pcspkr i2c_piix4 microcode parport soundcore i2c_core ata_generic pata_acpi
[ 228.064539] CPU: 0 PID: 558 Comm: nfsd Tainted: GF O 3.14.0-rc8+ #2 [ 228.064539] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 228.064539] task: ffff880076adec00 ti: ffff880074616000 task.ti: ffff880074616000 [ 228.064539] RIP: 0010:[<ffffffff8133ba17>] [<ffffffff8133ba17>] rb_next+0x27/0x50 [ 228.064539] RSP: 0018:ffff880074617de0 EFLAGS: 00000282 [ 228.064539] RAX: ffff880074478010 RBX: ffff88007446f860 RCX: 0000000000000014 [ 228.064539] RDX: ffff880074478010 RSI: 0000000000000000 RDI: ffff880074478010 [ 228.064539] RBP: ffff880074617de0 R08: 0000000000000000 R09: 0000000000000012 [ 228.064539] R10: 0000000000000001 R11: ffffffffffffffec R12: ffffea0001d11a00 [ 228.064539] R13: ffff88007f401400 R14: ffff88007446f800 R15: ffff880074617d50 [ 228.064539] FS: 0000000000000000(0000) GS:ffff88007f800000(0000) knlGS:0000000000000000 [ 228.064539] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 228.064539] CR2: 00007fe9ac6ec000 CR3: 000000007a5d6000 CR4: 00000000000006f0 [ 228.064539] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 228.064539] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 228.064539] Stack: [ 228.064539] ffff880074617e28 ffffffffa01ab7db ffff880074617df0 ffff880074617df0 [ 228.064539] ffff880079273000 ffffffff81cc26c0 ffffffff81cc26c0 0000000000000000 [ 228.064539] 0000000000000000 ffff880074617e48 ffffffffa01840b8 ffffffff81cc26c0 [ 228.064539] Call Trace: [ 228.064539] [<ffffffffa01ab7db>] nfs4_state_shutdown_net+0x18b/0x220 [nfsd] [ 228.064539] [<ffffffffa01840b8>] nfsd_shutdown_net+0x38/0x70 [nfsd] [ 228.064539] [<ffffffffa018413e>] nfsd_last_thread+0x4e/0x80 [nfsd] [ 228.064539] [<ffffffffa00aa1eb>] svc_shutdown_net+0x2b/0x30 [sunrpc] [ 228.064539] [<ffffffffa018464b>] nfsd_destroy+0x5b/0x80 [nfsd] [ 228.064539] [<ffffffffa0184773>] nfsd+0x103/0x130 [nfsd] [ 228.064539] [<ffffffffa0184670>] ? nfsd_destroy+0x80/0x80 [nfsd] [ 228.064539] [<ffffffff810a8232>] kthread+0xd2/0xf0 [ 228.064539] [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40 [ 228.064539] [<ffffffff816c493c>] ret_from_fork+0x7c/0xb0 [ 228.064539] [<ffffffff810a8160>] ? insert_kthread_work+0x40/0x40 [ 228.064539] Code: 1f 44 00 00 55 48 8b 17 48 89 e5 48 39 d7 74 3b 48
8b 47 08 48 85 c0 75 0e eb 25 66 0f 1f 84 00 00 00 00 00 48 89 d0 48 8b 50 10 <48> 85 d2 75 f4 5d c3 66 90 48 3b 78 08 75 f6 48 8b 10 48 89 c7
--- fs/nfsd/nfs4state.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
fs/nfsd/nfs4state.c +5 -8
@@ -4958,7 +4958,6 @@ nfs4_state_destroy_net(struct net *net)int i;struct nfs4_client *clp =NULL ;struct nfsd_net *nn =net_generic (net, nfsd_net_id); -struct rb_node *node, *tmp;for (i =0 ; i <CLIENT_HASH_SIZE ; i++) {while (!list_empty (&nn->conf_id_hashtbl[i])) {
@@ -4967,13 +4966,11 @@ nfs4_state_destroy_net(struct net *net) } } - node =rb_first (&nn->unconf_name_tree); -while (node !=NULL ) { - tmp = node; - node =rb_next (tmp); - clp = rb_entry(tmp, struct nfs4_client, cl_namenode); -rb_erase (tmp, &nn->unconf_name_tree); -destroy_client (clp); +for (i =0 ; i <CLIENT_HASH_SIZE ; i++) { +while (!list_empty (&nn->unconf_id_hashtbl[i])) { + clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); +destroy_client (clp); + } }kfree (nn->sessionid_hashtbl);
Greg Kroah-Hartman
maintainerPATCH 46/86 nfsd: set timeparms.to_maxval in setup_callback_client
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 3758cf7e14b753838fe754ede3862af10b35fdac upstream.
...otherwise the logic in the timeout handling doesn't work correctly.
--- fs/nfsd/nfs4callback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4callback.c +3 -1
@@ -637,9 +637,11 @@ static struct rpc_cred *get_backchannel_static int setup_callback_client (struct nfs4_client *clp,struct nfs4_cb_conn *conn,struct nfsd4_session *ses) { +int maxtime =max_cb_time (clp->net);struct rpc_timeout timeparms = { - .to_initval =max_cb_time (clp->net), + .to_initval = maxtime, .to_retries =0 , + .to_maxval = maxtime, };struct rpc_create_args args = { .net = clp->net,
Greg Kroah-Hartman
maintainerPATCH 47/86 IB/ipath: Fix potential buffer overrun in sending diag packet routine
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Dalessandro <[email protected]>
commit a2cb0eb8a64adb29a99fd864013de957028f36ae upstream.
Guard against a potential buffer overrun. The size to read from the user is passed in, and due to the padding that needs to be taken into account, as well as the place holder for the ICRC it is possible to overflow the 32bit value which would cause more data to be copied from user space than is allocated in the buffer.
--- drivers/infiniband/hw/ipath/ipath_diag.c | 66 +++++++++++-------------------- 1 file changed, 25 insertions(+), 41 deletions(-)
drivers/infiniband/hw/ipath/ipath_diag.c +25 -41
@@ -326,7 +326,7 @@ static ssize_t ipath_diagpkt_write(struc size_t count, loff_t *off) { u32 __iomem *piobuf; -u32 plen, clen, pbufn; +u32 plen, pbufn, maxlen_reserve;struct ipath_diag_pkt odp;struct ipath_diag_xpkt dp;u32 *tmpbuf =NULL ;
@@ -335,51 +335,29 @@ static ssize_t ipath_diagpkt_write(strucu64 val;u32 l_state, lt_state;/* LinkState, LinkTrainingState */ -if (count <sizeof (odp)) { - ret = -EINVAL ; - goto bail; - }if (count ==sizeof (dp)) {if (copy_from_user (&dp, data,sizeof (dp))) { ret = -EFAULT ; goto bail; } - }else if (copy_from_user (&odp, data,sizeof (odp))) { - ret = -EFAULT ; + }else if (count ==sizeof (odp)) { +if (copy_from_user (&odp, data,sizeof (odp))) { + ret = -EFAULT ; + goto bail; + } + }else { + ret = -EINVAL ; goto bail; } -/* -* Due to padding/alignment issues (lessened with new struct) -* the old and new structs are the same length. We need to -* disambiguate them, which we can do because odp.len has never -* been less than the total of LRH+BTH+DETH so far, while -* dp.unit (same offset) unit is unlikely to get that high. -* Similarly, dp.data, the pointer to user at the same offset -* as odp.unit, is almost certainly at least one (512byte)page -* "above" NULL. The if-block below can be omitted if compatibility -* between a new driver and older diagnostic code is unimportant. -* compatibility the other direction (new diags, old driver) is -* handled in the diagnostic code, with a warning. -*/ -if (dp.unit >=20 && dp.data <512 ) { -/* very probable version mismatch. Fix it up */ -memcpy (&odp, &dp,sizeof (odp)); -/* We got a legacy dp, copy elements to dp */ - dp.unit = odp.unit; - dp.data = odp.data; - dp.len = odp.len; - dp.pbc_wd =0 ;/* Indicate we need to compute PBC wd */ - } -/* send count must be an exact number of dwords */ if (dp.len &3 ) { ret = -EINVAL ; goto bail; } - clen = dp.len >>2 ; + plen = dp.len >>2 ; dd =ipath_lookup (dp.unit); if (!dd || !(dd->ipath_flags & IPATH_PRESENT) ||
@@ -422,16 +400,22 @@ static ssize_t ipath_diagpkt_write(struc goto bail; } -/* need total length before first word written */ -/* +1 word is for the qword padding */ - plen =sizeof (u32) + dp.len; - -if ((plen +4 ) > dd->ipath_ibmaxlen) { +/* +* need total length before first word written, plus 2 Dwords. One Dword +* is for padding so we get the full user data when not aligned on +* a word boundary. The other Dword is to make sure we have room for the +* ICRC which gets tacked on later. +*/ + maxlen_reserve =2 *sizeof (u32); +if (dp.len > dd->ipath_ibmaxlen - maxlen_reserve) {ipath_dbg ("Pkt len 0x%x > ibmaxlen %x\n" , - plen -4 , dd->ipath_ibmaxlen); + dp.len, dd->ipath_ibmaxlen); ret = -EINVAL ; - goto bail;/* before writing pbc */ + goto bail; } + + plen =sizeof (u32) + dp.len; + tmpbuf =vmalloc (plen);if (!tmpbuf) { dev_info(&dd->pcidev->dev, "Unable to allocate tmp buffer, "
@@ -473,11 +457,11 @@ static ssize_t ipath_diagpkt_write(struc*/ if (dd->ipath_flags &IPATH_PIO_FLUSH_WC ) {ipath_flush_wc (); -__iowrite32_copy (piobuf +2 , tmpbuf, clen -1 ); +__iowrite32_copy (piobuf +2 , tmpbuf, plen -1 );ipath_flush_wc (); -__raw_writel (tmpbuf[clen -1 ], piobuf + clen +1 ); +__raw_writel (tmpbuf[plen -1 ], piobuf + plen +1 ); }else -__iowrite32_copy (piobuf +2 , tmpbuf, clen); +__iowrite32_copy (piobuf +2 , tmpbuf, plen);ipath_flush_wc ();
Greg Kroah-Hartman
maintainerPATCH 48/86 IB/nes: Return an error on ib_copy_from_udata() failure instead of NULL
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit 9d194d1025f463392feafa26ff8c2d8247f71be1 upstream.
In case of error while accessing to userspace memory, function nes_create_qp() returns NULL instead of an error code wrapped through ERR_PTR(). But NULL is not expected by ib_uverbs_create_qp(), as it check for error with IS_ERR().
As page 0 is likely not mapped, it is going to trigger an Oops when the kernel will try to dereference NULL pointer to access to struct ib_qp's fields.
In some rare cases, page 0 could be mapped by userspace, which could turn this bug to a vulnerability that could be exploited: the function pointers in struct ib_device will be under userspace total control.
This was caught when using spatch (aka. coccinelle) to rewrite calls to ib_copy_{from,to}_udata().
--- drivers/infiniband/hw/nes/nes_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/nes/nes_verbs.c +1 -1
@@ -1186,7 +1186,7 @@ static struct ib_qp *nes_create_qp(strucnes_free_resource (nesadapter, nesadapter->allocated_qps, qp_num);kfree (nesqp->allocated_buffer);nes_debug (NES_DBG_QP ,"ib_copy_from_udata() Failed \n" ); -return NULL ; +return ERR_PTR (-EFAULT ); }if (req.user_wqe_buffers) { virt_wqs =1 ;
Greg Kroah-Hartman
maintainerPATCH 49/86 IB/mthca: Return an error on ib_copy_to_udata() failure
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit 08e74c4b00c30c232d535ff368554959403d0432 upstream.
In case of error when writing to userspace, the function mthca_create_cq() does not set an error code before following its error path.
This patch sets the error code to -EFAULT when ib_copy_to_udata() fails.
This was caught when using spatch (aka. coccinelle) to rewrite call to ib_copy_{from,to}_udata().
--- drivers/infiniband/hw/mthca/mthca_provider.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mthca/mthca_provider.c +1 -0
@@ -695,6 +695,7 @@ static struct ib_cq *mthca_create_cq(strif (context &&ib_copy_to_udata (udata, &cq->cqn,sizeof (__u32))) {mthca_free_cq (to_mdev (ibdev), cq); + err = -EFAULT ; goto err_free; }
Greg Kroah-Hartman
maintainerPATCH 50/86 IB/ehca: Returns an error on ib_copy_to_udata() failure
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit 5bdb0f02add5994b0bc17494f4726925ca5d6ba1 upstream.
In case of error when writing to userspace, function ehca_create_cq() does not set an error code before following its error path.
This patch sets the error code to -EFAULT when ib_copy_to_udata() fails.
This was caught when using spatch (aka. coccinelle) to rewrite call to ib_copy_{from,to}_udata().
--- drivers/infiniband/hw/ehca/ehca_cq.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/ehca/ehca_cq.c +1 -0
@@ -283,6 +283,7 @@ struct ib_cq *ehca_create_cq(struct ib_d (my_cq->galpas.user.fw_handle & (PAGE_SIZE -1 ));if (ib_copy_to_udata (udata, &resp,sizeof (resp))) {ehca_err (device,"Copy to udata failed." ); + cq =ERR_PTR (-EFAULT ); goto create_cq_exit4; } }
Greg Kroah-Hartman
maintainerPATCH 51/86 ib_srpt: Use correct ib_sg_dma primitives
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
commit b076808051f2c80d38e03fb2f1294f525c7a446d upstream.
The code was incorrectly using sg_dma_address() and sg_dma_len() instead of ib_sg_dma_address() and ib_sg_dma_len().
This prevents srpt from functioning with the
Intel HCA and indeed will corrupt memory
badly.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +10 -6
@@ -1078,6 +1078,7 @@ static void srpt_unmap_sg_to_ib_sge(strustatic int srpt_map_sg_to_ib_sge (struct srpt_rdma_ch *ch,struct srpt_send_ioctx *ioctx) { +struct ib_device *dev = ch->sport->sdev->device;struct se_cmd *cmd;struct scatterlist *sg, *sg_orig;int sg_cnt;
@@ -1124,7 +1125,7 @@ static int srpt_map_sg_to_ib_sge(struct db = ioctx->rbufs; tsize = cmd->data_length; - dma_len =sg_dma_len (&sg[0 ]); + dma_len =ib_sg_dma_len (dev, &sg[0 ]); riu = ioctx->rdma_ius;/*
@@ -1155,7 +1156,8 @@ static int srpt_map_sg_to_ib_sge(struct ++j;if (j < count) { sg =sg_next (sg); - dma_len =sg_dma_len (sg); + dma_len =ib_sg_dma_len ( + dev, sg); } } }else {
@@ -1192,8 +1194,8 @@ static int srpt_map_sg_to_ib_sge(struct tsize = cmd->data_length; riu = ioctx->rdma_ius; sg = sg_orig; - dma_len =sg_dma_len (&sg[0 ]); - dma_addr =sg_dma_address (&sg[0 ]); + dma_len =ib_sg_dma_len (dev, &sg[0 ]); + dma_addr =ib_sg_dma_address (dev, &sg[0 ]);/* this second loop is really mapped sg_addres to rdma_iu->ib_sge */ for (i = 0, j = 0;
@@ -1216,8 +1218,10 @@ static int srpt_map_sg_to_ib_sge(struct ++j;if (j < count) { sg =sg_next (sg); - dma_len =sg_dma_len (sg); - dma_addr =sg_dma_address (sg); + dma_len =ib_sg_dma_len ( + dev, sg); + dma_addr =ib_sg_dma_address ( + dev, sg); } } }else {
Greg Kroah-Hartman
maintainerPATCH 52/86 SCSI: qla2xxx: fix error handling of qla2x00_mem_alloc()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b2a72ec32d0f499aaadf41264232517a12326df0 upstream.
qla2x00_mem_alloc() returns 1 on success and -ENOMEM on failure. On the one hand the caller assumes non-zero is success but on the other hand the caller also assumes that it returns an error code.
I've fixed it to return zero on success and a negative error code on failure. This matches the documentation as well.
--- drivers/scsi/qla2xxx/qla_os.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +3 -3
@@ -2553,7 +2553,7 @@ qla2x00_probe_one(struct pci_dev *pdev, ha->flags.enable_64bit_addressing ?"enable" : "disable"); ret =qla2x00_mem_alloc (ha, req_length, rsp_length, &req, &rsp); -if (!ret) { +if (ret) {ql_log_pci (ql_log_fatal, pdev,0x0031 ,"Failed to allocate memory for adapter, aborting.\n" );
@@ -3458,10 +3458,10 @@ qla2x00_mem_alloc(struct qla_hw_data *haelse {qla2x00_set_reserved_loop_ids (ha);ql_dbg_pci (ql_dbg_init, ha->pdev,0x0123 , -"loop_id_map=%p. \n" , ha->loop_id_map); +"loop_id_map=%p.\n" , ha->loop_id_map); } -return 1 ; +return 0 ; fail_async_pd:dma_pool_free (ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
Greg Kroah-Hartman
maintainerPATCH 53/86 SCSI: arcmsr: upper 32 of dma address lost
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit e2c70425f05219b142b3a8a9489a622c736db39d upstream.
The original code always set the upper 32 bits to zero because it was doing a shift of the wrong variable.
--- drivers/scsi/arcmsr/arcmsr_hba.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/arcmsr/arcmsr_hba.c +3 -4
@@ -2501,16 +2501,15 @@ static int arcmsr_polling_ccbdone(structstatic int arcmsr_iop_confirm (struct AdapterControlBlock *acb) {uint32_t cdb_phyaddr, cdb_phyaddr_hi32; -dma_addr_t dma_coherent_handle; +/* ******************************************************************** ** here we need to tell iop 331 our freeccb.HighPart ** if freeccb.HighPart is not zero ******************************************************************** */ - dma_coherent_handle = acb->dma_coherent_handle; - cdb_phyaddr = (uint32_t )(dma_coherent_handle); - cdb_phyaddr_hi32 = (uint32_t )((cdb_phyaddr >>16 ) >>16 ); + cdb_phyaddr =lower_32_bits (acb->dma_coherent_handle); + cdb_phyaddr_hi32 =upper_32_bits (acb->dma_coherent_handle); acb->cdb_phyaddr_hi32 = cdb_phyaddr_hi32;/* ***********************************************************************
Greg Kroah-Hartman
maintainerPATCH 54/86 iscsi-target: Fix ERL=2 ASYNC_EVENT connection pointer bug
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit d444edc679e7713412f243b792b1f964e5cff1e1 upstream.
This patch fixes a long-standing bug in iscsit_build_conn_drop_async_message() where during ERL=2 connection recovery, a bogus conn_p pointer could end up being used to send the ISCSI_OP_ASYNC_EVENT + DROPPING_CONNECTION notifying the initiator that cmd->logout_cid has failed.
The bug was manifesting itself as an OOPs in iscsit_allocate_cmd() with a bogus conn_p pointer in iscsit_build_conn_drop_async_message().
--- drivers/target/iscsi/iscsi_target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +3 -1
@@ -2454,6 +2454,7 @@ static void iscsit_build_conn_drop_async {struct iscsi_cmd *cmd;struct iscsi_conn *conn_p; +bool found = false;/* * Only send a Asynchronous Message on connections whos network
@@ -2462,11 +2463,12 @@ static void iscsit_build_conn_drop_asynclist_for_each_entry (conn_p, &conn->sess->sess_conn_list, conn_list) {if (conn_p->conn_state ==TARG_CONN_STATE_LOGGED_IN ) {iscsit_inc_conn_usage_count (conn_p); + found = true;break ; } } -if (!conn_p) +if (!found)return ; cmd =iscsit_allocate_cmd (conn_p,GFP_ATOMIC );
Greg Kroah-Hartman
maintainerPATCH 55/86 target/tcm_fc: Fix use-after-free of ft_tpg
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Grover <[email protected]>
commit 2c42be2dd4f6586728dba5c4e197afd5cfaded78 upstream.
ft_del_tpg checks tpg->tport is set before unlinking the tpg from the tport when the tpg is being removed. Set this pointer in ft_tport_create, or the unlinking won't happen in ft_del_tpg and tport->tpg will reference a deleted object.
This patch sets tpg->tport in ft_tport_create, because that's what ft_del_tpg checks, and is the only way to get back to the tport to clear tport->tpg.
The bug was occuring when:
- lport created, tport (our per-lport, per-provider context) is allocated.
tport->tpg = NULL
- tpg created
- a PRLI is received. ft_tport_create is called, tpg is found and tport->tpg is set
- tpg removed. ft_tpg is freed in ft_del_tpg. Since tpg->tport was not set, tport->tpg is not cleared and points at freed memory
- Future calls to ft_tport_create return tport via first conditional, instead of searching for new tpg by calling ft_lport_find_tpg. tport->tpg is still invalid, and will access freed memory.
see https://bugzilla.redhat.com/show_bug.cgi?id=1071340
--- drivers/target/tcm_fc/tfc_sess.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/tcm_fc/tfc_sess.c +1 -0
@@ -68,6 +68,7 @@ static struct ft_tport *ft_tport_create(if (tport) { tport->tpg = tpg; + tpg->tport = tport;return tport; }
Greg Kroah-Hartman
maintainerPATCH 56/86 x86/efi: Correct EFI boot stub use of code32_start
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit 7e8213c1f3acc064aef37813a39f13cbfe7c3ce7 upstream.
code32_start should point at the start of the protected mode code, and *not* at the beginning of the bzImage. This is much easier to do in assembly so document that callers of make_boot_params() need to fill out code32_start.
The fallout from this bug is that we would end up relocating the image but copying the image at some offset, resulting in what appeared to be memory corruption.
--- arch/x86/boot/compressed/eboot.c | 5 +++-- arch/x86/boot/compressed/head_32.S | 14 ++++++++------ arch/x86/boot/compressed/head_64.S | 9 +++------ 3 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/boot/compressed/eboot.c +3 -2
@@ -865,6 +865,9 @@ fail:* Because the x86 boot code expects to be passed a boot_params we * need to create one ourselves (usually the bootloader would create * one for us). +* +* The caller is responsible for filling out ->code32_start in the +* returned boot_params. */ struct boot_params *make_boot_params (void *handle,efi_system_table_t *_table) {
@@ -921,8 +924,6 @@ struct boot_params *make_boot_params(voi hdr->vid_mode =0xffff ; hdr->boot_flag =0xAA55 ; - hdr->code32_start = (__u64 )(unsigned long )image->image_base; - hdr->type_of_loader =0x21 ;/* Convert unicode cmdline to ascii */
arch/x86/boot/compressed/head_32.S +8 -6
@@ -50,6 +50,13 @@ ENTRY(efi_pe_entry) pushl %eax pushl %esi pushl %ecx + + call reloc +reloc: + popl %ecx + subl reloc, %ecx + movl %ecx, BP_code32_start(%eax) + sub $0x4, %esp ENTRY(efi_stub_entry)
@@ -63,12 +70,7 @@ ENTRY(efi_stub_entry) hlt jmp 1b 2: - call 3f -3: - popl %eax - subl $3b, %eax - subl BP_pref_address(%esi), %eax - add BP_code32_start(%esi), %eax + movl BP_code32_start(%esi), %eax leal preferred_addr(%eax), %eax jmp *%eax
arch/x86/boot/compressed/head_64.S +3 -6
@@ -217,6 +217,8 @@ ENTRY(efi_pe_entry) cmpq $0,%rax je 1f mov %rax, %rdx + leaq startup_32(%rip), %rax + movl %eax, BP_code32_start(%rdx) popq %rsi popq %rdi
@@ -230,12 +232,7 @@ ENTRY(efi_stub_entry) hlt jmp 1b 2: - call 3f -3: - popq %rax - subq $3b, %rax - subq BP_pref_address(%rsi), %rax - add BP_code32_start(%esi), %eax + movl BP_code32_start(%esi), %eax leaq preferred_addr(%rax), %rax jmp *%rax
Greg Kroah-Hartman
maintainerPATCH 57/86 reiserfs: fix race in readdir
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit 01d8885785a60ae8f4c37b0ed75bdc96d0fc6a44 upstream.
jdm-20004 reiserfs_delete_xattrs: Couldn't delete all xattrs (-2)
The -ENOENT is due to readdir calling dir_emit on the same entry twice.
If the dir_emit callback sleeps and the tree is changed underneath us, we won't be able to trust deh_offset(deh) anymore. We need to save next_pos before we might sleep so we can find the next entry.
--- fs/reiserfs/dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/reiserfs/dir.c +4 -2
@@ -128,6 +128,7 @@ int reiserfs_readdir_dentry(struct dentrchar *d_name;off_t d_off;ino_t d_ino; +loff_t cur_pos =deh_offset (deh);if (!de_visible (deh))/* it is hidden entry */
@@ -200,8 +201,9 @@ int reiserfs_readdir_dentry(struct dentrif (local_buf != small_buf) {kfree (local_buf); } -// next entry should be looked for with such offset - next_pos =deh_offset (deh) +1 ; + +/* deh_offset(deh) may be invalid now. */ + next_pos = cur_pos +1 ;if (item_moved (&tmp_ih, &path_to_entry)) { set_cpu_key_k_offset(&pos_key,
Greg Kroah-Hartman
maintainerPATCH 58/86 usb: gadget: tcm_usb_gadget: stop format strings
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit aba37fd975f0dd58e025c99c2a79b61b20190831 upstream.
This makes sure that the name coming out of configfs cannot be used accidentally as a format string.
--- drivers/usb/gadget/tcm_usb_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/tcm_usb_gadget.c +1 -1
@@ -1614,7 +1614,7 @@ static struct se_wwn *usbg_make_tport(return ERR_PTR (-ENOMEM ); } tport->tport_wwpn = wwpn; -snprintf (tport->tport_name,sizeof (tport->tport_name), wnn_name); +snprintf (tport->tport_name,sizeof (tport->tport_name),"%s" , wnn_name);return &tport->tport_wwn; }
Greg Kroah-Hartman
maintainerPATCH 59/86 usb: gadget: zero: Fix SuperSpeed enumeration for alternate setting 1
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 9c1b70361e0b38e4acb8e62b54da66538cb77ff2 upstream.
It was impossible to enumerate on a SuperSpeed (XHCI) host with alternate setting = 1 due to the wrongly set 'bMaxBurst' field in the SuperSpeed Endpoint Companion descriptor.
Testcase:
<host> modprobe -r usbtest; modprobe usbtest alt=1 <device> modprobe g_zero
plug device to SuperSpeed port on the host.
Without this patch the host always complains like so "usb 12-2: Not enough bandwidth for new device state.
usb 12-2: Not enough bandwidth for altsetting 1"
Bug was introduced by commit cf9a08ae in v3.9
new function interface)
--- drivers/usb/gadget/zero.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/zero.c +1 -1
@@ -280,7 +280,7 @@ static int __init zero_bind(struct usb_c ss_opts->isoc_interval = gzero_options.isoc_interval; ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket; ss_opts->isoc_mult = gzero_options.isoc_mult; - ss_opts->isoc_maxburst = gzero_options.isoc_maxpacket; + ss_opts->isoc_maxburst = gzero_options.isoc_maxburst; ss_opts->bulk_buflen = gzero_options.bulk_buflen; func_ss =usb_get_function (func_inst_ss);
Greg Kroah-Hartman
maintainerPATCH 60/86 xhci: Prevent runtime pm from autosuspending during initialization
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit bcffae7708eb8352f44dc510b326541fe43a02a4 upstream.
xHCI driver has its own pci probe function that will call usb_hcd_pci_probe to register its usb-2 bus, and then continue to manually register the usb-3 bus. usb_hcd_pci_probe does a pm_runtime_put_noidle at the end and might thus trigger a runtime suspend before the usb-3 bus is ready.
Prevent the runtime suspend by increasing the usage count in the beginning of xhci_pci_probe, and decrease it once the usb-3 bus is ready.
xhci-platform driver is not using usb_hcd_pci_probe to set up busses and should not need to have it's usage count increased during probe.
--- drivers/usb/host/xhci-pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +10 -1
@@ -161,6 +161,10 @@ static int xhci_pci_probe(struct pci_devstruct usb_hcd *hcd; driver = (struct hc_driver *)id->driver_data; + +/* Prevent runtime suspending between USB-2 and USB-3 initialization */ +pm_runtime_get_noresume (&dev->dev); +/* Register the USB 2.0 roothub. * FIXME: USB core must know to register the USB 2.0 roothub first. * This is sort of silly, because we could just set the HCD driver flags
@@ -170,7 +174,7 @@ static int xhci_pci_probe(struct pci_dev retval =usb_hcd_pci_probe (dev, id);if (retval) -return retval; + goto put_runtime_pm;/* USB 2.0 roothub is stored in the PCI device now. */ hcd =dev_get_drvdata (&dev->dev);
@@ -199,12 +203,17 @@ static int xhci_pci_probe(struct pci_devif (xhci->quirks &XHCI_LPM_SUPPORT )hcd_to_bus (xhci->shared_hcd)->root_hub->lpm_capable =1 ; +/* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ +pm_runtime_put_noidle (&dev->dev); +return 0 ; put_usb3_hcd:usb_put_hcd (xhci->shared_hcd); dealloc_usb2_hcd:usb_hcd_pci_remove (dev); +put_runtime_pm: +pm_runtime_put_noidle (&dev->dev);return retval; }
Greg Kroah-Hartman
maintainerPATCH 61/86 xhci: extend quirk for Renesas cards
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Gnatenko <[email protected]>
commit 6db249ebefc6bf5c39f35dfaacc046d8ad3ffd70 upstream.
After suspend another Renesas PCI-X USB 3.0 card doesn't work. [root@fedora-20 ~]# lspci -vmnnd 1912:
Device: 03:00.0
Class: USB controller [0c03]
Vendor: Renesas Technology Corp. [1912]
Device: uPD720202 USB 3.0 Host Controller [0015]
SVendor: Renesas Technology Corp. [1912]
SDevice: uPD720202 USB 3.0 Host Controller [0015]
Rev: 02
ProgIf: 30
This patch should be applied to stable kernel 3.14 that contain the commit 1aa9578c1a9450fb21501c4f549f5b1edb557e6d "xhci: Fix resume issues on Renesas chips in Samsung laptops"
Reference: http://redmine.russianfedora.pro/issues/1315
--- drivers/usb/host/xhci-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/host/xhci-pci.c +1 -3
@@ -114,9 +114,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |=XHCI_TRUST_TX_LENGTH ; }if (pdev->vendor ==PCI_VENDOR_ID_RENESAS && - pdev->device ==0x0015 && - pdev->subsystem_vendor ==PCI_VENDOR_ID_SAMSUNG && - pdev->subsystem_device ==0xc0cd ) + pdev->device ==0x0015 ) xhci->quirks |=XHCI_RESET_ON_RESUME ;if (pdev->vendor ==PCI_VENDOR_ID_VIA ) xhci->quirks |=XHCI_RESET_ON_RESUME ;
Greg Kroah-Hartman
maintainerPATCH 62/86 usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Cohen <[email protected]>
commit 01bb59ebffdec314da8da66266edf29529372f9b upstream.
When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]
Instead of creating nested #ifdefs, this patch fixes it by defining the xHCI PCI stubs as inline.
This warning has been in since 3.2 kernel and was caused by commit 421aa841a134f6a743111cf44d0c6d3b45e3cf8c "usb/xhci: hide MSI code behind PCI bars", but wasn't noticed until 3.13 when a configuration with these options was tried
--- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.c +3 -3
@@ -394,16 +394,16 @@ static int xhci_try_enable_msi(struct us#else -static int xhci_try_enable_msi (struct usb_hcd *hcd) +static inline int xhci_try_enable_msi (struct usb_hcd *hcd) {return 0 ; } -static void xhci_cleanup_msix (struct xhci_hcd *xhci) +static inline void xhci_cleanup_msix (struct xhci_hcd *xhci) { } -static void xhci_msix_sync_irqs (struct xhci_hcd *xhci) +static inline void xhci_msix_sync_irqs (struct xhci_hcd *xhci) { }
Greg Kroah-Hartman
maintainerPATCH 63/86 media: uvcvideo: Do not use usb_set_interface on bulk EP
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
commit b1e43f232698274871e1358c276d7b0242a7d607 upstream.
The UVC specification uses alternate setting selection to notify devices of stream start/stop. This breaks when using bulk-based devices, as the video streaming interface has a single alternate setting in that case, making video stream start and video stream stop events to appear identical to the device. Bulk-based devices are thus not well supported by UVC.
The webcam built in the Asus Zenbook UX302LA ignores the set interface request and will keep the video stream enabled when the driver tries to stop it. If USB autosuspend is enabled the device will then be suspended and will crash, requiring a cold reboot.
USB trace capture showed that Windows sends a CLEAR_FEATURE(HALT) request to the bulk endpoint when stopping the stream instead of selecting alternate setting 0. The camera then behaves correctly, and thus seems to require that behaviour.
Replace selection of alternate setting 0 with clearing of the endpoint halt feature at video stream stop for bulk-based devices. Let's refrain from blaming Microsoft this time, as it's not clear whether this Windows-specific but USB-compliant behaviour was specifically developed to handle bulkd-based UVC devices, or if the camera just took advantage of it.
--- drivers/media/usb/uvc/uvc_video.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_video.c +19 -1
@@ -1846,7 +1846,25 @@ int uvc_video_enable(struct uvc_streaminif (!enable) {uvc_uninit_video (stream,1 ); -usb_set_interface (stream->dev->udev, stream->intfnum,0 ); +if (stream->intf->num_altsetting >1 ) { +usb_set_interface (stream->dev->udev, + stream->intfnum,0 ); + }else { +/* UVC doesn't specify how to inform a bulk-based device +* when the video stream is stopped. Windows sends a +* CLEAR_FEATURE(HALT) request to the video streaming +* bulk endpoint, mimic the same behaviour. +*/ +unsigned int epnum = stream->header.bEndpointAddress + &USB_ENDPOINT_NUMBER_MASK ; +unsigned int dir = stream->header.bEndpointAddress + &USB_ENDPOINT_DIR_MASK ; +unsigned int pipe; + + pipe =usb_sndbulkpipe (stream->dev->udev, epnum) | dir; +usb_clear_halt (stream->dev->udev, pipe); + } +uvc_queue_enable (&stream->queue,0 );uvc_video_clock_cleanup (stream);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 64/86 media: v4l2-compat-ioctl32: fix wrong VIDIOC_SUBDEV_G/S_EDID32 support
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit bc826d6e39fe5f09cbadf8723e9183e6331b586f upstream.
The wrong ioctl numbers were used due to a copy-and-paste error.
--- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +2 -2
@@ -787,8 +787,8 @@ static int put_v4l2_subdev_edid32(struct#define VIDIOC_DQBUF32 _IOWR('V', 17, struct v4l2_buffer32)#define VIDIOC_ENUMSTD32 _IOWR('V', 25, struct v4l2_standard32)#define VIDIOC_ENUMINPUT32 _IOWR('V', 26, struct v4l2_input32) -#define VIDIOC_SUBDEV_G_EDID32 _IOWR('V', 63, struct v4l2_subdev_edid32) -#define VIDIOC_SUBDEV_S_EDID32 _IOWR('V', 64, struct v4l2_subdev_edid32) +#define VIDIOC_SUBDEV_G_EDID32 _IOWR('V', 40, struct v4l2_subdev_edid32) +#define VIDIOC_SUBDEV_S_EDID32 _IOWR('V', 41, struct v4l2_subdev_edid32)#define VIDIOC_TRY_FMT32 _IOWR('V', 64, struct v4l2_format32)#define VIDIOC_G_EXT_CTRLS32 _IOWR('V', 71, struct v4l2_ext_controls32)#define VIDIOC_S_EXT_CTRLS32 _IOWR('V', 72, struct v4l2_ext_controls32)
Greg Kroah-Hartman
maintainerPATCH 65/86 media: m88rs2000: prevent frontend crash on continuous transponder scans
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 8272d0a0c0d374a01721e579df6e8add5577132b upstream.
Add m88rs2000_get_tune_settings, min delay of 2000 ms on symbol rate more than 3000000 and delay of 3000ms less than this.
Adding min delay prevents crashing the frontend on continuous transponder scans. Other dvb_frontend_tune_settings remain as default.
This makes very little time difference to good channel scans, but slows down the set frontend where lock can never be achieved i.e. DVB-S2.
--- drivers/media/dvb-frontends/m88rs2000.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/media/dvb-frontends/m88rs2000.c +17 -0
@@ -712,6 +712,22 @@ static int m88rs2000_get_frontend(structreturn 0 ; } +static int m88rs2000_get_tune_settings (struct dvb_frontend *fe, +struct dvb_frontend_tune_settings *tune) +{ +struct dtv_frontend_properties *c = &fe->dtv_property_cache; + +if (c->symbol_rate >3000000 ) + tune->min_delay_ms =2000 ; +else + tune->min_delay_ms =3000 ; + + tune->step_size = c->symbol_rate /16000 ; + tune->max_drift = c->symbol_rate /2000 ; + +return 0 ; +} +static int m88rs2000_i2c_gate_ctrl (struct dvb_frontend *fe,int enable) {struct m88rs2000_state *state = fe->demodulator_priv;
@@ -763,6 +779,7 @@ static struct dvb_frontend_ops m88rs2000 .set_frontend = m88rs2000_set_frontend, .get_frontend = m88rs2000_get_frontend, + .get_tune_settings = m88rs2000_get_tune_settings, }; struct dvb_frontend *m88rs2000_attach(const struct m88rs2000_config *config,
Greg Kroah-Hartman
maintainerPATCH 66/86 media: m88rs2000: add caps FE_CAN_INVERSION_AUTO
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 3c8023a782964c72574ad8268ba0ea4e2d9772fc upstream.
The m88rs2000 frontend is always auto inversion.
--- drivers/media/dvb-frontends/m88rs2000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/m88rs2000.c +1 -1
@@ -759,7 +759,7 @@ static struct dvb_frontend_ops m88rs2000 .symbol_rate_tolerance = 500, /* ppm */ .caps =FE_CAN_FEC_1_2 |FE_CAN_FEC_2_3 |FE_CAN_FEC_3_4 |FE_CAN_FEC_5_6 |FE_CAN_FEC_7_8 | -FE_CAN_QPSK | +FE_CAN_QPSK |FE_CAN_INVERSION_AUTO |FE_CAN_FEC_AUTO },
Greg Kroah-Hartman
maintainerPATCH 67/86 media: em28xx: fix PCTV 290e LNA oops
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit 3ec40dcfb413214b2874aec858870502b61c2202 upstream.
Pointer to device state has been moved to different location during some change. PCTV 290e LNA function still uses old pointer, carried over FE priv, and it crash.
--- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-dvb.c +2 -1
@@ -673,7 +673,8 @@ static void pctv_520e_init(struct em28xxstatic int em28xx_pctv_290e_set_lna (struct dvb_frontend *fe) {struct dtv_frontend_properties *c = &fe->dtv_property_cache; -struct em28xx *dev = fe->dvb->priv; +struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; +struct em28xx *dev = i2c_bus->dev;#ifdef CONFIG_GPIOLIB struct em28xx_dvb *dvb = dev->dvb;int ret;
Greg Kroah-Hartman
maintainerPATCH 68/86 media: saa7134: fix WARN_ON during resume
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 30d652823de5fd7907d40e969a2d8e23938d8d03 upstream.
Do not attempt to reload the tuner modules when resuming after a suspend. This triggers a WARN_ON in kernel/kmod.c:148 __request_module.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=69581.
This has always been wrong, but it was never noticed until the WARN_ON was added in 3.9.
--- drivers/media/pci/saa7134/saa7134-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/saa7134/saa7134-cards.c +2 -2
@@ -8045,8 +8045,8 @@ int saa7134_board_init2(struct saa7134_dbreak ; }/* switch() */ -/* initialize tuner */ -if (TUNER_ABSENT != dev->tuner_type) { +/* initialize tuner (don't do this when resuming) */ +if (!dev->insuspend &&TUNER_ABSENT != dev->tuner_type) {int has_demod = (dev->tda9887_conf &TDA9887_PRESENT );/* Note: radio tuner address is always filled in,
Greg Kroah-Hartman
maintainerPATCH 69/86 media: omap3isp: preview: Fix the crop margins
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Vaussard <[email protected]>
commit 8b57b9669aa884ac75b8d09c251d6b1755533c15 upstream.
Commit 3fdfedaaa "[media] omap3isp: preview: Lower the crop margins" accidentally changed the previewer's cropping, causing the previewer to miss four pixels on each line, thus corrupting the final image. Restored the removed setting.
--- drivers/media/platform/omap3isp/isppreview.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/platform/omap3isp/isppreview.c +9 -0
@@ -1079,6 +1079,7 @@ static void preview_config_input_format(*/ static void preview_config_input_size (struct isp_prev_device *prev,u32 active) { +const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK ];struct isp_device *isp =to_isp_device (prev);unsigned int sph = prev->crop.left;unsigned int eph = prev->crop.left + prev->crop.width -1 ;
@@ -1086,6 +1087,14 @@ static void preview_config_input_size(stunsigned int elv = prev->crop.top + prev->crop.height -1 ;u32 features; +if (format->code !=V4L2_MBUS_FMT_Y8_1X8 && + format->code !=V4L2_MBUS_FMT_Y10_1X10 ) { + sph -=2 ; + eph +=2 ; + slv -=2 ; + elv +=2 ; + } + features = (prev->params.params[0 ].features & active) | (prev->params.params[1 ].features & ~active);
Greg Kroah-Hartman
maintainerPATCH 70/86 media: media: gspca: sn9c20x: add ID for Genius Look 1320 V2
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 61f0319193c44adbbada920162d880b1fdb3aeb3 upstream.
--- Documentation/video4linux/gspca.txt | 1 + drivers/media/usb/gspca/sn9c20x.c | 1 + 2 files changed, 2 insertions(+)
Documentation/video4linux/gspca.txt +1 -0
@@ -55,6 +55,7 @@ zc3xx 0458:700f Genius VideoCam Web V2 sonixj 0458:7025 Genius Eye 311Q sn9c20x 0458:7029 Genius Look 320s sonixj 0458:702e Genius Slim 310 NB +sn9c20x 0458:7045 Genius Look 1320 V2 sn9c20x 0458:704a Genius Slim 1320 sn9c20x 0458:704c Genius i-Look 1321 sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650)
drivers/media/usb/gspca/sn9c20x.c +1 -0
@@ -2394,6 +2394,7 @@ static const struct usb_device_id device {USB_DEVICE(0x045e, 0x00f4), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x145f, 0x013d), SN9C20X(OV7660, 0x21, 0)}, {USB_DEVICE(0x0458, 0x7029), SN9C20X(HV7131R, 0x11, 0)}, + {USB_DEVICE(0x0458, 0x7045), SN9C20X(MT9M112, 0x5d, LED_REVERSE)}, {USB_DEVICE(0x0458, 0x704a), SN9C20X(MT9M112, 0x5d, 0)}, {USB_DEVICE(0x0458, 0x704c), SN9C20X(MT9M112, 0x5d, 0)}, {USB_DEVICE(0xa168, 0x0610), SN9C20X(HV7131R, 0x11, 0)},
Greg Kroah-Hartman
maintainerPATCH 71/86 usb: dwc3: fix wrong bit mask in dwc3_event_devt
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Rui <[email protected]>
commit 06f9b6e59661cee510b04513b13ea7927727d758 upstream.
Around DWC USB3 2.30a release another bit has been added to the Device-Specific Event (DEVT) Event Information (EvtInfo) bitfield.
Because of that, what used to be 8 bits long, has become 9 bits long.
Per dwc3 2.30a+ spec in the Device-Specific Event (DEVT), the field of Event Information Bits(EvtInfo) uses [24:16] bits, and it has 9 bits not 8 bits. And the following reserved field uses [31:25] bits not [31:24] bits, and it has 7 bits.
So in dwc3_event_devt, the bit mask should be:event_info [24:16] 9 bitsreserved31_25 [31:25] 7 bits
This patch makes sure that newer core releases will work fine with Linux and that we will decode the event information properly on new core releases.
[ [email protected] : improve commit log a bit ]
--- drivers/usb/dwc3/core.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/core.h +3 -3
@@ -836,15 +836,15 @@ struct dwc3_event_depevt {* 12 - VndrDevTstRcved * @reserved15_12: Reserved, not used * @event_info: Information about this event -* @reserved31_24: Reserved, not used +* @reserved31_25: Reserved, not used */ struct dwc3_event_devt {u32 one_bit:1 ;u32 device_event:7 ;u32 type:4 ;u32 reserved15_12:4 ; -u32 event_info:8 ; -u32 reserved31_24:8 ; +u32 event_info:9 ; +u32 reserved31_25:7 ; } __packed;/**
Greg Kroah-Hartman
maintainerPATCH 72/86 usb: musb: avoid NULL pointer dereference
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit eee3f15d5f1f4f0c283dd4db67dc1b874a2852d1 upstream.
instead of relying on the otg pointer, which can be NULL in certain cases, we can use the gadget and host pointers we already hold inside struct musb.
--- drivers/usb/musb/musb_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_core.c +2 -3
@@ -440,7 +440,6 @@ void musb_hnp_stop(struct musb *musb)static irqreturn_t musb_stage0_irq (struct musb *musb,u8 int_usb,u8 devctl) { -struct usb_otg *otg = musb->xceiv->otg;irqreturn_t handled =IRQ_NONE ; dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl,
@@ -655,7 +654,7 @@ static irqreturn_t musb_stage0_irq(strucbreak ;case OTG_STATE_B_PERIPHERAL :musb_g_suspend (musb); - musb->is_active = otg->gadget->b_hnp_enable; + musb->is_active = musb->g.b_hnp_enable;if (musb->is_active) { musb->xceiv->state =OTG_STATE_B_WAIT_ACON ;dev_dbg (musb->controller,"HNP: Setting timer for b_ase0_brst\n" );
@@ -671,7 +670,7 @@ static irqreturn_t musb_stage0_irq(strucbreak ;case OTG_STATE_A_HOST : musb->xceiv->state =OTG_STATE_A_SUSPEND ; - musb->is_active = otg->host->b_hnp_enable; + musb->is_active = musb->hcd->self.b_hnp_enable;break ;case OTG_STATE_B_HOST :/* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
Greg Kroah-Hartman
maintainerPATCH 73/86 hvc: ensure hvc_init is only ever called once in hvc_console.c
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit f76a1cbed18c86e2d192455f0daebb48458965f3 upstream.
Commit 3e6c6f630a5282df8f3393a59f10eb9c56536d23 ("Delay creation of khcvd thread") moved the call of hvc_init from being a device_initcall into hvc_alloc, and used a non-null hvc_driver as indication of whether hvc_init had already been called.
The problem with this is that hvc_driver is only assigned a value at the bottom of hvc_init, and so there is a window where multiple hvc_alloc calls can be in progress at the same time and hence try and call hvc_init multiple times. Previously the use of device_init guaranteed that hvc_init was only called once.
This manifests itself as sporadic instances of two hvc_init calls racing each other, and with the loser of the race getting -EBUSY from tty_register_driver() and hence that virtual console fails:
Couldn't register hvc console driver virtio-ports vport0p1: error -16 allocating hvc for port
Here we add an atomic_t to guarantee we'll never run hvc_init twice.
--- drivers/tty/hvc/hvc_console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/hvc/hvc_console.c +5 -1
@@ -31,6 +31,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/major.h> +#include <linux/atomic.h> #include <linux/sysrq.h> #include <linux/tty.h> #include <linux/tty_flip.h>
@@ -70,6 +71,9 @@ static struct task_struct *hvc_task;/* Picks up late kicks after list walk but before schedule() */ static int hvc_kicked; +/* hvc_init is triggered from hvc_alloc, i.e. only when actually used */ +static atomic_t hvc_needs_init__read_mostly =ATOMIC_INIT (-1 ); +static int hvc_init (void );#ifdef CONFIG_MAGIC_SYSRQ
@@ -842,7 +846,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtint i;/* We wait until a driver actually comes along */ -if (!hvc_driver) { +if (atomic_inc_not_zero (&hvc_needs_init)) {int err =hvc_init ();if (err)return ERR_PTR (err);
Greg Kroah-Hartman
maintainerPATCH 74/86 usb: phy: Add ulpi IDs for SMSC USB3320 and TI TUSB1210
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
commit ead5178bf442dbae4008ee54bf4f66a1f6a317c9 upstream.
Add new ulpi IDs which are available on Xilinx Zynq boards.
--- drivers/usb/phy/phy-ulpi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/phy/phy-ulpi.c +2 -0
@@ -47,6 +47,8 @@ struct ulpi_info {static struct ulpi_info ulpi_ids[] = {ULPI_INFO (ULPI_ID (0x04cc ,0x1504 ),"NXP ISP1504" ),ULPI_INFO (ULPI_ID (0x0424 ,0x0006 ),"SMSC USB331x" ), +ULPI_INFO (ULPI_ID (0x0424 ,0x0007 ),"SMSC USB3320" ), +ULPI_INFO (ULPI_ID (0x0451 ,0x1507 ),"TI TUSB1210" ), };static int ulpi_set_otg_flags (struct usb_phy *phy)
Greg Kroah-Hartman
maintainerPATCH 75/86 USB: unbind all interfaces before rebinding any
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 6aec044cc2f5670cf3b143c151c8be846499bd15 upstream.
When a driver doesn't have pre_reset, post_reset, or reset_resume methods, the USB core unbinds that driver when its device undergoes a reset or a reset-resume, and then rebinds it afterward.
The existing straightforward implementation can lead to problems, because each interface gets unbound and rebound before the next interface is handled. If a driver claims additional interfaces, the claim may fail because the old binding instance may still own the additional interface when the new instance tries to claim it.
This patch fixes the problem by first unbinding all the interfaces that are marked (i.e., their needs_binding flag is set) and then rebinding all of them.
The patch also makes the helper functions in driver.c a little more uniform and adjusts some out-of-date comments.
--- drivers/usb/core/driver.c | 94 +++++++++++++++++++++++++++------------------- drivers/usb/core/hub.c | 5 +- drivers/usb/core/usb.h | 2 3 files changed, 60 insertions(+), 41 deletions(-)
drivers/usb/core/driver.c +56 -38
@@ -953,8 +953,7 @@ EXPORT_SYMBOL_GPL(usb_deregister);* it doesn't support pre_reset/post_reset/reset_resume or * because it doesn't support suspend/resume. * -* The caller must hold @intf's device's lock, but not its pm_mutex -* and not @intf->dev.sem. +* The caller must hold @intf's device's lock, but not @intf's lock. */ void usb_forced_unbind_intf (struct usb_interface *intf) {
@@ -967,16 +966,37 @@ void usb_forced_unbind_intf(struct usb_i intf->needs_binding =1 ; } +/* +* Unbind drivers for @udev's marked interfaces. These interfaces have +* the needs_binding flag set, for example by usb_resume_interface(). +* +* The caller must hold @udev's device lock. +*/ +static void unbind_marked_interfaces (struct usb_device *udev) +{ +struct usb_host_config *config; +int i; +struct usb_interface *intf; + + config = udev->actconfig; +if (config) { +for (i =0 ; i < config->desc.bNumInterfaces; ++i) { + intf = config->interface[i]; +if (intf->dev.driver && intf->needs_binding) +usb_forced_unbind_intf (intf); + } + } +} +/* Delayed forced unbinding of a USB interface driver and scan * for rebinding. * -* The caller must hold @intf's device's lock, but not its pm_mutex -* and not @intf->dev.sem. +* The caller must hold @intf's device's lock, but not @intf's lock. * * Note: Rebinds will be skipped if a system sleep transition is in * progress and the PM "complete" callback hasn't occurred yet. */ -void usb_rebind_intf (struct usb_interface *intf) +static void usb_rebind_intf (struct usb_interface *intf) {int rc;
@@ -993,68 +1013,66 @@ void usb_rebind_intf(struct usb_interfac } } -#ifdef CONFIG_PM - -/* Unbind drivers for @udev's interfaces that don't support suspend/resume -* There is no check for reset_resume here because it can be determined -* only during resume whether reset_resume is needed. +/* +* Rebind drivers to @udev's marked interfaces. These interfaces have +* the needs_binding flag set. * * The caller must hold @udev's device lock. */ -static void unbind_no_pm_drivers_interfaces (struct usb_device *udev) +static void rebind_marked_interfaces (struct usb_device *udev) {struct usb_host_config *config;int i;struct usb_interface *intf; -struct usb_driver *drv; config = udev->actconfig;if (config) {for (i =0 ; i < config->desc.bNumInterfaces; ++i) { intf = config->interface[i]; - -if (intf->dev.driver) { - drv =to_usb_driver (intf->dev.driver); -if (!drv->suspend || !drv->resume) -usb_forced_unbind_intf (intf); - } +if (intf->needs_binding) +usb_rebind_intf (intf); } } } -/* Unbind drivers for @udev's interfaces that failed to support reset-resume. -* These interfaces have the needs_binding flag set by usb_resume_interface(). +/* +* Unbind all of @udev's marked interfaces and then rebind all of them. +* This ordering is necessary because some drivers claim several interfaces +* when they are first probed. * * The caller must hold @udev's device lock. */ -static void unbind_no_reset_resume_drivers_interfaces (struct usb_device *udev) +void usb_unbind_and_rebind_marked_interfaces (struct usb_device *udev) { -struct usb_host_config *config; -int i; -struct usb_interface *intf; - - config = udev->actconfig; -if (config) { -for (i =0 ; i < config->desc.bNumInterfaces; ++i) { - intf = config->interface[i]; -if (intf->dev.driver && intf->needs_binding) -usb_forced_unbind_intf (intf); - } - } +unbind_marked_interfaces (udev); +rebind_marked_interfaces (udev); } -static void do_rebind_interfaces (struct usb_device *udev) +#ifdef CONFIG_PM + +/* Unbind drivers for @udev's interfaces that don't support suspend/resume +* There is no check for reset_resume here because it can be determined +* only during resume whether reset_resume is needed. +* +* The caller must hold @udev's device lock. +*/ +static void unbind_no_pm_drivers_interfaces (struct usb_device *udev) {struct usb_host_config *config;int i;struct usb_interface *intf; +struct usb_driver *drv; config = udev->actconfig;if (config) {for (i =0 ; i < config->desc.bNumInterfaces; ++i) { intf = config->interface[i]; -if (intf->needs_binding) -usb_rebind_intf (intf); + +if (intf->dev.driver) { + drv =to_usb_driver (intf->dev.driver); +if (!drv->suspend || !drv->resume) +usb_forced_unbind_intf (intf); + } } } }
@@ -1379,7 +1397,7 @@ int usb_resume_complete(struct device *d* whose needs_binding flag is set */ if (udev->state !=USB_STATE_NOTATTACHED ) -do_rebind_interfaces (udev); +rebind_marked_interfaces (udev);return 0 ; }
@@ -1401,7 +1419,7 @@ int usb_resume(struct device *dev, pm_mepm_runtime_disable (dev);pm_runtime_set_active (dev);pm_runtime_enable (dev); -unbind_no_reset_resume_drivers_interfaces (udev); +unbind_marked_interfaces (udev); }/* Avoid PM error messages for devices disconnected while suspended
drivers/usb/core/hub.c +3 -2
@@ -5252,10 +5252,11 @@ int usb_reset_device(struct usb_device *else if (cintf->condition ==USB_INTERFACE_BOUND ) rebind =1 ; +if (rebind) + cintf->needs_binding =1 ; } -if (ret ==0 && rebind) -usb_rebind_intf (cintf); } +usb_unbind_and_rebind_marked_interfaces (udev); }usb_autosuspend_device (udev);
drivers/usb/core/usb.h +1 -1
@@ -55,7 +55,7 @@ extern int usb_match_one_id_intf(structextern int usb_match_device (struct usb_device *dev,const struct usb_device_id *id);extern void usb_forced_unbind_intf (struct usb_interface *intf); -extern void usb_rebind_intf (struct usb_interface *intf); +extern void usb_unbind_and_rebind_marked_interfaces (struct usb_device *udev);extern int usb_hub_claim_port (struct usb_device *hdev,unsigned port,struct dev_state *owner);
Greg Kroah-Hartman
maintainerPATCH 76/86 mtip32xx: Set queue bounce limit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Franciosi <[email protected]>
commit 1044b1bb9278f2e656a1a7b63dc24a59506540aa upstream.
We need to set the queue bounce limit during the device initialization to prevent excessive bouncing on 32 bit architectures.
--- drivers/block/mtip32xx/mtip32xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/mtip32xx/mtip32xx.c +1 -0
@@ -4040,6 +4040,7 @@ skip_create_disk:blk_queue_max_hw_sectors (dd->queue,0xffff );blk_queue_max_segment_size (dd->queue,0x400000 );blk_queue_io_min (dd->queue,4096 ); +blk_queue_bounce_limit (dd->queue, dd->pdev->dma_mask);/* * write back cache is not supported in the device. FUA depends on
Greg Kroah-Hartman
maintainerPATCH 77/86 sh: fix format string bug in stack tracer
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit a0c32761e73c9999cbf592b702f284221fea8040 upstream.
Kees reported the following error:
arch/sh/kernel/dumpstack.c: In function 'print_trace_address':
arch/sh/kernel/dumpstack.c:118:2: error: format not a string literal and no format arguments [-Werror=format-security]
Use the "%s" format so that it's impossible to interpret 'data' as a format string.
--- arch/sh/kernel/dumpstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/dumpstack.c +1 -1
@@ -115,7 +115,7 @@ static int print_trace_stack(void *data,*/ static void print_trace_address (void *data,unsigned long addr,int reliable) { -printk (data); +printk ("%s" , (char *)data);printk_address (addr, reliable); }
Greg Kroah-Hartman
maintainerPATCH 78/86 mm: try_to_unmap_cluster() should lock_page() before mlocking
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 57e68e9cd65b4b8eb4045a1e0d0746458502554c upstream.
A BUG_ON(!PageLocked) was triggered in mlock_vma_page() by Sasha Levin fuzzing with trinity. The call site try_to_unmap_cluster() does not lock the pages other than its check_page parameter (which is already locked).
The BUG_ON in mlock_vma_page() is not documented and its purpose is somewhat unclear, but apparently it serializes against page migration, which could otherwise fail to transfer the PG_mlocked flag. This would not be fatal, as the page would be eventually encountered again, but NR_MLOCK accounting would become distorted nevertheless. This patch adds a comment to the BUG_ON in mlock_vma_page() and munlock_vma_page() to that effect.
The call site try_to_unmap_cluster() is fixed so that for page != check_page, trylock_page() is attempted (to avoid possible deadlocks as we already have check_page locked) and mlock_vma_page() is performed only upon success. If the page lock cannot be obtained, the page is left without PG_mlocked, which is again not a problem in the whole unevictable memory design.
--- mm/mlock.c | 2 ++ mm/rmap.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
mm/mlock.c +2 -0
@@ -76,6 +76,7 @@ void clear_page_mlock(struct page *page)*/ void mlock_vma_page (struct page *page) { +/* Serialize with page migration */ BUG_ON (!PageLocked (page));if (!TestSetPageMlocked (page)) {
@@ -106,6 +107,7 @@ unsigned int munlock_vma_page(struct pag {unsigned int page_mask =0 ; +/* For try_to_munlock() and to serialize with page migration */ BUG_ON (!PageLocked (page));if (TestClearPageMlocked (page)) {
mm/rmap.c +12 -2
@@ -1390,9 +1390,19 @@ static int try_to_unmap_cluster(unsignedBUG_ON (!page ||PageAnon (page));if (locked_vma) { -mlock_vma_page (page);/* no-op if already mlocked */ -if (page == check_page) +if (page == check_page) { +/* we know we have check_page locked */ +mlock_vma_page (page); ret =SWAP_MLOCK ; + }else if (trylock_page (page)) { +/* +* If we can lock the page, perform mlock. +* Otherwise leave the page alone, it will be +* eventually encountered again later. +*/ +mlock_vma_page (page); +unlock_page (page); + }continue ;/* don't unmap */ }
Greg Kroah-Hartman
maintainerPATCH 79/86 mm: hugetlb: fix softlockup when a large number of hugepages are freed.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Mizuma, Masayoshi" <[email protected]>
commit 55f67141a8927b2be3e51840da37b8a2320143ed upstream.
When I decrease the value of nr_hugepage in procfs a lot, softlockup happens. It is because there is no chance of context switch during this process.
On the other hand, when I allocate a large number of hugepages, there is some chance of context switch. Hence softlockup doesn't happen during this process. So it's necessary to add the context switch in the freeing process as same as allocating process to avoid softlockup.
When I freed 12 TB hugapages with kernel-2.6.32-358.el6, the freeing process occupied a CPU over 150 seconds and following softlockup message appeared twice or more.
$ echo 6000000 > /proc/sys/vm/nr_hugepages $ cat /proc/sys/vm/nr_hugepages 6000000 $ grep ^Huge /proc/meminfo HugePages_Total: 6000000 HugePages_Free: 6000000 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB $ echo 0 > /proc/sys/vm/nr_hugepages
BUG: soft lockup - CPU#16 stuck for 67s! [sh:12883] ... Pid: 12883, comm: sh Not tainted 2.6.32-358.el6.x86_64 #1 Call Trace: free_pool_huge_page+0xb8/0xd0 set_max_huge_pages+0x128/0x190 hugetlb_sysctl_handler_common+0x113/0x140 hugetlb_sysctl_handler+0x1e/0x20 proc_sys_call_handler+0x97/0xd0 proc_sys_write+0x14/0x20 vfs_write+0xb8/0x1a0 sys_write+0x51/0x90 __audit_syscall_exit+0x265/0x290 system_call_fastpath+0x16/0x1b
I have not confirmed this problem with upstream kernels because I am not able to prepare the machine equipped with 12TB memory now. However I confirmed that the amount of decreasing hugepages was directly proportional to the amount of required time.
I measured required times on a smaller machine. It showed 130-145 hugepages decreased in a millisecond.
Amount of decreasing Required time Decreasing rate
hugepages (msec) (pages/msec)
------------------------------------------------------------
10,000 pages == 20GB 70 - 74 135-142
30,000 pages == 60GB 208 - 229 131-144
It means decrement of 6TB hugepages will trigger softlockup with the default threshold 20sec, in this decreasing rate.
--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)
mm/hugetlb.c +1 -0
@@ -1487,6 +1487,7 @@ static unsigned long set_max_huge_pages(while (min_count <persistent_huge_pages (h)) {if (!free_pool_huge_page (h, nodes_allowed,0 ))break ; +cond_resched_lock (&hugetlb_lock); }while (count <persistent_huge_pages (h)) {if (!adjust_pool_surplus (h, nodes_allowed,1 ))
Greg Kroah-Hartman
maintainerPATCH 80/86 hung_task: check the value of "sysctl_hung_task_timeout_sec"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Hua <[email protected]>
commit 80df28476505ed4e6701c3448c63c9229a50c655 upstream.
As sysctl_hung_task_timeout_sec is unsigned long, when this value is larger then LONG_MAX/HZ, the function schedule_timeout_interruptible in watchdog will return immediately without sleep and with print :
schedule_timeout: wrong timeout value ffffffffffffff83
and then the funtion watchdog will call schedule_timeout_interruptible again and again. The screen will be filled with
"schedule_timeout: wrong timeout value ffffffffffffff83"
This patch does some check and correction in sysctl, to let the function schedule_timeout_interruptible allways get the valid parameter.
--- kernel/sysctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/sysctl.c +6 -0
@@ -144,6 +144,11 @@ static int min_percpu_pagelist_fract = 8static int ngroups_max =NGROUPS_MAX ;static const int cap_last_cap =CAP_LAST_CAP ; +/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */ +#ifdef CONFIG_DETECT_HUNG_TASK +static unsigned long hung_task_timeout_max = (LONG_MAX /HZ ); +#endif +#ifdef CONFIG_INOTIFY_USER #include <linux/inotify.h> #endif
@@ -966,6 +971,7 @@ static struct ctl_table kern_table[] = { .maxlen = sizeof(unsigned long), .mode = 0644, .proc_handler = proc_dohung_task_timeout_secs, + .extra2 = &hung_task_timeout_max, }, { .procname = "hung_task_warnings",
Greg Kroah-Hartman
maintainerPATCH 81/86 ocfs2: dlm: fix lock migration crash
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit 34aa8dac482f1358d59110d5e3a12f4351f6acaa upstream.
This issue was introduced by commit 800deef3f6f8 ("ocfs2: use list_for_each_entry where benefical") in 2007 where it replaced list_for_each with list_for_each_entry. The variable "lock" will point to invalid data if "tmpq" list is empty and a panic will be triggered due to this. Sunil advised reverting it back, but the old version was also not right. At the end of the outer for loop, that list_for_each_entry will also set "lock" to an invalid data, then in the next loop, if the "tmpq" list is empty, "lock" will be an stale invalid data and cause the panic. So reverting the list_for_each back and reset "lock" to NULL to fix this issue.
Another concern is that this seemes can not happen because the "tmpq" list should not be empty. Let me describe how.
old lock resource owner(node 1): migratation target(node 2):
image there's lockres with a EX lock from node 2 in granted list, a NR lock from node x with convert_type EX in converting list.dlm_empty_lockres() {
dlm_pick_migration_target() {
pick node 2 as target as its lock is the first one in granted list.
}
dlm_migrate_lockres() {
dlm_mark_lockres_migrating() {
res->state |= DLM_LOCK_RES_BLOCK_DIRTY;
wait_event(dlm->ast_wq, !dlm_lockres_is_dirty(dlm, res));
//after the above code, we can not dirty lockres any more,
// so dlm_thread shuffle list will not run
downconvert lock from EX to NR
upconvert lock from NR to EX<<< migration may schedule out here, then
<<< node 2 send down convert request to convert type from EX to <<< NR, then send up convert request to convert type from NR to <<< EX, at this time, lockres granted list is empty, and two locks <<< in the converting list, node x up convert lock followed by <<< node 2 up convert lock.
// will set lockres RES_MIGRATING flag, the following
// lock/unlock can not run
dlm_lockres_release_ast(dlm, res);}
dlm_send_one_lockres()
dlm_process_recovery_data()
for (i=0; i<mres->num_locks; i++)
if (ml->node == dlm->node_num)
for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
list_for_each_entry(lock, tmpq, list)
if (lock) break; <<< lock is invalid as grant list is empty.
}
if (lock->ml.node != ml->node)
BUG() >>> crash here}
I see the above locks status from a vmcore of our internal bug.
--- fs/ocfs2/dlm/dlmrecovery.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +8 -6
@@ -1751,13 +1751,13 @@ static int dlm_process_recovery_data(str struct dlm_migratable_lockres *mres) {struct dlm_migratable_lock *ml; -struct list_head *queue; +struct list_head *queue, *iter;struct list_head *tmpq =NULL ;struct dlm_lock *newlock =NULL ;struct dlm_lockstatus *lksb =NULL ;int ret =0 ;int i, j, bad; -struct dlm_lock *lock =NULL ; +struct dlm_lock *lock;u8 from =O2NM_MAX_NODES ;unsigned int added =0 ;__be64 c;
@@ -1792,14 +1792,16 @@ static int dlm_process_recovery_data(str/* MIGRATION ONLY! */ BUG_ON (!(mres->flags &DLM_MRES_MIGRATION )); + lock =NULL ;spin_lock (&res->spinlock);for (j =DLM_GRANTED_LIST ; j <=DLM_BLOCKED_LIST ; j++) { tmpq =dlm_list_idx_to_ptr (res, j); -list_for_each_entry (lock, tmpq, list) { -if (lock->ml.cookie != ml->cookie) - lock =NULL ; -else +list_for_each (iter, tmpq) { + lock =list_entry (iter, + struct dlm_lock, list); +if (lock->ml.cookie == ml->cookie)break ; + lock =NULL ; }if (lock)break ;
Greg Kroah-Hartman
maintainerPATCH 82/86 ocfs2: dlm: fix recovery hung
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit ded2cf71419b9353060e633b59e446c42a6a2a09 upstream.
There is a race window in dlm_do_recovery() between dlm_remaster_locks() and dlm_reset_recovery() when the recovery master nearly finish the recovery process for a dead node. After the master sends FINALIZE_RECO message in dlm_remaster_locks(), another node may become the recovery master for another dead node, and then send the BEGIN_RECO message to all the nodes included the old master, in the handler of this message dlm_begin_reco_handler() of old master, dlm->reco.dead_node and dlm->reco.new_master will be set to the second dead node and the new master, then in dlm_reset_recovery(), these two variables will be reset to default value. This will cause new recovery master can not finish the recovery process and hung, at last the whole cluster will hung for recovery.
old recovery master: new recovery master:dlm_remaster_locks()
become recovery master for another dead node. dlm_send_begin_reco_message()dlm_begin_reco_handler()
{
if (dlm->reco.state & DLM_RECO_STATE_FINALIZE) {
return -EAGAIN;
}
dlm_set_reco_master(dlm, br->node_idx);
dlm_set_reco_dead_node(dlm, br->dead_node);
}dlm_reset_recovery()
{
dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM); dlm_set_reco_master(dlm, O2NM_INVALID_NODE_NUM);
}
will hang in dlm_remaster_locks() for request dlm locks info
Before send FINALIZE_RECO message, recovery master should set DLM_RECO_STATE_FINALIZE for itself and clear it after the recovery done, this can break the race windows as the BEGIN_RECO messages will not be handled before DLM_RECO_STATE_FINALIZE flag is cleared.
A similar race may happen between new recovery master and normal node which is in dlm_finalize_reco_handler(), also fix it.
--- fs/ocfs2/dlm/dlmrecovery.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +13 -2
@@ -540,7 +540,10 @@ master_here:/* success! see if any other nodes need recovery */ mlog (0 ,"DONE mastering recovery of %s:%u here(this=%u)!\n" , dlm->name, dlm->reco.dead_node, dlm->node_num); -dlm_reset_recovery (dlm); +spin_lock (&dlm->spinlock); +__dlm_reset_recovery (dlm); + dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE ; +spin_unlock (&dlm->spinlock); }dlm_end_recovery (dlm);
@@ -698,6 +701,14 @@ static int dlm_remaster_locks(struct dlmif (all_nodes_done) {int ret; +/* Set this flag on recovery master to avoid +* a new recovery for another dead node start +* before the recovery is not done. That may +* cause recovery hung.*/ +spin_lock (&dlm->spinlock); + dlm->reco.state |=DLM_RECO_STATE_FINALIZE ; +spin_unlock (&dlm->spinlock); +/* all nodes are now in DLM_RECO_NODE_DATA_DONE state * just send a finalize message to everyone and * clean up */
@@ -2869,8 +2880,8 @@ int dlm_finalize_reco_handler(struct o2nBUG (); } dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE ; +__dlm_reset_recovery (dlm);spin_unlock (&dlm->spinlock); -dlm_reset_recovery (dlm);dlm_kick_recovery_thread (dlm);break ;default :
Greg Kroah-Hartman
maintainerPATCH 83/86 ocfs2: do not put bh when buffer_uptodate failed
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: alex chen <[email protected]>
commit f7cf4f5bfe073ad792ab49c04f247626b3e38db6 upstream.
Do not put bh when buffer_uptodate failed in ocfs2_write_block and ocfs2_write_super_or_backup, because it will put bh in b_end_io. Otherwise it will hit a warning "VFS: brelse: Trying to free free buffer".
--- fs/ocfs2/buffer_head_io.c | 2 -- 1 file changed, 2 deletions(-)
fs/ocfs2/buffer_head_io.c +0 -2
@@ -90,7 +90,6 @@ int ocfs2_write_block(struct ocfs2_super* information for this bh as it's not marked locally * uptodate. */ ret = -EIO ; -put_bh (bh);mlog_errno (ret); }
@@ -420,7 +419,6 @@ int ocfs2_write_super_or_backup(struct oif (!buffer_uptodate (bh)) { ret = -EIO ; -put_bh (bh);mlog_errno (ret); }
Greg Kroah-Hartman
maintainerPATCH 84/86 ext4: fix jbd2 warning under heavy xattr load
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit ec4cb1aa2b7bae18dd8164f2e9c7c51abcf61280 upstream.
When heavily exercising xattr code the assertion that jbd2_journal_dirty_metadata() shouldn't return error was triggered:
WARNING: at /srv/autobuild-ceph/gitbuilder.git/build/fs/jbd2/transaction.c:1237 jbd2_journal_dirty_metadata+0x1ba/0x260() CPU: 0 PID: 8877 Comm: ceph-osd Tainted: G W 3.10.0-ceph-00049-g68d04c9 #1 Hardware name: Dell Inc. PowerEdge R410/01V648, BIOS 1.6.3 02/07/2011 ffffffff81a1d3c8 ffff880214469928 ffffffff816311b0 ffff880214469968 ffffffff8103fae0 ffff880214469958 ffff880170a9dc30 ffff8802240fbe80 0000000000000000 ffff88020b366000 ffff8802256e7510 ffff880214469978 Call Trace: [<ffffffff816311b0>] dump_stack+0x19/0x1b [<ffffffff8103fae0>] warn_slowpath_common+0x70/0xa0 [<ffffffff8103fb2a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81267c2a>] jbd2_journal_dirty_metadata+0x1ba/0x260 [<ffffffff81245093>] __ext4_handle_dirty_metadata+0xa3/0x140 [<ffffffff812561f3>] ext4_xattr_release_block+0x103/0x1f0 [<ffffffff81256680>] ext4_xattr_block_set+0x1e0/0x910 [<ffffffff8125795b>] ext4_xattr_set_handle+0x38b/0x4a0 [<ffffffff810a319d>] ? trace_hardirqs_on+0xd/0x10 [<ffffffff81257b32>] ext4_xattr_set+0xc2/0x140 [<ffffffff81258547>] ext4_xattr_user_set+0x47/0x50 [<ffffffff811935ce>] generic_setxattr+0x6e/0x90 [<ffffffff81193ecb>] __vfs_setxattr_noperm+0x7b/0x1c0 [<ffffffff811940d4>] vfs_setxattr+0xc4/0xd0 [<ffffffff8119421e>] setxattr+0x13e/0x1e0 [<ffffffff811719c7>] ? __sb_start_write+0xe7/0x1b0 [<ffffffff8118f2e8>] ? mnt_want_write_file+0x28/0x60 [<ffffffff8118c65c>] ? fget_light+0x3c/0x130 [<ffffffff8118f2e8>] ? mnt_want_write_file+0x28/0x60 [<ffffffff8118f1f8>] ? __mnt_want_write+0x58/0x70 [<ffffffff811946be>] SyS_fsetxattr+0xbe/0x100 [<ffffffff816407c2>] system_call_fastpath+0x16/0x1b
The reason for the warning is that buffer_head passed into jbd2_journal_dirty_metadata() didn't have journal_head attached. This is caused by the following race of two ext4_xattr_release_block() calls:
CPU1 CPU2ext4_xattr_release_block() ext4_xattr_release_block()lock_buffer(bh);
/* False */
if (BHDR(bh)->h_refcount == cpu_to_le32(1))
} else {
le32_add_cpu(&BHDR(bh)->h_refcount, -1);
unlock_buffer(bh);
lock_buffer(bh);
/* True */
if (BHDR(bh)->h_refcount == cpu_to_le32(1))
get_bh(bh);
ext4_free_blocks()
...
jbd2_journal_forget()
jbd2_journal_unfile_buffer()
-> JH is gone error = ext4_handle_dirty_xattr_block(handle, inode, bh); -> triggers the warning
We fix the problem by moving ext4_handle_dirty_xattr_block() under the buffer lock. Sadly this cannot be done in nojournal mode as that function can call sync_dirty_buffer() which would deadlock. Luckily in nojournal mode the race is harmless (we only dirty already freed buffer) and thus for nojournal mode we leave the dirtying outside of the buffer lock.
--- fs/ext4/xattr.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
fs/ext4/xattr.c +19 -4
@@ -517,8 +517,8 @@ static void ext4_xattr_update_super_bloc }/* -* Release the xattr block BH: If the reference count is > 1, decrement -* it; otherwise free the block. +* Release the xattr block BH: If the reference count is > 1, decrement it; +* otherwise free the block. */ static void ext4_xattr_release_block(handle_t *handle, struct inode *inode,
@@ -538,16 +538,31 @@ ext4_xattr_release_block(handle_t *handlif (ce)mb_cache_entry_free (ce);get_bh (bh); +unlock_buffer (bh);ext4_free_blocks (handle, inode, bh,0 ,1 ,EXT4_FREE_BLOCKS_METADATA |EXT4_FREE_BLOCKS_FORGET ); -unlock_buffer (bh); }else {le32_add_cpu (&BHDR (bh)->h_refcount,-1 );if (ce)mb_cache_entry_release (ce); +/* +* Beware of this ugliness: Releasing of xattr block references +* from different inodes can race and so we have to protect +* from a race where someone else frees the block (and releases +* its journal_head) before we are done dirtying the buffer. In +* nojournal mode this race is harmless and we actually cannot +* call ext4_handle_dirty_xattr_block() with locked buffer as +* that function can call sync_dirty_buffer() so for that case +* we handle the dirtying after unlocking the buffer. +*/ +if (ext4_handle_valid (handle)) + error =ext4_handle_dirty_xattr_block (handle, inode, + bh);unlock_buffer (bh); - error =ext4_handle_dirty_xattr_block (handle, inode, bh); +if (!ext4_handle_valid (handle)) + error =ext4_handle_dirty_xattr_block (handle, inode, + bh);if (IS_SYNC (inode))ext4_handle_sync (handle);dquot_free_block (inode,EXT4_C2B (EXT4_SB (inode->i_sb),1 ));
Greg Kroah-Hartman
maintainerPATCH 85/86 ext4: use i_size_read in ext4_unaligned_aio()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 6e6358fc3c3c862bfe9a5bc029d3f8ce43dc9765 upstream.
We haven't taken i_mutex yet, so we need to use i_size_read().
--- fs/ext4/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/file.c +1 -1
@@ -82,7 +82,7 @@ ext4_unaligned_aio(struct inode *inode,size_t count =iov_length (iov, nr_segs);loff_t final_size = pos + count; -if (pos >= inode->i_size) +if (pos >=i_size_read (inode))return 0 ;if ((pos & blockmask) || (final_size & blockmask))
Greg Kroah-Hartman
maintainerPATCH 86/86 USB: pl2303: add ids for Hewlett-Packard HP POS pole displays
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Sanders <[email protected]>
commit b16c02fbfb963fa2941b7517ebf1f8a21946775e upstream.
Add device ids to pl2303 for the Hewlett-Packard HP POS pole displays:
LD960: 03f0:0B39
LCM220: 03f0:3139
LCM960: 03f0:3239
[ Johan: fix indentation and sort PIDs numerically ]
--- drivers/usb/serial/pl2303.c | 3 +++ drivers/usb/serial/pl2303.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/usb/serial/pl2303.c +3 -0
@@ -82,6 +82,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LCM960_PRODUCT_ID) }, { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
drivers/usb/serial/pl2303.h +4 -1
@@ -121,8 +121,11 @@#define SUPERIAL_VENDOR_ID 0x5372#define SUPERIAL_PRODUCT_ID 0x2303 -/* Hewlett-Packard LD220-HP POS Pole Display */ +/* Hewlett-Packard POS Pole Displays */ #define HP_VENDOR_ID 0x03f0 +#define HP_LD960_PRODUCT_ID 0x0b39 +#define HP_LCM220_PRODUCT_ID 0x3139 +#define HP_LCM960_PRODUCT_ID 0x3239#define HP_LD220_PRODUCT_ID 0x3524/* Cressi Edy (diving computer) PC interface */
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
I am still seeing build failures, even with x86_64 (both allmodconfig and allyesconfig fail).
total: 127 pass: 113 skipped: 4 fail: 10
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'
Problem is due to 'usb: musb: avoid NULL pointer dereference'.
A brief glance into the code suggests that the patch will require an explicit back-port to 3.10.
Greg, I suspect you might not have USB_MUSB_HDRC enabled in your builds.
On the plus side, qemu builds and tests all passed ... but I guess that only shows the somewhat limited scope of those tests :-(.
Guenter
Greg Kroah-Hartman
maintainerQuoted 12 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
I am still seeing build failures, even with
x86_64(both allmodconfig and allyesconfig fail).
Quoted 8 lines
total: 127 pass: 113 skipped: 4 fail: 10
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'Problem is due to 'usb: musb: avoid NULL pointer dereference'.
A brief glance into the code suggests that the patch will require an explicit back-port to 3.10.
Thanks, I've now dropped that one.
Quoted 1 line
Greg, I suspect you might not have
USB_MUSB_HDRCenabled in your builds.
I don't :(
I'm running with a distro kernel config in the builds to let me build the kernel, which doesn't pick up a lot of the embedded options, like musb.
thanks,
greg k-h
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
I am still seeing build failures, even with
x86_64(both allmodconfig and allyesconfig fail).total: 127 pass: 113 skipped: 4 fail: 10
Quoted 9 lines
Quoted 6 lines
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'Problem is due to 'usb: musb: avoid NULL pointer dereference'.
A brief glance into the code suggests that the patch will require an explicit back-port to 3.10.Thanks, I've now dropped that one.
Looks like you added it back in. The build with the dropped patch was fine. I'll send another note after the rebuild with the patch added back in is complete.
Guenter
Greg Kroah-Hartman
maintainerQuoted 23 lines · Guenter Roeck
Quoted 22 lines · Greg Kroah-Hartman
Quoted 20 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
I am still seeing build failures, even with
x86_64(both allmodconfig and allyesconfig fail).total: 127 pass: 113 skipped: 4 fail: 10
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'Problem is due to 'usb: musb: avoid NULL pointer dereference'.
A brief glance into the code suggests that the patch will require an explicit back-port to 3.10.
Quoted 5 lines
Quoted 2 lines
Thanks, I've now dropped that one.
Looks like you added it back in. The build with the dropped patch was fine. I'll send another note after the rebuild with the patch added back in is complete.
I added back the "fixed" one, hopefully it really is :)
greg k-h
Quoted 24 lines · Greg Kroah-Hartman
Quoted 23 lines · Guenter Roeck
Quoted 22 lines · Greg Kroah-Hartman
Quoted 20 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
I am still seeing build failures, even with
x86_64(both allmodconfig and allyesconfig fail).total: 127 pass: 113 skipped: 4 fail: 10
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'Problem is due to 'usb: musb: avoid NULL pointer dereference'.
A brief glance into the code suggests that the patch will require an explicit back-port to 3.10.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Thanks, I've now dropped that one.
Looks like you added it back in. The build with the dropped patch was fine. I'll send another note after the rebuild with the patch added back in is complete.
I added back the "fixed" one, hopefully it really is :)
Yes. Final build results:
total: 127 pass: 122 skipped: 4 fail: 1
[ unicore32:defconfig is the failing build ]
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
Hi Greg,
did you get my reply with the build failure ?
Here it is again, in case it got lost:
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'
This is seen in 9 of my builds, including x86_64:allmodconfig and x86_64:allyesconfig.
Guenter
Greg Kroah-Hartman
maintainerQuoted 9 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
Hi Greg,
did you get my reply with the build failure ?
Here it is again, in case it got lost:
drivers/usb/musb/musb_core.c: In function 'musb_stage0_irq':drivers/usb/musb/musb_core.c:673:26: error: 'struct musb' has no member named 'hcd'
Yes, now got it, the patch is removed so the builds should now work.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.39 release. There are 86 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue May 6 15:41:13 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.39-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test systems. No dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658