4.1.4-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 4.1.4-stable review
This is the start of the stable review cycle for the 4.1.4 release. There are 267 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 Sun Aug 2 19:39:27 UTC 2015. 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/v4.x/stable-review/patch-4.1.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.1.4-rc1
Linus Torvalds <[email protected]>
Fix firmware loader uevent buffer NULL pointer dereference
Joe Perches <[email protected]>
hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead
Sanidhya Kashyap <[email protected]>
hpfs: kstrdup() out of memory handling
Szabolcs Nagy <[email protected]>
ARM: 8397/1: fix vdsomunge not to depend on glibc specific error.h
Stephen Boyd <[email protected]>
ARM: 8393/1: smp: Fix suspicious RCU usage with ipi tracepoints
Srikar Dronamraju <[email protected]>
perf bench numa: Fix to show proper convergence stats
Christoffer Dall <[email protected]>
arm64: Don't report clear pmds and puds as huge
Xi Wang <[email protected]>
arm64: bpf: fix endianness conversion bugs
Xi Wang <[email protected]>
arm64: bpf: fix out-of-bounds read in bpf2a64_offset()
Stephen Boyd <[email protected]>
ARM64: smp: Fix suspicious RCU usage with ipi tracepoints
Al Viro <[email protected]>
p9_client_write(): avoid double p9_free_req()
Aaro Koskinen <[email protected]>
EDAC, octeon: Fix broken build due to model helper renames
Russell King <[email protected]>
ARM: dove: fix legacy dove IRQ numbers
Chris Wilson <[email protected]>
agp/intel: Fix typo in needs_ilk_vtd_wa()
Ilya Dryomov <[email protected]>
rbd: use GFP_NOIO in rbd_obj_request_create()
Al Viro <[email protected]>
9p: don't leave a half-initialized inode sitting around
Al Viro <[email protected]>
9p: forgetting to cancel request on interrupted zero-copy RPC
Trond Myklebust <[email protected]>
SUNRPC: Fix a memory leak in the backchannel code
Jeff Layton <[email protected]>
nfs: always update creds in mirror, even when we have an already connected ds
Jeff Layton <[email protected]>
nfs: fix potential credential leak in ff_layout_update_mirror_cred
Trond Myklebust <[email protected]>
NFS: Ensure we set NFS_CONTEXT_RESEND_WRITES when requeuing writes
Jeff Layton <[email protected]>
nfs: increase size of EXCHANGE_ID name string buffer
Olga Kornievskaia <[email protected]>
fixing infinite OPEN loop in 4.0 stateid recovery
Chuck Lever <[email protected]>
NFS: Fix size of NFSACL SETACL operations
Trond Myklebust <[email protected]>
pNFS/flexfiles: Fix the reset of struct pgio_header when resending
Trond Myklebust <[email protected]>
pNFS: Fix a memory leak when attempted pnfs fails
Hai Li <[email protected]>
clk: qcom: Use parent rate when set rate to pixel RCG clock
Krzysztof Kozlowski <[email protected]>
clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference
Stefan Wahren <[email protected]>
clk: Fix JSON output in debugfs
Geert Uytterhoeven <[email protected]>
gpiolib: Add missing dummies for the unified device properties interface
Uwe Kleine-König <[email protected]>
watchdog: omap: assert the counter being stopped before reprogramming
Konstantin Khlebnikov <[email protected]>
of: return NUMA_NO_NODE from fallback of_node_to_nid()
Miklos Szeredi <[email protected]>
ovl: lookup whiteouts outside iterate_dir()
Pali Rohár <[email protected]>
dell-laptop: Fix allocating & freeing SMI buffer page
Jingoo Han <[email protected]>
of/address: use atomic allocation in pci_register_io_range()
Arnd Bergmann <[email protected]>
ideapad: fix software rfkill setting
Dmitry Tunin <[email protected]>
ideapad_laptop: Lenovo G50-30 fix rfkill reports wireless blocked
Damian Eppel <[email protected]>
clocksource: exynos_mct: Avoid blocking calls in the cpu hotplug notifier
Alexander Duyck <[email protected]>
e1000e: Cleanup handling of VLAN_HLEN as a part of max frame size
Michal Kazior <[email protected]>
mac80211: prevent possible crypto tx tailroom corruption
Michal Kazior <[email protected]>
cfg80211: ignore netif running state when changing iftype
Eliad Peller <[email protected]>
iwlwifi: mvm: fix ROC reference accounting
Chun-Yeow Yeoh <[email protected]>
mac80211: fix the beacon csa counter for mesh and ibss
Vasily Averin <[email protected]>
security_syslog() should be called once only
Chris Metcalf <[email protected]>
__bitmap_parselist: fix bug in empty string handling
Daniel Borkmann <[email protected]>
compiler-intel: fix wrong compiler barrier() macro
Jean Delvare <[email protected]>
firmware: dmi_scan: Only honor end-of-table for 64-bit tables
Takashi Iwai <[email protected]>
PM / sleep: Increase default DPM watchdog timeout to 60
Naoya Horiguchi <[email protected]>
mm/hugetlb: introduce minimum hugepage order
Arnd Bergmann <[email protected]>
tty: remove platform_sysrq_reset_seq
Colin Ian King <[email protected]>
RDMA/ocrdma: fix double free on pd
Geert Uytterhoeven <[email protected]>
PM / clk: Fix clock error check in __pm_clk_add()
Ulf Hansson <[email protected]>
mmc: sdhci: Restore behavior while creating OCR mask
Ding Wang <[email protected]>
mmc: card: Fixup request missing in mmc_blk_issue_rw_rq
Arnd Bergmann <[email protected]>
serial: samsung: only use earlycon for console
Jiang Liu <[email protected]>
ACPI / PCI: Fix regressions caused by resource_size_t overflow with 32-bit kernel
Lv Zheng <[email protected]>
ACPICA: Tables: Enable default 64-bit FADT addresses favor
Lv Zheng <[email protected]>
ACPICA: Tables: Fix an issue that FACS initialization is performed twice
Lv Zheng <[email protected]>
ACPICA: Tables: Enable both 32-bit and 64-bit FACS
Rafael J. Wysocki <[email protected]>
ACPI / LPSS: Fix up acpi_lpss_create_device()
Rafael J. Wysocki <[email protected]>
ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage
Dan Carpenter <[email protected]>
ACPI / resources: free memory on error in add_region_before()
Ilya Dryomov <[email protected]>
crush: fix a bug in tree bucket decode
Miklos Szeredi <[email protected]>
fuse: initialize fc->release before calling it
Stephen Smalley <[email protected]>
selinux: fix mprotect PROT_EXEC regression caused by mm change
Paul Moore <[email protected]>
selinux: don't waste ebitmap space when importing NetLabel categories
Filipe Manana <[email protected]>
Btrfs: fix file corruption after cloning inline extents
Filipe Manana <[email protected]>
Btrfs: fix list transaction->pending_ordered corruption
Filipe Manana <[email protected]>
Btrfs: fix memory leak in the extent_same ioctl
Filipe Manana <[email protected]>
Btrfs: fix fsync data loss after append write
Filipe Manana <[email protected]>
Btrfs: fix race between caching kthread and returning inode to inode cache
Filipe Manana <[email protected]>
Btrfs: use kmem_cache_free when freeing entry in inode cache
Firo Yang <[email protected]>
md: fix a build warning
Omar Sandoval <[email protected]>
Btrfs: don't invalidate root dentry when subvolume deletion fails
Stefan Wahren <[email protected]>
ARM: dts: mx23: fix iio-hwmon support
Constantine Shulyupin <[email protected]>
hwmon: (nct7802) fix visibility of temp3
Stevens, Nick <[email protected]>
hwmon: (mcp3021) Fix broken output scaling
Goldwyn Rodrigues <[email protected]>
md: Skip cluster setup for dm-raid
NeilBrown <[email protected]>
md: unlock mddev_lock on an error path.
NeilBrown <[email protected]>
md: clear mddev->private when it has been freed.
Lior Amsalem <[email protected]>
dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup
Steven Rostedt (Red Hat) <[email protected]>
tracing: Fix sample output of dynamic arrays
Steven Rostedt (Red Hat) <[email protected]>
tracing: Have branch tracer use recursive field of task struct
Steven Rostedt (Red Hat) <[email protected]>
tracing: Fix typo from "static inlin" to "static inline"
Steven Rostedt (Red Hat) <[email protected]>
tracing/filter: Do not allow infix to exceed end of string
Steven Rostedt (Red Hat) <[email protected]>
tracing/filter: Do not WARN on operand count going below zero
Mimi Zohar <[email protected]>
ima: update builtin policies
Mimi Zohar <[email protected]>
ima: extend "mask" policy matching support
Mimi Zohar <[email protected]>
ima: add support for new "euid" policy condition
Mimi Zohar <[email protected]>
ima: fix ima_show_template_data_ascii()
Mimi Zohar <[email protected]>
evm: labeling pseudo filesystems exception
Mimi Zohar <[email protected]>
ima: do not measure or appraise the NSFS filesystem
Dan Carpenter <[email protected]>
ima: cleanup ima_init_policy() a little
Roberto Sassu <[email protected]>
ima: skip measurement of cgroupfs files and update documentation
Colin Ian King <[email protected]>
KEYS: ensure we free the assoc array edit if edit is valid
Mimi Zohar <[email protected]>
KEYS: fix "ca_keys=" partial key matching
Jarkko Sakkinen <[email protected]>
tpm, tpm_crb: fail when TPM2 ACPI table contents look corrupted
Jason Gunthorpe <[email protected]>
tpm: Fix initialization of the cdev
Hon Ching \\(Vicky\\) Lo <[email protected]>
vTPM: set virtual device before passing to ibmvtpm_reset_crq
Jarkko Sakkinen <[email protected]>
tpm, tpm_crb: fix le64_to_cpu conversions in crb_acpi_add()
David Fries <[email protected]>
w1_therm reference count family data
Brian Foster <[email protected]>
xfs: don't truncate attribute extents if no extents exist
Eric Sandeen <[email protected]>
xfs: fix remote symlinks on V5/CRC filesystems
Martin K. Petersen <[email protected]>
libata: Fix regression when the NCQ Send and Receive log page is absent
Daniel Vetter <[email protected]>
drm: Stop resetting connector state to unknown
Tvrtko Ursulin <[email protected]>
drm: Provide compat ioctl for addfb2.1
Zhao Junwang <[email protected]>
drm: add a check for x/y in drm_mode_setcrtc
Daniel Kurtz <[email protected]>
drm/rockchip: use drm_gem_mmap helpers
Alex Deucher <[email protected]>
drm/radeon/ci: silence a harmless PCC warning
Christian König <[email protected]>
drm/radeon: fix user ptr race condition
Alex Deucher <[email protected]>
drm/radeon: add a dpm quirk for Sapphire Radeon R9 270X 2GB GDDR5
Michel Dänzer <[email protected]>
drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL
Grigori Goronzy <[email protected]>
drm/radeon: unpin cursor BOs on suspend and pin them again on resume (v2)
Michel Dänzer <[email protected]>
drm/radeon: Clean up reference counting and pinning of the cursor BOs
Mario Kleiner <[email protected]>
drm/radeon: Handle irqs only based on irq ring, not irq status regs.
Grigori Goronzy <[email protected]>
drm/radeon: fix HDP flushing
Alex Deucher <[email protected]>
drm/radeon: only check the sink type on DP connectors
Alex Deucher <[email protected]>
Revert "drm/radeon: dont switch vt on suspend"
Jérôme Glisse <[email protected]>
drm/radeon: SDMA fix hibernation (CI GPU family).
Jérôme Glisse <[email protected]>
drm/radeon: compute ring fix hibernation (CI GPU family) v2.
Chris Wilson <[email protected]>
drm/i915: Use two 32bit reads for select 64bit REG_READ ioctls
Daniel Vetter <[email protected]>
Revert "drm/i915: Declare the swizzling unknown for L-shaped configurations"
Tvrtko Ursulin <[email protected]>
drm/i915: Forward all core DRM ioctls to core compat handling
Tomas Elf <[email protected]>
drm/i915: Snapshot seqno of most recently submitted request.
Chris Wilson <[email protected]>
drm/i915: Declare the swizzling unknown for L-shaped configurations
Jani Nikula <[email protected]>
drm/i915: fix backlight after resume on 855gm
Rodrigo Vivi <[email protected]>
drm/i915: Fix IPS related flicker
Michel Thierry <[email protected]>
drm/i915/ppgtt: Break loop in gen8_ppgtt_clear_range failure path
Alex Deucher <[email protected]>
drm/radeon: clean up radeon_audio_enable
Alex Deucher <[email protected]>
drm/radeon: take the mode_config mutex when dealing with hpds (v2)
Andrey Ryabinin <[email protected]>
drm/atomic: fix out of bounds read in for_each_*_in_state helpers
Geert Uytterhoeven <[email protected]>
drm/bridge: ptn3460: Include linux/gpio/consumer.h
Frediano Ziglio <[email protected]>
drm/qxl: Do not leak memory if qxl_release_list_add fails
Frediano Ziglio <[email protected]>
drm/qxl: Do not cause spice-server to clean our objects
Thierry Reding <[email protected]>
drm/tegra: dpaux: Fix transfers larger than 4 bytes
Daniel Vetter <[email protected]>
drm/dp/mst: make sure mst_primary mstb is valid in work function
Dave Airlie <[email protected]>
drm/dp/mst: take lock around looking up the branch device on hpd irq
Dave Airlie <[email protected]>
drm/dp/mst: close deadlock in connector destruction.
Daniel Vetter <[email protected]>
drm/vgem: Set unique to "vgem"
Pawel Moll <[email protected]>
bus: arm-ccn: Fix node->XP config conversion
Boris Brezillon <[email protected]>
ARM: at91/dt: update udc compatible strings
Nicolas Ferre <[email protected]>
ARM: at91/dt: trivial: fix USB udc compatible string
Nicolas Ferre <[email protected]>
tty/serial: at91: RS485 mode: 0 is valid for delay_rts_after_send
[email protected] <[email protected]>
ARM: at91/dt: sama5d4: fix dma conf for aes, sha and tdes nodes
Ludovic Desroches <[email protected]>
ARM: at91/dt: sama5d4ek: mci0 uses slot 0
Martin K. Petersen <[email protected]>
block: Do a full clone when splitting discard bios
Ming Lei <[email protected]>
block: loop: avoiding too many pending per work I/O
Ming Lei <[email protected]>
block: loop: convert to per-device workqueue
Tomas Winkler <[email protected]>
mmc: block: Add missing mmc_blk_put() in power_ro_lock_show()
Joe Thornber <[email protected]>
dm btree: silence lockdep lock inversion in dm_btree_del()
Joe Thornber <[email protected]>
dm thin: allocate the cell_sort_array dynamically
Dennis Yang <[email protected]>
dm btree remove: fix bug in redistribute3
Joe Thornber <[email protected]>
dm space map metadata: fix occasional leak of a metadata block on resize
Mikulas Patocka <[email protected]>
dm stats: fix divide by zero if 'number_of_areas' arg is zero
Joe Thornber <[email protected]>
dm cache: fix race when issuing a POLICY_REPLACE operation
AMAN DEEP <[email protected]>
usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function
Lu Baolu <[email protected]>
usb: core: lpm: set lpm_capable for root hub device
Alan Stern <[email protected]>
USB: OHCI: Fix race between ED unlink and URB submission
Johannes Thumshirn <[email protected]>
USB: serial: Destroy serial_minors IDR on module exit
Claudio Cappelli <[email protected]>
USB: option: add 2020:4000 ID
Peter Sanford <[email protected]>
USB: cp210x: add ID for Aruba Networks controllers
Felipe Balbi <[email protected]>
usb: musb: host: rely on port_mode to call musb_start()
Michal Nazarewicz <[email protected]>
usb: f_mass_storage: limit number of reported LUNs
Alexey Khoroshilov <[email protected]>
usb: gadget: mv_udc_core: fix phy_regs I/O memory leak
Rui Miguel Silva <[email protected]>
usb: gadget: f_fs: do not set cancel function on synchronous {read,write}Kishon Vijay Abraham I <[email protected]>
usb: gadget: composite: Fix NULL pointer dereference
Thomas Hebb <[email protected]>
phy: berlin-usb: fix divider for BG2CD
Stefan Wahren <[email protected]>
usb: phy: mxs: suspend to RAM causes NULL pointer dereference
NeilBrown <[email protected]>
phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Dan Carpenter <[email protected]>
USB: devio: fix a condition in async_completed()
Robert Schlabbach <[email protected]>
usb: core: Fix USB 3.0 devices lost in NOTATTACHED state after a hub port reset
John Youn <[email protected]>
usb: dwc3: Reset the transfer resource index on SET_INTERFACE
Felipe Balbi <[email protected]>
usb: dwc3: gadget: don't clear EP_BUSY too early
Subbaraya Sundeep Bhatta <[email protected]>
usb: dwc3: gadget: return error if command sent to DEPCMD register fails
Subbaraya Sundeep Bhatta <[email protected]>
usb: dwc3: gadget: return error if command sent to DGCMD register fails
Arne Fitzenreiter <[email protected]>
libata: force disable trim for SuperSSpeed S238
Martin K. Petersen <[email protected]>
libata: Do not blacklist M510DC
David Milburn <[email protected]>
libata: add ATA_HORKAGE_MAX_SEC_1024 to revert back to previous max_sectors limit
Arne Fitzenreiter <[email protected]>
libata: add ATA_HORKAGE_NOTRIM
Martin K. Petersen <[email protected]>
libata: Expose TRIM capability in sysfs
Martin K. Petersen <[email protected]>
libata: Fall back to unqueued READ LOG EXT if the DMA variant fails
Mikulas Patocka <[email protected]>
libata: increase the timeout when setting transfer mode
Aleksei Mamlin <[email protected]>
libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER
Martin K. Petersen <[email protected]>
libata: Do not blacklist Micron M500DC
Peter Ujfalusi <[email protected]>
ASoC: tas2552: Fix kernel crash caused by wrong kcontrol entry
Peter Ujfalusi <[email protected]>
ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card
Zidan Wang <[email protected]>
ASoC: wm8960: the enum of "DAC Polarity" should be wm8960_enum[1]
Axel Lin <[email protected]>
ASoC: wm8903: Fix define for WM8903_VMID_RES_250K
Axel Lin <[email protected]>
ASoC: wm8955: Fix setting wrong register for WM8955_K_8_0_MASK bits
Axel Lin <[email protected]>
ASoC: wm8737: Fixup setting VMID Impedance control register
Arnd Bergmann <[email protected]>
ASoC: omap: fix up SND_OMAP_SOC_OMAP_ABE_TWL6040 dependency, again
Dan Carpenter <[email protected]>
ASoC: imx-wm8962: Add a missing error check
Arnd Bergmann <[email protected]>
ASoC: qcom: remove incorrect dependencies
Axel Lin <[email protected]>
ASoC: max98925: Fix mask for setting DAI invert mode
Nicolas Boichat <[email protected]>
ASoC: rt5645: Init jack_detect_work before registering irq
Richard Fitzgerald <[email protected]>
ASoC: arizona: Fix noise generator gain TLV
Mauro Carvalho Chehab <[email protected]>
cx24116: fix a buffer overflow when checking userspace params
Mauro Carvalho Chehab <[email protected]>
s5h1420: fix a buffer overflow when checking userspace params
Hans Verkuil <[email protected]>
saa7164: fix querycap warning
Mauro Carvalho Chehab <[email protected]>
af9013: Don't accept invalid bandwidth
Mauro Carvalho Chehab <[email protected]>
cx24117: fix a buffer overflow when checking userspace params
Hans Verkuil <[email protected]>
cx18: add missing caps for the PCM video device
David Härdeman <[email protected]>
rc-core: fix dib0700 scancode generation for RC5
Thomas Reitmayr <[email protected]>
media: Fix regression in some more dib0700 based devices
Laurent Pinchart <[email protected]>
vb2: Don't WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers
Jan Leupold <[email protected]>
iio: adc: at91_adc: allow to use full range of startup time
Heiko Stuebner <[email protected]>
iio: adc: rockchip_saradc: add missing MODULE_* data
Daniel Baluta <[email protected]>
iio: proximity: sx9500: Fix proximity value
Daniel Baluta <[email protected]>
iio: ABI: Clarify proximity output value
Fabio Estevam <[email protected]>
iio: twl4030-madc: Pass the IRQF_ONESHOT flag
Peter Meerwald <[email protected]>
iio: tmp006: Check channel info on write
Adriana Reus <[email protected]>
iio: inv-mpu: Specify the expected format/precision for write channels
JM Friedt <[email protected]>
iio: DAC: ad5624r_spi: fix bit shift of output data value
Peter Meerwald <[email protected]>
iio: light: tcs3414: Fix bug preventing to set integration time
Hartmut Knaack <[email protected]>
iio:accel:bmc150-accel: fix counting direction
Hartmut Knaack <[email protected]>
iio:adc:cc10001_adc: fix Kconfig dependency
Hartmut Knaack <[email protected]>
iio:light:cm3323: clear bitmask before set
Alexander Sverdlin <[email protected]>
i2c: use parent adapter quirks in mux
Alexander Sverdlin <[email protected]>
i2c: mux: pca954x: Use __i2c_transfer because of quirks
Alexander Sverdlin <[email protected]>
i2c: mux: Use __i2c_transfer() instead of calling parent's master_xfer()
Cyrille Pitchen <[email protected]>
i2c: at91: fix a race condition when using the DMA controller
Stefan Agner <[email protected]>
rtc: snvs: fix wakealarm by call enable_irq_wake earlier
Christophe Ricard <[email protected]>
NFC: st21nfcb: remove st21nfcb_nci_i2c_disable
Christophe Ricard <[email protected]>
NFC: st21nfcb: Do not remove header once the payload is sent
Firo Yang <[email protected]>
NFC: st21nfcb: Remove inappropriate kfree on a devm_kzalloc pointer
Joseph Qi <[email protected]>
jbd2: fix ocfs2 corrupt when updating journal superblock fails
Dmitry Monakhov <[email protected]>
jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
Michal Hocko <[email protected]>
ext4: replace open coded nofail allocation in ext4_free_blocks()
Eryu Guan <[email protected]>
ext4: correctly migrate a file with a hole at the beginning
Eryu Guan <[email protected]>
ext4: be more strict when migrating to non-extent based file
Lukas Czerner <[email protected]>
ext4: fix reservation release on invalidatepage for delalloc fs
Nikolay Borisov <[email protected]>
ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp
Nikolay Borisov <[email protected]>
bufferhead: Add _gfp version for sb_getblk()
Theodore Ts'o <[email protected]>
ext4: fix fencepost error in lazytime optimization
Theodore Ts'o <[email protected]>
ext4: set lazytime on remount if MS_LAZYTIME is set by mount
Darrick J. Wong <[email protected]>
ext4: don't retry file block mapping on bigalloc fs with non-extent file
Theodore Ts'o <[email protected]>
ext4: call sync_blockdev() before invalidate_bdev() in put_super()
Theodore Ts'o <[email protected]>
ext4: fix race between truncate and __ext4_journalled_writepage()
Srinivas Pandruvada <[email protected]>
hid-sensor: Fix suspend/resume delay
Ian Abbott <[email protected]>
staging: comedi: cb_pcimdas: fix handlers for DI and DO subdevices
Haggai Eran <[email protected]>
staging: rtl8712: prevent buffer overrun in recvbuf2recvframe
Malcolm Priestley <[email protected]>
staging: vt6655: device_rx_srv check sk_buff is NULL
Malcolm Priestley <[email protected]>
staging: vt6655: check ieee80211_bss_conf bssid not NULL
Malcolm Priestley <[email protected]>
staging: vt6656: check ieee80211_bss_conf bssid not NULL
Lennert Buytenhek <[email protected]>
ieee802154: Fix sockaddr_ieee802154 implicit padding information leak.
Vincent Fann <[email protected]>
rtlwifi: Remove the clear interrupt routine from all drivers
Dan Carpenter <[email protected]>
ath9k_htc: memory corruption calling set_bit()
Felix Fietkau <[email protected]>
ath9k: fix DMA stop sequence for AR9003+
Chris Mason <[email protected]>
Bluetooth: btbcm: allow btbcm_read_verbose_config to fail on Apple
Aleksei Volkov <[email protected]>
Bluetooth: btusb: Correct typo in Roper Class 1 Bluetooth Dongle
Marcel Holtmann <[email protected]>
Bluetooth: btusb: Fix secure send command length alignment on Intel 8260
Marcel Holtmann <[email protected]>
Bluetooth: btusb: Fix memory leak in Intel setup routine
Marcel Holtmann <[email protected]>
Bluetooth: Fix race condition with user channel and setup stage
Greg Ungerer <[email protected]>
m68knommu: force setting of CONFIG_CLOCK_FREQ for ColdFire
Greg Ungerer <[email protected]>
m68knommu: make ColdFire SoC selection a choice
Andrew Morton <[email protected]>
openrisc: fix CONFIG_UID16 setting
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-xp: fix functions of MPP48
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-xp: remove non-existing VDD cpu_pd functions
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-xp: remove non-existing NAND pins
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-39x: fix incorrect total number of GPIOs
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-38x: fix incorrect total number of GPIOs
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-38x: fix PCIe functions
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-375: remove non-existing NAND re/we pins
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-375: remove incorrect space in pin description
Thomas Petazzoni <[email protected]>
pinctrl: mvebu: armada-370: fix spi0 pin description
Masahiro Yamada <[email protected]>
pinctrl: zynq: fix offset address for {SD0,SD1}_WP_CD_SEL
Masahiro Yamada <[email protected]>
pinctrl: zynq: fix DEFINE_ZYNQ_PINMUX_FUNCTION_MUX macro
-------------
Diffstat:
Documentation/ABI/testing/ima_policy | 26 +- Documentation/ABI/testing/sysfs-ata | 11 + Documentation/ABI/testing/sysfs-bus-iio | 6 +- .../pinctrl/marvell,armada-370-pinctrl.txt | 4 +- .../pinctrl/marvell,armada-375-pinctrl.txt | 4 +- .../pinctrl/marvell,armada-38x-pinctrl.txt | 38 +- .../bindings/pinctrl/marvell,armada-xp-pinctrl.txt | 32 +- .../devicetree/bindings/usb/atmel-usb.txt | 6 +- Documentation/kernel-parameters.txt | 10 +- Makefile | 4 +- arch/arm/boot/dts/at91-sama5d4ek.dts | 4 +- arch/arm/boot/dts/at91sam9g45.dtsi | 2 +- arch/arm/boot/dts/at91sam9x5.dtsi | 2 +- arch/arm/boot/dts/imx23.dtsi | 1 + arch/arm/boot/dts/sama5d3.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 22 +- arch/arm/kernel/smp.c | 4 +- arch/arm/mach-dove/include/mach/irqs.h | 118 +++---- arch/arm/mach-dove/irq.c | 8 +- arch/arm/vdso/vdsomunge.c | 56 +-- arch/arm64/kernel/smp.c | 4 +- arch/arm64/mm/hugetlbpage.c | 4 +- arch/arm64/net/bpf_jit.h | 4 + arch/arm64/net/bpf_jit_comp.c | 29 +- arch/m68k/Kconfig.cpu | 41 +-- arch/m68k/include/asm/coldfire.h | 2 +- arch/openrisc/Kconfig | 4 +- block/bio.c | 15 +- crypto/asymmetric_keys/asymmetric_keys.h | 3 + crypto/asymmetric_keys/asymmetric_type.c | 20 +- crypto/asymmetric_keys/x509_public_key.c | 23 +- drivers/acpi/acpi_lpss.c | 7 +- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/acpica/tbfadt.c | 21 +- drivers/acpi/acpica/tbutils.c | 34 +- drivers/acpi/acpica/tbxfload.c | 3 +- drivers/acpi/acpica/utxfinit.c | 10 +- drivers/acpi/osl.c | 12 +- drivers/acpi/resource.c | 184 +--------- drivers/ata/libata-core.c | 23 +- drivers/ata/libata-eh.c | 13 +- drivers/ata/libata-scsi.c | 3 +- drivers/ata/libata-transport.c | 24 ++ drivers/base/firmware_class.c | 16 +- drivers/base/power/clock_ops.c | 2 +- drivers/block/loop.c | 30 +- drivers/block/loop.h | 1 + drivers/block/rbd.c | 4 +- drivers/bluetooth/btbcm.c | 11 +- drivers/bluetooth/btusb.c | 38 +- drivers/bus/arm-ccn.c | 2 +- drivers/char/agp/intel-gtt.c | 2 +- drivers/char/tpm/tpm-chip.c | 3 +- drivers/char/tpm/tpm_crb.c | 12 +- drivers/char/tpm/tpm_ibmvtpm.c | 5 +- drivers/clk/clk.c | 5 +- drivers/clk/qcom/clk-rcg2.c | 9 +- drivers/clk/ti/clk-dra7-atl.c | 5 + drivers/clocksource/exynos_mct.c | 43 ++- drivers/dma/mv_xor.c | 72 ++-- drivers/dma/mv_xor.h | 1 + drivers/edac/octeon_edac-l2c.c | 2 +- drivers/edac/octeon_edac-lmc.c | 2 +- drivers/edac/octeon_edac-pc.c | 2 +- drivers/firmware/dmi_scan.c | 13 +- drivers/gpu/drm/bridge/ptn3460.c | 1 + drivers/gpu/drm/drm_crtc.c | 12 +- drivers/gpu/drm/drm_dp_mst_topology.c | 67 +++- drivers/gpu/drm/drm_ioc32.c | 60 ++++ drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +- drivers/gpu/drm/i915/i915_ioc32.c | 2 +- drivers/gpu/drm/i915/i915_irq.c | 13 +- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 13 + drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_panel.c | 8 + drivers/gpu/drm/i915/intel_ringbuffer.h | 7 + drivers/gpu/drm/i915/intel_uncore.c | 26 +- drivers/gpu/drm/qxl/qxl_cmd.c | 1 + drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/radeon/ci_dpm.c | 2 +- drivers/gpu/drm/radeon/cik.c | 370 +++++++++++-------- drivers/gpu/drm/radeon/cik_sdma.c | 11 + drivers/gpu/drm/radeon/evergreen.c | 392 ++++++++++++--------- drivers/gpu/drm/radeon/r600.c | 155 ++++---- drivers/gpu/drm/radeon/radeon_audio.c | 36 +- drivers/gpu/drm/radeon/radeon_audio.h | 2 - drivers/gpu/drm/radeon/radeon_cursor.c | 84 ++--- drivers/gpu/drm/radeon/radeon_device.c | 34 +- drivers/gpu/drm/radeon/radeon_fb.c | 1 - drivers/gpu/drm/radeon/radeon_gart.c | 12 +- drivers/gpu/drm/radeon/radeon_gem.c | 2 + drivers/gpu/drm/radeon/radeon_irq_kms.c | 2 + drivers/gpu/drm/radeon/radeon_mode.h | 1 - drivers/gpu/drm/radeon/radeon_object.c | 1 - drivers/gpu/drm/radeon/si.c | 336 ++++++++++-------- drivers/gpu/drm/radeon/si_dpm.c | 1 + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 67 ++-- drivers/gpu/drm/tegra/dpaux.c | 18 +- drivers/gpu/drm/vgem/vgem_drv.c | 2 + drivers/hwmon/mcp3021.c | 14 +- drivers/hwmon/nct7802.c | 2 +- drivers/i2c/busses/i2c-at91.c | 70 +++- drivers/i2c/i2c-mux.c | 3 +- drivers/i2c/muxes/i2c-mux-pca9541.c | 4 +- drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +- drivers/iio/accel/bmc150-accel.c | 2 +- drivers/iio/adc/Kconfig | 3 +- drivers/iio/adc/at91_adc.c | 8 +- drivers/iio/adc/rockchip_saradc.c | 4 + drivers/iio/adc/twl4030-madc.c | 3 +- .../iio/common/hid-sensors/hid-sensor-trigger.c | 11 +- drivers/iio/dac/ad5624r_spi.c | 4 +- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 + drivers/iio/light/cm3323.c | 2 +- drivers/iio/light/tcs3414.c | 2 +- drivers/iio/proximity/sx9500.c | 2 +- drivers/iio/temperature/tmp006.c | 3 + drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 - drivers/md/bitmap.c | 15 +- drivers/md/dm-cache-policy-cleaner.c | 3 +- drivers/md/dm-cache-policy-internal.h | 5 +- drivers/md/dm-cache-policy-mq.c | 41 ++- drivers/md/dm-cache-policy.h | 15 +- drivers/md/dm-cache-target.c | 58 +-- drivers/md/dm-stats.c | 2 + drivers/md/dm-thin.c | 13 +- drivers/md/md.c | 9 +- drivers/md/persistent-data/dm-btree-remove.c | 6 +- drivers/md/persistent-data/dm-btree.c | 2 +- drivers/md/persistent-data/dm-space-map-metadata.c | 50 ++- drivers/media/dvb-frontends/af9013.c | 4 + drivers/media/dvb-frontends/cx24116.c | 8 +- drivers/media/dvb-frontends/cx24117.c | 2 +- drivers/media/dvb-frontends/s5h1420.c | 2 +- drivers/media/pci/cx18/cx18-streams.c | 1 + drivers/media/pci/saa7164/saa7164-encoder.c | 11 +- drivers/media/pci/saa7164/saa7164-vbi.c | 11 +- drivers/media/usb/dvb-usb/dib0700_core.c | 70 ++-- drivers/media/usb/dvb-usb/dib0700_devices.c | 6 + drivers/media/v4l2-core/videobuf2-core.c | 33 +- drivers/mmc/card/block.c | 10 +- drivers/mmc/host/sdhci.c | 9 +- drivers/net/ethernet/intel/e1000e/82571.c | 2 +- drivers/net/ethernet/intel/e1000e/ich8lan.c | 10 +- drivers/net/ethernet/intel/e1000e/netdev.c | 18 +- drivers/net/wireless/ath/ath9k/htc.h | 6 +- drivers/net/wireless/ath/ath9k/main.c | 12 +- drivers/net/wireless/iwlwifi/mvm/debugfs.c | 5 +- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 + drivers/net/wireless/iwlwifi/mvm/time-event.c | 15 +- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 16 - drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | 17 - drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 13 - drivers/net/wireless/rtlwifi/rtl8723be/hw.c | 17 - drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | 20 -- drivers/nfc/st21nfcb/i2c.c | 10 - drivers/nfc/st21nfcb/st21nfcb.c | 3 - drivers/of/address.c | 2 +- drivers/of/base.c | 2 +- drivers/phy/phy-berlin-usb.c | 4 +- drivers/phy/phy-twl4030-usb.c | 1 - drivers/pinctrl/mvebu/pinctrl-armada-370.c | 4 +- drivers/pinctrl/mvebu/pinctrl-armada-375.c | 4 +- drivers/pinctrl/mvebu/pinctrl-armada-38x.c | 51 ++- drivers/pinctrl/mvebu/pinctrl-armada-39x.c | 2 +- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 37 +- drivers/pinctrl/pinctrl-zynq.c | 11 +- drivers/platform/x86/dell-laptop.c | 8 +- drivers/platform/x86/ideapad-laptop.c | 10 +- drivers/pnp/system.c | 35 +- drivers/rtc/rtc-snvs.c | 30 +- drivers/staging/comedi/drivers/cb_pcimdas.c | 8 +- drivers/staging/rtl8712/rtl8712_recv.c | 3 +- drivers/staging/vt6655/device_main.c | 6 +- drivers/staging/vt6656/main_usb.c | 2 +- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/atmel_serial.c | 9 +- drivers/tty/sysrq.c | 19 +- drivers/usb/core/devio.c | 2 +- drivers/usb/core/hcd.c | 7 +- drivers/usb/core/hub.c | 84 ++--- drivers/usb/core/usb.h | 1 + drivers/usb/dwc3/ep0.c | 4 + drivers/usb/dwc3/gadget.c | 10 +- drivers/usb/gadget/composite.c | 11 +- drivers/usb/gadget/function/f_fs.c | 6 +- drivers/usb/gadget/function/f_mass_storage.c | 16 +- drivers/usb/gadget/udc/mv_udc_core.c | 2 +- drivers/usb/host/ohci-q.c | 7 +- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/musb/musb_virthub.c | 4 +- drivers/usb/phy/phy-mxs-usb.c | 3 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/option.c | 1 + drivers/usb/serial/usb-serial.c | 1 + drivers/w1/slaves/w1_therm.c | 62 +++- drivers/watchdog/omap_wdt.c | 7 + fs/9p/vfs_inode.c | 3 +- fs/9p/vfs_inode_dotl.c | 3 +- fs/btrfs/inode-map.c | 17 +- fs/btrfs/ioctl.c | 22 +- fs/btrfs/transaction.c | 4 +- fs/btrfs/tree-log.c | 14 +- fs/ext4/extents.c | 6 +- fs/ext4/indirect.c | 2 +- fs/ext4/inode.c | 45 ++- fs/ext4/mballoc.c | 16 +- fs/ext4/migrate.c | 17 +- fs/ext4/super.c | 4 + fs/fuse/inode.c | 2 +- fs/hpfs/super.c | 18 +- fs/jbd2/checkpoint.c | 7 +- fs/jbd2/journal.c | 38 +- fs/nfs/flexfilelayout/flexfilelayout.c | 2 +- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 7 +- fs/nfs/nfs3xdr.c | 2 +- fs/nfs/nfs4state.c | 2 + fs/nfs/pnfs.c | 3 + fs/nfs/write.c | 1 + fs/overlayfs/readdir.c | 77 ++-- fs/xfs/xfs_attr_inactive.c | 10 +- fs/xfs/xfs_symlink.c | 2 +- include/acpi/acpixf.h | 13 +- include/acpi/actypes.h | 1 + include/drm/drm_atomic.h | 24 +- include/drm/drm_crtc.h | 2 + include/drm/drm_dp_mst_helper.h | 4 + include/linux/acpi.h | 10 - include/linux/ata.h | 1 + include/linux/buffer_head.h | 7 + include/linux/compiler-intel.h | 2 + include/linux/gpio/consumer.h | 15 + include/linux/hid-sensor-hub.h | 1 + include/linux/jbd2.h | 4 +- include/linux/libata.h | 3 + include/linux/nfs_xdr.h | 2 +- include/linux/of.h | 5 +- include/uapi/drm/i915_drm.h | 8 + kernel/power/Kconfig | 2 +- kernel/printk/printk.c | 11 +- kernel/trace/trace.h | 3 +- kernel/trace/trace_branch.c | 17 +- kernel/trace/trace_events_filter.c | 10 +- lib/bitmap.c | 17 +- mm/hugetlb.c | 19 +- net/9p/client.c | 4 +- net/bluetooth/hci_sock.c | 26 +- net/ceph/osdmap.c | 2 +- net/ieee802154/socket.c | 6 + net/mac80211/cfg.c | 1 + net/mac80211/ibss.c | 1 + net/mac80211/main.c | 3 + net/mac80211/mesh.c | 1 + net/sunrpc/backchannel_rqst.c | 2 +- net/wireless/util.c | 2 +- samples/trace_events/trace-events-sample.h | 7 +- security/integrity/evm/evm_main.c | 11 + security/integrity/ima/ima.h | 2 +- security/integrity/ima/ima_fs.c | 4 +- security/integrity/ima/ima_policy.c | 124 +++++-- security/integrity/ima/ima_template_lib.c | 3 +- security/keys/keyring.c | 8 +- security/selinux/hooks.c | 3 +- security/selinux/ss/ebitmap.c | 6 + sound/soc/codecs/max98925.c | 2 +- sound/soc/codecs/rt5645.c | 4 +- sound/soc/codecs/tas2552.c | 4 +- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/codecs/wm8737.c | 6 +- sound/soc/codecs/wm8903.h | 2 +- sound/soc/codecs/wm8955.c | 2 +- sound/soc/codecs/wm8960.c | 2 +- sound/soc/codecs/wm8997.c | 2 +- sound/soc/fsl/imx-wm8962.c | 2 +- sound/soc/omap/Kconfig | 5 +- sound/soc/qcom/Kconfig | 2 - tools/perf/util/cloexec.c | 4 + 281 files changed, 2866 insertions(+), 1964 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 3/267 pinctrl: mvebu: armada-370: fix spi0 pin description
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 438881dfddb9107ef0eb30b49368e91e092f0b3e upstream.
Due to a mistake, the CS0 and CS1 SPI0 functions were incorrectly named "spi0-1" instead of just "spi0". This commit fixes that.
This DT binding change does not affect any of the in-tree users.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt | 4 ++-- drivers/pinctrl/mvebu/pinctrl-armada-370.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt +2 -2
@@ -92,5 +92,5 @@ mpp61 61 gpo, dev(wen1), u mpp62 62 gpio, dev(a2), uart1(cts), tdm(drx), pcie(clkreq0), audio(mclk), uart0(cts) mpp63 63 gpo, spi0(sck), tclk -mpp64 64 gpio, spi0(miso), spi0-1(cs1) -mpp65 65 gpio, spi0(mosi), spi0-1(cs2) +mpp64 64 gpio, spi0(miso), spi0(cs1) +mpp65 65 gpio, spi0(mosi), spi0(cs2)
drivers/pinctrl/mvebu/pinctrl-armada-370.c +2 -2
@@ -370,11 +370,11 @@ static struct mvebu_mpp_mode mv88f6710_mMPP_MODE (64 ,MPP_FUNCTION (0x0 ,"gpio" ,NULL ),MPP_FUNCTION (0x1 ,"spi0" ,"miso" ), -MPP_FUNCTION (0x2 ,"spi0-1" ,"cs1" )), +MPP_FUNCTION (0x2 ,"spi0" ,"cs1" )),MPP_MODE (65 ,MPP_FUNCTION (0x0 ,"gpio" ,NULL ),MPP_FUNCTION (0x1 ,"spi0" ,"mosi" ), - MPP_FUNCTION(0x2, "spi0-1", "cs2")), + MPP_FUNCTION(0x2, "spi0", "cs2")), };static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info;
Greg Kroah-Hartman
maintainerPATCH 4/267 pinctrl: mvebu: armada-375: remove incorrect space in pin description
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit d538990ee12b162f7ce6c0fcef3b643800102676 upstream.
There was an incorrect space in the definition of the function of one pin in the Armada 375 pinctrl driver, which this commit fixes.
--- drivers/pinctrl/mvebu/pinctrl-armada-375.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-375.c +1 -1
@@ -92,7 +92,7 @@ static struct mvebu_mpp_mode mv88f6720_m MPP_FUNCTION(0x5, "nand", "io1")),MPP_MODE (8 ,MPP_FUNCTION (0x0 ,"gpio" ,NULL ), -MPP_FUNCTION (0x1 ,"dev " ,"bootcs" ), +MPP_FUNCTION (0x1 ,"dev" ,"bootcs" ),MPP_FUNCTION (0x2 ,"spi0" ,"cs0" ),MPP_FUNCTION (0x3 ,"spi1" ,"cs0" ), MPP_FUNCTION(0x5, "nand", "ce")),
Greg Kroah-Hartman
maintainerPATCH 5/267 pinctrl: mvebu: armada-375: remove non-existing NAND re/we pins
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit e5447d26092c72ef3346615ee558c9112ef8063f upstream.
After updating to a more recent version of the Armada 375, we realized that some of the pins documented as having a NAND-related functionality in fact did not have such functionality. This commit updates the pinctrl driver accordingly.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt | 4 ++-- drivers/pinctrl/mvebu/pinctrl-armada-375.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt +2 -2
@@ -22,8 +22,8 @@ mpp5 5 gpio, dev(ad7), s mpp6 6 gpio, dev(ad0), led(p1), audio(rclk) mpp7 7 gpio, dev(ad1), ptp(clk), led(p2), audio(extclk) mpp8 8 gpio, dev (bootcs), spi0(cs0), spi1(cs0) -mpp9 9 gpio, nf(wen), spi0(sck), spi1(sck) -mpp10 10 gpio, nf(ren), dram(vttctrl), led(c1) +mpp9 9 gpio, spi0(sck), spi1(sck), nand(we) +mpp10 10 gpio, dram(vttctrl), led(c1), nand(re) mpp11 11 gpio, dev(a0), led(c2), audio(sdo) mpp12 12 gpio, dev(a1), audio(bclk) mpp13 13 gpio, dev(readyn), pcie0(rstoutn), pcie1(rstoutn)
drivers/pinctrl/mvebu/pinctrl-armada-375.c +0 -2
@@ -98,13 +98,11 @@ static struct mvebu_mpp_mode mv88f6720_m MPP_FUNCTION(0x5, "nand", "ce")),MPP_MODE (9 ,MPP_FUNCTION (0x0 ,"gpio" ,NULL ), -MPP_FUNCTION (0x1 ,"nf" ,"wen" ),MPP_FUNCTION (0x2 ,"spi0" ,"sck" ),MPP_FUNCTION (0x3 ,"spi1" ,"sck" ),MPP_FUNCTION (0x5 ,"nand" ,"we" )), MPP_MODE(10, MPP_FUNCTION(0x0, "gpio", NULL), - MPP_FUNCTION(0x1, "nf", "ren"), MPP_FUNCTION(0x2, "dram", "vttctrl"), MPP_FUNCTION(0x3, "led", "c1"), MPP_FUNCTION(0x5, "nand", "re"),
Greg Kroah-Hartman
maintainerPATCH 6/267 pinctrl: mvebu: armada-38x: fix PCIe functions
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 331642fbf24a1c16b2669ca0a6479b5fcd6dd5b2 upstream.
A new revision of the Marvell Armada 38x hardware datasheet unveiled that the definition of some of the PCIe functions were not correct. This commit fixes the pinctrl driver accordingly.
Some PCIe functions simply do not exist, some of the PCIe functions in fact were corresponding to other functions, and some PCIe functions have been added.
Note: the seemingly unrelated removal of spi(cs2) on MPP47 is related:
this function is in fact implemented on MPP43, instead of a PCIe function.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt | 38 +++---- drivers/pinctrl/mvebu/pinctrl-armada-38x.c | 49 ++++------ 2 files changed, 39 insertions(+), 48 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt +19 -19
@@ -27,15 +27,15 @@ mpp8 8 gpio, ge0(txd1), mpp9 9 gpio, ge0(txd2), dev(ad11) mpp10 10 gpio, ge0(txd3), dev(ad12) mpp11 11 gpio, ge0(txctl), dev(ad13) -mpp12 12 gpio, ge0(rxd0), pcie0(rstout), pcie1(rstout) [1], spi0(cs1), dev(ad14) -mpp13 13 gpio, ge0(rxd1), pcie0(clkreq), pcie1(clkreq) [1], spi0(cs2), dev(ad15) -mpp14 14 gpio, ge0(rxd2), ptp(clk), m(vtt_ctrl), spi0(cs3), dev(wen1) -mpp15 15 gpio, ge0(rxd3), ge(mdc slave), pcie0(rstout), spi0(mosi), pcie1(rstout) [1] -mpp16 16 gpio, ge0(rxctl), ge(mdio slave), m(decc_err), spi0(miso), pcie0(clkreq) +mpp12 12 gpio, ge0(rxd0), pcie0(rstout), spi0(cs1), dev(ad14), pcie3(clkreq) +mpp13 13 gpio, ge0(rxd1), pcie0(clkreq), pcie1(clkreq) [1], spi0(cs2), dev(ad15), pcie2(clkreq) +mpp14 14 gpio, ge0(rxd2), ptp(clk), m(vtt_ctrl), spi0(cs3), dev(wen1), pcie3(clkreq) +mpp15 15 gpio, ge0(rxd3), ge(mdc slave), pcie0(rstout), spi0(mosi) +mpp16 16 gpio, ge0(rxctl), ge(mdio slave), m(decc_err), spi0(miso), pcie0(clkreq), pcie1(clkreq) [1] mpp17 17 gpio, ge0(rxclk), ptp(clk), ua1(rxd), spi0(sck), sata1(prsnt) -mpp18 18 gpio, ge0(rxerr), ptp(trig_gen), ua1(txd), spi0(cs0), pcie1(rstout) [1] -mpp19 19 gpio, ge0(col), ptp(event_req), pcie0(clkreq), sata1(prsnt), ua0(cts) -mpp20 20 gpio, ge0(txclk), ptp(clk), pcie1(rstout) [1], sata0(prsnt), ua0(rts) +mpp18 18 gpio, ge0(rxerr), ptp(trig_gen), ua1(txd), spi0(cs0) +mpp19 19 gpio, ge0(col), ptp(event_req), ge0(txerr), sata1(prsnt), ua0(cts) +mpp20 20 gpio, ge0(txclk), ptp(clk), sata0(prsnt), ua0(rts) mpp21 21 gpio, spi0(cs1), ge1(rxd0), sata0(prsnt), sd0(cmd), dev(bootcs) mpp22 22 gpio, spi0(mosi), dev(ad0) mpp23 23 gpio, spi0(sck), dev(ad2)
@@ -58,23 +58,23 @@ mpp39 39 gpio, i2c1(sck), mpp40 40 gpio, i2c1(sda), ge1(rxd3), ua0(rts), sd0(d2), dev(ad6) mpp41 41 gpio, ua1(rxd), ge1(rxctl), ua0(cts), spi1(cs3), dev(burst/last) mpp42 42 gpio, ua1(txd), ua0(rts), dev(ad7) -mpp43 43 gpio, pcie0(clkreq), m(vtt_ctrl), m(decc_err), pcie0(rstout), dev(clkout) -mpp44 44 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [3], pcie0(rstout) -mpp45 45 gpio, ref(clk_out0), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) -mpp46 46 gpio, ref(clk_out1), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) -mpp47 47 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], spi1(cs2), sata3(prsnt) [2] -mpp48 48 gpio, sata0(prsnt), m(vtt_ctrl), tdm2c(pclk), audio(mclk), sd0(d4) -mpp49 49 gpio, sata2(prsnt) [2], sata3(prsnt) [2], tdm2c(fsync), audio(lrclk), sd0(d5) -mpp50 50 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(drx), audio(extclk), sd0(cmd) +mpp43 43 gpio, pcie0(clkreq), m(vtt_ctrl), m(decc_err), spi1(cs2), dev(clkout) +mpp44 44 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [3] +mpp45 45 gpio, ref(clk_out0), pcie0(rstout) +mpp46 46 gpio, ref(clk_out1), pcie0(rstout) +mpp47 47 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [2] +mpp48 48 gpio, sata0(prsnt), m(vtt_ctrl), tdm2c(pclk), audio(mclk), sd0(d4), pcie0(clkreq) +mpp49 49 gpio, sata2(prsnt) [2], sata3(prsnt) [2], tdm2c(fsync), audio(lrclk), sd0(d5), pcie1(clkreq) +mpp50 50 gpio, pcie0(rstout), tdm2c(drx), audio(extclk), sd0(cmd) mpp51 51 gpio, tdm2c(dtx), audio(sdo), m(decc_err) -mpp52 52 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(intn), audio(sdi), sd0(d6) +mpp52 52 gpio, pcie0(rstout), tdm2c(intn), audio(sdi), sd0(d6) mpp53 53 gpio, sata1(prsnt), sata0(prsnt), tdm2c(rstn), audio(bclk), sd0(d7) -mpp54 54 gpio, sata0(prsnt), sata1(prsnt), pcie0(rstout), pcie1(rstout) [1], sd0(d3) +mpp54 54 gpio, sata0(prsnt), sata1(prsnt), pcie0(rstout), ge0(txerr), sd0(d3) mpp55 55 gpio, ua1(cts), ge(mdio), pcie1(clkreq) [1], spi1(cs1), sd0(d0) mpp56 56 gpio, ua1(rts), ge(mdc), m(decc_err), spi1(mosi) mpp57 57 gpio, spi1(sck), sd0(clk) mpp58 58 gpio, pcie1(clkreq) [1], i2c1(sck), pcie2(clkreq), spi1(miso), sd0(d1) -mpp59 59 gpio, pcie0(rstout), i2c1(sda), pcie1(rstout) [1], spi1(cs0), sd0(d2) +mpp59 59 gpio, pcie0(rstout), i2c1(sda), spi1(cs0), sd0(d2) [1]: only available on 88F6820 and 88F6828 [2]: only available on 88F6828
drivers/pinctrl/mvebu/pinctrl-armada-38x.c +20 -29
151 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 7/267 pinctrl: mvebu: armada-38x: fix incorrect total number of GPIOs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 27e7cd016558bf787b128fd882cdd90409ae4036 upstream.
The pinctrl_gpio_range[] array described a first bank of 32 GPIOs and a second one of 27 GPIOs. However, since there is a total of 60 MPP pins that can be muxed as GPIOs, the second bank really has 28 GPIOs.
--- drivers/pinctrl/mvebu/pinctrl-armada-38x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-38x.c +1 -1
@@ -402,7 +402,7 @@ static struct mvebu_mpp_ctrl armada_38x_static struct pinctrl_gpio_range armada_38x_mpp_gpio_ranges[] = {MPP_GPIO_RANGE (0 ,0 ,0 ,32 ), -MPP_GPIO_RANGE (1 ,32 ,32 ,27 ), +MPP_GPIO_RANGE (1 ,32 ,32 ,28 ), };static int armada_38x_pinctrl_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 8/267 pinctrl: mvebu: armada-39x: fix incorrect total number of GPIOs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 7c580311a2cb3bb0d0188665c9c69227aed650ea upstream.
The pinctrl_gpio_range[] array described a first bank of 32 GPIOs and a second one of 27 GPIOs. However, since there is a total of 60 MPP pins that can be muxed as GPIOs, the second bank really has 28 GPIOs.
--- drivers/pinctrl/mvebu/pinctrl-armada-39x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-39x.c +1 -1
@@ -380,7 +380,7 @@ static struct mvebu_mpp_ctrl armada_39x_static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = {MPP_GPIO_RANGE (0 ,0 ,0 ,32 ), -MPP_GPIO_RANGE (1 ,32 ,32 ,27 ), +MPP_GPIO_RANGE (1 ,32 ,32 ,28 ), };static int armada_39x_pinctrl_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 9/267 pinctrl: mvebu: armada-xp: remove non-existing NAND pins
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit bc99357f3690c11817756adfee0ece811a3db2e7 upstream.
After updating to a more recent version of the Armada XP datasheet, we realized that some of the pins documented as having a NAND-related functionality in fact did not have such functionality. This commit updates the pinctrl driver accordingly.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt | 4 ++-- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt +2 -2
@@ -42,8 +42,8 @@ mpp20 20 gpio, ge0(rxd4), mpp21 21 gpio, ge0(rxd5), ge1(rxd3), lcd(d21), mem(bat) mpp22 22 gpio, ge0(rxd6), ge1(rxctl), lcd(d22), sata0(prsnt) mpp23 23 gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt) -mpp24 24 gpio, lcd(hsync), sata1(prsnt), nf(bootcs-re), tdm(rst) -mpp25 25 gpio, lcd(vsync), sata0(prsnt), nf(bootcs-we), tdm(pclk) +mpp24 24 gpio, lcd(hsync), sata1(prsnt), tdm(rst) +mpp25 25 gpio, lcd(vsync), sata0(prsnt), tdm(pclk) mpp26 26 gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd) mpp27 27 gpio, lcd(e), tdm(dtx), ptp(trig) mpp28 28 gpio, lcd(pwm), tdm(drx), ptp(evreq)
drivers/pinctrl/mvebu/pinctrl-armada-xp.c +0 -2
@@ -172,13 +172,11 @@ static struct mvebu_mpp_mode armada_xp_mMPP_MODE (24 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"sata1" ,"prsnt" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x2 ,"nf" ,"bootcs-re" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x3 ,"tdm" ,"rst" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x4 ,"lcd" ,"hsync" ,V_MV78230_PLUS )),MPP_MODE (25 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"sata0" ,"prsnt" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x2 ,"nf" ,"bootcs-we" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x3 ,"tdm" ,"pclk" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x4 ,"lcd" ,"vsync" ,V_MV78230_PLUS )), MPP_MODE(26,
Greg Kroah-Hartman
maintainerPATCH 10/267 pinctrl: mvebu: armada-xp: remove non-existing VDD cpu_pd functions
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 80b3d04feab5e69d51cb2375eb989a7165e43e3b upstream.
The latest version of the Armada XP datasheet no longer documents the VDD cpu_pd functions, which might indicate they are not working and/or not supported. This commit ensures the pinctrl driver matches the datasheet.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt | 26 +++---- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 33 +++------- 2 files changed, 20 insertions(+), 39 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt +10 -16
@@ -44,13 +44,13 @@ mpp22 22 gpio, ge0(rxd6), mpp23 23 gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt) mpp24 24 gpio, lcd(hsync), sata1(prsnt), tdm(rst) mpp25 25 gpio, lcd(vsync), sata0(prsnt), tdm(pclk) -mpp26 26 gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd) +mpp26 26 gpio, lcd(clk), tdm(fsync) mpp27 27 gpio, lcd(e), tdm(dtx), ptp(trig) mpp28 28 gpio, lcd(pwm), tdm(drx), ptp(evreq) -mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk), vdd(cpu0-pd) +mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk) mpp30 30 gpio, tdm(int1), sd0(clk) -mpp31 31 gpio, tdm(int2), sd0(cmd), vdd(cpu0-pd) -mpp32 32 gpio, tdm(int3), sd0(d0), vdd(cpu1-pd) +mpp31 31 gpio, tdm(int2), sd0(cmd) +mpp32 32 gpio, tdm(int3), sd0(d0) mpp33 33 gpio, tdm(int4), sd0(d1), mem(bat) mpp34 34 gpio, tdm(int5), sd0(d2), sata0(prsnt) mpp35 35 gpio, tdm(int6), sd0(d3), sata1(prsnt)
@@ -58,14 +58,11 @@ mpp36 36 gpio, spi(mosi) mpp37 37 gpio, spi(miso) mpp38 38 gpio, spi(sck) mpp39 39 gpio, spi(cs0) -mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), vdd(cpu1-pd), - pcie(clkreq0) +mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), pcie(clkreq0) mpp41 41 gpio, spi(cs2), uart2(rts), lcd(vga-vsync), sata1(prsnt), pcie(clkreq1) -mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer), - vdd(cpu0-pd) -mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout), - vdd(cpu2-3-pd){1} +mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer) +mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout) mpp44 44 gpio, uart2(cts), uart3(rxd), spi(cs4), pcie(clkreq2), mem(bat) mpp45 45 gpio, uart2(rts), uart3(txd), spi(cs5), sata1(prsnt)
@@ -84,9 +81,9 @@ mpp51 51 gpio, dev(ad16) mpp52 52 gpio, dev(ad17) mpp53 53 gpio, dev(ad18) mpp54 54 gpio, dev(ad19) -mpp55 55 gpio, dev(ad20), vdd(cpu0-pd) -mpp56 56 gpio, dev(ad21), vdd(cpu1-pd) -mpp57 57 gpio, dev(ad22), vdd(cpu2-3-pd){1} +mpp55 55 gpio, dev(ad20) +mpp56 56 gpio, dev(ad21) +mpp57 57 gpio, dev(ad22) mpp58 58 gpio, dev(ad23) mpp59 59 gpio, dev(ad24) mpp60 60 gpio, dev(ad25)
@@ -96,6 +93,3 @@ mpp63 63 gpio, dev(ad28) mpp64 64 gpio, dev(ad29) mpp65 65 gpio, dev(ad30) mpp66 66 gpio, dev(ad31) - -Notes: -* {1} vdd(cpu2-3-pd) only available on mv78460.
drivers/pinctrl/mvebu/pinctrl-armada-xp.c +10 -23
@@ -14,10 +14,7 @@* available: mv78230, mv78260 and mv78460. From a pin muxing * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 * both have 67 MPP pins (more GPIOs and address lines for the memory -* bus mainly). The only difference between the mv78260 and the -* mv78460 in terms of pin muxing is the addition of two functions on -* pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two -* cores, mv78460 has four cores). +* bus mainly). */ #include <linux/err.h>
@@ -182,8 +179,7 @@ static struct mvebu_mpp_mode armada_xp_mMPP_MODE (26 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x3 ,"tdm" ,"fsync" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x4 ,"lcd" ,"clk" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x5 ,"vdd" ,"cpu1-pd" ,V_MV78230_PLUS )), +MPP_VAR_FUNCTION (0x4 ,"lcd" ,"clk" ,V_MV78230_PLUS )), MPP_MODE(27, MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS),
@@ -198,8 +194,7 @@ static struct mvebu_mpp_mode armada_xp_m MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), + MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), MPP_MODE(30, MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS),
@@ -207,13 +202,11 @@ static struct mvebu_mpp_mode armada_xp_mMPP_MODE (31 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"sd0" ,"cmd" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x3 ,"tdm" ,"int2" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x5 ,"vdd" ,"cpu0-pd" ,V_MV78230_PLUS )), +MPP_VAR_FUNCTION (0x3 ,"tdm" ,"int2" ,V_MV78230_PLUS )),MPP_MODE (32 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"sd0" ,"d0" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x3 ,"tdm" ,"int3" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x5 ,"vdd" ,"cpu1-pd" ,V_MV78230_PLUS )), +MPP_VAR_FUNCTION (0x3 ,"tdm" ,"int3" ,V_MV78230_PLUS )), MPP_MODE(33, MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS),
@@ -245,7 +238,6 @@ static struct mvebu_mpp_mode armada_xp_mMPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"spi" ,"cs1" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x2 ,"uart2" ,"cts" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x3 ,"vdd" ,"cpu1-pd" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x4 ,"lcd" ,"vga-hsync" ,V_MV78230_PLUS ), MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS)), MPP_MODE(41,
@@ -260,15 +252,13 @@ static struct mvebu_mpp_mode armada_xp_m MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), + MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS)),MPP_MODE (43 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x1 ,"uart2" ,"txd" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x2 ,"uart0" ,"rts" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x3 ,"spi" ,"cs3" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x4 ,"pcie" ,"rstout" ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x5 ,"vdd" ,"cpu2-3-pd" ,V_MV78460 )), +MPP_VAR_FUNCTION (0x4 ,"pcie" ,"rstout" ,V_MV78230_PLUS )), MPP_MODE(44, MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS),
@@ -319,16 +309,13 @@ static struct mvebu_mpp_mode armada_xp_m MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)),MPP_MODE (55 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad20" ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x2 ,"vdd" ,"cpu0-pd" ,V_MV78260_PLUS )), +MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad20" ,V_MV78260_PLUS )),MPP_MODE (56 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad21" ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x2 ,"vdd" ,"cpu1-pd" ,V_MV78260_PLUS )), +MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad21" ,V_MV78260_PLUS )),MPP_MODE (57 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad22" ,V_MV78260_PLUS ), -MPP_VAR_FUNCTION (0x2 ,"vdd" ,"cpu2-3-pd" ,V_MV78460 )), +MPP_VAR_FUNCTION (0x1 ,"dev" ,"ad22" ,V_MV78260_PLUS )),MPP_MODE (58 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78260_PLUS ), MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)),
Greg Kroah-Hartman
maintainerPATCH 11/267 pinctrl: mvebu: armada-xp: fix functions of MPP48
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit ea78b9511a54d0de026e04b5da86b30515072f31 upstream.
There was a mistake in the definition of the functions for MPP48 on Marvell Armada XP. The second function is dev(clkout), and not tclk.
--- Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt | 2 +- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt +1 -1
@@ -69,7 +69,7 @@ mpp45 45 gpio, uart2(rts), mpp46 46 gpio, uart3(rts), uart1(rts), spi(cs6), sata0(prsnt) mpp47 47 gpio, uart3(cts), uart1(cts), spi(cs7), pcie(clkreq3), ref(clkout) -mpp48 48 gpio, tclk, dev(burst/last) +mpp48 48 gpio, dev(clkout), dev(burst/last) * Marvell Armada XP (mv78260 and mv78460 only)
drivers/pinctrl/mvebu/pinctrl-armada-xp.c +1 -1
@@ -287,7 +287,7 @@ static struct mvebu_mpp_mode armada_xp_m MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS)),MPP_MODE (48 ,MPP_VAR_FUNCTION (0x0 ,"gpio" ,NULL ,V_MV78230_PLUS ), -MPP_VAR_FUNCTION (0x1 ,"tclk" ,NULL ,V_MV78230_PLUS ), +MPP_VAR_FUNCTION (0x1 ,"dev" ,"clkout" ,V_MV78230_PLUS ),MPP_VAR_FUNCTION (0x2 ,"dev" ,"burst/last" ,V_MV78230_PLUS )), MPP_MODE(49, MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS),
Greg Kroah-Hartman
maintainerPATCH 12/267 openrisc: fix CONFIG_UID16 setting
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit 04ea1e91f85615318ea91ce8ab50cb6a01ee4005 upstream.
openrisc-allnoconfig:
kernel/uid16.c: In function 'SYSC_setgroups16':
kernel/uid16.c:184:2: error: implicit declaration of function 'groups_alloc' kernel/uid16.c:184:13: warning: assignment makes pointer from integer without a cast
openrisc shouldn't be setting CONFIG_UID16 when CONFIG_MULTIUSER=n.
--- arch/openrisc/Kconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/openrisc/Kconfig +1 -3
@@ -17,6 +17,7 @@ config OPENRISC select GENERIC_IRQ_SHOW select GENERIC_IOMAP select GENERIC_CPU_DEVICES + select HAVE_UID16 select GENERIC_ATOMIC64 select GENERIC_CLOCKEVENTS select GENERIC_STRNCPY_FROM_USER
@@ -31,9 +32,6 @@ config MMU config HAVE_DMA_ATTRS def_bool y -config UID16 - def_bool y - config RWSEM_GENERIC_SPINLOCK def_bool y
Greg Kroah-Hartman
maintainerPATCH 13/267 m68knommu: make ColdFire SoC selection a choice
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Ungerer <[email protected]>
commit fa95a1dd0819c9041a873b10a6d83b5134964154 upstream.
It would be nice if we could support multiple ColdFire SoC types in a single binary - but currently the code simply does not support it. Change the SoC selection config options to be a choice instead of individual selectable entries.
This fixes problems with building allnoconfig, and means that a sane linux kernel is generated for a single ColdFire SoC type.
--- arch/m68k/Kconfig.cpu | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
arch/m68k/Kconfig.cpu +18 -9
@@ -125,6 +125,13 @@ endif # M68KCLASSIC if COLDFIRE +choice + prompt "ColdFire SoC type" + default M520x + help + Select the type of ColdFire System-on-Chip (SoC) that you want + to build for. + config M5206 bool "MCF5206" depends on !MMU
@@ -174,9 +181,6 @@ config M525x help Freescale (Motorola) Coldfire 5251/5253 processor support. -config M527x - bool - config M5271 bool "MCF5271" depends on !MMU
@@ -223,9 +227,6 @@ config M5307 help Motorola ColdFire 5307 processor support. -config M53xx - bool - config M532x bool "MCF532x" depends on !MMU
@@ -251,9 +252,6 @@ config M5407 help Motorola ColdFire 5407 processor support. -config M54xx - bool - config M547x bool "MCF547x" select M54xx
@@ -280,6 +278,17 @@ config M5441x help Freescale Coldfire 54410/54415/54416/54417/54418 processor support. +endchoice + +config M527x + bool + +config M53xx + bool + +config M54xx + bool + endif # COLDFIRE
Greg Kroah-Hartman
maintainerPATCH 14/267 m68knommu: force setting of CONFIG_CLOCK_FREQ for ColdFire
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Ungerer <[email protected]>
commit d9ee489619744ee5ac246b8fb3dd65bb078d2f0a upstream.
It is possible to disable the clock selection at configuration time, but for ColdFire targets we always expect a clock frequency to be selected. This results in the following compile time error:
CC arch/m68k/kernel/asm-offsets.s
In file included from ./arch/m68k/include/asm/timex.h:14:0,
from include/linux/timex.h:65,
from include/linux/sched.h:19,
from arch/m68k/kernel/asm-offsets.c:14:./arch/m68k/include/asm/coldfire.h:25:2: error: #error "Don't know what your ColdFire CPU clock frequency is??"
Remove CONFIG_CLOCK_SELECT completely and always enable CONFIG_CLOCK_FREQ for ColdFire.
--- arch/m68k/Kconfig.cpu | 14 +------------- arch/m68k/include/asm/coldfire.h | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-)
arch/m68k/Kconfig.cpu +1 -13
@@ -425,22 +425,10 @@ config HAVE_MBAR config HAVE_IPSBAR bool -config CLOCK_SET - bool "Enable setting the CPU clock frequency" - depends on COLDFIRE - default n - help - On some CPU's you do not need to know what the core CPU clock - frequency is. On these you can disable clock setting. On some - traditional 68K parts, and on all ColdFire parts you need to set - the appropriate CPU clock frequency. On these devices many of the - onboard peripherals derive their timing from the master CPU clock - frequency. - config CLOCK_FREQ int "Set the core clock frequency" default "66666666" - depends on CLOCK_SET + depends on COLDFIRE help Define the CPU clock frequency in use. This is the core clock frequency, it may or may not be the same as the external clock
arch/m68k/include/asm/coldfire.h +1 -1
@@ -19,7 +19,7 @@* in any case new boards come along from time to time that have yet * another different clocking frequency. */ -#ifdef CONFIG_CLOCK_SET +#ifdef CONFIG_CLOCK_FREQ #define MCF_CLK CONFIG_CLOCK_FREQ#else #error "Don't know what your ColdFire CPU clock frequency is??"
Greg Kroah-Hartman
maintainerPATCH 15/267 Bluetooth: Fix race condition with user channel and setup stage
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit 781f899f2f9d8b71e35225a087f90052059486c5 upstream.
During the initial setup stage of a controller, the low-level transport is actually active. This means that HCI_UP is true. To avoid toggling the transport off and back on again for normal operation the kernel holds a grace period with HCI_AUTO_OFF that will turn the low-level transport off in case no user is present.
The idea of the grace period is important to avoid having to initialize all of the controller twice. So legacy ioctl and the new management interface knows how to clear this grace period and then start normal operation.
For the user channel operation this grace period has not been taken into account which results in the problem that HCI_UP and HCI_AUTO_OFF are set and the kernel will return EBUSY. However from a system point of view the controller is ready to be grabbed by either the ioctl, the management interface or the user channel.
This patch brings the user channel to the same level as the other two entries for operating a controller.
--- net/bluetooth/hci_sock.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
net/bluetooth/hci_sock.c +19 -7
@@ -741,10 +741,11 @@ static int hci_sock_bind(struct socket * goto done; } -if (test_bit (HCI_UP , &hdev->flags) || -test_bit (HCI_INIT , &hdev->flags) || +if (test_bit (HCI_INIT , &hdev->flags) ||hci_dev_test_flag (hdev,HCI_SETUP ) || -hci_dev_test_flag (hdev,HCI_CONFIG )) { +hci_dev_test_flag (hdev,HCI_CONFIG ) || + (!hci_dev_test_flag (hdev,HCI_AUTO_OFF ) && +test_bit (HCI_UP , &hdev->flags))) { err = -EBUSY ;hci_dev_put (hdev); goto done;
@@ -760,10 +761,21 @@ static int hci_sock_bind(struct socket * err =hci_dev_open (hdev->id);if (err) { -hci_dev_clear_flag (hdev,HCI_USER_CHANNEL ); -mgmt_index_added (hdev); -hci_dev_put (hdev); - goto done; +if (err == -EALREADY ) { +/* In case the transport is already up and +* running, clear the error here. +* +* This can happen when opening an user +* channel and HCI_AUTO_OFF grace period +* is still active. +*/ + err =0 ; + }else { +hci_dev_clear_flag (hdev,HCI_USER_CHANNEL ); +mgmt_index_added (hdev); +hci_dev_put (hdev); + goto done; + } }atomic_inc (&hdev->promisc);
Greg Kroah-Hartman
maintainerPATCH 16/267 Bluetooth: btusb: Fix memory leak in Intel setup routine
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit ecffc80478cdce122f0ecb6a4e4f909132dd5c47 upstream.
The SKB returned from the Intel specific version information command is missing a kfree_skb.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -1993,6 +1993,8 @@ static int btusb_setup_intel(struct hci_ } fw_ptr = fw->data; +kfree_skb (skb); +/* This Intel specific command enables the manufacturer mode of the * controller. *
Greg Kroah-Hartman
maintainerPATCH 17/267 Bluetooth: btusb: Fix secure send command length alignment on Intel 8260
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit e66890a96abbb746e1229c3067471be36dc49b34 upstream.
This patch fixes the command length alignment issue for Intel Bluetooth 8260.
The length of parameters in the firmware downloading command must be multiplication of 4. If not, the command must append Intel_NOP command with extra parameters, zeros, at the end, and the firmware file is already included Intel_NOP command for alignment.
This patch checks the next command and if the next command is Intel_NOP command, it reads the Intel_NOP command and send them together.
For example, if the data from the firmware file looks like this:
8E FC 03 11 22 33 02 FC 03 00 00 00
Previously, btusb sends two commands:
09 FC 06 8E FC 03 11 22 33
09 FC 06 02 FC 03 00 00 00
This won't work because the length of parameters are 6 which violates the 4 byte alignment.
This patch will append them together and send as one command:
09 FC 0C 8E FC 03 11 22 33 02 FC 03 00 00 00
Based on previous work from Tedd Ho-Jeong An <[email protected]>
--- drivers/bluetooth/btusb.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/bluetooth/btusb.c +22 -12
@@ -2336,6 +2336,7 @@ static int btusb_setup_intel_new(structstruct intel_boot_params *params;const struct firmware *fw;const u8 *fw_ptr; +u32 frag_len;char fwname[64 ];ktime_t calltime, delta, rettime;unsigned long long duration;
@@ -2542,24 +2543,33 @@ static int btusb_setup_intel_new(struct } fw_ptr = fw->data +644 ; + frag_len =0 ;while (fw_ptr - fw->data < fw->size) { -struct hci_command_hdr *cmd = (void *)fw_ptr; -u8 cmd_len; +struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len); - cmd_len =sizeof (*cmd) + cmd->plen; + frag_len +=sizeof (*cmd) + cmd->plen; -/* Send each command from the firmware data buffer as -* a single Data fragment. +/* The paramter length of the secure send command requires +* a 4 byte alignment. It happens so that the firmware file +* contains proper Intel_NOP commands to align the fragments +* as needed. +* +* Send set of commands with 4 byte alignment from the +* firmware data buffer as a single Data fragement. */ - err =btusb_intel_secure_send (hdev,0x01 , cmd_len, fw_ptr); -if (err <0 ) { -BT_ERR ("%s: Failed to send firmware data (%d)" , - hdev->name, err); - goto done; - } +if (!(frag_len %4 )) { + err =btusb_intel_secure_send (hdev,0x01 , frag_len, + fw_ptr); +if (err <0 ) { +BT_ERR ("%s: Failed to send firmware data (%d)" , + hdev->name, err); + goto done; + } - fw_ptr += cmd_len; + fw_ptr += frag_len; + frag_len =0 ; + } }set_bit (BTUSB_FIRMWARE_LOADED , &data->flags);
Greg Kroah-Hartman
maintainerPATCH 18/267 Bluetooth: btusb: Correct typo in Roper Class 1 Bluetooth Dongle
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksei Volkov <[email protected]>
commit 2eeac871697ac24a77b6d7953bd711b490e83ac7 upstream.
That patch corrects the typo in usb vendor id for Roper Class 1 Bluetooth Dongle. Problem with typo is present since 4.0 kernel.
Content /sys/kernel/debug/usb/devices for these dongle:
T: Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1310 ProdID=0001 Rev=15.00 S: Manufacturer=SiW S: Product=SiW S: SerialNumber=E7BB050D0B00 C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr= 50mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btusb.c +1 -1
@@ -268,7 +268,7 @@ static const struct usb_device_id blackl { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, /* Roper Class 1 Bluetooth Dongle (Silicon Wave based) */ - { USB_DEVICE(0x1300, 0x0001), .driver_info = BTUSB_SWAVE }, + { USB_DEVICE(0x1310, 0x0001), .driver_info = BTUSB_SWAVE }, /* Digianswer devices */ { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
Greg Kroah-Hartman
maintainerPATCH 19/267 Bluetooth: btbcm: allow btbcm_read_verbose_config to fail on Apple
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit 7bee8b08c428b63aa4a3765bb907602e36355378 upstream.
Commit 1c8ba6d013 moved around the setup code for broadcomm chips, and also added btbcm_read_verbose_config() to read extra information about the hardware. It's returning errors on some macbooks:
Bluetooth: hci0: BCM: Read verbose config info failed (-16)
Which makes us error out of the setup function. Since this probe isn't critical to operate the chip, this patch just changes things to carry on when it fails.
--- drivers/bluetooth/btbcm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/bluetooth/btbcm.c +5 -6
@@ -378,12 +378,11 @@ int btbcm_setup_apple(struct hci_dev *hd/* Read Verbose Config Version Info */ skb =btbcm_read_verbose_config (hdev); -if (IS_ERR (skb)) -return PTR_ERR (skb); - -BT_INFO ("%s: BCM: chip id %u build %4.4u" , hdev->name, skb->data[1 ], -get_unaligned_le16 (skb->data +5 )); -kfree_skb (skb); +if (!IS_ERR (skb)) { +BT_INFO ("%s: BCM: chip id %u build %4.4u" , hdev->name, skb->data[1 ], +get_unaligned_le16 (skb->data +5 )); +kfree_skb (skb); + }set_bit (HCI_QUIRK_STRICT_DUPLICATE_FILTER , &hdev->quirks);
Greg Kroah-Hartman
maintainerPATCH 20/267 ath9k: fix DMA stop sequence for AR9003+
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 300f77c08ded96d33f492aaa02549103852f0c12 upstream.
AR93xx and newer needs to stop rx before tx to avoid getting the DMA engine or MAC into a stuck state.
This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
--- drivers/net/wireless/ath/ath9k/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +7 -5
@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct athath_stop_ani (sc);ath9k_hw_disable_interrupts (ah); -if (!ath_drain_all_txq (sc)) - ret = false; - -if (!ath_stoprecv (sc)) - ret = false; +if (AR_SREV_9300_20_OR_LATER (ah)) { + ret &=ath_stoprecv (sc); + ret &=ath_drain_all_txq (sc); + }else { + ret &=ath_drain_all_txq (sc); + ret &=ath_stoprecv (sc); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 21/267 ath9k_htc: memory corruption calling set_bit()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 191f1aeeb93bb58e56f4d1868294ae22f3f67d4e upstream.
In d8a2c51cdcae ('ath9k_htc: Use atomic operations for op_flags') we changed things like this:
- if (priv->op_flags & OP_TSF_RESET) {
+ if (test_bit(OP_TSF_RESET, &priv->op_flags)) {
The problem is that test_bit() takes a bit number and not a mask. It means that when we do:
set_bit(OP_TSF_RESET, &priv->op_flags);
Then it sets the (1 << 6) bit instead of the 6 bit so we are setting a bit which is past the end of the unsigned long.
--- drivers/net/wireless/ath/ath9k/htc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +3 -3
@@ -440,9 +440,9 @@ static inline void ath9k_htc_stop_btcoex }#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ -#define OP_BT_PRIORITY_DETECTED BIT(3) -#define OP_BT_SCAN BIT(4) -#define OP_TSF_RESET BIT(6) +#define OP_BT_PRIORITY_DETECTED 3 +#define OP_BT_SCAN 4 +#define OP_TSF_RESET 6enum htc_op_flags {HTC_FWFLAG_NO_RMW ,
Greg Kroah-Hartman
maintainerPATCH 22/267 rtlwifi: Remove the clear interrupt routine from all drivers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Fann <[email protected]>
commit 1277fa2ab2f9a624a4b0177119ca13b5fd65edd0 upstream.
Several of these drivers have there TX randomly blocked for 3~5 seconds while measuring tx throughput (iperf). The root couse happens in rtl_pci_flush(). The function uses a while-loop to wait for TX queue length to decrease to 0. The TX queue length counts the number of packets that are queued in the driver. The driver relys on the TX OK interrupt to return skb and reduce TX queue length.
The interrupt subroutine disables interupts, reads the interrupt registers, and then clears the registers in the beginning of _rtl_pci_interrupt(). After all interupts process are finished, the driver invokes enable_interrupt() to enable interupts. This behavior is normal for an interrupt subroutine.
But enable_interrupt() invokes clear_interrupt() again. This unexpected interrupt clearing may cleari me fresh TX OK interrupts. These missing interrupts cause TX queue length to never reduce to 0i, which causes rtl_pci_flush() to be stuck in unterminated while-loop.
This patch removes clear_interrupt() in enable_interrupt() to avoid this behavior.
--- drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 16 ---------------- drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | 17 ----------------- drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 13 ------------- drivers/net/wireless/rtlwifi/rtl8723be/hw.c | 17 ----------------- drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | 20 -------------------- 5 files changed, 83 deletions(-)
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +0 -16
@@ -1354,27 +1354,11 @@ void rtl88ee_set_qos(struct ieee80211_hw } } -static void rtl88ee_clear_interrupt (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u32 tmp; - - tmp =rtl_read_dword (rtlpriv,REG_HISR ); -rtl_write_dword (rtlpriv,REG_HISR , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HISRE ); -rtl_write_dword (rtlpriv,REG_HISRE , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HSISR ); -rtl_write_dword (rtlpriv,REG_HSISR , tmp); -} -void rtl88ee_enable_interrupt (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw)); -rtl88ee_clear_interrupt (hw);/*clear it here first*/ rtl_write_dword (rtlpriv,REG_HIMR , rtlpci->irq_mask[0 ] &0xFFFFFFFF ); rtl_write_dword(rtlpriv, REG_HIMRE,
drivers/net/wireless/rtlwifi/rtl8192ee/hw.c +0 -17
@@ -1584,28 +1584,11 @@ void rtl92ee_set_qos(struct ieee80211_hw } } -static void rtl92ee_clear_interrupt (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u32 tmp; - - tmp =rtl_read_dword (rtlpriv,REG_HISR ); -rtl_write_dword (rtlpriv,REG_HISR , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HISRE ); -rtl_write_dword (rtlpriv,REG_HISRE , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HSISR ); -rtl_write_dword (rtlpriv,REG_HSISR , tmp); -} -void rtl92ee_enable_interrupt (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw)); -rtl92ee_clear_interrupt (hw);/*clear it here first*/ -rtl_write_dword (rtlpriv,REG_HIMR , rtlpci->irq_mask[0 ] &0xFFFFFFFF );rtl_write_dword (rtlpriv,REG_HIMRE , rtlpci->irq_mask[1 ] &0xFFFFFFFF ); rtlpci->irq_enabled = true;
drivers/net/wireless/rtlwifi/rtl8723ae/hw.c +0 -13
@@ -1258,18 +1258,6 @@ void rtl8723e_set_qos(struct ieee80211_h } } -static void rtl8723e_clear_interrupt (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u32 tmp; - - tmp =rtl_read_dword (rtlpriv,REG_HISR ); -rtl_write_dword (rtlpriv,REG_HISR , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HISRE ); -rtl_write_dword (rtlpriv,REG_HISRE , tmp); -} -void rtl8723e_enable_interrupt (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -1284,7 +1272,6 @@ void rtl8723e_disable_interrupt(struct i {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw)); -rtl8723e_clear_interrupt (hw);/*clear it here first*/ rtl_write_dword (rtlpriv,0x3a8 ,IMR8190_DISABLED );rtl_write_dword (rtlpriv,0x3ac ,IMR8190_DISABLED ); rtlpci->irq_enabled = false;
drivers/net/wireless/rtlwifi/rtl8723be/hw.c +0 -17
@@ -1634,28 +1634,11 @@ void rtl8723be_set_qos(struct ieee80211_ } } -static void rtl8723be_clear_interrupt (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u32 tmp; - - tmp =rtl_read_dword (rtlpriv,REG_HISR ); -rtl_write_dword (rtlpriv,REG_HISR , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HISRE ); -rtl_write_dword (rtlpriv,REG_HISRE , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HSISR ); -rtl_write_dword (rtlpriv,REG_HSISR , tmp); -} -void rtl8723be_enable_interrupt (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw)); -rtl8723be_clear_interrupt (hw);/*clear it here first*/ -rtl_write_dword (rtlpriv,REG_HIMR , rtlpci->irq_mask[0 ] &0xFFFFFFFF );rtl_write_dword (rtlpriv,REG_HIMRE , rtlpci->irq_mask[1 ] &0xFFFFFFFF ); rtlpci->irq_enabled = true;
drivers/net/wireless/rtlwifi/rtl8821ae/hw.c +0 -20
@@ -2253,31 +2253,11 @@ void rtl8821ae_set_qos(struct ieee80211_ } } -static void rtl8821ae_clear_interrupt (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u32 tmp; - tmp =rtl_read_dword (rtlpriv,REG_HISR ); -/*printk("clear interrupt first:\n"); -printk("0x%x = 0x%08x\n",REG_HISR, tmp);*/ -rtl_write_dword (rtlpriv,REG_HISR , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HISRE ); -/*printk("0x%x = 0x%08x\n",REG_HISRE, tmp);*/ -rtl_write_dword (rtlpriv,REG_HISRE , tmp); - - tmp =rtl_read_dword (rtlpriv,REG_HSISR ); -/*printk("0x%x = 0x%08x\n",REG_HSISR, tmp);*/ -rtl_write_dword (rtlpriv,REG_HSISR , tmp); -} -void rtl8821ae_enable_interrupt (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw)); -rtl8821ae_clear_interrupt (hw);/*clear it here first*/ -rtl_write_dword (rtlpriv,REG_HIMR , rtlpci->irq_mask[0 ] &0xFFFFFFFF );rtl_write_dword (rtlpriv,REG_HIMRE , rtlpci->irq_mask[1 ] &0xFFFFFFFF ); rtlpci->irq_enabled = true;
Greg Kroah-Hartman
maintainerPATCH 23/267 ieee802154: Fix sockaddr_ieee802154 implicit padding information leak.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennert Buytenhek <[email protected]>
commit 8a70cefa3037d62e7c0b6068a66675def1a330c9 upstream.
The AF_IEEE802154 sockaddr looks like this:
struct sockaddr_ieee802154 {
sa_family_t family; /* AF_IEEE802154 */
struct ieee802154_addr_sa addr;
};
struct ieee802154_addr_sa {
int addr_type;
u16 pan_id;
union {
u8 hwaddr[IEEE802154_ADDR_LEN];
u16 short_addr;
};
};On most architectures there will be implicit structure padding here, in two different places:
* In struct sockaddr_ieee802154, two bytes of padding between 'family' (unsigned short) and 'addr', so that 'addr' starts on a four byte boundary.
* In struct ieee802154_addr_sa, two bytes at the end of the structure, to make the structure 16 bytes.
When calling recvmsg(2) on a PF_IEEE802154 SOCK_DGRAM socket, the ieee802154 stack constructs a struct sockaddr_ieee802154 on the kernel stack without clearing these padding fields, and, depending on the addr_type, between four and ten bytes of uncleared kernel stack will be copied to userspace.
We can't just insert two 'u16 __pad's in the right places and zero those before copying an address to userspace, as not all architectures insert this implicit padding -- from a quick test it seems that avr32, cris and m68k don't insert this padding, while every other architecture that I have cross compilers for does insert this padding.
The easiest way to plug the leak is to just memset the whole struct sockaddr_ieee802154 before filling in the fields we want to fill in, and that's what this patch does.
--- net/ieee802154/socket.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ieee802154/socket.c +6 -0
@@ -739,6 +739,12 @@ static int dgram_recvmsg(struct sock *sksock_recv_ts_and_drops (msg, sk, skb);if (saddr) { +/* Clear the implicit padding in struct sockaddr_ieee802154 +* (16 bits between 'family' and 'addr') and in struct +* ieee802154_addr_sa (16 bits at the end of the structure). +*/ +memset (saddr,0 ,sizeof (*saddr)); + saddr->family =AF_IEEE802154 ;ieee802154_addr_to_sa (&saddr->addr, &mac_cb (skb)->source); *addr_len =sizeof (*saddr);
Greg Kroah-Hartman
maintainerPATCH 24/267 staging: vt6656: check ieee80211_bss_conf bssid not NULL
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit d309509f84725f99326cc73d3b00aae096b374ae upstream.
Sometimes bssid can go null on failed association.
--- drivers/staging/vt6656/main_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -1
@@ -701,7 +701,7 @@ static void vnt_bss_info_changed(struct priv->current_aid = conf->aid; -if (changed &BSS_CHANGED_BSSID ) +if (changed &BSS_CHANGED_BSSID && conf->bssid)vnt_mac_set_bssid_addr (priv, (u8 *)conf->bssid);
Greg Kroah-Hartman
maintainerPATCH 25/267 staging: vt6655: check ieee80211_bss_conf bssid not NULL
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 8e8e9198920ddfa920191069ae02eba75d39e653 upstream.
Sometimes bssid can go null on failed association.
--- drivers/staging/vt6655/device_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/device_main.c +1 -1
@@ -1417,7 +1417,7 @@ static void vnt_bss_info_changed(struct priv->current_aid = conf->aid; -if (changed &BSS_CHANGED_BSSID ) { +if (changed &BSS_CHANGED_BSSID && conf->bssid) {unsigned long flags;spin_lock_irqsave (&priv->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 26/267 staging: vt6655: device_rx_srv check sk_buff is NULL
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit b5eeed8cb6097c8ea660b6598d36fdbb94065a22 upstream.
There is a small chance that pRD->pRDInfo->skb could go NULL while the interrupt is processing.
Put NULL check on loop to break out.
--- drivers/staging/vt6655/device_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/vt6655/device_main.c +4 -0
@@ -807,6 +807,10 @@ static int device_rx_srv(struct vnt_priv pRD = pRD->next) {if (works++ >15 )break ; + +if (!pRD->pRDInfo->skb) +break ; +if (vnt_receive_frame (pDevice, pRD)) {if (!device_alloc_rx_buf (pDevice, pRD)) { dev_err(&pDevice->pcid->dev,
Greg Kroah-Hartman
maintainerPATCH 27/267 staging: rtl8712: prevent buffer overrun in recvbuf2recvframe
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haggai Eran <[email protected]>
commit cab462140f8a183e3cca0b51c8b59ef715cb6148 upstream.
With an RTL8191SU USB adaptor, sometimes the hints for a fragmented packet are set, but the packet length is too large. Allocate enough space to prevent memory corruption and a resulting kernel panic [1].
[1] http://www.spinics.net/lists/linux-wireless/msg136546.html
--- drivers/staging/rtl8712/rtl8712_recv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8712/rtl8712_recv.c +2 -1
@@ -1056,7 +1056,8 @@ static int recvbuf2recvframe(struct _ada/* for first fragment packet, driver need allocate 1536 + * drvinfo_sz + RXDESC_SIZE to defrag packet. */ if ((mf ==1 ) && (frag ==0 )) - alloc_sz =1658 ;/*1658+6=1664, 1664 is 128 alignment.*/ +/*1658+6=1664, 1664 is 128 alignment.*/ + alloc_sz =max_t (u16, tmp_len,1658 );else alloc_sz = tmp_len;/* 2 is for IP header 4 bytes alignment in QoS packet case.
Greg Kroah-Hartman
maintainerPATCH 28/267 staging: comedi: cb_pcimdas: fix handlers for DI and DO subdevices
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit b08ad6657aacf9b5d7c4b22de2ba891b152d0528 upstream.
Normally, low-level Comedi drivers set an insn_bits handler for digital input (DI), digital output (DO) and digital input/output (DIO) subdevice types to handle normal reading and writing of digital channels. The "cb_pcimdas" driver currently has an insn_read handler for the DI subdevice and an insn_write handler for the DO subdevice. However, the actual handler functions cb_pcimdas_di_insn_read() and cb_pcimdas_do_insn_write() are written to behave like insn_bits handlers. Something's wrong there! To fix it, set the functions as insn_bits handlers and rename them for consistency.
--- drivers/staging/comedi/drivers/cb_pcimdas.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/comedi/drivers/cb_pcimdas.c +4 -4
@@ -243,7 +243,7 @@ static int cb_pcimdas_ao_insn_write(strureturn insn->n; } -static int cb_pcimdas_di_insn_read (struct comedi_device *dev, +static int cb_pcimdas_di_insn_bits (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
@@ -258,7 +258,7 @@ static int cb_pcimdas_di_insn_read(strucreturn insn->n; } -static int cb_pcimdas_do_insn_write (struct comedi_device *dev, +static int cb_pcimdas_do_insn_bits (struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
@@ -424,7 +424,7 @@ static int cb_pcimdas_auto_attach(struct s->n_chan =4 ; s->maxdata =1 ; s->range_table = &range_digital; - s->insn_read = cb_pcimdas_di_insn_read; + s->insn_bits = cb_pcimdas_di_insn_bits;/* Digital Output subdevice (main connector) */ s = &dev->subdevices[4 ];
@@ -433,7 +433,7 @@ static int cb_pcimdas_auto_attach(struct s->n_chan =4 ; s->maxdata =1 ; s->range_table = &range_digital; - s->insn_write = cb_pcimdas_do_insn_write; + s->insn_bits = cb_pcimdas_do_insn_bits;/* Counter subdevice (8254) */ s = &dev->subdevices[5 ];
Greg Kroah-Hartman
maintainerPATCH 29/267 hid-sensor: Fix suspend/resume delay
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
commit 1e25aa9641e8f3fa39cd5e46b4afcafd7f12a44b upstream.
By default all the sensors are runtime suspended state (lowest power state). During Linux suspend process, all the run time suspended devices are resumed and then suspended. This caused all sensors to power up and introduced delay in suspend time, when we introduced runtime PM for HID sensors. The opposite process happens during resume process.
To fix this, we do powerup process of the sensors only when the request is issued from user (raw or tiggerred). In this way when runtime, resume calls for powerup it will simply return as this will not match user requested state.
Note this is a regression fix as the increase in suspend / resume times can be substantial (report of 8 seconds on Len's laptop!)
--- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 11 ++++++++++- include/linux/hid-sensor-hub.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +10 -1
@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(strucs32 poll_value =0 ;if (state) { +if (!atomic_read (&st->user_requested_state)) +return 0 ;if (sensor_hub_device_open (st->hsdev))return -EIO ;
@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struc poll_value =hid_sensor_read_poll_value (st); }else { -if (!atomic_dec_and_test (&st->data_ready)) +int val; + + val =atomic_dec_if_positive (&st->data_ready); +if (val <0 )return 0 ; +sensor_hub_device_close (st->hsdev); state_val = hid_sensor_get_usage_index(st->hsdev, st->power_state.report_id,
@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state);int hid_sensor_power_state (struct hid_sensor_common *st,bool state) { +#ifdef CONFIG_PM int ret; +atomic_set (&st->user_requested_state, state);if (state) ret =pm_runtime_get_sync (&st->pdev->dev);else {
@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sereturn 0 ;#else +atomic_set (&st->user_requested_state, state);return _hid_sensor_power_state (st, state);#endif }
include/linux/hid-sensor-hub.h +1 -0
@@ -230,6 +230,7 @@ struct hid_sensor_common {struct platform_device *pdev;unsigned usage_id;atomic_t data_ready; +atomic_t user_requested_state;struct iio_trigger *trigger;struct hid_sensor_hub_attribute_info poll;struct hid_sensor_hub_attribute_info report_state;
Greg Kroah-Hartman
maintainerPATCH 30/267 ext4: fix race between truncate and __ext4_journalled_writepage()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit bdf96838aea6a265f2ae6cbcfb12a778c84a0b8e upstream.
The commit cf108bca465d: "ext4: Invert the locking order of page_lock and transaction start" caused __ext4_journalled_writepage() to drop the page lock before the page was written back, as part of changing the locking order to jbd2_journal_start -> page_lock. However, this introduced a potential race if there was a truncate racing with the data=journalled writeback mode.
Fix this by grabbing the page lock after starting the journal handle, and then checking to see if page had gotten truncated out from under us.
This fixes a number of different warnings or BUG_ON's when running xfstests generic/086 in data=journalled mode, including:
jbd2_journal_dirty_metadata: vdc-8: bad jh for block 115643: transaction (ee3fe7 c0, 164), jh->b_transaction ( (null), 0), jh->b_next_transaction ( (null), 0), jlist 0
- and -
kernel BUG at /usr/projects/linux/ext4/fs/jbd2/transaction.c:2200!
... Call Trace: [<c02b2ded>] ? __ext4_journalled_invalidatepage+0x117/0x117 [<c02b2de5>] __ext4_journalled_invalidatepage+0x10f/0x117 [<c02b2ded>] ? __ext4_journalled_invalidatepage+0x117/0x117 [<c027d883>] ? lock_buffer+0x36/0x36 [<c02b2dfa>] ext4_journalled_invalidatepage+0xd/0x22 [<c0229139>] do_invalidatepage+0x22/0x26 [<c0229198>] truncate_inode_page+0x5b/0x85 [<c022934b>] truncate_inode_pages_range+0x156/0x38c [<c0229592>] truncate_inode_pages+0x11/0x15 [<c022962d>] truncate_pagecache+0x55/0x71 [<c02b913b>] ext4_setattr+0x4a9/0x560 [<c01ca542>] ? current_kernel_time+0x10/0x44 [<c026c4d8>] notify_change+0x1c7/0x2be [<c0256a00>] do_truncate+0x65/0x85 [<c0226f31>] ? file_ra_state_init+0x12/0x29
- and -
WARNING: CPU: 1 PID: 1331 at /usr/projects/linux/ext4/fs/jbd2/transaction.c:1396
irty_metadata+0x14a/0x1ae()
...
Call Trace:
[<c01b879f>] ? console_unlock+0x3a1/0x3ce
[<c082cbb4>] dump_stack+0x48/0x60
[<c0178b65>] warn_slowpath_common+0x89/0xa0
[<c02ef2cf>] ? jbd2_journal_dirty_metadata+0x14a/0x1ae
[<c0178bef>] warn_slowpath_null+0x14/0x18
[<c02ef2cf>] jbd2_journal_dirty_metadata+0x14a/0x1ae
[<c02d8615>] __ext4_handle_dirty_metadata+0xd4/0x19d
[<c02b2f44>] write_end_fn+0x40/0x53
[<c02b4a16>] ext4_walk_page_buffers+0x4e/0x6a
[<c02b59e7>] ext4_writepage+0x354/0x3b8
[<c02b2f04>] ? mpage_release_unused_pages+0xd4/0xd4
[<c02b1b21>] ? wait_on_buffer+0x2c/0x2c
[<c02b5a4b>] ? ext4_writepage+0x3b8/0x3b8
[<c02b5a5b>] __writepage+0x10/0x2e
[<c0225956>] write_cache_pages+0x22d/0x32c
[<c02b5a4b>] ? ext4_writepage+0x3b8/0x3b8
[<c02b6ee8>] ext4_writepages+0x102/0x607
[<c019adfe>] ? sched_clock_local+0x10/0x10e
[<c01a8a7c>] ? __lock_is_held+0x2e/0x44
[<c01a8ad5>] ? lock_is_held+0x43/0x51
[<c0226dff>] do_writepages+0x1c/0x29
[<c0276bed>] __writeback_single_inode+0xc3/0x545
[<c0277c07>] writeback_sb_inodes+0x21f/0x36d
...--- fs/ext4/inode.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
fs/ext4/inode.c +19 -4
@@ -1701,19 +1701,32 @@ static int __ext4_journalled_writepage(sext4_walk_page_buffers (handle, page_bufs,0 , len,NULL , bget_one); } -/* As soon as we unlock the page, it can go away, but we have -* references to buffers so we are safe */ +/* +* We need to release the page lock before we start the +* journal, so grab a reference so the page won't disappear +* out from under us. +*/ +get_page (page);unlock_page (page); handle =ext4_journal_start (inode,EXT4_HT_WRITE_PAGE ,ext4_writepage_trans_blocks (inode));if (IS_ERR (handle)) { ret =PTR_ERR (handle); - goto out; +put_page (page); + goto out_no_pagelock; } -BUG_ON (!ext4_handle_valid (handle)); +lock_page (page); +put_page (page); +if (page->mapping != mapping) { +/* The page got truncated from under us */ +ext4_journal_stop (handle); + ret =0 ; + goto out; + } +if (inline_data) {BUFFER_TRACE (inode_bh,"get write access" ); ret =ext4_journal_get_write_access (handle, inode_bh);
@@ -1739,6 +1752,8 @@ static int __ext4_journalled_writepage(s NULL, bput_one);ext4_set_inode_state (inode,EXT4_STATE_JDATA ); out: +unlock_page (page); +out_no_pagelock:brelse (inode_bh);return ret; }
Greg Kroah-Hartman
maintainerPATCH 31/267 ext4: call sync_blockdev() before invalidate_bdev() in put_super()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 89d96a6f8e6491f24fc8f99fd6ae66820e85c6c1 upstream.
Normally all of the buffers will have been forced out to disk before we call invalidate_bdev(), but there will be some cases, where a file system operation was aborted due to an ext4_error(), where there may still be some dirty buffers in the buffer cache for the device. So try to force them out to memory before calling invalidate_bdev().
This fixes a warning triggered by generic/081:
WARNING: CPU: 1 PID: 3473 at /usr/projects/linux/ext4/fs/block_dev.c:56 __blkdev_put+0xb5/0x16f()
--- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/super.c +1 -0
@@ -807,6 +807,7 @@ static void ext4_put_super(struct super_dump_orphan_list (sb, sbi);J_ASSERT (list_empty (&sbi->s_orphan)); +sync_blockdev (sb->s_bdev);invalidate_bdev (sb->s_bdev);if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) {/*
Greg Kroah-Hartman
maintainerPATCH 32/267 ext4: dont retry file block mapping on bigalloc fs with non-extent file
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 292db1bc6c105d86111e858859456bcb11f90f91 upstream.
ext4 isn't willing to map clusters to a non-extent file. Don't signal this with an out of space error, since the FS will retry the allocation (which didn't fail) forever. Instead, return EUCLEAN so that the operation will fail immediately all the way back to userspace.
(The fix is either to run e2fsck -E bmap2extent, or to chattr +e the file.)
--- fs/ext4/indirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/indirect.c +1 -1
@@ -565,7 +565,7 @@ int ext4_ind_map_blocks(handle_t *handle EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {EXT4_ERROR_INODE (inode,"Can't allocate blocks for " "non-extent mapped inodes with bigalloc" ); -return -ENOSPC ; +return -EUCLEAN ; }/* Set up for the direct block allocation */
Greg Kroah-Hartman
maintainerPATCH 33/267 ext4: set lazytime on remount if MS_LAZYTIME is set by mount
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit a2fd66d069d86d793e9d39d4079b96f46d13f237 upstream.
Newer versions of mount parse the lazytime feature and pass it to the mount system call via the flags field in the mount system call, removing the lazytime string from the mount options list. So we need to check for the presence of MS_LAZYTIME and set it in sb->s_flags in order for this flag to be set on a remount.
--- fs/ext4/super.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/super.c +3 -0
@@ -4944,6 +4944,9 @@ static int ext4_remount(struct super_bloset_task_ioprio (sbi->s_journal->j_task, journal_ioprio); } +if (*flags &MS_LAZYTIME ) + sb->s_flags |=MS_LAZYTIME ; +if ((*flags &MS_RDONLY ) != (sb->s_flags &MS_RDONLY )) {if (sbi->s_mount_flags &EXT4_MF_FS_ABORTED ) { err = -EROFS ;
Greg Kroah-Hartman
maintainerPATCH 34/267 ext4: fix fencepost error in lazytime optimization
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 0f0ff9a9f3fa2ec6f427603fd521d5f3a0b076d1 upstream.
Commit 8f4d8558391: "ext4: fix lazytime optimization" was not a complete fix. In the case where the inode number is a multiple of 16, and we could still end up updating an inode with dirty timestamps written to the wrong inode on disk. Oops.
This can be easily reproduced by using generic/005 with a file system with metadata_csum and lazytime enabled.
--- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ext4/inode.c +6 -1
@@ -4360,7 +4360,12 @@ static void ext4_update_other_inodes_timint inode_size =EXT4_INODE_SIZE (sb); oi.orig_ino = orig_ino; - ino = (orig_ino & ~(inodes_per_block -1 )) +1 ; +/* +* Calculate the first inode in the inode table block. Inode +* numbers are one-based. That is, the first inode in a block +* (assuming 4k blocks and 256 byte inodes) is (n*16 + 1). +*/ + ino = ((orig_ino -1 ) & ~(inodes_per_block -1 )) +1 ;for (i =0 ; i < inodes_per_block; i++, ino++, buf += inode_size) {if (ino == orig_ino)continue ;
Greg Kroah-Hartman
maintainerPATCH 35/267 bufferhead: Add _gfp version for sb_getblk()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit bd7ade3cd9b0850264306f5c2b79024a417b6396 upstream.
sb_getblk() is used during ext4 (and possibly other FSes) writeback paths. Sometimes such path require allocating memory and guaranteeing that such allocation won't block. Currently, however, there is no way to provide user flags for sb_getblk which could lead to deadlocks.
This patch implements a sb_getblk_gfp with the only difference it can accept user-provided GFP flags.
--- include/linux/buffer_head.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/buffer_head.h +7 -0
@@ -317,6 +317,13 @@ sb_getblk(struct super_block *sb, sectorreturn __getblk_gfp (sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE); } + +static inline struct buffer_head * +sb_getblk_gfp (struct super_block *sb,sector_t block,gfp_t gfp) +{ +return __getblk_gfp (sb->s_bdev, block, sb->s_blocksize, gfp); +} +static inline struct buffer_head *sb_find_get_block (struct super_block *sb,sector_t block) {
Greg Kroah-Hartman
maintainerPATCH 36/267 ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit c45653c341f5c8a0ce19c8f0ad4678640849cb86 upstream.
Switch ext4 to using sb_getblk_gfp with GFP_NOFS added to fix possible deadlocks in the page writeback path.
--- fs/ext4/extents.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/extents.c +3 -3
@@ -503,7 +503,7 @@ __read_extent_tree_block(const char *funstruct buffer_head *bh;int err; - bh =sb_getblk (inode->i_sb, pblk); + bh =sb_getblk_gfp (inode->i_sb, pblk, __GFP_MOVABLE |GFP_NOFS );if (unlikely (!bh))return ERR_PTR (-ENOMEM );
@@ -1088,7 +1088,7 @@ static int ext4_ext_split(handle_t *hand err = -EIO ; goto cleanup; } - bh =sb_getblk (inode->i_sb, newblock); + bh =sb_getblk_gfp (inode->i_sb, newblock, __GFP_MOVABLE |GFP_NOFS );if (unlikely (!bh)) { err = -ENOMEM ; goto cleanup;
@@ -1282,7 +1282,7 @@ static int ext4_ext_grow_indepth(handle_if (newblock ==0 )return err; - bh =sb_getblk (inode->i_sb, newblock); + bh =sb_getblk_gfp (inode->i_sb, newblock, __GFP_MOVABLE |GFP_NOFS );if (unlikely (!bh))return -ENOMEM ;lock_buffer (bh);
Greg Kroah-Hartman
maintainerPATCH 37/267 ext4: fix reservation release on invalidatepage for delalloc fs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 9705acd63b125dee8b15c705216d7186daea4625 upstream.
On delalloc enabled file system on invalidatepage operation in ext4_da_page_release_reservation() we want to clear the delayed buffer and remove the extent covering the delayed buffer from the extent status tree.
However currently there is a bug where on the systems with page size > block size we will always remove extents from the start of the page regardless where the actual delayed buffers are positioned in the page. This leads to the errors like this:
EXT4-fs warning (device loop0): ext4_da_release_space:1225:ext4_da_release_space: ino 13, to_free 1 with only 0 reserved data blocks
This however can cause data loss on writeback time if the file system is in ENOSPC condition because we're releasing reservation for someones else delayed buffer.
Fix this by only removing extents that corresponds to the part of the page we want to invalidate.
This problem is reproducible by the following fio receipt (however I was only able to reproduce it with fio-2.1 or older.
[global]
bs=8k
iodepth=1024
iodepth_batch=60
randrepeat=1
size=1m
directory=/mnt/test
numjobs=20
[job1]
ioengine=sync
bs=1k
direct=1
rw=randread
filename=file1:file2
[job2]
ioengine=libaio
rw=randwrite
direct=1
filename=file1:file2
[job3]
bs=1k
ioengine=posixaio
rw=randwrite
direct=1
filename=file1:file2
[job5]
bs=1k
ioengine=sync
rw=randread
filename=file1:file2
[job7]
ioengine=libaio
rw=randwrite
filename=file1:file2
[job8]
ioengine=posixaio
rw=randwrite
filename=file1:file2
[job10]
ioengine=mmap
rw=randwrite
bs=1k
filename=file1:file2
[job11]
ioengine=mmap
rw=randwrite
direct=1
filename=file1:file2
--- fs/ext4/inode.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
fs/ext4/inode.c +12 -3
@@ -1342,7 +1342,7 @@ static void ext4_da_page_release_reservaunsigned int offset, unsigned int length) { - int to_release = 0; + int to_release = 0, contiguous_blks = 0;struct buffer_head *head, *bh;unsigned int curr_off =0 ;struct inode *inode = page->mapping->host;
@@ -1363,14 +1363,23 @@ static void ext4_da_page_release_reservaif ((offset <= curr_off) && (buffer_delay (bh))) { to_release++; + contiguous_blks++;clear_buffer_delay (bh); + }else if (contiguous_blks) { + lblk = page->index << + (PAGE_CACHE_SHIFT - inode->i_blkbits); + lblk += (curr_off >> inode->i_blkbits) - + contiguous_blks; +ext4_es_remove_extent (inode, lblk, contiguous_blks); + contiguous_blks =0 ; } curr_off = next_off; }while ((bh = bh->b_this_page) != head); -if (to_release) { +if (contiguous_blks) { lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); -ext4_es_remove_extent (inode, lblk, to_release); + lblk += (curr_off >> inode->i_blkbits) - contiguous_blks; +ext4_es_remove_extent (inode, lblk, contiguous_blks); }/* If we have released all the blocks belonging to a cluster, then we
Greg Kroah-Hartman
maintainerPATCH 38/267 ext4: be more strict when migrating to non-extent based file
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eryu Guan <[email protected]>
commit d6f123a9297496ad0b6335fe881504c4b5b2a5e5 upstream.
Currently the check in ext4_ind_migrate() is not enough before doing the real conversion:
a) delayed allocated extents could bypass the check on eh->eh_entries and eh->eh_depth
This can be demonstrated by this script
xfs_io -fc "pwrite 0 4k" -c "pwrite 8k 4k" /mnt/ext4/testfile chattr -e /mnt/ext4/testfile
where testfile has two extents but still be converted to non-extent based file format.
b) only extent length is checked but not the offset, which would result in data lose (delalloc) or fs corruption (nodelalloc), because non-extent based file only supports at most (12 + 2^10 + 2^20 + 2^30) blocks
This can be demostrated by
xfs_io -fc "pwrite 5T 4k" /mnt/ext4/testfile
chattr -e /mnt/ext4/testfile
sync
If delalloc is enabled, dmesg prints
EXT4-fs warning (device dm-4): ext4_block_to_path:105: block 1342177280 > max in inode 53
EXT4-fs (dm-4): Delayed block allocation failed for inode 53 at logical offset 1342177280 with max blocks 1 with error 5 EXT4-fs (dm-4): This should not happen!! Data will be lost
If delalloc is disabled, e2fsck -nf shows corruption
Inode 53, i_size is 5497558142976, should be 4096. Fix? no
Fix the two issues by
a) forcing all delayed allocation blocks to be allocated before checking eh->eh_depth and eh->eh_entries
b) limiting the last logical block of the extent is within direct map
--- fs/ext4/migrate.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ext4/migrate.c +11 -1
@@ -620,6 +620,7 @@ int ext4_ind_migrate(struct inode *inodestruct ext4_inode_info *ei =EXT4_I (inode);struct ext4_extent *ex;unsigned int i, len; +ext4_lblk_t end;ext4_fsblk_t blk;handle_t *handle;int ret;
@@ -633,6 +634,14 @@ int ext4_ind_migrate(struct inode *inode EXT4_FEATURE_RO_COMPAT_BIGALLOC))return -EOPNOTSUPP ; +/* +* In order to get correct extent info, force all delayed allocation +* blocks to be allocated, otherwise delayed allocation blocks may not +* be reflected and bypass the checks on extent header. +*/ +if (test_opt (inode->i_sb,DELALLOC )) +ext4_alloc_da_blocks (inode); + handle =ext4_journal_start (inode,EXT4_HT_MIGRATE ,1 );if (IS_ERR (handle))return PTR_ERR (handle);
@@ -654,7 +663,8 @@ int ext4_ind_migrate(struct inode *inodeelse { len =le16_to_cpu (ex->ee_len); blk =ext4_ext_pblock (ex); -if (len >EXT4_NDIR_BLOCKS ) { + end =le32_to_cpu (ex->ee_block) + len -1 ; +if (end >=EXT4_NDIR_BLOCKS ) { ret = -EOPNOTSUPP ; goto errout; }
Greg Kroah-Hartman
maintainerPATCH 39/267 ext4: correctly migrate a file with a hole at the beginning
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eryu Guan <[email protected]>
commit 8974fec7d72e3e02752fe0f27b4c3719c78d9a15 upstream.
Currently ext4_ind_migrate() doesn't correctly handle a file which contains a hole at the beginning of the file. This caused the migration to be done incorrectly, and then if there is a subsequent following delayed allocation write to the "hole", this would reclaim the same data blocks again and results in fs corruption.
# assmuing 4k block size ext4, with delalloc enabled # skip the first block and write to the second block xfs_io -fc "pwrite 4k 4k" -c "fsync" /mnt/ext4/testfile
# converting to indirect-mapped file, which would move the data blocks # to the beginning of the file, but extent status cache still marks # that region as a hole chattr -e /mnt/ext4/testfile
# delayed allocation writes to the "hole", reclaim the same data block # again, results in i_blocks corruption xfs_io -c "pwrite 0 4k" /mnt/ext4/testfile umount /mnt/ext4 e2fsck -nf /dev/sda6 ... Inode 53, i_blocks is 16, should be 8. Fix? no ...
--- fs/ext4/migrate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/ext4/migrate.c +5 -4
@@ -620,7 +620,7 @@ int ext4_ind_migrate(struct inode *inodestruct ext4_inode_info *ei =EXT4_I (inode);struct ext4_extent *ex;unsigned int i, len; -ext4_lblk_t end; +ext4_lblk_t start, end;ext4_fsblk_t blk;handle_t *handle;int ret;
@@ -659,11 +659,12 @@ int ext4_ind_migrate(struct inode *inode goto errout; }if (eh->eh_entries ==0 ) - blk = len =0 ; + blk = len = start = end =0 ;else { len =le16_to_cpu (ex->ee_len); blk =ext4_ext_pblock (ex); - end =le32_to_cpu (ex->ee_block) + len -1 ; + start =le32_to_cpu (ex->ee_block); + end = start + len -1 ;if (end >=EXT4_NDIR_BLOCKS ) { ret = -EOPNOTSUPP ; goto errout;
@@ -672,7 +673,7 @@ int ext4_ind_migrate(struct inode *inodeext4_clear_inode_flag (inode,EXT4_INODE_EXTENTS );memset (ei->i_data,0 ,sizeof (ei->i_data)); -for (i=0 ; i < len; i++) +for (i = start; i <= end; i++) ei->i_data[i] =cpu_to_le32 (blk++);ext4_mark_inode_dirty (handle, inode); errout:
Greg Kroah-Hartman
maintainerPATCH 40/267 ext4: replace open coded nofail allocation in ext4_free_blocks()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 7444a072c387a93ebee7066e8aee776954ab0e41 upstream.
ext4_free_blocks is looping around the allocation request and mimics __GFP_NOFAIL behavior without any allocation fallback strategy. Let's remove the open coded loop and replace it with __GFP_NOFAIL. Without the flag the allocator has no way to find out never-fail requirement and cannot help in any way.
--- fs/ext4/mballoc.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
fs/ext4/mballoc.c +5 -11
@@ -4800,18 +4800,12 @@ do_more:/* * blocks being freed are metadata. these blocks shouldn't * be used until this transaction is committed +* +* We use __GFP_NOFAIL because ext4_free_blocks() is not allowed +* to fail. */ - retry: - new_entry =kmem_cache_alloc (ext4_free_data_cachep,GFP_NOFS ); -if (!new_entry) { -/* -* We use a retry loop because -* ext4_free_blocks() is not allowed to fail. -*/ -cond_resched (); -congestion_wait (BLK_RW_ASYNC ,HZ /50 ); - goto retry; - } + new_entry =kmem_cache_alloc (ext4_free_data_cachep, +GFP_NOFS |__GFP_NOFAIL); new_entry->efd_start_cluster = bit; new_entry->efd_group = block_group; new_entry->efd_count = count_clusters;
Greg Kroah-Hartman
maintainerPATCH 41/267 jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Monakhov <[email protected]>
commit b4f1afcd068f6e533230dfed00782cd8a907f96b upstream.
jbd2_cleanup_journal_tail() can be invoked by jbd2__journal_start() So allocations should be done with GFP_NOFS
[Full stack trace snipped from 3.10-rh7]
[<ffffffff815c4bd4>] dump_stack+0x19/0x1b [<ffffffff8105dba1>] warn_slowpath_common+0x61/0x80 [<ffffffff8105dcca>] warn_slowpath_null+0x1a/0x20 [<ffffffff815c2142>] slab_pre_alloc_hook.isra.31.part.32+0x15/0x17 [<ffffffff8119c045>] kmem_cache_alloc+0x55/0x210 [<ffffffff811477f5>] ? mempool_alloc_slab+0x15/0x20 [<ffffffff811477f5>] mempool_alloc_slab+0x15/0x20 [<ffffffff81147939>] mempool_alloc+0x69/0x170 [<ffffffff815cb69e>] ? _raw_spin_unlock_irq+0xe/0x20 [<ffffffff8109160d>] ? finish_task_switch+0x5d/0x150 [<ffffffff811f1a8e>] bio_alloc_bioset+0x1be/0x2e0 [<ffffffff8127ee49>] blkdev_issue_flush+0x99/0x120 [<ffffffffa019a733>] jbd2_cleanup_journal_tail+0x93/0xa0 [jbd2] -->GFP_KERNEL [<ffffffffa019aca1>] jbd2_log_do_checkpoint+0x221/0x4a0 [jbd2] [<ffffffffa019afc7>] __jbd2_log_wait_for_space+0xa7/0x1e0 [jbd2] [<ffffffffa01952d8>] start_this_handle+0x2d8/0x550 [jbd2] [<ffffffff811b02a9>] ? __memcg_kmem_put_cache+0x29/0x30 [<ffffffff8119c120>] ? kmem_cache_alloc+0x130/0x210 [<ffffffffa019573a>] jbd2__journal_start+0xba/0x190 [jbd2] [<ffffffff811532ce>] ? lru_cache_add+0xe/0x10 [<ffffffffa01c9549>] ? ext4_da_write_begin+0xf9/0x330 [ext4] [<ffffffffa01f2c77>] __ext4_journal_start_sb+0x77/0x160 [ext4] [<ffffffffa01c9549>] ext4_da_write_begin+0xf9/0x330 [ext4] [<ffffffff811446ec>] generic_file_buffered_write_iter+0x10c/0x270 [<ffffffff81146918>] __generic_file_write_iter+0x178/0x390 [<ffffffff81146c6b>] __generic_file_aio_write+0x8b/0xb0 [<ffffffff81146ced>] generic_file_aio_write+0x5d/0xc0 [<ffffffffa01bf289>] ext4_file_write+0xa9/0x450 [ext4] [<ffffffff811c31d9>] ? pipe_read+0x379/0x4f0 [<ffffffff811b93f0>] do_sync_write+0x90/0xe0 [<ffffffff811b9b6d>] vfs_write+0xbd/0x1e0 [<ffffffff811ba5b8>] SyS_write+0x58/0xb0 [<ffffffff815d4799>] system_call_fastpath+0x16/0x1b
--- fs/jbd2/checkpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/checkpoint.c +1 -1
@@ -405,7 +405,7 @@ int jbd2_cleanup_journal_tail(journal_t* jbd2_cleanup_journal_tail() doesn't get called all that often. */ if (journal->j_flags &JBD2_BARRIER ) -blkdev_issue_flush (journal->j_fs_dev,GFP_KERNEL ,NULL ); +blkdev_issue_flush (journal->j_fs_dev,GFP_NOFS ,NULL );__jbd2_update_log_tail (journal, first_tid, blocknr);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 42/267 jbd2: fix ocfs2 corrupt when updating journal superblock fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
commit 6f6a6fda294506dfe0e3e0a253bb2d2923f28f0a upstream.
If updating journal superblock fails after journal data has been flushed, the error is omitted and this will mislead the caller as a normal case. In ocfs2, the checkpoint will be treated successfully and the other node can get the lock to update. Since the sb_start is still pointing to the old log block, it will rewrite the journal data during journal recovery by the other node. Thus the new updates will be overwritten and ocfs2 corrupts. So in above case we have to return the error, and ocfs2_commit_cache will take care of the error and prevent the other node to do update first. And only after recovering journal it can do the new updates.
The issue discussion mail can be found at:
https://oss.oracle.com/pipermail/ocfs2-devel/2015-June/010856.html
http://comments.gmane.org/gmane.comp.file-systems.ext4/48841
[ Fixed bug in patch which allowed a non-negative error return from
jbd2_cleanup_journal_tail() to leak out of jbd2_fjournal_flush(); this was causing xfstests ext4/306 to fail. -- Ted ]
--- fs/jbd2/checkpoint.c | 5 ++--- fs/jbd2/journal.c | 38 +++++++++++++++++++++++++++++++------- include/linux/jbd2.h | 4 ++-- 3 files changed, 35 insertions(+), 12 deletions(-)
fs/jbd2/checkpoint.c +2 -3
@@ -390,7 +390,7 @@ int jbd2_cleanup_journal_tail(journal_tunsigned long blocknr;if (is_journal_aborted (journal)) -return 1 ; +return -EIO ;if (!jbd2_journal_get_log_tail (journal, &first_tid, &blocknr))return 1 ;
@@ -407,8 +407,7 @@ int jbd2_cleanup_journal_tail(journal_tif (journal->j_flags &JBD2_BARRIER )blkdev_issue_flush (journal->j_fs_dev,GFP_NOFS ,NULL ); -__jbd2_update_log_tail (journal, first_tid, blocknr); -return 0 ; +return __jbd2_update_log_tail (journal, first_tid, blocknr); }
fs/jbd2/journal.c +31 -7
@@ -885,9 +885,10 @@ int jbd2_journal_get_log_tail(journal_t* * Requires j_checkpoint_mutex */ -void __jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block) +int __jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block) {unsigned long freed; +int ret;BUG_ON (!mutex_is_locked (&journal->j_checkpoint_mutex));
@@ -897,7 +898,10 @@ void __jbd2_update_log_tail(journal_t *j* space and if we lose sb update during power failure we'd replay * old transaction with possibly newly overwritten data. */ -jbd2_journal_update_sb_log_tail (journal, tid, block,WRITE_FUA ); + ret =jbd2_journal_update_sb_log_tail (journal, tid, block,WRITE_FUA ); +if (ret) + goto out; +write_lock (&journal->j_state_lock); freed = block - journal->j_tail;if (block < journal->j_tail)
@@ -913,6 +917,9 @@ void __jbd2_update_log_tail(journal_t *j journal->j_tail_sequence = tid; journal->j_tail = block;write_unlock (&journal->j_state_lock); + +out: +return ret; }/*
@@ -1331,7 +1338,7 @@ static int journal_reset(journal_t *jourreturn jbd2_journal_start_thread (journal); } -static void jbd2_write_superblock (journal_t *journal,int write_op) +static int jbd2_write_superblock (journal_t *journal,int write_op) {struct buffer_head *bh = journal->j_sb_buffer;journal_superblock_t *sb = journal->j_superblock;
@@ -1370,7 +1377,10 @@ static void jbd2_write_superblock(journaprintk (KERN_ERR "JBD2: Error %d detected when updating " "journal superblock for %s.\n" , ret, journal->j_devname); +jbd2_journal_abort (journal, ret); } + +return ret; }/**
@@ -1383,10 +1393,11 @@ static void jbd2_write_superblock(journa* Update a journal's superblock information about log tail and write it to * disk, waiting for the IO to complete. */ -void jbd2_journal_update_sb_log_tail (journal_t *journal,tid_t tail_tid, +int jbd2_journal_update_sb_log_tail (journal_t *journal,tid_t tail_tid,unsigned long tail_block,int write_op) {journal_superblock_t *sb = journal->j_superblock; +int ret;BUG_ON (!mutex_is_locked (&journal->j_checkpoint_mutex)); jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n",
@@ -1395,13 +1406,18 @@ void jbd2_journal_update_sb_log_tail(jou sb->s_sequence =cpu_to_be32 (tail_tid); sb->s_start =cpu_to_be32 (tail_block); -jbd2_write_superblock (journal, write_op); + ret =jbd2_write_superblock (journal, write_op); +if (ret) + goto out;/* Log is no longer empty */ write_lock (&journal->j_state_lock);WARN_ON (!sb->s_sequence); journal->j_flags &= ~JBD2_FLUSHED ;write_unlock (&journal->j_state_lock); + +out: +return ret; }/**
@@ -1950,7 +1966,14 @@ int jbd2_journal_flush(journal_t *journareturn -EIO ;mutex_lock (&journal->j_checkpoint_mutex); -jbd2_cleanup_journal_tail (journal); +if (!err) { + err =jbd2_cleanup_journal_tail (journal); +if (err <0 ) { +mutex_unlock (&journal->j_checkpoint_mutex); + goto out; + } + err =0 ; + }/* Finally, mark the journal as really needing no recovery. * This sets s_start==0 in the underlying superblock, which is
@@ -1966,7 +1989,8 @@ int jbd2_journal_flush(journal_t *journaJ_ASSERT (journal->j_head == journal->j_tail);J_ASSERT (journal->j_tail_sequence == journal->j_transaction_sequence);write_unlock (&journal->j_state_lock); -return 0 ; +out: +return err; }/**
include/linux/jbd2.h +2 -2
@@ -1035,7 +1035,7 @@ struct buffer_head *jbd2_journal_get_desint jbd2_journal_next_log_block (journal_t *,unsigned long long *);int jbd2_journal_get_log_tail (journal_t *journal,tid_t *tid,unsigned long *block); -void __jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block); +int __jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block);void jbd2_update_log_tail (journal_t *journal,tid_t tid,unsigned long block);/* Commit management */
@@ -1157,7 +1157,7 @@ extern int jbd2_journal_recover (jextern int jbd2_journal_wipe (journal_t *,int );extern int jbd2_journal_skip_recovery (journal_t *);extern void jbd2_journal_update_sb_errno (journal_t *); -extern void jbd2_journal_update_sb_log_tail (journal_t *,tid_t , +extern int jbd2_journal_update_sb_log_tail (journal_t *,tid_t ,unsigned long ,int );extern void __jbd2_journal_abort_hard (journal_t *);extern void jbd2_journal_abort (journal_t *,int );
Greg Kroah-Hartman
maintainerPATCH 43/267 NFC: st21nfcb: Remove inappropriate kfree on a devm_kzalloc pointer
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Firo Yang <[email protected]>
commit 38bd83f04c5e9695011dc5c294e0c4e6a9f9052d upstream.
Since ndev->driver_data is allocated by devm_kzalloc(), we do not need the inappropriate kfree to free it in driver's remove function. Freeing will trigger when driver unloads.
--- drivers/nfc/st21nfcb/st21nfcb.c | 3 --- 1 file changed, 3 deletions(-)
drivers/nfc/st21nfcb/st21nfcb.c +0 -3
@@ -131,11 +131,8 @@ EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);void st21nfcb_nci_remove (struct nci_dev *ndev) { -struct st21nfcb_nci_info *info =nci_get_drvdata (ndev); -nci_unregister_device (ndev);nci_free_device (ndev); -kfree (info); }EXPORT_SYMBOL_GPL (st21nfcb_nci_remove);
Greg Kroah-Hartman
maintainerPATCH 44/267 NFC: st21nfcb: Do not remove header once the payload is sent
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Ricard <[email protected]>
commit 09f39a950523b1bb830c30a8670b77e0067da092 upstream.
Once the data is sent, we need to preserve the full frame for the ndlc state machine. If the NDLC ACK is not received in time, the ndlc layer will resend the same frame.
Having the header byte pulled will corrupt the frame.
--- drivers/nfc/st21nfcb/i2c.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/nfc/st21nfcb/i2c.c +0 -7
@@ -87,11 +87,6 @@ static void st21nfcb_nci_i2c_disable(voigpio_set_value (phy->gpio_reset,1 ); } -static void st21nfcb_nci_remove_header (struct sk_buff *skb) -{ -skb_pull (skb,ST21NFCB_FRAME_HEADROOM ); -} -/* * Writing a frame must not return the number of written bytes. * It must return either zero for success, or <0 for error.
@@ -121,8 +116,6 @@ static int st21nfcb_nci_i2c_write(void * r =0 ; } -st21nfcb_nci_remove_header (skb); -return r; }
Greg Kroah-Hartman
maintainerPATCH 45/267 NFC: st21nfcb: remove st21nfcb_nci_i2c_disable
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Ricard <[email protected]>
commit 4ac82e894825126816d7b7f662743335ce2b015e upstream.
ndlc_remove already calls st21nfcb_nci_i2c_disable and phy->powered is already set to 0.
--- drivers/nfc/st21nfcb/i2c.c | 3 --- 1 file changed, 3 deletions(-)
drivers/nfc/st21nfcb/i2c.c +0 -3
@@ -359,9 +359,6 @@ static int st21nfcb_nci_i2c_remove(strucndlc_remove (phy->ndlc); -if (phy->powered) -st21nfcb_nci_i2c_disable (phy); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 46/267 rtc: snvs: fix wakealarm by call enable_irq_wake earlier
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Agner <[email protected]>
commit 119434f44c78df8c4b6d67f835448542a4bd7e91 upstream.
When entering suspend while an wakeup alarm is set, enable_set_wake should make sure that the RTC interrupt keep being enabled and the .irq_set_wake for the RTC interrupt get called. However, since the driver uses the suspend_noirq callback, the call to enable_irq_wake has been made after disabling the interrupts. While .irq_set_wake has been called properly, the interrupt remained disabled.
Use the suspend callback to call enable_irq_wake early enough to ensure the RTC interrupt remains enabled.
--- drivers/rtc/rtc-snvs.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/rtc/rtc-snvs.c +21 -9
@@ -322,6 +322,13 @@ static int snvs_rtc_suspend(struct devicif (device_may_wakeup (dev))enable_irq_wake (data->irq); +return 0 ; +} + +static int snvs_rtc_suspend_noirq (struct device *dev) +{ +struct snvs_rtc_data *data =dev_get_drvdata (dev); +if (data->clk)clk_disable_unprepare (data->clk);
@@ -331,23 +338,28 @@ static int snvs_rtc_suspend(struct devicstatic int snvs_rtc_resume (struct device *dev) {struct snvs_rtc_data *data =dev_get_drvdata (dev); -int ret;if (device_may_wakeup (dev)) -disable_irq_wake (data->irq); +return disable_irq_wake (data->irq); -if (data->clk) { - ret =clk_prepare_enable (data->clk); -if (ret) -return ret; - } +return 0 ; +} + +static int snvs_rtc_resume_noirq (struct device *dev) +{ +struct snvs_rtc_data *data =dev_get_drvdata (dev); + +if (data->clk) +return clk_prepare_enable (data->clk);return 0 ; }static const struct dev_pm_ops snvs_rtc_pm_ops = { - .suspend_noirq = snvs_rtc_suspend, - .resume_noirq = snvs_rtc_resume, + .suspend = snvs_rtc_suspend, + .suspend_noirq = snvs_rtc_suspend_noirq, + .resume = snvs_rtc_resume, + .resume_noirq = snvs_rtc_resume_noirq, };#define SNVS_RTC_PM_OPS (&snvs_rtc_pm_ops)
Greg Kroah-Hartman
maintainerPATCH 47/267 i2c: at91: fix a race condition when using the DMA controller
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyrille Pitchen <[email protected]>
commit 93563a6a71bb69dd324fc7354c60fb05f84aae6b upstream.
For TX transactions, the TXCOMP bit in the Status Register is cleared when the first data is written into the Transmit Holding Register.
In the lines from at91_do_twi_transfer():at91_twi_write_data_dma(dev); at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP);
the TXCOMP interrupt may be enabled before the DMA controller has actually started to write into the THR. In such a case, the TXCOMP bit is still set into the Status Register so the interrupt is triggered immediately. The driver understands that a transaction completion has occurred but this transaction hasn't started yet. Hence the TXCOMP interrupt is no longer enabled by at91_do_twi_transfer() but instead by at91_twi_write_data_dma_callback().
Also, the TXCOMP bit in the Status Register in not a clear on read flag but a snapshot of the transmission state at the time the Status Register is read.
When a NACK error is dectected by the I2C controller, the TXCOMP, NACK and TXRDY bits are set together to 1 in the SR. If enabled, the TXCOMP interrupt is triggered at the same time. Also setting the TXRDY to 1 triggers the DMA controller to write the next data into the THR. Such a write resets the TXCOMP bit to 0 in the SR. So depending on when the interrupt handler reads the SR, it may fail to detect the NACK error if it relies on the TXCOMP bit. The NACK bit and its interrupt should be used instead.
For RX transactions, the TXCOMP bit in the Status Register is cleared when the START bit is set into the Control Register. However to unify the management of the TXCOMP bit when the DMA controller is used, the TXCOMP interrupt is now enabled by the DMA callbacks for both TX and RX transfers.
--- drivers/i2c/busses/i2c-at91.c | 70 +++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 17 deletions(-)
drivers/i2c/busses/i2c-at91.c +53 -17
@@ -65,6 +65,9 @@#define AT91_TWI_UNRE 0x0080/* Underrun Error */ #define AT91_TWI_NACK 0x0100/* Not Acknowledged */ +#define AT91_TWI_INT_MASK \ + (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK) +#define AT91_TWI_IER 0x0024/* Interrupt Enable Register */ #define AT91_TWI_IDR 0x0028/* Interrupt Disable Register */ #define AT91_TWI_IMR 0x002c/* Interrupt Mask Register */
@@ -119,13 +122,12 @@ static void at91_twi_write(struct at91_tstatic void at91_disable_twi_interrupts (struct at91_twi_dev *dev) { -at91_twi_write (dev,AT91_TWI_IDR , -AT91_TWI_TXCOMP |AT91_TWI_RXRDY |AT91_TWI_TXRDY ); +at91_twi_write (dev,AT91_TWI_IDR ,AT91_TWI_INT_MASK ); }static void at91_twi_irq_save (struct at91_twi_dev *dev) { - dev->imr =at91_twi_read (dev,AT91_TWI_IMR ) &0x7 ; + dev->imr =at91_twi_read (dev,AT91_TWI_IMR ) &AT91_TWI_INT_MASK ;at91_disable_twi_interrupts (dev); }
@@ -215,6 +217,14 @@ static void at91_twi_write_data_dma_calldma_unmap_single (dev->dev,sg_dma_address (&dev->dma.sg), dev->buf_len,DMA_TO_DEVICE ); +/* +* When this callback is called, THR/TX FIFO is likely not to be empty +* yet. So we have to wait for TXCOMP or NACK bits to be set into the +* Status Register to be sure that the STOP bit has been sent and the +* transfer is completed. The NACK interrupt has already been enabled, +* we just have to enable TXCOMP one. +*/ +at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_TXCOMP );at91_twi_write (dev,AT91_TWI_CR ,AT91_TWI_STOP ); }
@@ -309,7 +319,7 @@ static void at91_twi_read_data_dma_callb/* The last two bytes have to be read without using dma */ dev->buf += dev->buf_len -2 ; dev->buf_len =2 ; -at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_RXRDY ); +at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_RXRDY |AT91_TWI_TXCOMP ); }static void at91_twi_read_data_dma (struct at91_twi_dev *dev)
@@ -370,7 +380,7 @@ static irqreturn_t atmel_twi_interrupt(i/* catch error flags */ dev->transfer_status |= status; -if (irqstatus &AT91_TWI_TXCOMP ) { +if (irqstatus & (AT91_TWI_TXCOMP |AT91_TWI_NACK )) {at91_disable_twi_interrupts (dev);complete (&dev->cmd_complete); }
@@ -384,6 +394,34 @@ static int at91_do_twi_transfer(struct aunsigned long time_left;bool has_unre_flag = dev->pdata->has_unre_flag; +/* +* WARNING: the TXCOMP bit in the Status Register is NOT a clear on +* read flag but shows the state of the transmission at the time the +* Status Register is read. According to the programmer datasheet, +* TXCOMP is set when both holding register and internal shifter are +* empty and STOP condition has been sent. +* Consequently, we should enable NACK interrupt rather than TXCOMP to +* detect transmission failure. +* +* Besides, the TXCOMP bit is already set before the i2c transaction +* has been started. For read transactions, this bit is cleared when +* writing the START bit into the Control Register. So the +* corresponding interrupt can safely be enabled just after. +* However for write transactions managed by the CPU, we first write +* into THR, so TXCOMP is cleared. Then we can safely enable TXCOMP +* interrupt. If TXCOMP interrupt were enabled before writing into THR, +* the interrupt handler would be called immediately and the i2c command +* would be reported as completed. +* Also when a write transaction is managed by the DMA controller, +* enabling the TXCOMP interrupt in this function may lead to a race +* condition since we don't know whether the TXCOMP interrupt is enabled +* before or after the DMA has started to write into THR. So the TXCOMP +* interrupt is enabled later by at91_twi_write_data_dma_callback(). +* Immediately after in that DMA callback, we still need to send the +* STOP condition manually writing the corresponding bit into the +* Control Register. +*/ +dev_dbg (dev->dev,"transfer: %s %d bytes.\n" , (dev->msg->flags &I2C_M_RD ) ?"read" :"write" , dev->buf_len);
@@ -414,26 +452,24 @@ static int at91_do_twi_transfer(struct a* seems to be the best solution. */ if (dev->use_dma && (dev->buf_len >AT91_I2C_DMA_THRESHOLD )) { +at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_NACK );at91_twi_read_data_dma (dev); -/* -* It is important to enable TXCOMP irq here because -* doing it only when transferring the last two bytes -* will mask NACK errors since TXCOMP is set when a -* NACK occurs. -*/ -at91_twi_write (dev,AT91_TWI_IER , -AT91_TWI_TXCOMP ); - }else + }else {at91_twi_write (dev,AT91_TWI_IER , -AT91_TWI_TXCOMP |AT91_TWI_RXRDY ); +AT91_TWI_TXCOMP | +AT91_TWI_NACK | +AT91_TWI_RXRDY ); + } }else {if (dev->use_dma && (dev->buf_len >AT91_I2C_DMA_THRESHOLD )) { +at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_NACK );at91_twi_write_data_dma (dev); -at91_twi_write (dev,AT91_TWI_IER ,AT91_TWI_TXCOMP ); }else {at91_twi_write_next_byte (dev);at91_twi_write (dev,AT91_TWI_IER , -AT91_TWI_TXCOMP |AT91_TWI_TXRDY ); +AT91_TWI_TXCOMP | +AT91_TWI_NACK | +AT91_TWI_TXRDY ); } }
Greg Kroah-Hartman
maintainerPATCH 51/267 iio:light:cm3323: clear bitmask before set
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hartmut Knaack <[email protected]>
commit c288503b32e8c5534062a05ec565d28bffa06db3 upstream.
When setting the bits for integration time, the appropriate bitmask needs to be cleared first.
--- drivers/iio/light/cm3323.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/cm3323.c +1 -1
@@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3for (i =0 ; i <ARRAY_SIZE (cm3323_int_time); i++) {if (val == cm3323_int_time[i].val && val2 == cm3323_int_time[i].val2) { - reg_conf = data->reg_conf; + reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK ; reg_conf |= i <<CM3323_CONF_IT_SHIFT ; ret = i2c_smbus_write_word_data(data->client,
Greg Kroah-Hartman
maintainerPATCH 52/267 iio:adc:cc10001_adc: fix Kconfig dependency
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hartmut Knaack <[email protected]>
commit b2b3c3dc6a7bef886850920f5f5dca041b443aa0 upstream.
The Cosmic Circuits 10001 ADC driver depends on HAS_IOMEM, HAVE_CLK and REGULATOR together, not just any of these.
--- drivers/iio/adc/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/adc/Kconfig +1 -2
@@ -146,8 +146,7 @@ config DA9150_GPADC config CC10001_ADC tristate "Cosmic Circuits 10001 ADC driver" - depends on HAVE_CLK || REGULATOR - depends on HAS_IOMEM + depends on HAS_IOMEM && HAVE_CLK && REGULATOR select IIO_BUFFER select IIO_TRIGGERED_BUFFER help
Greg Kroah-Hartman
maintainerPATCH 53/267 iio:accel:bmc150-accel: fix counting direction
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hartmut Knaack <[email protected]>
commit 7a1d0d91c94305fa5802a53df3a54c0ea1963c48 upstream.
In bmc150_accel_unregister_triggers() triggers should be unregistered in reverse order of registration. Trigger registration starts with number 0, counting up. In consequence, trigger number needs to be count down here.
--- drivers/iio/accel/bmc150-accel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/bmc150-accel.c +1 -1
@@ -1465,7 +1465,7 @@ static void bmc150_accel_unregister_trig {int i; -for (i = from; i >=0 ; i++) { +for (i = from; i >=0 ; i--) {if (data->triggers[i].indio_trig) {iio_trigger_unregister (data->triggers[i].indio_trig); data->triggers[i].indio_trig =NULL ;
Greg Kroah-Hartman
maintainerPATCH 54/267 iio: light: tcs3414: Fix bug preventing to set integration time
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Meerwald <[email protected]>
commit 33361e5678a541f82f29f85467d589e7bf8da76b upstream.
the millisecond values in tcs3414_times should be checked against val2, not val, which is always zero.
--- drivers/iio/light/tcs3414.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/tcs3414.c +1 -1
@@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_if (val !=0 )return -EINVAL ;for (i =0 ; i <ARRAY_SIZE (tcs3414_times); i++) { -if (val == tcs3414_times[i] *1000 ) { +if (val2 == tcs3414_times[i] *1000 ) { data->timing &= ~TCS3414_INTEG_MASK ; data->timing |= i; return i2c_smbus_write_byte_data(
Greg Kroah-Hartman
maintainerPATCH 55/267 iio: DAC: ad5624r_spi: fix bit shift of output data value
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: JM Friedt <[email protected]>
commit adfa969850ae93beca57f7527f0e4dc10cbe1309 upstream.
The value sent on the SPI bus is shifted by an erroneous number of bits. The shift value was already computed in the iio_chan_spec structure and hence subtracting this argument to 16 yields an erroneous data position in the SPI stream.
--- drivers/iio/dac/ad5624r_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad5624r_spi.c +2 -2
@@ -22,7 +22,7 @@#include "ad5624r.h" static int ad5624r_spi_write (struct spi_device *spi, -u8 cmd,u8 addr,u16 val,u8 len) +u8 cmd,u8 addr,u16 val,u8 shift) {u32 data;u8 msg[3 ];
@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_* 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, * for the AD5664R, AD5644R, and AD5624R, respectively. */ - data = (0 <<22 ) | (cmd <<19 ) | (addr <<16 ) | (val << (16 - len)); + data = (0 <<22 ) | (cmd <<19 ) | (addr <<16 ) | (val << shift); msg[0 ] = data >>16 ; msg[1 ] = data >>8 ; msg[2 ] = data;
Greg Kroah-Hartman
maintainerPATCH 56/267 iio: inv-mpu: Specify the expected format/precision for write channels
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adriana Reus <[email protected]>
commit 6a3c45bb5a385be7049a7725a4fe93eaa76915f4 upstream.
The gyroscope needs IIO_VAL_INT_PLUS_NANO for the scale channel and unless specified write returns MICRO by default.
This needs to be properly specified so that write operations into scale have the expected behaviour.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +18 -0
@@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(return -EINVAL ; } +static int inv_write_raw_get_fmt (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan,long mask) +{ +switch (mask) { +case IIO_CHAN_INFO_SCALE : +switch (chan->type) { +case IIO_ANGL_VEL : +return IIO_VAL_INT_PLUS_NANO ; +default : +return IIO_VAL_INT_PLUS_MICRO ; + } +default : +return IIO_VAL_INT_PLUS_MICRO ; + } + +return -EINVAL ; +}static int inv_mpu6050_write_accel_scale (struct inv_mpu6050_state *st,int val) {int result, i;
@@ -696,6 +713,7 @@ static const struct iio_info mpu_info = .driver_module = THIS_MODULE, .read_raw = &inv_mpu6050_read_raw, .write_raw = &inv_mpu6050_write_raw, + .write_raw_get_fmt = &inv_write_raw_get_fmt, .attrs = &inv_attribute_group, .validate_trigger = inv_mpu6050_validate_trigger, };
Greg Kroah-Hartman
maintainerPATCH 57/267 iio: tmp006: Check channel info on write
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Meerwald <[email protected]>
commit 8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf upstream.
only SAMP_FREQ is writable
Will lead to SAMP_FREQ being written by any attempt to write to the other exported attributes and hence a rather unexpected result!
--- drivers/iio/temperature/tmp006.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/temperature/tmp006.c +3 -0
@@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dstruct tmp006_data *data =iio_priv (indio_dev);int i; +if (mask !=IIO_CHAN_INFO_SAMP_FREQ ) +return -EINVAL ; +for (i =0 ; i <ARRAY_SIZE (tmp006_freqs); i++)if ((val == tmp006_freqs[i][0 ]) && (val2 == tmp006_freqs[i][1 ])) {
Greg Kroah-Hartman
maintainerPATCH 58/267 iio: twl4030-madc: Pass the IRQF_ONESHOT flag
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 6c0d48cb29c29b306ba3548afb45154d22eb4d78 upstream.
Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail.
So pass the IRQF_ONESHOT flag in this case.
The semantic patch that makes this change is available in scripts/coccinelle/misc/irqf_oneshot.cocci.
--- drivers/iio/adc/twl4030-madc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/twl4030-madc.c +2 -1
@@ -835,7 +835,8 @@ static int twl4030_madc_probe(struct pla irq =platform_get_irq (pdev,0 ); ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , twl4030_madc_threaded_irq_handler, -IRQF_TRIGGER_RISING ,"twl4030_madc" , madc); +IRQF_TRIGGER_RISING |IRQF_ONESHOT , +"twl4030_madc" , madc);if (ret) {dev_err (&pdev->dev,"could not request irq\n" ); goto err_i2c;
Greg Kroah-Hartman
maintainerPATCH 59/267 iio: ABI: Clarify proximity output value
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baluta <[email protected]>
commit bdc10d57f236b534fb675a4bbefd10017aeb2b26 upstream.
Current description for proximity measurement is ambiguous. While the first part says that proximity is measured by observing reflectivity, the second part incorrectly infers that reported values should behave like a distance.
This is because of AS3935 lightning sensor which uses the proximity API, while not being a true proximity sensor.
Note this is marked for stable as it accompanies a fix in ABI usage to the sx9500 driver which would otherwise appear to be correct.
--- Documentation/ABI/testing/sysfs-bus-iio | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Documentation/ABI/testing/sysfs-bus-iio +2 -4
@@ -1165,10 +1165,8 @@ Description: object is near the sensor, usually be observing reflectivity of infrared or ultrasound emitted. Often these sensors are unit less and as such conversion - to SI units is not possible. Where it is, the units should - be meters. If such a conversion is not possible, the reported - values should behave in the same way as a distance, i.e. lower - values indicate something is closer to the sensor. + to SI units is not possible. Higher proximity measurements + indicate closer objects, and vice versa. What: /sys/.../iio:deviceX/in_illuminance_input What: /sys/.../iio:deviceX/in_illuminance_raw
Greg Kroah-Hartman
maintainerPATCH 60/267 iio: proximity: sx9500: Fix proximity value
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baluta <[email protected]>
commit fd1883f07cb434707e50c4c9a16e3ed4b3a5e74f upstream.
Because of the ABI confusion proximity value exposed by SX9500 was inverted.
--- drivers/iio/proximity/sx9500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/sx9500.c +1 -1
@@ -206,7 +206,7 @@ static int sx9500_read_proximity(structif (ret <0 )return ret; - *val =32767 - (s16 )be16_to_cpu (regval); + *val =be16_to_cpu (regval);return IIO_VAL_INT ; }
Greg Kroah-Hartman
maintainerPATCH 61/267 iio: adc: rockchip_saradc: add missing MODULE_* data
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit dc7b8d98ac003c9f1e83a5f927c372dac6f114a1 upstream.
The module-data is currently missing. This includes the license-information which makes the driver taint the kernel and miss symbols when compiled as module.
--- drivers/iio/adc/rockchip_saradc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iio/adc/rockchip_saradc.c +4 -0
@@ -349,3 +349,7 @@ static struct platform_driver rockchip_s };module_platform_driver (rockchip_saradc_driver); + +MODULE_AUTHOR ("Heiko Stuebner <[email protected]>" ); +MODULE_DESCRIPTION ("Rockchip SARADC driver" ); +MODULE_LICENSE ("GPL v2" );
Greg Kroah-Hartman
maintainerPATCH 62/267 iio: adc: at91_adc: allow to use full range of startup time
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Leupold <[email protected]>
commit 2ab5f39bc7825808e0fa1e7e5f0b23e174563467 upstream.
The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond value. When trying to increase the value of STARTUP in Register AT91_ADC_MR some higher values can't be reached.
Change the type in function parameter and private structure field from u8 to u32.
--- drivers/iio/adc/at91_adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/adc/at91_adc.c +4 -4
@@ -182,7 +182,7 @@ struct at91_adc_caps {u8 ts_pen_detect_sensitivity;/* startup time calculate function */ -u32 (*calc_startup_ticks)(u8 startup_time,u32 adc_clk_khz); +u32 (*calc_startup_ticks)(u32 startup_time,u32 adc_clk_khz);u8 num_channels;struct at91_adc_reg_desc registers;
@@ -201,7 +201,7 @@ struct at91_adc_state {u8 num_channels;void __iomem *reg_base;struct at91_adc_reg_desc *registers; -u8 startup_time; +u32 startup_time;u8 sample_hold_time;bool sleep_mode;struct iio_trigger **trig;
@@ -779,7 +779,7 @@ ret:return ret; } -static u32 calc_startup_ticks_9260 (u8 startup_time,u32 adc_clk_khz) +static u32 calc_startup_ticks_9260 (u32 startup_time,u32 adc_clk_khz) {/* * Number of ticks needed to cover the startup time of the ADC
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 streturn round_up ((startup_time * adc_clk_khz /1000 ) -1 ,8 ) /8 ; } -static u32 calc_startup_ticks_9x5 (u8 startup_time,u32 adc_clk_khz) +static u32 calc_startup_ticks_9x5 (u32 startup_time,u32 adc_clk_khz) {/* * For sama5d3x and at91sam9x5, the formula changes to:
Greg Kroah-Hartman
maintainerPATCH 63/267 vb2: Dont WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit 77a3c6fd90c94f635edb00d4a65f485687538791 upstream.
Commit f61bf13b6a07 ("[media] vb2: add allow_zero_bytesused flag to the vb2_queue struct") added a WARN_ONCE to catch usage of a deprecated API using a zero value for v4l2_buffer.bytesused.
However, the condition is checked incorrectly, as the v4L2_buffer bytesused field is supposed to be ignored for multiplanar buffers. This results in spurious warnings when using the multiplanar API.
Fix it by checking v4l2_buffer.bytesused for uniplanar buffers and v4l2_plane.bytesused for multiplanar buffers.
--- drivers/media/v4l2-core/videobuf2-core.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/media/v4l2-core/videobuf2-core.c +23 -10
@@ -1237,6 +1237,23 @@ void vb2_discard_done(struct vb2_queue * }EXPORT_SYMBOL_GPL (vb2_discard_done); +static void vb2_warn_zero_bytesused (struct vb2_buffer *vb) +{ +static bool __check_once__read_mostly ; + +if (__check_once) +return ; + + __check_once = true; +__WARN (); + +pr_warn_once ("use of bytesused == 0 is deprecated and will be removed in the future,\n" ); +if (vb->vb2_queue->allow_zero_bytesused) +pr_warn_once ("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n" ); +else +pr_warn_once ("use the actual size instead.\n" ); +} +/** * __fill_vb2_buffer() - fill a vb2_buffer with information provided in a * v4l2_buffer by the userspace. The caller has already verified that struct
@@ -1247,16 +1264,6 @@ static void __fill_vb2_buffer(struct vb2 {unsigned int plane; -if (V4L2_TYPE_IS_OUTPUT (b->type)) { -if (WARN_ON_ONCE (b->bytesused ==0 )) { -pr_warn_once ("use of bytesused == 0 is deprecated and will be removed in the future,\n" ); -if (vb->vb2_queue->allow_zero_bytesused) -pr_warn_once ("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n" ); -else -pr_warn_once ("use the actual size instead.\n" ); - } - } -if (V4L2_TYPE_IS_MULTIPLANAR (b->type)) {if (b->memory ==V4L2_MEMORY_USERPTR ) {for (plane =0 ; plane < vb->num_planes; ++plane) {
@@ -1297,6 +1304,9 @@ static void __fill_vb2_buffer(struct vb2struct v4l2_plane *pdst = &v4l2_planes[plane];struct v4l2_plane *psrc = &b->m.planes[plane]; +if (psrc->bytesused ==0 ) +vb2_warn_zero_bytesused (vb); +if (vb->vb2_queue->allow_zero_bytesused) pdst->bytesused = psrc->bytesused;else
@@ -1331,6 +1341,9 @@ static void __fill_vb2_buffer(struct vb2 }if (V4L2_TYPE_IS_OUTPUT (b->type)) { +if (b->bytesused ==0 ) +vb2_warn_zero_bytesused (vb); +if (vb->vb2_queue->allow_zero_bytesused) v4l2_planes[0 ].bytesused = b->bytesused;else
Greg Kroah-Hartman
maintainerPATCH 64/267 media: Fix regression in some more dib0700 based devices
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Reitmayr <[email protected]>
commit e989a73ebd09d22c22ead51fa363a2f56f70f28a upstream.
Fix an oops during device initialization by correctly setting size_of_priv instead of leaving it 0.
The regression was introduced by 8abe4a0a3f6d4217b16a ("[media] dib7000:
export just one symbol") and only fixed for one type of dib0700 based devices in 9e334c75642b6e5bfb95 ("[media] Fix regression in some dib0700 based devices").
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92301
--- drivers/media/usb/dvb-usb/dib0700_devices.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/usb/dvb-usb/dib0700_devices.c +6 -0
@@ -3944,6 +3944,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), }, { .num_frontends = 1, .fe = {{
@@ -3956,6 +3958,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x03), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), } },
@@ -4009,6 +4013,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), }, },
Greg Kroah-Hartman
maintainerPATCH 66/267 cx18: add missing caps for the PCM video device
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 2b4fd3ede3bab65ef5b97387b90899d11e4d3202 upstream.
The cx18 PCM video device didn't have any capabilities set, which caused a warnings in the v4l2 core:
[ 6.229393] ------------[ cut here ]------------ [ 6.229414] WARNING: CPU: 1 PID: 593 at drivers/media/v4l2-core/v4l2-ioctl.c:1025 v4l_querycap+0x41/0x70 [videodev]() [ 6.229415] Modules linked in: cx18_alsa mxl5005s s5h1409
tuner_simple tuner_types cs5345 tuner intel_rapl iosf_mbi x86_pkg_temp_thermal coretemp raid1 snd_hda_codec_realtek kvm_intel snd_hda_codec_generic snd_hda_codec_hdmi kvm snd_oxygen(+) snd_hda_intel snd_oxygen_lib snd_hda_controller snd_hda_codec snd_mpu401_uart iTCO_wdt snd_rawmidi iTCO_vendor_support snd_hwdep crct10dif_pclmul crc32_pclmul crc32c_intel snd_seq cx18 snd_seq_device ghash_clmulni_intel videobuf_vmalloc tveeprom cx2341x snd_pcm serio_raw videobuf_core vfat dvb_core fat v4l2_common snd_timer videodev snd lpc_ich i2c_i801 joydev mfd_core mei_me media soundcore tpm_infineon soc_button_array tpm_tis mei shpchp tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc i915 nouveau mxm_wmi wmi e1000e ttm i2c_algo_bit drm_kms_helper
[ 6.229444] drm ptp pps_core video [ 6.229446] CPU: 1 PID: 593 Comm: v4l_id Not tainted 3.19.3-200.fc21.x86_64 #1 [ 6.229447] Hardware name: Gigabyte Technology Co., Ltd. Z87-D3HP/Z87-D3HP-CF, BIOS F6 01/20/2014 [ 6.229448] 0000000000000000 00000000d12b1131 ffff88042dacfc28 ffffffff8176e215 [ 6.229449] 0000000000000000 0000000000000000 ffff88042dacfc68 ffffffff8109bc1a [ 6.229451] ffffffffa0594000 ffff88042dacfd90 0000000000000000 ffffffffa04e2140 [ 6.229452] Call Trace: [ 6.229466] [<ffffffff8176e215>] dump_stack+0x45/0x57 [ 6.229469] [<ffffffff8109bc1a>] warn_slowpath_common+0x8a/0xc0 [ 6.229472] [<ffffffff8109bd4a>] warn_slowpath_null+0x1a/0x20 [ 6.229474] [<ffffffffa04ca401>] v4l_querycap+0x41/0x70 [videodev] [ 6.229477] [<ffffffffa04ca6cc>] __video_do_ioctl+0x29c/0x320 [videodev] [ 6.229479] [<ffffffff81227131>] ? do_last+0x2f1/0x1210 [ 6.229491] [<ffffffffa04cc776>] video_usercopy+0x366/0x5d0 [videodev] [ 6.229494] [<ffffffffa04ca430>] ? v4l_querycap+0x70/0x70 [videodev] [ 6.229497] [<ffffffffa04cc9f5>] video_ioctl2+0x15/0x20 [videodev] [ 6.229499] [<ffffffffa04c6794>] v4l2_ioctl+0x164/0x180 [videodev] [ 6.229501] [<ffffffff8122e298>] do_vfs_ioctl+0x2f8/0x500 [ 6.229502] [<ffffffff8122e521>] SyS_ioctl+0x81/0xa0 [ 6.229505] [<ffffffff81774a09>] system_call_fastpath+0x12/0x17 [ 6.229506] ---[ end trace dacd80d4b19277ea ]---
Added the necessary capabilities to stop this warning.
--- drivers/media/pci/cx18/cx18-streams.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/cx18/cx18-streams.c +1 -0
@@ -90,6 +90,7 @@ static struct {"encoder PCM audio" ,VFL_TYPE_GRABBER ,CX18_V4L2_ENC_PCM_OFFSET ,PCI_DMA_FROMDEVICE , +V4L2_CAP_TUNER |V4L2_CAP_AUDIO |V4L2_CAP_READWRITE , }, { /* CX18_ENC_STREAM_TYPE_IDX */ "encoder IDX",
Greg Kroah-Hartman
maintainerPATCH 67/267 cx24117: fix a buffer overflow when checking userspace params
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 82e3b88b679049f043fe9b03991d6d66fc0a43c8 upstream.
The maximum size for a DiSEqC command is 6, according to the userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23
--- drivers/media/dvb-frontends/cx24117.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/cx24117.c +1 -1
@@ -1043,7 +1043,7 @@ static int cx24117_send_diseqc_msg(strucdev_dbg (&state->priv->i2c->dev,")\n" );/* Validate length */ -if (d->msg_len >15 ) +if (d->msg_len >sizeof (d->msg))return -EINVAL ;/* DiSEqC message */
Greg Kroah-Hartman
maintainerPATCH 68/267 af9013: Dont accept invalid bandwidth
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit d7b76c91f471413de9ded837bddeca2164786571 upstream.
If userspace sends an invalid bandwidth, it should either return EINVAL or switch to auto mode.
This driver will go past an array and program the hardware on a wrong way if this happens.
--- drivers/media/dvb-frontends/af9013.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/dvb-frontends/af9013.c +4 -0
@@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dv } } +/* Return an error if can't find bandwidth or the right clock */ +if (i ==ARRAY_SIZE (coeff_lut)) +return -EINVAL ; + ret =af9013_wr_regs (state,0xae00 , coeff_lut[i].val,sizeof (coeff_lut[i].val)); }
Greg Kroah-Hartman
maintainerPATCH 69/267 saa7164: fix querycap warning
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 534bc3e2ee93835badca753bedce8073c67caa92 upstream.
Fix the VIDIOC_QUERYCAP warning due to the missing device_caps. Don't fill in the version field, the V4L2 core will do that for you.
--- drivers/media/pci/saa7164/saa7164-encoder.c | 11 ++++++----- drivers/media/pci/saa7164/saa7164-vbi.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-)
drivers/media/pci/saa7164/saa7164-encoder.c +6 -5
@@ -721,13 +721,14 @@ static int vidioc_querycap(struct file * sizeof(cap->card));sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); - cap->capabilities = + cap->device_caps =V4L2_CAP_VIDEO_CAPTURE | -V4L2_CAP_READWRITE | -0 ; +V4L2_CAP_READWRITE | +V4L2_CAP_TUNER ; - cap->capabilities |=V4L2_CAP_TUNER ; - cap->version =0 ; + cap->capabilities = cap->device_caps | +V4L2_CAP_VBI_CAPTURE | +V4L2_CAP_DEVICE_CAPS ;return 0 ; }
drivers/media/pci/saa7164/saa7164-vbi.c +6 -5
@@ -660,13 +660,14 @@ static int vidioc_querycap(struct file * sizeof(cap->card));sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); - cap->capabilities = + cap->device_caps =V4L2_CAP_VBI_CAPTURE | -V4L2_CAP_READWRITE | -0 ; +V4L2_CAP_READWRITE | +V4L2_CAP_TUNER ; - cap->capabilities |=V4L2_CAP_TUNER ; - cap->version =0 ; + cap->capabilities = cap->device_caps | +V4L2_CAP_VIDEO_CAPTURE | +V4L2_CAP_DEVICE_CAPS ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 70/267 s5h1420: fix a buffer overflow when checking userspace params
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 12f4543f5d6811f864e6c4952eb27253c7466c02 upstream.
The maximum size for a DiSEqC command is 6, according to the userspace API. However, the code allows to write up to 7 values:
drivers/media/dvb-frontends/s5h1420.c:193 s5h1420_send_master_cmd() error: buffer overflow 'cmd->msg' 6 <= 7
--- drivers/media/dvb-frontends/s5h1420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/s5h1420.c +1 -1
@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struint result =0 ;dprintk ("enter %s\n" , __func__); -if (cmd->msg_len >8 ) +if (cmd->msg_len >sizeof (cmd->msg))return -EINVAL ;/* setup for DISEQC */
Greg Kroah-Hartman
maintainerPATCH 71/267 cx24116: fix a buffer overflow when checking userspace params
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 1fa2337a315a2448c5434f41e00d56b01a22283c upstream.
The maximum size for a DiSEqC command is 6, according to the userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23
--- drivers/media/dvb-frontends/cx24116.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/dvb-frontends/cx24116.c +4 -4
@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(strucstruct cx24116_state *state = fe->demodulator_priv;int i, ret; +/* Validate length */ +if (d->msg_len >sizeof (d->msg)) +return -EINVAL ; +/* Dump DiSEqC message */ if (debug) {printk (KERN_INFO "cx24116: %s(" , __func__);
@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(strucprintk (") toneburst=%d\n" , toneburst); } -/* Validate length */ -if (d->msg_len > (CX24116_ARGLEN -CX24116_DISEQC_MSGOFS )) -return -EINVAL ; -/* DiSEqC message */ for (i =0 ; i < d->msg_len; i++) state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];
Greg Kroah-Hartman
maintainerPATCH 72/267 ASoC: arizona: Fix noise generator gain TLV
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <[email protected]>
commit 15575ed544910464715df5c45a44b9732e415b93 upstream.
The Arizona codec drivers had an incorrect dB scaling for the noise generator gain that started at 0dB and went upwards. Actually the highest setting is 0dB.
--- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/codecs/wm8997.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm5102.c +1 -1
@@ -42,7 +42,7 @@ struct wm5102_priv { static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); -static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); +static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);static const struct wm_adsp_region wm5102_dsp1_regions[] = {
sound/soc/codecs/wm5110.c +1 -1
@@ -167,7 +167,7 @@ static int wm5110_sysclk_ev(struct snd_s static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); -static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); +static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);#define WM5110_NG_SRC (name, base) \
sound/soc/codecs/wm8997.c +1 -1
@@ -40,7 +40,7 @@ struct wm8997_priv { static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); -static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); +static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);static const struct reg_default wm8997_sysclk_reva_patch[] = {
Greg Kroah-Hartman
maintainerPATCH 73/267 ASoC: rt5645: Init jack_detect_work before registering irq
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Boichat <[email protected]>
commit 7ea3470a7277380248135a592a849e1c27960b2f upstream.
Prevents frequent panic on boot, if the irq handler rt5645_irq gets called before the workqueue rt5645_jack_detect_work is initialized.
--- sound/soc/codecs/rt5645.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5645.c +2 -2
@@ -2837,6 +2837,8 @@ static int rt5645_i2c_probe(struct i2c_c } } +INIT_DELAYED_WORK (&rt5645->jack_detect_work, rt5645_jack_detect_work); +if (rt5645->i2c->irq) { ret =request_threaded_irq (rt5645->i2c->irq,NULL , rt5645_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
@@ -2855,8 +2857,6 @@ static int rt5645_i2c_probe(struct i2c_cdev_err (&i2c->dev,"Fail gpio_direction hp_det_gpio\n" ); } -INIT_DELAYED_WORK (&rt5645->jack_detect_work, rt5645_jack_detect_work); -return snd_soc_register_codec (&i2c->dev, &soc_codec_dev_rt5645, rt5645_dai,ARRAY_SIZE (rt5645_dai)); }
Greg Kroah-Hartman
maintainerPATCH 74/267 ASoC: max98925: Fix mask for setting DAI invert mode
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 0b51601d4504f46f585eed823485101390f0b588 upstream.
The M98925_DAI_WCI_MASK bit is not updated with current code. To properly set the DAI invert mode, the mask should be M98925_DAI_BCI_MASK | M98925_DAI_WCI_MASK.
--- sound/soc/codecs/max98925.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/max98925.c +1 -1
@@ -346,7 +346,7 @@ static int max98925_dai_set_fmt(struct s }regmap_update_bits (max98925->regmap,MAX98925_FORMAT , -M98925_DAI_BCI_MASK , invert); +M98925_DAI_BCI_MASK |M98925_DAI_WCI_MASK , invert);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 75/267 ASoC: qcom: remove incorrect dependencies
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit a7310c496f376b945e7e61f64d69c9c0a93ee1ee upstream.
Compile-tests show a warning for the newly added SND_SOC_STORM symbol:
warning: (SND_SOC_STORM) selects SND_SOC_LPASS_CPU which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_QCOM)
The problem is that it can be selected for COMPILE_TEST on non-QCOM builds, but the symbols it selects have a dependency. Dropping the dependencies makes it work without warnings and no other side-effects, because these are not user-visible.
--- sound/soc/qcom/Kconfig | 2 -- 1 file changed, 2 deletions(-)
sound/soc/qcom/Kconfig +0 -2
@@ -6,12 +6,10 @@ config SND_SOC_QCOM config SND_SOC_LPASS_CPU tristate - depends on SND_SOC_QCOM select REGMAP_MMIO config SND_SOC_LPASS_PLATFORM tristate - depends on SND_SOC_QCOM select REGMAP_MMIO config SND_SOC_STORM
Greg Kroah-Hartman
maintainerPATCH 76/267 ASoC: imx-wm8962: Add a missing error check
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 474ff0ae23b834e9fc18374d14bb5f3e7b3828b4 upstream.
My static checker complains that:
sound/soc/fsl/imx-wm8962.c:196 imx_wm8962_probe() warn: we tested 'ret' before and it was 'false'
The intent was that we use "ret" to check imx_audmux_v2_configure_port().
Otherwise, Acked-by: Nicolin Chen <[email protected]>
--- sound/soc/fsl/imx-wm8962.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/imx-wm8962.c +1 -1
@@ -190,7 +190,7 @@ static int imx_wm8962_probe(struct platfdev_err (&pdev->dev,"audmux internal port setup failed\n" );return ret; } -imx_audmux_v2_configure_port (ext_port, + ret =imx_audmux_v2_configure_port (ext_port,IMX_AUDMUX_V2_PTCR_SYN ,IMX_AUDMUX_V2_PDCR_RXDSEL (int_port));if (ret) {
Greg Kroah-Hartman
maintainerPATCH 77/267 ASoC: omap: fix up SND_OMAP_SOC_OMAP_ABE_TWL6040 dependency, again
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 0574eab363ace70ef275d4caad6eadc458d33728 upstream.
I tried to fix this before and submitted a working patch, but after some discussion we came up with what seemed to be a nicer solution, resulting in commit 3d4cf65e2d ("ASoC: omap: fix up SND_OMAP_SOC_OMAP_ABE_TWL6040 dependency"). Unfortunately, that version was incomplete, and we still get this build error:
drivers/clk/clk-palmas.c:46:16: error: field 'hw' has incomplete type drivers/clk/clk-palmas.c: In function 'to_palmas_clks_info':drivers/clk/clk-palmas.c:54:74: warning: initialization from incompatible pointer type [-Winc
This happens only in randconfig builds that turn on MFD_PALMAS on a platform other than OMAP2+ when COMPILE_TEST is set but COMMON_CLK is not.
The new approach is only 'select COMMON_CLK_PALMAS' if we know that we are on an OMAP5 platform and MFD_PALMAS is already set. This patch has survived thousands of randconfig builds and I don't see a remaining hole in the logic.
--- sound/soc/omap/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/omap/Kconfig +3 -2
@@ -100,12 +100,13 @@ config SND_OMAP_SOC_OMAP_TWL4030 config SND_OMAP_SOC_OMAP_ABE_TWL6040 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" - depends on TWL6040_CORE && SND_OMAP_SOC && (ARCH_OMAP4 || SOC_OMAP5 || COMPILE_TEST) + depends on TWL6040_CORE && SND_OMAP_SOC + depends on ARCH_OMAP4 || (SOC_OMAP5 && MFD_PALMAS) || COMPILE_TEST select SND_OMAP_SOC_DMIC select SND_OMAP_SOC_MCPDM select SND_SOC_TWL6040 select SND_SOC_DMIC - select COMMON_CLK_PALMAS if MFD_PALMAS + select COMMON_CLK_PALMAS if (SOC_OMAP5 && MFD_PALMAS) help Say Y if you want to add support for SoC audio on OMAP boards using ABE and twl6040 codec. This driver currently supports:
Greg Kroah-Hartman
maintainerPATCH 79/267 ASoC: wm8955: Fix setting wrong register for WM8955_K_8_0_MASK bits
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 12c350050538c7dc779c083b7342bfd20f74949c upstream.
WM8955_K_8_0_MASK bits is controlled by WM8955_PLL_CONTROL_3 rather than WM8955_PLL_CONTROL_2.
--- sound/soc/codecs/wm8955.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8955.c +1 -1
@@ -298,7 +298,7 @@ static int wm8955_configure_clocking(strsnd_soc_update_bits (codec,WM8955_PLL_CONTROL_2 ,WM8955_K_17_9_MASK , (pll.k >>9 ) &WM8955_K_17_9_MASK ); -snd_soc_update_bits (codec,WM8955_PLL_CONTROL_2 , +snd_soc_update_bits (codec,WM8955_PLL_CONTROL_3 ,WM8955_K_8_0_MASK , pll.k &WM8955_K_8_0_MASK );if (pll.k)
Greg Kroah-Hartman
maintainerPATCH 81/267 ASoC: wm8960: the enum of "DAC Polarity" should be wm8960_enum[1]
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zidan Wang <[email protected]>
commit a077e81ec61e07a7f86997d045109f06719fbffe upstream.
the enum of "DAC Polarity" should be wm8960_enum[1].
--- sound/soc/codecs/wm8960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8960.c +1 -1
@@ -245,7 +245,7 @@ SOC_SINGLE("PCM Playback -6dB Switch", WSOC_ENUM ("ADC Polarity" , wm8960_enum[0 ]),SOC_SINGLE ("ADC High Pass Filter Switch" ,WM8960_DACCTL1 ,0 ,1 ,0 ), -SOC_ENUM ("DAC Polarity" , wm8960_enum[2 ]), +SOC_ENUM ("DAC Polarity" , wm8960_enum[1 ]),SOC_SINGLE_BOOL_EXT ("DAC Deemphasis Switch" ,0 , wm8960_get_deemph, wm8960_put_deemph),
Greg Kroah-Hartman
maintainerPATCH 82/267 ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 80ba2669ec8c3e6517aa935001f6cb8809bf3df4 upstream.
If the card is not part of any card the tas_data->codec is NULL since it is set only during snd_soc_codec_driver.probe, which is not yet called.
--- sound/soc/codecs/tas2552.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/tas2552.c +3 -0
@@ -120,6 +120,9 @@ static void tas2552_sw_shutdown(struct t {u8 cfg1_reg; +if (!tas_data->codec) +return ; +if (sw_shutdown) cfg1_reg =0 ;else
Greg Kroah-Hartman
maintainerPATCH 83/267 ASoC: tas2552: Fix kernel crash caused by wrong kcontrol entry
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 1cf0f44811b754b64283b11ef0e60cb0de07b29c upstream.
SOC_DAPM_SINGLE("Playback AMP", ..) should not be under kcontrols. It causes kernel crash (NULL pointer) when the mixers are listed.
--- sound/soc/codecs/tas2552.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/tas2552.c +0 -1
@@ -338,7 +338,6 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7,static const struct snd_kcontrol_new tas2552_snd_controls[] = {SOC_SINGLE_TLV ("Speaker Driver Playback Volume" ,TAS2552_PGA_GAIN ,0 ,0x1f ,1 , dac_tlv), -SOC_DAPM_SINGLE ("Playback AMP" ,SND_SOC_NOPM ,0 ,1 ,0 ), };static const struct reg_default tas2552_init_regs[] = {
Greg Kroah-Hartman
maintainerPATCH 84/267 libata: Do not blacklist Micron M500DC
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit 243918be6393f643e513a26e7882e6ae06ff7717 upstream.
Queued TRIM got disabled on Micron M500DC drives thanks to the "Micron_M500*" pattern we had in place to accommodate the previous generation of this drive family. Tweak the blacklist entry slightly so we only disable queued TRIM for the non-DC variants of M500 drives.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -4225,7 +4225,7 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },/* devices that don't properly handle queued TRIM commands */ - { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | + { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, },
Greg Kroah-Hartman
maintainerPATCH 85/267 libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksei Mamlin <[email protected]>
commit 08c85d2a599d967ede38a847f5594447b6100642 upstream.
Enabling AA on HP 250GB SATA disk VB0250EAVER causes errors:
[ 3.788362] ata3.00: failed to enable AA (error_mask=0x1) [ 3.789243] ata3.00: failed to enable AA (error_mask=0x1)
Add the ATA_HORKAGE_BROKEN_FPDMA_AA for this specific harddisk.
tj: Collected FPDMA_AA entries and updated comment.
--- drivers/ata/libata-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ata/libata-core.c +2 -1
@@ -4174,9 +4174,10 @@ static const struct ata_blacklist_entry {"ST3320[68]13AS" ,"SD1[5-9]" ,ATA_HORKAGE_NONCQ | ATA_HORKAGE_FIRMWARE_WARN }, -/* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ +/* drives which fail FPDMA_AA activation (some may freeze afterwards) */ { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, + { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA },/* Blacklist entries taken from Silicon Image 3124/3132 Windows driver .inf file - also several Linux problem reports */
Greg Kroah-Hartman
maintainerPATCH 86/267 libata: increase the timeout when setting transfer mode
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit d531be2ca2f27cca5f041b6a140504999144a617 upstream.
I have a ST4000DM000 disk. If Linux is booted while the disk is spun down, the command that sets transfer mode causes the disk to spin up. The spin-up takes longer than the default 5s timeout, so the command fails and timeout is reported.
Fix this by increasing the timeout to 15s, which is enough for the disk to spin up.
--- drivers/ata/libata-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ata/libata-core.c +2 -1
@@ -4502,7 +4502,8 @@ static unsigned int ata_dev_set_xfermodeelse /* In the ancient relic department - skip all of this */ return 0 ; - err_mask =ata_exec_internal (dev, &tf,NULL ,DMA_NONE ,NULL ,0 ,0 ); +/* On some disks, this command causes spin-up, so we need longer timeout */ + err_mask =ata_exec_internal (dev, &tf,NULL ,DMA_NONE ,NULL ,0 ,15000 );DPRINTK ("EXIT, err_mask=%x\n" , err_mask);return err_mask;
Greg Kroah-Hartman
maintainerPATCH 87/267 libata: Fall back to unqueued READ LOG EXT if the DMA variant fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit 5d3abf8ff67f49271a42c0f7fa4f20f9e046bf0e upstream.
Some devices advertise support for the READ/WRITE LOG DMA EXT commands but fail when we try to issue them. This can lead to queued TRIM being unintentionally disabled since the relevant feature flag is located in a general purpose log page.
Fall back to unqueued READ LOG EXT if the DMA variant fails while reading a log page.
--- drivers/ata/libata-eh.c | 12 +++++++++++- include/linux/libata.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/ata/libata-eh.c +11 -1
@@ -1507,13 +1507,17 @@ unsigned int ata_read_log_page(struct at {struct ata_taskfile tf;unsigned int err_mask; +bool dma = false;DPRINTK ("read log page - log 0x%x, page 0x%x\n" , log, page); +retry:ata_tf_init (dev, &tf); -if (dev->dma_mode &&ata_id_has_read_log_dma_ext (dev->id)) { +if (dev->dma_mode &&ata_id_has_read_log_dma_ext (dev->id) && + !(dev->horkage &ATA_HORKAGE_NO_NCQ_LOG )) { tf.command =ATA_CMD_READ_LOG_DMA_EXT ; tf.protocol =ATA_PROT_DMA ; + dma = true; }else { tf.command =ATA_CMD_READ_LOG_EXT ; tf.protocol =ATA_PROT_PIO ;
@@ -1527,6 +1531,12 @@ unsigned int ata_read_log_page(struct at err_mask =ata_exec_internal (dev, &tf,NULL ,DMA_FROM_DEVICE , buf, sectors *ATA_SECT_SIZE ,0 ); +if (err_mask && dma) { + dev->horkage |=ATA_HORKAGE_NO_NCQ_LOG ; +ata_dev_warn (dev,"READ LOG DMA EXT failed, trying unqueued\n" ); + goto retry; + } +DPRINTK ("EXIT, err_mask=%x\n" , err_mask);return err_mask; }
include/linux/libata.h +1 -0
@@ -431,6 +431,7 @@ enum {ATA_HORKAGE_NOLPM = (1 <<20 ),/* don't use LPM */ ATA_HORKAGE_WD_BROKEN_LPM = (1 <<21 ),/* some WDs have broken LPM */ ATA_HORKAGE_ZERO_AFTER_TRIM = (1 <<22 ),/* guarantees zero after trim */ + ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read *//* DMA mask for user DMA control: User visible values; DO NOT renumber */
Greg Kroah-Hartman
maintainerPATCH 88/267 libata: Expose TRIM capability in sysfs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit f303074160d3401970ccae082014e1ee5a9a52c5 upstream.
Create a sysfs "trim" attribute for each ata_device that displays whether DSM TRIM is "unsupported", "unqueued", "forced_unqueued" (blacklisted) or "queued".
--- Documentation/ABI/testing/sysfs-ata | 11 +++++++++++ drivers/ata/libata-transport.c | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+)
Documentation/ABI/testing/sysfs-ata +11 -0
@@ -90,6 +90,17 @@ gscr 130: SATA_PMP_GSCR_SII_GPIO Only valid if the device is a PM. +trim + + Shows the DSM TRIM mode currently used by the device. Valid + values are: + unsupported: Drive does not support DSM TRIM + unqueued: Drive supports unqueued DSM TRIM only + queued: Drive supports queued DSM TRIM + forced_unqueued: Drive's unqueued DSM support is known to be + buggy and only unqueued TRIM commands + are sent + spdn_cnt Number of time libata decided to lower the speed of link due to errors.
drivers/ata/libata-transport.c +22 -0
@@ -560,6 +560,27 @@ show_ata_dev_gscr(struct device *dev, static DEVICE_ATTR(gscr, S_IRUGO, show_ata_dev_gscr, NULL); +static ssize_t +show_ata_dev_trim (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct ata_device *ata_dev =transport_class_to_dev (dev); +unsigned char *mode; + +if (!ata_id_has_trim (ata_dev->id)) + mode ="unsupported" ; +else if (ata_dev->horkage &ATA_HORKAGE_NO_NCQ_TRIM ) + mode ="forced_unqueued" ; +else if (ata_fpdma_dsm_supported (ata_dev)) + mode ="queued" ; +else + mode ="unqueued" ; + +return snprintf (buf,20 ,"%s\n" , mode); +} + +static DEVICE_ATTR(trim, S_IRUGO, show_ata_dev_trim, NULL); + static DECLARE_TRANSPORT_CLASS(ata_dev_class, "ata_device", NULL, NULL, NULL);
@@ -733,6 +754,7 @@ struct scsi_transport_template *ata_attaSETUP_DEV_ATTRIBUTE (ering);SETUP_DEV_ATTRIBUTE (id);SETUP_DEV_ATTRIBUTE (gscr); +SETUP_DEV_ATTRIBUTE (trim);BUG_ON (count >ATA_DEV_ATTRS ); i->dev_attrs[count] =NULL ;
Greg Kroah-Hartman
maintainerPATCH 89/267 libata: add ATA_HORKAGE_NOTRIM
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arne Fitzenreiter <[email protected]>
commit 71d126fd28de2d4d9b7b2088dbccd7ca62fad6e0 upstream.
Some devices lose data on TRIM whether queued or not. This patch adds a horkage to disable TRIM.
tj: Collapsed unnecessary if() nesting.
--- drivers/ata/libata-scsi.c | 3 ++- drivers/ata/libata-transport.c | 2 ++ include/linux/libata.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +2 -1
@@ -2568,7 +2568,8 @@ static unsigned int ata_scsiop_read_cap( rbuf[14 ] = (lowest_aligned >>8 ) &0x3f ; rbuf[15 ] = lowest_aligned; -if (ata_id_has_trim (args->id)) { +if (ata_id_has_trim (args->id) && + !(dev->horkage &ATA_HORKAGE_NOTRIM )) { rbuf[14 ] |=0x80 ;/* LBPME */ if (ata_id_has_zero_after_trim(args->id) &&
drivers/ata/libata-transport.c +2 -0
@@ -569,6 +569,8 @@ show_ata_dev_trim(struct device *dev,if (!ata_id_has_trim (ata_dev->id)) mode ="unsupported" ; +else if (ata_dev->horkage &ATA_HORKAGE_NOTRIM ) + mode ="forced_unsupported" ;else if (ata_dev->horkage &ATA_HORKAGE_NO_NCQ_TRIM ) mode ="forced_unqueued" ;else if (ata_fpdma_dsm_supported (ata_dev))
include/linux/libata.h +2 -0
@@ -432,6 +432,8 @@ enum {ATA_HORKAGE_WD_BROKEN_LPM = (1 <<21 ),/* some WDs have broken LPM */ ATA_HORKAGE_ZERO_AFTER_TRIM = (1 <<22 ),/* guarantees zero after trim */ ATA_HORKAGE_NO_NCQ_LOG = (1 <<23 ),/* don't use NCQ for log read */ +ATA_HORKAGE_NOTRIM = (1 <<24 ),/* don't use TRIM */ +/* DMA mask for user DMA control: User visible values; DO NOT renumber */
Greg Kroah-Hartman
maintainerPATCH 90/267 libata: add ATA_HORKAGE_MAX_SEC_1024 to revert back to previous max_sectors limit
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Milburn <[email protected]>
commit af34d637637eabaf49406eb35c948cd51ba262a6 upstream.
Since no longer limiting max_sectors to BLK_DEF_MAX_SECTORS (commit 34b48db66e08), data corruption may occur on ST380013AS drive configured on 82801JI (ICH10 Family) SATA controller. This patch will allow the driver to limit max_sectors as before
# cat /sys/block/sdb/queue/max_sectors_kb 512
I was able to double the max_sectors_kb value up to 16384 on linux-4.2.0-rc2 before seeing corruption, but seems safer to use previous limit. Without this patch max_sectors_kb will be 32767.
tj: Minor comment update.
--- drivers/ata/libata-core.c | 10 ++++++++++ include/linux/ata.h | 1 + include/linux/libata.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/ata/libata-core.c +10 -0
@@ -2478,6 +2478,10 @@ int ata_dev_configure(struct ata_device dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, dev->max_sectors); +if (dev->horkage &ATA_HORKAGE_MAX_SEC_1024 ) + dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_1024, + dev->max_sectors); +if (dev->horkage &ATA_HORKAGE_MAX_SEC_LBA48 ) dev->max_sectors =ATA_MAX_SECTORS_LBA48 ;
@@ -4146,6 +4150,12 @@ static const struct ata_blacklist_entry { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, +/* +* Causes silent data corruption with higher max sects. +* http://lkml.kernel.org/g/[email protected] +*/ + { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, +/* Devices we expect to fail diagnostics */ /* Devices where NCQ should be avoided */
include/linux/ata.h +1 -0
@@ -45,6 +45,7 @@ enum {ATA_SECT_SIZE =512 ,ATA_MAX_SECTORS_128 =128 ,ATA_MAX_SECTORS =256 , +ATA_MAX_SECTORS_1024 =1024 ,ATA_MAX_SECTORS_LBA48 =65535 ,/* TODO: 65536? */ ATA_MAX_SECTORS_TAPE = 65535,
include/linux/libata.h +1 -1
@@ -433,7 +433,7 @@ enum {ATA_HORKAGE_ZERO_AFTER_TRIM = (1 <<22 ),/* guarantees zero after trim */ ATA_HORKAGE_NO_NCQ_LOG = (1 <<23 ),/* don't use NCQ for log read */ ATA_HORKAGE_NOTRIM = (1 <<24 ),/* don't use TRIM */ - + ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 *//* DMA mask for user DMA control: User visible values; DO NOT renumber */
Greg Kroah-Hartman
maintainerPATCH 91/267 libata: Do not blacklist M510DC
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit 9051bd393cf25e76dfb45409792719a854661500 upstream.
A new Micron drive was just announced, once again recycling the first part of the model string. Add an underscore to the M510/M550 pattern to avoid picking up the new DC drive.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -4240,7 +4240,7 @@ static const struct ata_blacklist_entry ATA_HORKAGE_ZERO_AFTER_TRIM, }, {"Crucial_CT*M500*" ,NULL ,ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, - { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | + { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, },
Greg Kroah-Hartman
maintainerPATCH 92/267 libata: force disable trim for SuperSSpeed S238
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arne Fitzenreiter <[email protected]>
commit cda57b1b05cf7b8b99ab4b732bea0b05b6c015cc upstream.
This device loses blocks, often the partition table area, on trim. Disable TRIM.
http://pcengines.ch/msata16a.htm
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -4249,6 +4249,9 @@ static const struct ata_blacklist_entry {"Samsung SSD 8*" ,NULL ,ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, + /* devices that don't properly handle TRIM commands */ + { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, +/* * As defined, the DRAT (Deterministic Read After Trim) and RZAT * (Return Zero After Trim) flags in the ATA Command Set are
Greg Kroah-Hartman
maintainerPATCH 93/267 usb: dwc3: gadget: return error if command sent to DGCMD register fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep Bhatta <[email protected]>
commit 891b1dc022955d36cf4c0f42d383226a930db7ed upstream.
We need to return error to caller if command is not sent to controller succesfully.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -291,6 +291,8 @@ int dwc3_send_gadget_generic_command(strdwc3_trace (trace_dwc3_gadget,"Command Complete --> %d" ,DWC3_DGCMD_STATUS (reg)); +if (DWC3_DGCMD_STATUS (reg)) +return -EINVAL ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 94/267 usb: dwc3: gadget: return error if command sent to DEPCMD register fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep Bhatta <[email protected]>
commit 76e838c9f7765f9a6205b4d558d75a66104bc60d upstream.
We need to return error to caller if command is not sent to controller succesfully.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -330,6 +330,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3dwc3_trace (trace_dwc3_gadget,"Command Complete --> %d" ,DWC3_DEPCMD_STATUS (reg)); +if (DWC3_DEPCMD_STATUS (reg)) +return -EINVAL ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 95/267 usb: dwc3: gadget: dont clear EP_BUSY too early
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit e18b7975c885bc3a938b9a76daf32957ea0235fa upstream.
In case of non-Isochronous transfers, we don't want to clear DWC3_EP_BUSY flag until XferComplete event. That's because XferInProgress was only enabled so we can recycle TRBs and usb_requests quicker, but there are still other pending requests being transferred.
In order to make sure we don't allow for another StartTransfer command while the HW is still processing other transfers, we must keep DWC3_EP_BUSY flag set and this what this patch does.
bulk/interrupt transfers)
--- drivers/usb/dwc3/gadget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +5 -1
@@ -1906,12 +1906,16 @@ static void dwc3_endpoint_transfer_compl {unsigned status =0 ;int clean_busy; +u32 is_xfer_complete; + + is_xfer_complete = (event->endpoint_event ==DWC3_DEPEVT_XFERCOMPLETE );if (event->status &DEPEVT_STATUS_BUSERR ) status = -ECONNRESET ; clean_busy =dwc3_cleanup_done_reqs (dwc, dep, event, status); -if (clean_busy) +if (clean_busy && (is_xfer_complete || +usb_endpoint_xfer_isoc (dep->endpoint.desc))) dep->flags &= ~DWC3_EP_BUSY ;/*
Greg Kroah-Hartman
maintainerPATCH 96/267 usb: dwc3: Reset the transfer resource index on SET_INTERFACE
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit aebda618718157a69c0dc0adb978d69bc2b8723c upstream.
This fixes an issue introduced in commit b23c843992b6 (usb: dwc3:
gadget: fix DEPSTARTCFG for non-EP0 EPs) that made sure we would only use DEPSTARTCFG once per SetConfig.
The trick is that we should use one DEPSTARTCFG per SetConfig *OR* SetInterface. SetInterface was completely missed from the original patch.
This problem became aparent after commit 76e838c9f776 (usb: dwc3:
gadget: return error if command sent to DEPCMD register fails) added checking of the return status of device endpoint commands.
'Set Endpoint Transfer Resource' command was caught failing occasionally. This is because the Transfer Resource Index was not getting reset during a SET_INTERFACE request.
Finally, to fix the issue, was we have to do is make sure that our start_config_issued flag gets reset whenever we receive a SetInterface request.
To verify the problem (and its fix), all we have to do is run test 9 from testusb with 'testusb -t 9 -s 2048 -a -c 5000'.
--- drivers/usb/dwc3/ep0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/dwc3/ep0.c +4 -0
@@ -727,6 +727,10 @@ static int dwc3_ep0_std_request(struct ddwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_ISOCH_DELAY" ); ret =dwc3_ep0_set_isoch_delay (dwc, ctrl);break ; +case USB_REQ_SET_INTERFACE : +dwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_INTERFACE" ); + dwc->start_config_issued = false; +/* Fall through */ default :dwc3_trace (trace_dwc3_ep0,"Forwarding to gadget driver" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
Greg Kroah-Hartman
maintainerPATCH 97/267 usb: core: Fix USB 3.0 devices lost in NOTATTACHED state after a hub port reset
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Schlabbach <[email protected]>
commit fb6d1f7df5d25299fd7b3e84b72b8851d3634764 upstream.
Fix USB 3.0 devices lost in NOTATTACHED state after a hub port reset.
Dissolve the function hub_port_finish_reset() completely and divide the actions to be taken into those which need to be done after each reset attempt and those which need to be done after the full procedure is complete, and place them in the appropriate places in hub_port_reset(). Also, remove an unneeded forward declaration of hub_port_reset().
Verbose Problem Description:
USB 3.0 devices may be "lost for good" during a hub port reset. This makes Linux unable to boot from USB 3.0 devices in certain constellations of host controllers and devices, because the USB device is lost during initialization, preventing the rootfs from being mounted.
The underlying problem is that in the affected constellations, during the processing inside hub_port_reset(), the hub link state goes from 0 to SS.inactive after the initial reset, and back to 0 again only after the following "warm" reset.
However, hub_port_finish_reset() is called after each reset attempt and sets the state the connected USB device based on the "preliminary" status of the hot reset to USB_STATE_NOTATTACHED due to SS.inactive, yet when the following warm reset is complete and hub_port_finish_reset() is called again, its call to set the device to USB_STATE_DEFAULT is blocked by usb_set_device_state() which does not allow taking USB devices out of USB_STATE_NOTATTACHED state.
Thanks to Alan Stern for guiding me to the proper solution and how to submit it.
--- drivers/usb/core/hub.c | 82 +++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 49 deletions(-)
drivers/usb/core/hub.c +33 -49
@@ -2616,9 +2616,6 @@ static bool use_new_scheme(struct usb_dereturn USE_NEW_SCHEME (retry); } -static int hub_port_reset (struct usb_hub *hub,int port1, -struct usb_device *udev,unsigned int delay,bool warm); -/* Is a USB 3.0 port in the Inactive or Compliance Mode state? * Port worm reset is required to recover */
@@ -2706,44 +2703,6 @@ static int hub_port_wait_reset(struct usreturn 0 ; } -static void hub_port_finish_reset (struct usb_hub *hub,int port1, -struct usb_device *udev,int *status) -{ -switch (*status) { -case 0 : -/* TRSTRCY = 10 ms; plus some extra */ -msleep (10 +40 ); -if (udev) { -struct usb_hcd *hcd =bus_to_hcd (udev->bus); - -update_devnum (udev,0 ); -/* The xHC may think the device is already reset, -* so ignore the status. -*/ -if (hcd->driver->reset_device) - hcd->driver->reset_device (hcd, udev); - } -/* FALL THROUGH */ -case -ENOTCONN : -case -ENODEV : -usb_clear_port_feature (hub->hdev, - port1,USB_PORT_FEAT_C_RESET ); -if (hub_is_superspeed (hub->hdev)) { -usb_clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_BH_PORT_RESET ); -usb_clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_PORT_LINK_STATE ); -usb_clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_CONNECTION ); - } -if (udev) -usb_set_device_state (udev, *status - ?USB_STATE_NOTATTACHED - :USB_STATE_DEFAULT ); -break ; - } -} -/* Handle port reset and port warm(BH) reset (for USB3 protocol ports) */ static int hub_port_reset (struct usb_hub *hub,int port1,struct usb_device *udev,unsigned int delay,bool warm)
@@ -2767,13 +2726,10 @@ static int hub_port_reset(struct usb_hub* If the caller hasn't explicitly requested a warm reset, * double check and see if one is needed. */ - status =hub_port_status (hub, port1, - &portstatus, &portchange); -if (status <0 ) - goto done; - -if (hub_port_warm_reset_required (hub, port1, portstatus)) - warm = true; +if (hub_port_status (hub, port1, &portstatus, &portchange) ==0 ) +if (hub_port_warm_reset_required (hub, port1, + portstatus)) + warm = true; }clear_bit (port1, hub->warm_reset_bits);
@@ -2799,11 +2755,19 @@ static int hub_port_reset(struct usb_hub/* Check for disconnect or reset */ if (status ==0 || status == -ENOTCONN || status == -ENODEV ) { -hub_port_finish_reset (hub, port1, udev, &status); +usb_clear_port_feature (hub->hdev, port1, +USB_PORT_FEAT_C_RESET );if (!hub_is_superspeed (hub->hdev)) goto done; +usb_clear_port_feature (hub->hdev, port1, +USB_PORT_FEAT_C_BH_PORT_RESET ); +usb_clear_port_feature (hub->hdev, port1, +USB_PORT_FEAT_C_PORT_LINK_STATE ); +usb_clear_port_feature (hub->hdev, port1, +USB_PORT_FEAT_C_CONNECTION ); +/* * If a USB 3.0 device migrates from reset to an error * state, re-issue the warm reset.
@@ -2836,6 +2800,26 @@ static int hub_port_reset(struct usb_hubdev_err (&port_dev->dev,"Cannot enable. Maybe the USB cable is bad?\n" ); done: +if (status ==0 ) { +/* TRSTRCY = 10 ms; plus some extra */ +msleep (10 +40 ); +if (udev) { +struct usb_hcd *hcd =bus_to_hcd (udev->bus); + +update_devnum (udev,0 ); +/* The xHC may think the device is already reset, +* so ignore the status. +*/ +if (hcd->driver->reset_device) + hcd->driver->reset_device (hcd, udev); + +usb_set_device_state (udev,USB_STATE_DEFAULT ); + } + }else { +if (udev) +usb_set_device_state (udev,USB_STATE_NOTATTACHED ); + } +if (!hub_is_superspeed (hub->hdev))up_read (&ehci_cf_port_reset_rwsem);
Greg Kroah-Hartman
maintainerPATCH 98/267 USB: devio: fix a condition in async_completed()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 83ed07c5db71bc02bd646d6eb60b48908235cdf9 upstream.
Static checkers complain that the current condition is never true. It seems pretty likely that it's a typo and "URB" was intended instead of "USB".
--- drivers/usb/core/devio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/devio.c +1 -1
@@ -513,7 +513,7 @@ static void async_completed(struct urb *snoop (&urb->dev->dev,"urb complete\n" );snoop_urb (urb->dev, as->userurb, urb->pipe, urb->actual_length, as->status,COMPLETE ,NULL ,0 ); -if ((urb->transfer_flags &URB_DIR_MASK ) ==USB_DIR_IN ) +if ((urb->transfer_flags &URB_DIR_MASK ) ==URB_DIR_IN )snoop_urb_data (urb, urb->actual_length); if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET &&
Greg Kroah-Hartman
maintainerPATCH 99/267 phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 4724e27114c4a7eceeee07db227a17fcab6f165c upstream.
The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this pm_runtime_get_sync() during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.
--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)
drivers/phy/phy-twl4030-usb.c +0 -1
@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected.
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Hello,
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-2@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 8 lines · Alexander Holler
Hello,
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
-Kishon
Quoted 49 lines
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-1@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. Signature · 5 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
This is probably related to
Commit: 56301df6bcaa ("phy: twl4030-usb: make runtime pm more reliable.")
I certainly only tested with that patch in place.
Looking at the code again, I cannot see why I thought I needed the 4724e277 patch.
Devices are initialised as RPM_SUSPENDED with a usage count of zero (in pm_runtime_init) so when twl4030_usb_probe() calls pm_runtime_get_sync(), that will increase the usage_count to 1 and resume the device. Then it calls pm_runtime_put_autosuspend() which will (ultimately) drop the usage_count back to zero and suspend the device.
So it looks like I messed up, but I'm sure I must have had a reason for that patch. I'll try to do some testing later in the week and will report what I find.
NeilBrown
Quoted 52 lines
-Kishon
Quoted 49 lines
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-1@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. Signature · 5 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Am 09.08.2015 um 11:00 schrieb NeilBrown:
Quoted 22 lines
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
Quoted 5 lines
This is probably related to
Commit:
56301df6bcaa("phy: twl4030-usb: make runtime pm more reliable.")I certainly only tested with that patch in place.
Cherry-Picking 56301df6bcaa instead of reverting d1221a608bd did the trick too. So it looks like 56301df6bcaa is indeed a prerequisit for d1221a608bd.
Therefor I suggest to feed 56301df6bcaa to the stable series (e.g. 4.1.6) too.
Regards,
Alexander Holler
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 27 lines · On Sun, 9 Aug 2015 12:45:20 +0200 Alexander Holler <[email protected]> wrote:
Am 09.08.2015 um 11:00 schrieb NeilBrown:
Quoted 26 lines
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
This is probably related to
Commit:
56301df6bcaa("phy: twl4030-usb: make runtime pm more reliable.")
Quoted 9 lines
Quoted 1 line
I certainly only tested with that patch in place.
Cherry-Picking
56301df6bcaainstead of revertingd1221a608bddid the trick too. So it looks like56301df6bcaais indeed a prerequisit ford1221a608bd.Therefor I suggest to feed
56301df6bcaato the stable series (e.g. 4.1.6) too.
The reality is ... more complicated.
I had a close look at how refcounts are inc/dec for the twl4030 phy.
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
The two counts come from twl4030_usb_irq and twl4030_charger_enable_usb, which is what I would expect.
However at the end of twl4030_usb_probe, the count goes to -1 !!! because of the pm_runtime_put_autosuspend, which no longer has a balancing pm_runtime_get() - which I really shouldn't have removed.
The extra refcount that I saw before and blamed on that pm_runtime_get() actually comes from a phy_power_on() call in omap2430_musb_init.
omap2430_musb_init() calls phy_power_on(), and doesn't call phy_power_off() until omap2430_musb_exit().
So it tries to keep the phy on the entire time that the module is loaded.
Do we want to just remove the phy_power_on() call from omap2430_musb_init()?
That seems to work for me, but may well break on other boards.
I think the best thing to do for -stable it to leave 56301df6bcaa out and revert the backport of d1221a608bd.
That will return to a state which, while not perfect, at least is not a regression.
With that (older) code, the extra phy_power_on() call still increases the usage_count, but the irq_handler in the twl4030 phy driver will drop it down to zero without first increasing. So things work for the wrong reasons.
Felipe: you added the phy_power_on() call in
Commit: 3063a12be2b0 ("usb: musb: fix PHY power on/off")
Do we really want the phy to be on the whole time the modules is loaded? If not, how/when should the phy be powered down?
Thanks,
NeilBrown
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Regards,
Alexander Holler
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 11 lines · On Tue, 11 Aug 2015 23:34:17 +0200 Alexander Holler <[email protected]>…
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
With an OTG cable, the usage_count would probably got to '1' because the charger wouldn't be interested.
However the important point is that the usage_count goes to zero when no cable is plugged in.
Quoted 5 lines
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Just reporting the problem is sometimes 90% for the bug fixed. I'm confident I know what is happening. What isn't clear is how best to fix it without breaking something else... I suspect Felipe can help with that.
Thanks,
NeilBrown
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Hi,
Quoted 27 lines · NeilBrown
Quoted 11 lines · On Tue, 11 Aug 2015 23:34:17 +0200 Alexander Holler <[email protected]>…
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
With an OTG cable, the
usage_countwould probably got to '1' because the charger wouldn't be interested.However the important point is that the
usage_countgoes to zero when no cable is plugged in.Quoted 5 lines
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Quoted 4 lines
Just reporting the problem is sometimes 90% for the bug fixed. I'm confident I know what is happening. What isn't clear is how best to fix it without breaking something else... I suspect Felipe can help with that.
It'll take me a while to be able to look at this. I don't have any platform with TWL4030 (IIRC, AM335x uses tps65218 instead). Besides, I have a slightly bigger problem to look at (MUSB + some hubs + CP2108 fails sometimes).
If I get some time, I'll try to have a look, but it might take a few weeks.
cheers
Signature · 1 line
balbi
Greg Kroah-Hartman
maintainerPATCH 100/267 usb: phy: mxs: suspend to RAM causes NULL pointer dereference
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
commit 543aa4867d4a2dff5fc11e1b688197ee3bad7f89 upstream.
Triggering suspend to RAM via sysfs on a i.MX28 causes a NULL pointer dereference. This patch avoids the oops in mxs_phy_get_vbus_status() by aborting since there is no syscon available.
--- drivers/usb/phy/phy-mxs-usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/phy/phy-mxs-usb.c +3 -0
@@ -217,6 +217,9 @@ static bool mxs_phy_get_vbus_status(stru {unsigned int vbus_value; +if (!mxs_phy->regmap_anatop) +return false; +if (mxs_phy->port_id ==0 ) regmap_read(mxs_phy->regmap_anatop, ANADIG_USB1_VBUS_DET_STAT,
Greg Kroah-Hartman
maintainerPATCH 101/267 phy: berlin-usb: fix divider for BG2CD
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hebb <[email protected]>
commit 96696a9df935d15fd2e89603454c20a692ec232a upstream.
The marvell,berlin2cd-usb-phy compatible incorrectly sets the PLL divider to BG2's value instead of BG2CD/BG2Q's. Change it to the right value.
--- drivers/phy/phy-berlin-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-berlin-usb.c +2 -2
@@ -106,8 +106,8 @@static const u32 phy_berlin_pll_dividers[] = {/* Berlin 2 */ CLK_REF_DIV (0xc ) |FEEDBACK_CLK_DIV (0x54 ), -/* Berlin 2CD */ -CLK_REF_DIV (0x6 ) |FEEDBACK_CLK_DIV (0x55 ), +/* Berlin 2CD/Q */ +CLK_REF_DIV (0xc ) |FEEDBACK_CLK_DIV (0x54 ), };struct phy_berlin_usb_priv {
Greg Kroah-Hartman
maintainerPATCH 102/267 usb: gadget: composite: Fix NULL pointer dereference
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kishon Vijay Abraham I <[email protected]>
commit b4c21f0bdd2c0cd5d5be1bb56f0a28dae5041eed upstream.
commit f563d230903210acc ("usb: gadget: composite: add req_match method to usb_function") accesses cdev->config even before set config is invoked causing a NULL pointer dereferencing error while running Lecroy Mass Storage Compliance test.
Fix it here by accessing cdev->config only if it is non NULL.
method to usb_function").
--- drivers/usb/gadget/composite.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/usb/gadget/composite.c +7 -4
@@ -1758,10 +1758,13 @@ unknown:* take such requests too, if that's ever needed: to work * in config 0, etc. */ -list_for_each_entry (f, &cdev->config->functions, list) -if (f->req_match && f->req_match (f, ctrl)) - goto try_fun_setup; - f =NULL ; +if (cdev->config) { +list_for_each_entry (f, &cdev->config->functions, list) +if (f->req_match && f->req_match (f, ctrl)) + goto try_fun_setup; + f =NULL ; + } +switch (ctrl->bRequestType &USB_RECIP_MASK ) {case USB_RECIP_INTERFACE :if (!cdev->config || intf >=MAX_CONFIG_INTERFACES )
Greg Kroah-Hartman
maintainerPATCH 103/267 usb: gadget: f_fs: do not set cancel function on synchronous {read,write}
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rui Miguel Silva <[email protected]>
commit 4088acf1e845aba35f30fb91dee10649edbd0e84 upstream.
do not try to set cancel function in synchronous operations in ffs_epfile_{read,write}_iter.
--- drivers/usb/gadget/function/f_fs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_fs.c +4 -2
@@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(str kiocb->private = p; -kiocb_set_cancel_fn (kiocb, ffs_aio_cancel); +if (p->aio) +kiocb_set_cancel_fn (kiocb, ffs_aio_cancel); res =ffs_epfile_io (kiocb->ki_filp, p);if (res == -EIOCBQUEUED )
@@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(stru kiocb->private = p; -kiocb_set_cancel_fn (kiocb, ffs_aio_cancel); +if (p->aio) +kiocb_set_cancel_fn (kiocb, ffs_aio_cancel); res =ffs_epfile_io (kiocb->ki_filp, p);if (res == -EIOCBQUEUED )
Greg Kroah-Hartman
maintainerPATCH 104/267 usb: gadget: mv_udc_core: fix phy_regs I/O memory leak
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
commit 53e20f2eb161fbe9eea28b54dccc870cec94eca2 upstream.
There was an omission in transition to devm_xxx resource handling. iounmap(udc->phy_regs) were removed, but ioremap() was left without devm_.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/gadget/udc/mv_udc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/mv_udc_core.c +1 -1
@@ -2167,7 +2167,7 @@ static int mv_udc_probe(struct platform_return -ENODEV ; } - udc->phy_regs =ioremap (r->start,resource_size (r)); + udc->phy_regs =devm_ioremap (&pdev->dev, r->start,resource_size (r));if (udc->phy_regs ==NULL ) {dev_err (&pdev->dev,"failed to map phy I/O memory\n" );return -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 105/267 usb: f_mass_storage: limit number of reported LUNs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Nazarewicz <[email protected]>
commit 8515bac01a983d277148e4fcc5f235bf603de577 upstream.
Mass storage function created via configfs always reports eight LUNs to the hosts even if only one LUN has been configured. Adjust the number when the USB function is allocated based on LUNs that user has created.
--- drivers/usb/gadget/function/f_mass_storage.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_mass_storage.c +13 -3
@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_commreturn -EINVAL ; } - curlun =kcalloc (nluns,sizeof (*curlun),GFP_KERNEL ); + curlun =kcalloc (FSG_MAX_LUNS ,sizeof (*curlun),GFP_KERNEL );if (unlikely (!curlun))return -ENOMEM ;
@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_comm common->luns = curlun; common->nluns = nluns; -pr_info ("Number of LUNs=%d\n" , common->nluns); -return 0 ; }EXPORT_SYMBOL_GPL (fsg_common_set_nluns);
@@ -3563,14 +3561,26 @@ static struct usb_function *fsg_alloc(ststruct fsg_opts *opts =fsg_opts_from_func_inst (fi);struct fsg_common *common = opts->common;struct fsg_dev *fsg; +unsigned nluns, i; fsg =kzalloc (sizeof (*fsg),GFP_KERNEL );if (unlikely (!fsg))return ERR_PTR (-ENOMEM );mutex_lock (&opts->lock); +if (!opts->refcnt) { +for (nluns = i =0 ; i <FSG_MAX_LUNS ; ++i) +if (common->luns[i]) + nluns = i +1 ; +if (!nluns) +pr_warn ("No LUNS defined, continuing anyway\n" ); +else + common->nluns = nluns; +pr_info ("Number of LUNs=%u\n" , common->nluns); + } opts->refcnt++;mutex_unlock (&opts->lock); + fsg->function.name =FSG_DRIVER_DESC ; fsg->function.bind = fsg_bind; fsg->function.unbind = fsg_unbind;
Greg Kroah-Hartman
maintainerPATCH 106/267 usb: musb: host: rely on port_mode to call musb_start()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit be9d39881fc4fa39a64b6eed6bab5d9ee5125344 upstream.
Currently, we're calling musb_start() twice for DRD ports in some situations. This has been observed to cause enumeration issues after suspend/resume cycles with AM335x.
In order to fix the problem, we just have to fix the check on musb_has_gadget() so that it only returns true if current mode is Host and ignore the fact that we have or not a gadget driver loaded.
--- drivers/usb/musb/musb_virthub.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/musb/musb_virthub.c +1 -3
@@ -273,9 +273,7 @@ static int musb_has_gadget(struct musb *#ifdef CONFIG_USB_MUSB_HOST return 1 ;#else -if (musb->port_mode ==MUSB_PORT_MODE_HOST ) -return 1 ; -return musb->g.dev.driver !=NULL ; +return musb->port_mode ==MUSB_PORT_MODE_HOST ;#endif }
Greg Kroah-Hartman
maintainerPATCH 107/267 USB: cp210x: add ID for Aruba Networks controllers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Sanford <[email protected]>
commit f98a7aa81eeeadcad25665c3501c236d531d4382 upstream.
Add the USB serial console device ID for Aruba Networks 7xxx series controllers which have a USB port for their serial console.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -187,6 +187,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ + { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
Greg Kroah-Hartman
maintainerPATCH 108/267 USB: option: add 2020:4000 ID
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudio Cappelli <[email protected]>
commit f6d7fb37f92622479ef6da604f27561f5045ba1e upstream.
Add device Olivetti Olicard 300 (Network Connect: MT6225) - IDs 2020:4000.
T: Bus=01 Lev=02 Prnt=04 Port=00 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2020 ProdID=4000 Rev=03.00 S: Manufacturer=Network Connect S: Product=MT6225 C: #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=option I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/usb/serial/option.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/option.c +1 -0
@@ -1765,6 +1765,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, { } /* Terminating entry */
Greg Kroah-Hartman
maintainerPATCH 109/267 USB: serial: Destroy serial_minors IDR on module exit
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <[email protected]>
commit d23f47d4927fd2f61b3a754d83c7bcec215b5cfe upstream.
Destroy serial_minors IDR on module exit, reclaiming the allocated memory.
This was detected by the following semantic patch (written by Luis Rodriguez <[email protected]>)
<SmPL>
@ defines_module_init @
declarer name module_init, module_exit;
declarer name DEFINE_IDR;
identifier init;
@@
module_init(init);
@ defines_module_exit @
identifier exit;
@@
module_exit(exit);
@ declares_idr depends on defines_module_init && defines_module_exit @ identifier idr;
@@
DEFINE_IDR(idr);
@ on_exit_calls_destroy depends on declares_idr && defines_module_exit @ identifier declares_idr.idr, defines_module_exit.exit;
@@
exit(void)
{
...
idr_destroy(&idr);
...
}
@ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @ identifier declares_idr.idr, defines_module_exit.exit;
@@
exit(void)
{
...
+idr_destroy(&idr);
}
</SmPL>
--- drivers/usb/serial/usb-serial.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/usb-serial.c +1 -0
@@ -1306,6 +1306,7 @@ static void __exit usb_serial_exit(void)tty_unregister_driver (usb_serial_tty_driver);put_tty_driver (usb_serial_tty_driver);bus_unregister (&usb_serial_bus_type); +idr_destroy (&serial_minors); }
Greg Kroah-Hartman
maintainerPATCH 110/267 USB: OHCI: Fix race between ED unlink and URB submission
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 7d8021c967648accd1b78e5e1ddaad655cd2c61f upstream.
This patch fixes a bug introduced by commit 977dcfdc6031 ("USB: OHCI:
don't lose track of EDs when a controller dies"). The commit changed ed_state from ED_UNLINK to ED_IDLE too early, before finish_urb() had been called. The user-visible consequence is that the driver occasionally crashes or locks up when an URB is submitted while another URB for the same endpoint is being unlinked.
This patch moves the ED state change later, to the right place. The drawback is that now we may unnecessarily execute some instructions multiple times when a controller dies. Since controllers dying is an exceptional occurrence, a little wasted time won't matter.
--- drivers/usb/host/ohci-q.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/usb/host/ohci-q.c +1 -6
@@ -980,10 +980,6 @@ rescan_all:int completed, modified;__hc32 *prev; -/* Is this ED already invisible to the hardware? */ -if (ed->state ==ED_IDLE ) - goto ed_idle; -/* only take off EDs that the HC isn't using, accounting for * frame counter wraps and EDs with partially retired TDs */
@@ -1011,12 +1007,10 @@ skip_ed: }/* ED's now officially unlinked, hc doesn't see */ - ed->state =ED_IDLE ; ed->hwHeadP &= ~cpu_to_hc32 (ohci,ED_H ); ed->hwNextED =0 ;wmb (); ed->hwINFO &= ~cpu_to_hc32 (ohci,ED_SKIP |ED_DEQUEUE ); -ed_idle:/* reentrancy: if we drop the schedule lock, someone might * have modified this list. normally it's just prepending
@@ -1087,6 +1081,7 @@ rescan_this:if (list_empty (&ed->td_list)) { *last = ed->ed_next; ed->ed_next =NULL ; + ed->state =ED_IDLE ;list_del (&ed->in_use_list); }else if (ohci->rh_state ==OHCI_RH_RUNNING ) { *last = ed->ed_next;
Greg Kroah-Hartman
maintainerPATCH 111/267 usb: core: lpm: set lpm_capable for root hub device
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 2d2a316765d956bc5cb6bb367b2ec52ca59ab8e9 upstream.
Commit 25cd2882e2fc ("usb/xhci: Change how we indicate a host supports Link PM.") removed the code to set lpm_capable for USB 3.0 super-speed root hub. The intention of that change was to avoid touching usb core internal field, a.k.a. lpm_capable, and let usb core to set it by checking U1 and U2 exit latency values in the descriptor.
Usb core checks and sets lpm_capable in hub_port_init(). Unfortunately, root hub is a special usb device as it has no parent. Hub_port_init() will never be called for a root hub device. That means lpm_capable will by no means be set for the root hub. As the result, lpm isn't functional at all in Linux kernel.
This patch add the code to check and set lpm_capable when registering a root hub device. It could be back-ported to kernels as old as v3.15, that contains the Commit 25cd2882e2fc ("usb/xhci: Change how we indicate a host supports Link PM.").
--- drivers/usb/core/hcd.c | 7 +++++-- drivers/usb/core/hub.c | 2 +- drivers/usb/core/usb.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/usb/core/hcd.c +5 -2
@@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_ dev_name(&usb_dev->dev), retval);return (retval <0 ) ? retval : -EMSGSIZE ; } -if (usb_dev->speed ==USB_SPEED_SUPER ) { + +if (le16_to_cpu (usb_dev->descriptor.bcdUSB) >=0x0201 ) { retval =usb_get_bos_descriptor (usb_dev); -if (retval <0 ) { +if (!retval) { + usb_dev->lpm_capable =usb_device_supports_lpm (usb_dev); + }else if (usb_dev->speed ==USB_SPEED_SUPER ) {mutex_unlock (&usb_bus_list_lock);dev_dbg (parent_dev,"can't read %s bos descriptor %d\n" ,dev_name (&usb_dev->dev), retval);
drivers/usb/core/hub.c +1 -1
@@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(streturn usb_get_intfdata (hdev->actconfig->interface[0 ]); } -static int usb_device_supports_lpm (struct usb_device *udev) +int usb_device_supports_lpm (struct usb_device *udev) {/* USB 2.1 (and greater) devices indicate LPM support through * their USB 2.0 Extended Capabilities BOS descriptor.
drivers/usb/core/usb.h +1 -0
@@ -65,6 +65,7 @@ extern int usb_hub_init(void);extern void usb_hub_cleanup (void );extern int usb_major_init (void );extern void usb_major_cleanup (void ); +extern int usb_device_supports_lpm (struct usb_device *udev);#ifdef CONFIG_PM
Greg Kroah-Hartman
maintainerPATCH 112/267 usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AMAN DEEP <[email protected]>
commit 3496810663922617d4b706ef2780c279252ddd6a upstream.
virt_dev->num_cached_rings counts on freed ring and is not updated correctly. In xhci_free_or_cache_endpoint_ring() function, the free ring is added into cache and then num_rings_cache is incremented as below:
virt_dev->ring_cache[rings_cached] = virt_dev->eps[ep_index].ring; virt_dev->num_rings_cached++;
here, free ring pointer is added to a current index and then index is incremented.
So current index always points to empty location in the ring cache. For getting available free ring, current index should be decremented first and then corresponding ring buffer value should be taken from ring cache.
But In function xhci_endpoint_init(), the num_rings_cached index is accessed before decrement.
virt_dev->eps[ep_index].new_ring = virt_dev->ring_cache[virt_dev->num_rings_cached]; virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; virt_dev->num_rings_cached--; This is bug in manipulating the index of ring cache. And it should be as below: virt_dev->num_rings_cached--; virt_dev->eps[ep_index].new_ring = virt_dev->ring_cache[virt_dev->num_rings_cached]; virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
--- drivers/usb/host/xhci-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
@@ -1427,10 +1427,10 @@ int xhci_endpoint_init(struct xhci_hcd */* Attempt to use the ring cache */ if (virt_dev->num_rings_cached ==0 )return -ENOMEM ; + virt_dev->num_rings_cached--; virt_dev->eps[ep_index].new_ring = virt_dev->ring_cache[virt_dev->num_rings_cached]; virt_dev->ring_cache[virt_dev->num_rings_cached] =NULL ; - virt_dev->num_rings_cached--;xhci_reinit_cached_ring (xhci, virt_dev->eps[ep_index].new_ring,1 , type); }
Greg Kroah-Hartman
maintainerPATCH 113/267 dm cache: fix race when issuing a POLICY_REPLACE operation
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit fb4100ae7f312c3d614b37621c2b17b3b7cf65f8 upstream.
There is a race between a policy deciding to replace a cache entry, the core target writing back any dirty data from this block, and other IO threads doing IO to the same block.
This sort of problem is avoided most of the time by the core target grabbing a bio prison cell before making the request to the policy. But for a demotion the core target doesn't know which block will be demoted, so can't do this in advance.
Fix this demotion race by introducing a callback to the policy interface that allows the policy to grab the cell on behalf of the core target.
--- drivers/md/dm-cache-policy-cleaner.c | 3 + drivers/md/dm-cache-policy-internal.h | 5 +- drivers/md/dm-cache-policy-mq.c | 41 ++++++++++++++++-------- drivers/md/dm-cache-policy.h | 15 ++++++++ drivers/md/dm-cache-target.c | 58 ++++++++++++++++++++++------------ 5 files changed, 85 insertions(+), 37 deletions(-)
drivers/md/dm-cache-policy-cleaner.c +2 -1
@@ -171,7 +171,8 @@ static void remove_cache_hash_entry(stru/* Public interface (see dm-cache-policy.h */ static int wb_map (struct dm_cache_policy *pe,dm_oblock_t oblock,bool can_block,bool can_migrate,bool discarded_oblock, -struct bio *bio,struct policy_result *result) +struct bio *bio,struct policy_locker *locker, +struct policy_result *result) {struct policy *p =to_policy (pe);struct wb_cache_entry *e;
drivers/md/dm-cache-policy-internal.h +3 -2
@@ -16,9 +16,10 @@*/ static inline int policy_map (struct dm_cache_policy *p,dm_oblock_t oblock,bool can_block,bool can_migrate,bool discarded_oblock, -struct bio *bio,struct policy_result *result) +struct bio *bio,struct policy_locker *locker, +struct policy_result *result) { -return p->map (p, oblock, can_block, can_migrate, discarded_oblock, bio, result); +return p->map (p, oblock, can_block, can_migrate, discarded_oblock, bio, locker, result); }static inline int policy_lookup (struct dm_cache_policy *p,dm_oblock_t oblock,dm_cblock_t *cblock)
drivers/md/dm-cache-policy-mq.c +28 -13
130 lines not on this page · raw message
drivers/md/dm-cache-policy.h +14 -1
@@ -70,6 +70,18 @@ enum policy_operation { };/* +* When issuing a POLICY_REPLACE the policy needs to make a callback to +* lock the block being demoted. This doesn't need to occur during a +* writeback operation since the block remains in the cache. +*/ +struct policy_locker ; +typedef int (*policy_lock_fn )(struct policy_locker *l,dm_oblock_t oblock); + +struct policy_locker { +policy_lock_fn fn; +}; + +/* * This is the instruction passed back to the core target. */ struct policy_result {
@@ -122,7 +134,8 @@ struct dm_cache_policy {*/ int (*map)(struct dm_cache_policy *p,dm_oblock_t oblock,bool can_block,bool can_migrate,bool discarded_oblock, -struct bio *bio,struct policy_result *result); +struct bio *bio,struct policy_locker *locker, +struct policy_result *result);/* * Sometimes we want to see if a block is in the cache, without
drivers/md/dm-cache-target.c +38 -20
102 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 114/267 dm stats: fix divide by zero if number_of_areas arg is zero
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit dd4c1b7d0c95be1c9245118a3accc41a16f1db67 upstream.
If the number_of_areas argument was zero the kernel would crash on div-by-zero. Add better input validation.
--- drivers/md/dm-stats.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm-stats.c +2 -0
@@ -795,6 +795,8 @@ static int message_stats_create(struct mreturn -EINVAL ;if (sscanf (argv[2 ],"/%u%c" , &divisor, &dummy) ==1 ) { +if (!divisor) +return -EINVAL ; step = end - start;if (do_div (step, divisor)) step++;
Greg Kroah-Hartman
maintainerPATCH 115/267 dm space map metadata: fix occasional leak of a metadata block on resize
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 6096d91af0b65a3967139b32d5adbb3647858a26 upstream.
The metadata space map has a simplified 'bootstrap' mode that is operational when extending the space maps. Whilst in this mode it's possible for some refcount decrement operations to become queued (eg, as a result of shadowing one of the bitmap indexes). These decrements were not being applied when switching out of bootstrap mode.
The effect of this bug was the leaking of a 4k metadata block. This is detected by the latest version of thin_check as a non fatal error.
--- drivers/md/persistent-data/dm-space-map-metadata.c | 50 ++++++++++++++------- 1 file changed, 35 insertions(+), 15 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +35 -15
@@ -204,6 +204,27 @@ static void in(struct sm_metadata *smm) smm->recursion_count++; } +static int apply_bops (struct sm_metadata *smm) +{ +int r =0 ; + +while (!brb_empty (&smm->uncommitted)) { +struct block_op bop; + + r =brb_pop (&smm->uncommitted, &bop); +if (r) { +DMERR ("bug in bop ring buffer" ); +break ; + } + + r =commit_bop (smm, &bop); +if (r) +break ; + } + +return r; +} +static int out (struct sm_metadata *smm) {int r =0 ;
@@ -216,21 +237,8 @@ static int out(struct sm_metadata *smm)return -ENOMEM ; } -if (smm->recursion_count ==1 ) { -while (!brb_empty (&smm->uncommitted)) { -struct block_op bop; - - r =brb_pop (&smm->uncommitted, &bop); -if (r) { -DMERR ("bug in bop ring buffer" ); -break ; - } - - r =commit_bop (smm, &bop); -if (r) -break ; - } - } +if (smm->recursion_count ==1 ) +apply_bops (smm); smm->recursion_count--;
@@ -704,6 +712,12 @@ static int sm_metadata_extend(struct dm_ } old_len = smm->begin; + r =apply_bops (smm); +if (r) { +DMERR ("%s: apply_bops failed" , __func__); + goto out; + } + r =sm_ll_commit (&smm->ll);if (r) goto out;
@@ -773,6 +787,12 @@ int dm_sm_metadata_create(struct dm_spacif (r)return r; + r =apply_bops (smm); +if (r) { +DMERR ("%s: apply_bops failed" , __func__); +return r; + } +return sm_metadata_commit (sm); }
Greg Kroah-Hartman
maintainerPATCH 116/267 dm btree remove: fix bug in redistribute3
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Yang <[email protected]>
commit 4c7e309340ff85072e96f529582d159002c36734 upstream.
redistribute3() shares entries out across 3 nodes. Some entries were being moved the wrong way, breaking the ordering. This manifested as a BUG() in dm-btree-remove.c:shift() when entries were removed from the btree.
For additional context see:
https://www.redhat.com/archives/dm-devel/2015-May/msg00113.html
--- drivers/md/persistent-data/dm-btree-remove.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/persistent-data/dm-btree-remove.c +3 -3
@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btreif (s <0 && nr_center < -s) {/* not enough in central node */ -shift (left, center, nr_center); - s = nr_center - target; +shift (left, center, -nr_center); + s += nr_center;shift (left, right, s); nr_right += s; }else
@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btreif (s >0 && nr_center < s) {/* not enough in central node */ shift (center, right, nr_center); - s = target - nr_center; + s -= nr_center;shift (left, right, s); nr_left -= s; }else
Greg Kroah-Hartman
maintainerPATCH 117/267 dm thin: allocate the cell_sort_array dynamically
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit a822c83e47d97cdef38c4352e1ef62d9f46cfe98 upstream.
Given the pool's cell_sort_array holds 8192 pointers it triggers an order 5 allocation via kmalloc. This order 5 allocation is prone to failure as system memory gets more fragmented over time.
Fix this by allocating the cell_sort_array using vmalloc.
--- drivers/md/dm-thin.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/md/dm-thin.c +12 -1
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/vmalloc.h> #include <linux/sort.h> #include <linux/rbtree.h>
@@ -260,7 +261,7 @@ struct pool {process_mapping_fn process_prepared_mapping;process_mapping_fn process_prepared_discard; -struct dm_bio_prison_cell *cell_sort_array[CELL_SORT_ARRAY_SIZE ]; +struct dm_bio_prison_cell **cell_sort_array; };static enum pool_mode get_pool_mode (struct pool *pool);
@@ -2499,6 +2500,7 @@ static void __pool_destroy(struct pool * {__pool_table_remove (pool); +vfree (pool->cell_sort_array);if (dm_pool_metadata_close (pool->pmd) <0 )DMWARN ("%s: dm_pool_metadata_close() failed." , __func__);
@@ -2611,6 +2613,13 @@ static struct pool *pool_create(struct m goto bad_mapping_pool; } + pool->cell_sort_array =vmalloc (sizeof (*pool->cell_sort_array) *CELL_SORT_ARRAY_SIZE ); +if (!pool->cell_sort_array) { + *error ="Error allocating cell sort array" ; + err_p =ERR_PTR (-ENOMEM ); + goto bad_sort_array; + } + pool->ref_count =1 ; pool->last_commit_jiffies = jiffies; pool->pool_md = pool_md;
@@ -2619,6 +2628,8 @@ static struct pool *pool_create(struct mreturn pool; +bad_sort_array: +mempool_destroy (pool->mapping_pool); bad_mapping_pool:dm_deferred_set_destroy (pool->all_io_ds); bad_all_io_ds:
Greg Kroah-Hartman
maintainerPATCH 118/267 dm btree: silence lockdep lock inversion in dm_btree_del()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 1c7518794a3647eb345d59ee52844e8a40405198 upstream.
Allocate memory using GFP_NOIO when deleting a btree. dm_btree_del() can be called via an ioctl and we don't want to recurse into the FS or block layer.
--- drivers/md/persistent-data/dm-btree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/persistent-data/dm-btree.c +1 -1
@@ -255,7 +255,7 @@ int dm_btree_del(struct dm_btree_info *iint r;struct del_stack *s; - s =kmalloc (sizeof (*s),GFP_KERNEL ); + s =kmalloc (sizeof (*s),GFP_NOIO );if (!s)return -ENOMEM ; s->info = info;
Greg Kroah-Hartman
maintainerPATCH 119/267 mmc: block: Add missing mmc_blk_put() in power_ro_lock_show()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit 9098f84cced870f54d8c410dd2444cfa61467fa0 upstream.
Enclosing mmc_blk_put() is missing in power_ro_lock_show() sysfs handler, let's add it.
--- drivers/mmc/card/block.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/card/block.c +2 -0
@@ -208,6 +208,8 @@ static ssize_t power_ro_lock_show(struct ret =snprintf (buf,PAGE_SIZE ,"%d\n" , locked); +mmc_blk_put (md); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 120/267 block: loop: convert to per-device workqueue
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit f4aa4c7bbac6c4afdd4adccf90898c1a3685396d upstream.
Documentation/workqueue.txt:
If there is dependency among multiple work items used during memory reclaim, they should be queued to separate wq each with WQ_MEM_RECLAIM.
Loop devices can be stacked, so we have to convert to per-device workqueue. One example is Fedora live CD.
--- drivers/block/loop.c | 30 ++++++++++++++---------------- drivers/block/loop.h | 1 + 2 files changed, 15 insertions(+), 16 deletions(-)
drivers/block/loop.c +14 -16
@@ -86,8 +86,6 @@ static DEFINE_MUTEX(loop_index_mutex);static int max_part;static int part_shift; -static struct workqueue_struct *loop_wq; - static int transfer_xor(struct loop_device *lo, int cmd, struct page *raw_page, unsigned raw_off, struct page *loop_page, unsigned loop_off,
@@ -725,6 +723,12 @@ static int loop_set_fd(struct loop_devic size =get_loop_size (lo, file);if ((loff_t )(sector_t )size != size) goto out_putf; + error = -ENOMEM ; + lo->wq =alloc_workqueue ("kloopd%d" , +WQ_MEM_RECLAIM |WQ_HIGHPRI |WQ_UNBOUND ,0 , + lo->lo_number); +if (!lo->wq) + goto out_putf; error =0 ;
@@ -872,6 +876,8 @@ static int loop_clr_fd(struct loop_devic lo->lo_flags =0 ;if (!part_shift) lo->lo_disk->flags |=GENHD_FL_NO_PART_SCAN ; +destroy_workqueue (lo->wq); + lo->wq =NULL ;mutex_unlock (&lo->lo_ctl_mutex);/* * Need not hold lo_ctl_mutex to fput backing file.
@@ -1425,9 +1431,13 @@ static int loop_queue_rq(struct blk_mq_h const struct blk_mq_queue_data *bd) {struct loop_cmd *cmd =blk_mq_rq_to_pdu (bd->rq); +struct loop_device *lo = cmd->rq->q->queuedata;blk_mq_start_request (bd->rq); +if (lo->lo_state != Lo_bound) +return -EIO ; +if (cmd->rq->cmd_flags &REQ_WRITE ) {struct loop_device *lo = cmd->rq->q->queuedata;bool need_sched = true;
@@ -1441,9 +1451,9 @@ static int loop_queue_rq(struct blk_mq_hspin_unlock_irq (&lo->lo_lock);if (need_sched) -queue_work (loop_wq, &lo->write_work); +queue_work (lo->wq, &lo->write_work); }else { -queue_work (loop_wq, &cmd->read_work); +queue_work (lo->wq, &cmd->read_work); }return BLK_MQ_RQ_QUEUE_OK ;
@@ -1455,9 +1465,6 @@ static void loop_handle_cmd(struct loop_struct loop_device *lo = cmd->rq->q->queuedata;int ret = -EIO ; -if (lo->lo_state != Lo_bound) - goto failed; -if (write && (lo->lo_flags &LO_FLAGS_READ_ONLY )) goto failed;
@@ -1806,13 +1813,6 @@ static int __init loop_init(void) goto misc_out; } - loop_wq =alloc_workqueue ("kloopd" , -WQ_MEM_RECLAIM |WQ_HIGHPRI |WQ_UNBOUND ,0 ); -if (!loop_wq) { - err = -ENOMEM ; - goto misc_out; - } -blk_register_region (MKDEV (LOOP_MAJOR ,0 ), range,THIS_MODULE , loop_probe,NULL ,NULL );
@@ -1850,8 +1850,6 @@ static void __exit loop_exit(void)blk_unregister_region (MKDEV (LOOP_MAJOR ,0 ), range);unregister_blkdev (LOOP_MAJOR ,"loop" ); -destroy_workqueue (loop_wq); -misc_deregister (&loop_misc); }
drivers/block/loop.h +1 -0
@@ -54,6 +54,7 @@ struct loop_device {gfp_t old_gfp_mask;spinlock_t lo_lock; +struct workqueue_struct *wq;struct list_head write_cmd_head;struct work_struct write_work;bool write_started;
Greg Kroah-Hartman
maintainerPATCH 121/267 block: loop: avoiding too many pending per work I/O
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit 4d4e41aef9429872ea3b105e83426941f7185ab6 upstream.
If there are too many pending per work I/O, too many high priority work thread can be generated so that system performance can be effected.
This patch limits the max_active parameter of workqueue as 16.
This patch fixes Fedora 22 live booting performance regression when it is booted from squashfs over dm based on loop, and looks the following reasons are related with the problem:
- not like other filesyststems(such as ext4), squashfs is a bit special, and I observed that increasing I/O jobs to access file in squashfs only improve I/O performance a little, but it can make big difference for ext4
- nested loop: both squashfs.img and ext3fs.img are mounted as loop block, and ext3fs.img is inside the squashfs
- during booting, lots of tasks may run concurrently
--- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/loop.c +1 -1
@@ -725,7 +725,7 @@ static int loop_set_fd(struct loop_devic goto out_putf; error = -ENOMEM ; lo->wq =alloc_workqueue ("kloopd%d" , -WQ_MEM_RECLAIM |WQ_HIGHPRI |WQ_UNBOUND ,0 , +WQ_MEM_RECLAIM |WQ_HIGHPRI |WQ_UNBOUND ,16 , lo->lo_number);if (!lo->wq) goto out_putf;
Greg Kroah-Hartman
maintainerPATCH 122/267 block: Do a full clone when splitting discard bios
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit f3f5da624e0a891c34d8cd513c57f1d9b0c7dadc upstream.
This fixes a data corruption bug when using discard on top of MD linear, raid0 and raid10 personalities.
Commit 20d0189b1012 "block: Introduce new bio_split()" permits sharing the bio_vec between the two resulting bios. That is fine for read/write requests where the bio_vec is immutable. For discards, however, we need to be able to attach a payload and update the bio_vec so the page can get mapped to a scatterlist entry. Therefore the bio_vec can not be shared when splitting discards and we must do a full clone.
--- block/bio.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
block/bio.c +12 -3
@@ -1814,8 +1814,9 @@ EXPORT_SYMBOL(bio_endio_nodec);* Allocates and returns a new bio which represents @sectors from the start of * @bio, and updates @bio to represent the remaining sectors. * -* The newly allocated bio will point to @bio's bi_io_vec; it is the caller's -* responsibility to ensure that @bio is not freed before the split. +* Unless this is a discard request the newly allocated bio will point +* to @bio's bi_io_vec; it is the caller's responsibility to ensure that +* @bio is not freed before the split. */ struct bio *bio_split (struct bio *bio,int sectors,gfp_t gfp,struct bio_set *bs)
@@ -1825,7 +1826,15 @@ struct bio *bio_split(struct bio *bio, iBUG_ON (sectors <=0 );BUG_ON (sectors >=bio_sectors (bio)); - split =bio_clone_fast (bio, gfp, bs); +/* +* Discards need a mutable bio_vec to accommodate the payload +* required by the DSM TRIM and UNMAP commands. +*/ +if (bio->bi_rw &REQ_DISCARD ) + split =bio_clone_bioset (bio, gfp, bs); +else + split =bio_clone_fast (bio, gfp, bs); +if (!split)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 123/267 ARM: at91/dt: sama5d4ek: mci0 uses slot 0
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ludovic Desroches <[email protected]>
commit ea25525ce0d195724fead07fe6562fe478a3bf6f upstream.
Mci0 uses slot 0 not 1.
--- arch/arm/boot/dts/at91-sama5d4ek.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91-sama5d4ek.dts +2 -2
@@ -108,8 +108,8 @@ mmc0: mmc@f8000000 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>; - slot@1 { - reg = <1>; + slot@0 { + reg = <0>; bus-width = <4>; cd-gpios = <&pioE 5 0>; };
Greg Kroah-Hartman
maintainerPATCH 124/267 ARM: at91/dt: sama5d4: fix dma conf for aes, sha and tdes nodes
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit aabbe8f1a561dd8318e693830d9ae377c9a04d2b upstream.
The xdmac channel configuration is done in one cell not two. This error prevents from probing devices correctly.
--- arch/arm/boot/dts/sama5d4.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/boot/dts/sama5d4.dtsi +10 -10
@@ -1125,10 +1125,10 @@ compatible = "atmel,at91sam9g46-aes"; reg = <0xfc044000 0x100>; interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>; - dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) - AT91_XDMAC_DT_PERID(41)>, - <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) - AT91_XDMAC_DT_PERID(40)>; + dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) + | AT91_XDMAC_DT_PERID(41))>, + <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) + | AT91_XDMAC_DT_PERID(40))>; dma-names = "tx", "rx"; clocks = <&aes_clk>; clock-names = "aes_clk";
@@ -1139,10 +1139,10 @@ compatible = "atmel,at91sam9g46-tdes"; reg = <0xfc04c000 0x100>; interrupts = <14 IRQ_TYPE_LEVEL_HIGH 0>; - dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) - AT91_XDMAC_DT_PERID(42)>, - <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) - AT91_XDMAC_DT_PERID(43)>; + dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) + | AT91_XDMAC_DT_PERID(42))>, + <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) + | AT91_XDMAC_DT_PERID(43))>; dma-names = "tx", "rx"; clocks = <&tdes_clk>; clock-names = "tdes_clk";
@@ -1153,8 +1153,8 @@ compatible = "atmel,at91sam9g46-sha"; reg = <0xfc050000 0x100>; interrupts = <15 IRQ_TYPE_LEVEL_HIGH 0>; - dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) - AT91_XDMAC_DT_PERID(44)>; + dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) + | AT91_XDMAC_DT_PERID(44))>; dma-names = "tx"; clocks = <&sha_clk>; clock-names = "sha_clk";
Greg Kroah-Hartman
maintainerPATCH 126/267 ARM: at91/dt: trivial: fix USB udc compatible string
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit 50f0a44991516b5b9744ecb2c080c2ec6ad21b25 upstream.
To please checkpatch and the tiresome reader, add the "atmel," prefix to the USB udc compatible string.
--- Documentation/devicetree/bindings/usb/atmel-usb.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/usb/atmel-usb.txt +3 -3
@@ -60,9 +60,9 @@ Atmel High-Speed USB device controller Required properties: - compatible: Should be one of the following - "at91sam9rl-udc" - "at91sam9g45-udc" - "sama5d3-udc" + "atmel,at91sam9rl-udc" + "atmel,at91sam9g45-udc" + "atmel,sama5d3-udc" - reg: Address and length of the register set for the device - interrupts: Should contain usba interrupt - ep childnode: To specify the number of endpoints and their properties.
Greg Kroah-Hartman
maintainerPATCH 127/267 ARM: at91/dt: update udc compatible strings
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit 6540165cf41655810ee67b78f01537af022a636a upstream.
at91sam9g45, at91sam9x5 and sama5 SoCs should not use "atmel,at91sam9rl-udc" for their USB device compatible property since this compatible is attached to a specific hardware bug fix.
--- arch/arm/boot/dts/at91sam9g45.dtsi | 2 +- arch/arm/boot/dts/at91sam9x5.dtsi | 2 +- arch/arm/boot/dts/sama5d3.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/at91sam9g45.dtsi +1 -1
@@ -1148,7 +1148,7 @@ usb2: gadget@fff78000 { #address-cells = <1>; #size-cells = <0>; - compatible = "atmel,at91sam9rl-udc"; + compatible = "atmel,at91sam9g45-udc"; reg = <0x00600000 0x80000 0xfff78000 0x400>; interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
arch/arm/boot/dts/at91sam9x5.dtsi +1 -1
@@ -1062,7 +1062,7 @@ usb2: gadget@f803c000 { #address-cells = <1>; #size-cells = <0>; - compatible = "atmel,at91sam9rl-udc"; + compatible = "atmel,at91sam9g45-udc"; reg = <0x00500000 0x80000 0xf803c000 0x400>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>;
arch/arm/boot/dts/sama5d3.dtsi +1 -1
@@ -1321,7 +1321,7 @@ usb0: gadget@00500000 { #address-cells = <1>; #size-cells = <0>; - compatible = "atmel,at91sam9rl-udc"; + compatible = "atmel,sama5d3-udc"; reg = <0x00500000 0x100000 0xf8030000 0x4000>; interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>;
arch/arm/boot/dts/sama5d4.dtsi +1 -1
@@ -123,7 +123,7 @@ usb0: gadget@00400000 { #address-cells = <1>; #size-cells = <0>; - compatible = "atmel,at91sam9rl-udc"; + compatible = "atmel,sama5d3-udc"; reg = <0x00400000 0x100000 0xfc02c000 0x4000>; interrupts = <47 IRQ_TYPE_LEVEL_HIGH 2>;
Greg Kroah-Hartman
maintainerPATCH 128/267 bus: arm-ccn: Fix node->XP config conversion
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Moll <[email protected]>
commit a18f8e97fe69195823d7fb5c68a8d6565f39db4b upstream.
Events defined as watchpoints on nodes must have their config values converted so that they apply to the respective node's XP. The function setting new values was using wrong mask for the "port" field, resulting in corrupted value. Fixed now.
--- drivers/bus/arm-ccn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/arm-ccn.c +1 -1
@@ -212,7 +212,7 @@ static int arm_ccn_node_to_xp_port(int nstatic void arm_ccn_pmu_config_set (u64 *config,u32 node_xp,u32 type,u32 port) { - *config &= ~((0xff <<0 ) | (0xff <<8 ) | (0xff <<24 )); + *config &= ~((0xff <<0 ) | (0xff <<8 ) | (0x3 <<24 )); *config |= (node_xp <<0 ) | (type <<8 ) | (port <<24 ); }
Greg Kroah-Hartman
maintainerPATCH 129/267 drm/vgem: Set unique to "vgem"
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit fa2f97dd33c2c32a06a5ea7f6e87af06a2e26baa upstream.
Since there's only one global instance ever we don't need to have anything fancy. Stops a WARNING in the get_unique ioctl that the unique name isn't set.
--- drivers/gpu/drm/vgem/vgem_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/vgem/vgem_drv.c +2 -0
@@ -328,6 +328,8 @@ static int __init vgem_init(void) goto out; } +drm_dev_set_unique (vgem_device,"vgem" ); + ret =drm_dev_register (vgem_device,0 );if (ret)
Greg Kroah-Hartman
maintainerPATCH 130/267 drm/dp/mst: close deadlock in connector destruction.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 6b8eeca65b18ae77e175cc2b6571731f0ee413bf upstream.
I've only seen this once, and I failed to capture the lockdep backtrace, but I did some investigations.
If we are calling into the MST layer from EDID probing, we have the mode_config mutex held, if during that EDID probing, the MST hub goes away, then we can get a deadlock where the connector destruction function in the driver tries to retake the mode config mutex.
This offloads connector destruction to a workqueue, and avoid the subsequenct lock ordering issue.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 40 ++++++++++++++++++++++++++++++++-- include/drm/drm_crtc.h | 2 + include/drm/drm_dp_mst_helper.h | 4 +++ 3 files changed, 44 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +38 -2
@@ -867,8 +867,16 @@ static void drm_dp_destroy_port(struct k port->vcpi.num_slots =0 ;kfree (port->cached_edid); -if (port->connector) - (*port->mgr->cbs->destroy_connector)(mgr, port->connector); + +/* we can't destroy the connector here, as +we might be holding the mode_config.mutex +from an EDID retrieval */ +if (port->connector) { +mutex_lock (&mgr->destroy_connector_lock); +list_add (&port->connector->destroy_list, &mgr->destroy_connector_list); +mutex_unlock (&mgr->destroy_connector_lock); +schedule_work (&mgr->destroy_connector_work); + }drm_dp_port_teardown_pdt (port, port->pdt);if (!port->input && port->vcpi.vcpi >0 )
@@ -2632,6 +2640,30 @@ static void drm_dp_tx_work(struct work_smutex_unlock (&mgr->qlock); } +static void drm_dp_destroy_connector_work (struct work_struct *work) +{ + struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); +struct drm_connector *connector; + +/* +* Not a regular list traverse as we have to drop the destroy +* connector lock before destroying the connector, to avoid AB->BA +* ordering between this lock and the config mutex. +*/ +for (;;) { +mutex_lock (&mgr->destroy_connector_lock); + connector = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_connector, destroy_list); +if (!connector) { +mutex_unlock (&mgr->destroy_connector_lock); +break ; + } +list_del (&connector->destroy_list); +mutex_unlock (&mgr->destroy_connector_lock); + + mgr->cbs->destroy_connector (mgr, connector); + } +} +/** * drm_dp_mst_topology_mgr_init - initialise a topology manager * @mgr: manager struct to initialise
@@ -2651,10 +2683,13 @@ int drm_dp_mst_topology_mgr_init(structmutex_init (&mgr->lock);mutex_init (&mgr->qlock);mutex_init (&mgr->payload_lock); +mutex_init (&mgr->destroy_connector_lock);INIT_LIST_HEAD (&mgr->tx_msg_upq);INIT_LIST_HEAD (&mgr->tx_msg_downq); +INIT_LIST_HEAD (&mgr->destroy_connector_list);INIT_WORK (&mgr->work, drm_dp_mst_link_probe_work);INIT_WORK (&mgr->tx_work, drm_dp_tx_work); +INIT_WORK (&mgr->destroy_connector_work, drm_dp_destroy_connector_work);init_waitqueue_head (&mgr->tx_waitq); mgr->dev = dev; mgr->aux = aux;
@@ -2679,6 +2714,7 @@ EXPORT_SYMBOL(drm_dp_mst_topology_mgr_in*/ void drm_dp_mst_topology_mgr_destroy (struct drm_dp_mst_topology_mgr *mgr) { +flush_work (&mgr->destroy_connector_work);mutex_lock (&mgr->payload_lock);kfree (mgr->payloads); mgr->payloads =NULL ;
include/drm/drm_crtc.h +2 -0
@@ -731,6 +731,8 @@ struct drm_connector {uint8_t num_h_tile, num_v_tile;uint8_t tile_h_loc, tile_v_loc;uint16_t tile_h_size, tile_v_size; + +struct list_head destroy_list; };/**
include/drm/drm_dp_mst_helper.h +4 -0
@@ -463,6 +463,10 @@ struct drm_dp_mst_topology_mgr {struct work_struct work;struct work_struct tx_work; + +struct list_head destroy_connector_list; +struct mutex destroy_connector_lock; +struct work_struct destroy_connector_work; };int drm_dp_mst_topology_mgr_init (struct drm_dp_mst_topology_mgr *mgr,struct device *dev,struct drm_dp_aux *aux,int max_dpcd_transaction_bytes,int max_payloads,int conn_base_id);
Greg Kroah-Hartman
maintainerPATCH 131/267 drm/dp/mst: take lock around looking up the branch device on hpd irq
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 9eb1e57f564d4e6e10991402726cc83fe0b9172f upstream.
If we are doing an MST transaction and we've gotten HPD and we lookup the device from the incoming msg, we should take the mgr lock around it, so that mst_primary and mstb->ports are valid.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
@@ -1171,6 +1171,8 @@ static struct drm_dp_mst_branch *drm_dp_struct drm_dp_mst_port *port;int i;/* find the port by iterating down */ + +mutex_lock (&mgr->lock); mstb = mgr->mst_primary;for (i =0 ; i < lct -1 ; i++) {
@@ -1190,6 +1192,7 @@ static struct drm_dp_mst_branch *drm_dp_ } }kref_get (&mstb->kref); +mutex_unlock (&mgr->lock);return mstb; }
Greg Kroah-Hartman
maintainerPATCH 132/267 drm/dp/mst: make sure mst_primary mstb is valid in work function
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 9254ec496a1dbdddeab50021a8138dc627a8166a upstream.
This validates the mst_primary under the lock, and then calls into the check and send function. This makes the code a lot easier to understand the locking rules in.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +19 -5
@@ -1200,7 +1200,7 @@ static void drm_dp_check_and_send_link_a struct drm_dp_mst_branch *mstb) {struct drm_dp_mst_port *port; - +struct drm_dp_mst_branch *mstb_child;if (!mstb->link_address_sent) {drm_dp_send_link_address (mgr, mstb); mstb->link_address_sent = true;
@@ -1215,17 +1215,31 @@ static void drm_dp_check_and_send_link_aif (!port->available_pbn)drm_dp_send_enum_path_resources (mgr, mstb, port); -if (port->mstb) -drm_dp_check_and_send_link_address (mgr, port->mstb); +if (port->mstb) { + mstb_child =drm_dp_get_validated_mstb_ref (mgr, port->mstb); +if (mstb_child) { +drm_dp_check_and_send_link_address (mgr, mstb_child); +drm_dp_put_mst_branch_device (mstb_child); + } + } } }static void drm_dp_mst_link_probe_work (struct work_struct *work) { struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, work); +struct drm_dp_mst_branch *mstb; -drm_dp_check_and_send_link_address (mgr, mgr->mst_primary); - +mutex_lock (&mgr->lock); + mstb = mgr->mst_primary; +if (mstb) { +kref_get (&mstb->kref); + } +mutex_unlock (&mgr->lock); +if (mstb) { +drm_dp_check_and_send_link_address (mgr, mstb); +drm_dp_put_mst_branch_device (mstb); + } } static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
Greg Kroah-Hartman
maintainerPATCH 133/267 drm/tegra: dpaux: Fix transfers larger than 4 bytes
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thierry Reding <[email protected]>
commit 3c1dae0a07c651526f8e878d223a88f82caa5a50 upstream.
The DPAUX read/write FIFO registers aren't sequential in the register space, causing transfers larger than 4 bytes to cause accesses to non- existing FIFO registers.
--- drivers/gpu/drm/tegra/dpaux.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +8 -10
@@ -72,34 +72,32 @@ static inline void tegra_dpaux_writel(ststatic void tegra_dpaux_write_fifo (struct tegra_dpaux *dpaux,const u8 *buffer,size_t size) { -unsigned long offset =DPAUX_DP_AUXDATA_WRITE (0 );size_t i, j; -for (i =0 ; i < size; i +=4 ) { -size_t num =min_t (size_t, size - i,4 ); +for (i =0 ; i <DIV_ROUND_UP (size,4 ); i++) { +size_t num =min_t (size_t, size - i *4 ,4 );unsigned long value =0 ;for (j =0 ; j < num; j++) - value |= buffer[i + j] << (j *8 ); + value |= buffer[i *4 + j] << (j *8 ); -tegra_dpaux_writel (dpaux, value, offset++); +tegra_dpaux_writel (dpaux, value,DPAUX_DP_AUXDATA_WRITE (i)); } }static void tegra_dpaux_read_fifo (struct tegra_dpaux *dpaux,u8 *buffer,size_t size) { -unsigned long offset =DPAUX_DP_AUXDATA_READ (0 );size_t i, j; -for (i =0 ; i < size; i +=4 ) { -size_t num =min_t (size_t, size - i,4 ); +for (i =0 ; i <DIV_ROUND_UP (size,4 ); i++) { +size_t num =min_t (size_t, size - i *4 ,4 );unsigned long value; - value =tegra_dpaux_readl (dpaux, offset++); + value =tegra_dpaux_readl (dpaux,DPAUX_DP_AUXDATA_READ (i));for (j =0 ; j < num; j++) - buffer[i + j] = value >> (j *8 ); + buffer[i *4 + j] = value >> (j *8 ); } }
Greg Kroah-Hartman
maintainerPATCH 134/267 drm/qxl: Do not cause spice-server to clean our objects
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frediano Ziglio <[email protected]>
commit 2fa19535ca6abcbfd1ccc9ef694db52f49f77747 upstream.
If objects are moved back from system memory to VRAM (and spice id created again) memory is already initialized so we need to set flag to not clear memory.
If you don't do it after a while using desktop many images turns to black or transparents.
--- drivers/gpu/drm/qxl/qxl_cmd.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/qxl/qxl_cmd.c +1 -0
@@ -505,6 +505,7 @@ int qxl_hw_surface_alloc(struct qxl_devi cmd = (struct qxl_surface_cmd *)qxl_release_map (qdev, release); cmd->type =QXL_SURFACE_CMD_CREATE ; + cmd->flags =QXL_SURF_FLAG_KEEP_DATA ; cmd->u.surface_create.format = surf->surf.format; cmd->u.surface_create.width = surf->surf.width; cmd->u.surface_create.height = surf->surf.height;
Greg Kroah-Hartman
maintainerPATCH 135/267 drm/qxl: Do not leak memory if qxl_release_list_add fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frediano Ziglio <[email protected]>
commit 8451cc964c1d193b989c41a44e5e77109cc696f8 upstream.
If the function fails reference counter to the object is not decremented causing leaks.
This is hard to spot as it happens only on very low memory situations.
--- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_ioctl.c +3 -1
@@ -122,8 +122,10 @@ static struct qxl_bo *qxlhw_handle_to_bo qobj =gem_to_qxl_bo (gobj); ret =qxl_release_list_add (release, qobj); -if (ret) +if (ret) { +drm_gem_object_unreference_unlocked (gobj);return NULL ; + }return qobj; }
Greg Kroah-Hartman
maintainerPATCH 136/267 drm/bridge: ptn3460: Include linux/gpio/consumer.h
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit dad3c3503462f59c6bec7edfa19dbde1857962c0 upstream.
If GPIOLIB=n and asm-generic/gpio.h is not used:
drivers/gpu/drm/bridge/ptn3460.c: In function ‘ptn3460_pre_enable’:
drivers/gpu/drm/bridge/ptn3460.c:135: error: implicit declaration of function ‘gpiod_set_value’ drivers/gpu/drm/bridge/ptn3460.c: In function ‘ptn3460_probe’:
drivers/gpu/drm/bridge/ptn3460.c:333: error: implicit declaration of function ‘devm_gpiod_get’ drivers/gpu/drm/bridge/ptn3460.c:333: warning: assignment makes pointer from integer without a cast drivers/gpu/drm/bridge/ptn3460.c:340: error: implicit declaration of function ‘gpiod_direction_output’ drivers/gpu/drm/bridge/ptn3460.c:346: warning: assignment makes pointer from integer without a cast
Add the missing #include <linux/gpio/consumer.h> to fix this.
--- drivers/gpu/drm/bridge/ptn3460.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ptn3460.c +1 -0
@@ -15,6 +15,7 @@#include <linux/delay.h> #include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/i2c.h> #include <linux/module.h> #include <linux/of.h>
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 137/267 drm/atomic: fix out of bounds read in for_each_*_in_state helpers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 60f207a5b6d8f23c2e8388b415e8d5c7311cc79d upstream.
for_each_*_in_state validate array index after access to array elements, thus perform out of bounds read.
Fix this by validating index in the first place and read array element iff validation was successful.
--- include/drm/drm_atomic.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
include/drm/drm_atomic.h +12 -12
@@ -77,26 +77,26 @@ int __must_check drm_atomic_async_commit#define for_each_connector_in_state (state, connector, connector_state, __i) \ for ((__i) = 0; \ - (connector) = (state)->connectors[__i], \ - (connector_state) = (state)->connector_states[__i], \ - (__i) < (state)->num_connector; \ + (__i) < (state)->num_connector && \ + ((connector) = (state)->connectors[__i], \ + (connector_state) = (state)->connector_states[__i], 1); \ (__i)++) \ if (connector)#define for_each_crtc_in_state (state, crtc, crtc_state, __i) \ for ((__i) = 0; \ - (crtc) = (state)->crtcs[__i], \ - (crtc_state) = (state)->crtc_states[__i], \ - (__i) < (state)->dev->mode_config.num_crtc; \ + (__i) < (state)->dev->mode_config.num_crtc && \ + ((crtc) = (state)->crtcs[__i], \ + (crtc_state) = (state)->crtc_states[__i], 1); \ (__i)++) \ if (crtc_state) -#define for_each_plane_in_state (state, plane, plane_state, __i) \ - for ((__i) = 0; \ - (plane) = (state)->planes[__i], \ - (plane_state) = (state)->plane_states[__i], \ - (__i) < (state)->dev->mode_config.num_total_plane; \ - (__i)++) \ +#define for_each_plane_in_state (state, plane, plane_state, __i) \ + for ((__i) = 0; \ + (__i) < (state)->dev->mode_config.num_total_plane && \ + ((plane) = (state)->planes[__i], \ + (plane_state) = (state)->plane_states[__i], 1); \ + (__i)++) \ if (plane_state)#endif /* DRM_ATOMIC_H_ */
Greg Kroah-Hartman
maintainerPATCH 138/267 drm/radeon: take the mode_config mutex when dealing with hpds (v2)
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 39fa10f7e21574a70cecf1fed0f9b36535aa68a0 upstream.
Since we are messing with state in the worker.
v2: drop the changes in the mst worker
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +2 -0
@@ -79,10 +79,12 @@ static void radeon_hotplug_work_func(strstruct drm_mode_config *mode_config = &dev->mode_config;struct drm_connector *connector; +mutex_lock (&mode_config->mutex);if (mode_config->num_connector) {list_for_each_entry (connector, &mode_config->connector_list, head)radeon_connector_hotplug (connector); } +mutex_unlock (&mode_config->mutex);/* Just fire off a uevent and let userspace tell us what to do */ drm_helper_hpd_irq_event (dev); }
Greg Kroah-Hartman
maintainerPATCH 139/267 drm/radeon: clean up radeon_audio_enable
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 010621936103fcfc15375ccdc92c0f583923d489 upstream.
- make it static
- fix mask/bool handling for last param
--- drivers/gpu/drm/radeon/radeon_audio.c | 18 +++++++++--------- drivers/gpu/drm/radeon/radeon_audio.h | 2 -- 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/radeon_audio.c +9 -9
@@ -242,6 +242,13 @@ static struct radeon_audio_funcs dce6_dp .dpms = evergreen_dp_enable, }; +static void radeon_audio_enable (struct radeon_device *rdev, +struct r600_audio_pin *pin,u8 enable_mask) +{ +if (rdev->audio.funcs->enable) + rdev->audio.funcs->enable (rdev, pin, enable_mask); +} +static void radeon_audio_interface_init (struct radeon_device *rdev) {if (ASIC_IS_DCE6 (rdev)) {
@@ -307,7 +314,7 @@ int radeon_audio_init(struct radeon_devi/* disable audio. it will be set up later */ for (i =0 ; i < rdev->audio.num_pins; i++) -radeon_audio_enable (rdev, &rdev->audio.pin[i], false); +radeon_audio_enable (rdev, &rdev->audio.pin[i],0 );return 0 ; }
@@ -443,13 +450,6 @@ static void radeon_audio_select_pin(stru radeon_encoder->audio->select_pin (encoder); } -void radeon_audio_enable (struct radeon_device *rdev, -struct r600_audio_pin *pin,u8 enable_mask) -{ -if (rdev->audio.funcs->enable) - rdev->audio.funcs->enable (rdev, pin, enable_mask); -} -void radeon_audio_detect (struct drm_connector *connector,enum drm_connector_status status) {
@@ -502,7 +502,7 @@ void radeon_audio_fini(struct radeon_devreturn ;for (i =0 ; i < rdev->audio.num_pins; i++) -radeon_audio_enable (rdev, &rdev->audio.pin[i], false); +radeon_audio_enable (rdev, &rdev->audio.pin[i],0 ); rdev->audio.enabled = false; }
drivers/gpu/drm/radeon/radeon_audio.h +0 -2
@@ -74,8 +74,6 @@ u32 radeon_audio_endpoint_rreg(struct ravoid radeon_audio_endpoint_wreg (struct radeon_device *rdev,u32 offset,u32 reg,u32 v);struct r600_audio_pin *radeon_audio_get_pin (struct drm_encoder *encoder); -void radeon_audio_enable (struct radeon_device *rdev, -struct r600_audio_pin *pin,u8 enable_mask);void radeon_audio_fini (struct radeon_device *rdev);void radeon_audio_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode);
Greg Kroah-Hartman
maintainerPATCH 140/267 drm/i915/ppgtt: Break loop in gen8_ppgtt_clear_range failure path
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Thierry <[email protected]>
commit 00245266b4be4fbe989ee073663f56716da6c1f3 upstream.
If for some reason [1], the page directory/table does not exist, clear_range would end up in an infinite while loop.
Introduced by commit 06fda602dbca ("drm/i915: Create page table allocators").
[1] This is already being addressed in one of Mika's patches:
http://mid.gmane.org/[email protected]
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +3 -3
@@ -502,17 +502,17 @@ static void gen8_ppgtt_clear_range(strucstruct page *page_table;if (WARN_ON (!ppgtt->pdp.page_directory[pdpe])) -continue ; +break ; pd = ppgtt->pdp.page_directory[pdpe];if (WARN_ON (!pd->page_table[pde])) -continue ; +break ; pt = pd->page_table[pde];if (WARN_ON (!pt->page)) -continue ; +break ; page_table = pt->page;
Greg Kroah-Hartman
maintainerPATCH 143/267 drm/i915: Declare the swizzling unknown for L-shaped configurations
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 19ee835cdb0b5a8eb11a68f25a51b8039d564488 upstream.
The old style of memory interleaving swizzled upto the end of the first even bank of memory, and then used the remainder as unswizzled on the unpaired bank - i.e. swizzling is not constant for all memory. This causes problems when we try to migrate memory and so the kernel prevents migration at all when we detect L-shaped inconsistent swizzling. However, this issue also extends to userspace who try to manually detile into memory as the swizzling for an individual page is unknown (it depends on its physical address only known to the kernel), userspace cannot correctly swizzle objects.
v2: Mark the global swizzling as unknown rather than adjust the value reported to userspace.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91105
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +11 -1
@@ -183,8 +183,18 @@ i915_gem_detect_bit_6_swizzle(struct drmif (IS_GEN4 (dev)) {uint32_t ddc2 =I915_READ (DCC2 ); -if (!(ddc2 &DCC2_MODIFIED_ENHANCED_DISABLE )) +if (!(ddc2 &DCC2_MODIFIED_ENHANCED_DISABLE )) { +/* Since the swizzling may vary within an +* object, we have no idea what the swizzling +* is for any page in particular. Thus we +* cannot migrate tiled pages using the GPU, +* nor can we tell userspace what the exact +* swizzling is for any object. +*/ dev_priv->quirks |=QUIRK_PIN_SWIZZLED_PAGES ; + swizzle_x =I915_BIT_6_SWIZZLE_UNKNOWN ; + swizzle_y =I915_BIT_6_SWIZZLE_UNKNOWN ; + } }if (dcc ==0xffffffff ) {
Greg Kroah-Hartman
maintainerPATCH 144/267 drm/i915: Snapshot seqno of most recently submitted request.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Elf <[email protected]>
commit 94f7bbe1509731bdef651d7fb235b2c31fb23be8 upstream.
The hang checker needs to inspect whether or not the ring request list is empty as well as if the given engine has reached or passed the most recently submitted request. The problem with this is that the hang checker cannot grab the struct_mutex, which is required in order to safely inspect requests since requests might be deallocated during inspection. In the past we've had kernel panics due to this very unsynchronized access in the hang checker.
One solution to this problem is to not inspect the requests directly since we're only interested in the seqno of the most recently submitted request - not the request itself. Instead the seqno of the most recently submitted request is stored separately, which the hang checker then inspects, circumventing the issue of synchronization from the hang checker entirely.
This fixes a regression introduced in
commit 44cdd6d219bc64f6810b8ed0023a4d4db9e0fe68
Author: John Harrison <[email protected]> Date: Mon Nov 24 18:49:40 2014 +0000
drm/i915: Convert 'ring_idle()' to use requests not seqnos
v2 (Chris Wilson):
- Pass current engine seqno to ring_idle() from i915_hangcheck_elapsed() rather than compute it over again.
- Remove extra whitespace.
Issue: VIZ-5998
--- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_irq.c | 13 +++---------- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 3 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -2401,6 +2401,7 @@ int __i915_add_request(struct intel_engi } request->emitted_jiffies = jiffies; + ring->last_submitted_seqno = request->seqno;list_add_tail (&request->list, &ring->request_list); request->file_priv =NULL ;
drivers/gpu/drm/i915/i915_irq.c +3 -10
@@ -2650,18 +2650,11 @@ static void gen8_disable_vblank(struct dspin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); } -static struct drm_i915_gem_request * -ring_last_request (struct intel_engine_cs *ring) -{ -return list_entry (ring->request_list.prev, - struct drm_i915_gem_request, list); -} -static bool -ring_idle (struct intel_engine_cs *ring) +ring_idle (struct intel_engine_cs *ring,u32 seqno) {return (list_empty (&ring->request_list) || -i915_gem_request_completed (ring_last_request (ring), false)); +i915_seqno_passed (seqno, ring->last_submitted_seqno)); } static bool
@@ -2883,7 +2876,7 @@ static void i915_hangcheck_elapsed(struc acthd =intel_ring_get_active_head (ring);if (ring->hangcheck.seqno == seqno) { -if (ring_idle (ring)) { +if (ring_idle (ring, seqno)) { ring->hangcheck.action =HANGCHECK_IDLE ;if (waitqueue_active (&ring->irq_queue)) {
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -0
@@ -266,6 +266,13 @@ struct intel_engine_cs {* Do we have some not yet emitted requests outstanding? */ struct drm_i915_gem_request *outstanding_lazy_request; +/** +* Seqno of request most recently submitted to request_list. +* Used exclusively by hang checker to avoid grabbing lock while +* inspecting request list. +*/ +u32 last_submitted_seqno; +bool gpu_caches_dirty;wait_queue_head_t irq_queue;
Greg Kroah-Hartman
maintainerPATCH 145/267 drm/i915: Forward all core DRM ioctls to core compat handling
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
commit ac7e7ab1c3243b10b41653cc8d8536088d83b152 upstream.
Previously only core DRM ioctls under the DRM_COMMAND_BASE were being forwarded, but the drm.h header suggests (and reality confirms) ones after (and including) DRM_COMMAND_END should be forwarded as well.
We need this to correctly forward the compat ioctl for the botched-up addfb2.1 extension.
--- drivers/gpu/drm/i915/i915_ioc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_ioc32.c +1 -1
@@ -204,7 +204,7 @@ long i915_compat_ioctl(struct file *filpdrm_ioctl_compat_t *fn =NULL ;int ret; -if (nr <DRM_COMMAND_BASE ) +if (nr <DRM_COMMAND_BASE || nr >=DRM_COMMAND_END )return drm_compat_ioctl (filp, cmd, arg);if (nr <DRM_COMMAND_BASE +ARRAY_SIZE (i915_compat_ioctls))
Greg Kroah-Hartman
maintainerPATCH 146/267 Revert "drm/i915: Declare the swizzling unknown for L-shaped configurations"
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit d82c0ba6e306f079407f07003e53c262d683397b upstream.
This reverts commit 19ee835cdb0b5a8eb11a68f25a51b8039d564488.
It breaks existing old userspace which doesn't handle UNKNOWN swizzling correct. Yes UNKNOWN was a thing back in 2009 and probably still is on some other platforms, but it still pretty clearly broke the testers machine. If we want this we need to extend the ioctl with new paramters that only new userspace looks at.
--- drivers/gpu/drm/i915/i915_gem_tiling.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +1 -11
@@ -183,18 +183,8 @@ i915_gem_detect_bit_6_swizzle(struct drmif (IS_GEN4 (dev)) {uint32_t ddc2 =I915_READ (DCC2 ); -if (!(ddc2 &DCC2_MODIFIED_ENHANCED_DISABLE )) { -/* Since the swizzling may vary within an -* object, we have no idea what the swizzling -* is for any page in particular. Thus we -* cannot migrate tiled pages using the GPU, -* nor can we tell userspace what the exact -* swizzling is for any object. -*/ +if (!(ddc2 &DCC2_MODIFIED_ENHANCED_DISABLE )) dev_priv->quirks |=QUIRK_PIN_SWIZZLED_PAGES ; - swizzle_x =I915_BIT_6_SWIZZLE_UNKNOWN ; - swizzle_y =I915_BIT_6_SWIZZLE_UNKNOWN ; - } }if (dcc ==0xffffffff ) {
Greg Kroah-Hartman
maintainerPATCH 150/267 Revert "drm/radeon: dont switch vt on suspend"
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit ac9134906b3f5c2b45dc80dab0fee792bd516d52 upstream.
This reverts commit b9729b17a414f99c61f4db9ac9f9ed987fa0cbfe.
This seems to break the cursor on resume for lots of systems.
--- drivers/gpu/drm/radeon/radeon_fb.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/radeon/radeon_fb.c +0 -1
@@ -257,7 +257,6 @@ static int radeonfb_create(struct drm_fb } info->par = rfbdev; - info->skip_vt_switch = true; ret =radeon_framebuffer_init (rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 151/267 drm/radeon: only check the sink type on DP connectors
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 479e9a95120aaae0bf0d3e0b5b26b36ac4a347b6 upstream.
Avoids a crash on pre-DP asics that support HDMI.
--- drivers/gpu/drm/radeon/radeon_audio.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/radeon/radeon_audio.c +9 -9
@@ -469,22 +469,22 @@ void radeon_audio_detect(struct drm_conn dig = radeon_encoder->enc_priv;if (status == connector_status_connected) { -struct radeon_connector *radeon_connector; -int sink_type; -if (!drm_detect_monitor_audio (radeon_connector_edid (connector))) { radeon_encoder->audio =NULL ;return ; } - radeon_connector =to_radeon_connector (connector); - sink_type =radeon_dp_getsinktype (radeon_connector); +if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { +struct radeon_connector *radeon_connector =to_radeon_connector (connector); -if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && - sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) - radeon_encoder->audio = rdev->audio.dp_funcs; -else +if (radeon_dp_getsinktype (radeon_connector) == +CONNECTOR_OBJECT_ID_DISPLAYPORT ) + radeon_encoder->audio = rdev->audio.dp_funcs; +else + radeon_encoder->audio = rdev->audio.hdmi_funcs; + }else { radeon_encoder->audio = rdev->audio.hdmi_funcs; + } dig->afmt->pin =radeon_audio_get_pin (connector->encoder);radeon_audio_enable (rdev, dig->afmt->pin,0xf );
Greg Kroah-Hartman
maintainerPATCH 157/267 drm/radeon: add a dpm quirk for Sapphire Radeon R9 270X 2GB GDDR5
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 5dfc71bc44d91d1620505c064fa22b0b3db58a9d upstream.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76490
--- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/si_dpm.c +1 -0
@@ -2925,6 +2925,7 @@ static struct si_dpm_quirk si_dpm_quirk_/* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, + { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, { 0, 0, 0, 0 }, };
Greg Kroah-Hartman
maintainerPATCH 159/267 drm/radeon/ci: silence a harmless PCC warning
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit bda5e3e97ffe80c5a793383df5681d3581d46ac8 upstream.
This has been a source of confusion. Make it debug only.
--- drivers/gpu/drm/radeon/ci_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ci_dpm.c +1 -1
@@ -5818,7 +5818,7 @@ int ci_dpm_init(struct radeon_device *rd tmp |=DPM_ENABLED ;break ;default : -DRM_ERROR ("Invalid PCC GPIO: %u!\n" , gpio.shift); +DRM_DEBUG ("Invalid PCC GPIO: %u!\n" , gpio.shift);break ; }WREG32_SMC (CNB_PWRMGT_CNTL , tmp);
Greg Kroah-Hartman
maintainerPATCH 160/267 drm/rockchip: use drm_gem_mmap helpers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Kurtz <[email protected]>
commit 41315b793e13f884cda79389f0d5d44d027e57d1 upstream.
Rather than (incompletely [0]) re-implementing drm_gem_mmap() and drm_gem_mmap_obj() helpers, call them directly from the rockchip mmap routines.
Once the core functions return successfully, the rockchip mmap routines can still use dma_mmap_attrs() to simply mmap the entire buffer.
[0] Previously, we were performing the mmap() without first taking a reference on the underlying gem buffer. This could leak ptes if the gem object is destroyed while userspace is still holding the mapping.
--- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 67 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 33 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +34 -33
@@ -54,55 +54,56 @@ static void rockchip_gem_free_buf(struct &rk_obj->dma_attrs); } -int rockchip_gem_mmap_buf (struct drm_gem_object *obj, -struct vm_area_struct *vma) +static int rockchip_drm_gem_object_mmap (struct drm_gem_object *obj, +struct vm_area_struct *vma) + { +int ret;struct rockchip_gem_object *rk_obj =to_rockchip_obj (obj);struct drm_device *drm = obj->dev; -unsigned long vm_size; - - vma->vm_flags |=VM_IO |VM_DONTEXPAND |VM_DONTDUMP ; - vm_size = vma->vm_end - vma->vm_start; -if (vm_size > obj->size) -return -EINVAL ; +/* +* dma_alloc_attrs() allocated a struct page table for rk_obj, so clear +* VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). +*/ + vma->vm_flags &= ~VM_PFNMAP ; -return dma_mmap_attrs (drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, + ret =dma_mmap_attrs (drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, obj->size, &rk_obj->dma_attrs); +if (ret) +drm_gem_vm_close (vma); + +return ret; } -/* drm driver mmap file operations */ -int rockchip_gem_mmap (struct file *filp,struct vm_area_struct *vma) +int rockchip_gem_mmap_buf (struct drm_gem_object *obj, +struct vm_area_struct *vma) { -struct drm_file *priv = filp->private_data; -struct drm_device *dev = priv->minor->dev; -struct drm_gem_object *obj; -struct drm_vma_offset_node *node; +struct drm_device *drm = obj->dev;int ret; -if (drm_device_is_unplugged (dev)) -return -ENODEV ; +mutex_lock (&drm->struct_mutex); + ret =drm_gem_mmap_obj (obj, obj->size, vma); +mutex_unlock (&drm->struct_mutex); +if (ret) +return ret; -mutex_lock (&dev->struct_mutex); +return rockchip_drm_gem_object_mmap (obj, vma); +} - node =drm_vma_offset_exact_lookup (dev->vma_offset_manager, - vma->vm_pgoff, -vma_pages (vma)); -if (!node) { -mutex_unlock (&dev->struct_mutex); -DRM_ERROR ("failed to find vma node.\n" ); -return -EINVAL ; - }else if (!drm_vma_node_is_allowed (node, filp)) { -mutex_unlock (&dev->struct_mutex); -return -EACCES ; - } +/* drm driver mmap file operations */ +int rockchip_gem_mmap (struct file *filp,struct vm_area_struct *vma) +{ +struct drm_gem_object *obj; +int ret; - obj = container_of(node, struct drm_gem_object, vma_node); - ret =rockchip_gem_mmap_buf (obj, vma); + ret =drm_gem_mmap (filp, vma); +if (ret) +return ret; -mutex_unlock (&dev->struct_mutex); + obj = vma->vm_private_data; -return ret; +return rockchip_drm_gem_object_mmap (obj, vma); } struct rockchip_gem_object *
Greg Kroah-Hartman
maintainerPATCH 161/267 drm: add a check for x/y in drm_mode_setcrtc
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Junwang <[email protected]>
commit 01447e9f04ba1c49a9534ae6a5a6f26c2bb05226 upstream.
legacy setcrtc ioctl does take a 32 bit value which might indeed overflow
the checks of crtc_req->x > INT_MAX and crtc_req->y > INT_MAX aren't needed any more with this
v2: -polish the annotation according to Daniel's comment
--- drivers/gpu/drm/drm_crtc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -2
@@ -2749,8 +2749,11 @@ int drm_mode_setcrtc(struct drm_device *if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -/* For some reason crtc x/y offsets are signed internally. */ -if (crtc_req->x >INT_MAX || crtc_req->y >INT_MAX ) +/* +* Universal plane src offsets are only 16.16, prevent havoc for +* drivers using universal plane code internally. +*/ +if (crtc_req->x &0xffff0000 || crtc_req->y &0xffff0000 )return -ERANGE ;drm_modeset_lock_all (dev);
Greg Kroah-Hartman
maintainerPATCH 162/267 drm: Provide compat ioctl for addfb2.1
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
commit c631d5f90e7ee246536c72f80ade86e9ef4d2f13 upstream.
Frame buffer modifiers extensions provided in;
commit e3eb3250d84ef97b766312345774367b6a310db8
Author: Rob Clark <[email protected]>
Date: Thu Feb 5 14:41:52 2015 +0000
drm: add support for tiled/compressed/etc modifier in addfb2
Missed the structure packing/alignment problem where 64-bit members were added after the odd number of 32-bit ones. This makes the compiler produce structures of different sizes under 32- and 64-bit x86 targets and makes the ioctl need explicit compat handling.
v2: Removed the typedef. (Daniel Vetter)
--- drivers/gpu/drm/drm_ioc32.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
drivers/gpu/drm/drm_ioc32.c +60 -0
@@ -70,6 +70,8 @@#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) +#define DRM_IOCTL_MODE_ADDFB232 DRM_IOWR(0xb8, drm_mode_fb_cmd232_t) + typedef struct drm_version_32 { int version_major; /**< Major version */ int version_minor; /**< Minor version */
@@ -1016,6 +1018,63 @@ static int compat_drm_wait_vblank(structreturn 0 ; } +typedef struct drm_mode_fb_cmd232 { +u32 fb_id; +u32 width; +u32 height; +u32 pixel_format; +u32 flags; +u32 handles[4 ]; +u32 pitches[4 ]; +u32 offsets[4 ]; +u64 modifier[4 ]; +} __attribute__((packed))drm_mode_fb_cmd232_t ; + +static int compat_drm_mode_addfb2 (struct file *file,unsigned int cmd, +unsigned long arg) +{ +struct drm_mode_fb_cmd232 __user *argp = (void __user *)arg; +struct drm_mode_fb_cmd232 req32; +struct drm_mode_fb_cmd2 __user *req64; +int i; +int err; + +if (copy_from_user (&req32, argp,sizeof (req32))) +return -EFAULT ; + + req64 =compat_alloc_user_space (sizeof (*req64)); + +if (!access_ok (VERIFY_WRITE , req64,sizeof (*req64)) + ||__put_user (req32.width, &req64->width) + ||__put_user (req32.height, &req64->height) + ||__put_user (req32.pixel_format, &req64->pixel_format) + ||__put_user (req32.flags, &req64->flags)) +return -EFAULT ; + +for (i =0 ; i <4 ; i++) { +if (__put_user (req32.handles[i], &req64->handles[i])) +return -EFAULT ; +if (__put_user (req32.pitches[i], &req64->pitches[i])) +return -EFAULT ; +if (__put_user (req32.offsets[i], &req64->offsets[i])) +return -EFAULT ; +if (__put_user (req32.modifier[i], &req64->modifier[i])) +return -EFAULT ; + } + + err =drm_ioctl (file,DRM_IOCTL_MODE_ADDFB2 , (unsigned long )req64); +if (err) +return err; + +if (__get_user (req32.fb_id, &req64->fb_id)) +return -EFAULT ; + +if (copy_to_user (argp, &req32,sizeof (req32))) +return -EFAULT ; + +return 0 ; +} +static drm_ioctl_compat_t *drm_compat_ioctls[] = { [DRM_IOCTL_NR (DRM_IOCTL_VERSION32 )] = compat_drm_version, [DRM_IOCTL_NR (DRM_IOCTL_GET_UNIQUE32 )] = compat_drm_getunique,
@@ -1048,6 +1107,7 @@ static drm_ioctl_compat_t *drm_compat_io [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, #endif [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, + [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, };/**
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 164/267 libata: Fix regression when the NCQ Send and Receive log page is absent
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
commit eab6ee1ce3c4678224d70338134f7a02005768cb upstream.
Commit 5d3abf8ff67f ("libata: Fall back to unqueued READ LOG EXT if the DMA variant fails") allowed us to fall back to the unqueued READ LOG variant if the queued version failed. However, if the device did not support the page at all we would end up looping due to a merge snafu.
Ensure we only take the fallback path once.
--- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-eh.c +1 -0
@@ -1521,6 +1521,7 @@ retry: }else { tf.command =ATA_CMD_READ_LOG_EXT ; tf.protocol =ATA_PROT_PIO ; + dma = false; } tf.lbal = log; tf.lbam = page;
Greg Kroah-Hartman
maintainerPATCH 165/267 xfs: fix remote symlinks on V5/CRC filesystems
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 2ac56d3d4bd625450a54d4c3f9292d58f6b88232 upstream.
If we create a CRC filesystem, mount it, and create a symlink with a path long enough that it can't live in the inode, we get a very strange result upon remount:
# ls -l mnt total 4 lrwxrwxrwx. 1 root root 929 Jun 15 16:58 link -> XSLM
XSLM is the V5 symlink block header magic (which happens to be followed by a NUL, so the string looks terminated).
xfs_readlink_bmap() advanced cur_chunk by the size of the header for CRC filesystems, but never actually used that pointer; it kept reading from bp->b_addr, which is the start of the block, rather than the start of the symlink data after the header.
Looks like this problem goes back to v3.10.
Fixing this gets us reading the proper link target, again.
--- fs/xfs/xfs_symlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_symlink.c +1 -1
@@ -104,7 +104,7 @@ xfs_readlink_bmap( cur_chunk +=sizeof (struct xfs_dsymlink_hdr ); } -memcpy (link + offset, bp->b_addr, byte_cnt); +memcpy (link + offset, cur_chunk, byte_cnt); pathlen -= byte_cnt; offset += byte_cnt;
Greg Kroah-Hartman
maintainerPATCH 166/267 xfs: dont truncate attribute extents if no extents exist
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
commit f66bf042693b620133d39af8d2f13615f03eadfc upstream.
The xfs_attr3_root_inactive() call from xfs_attr_inactive() assumes that attribute blocks exist to invalidate. It is possible to have an attribute fork without extents, however. Consider the case where the attribute fork is created towards the beginning of xfs_attr_set() but some part of the subsequent attribute set fails.
If an inode in such a state hits xfs_attr_inactive(), it eventually calls xfs_dabuf_map() and possibly xfs_bmapi_read(). The former emits a filesystem corruption warning, returns an error that bubbles back up to xfs_attr_inactive(), and leads to destruction of the in-core attribute fork without an on-disk reset. If the inode happens to make it back through xfs_inactive() in this state (e.g., via a concurrent bulkstat that cycles the inode from the reclaim state and releases it), i_afp might not exist when xfs_bmapi_read() is called and causes a NULL dereference panic.
A '-p 2' fsstress run to ENOSPC on a relatively small fs (1GB) reproduces these problems. The behavior is a regression caused by:
6dfe5a0 xfs: xfs_attr_inactive leaves inconsistent attr fork state behind
... which removed logic that avoided the attribute extent truncate when no extents exist. Restore this logic to ensure the attribute fork is destroyed and reset correctly if it exists without any allocated extents.
--- fs/xfs/xfs_attr_inactive.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/xfs/xfs_attr_inactive.c +8 -2
@@ -435,8 +435,14 @@ xfs_attr_inactive(*/ xfs_trans_ijoin (trans, dp,0 ); -/* invalidate and truncate the attribute fork extents */ -if (dp->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ) { +/* +* Invalidate and truncate the attribute fork extents. Make sure the +* fork actually has attributes as otherwise the invalidation has no +* blocks to read and returns an error. In this case, just do the fork +* removal below. +*/ +if (xfs_inode_hasattr (dp) && + dp->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ) { error =xfs_attr3_root_inactive (&trans, dp);if (error) goto out_cancel;
Greg Kroah-Hartman
maintainerPATCH 167/267 w1_therm reference count family data
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Fries <[email protected]>
commit f7134eea05b2fb4a2c0935f8a540539fff01f3eb upstream.
A temperature conversion can take 750 ms and when possible the w1_therm slave driver drops the bus_mutex to allow other bus operations, but that includes operations such as a periodic slave search, which can remove this slave when it is no longer detected. If that happens the sl->family_data will be freed and set to NULL causing w1_slave_show to crash when it wakes up.
--- drivers/w1/slaves/w1_therm.c | 62 ++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 15 deletions(-)
drivers/w1/slaves/w1_therm.c +47 -15
@@ -59,16 +59,32 @@ MODULE_ALIAS("w1-family-" __stringify(W1static int w1_strong_pullup =1 ;module_param_named (strong_pullup, w1_strong_pullup, int,0 ); +struct w1_therm_family_data { +uint8_t rom[9 ]; +atomic_t refcnt; +}; + +/* return the address of the refcnt in the family data */ +#define THERM_REFCNT (family_data) \ + (&((struct w1_therm_family_data*)family_data)->refcnt) +static int w1_therm_add_slave (struct w1_slave *sl) { - sl->family_data =kzalloc (9 ,GFP_KERNEL ); + sl->family_data =kzalloc (sizeof (struct w1_therm_family_data ), +GFP_KERNEL );if (!sl->family_data)return -ENOMEM ; +atomic_set (THERM_REFCNT (sl->family_data),1 );return 0 ; }static void w1_therm_remove_slave (struct w1_slave *sl) { +int refcnt =atomic_sub_return (1 ,THERM_REFCNT (sl->family_data)); +while (refcnt) { +msleep (1000 ); + refcnt =atomic_read (THERM_REFCNT (sl->family_data)); + }kfree (sl->family_data); sl->family_data =NULL ; }
@@ -194,13 +210,22 @@ static ssize_t w1_slave_show(struct devistruct w1_slave *sl =dev_to_w1_slave (device);struct w1_master *dev = sl->master;u8 rom[9 ], crc, verdict, external_power; -int i, max_trying =10 ; +int i, ret, max_trying =10 ;ssize_t c =PAGE_SIZE ; +u8 *family_data = sl->family_data; + + ret =mutex_lock_interruptible (&dev->bus_mutex); +if (ret !=0 ) + goto post_unlock; - i =mutex_lock_interruptible (&dev->bus_mutex); -if (i !=0 ) -return i; +if (!sl->family_data) + { + ret = -ENODEV ; + goto pre_unlock; + } +/* prevent the slave from going away in sleep */ +atomic_inc (THERM_REFCNT (family_data));memset (rom,0 ,sizeof (rom));while (max_trying--) {
@@ -230,17 +255,19 @@ static ssize_t w1_slave_show(struct devimutex_unlock (&dev->bus_mutex); sleep_rem =msleep_interruptible (tm); -if (sleep_rem !=0 ) -return -EINTR ; +if (sleep_rem !=0 ) { + ret = -EINTR ; + goto post_unlock; + } - i =mutex_lock_interruptible (&dev->bus_mutex); -if (i !=0 ) -return i; + ret =mutex_lock_interruptible (&dev->bus_mutex); +if (ret !=0 ) + goto post_unlock; }else if (!w1_strong_pullup) { sleep_rem =msleep_interruptible (tm);if (sleep_rem !=0 ) { -mutex_unlock (&dev->bus_mutex); -return -EINTR ; + ret = -EINTR ; + goto pre_unlock; } }
@@ -269,19 +296,24 @@ static ssize_t w1_slave_show(struct devi c -=snprintf (buf +PAGE_SIZE - c, c,": crc=%02x %s\n" , crc, (verdict) ?"YES" :"NO" );if (verdict) -memcpy (sl->family_data, rom,sizeof (rom)); +memcpy (family_data, rom,sizeof (rom));else dev_warn (device,"Read failed CRC check\n" );for (i =0 ; i <9 ; ++i) c -=snprintf (buf +PAGE_SIZE - c, c,"%02x " , - ((u8 *)sl->family_data)[i]); + ((u8 *)family_data)[i]); c -=snprintf (buf +PAGE_SIZE - c, c,"t=%d\n" ,w1_convert_temp (rom, sl->family->fid)); + ret =PAGE_SIZE - c; + +pre_unlock:mutex_unlock (&dev->bus_mutex); -return PAGE_SIZE - c; +post_unlock: +atomic_dec (THERM_REFCNT (family_data)); +return ret; }static int __init w1_therm_init (void )
Greg Kroah-Hartman
maintainerPATCH 168/267 tpm, tpm_crb: fix le64_to_cpu conversions in crb_acpi_add()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit 49afd7289bd937401c5f7faa193054bc3c41dad6 upstream.
le64_to_cpu() was applied twice to the physical addresses read from the control area. This hasn't shown any visible regressions because CRB driver has been tested only on the little endian platofrms so far.
--- drivers/char/tpm/tpm_crb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_crb.c +2 -2
@@ -267,7 +267,7 @@ static int crb_acpi_add(struct acpi_devimemcpy_fromio (&pa, &priv->cca->cmd_pa,8 ); pa =le64_to_cpu (pa); - priv->cmd =devm_ioremap_nocache (dev,le64_to_cpu (pa), + priv->cmd =devm_ioremap_nocache (dev, pa,ioread32 (&priv->cca->cmd_size));if (!priv->cmd) {dev_err (dev,"ioremap of the command buffer failed\n" );
@@ -276,7 +276,7 @@ static int crb_acpi_add(struct acpi_devimemcpy_fromio (&pa, &priv->cca->rsp_pa,8 ); pa =le64_to_cpu (pa); - priv->rsp =devm_ioremap_nocache (dev,le64_to_cpu (pa), + priv->rsp =devm_ioremap_nocache (dev, pa,ioread32 (&priv->cca->rsp_size));if (!priv->rsp) {dev_err (dev,"ioremap of the response buffer failed\n" );
Greg Kroah-Hartman
maintainerPATCH 169/267 vTPM: set virtual device before passing to ibmvtpm_reset_crq
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Hon Ching \\(Vicky\\) Lo" <[email protected]>
commit 9d75f08946e8485109458ccf16f714697c207f41 upstream.
tpm_ibmvtpm_probe() calls ibmvtpm_reset_crq(ibmvtpm) without having yet set the virtual device in the ibmvtpm structure. So in ibmvtpm_reset_crq, the phype call contains empty unit addresses, ibmvtpm->vdev->unit_address.
--- drivers/char/tpm/tpm_ibmvtpm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_ibmvtpm.c +3 -2
@@ -578,6 +578,9 @@ static int tpm_ibmvtpm_probe(struct vio_ goto cleanup; } + ibmvtpm->dev = dev; + ibmvtpm->vdev = vio_dev; + crq_q = &ibmvtpm->crq_queue; crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page (GFP_KERNEL );if (!crq_q->crq_addr) {
@@ -622,8 +625,6 @@ static int tpm_ibmvtpm_probe(struct vio_ crq_q->index =0 ; - ibmvtpm->dev = dev; - ibmvtpm->vdev = vio_dev;TPM_VPRIV (chip) = (void *)ibmvtpm;spin_lock_init (&ibmvtpm->rtce_lock);
Greg Kroah-Hartman
maintainerPATCH 170/267 tpm: Fix initialization of the cdev
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit ba0ef85479c46a2ab354c2220bdb6152f7f4baf3 upstream.
When a cdev is contained in a dynamic structure the cdev parent kobj should be set to the kobj that controls the lifetime of the enclosing structure. In TPM's case this is the embedded struct device.
Also, cdev_init 0's the whole structure, so all sets must be after, not before. This fixes module ref counting and cdev.
--- drivers/char/tpm/tpm-chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm-chip.c +2 -1
@@ -129,8 +129,9 @@ struct tpm_chip *tpmm_chip_alloc(structdevice_initialize (&chip->dev); - chip->cdev.owner = chip->pdev->driver->owner;cdev_init (&chip->cdev, &tpm_fops); + chip->cdev.owner = chip->pdev->driver->owner; + chip->cdev.kobj.parent = &chip->dev.kobj;return chip; }
Greg Kroah-Hartman
maintainerPATCH 171/267 tpm, tpm_crb: fail when TPM2 ACPI table contents look corrupted
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit b371616b8537d6450ebca0819defbf53452bebf3 upstream.
At least some versions of AMI BIOS have corrupted contents in the TPM2 ACPI table and namely the physical address of the control area is set to zero.
This patch changes the driver to fail gracefully when we observe a zero address instead of continuing to ioremap.
--- drivers/char/tpm/tpm_crb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm_crb.c +8 -0
@@ -233,6 +233,14 @@ static int crb_acpi_add(struct acpi_devireturn -ENODEV ; } +/* At least some versions of AMI BIOS have a bug that TPM2 table has +* zero address for the control area and therefore we must fail. +*/ +if (!buf->control_area_pa) { +dev_err (dev,"TPM2 ACPI table has a zero address for the control area\n" ); +return -EINVAL ; + } +if (buf->hdr.length <sizeof (struct acpi_tpm2 )) {dev_err (dev,"TPM2 ACPI table has wrong size" );return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 172/267 KEYS: fix "ca_keys=" partial key matching
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit f2b3dee484f9cee967a54ef05a66866282337519 upstream.
The call to asymmetric_key_hex_to_key_id() from ca_keys_setup() silently fails with -ENOMEM. Instead of dynamically allocating memory from a __setup function, this patch defines a variable and calls __asymmetric_key_hex_to_key_id(), a new helper function, directly.
This bug was introduced by 'commit 46963b774d44 ("KEYS: Overhaul key identification when searching for asymmetric keys")'.
Changelog:
- for clarification, rename hexlen to asciihexlen in asymmetric_key_hex_to_key_id()
- add size argument to __asymmetric_key_hex_to_key_id() - David Howells
- inline __asymmetric_key_hex_to_key_id() - David Howells
- remove duplicate strlen() calls
--- crypto/asymmetric_keys/asymmetric_keys.h | 3 +++ crypto/asymmetric_keys/asymmetric_type.c | 20 ++++++++++++++------ crypto/asymmetric_keys/x509_public_key.c | 23 ++++++++++++++++++----- 3 files changed, 35 insertions(+), 11 deletions(-)
crypto/asymmetric_keys/asymmetric_keys.h +3 -0
@@ -11,6 +11,9 @@extern struct asymmetric_key_id *asymmetric_key_hex_to_key_id (const char *id); +extern int __asymmetric_key_hex_to_key_id (const char *id, +struct asymmetric_key_id *match_id, +size_t hexlen);static inline const struct asymmetric_key_ids *asymmetric_key_ids (const struct key *key) {
crypto/asymmetric_keys/asymmetric_type.c +14 -6
@@ -104,6 +104,15 @@ static bool asymmetric_match_key_ids(return false; } +/* helper function can be called directly with pre-allocated memory */ +inline int __asymmetric_key_hex_to_key_id (const char *id, +struct asymmetric_key_id *match_id, +size_t hexlen) +{ + match_id->len = hexlen; +return hex2bin (match_id->data, id, hexlen); +} +/** * asymmetric_key_hex_to_key_id - Convert a hex string into a key ID. * @id: The ID as a hex string.
@@ -111,21 +120,20 @@ static bool asymmetric_match_key_ids(struct asymmetric_key_id *asymmetric_key_hex_to_key_id (const char *id) {struct asymmetric_key_id *match_id; -size_t hexlen; +size_t asciihexlen;int ret;if (!*id)return ERR_PTR (-EINVAL ); - hexlen =strlen (id); -if (hexlen &1 ) + asciihexlen =strlen (id); +if (asciihexlen &1 )return ERR_PTR (-EINVAL ); - match_id =kmalloc (sizeof (struct asymmetric_key_id ) + hexlen /2 , + match_id =kmalloc (sizeof (struct asymmetric_key_id ) + asciihexlen /2 ,GFP_KERNEL );if (!match_id)return ERR_PTR (-ENOMEM ); - match_id->len = hexlen /2 ; - ret =hex2bin (match_id->data, id, hexlen /2 ); + ret =__asymmetric_key_hex_to_key_id (id, match_id, asciihexlen /2 );if (ret <0 ) {kfree (match_id);return ERR_PTR (-EINVAL );
crypto/asymmetric_keys/x509_public_key.c +18 -5
@@ -28,17 +28,30 @@ static bool use_builtin_keys;static struct asymmetric_key_id *ca_keyid;#ifndef MODULE +static struct { +struct asymmetric_key_id id; +unsigned char data[10 ]; +} cakey; +static int __init ca_keys_setup (char *str) {if (!str)/* default system keyring */ return 1 ;if (strncmp (str,"id:" ,3 ) ==0 ) { -struct asymmetric_key_id *p; - p =asymmetric_key_hex_to_key_id (str +3 ); -if (p ==ERR_PTR (-EINVAL )) -pr_err ("Unparsable hex string in ca_keys\n" ); -else if (!IS_ERR (p)) +struct asymmetric_key_id *p = &cakey.id; +size_t hexlen = (strlen (str) -3 ) /2 ; +int ret; + +if (hexlen ==0 || hexlen >sizeof (cakey.data)) { +pr_err ("Missing or invalid ca_keys id\n" ); +return 1 ; + } + + ret =__asymmetric_key_hex_to_key_id (str +3 , p, hexlen); +if (ret <0 ) +pr_err ("Unparsable ca_keys id hex string\n" ); +else ca_keyid = p;/* owner key 'id:xxxxxx' */ }else if (strcmp (str,"builtin" ) ==0 ) { use_builtin_keys = true;
Greg Kroah-Hartman
maintainerPATCH 173/267 KEYS: ensure we free the assoc array edit if edit is valid
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit ca4da5dd1f99fe9c59f1709fb43e818b18ad20e0 upstream.
__key_link_end is not freeing the associated array edit structure and this leads to a 512 byte memory leak each time an identical existing key is added with add_key().
The reason the add_key() system call returns okay is that key_create_or_update() calls __key_link_begin() before checking to see whether it can update a key directly rather than adding/replacing - which it turns out it can. Thus __key_link() is not called through __key_instantiate_and_link() and __key_link_end() must cancel the edit.
CVE-2015-1333
--- security/keys/keyring.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
security/keys/keyring.c +5 -3
@@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,if (index_key->type == &key_type_keyring)up_write (&keyring_serialise_link_sem); -if (edit && !edit->dead_leaf) { -key_payload_reserve (keyring, - keyring->datalen -KEYQUOTA_LINK_BYTES ); +if (edit) { +if (!edit->dead_leaf) { +key_payload_reserve (keyring, + keyring->datalen -KEYQUOTA_LINK_BYTES ); + }assoc_array_cancel_edit (edit); }up_write (&keyring->sem);
Greg Kroah-Hartman
maintainerPATCH 174/267 ima: skip measurement of cgroupfs files and update documentation
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
commit 6438de9f3fb5180d78a0422695d0b88c687757d3 upstream.
This patch adds a rule in the default measurement policy to skip inodes in the cgroupfs filesystem. Measurements for this filesystem can be avoided, as all the digests collected have the same value of the digest of an empty file.
Furthermore, this patch updates the documentation of IMA policies in Documentation/ABI/testing/ima_policy to make it consistent with the policies set in security/integrity/ima/ima_policy.c.
--- Documentation/ABI/testing/ima_policy | 17 ++++++++++++----- security/integrity/ima/ima_policy.c | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-)
Documentation/ABI/testing/ima_policy +12 -5
@@ -49,11 +49,22 @@ Description: dont_measure fsmagic=0x01021994 dont_appraise fsmagic=0x01021994 # RAMFS_MAGIC - dont_measure fsmagic=0x858458f6 dont_appraise fsmagic=0x858458f6 + # DEVPTS_SUPER_MAGIC + dont_measure fsmagic=0x1cd1 + dont_appraise fsmagic=0x1cd1 + # BINFMTFS_MAGIC + dont_measure fsmagic=0x42494e4d + dont_appraise fsmagic=0x42494e4d # SECURITYFS_MAGIC dont_measure fsmagic=0x73636673 dont_appraise fsmagic=0x73636673 + # SELINUX_MAGIC + dont_measure fsmagic=0xf97cff8c + dont_appraise fsmagic=0xf97cff8c + # CGROUP_SUPER_MAGIC + dont_measure fsmagic=0x27e0eb + dont_appraise fsmagic=0x27e0eb measure func=BPRM_CHECK measure func=FILE_MMAP mask=MAY_EXEC
@@ -70,10 +81,6 @@ Description: Examples of LSM specific definitions: SELinux: - # SELINUX_MAGIC - dont_measure fsmagic=0xf97cff8c - dont_appraise fsmagic=0xf97cff8c - dont_measure obj_type=var_log_t dont_appraise obj_type=var_log_t dont_measure obj_type=auditd_log_t
security/integrity/ima/ima_policy.c +2 -0
@@ -79,6 +79,8 @@ static struct ima_rule_entry default_rul {.action = DONT_MEASURE, .fsmagic = BINFMTFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_MEASURE, .fsmagic = SECURITYFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_MEASURE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC}, + {.action = DONT_MEASURE, .fsmagic = CGROUP_SUPER_MAGIC, + .flags = IMA_FSMAGIC}, {.action = MEASURE, .func = MMAP_CHECK, .mask = MAY_EXEC, .flags = IMA_FUNC | IMA_MASK}, {.action = MEASURE, .func = BPRM_CHECK, .mask = MAY_EXEC,
Greg Kroah-Hartman
maintainerPATCH 175/267 ima: cleanup ima_init_policy() a little
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 5577857f8e26e9027271f10daf96361640907300 upstream.
It's a bit easier to read this if we split it up into two for loops.
--- security/integrity/ima/ima_policy.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
security/integrity/ima/ima_policy.c +5 -9
@@ -340,16 +340,12 @@ void __init ima_init_policy(void) appraise_entries = ima_use_appraise_tcb ?ARRAY_SIZE (default_appraise_rules) :0 ; -for (i =0 ; i < measure_entries + appraise_entries; i++) { -if (i < measure_entries) -list_add_tail (&default_rules[i].list, - &ima_default_rules); -else { -int j = i - measure_entries; +for (i =0 ; i < measure_entries; i++) +list_add_tail (&default_rules[i].list, &ima_default_rules); -list_add_tail (&default_appraise_rules[j].list, - &ima_default_rules); - } +for (i =0 ; i < appraise_entries; i++) { +list_add_tail (&default_appraise_rules[i].list, + &ima_default_rules); } ima_rules = &ima_default_rules;
Greg Kroah-Hartman
maintainerPATCH 176/267 ima: do not measure or appraise the NSFS filesystem
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit cd025f7f94108995383edddfb61fc8afea6c66a9 upstream.
Include don't appraise or measure rules for the NSFS filesystem in the builtin ima_tcb and ima_appraise_tcb policies.
Changelog:
- Update documentation
--- Documentation/ABI/testing/ima_policy | 3 +++ security/integrity/ima/ima_policy.c | 2 ++ 2 files changed, 5 insertions(+)
Documentation/ABI/testing/ima_policy +3 -0
@@ -65,6 +65,9 @@ Description: # CGROUP_SUPER_MAGIC dont_measure fsmagic=0x27e0eb dont_appraise fsmagic=0x27e0eb + # NSFS_MAGIC + dont_measure fsmagic=0x6e736673 + dont_appraise fsmagic=0x6e736673 measure func=BPRM_CHECK measure func=FILE_MMAP mask=MAY_EXEC
security/integrity/ima/ima_policy.c +2 -0
@@ -81,6 +81,7 @@ static struct ima_rule_entry default_rul {.action = DONT_MEASURE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_MEASURE, .fsmagic = CGROUP_SUPER_MAGIC, .flags = IMA_FSMAGIC}, + {.action = DONT_MEASURE, .fsmagic = NSFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = MEASURE, .func = MMAP_CHECK, .mask = MAY_EXEC, .flags = IMA_FUNC | IMA_MASK}, {.action = MEASURE, .func = BPRM_CHECK, .mask = MAY_EXEC,
@@ -101,6 +102,7 @@ static struct ima_rule_entry default_app {.action = DONT_APPRAISE, .fsmagic = BINFMTFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_APPRAISE, .fsmagic = SECURITYFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_APPRAISE, .fsmagic = SELINUX_MAGIC, .flags = IMA_FSMAGIC}, + {.action = DONT_APPRAISE, .fsmagic = NSFS_MAGIC, .flags = IMA_FSMAGIC}, {.action = DONT_APPRAISE, .fsmagic = CGROUP_SUPER_MAGIC, .flags = IMA_FSMAGIC}, #ifndef CONFIG_IMA_APPRAISE_SIGNED_INIT {.action = APPRAISE, .fowner = GLOBAL_ROOT_UID, .flags = IMA_FOWNER},
Greg Kroah-Hartman
maintainerPATCH 177/267 evm: labeling pseudo filesystems exception
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit 5101a1850bb7ccbf107929dee9af0cd2f400940f upstream.
To prevent offline stripping of existing file xattrs and relabeling of them at runtime, EVM allows only newly created files to be labeled. As pseudo filesystems are not persistent, stripping of xattrs is not a concern.
Some LSMs defer file labeling on pseudo filesystems. This patch permits the labeling of existing files on pseudo files systems.
--- security/integrity/evm/evm_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
security/integrity/evm/evm_main.c +11 -0
@@ -296,6 +296,17 @@ static int evm_protect_xattr(struct dent iint =integrity_iint_find (d_backing_inode (dentry));if (iint && (iint->flags &IMA_NEW_FILE ))return 0 ; + +/* exception for pseudo filesystems */ +if (dentry->d_inode->i_sb->s_magic ==TMPFS_MAGIC + || dentry->d_inode->i_sb->s_magic ==SYSFS_MAGIC ) +return 0 ; + +integrity_audit_msg (AUDIT_INTEGRITY_METADATA , + dentry->d_inode, dentry->d_name.name, +"update_metadata" , + integrity_status_msg[evm_status], + -EPERM ,0 ); } out:if (evm_status !=INTEGRITY_PASS )
Greg Kroah-Hartman
maintainerPATCH 178/267 ima: fix ima_show_template_data_ascii()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit 45b26133b97871896b8c5241d59f4ff7839db7b2 upstream.
This patch fixes a bug introduced in "4d7aeee ima: define new template ima-ng and template fields d-ng and n-ng".
Changelog:
- change int to uint32 (Roberto Sassu's suggestion)
--- security/integrity/ima/ima.h | 2 +- security/integrity/ima/ima_fs.c | 4 ++-- security/integrity/ima/ima_template_lib.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-)
security/integrity/ima/ima.h +1 -1
@@ -106,7 +106,7 @@ void ima_add_violation(struct file *file const char *op, const char *cause);int ima_init_crypto (void );void ima_putc (struct seq_file *m,void *data,int datalen); -void ima_print_digest (struct seq_file *m,u8 *digest,int size); +void ima_print_digest (struct seq_file *m,u8 *digest,u32 size);struct ima_template_desc *ima_template_desc_current (void );int ima_init_template (void );
security/integrity/ima/ima_fs.c +2 -2
@@ -190,9 +190,9 @@ static const struct file_operations ima_ .release = seq_release, }; -void ima_print_digest (struct seq_file *m,u8 *digest,int size) +void ima_print_digest (struct seq_file *m,u8 *digest,u32 size) { -int i; +u32 i;for (i =0 ; i < size; i++)seq_printf (m,"%02x" , *(digest + i));
security/integrity/ima/ima_template_lib.c +2 -1
@@ -70,7 +70,8 @@ static void ima_show_template_data_asciienum data_formats datafmt, struct ima_field_data *field_data) { - u8 *buf_ptr = field_data->data, buflen = field_data->len; + u8 *buf_ptr = field_data->data; +u32 buflen = field_data->len;switch (datafmt) {case DATA_FMT_DIGEST_WITH_ALGO :
Greg Kroah-Hartman
maintainerPATCH 179/267 ima: add support for new "euid" policy condition
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit 139069eff7388407f19794384c42a534d618ccd7 upstream.
The new "euid" policy condition measures files with the specified effective uid (euid). In addition, for CAP_SETUID files it measures files with the specified uid or suid.
Changelog:
- fixed checkpatch.pl warnings
- fixed avc denied {setuid} messages - based on Roberto's feedback
--- Documentation/ABI/testing/ima_policy | 3 ++- security/integrity/ima/ima_policy.c | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-)
Documentation/ABI/testing/ima_policy +2 -1
@@ -20,7 +20,7 @@ Description: action: measure | dont_measure | appraise | dont_appraise | audit condition:= base | lsm [option] base: [[func=] [mask=] [fsmagic=] [fsuuid=] [uid=] - [fowner]] + [euid=] [fowner=]] lsm: [[subj_user=] [subj_role=] [subj_type=] [obj_user=] [obj_role=] [obj_type=]] option: [[appraise_type=]] [permit_directio]
@@ -31,6 +31,7 @@ Description: fsmagic:= hex value fsuuid:= file system UUID (e.g 8bcbe394-4f13-4144-be8e-5aa9ea2ce2f6) uid:= decimal value + euid:= decimal value fowner:=decimal value lsm: are LSM specific option: appraise_type:= [imasig]
security/integrity/ima/ima_policy.c +23 -4
@@ -27,6 +27,7 @@#define IMA_UID 0x0008#define IMA_FOWNER 0x0010#define IMA_FSUUID 0x0020 +#define IMA_EUID 0x0080#define UNKNOWN 0#define MEASURE 0x0001/* same as IMA_MEASURE */
@@ -194,6 +195,16 @@ static bool ima_match_rules(struct ima_rreturn false;if ((rule->flags &IMA_UID ) && !uid_eq (rule->uid, cred->uid))return false; +if (rule->flags &IMA_EUID ) { +if (has_capability_noaudit (current,CAP_SETUID )) { +if (!uid_eq (rule->uid, cred->euid) + && !uid_eq (rule->uid, cred->suid) + && !uid_eq (rule->uid, cred->uid)) +return false; + }else if (!uid_eq (rule->uid, cred->euid)) +return false; + } +if ((rule->flags &IMA_FOWNER ) && !uid_eq (rule->fowner, inode->i_uid))return false;for (i =0 ; i <MAX_LSM_RULES ; i++) {
@@ -373,7 +384,8 @@ enum { Opt_audit, Opt_obj_user, Opt_obj_role, Opt_obj_type, Opt_subj_user, Opt_subj_role, Opt_subj_type, - Opt_func, Opt_mask, Opt_fsmagic, Opt_uid, Opt_fowner, + Opt_func, Opt_mask, Opt_fsmagic, + Opt_uid, Opt_euid, Opt_fowner, Opt_appraise_type, Opt_fsuuid, Opt_permit_directio };
@@ -394,6 +406,7 @@ static match_table_t policy_tokens = { {Opt_fsmagic, "fsmagic=%s"}, {Opt_fsuuid, "fsuuid=%s"}, {Opt_uid, "uid=%s"}, + {Opt_euid, "euid=%s"}, {Opt_fowner, "fowner=%s"}, {Opt_appraise_type, "appraise_type=%s"}, {Opt_permit_directio, "permit_directio"},
@@ -566,6 +579,9 @@ static int ima_parse_rule(char *rule, stbreak ;case Opt_uid:ima_log_string (ab,"uid" , args[0 ].from); +case Opt_euid: +if (token == Opt_euid) +ima_log_string (ab,"euid" , args[0 ].from);if (uid_valid (entry->uid)) { result = -EINVAL ;
@@ -574,11 +590,14 @@ static int ima_parse_rule(char *rule, st result =kstrtoul (args[0 ].from,10 , &lnum);if (!result) { - entry->uid =make_kuid (current_user_ns (), (uid_t )lnum); -if (!uid_valid (entry->uid) || (((uid_t )lnum) != lnum)) + entry->uid =make_kuid (current_user_ns (), + (uid_t ) lnum); +if (!uid_valid (entry->uid) || + (uid_t )lnum != lnum) result = -EINVAL ;else - entry->flags |=IMA_UID ; + entry->flags |= (token == Opt_uid) + ?IMA_UID :IMA_EUID ; }break ;case Opt_fowner:
Greg Kroah-Hartman
maintainerPATCH 180/267 ima: extend "mask" policy matching support
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit 4351c294b8c1028077280f761e158d167b592974 upstream.
The current "mask" policy option matches files opened as MAY_READ, MAY_WRITE, MAY_APPEND or MAY_EXEC. This patch extends the "mask" option to match files opened containing one of these modes. For example, "mask=^MAY_READ" would match files opened read-write.
--- Documentation/ABI/testing/ima_policy | 3 ++- security/integrity/ima/ima_policy.c | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-)
Documentation/ABI/testing/ima_policy +2 -1
@@ -27,7 +27,8 @@ Description: base: func:= [BPRM_CHECK][MMAP_CHECK][FILE_CHECK][MODULE_CHECK] [FIRMWARE_CHECK] - mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC] + mask:= [[^]MAY_READ] [[^]MAY_WRITE] [[^]MAY_APPEND] + [[^]MAY_EXEC] fsmagic:= hex value fsuuid:= file system UUID (e.g 8bcbe394-4f13-4144-be8e-5aa9ea2ce2f6) uid:= decimal value
security/integrity/ima/ima_policy.c +15 -5
@@ -27,6 +27,7 @@#define IMA_UID 0x0008#define IMA_FOWNER 0x0010#define IMA_FSUUID 0x0020 +#define IMA_INMASK 0x0040#define IMA_EUID 0x0080#define UNKNOWN 0
@@ -187,6 +188,9 @@ static bool ima_match_rules(struct ima_rif ((rule->flags &IMA_MASK ) && (rule->mask != mask && func !=POST_SETATTR ))return false; +if ((rule->flags &IMA_INMASK ) && + (!(rule->mask & mask) && func !=POST_SETATTR )) +return false;if ((rule->flags &IMA_FSMAGIC ) && rule->fsmagic != inode->i_sb->s_magic)return false;
@@ -448,6 +452,7 @@ static void ima_log_string(struct audit_static int ima_parse_rule (char *rule,struct ima_rule_entry *entry) {struct audit_buffer *ab; +char *from;char *p;int result =0 ;
@@ -538,18 +543,23 @@ static int ima_parse_rule(char *rule, stif (entry->mask) result = -EINVAL ; -if ((strcmp (args[0 ].from,"MAY_EXEC" )) ==0 ) + from = args[0 ].from; +if (*from =='^' ) + from++; + +if ((strcmp (from,"MAY_EXEC" )) ==0 ) entry->mask =MAY_EXEC ; -else if (strcmp (args[0 ].from,"MAY_WRITE" ) ==0 ) +else if (strcmp (from,"MAY_WRITE" ) ==0 ) entry->mask =MAY_WRITE ; -else if (strcmp (args[0 ].from,"MAY_READ" ) ==0 ) +else if (strcmp (from,"MAY_READ" ) ==0 ) entry->mask =MAY_READ ; -else if (strcmp (args[0 ].from,"MAY_APPEND" ) ==0 ) +else if (strcmp (from,"MAY_APPEND" ) ==0 ) entry->mask =MAY_APPEND ;else result = -EINVAL ;if (!result) - entry->flags |=IMA_MASK ; + entry->flags |= (*args[0 ].from =='^' ) + ?IMA_INMASK :IMA_MASK ;break ;case Opt_fsmagic:ima_log_string (ab,"fsmagic" , args[0 ].from);
Greg Kroah-Hartman
maintainerPATCH 181/267 ima: update builtin policies
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
commit 24fd03c87695a76f0517df42a37e51b1597d2c8a upstream.
This patch defines a builtin measurement policy "tcb", similar to the existing "ima_tcb", but with additional rules to also measure files based on the effective uid and to measure files opened with the "read" mode bit set (eg. read, read-write).
Changing the builtin "ima_tcb" policy could potentially break existing users. Instead of defining a new separate boot command line option each time the builtin measurement policy is modified, this patch defines a single generic boot command line option "ima_policy=" to specify the builtin policy and deprecates the use of the builtin ima_tcb policy.
[The "ima_policy=" boot command line option is based on Roberto Sassu's "ima: added new policy type exec" patch.]
--- Documentation/kernel-parameters.txt | 10 ++++- security/integrity/ima/ima_policy.c | 65 +++++++++++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 10 deletions(-)
Documentation/kernel-parameters.txt +9 -1
@@ -1398,7 +1398,15 @@ bytes respectively. Such letter suffixes The list of supported hash algorithms is defined in crypto/hash_info.h. - ima_tcb [IMA] + ima_policy= [IMA] + The builtin measurement policy to load during IMA + setup. Specyfing "tcb" as the value, measures all + programs exec'd, files mmap'd for exec, and all files + opened with the read mode bit set by either the + effective uid (euid=0) or uid=0. + Format: "tcb" + + ima_tcb [IMA] Deprecated. Use ima_policy= instead. Load a policy which meets the needs of the Trusted Computing Base. This means IMA will measure all programs exec'd, files mmap'd for exec, and all files
security/integrity/ima/ima_policy.c +56 -9
109 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 182/267 tracing/filter: Do not WARN on operand count going below zero
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit b4875bbe7e68f139bd3383828ae8e994a0df6d28 upstream.
When testing the fix for the trace filter, I could not come up with a scenario where the operand count goes below zero, so I added a WARN_ON_ONCE(cnt < 0) to the logic. But there is legitimate case that it can happen (although the filter would be wrong).
# echo '>' > /sys/kernel/debug/events/ext4/ext4_truncate_exit/filter
That is, a single operation without any operands will hit the path where the WARN_ON_ONCE() can trigger. Although this is harmless, and the filter is reported as a error. But instead of spitting out a warning to the kernel dmesg, just fail nicely and report it via the proper channels.
--- kernel/trace/trace_events_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events_filter.c +3 -1
@@ -1385,7 +1385,9 @@ static int check_preds(struct filter_parif (elt->op !=OP_NOT ) cnt--; n_normal_preds++; -WARN_ON_ONCE (cnt <0 ); +/* all ops should have operands */ +if (cnt <0 ) +break ; }if (cnt !=1 || !n_normal_preds || n_logical_preds >= n_normal_preds) {
Greg Kroah-Hartman
maintainerPATCH 183/267 tracing/filter: Do not allow infix to exceed end of string
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 6b88f44e161b9ee2a803e5b2b1fbcf4e20e8b980 upstream.
While debugging a WARN_ON() for filtering, I found that it is possible for the filter string to be referenced after its end. With the filter:
# echo '>' > /sys/kernel/debug/events/ext4/ext4_truncate_exit/filter
The filter_parse() function can call infix_get_op() which calls infix_advance() that updates the infix filter pointers for the cnt and tail without checking if the filter is already at the end, which will put the cnt to zero and the tail beyond the end. The loop then calls infix_next() that has
ps->infix.cnt--; return ps->infix.string[ps->infix.tail++];
The cnt will now be below zero, and the tail that is returned is already passed the end of the filter string. So far the allocation of the filter string usually has some buffer that is zeroed out, but if the filter string is of the exact size of the allocated buffer there's no guarantee that the charater after the nul terminating character will be zero.
Luckily, only root can write to the filter.
--- kernel/trace/trace_events_filter.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/trace/trace_events_filter.c +6 -0
@@ -1056,6 +1056,9 @@ static void parse_init(struct filter_parstatic char infix_next (struct filter_parse_state *ps) { +if (!ps->infix.cnt) +return 0 ; + ps->infix.cnt--;return ps->infix.string[ps->infix.tail++];
@@ -1071,6 +1074,9 @@ static char infix_peek(struct filter_parstatic void infix_advance (struct filter_parse_state *ps) { +if (!ps->infix.cnt) +return ; + ps->infix.cnt--; ps->infix.tail++; }
Greg Kroah-Hartman
maintainerPATCH 184/267 tracing: Fix typo from "static inlin" to "static inline"
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit cc9e4bde03f2b4cfba52406c021364cbd2a4a0f3 upstream.
The trace.h header when called without CONFIG_EVENT_TRACING enabled (seldom done), will not compile because of a typo in the protocol of trace_event_enum_update().
--- kernel/trace/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.h +1 -1
@@ -1312,7 +1312,7 @@ void trace_event_init(void);void trace_event_enum_update (struct trace_enum_map **map,int len);#else static inline void __init trace_event_init (void ) { } -static inlin void trace_event_enum_update(struct trace_enum_map **map, int len) { } +static inline void trace_event_enum_update (struct trace_enum_map **map,int len) { }#endif extern struct trace_iterator *tracepoint_print_iter;
Greg Kroah-Hartman
maintainerPATCH 185/267 tracing: Have branch tracer use recursive field of task struct
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 6224beb12e190ff11f3c7d4bf50cb2922878f600 upstream.
Fengguang Wu's tests triggered a bug in the branch tracer's start up test when CONFIG_DEBUG_PREEMPT set. This was because that config adds some debug logic in the per cpu field, which calls back into the branch tracer.
The branch tracer has its own recursive checks, but uses a per cpu variable to implement it. If retrieving the per cpu variable calls back into the branch tracer, you can see how things will break.
Instead of using a per cpu variable, use the trace_recursion field of the current task struct. Simply set a bit when entering the branch tracing and clear it when leaving. If the bit is set on entry, just don't do the tracing.
There's also the case with lockdep, as the local_irq_save() called before the recursion can also trigger code that can call back into the function. Changing that to a raw_local_irq_save() will protect that as well.
This prevents the recursion and the inevitable crash that follows.
--- kernel/trace/trace.h | 1 + kernel/trace/trace_branch.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)
kernel/trace/trace.h +1 -0
@@ -444,6 +444,7 @@ enum {TRACE_CONTROL_BIT , + TRACE_BRANCH_BIT,/* * Abuse of the trace_recursion. * As we need a way to maintain state if we are tracing the function
kernel/trace/trace_branch.c +10 -7
@@ -36,9 +36,12 @@ probe_likely_condition(struct ftrace_brastruct trace_branch *entry;struct ring_buffer *buffer;unsigned long flags; -int cpu, pc; +int pc;const char *p; +if (current->trace_recursion &TRACE_BRANCH_BIT ) +return ; +/* * I would love to save just the ftrace_likely_data pointer, but * this code can also be used by modules. Ugly things can happen
@@ -49,10 +52,10 @@ probe_likely_condition(struct ftrace_braif (unlikely (!tr))return ; -local_irq_save (flags); - cpu =raw_smp_processor_id (); - data =per_cpu_ptr (tr->trace_buffer.data, cpu); -if (atomic_inc_return (&data->disabled) !=1 ) +raw_local_irq_save (flags); + current->trace_recursion |=TRACE_BRANCH_BIT ; + data =this_cpu_ptr (tr->trace_buffer.data); +if (atomic_read (&data->disabled)) goto out; pc =preempt_count ();
@@ -81,8 +84,8 @@ probe_likely_condition(struct ftrace_bra__buffer_unlock_commit (buffer, event); out: -atomic_dec (&data->disabled); -local_irq_restore (flags); + current->trace_recursion &= ~TRACE_BRANCH_BIT ; +raw_local_irq_restore (flags); } static inline
Greg Kroah-Hartman
maintainerPATCH 186/267 tracing: Fix sample output of dynamic arrays
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit d6726c8145290bef950ae2538ea6ae1d96a1944b upstream.
He Kuang noticed that the trace event samples for arrays was broken:
"The output result of trace_foo_bar event in traceevent samples is
wrong. This problem can be reproduced as following:
(Build kernel with SAMPLE_TRACE_EVENTS=m)
$ insmod trace-events-sample.ko
$ echo 1 > /sys/kernel/debug/tracing/events/sample-trace/foo_bar/enable
$ cat /sys/kernel/debug/tracing/trace
event-sample-980 [000] .... 43.649559: foo_bar: foo hello 21 0x15 BIT1|BIT3|0x10 {0x1,0x6f6f6e53,0xff007970,0xffffffff} Snoopy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The array length is not right, should be {0x1}.(ffffffff,ffffffff)
event-sample-980 [000] .... 44.653827: foo_bar: foo hello 22 0x16 BIT2|BIT3|0x10 {0x1,0x2,0x646e6147,0x666c61,0xffffffff,0xffffffff,0x750aeffe,0x7} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The array length is not right, should be {0x1,0x2}.Gandalf (ffffffff,ffffffff)"
This was caused by an update to have __print_array()'s second parameter be the count of items in the array and not the size of the array.
As there is already users of __print_array(), it can not change. But the sample code can and we can also improve on the documentation about __print_array() and __get_dynamic_array_len().
--- samples/trace_events/trace-events-sample.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
samples/trace_events/trace-events-sample.h +5 -2
@@ -168,7 +168,10 @@* * For __dynamic_array(int, foo, bar) use __get_dynamic_array(foo) * Use __get_dynamic_array_len(foo) to get the length of the array -* saved. +* saved. Note, __get_dynamic_array_len() returns the total allocated +* length of the dynamic array; __print_array() expects the second +* parameter to be the number of elements. To get that, the array length +* needs to be divided by the element size. * * For __string(foo, bar) use __get_str(foo) *
@@ -288,7 +291,7 @@ TRACE_EVENT(foo_bar,* This prints out the array that is defined by __array in a nice format. */ __print_array (__get_dynamic_array (list), -__get_dynamic_array_len (list), +__get_dynamic_array_len (list) /sizeof (int ),sizeof (int )), __get_str(str), __get_bitmask(cpus)) );
Greg Kroah-Hartman
maintainerPATCH 187/267 dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lior Amsalem <[email protected]>
commit 9136291f1dbc1d4d1cacd2840fb35f4f3ce16c46 upstream.
This patch fixes a bug in the XOR driver where the cleanup function can be called and free descriptors that never been processed by the engine (which result in data errors).
The cleanup function will free descriptors based on the ownership bit in the descriptors.
--- drivers/dma/mv_xor.c | 74 ++++++++++++++++++++++++++++++++------------------- drivers/dma/mv_xor.h | 1 2 files changed, 48 insertions(+), 27 deletions(-)
drivers/dma/mv_xor.c +47 -27
@@ -273,7 +273,8 @@ static void mv_xor_slot_cleanup(struct mdma_cookie_t cookie =0 ;int busy =mv_chan_is_busy (mv_chan);u32 current_desc =mv_chan_get_current_desc (mv_chan); -int seen_current =0 ; +int current_cleaned =0 ; +struct mv_xor_desc *hw_desc;dev_dbg (mv_chan_to_devp (mv_chan),"%s %d\n" , __func__, __LINE__);dev_dbg (mv_chan_to_devp (mv_chan),"current_desc %x\n" , current_desc);
@@ -285,38 +286,57 @@ static void mv_xor_slot_cleanup(struct mlist_for_each_entry_safe (iter, _iter, &mv_chan->chain, chain_node) { -prefetch (_iter); -prefetch (&_iter->async_tx); -/* do not advance past the current descriptor loaded into the -* hardware channel, subsequent descriptors are either in -* process or have not been submitted -*/ -if (seen_current) -break ; - -/* stop the search if we reach the current descriptor and the -* channel is busy -*/ -if (iter->async_tx.phys == current_desc) { - seen_current =1 ; -if (busy) +/* clean finished descriptors */ + hw_desc = iter->hw_desc; +if (hw_desc->status &XOR_DESC_SUCCESS ) { + cookie =mv_xor_run_tx_complete_actions (iter, mv_chan, + cookie); + +/* done processing desc, clean slot */ +mv_xor_clean_slot (iter, mv_chan); + +/* break if we did cleaned the current */ +if (iter->async_tx.phys == current_desc) { + current_cleaned =1 ;break ; + } + }else { +if (iter->async_tx.phys == current_desc) { + current_cleaned =0 ; +break ; + } } - - cookie =mv_xor_run_tx_complete_actions (iter, mv_chan, cookie); - -if (mv_xor_clean_slot (iter, mv_chan)) -break ; }if ((busy ==0 ) && !list_empty (&mv_chan->chain)) { -struct mv_xor_desc_slot *chain_head; - chain_head =list_entry (mv_chan->chain.next, - struct mv_xor_desc_slot, - chain_node); - -mv_xor_start_new_chain (mv_chan, chain_head); +if (current_cleaned) { +/* +* current descriptor cleaned and removed, run +* from list head +*/ + iter =list_entry (mv_chan->chain.next, + struct mv_xor_desc_slot, + chain_node); +mv_xor_start_new_chain (mv_chan, iter); + }else { +if (!list_is_last (&iter->chain_node, &mv_chan->chain)) { +/* +* descriptors are still waiting after +* current, trigger them +*/ + iter =list_entry (iter->chain_node.next, + struct mv_xor_desc_slot, + chain_node); +mv_xor_start_new_chain (mv_chan, iter); + }else { +/* +* some descriptors are still waiting +* to be cleaned +*/ +tasklet_schedule (&mv_chan->irq_tasklet); + } + } }if (cookie >0 )
drivers/dma/mv_xor.h +1 -0
@@ -31,6 +31,7 @@#define XOR_OPERATION_MODE_XOR 0#define XOR_OPERATION_MODE_MEMCPY 2#define XOR_DESCRIPTOR_SWAP BIT(14) +#define XOR_DESC_SUCCESS 0x40000000#define XOR_DESC_DMA_OWNED BIT(31)#define XOR_DESC_EOD_INT_EN BIT(31)
Greg Kroah-Hartman
maintainerPATCH 188/267 md: clear mddev->private when it has been freed.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit bd6919228d7e1867ae9e24ab27e3e4a366c87d21 upstream.
If ->private is set when ->run is called, it is assumed to be a 'config' prepared as part of 'reshape'.
So it is important when we free that config, that we also clear ->private. This is not often a problem as the mddev will normally be discarded shortly after the config us freed.
However if an 'assemble' races with a final close, the assemble can use the old mddev which has a stale ->private. This leads to any of various sorts of crashes.
So clear ->private after calling ->free().
--- drivers/md/md.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/md.c +3 -0
@@ -5159,6 +5159,7 @@ int md_run(struct mddev *mddev)mddev_detach (mddev);if (mddev->private) pers->free (mddev, mddev->private); + mddev->private =NULL ;module_put (pers->owner);bitmap_destroy (mddev);return err;
@@ -5294,6 +5295,7 @@ static void md_clean(struct mddev *mddev mddev->changed =0 ; mddev->degraded =0 ; mddev->safemode =0 ; + mddev->private =NULL ; mddev->merge_check_needed =0 ; mddev->bitmap_info.offset =0 ; mddev->bitmap_info.default_offset =0 ;
@@ -5366,6 +5368,7 @@ static void __md_stop(struct mddev *mdde mddev->pers =NULL ;spin_unlock (&mddev->lock); pers->free (mddev, mddev->private); + mddev->private =NULL ;if (pers->sync_request && mddev->to_remove ==NULL ) mddev->to_remove = &md_redundancy_group;module_put (pers->owner);
Greg Kroah-Hartman
maintainerPATCH 189/267 md: unlock mddev_lock on an error path.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 9a8c0fa861e4db60409b4dda254cef5e17e4d43c upstream.
This error path retuns while still holding the lock - bad.
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -4005,8 +4005,10 @@ new_dev_store(struct mddev *mddev, constelse rdev =md_import_device (dev,-1 ,-1 ); -if (IS_ERR (rdev)) +if (IS_ERR (rdev)) { +mddev_unlock (mddev);return PTR_ERR (rdev); + } err =bind_rdev_to_array (rdev, mddev); out:if (err)
Greg Kroah-Hartman
maintainerPATCH 190/267 md: Skip cluster setup for dm-raid
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Goldwyn Rodrigues <[email protected]>
commit d3b178adb3a3adf54ecf77758138b654c3ee7f09 upstream.
There is a bug that the bitmap superblock isn't initialised properly for dm-raid, so a new field can have garbage in new fields. (dm-raid does initialisation in the kernel - md initialised the
superblock in mdadm).
This means that for dm-raid we cannot currently trust the new ->nodes field. So:
- use __GFP_ZERO to initialise the superblock properly for all new arrays
- initialise all fields in bitmap_info in bitmap_new_disk_sb
- ignore ->nodes for dm arrays (yes, this is a hack)
This bug exposes dm-raid to bug in the (still experimental) md-cluster code, so it is suitable for -stable. It does cause crashes.
References: https://bugzilla.kernel.org/show_bug.cgi?id=100491
--- drivers/md/bitmap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/md/bitmap.c +12 -3
@@ -494,7 +494,7 @@ static int bitmap_new_disk_sb(struct bitbitmap_super_t *sb;unsigned long chunksize, daemon_sleep, write_behind; - bitmap->storage.sb_page =alloc_page (GFP_KERNEL ); + bitmap->storage.sb_page =alloc_page (GFP_KERNEL | __GFP_ZERO);if (bitmap->storage.sb_page ==NULL )return -ENOMEM ; bitmap->storage.sb_page->index =0 ;
@@ -541,6 +541,7 @@ static int bitmap_new_disk_sb(struct bit sb->state =cpu_to_le32 (bitmap->flags); bitmap->events_cleared = bitmap->mddev->events; sb->events_cleared =cpu_to_le64 (bitmap->mddev->events); + bitmap->mddev->bitmap_info.nodes =0 ;kunmap_atomic (sb);
@@ -611,8 +612,16 @@ re_read: daemon_sleep =le32_to_cpu (sb->daemon_sleep) *HZ ; write_behind =le32_to_cpu (sb->write_behind); sectors_reserved =le32_to_cpu (sb->sectors_reserved); - nodes =le32_to_cpu (sb->nodes); -strlcpy (bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name,64 ); +/* XXX: This is a hack to ensure that we don't use clustering +* in case: +* - dm-raid is in use and +* - the nodes written in bitmap_sb is erroneous. +*/ +if (!bitmap->mddev->sync_super) { + nodes =le32_to_cpu (sb->nodes); +strlcpy (bitmap->mddev->bitmap_info.cluster_name, + sb->cluster_name,64 ); + }/* verify that the bitmap-specific fields are valid */ if (sb->magic !=cpu_to_le32 (BITMAP_MAGIC ))
Greg Kroah-Hartman
maintainerPATCH 191/267 hwmon: (mcp3021) Fix broken output scaling
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Stevens, Nick" <[email protected]>
commit 347d7e45bd09ce09cbc30d5cea9de377eb22f55c upstream.
The mcp3021 scaling code is dividing the VDD (full-scale) value in millivolts by the A2D resolution to obtain the scaling factor. When VDD is 3300mV (the standard value) and the resolution is 12-bit (4096 divisions), the result is a scale factor of 3300/4096, which is always one. Effectively, the raw A2D reading is always being returned because no scaling is applied.
This patch fixes the issue and simplifies the register-to-volts calculation, removing the unneeded "output_scale" struct member.
--- drivers/hwmon/mcp3021.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/hwmon/mcp3021.c +1 -13
@@ -31,14 +31,11 @@/* output format */ #define MCP3021_SAR_SHIFT 2#define MCP3021_SAR_MASK 0x3ff -#define MCP3021_OUTPUT_RES 10/* 10-bit resolution */ -#define MCP3021_OUTPUT_SCALE 4#define MCP3221_SAR_SHIFT 0#define MCP3221_SAR_MASK 0xfff#define MCP3221_OUTPUT_RES 12/* 12-bit resolution */ -#define MCP3221_OUTPUT_SCALE 1enum chips { mcp3021,
@@ -54,7 +51,6 @@ struct mcp3021_data {u16 sar_shift;u16 sar_mask;u8 output_res; -u8 output_scale; };static int mcp3021_read16 (struct i2c_client *client)
@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_clistatic inline u16 volts_from_reg (struct mcp3021_data *data,u16 val) { -if (val ==0 ) -return 0 ; - - val = val * data->output_scale - data->output_scale /2 ; - -return val *DIV_ROUND_CLOSEST (data->vdd, - (1 << data->output_res) * data->output_scale); +return DIV_ROUND_CLOSEST (data->vdd * val,1 << data->output_res); } static ssize_t show_in_input(struct device *dev, struct device_attribute *attr,
@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_clie data->sar_shift =MCP3021_SAR_SHIFT ; data->sar_mask =MCP3021_SAR_MASK ; data->output_res =MCP3021_OUTPUT_RES ; - data->output_scale =MCP3021_OUTPUT_SCALE ;break ;case mcp3221: data->sar_shift =MCP3221_SAR_SHIFT ; data->sar_mask =MCP3221_SAR_MASK ; data->output_res =MCP3221_OUTPUT_RES ; - data->output_scale =MCP3221_OUTPUT_SCALE ;break ; }