Linux 3.19.8-ckt11 stable review
Subsystems (108)
This is the start of the review cycle for the Linux 3.19.8-ckt11 stable kernel.
This version contains 164 new patches, summarized below. The new patches are posted as replies to this message and also available in this git branch:
http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-review
git://kernel.ubuntu.com/ubuntu/linux.git linux-3.19.y-review
The review period for version 3.19.8-ckt11 will be open for the next three days. To report a problem, please reply to the relevant follow-up patch message.
For more information about the Linux 3.19.y-ckt extended stable kernel version, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .
-Kamal
--
.../devicetree/bindings/mmc/renesas,mmcif.txt | 4 +- Documentation/devicetree/bindings/usb/dwc3.txt | 2 + Documentation/filesystems/proc.txt | 5 +- MAINTAINERS | 1 + arch/arm/common/edma.c | 6 +- arch/arm/mach-pxa/include/mach/pxa27x.h | 2 +- arch/arm/mach-pxa/pxa27x.c | 2 +- arch/arm/mach-tegra/board-paz00.c | 4 +- arch/arm/mm/dma-mapping.c | 7 + arch/arm64/include/asm/ptrace.h | 16 +- arch/arm64/net/bpf_jit.h | 3 +- arch/arm64/net/bpf_jit_comp.c | 54 ++++-- arch/mips/include/asm/atomic.h | 2 +- arch/parisc/include/asm/compat.h | 4 +- arch/parisc/include/uapi/asm/ipcbuf.h | 19 +- arch/parisc/include/uapi/asm/msgbuf.h | 10 +- arch/parisc/include/uapi/asm/posix_types.h | 2 + arch/parisc/include/uapi/asm/sembuf.h | 6 +- arch/parisc/include/uapi/asm/shmbuf.h | 8 +- arch/parisc/mm/init.c | 16 ++ arch/s390/kvm/kvm-s390.c | 4 +- arch/sparc/kernel/pci.c | 7 +- arch/sparc/kernel/pci_common.c | 17 +- arch/sparc/kernel/pci_impl.h | 1 + arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +- arch/x86/include/uapi/asm/svm.h | 1 + arch/x86/kernel/head_64.S | 8 + arch/x86/kernel/setup.c | 8 + arch/x86/kernel/verify_cpu.S | 12 +- arch/x86/kvm/svm.c | 22 +-- arch/x86/kvm/vmx.c | 24 +-- arch/xtensa/include/asm/asmmacro.h | 7 +- arch/xtensa/include/asm/vectors.h | 9 +- arch/xtensa/kernel/Makefile | 1 + arch/xtensa/kernel/entry.S | 8 +- arch/xtensa/kernel/head.S | 2 +- arch/xtensa/kernel/setup.c | 9 +- arch/xtensa/kernel/vectors.S | 4 +- arch/xtensa/kernel/vmlinux.lds.S | 12 +- arch/xtensa/lib/usercopy.S | 6 +- arch/xtensa/platforms/iss/setup.c | 2 + arch/xtensa/platforms/xt2000/setup.c | 2 + arch/xtensa/platforms/xtfpga/setup.c | 2 + crypto/algif_hash.c | 12 +- drivers/acpi/osl.c | 13 +- drivers/acpi/sleep.c | 6 +- drivers/bluetooth/ath3k.c | 4 + drivers/bluetooth/btusb.c | 2 + drivers/char/tpm/tpm_ibmvtpm.c | 2 +- drivers/char/tpm/tpm_of.c | 3 +- drivers/clk/versatile/clk-icst.c | 4 +- drivers/dma/dw/core.c | 12 +- drivers/firewire/ohci.c | 5 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_fb.c | 7 + drivers/gpu/drm/ast/ast_main.c | 1 + drivers/gpu/drm/ast/ast_mode.c | 2 + drivers/gpu/drm/drm_crtc.c | 5 +- drivers/gpu/drm/i915/intel_display.c | 3 + drivers/gpu/drm/radeon/si_dpm.c | 2 + drivers/hid/hid-core.c | 2 +- drivers/hsi/controllers/omap_ssi_port.c | 2 +- drivers/hsi/hsi.c | 1 - drivers/i2c/busses/i2c-img-scb.c | 71 +++++--- drivers/input/mouse/elantech.c | 7 + drivers/iommu/intel-iommu.c | 9 +- drivers/md/dm-mpath.c | 7 +- drivers/media/platform/vivid/vivid-core.c | 5 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 9 +- drivers/media/v4l2-core/v4l2-ctrls.c | 12 +- drivers/media/v4l2-core/videobuf2-dma-contig.c | 5 +- drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 +- drivers/mfd/twl6040.c | 2 + drivers/mtd/mtd_blkdevs.c | 10 +- drivers/mtd/mtdpart.c | 4 +- drivers/net/bonding/bond_main.c | 1 + drivers/net/can/dev.c | 2 +- drivers/net/ethernet/marvell/mvneta.c | 2 +- drivers/net/ethernet/sfc/ef10.c | 4 +- drivers/net/ethernet/sfc/farch.c | 4 +- drivers/net/ethernet/sfc/net_driver.h | 2 + drivers/net/ethernet/sfc/tx.c | 30 +++- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 +- drivers/net/macvtap.c | 2 +- drivers/net/usb/qmi_wwan.c | 9 +- drivers/net/wireless/mwifiex/debugfs.c | 14 +- drivers/of/fdt.c | 5 +- drivers/of/of_reserved_mem.c | 4 + drivers/pci/host/pcie-spear13xx.c | 26 +-- drivers/platform/x86/ideapad-laptop.c | 7 + drivers/power/wm831x_power.c | 6 +- drivers/regulator/arizona-ldo1.c | 18 +- drivers/rtc/rtc-ds1307.c | 4 +- drivers/scsi/megaraid/megaraid_sas.h | 2 + drivers/scsi/megaraid/megaraid_sas_base.c | 20 ++- drivers/scsi/scsi_sysfs.c | 18 +- drivers/scsi/storvsc_drv.c | 3 +- drivers/spi/spi-atmel.c | 3 +- drivers/spi/spi-dw.c | 6 +- drivers/spi/spi-ti-qspi.c | 3 +- drivers/staging/rtl8712/usb_intf.c | 1 + drivers/thermal/samsung/exynos_tmu.c | 33 ++-- drivers/usb/dwc3/core.c | 16 +- drivers/usb/dwc3/core.h | 22 +++ drivers/usb/dwc3/dwc3-pci.c | 10 ++ drivers/usb/dwc3/platform_data.h | 1 + drivers/usb/host/ehci-orion.c | 3 +- drivers/usb/serial/qcserial.c | 2 + fs/binfmt_elf.c | 10 +- fs/btrfs/file.c | 16 +- fs/btrfs/inode.c | 92 ++++++++-- fs/btrfs/ioctl.c | 195 ++++++++++++++++----- fs/btrfs/xattr.c | 4 +- fs/cachefiles/rdwr.c | 67 +++---- fs/ceph/mds_client.c | 2 +- fs/ext4/ext4_jbd2.c | 6 +- fs/ext4/resize.c | 4 +- fs/ext4/super.c | 12 +- fs/fscache/netfs.c | 38 ++-- fs/fscache/page.c | 2 +- fs/jbd2/checkpoint.c | 8 +- fs/jbd2/journal.c | 6 +- fs/lockd/host.c | 7 +- fs/lockd/mon.c | 36 ++-- fs/lockd/netns.h | 1 + fs/lockd/svc.c | 1 + fs/lockd/svc4proc.c | 2 +- fs/lockd/svcproc.c | 2 +- fs/nfsd/nfs4state.c | 33 +++- fs/nfsd/state.h | 17 +- fs/pipe.c | 9 +- fs/proc/array.c | 16 +- fs/proc/base.c | 11 +- fs/proc/fd.c | 14 +- fs/seq_file.c | 11 +- include/linux/acpi.h | 6 + include/linux/jbd2.h | 1 + include/linux/lockd/lockd.h | 9 +- include/linux/tracepoint.h | 9 +- include/net/inet_common.h | 3 +- include/net/inet_frag.h | 15 +- include/net/netfilter/nf_conntrack.h | 4 - kernel/events/core.c | 4 + kernel/printk/printk.c | 13 +- lib/devres.c | 2 +- mm/memcontrol.c | 11 +- mm/slab.c | 5 +- net/bluetooth/hidp/core.c | 14 ++ net/bluetooth/mgmt.c | 12 +- net/core/dst.c | 2 +- net/core/fib_rules.c | 2 +- net/ieee802154/reassembly.c | 11 +- net/ipv4/inet_fragment.c | 6 - net/ipv4/ip_fragment.c | 12 +- net/ipv4/ip_output.c | 2 +- net/ipv4/ipmr.c | 6 +- net/ipv4/sysctl_net_ipv4.c | 4 +- net/ipv4/tcp_input.c | 5 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/addrconf.c | 1 + net/ipv6/netfilter/nf_conntrack_reasm.c | 12 +- net/ipv6/reassembly.c | 12 +- net/ipv6/sit.c | 26 +-- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/tunnel6.c | 12 +- net/irda/irlmp.c | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/trace.h | 10 +- net/mac80211/util.c | 7 + net/netfilter/nf_nat_redirect.c | 2 +- net/netfilter/nfnetlink.c | 2 +- net/packet/af_packet.c | 86 +++++---- net/rds/tcp_recv.c | 11 +- net/sunrpc/auth_gss/auth_gss.c | 13 +- net/sunrpc/xprtrdma/verbs.c | 66 ++----- net/tipc/msg.c | 12 +- net/wireless/nl80211.c | 12 +- scripts/recordmcount.c | 24 ++- scripts/recordmcount.h | 2 +- security/integrity/digsig.c | 2 +- sound/firewire/bebob/Makefile | 2 +- sound/firewire/bebob/bebob_maudio.c | 2 +- sound/firewire/dice/Makefile | 2 +- sound/firewire/dice/dice-stream.c | 12 +- sound/firewire/dice/dice.c | 3 +- sound/firewire/fireworks/Makefile | 2 +- sound/firewire/fireworks/fireworks_command.c | 2 +- sound/firewire/oxfw/Makefile | 2 +- sound/pci/hda/hda_intel.c | 8 + sound/pci/hda/patch_hdmi.c | 3 +- sound/pci/hda/patch_realtek.c | 13 ++ sound/pci/hda/patch_sigmatel.c | 1 + sound/usb/quirks.c | 1 + tools/perf/Documentation/perf-trace.txt | 1 - 194 files changed, 1327 insertions(+), 695 deletions(-)
Alex Deucher (1):
drm/radeon: add quirk for ASUS R7 370
Alexandra Yates (1):
ALSA: hda - Add Intel Lewisburg device IDs Audio
Andrey Ryabinin (1):
lockd: create NSM handles per net namespace
Andrzej Hajda (1):
[media] v4l2-compat-ioctl32: fix alignment for ARM64
Andy Leiserson (1):
fix calculation of meta_bg descriptor backups
Andy Shevchenko (2):
spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
dmaengine: dw: convert to __ffs()
Ani Sinha (1):
ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.
Antonio Ospite (1):
[media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
Arik Nemtsov (1):
mac80211: allow null chandef in tracing
Arnd Bergmann (3):
ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
sunrpc: avoid warning in gss_key_timeout
ceph: fix message length computation
Benoit Parrot (1):
[media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
Bjørn Mork (3):
qmi_wwan: add Sierra Wireless MC74xx/EM74xx
qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module
USB: qcserial: add Sierra Wireless MC74xx/EM74xx
Boris BREZILLON (1):
mtd: mtdpart: fix add_mtd_partitions error path
Borislav Petkov (1):
x86/cpu: Call verify_cpu() after having entered long mode too
Brian Norris (1):
mtd: blkdevs: fix potential deadlock + lockdep warnings
Catalin Marinas (1):
mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE
Charles Keepax (1):
regulator: arizona-ldo1: Fix handling of GPIO 0
Chen Yu (3):
ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
ACPI: Using correct irq when waiting for events
ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle
Christoph Hellwig (1):
scsi: restart list search after unlock in scsi_remove_target
Christophe JAILLET (1):
TPM: Avoid reference to potentially freed memory
Chuck Lever (1):
xprtrdma: Re-arm after missed events
Daeho Jeong (1):
ext4, jbd2: ensure entering into panic after recording an error in superblock
Dan Carpenter (3):
irda: precedence bug in irlmp_seq_hb_idx()
mwifiex: fix mwifiex_rdeeprom_read()
devres: fix a for loop bounds check
David Herrmann (1):
Bluetooth: hidp: fix device disconnect on idle timeout
David Hildenbrand (1):
KVM: s390: SCA must not cross page boundaries
David Howells (1):
FS-Cache: Handle a write to the page immediately beyond the EOF marker
David Mosberger-Tang (1):
spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word
David Woodhouse (1):
iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints
Dmitry Kasatkin (1):
integrity: prevent loading untrusted certificates on the IMA trusted keyring
Dmitry Osipenko (1):
ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table
Dmitry Tunin (2):
Bluetooth: ath3k: Add new AR3012 0930:021c id
Bluetooth: ath3k: Add support of AR3012 0cf3:817b device
Egbert Eich (1):
drm/ast: Initialized data needed to map fbdev memory
Eric Biggers (1):
fs/pipe.c: return error code rather than 0 in pipe_write()
Eric Dumazet (6):
sit: fix sit0 percpu double allocations
net: avoid NULL deref in inet_ctl_sock_destroy()
net: fix a race in dst_release()
tcp: call sk_mark_napi_id() on the child, not the listener
packet: fix match_fanout_group()
net: fix percpu memory leaks
Eric Northup (1):
KVM: x86: work around infinite loop in microcode when #AC is delivered
Eric W. Biederman (1):
ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk
Ezequiel Garcia (1):
vivid: Fix iteration in driver removal path
Filipe Manana (5):
Btrfs: fix file corruption and data loss after cloning inline extents
Btrfs: fix truncation of compressed and inlined extents
Btrfs: fix race leading to incorrect item deletion when dropping extents
Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
Btrfs: fix race when listing an inode's xattrs
Flavio Leitner (1):
netfilter: remove dead code
Florian Westphal (1):
netfilter: nfnetlink: don't probe module if it exists
Francesco Ruggeri (1):
packet: race condition in packet_bind
Gabriele Paoloni (1):
PCI: spear: Fix dw_pcie_cfg_read/write() usage
Geliang Tang (1):
hsi: fix double kfree
Greg Thelen (1):
fs, seqfile: always allow oom killer
Hans Verkuil (1):
[media] v4l2-ctrls: arrays are also considered compound controls
Hans de Goede (1):
ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list
Helge Deller (1):
parisc: Fixes and cleanups in kernel uapi header files
Herbert Xu (1):
crypto: algif_hash - Only export and import on sockets with data
Hon Ching \\(Vicky\\) Lo (1):
vTPM: fix memory allocation flag for rtce buffer at kernel boot
Ingo Molnar (1):
fs/proc, core/debug: Don't expose absolute kernel addresses via wchan
Jan Kara (1):
jbd2: fix checkpoint list cleanup
Jani Nikula (1):
drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015)
[email protected] (1):
mac80211: fix divide by zero when NOA update
Jason Liu (1):
drivers: of: of_reserved_mem: fixup the alignment with CMA setup
Jason Wang (1):
macvtap: unbreak receiving of gro skb with frag list
Jay Vosburgh (1):
bonding: fix panic on non-ARPHRD_ETHER enslave failure
Jeff Layton (1):
nfsd: serialize state seqid morphing operations
Johan Hedberg (1):
Bluetooth: Fix removing connection parameters when unpairing
Johannes Berg (1):
mac80211: fix driver RSSI event calculations
John Youn (4):
usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID
usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1
usb: dwc3: Support Synopsys USB 3.1 IP
usb: dwc3: Add dis_enblslpm_quirk
Jon Paul Maloy (1):
tipc: allow non-linear first fragment buffer
Jonas Gorski (1):
usb: ehci-orion: fix probe for !GENERIC_PHY
Jurgen Kramer (1):
ALSA: usb: Add native DSD support for Aune X1S
K. Y. Srinivasan (1):
storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag
Kailang Yang (1):
ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back
Kinglong Mee (2):
FS-Cache: Increase reference of parent after registering, netfs success
FS-Cache: Don't override netfs's primary_index if registering failed
Krzysztof Kozlowski (1):
thermal: exynos: Fix unbalanced regulator disable on probe failure
Krzysztof Mazur (1):
x86/setup: Fix low identity map for >= 2GB kernel range
Larry Finger (1):
staging: rtl8712: Add device ID for Sitecom WLA2100
Li Bin (1):
recordmcount: arm64: Replace the ignored mcount call into nop
Linus Walleij (1):
clk: versatile-icst: fix memory leak
Lu, Han (1):
ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec
Lukas Czerner (1):
ext4: fix potential use after free in __ext4_journal_stop
Lukas Wunner (1):
drm: Fix return value of drm_framebuffer_init()
Maciej W. Rozycki (1):
binfmt_elf: Don't clobber passed executable's file header
Marek Szyprowski (2):
ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()
ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap()
Marek Vasut (1):
can: Use correct type in sizeof() in nla_put()
Martin Habets (1):
sfc: push partner queue for skb->xmit_more
Masahiro Yamada (1):
of/fdt: fix error checking for earlycon address
Mathias Krause (1):
printk: prevent userland from spoofing kernel messages
Mathieu Desnoyers (1):
tracepoints: Fix documentation of RCU lockdep checks
Mauricio Faria de Oliveira (1):
Revert "dm mpath: fix stalls when handling invalid ioctls"
Max Filippov (2):
xtensa: fixes for configs without loop option
xtensa: fix secondary core boot in SMP
Maxim Sheviakov (2):
drm/radeon: add quirk for MSI R7 370 drm/radeon: fix quirk for MSI R7 370 Armor 2X
Maxime Ripard (1):
net: mvneta: Fix CPU_MAP registers initialisation
Michal Hocko (1):
memcg: fix thresholds for 32b architectures.
Michal Kubeček (1):
ipv6: fix tunnel error handling
Munehisa Kamata (1):
netfilter: nf_nat_redirect: add missing NULL pointer check
Nicolas Iooss (1):
crypto: crc32c-pclmul - use .rodata instead of .rotata
Ola Olsson (1):
nl80211: Fix potential memory leak from parse_acl_data
Oleg Nesterov (1):
proc: actually make proc_fd_permission() thread-friendly
Paolo Bonzini (2):
x86/setup: Extend low identity map to cover whole kernel range
KVM: svm: unconditionally intercept #DB
Peter Feiner (1):
perf trace: Fix documentation for -i
Peter Oberparleiter (1):
scsi_sysfs: Fix queue_ramp_up_period return code
Peter Ujfalusi (1):
ARM: common: edma: Fix channel parameter for irq callbacks
Peter Zijlstra (1):
perf: Fix inherited events vs. tracepoint filters
Phil Reid (1):
stmmac: Correctly report PTP capabilities.
Radim Krčmář (1):
KVM: VMX: fix SMEP and SMAP without EPT
Ralf Baechle (1):
MIPS: atomic: Fix comment describing atomic64_add_unless's return value.
Richard Purdie (1):
HID: core: Avoid uninitialized buffer access
Robin Murphy (1):
arm64: Fix compat register mappings
Roger Quadros (1):
hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.
Roland Dreier (1):
[3.19-stable only] fib_rules: Fix dump_rules() not to exit early
Sabrina Dubroca (1):
ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
Sergei Shtylyov (1):
DT: mmc: sh_mmcif: fix "compatible" property text
Sifan Naeem (6):
i2c: img-scb: enable fencing for all versions of the ip
i2c: img-scb: do dummy writes before fifo access
i2c: img-scb: use DIV_ROUND_UP to round divisor values
i2c: img-scb: fix LOW and HIGH period values for the SCL clock
i2c: img-scb: Clear line and interrupt status before starting a transfer
i2c: img-scb: verify support for requested bit rate
Sowmini Varadhan (1):
RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv
Stefan Richter (1):
firewire: ohci: fix JMicron JMB38x IT context discovery
Takashi Iwai (3):
ALSA: hda - Disable 64bit address for Creative HDA controllers
ALSA: hda - Apply pin fixup for HP ProBook 6550b
Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled
Takashi Sakamoto (5):
ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
ALSA: dice: correct variable types for __be32 data
ALSA: dice: assign converted data to the same type of variable
ALSA: fireworks: use u32 type for be32_to_cpup() macro
ALSA: bebob: use correct type for __be32 data
Tero Kristo (1):
rtc: ds1307: Fix alarm programming for mcp794xx
Tiffany Lin (2):
[media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish [media] media: vb2 dma-sg: Fully cache synchronise buffers in prepare and finish
Tony Lindgren (1):
mfd: twl6040: Fix deferred probe handling for clk32k
Valentin Rothberg (1):
wm831x_power: Use IRQF_ONESHOT to request threaded IRQs
Vignesh R (1):
spi: ti-qspi: Fix data corruption seen on r/w stress test
Vineet Gupta (1):
MAINTAINERS: Add public mailing list for ARC
WANG Cong (1):
ipv4: disable BH when changing ip local port range
Yinghai Lu (1):
sparc/PCI: Add mem64 resource parsing for root bus
Yuchung Cheng (1):
tcp: apply Kern's check on RTTs used for congestion control
Zi Shen Lim (2):
arm64: bpf: fix div-by-zero case
arm64: bpf: fix mod-by-zero case
libin (1):
recordmcount: Fix endianness handling bug for nop_mcount
[email protected] (3):
megaraid_sas: Expose TAPE drives unconditionally
megaraid_sas: Do not use PAGE_SIZE for max_sectors megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
PATCH 1/164 x86/setup: Extend low identity map to cover whole kernel range
3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit f5f3497cad8c8416a74b9aaceb127908755d020a upstream.
On 32-bit systems, the initial_page_table is reused by efi_call_phys_prolog as an identity map to call SetVirtualAddressMap. efi_call_phys_prolog takes care of converting the current CPU's GDT to a physical address too.
For PAE kernels the identity mapping is achieved by aliasing the first PDPE for the kernel memory mapping into the first PDPE of initial_page_table. This makes the EFI stub's trick "just work".
However, for non-PAE kernels there is no guarantee that the identity mapping in the initial_page_table extends as far as the GDT; in this case, accesses to the GDT will cause a page fault (which quickly becomes a triple fault). Fix this by copying the kernel mappings from swapper_pg_dir to initial_page_table twice, both at PAGE_OFFSET and at identity mapping.
For some reason, this is only reproducible with QEMU's dynamic translation mode, and not for example with KVM. However, even under KVM one can clearly see that the page table is bogus:
$ qemu-system-i386 -pflash OVMF.fd -M q35 vmlinuz0 -s -S -daemonize
$ gdb
(gdb) target remote localhost:1234
(gdb) hb *0x02858f6f
Hardware assisted breakpoint 1 at 0x2858f6f
(gdb) c
Continuing. Breakpoint 1, 0x02858f6f in ?? ()
(gdb) monitor info registers
...
GDT= 0724e000 000000ff
IDT= fffbb000 000007ff
CR0=0005003b CR2=ff896000 CR3=032b7000 CR4=00000690
...The page directory is sane:
(gdb) x/4wx 0x32b7000
0x32b7000: 0x03398063 0x03399063 0x0339a063 0x0339b063
(gdb) x/4wx 0x3398000
0x3398000: 0x00000163 0x00001163 0x00002163 0x00003163
(gdb) x/4wx 0x3399000
0x3399000: 0x00400003 0x00401003 0x00402003 0x00403003but our particular page directory entry is empty:
(gdb) x/1wx 0x32b7000 + (0x724e000 >> 22) * 4
0x32b7070: 0x00000000[ It appears that you can skate past this issue if you don't receive
any interrupts while the bogus GDT pointer is loaded, or if you avoid reloading the segment registers in general.
Andy Lutomirski provides some additional insight:
"AFAICT it's entirely permissible for the GDTR and/or LDT
descriptor to point to unmapped memory. Any attempt to use them (segment loads, interrupts, IRET, etc) will try to access that memory as if the access came from CPL 0 and, if the access fails, will generate a valid page fault with CR2 pointing into the GDT or LDT."
Up until commit 23a0d4e8fa6d ("efi: Disable interrupts around EFI calls, not in the epilog/prolog calls") interrupts were disabled around the prolog and epilog calls, and the functional GDT was re-installed before interrupts were re-enabled.
Which explains why no one has hit this issue until now. ]
--- arch/x86/kernel/setup.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kernel/setup.c +8 -0
@@ -1188,6 +1188,14 @@ void __init setup_arch(char **cmdline_p)clone_pgd_range (initial_page_table +KERNEL_PGD_BOUNDARY , swapper_pg_dir +KERNEL_PGD_BOUNDARY ,KERNEL_PGD_PTRS ); + +/* +* sync back low identity map too. It is used for example +* in the 32-bit EFI stub. +*/ +clone_pgd_range (initial_page_table, + swapper_pg_dir +KERNEL_PGD_BOUNDARY , +KERNEL_PGD_PTRS );#endif tboot_probe ();
Signature · 1 line
1.9.1
PATCH 2/164 x86/setup: Fix low identity map for >= 2GB kernel range
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Mazur <[email protected]>
commit 68accac392d859d24adcf1be3a90e41f978bd54c upstream.
The commit f5f3497cad8c extended the low identity mapping. However, if the kernel uses more than 2 GB (VMSPLIT_2G_OPT or VMSPLIT_1G memory split), the normal memory mapping is overwritten by the low identity mapping causing a crash. To avoid overwritting, limit the low identity map to cover only memory before kernel range (PAGE_OFFSET).
--- arch/x86/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/setup.c +1 -1
@@ -1195,7 +1195,7 @@ void __init setup_arch(char **cmdline_p)*/ clone_pgd_range (initial_page_table, swapper_pg_dir +KERNEL_PGD_BOUNDARY , -KERNEL_PGD_PTRS ); +min (KERNEL_PGD_PTRS ,KERNEL_PGD_BOUNDARY ));#endif tboot_probe ();
Signature · 1 line
1.9.1
PATCH 3/164 drm/radeon: add quirk for MSI R7 370
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Sheviakov <[email protected]>
commit e78654799135a788a941bacad3452fbd7083e518 upstream.
Just adds the quirk for MSI R7 370 Armor 2X
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=91294
--- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/si_dpm.c +1 -0
@@ -2923,6 +2923,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { { 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 }, + { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, { 0, 0, 0, 0 }, };
Signature · 1 line
1.9.1
PATCH 4/164 drm/radeon: add quirk for ASUS R7 370
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 2b02ec79004388a8c65e227bc289ed891b5ac8c6 upstream.
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=92260
--- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/si_dpm.c +1 -0
@@ -2924,6 +2924,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, + { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, { 0, 0, 0, 0 }, };
Signature · 1 line
1.9.1
PATCH 5/164 drm/radeon: fix quirk for MSI R7 370 Armor 2X
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Sheviakov <[email protected]>
commit 515c752dabee9945c1e8686c87f7cdeb3935eea4 upstream.
There was a typo in the original.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=92865
--- drivers/gpu/drm/radeon/si_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/si_dpm.c +1 -1
@@ -2923,7 +2923,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { { 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 }, - { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, + { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 }, { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, { 0, 0, 0, 0 }, };
Signature · 1 line
1.9.1
PATCH 6/164 irda: precedence bug in irlmp_seq_hb_idx()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 50010c20597d14667eff0fdb628309986f195230 ]
This is decrementing the pointer, instead of the value stored in the pointer. KASan detects it as an out of bounds reference.
--- net/irda/irlmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/irda/irlmp.c +1 -1
@@ -1839,7 +1839,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)for (element =hashbin_get_first (iter->hashbin); element !=NULL ; element =hashbin_get_next (iter->hashbin)) { -if (!off || *off-- ==0 ) { +if (!off || (*off)-- ==0 ) {/* NB: hashbin left locked */ return element; }
Signature · 1 line
1.9.1
PATCH 7/164 tipc: allow non-linear first fragment buffer
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Paul Maloy <[email protected]>
[ Upstream commit 45c8b7b175ceb2d542e0fe15247377bf3bce29ec ]
The current code for message reassembly is erroneously assuming that the the first arriving fragment buffer always is linear, and then goes ahead resetting the fragment list of that buffer in anticipation of more arriving fragments.
However, if the buffer already happens to be non-linear, we will inadvertently drop the already attached fragment list, and later on trig a BUG() in __pskb_pull_tail().
We see this happen when running fragmented TIPC multicast across UDP, something made possible since
commit d0f91938bede ("tipc: add ip/udp media type")
We fix this by not resetting the fragment list when the buffer is non- linear, and by initiatlizing our private fragment list tail pointer to the tail of the existing fragment list.
--- net/tipc/msg.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/tipc/msg.c +9 -3
@@ -98,7 +98,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) {struct sk_buff *head = *headbuf;struct sk_buff *frag = *buf; -struct sk_buff *tail; +struct sk_buff *tail =NULL ;struct tipc_msg *msg;u32 fragid;int delta;
@@ -118,9 +118,15 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)if (unlikely (skb_unclone (frag,GFP_ATOMIC ))) goto err; head = *headbuf = frag; -skb_frag_list_init (head); -TIPC_SKB_CB (head)->tail =NULL ; *buf =NULL ; +TIPC_SKB_CB (head)->tail =NULL ; +if (skb_is_nonlinear (head)) { + skb_walk_frags(head, tail) { +TIPC_SKB_CB (head)->tail = tail; + } + }else { +skb_frag_list_init (head); + }return 0 ; }
Signature · 1 line
1.9.1
PATCH 8/164 qmi_wwan: add Sierra Wireless MC74xx/EM74xx
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
[ Upstream commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef ]
New device IDs shamelessly lifted from the vendor driver.
--- drivers/net/usb/qmi_wwan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/qmi_wwan.c +4 -0
@@ -764,6 +764,10 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ + {QMI_FIXED_INTF(0x1199, 0x9070, 8)}, /* Sierra Wireless MC74xx/EM74xx */ + {QMI_FIXED_INTF(0x1199, 0x9070, 10)}, /* Sierra Wireless MC74xx/EM74xx */ + {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx/EM74xx */ + {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx/EM74xx */ {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
Signature · 1 line
1.9.1
PATCH 9/164 macvtap: unbreak receiving of gro skb with frag list
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit f23d538bc24a83c16127c2eb82c9cf1adc2b5149 ]
We don't have fraglist support in TAP_FEATURES. This will lead software segmentation of gro skb with frag list. Fixes by having frag list support in TAP_FEATURES.
With this patch single session of netperf receiving were restored from about 5Gb/s to about 12Gb/s on mlx4.
Fixes a567dd6252 ("macvtap: simplify usage of tap_features")
--- drivers/net/macvtap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvtap.c +1 -1
@@ -82,7 +82,7 @@ static const struct proto_ops macvtap_socket_ops;#define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ NETIF_F_TSO6 | NETIF_F_UFO)#define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) -#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) +#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG | NETIF_F_FRAGLIST)static struct macvlan_dev *macvtap_get_vlan_rcu (const struct net_device *dev) {
Signature · 1 line
1.9.1
PATCH 10/164 RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sowmini Varadhan <[email protected]>
[ Upstream commit 8ce675ff39b9958d1c10f86cf58e357efaafc856 ]
Either of pskb_pull() or pskb_trim() may fail under low memory conditions. If rds_tcp_data_recv() ignores such failures, the application will receive corrupted data because the skb has not been correctly carved to the RDS datagram size.
Avoid this by handling pskb_pull/pskb_trim failure in the same manner as the skb_clone failure: bail out of rds_tcp_data_recv(), and retry via the deferred call to rds_send_worker() that gets set up on ENOMEM from rds_tcp_read_sock()
--- net/rds/tcp_recv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/rds/tcp_recv.c +9 -2
@@ -214,8 +214,15 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb, } to_copy =min (tc->t_tinc_data_rem, left); -pskb_pull (clone, offset); -pskb_trim (clone, to_copy); +if (!pskb_pull (clone, offset) || +pskb_trim (clone, to_copy)) { +pr_warn ("rds_tcp_data_recv: pull/trim failed " +"left %zu data_rem %zu skb_len %d\n" , + left, tc->t_tinc_data_rem, skb->len); +kfree_skb (clone); + desc->error = -ENOMEM ; + goto out; + }skb_queue_tail (&tinc->ti_skb_list, clone); rdsdebug("skb %p data %p len %d off %u to_copy %zu -> "
Signature · 1 line
1.9.1
PATCH 11/164 stmmac: Correctly report PTP capabilities.
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Reid <[email protected]>
[ Upstream commit e6dbe1eb2db0d7a14991c06278dd3030c45fb825 ]
priv->hwts_*_en indicate if timestamping is enabled/disabled at run time. But priv->dma_cap.time_stamp and priv->dma_cap.atime_stamp indicates HW is support for PTPv1/PTPv2.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +5 -2
@@ -721,10 +721,13 @@ static int stmmac_get_ts_info(struct net_device *dev, {struct stmmac_priv *priv =netdev_priv (dev); -if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { +if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { - info->so_timestamping =SOF_TIMESTAMPING_TX_HARDWARE | + info->so_timestamping =SOF_TIMESTAMPING_TX_SOFTWARE | +SOF_TIMESTAMPING_TX_HARDWARE | +SOF_TIMESTAMPING_RX_SOFTWARE |SOF_TIMESTAMPING_RX_HARDWARE | +SOF_TIMESTAMPING_SOFTWARE |SOF_TIMESTAMPING_RAW_HARDWARE ;if (priv->ptp_clock)
Signature · 1 line
1.9.1
PATCH 12/164 ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ani Sinha <[email protected]>
[ Upstream commit 44f49dd8b5a606870a1f21101522a0f9c4414784 ]
Fixes the following kernel BUG :
BUG: using __this_cpu_add() in preemptible [00000000] code: bash/2758 caller is __this_cpu_preempt_check+0x13/0x15 CPU: 0 PID: 2758 Comm: bash Tainted: P O 3.18.19 #2 ffffffff8170eaca ffff880110d1b788 ffffffff81482b2a 0000000000000000 0000000000000000 ffff880110d1b7b8 ffffffff812010ae ffff880007cab800 ffff88001a060800 ffff88013a899108 ffff880108b84240 ffff880110d1b7c8 Call Trace: [<ffffffff81482b2a>] dump_stack+0x52/0x80 [<ffffffff812010ae>] check_preemption_disabled+0xce/0xe1 [<ffffffff812010d4>] __this_cpu_preempt_check+0x13/0x15 [<ffffffff81419d60>] ipmr_queue_xmit+0x647/0x70c [<ffffffff8141a154>] ip_mr_forward+0x32f/0x34e [<ffffffff8141af76>] ip_mroute_setsockopt+0xe03/0x108c [<ffffffff810553fc>] ? get_parent_ip+0x11/0x42 [<ffffffff810e6974>] ? pollwake+0x4d/0x51 [<ffffffff81058ac0>] ? default_wake_function+0x0/0xf [<ffffffff810553fc>] ? get_parent_ip+0x11/0x42 [<ffffffff810613d9>] ? __wake_up_common+0x45/0x77 [<ffffffff81486ea9>] ? _raw_spin_unlock_irqrestore+0x1d/0x32 [<ffffffff810618bc>] ? __wake_up_sync_key+0x4a/0x53 [<ffffffff8139a519>] ? sock_def_readable+0x71/0x75 [<ffffffff813dd226>] do_ip_setsockopt+0x9d/0xb55 [<ffffffff81429818>] ? unix_seqpacket_sendmsg+0x3f/0x41 [<ffffffff813963fe>] ? sock_sendmsg+0x6d/0x86 [<ffffffff813959d4>] ? sockfd_lookup_light+0x12/0x5d [<ffffffff8139650a>] ? SyS_sendto+0xf3/0x11b [<ffffffff810d5738>] ? new_sync_read+0x82/0xaa [<ffffffff813ddd19>] compat_ip_setsockopt+0x3b/0x99 [<ffffffff813fb24a>] compat_raw_setsockopt+0x11/0x32 [<ffffffff81399052>] compat_sock_common_setsockopt+0x18/0x1f [<ffffffff813c4d05>] compat_SyS_setsockopt+0x1a9/0x1cf [<ffffffff813c4149>] compat_SyS_socketcall+0x180/0x1e3 [<ffffffff81488ea1>] cstar_dispatch+0x7/0x1e
--- net/ipv4/ipmr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/ipmr.c +3 -3
@@ -1674,8 +1674,8 @@ static inline int ipmr_forward_finish(struct sk_buff *skb) {struct ip_options *opt = &(IPCB (skb)->opt); -IP_INC_STATS_BH (dev_net (skb_dst (skb)->dev),IPSTATS_MIB_OUTFORWDATAGRAMS ); -IP_ADD_STATS_BH (dev_net (skb_dst (skb)->dev),IPSTATS_MIB_OUTOCTETS , skb->len); +IP_INC_STATS (dev_net (skb_dst (skb)->dev),IPSTATS_MIB_OUTFORWDATAGRAMS ); +IP_ADD_STATS (dev_net (skb_dst (skb)->dev),IPSTATS_MIB_OUTOCTETS , skb->len);if (unlikely (opt->optlen))ip_forward_options (skb);
@@ -1737,7 +1737,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,* to blackhole. */ -IP_INC_STATS_BH (dev_net (dev),IPSTATS_MIB_FRAGFAILS ); +IP_INC_STATS (dev_net (dev),IPSTATS_MIB_FRAGFAILS );ip_rt_put (rt); goto out_free; }
Signature · 1 line
1.9.1
PATCH 13/164 qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
[ Upstream commit 70910791731b5956171e1bfcad707766b8e18fee ]
The lt4112 is a HP branded Huawei me906e modem. Like other Huawei modems, it does not have a fixed interface to function mapping. Instead it uses a Huawei specific scheme: functions are mapped by subclass and protocol.
However, the HP vendor ID is used for modems from many different manufacturers using different schemes, so we cannot apply a generic vendor rule like we do for the Huawei vendor ID.
Replace the previous lt4112 entry pointing to an arbitrary interface number with a device specific subclass + protocol match.
--- drivers/net/usb/qmi_wwan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +4 -1
@@ -539,6 +539,10 @@ static const struct usb_device_id products[] = { USB_CDC_PROTO_NONE), .driver_info = (unsigned long )&qmi_wwan_info, }, + { /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ +USB_DEVICE_AND_INTERFACE_INFO (0x03f0 ,0x581d ,USB_CLASS_VENDOR_SPEC ,1 ,7 ), + .driver_info = (unsigned long)&qmi_wwan_info, + }, /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
@@ -788,7 +792,6 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ - {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
1.9.1
PATCH 14/164 sit: fix sit0 percpu double allocations
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4ece9009774596ee3df0acba65a324b7ea79387c ]
sit0 device allocates its percpu storage twice :
- One time in ipip6_tunnel_init()
- One time in ipip6_fb_tunnel_init()
Thus we leak 48 bytes per possible cpu per network namespace dismantle.
ipip6_fb_tunnel_init() can be much simpler and does not return an error, and should be called after register_netdev()
Note that ipip6_tunnel_clone_6rd() also needs to be called after register_netdev() (calling ipip6_tunnel_init())
--- net/ipv6/sit.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-)
net/ipv6/sit.c +4 -22
@@ -1395,34 +1395,20 @@ static int ipip6_tunnel_init(struct net_device *dev)return 0 ; } -static int __net_init ipip6_fb_tunnel_init (struct net_device *dev) +static void __net_init ipip6_fb_tunnel_init (struct net_device *dev) {struct ip_tunnel *tunnel =netdev_priv (dev);struct iphdr *iph = &tunnel->parms.iph;struct net *net =dev_net (dev);struct sit_net *sitn =net_generic (net, sit_net_id); - tunnel->dev = dev; - tunnel->net =dev_net (dev); - iph->version =4 ; iph->protocol =IPPROTO_IPV6 ; iph->ihl =5 ; iph->ttl =64 ; - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); -if (!dev->tstats) -return -ENOMEM ; - - tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); -if (!tunnel->dst_cache) { -free_percpu (dev->tstats); -return -ENOMEM ; - } -dev_hold (dev);rcu_assign_pointer (sitn->tunnels_wc[0 ], tunnel); -return 0 ; }static int ipip6_validate (struct nlattr *tb[],struct nlattr *data[])
@@ -1832,23 +1818,19 @@ static int __net_init sit_init_net(struct net *net)*/ sitn->fb_tunnel_dev->features |=NETIF_F_NETNS_LOCAL ; - err =ipip6_fb_tunnel_init (sitn->fb_tunnel_dev); -if (err) - goto err_dev_free; - -ipip6_tunnel_clone_6rd (sitn->fb_tunnel_dev, sitn); err =register_netdev (sitn->fb_tunnel_dev);if (err) goto err_reg_dev; +ipip6_tunnel_clone_6rd (sitn->fb_tunnel_dev, sitn); +ipip6_fb_tunnel_init (sitn->fb_tunnel_dev); + t =netdev_priv (sitn->fb_tunnel_dev);strcpy (t->parms.name, sitn->fb_tunnel_dev->name);return 0 ; err_reg_dev: -dev_put (sitn->fb_tunnel_dev); -err_dev_free:ipip6_dev_free (sitn->fb_tunnel_dev); err_alloc_dev:return err;
Signature · 1 line
1.9.1
PATCH 15/164 sfc: push partner queue for skb->xmit_more
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Habets <[email protected]>
[ Upstream commit b2663a4f30e85ec606b806f5135413e6d5c78d1e ]
When the IP stack passes SKBs the sfc driver puts them in 2 different TX queues (called partners), one for checksummed and one for not checksummed. If the SKB has xmit_more set the driver will delay pushing the work to the NIC.
When later it does decide to push the buffers this patch ensures it also pushes the partner queue, if that also has any delayed work. Before this fix the work in the partner queue would be left for a long time and cause a netdev watchdog.
--- drivers/net/ethernet/sfc/ef10.c | 4 +++- drivers/net/ethernet/sfc/farch.c | 4 +++- drivers/net/ethernet/sfc/net_driver.h | 2 ++ drivers/net/ethernet/sfc/tx.c | 30 ++++++++++++++++++++++++++++-- 4 files changed, 36 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/ef10.c +3 -1
@@ -1344,7 +1344,9 @@ static void efx_ef10_tx_write(struct efx_tx_queue *tx_queue)unsigned int write_ptr;efx_qword_t *txd; -BUG_ON (tx_queue->write_count == tx_queue->insert_count); + tx_queue->xmit_more_available = false; +if (unlikely (tx_queue->write_count == tx_queue->insert_count)) +return ; do { write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
drivers/net/ethernet/sfc/farch.c +3 -1
@@ -319,7 +319,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)unsigned write_ptr;unsigned old_write_count = tx_queue->write_count; -BUG_ON (tx_queue->write_count == tx_queue->insert_count); + tx_queue->xmit_more_available = false; +if (unlikely (tx_queue->write_count == tx_queue->insert_count)) +return ; do { write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
drivers/net/ethernet/sfc/net_driver.h +2 -0
@@ -218,6 +218,7 @@ struct efx_tx_buffer {* @tso_packets: Number of packets via the TSO xmit path * @pushes: Number of times the TX push feature has been used * @pio_packets: Number of times the TX PIO feature has been used +* @xmit_more_available: Are any packets waiting to be pushed to the NIC * @empty_read_count: If the completion path has seen the queue as empty * and the transmission path has not yet checked this, the value of * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0.
@@ -250,6 +251,7 @@ struct efx_tx_queue {unsigned int tso_packets;unsigned int pushes;unsigned int pio_packets; +bool xmit_more_available;/* Statistics to supplement MAC stats */ unsigned long tx_packets;
drivers/net/ethernet/sfc/tx.c +28 -2
@@ -431,8 +431,20 @@ finish_packet:efx_tx_maybe_stop_queue (tx_queue);/* Pass off to hardware */ -if (!skb->xmit_more ||netif_xmit_stopped (tx_queue->core_txq)) +if (!skb->xmit_more ||netif_xmit_stopped (tx_queue->core_txq)) { +struct efx_tx_queue *txq2 =efx_tx_queue_partner (tx_queue); + +/* There could be packets left on the partner queue if those +* SKBs had skb->xmit_more set. If we do not push those they +* could be left for a long time and cause a netdev watchdog. +*/ +if (txq2->xmit_more_available) +efx_nic_push_buffers (txq2); +efx_nic_push_buffers (tx_queue); + }else { + tx_queue->xmit_more_available = skb->xmit_more; + } tx_queue->tx_packets++;
@@ -721,6 +733,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue) tx_queue->read_count =0 ; tx_queue->old_read_count =0 ; tx_queue->empty_read_count =0 |EFX_EMPTY_COUNT_VALID ; + tx_queue->xmit_more_available = false;/* Set up TX descriptor ring */ efx_nic_init_tx (tx_queue);
@@ -746,6 +759,7 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) ++tx_queue->read_count; } + tx_queue->xmit_more_available = false;netdev_tx_reset_queue (tx_queue->core_txq); }
@@ -1301,8 +1315,20 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,efx_tx_maybe_stop_queue (tx_queue);/* Pass off to hardware */ -if (!skb->xmit_more ||netif_xmit_stopped (tx_queue->core_txq)) +if (!skb->xmit_more ||netif_xmit_stopped (tx_queue->core_txq)) { +struct efx_tx_queue *txq2 =efx_tx_queue_partner (tx_queue); + +/* There could be packets left on the partner queue if those +* SKBs had skb->xmit_more set. If we do not push those they +* could be left for a long time and cause a netdev watchdog. +*/ +if (txq2->xmit_more_available) +efx_nic_push_buffers (txq2); +efx_nic_push_buffers (tx_queue); + }else { + tx_queue->xmit_more_available = skb->xmit_more; + } tx_queue->tso_bursts++;return NETDEV_TX_OK ;
Signature · 1 line
1.9.1
PATCH 16/164 net: avoid NULL deref in inet_ctl_sock_destroy()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 8fa677d2706d325d71dab91bf6e6512c05214e37 ]
Under low memory conditions, tcp_sk_init() and icmp_sk_init() can both iterate on all possible cpus and call inet_ctl_sock_destroy(), with eventual NULL pointer.
--- include/net/inet_common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/net/inet_common.h +2 -1
@@ -42,7 +42,8 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,static inline void inet_ctl_sock_destroy (struct sock *sk) { -sk_release_kernel (sk); +if (sk) +sk_release_kernel (sk); }#endif
Signature · 1 line
1.9.1
PATCH 17/164 ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 2a189f9e57650e9f310ddf4aad75d66c1233a064 ]
In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up the dev_snmp6 entry that we have already registered for this device. Call snmp6_unregister_dev in this case.
--- net/ipv6/addrconf.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/addrconf.c +1 -0
@@ -396,6 +396,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)if (err) {ipv6_mc_destroy_dev (ndev);del_timer (&ndev->regen_timer); +snmp6_unregister_dev (ndev); goto err_release; }/* protected by rtnl_lock */
Signature · 1 line
1.9.1
PATCH 18/164 ipv4: disable BH when changing ip local port range
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: WANG Cong <[email protected]>
[ Upstream commit 4ee3bd4a8c7463cdef0b82ebc33fc94a9170a7e0 ]
This fixes the following lockdep warning:
[ INFO: inconsistent lock state ]
4.3.0-rc7+ #1197 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
sysctl/1019 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&(&net->ipv4.ip_local_ports.lock)->seqcount){+.+-..}, at: [<ffffffff81921de7>] ipv4_local_port_range+0xb4/0x12a
{IN-SOFTIRQ-R} state was registered at:
[<ffffffff810bd682>] __lock_acquire+0x2f6/0xdf0 [<ffffffff810be6d5>] lock_acquire+0x11c/0x1a4 [<ffffffff818e599c>] inet_get_local_port_range+0x4e/0xae [<ffffffff8166e8e3>] udp_flow_src_port.constprop.40+0x23/0x116 [<ffffffff81671cb9>] vxlan_xmit_one+0x219/0xa6a [<ffffffff81672f75>] vxlan_xmit+0xa6b/0xaa5 [<ffffffff817f2deb>] dev_hard_start_xmit+0x2ae/0x465 [<ffffffff817f35ed>] __dev_queue_xmit+0x531/0x633 [<ffffffff817f3702>] dev_queue_xmit_sk+0x13/0x15 [<ffffffff818004a5>] neigh_resolve_output+0x12f/0x14d [<ffffffff81959cfa>] ip6_finish_output2+0x344/0x39f [<ffffffff8195bf58>] ip6_finish_output+0x88/0x8e [<ffffffff8195bfef>] ip6_output+0x91/0xe5 [<ffffffff819792ae>] dst_output_sk+0x47/0x4c [<ffffffff81979392>] NF_HOOK_THRESH.constprop.30+0x38/0x82 [<ffffffff8197981e>] mld_sendpack+0x189/0x266 [<ffffffff8197b28b>] mld_ifc_timer_expire+0x1ef/0x223 [<ffffffff810de581>] call_timer_fn+0xfb/0x28c [<ffffffff810ded1e>] run_timer_softirq+0x1c7/0x1f1
--- net/ipv4/sysctl_net_ipv4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/sysctl_net_ipv4.c +2 -2
@@ -45,10 +45,10 @@ static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };/* Update system visible IP port range */ static void set_local_port_range (struct net *net,int range[2 ]) { -write_seqlock (&net->ipv4.ip_local_ports.lock); +write_seqlock_bh (&net->ipv4.ip_local_ports.lock); net->ipv4.ip_local_ports.range[0 ] = range[0 ]; net->ipv4.ip_local_ports.range[1 ] = range[1 ]; -write_sequnlock (&net->ipv4.ip_local_ports.lock); +write_sequnlock_bh (&net->ipv4.ip_local_ports.lock); }/* Validate changes from /proc interface. */
Signature · 1 line
1.9.1
PATCH 19/164 packet: race condition in packet_bind
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Ruggeri <[email protected]>
[ Upstream commit 30f7ea1c2b5f5fb7462c5ae44fe2e40cb2d6a474 ]
There is a race conditions between packet_notifier and packet_bind{_spkt}.
It happens if packet_notifier(NETDEV_UNREGISTER) executes between the time packet_bind{_spkt} takes a reference on the new netdevice and the time packet_do_bind sets po->ifindex.
In this case the notification can be missed.
If this happens during a dev_change_net_namespace this can result in the netdevice to be moved to the new namespace while the packet_sock in the old namespace still holds a reference on it. When the netdevice is later deleted in the new namespace the deletion hangs since the packet_sock is not found in the new namespace' &net->packet.sklist.
It can be reproduced with the script below.
This patch makes packet_do_bind check again for the presence of the netdevice in the packet_sock's namespace after the synchronize_net in unregister_prot_hook.
More in general it also uses the rcu lock for the duration of the bind to stop dev_change_net_namespace/rollback_registered_many from going past the synchronize_net following unlist_netdevice, so that no NETDEV_UNREGISTER notifications can happen on the new netdevice while the bind is executing. In order to do this some code from packet_bind{_spkt} is consolidated into packet_do_dev.
import socket, os, time, sys
proto=7
realDev='em1'
vlanId=400
if len(sys.argv) > 1:
vlanId=int(sys.argv[1])
dev='vlan%d' % vlanId
os.system('taskset -p 0x10 %d' % os.getpid())
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, proto) os.system('ip link add link %s name %s type vlan id %d' %
(realDev, dev, vlanId))os.system('ip netns add dummy')
pid=os.fork()
if pid == 0:
# dev should be moved while packet_do_bind is in synchronize net
os.system('taskset -p 0x20000 %d' % os.getpid())
os.system('ip link set %s netns dummy' % dev)
os.system('ip netns exec dummy ip link del %s' % dev)
s.close()
sys.exit(0)time.sleep(.004)
try:
s.bind(('%s' % dev, proto+1))
except:
print 'Could not bind socket'
s.close()
os.system('ip netns del dummy')
sys.exit(0)
os.waitpid(pid, 0)s.close()os.system('ip netns del dummy')sys.exit(0)
--- net/packet/af_packet.c | 80 +++++++++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 31 deletions(-)
net/packet/af_packet.c +49 -31
@@ -2665,22 +2665,40 @@ static int packet_release(struct socket *sock)* Attach a packet hook. */ -static int packet_do_bind (struct sock *sk,struct net_device *dev,__be16 proto) +static int packet_do_bind (struct sock *sk,const char *name,int ifindex, +__be16 proto) {struct packet_sock *po =pkt_sk (sk);struct net_device *dev_curr;__be16 proto_curr;bool need_rehook; +struct net_device *dev =NULL ; +int ret =0 ; +bool unlisted = false; -if (po->fanout) { -if (dev) -dev_put (dev); - +if (po->fanout)return -EINVAL ; - }lock_sock (sk);spin_lock (&po->bind_lock); +rcu_read_lock (); + +if (name) { + dev =dev_get_by_name_rcu (sock_net (sk), name); +if (!dev) { + ret = -ENODEV ; + goto out_unlock; + } + }else if (ifindex) { + dev =dev_get_by_index_rcu (sock_net (sk), ifindex); +if (!dev) { + ret = -ENODEV ; + goto out_unlock; + } + } + +if (dev) +dev_hold (dev); proto_curr = po->prot_hook.type; dev_curr = po->prot_hook.dev;
@@ -2688,14 +2706,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) need_rehook = proto_curr != proto || dev_curr != dev;if (need_rehook) { -unregister_prot_hook (sk, true); +if (po->running) { +rcu_read_unlock (); +__unregister_prot_hook (sk, true); +rcu_read_lock (); + dev_curr = po->prot_hook.dev; +if (dev) + unlisted = !dev_get_by_index_rcu (sock_net (sk), + dev->ifindex); + } po->num = proto; po->prot_hook.type = proto; - po->prot_hook.dev = dev; - po->ifindex = dev ? dev->ifindex :0 ; -packet_cached_dev_assign (po, dev); +if (unlikely (unlisted)) { +dev_put (dev); + po->prot_hook.dev =NULL ; + po->ifindex =-1 ; +packet_cached_dev_reset (po); + }else { + po->prot_hook.dev = dev; + po->ifindex = dev ? dev->ifindex :0 ; +packet_cached_dev_assign (po, dev); + } }if (dev_curr)dev_put (dev_curr);
@@ -2703,7 +2736,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)if (proto ==0 || !need_rehook) goto out_unlock; -if (!dev || (dev->flags &IFF_UP )) { +if (!unlisted && (!dev || (dev->flags &IFF_UP ))) {register_prot_hook (sk); }else { sk->sk_err =ENETDOWN ;
@@ -2712,9 +2745,10 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) } out_unlock: +rcu_read_unlock ();spin_unlock (&po->bind_lock);release_sock (sk); -return 0 ; +return ret; }/*
@@ -2726,8 +2760,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, {struct sock *sk = sock->sk;char name[15 ]; -struct net_device *dev; -int err = -ENODEV ;/* * Check legality
@@ -2737,19 +2769,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr,return -EINVAL ;strlcpy (name, uaddr->sa_data,sizeof (name)); - dev =dev_get_by_name (sock_net (sk), name); -if (dev) - err =packet_do_bind (sk, dev,pkt_sk (sk)->num); -return err; +return packet_do_bind (sk, name,0 ,pkt_sk (sk)->num); }static int packet_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) {struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;struct sock *sk = sock->sk; -struct net_device *dev =NULL ; -int err; -/* * Check legality
@@ -2760,16 +2786,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_lenif (sll->sll_family !=AF_PACKET )return -EINVAL ; -if (sll->sll_ifindex) { - err = -ENODEV ; - dev =dev_get_by_index (sock_net (sk), sll->sll_ifindex); -if (dev ==NULL ) - goto out; - } - err =packet_do_bind (sk, dev, sll->sll_protocol ? :pkt_sk (sk)->num); - -out: -return err; +return packet_do_bind (sk,NULL , sll->sll_ifindex, + sll->sll_protocol ? :pkt_sk (sk)->num); }static struct proto packet_proto = {
Signature · 1 line
1.9.1
PATCH 20/164 net: fix a race in dst_release()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d69bbf88c8d0b367cf3e3a052f6daadf630ee566 ]
Only cpu seeing dst refcount going to 0 can safely dereference dst->flags.
Otherwise an other cpu might already have freed the dst.
--- net/core/dst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dst.c +1 -1
@@ -285,7 +285,7 @@ void dst_release(struct dst_entry *dst) newrefcnt =atomic_dec_return (&dst->__refcnt);WARN_ON (newrefcnt <0 ); -if (unlikely (dst->flags &DST_NOCACHE ) && !newrefcnt) +if (!newrefcnt &&unlikely (dst->flags &DST_NOCACHE ))call_rcu (&dst->rcu_head, dst_destroy_rcu); } }
Signature · 1 line
1.9.1
PATCH 21/164 HID: core: Avoid uninitialized buffer access
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Purdie <[email protected]>
commit 79b568b9d0c7c5d81932f4486d50b38efdd6da6d upstream.
hid_connect adds various strings to the buffer but they're all conditional. You can find circumstances where nothing would be written to it but the kernel will still print the supposedly empty buffer with printk. This leads to corruption on the console/in the logs.
Ensure buf is initialized to an empty string.
--- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +1 -1
@@ -1562,7 +1562,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) "Multi-Axis Controller" };const char *type, *bus; -char buf[64 ]; +char buf[64 ] ="" ;unsigned int i;int len;int ret;
Signature · 1 line
1.9.1
PATCH 22/164 v4l2-compat-ioctl32: fix alignment for ARM64
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Hajda <[email protected]>
commit 655e9780ab913a3a06d4a164d55e3b755524186d upstream.
Alignment/padding rules on AMD64 and ARM64 differs. To allow properly match compatible ioctls on ARM64 kernels without breaking AMD64 some fields should be aligned using compat_s64 type and in one case struct should be unpacked.
--- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +5 -4
@@ -266,7 +266,7 @@ static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_struct v4l2_standard32 {__u32 index; -__u32 id[2 ];/* __u64 would get the alignment wrong */ +compat_u64 id;__u8 name[24 ];struct v4l2_fract frameperiod;/* Frames, not fields */ __u32 framelines;
@@ -286,7 +286,7 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 { if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || put_user(kp->index, &up->index) || - copy_to_user(up->id, &kp->id, sizeof(__u64)) || + put_user(kp->id, &up->id) || copy_to_user(up->name, kp->name, 24) || copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || put_user(kp->framelines, &up->framelines) ||
@@ -587,10 +587,10 @@ struct v4l2_input32 {__u32 type;/* Type of input */ __u32 audioset;/* Associated audios (bitfield) */ __u32 tuner;/* Associated tuner */ -v4l2_std_id std; +compat_u64 std;__u32 status;__u32 reserved[4 ]; -} __attribute__ ((packed)); +};/* The 64-bit v4l2_input struct has extra padding at the end of the struct. Otherwise it is identical to the 32-bit version. */
@@ -738,6 +738,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_extstruct v4l2_event32 {__u32 type;union { +compat_s64 value64;__u8 data[64 ]; } u;__u32 pending;
Signature · 1 line
1.9.1
PATCH 23/164 net: mvneta: Fix CPU_MAP registers initialisation
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Ripard <[email protected]>
commit 2502d0ef272da7058ef303b849a2c8dc324c2e2e upstream.
The CPU_MAP register is duplicated for each CPUs at different addresses, each instance being at a different address.
However, the code so far was using CONFIG_NR_CPUS to initialise the CPU_MAP registers for each registers, while the SoCs embed at most 4 CPUs.
This is especially an issue with multi_v7_defconfig, where CONFIG_NR_CPUS is currently set to 16, resulting in writes to registers that are not CPU_MAP.
--- drivers/net/ethernet/marvell/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvneta.c +1 -1
@@ -942,7 +942,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Set CPU queue access map - all CPUs have access to all RX * queues and to all TX queues */ -for (cpu =0 ; cpu <CONFIG_NR_CPUS ; cpu++) +for_each_present_cpu (cpu)mvreg_write (pp,MVNETA_CPU_MAP (cpu), (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |MVNETA_CPU_TXQ_ACCESS_ALL_MASK ));
Signature · 1 line
1.9.1
PATCH 24/164 mtd: mtdpart: fix add_mtd_partitions error path
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris BREZILLON <[email protected]>
commit e5bae86797141e4a95e42d825f737cb36d7b8c37 upstream.
If we fail to allocate a partition structure in the middle of the partition creation process, the already allocated partitions are never removed, which means they are still present in the partition list and their resources are never freed.
--- drivers/mtd/mtdpart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/mtdpart.c +3 -1
@@ -648,8 +648,10 @@ int add_mtd_partitions(struct mtd_info *master,for (i =0 ; i < nbparts; i++) { slave =allocate_partition (master, parts + i, i, cur_offset); -if (IS_ERR (slave)) +if (IS_ERR (slave)) { +del_mtd_partitions (master);return PTR_ERR (slave); + }mutex_lock (&mtd_partitions_mutex);list_add (&slave->list, &mtd_partitions);
Signature · 1 line
1.9.1
PATCH 25/164 fs/proc, core/debug: Don't expose absolute kernel addresses via wchan
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit b2f73922d119686323f14fbbe46587f863852328 upstream.
So the /proc/PID/stat 'wchan' field (the 30th field, which contains the absolute kernel address of the kernel function a task is blocked in) leaks absolute kernel addresses to unprivileged user-space:
seq_put_decimal_ull(m, ' ', wchan);
The absolute address might also leak via /proc/PID/wchan as well, if KALLSYMS is turned off or if the symbol lookup fails for some reason:
static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
unsigned long wchan;
char symname[KSYM_NAME_LEN];
wchan = get_wchan(task);
if (lookup_symbol_name(wchan, symname) < 0) {
if (!ptrace_may_access(task, PTRACE_MODE_READ))
return 0;
seq_printf(m, "%lu", wchan);
} else {
seq_printf(m, "%s", symname);
}
return 0;
}This isn't ideal, because for example it trivially leaks the KASLR offset to any local attacker:
fomalhaut:~> printf "%016lx\n" $(cat /proc/$$/stat | cut -d' ' -f35) ffffffff8123b380
Most real-life uses of wchan are symbolic:
ps -eo pid:10,tid:10,wchan:30,comm
and procps uses /proc/PID/wchan, not the absolute address in /proc/PID/stat:
triton:~/tip> strace -f ps -eo pid:10,tid:10,wchan:30,comm 2>&1 | grep wchan | tail -1
open("/proc/30833/wchan", O_RDONLY) = 6
There's one compatibility quirk here: procps relies on whether the absolute value is non-zero - and we can provide that functionality by outputing "0" or "1" depending on whether the task is blocked (whether there's a wchan address).
These days there appears to be very little legitimate reason user-space would be interested in the absolute address. The absolute address is mostly historic: from the days when we didn't have kallsyms and user-space procps had to do the decoding itself via the System.map.
So this patch sets all numeric output to "0" or "1" and keeps only symbolic output, in /proc/PID/wchan.
( The absolute sleep address can generally still be profiled via
perf, by tasks with sufficient privileges. )
--- Documentation/filesystems/proc.txt | 5 +++-- fs/proc/array.c | 16 ++++++++++++++-- fs/proc/base.c | 11 +++++------ 3 files changed, 22 insertions(+), 10 deletions(-)
Documentation/filesystems/proc.txt +3 -2
@@ -139,7 +139,8 @@ Table 1-1: Process specific entries in /proc stat Process status statm Process memory status information status Process status in human readable form - wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan + wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function + symbol the task is blocked in - or "0" if not blocked. pagemap Page table stack Report full stack trace, enable via CONFIG_STACKTRACE smaps a extension based on maps, showing the memory consumption of
@@ -301,7 +302,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7) blocked bitmap of blocked signals sigign bitmap of ignored signals sigcatch bitmap of caught signals - wchan address where process went to sleep + 0 (place holder, used to be the wchan address, use /proc/PID/wchan instead) 0 (place holder) 0 (place holder) exit_signal signal to send to parent thread on exit
fs/proc/array.c +14 -2
@@ -368,7 +368,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,static int do_task_stat (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task,int whole) { -unsigned long vsize, eip, esp, wchan = ~0UL ; +unsigned long vsize, eip, esp, wchan =0 ;int priority, nice;int tty_pgrp =-1 , tty_nr =0 ;sigset_t sigign, sigcatch;
@@ -500,7 +500,19 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,seq_put_decimal_ull (m,' ' , task->blocked.sig[0 ] &0x7fffffffUL );seq_put_decimal_ull (m,' ' , sigign.sig[0 ] &0x7fffffffUL );seq_put_decimal_ull (m,' ' , sigcatch.sig[0 ] &0x7fffffffUL ); -seq_put_decimal_ull (m,' ' , wchan); + +/* +* We used to output the absolute kernel address, but that's an +* information leak - so instead we show a 0/1 flag here, to signal +* to user-space whether there's a wchan field in /proc/PID/wchan. +* +* This works with older implementations of procps as well. +*/ +if (wchan) +seq_puts (m," 1" ); +else +seq_puts (m," 0" ); +seq_put_decimal_ull (m,' ' ,0 );seq_put_decimal_ull (m,' ' ,0 );seq_put_decimal_ll (m,' ' , task->exit_signal);
fs/proc/base.c +5 -6
@@ -238,13 +238,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, wchan =get_wchan (task); -if (lookup_symbol_name (wchan, symname) <0 ) -if (!ptrace_may_access (task,PTRACE_MODE_READ )) -return 0 ; -else -return seq_printf (m,"%lu" , wchan); +if (wchan &&ptrace_may_access (task,PTRACE_MODE_READ ) && !lookup_symbol_name (wchan, symname)) +seq_printf (m,"%s" , symname);else - return seq_printf(m, "%s", symname); +seq_putc (m,'0' ); + + return 0; }#endif /* CONFIG_KALLSYMS */
Signature · 1 line
1.9.1
PATCH 26/164 v4l2-ctrls: arrays are also considered compound controls
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 35204e2e84f2dae72012f8ca319659c12f428430 upstream.
Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong since arrays are also considered compound controls (i.e. with more than one value), and applications that do not know about arrays will not be able to handle such controls.
Fix the test to include arrays.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +2 -2
@@ -2497,7 +2497,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr/* We found a control with the given ID, so just get the next valid one in the list. */ list_for_each_entry_continue (ref, &hdl->ctrl_refs, node) { - is_compound = + is_compound = ref->ctrl->is_array || ref->ctrl->type >=V4L2_CTRL_COMPOUND_TYPES ;if (id < ref->ctrl->id && (is_compound & mask) == match)
@@ -2511,7 +2511,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctris one, otherwise the first 'if' above would have been true. */ list_for_each_entry (ref, &hdl->ctrl_refs, node) { - is_compound = + is_compound = ref->ctrl->is_array || ref->ctrl->type >=V4L2_CTRL_COMPOUND_TYPES ;if (id < ref->ctrl->id && (is_compound & mask) == match)
Signature · 1 line
1.9.1
PATCH 27/164 media: v4l2-ctrls: Fix 64bit support in get_ctrl()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoit Parrot <[email protected]>
commit a8077734055f870ba630563868a6349671ca8dfc upstream.
When trying to use v4l2_ctrl_g_ctrl_int64() to retrieve a V4L2_CTRL_TYPE_INTEGER64 type value the internal helper function get_ctrl() would prematurely exit because for this control type the 'is_int' flag is not set. This would result in v4l2_ctrl_g_ctrl_int64 always returning 0.
Also v4l2_ctrl_g_ctrl_int64() is reading and returning the 32bit value member instead of the 64bit version, so fixing that as well.
This patch extends the condition check to allow the V4L2_CTRL_TYPE_INTEGER64 type to continue processing instead of exiting.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +3 -3
@@ -2883,7 +2883,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)* cur_to_user() calls below would need to be modified not to access * userspace memory when called from get_ctrl(). */ -if (!ctrl->is_int) +if (!ctrl->is_int && ctrl->type !=V4L2_CTRL_TYPE_INTEGER64 )return -EINVAL ;if (ctrl->flags &V4L2_CTRL_FLAG_WRITE_ONLY )
@@ -2941,9 +2941,9 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl)/* It's a driver bug if this happens. */ WARN_ON (ctrl->is_ptr || ctrl->type !=V4L2_CTRL_TYPE_INTEGER64 ); - c.value =0 ; + c.value64 =0 ;get_ctrl (ctrl, &c); -return c.value; +return c.value64; }EXPORT_SYMBOL (v4l2_ctrl_g_ctrl_int64);
Signature · 1 line
1.9.1
PATCH 28/164 ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
commit e77b675f8786f38d40fc1562e1275875daf67fef upstream.
Commit 72daceb9a10a ("net: rfkill: gpio: Add default GPIO driver mappings for ACPI") removed possibility to request GPIO by table index for non-ACPI platforms without changing its users. As result "shutdown" GPIO request will fail if request for "reset" GPIO succeeded or "reset" will be requested instead of "shutdown" if "reset" wasn't defined. Fix it by making gpiod_lookup_table use con_id's instead of indexes.
--- arch/arm/mach-tegra/board-paz00.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/board-paz00.c +2 -2
@@ -39,8 +39,8 @@ static struct platform_device wifi_rfkill_device = {static struct gpiod_lookup_table wifi_gpio_lookup = { .dev_id ="rfkill_gpio" , .table = { -GPIO_LOOKUP_IDX ("tegra-gpio" ,25 ,NULL ,0 ,0 ), -GPIO_LOOKUP_IDX ("tegra-gpio" ,85 ,NULL ,1 ,0 ), +GPIO_LOOKUP ("tegra-gpio" ,25 ,"reset" ,0 ), +GPIO_LOOKUP ("tegra-gpio" ,85 ,"shutdown" ,0 ), { }, }, };
Signature · 1 line
1.9.1
PATCH 29/164 ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 371f0f085f629fc0f66695f572373ca4445a67ad upstream.
dma_mmap() function in IOMMU-based dma-mapping implementation lacked a check for valid range of mmap parameters (offset and buffer size), what might have caused access beyond the allocated buffer. This patch fixes this issue.
--- arch/arm/mm/dma-mapping.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/mm/dma-mapping.c +5 -0
@@ -1365,12 +1365,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,unsigned long uaddr = vma->vm_start;unsigned long usize = vma->vm_end - vma->vm_start;struct page **pages =__iommu_get_pages (cpu_addr, attrs); +unsigned long nr_pages =PAGE_ALIGN (size) >>PAGE_SHIFT ; +unsigned long off = vma->vm_pgoff; vma->vm_page_prot =__get_dma_pgprot (attrs, vma->vm_page_prot);if (!pages)return -ENXIO ; +if (off >= nr_pages || (usize >>PAGE_SHIFT ) > nr_pages - off) +return -ENXIO ; + do { int ret = vm_insert_page(vma, uaddr, *pages++); if (ret) {
Signature · 1 line
1.9.1
PATCH 30/164 ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 7e31210349e9e03a9a4dff31ab5f2bc83e8e84f5 upstream.
IOMMU-based dma_mmap() implementation lacked proper support for offset parameter used in mmap call (it always assumed that mapping starts from offset zero). This patch adds support for offset parameter to IOMMU-based implementation.
--- arch/arm/mm/dma-mapping.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mm/dma-mapping.c +2 -0
@@ -1376,6 +1376,8 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,if (off >= nr_pages || (usize >>PAGE_SHIFT ) > nr_pages - off)return -ENXIO ; + pages += off; + do { int ret = vm_insert_page(vma, uaddr, *pages++); if (ret) {
Signature · 1 line
1.9.1
PATCH 31/164 integrity: prevent loading untrusted certificates on the IMA trusted keyring
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Kasatkin <[email protected]>
commit 72e1eed8abb11c79749266d433c817ce36732893 upstream.
If IMA_LOAD_X509 is enabled, either directly or indirectly via IMA_APPRAISE_SIGNED_INIT, certificates are loaded onto the IMA trusted keyring by the kernel via key_create_or_update(). When the KEY_ALLOC_TRUSTED flag is provided, certificates are loaded without first verifying the certificate is properly signed by a trusted key on the system keyring. This patch removes the KEY_ALLOC_TRUSTED flag.
--- security/integrity/digsig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/digsig.c +1 -1
@@ -105,7 +105,7 @@ int __init integrity_load_x509(const unsigned int id, char *path) rc, ((KEY_POS_ALL & ~KEY_POS_SETATTR ) |KEY_USR_VIEW |KEY_USR_READ ), - KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_TRUSTED); + KEY_ALLOC_NOT_IN_QUOTA);if (IS_ERR (key)) { rc =PTR_ERR (key); pr_err("Problem loading X.509 certificate (%d): %s\n",
Signature · 1 line
1.9.1
PATCH 32/164 usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit 41adc59caece02aa2e988a0e8f9fe8e6f426f82e upstream.
This ID is for the Synopsys DWC_usb3 core with AXI interface on PCIe HAPS platform. This core has the debug registers mapped at a separate BAR in order to support enhanced hibernation.
--- drivers/usb/dwc3/dwc3-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +5 -0
@@ -30,6 +30,7 @@/* FIXME define these in <linux/pci_ids.h> */ #define PCI_VENDOR_ID_SYNOPSYS 0x16c3#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce#define PCI_DEVICE_ID_INTEL_BYT 0x0f37#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e#define PCI_DEVICE_ID_INTEL_BSW 0x22B7
@@ -218,6 +219,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = {PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS ,PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 ), }, + { +PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS , +PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI ), + }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
Signature · 1 line
1.9.1
PATCH 33/164 usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit e8095a25364a30216ad40dbe8893ed5c3c235949 upstream.
This adds the PCI product ID for the Synopsys USB 3.1 IP core (DWC_usb31) on a HAPS-based PCI development platform.
--- drivers/usb/dwc3/dwc3-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +5 -0
@@ -31,6 +31,7 @@#define PCI_VENDOR_ID_SYNOPSYS 0x16c3#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf#define PCI_DEVICE_ID_INTEL_BYT 0x0f37#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e#define PCI_DEVICE_ID_INTEL_BSW 0x22B7
@@ -223,6 +224,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = {PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS ,PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI ), }, + { +PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS , +PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 ), + }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
Signature · 1 line
1.9.1
PATCH 34/164 usb: dwc3: Support Synopsys USB 3.1 IP
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit 690fb3718a70c66004342f6f5e2e8a5f95b977db upstream.
This patch allows the dwc3 driver to run on the new Synopsys USB 3.1 IP core, albeit in USB 3.0 mode only.
The Synopsys USB 3.1 IP (DWC_usb31) retains mostly the same register interface and programming model as the existing USB 3.0 controller IP (DWC_usb3). However the GSNPSID and version numbers are different.
Add checking for the new ID to pass driver probe.
Also, since the DWC_usb31 version number is lower in value than the full GSNPSID of the DWC_usb3 IP, we set the high bit to identify DWC_usb31 and to ensure the values are higher.
Finally, add a documentation note about the revision numbering scheme. Any future revision checks (for STARS, workarounds, and new features) should take into consideration how it applies to both the 3.1/3.0 IP.
--- drivers/usb/dwc3/core.c | 10 ++++++++-- drivers/usb/dwc3/core.h | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.c +8 -2
@@ -445,12 +445,18 @@ static int dwc3_core_init(struct dwc3 *dwc) reg =dwc3_readl (dwc->regs,DWC3_GSNPSID );/* This should read as U3 followed by revision number */ -if ((reg &DWC3_GSNPSID_MASK ) !=0x55330000 ) { +if ((reg &DWC3_GSNPSID_MASK ) ==0x55330000 ) { +/* Detected DWC_usb3 IP */ + dwc->revision = reg; + }else if ((reg &DWC3_GSNPSID_MASK ) ==0x33310000 ) { +/* Detected DWC_usb31 IP */ + dwc->revision =dwc3_readl (dwc->regs,DWC3_VER_NUMBER ); + dwc->revision |=DWC3_REVISION_IS_DWC31 ; + }else {dev_err (dwc->dev,"this is not a DesignWare USB3 DRD Core\n" ); ret = -ENODEV ; goto err0; } - dwc->revision = reg;/* * Write Linux Version Code to our GUID register so it's easy to figure
drivers/usb/dwc3/core.h +18 -0
@@ -107,6 +107,9 @@#define DWC3_GPRTBIMAP_FS0 0xc188#define DWC3_GPRTBIMAP_FS1 0xc18c +#define DWC3_VER_NUMBER 0xc1a0 +#define DWC3_VER_TYPE 0xc1a4 +#define DWC3_GUSB2PHYCFG (n) (0xc200 + (n * 0x04))#define DWC3_GUSB2I2CCTL (n) (0xc240 + (n * 0x04))
@@ -755,6 +758,14 @@ struct dwc3 {u32 num_event_buffers;u32 u1u2;u32 maximum_speed; + +/* +* All 3.1 IP version constants are greater than the 3.0 IP +* version constants. This works for most version checks in +* dwc3. However, in the future, this may not apply as +* features may be developed on newer versions of the 3.0 IP +* that are not in the 3.1 IP. +*/ u32 revision;#define DWC3_REVISION_173A 0x5533173a
@@ -777,6 +788,13 @@ struct dwc3 {#define DWC3_REVISION_270A 0x5533270a#define DWC3_REVISION_280A 0x5533280a +/* +* NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really +* just so dwc31 revisions are always larger than dwc3. +*/ +#define DWC3_REVISION_IS_DWC31 0x80000000 +#define DWC3_USB31_REVISION_110A (0x3131302a | DWC3_REVISION_IS_USB31) +enum dwc3_ep0_next ep0_next_event;enum dwc3_ep0_state ep0state;enum dwc3_link_state link_state;
Signature · 1 line
1.9.1
PATCH 35/164 usb: dwc3: Add dis_enblslpm_quirk
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit ec791d149bca4511e7d3a6a92bb3b030c5a443f9 upstream.
Add a quirk to clear the GUSB2PHYCFG.ENBLSLPM bit, which controls whether the PHY receives the suspend signal from the controller.
--- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c | 6 ++++++ drivers/usb/dwc3/core.h | 4 ++++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 13 insertions(+)
Documentation/devicetree/bindings/usb/dwc3.txt +2 -0
@@ -34,6 +34,8 @@ Optional properties: LTSSM during USB3 Compliance mode. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. + - snps,dis_enblslpm_quirk: when set clears the enblslpm in GUSB2PHYCFG, + disabling the suspend signal to the PHY. - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal utmi_l1_suspend_n, false when asserts utmi_sleep_n - snps,hird-threshold: HIRD threshold
drivers/usb/dwc3/core.c +6 -0
@@ -425,6 +425,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc)if (dwc->dis_u2_susphy_quirk) reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ; +if (dwc->dis_enblslpm_quirk) + reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ; +dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg);mdelay (100 );
@@ -839,6 +842,8 @@ static int dwc3_probe(struct platform_device *pdev) "snps,dis_u3_susphy_quirk"); dwc->dis_u2_susphy_quirk =of_property_read_bool (node,"snps,dis_u2_susphy_quirk" ); + dwc->dis_enblslpm_quirk =device_property_read_bool (dev, +"snps,dis_enblslpm_quirk" ); dwc->tx_de_emphasis_quirk =of_property_read_bool (node,"snps,tx_de_emphasis_quirk" );
@@ -866,6 +871,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk; dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk; dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk; + dwc->dis_enblslpm_quirk = pdata->dis_enblslpm_quirk; dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;if (pdata->tx_de_emphasis)
drivers/usb/dwc3/core.h +4 -0
@@ -176,6 +176,7 @@/* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31)#define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) +#define DWC3_GUSB2PHYCFG_ENBLSLPM (1 << 8)/* Global USB3 PIPE Control Register */ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31)
@@ -706,6 +707,8 @@ struct dwc3_scratchpad_array {* @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy +* @dis_enblslpm_quirk: set if we clear enblslpm in GUSB2PHYCFG, +* disabling the suspend signal to the PHY. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis
@@ -846,6 +849,7 @@ struct dwc3 { unsigned rx_detect_poll_quirk:1; unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; + unsigned dis_enblslpm_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;
drivers/usb/dwc3/platform_data.h +1 -0
@@ -41,6 +41,7 @@ struct dwc3_platform_data { unsigned rx_detect_poll_quirk:1; unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; + unsigned dis_enblslpm_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;
Signature · 1 line
1.9.1
PATCH 36/164 spi: ti-qspi: Fix data corruption seen on r/w stress test
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh R <[email protected]>
commit bc27a53928981662079aa243915b443370294a03 upstream.
Writing invalid command to QSPI_SPI_CMD_REG will terminate current transfer and de-assert the chip select. This has to be done before calling spi_finalize_current_message(). Because spi_finalize_current_message() will mark the end of current message transfer and schedule the next transfer. If the chipselect is not de-asserted before calling spi_finalize_current_message() then the next transfer will overlap with the previous transfer leading to data corruption.__spi_pump_message() can be called either from kthread worker context or directly from the calling process's context. It is possible that these two calls can race against each other. But race is serialized by checking whether master->cur_msg == NULL (pointer to msg being handled by transfer_one() at present). The master->cur_msg is set to NULL when spi_finalize_current_message() is called on that message, which means calling spi_finalize_current_message() allows __spi_sync() to pump next message in calling process context.
Now if spi-ti-qspi calls spi_finalize_current_message() before we terminate transfer at hardware side, if __spi_pump_message() is called from process context then the successive transactions can overlap.
Fix this by moving writing invalid command to QSPI_SPI_CMD_REG to before calling spi_finalize_current_message() call.
--- drivers/spi/spi-ti-qspi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi-ti-qspi.c +1 -2
@@ -364,11 +364,10 @@ static int ti_qspi_start_transfer_one(struct spi_master *master,mutex_unlock (&qspi->list_lock); +ti_qspi_write (qspi, qspi->cmd |QSPI_INVAL ,QSPI_SPI_CMD_REG ); m->status = status;spi_finalize_current_message (master); -ti_qspi_write (qspi, qspi->cmd |QSPI_INVAL ,QSPI_SPI_CMD_REG ); -return status; }
Signature · 1 line
1.9.1
PATCH 37/164 nfsd: serialize state seqid morphing operations
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 35a92fe8770ce54c5eb275cd76128645bea2d200 upstream.
Andrew was seeing a race occur when an OPEN and OPEN_DOWNGRADE were running in parallel. The server would receive the OPEN_DOWNGRADE first and check its seqid, but then an OPEN would race in and bump it. The OPEN_DOWNGRADE would then complete and bump the seqid again. The result was that the OPEN_DOWNGRADE would be applied after the OPEN, even though it should have been rejected since the seqid changed.
The only recourse we have here I think is to serialize operations that bump the seqid in a stateid, particularly when we're given a seqid in the call. To address this, we add a new rw_semaphore to the nfs4_ol_stateid struct. We do a down_write prior to checking the seqid after looking up the stateid to ensure that nothing else is going to bump it while we're operating on it.
In the case of OPEN, we do a down_read, as the call doesn't contain a seqid. Those can run in parallel -- we just need to serialize them when there is a concurrent OPEN_DOWNGRADE or CLOSE.
LOCK and LOCKU however always take the write lock as there is no opportunity for parallelizing those.
--- fs/nfsd/nfs4state.c | 33 ++++++++++++++++++++++++++++----- fs/nfsd/state.h | 17 +++++++++-------- 2 files changed, 37 insertions(+), 13 deletions(-)
fs/nfsd/nfs4state.c +28 -5
@@ -3262,6 +3262,7 @@ static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, stp->st_access_bmap =0 ; stp->st_deny_bmap =0 ; stp->st_openstp =NULL ; +init_rwsem (&stp->st_rwsem);spin_lock (&oo->oo_owner.so_client->cl_lock);list_add (&stp->st_perstateowner, &oo->oo_owner.so_stateids);spin_lock (&fp->fi_lock);
@@ -4083,21 +4084,27 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf*/ if (stp) {/* Stateid was found, this is an OPEN upgrade */ +down_read (&stp->st_rwsem); status =nfs4_upgrade_open (rqstp, fp, current_fh, stp, open); -if (status) +if (status) { +up_read (&stp->st_rwsem); goto out; + } }else { stp = open->op_stp; open->op_stp =NULL ;init_open_stateid (stp, fp, open); +down_read (&stp->st_rwsem); status =nfs4_get_vfs_file (rqstp, fp, current_fh, stp, open);if (status) { +up_read (&stp->st_rwsem);release_open_stateid (stp); goto out; } }update_stateid (&stp->st_stid.sc_stateid);memcpy (&open->op_stateid, &stp->st_stid.sc_stateid,sizeof (stateid_t)); +up_read (&stp->st_rwsem);if (nfsd4_has_session (&resp->cstate)) {if (open->op_deleg_want &NFS4_SHARE_WANT_NO_DELEG ) {
@@ -4665,10 +4672,13 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_* revoked delegations are kept only for free_stateid. */ return nfserr_bad_stateid; +down_write (&stp->st_rwsem); status =check_stateid_generation (stateid, &stp->st_stid.sc_stateid,nfsd4_has_session (cstate)); -if (status) -return status; -return nfs4_check_fh (current_fh, stp); +if (status == nfs_ok) + status =nfs4_check_fh (current_fh, stp); +if (status != nfs_ok) +up_write (&stp->st_rwsem); +return status; }/*
@@ -4715,6 +4725,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *csreturn status; oo =openowner (stp->st_stateowner);if (!(oo->oo_flags &NFS4_OO_CONFIRMED )) { +up_write (&stp->st_rwsem);nfs4_put_stid (&stp->st_stid);return nfserr_bad_stateid; }
@@ -4745,11 +4756,14 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out; oo =openowner (stp->st_stateowner); status = nfserr_bad_stateid; -if (oo->oo_flags &NFS4_OO_CONFIRMED ) +if (oo->oo_flags &NFS4_OO_CONFIRMED ) { +up_write (&stp->st_rwsem); goto put_stateid; + } oo->oo_flags |=NFS4_OO_CONFIRMED ;update_stateid (&stp->st_stid.sc_stateid);memcpy (&oc->oc_resp_stateid, &stp->st_stid.sc_stateid,sizeof (stateid_t)); +up_write (&stp->st_rwsem);dprintk ("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n" , __func__, oc->oc_seqid,STATEID_VAL (&stp->st_stid.sc_stateid));
@@ -4828,6 +4842,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,memcpy (&od->od_stateid, &stp->st_stid.sc_stateid,sizeof (stateid_t)); status = nfs_ok; put_stateid: +up_write (&stp->st_rwsem);nfs4_put_stid (&stp->st_stid); out:nfsd4_bump_seqid (cstate, status);
@@ -4881,6 +4896,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out;update_stateid (&stp->st_stid.sc_stateid);memcpy (&close->cl_stateid, &stp->st_stid.sc_stateid,sizeof (stateid_t)); +up_write (&stp->st_rwsem);nfsd4_close_open_stateid (stp);
@@ -5109,6 +5125,7 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, stp->st_access_bmap =0 ; stp->st_deny_bmap = open_stp->st_deny_bmap; stp->st_openstp = open_stp; +init_rwsem (&stp->st_rwsem);list_add (&stp->st_locks, &open_stp->st_locks);list_add (&stp->st_perstateowner, &lo->lo_owner.so_stateids);spin_lock (&fp->fi_lock);
@@ -5277,6 +5294,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, &open_stp, nn);if (status) goto out; +up_write (&open_stp->st_rwsem); open_sop =openowner (open_stp->st_stateowner); status = nfserr_bad_stateid; if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
@@ -5284,6 +5302,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out; status =lookup_or_create_lock_state (cstate, open_stp, lock, &lock_stp, &new); +if (status == nfs_ok) +down_write (&lock_stp->st_rwsem); }else { status = nfs4_preprocess_seqid_op(cstate, lock->lk_old_lock_seqid,
@@ -5389,6 +5409,8 @@ out: seqid_mutating_err(ntohl(status))) lock_sop->lo_owner.so_seqid++; +up_write (&lock_stp->st_rwsem); +/* * If this is a new, never-before-used stateid, and we are * returning an error, then just go ahead and release it.
@@ -5559,6 +5581,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, fput:fput (filp); put_stateid: +up_write (&stp->st_rwsem);nfs4_put_stid (&stp->st_stid); out:nfsd4_bump_seqid (cstate, status);
fs/nfsd/state.h +9 -8
@@ -513,14 +513,15 @@ struct nfs4_file {* Better suggestions welcome. */ struct nfs4_ol_stateid { -struct nfs4_stid st_stid;/* must be first field */ -struct list_head st_perfile; -struct list_head st_perstateowner; -struct list_head st_locks; -struct nfs4_stateowner * st_stateowner; -unsigned char st_access_bmap; -unsigned char st_deny_bmap; -struct nfs4_ol_stateid * st_openstp; +struct nfs4_stid st_stid; +struct list_head st_perfile; +struct list_head st_perstateowner; +struct list_head st_locks; +struct nfs4_stateowner *st_stateowner; +unsigned char st_access_bmap; +unsigned char st_deny_bmap; +struct nfs4_ol_stateid *st_openstp; +struct rw_semaphore st_rwsem; };static inline struct nfs4_ol_stateid *openlockstateid (struct nfs4_stid *s)
Signature · 1 line
1.9.1
PATCH 38/164 lockd: create NSM handles per net namespace
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 0ad95472bf169a3501991f8f33f5147f792a8116 upstream.
Commit cb7323fffa85 ("lockd: create and use per-net NSM
RPC clients on MON/UNMON requests") introduced per-net
NSM RPC clients. Unfortunately this doesn't make any sense without per-net nsm_handle.
E.g. the following scenario could happen
Two hosts (X and Y) in different namespaces (A and B) share the same nsm struct.
1. nsm_monitor(host_X) called => NSM rpc client created,
nsm->sm_monitored bit set. 2. nsm_mointor(host-Y) called => nsm->sm_monitored already set, we just exit. Thus in namespace B ln->nsm_clnt == NULL. 3. host X destroyed => nsm->sm_count decremented to 1 4. host Y destroyed => nsm_unmonitor() => nsm_mon_unmon() => NULL-ptr dereference of *ln->nsm_clnt
So this could be fixed by making per-net nsm_handles list, instead of global. Thus different net namespaces will not be able share the same nsm_handle.
--- fs/lockd/host.c | 7 ++++--- fs/lockd/mon.c | 36 ++++++++++++++++++++++-------------- fs/lockd/netns.h | 1 + fs/lockd/svc.c | 1 + fs/lockd/svc4proc.c | 2 +- fs/lockd/svcproc.c | 2 +- include/linux/lockd/lockd.h | 9 ++++++--- 7 files changed, 36 insertions(+), 22 deletions(-)
fs/lockd/host.c +4 -3
@@ -116,7 +116,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,atomic_inc (&nsm->sm_count); else { host =NULL ; - nsm =nsm_get_handle (ni->sap, ni->salen, + nsm =nsm_get_handle (ni->net, ni->sap, ni->salen, ni->hostname, ni->hostname_len);if (unlikely (nsm ==NULL )) { dprintk("lockd: %s failed; no nsm handle\n",
@@ -534,17 +534,18 @@ static struct nlm_host *next_host_state(struct hlist_head *cache,/** * nlm_host_rebooted - Release all resources held by rebooted host +* @net: network namespace * @info: pointer to decoded results of NLM_SM_NOTIFY call * * We were notified that the specified host has rebooted. Release * all resources held by that peer. */ -void nlm_host_rebooted (const struct nlm_reboot *info) +void nlm_host_rebooted (const struct net *net,const struct nlm_reboot *info) {struct nsm_handle *nsm;struct nlm_host *host; - nsm =nsm_reboot_lookup (info); + nsm =nsm_reboot_lookup (net, info);if (unlikely (nsm ==NULL ))return ;
fs/lockd/mon.c +22 -14
@@ -51,7 +51,6 @@ struct nsm_res { };static const struct rpc_program nsm_program; -static LIST_HEAD (nsm_handles);static DEFINE_SPINLOCK (nsm_lock);/*
@@ -264,33 +263,35 @@ void nsm_unmonitor(const struct nlm_host *host) } } -static struct nsm_handle *nsm_lookup_hostname (const char *hostname, -const size_t len) +static struct nsm_handle *nsm_lookup_hostname (const struct list_head *nsm_handles, +const char *hostname,const size_t len) {struct nsm_handle *nsm; -list_for_each_entry (nsm, &nsm_handles, sm_link) +list_for_each_entry (nsm, nsm_handles, sm_link)if (strlen (nsm->sm_name) == len &&memcmp (nsm->sm_name, hostname, len) ==0 )return nsm;return NULL ; } -static struct nsm_handle *nsm_lookup_addr (const struct sockaddr *sap) +static struct nsm_handle *nsm_lookup_addr (const struct list_head *nsm_handles, +const struct sockaddr *sap) {struct nsm_handle *nsm; -list_for_each_entry (nsm, &nsm_handles, sm_link) +list_for_each_entry (nsm, nsm_handles, sm_link)if (rpc_cmp_addr (nsm_addr (nsm), sap))return nsm;return NULL ; } -static struct nsm_handle *nsm_lookup_priv (const struct nsm_private *priv) +static struct nsm_handle *nsm_lookup_priv (const struct list_head *nsm_handles, +const struct nsm_private *priv) {struct nsm_handle *nsm; -list_for_each_entry (nsm, &nsm_handles, sm_link) +list_for_each_entry (nsm, nsm_handles, sm_link)if (memcmp (nsm->sm_priv.data, priv->data,sizeof (priv->data)) ==0 )return nsm;
@@ -353,6 +354,7 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,/** * nsm_get_handle - Find or create a cached nsm_handle +* @net: network namespace * @sap: pointer to socket address of handle to find * @salen: length of socket address * @hostname: pointer to C string containing hostname to find
@@ -365,11 +367,13 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,* @hostname cannot be found in the handle cache. Returns NULL if * an error occurs. */ -struct nsm_handle *nsm_get_handle (const struct sockaddr *sap, +struct nsm_handle *nsm_get_handle (const struct net *net, +const struct sockaddr *sap,const size_t salen,const char *hostname,const size_t hostname_len) {struct nsm_handle *cached, *new =NULL ; +struct lockd_net *ln =net_generic (net, lockd_net_id);if (hostname &&memchr (hostname,'/' , hostname_len) !=NULL ) {if (printk_ratelimit ()) {
@@ -384,9 +388,10 @@ retry:spin_lock (&nsm_lock);if (nsm_use_hostnames && hostname !=NULL ) - cached =nsm_lookup_hostname (hostname, hostname_len); + cached =nsm_lookup_hostname (&ln->nsm_handles, + hostname, hostname_len);else - cached =nsm_lookup_addr (sap); + cached =nsm_lookup_addr (&ln->nsm_handles, sap);if (cached !=NULL ) {atomic_inc (&cached->sm_count);
@@ -400,7 +405,7 @@ retry: }if (new !=NULL ) { -list_add (&new->sm_link, &nsm_handles); +list_add (&new->sm_link, &ln->nsm_handles);spin_unlock (&nsm_lock);dprintk ("lockd: created nsm_handle for %s (%s)\n" , new->sm_name, new->sm_addrbuf);
@@ -417,19 +422,22 @@ retry:/** * nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle +* @net: network namespace * @info: pointer to NLMPROC_SM_NOTIFY arguments * * Returns a matching nsm_handle if found in the nsm cache. The returned * nsm_handle's reference count is bumped. Otherwise returns NULL if some * error occurred. */ -struct nsm_handle *nsm_reboot_lookup (const struct nlm_reboot *info) +struct nsm_handle *nsm_reboot_lookup (const struct net *net, +const struct nlm_reboot *info) {struct nsm_handle *cached; +struct lockd_net *ln =net_generic (net, lockd_net_id);spin_lock (&nsm_lock); - cached =nsm_lookup_priv (&info->priv); + cached =nsm_lookup_priv (&ln->nsm_handles, &info->priv);if (unlikely (cached ==NULL )) {spin_unlock (&nsm_lock); dprintk("lockd: never saw rebooted peer '%.*s' before\n",
fs/lockd/netns.h +1 -0
@@ -15,6 +15,7 @@ struct lockd_net {spinlock_t nsm_clnt_lock;unsigned int nsm_users;struct rpc_clnt *nsm_clnt; +struct list_head nsm_handles; };extern int lockd_net_id;
fs/lockd/svc.c +1 -0
@@ -587,6 +587,7 @@ static int lockd_init_net(struct net *net)INIT_DELAYED_WORK (&ln->grace_period_end, grace_ender);INIT_LIST_HEAD (&ln->lockd_manager.list);spin_lock_init (&ln->nsm_clnt_lock); +INIT_LIST_HEAD (&ln->nsm_handles);return 0 ; }
fs/lockd/svc4proc.c +1 -1
@@ -421,7 +421,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,return rpc_system_err; } -nlm_host_rebooted (argp); +nlm_host_rebooted (SVC_NET (rqstp), argp);return rpc_success; }
fs/lockd/svcproc.c +1 -1
@@ -464,7 +464,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,return rpc_system_err; } -nlm_host_rebooted (argp); +nlm_host_rebooted (SVC_NET (rqstp), argp);return rpc_success; }
include/linux/lockd/lockd.h +6 -3
@@ -235,7 +235,8 @@ void nlm_rebind_host(struct nlm_host *);struct nlm_host *nlm_get_host (struct nlm_host *);void nlm_shutdown_hosts (void );void nlm_shutdown_hosts_net (struct net *net); -void nlm_host_rebooted (const struct nlm_reboot *); +void nlm_host_rebooted (const struct net *net, +const struct nlm_reboot *);/* * Host monitoring
@@ -243,11 +244,13 @@ void nlm_host_rebooted(const struct nlm_reboot *);int nsm_monitor (const struct nlm_host *host);void nsm_unmonitor (const struct nlm_host *host); -struct nsm_handle *nsm_get_handle (const struct sockaddr *sap, +struct nsm_handle *nsm_get_handle (const struct net *net, +const struct sockaddr *sap,const size_t salen,const char *hostname,const size_t hostname_len); -struct nsm_handle *nsm_reboot_lookup (const struct nlm_reboot *info); +struct nsm_handle *nsm_reboot_lookup (const struct net *net, +const struct nlm_reboot *info);void nsm_release (struct nsm_handle *nsm);/*
Signature · 1 line
1.9.1
PATCH 39/164 Btrfs: fix file corruption and data loss after cloning inline extents
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 8039d87d9e473aeb740d4fdbd59b9d2f89b2ced9 upstream.
Currently the clone ioctl allows to clone an inline extent from one file to another that already has other (non-inlined) extents. This is a problem because btrfs is not designed to deal with files having inline and regular extents, if a file has an inline extent then it must be the only extent in the file and must start at file offset 0. Having a file with an inline extent followed by regular extents results in EIO errors when doing reads or writes against the first 4K of the file.
Also, the clone ioctl allows one to lose data if the source file consists of a single inline extent, with a size of N bytes, and the destination file consists of a single inline extent with a size of M bytes, where we have M > N. In this case the clone operation removes the inline extent from the destination file and then copies the inline extent from the source file into the destination file - we lose the M - N bytes from the destination file, a read operation will get the value 0x00 for any bytes in the the range [N, M] (the destination inode's i_size remained as M, that's why we can read past N bytes).
So fix this by not allowing such destructive operations to happen and return errno EOPNOTSUPP to user space.
Currently the fstest btrfs/035 tests the data loss case but it totally ignores this - i.e. expects the operation to succeed and does not check the we got data loss.
The following test case for fstests exercises all these cases that result in file corruption and data loss:
seq=basename $0
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
rm -f $tmp.*
}# get standard environment, filters and checks . ./common/rc . ./common/filter
# real QA test starts here _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch _require_cloner _require_btrfs_fs_feature "no_holes" _require_btrfs_mkfs_feature "no-holes"
rm -f $seqres.full
test_cloning_inline_extents()
{
local mkfs_opts=$1
local mount_opts=$2 _scratch_mkfs $mkfs_opts >>$seqres.full 2>&1 _scratch_mount $mount_opts
# File bar, the source for all the following clone operations, consists # of a single inline extent (50 bytes).
$XFS_IO_PROG -f -c "pwrite -S 0xbb 0 50" $SCRATCH_MNT/bar \
| _filter_xfs_io
# Test cloning into a file with an extent (non-inlined) where the # destination offset overlaps that extent. It should not be possible to # clone the inline extent from file bar into this file. $XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 16K" $SCRATCH_MNT/foo \
| _filter_xfs_io
$CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo
# Doing IO against any range in the first 4K of the file should work. # Due to a past clone ioctl bug which allowed cloning the inline extent, # these operations resulted in EIO errors.
echo "File foo data after clone operation:"
# All bytes should have the value 0xaa (clone operation failed and did # not modify our file).
od -t x1 $SCRATCH_MNT/foo
$XFS_IO_PROG -c "pwrite -S 0xcc 0 100" $SCRATCH_MNT/foo | _filter_xfs_io
# Test cloning the inline extent against a file which has a hole in its # first 4K followed by a non-inlined extent. It should not be possible # as well to clone the inline extent from file bar into this file. $XFS_IO_PROG -f -c "pwrite -S 0xdd 4K 12K" $SCRATCH_MNT/foo2 \
| _filter_xfs_io
$CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo2
# Doing IO against any range in the first 4K of the file should work. # Due to a past clone ioctl bug which allowed cloning the inline extent, # these operations resulted in EIO errors.
echo "File foo2 data after clone operation:"
# All bytes should have the value 0x00 (clone operation failed and did # not modify our file).
od -t x1 $SCRATCH_MNT/foo2
$XFS_IO_PROG -c "pwrite -S 0xee 0 90" $SCRATCH_MNT/foo2 | _filter_xfs_io
# Test cloning the inline extent against a file which has a size of zero # but has a prealloc extent. It should not be possible as well to clone # the inline extent from file bar into this file. $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo3 | _filter_xfs_io $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo3
# Doing IO against any range in the first 4K of the file should work. # Due to a past clone ioctl bug which allowed cloning the inline extent, # these operations resulted in EIO errors.
echo "First 50 bytes of foo3 after clone operation:"
# Should not be able to read any bytes, file has 0 bytes i_size (the # clone operation failed and did not modify our file).
od -t x1 $SCRATCH_MNT/foo3
$XFS_IO_PROG -c "pwrite -S 0xff 0 90" $SCRATCH_MNT/foo3 | _filter_xfs_io
# Test cloning the inline extent against a file which consists of a # single inline extent that has a size not greater than the size of # bar's inline extent (40 < 50).
# It should be possible to do the extent cloning from bar to this file. $XFS_IO_PROG -f -c "pwrite -S 0x01 0 40" $SCRATCH_MNT/foo4 \
| _filter_xfs_io
$CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo4
# Doing IO against any range in the first 4K of the file should work. echo "File foo4 data after clone operation:"
# Must match file bar's content.
od -t x1 $SCRATCH_MNT/foo4
$XFS_IO_PROG -c "pwrite -S 0x02 0 90" $SCRATCH_MNT/foo4 | _filter_xfs_io
# Test cloning the inline extent against a file which consists of a # single inline extent that has a size greater than the size of bar's # inline extent (60 > 50).
# It should not be possible to clone the inline extent from file bar # into this file.
$XFS_IO_PROG -f -c "pwrite -S 0x03 0 60" $SCRATCH_MNT/foo5 \
| _filter_xfs_io
$CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo5
# Reading the file should not fail.
echo "File foo5 data after clone operation:"
# Must have a size of 60 bytes, with all bytes having a value of 0x03 # (the clone operation failed and did not modify our file). od -t x1 $SCRATCH_MNT/foo5
# Test cloning the inline extent against a file which has no extents but # has a size greater than bar's inline extent (16K > 50).
# It should not be possible to clone the inline extent from file bar # into this file.
$XFS_IO_PROG -f -c "truncate 16K" $SCRATCH_MNT/foo6 | _filter_xfs_io $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo6
# Reading the file should not fail.
echo "File foo6 data after clone operation:"
# Must have a size of 16K, with all bytes having a value of 0x00 (the # clone operation failed and did not modify our file).
od -t x1 $SCRATCH_MNT/foo6
# Test cloning the inline extent against a file which has no extents but # has a size not greater than bar's inline extent (30 < 50). # It should be possible to clone the inline extent from file bar into # this file.
$XFS_IO_PROG -f -c "truncate 30" $SCRATCH_MNT/foo7 | _filter_xfs_io $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo7
# Reading the file should not fail.
echo "File foo7 data after clone operation:"
# Must have a size of 50 bytes, with all bytes having a value of 0xbb. od -t x1 $SCRATCH_MNT/foo7
# Test cloning the inline extent against a file which has a size not # greater than the size of bar's inline extent (20 < 50) but has # a prealloc extent that goes beyond the file's size. It should not be # possible to clone the inline extent from bar into this file. $XFS_IO_PROG -f -c "falloc -k 0 1M" \
-c "pwrite -S 0x88 0 20" \
$SCRATCH_MNT/foo8 | _filter_xfs_io
$CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo8
echo "File foo8 data after clone operation:"
# Must have a size of 20 bytes, with all bytes having a value of 0x88 # (the clone operation did not modify our file).
od -t x1 $SCRATCH_MNT/foo8
_scratch_unmount
}
echo -e "\nTesting without compression and without the no-holes feature...\n" test_cloning_inline_extents
echo -e "\nTesting with compression and without the no-holes feature...\n" test_cloning_inline_extents "" "-o compress"
echo -e "\nTesting without compression and with the no-holes feature...\n" test_cloning_inline_extents "-O no-holes" ""
echo -e "\nTesting with compression and with the no-holes feature...\n" test_cloning_inline_extents "-O no-holes" "-o compress"
status=0
exit
--- fs/btrfs/ioctl.c | 195 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 152 insertions(+), 43 deletions(-)
fs/btrfs/ioctl.c +152 -43
@@ -3159,6 +3159,150 @@ static void clone_update_extent_map(struct inode *inode, &BTRFS_I(inode)->runtime_flags); } +/* +* Make sure we do not end up inserting an inline extent into a file that has +* already other (non-inline) extents. If a file has an inline extent it can +* not have any other extents and the (single) inline extent must start at the +* file offset 0. Failing to respect these rules will lead to file corruption, +* resulting in EIO errors on read/write operations, hitting BUG_ON's in mm, etc +* +* We can have extents that have been already written to disk or we can have +* dirty ranges still in delalloc, in which case the extent maps and items are +* created only when we run delalloc, and the delalloc ranges might fall outside +* the range we are currently locking in the inode's io tree. So we check the +* inode's i_size because of that (i_size updates are done while holding the +* i_mutex, which we are holding here). +* We also check to see if the inode has a size not greater than "datal" but has +* extents beyond it, due to an fallocate with FALLOC_FL_KEEP_SIZE (and we are +* protected against such concurrent fallocate calls by the i_mutex). +* +* If the file has no extents but a size greater than datal, do not allow the +* copy because we would need turn the inline extent into a non-inline one (even +* with NO_HOLES enabled). If we find our destination inode only has one inline +* extent, just overwrite it with the source inline extent if its size is less +* than the source extent's size, or we could copy the source inline extent's +* data into the destination inode's inline extent if the later is greater then +* the former. +*/ +static int clone_copy_inline_extent (struct inode *src, +struct inode *dst, +struct btrfs_trans_handle *trans, +struct btrfs_path *path, +struct btrfs_key *new_key, +const u64 drop_start, +const u64 datal, +const u64 skip, +const u64 size, +char *inline_data) +{ +struct btrfs_root *root =BTRFS_I (dst)->root; +const u64 aligned_end =ALIGN (new_key->offset + datal, + root->sectorsize); +int ret; +struct btrfs_key key; + +if (new_key->offset >0 ) +return -EOPNOTSUPP ; + + key.objectid =btrfs_ino (dst); + key.type =BTRFS_EXTENT_DATA_KEY ; + key.offset =0 ; + ret =btrfs_search_slot (NULL , root, &key, path,0 ,0 ); +if (ret <0 ) { +return ret; + }else if (ret >0 ) { +if (path->slots[0 ] >=btrfs_header_nritems (path->nodes[0 ])) { + ret =btrfs_next_leaf (root, path); +if (ret <0 ) +return ret; +else if (ret >0 ) + goto copy_inline_extent; + } +btrfs_item_key_to_cpu (path->nodes[0 ], &key, path->slots[0 ]); +if (key.objectid ==btrfs_ino (dst) && + key.type ==BTRFS_EXTENT_DATA_KEY ) { +ASSERT (key.offset >0 ); +return -EOPNOTSUPP ; + } + }else if (i_size_read (dst) <= datal) { +struct btrfs_file_extent_item *ei; +u64 ext_len; + +/* +* If the file size is <= datal, make sure there are no other +* extents following (can happen do to an fallocate call with +* the flag FALLOC_FL_KEEP_SIZE). +*/ + ei =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], + struct btrfs_file_extent_item); +/* +* If it's an inline extent, it can not have other extents +* following it. +*/ +if (btrfs_file_extent_type (path->nodes[0 ], ei) == +BTRFS_FILE_EXTENT_INLINE ) + goto copy_inline_extent; + + ext_len =btrfs_file_extent_num_bytes (path->nodes[0 ], ei); +if (ext_len > aligned_end) +return -EOPNOTSUPP ; + + ret =btrfs_next_item (root, path); +if (ret <0 ) { +return ret; + }else if (ret ==0 ) { +btrfs_item_key_to_cpu (path->nodes[0 ], &key, + path->slots[0 ]); +if (key.objectid ==btrfs_ino (dst) && + key.type ==BTRFS_EXTENT_DATA_KEY ) +return -EOPNOTSUPP ; + } + } + +copy_inline_extent: +/* +* We have no extent items, or we have an extent at offset 0 which may +* or may not be inlined. All these cases are dealt the same way. +*/ +if (i_size_read (dst) > datal) { +/* +* If the destination inode has an inline extent... +* This would require copying the data from the source inline +* extent into the beginning of the destination's inline extent. +* But this is really complex, both extents can be compressed +* or just one of them, which would require decompressing and +* re-compressing data (which could increase the new compressed +* size, not allowing the compressed data to fit anymore in an +* inline extent). +* So just don't support this case for now (it should be rare, +* we are not really saving space when cloning inline extents). +*/ +return -EOPNOTSUPP ; + } + +btrfs_release_path (path); + ret =btrfs_drop_extents (trans, root, dst, drop_start, aligned_end,1 ); +if (ret) +return ret; + ret =btrfs_insert_empty_item (trans, root, path, new_key, size); +if (ret) +return ret; + +if (skip) { +const u32 start =btrfs_file_extent_calc_inline_size (0 ); + +memmove (inline_data + start, inline_data + start + skip, datal); + } + +write_extent_buffer (path->nodes[0 ], inline_data, +btrfs_item_ptr_offset (path->nodes[0 ], + path->slots[0 ]), + size); +inode_add_bytes (dst, datal); + +return 0 ; +} +/** * btrfs_clone() - clone a range from inode file to another *
@@ -3423,21 +3567,6 @@ process_slot: }else if (type ==BTRFS_FILE_EXTENT_INLINE ) {u64 skip =0 ;u64 trim =0 ; -u64 aligned_end =0 ; - -/* -* Don't copy an inline extent into an offset -* greater than zero. Having an inline extent -* at such an offset results in chaos as btrfs -* isn't prepared for such cases. Just skip -* this case for the same reasons as commented -* at btrfs_ioctl_clone(). -*/ -if (last_dest_end >0 ) { - ret = -EOPNOTSUPP ; -btrfs_end_transaction (trans, root); - goto out; - }if (off > key.offset) { skip = off - key.offset;
@@ -3455,42 +3584,22 @@ process_slot: size -= skip + trim; datal -= skip + trim; - aligned_end =ALIGN (new_key.offset + datal, - root->sectorsize); - ret =btrfs_drop_extents (trans, root, inode, - drop_start, - aligned_end, -1 ); + ret =clone_copy_inline_extent (src, inode, + trans, path, + &new_key, + drop_start, + datal, + skip, size, buf);if (ret) {if (ret != -EOPNOTSUPP )btrfs_abort_transaction (trans, - root, ret); -btrfs_end_transaction (trans, root); - goto out; - } - - ret =btrfs_insert_empty_item (trans, root, path, - &new_key, size); -if (ret) { -btrfs_abort_transaction (trans, root, - ret); + root, + ret);btrfs_end_transaction (trans, root); goto out; } - -if (skip) { -u32 start = -btrfs_file_extent_calc_inline_size (0 ); -memmove (buf+start, buf+start+skip, - datal); - } - leaf = path->nodes[0 ]; slot = path->slots[0 ]; -write_extent_buffer (leaf, buf, -btrfs_item_ptr_offset (leaf, slot), - size); -inode_add_bytes (inode, datal); }/* If we have an implicit hole (NO_HOLES feature). */
Signature · 1 line
1.9.1
PATCH 40/164 ARM: common: edma: Fix channel parameter for irq callbacks
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 696d8b70c09dd421c4d037fab04341e5b30585cf upstream.
In case when the interrupt happened for the second eDMA the channel number was incorrectly passed to the client driver.
--- arch/arm/common/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/common/edma.c +4 -2
@@ -406,7 +406,8 @@ static irqreturn_t dma_irq_handler(int irq, void *data) BIT(slot));if (edma_cc[ctlr]->intr_data[channel].callback) edma_cc[ctlr]->intr_data[channel].callback ( - channel,EDMA_DMA_COMPLETE , +EDMA_CTLR_CHAN (ctlr, channel), +EDMA_DMA_COMPLETE , edma_cc[ctlr]->intr_data[channel].data); } }while (sh_ipr);
@@ -460,7 +461,8 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data)if (edma_cc[ctlr]->intr_data[k]. callback) { edma_cc[ctlr]->intr_data[k]. -callback (k, +callback ( +EDMA_CTLR_CHAN (ctlr, k),EDMA_DMA_CC_ERROR , edma_cc[ctlr]->intr_data [k].data);
Signature · 1 line
1.9.1
PATCH 41/164 iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit d14053b3c714178525f22660e6aaf41263d00056 upstream.
The VT-d specification says that "Software must enable ATS on endpoint devices behind a Root Port only if the Root Port is reported as supporting ATS transactions."
We walk up the tree to find a Root Port, but for integrated devices we don't find one — we get to the host bridge. In that case we *should* allow ATS. Currently we don't, which means that we are incorrectly failing to use ATS for the integrated graphics. Fix that.
We should never break out of this loop "naturally" with bus==NULL, since we'll always find bridge==NULL in that case (and now return 1).
So remove the check for (!bridge) after the loop, since it can never happen. If it did, it would be worthy of a BUG_ON(!bridge). But since it'll oops anyway in that case, that'll do just as well.
--- drivers/iommu/intel-iommu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/iommu/intel-iommu.c +6 -3
@@ -3945,14 +3945,17 @@ int dmar_find_matched_atsr_unit(struct pci_dev *dev) dev =pci_physfn (dev);for (bus = dev->bus; bus; bus = bus->parent) { bridge = bus->self; -if (!bridge || !pci_is_pcie (bridge) || +/* If it's an integrated device, allow ATS */ +if (!bridge) +return 1 ; +/* Connected via non-PCIe: no ATS */ +if (!pci_is_pcie (bridge) ||pci_pcie_type (bridge) ==PCI_EXP_TYPE_PCI_BRIDGE )return 0 ; +/* If we found the root port, look it up in the ATSR */ if (pci_pcie_type (bridge) ==PCI_EXP_TYPE_ROOT_PORT )break ; } -if (!bridge) -return 0 ;rcu_read_lock ();list_for_each_entry_rcu (atsru, &dmar_atsr_units, list) {
Signature · 1 line
1.9.1
PATCH 42/164 Btrfs: fix truncation of compressed and inlined extents
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 0305cd5f7fca85dae392b9ba85b116896eb7c1c7 upstream.
When truncating a file to a smaller size which consists of an inline extent that is compressed, we did not discard (or made unusable) the data between the new file size and the old file size, wasting metadata space and allowing for the truncated data to be leaked and the data corruption/loss mentioned below.
We were also not correctly decrementing the number of bytes used by the inode, we were setting it to zero, giving a wrong report for callers of the stat(2) syscall. The fsck tool also reported an error about a mismatch between the nbytes of the file versus the real space used by the file.
Now because we weren't discarding the truncated region of the file, it was possible for a caller of the clone ioctl to actually read the data that was truncated, allowing for a security breach without requiring root access to the system, using only standard filesystem operations. The scenario is the following:
1) User A creates a file which consists of an inline and compressed extent with a size of 2000 bytes - the file is not accessible to any other users (no read, write or execution permission for anyone else);
2) The user truncates the file to a size of 1000 bytes;
3) User A makes the file world readable;
4) User B creates a file consisting of an inline extent of 2000 bytes;
5) User B issues a clone operation from user A's file into its own
file (using a length argument of 0, clone the whole range);
6) User B now gets to see the 1000 bytes that user A truncated from its file before it made its file world readbale. User B also lost the bytes in the range [1000, 2000[ bytes from its own file, but that might be ok if his/her intention was reading stale data from user A that was never supposed to be public.
Note that this contrasts with the case where we truncate a file from 2000 bytes to 1000 bytes and then truncate it back from 1000 to 2000 bytes. In this case reading any byte from the range [1000, 2000[ will return a value of 0x00, instead of the original data.
This problem exists since the clone ioctl was added and happens both with and without my recent data loss and file corruption fixes for the clone ioctl (patch "Btrfs: fix file corruption and data loss after cloning inline extents").
So fix this by truncating the compressed inline extents as we do for the non-compressed case, which involves decompressing, if the data isn't already in the page cache, compressing the truncated version of the extent, writing the compressed content into the inline extent and then truncate it.
The following test case for fstests reproduces the problem. In order for the test to pass both this fix and my previous fix for the clone ioctl that forbids cloning a smaller inline extent into a larger one, which is titled "Btrfs: fix file corruption and data loss after cloning inline extents", are needed. Without that other fix the test fails in a different way that does not leak the truncated data, instead part of destination file gets replaced with zeroes (because the destination file has a larger inline extent than the source).
seq=basename $0
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
rm -f $tmp.*
}# get standard environment, filters and checks . ./common/rc . ./common/filter
# real QA test starts here _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch _require_cloner
rm -f $seqres.full
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount "-o compress"
# Create our test files. File foo is going to be the source of a clone operation
# and consists of a single inline extent with an uncompressed size of 512 bytes,
# while file bar consists of a single inline extent with an uncompressed size of
# 256 bytes. For our test's purpose, it's important that file bar has an inline
# extent with a size smaller than foo's inline extent.
$XFS_IO_PROG -f -c "pwrite -S 0xa1 0 128" \
-c "pwrite -S 0x2a 128 384" \
$SCRATCH_MNT/foo | _filter_xfs_io
$XFS_IO_PROG -f -c "pwrite -S 0xbb 0 256" $SCRATCH_MNT/bar | _filter_xfs_io# Now durably persist all metadata and data. We do this to make sure that we get
# on disk an inline extent with a size of 512 bytes for file foo. sync
# Now truncate our file foo to a smaller size. Because it consists of a
# compressed and inline extent, btrfs did not shrink the inline extent to the # new size (if the extent was not compressed, btrfs would shrink it to 128 # bytes), it only updates the inode's i_size to 128 bytes. $XFS_IO_PROG -c "truncate 128" $SCRATCH_MNT/foo
# Now clone foo's inline extent into bar.
# This clone operation should fail with errno EOPNOTSUPP because the source
# file consists only of an inline extent and the file's size is smaller than # the inline extent of the destination (128 bytes < 256 bytes). However the # clone ioctl was not prepared to deal with a file that has a size smaller # than the size of its inline extent (something that happens only for compressed # inline extents), resulting in copying the full inline extent from the source # file into the destination file. # # Note that btrfs' clone operation for inline extents consists of removing the # inline extent from the destination inode and copy the inline extent from the # source inode into the destination inode, meaning that if the destination # inode's inline extent is larger (N bytes) than the source inode's inline # extent (M bytes), some bytes (N - M bytes) will be lost from the destination # file. Btrfs could copy the source inline extent's data into the destination's # inline extent so that we would not lose any data, but that's currently not # done due to the complexity that would be needed to deal with such cases # (specially when one or both extents are compressed), returning EOPNOTSUPP, as # it's normally not a very common case to clone very small files (only case # where we get inline extents) and copying inline extents does not save any # space (unlike for normal, non-inlined extents). $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/foo $SCRATCH_MNT/bar
# Now because the above clone operation used to succeed, and due to foo's inline
# extent not being shinked by the truncate operation, our file bar got the whole # inline extent copied from foo, making us lose the last 128 bytes from bar # which got replaced by the bytes in range [128, 256[ from foo before foo was # truncated - in other words, data loss from bar and being able to read old and # stale data from foo that should not be possible to read anymore through normal # filesystem operations. Contrast with the case where we truncate a file from a # size N to a smaller size M, truncate it back to size N and then read the range # [M, N[, we should always get the value 0x00 for all the bytes in that range.
# We expected the clone operation to fail with errno EOPNOTSUPP and therefore
# not modify our file's bar data/metadata. So its content should be 256 bytes # long with all bytes having the value 0xbb. # # Without the btrfs bug fix, the clone operation succeeded and resulted in # leaking truncated data from foo, the bytes that belonged to its range # [128, 256[, and losing data from bar in that same range. So reading the # file gave us the following content: # # 0000000 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 # * # 0000200 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a # * # 0000400 echo "File bar's content after the clone operation:" od -t x1 $SCRATCH_MNT/bar
# Also because the foo's inline extent was not shrunk by the truncate # operation, btrfs' fsck, which is run by the fstests framework everytime a
# test completes, failed reporting the following error: # # root 5 inode 257 errors 400, nbytes wrong
status=0
exit
--- fs/btrfs/inode.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 14 deletions(-)
fs/btrfs/inode.c +68 -14
@@ -4074,6 +4074,47 @@ out:return err; } +static int truncate_inline_extent (struct inode *inode, +struct btrfs_path *path, +struct btrfs_key *found_key, +const u64 item_end, +const u64 new_size) +{ +struct extent_buffer *leaf = path->nodes[0 ]; +int slot = path->slots[0 ]; +struct btrfs_file_extent_item *fi; +u32 size = (u32)(new_size - found_key->offset); +struct btrfs_root *root =BTRFS_I (inode)->root; + + fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); + +if (btrfs_file_extent_compression (leaf, fi) !=BTRFS_COMPRESS_NONE ) { +loff_t offset = new_size; +loff_t page_end =ALIGN (offset,PAGE_CACHE_SIZE ); + +/* +* Zero out the remaining of the last page of our inline extent, +* instead of directly truncating our inline extent here - that +* would be much more complex (decompressing all the data, then +* compressing the truncated data, which might be bigger than +* the size of the inline extent, resize the extent, etc). +* We release the path because to get the page we might need to +* read the extent item from disk (data not in the page cache). +*/ +btrfs_release_path (path); +return btrfs_truncate_page (inode, offset, page_end - offset,0 ); + } + +btrfs_set_file_extent_ram_bytes (leaf, fi, size); + size =btrfs_file_extent_calc_inline_size (size); +btrfs_truncate_item (root, path, size,1 ); + +if (test_bit (BTRFS_ROOT_REF_COWS , &root->state)) +inode_sub_bytes (inode, item_end +1 - new_size); + +return 0 ; +} +/* * this can truncate away extent items, csum items and directory items. * It starts at a high offset and removes keys until it can't find
@@ -4243,27 +4284,40 @@ search_again:* special encodings */ if (!del_item && -btrfs_file_extent_compression (leaf, fi) ==0 &&btrfs_file_extent_encryption (leaf, fi) ==0 &&btrfs_file_extent_other_encoding (leaf, fi) ==0 ) { -u32 size = new_size - found_key.offset; - -if (test_bit (BTRFS_ROOT_REF_COWS , &root->state)) -inode_sub_bytes (inode, item_end +1 - - new_size);/* -* update the ram bytes to properly reflect -* the new size of our item +* Need to release path in order to truncate a +* compressed extent. So delete any accumulated +* extent items so far. */ -btrfs_set_file_extent_ram_bytes (leaf, fi, size); - size = -btrfs_file_extent_calc_inline_size (size); -btrfs_truncate_item (root, path, size,1 ); +if (btrfs_file_extent_compression (leaf, fi) != +BTRFS_COMPRESS_NONE && pending_del_nr) { + err =btrfs_del_items (trans, root, path, + pending_del_slot, + pending_del_nr); +if (err) { +btrfs_abort_transaction (trans, + root, + err); + goto error; + } + pending_del_nr =0 ; + } + + err =truncate_inline_extent (inode, path, + &found_key, + item_end, + new_size); +if (err) { +btrfs_abort_transaction (trans, + root, err); + goto error; + } }else if (test_bit (BTRFS_ROOT_REF_COWS , &root->state)) { -inode_sub_bytes (inode, item_end +1 - - found_key.offset); +inode_sub_bytes (inode, item_end +1 - new_size); } } delete:
Signature · 1 line
1.9.1
PATCH 43/164 jbd2: fix checkpoint list cleanup
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 33d14975e5ac469963d5d63856b61698ad0bff07 upstream.
Unlike comments and expectation of callers journal_clean_one_cp_list() returned 1 not only if it freed the transaction but also if it freed some buffers in the transaction. That could make __jbd2_journal_clean_checkpoint_list() skip processing t_checkpoint_io_list and continue with processing the next transaction. This is mostly a cosmetic issue since the only result is we can sometimes free less memory than we could. But it's still worth fixing. Fix journal_clean_one_cp_list() to return 1 only if the transaction was really freed.
--- fs/jbd2/checkpoint.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/jbd2/checkpoint.c +3 -5
@@ -427,7 +427,6 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)struct journal_head *last_jh;struct journal_head *next_jh = jh;int ret; -int freed =0 ;if (!jh)return 0 ;
@@ -441,10 +440,9 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)else ret =__jbd2_journal_remove_checkpoint (jh) +1 ;if (!ret) -return freed; +return 0 ;if (ret ==2 )return 1 ; - freed =1 ;/* * This function only frees up some memory * if possible so we dont have an obligation
@@ -452,10 +450,10 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)* requested: */ if (need_resched ()) -return freed; +return 0 ; }while (jh != last_jh); -return freed; +return 0 ; }/*
Signature · 1 line
1.9.1
PATCH 44/164 ext4: fix potential use after free in __ext4_journal_stop
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 6934da9238da947628be83635e365df41064b09b upstream.
There is a use-after-free possibility in __ext4_journal_stop() in the case that we free the handle in the first jbd2_journal_stop() because we're referencing handle->h_err afterwards. This was introduced in 9705acd63b125dee8b15c705216d7186daea4625 and it is wrong. Fix it by storing the handle->h_err value beforehand and avoid referencing potentially freed handle.
--- fs/ext4/ext4_jbd2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/ext4_jbd2.c +3 -3
@@ -88,13 +88,13 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)return 0 ; } + err = handle->h_err;if (!handle->h_transaction) { - err =jbd2_journal_stop (handle); -return handle->h_err ? handle->h_err : err; + rc =jbd2_journal_stop (handle); +return err ? err : rc; } sb = handle->h_transaction->t_journal->j_private; - err = handle->h_err; rc =jbd2_journal_stop (handle);if (!err)
Signature · 1 line
1.9.1
PATCH 45/164 fix calculation of meta_bg descriptor backups
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Leiserson <[email protected]>
commit 904dad4742d211b7a8910e92695c0fa957483836 upstream.
"group" is the group where the backup will be placed, and is initialized to zero in the declaration. This meant that backups for meta_bg descriptors were erroneously written to the backup block group descriptors in groups 1 and (desc_per_block-1).
Reproduction information:
mke2fs -Fq -t ext4 -b 1024 -O ^resize_inode /tmp/foo.img 16G truncate -s 24G /tmp/foo.img
losetup /dev/loop0 /tmp/foo.img
mount /dev/loop0 /mnt
resize2fs /dev/loop0
umount /dev/loop0
dd if=/dev/zero of=/dev/loop0 bs=1024 count=2 e2fsck -fy /dev/loop0
losetup -d /dev/loop0
--- fs/ext4/resize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/resize.c +2 -2
@@ -1040,7 +1040,7 @@ exit_free:* do not copy the full number of backups at this time. The resize * which changed s_groups_count will backup again. */ -static void update_backups (struct super_block *sb,int blk_off,char *data, +static void update_backups (struct super_block *sb,sector_t blk_off,char *data,int size,int meta_bg) {struct ext4_sb_info *sbi =EXT4_SB (sb);
@@ -1065,7 +1065,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, group =ext4_list_backups (sb, &three, &five, &seven); last = sbi->s_groups_count; }else { - group =ext4_meta_bg_first_group (sb, group) +1 ; + group =ext4_get_group_number (sb, blk_off) +1 ; last = (ext4_group_t)(group +EXT4_DESC_PER_BLOCK (sb) -2 ); }
Signature · 1 line
1.9.1
PATCH 46/164 ext4, jbd2: ensure entering into panic after recording an error in superblock
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daeho Jeong <[email protected]>
commit 4327ba52afd03fc4b5afa0ee1d774c9c5b0e85c5 upstream.
If a EXT4 filesystem utilizes JBD2 journaling and an error occurs, the journaling will be aborted first and the error number will be recorded into JBD2 superblock and, finally, the system will enter into the panic state in "errors=panic" option. But, in the rare case, this sequence is little twisted like the below figure and it will happen that the system enters into panic state, which means the system reset in mobile environment, before completion of recording an error in the journal superblock. In this case, e2fsck cannot recognize that the filesystem failure occurred in the previous run and the corruption wouldn't be fixed.
Task A Task Bext4_handle_error()
-> jbd2_journal_abort()
-> __journal_abort_soft()
-> __jbd2_journal_abort_hard()
| -> journal->j_flags |= JBD2_ABORT;
|
| __ext4_abort()
| -> jbd2_journal_abort()
| | -> __journal_abort_soft()
| | -> if (journal->j_flags & JBD2_ABORT)
| | return;
| -> panic()
|
-> jbd2_journal_update_sb_errno()--- fs/ext4/super.c | 12 ++++++++++-- fs/jbd2/journal.c | 6 +++++- include/linux/jbd2.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-)
fs/ext4/super.c +10 -2
@@ -395,9 +395,13 @@ static void ext4_handle_error(struct super_block *sb)smp_wmb (); sb->s_flags |=MS_RDONLY ; } -if (test_opt (sb,ERRORS_PANIC )) +if (test_opt (sb,ERRORS_PANIC )) { +if (EXT4_SB (sb)->s_journal && + !(EXT4_SB (sb)->s_journal->j_flags &JBD2_REC_ERR )) +return ;panic ("EXT4-fs (device %s): panic forced after error\n" , sb->s_id); + } }#define ext4_error_ratelimit (sb) \
@@ -586,8 +590,12 @@ void __ext4_abort(struct super_block *sb, const char *function,jbd2_journal_abort (EXT4_SB (sb)->s_journal, -EIO );save_error_info (sb, function, line); } -if (test_opt (sb,ERRORS_PANIC )) +if (test_opt (sb,ERRORS_PANIC )) { +if (EXT4_SB (sb)->s_journal && + !(EXT4_SB (sb)->s_journal->j_flags &JBD2_REC_ERR )) +return ;panic ("EXT4-fs panic from previous error\n" ); + } } void __ext4_msg(struct super_block *sb,
fs/jbd2/journal.c +5 -1
@@ -2086,8 +2086,12 @@ static void __journal_abort_soft (journal_t *journal, int errno)__jbd2_journal_abort_hard (journal); -if (errno) +if (errno) {jbd2_journal_update_sb_errno (journal); +write_lock (&journal->j_state_lock); + journal->j_flags |=JBD2_REC_ERR ; +write_unlock (&journal->j_state_lock); + } }/**
include/linux/jbd2.h +1 -0
@@ -1007,6 +1007,7 @@ struct journal_s#define JBD2_ABORT_ON_SYNCDATA_ERR 0x040/* Abort the journal on file * data write error in ordered * mode */ +#define JBD2_REC_ERR 0x080/* The errno in the sb has been recorded */ /* * Function declarations for the journaling transaction and buffer
Signature · 1 line
1.9.1
PATCH 47/164 vTPM: fix memory allocation flag for rtce buffer at kernel boot
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Hon Ching \\\\(Vicky\\\\) Lo" <[email protected]>
commit 60ecd86c4d985750efa0ea3d8610972b09951715 upstream.
At ibm vtpm initialzation, tpm_ibmvtpm_probe() registers its interrupt handler, ibmvtpm_interrupt, which calls ibmvtpm_crq_process to allocate memory for rtce buffer. The current code uses 'GFP_KERNEL' as the type of kernel memory allocation, which resulted a warning at kernel/lockdep.c. This patch uses 'GFP_ATOMIC' instead so that the allocation is high-priority and does not sleep.
--- drivers/char/tpm/tpm_ibmvtpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_ibmvtpm.c +1 -1
@@ -490,7 +490,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, } ibmvtpm->rtce_size =be16_to_cpu (crq->len); ibmvtpm->rtce_buf =kmalloc (ibmvtpm->rtce_size, -GFP_KERNEL ); +GFP_ATOMIC );if (!ibmvtpm->rtce_buf) {dev_err (ibmvtpm->dev,"Failed to allocate memory for rtce buffer\n" );return ;
Signature · 1 line
1.9.1
PATCH 48/164 spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 02f20387e1bca550639c37b1945f20cd32ddfcce upstream.
The following warning occurs when DW SPI is compiled as a module and it's a PCI device. On the removal stage pcibios_free_irq() is called earlier than free_irq() due to the latter is called at managed resources free strage.
------------[ cut here ]------------ WARNING: CPU: 1 PID: 1003 at /home/andy/prj/linux/fs/proc/generic.c:575 remove_proc_entry+0x118/0x150() remove_proc_entry: removing non-empty directory 'irq/38', leaking at least 'dw_spi1' Modules linked in: spi_dw_midpci(-) spi_dw [last unloaded: dw_dmac_core] CPU: 1 PID: 1003 Comm: modprobe Not tainted 4.3.0-rc5-next-20151013+ #32 00000000 00000000 f5535d70 c12dc220 f5535db0 f5535da0 c104e912 c198a6bc f5535dcc 000003eb c198a638 0000023f c11b4098 c11b4098 f54f1ec8 f54f1ea0 f642ba20 f5535db8 c104e96e 00000009 f5535db0 c198a6bc f5535dcc f5535df0 Call Trace: [<c12dc220>] dump_stack+0x41/0x61 [<c104e912>] warn_slowpath_common+0x82/0xb0 [<c11b4098>] ? remove_proc_entry+0x118/0x150 [<c11b4098>] ? remove_proc_entry+0x118/0x150 [<c104e96e>] warn_slowpath_fmt+0x2e/0x30 [<c11b4098>] remove_proc_entry+0x118/0x150 [<c109b96a>] unregister_irq_proc+0xaa/0xc0 [<c109575e>] free_desc+0x1e/0x60 [<c10957d2>] irq_free_descs+0x32/0x70 [<c109b1a0>] irq_domain_free_irqs+0x120/0x150 [<c1039e8c>] mp_unmap_irq+0x5c/0x60 [<c16277b0>] intel_mid_pci_irq_disable+0x20/0x40 [<c1627c7f>] pcibios_free_irq+0xf/0x20 [<c13189f2>] pci_device_remove+0x52/0xb0 [<c13f6367>] __device_release_driver+0x77/0x100 [<c13f6da7>] driver_detach+0x87/0x90 [<c13f5eaa>] bus_remove_driver+0x4a/0xc0 [<c128bf0d>] ? selinux_capable+0xd/0x10 [<c13f7483>] driver_unregister+0x23/0x60 [<c10bad8a>] ? find_module_all+0x5a/0x80 [<c1317413>] pci_unregister_driver+0x13/0x60 [<f80ac654>] dw_spi_driver_exit+0xd/0xf [spi_dw_midpci] [<c10bce9a>] SyS_delete_module+0x17a/0x210
Explicitly call free_irq() at removal stage of the DW SPI driver.
--- drivers/spi/spi-dw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-dw.c +4 -2
@@ -650,8 +650,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) dws->dma_addr = (dma_addr_t)(dws->paddr +0x60 );snprintf (dws->name,sizeof (dws->name),"dw_spi%d" , dws->bus_num); - ret =devm_request_irq (dev, dws->irq, dw_spi_irq,IRQF_SHARED , - dws->name, dws); + ret =request_irq (dws->irq, dw_spi_irq,IRQF_SHARED , dws->name, dws);if (ret <0 ) {dev_err (&master->dev,"can not get IRQ\n" ); goto err_free_master;
@@ -694,6 +693,7 @@ err_dma_exit:if (dws->dma_ops && dws->dma_ops->dma_exit) dws->dma_ops->dma_exit (dws);spi_enable_chip (dws,0 ); +free_irq (dws->irq, master); err_free_master:spi_master_put (master);return ret;
@@ -711,6 +711,8 @@ void dw_spi_remove_host(struct dw_spi *dws)spi_enable_chip (dws,0 );/* Disable clk */ spi_set_clk (dws,0 ); + +free_irq (dws->irq, dws->master); }EXPORT_SYMBOL_GPL (dw_spi_remove_host);
Signature · 1 line
1.9.1
PATCH 49/164 media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiffany Lin <[email protected]>
commit d9a985883fa32453d099d6293188c11d75cef1fa upstream.
In videobuf2 dma-contig memory type the prepare and finish ops, instead of passing the number of entries in the original scatterlist as the "nents" parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(), the value returned by dma_map_sg() was used. Albeit this has been suggested in comments of some implementations (which have since been corrected), this is wrong.
--- drivers/media/v4l2-core/videobuf2-dma-contig.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/videobuf2-dma-contig.c +3 -2
@@ -120,7 +120,8 @@ static void vb2_dc_prepare(void *buf_priv)if (!sgt || buf->db_attach)return ; -dma_sync_sg_for_device (buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +dma_sync_sg_for_device (buf->dev, sgt->sgl, sgt->orig_nents, + buf->dma_dir); }static void vb2_dc_finish (void *buf_priv)
@@ -132,7 +133,7 @@ static void vb2_dc_finish(void *buf_priv)if (!sgt || buf->db_attach)return ; -dma_sync_sg_for_cpu (buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +dma_sync_sg_for_cpu (buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); }/*********************************************/
Signature · 1 line
1.9.1
PATCH 50/164 media: vb2 dma-sg: Fully cache synchronise buffers in prepare and finish
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiffany Lin <[email protected]>
commit 418dae2276065680bde7ae27d2c075e612a54de6 upstream.
In videobuf2 dma-sg memory types the prepare and finish ops, instead of passing the number of entries in the original scatterlist as the "nents" parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(), the value returned by dma_map_sg() was used. Albeit this has been suggested in comments of some implementations (which have since been corrected), this is wrong.
--- drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/videobuf2-dma-sg.c +3 -2
@@ -209,7 +209,8 @@ static void vb2_dma_sg_prepare(void *buf_priv)if (buf->db_attach)return ; -dma_sync_sg_for_device (buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +dma_sync_sg_for_device (buf->dev, sgt->sgl, sgt->orig_nents, + buf->dma_dir); }static void vb2_dma_sg_finish (void *buf_priv)
@@ -221,7 +222,7 @@ static void vb2_dma_sg_finish(void *buf_priv)if (buf->db_attach)return ; -dma_sync_sg_for_cpu (buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); +dma_sync_sg_for_cpu (buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); }static inline int vma_is_io (struct vm_area_struct *vma)
Signature · 1 line
1.9.1
PATCH 51/164 media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Ospite <[email protected]>
commit 759b26a1d916400a1a20948eb964dea6ad0bd9e9 upstream.
Since commit 5d0360a4f027576e5419d4a7c711c9ca0f1be8ca it's not possible anymore to set auto clusters from auto to manual using VIDIOC_S_CTRL.
For example, setting autogain to manual with gspca/ov534 driver and this sequence of commands does not work:
v4l2-ctl --set-ctrl=gain_automatic=1 v4l2-ctl --list-ctrls | grep gain_automatic # The following does not work v4l2-ctl --set-ctrl=gain_automatic=0 v4l2-ctl --list-ctrls | grep gain_automatic
Changing the value using VIDIOC_S_EXT_CTRLS (like qv4l2 does) works fine.
The apparent cause by looking at the changes in 5d0360a and comparing with the code path for VIDIOC_S_EXT_CTRLS seems to be that the code in v4l2-ctrls.c::set_ctrl() is not calling user_to_new() anymore after calling update_from_auto_cluster(master).
However the root cause of the problem is that calling update_from_auto_cluster(master) overrides also the _master_ control state calling cur_to_new() while it was supposed to only update the volatile controls.
Calling user_to_new() after update_from_auto_cluster(master) was just masking the original bug by restoring the correct new value of the master control before making the changes permanent.
Fix the original bug by making update_from_auto_cluster() not override the new master control value.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-ctrls.c +1 -1
@@ -3042,7 +3042,7 @@ static void update_from_auto_cluster(struct v4l2_ctrl *master) {int i; -for (i =0 ; i < master->ncontrols; i++) +for (i =1 ; i < master->ncontrols; i++)cur_to_new (master->cluster[i]);if (!call_op (master, g_volatile_ctrl))for (i =1 ; i < master->ncontrols; i++)
Signature · 1 line
1.9.1
PATCH 52/164 Bluetooth: hidp: fix device disconnect on idle timeout
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Herrmann <[email protected]>
commit 660f0fc07d21114549c1862e67e78b1cf0c90c29 upstream.
The HIDP specs define an idle-timeout which automatically disconnects a device. This has always been implemented in the HIDP layer and forced a synchronous shutdown of the hidp-scheduler. This works just fine, but lacks a forced disconnect on the underlying l2cap channels. This has been broken since:
commit 5205185d461d5902325e457ca80bd421127b7308
Author: David Herrmann <[email protected]>
Date: Sat Apr 6 20:28:47 2013 +0200
Bluetooth: hidp: remove old session-management
The old session-management always forced an l2cap error on the ctrl/intr channels when shutting down. The new session-management skips this, as we don't want to enforce channel policy on the caller. In other words, if user-space removes an HIDP device, the underlying channels (which are *owned* and *referenced* by user-space) are still left active. User-space needs to call shutdown(2) or close(2) to release them.
Unfortunately, this does not work with idle-timeouts. There is no way to signal user-space that the HIDP layer has been stopped. The API simply does not support any event-passing except for poll(2). Hence, we restore old behavior and force EUNATCH on the sockets if the HIDP layer is disconnected due to idle-timeouts (behavior of explicit disconnects remains unmodified). User-space can still call
getsockopt(..., SO_ERROR, ...)
..to retrieve the EUNATCH error and clear sk_err. Hence, the channels can still be re-used (which nobody does so far, though). Therefore, the API still supports the new behavior, but with this patch it's also compatible to the old implicit channel shutdown.
--- net/bluetooth/hidp/core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/bluetooth/hidp/core.c +14 -0
@@ -400,6 +400,20 @@ static void hidp_idle_timeout(unsigned long arg) {struct hidp_session *session = (struct hidp_session *) arg; +/* The HIDP user-space API only contains calls to add and remove +* devices. There is no way to forward events of any kind. Therefore, +* we have to forcefully disconnect a device on idle-timeouts. This is +* unfortunate and weird API design, but it is spec-compliant and +* required for backwards-compatibility. Hence, on idle-timeout, we +* signal driver-detach events, so poll() will be woken up with an +* error-condition on both sockets. +*/ + + session->intr_sock->sk->sk_err =EUNATCH ; + session->ctrl_sock->sk->sk_err =EUNATCH ; +wake_up_interruptible (sk_sleep (session->intr_sock->sk)); +wake_up_interruptible (sk_sleep (session->ctrl_sock->sk)); +hidp_session_terminate (session); }
Signature · 1 line
1.9.1
PATCH 53/164 Bluetooth: ath3k: Add new AR3012 0930:021c id
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit cd355ff071cd37e7197eccf9216770b2b29369f7 upstream.
This adapter works with the existing linux-firmware.
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#= 3 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0930 ProdID=021c Rev=00.01 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -93,6 +93,7 @@ static const struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x04CA, 0x300f) }, { USB_DEVICE(0x04CA, 0x3010) }, { USB_DEVICE(0x0930, 0x0219) }, + { USB_DEVICE(0x0930, 0x021c) }, { USB_DEVICE(0x0930, 0x0220) }, { USB_DEVICE(0x0930, 0x0227) }, { USB_DEVICE(0x0b05, 0x17d0) },
@@ -152,6 +153,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -181,6 +181,7 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
Signature · 1 line
1.9.1
PATCH 54/164 Bluetooth: ath3k: Add support of AR3012 0cf3:817b device
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 18e0afab8ce3f1230ce3fef52b2e73374fd9c0e7 upstream.
T: Bus=04 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0cf3 ProdID=817b Rev=00.02
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -105,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0CF3, 0x311F) }, { USB_DEVICE(0x0cf3, 0x3121) }, { USB_DEVICE(0x0CF3, 0x817a) }, + { USB_DEVICE(0x0CF3, 0x817b) }, { USB_DEVICE(0x0cf3, 0xe003) }, { USB_DEVICE(0x0CF3, 0xE004) }, { USB_DEVICE(0x0CF3, 0xE005) },
@@ -165,6 +166,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0CF3, 0x817b), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +1 -0
@@ -193,6 +193,7 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0cf3, 0x311f), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x817b), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
Signature · 1 line
1.9.1
PATCH 55/164 Bluetooth: Fix removing connection parameters when unpairing
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit a6ad2a6b9cc1d9d791aee5462cfb8528f366f1d4 upstream.
The commit 89cbb0638e9b7 introduced support for deferred connection parameter removal when unpairing by removing them only once an existing connection gets disconnected. However, it failed to address the scenario when we're *not* connected and do an unpair operation.
What makes things worse is that most user space BlueZ versions will first issue a disconnect request and only then unpair, meaning the buggy code will be triggered every time. This effectively causes the kernel to resume scanning and reconnect to a device for which we've removed all keys and GATT database information.
This patch fixes the issue by adding the missing call to the hci_conn_params_del() function to a branch which handles the case of no existing connection.
--- net/bluetooth/mgmt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/bluetooth/mgmt.c +7 -5
@@ -2772,6 +2772,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, }else {u8 addr_type; +if (cp->addr.type ==BDADDR_LE_PUBLIC ) + addr_type =ADDR_LE_DEV_PUBLIC ; +else + addr_type =ADDR_LE_DEV_RANDOM ; + conn =hci_conn_hash_lookup_ba (hdev,LE_LINK , &cp->addr.bdaddr);if (conn) {
@@ -2787,13 +2792,10 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,*/ if (!cp->disconnect) conn =NULL ; + }else { +hci_conn_params_del (hdev, &cp->addr.bdaddr, addr_type); } -if (cp->addr.type ==BDADDR_LE_PUBLIC ) - addr_type =ADDR_LE_DEV_PUBLIC ; -else - addr_type =ADDR_LE_DEV_RANDOM ; -hci_remove_irk (hdev, &cp->addr.bdaddr, addr_type); err =hci_remove_ltk (hdev, &cp->addr.bdaddr, addr_type);
Signature · 1 line
1.9.1
PATCH 56/164 spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Mosberger-Tang <[email protected]>
commit 06515f83908d038d9e12ffa3dcca27a1b67f2de0 upstream.
The DMA-slave configuration depends on the whether <= 8 or > 8 bits are transferred per word, so we need to call atmel_spi_dma_slave_config() with the correct value.
--- drivers/spi/spi-atmel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-atmel.c +2 -1
@@ -582,7 +582,8 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, *plen = len; -if (atmel_spi_dma_slave_config (as, &slave_config,8 )) +if (atmel_spi_dma_slave_config (as, &slave_config, + xfer->bits_per_word)) goto err_exit;/* Send both scatterlists */
Signature · 1 line
1.9.1
PATCH 57/164 USB: qcserial: add Sierra Wireless MC74xx/EM74xx
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
commit f504ab1888026d15b5be8f9c262bf4ae9cacd177 upstream.
New device IDs shamelessly lifted from the vendor driver.
--- drivers/usb/serial/qcserial.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/qcserial.c +2 -0
@@ -153,6 +153,8 @@ static const struct usb_device_id id_table[] = { {DEVICE_SWI(0x1199, 0x9056)}, /* Sierra Wireless Modem */ {DEVICE_SWI(0x1199, 0x9060)}, /* Sierra Wireless Modem */ {DEVICE_SWI(0x1199, 0x9061)}, /* Sierra Wireless Modem */ + {DEVICE_SWI(0x1199, 0x9070)}, /* Sierra Wireless MC74xx/EM74xx */ + {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx/EM74xx */ {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
Signature · 1 line
1.9.1
PATCH 58/164 staging: rtl8712: Add device ID for Sitecom WLA2100
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 1e6e63283691a2a9048a35d9c6c59cf0abd342e4 upstream.
This adds the USB ID for the Sitecom WLA2100. The Windows 10 inf file was checked to verify that the addition is correct.
--- drivers/staging/rtl8712/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8712/usb_intf.c +1 -0
@@ -144,6 +144,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { {USB_DEVICE(0x0DF6, 0x0058)}, {USB_DEVICE(0x0DF6, 0x0049)}, {USB_DEVICE(0x0DF6, 0x004C)}, + {USB_DEVICE(0x0DF6, 0x006C)}, {USB_DEVICE(0x0DF6, 0x0064)},/* Skyworth */ {USB_DEVICE(0x14b2, 0x3300)},
Signature · 1 line
1.9.1
PATCH 59/164 ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
commit 49e4b84333f338d4f183f28f1f3c1131b9fb2b5a upstream.
Currently when the system is trying to uninstall the ACPI interrupt handler, it uses acpi_gbl_FADT.sci_interrupt as the IRQ number. However, the IRQ number that the ACPI interrupt handled is installed for comes from acpi_gsi_to_irq() and that is the number that should be used for the handler removal.
Fix this problem by using the mapped IRQ returned from acpi_gsi_to_irq() as appropriate.
--- drivers/acpi/osl.c | 9 ++++++--- include/linux/acpi.h | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/acpi/osl.c +6 -3
@@ -83,6 +83,7 @@ static void *acpi_irq_context;static struct workqueue_struct *kacpid_wq;static struct workqueue_struct *kacpi_notify_wq;static struct workqueue_struct *kacpi_hotplug_wq; +unsigned int acpi_sci_irq =INVALID_ACPI_IRQ ;/* * This list of permanent mappings is for memory that may be accessed from
@@ -840,17 +841,19 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, acpi_irq_handler =NULL ;return AE_NOT_ACQUIRED ; } + acpi_sci_irq = irq;return AE_OK ; } -acpi_status acpi_os_remove_interrupt_handler (u32 irq,acpi_osd_handler handler) +acpi_status acpi_os_remove_interrupt_handler (u32 gsi,acpi_osd_handler handler) { -if (irq != acpi_gbl_FADT.sci_interrupt) +if (gsi != acpi_gbl_FADT.sci_interrupt || !acpi_sci_irq_valid ())return AE_BAD_PARAMETER ; -free_irq (irq, acpi_irq); +free_irq (acpi_sci_irq, acpi_irq); acpi_irq_handler =NULL ; + acpi_sci_irq =INVALID_ACPI_IRQ ;return AE_OK ; }
include/linux/acpi.h +6 -0
@@ -157,6 +157,12 @@ int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);void acpi_irq_stats_init (void );extern u32 acpi_irq_handled;extern u32 acpi_irq_not_handled; +extern unsigned int acpi_sci_irq; +#define INVALID_ACPI_IRQ ((unsigned)-1) +static inline bool acpi_sci_irq_valid (void ) +{ +return acpi_sci_irq !=INVALID_ACPI_IRQ ; +}extern int sbf_port;extern unsigned long acpi_realmode_flags;
Signature · 1 line
1.9.1
PATCH 60/164 ACPI: Using correct irq when waiting for events
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
commit efb1cf7d28b8aeacec53e9ba8f3f2809c5cb9686 upstream.
When the system is waiting for GPE/fixed event handler to finish, it uses acpi_gbl_FADT.sci_interrupt directly as the IRQ number. However, the remapped IRQ returned by acpi_gsi_to_irq() should be passed to synchronize_hardirq() instead of it.
--- drivers/acpi/osl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/osl.c +2 -2
@@ -1195,8 +1195,8 @@ void acpi_os_wait_events_complete(void)* Make sure the GPE handler or the fixed event handler is not used * on another CPU after removal. */ -if (acpi_irq_handler) -synchronize_hardirq (acpi_gbl_FADT.sci_interrupt); +if (acpi_sci_irq_valid ()) +synchronize_hardirq (acpi_sci_irq);flush_workqueue (kacpid_wq);flush_workqueue (kacpi_notify_wq); }
Signature · 1 line
1.9.1
PATCH 61/164 ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
commit 8c01275e0cdf1959aa25c322fd5870c097733195 upstream.
For an ACPI compatible system, the SCI (ACPI System Control Interrupt) is used to wake the system up from suspend-to-idle. Once the CPU is woken up by the SCI, the interrupt handler will first check if the current IRQ has been configured for system wakeup, so irq_pm_check_wakeup() is invoked to validate the IRQ number. However, during suspend-to-idle, enable_irq_wake() is called for acpi_gbl_FADT.sci_interrupt, although the IRQ number that the SCI handler has been installed for should be passed to it instead. Thus, if acpi_gbl_FADT.sci_interrupt happens to be different from that number, ACPI interrupts will not be able to wake up the system from sleep.
Fix this problem by passing the IRQ number returned by acpi_gsi_to_irq() to enable_irq_wake() instead of acpi_gbl_FADT.sci_interrupt.
--- drivers/acpi/sleep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +4 -2
@@ -631,13 +631,15 @@ static int acpi_freeze_prepare(void) {acpi_enable_all_wakeup_gpes ();acpi_os_wait_events_complete (); -enable_irq_wake (acpi_gbl_FADT.sci_interrupt); +if (acpi_sci_irq_valid ()) +enable_irq_wake (acpi_sci_irq);return 0 ; }static void acpi_freeze_restore (void ) { -disable_irq_wake (acpi_gbl_FADT.sci_interrupt); +if (acpi_sci_irq_valid ()) +disable_irq_wake (acpi_sci_irq);acpi_enable_all_runtime_gpes (); }
Signature · 1 line
1.9.1
PATCH 62/164 ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 6ed1131fe196ad7ffc13acc1a1eadc08a1db0303 upstream.
This machine had I2S codec for speaker output.
It need to refill the I2S codec initial verb after resume back.
--- sound/pci/hda/patch_realtek.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_realtek.c +13 -0
@@ -4354,6 +4354,7 @@ enum {ALC282_FIXUP_ASPIRE_V5_PINS ,ALC280_FIXUP_HP_GPIO4 ,ALC286_FIXUP_HP_GPIO_LED , + ALC275_FIXUP_DELL_XPS, }; static const struct hda_fixup alc269_fixups[] = {
@@ -4853,6 +4854,17 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc286_fixup_hp_gpio_led, }, + [ALC275_FIXUP_DELL_XPS] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { +/* Enables internal speaker */ + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x1f }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x00c0 }, + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x30 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x00b1 }, + {} + } + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4867,6 +4879,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x0775 ,"Acer Aspire E1-572" ,ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572 ),SND_PCI_QUIRK (0x1025 ,0x079b ,"Acer Aspire V5-573G" ,ALC282_FIXUP_ASPIRE_V5_PINS ),SND_PCI_QUIRK (0x1028 ,0x0470 ,"Dell M101z" ,ALC269_FIXUP_DELL_M101Z ), +SND_PCI_QUIRK (0x1028 ,0x054b ,"Dell XPS one 2710" ,ALC275_FIXUP_DELL_XPS ),SND_PCI_QUIRK (0x1028 ,0x05da ,"Dell Vostro 5460" ,ALC290_FIXUP_SUBWOOFER ),SND_PCI_QUIRK (0x1028 ,0x05f4 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
Signature · 1 line
1.9.1
PATCH 63/164 ALSA: hda - Disable 64bit address for Creative HDA controllers
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit cadd16ea33a938d49aee99edd4758cc76048b399 upstream.
We've had many reports that some Creative sound cards with CA0132 don't work well. Some reported that it starts working after reloading the module, while some reported it starts working when a 32bit kernel is used. All these facts seem implying that the chip fails to communicate when the buffer is located in 64bit address.
This patch addresses these issues by just adding AZX_DCAPS_NO_64BIT flag to the corresponding PCI entries. I casually had a chance to test an SB Recon3D board, and indeed this seems helping.
Although this hasn't been tested on all Creative devices, it's safer to assume that this restriction applies to the rest of them, too. So the flag is applied to all Creative entries.
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -324,6 +324,7 @@ enum {#define AZX_DCAPS_PRESET_CTHDA \ (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |\ + AZX_DCAPS_NO_64BIT |\ AZX_DCAPS_4K_BDLE_BOUNDARY | AZX_DCAPS_SNOOP_OFF)/*
@@ -2196,11 +2197,13 @@ static const struct pci_device_id azx_ids[] = { .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, .class_mask = 0xffffff, .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | + AZX_DCAPS_NO_64BIT | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, #else /* this entry seems still valid -- i.e. without emu20kx chip */ { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | + AZX_DCAPS_NO_64BIT | AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, #endif /* CM8888 */
Signature · 1 line
1.9.1
PATCH 64/164 MAINTAINERS: Add public mailing list for ARC
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit 9acdc911b55569145034b01075adf658891afbd2 upstream.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -9295,6 +9295,7 @@ F: include/net/switchdev.h SYNOPSYS ARC ARCHITECTURE M: Vineet Gupta <[email protected]> +L: [email protected] S: Supported F: arch/arc/ F: Documentation/devicetree/bindings/arc/
Signature · 1 line
1.9.1
PATCH 65/164 megaraid_sas: Expose TAPE drives unconditionally
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.
Expose non-disk (TAPE drive, CD-ROM) unconditionally.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +3 -2
@@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) pd_index = (sdev->channel *MEGASAS_MAX_DEV_PER_CHANNEL ) + sdev->id; -if (instance->pd_list[pd_index].driveState == -MR_PD_STATE_SYSTEM ) { +if ((instance->pd_list[pd_index].driveState == +MR_PD_STATE_SYSTEM ) || + (instance->pd_list[pd_index].driveType !=TYPE_DISK )) {return 0 ; }return -ENXIO ;
Signature · 1 line
1.9.1
RE: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally
patch- "aed335e megaraid_sas: Make tape drives visible on PERC5 controllers" is must along with current patch. Please consider.
Quoted 10 lines
-----Original Message-----
From: Kamal Mostafa [mailto:[email protected]]
Sent: Wednesday, December 02, 2015 10:29 PM
To: [email protected]; [email protected]; kernel- [email protected]
Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
Subject: [PATCH 3.19.y-ckt 065/164]megaraid_sas: Expose TAPE drives unconditionally3.19.8-ckt11 -stable review patch. If anyone has any objections, please
let me
Quoted 26 lines
know.
------------------
From: "[email protected]" <[email protected]>
commit
0d5b47a724bab0ebaaa933d6ff5e584957aaa188upstream.Expose non-disk (TAPE drive, CD-ROM) unconditionally.
Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>Reviewed-by Tomas Henzl <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>Signed-off-by Kamal Mostafa <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/scsi/megaraid/megaraid_sas_base.c +0
-0
drivers/scsi/megaraid/megaraid_sas_base.c static int megasas_slave_alloc(struct scsi_device · line 1688
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +4
-2@@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) pd_index = (sdev->channel *MEGASAS_MAX_DEV_PER_CHANNEL ) + sdev->id; -if (instance->pd_list[pd_index].driveState == -MR_PD_STATE_SYSTEM ) { + if ((instance->pd_list[pd_index].driveState == + MR_PD_STATE_SYSTEM) || + (instance->pd_list[pd_index].driveType !=
TYPE_DISK)) {
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-1return 0 ; }return -ENXIO ; --1.9.1
Re: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally
Quoted 2 lines · Sumit Saxena
patch- "aed335e
megaraid_sas: Make tape drives visible on PERC5 controllers" is must along with current patch. Please consider.
Thanks Sumit. I will pick up aed335e for this 3.19.8-ckt11 release as well then.
-Kamal
Quoted 54 lines
Quoted 10 lines
-----Original Message-----
From: Kamal Mostafa [mailto:[email protected]]
Sent: Wednesday, December 02, 2015 10:29 PM
To: [email protected]; [email protected]; kernel- [email protected]
Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
Subject: [PATCH 3.19.y-ckt 065/164]megaraid_sas: Expose TAPE drives unconditionally3.19.8-ckt11 -stable review patch. If anyone has any objections, please
let me
Quoted 26 lines
know.
------------------
From: "[email protected]" <[email protected]>
commit
0d5b47a724bab0ebaaa933d6ff5e584957aaa188upstream.Expose non-disk (TAPE drive, CD-ROM) unconditionally.
Signed-off-by Sumit Saxena <[email protected]>Signed-off-by Kashyap Desai <[email protected]>Reviewed-by Tomas Henzl <[email protected]>Reviewed-by Martin K. Petersen <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>Signed-off-by Kamal Mostafa <[email protected]>--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/scsi/megaraid/megaraid_sas_base.c +0
-0drivers/scsi/megaraid/megaraid_sas_base.c static int megasas_slave_alloc(struct scsi_device · line 1688
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +4
-2@@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) pd_index = (sdev->channel *MEGASAS_MAX_DEV_PER_CHANNEL ) + sdev->id; -if (instance->pd_list[pd_index].driveState == -MR_PD_STATE_SYSTEM ) { + if ((instance->pd_list[pd_index].driveState == + MR_PD_STATE_SYSTEM) || + (instance->pd_list[pd_index].driveType !=
TYPE_DISK)) {Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_base.c +0
-1return 0 ; }return -ENXIO ; --1.9.1
PATCH 66/164 megaraid_sas: Do not use PAGE_SIZE for max_sectors
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 357ae967ad66e357f78b5cfb5ab6ca07fb4a7758 upstream.
Do not use PAGE_SIZE marco to calculate max_sectors per I/O request. Driver code assumes PAGE_SIZE will be always 4096 which can lead to wrongly calculated value if PAGE_SIZE is not 4096. This issue was reported in Ubuntu Bugzilla Bug #1475166.
--- drivers/scsi/megaraid/megaraid_sas.h | 2 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas.h +2 -0
@@ -360,6 +360,8 @@ enum MR_EVT_ARGS { MR_EVT_ARGS_GENERIC, }; + +#define SGE_BUFFER_SIZE 4096/* * define constants for device list query options */
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
@@ -4661,7 +4661,7 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->crash_dump_buf =NULL ; } instance->max_sectors_per_req = instance->max_num_sge * -PAGE_SIZE /512 ; +SGE_BUFFER_SIZE /512 ;if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) instance->max_sectors_per_req = tmp_sectors;
Signature · 1 line
1.9.1
PATCH 67/164 KVM: s390: SCA must not cross page boundaries
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit c5c2c393468576bad6d10b2b5fefff8cd25df3f4 upstream.
We seemed to have missed a few corner cases in commit f6c137ff00a4 ("KVM: s390: randomize sca address").
The SCA has a maximum size of 2112 bytes. By setting the sca_offset to some unlucky numbers, we exceed the page.
0x7c0 (1984) -> Fits exactly0x7d0 (2000) -> 16 bytes out0x7e0 (2016) -> 32 bytes out0x7f0 (2032) -> 48 bytes out
One VCPU entry is 32 bytes long.
For the last two cases, we actually write data to the other page.
1. The address of the VCPU.
2. Injection/delivery/clearing of SIGP externall calls via SIGP IF.
Especially the 2. happens regularly. So this could produce two problems:
1. The guest losing/getting external calls.
2. Random memory overwrites in the host.
So this problem happens on every 127 + 128 created VM with 64 VCPUs.
--- arch/s390/kvm/kvm-s390.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +3 -1
@@ -443,7 +443,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)if (!kvm->arch.sca) goto out_err;spin_lock (&kvm_lock); - sca_offset = (sca_offset +16 ) &0x7f0 ; + sca_offset +=16 ; +if (sca_offset +sizeof (struct sca_block ) >PAGE_SIZE ) + sca_offset =0 ; kvm->arch.sca = (struct sca_block *) ((char *) kvm->arch.sca + sca_offset);spin_unlock (&kvm_lock);
Signature · 1 line
1.9.1
PATCH 68/164 arm64: Fix compat register mappings
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit 5accd17d0eb523350c9ef754d655e379c9bb93b3 upstream.
For reasons not entirely apparent, but now enshrined in history, the architectural mapping of AArch32 banked registers to AArch64 registers actually orders SP_<mode> and LR_<mode> backwards compared to the intuitive r13/r14 order, for all modes except FIQ.
Fix the compat_<reg>_<mode> macros accordingly, in the hope of avoiding subtle bugs with KVM and AArch32 guests.
--- arch/arm64/include/asm/ptrace.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/include/asm/ptrace.h +8 -8
@@ -76,14 +76,14 @@#define compat_sp regs[13]#define compat_lr regs[14]#define compat_sp_hyp regs[15] -#define compat_sp_irq regs[16] -#define compat_lr_irq regs[17] -#define compat_sp_svc regs[18] -#define compat_lr_svc regs[19] -#define compat_sp_abt regs[20] -#define compat_lr_abt regs[21] -#define compat_sp_und regs[22] -#define compat_lr_und regs[23] +#define compat_lr_irq regs[16] +#define compat_sp_irq regs[17] +#define compat_lr_svc regs[18] +#define compat_sp_svc regs[19] +#define compat_lr_abt regs[20] +#define compat_sp_abt regs[21] +#define compat_lr_und regs[22] +#define compat_sp_und regs[23]#define compat_r8_fiq regs[24]#define compat_r9_fiq regs[25]#define compat_r10_fiq regs[26]
Signature · 1 line
1.9.1
PATCH 69/164 can: Use correct type in sizeof() in nla_put()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 562b103a21974c2f9cd67514d110f918bb3e1796 upstream.
The sizeof() is invoked on an incorrect variable, likely due to some copy-paste error, and this might result in memory corruption. Fix this.
--- drivers/net/can/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev.c +1 -1
@@ -912,7 +912,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)nla_put (skb,IFLA_CAN_BITTIMING_CONST , sizeof(*priv->bittiming_const), priv->bittiming_const)) || -nla_put (skb,IFLA_CAN_CLOCK ,sizeof (cm), &priv->clock) || +nla_put (skb,IFLA_CAN_CLOCK ,sizeof (priv->clock), &priv->clock) ||nla_put_u32 (skb,IFLA_CAN_STATE , state) ||nla_put (skb,IFLA_CAN_CTRLMODE ,sizeof (cm), &cm) || nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||
Signature · 1 line
1.9.1
PATCH 70/164 mtd: blkdevs: fix potential deadlock + lockdep warnings
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit f3c63795e90f0c6238306883b6c72f14d5355721 upstream.
Commit 073db4a51ee4 ("mtd: fix: avoid race condition when accessing mtd->usecount") fixed a race condition but due to poor ordering of the mutex acquisition, introduced a potential deadlock.
The deadlock can occur, for example, when rmmod'ing the m25p80 module, which will delete one or more MTDs, along with any corresponding mtdblock devices. This could potentially race with an acquisition of the block device as follows.
-> blktrans_open()
-> mutex_lock(&dev->lock);
-> mutex_lock(&mtd_table_mutex); -> del_mtd_device()
-> mutex_lock(&mtd_table_mutex);
-> blktrans_notify_remove() -> del_mtd_blktrans_dev()
-> mutex_lock(&dev->lock);This is a classic (potential) ABBA deadlock, which can be fixed by making the A->B ordering consistent everywhere. There was no real purpose to the ordering in the original patch, AFAIR, so this shouldn't be a problem. This ordering was actually already present in del_mtd_blktrans_dev(), for one, where the function tried to ensure that its caller already held mtd_table_mutex before it acquired &dev->lock:
if (mutex_trylock(&mtd_table_mutex)) {
mutex_unlock(&mtd_table_mutex);
BUG();
}So, reverse the ordering of acquisition of &dev->lock and &mtd_table_mutex so we always acquire mtd_table_mutex first.
Snippets of the lockdep output follow:
# modprobe -r m25p80
[ 53.419251]
[ 53.420838] ======================================================
[ 53.427300] [ INFO: possible circular locking dependency detected ]
[ 53.433865] 4.3.0-rc6 #96 Not tainted
[ 53.437686] -------------------------------------------------------
[ 53.444220] modprobe/372 is trying to acquire lock:
[ 53.449320] (&new->lock){+.+...}, at: [<c043fe4c>] del_mtd_blktrans_dev+0x80/0xdc
[ 53.457271]
[ 53.457271] but task is already holding lock:
[ 53.463372] (mtd_table_mutex){+.+.+.}, at: [<c0439994>] del_mtd_device+0x18/0x100
[ 53.471321]
[ 53.471321] which lock already depends on the new lock.
[ 53.471321]
[ 53.479856]
[ 53.479856] the existing dependency chain (in reverse order) is:
[ 53.487660]
-> #1 (mtd_table_mutex){+.+.+.}:
[ 53.492331] [<c043fc5c>] blktrans_open+0x34/0x1a4
[ 53.497879] [<c01afce0>] __blkdev_get+0xc4/0x3b0
[ 53.503364] [<c01b0bb8>] blkdev_get+0x108/0x320
[ 53.508743] [<c01713c0>] do_dentry_open+0x218/0x314
[ 53.514496] [<c0180454>] path_openat+0x4c0/0xf9c
[ 53.519959] [<c0182044>] do_filp_open+0x5c/0xc0
[ 53.525336] [<c0172758>] do_sys_open+0xfc/0x1cc
[ 53.530716] [<c000f740>] ret_fast_syscall+0x0/0x1c
[ 53.536375]
-> #0 (&new->lock){+.+...}:
[ 53.540587] [<c063f124>] mutex_lock_nested+0x38/0x3cc
[ 53.546504] [<c043fe4c>] del_mtd_blktrans_dev+0x80/0xdc
[ 53.552606] [<c043f164>] blktrans_notify_remove+0x7c/0x84
[ 53.558891] [<c04399f0>] del_mtd_device+0x74/0x100
[ 53.564544] [<c043c670>] del_mtd_partitions+0x80/0xc8
[ 53.570451] [<c0439aa0>] mtd_device_unregister+0x24/0x48
[ 53.576637] [<c046ce6c>] spi_drv_remove+0x1c/0x34
[ 53.582207] [<c03de0f0>] __device_release_driver+0x88/0x114
[ 53.588663] [<c03de19c>] device_release_driver+0x20/0x2c
[ 53.594843] [<c03dd9e8>] bus_remove_device+0xd8/0x108
[ 53.600748] [<c03dacc0>] device_del+0x10c/0x210
[ 53.606127] [<c03dadd0>] device_unregister+0xc/0x20
[ 53.611849] [<c046d878>] __unregister+0x10/0x20
[ 53.617211] [<c03da868>] device_for_each_child+0x50/0x7c
[ 53.623387] [<c046eae8>] spi_unregister_master+0x58/0x8c
[ 53.629578] [<c03e12f0>] release_nodes+0x15c/0x1c8
[ 53.635223] [<c03de0f8>] __device_release_driver+0x90/0x114
[ 53.641689] [<c03de900>] driver_detach+0xb4/0xb8
[ 53.647147] [<c03ddc78>] bus_remove_driver+0x4c/0xa0
[ 53.652970] [<c00cab50>] SyS_delete_module+0x11c/0x1e4
[ 53.658976] [<c000f740>] ret_fast_syscall+0x0/0x1c
[ 53.664621]
[ 53.664621] other info that might help us debug this:
[ 53.664621]
[ 53.672979] Possible unsafe locking scenario:
[ 53.672979]
[ 53.679169] CPU0 CPU1
[ 53.683900] ---- ----
[ 53.688633] lock(mtd_table_mutex);
[ 53.692383] lock(&new->lock);
[ 53.698306] lock(mtd_table_mutex);
[ 53.704658] lock(&new->lock);
[ 53.707946]
[ 53.707946] *** DEADLOCK ***--- drivers/mtd/mtd_blkdevs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/mtd_blkdevs.c +5 -5
@@ -199,8 +199,8 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)if (!dev)return -ERESTARTSYS ;/* FIXME: busy loop! -arnd*/ -mutex_lock (&dev->lock);mutex_lock (&mtd_table_mutex); +mutex_lock (&dev->lock);if (dev->open) goto unlock;
@@ -224,8 +224,8 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) unlock: dev->open++; -mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock); +mutex_unlock (&mtd_table_mutex);blktrans_dev_put (dev);return ret;
@@ -235,8 +235,8 @@ error_release: error_put:module_put (dev->tr->owner);kref_put (&dev->ref, blktrans_dev_release); -mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock); +mutex_unlock (&mtd_table_mutex);blktrans_dev_put (dev);return ret; }
@@ -248,8 +248,8 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)if (!dev)return ; -mutex_lock (&dev->lock);mutex_lock (&mtd_table_mutex); +mutex_lock (&dev->lock);if (--dev->open) goto unlock;
@@ -263,8 +263,8 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)__put_mtd_device (dev->mtd); } unlock: -mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock); +mutex_unlock (&mtd_table_mutex);blktrans_dev_put (dev); }
Signature · 1 line
1.9.1
PATCH 71/164 Revert "dm mpath: fix stalls when handling invalid ioctls"
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauricio Faria de Oliveira <[email protected]>
commit 47796938c46b943d157ac8a6f9ed4e3b98b83cf4 upstream.
This reverts commit a1989b330093578ea5470bea0a00f940c444c466.
That commit introduced a regression at least for the case of the SG_IO ioctl() running without CAP_SYS_RAWIO capability (e.g., unprivileged users) when there are no active paths: the ioctl() fails with the ENOTTY errno immediately rather than blocking due to queue_if_no_path until a path becomes active, for example.
That case happens to be exercised by QEMU KVM guests with 'scsi-block' devices (qemu "-device scsi-block" [1], libvirt "<disk type='block' device='lun'>" [2]) from multipath devices; which leads to SCSI/filesystem errors in such a guest.
More general scenarios can hit that regression too. The following demonstration employs a SG_IO ioctl() with a standard SCSI INQUIRY command for this objective (some output & user changes omitted for brevity and comments added for clarity).
Reverting that commit restores normal operation (queueing) in failing scenarios; tested on linux-next (next-20151022).
1) Test-case is based on sg_simple0 [3] (just SG_IO; remove SG_GET_VERSION_NUM)
$ cat sg_simple0.c
... see [3] ...
$ sed '/SG_GET_VERSION_NUM/,/}/d' sg_simple0.c > sgio_inquiry.c
$ gcc sgio_inquiry.c -o sgio_inquiry2) The ioctl() works fine with active paths present.
# multipath -l 85ag56
85ag56 (...) dm-19 IBM ,2145
size=60G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| |- 8:0:11:0 sdz 65:144 active undef running
| `- 9:0:9:0 sdbf 67:144 active undef running
`-+- policy='service-time 0' prio=0 status=enabled
|- 8:0:12:0 sdae 65:224 active undef running
`- 9:0:12:0 sdbo 68:32 active undef running $ ./sgio_inquiry /dev/mapper/85ag56
Some of the INQUIRY command's response:
IBM 2145 0000
INQUIRY duration=0 millisecs, resid=03) The ioctl() fails with ENOTTY errno with _no_ active paths present, for unprivileged users (rather than blocking due to queue_if_no_path).
# for path in $(multipath -l 85ag56 | grep -o 'sd[a-z]\+'); \
do multipathd -k"fail path $path"; done # multipath -l 85ag56
85ag56 (...) dm-19 IBM ,2145
size=60G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=0 status=enabled
| |- 8:0:11:0 sdz 65:144 failed undef running
| `- 9:0:9:0 sdbf 67:144 failed undef running
`-+- policy='service-time 0' prio=0 status=enabled
|- 8:0:12:0 sdae 65:224 failed undef running
`- 9:0:12:0 sdbo 68:32 failed undef running $ ./sgio_inquiry /dev/mapper/85ag56
sg_simple0: Inquiry SG_IO ioctl error: Inappropriate ioctl for device4) dmesg shows that scsi_verify_blk_ioctl() failed for SG_IO (0x2285); it returns -ENOIOCTLCMD, later replaced with -ENOTTY in vfs_ioctl().
$ dmesg
<...>
[] device-mapper: multipath: Failing path 65:144.
[] device-mapper: multipath: Failing path 67:144.
[] device-mapper: multipath: Failing path 65:224.
[] device-mapper: multipath: Failing path 68:32.
[] sgio_inquiry: sending ioctl 2285 to a partition!5) The ioctl() only works if the SYS_CAP_RAWIO capability is present (then queueing happens -- in this example, queue_if_no_path is set); this is due to a conditional check in scsi_verify_blk_ioctl().
# capsh --drop=cap_sys_rawio -- -c './sgio_inquiry /dev/mapper/85ag56'
sg_simple0: Inquiry SG_IO ioctl error: Inappropriate ioctl for device # ./sgio_inquiry /dev/mapper/85ag56 &
[1] 72830 # cat /proc/72830/stack
[<c00000171c0df700>] 0xc00000171c0df700
[<c000000000015934>] __switch_to+0x204/0x350
[<c000000000152d4c>] msleep+0x5c/0x80
[<c00000000077dfb0>] dm_blk_ioctl+0x70/0x170
[<c000000000487c40>] blkdev_ioctl+0x2b0/0x9b0
[<c0000000003128e4>] block_ioctl+0x64/0xd0
[<c0000000002dd3b0>] do_vfs_ioctl+0x490/0x780
[<c0000000002dd774>] SyS_ioctl+0xd4/0xf0
[<c000000000009358>] system_call+0x38/0xd06) This is the function call chain exercised in this analysis:
SYSCALL_DEFINE3(ioctl, <...>) @ fs/ioctl.c
-> do_vfs_ioctl()
-> vfs_ioctl()
...
error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
...
-> dm_blk_ioctl() @ drivers/md/dm.c
-> multipath_ioctl() @ drivers/md/dm-mpath.c
...
(bdev = NULL, due to no active paths)
...
if (!bdev || <...>) {
int err = scsi_verify_blk_ioctl(NULL, cmd);
if (err)
r = err;
}
...
-> scsi_verify_blk_ioctl() @ block/scsi_ioctl.c
...
if (bd && bd == bd->bd_contains) // not taken (bd = NULL)
return 0;
...
if (capable(CAP_SYS_RAWIO)) // not taken (unprivileged user)
return 0;
...
printk_ratelimited(KERN_WARNING
"%s: sending ioctl %x to a partition!\n" <...>);
return -ENOIOCTLCMD;
<-
...
return r ? : <...>
<-
...
if (error == -ENOIOCTLCMD)
error = -ENOTTY;
out:
return error;
...Links:
[1] http://git.qemu.org/?p=qemu.git;a=commit;h=336a6915bc7089fb20fea4ba99972ad9a97c5f52
[2] https://libvirt.org/formatdomain.html#elementsDisks (see 'disk' -> 'device')
[3] http://tldp.org/HOWTO/SCSI-Generic-HOWTO/pexample.html (Revision 1.2, 2002-05-03)
--- drivers/md/dm-mpath.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/md/dm-mpath.c +2 -5
@@ -1545,11 +1545,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,/* * Only pass ioctls through if the device sizes match exactly. */ -if (!bdev || ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) { -int err =scsi_verify_blk_ioctl (NULL , cmd); -if (err) - r = err; - } +if (!r && ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) + r =scsi_verify_blk_ioctl (NULL , cmd);if (r == -ENOTCONN && !fatal_signal_pending (current)) {spin_lock_irqsave (&m->lock, flags);
Signature · 1 line
1.9.1
PATCH 72/164 drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015)
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 9be64eee3a87dc03218ca9a12834d1150a57b8a8 upstream.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=106671
--- drivers/gpu/drm/i915/intel_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -13033,6 +13033,9 @@ static struct intel_quirk intel_quirks[] = {/* Dell Chromebook 11 */ { 0x0a06, 0x1028, 0x0a35, quirk_backlight_present }, + +/* Dell Chromebook 11 (2015 version) */ + { 0x0a16, 0x1028, 0x0a35, quirk_backlight_present }, };static void intel_init_quirks (struct drm_device *dev)
Signature · 1 line
1.9.1
PATCH 73/164 crypto: algif_hash - Only export and import on sockets with data
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 4afa5f9617927453ac04b24b584f6c718dfb4f45 upstream.
The hash_accept call fails to work on sockets that have not received any data. For some algorithm implementations it may cause crashes.
This patch fixes this by ensuring that we only export and import on sockets that have received data.
--- crypto/algif_hash.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
crypto/algif_hash.c +10 -2
@@ -192,9 +192,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)struct sock *sk2;struct alg_sock *ask2;struct hash_ctx *ctx2; +bool more;int err; - err =crypto_ahash_export (req, state); +lock_sock (sk); + more = ctx->more; + err = more ?crypto_ahash_export (req, state) :0 ; +release_sock (sk); +if (err)return err;
@@ -205,7 +210,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) sk2 = newsock->sk; ask2 =alg_sk (sk2); ctx2 = ask2->private; - ctx2->more =1 ; + ctx2->more = more; + +if (!more) +return err; err =crypto_ahash_import (&ctx2->req, state);if (err) {
Signature · 1 line
1.9.1
PATCH 74/164 xtensa: fixes for configs without loop option
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 5029615e25dc5040beb065f36743c127a8e51497 upstream.
Build-time fixes:
- make lbeg/lend/lcount save/restore conditional on kernel entry;
- don't clear lcount in platform_restart functions unconditionally.
Run-time fixes:
- use correct end of range register in __endla paired with __loopt, not the unused temporary register. This fixes .bss zero-initialization. Update comments in asmmacro.h;
- don't clobber a10 in the usercopy that leads to access to unmapped memory.
--- arch/xtensa/include/asm/asmmacro.h | 7 ++++--- arch/xtensa/kernel/entry.S | 8 ++++++-- arch/xtensa/kernel/head.S | 2 +- arch/xtensa/lib/usercopy.S | 6 +++--- arch/xtensa/platforms/iss/setup.c | 2 ++ arch/xtensa/platforms/xt2000/setup.c | 2 ++ arch/xtensa/platforms/xtfpga/setup.c | 2 ++ 7 files changed, 20 insertions(+), 9 deletions(-)
arch/xtensa/include/asm/asmmacro.h +4 -3
@@ -35,9 +35,10 @@* __loop as * restart loop. 'as' register must not have been modified! * -* __endla ar, at, incr +* __endla ar, as, incr * ar start address (modified) -* as scratch register used by macro +* as scratch register used by __loops/__loopi macros or +* end address used by __loopt macro * inc increment */
@@ -97,7 +98,7 @@ .endm /* - * loop from ar to ax + * loop from ar to as */ .macro __loopt ar, as, at, incr_log2
arch/xtensa/kernel/entry.S +6 -2
@@ -335,8 +335,10 @@ common_exception: s32i a2, a1, PT_SYSCALL movi a2, 0 s32i a3, a1, PT_EXCVADDR +#if XCHAL_HAVE_LOOPS xsr a2, lcount s32i a2, a1, PT_LCOUNT +#endif /* It is now save to restore the EXC_TABLE_FIXUP variable. */
@@ -368,11 +370,12 @@ common_exception: s32i a3, a1, PT_PS # save ps /* Save lbeg, lend */ - +#if XCHAL_HAVE_LOOPS rsr a2, lbeg rsr a3, lend s32i a2, a1, PT_LBEG s32i a3, a1, PT_LEND +#endif /* Save SCOMPARE1 */
@@ -664,13 +667,14 @@ common_exception_exit: wsr a3, sar /* Restore LBEG, LEND, LCOUNT */ - +#if XCHAL_HAVE_LOOPS l32i a2, a1, PT_LBEG l32i a3, a1, PT_LEND wsr a2, lbeg l32i a2, a1, PT_LCOUNT wsr a3, lend wsr a2, lcount +#endif /* We control single stepping through the ICOUNTLEVEL register. */
arch/xtensa/kernel/head.S +1 -1
@@ -249,7 +249,7 @@ ENTRY(_startup) __loopt a2, a3, a4, 2 s32i a0, a2, 0 - __endla a2, a4, 4 + __endla a2, a3, 4 #if XCHAL_DCACHE_IS_WRITEBACK
arch/xtensa/lib/usercopy.S +3 -3
@@ -222,8 +222,8 @@ __xtensa_copy_user: loopnez a7, .Loop2done #else /* !XCHAL_HAVE_LOOPS */ beqz a7, .Loop2done - slli a10, a7, 4 - add a10, a10, a3 # a10 = end of last 16B source chunk + slli a12, a7, 4 + add a12, a12, a3 # a12 = end of last 16B source chunk #endif /* !XCHAL_HAVE_LOOPS */ .Loop2: EX(l32i, a7, a3, 4, l_fixup)
@@ -241,7 +241,7 @@ __xtensa_copy_user: EX(s32i, a9, a5, 12, s_fixup) addi a5, a5, 16 #if !XCHAL_HAVE_LOOPS - blt a3, a10, .Loop2 + blt a3, a12, .Loop2 #endif /* !XCHAL_HAVE_LOOPS */ .Loop2done: bbci.l a4, 3, .L12
arch/xtensa/platforms/iss/setup.c +2 -0
@@ -61,7 +61,9 @@ void platform_restart(void)#if XCHAL_NUM_IBREAK >0 "wsr a2, ibreakenable\n\t"#endif +#if XCHAL_HAVE_LOOPS "wsr a2, lcount\n\t" +#endif "movi a2, 0x1f\n\t" "wsr a2, ps\n\t" "isync\n\t"
arch/xtensa/platforms/xt2000/setup.c +2 -0
@@ -72,7 +72,9 @@ void platform_restart(void)#if XCHAL_NUM_IBREAK >0 "wsr a2, ibreakenable\n\t"#endif +#if XCHAL_HAVE_LOOPS "wsr a2, lcount\n\t" +#endif "movi a2, 0x1f\n\t" "wsr a2, ps\n\t" "isync\n\t"
arch/xtensa/platforms/xtfpga/setup.c +2 -0
@@ -63,7 +63,9 @@ void platform_restart(void)#if XCHAL_NUM_IBREAK >0 "wsr a2, ibreakenable\n\t"#endif +#if XCHAL_HAVE_LOOPS "wsr a2, lcount\n\t" +#endif "movi a2, 0x1f\n\t" "wsr a2, ps\n\t" "isync\n\t"
Signature · 1 line
1.9.1
PATCH 75/164 PCI: spear: Fix dw_pcie_cfg_read/write() usage
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Paoloni <[email protected]>
commit fa3b7cbab548b15da438b0cc13aa515f7f291f4d upstream.
The first argument of dw_pcie_cfg_read/write() is a 32-bit aligned address. The second argument is the byte offset into a 32-bit word, and dw_pcie_cfg_read/write() only look at the low two bits.
SPEAr13xx used dw_pcie_cfg_read() and dw_pcie_cfg_write() incorrectly: it passed important address bits in the second argument, where they were ignored.
Pass the complete 32-bit word address in the first argument and only the 2-bit offset into that word in the second argument.
Without this fix, SPEAr13xx host will never work with few buggy gen1 card which connects with only gen1 host and also with any endpoint which would generate a read request of more than 128 bytes.
--- drivers/pci/host/pcie-spear13xx.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/pci/host/pcie-spear13xx.c +14 -12
@@ -163,34 +163,36 @@ static int spear13xx_pcie_establish_link(struct pcie_port *pp)* default value in capability register is 512 bytes. So force * it to 128 here. */ -dw_pcie_cfg_read (pp->dbi_base, exp_cap_off +PCI_EXP_DEVCTL ,4 , &val); +dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL , +0 ,2 , &val); val &= ~PCI_EXP_DEVCTL_READRQ ; -dw_pcie_cfg_write (pp->dbi_base, exp_cap_off +PCI_EXP_DEVCTL ,4 , val); +dw_pcie_cfg_write (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL , +0 ,2 , val); -dw_pcie_cfg_write (pp->dbi_base,PCI_VENDOR_ID ,2 ,0x104A ); -dw_pcie_cfg_write (pp->dbi_base,PCI_DEVICE_ID ,2 ,0xCD80 ); +dw_pcie_cfg_write (pp->dbi_base +PCI_VENDOR_ID ,0 ,2 ,0x104A ); +dw_pcie_cfg_write (pp->dbi_base +PCI_VENDOR_ID ,2 ,2 ,0xCD80 );/* * if is_gen1 is set then handle it, so that some buggy card * also works */ if (spear13xx_pcie->is_gen1) { -dw_pcie_cfg_read (pp->dbi_base, exp_cap_off +PCI_EXP_LNKCAP ,4 , - &val); +dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +0 ,4 , &val);if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base, exp_cap_off + -PCI_EXP_LNKCAP ,4 , val); +dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCAP ,0 ,4 , val); } -dw_pcie_cfg_read (pp->dbi_base, exp_cap_off +PCI_EXP_LNKCTL2 ,4 , - &val); +dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +0 ,2 , &val);if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base, exp_cap_off + -PCI_EXP_LNKCTL2 ,4 , val); +dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCTL2 ,0 ,2 , val); } }
Signature · 1 line
1.9.1
PATCH 76/164 megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 323c4a02c631d00851d8edc4213c4d184ef83647 upstream.
This is an issue on SMAP enabled CPUs and 32 bit apps running on 64 bit OS. Do not access user memory from kernel code. The SMAP bit restricts accessing user memory from kernel code.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +11 -2
@@ -6382,6 +6382,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)int i;int error =0 ;compat_uptr_t ptr; +unsigned long local_raw_ptr; +u32 local_sense_off; +u32 local_sense_len;if (clear_user (ioc,sizeof (*ioc)))return -EFAULT ;
@@ -6399,9 +6402,15 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)* sense_len is not null, so prepare the 64bit value under * the same condition. */ -if (ioc->sense_len) { +if (get_user (local_raw_ptr, ioc->frame.raw) || +get_user (local_sense_off, &ioc->sense_off) || +get_user (local_sense_len, &ioc->sense_len)) +return -EFAULT ; + + +if (local_sense_len) {void __user **sense_ioc_ptr = - (void __user **)(ioc->frame.raw + ioc->sense_off); + (void __user **)((u8 *)local_raw_ptr + local_sense_off);compat_uptr_t *sense_cioc_ptr = (compat_uptr_t *)(cioc->frame.raw + cioc->sense_off); if (get_user(ptr, sense_cioc_ptr) ||
Signature · 1 line
1.9.1
PATCH 77/164 mac80211: fix divide by zero when NOA update
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 519ee6918b91abdc4bc9720deae17599a109eb40 upstream.
In case of one shot NOA the interval can be 0, catch that instead of potentially (depending on the driver) crashing like this:
divide error: 0000 [#1] SMP
[...]
Call Trace: <IRQ> [<ffffffffc08e891c>] ieee80211_extend_absent_time+0x6c/0xb0 [mac80211] [<ffffffffc08e8a17>] ieee80211_update_p2p_noa+0xb7/0xe0 [mac80211] [<ffffffffc069cc30>] ath9k_p2p_ps_timer+0x170/0x190 [ath9k] [<ffffffffc070adf8>] ath_gen_timer_isr+0xc8/0xf0 [ath9k_hw] [<ffffffffc0691156>] ath9k_tasklet+0x296/0x2f0 [ath9k] [<ffffffff8107ad65>] tasklet_action+0xe5/0xf0
[...]
--- net/mac80211/util.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/mac80211/util.c +7 -0
@@ -2891,6 +2891,13 @@ ieee80211_extend_noa_desc(struct ieee80211_noa_data *data, u32 tsf, int i)if (end >0 )return false; +/* One shot NOA */ +if (data->count[i] ==1 ) +return false; + +if (data->desc[i].interval ==0 ) +return false; +/* End time is in the past, check for repetitions */ skip =DIV_ROUND_UP (-end, data->desc[i].interval);if (data->count[i] <255 ) {
Signature · 1 line
1.9.1
PATCH 78/164 nl80211: Fix potential memory leak from parse_acl_data
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ola Olsson <[email protected]>
commit 4baf6bea37247e59f1971e8009d13aeda95edba2 upstream.
If parse_acl_data succeeds but the subsequent parsing of smps attributes fails, there will be a memory leak due to early returns. Fix that by moving the ACL parsing later.
--- net/wireless/nl80211.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/wireless/nl80211.c +6 -6
@@ -3388,12 +3388,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) wdev->iftype))return -EINVAL ; -if (info->attrs[NL80211_ATTR_ACL_POLICY ]) { - params.acl =parse_acl_data (&rdev->wiphy, info); -if (IS_ERR (params.acl)) -return PTR_ERR (params.acl); - } -if (info->attrs[NL80211_ATTR_SMPS_MODE ]) { params.smps_mode =nla_get_u8 (info->attrs[NL80211_ATTR_SMPS_MODE ]);
@@ -3417,6 +3411,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) params.smps_mode =NL80211_SMPS_OFF ; } +if (info->attrs[NL80211_ATTR_ACL_POLICY ]) { + params.acl =parse_acl_data (&rdev->wiphy, info); +if (IS_ERR (params.acl)) +return PTR_ERR (params.acl); + } +wdev_lock (wdev); err =rdev_start_ap (rdev, dev, ¶ms);if (!err) {
Signature · 1 line
1.9.1
PATCH 79/164 mac80211: allow null chandef in tracing
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Arik Nemtsov <[email protected]>
commit 254d3dfe445f94a764e399ca12e04365ac9413ed upstream.
In TDLS channel-switch operations the chandef can sometimes be NULL. Avoid an oops in the trace code for these cases and just print a chandef full of zeros.
--- net/mac80211/trace.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/mac80211/trace.h +5 -5
@@ -33,11 +33,11 @@ __field(u32, chan_width) \ __field(u32, center_freq1) \ __field(u32, center_freq2) -#define CHANDEF_ASSIGN (c) \ - __entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0; \ - __entry->chan_width = (c)->width; \ - __entry->center_freq1 = (c)->center_freq1; \ - __entry->center_freq2 = (c)->center_freq2; +#define CHANDEF_ASSIGN (c) \ + __entry->control_freq = (c) ? ((c)->chan ? (c)->chan->center_freq : 0) : 0; \ + __entry->chan_width = (c) ? (c)->width : 0; \ + __entry->center_freq1 = (c) ? (c)->center_freq1 : 0; \ + __entry->center_freq2 = (c) ? (c)->center_freq2 : 0;#define CHANDEF_PR_FMT " control:%d MHz width:%d center: %d/%d MHz"#define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \ __entry->center_freq1, __entry->center_freq2
Signature · 1 line
1.9.1
PATCH 80/164 xtensa: fix secondary core boot in SMP
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit ab45fb145096799dabd18afc58bb5f97171017cd upstream.
There are multiple factors adding to the issue in different configurations:
- commit 17290231df16eeee ("xtensa: add fixup for double exception raised in window overflow") added function window_overflow_restore_a0_fixup to double exception vector overlapping reset vector location of secondary processor cores.
- on MMUv2 cores RESET_VECTOR1_VADDR may point to uncached kernel memory making code overlapping depend on cache type and size, so that without cache or with WT cache reset vector code overwrites double exception code, making issue even harder to detect.
- on MMUv3 cores RESET_VECTOR1_VADDR may point to unmapped area, as MMUv3 cores change virtual address map to match MMUv2 layout, but reset vector virtual address is given for the original MMUv3 mapping.
- physical memory region of the secondary reset vector is not reserved in the physical memory map, and thus may be allocated and overwritten at arbitrary moment.
Fix it as follows:
- move window_overflow_restore_a0_fixup code to .text section.
- define RESET_VECTOR1_VADDR so that it points to reset vector in the cacheable MMUv2 map for cores with MMU.
- reserve reset vector region in the physical memory map. Drop separate literal section and build mxhead.S with text section literals.
--- arch/xtensa/include/asm/vectors.h | 9 +++++---- arch/xtensa/kernel/Makefile | 1 + arch/xtensa/kernel/setup.c | 9 ++++++++- arch/xtensa/kernel/vectors.S | 4 +++- arch/xtensa/kernel/vmlinux.lds.S | 12 ++---------- 5 files changed, 19 insertions(+), 16 deletions(-)
arch/xtensa/include/asm/vectors.h +5 -4
@@ -48,6 +48,9 @@#define LOAD_MEMORY_ADDRESS 0xD0003000#endif +#define RESET_VECTOR1_VADDR (VIRTUAL_MEMORY_ADDRESS + \ + XCHAL_RESET_VECTOR1_PADDR) +#else /* !defined(CONFIG_MMU) */ /* MMU Not being used - Virtual == Physical */
@@ -60,6 +63,8 @@/* Loaded just above possibly live vectors */ #define LOAD_MEMORY_ADDRESS (PLATFORM_DEFAULT_MEM_START + 0x3000) +#define RESET_VECTOR1_VADDR (XCHAL_RESET_VECTOR1_VADDR) +#endif /* CONFIG_MMU */ #define XC_VADDR (offset) (VIRTUAL_MEMORY_ADDRESS + offset)
@@ -71,10 +76,6 @@ VECBASE_RESET_VADDR)#define RESET_VECTOR_VADDR XC_VADDR(RESET_VECTOR_VECOFS) -#define RESET_VECTOR1_VECOFS (XCHAL_RESET_VECTOR1_VADDR - \ - VECBASE_RESET_VADDR) -#define RESET_VECTOR1_VADDR XC_VADDR(RESET_VECTOR1_VECOFS) -#if defined(XCHAL_HAVE_VECBASE ) &&XCHAL_HAVE_VECBASE #define USER_VECTOR_VADDR XC_VADDR(XCHAL_USER_VECOFS)
arch/xtensa/kernel/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_FUNCTION_TRACER) += mcount.o obj-$(CONFIG_SMP) += smp.o mxhead.o AFLAGS_head.o += -mtext-section-literals +AFLAGS_mxhead.o += -mtext-section-literals # In the Xtensa architecture, assembly generates literals which must always # precede the L32R instruction with a relative offset less than 256 kB.
arch/xtensa/kernel/setup.c +8 -1
@@ -334,7 +334,10 @@ extern char _Level5InterruptVector_text_end;extern char _Level6InterruptVector_text_start;extern char _Level6InterruptVector_text_end;#endif - +#ifdef CONFIG_SMP +extern char _SecondaryResetVector_text_start; +extern char _SecondaryResetVector_text_end; +#endif #ifdef CONFIG_S32C1I_SELFTEST
@@ -506,6 +509,10 @@ void __init setup_arch(char **cmdline_p) __pa(&_Level6InterruptVector_text_end), 0);#endif +#ifdef CONFIG_SMP +mem_reserve (__pa (&_SecondaryResetVector_text_start), +__pa (&_SecondaryResetVector_text_end),0 ); +#endif parse_early_param ();bootmem_init ();
arch/xtensa/kernel/vectors.S +3 -1
@@ -478,6 +478,9 @@ _DoubleExceptionVector_handle_exception: ENDPROC(_DoubleExceptionVector) + .end literal_prefix + + .text /* * Fixup handler for TLB miss in double exception handler for window owerflow. * We get here with windowbase set to the window that was being spilled and
@@ -587,7 +590,6 @@ ENTRY(window_overflow_restore_a0_fixup) ENDPROC(window_overflow_restore_a0_fixup) - .end literal_prefix /* * Debug interrupt vector *
arch/xtensa/kernel/vmlinux.lds.S +2 -10
@@ -166,8 +166,6 @@ SECTIONS RELOCATE_ENTRY(_DebugInterruptVector_text, .DebugInterruptVector.text); #if defined(CONFIG_SMP) - RELOCATE_ENTRY(_SecondaryResetVector_literal, - .SecondaryResetVector.literal); RELOCATE_ENTRY(_SecondaryResetVector_text, .SecondaryResetVector.text); #endif
@@ -282,17 +280,11 @@ SECTIONS #if defined(CONFIG_SMP) - SECTION_VECTOR (_SecondaryResetVector_literal, - .SecondaryResetVector.literal, - RESET_VECTOR1_VADDR - 4, - SIZEOF(.DoubleExceptionVector.text), - .DoubleExceptionVector.text) - SECTION_VECTOR (_SecondaryResetVector_text, .SecondaryResetVector.text, RESET_VECTOR1_VADDR, - 4, - .SecondaryResetVector.literal) + SIZEOF(.DoubleExceptionVector.text), + .DoubleExceptionVector.text) . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
Signature · 1 line
1.9.1
PATCH 81/164 recordmcount: Fix endianness handling bug for nop_mcount
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: libin <[email protected]>
commit c84da8b9ad3761eef43811181c7e896e9834b26b upstream.
In nop_mcount, shdr->sh_offset and welp->r_offset should handle endianness properly, otherwise it will trigger Segmentation fault if the recordmcount main and file.o have different endianness.
--- scripts/recordmcount.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/recordmcount.h +1 -1
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,if (mcountsym ==Elf_r_sym (relp) && !is_fake_mcount (relp)) {if (make_nop) - ret =make_nop ((void *)ehdr, shdr->sh_offset + relp->r_offset); + ret =make_nop ((void *)ehdr,_w (shdr->sh_offset) +_w (relp->r_offset));if (warn_on_notrace_sect && !once) {printf ("Section %s has mcount callers being ignored\n" , txtname);
Signature · 1 line
1.9.1
PATCH 82/164 recordmcount: arm64: Replace the ignored mcount call into nop
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Bin <[email protected]>
commit 2ee8a74f2a5da913637f75a19a0da0e7a08c0f86 upstream.
By now, the recordmcount only records the function that in following sections:
.text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/ .kprobes.text/.text.unlikely
For the function that not in these sections, the call mcount will be in place and not be replaced when kernel boot up. And it will bring performance overhead, such as do_mem_abort (in .exception.text section). This patch make the call mcount to nop for this case in recordmcount.
--- scripts/recordmcount.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
scripts/recordmcount.c +23 -1
@@ -42,6 +42,7 @@#ifndef EM_AARCH64 #define EM_AARCH64 183 +#define R_AARCH64_NONE 0#define R_AARCH64_ABS64 257#endif
@@ -160,6 +161,22 @@ static int make_nop_x86(void *map, size_t const offset)return 0 ; } +static unsigned char ideal_nop4_arm64[4 ] = {0x1f ,0x20 ,0x03 ,0xd5 }; +static int make_nop_arm64 (void *map,size_t const offset) +{ +uint32_t *ptr; + + ptr = map + offset; +/* bl <_mcount> is 0x94000000 before relocation */ +if (*ptr !=0x94000000 ) +return -1 ; + +/* Convert to nop */ +ulseek (fd_map, offset,SEEK_SET ); +uwrite (fd_map, ideal_nop,4 ); +return 0 ; +} +/* * Get the whole file as a programming convenience in order to avoid * malloc+lseek+read+free of many pieces. If successful, then mmap
@@ -353,7 +370,12 @@ do_file(char const *const fname) altmcount ="__gnu_mcount_nc" ;break ;case EM_AARCH64 : - reltype =R_AARCH64_ABS64 ; gpfx ='_' ;break ; + reltype =R_AARCH64_ABS64 ; + make_nop = make_nop_arm64; + rel_type_nop =R_AARCH64_NONE ; + ideal_nop = ideal_nop4_arm64; + gpfx ='_' ; +break ;case EM_IA_64 : reltype =R_IA64_IMM64 ; gpfx ='_' ;break ;case EM_METAG : reltype =R_METAG_ADDR32 ; altmcount ="_mcount_wrapper" ;
Signature · 1 line
1.9.1
PATCH 83/164 KVM: VMX: fix SMEP and SMAP without EPT
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
commit 656ec4a4928a3db7d16e5cb9bce351a478cfd3d5 upstream.
The comment in code had it mostly right, but we enable paging for emulated real mode regardless of EPT.
Without EPT (which implies emulated real mode), secondary VCPUs won't start unless we disable SM[AE]P when the guest doesn't use paging.
--- arch/x86/kvm/vmx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
arch/x86/kvm/vmx.c +10 -9
@@ -3553,20 +3553,21 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)if (!is_paging (vcpu)) { hw_cr4 &= ~X86_CR4_PAE ; hw_cr4 |=X86_CR4_PSE ; -/* -* SMEP/SMAP is disabled if CPU is in non-paging mode -* in hardware. However KVM always uses paging mode to -* emulate guest non-paging mode with TDP. -* To emulate this behavior, SMEP/SMAP needs to be -* manually disabled when guest switches to non-paging -* mode. -*/ - hw_cr4 &= ~(X86_CR4_SMEP |X86_CR4_SMAP ); }else if (!(cr4 &X86_CR4_PAE )) { hw_cr4 &= ~X86_CR4_PAE ; } } +if (!enable_unrestricted_guest && !is_paging (vcpu)) +/* +* SMEP/SMAP is disabled if CPU is in non-paging mode in +* hardware. However KVM always uses paging mode without +* unrestricted guest. +* To emulate this behavior, SMEP/SMAP needs to be manually +* disabled when guest switches to non-paging mode. +*/ + hw_cr4 &= ~(X86_CR4_SMEP |X86_CR4_SMAP ); +vmcs_writel (CR4_READ_SHADOW , cr4);vmcs_writel (GUEST_CR4 , hw_cr4);return 0 ;
Signature · 1 line
1.9.1
PATCH 84/164 thermal: exynos: Fix unbalanced regulator disable on probe failure
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.
During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable.
The patch moves code for getting and enabling the regulator from exynos_map_dt_data() to probe function because it is really not a part of getting Device Tree properties.
--- drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/thermal/samsung/exynos_tmu.c +16 -17
@@ -729,27 +729,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)struct exynos_tmu_data *data =platform_get_drvdata (pdev);struct exynos_tmu_platform_data *pdata;struct resource res; -int ret;if (!data || !pdev->dev.of_node)return -ENODEV ; -/* -* Try enabling the regulator if found -* TODO: Add regulator as an SOC feature, so that regulator enable -* is a compulsory call. -*/ - data->regulator =devm_regulator_get (&pdev->dev,"vtmu" ); -if (!IS_ERR (data->regulator)) { - ret =regulator_enable (data->regulator); -if (ret) { -dev_err (&pdev->dev,"failed to enable vtmu\n" ); -return ret; - } - }else { -dev_info (&pdev->dev,"Regulator node (vtmu) not found\n" ); - } - data->id =of_alias_get_id (pdev->dev.of_node,"tmuctrl" );if (data->id <0 ) data->id =0 ;
@@ -849,6 +832,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)platform_set_drvdata (pdev, data);mutex_init (&data->lock); +/* +* Try enabling the regulator if found +* TODO: Add regulator as an SOC feature, so that regulator enable +* is a compulsory call. +*/ + data->regulator =devm_regulator_get (&pdev->dev,"vtmu" ); +if (!IS_ERR (data->regulator)) { + ret =regulator_enable (data->regulator); +if (ret) { +dev_err (&pdev->dev,"failed to enable vtmu\n" ); +return ret; + } + }else { +dev_info (&pdev->dev,"Regulator node (vtmu) not found\n" ); + } + ret =exynos_map_dt_data (pdev);if (ret)return ret;
Signature · 1 line
1.9.1
Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
Quoted 23 lines
3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit
824ead03b78403a21449cb7eb153a4344cd3b4c8upstream.During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable.
The patch moves code for getting and enabling the regulator from
exynos_map_dt_data()to probe function because it is really not a part of getting Device Tree properties.Acked-by Lukasz Majewski <[email protected]>Tested-by Lukasz Majewski <[email protected]>Reviewed-by Alim Akhtar <[email protected]>Signed-off-by Krzysztof Kozlowski <[email protected]>Fixes 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")Signed-off-by Eduardo Valentin <[email protected]>Signed-off-by Kamal Mostafa <[email protected]>
Quoted 3 lines
--- drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
This patch shouldn't be backported before 4.2. It fixes a bug introduced in 4.2: 5f09a5cbd14a.
For kernels <4.2 this bug does not exist but fortunately the patch looks harmless. Anyway I think that still it shouldn't be ported for <4.2.
Best regards,
Krzysztof
Quoted 57 lines
drivers/thermal/samsung/exynos_tmu.c +16
-17@@ -729,27 +729,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)struct exynos_tmu_data *data =platform_get_drvdata (pdev);struct exynos_tmu_platform_data *pdata;struct resource res; -int ret;if (!data || !pdev->dev.of_node)return -ENODEV ; -/* -* Try enabling the regulator if found -* TODO: Add regulator as an SOC feature, so that regulator enable -* is a compulsory call. -*/ - data->regulator =devm_regulator_get (&pdev->dev,"vtmu" ); -if (!IS_ERR (data->regulator)) { - ret =regulator_enable (data->regulator); -if (ret) { -dev_err (&pdev->dev,"failed to enable vtmu\n" ); -return ret; - } - }else { -dev_info (&pdev->dev,"Regulator node (vtmu) not found\n" ); - } - data->id =of_alias_get_id (pdev->dev.of_node,"tmuctrl" );if (data->id <0 ) data->id =0 ;@@ -849,6 +832,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)platform_set_drvdata (pdev, data);mutex_init (&data->lock); +/* +* Try enabling the regulator if found +* TODO: Add regulator as an SOC feature, so that regulator enable +* is a compulsory call. +*/ + data->regulator =devm_regulator_get (&pdev->dev,"vtmu" ); +if (!IS_ERR (data->regulator)) { + ret =regulator_enable (data->regulator); +if (ret) { +dev_err (&pdev->dev,"failed to enable vtmu\n" ); +return ret; + } + }else { +dev_info (&pdev->dev,"Regulator node (vtmu) not found\n" ); + } + ret =exynos_map_dt_data (pdev);if (ret)return ret;
Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
Quoted 28 lines · Krzysztof Kozlowski
W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
Quoted 23 lines
3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit
824ead03b78403a21449cb7eb153a4344cd3b4c8upstream.During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable.
The patch moves code for getting and enabling the regulator from
exynos_map_dt_data()to probe function because it is really not a part of getting Device Tree properties.Acked-by Lukasz Majewski <[email protected]>Tested-by Lukasz Majewski <[email protected]>Reviewed-by Alim Akhtar <[email protected]>Signed-off-by Krzysztof Kozlowski <[email protected]>Fixes 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")Signed-off-by Eduardo Valentin <[email protected]>Signed-off-by Kamal Mostafa <[email protected]>Quoted 3 lines
--- drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
Quoted 9 lines
This patch shouldn't be backported before 4.2. It fixes a bug introduced in 4.2:
5f09a5cbd14a.For kernels <4.2 this bug does not exist but fortunately the patch looks harmless. Anyway I think that still it shouldn't be ported for <4.2.
Best regards,
Krzysztof
Sorry for the noise, I was wrong. Luis pointed out that the 5f09a5cbd14a was itself backported to 3.19 so this applies to backporting as well.
No objections from my side.
Best regards,
Krzysztof
Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
Quoted 35 lines · Krzysztof Kozlowski
Quoted 34 lines · Krzysztof Kozlowski
W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
Quoted 23 lines
3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit
824ead03b78403a21449cb7eb153a4344cd3b4c8upstream.During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable.
The patch moves code for getting and enabling the regulator from
exynos_map_dt_data()to probe function because it is really not a part of getting Device Tree properties.Acked-by Lukasz Majewski <[email protected]>Tested-by Lukasz Majewski <[email protected]>Reviewed-by Alim Akhtar <[email protected]>Signed-off-by Krzysztof Kozlowski <[email protected]>Fixes 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")Signed-off-by Eduardo Valentin <[email protected]>Signed-off-by Kamal Mostafa <[email protected]>Quoted 3 lines
--- drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)This patch shouldn't be backported before 4.2. It fixes a bug introduced in 4.2:
5f09a5cbd14a.For kernels <4.2 this bug does not exist but fortunately the patch looks harmless. Anyway I think that still it shouldn't be ported for <4.2.
Quoted 6 lines
Quoted 3 lines
Best regards,
KrzysztofSorry for the noise, I was wrong. Luis pointed out that the
5f09a5cbd14awas itself backported to 3.19 so this applies to backporting as well.
No worries. Thanks for reviewing this, Krzysztof.
-Kamal
Quoted 5 lines
No objections from my side.
Best regards,
Krzysztof
PATCH 85/164 ALSA: hda - Apply pin fixup for HP ProBook 6550b
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit c932b98c1e47312822d911c1bb76e81ef50e389c upstream.
HP ProBook 6550b needs the same pin fixup applied to other HP B-series laptops with docks for making its headphone and dock headphone jacks working properly. We just need to add the codec SSID to the list.
Bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=191971
--- sound/pci/hda/patch_sigmatel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_sigmatel.c +1 -0
@@ -700,6 +700,7 @@ static bool hp_bnb2011_with_dock(struct hda_codec *codec)static bool hp_blike_system (u32 subsystem_id) {switch (subsystem_id) { +case 0x103c1473 :/* HP ProBook 6550b */ case 0x103c1520 :case 0x103c1521 :case 0x103c1523 :
Signature · 1 line
1.9.1
PATCH 86/164 ALSA: hda - Add Intel Lewisburg device IDs Audio
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Yates <[email protected]>
commit 5cf92c8b3dc5da59e05dc81bdc069cedf6f38313 upstream.
Adding Intel codename Lewisburg platform device IDs for audio.
[rearranged the position by tiwai]
--- sound/pci/hda/hda_intel.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/hda_intel.c +5 -0
@@ -2017,6 +2017,11 @@ static const struct pci_device_id azx_ids[] = { .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, { PCI_DEVICE(0x8086, 0x8d21), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + /* Lewisburg */ + { PCI_DEVICE(0x8086, 0xa1f0), + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + { PCI_DEVICE(0x8086, 0xa270), + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, /* Lynx Point-LP */ { PCI_DEVICE(0x8086, 0x9c20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
Signature · 1 line
1.9.1
PATCH 87/164 firewire: ohci: fix JMicron JMB38x IT context discovery
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Richter <[email protected]>
commit 100ceb66d5c40cc0c7018e06a9474302470be73c upstream.
Reported by Clifford and Craig for JMicron OHCI-1394 + SDHCI combo
controllers: Often or even most of the time, the controller is initialized with the message "added OHCI v1.10 device as card 0, 4 IR + 0 IT contexts, quirks 0x10". With 0 isochronous transmit DMA contexts (IT contexts), applications like audio output are impossible.
However, OHCI-1394 demands that at least 4 IT contexts are implemented by the link layer controller, and indeed JMicron JMB38x do implement four of them. Only their IsoXmitIntMask register is unreliable at early access.
With my own JMB381 single function controller I found:
- I can reproduce the problem with a lower probability than Craig's.
- If I put a loop around the section which clears and reads IsoXmitIntMask, then either the first or the second attempt will return the correct initial mask of 0x0000000f. I never encountered a case of needing more than a second attempt.
- Consequently, if I put a dummy reg_read(...IsoXmitIntMaskSet) before the first write, the subsequent read will return the correct result.
- If I merely ignore a wrong read result and force the known real result, later isochronous transmit DMA usage works just fine.
So let's just fix this chip bug up by the latter method. Tested with JMB381 on kernel 3.13 and 4.3.
Since OHCI-1394 generally requires 4 IT contexts at a minium, this workaround is simply applied whenever the initial read of IsoXmitIntMask returns 0, regardless whether it's a JMicron chip or not. I never heard of this issue together with any other chip though.
I am not 100% sure that this fix works on the OHCI-1394 part of JMB380 and JMB388 combo controllers exactly the same as on the JMB381 single- function controller, but so far I haven't had a chance to let an owner of a combo chip run a patched kernel.
Strangely enough, IsoRecvIntMask is always reported correctly, even though it is probed right before IsoXmitIntMask.
--- drivers/firewire/ohci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/firewire/ohci.c +5 -0
@@ -3680,6 +3680,11 @@ static int pci_probe(struct pci_dev *dev,reg_write (ohci, OHCI1394_IsoXmitIntMaskSet, ~0 ); ohci->it_context_support =reg_read (ohci, OHCI1394_IsoXmitIntMaskSet); +/* JMicron JMB38x often shows 0 at first read, just ignore it */ +if (!ohci->it_context_support) { +ohci_notice (ohci,"overriding IsoXmitIntMask\n" ); + ohci->it_context_support =0xf ; + }reg_write (ohci, OHCI1394_IsoXmitIntMaskClear, ~0 ); ohci->it_context_mask = ohci->it_context_support; ohci->n_it =hweight32 (ohci->it_context_mask);
Signature · 1 line
1.9.1
PATCH 88/164 scsi: restart list search after unlock in scsi_remove_target
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 40998193560dab6c3ce8d25f4fa58a23e252ef38 upstream.
When dropping a lock while iterating a list we must restart the search as other threads could have manipulated the list under us. Without this we can get stuck in an endless loop. This bug was introduced by
commit bc3f02a795d3b4faa99d37390174be2a75d091bd
Author: Dan Williams <[email protected]> Date: Tue Aug 28 22:12:10 2012 -0700
[SCSI] scsi_remove_target: fix softlockup regression on hot remove
Which was itself trying to fix a reported soft lockup issue
http://thread.gmane.org/gmane.linux.kernel/1348679
However, we believe even with this revert of the original patch, the soft lockup problem has been fixed by
commit f2495e228fce9f9cec84367547813cbb0d6db15a
Author: James Bottomley <[email protected]> Date: Tue Jan 21 07:01:41 2014 -0800
[SCSI] dual scan thread bug fix
Thanks go to Dan Williams <[email protected]> for tracking all this prior history down.
--- drivers/scsi/scsi_sysfs.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/scsi/scsi_sysfs.c +4 -12
@@ -1148,31 +1148,23 @@ static void __scsi_remove_target(struct scsi_target *starget)void scsi_remove_target (struct device *dev) {struct Scsi_Host *shost =dev_to_shost (dev->parent); -struct scsi_target *starget, *last =NULL ; +struct scsi_target *starget;unsigned long flags; -/* remove targets being careful to lookup next entry before -* deleting the last -*/ +restart:spin_lock_irqsave (shost->host_lock, flags);list_for_each_entry (starget, &shost->__targets, siblings) {if (starget->state ==STARGET_DEL )continue ;if (starget->dev.parent == dev || &starget->dev == dev) { -/* assuming new targets arrive at the end */ kref_get (&starget->reap_ref);spin_unlock_irqrestore (shost->host_lock, flags); -if (last) -scsi_target_reap (last); - last = starget;__scsi_remove_target (starget); -spin_lock_irqsave (shost->host_lock, flags); +scsi_target_reap (starget); + goto restart; } }spin_unlock_irqrestore (shost->host_lock, flags); - -if (last) -scsi_target_reap (last); }EXPORT_SYMBOL (scsi_remove_target);
Signature · 1 line
1.9.1
PATCH 89/164 mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit d4322d88f5fdf92729dd40f923013414fbb2184d upstream.
On systems with a KMALLOC_MIN_SIZE of 128 (arm64, some mips and powerpc configurations defining ARCH_DMA_MINALIGN to 128), the first kmalloc_caches[] entry to be initialised after slab_early_init = 0 is "kmalloc-128" with index 7. Depending on the debug kernel configuration, sizeof(struct kmem_cache) can be larger than 128 resulting in an INDEX_NODE of 8.
Commit 8fc9cf420b36 ("slab: make more slab management structure off the slab") enables off-slab management objects for sizes starting with PAGE_SIZE >> 5 (128 bytes for a 4KB page configuration) and the creation of the "kmalloc-128" cache would try to place the management objects off-slab. However, since KMALLOC_MIN_SIZE is already 128 and freelist_size == 32 in __kmem_cache_create(), kmalloc_slab(freelist_size) returns NULL (kmalloc_caches[7] not populated yet). This triggers the following bug on arm64:
kernel BUG at /work/Linux/linux-2.6-aarch64/mm/slab.c:2283!
Internal error: Oops - BUG: 0 [#1] SMP
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.3.0-rc4+ #540
Hardware name: Juno (DT)
PC is at __kmem_cache_create+0x21c/0x280
LR is at __kmem_cache_create+0x210/0x280
[...]
Call trace:
__kmem_cache_create+0x21c/0x280
create_boot_cache+0x48/0x80
create_kmalloc_cache+0x50/0x88
create_kmalloc_caches+0x4c/0xf4
kmem_cache_init+0x100/0x118
start_kernel+0x214/0x33cThis patch introduces an OFF_SLAB_MIN_SIZE definition to avoid off-slab management objects for sizes equal to or smaller than KMALLOC_MIN_SIZE.
--- mm/slab.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/slab.c +3 -2
@@ -282,6 +282,7 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)#define CFLGS_OFF_SLAB (0x80000000UL)#define OFF_SLAB (x) ((x)->flags & CFLGS_OFF_SLAB) +#define OFF_SLAB_MIN_SIZE (max_t(size_t, PAGE_SIZE >> 5, KMALLOC_MIN_SIZE + 1))#define BATCHREFILL_LIMIT 16/*
@@ -2197,7 +2198,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)* it too early on. Always use on-slab management when * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak) */ -if ((size >= (PAGE_SIZE >>5 )) && !slab_early_init && +if (size >=OFF_SLAB_MIN_SIZE && !slab_early_init && !(flags &SLAB_NOLEAKTRACE ))/* * Size is large, assume best to place the slab management obj
@@ -2261,7 +2262,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)/* * This is a possibility for one of the kmalloc_{dma,}_caches. * But since we go off slab only for object size greater than -* PAGE_SIZE/8, and kmalloc_{dma,}_caches get created +* OFF_SLAB_MIN_SIZE, and kmalloc_{dma,}_caches get created * in ascending order,this should not happen at all. * But leave a BUG_ON for some lucky dude. */
Signature · 1 line
1.9.1
PATCH 90/164 memcg: fix thresholds for 32b architectures.
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit c12176d3368b9b36ae484d323d41e94be26f9b65 upstream.
Commit 424cdc141380 ("memcg: convert threshold to bytes") has fixed a regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page counters") where thresholds were silently converted to use page units rather than bytes when interpreting the user input.
The fix is not complete, though, as properly pointed out by Ben Hutchings during stable backport review. The page count is converted to bytes but unsigned long is used to hold the value which would be obviously not sufficient for 32b systems with more than 4G thresholds. The same applies to usage as taken from mem_cgroup_usage which might overflow.
Let's remove this bytes vs. pages internal tracking differences and handle thresholds in page units internally. Chage mem_cgroup_usage() to return the value in page units and revert 424cdc141380 because this should be sufficient for the consistent handling. mem_cgroup_read_u64 as the only users of mem_cgroup_usage outside of the threshold handling code is converted to give the proper in bytes result. It is doing that already for page_counter output so this is more consistent as well.
The value presented to the userspace is still in bytes units.
From: Michal Hocko <[email protected]>
Subject: memcg-fix-thresholds-for-32b-architectures-fix
Cc: Ben Hutchings <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Johannes Weiner <[email protected]>
From: Andrew Morton <[email protected]>
Subject: memcg-fix-thresholds-for-32b-architectures-fix-fix
don't attempt to inline mem_cgroup_usage()
The compiler ignores the inline anwyay. And __always_inlining it adds 600 bytes of goop to the .o file.
--- mm/memcontrol.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
mm/memcontrol.c +5 -6
@@ -3360,9 +3360,9 @@ static unsigned long tree_stat(struct mem_cgroup *memcg,return val; } -static inline u64 mem_cgroup_usage (struct mem_cgroup *memcg,bool swap) +static inline unsigned long mem_cgroup_usage (struct mem_cgroup *memcg,bool swap) { -u64 val; +unsigned long val;if (mem_cgroup_is_root (memcg)) { val =tree_stat (memcg,MEM_CGROUP_STAT_CACHE );
@@ -3375,7 +3375,7 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)else val =page_counter_read (&memcg->memsw); } -return val <<PAGE_SHIFT ; +return val; }enum {
@@ -3409,9 +3409,9 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,switch (MEMFILE_ATTR (cft->private)) {case RES_USAGE :if (counter == &memcg->memory) -return mem_cgroup_usage (memcg, false); +return (u64 )mem_cgroup_usage (memcg, false) *PAGE_SIZE ;if (counter == &memcg->memsw) -return mem_cgroup_usage (memcg, true); +return (u64 )mem_cgroup_usage (memcg, true) *PAGE_SIZE ;return (u64 )page_counter_read (counter) *PAGE_SIZE ;case RES_LIMIT :return (u64 )counter->limit *PAGE_SIZE ;
@@ -3904,7 +3904,6 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg, ret =page_counter_memparse (args, &threshold);if (ret)return ret; - threshold <<=PAGE_SHIFT ;mutex_lock (&memcg->thresholds_lock);
Signature · 1 line
1.9.1
PATCH 91/164 arm64: bpf: fix div-by-zero case
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Zi Shen Lim <[email protected]>
commit 251599e1d6906621f49218d7b474ddd159e58f3b upstream.
In the case of division by zero in a BPF program:
A = A / X; (X == 0)
the expected behavior is to terminate with return value 0.
This is confirmed by the test case introduced in commit 86bf1721b226 ("test_bpf: add tests checking that JIT/interpreter sets A and X to 0.").
--- arch/arm64/net/bpf_jit.h | 3 ++- arch/arm64/net/bpf_jit_comp.c | 37 +++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 13 deletions(-)
arch/arm64/net/bpf_jit.h +2 -1
@@ -1,7 +1,7 @@/* * BPF JIT compiler for ARM64 * -* Copyright (C) 2014 Zi Shen Lim <[email protected]> +* Copyright (C) 2014-2015 Zi Shen Lim <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -35,6 +35,7 @@aarch64_insn_gen_comp_branch_imm (0 , offset, Rt,A64_VARIANT (sf), \ AARCH64_INSN_BRANCH_COMP_##type)#define A64_CBZ (sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, ZERO) +#define A64_CBNZ (sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, NONZERO)/* Conditional branch (immediate) */ #define A64_COND_BRANCH (cond, offset) \
arch/arm64/net/bpf_jit_comp.c +25 -12
@@ -1,7 +1,7 @@/* * BPF JIT compiler for ARM64 * -* Copyright (C) 2014 Zi Shen Lim <[email protected]> +* Copyright (C) 2014-2015 Zi Shen Lim <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -225,6 +225,17 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)u8 jmp_cond;s32 jmp_offset; +#define check_imm (bits, imm) do { \ + if ((((imm) > 0) && ((imm) >> (bits))) || \ + (((imm) < 0) && (~(imm) >> (bits)))) { \ + pr_info("[%2d] imm=%d(0x%x) out of range\n", \ + i, imm, imm); \ + return -EINVAL; \ + } \ +} while (0) +#define check_imm19 (imm) check_imm(19, imm) +#define check_imm26 (imm) check_imm(26, imm) +switch (code) {/* dst = src */ case BPF_ALU |BPF_MOV |BPF_X :
@@ -258,8 +269,21 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)break ;case BPF_ALU |BPF_DIV |BPF_X :case BPF_ALU64 |BPF_DIV |BPF_X : + { +const u8 r0 = bpf2a64[BPF_REG_0 ]; + +/* if (src == 0) return 0 */ + jmp_offset =3 ;/* skip ahead to else path */ +check_imm19 (jmp_offset); +emit (A64_CBNZ (is64, src, jmp_offset), ctx); +emit (A64_MOVZ (1 , r0,0 ,0 ), ctx); + jmp_offset =epilogue_offset (ctx); +check_imm26 (jmp_offset); +emit (A64_B (jmp_offset), ctx); +/* else */ emit (A64_UDIV (is64, dst, dst, src), ctx);break ; + }case BPF_ALU |BPF_MOD |BPF_X :case BPF_ALU64 |BPF_MOD |BPF_X : ctx->tmp_used =1 ;
@@ -393,17 +417,6 @@ emit_bswap_uxt:emit (A64_ASR (is64, dst, dst, imm), ctx);break ; -#define check_imm (bits, imm) do { \ - if ((((imm) > 0) && ((imm) >> (bits))) || \ - (((imm) < 0) && (~(imm) >> (bits)))) { \ - pr_info("[%2d] imm=%d(0x%x) out of range\n", \ - i, imm, imm); \ - return -EINVAL; \ - } \ -} while (0) -#define check_imm19 (imm) check_imm(19, imm) -#define check_imm26 (imm) check_imm(26, imm) -/* JUMP off */ case BPF_JMP |BPF_JA : jmp_offset =bpf2a64_offset (i + off, i, ctx);
Signature · 1 line
1.9.1
PATCH 92/164 arm64: bpf: fix mod-by-zero case
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Zi Shen Lim <[email protected]>
commit 14e589ff4aa3f28a5424e92b6495ecb8950080f7 upstream.
Turns out in the case of modulo by zero in a BPF program:
A = A % X; (X == 0)
the expected behavior is to terminate with return value 0.
The bug in JIT is exposed by a new test case [1].
[1] https://lkml.org/lkml/2015/11/4/499
--- arch/arm64/net/bpf_jit_comp.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
arch/arm64/net/bpf_jit_comp.c +13 -8
@@ -269,6 +269,8 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)break ;case BPF_ALU |BPF_DIV |BPF_X :case BPF_ALU64 |BPF_DIV |BPF_X : +case BPF_ALU |BPF_MOD |BPF_X : +case BPF_ALU64 |BPF_MOD |BPF_X : {const u8 r0 = bpf2a64[BPF_REG_0 ];
@@ -281,16 +283,19 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)check_imm26 (jmp_offset);emit (A64_B (jmp_offset), ctx);/* else */ -emit (A64_UDIV (is64, dst, dst, src), ctx); +switch (BPF_OP (code)) { +case BPF_DIV : +emit (A64_UDIV (is64, dst, dst, src), ctx); +break ; +case BPF_MOD : + ctx->tmp_used =1 ; +emit (A64_UDIV (is64, tmp, dst, src), ctx); +emit (A64_MUL (is64, tmp, tmp, src), ctx); +emit (A64_SUB (is64, dst, dst, tmp), ctx); +break ; + }break ; } -case BPF_ALU |BPF_MOD |BPF_X : -case BPF_ALU64 |BPF_MOD |BPF_X : - ctx->tmp_used =1 ; -emit (A64_UDIV (is64, tmp, dst, src), ctx); -emit (A64_MUL (is64, tmp, tmp, src), ctx); -emit (A64_SUB (is64, dst, dst, tmp), ctx); -break ;case BPF_ALU |BPF_LSH |BPF_X :case BPF_ALU64 |BPF_LSH |BPF_X :emit (A64_LSLV (is64, dst, dst, src), ctx);
Signature · 1 line
1.9.1
PATCH 93/164 Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 60603950f836ef4e88daddf61a273b91e671db2d upstream.
Another Lifebook machine that needs the same quirk as other similar models to make the driver working.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=883192
--- drivers/input/mouse/elantech.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/mouse/elantech.c +7 -0
@@ -1509,6 +1509,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), }, }, + { +/* Fujitsu LIFEBOOK U745 does not work with crc_enabled == 0 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"), + }, + }, #endif { } };
Signature · 1 line
1.9.1
PATCH 94/164 proc: actually make proc_fd_permission() thread-friendly
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 54708d2858e79a2bdda10bf8a20c80eb96c20613 upstream.
The commit 96d0df79f264 ("proc: make proc_fd_permission() thread-friendly") fixed the access to /proc/self/fd from sub-threads, but introduced another
problem: a sub-thread can't access /proc/<tid>/fd/ or /proc/thread-self/fd if generic_permission() fails.
Change proc_fd_permission() to check same_thread_group(pid_task(), current).
--- fs/proc/fd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/proc/fd.c +11 -3
@@ -284,11 +284,19 @@ static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry,*/ int proc_fd_permission (struct inode *inode,int mask) { -int rv =generic_permission (inode, mask); +struct task_struct *p; +int rv; + + rv =generic_permission (inode, mask);if (rv ==0 ) -return 0 ; -if (task_tgid (current) ==proc_pid (inode)) +return rv; + +rcu_read_lock (); + p =pid_task (proc_pid (inode),PIDTYPE_PID ); +if (p &&same_thread_group (p, current)) rv =0 ; +rcu_read_unlock (); +return rv; }
Signature · 1 line
1.9.1
PATCH 95/164 printk: prevent userland from spoofing kernel messages
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 3824657c522f19f85a76bd932821174a5557a382 upstream.
The following statement of ABI/testing/dev-kmsg is not quite right:
It is not possible to inject messages from userspace with the facility number LOG_KERN (0), to make sure that the origin of the messages can always be reliably determined.
Userland actually can inject messages with a facility of 0 by abusing the fact that the facility is stored in a u8 data type. By using a facility which is a multiple of 256 the assignment of msg->facility in log_store() implicitly truncates it to 0, i.e. LOG_KERN, allowing users of /dev/kmsg to spoof kernel messages as shown below:
The following call...
# printf '<%d>Kernel panic - not syncing: beer empty\n' 0 >/dev/kmsg ...leads to the following log entry (dmesg -x | tail -n 1): user :emerg : [ 66.137758] Kernel panic - not syncing: beer empty
However, this call...
# printf '<%d>Kernel panic - not syncing: beer empty\n' 0x800 >/dev/kmsg ...leads to the slightly different log entry (note the kernel facility): kern :emerg : [ 74.177343] Kernel panic - not syncing: beer empty
Fix that by limiting the user provided facility to 8 bit right from the beginning and catch the truncation early.
--- kernel/printk/printk.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
kernel/printk/printk.c +8 -5
@@ -257,6 +257,9 @@ static u32 clear_idx;#define PREFIX_MAX 32#define LOG_LINE_MAX (1024 - PREFIX_MAX) +#define LOG_LEVEL (v) ((v) & 0x07) +#define LOG_FACILITY (v) ((v) >> 3 & 0xff) +/* record buffer */ #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS )#define LOG_ALIGN 4
@@ -519,7 +522,6 @@ struct devkmsg_user {static ssize_t devkmsg_write (struct kiocb *iocb,struct iov_iter *from) {char *buf, *line; -int i;int level = default_message_loglevel;int facility =1 ;/* LOG_USER */ size_t len = iocb->ki_nbytes;
@@ -549,12 +551,13 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) line = buf;if (line[0 ] =='<' ) {char *endp =NULL ; +unsigned int u; - i =simple_strtoul (line+1 , &endp,10 ); + u =simple_strtoul (line +1 , &endp,10 );if (endp && endp[0 ] =='>' ) { - level = i &7 ; -if (i >>3 ) - facility = i >>3 ; + level =LOG_LEVEL (u); +if (LOG_FACILITY (u) !=0 ) + facility =LOG_FACILITY (u); endp++; len -= endp - line; line = endp;
Signature · 1 line
1.9.1
PATCH 96/164 fs, seqfile: always allow oom killer
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Thelen <[email protected]>
commit 0f930902eb8806cff8dcaef9ff9faf3cfa5fd748 upstream.
Since 5cec38ac866b ("fs, seq_file: fallback to vmalloc instead of oom kill processes") seq_buf_alloc() avoids calling the oom killer for PAGE_SIZE or smaller allocations; but larger allocations can use the oom killer via vmalloc(). Thus reads of small files can return ENOMEM, but larger files use the oom killer to avoid ENOMEM.
The effect of this bug is that reads from /proc and other virtual filesystems can return ENOMEM instead of the preferred behavior - oom killing something (possibly the calling process). I don't know of anyone except Google who has noticed the issue.
I suspect the fix is more needed in smaller systems where there isn't any reclaimable memory. But these seem like the kinds of systems which probably don't use the oom killer for production situations.
Memory overcommit requires use of the oom killer to select a victim regardless of file size.
Enable oom killer for small seq_buf_alloc() allocations.
--- fs/seq_file.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/seq_file.c +8 -3
@@ -24,12 +24,17 @@ static void seq_set_overflow(struct seq_file *m)static void *seq_buf_alloc (unsigned long size) {void *buf; +gfp_t gfp =GFP_KERNEL ;/* -* __GFP_NORETRY to avoid oom-killings with high-order allocations - -* it's better to fall back to vmalloc() than to kill things. +* For high order allocations, use __GFP_NORETRY to avoid oom-killing - +* it's better to fall back to vmalloc() than to kill things. For small +* allocations, just use GFP_KERNEL which will oom kill, thus no need +* for vmalloc fallback. */ - buf =kmalloc (size,GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN); +if (size >PAGE_SIZE ) + gfp |= __GFP_NORETRY | __GFP_NOWARN; + buf =kmalloc (size, gfp);if (!buf && size >PAGE_SIZE ) buf =vmalloc (size);return buf;
Signature · 1 line
1.9.1
PATCH 97/164 x86/cpu: Call verify_cpu() after having entered long mode too
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 04633df0c43d710e5f696b06539c100898678235 upstream.
When we get loaded by a 64-bit bootloader, kernel entry point is startup_64 in head_64.S. We don't trust any and all bootloaders because some will fiddle with CPU configuration so we go ahead and massage each CPU into sanity again.
For example, some dell BIOSes have this XD disable feature which set IA32_MISC_ENABLE[34] and disable NX. This might be some dumb workaround for other OSes but Linux sure doesn't need it.
A similar thing is present in the Surface 3 firmware - see
https://bugzilla.kernel.org/show_bug.cgi?id=106051 - which sets this bit only on the BSP:
# rdmsr -a 0x1a0 400850089 850089 850089 850089
I know, right?!
There's not even an off switch in there.
So fix all those cases by sanitizing the 64-bit entry point too. For that, make verify_cpu() callable in 64-bit mode also.
--- arch/x86/kernel/head_64.S | 8 ++++++++ arch/x86/kernel/verify_cpu.S | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/head_64.S +8 -0
@@ -65,6 +65,9 @@ startup_64: * tables and then reload them. */ + /* Sanitize CPU configuration */ + call verify_cpu + /* * Compute the delta between the address I am compiled to run at and the * address I am actually running at.
@@ -174,6 +177,9 @@ ENTRY(secondary_startup_64) * after the boot processor executes this code. */ + /* Sanitize CPU configuration */ + call verify_cpu + movq $(init_level4_pgt - __START_KERNEL_map), %rax 1:
@@ -288,6 +294,8 @@ ENTRY(secondary_startup_64) pushq %rax # target address in negative space lretq +#include "verify_cpu.S" + #ifdef CONFIG_HOTPLUG_CPU /* * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
arch/x86/kernel/verify_cpu.S +7 -5
@@ -34,10 +34,11 @@ #include <asm/msr-index.h> verify_cpu: - pushfl # Save caller passed flags - pushl $0 # Kill any dangerous flags - popfl + pushf # Save caller passed flags + push $0 # Kill any dangerous flags + popf +#ifndef __x86_64__ pushfl # standard way to check for cpuid popl %eax movl %eax,%ebx
@@ -48,6 +49,7 @@ verify_cpu: popl %eax cmpl %eax,%ebx jz verify_cpu_no_longmode # cpu has no cpuid +#endif movl $0x0,%eax # See if cpuid 1 is implemented cpuid
@@ -130,10 +132,10 @@ verify_cpu_sse_test: jmp verify_cpu_sse_test # try again verify_cpu_no_longmode: - popfl # Restore caller passed flags + popf # Restore caller passed flags movl $1,%eax ret verify_cpu_sse_ok: - popfl # Restore caller passed flags + popf # Restore caller passed flags xorl %eax, %eax ret
Signature · 1 line
1.9.1
PATCH 98/164 parisc: Fixes and cleanups in kernel uapi header files
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit d0cf62fb63f760e98244d31396b3b58f3a1e326b upstream.
This patch fixes some bugs and partly cleans up the parisc uapi header files to what glibc defined:
- compat_semid64_ds was wrong and did not take the endianess into account
- ipc64_perm exported userspace types which broke building userspace packages on debian (e.g. trinity)
- ipc64_perm needs to use a 32bit mode_t on 64bit kernel
- msqid64_ds and semid64_ds needs unsigned longs for various struct members
- shmid64_ds exported size_t instead of __kernel_size_t
And finally add some compile-time checks for the sizes of those structs to avoid future breakage.
Runtime-tested with the Linux Test Project (LTP) testsuite.
--- arch/parisc/include/asm/compat.h | 4 ++-- arch/parisc/include/uapi/asm/ipcbuf.h | 19 ++++++++++++------- arch/parisc/include/uapi/asm/msgbuf.h | 10 +++++----- arch/parisc/include/uapi/asm/posix_types.h | 2 ++ arch/parisc/include/uapi/asm/sembuf.h | 6 +++--- arch/parisc/include/uapi/asm/shmbuf.h | 8 ++++---- arch/parisc/mm/init.c | 16 ++++++++++++++++ 7 files changed, 44 insertions(+), 21 deletions(-)
arch/parisc/include/asm/compat.h +2 -2
@@ -206,10 +206,10 @@ struct compat_ipc64_perm {struct compat_semid64_ds {struct compat_ipc64_perm sem_perm; -compat_time_t sem_otime;unsigned int __unused1; -compat_time_t sem_ctime; +compat_time_t sem_otime;unsigned int __unused2; +compat_time_t sem_ctime;compat_ulong_t sem_nsems;compat_ulong_t __unused3;compat_ulong_t __unused4;
arch/parisc/include/uapi/asm/ipcbuf.h +12 -7
@@ -1,6 +1,9 @@#ifndef __PARISC_IPCBUF_H__#define __PARISC_IPCBUF_H__ +#include <asm/bitsperlong.h> +#include <linux/posix_types.h> +/* * The ipc64_perm structure for PA-RISC is almost identical to * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel.
@@ -10,16 +13,18 @@struct ipc64_perm { -key_t key; -uid_t uid; -gid_t gid; -uid_t cuid; -gid_t cgid; +__kernel_key_t key; +__kernel_uid_t uid; +__kernel_gid_t gid; +__kernel_uid_t cuid; +__kernel_gid_t cgid; +#if __BITS_PER_LONG !=64 unsigned short int __pad1; -mode_t mode; +#endif +__kernel_mode_t mode;unsigned short int __pad2;unsigned short int seq; -unsigned int __pad3; +unsigned int __pad3;unsigned long long int __unused1;unsigned long long int __unused2; };
arch/parisc/include/uapi/asm/msgbuf.h +5 -5
@@ -27,13 +27,13 @@ struct msqid64_ds {unsigned int __pad3;#endif __kernel_time_t msg_ctime;/* last change time */ -unsigned int msg_cbytes;/* current number of bytes on queue */ -unsigned int msg_qnum;/* number of messages in queue */ -unsigned int msg_qbytes;/* max number of bytes on queue */ +unsigned long msg_cbytes;/* current number of bytes on queue */ +unsigned long msg_qnum;/* number of messages in queue */ +unsigned long msg_qbytes;/* max number of bytes on queue */ __kernel_pid_t msg_lspid;/* pid of last msgsnd */ __kernel_pid_t msg_lrpid;/* last receive pid */ -unsigned int __unused1; - unsigned int __unused2; +unsigned long __unused1; + unsigned long __unused2; };#endif /* _PARISC_MSGBUF_H */
arch/parisc/include/uapi/asm/posix_types.h +2 -0
@@ -7,8 +7,10 @@* assume GCC is being used. */ +#ifndef __LP64__typedef unsigned short __kernel_mode_t ;#define __kernel_mode_t __kernel_mode_t +#endif typedef unsigned short __kernel_ipc_pid_t ;#define __kernel_ipc_pid_t __kernel_ipc_pid_t
arch/parisc/include/uapi/asm/sembuf.h +3 -3
@@ -23,9 +23,9 @@ struct semid64_ds {unsigned int __pad2;#endif __kernel_time_t sem_ctime;/* last change time */ -unsigned int sem_nsems;/* no. of semaphores in array */ -unsigned int __unused1; - unsigned int __unused2; +unsigned long sem_nsems;/* no. of semaphores in array */ +unsigned long __unused1; + unsigned long __unused2; };#endif /* _PARISC_SEMBUF_H */
arch/parisc/include/uapi/asm/shmbuf.h +4 -4
@@ -30,12 +30,12 @@ struct shmid64_ds {#if __BITS_PER_LONG !=64 unsigned int __pad4;#endif -size_t shm_segsz;/* size of segment (bytes) */ +__kernel_size_t shm_segsz;/* size of segment (bytes) */ __kernel_pid_t shm_cpid;/* pid of creator */ __kernel_pid_t shm_lpid;/* pid of last operator */ -unsigned int shm_nattch;/* no. of current attaches */ -unsigned int __unused1; -unsigned int __unused2; +unsigned long shm_nattch;/* no. of current attaches */ +unsigned long __unused1; +unsigned long __unused2; };struct shminfo64 {
arch/parisc/mm/init.c +16 -0
@@ -23,6 +23,7 @@#include <linux/unistd.h> #include <linux/nodemask.h> /* for node_online_map */ #include <linux/pagemap.h> /* for release_pages and page_cache_release */ +#include <linux/compat.h> #include <asm/pgalloc.h> #include <asm/pgtable.h>
@@ -30,6 +31,7 @@#include <asm/pdc_chassis.h> #include <asm/mmzone.h> #include <asm/sections.h> +#include <asm/msgbuf.h> extern int data_start;extern void parisc_kernel_start (void );/* Kernel entry point in head.S */
@@ -590,6 +592,20 @@ unsigned long pcxl_dma_start __read_mostly;void __init mem_init (void ) { +/* Do sanity checks on IPC (compat) structures */ +BUILD_BUG_ON (sizeof (struct ipc64_perm ) !=48 ); +#ifndef CONFIG_64BIT +BUILD_BUG_ON (sizeof (struct semid64_ds ) !=80 ); +BUILD_BUG_ON (sizeof (struct msqid64_ds ) !=104 ); +BUILD_BUG_ON (sizeof (struct shmid64_ds ) !=104 ); +#endif +#ifdef CONFIG_COMPAT +BUILD_BUG_ON (sizeof (struct compat_ipc64_perm ) !=sizeof (struct ipc64_perm )); +BUILD_BUG_ON (sizeof (struct compat_semid64_ds ) !=80 ); +BUILD_BUG_ON (sizeof (struct compat_msqid64_ds ) !=104 ); +BUILD_BUG_ON (sizeof (struct compat_shmid64_ds ) !=104 ); +#endif +/* Do sanity checks on page table constants */ BUILD_BUG_ON (PTE_ENTRY_SIZE !=sizeof (pte_t));BUILD_BUG_ON (PMD_ENTRY_SIZE !=sizeof (pmd_t));
Signature · 1 line
1.9.1
PATCH 99/164 Btrfs: fix race leading to incorrect item deletion when dropping extents
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit aeafbf8486c9e2bd53f5cc3c10c0b7fd7149d69c upstream.
While running a stress test I got the following warning triggered:
[191627.672810] ------------[ cut here ]------------ [191627.673949] WARNING: CPU: 8 PID: 8447 at fs/btrfs/file.c:779 __btrfs_drop_extents+0x391/0xa50 [btrfs]() (...) [191627.701485] Call Trace: [191627.702037] [<ffffffff8145f077>] dump_stack+0x4f/0x7b [191627.702992] [<ffffffff81095de5>] ? console_unlock+0x356/0x3a2 [191627.704091] [<ffffffff8104b3b0>] warn_slowpath_common+0xa1/0xbb [191627.705380] [<ffffffffa0664499>] ? __btrfs_drop_extents+0x391/0xa50 [btrfs] [191627.706637] [<ffffffff8104b46d>] warn_slowpath_null+0x1a/0x1c [191627.707789] [<ffffffffa0664499>] __btrfs_drop_extents+0x391/0xa50 [btrfs] [191627.709155] [<ffffffff8115663c>] ? cache_alloc_debugcheck_after.isra.32+0x171/0x1d0 [191627.712444] [<ffffffff81155007>] ? kmemleak_alloc_recursive.constprop.40+0x16/0x18 [191627.714162] [<ffffffffa06570c9>] insert_reserved_file_extent.constprop.40+0x83/0x24e [btrfs] [191627.715887] [<ffffffffa065422b>] ? start_transaction+0x3bb/0x610 [btrfs] [191627.717287] [<ffffffffa065b604>] btrfs_finish_ordered_io+0x273/0x4e2 [btrfs] [191627.728865] [<ffffffffa065b888>] finish_ordered_fn+0x15/0x17 [btrfs] [191627.730045] [<ffffffffa067d688>] normal_work_helper+0x14c/0x32c [btrfs] [191627.731256] [<ffffffffa067d96a>] btrfs_endio_write_helper+0x12/0x14 [btrfs] [191627.732661] [<ffffffff81061119>] process_one_work+0x24c/0x4ae [191627.733822] [<ffffffff810615b0>] worker_thread+0x206/0x2c2 [191627.734857] [<ffffffff810613aa>] ? process_scheduled_works+0x2f/0x2f [191627.736052] [<ffffffff810613aa>] ? process_scheduled_works+0x2f/0x2f [191627.737349] [<ffffffff810669a6>] kthread+0xef/0xf7 [191627.738267] [<ffffffff810f3b3a>] ? time_hardirqs_on+0x15/0x28 [191627.739330] [<ffffffff810668b7>] ? __kthread_parkme+0xad/0xad [191627.741976] [<ffffffff81465592>] ret_from_fork+0x42/0x70 [191627.743080] [<ffffffff810668b7>] ? __kthread_parkme+0xad/0xad [191627.744206] ---[ end trace bbfddacb7aaada8d ]---
$ cat -n fs/btrfs/file.c
691 int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
(...)
758 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
759 if (key.objectid > ino ||
760 key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
761 break;
762
763 fi = btrfs_item_ptr(leaf, path->slots[0],
764 struct btrfs_file_extent_item);
765 extent_type = btrfs_file_extent_type(leaf, fi);
766
767 if (extent_type == BTRFS_FILE_EXTENT_REG ||
768 extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
(...)
774 } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
(...)
778 } else {
779 WARN_ON(1);
780 extent_end = search_start;
781 }
(...)This happened because the item we were processing did not match a file extent item (its key type != BTRFS_EXTENT_DATA_KEY), and even on this case we cast the item to a struct btrfs_file_extent_item pointer and then find a type field value that does not match any of the expected values (BTRFS_FILE_EXTENT_[REG|PREALLOC|INLINE]). This scenario happens due to a tiny time window where a race can happen as exemplified below. For example, consider the following scenario where we're using the NO_HOLES feature and we have the following two neighbour leafs:
Leaf X (has N items) Leaf Y
[ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ] [ (257 EXTENT_DATA 8192), ... ]
slot N - 2 slot N - 1 slot 0
Our inode 257 has an implicit hole in the range [0, 8K[ (implicit rather than explicit because NO_HOLES is enabled). Now if our inode has an ordered extent for the range [4K, 8K[ that is finishing, the following can happen:
CPU 1 CPU 2
btrfs_finish_ordered_io()
insert_reserved_file_extent()
__btrfs_drop_extents()
Searches for the key
(257 EXTENT_DATA 4096) through
btrfs_lookup_file_extent()
Key not found and we get a path where
path->nodes[0] == leaf X and
path->slots[0] == N
Because path->slots[0] is >=
btrfs_header_nritems(leaf X), we call
btrfs_next_leaf()
btrfs_next_leaf() releases the path
inserts key (257 INODE_REF 4096) at the end of leaf X, leaf X now has N + 1 keys, and the new key is at slot N
btrfs_next_leaf() searches for
key (257 INODE_REF 256), with
path->keep_locks set to 1,
because it was the last key it
saw in leaf X
finds it in leaf X again and
notices it's no longer the last
key of the leaf, so it returns 0
with path->nodes[0] == leaf X and
path->slots[0] == N (which is now
< btrfs_header_nritems(leaf X)),
pointing to the new key
(257 INODE_REF 4096)
__btrfs_drop_extents() casts the item at path->nodes[0], slot path->slots[0], to a struct btrfs_file_extent_item - it does
not skip keys for the target
inode with a type less than BTRFS_EXTENT_DATA_KEY (BTRFS_INODE_REF_KEY < BTRFS_EXTENT_DATA_KEY)
sees a bogus value for the type
field triggering the WARN_ON in
the trace shown above, and sets
extent_end = search_start (4096)
does the if-then-else logic to
fixup 0 length extent items created
by a past bug from hole punching:
if (extent_end == key.offset &&
extent_end >= search_start)
goto delete_extent_item;
that evaluates to true and it ends
up deleting the key pointed to by
path->slots[0], (257 INODE_REF 4096),
from leaf X
The same could happen for example for a xattr that ends up having a key with an offset value that matches search_start (very unlikely but not impossible).
So fix this by ensuring that keys smaller than BTRFS_EXTENT_DATA_KEY are skipped, never casted to struct btrfs_file_extent_item and never deleted by accident. Also protect against the unexpected case of getting a key for a lower inode number by skipping that key and issuing a warning.
--- fs/btrfs/file.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
fs/btrfs/file.c +12 -4
@@ -760,8 +760,16 @@ next_slot: }btrfs_item_key_to_cpu (leaf, &key, path->slots[0 ]); -if (key.objectid > ino || - key.type >BTRFS_EXTENT_DATA_KEY || key.offset >= end) + +if (key.objectid > ino) +break ; +if (WARN_ON_ONCE (key.objectid < ino) || + key.type <BTRFS_EXTENT_DATA_KEY ) { +ASSERT (del_nr ==0 ); + path->slots[0 ]++; + goto next_slot; + } +if (key.type >BTRFS_EXTENT_DATA_KEY || key.offset >= end)break ; fi = btrfs_item_ptr(leaf, path->slots[0],
@@ -780,8 +788,8 @@ next_slot:btrfs_file_extent_inline_len (leaf, path->slots[0 ], fi); }else { -WARN_ON (1 ); - extent_end = search_start; +/* can't happen */ +BUG (); }/*
Signature · 1 line
1.9.1
PATCH 100/164 Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 1d512cb77bdbda80f0dd0620a3b260d697fd581d upstream.
If we are using the NO_HOLES feature, we have a tiny time window when running delalloc for a nodatacow inode where we can race with a concurrent link or xattr add operation leading to a BUG_ON.
This happens because at run_delalloc_nocow() we end up casting a leaf item of type BTRFS_INODE_[REF|EXTREF]_KEY or of type BTRFS_XATTR_ITEM_KEY to a file extent item (struct btrfs_file_extent_item) and then analyse its extent type field, which won't match any of the expected extent types (values BTRFS_FILE_EXTENT_[REG|PREALLOC|INLINE]) and therefore trigger an explicit BUG_ON(1).
The following sequence diagram shows how the race happens when running a no-cow dellaloc range [4K, 8K[ for inode 257 and we have the following neighbour leafs:
Leaf X (has N items) Leaf Y
[ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ] [ (257 EXTENT_DATA 8192), ... ]
slot N - 2 slot N - 1 slot 0
(Note the implicit hole for inode 257 regarding the [0, 8K[ range)
CPU 1 CPU 2
run_dealloc_nocow()
btrfs_lookup_file_extent()
--> searches for a key with value
(257 EXTENT_DATA 4096) in the
fs/subvol tree
--> returns us a path with
path->nodes[0] == leaf X and
path->slots[0] == N because path->slots[0] is >=
btrfs_header_nritems(leaf X), it
calls btrfs_next_leaf()
btrfs_next_leaf()
--> releases the path
hard link added to our inode,
with key (257 INODE_REF 500)
added to the end of leaf X,
so leaf X now has N + 1 keys
--> searches for the key
(257 INODE_REF 256), because
it was the last key in leaf X
before it released the path,
with path->keep_locks set to 1
--> ends up at leaf X again and
it verifies that the key
(257 INODE_REF 256) is no longer
the last key in the leaf, so it
returns with path->nodes[0] ==
leaf X and path->slots[0] == N,
pointing to the new item with
key (257 INODE_REF 500) the loop iteration of run_dealloc_nocow() does not break out the loop and continues because the key referenced in the path
at path->nodes[0] and path->slots[0] is for inode 257, its type is < BTRFS_EXTENT_DATA_KEY and its offset (500) is less then our delalloc range's end (8192)
the item pointed by the path, an inode reference item, is (incorrectly) interpreted as a file extent item and we get an invalid extent type, leading to the BUG_ON(1):
if (extent_type == BTRFS_FILE_EXTENT_REG ||
extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
(...)
} else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
(...)
} else {
BUG_ON(1)
}The same can happen if a xattr is added concurrently and ends up having a key with an offset smaller then the delalloc's range end.
So fix this by skipping keys with a type smaller than BTRFS_EXTENT_DATA_KEY.
--- fs/btrfs/inode.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +8 -2
@@ -1287,8 +1287,14 @@ next_slot: num_bytes =0 ;btrfs_item_key_to_cpu (leaf, &found_key, path->slots[0 ]); -if (found_key.objectid > ino || - found_key.type >BTRFS_EXTENT_DATA_KEY || +if (found_key.objectid > ino) +break ; +if (WARN_ON_ONCE (found_key.objectid < ino) || + found_key.type <BTRFS_EXTENT_DATA_KEY ) { + path->slots[0 ]++; + goto next_slot; + } +if (found_key.type >BTRFS_EXTENT_DATA_KEY || found_key.offset > end)break ;
Signature · 1 line
1.9.1
PATCH 101/164 ALSA: usb: Add native DSD support for Aune X1S
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jurgen Kramer <[email protected]>
commit 16771c7c704769c5f3d70c024630b6e5b3eafa67 upstream.
This patch adds native DSD support for the Aune X1S 32BIT/384 DSD DAC
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1257,6 +1257,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,case USB_ID (0x20b1 ,0x000a ):/* Gustard DAC-X20U */ case USB_ID (0x20b1 ,0x2009 ):/* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ case USB_ID (0x20b1 ,0x2023 ):/* JLsounds I2SoverUSB */ +case USB_ID (0x20b1 ,0x3023 ):/* Aune X1S 32BIT/384 DSD DAC */ if (fp->altsetting ==3 )return SNDRV_PCM_FMTBIT_DSD_U32_BE ;break ;
Signature · 1 line
1.9.1
PATCH 102/164 perf: Fix inherited events vs. tracepoint filters
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit b71b437eedaed985062492565d9d421d975ae845 upstream.
Arnaldo reported that tracepoint filters seem to misbehave (ie. not apply) on inherited events.
The fix is obvious; filters are only set on the actual (parent) event, use the normal pattern of using this parent event for filters. This is safe because each child event has a reference to it.
--- kernel/events/core.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/events/core.c +4 -0
@@ -6181,6 +6181,10 @@ static int perf_tp_filter_match(struct perf_event *event, {void *record = data->raw->data; +/* only top level events have filters set */ +if (event->parent) + event = event->parent; +if (likely (!event->filter) ||filter_match_preds (event->filter, record))return 1 ;return 0 ;
Signature · 1 line
1.9.1
PATCH 103/164 scsi_sysfs: Fix queue_ramp_up_period return code
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
commit 863e02d0e173bb9d8cea6861be22820b25c076cc upstream.
Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX write() semantics. Fix this by returning the number of bytes written instead.
--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +1 -1
@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,return -EINVAL ; sdev->queue_ramp_up_period =msecs_to_jiffies (period); -return period; +return count; } static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
Signature · 1 line
1.9.1
PATCH 104/164 Btrfs: fix race when listing an inode's xattrs
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit f1cd1f0b7d1b5d4aaa5711e8f4e4898b0045cb6d upstream.
When listing a inode's xattrs we have a time window where we race against a concurrent operation for adding a new hard link for our inode that makes us not return any xattr to user space. In order for this to happen, the first xattr of our inode needs to be at slot 0 of a leaf and the previous leaf must still have room for an inode ref (or extref) item, and this can happen because an inode's listxattrs callback does not lock the inode's i_mutex (nor does the VFS does it for us), but adding a hard link to an inode makes the VFS lock the inode's i_mutex before calling the inode's link callback.
If we have the following leafs:
Leaf X (has N items) Leaf Y
[ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ] [ (257 XATTR_ITEM 12345), ... ]
slot N - 2 slot N - 1 slot 0
The race illustrated by the following sequence diagram is possible:
CPU 1 CPU 2
btrfs_listxattr()
searches for key (257 XATTR_ITEM 0)
gets path with path->nodes[0] == leaf X
and path->slots[0] == N
because path->slots[0] is >=
btrfs_header_nritems(leaf X), it calls
btrfs_next_leaf()
btrfs_next_leaf()
releases the path
adds key (257 INODE_REF 666) to the end of leaf X (slot N), and leaf X now has N + 1 items
searches for the key (257 INODE_REF 256),
with path->keep_locks == 1, because that
is the last key it saw in leaf X before
releasing the path
ends up at leaf X again and it verifies
that the key (257 INODE_REF 256) is no
longer the last key in leaf X, so it
returns with path->nodes[0] == leaf X
and path->slots[0] == N, pointing to
the new item with key (257 INODE_REF 666)
btrfs_listxattr's loop iteration sees that
the type of the key pointed by the path is
different from the type BTRFS_XATTR_ITEM_KEY
and so it breaks the loop and stops looking
for more xattr items
--> the application doesn't get any xattr
listed for our inode
So fix this by breaking the loop only if the key's type is greater than BTRFS_XATTR_ITEM_KEY and skip the current key if its type is smaller.
--- fs/btrfs/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/xattr.c +3 -1
@@ -309,8 +309,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)/* check to make sure this item is what we want */ if (found_key.objectid != key.objectid)break ; -if (found_key.type !=BTRFS_XATTR_ITEM_KEY ) +if (found_key.type >BTRFS_XATTR_ITEM_KEY )break ; +if (found_key.type <BTRFS_XATTR_ITEM_KEY ) + goto next; di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item);if (verify_dir_item (root, leaf, di))
Signature · 1 line
1.9.1
PATCH 105/164 ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit f71c882dd4cfe4aa88ea07b1402ddd43605d4aef upstream.
Like some of the other Yoga models the Lenovo Yoga 900 does not have a hw rfkill switch, and trying to read the hw rfkill switch through the ideapad module causes it to always reported blocking breaking wifi.
This commit adds the Lenovo Yoga 900 to the no_hw_rfkill dmi list, fixing the wifi breakage.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -858,6 +858,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3 Pro-1370"), }, }, + { + .ident = "Lenovo Yoga 900", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 900"), + }, + }, {} };
Signature · 1 line
1.9.1
PATCH 106/164 storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 8cf308e1225f5f93575f03cc4dbef24516fa81c9 upstream.
Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag since we are not specifying tags. Without this, the qlogic driver doesn't work properly with storvsc.
--- drivers/scsi/storvsc_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/storvsc_drv.c +1 -2
@@ -1608,8 +1608,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) vm_srb->win8_extension.time_out_value =60 ; vm_srb->win8_extension.srb_flags |= - (SRB_FLAGS_QUEUE_ACTION_ENABLE | -SRB_FLAGS_DISABLE_SYNCH_TRANSFER ); +SRB_FLAGS_DISABLE_SYNCH_TRANSFER ;/* Build the SRB */ switch (scmnd->sc_data_direction) {
Signature · 1 line
1.9.1
PATCH 107/164 KVM: x86: work around infinite loop in microcode when #AC is delivered
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Northup <[email protected]>
commit 54a20552e1eae07aa240fa370a0293e006b5faed upstream.
It was found that a guest can DoS a host by triggering an infinite stream of "alignment check" (#AC) exceptions. This causes the microcode to enter an infinite loop where the core never receives another interrupt. The host kernel panics pretty quickly due to the effects (CVE-2015-5307).
--- arch/x86/include/uapi/asm/svm.h | 1 + arch/x86/kvm/svm.c | 8 ++++++++ arch/x86/kvm/vmx.c | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-)
arch/x86/include/uapi/asm/svm.h +1 -0
@@ -100,6 +100,7 @@ { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ + { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ { SVM_EXIT_INTR, "interrupt" }, \ { SVM_EXIT_NMI, "nmi" }, \
arch/x86/kvm/svm.c +8 -0
@@ -1105,6 +1105,7 @@ static void init_vmcb(struct vcpu_svm *svm)set_exception_intercept (svm,PF_VECTOR );set_exception_intercept (svm,UD_VECTOR );set_exception_intercept (svm,MC_VECTOR ); +set_exception_intercept (svm,AC_VECTOR );set_intercept (svm,INTERCEPT_INTR );set_intercept (svm,INTERCEPT_NMI );
@@ -1791,6 +1792,12 @@ static int ud_interception(struct vcpu_svm *svm)return 1 ; } +static int ac_interception (struct vcpu_svm *svm) +{ +kvm_queue_exception_e (&svm->vcpu,AC_VECTOR ,0 ); +return 1 ; +} +static void svm_fpu_activate (struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu);
@@ -3354,6 +3361,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = { [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, [SVM_EXIT_EXCP_BASE + MC_VECTOR] = mc_interception, + [SVM_EXIT_EXCP_BASE + AC_VECTOR] = ac_interception, [SVM_EXIT_INTR] = intr_interception, [SVM_EXIT_NMI] = nmi_interception, [SVM_EXIT_SMI] = nop_on_interception,
arch/x86/kvm/vmx.c +4 -1
@@ -1507,7 +1507,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)u32 eb; eb = (1u <<PF_VECTOR ) | (1u <<UD_VECTOR ) | (1u <<MC_VECTOR ) | - (1u <<NM_VECTOR ) | (1u <<DB_VECTOR ); + (1u <<NM_VECTOR ) | (1u <<DB_VECTOR ) | (1u <<AC_VECTOR );if ((vcpu->guest_debug & (KVM_GUESTDBG_ENABLE |KVM_GUESTDBG_USE_SW_BP )) == (KVM_GUESTDBG_ENABLE |KVM_GUESTDBG_USE_SW_BP ))
@@ -4908,6 +4908,9 @@ static int handle_exception(struct kvm_vcpu *vcpu)return handle_rmode_exception (vcpu, ex_no, error_code);switch (ex_no) { +case AC_VECTOR : +kvm_queue_exception_e (vcpu,AC_VECTOR , error_code); +return 1 ;case DB_VECTOR : dr6 =vmcs_readl (EXIT_QUALIFICATION ); if (!(vcpu->guest_debug &
Signature · 1 line
1.9.1
PATCH 108/164 KVM: svm: unconditionally intercept #DB
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit cbdb967af3d54993f5814f1cee0ed311a055377d upstream.
This is needed to avoid the possibility that the guest triggers an infinite stream of #DB exceptions (CVE-2015-8104).
VMX is not affected: because it does not save DR6 in the VMCS, it already intercepts #DB unconditionally.
--- arch/x86/kvm/svm.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
arch/x86/kvm/svm.c +3 -11
@@ -1106,6 +1106,7 @@ static void init_vmcb(struct vcpu_svm *svm)set_exception_intercept (svm,UD_VECTOR );set_exception_intercept (svm,MC_VECTOR );set_exception_intercept (svm,AC_VECTOR ); +set_exception_intercept (svm,DB_VECTOR );set_intercept (svm,INTERCEPT_INTR );set_intercept (svm,INTERCEPT_NMI );
@@ -1638,20 +1639,13 @@ static void svm_set_segment(struct kvm_vcpu *vcpu,mark_dirty (svm->vmcb,VMCB_SEG ); } -static void update_db_bp_intercept (struct kvm_vcpu *vcpu) +static void update_bp_intercept (struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu); -clr_exception_intercept (svm,DB_VECTOR );clr_exception_intercept (svm,BP_VECTOR ); -if (svm->nmi_singlestep) -set_exception_intercept (svm,DB_VECTOR ); -if (vcpu->guest_debug &KVM_GUESTDBG_ENABLE ) { -if (vcpu->guest_debug & - (KVM_GUESTDBG_SINGLESTEP |KVM_GUESTDBG_USE_HW_BP )) -set_exception_intercept (svm,DB_VECTOR );if (vcpu->guest_debug &KVM_GUESTDBG_USE_SW_BP )set_exception_intercept (svm,BP_VECTOR ); }else
@@ -1757,7 +1751,6 @@ static int db_interception(struct vcpu_svm *svm)if (!(svm->vcpu.guest_debug &KVM_GUESTDBG_SINGLESTEP )) svm->vmcb->save.rflags &= ~(X86_EFLAGS_TF |X86_EFLAGS_RF ); -update_db_bp_intercept (&svm->vcpu); } if (svm->vcpu.guest_debug &
@@ -3749,7 +3742,6 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)*/ svm->nmi_singlestep = true; svm->vmcb->save.rflags |= (X86_EFLAGS_TF |X86_EFLAGS_RF ); -update_db_bp_intercept (vcpu); }static int svm_set_tss_addr (struct kvm *kvm,unsigned int addr)
@@ -4365,7 +4357,7 @@ static struct kvm_x86_ops svm_x86_ops = { .vcpu_load = svm_vcpu_load, .vcpu_put = svm_vcpu_put, - .update_db_bp_intercept = update_db_bp_intercept, + .update_db_bp_intercept = update_bp_intercept, .get_msr = svm_get_msr, .set_msr = svm_set_msr, .get_segment_base = svm_get_segment_base,
Signature · 1 line
1.9.1
PATCH 109/164 drivers: of: of_reserved_mem: fixup the alignment with CMA setup
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Liu <[email protected]>
commit 1cc8e3458b5110253c8f5aaf1890d5ffea9bb7b7 upstream.
There is an alignment mismatch issue between the of_reserved_mem and the CMA setup requirement. The of_reserved_mem will try to get the alignment value from the DTS and pass it to __memblock_alloc_base to do the memory block base allocation, but the alignment value specified in the DTS may not satisfy the CAM setup requirement since CMA setup required the alignment as the following in the code:
align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
The sanity check in the function of rmem_cma_setup will fail if the alignment does not setup correctly and thus CMA will fail to setup.
This patch is to fixup the alignment to meet the CMA setup required.
Mailing-list-thread: https://lkml.org/lkml/2015/11/9/138
--- drivers/of/of_reserved_mem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/of/of_reserved_mem.c +4 -0
@@ -123,6 +123,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node, align =dt_mem_next_cell (dt_root_addr_cells, &prop); } +/* Need adjust the alignment to satisfy the CMA requirement */ +if (IS_ENABLED (CONFIG_CMA ) &&of_flat_dt_is_compatible (node,"shared-dma-pool" )) + align =max (align, (phys_addr_t )PAGE_SIZE <<max (MAX_ORDER -1 , pageblock_order)); + prop =of_get_flat_dt_prop (node,"alloc-ranges" , &len);if (prop) {
Signature · 1 line
1.9.1
PATCH 110/164 drm/ast: Initialized data needed to map fbdev memory
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Egbert Eich <[email protected]>
commit 28fb4cb7fa6f63dc2fbdb5f2564dcbead8e3eee0 upstream.
Due to a missing initialization there was no way to map fbdev memory. Thus for example using the Xserver with the fbdev driver failed. This fix adds initialization for fix.smem_start and fix.smem_len in the fb_info structure, which fixes this problem.
--- drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_fb.c | 7 +++++++ drivers/gpu/drm/ast/ast_main.c | 1 + drivers/gpu/drm/ast/ast_mode.c | 2 ++ 4 files changed, 11 insertions(+)
drivers/gpu/drm/ast/ast_drv.h +1 -0
@@ -315,6 +315,7 @@ int ast_framebuffer_init(struct drm_device *dev,int ast_fbdev_init (struct drm_device *dev);void ast_fbdev_fini (struct drm_device *dev);void ast_fbdev_set_suspend (struct drm_device *dev,int state); +void ast_fbdev_set_base (struct ast_private *ast,unsigned long gpu_addr);struct ast_bo {struct ttm_buffer_object bo;
drivers/gpu/drm/ast/ast_fb.c +7 -0
@@ -370,3 +370,10 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)fb_set_suspend (ast->fbdev->helper.fbdev, state); } + +void ast_fbdev_set_base (struct ast_private *ast,unsigned long gpu_addr) +{ + ast->fbdev->helper.fbdev->fix.smem_start = + ast->fbdev->helper.fbdev->apertures->ranges[0 ].base + gpu_addr; + ast->fbdev->helper.fbdev->fix.smem_len = ast->vram_size - gpu_addr; +}
drivers/gpu/drm/ast/ast_main.c +1 -0
@@ -448,6 +448,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) dev->mode_config.min_height =0 ; dev->mode_config.preferred_depth =24 ; dev->mode_config.prefer_shadow =1 ; + dev->mode_config.fb_base =pci_resource_start (ast->dev->pdev,0 ); if (ast->chip == AST2100 || ast->chip == AST2200 ||
drivers/gpu/drm/ast/ast_mode.c +2 -0
@@ -547,6 +547,8 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc, ret =ttm_bo_kmap (&bo->bo,0 , bo->bo.num_pages, &bo->kmap);if (ret)DRM_ERROR ("failed to kmap fbcon\n" ); +else +ast_fbdev_set_base (ast, gpu_addr); }ast_bo_unreserve (bo);
Signature · 1 line
1.9.1
PATCH 111/164 FS-Cache: Increase reference of parent after registering, netfs success
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Kinglong Mee <[email protected]>
commit 86108c2e34a26e4bec3c6ddb23390bf8cedcf391 upstream.
If netfs exist, fscache should not increase the reference of parent's usage and n_children, otherwise, never be decreased.
v2: thanks David's suggest,
move increasing reference of parent if success use kmem_cache_free() freeing primary_index directly
v3: don't move "netfs->primary_index->parent = &fscache_fsdef_index;"
--- fs/fscache/netfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/fscache/netfs.c +4 -5
@@ -47,9 +47,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) netfs->primary_index->netfs_data = netfs; netfs->primary_index->flags =1 <<FSCACHE_COOKIE_ENABLED ; -atomic_inc (&netfs->primary_index->parent->usage); -atomic_inc (&netfs->primary_index->parent->n_children); -spin_lock_init (&netfs->primary_index->lock);INIT_HLIST_HEAD (&netfs->primary_index->backing_objects);
@@ -62,6 +59,9 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) goto already_registered; } +atomic_inc (&netfs->primary_index->parent->usage); +atomic_inc (&netfs->primary_index->parent->n_children); +list_add (&netfs->link, &fscache_netfs_list); ret =0 ;
@@ -71,8 +71,7 @@ already_registered:up_write (&fscache_addremove_sem);if (ret <0 ) { - netfs->primary_index->parent =NULL ; -__fscache_cookie_put (netfs->primary_index); +kmem_cache_free (fscache_cookie_jar, netfs->primary_index); netfs->primary_index =NULL ; }
Signature · 1 line
1.9.1
PATCH 112/164 FS-Cache: Don't override netfs's primary_index if registering failed
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Kinglong Mee <[email protected]>
commit b130ed5998e62879a66bad08931a2b5e832da95c upstream.
Only override netfs->primary_index when registering success.
--- fs/fscache/netfs.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
fs/fscache/netfs.c +17 -18
@@ -22,6 +22,7 @@ static LIST_HEAD(fscache_netfs_list);int __fscache_register_netfs (struct fscache_netfs *netfs) {struct fscache_netfs *ptr; +struct fscache_cookie *cookie;int ret;_enter ("{%s}" , netfs->name);
@@ -29,26 +30,25 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)INIT_LIST_HEAD (&netfs->link);/* allocate a cookie for the primary index */ - netfs->primary_index = -kmem_cache_zalloc (fscache_cookie_jar,GFP_KERNEL ); + cookie =kmem_cache_zalloc (fscache_cookie_jar,GFP_KERNEL ); -if (!netfs->primary_index) { +if (!cookie) {_leave (" = -ENOMEM" );return -ENOMEM ; }/* initialise the primary index cookie */ -atomic_set (&netfs->primary_index->usage,1 ); -atomic_set (&netfs->primary_index->n_children,0 ); -atomic_set (&netfs->primary_index->n_active,1 ); +atomic_set (&cookie->usage,1 ); +atomic_set (&cookie->n_children,0 ); +atomic_set (&cookie->n_active,1 ); - netfs->primary_index->def = &fscache_fsdef_netfs_def; - netfs->primary_index->parent = &fscache_fsdef_index; - netfs->primary_index->netfs_data = netfs; - netfs->primary_index->flags =1 <<FSCACHE_COOKIE_ENABLED ; + cookie->def = &fscache_fsdef_netfs_def; + cookie->parent = &fscache_fsdef_index; + cookie->netfs_data = netfs; + cookie->flags =1 <<FSCACHE_COOKIE_ENABLED ; -spin_lock_init (&netfs->primary_index->lock); -INIT_HLIST_HEAD (&netfs->primary_index->backing_objects); +spin_lock_init (&cookie->lock); +INIT_HLIST_HEAD (&cookie->backing_objects);/* check the netfs type is not already present */ down_write (&fscache_addremove_sem);
@@ -59,9 +59,10 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) goto already_registered; } -atomic_inc (&netfs->primary_index->parent->usage); -atomic_inc (&netfs->primary_index->parent->n_children); +atomic_inc (&cookie->parent->usage); +atomic_inc (&cookie->parent->n_children); + netfs->primary_index = cookie;list_add (&netfs->link, &fscache_netfs_list); ret =0 ;
@@ -70,10 +71,8 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) already_registered:up_write (&fscache_addremove_sem); -if (ret <0 ) { -kmem_cache_free (fscache_cookie_jar, netfs->primary_index); - netfs->primary_index =NULL ; - } +if (ret <0 ) +kmem_cache_free (fscache_cookie_jar, cookie);_leave (" = %d" , ret);return ret;
Signature · 1 line
1.9.1
PATCH 113/164 FS-Cache: Handle a write to the page immediately beyond the EOF marker
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 102f4d900c9c8f5ed89ae4746d493fe3ebd7ba64 upstream.
Handle a write being requested to the page immediately beyond the EOF marker on a cache object. Currently this gets an assertion failure in CacheFiles because the EOF marker is used there to encode information about a partial page at the EOF - which could lead to an unknown blank spot in the file if we extend the file over it.
The problem is actually in fscache where we check the index of the page being written against store_limit. store_limit is set to the number of pages that we're allowed to store by fscache_set_store_limit() - which means it's one more than the index of the last page we're allowed to store. The problem is that we permit writing to a page with an index _equal_ to the store limit - when we should reject that case.
Whilst we're at it, change the triggered assertion in CacheFiles to just return -ENOBUFS instead.
The assertion failure looks something like this:
CacheFiles: Assertion failed
1000 < 7b1 is false
------------[ cut here ]------------ kernel BUG at fs/cachefiles/rdwr.c:962! ... RIP: 0010:[<ffffffffa02c9e83>] [<ffffffffa02c9e83>] cachefiles_write_page+0x273/0x2d0 [cachefiles]
--- fs/cachefiles/rdwr.c | 67 +++++++++++++++++++++++++++++----------------------- fs/fscache/page.c | 2 +- 2 files changed, 38 insertions(+), 31 deletions(-)
fs/cachefiles/rdwr.c +37 -30
@@ -905,6 +905,15 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) cache =container_of (object->fscache.cache, struct cachefiles_cache, cache); + pos = (loff_t )page->index <<PAGE_SHIFT ; + +/* We mustn't write more data than we have, so we have to beware of a +* partial page at EOF. +*/ + eof = object->fscache.store_limit_l; +if (pos >= eof) + goto error; +/* write the page to the backing filesystem and let it store it in its * own time */ path.mnt = cache->mnt;
@@ -912,40 +921,38 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) file =dentry_open (&path,O_RDWR |O_LARGEFILE , cache->cache_cred);if (IS_ERR (file)) { ret =PTR_ERR (file); - }else { - pos = (loff_t ) page->index <<PAGE_SHIFT ; - -/* we mustn't write more data than we have, so we have -* to beware of a partial page at EOF */ - eof = object->fscache.store_limit_l; - len =PAGE_SIZE ; -if (eof & ~PAGE_MASK ) { - ASSERTCMP(pos, <, eof); -if (eof - pos <PAGE_SIZE ) { -_debug ("cut short %llx to %llx" , - pos, eof); - len = eof - pos; - ASSERTCMP(pos + len, ==, eof); - } - } - - data =kmap (page); - ret =__kernel_write (file, data, len, &pos); -kunmap (page); -if (ret != len) - ret = -EIO ; -fput (file); + goto error_2; } -if (ret <0 ) { -if (ret == -EIO ) -cachefiles_io_error_obj ( - object,"Write page to backing file failed" ); - ret = -ENOBUFS ; + len =PAGE_SIZE ; +if (eof & ~PAGE_MASK ) { +if (eof - pos <PAGE_SIZE ) { +_debug ("cut short %llx to %llx" , + pos, eof); + len = eof - pos; + ASSERTCMP(pos + len, ==, eof); + } } -_leave (" = %d" , ret); -return ret; + data =kmap (page); + ret =__kernel_write (file, data, len, &pos); +kunmap (page); +fput (file); +if (ret != len) + goto error_eio; + +_leave (" = 0" ); +return 0 ; + +error_eio: + ret = -EIO ; +error_2: +if (ret == -EIO ) +cachefiles_io_error_obj (object, +"Write page to backing file failed" ); +error: +_leave (" = -ENOBUFS [%d]" , ret); +return -ENOBUFS ; }/*
fs/fscache/page.c +1 -1
@@ -816,7 +816,7 @@ static void fscache_write_op(struct fscache_operation *_op) goto superseded; page = results[0 ];_debug ("gang %d [%lx]" , n, page->index); -if (page->index > op->store_limit) { +if (page->index >= op->store_limit) {fscache_stat (&fscache_n_store_pages_over_limit); goto superseded; }
Signature · 1 line
1.9.1
PATCH 114/164 binfmt_elf: Don't clobber passed executable's file header
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit b582ef5c53040c5feef4c96a8f9585b6831e2441 upstream.
Do not clobber the buffer space passed from search_binary_handler' and originally preloaded by prepare_binprm' with the executable's file header by overwriting it with its interpreter's file header. Instead keep the buffer space intact and directly use the data structure locally allocated for the interpreter's file header, fixing a bug introduced in 2.1.14 with loadable module support (linux-mips.org commit beb11695 [Import of Linux/MIPS 2.1.14], predating kernel.org repo's history). Adjust the amount of data read from the interpreter's file accordingly.
This was not an issue before loadable module support, because back then `load_elf_binary' was executed only once for a given ELF executable, whether the function succeeded or failed.
With loadable module support supported and enabled, upon a failure of `load_elf_binary' -- which may for example be caused by architecture code rejecting an executable due to a missing hardware feature requested in the file header -- a module load is attempted and then the function reexecuted by `search_binary_handler'. With the executable's file header replaced with its interpreter's file header the executable can then be erroneously accepted in this subsequent attempt.
--- fs/binfmt_elf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/binfmt_elf.c +5 -5
@@ -758,16 +758,16 @@ static int load_elf_binary(struct linux_binprm *bprm)*/ would_dump (bprm, interpreter); - retval =kernel_read (interpreter,0 , bprm->buf, -BINPRM_BUF_SIZE ); -if (retval !=BINPRM_BUF_SIZE ) { +/* Get the exec headers */ + retval =kernel_read (interpreter,0 , + (void *)&loc->interp_elf_ex, +sizeof (loc->interp_elf_ex)); +if (retval !=sizeof (loc->interp_elf_ex)) {if (retval >=0 ) retval = -EIO ; goto out_free_dentry; } -/* Get the exec headers */ - loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);break ; } elf_ppnt++;
Signature · 1 line
1.9.1
PATCH 115/164 fs/pipe.c: return error code rather than 0 in pipe_write()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 6ae08069939f17422835448acae76bda8d96b16a upstream.
pipe_write() would return 0 if it failed to merge the beginning of the data to write with the last, partially filled pipe buffer. It should return an error code instead. Userspace programs could be confused by write() returning 0 when called with a nonzero 'count'.
The EFAULT error case was a regression from f0d1bec9d5 ("new helper:copy_page_from_iter()"), while the ops->confirm() error case was a much older bug.
Test program:
#include <assert.h>
#include <errno.h>
#include <unistd.h>
int main(void)
{
int fd[2];
char data[1] = {0};
assert(0 == pipe(fd));
assert(1 == write(fd[1], data, 1));
/* prior to this patch, write() returned 0 here */
assert(-1 == write(fd[1], NULL, 1));
assert(errno == EFAULT);
}--- fs/pipe.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/pipe.c +4 -5
@@ -367,18 +367,17 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)int offset = buf->offset + buf->len;if (ops->can_merge && offset + chars <=PAGE_SIZE ) { -int error = ops->confirm (pipe, buf); -if (error) + ret = ops->confirm (pipe, buf); +if (ret) goto out; ret =copy_page_from_iter (buf->page, offset, chars, from);if (unlikely (ret < chars)) { - error = -EFAULT ; + ret = -EFAULT ; goto out; } do_wakeup =1 ; - buf->len += chars; - ret = chars; + buf->len += ret;if (!iov_iter_count (from)) goto out; }
Signature · 1 line
1.9.1
PATCH 116/164 ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lu, Han" <[email protected]>
commit e2656412f2a7343ecfd13eb74bac0a6e6e9c5aad upstream.
Broxton and Skylake have the same behavior on display audio. So this patch applys Skylake fix-ups to Broxton.
--- sound/pci/hda/patch_hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +2 -1
@@ -48,8 +48,9 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");#define is_haswell (codec) ((codec)->vendor_id == 0x80862807)#define is_broadwell (codec) ((codec)->vendor_id == 0x80862808)#define is_skylake (codec) ((codec)->vendor_id == 0x80862809) +#define is_broxton (codec) ((codec)->vendor_id == 0x8086280a)#define is_haswell_plus (codec) (is_haswell(codec) || is_broadwell(codec) \ - || is_skylake(codec)) + || is_skylake(codec) || is_broxton(codec))#define is_valleyview (codec) ((codec)->vendor_id == 0x80862882)#define is_cherryview (codec) ((codec)->vendor_id == 0x80862883)
Signature · 1 line
1.9.1
PATCH 117/164 crypto: crc32c-pclmul - use .rodata instead of .rotata
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Iooss <[email protected]>
commit 97bce7e0b58dfc7d159ded329f57961868fb060b upstream.
Module crc32c-intel uses a special read-only data section named .rotata. This section is defined for K_table, and its name seems to be a spelling mistake for .rodata.
--- arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/crc32c-pcl-intel-asm_64.S +1 -1
@@ -330,7 +330,7 @@ ENDPROC(crc_pcl) ## PCLMULQDQ tables ## Table is 128 entries x 2 words (8 bytes) each ################################################################ -.section .rotata, "a", %progbits +.section .rodata, "a", %progbits .align 8 K_table: .long 0x493c7d27, 0x00000001
Signature · 1 line
1.9.1
PATCH 118/164 wm831x_power: Use IRQF_ONESHOT to request threaded IRQs
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Rothberg <[email protected]>
commit 90adf98d9530054b8e665ba5a928de4307231d84 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.
scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue.
--- drivers/power/wm831x_power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/wm831x_power.c +3 -3
@@ -567,7 +567,7 @@ static int wm831x_power_probe(struct platform_device *pdev) irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"SYSLO" )); ret =request_threaded_irq (irq,NULL , wm831x_syslo_irq, -IRQF_TRIGGER_RISING ,"System power low" , +IRQF_TRIGGER_RISING |IRQF_ONESHOT ,"System power low" , power);if (ret !=0 ) { dev_err(&pdev->dev, "Failed to request SYSLO IRQ %d: %d\n",
@@ -577,7 +577,7 @@ static int wm831x_power_probe(struct platform_device *pdev) irq =wm831x_irq (wm831x,platform_get_irq_byname (pdev,"PWR SRC" )); ret =request_threaded_irq (irq,NULL , wm831x_pwr_src_irq, -IRQF_TRIGGER_RISING ,"Power source" , +IRQF_TRIGGER_RISING |IRQF_ONESHOT ,"Power source" , power);if (ret !=0 ) { dev_err(&pdev->dev, "Failed to request PWR SRC IRQ %d: %d\n",
@@ -590,7 +590,7 @@ static int wm831x_power_probe(struct platform_device *pdev)platform_get_irq_byname (pdev, wm831x_bat_irqs[i])); ret =request_threaded_irq (irq,NULL , wm831x_bat_irq, -IRQF_TRIGGER_RISING , +IRQF_TRIGGER_RISING |IRQF_ONESHOT , wm831x_bat_irqs[i], power);if (ret !=0 ) {
Signature · 1 line
1.9.1
PATCH 119/164 mwifiex: fix mwifiex_rdeeprom_read()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 1f9c6e1bc1ba5f8a10fcd6e99d170954d7c6d382 upstream.
There were several bugs here.
1) The done label was in the wrong place so we didn't copy any information out when there was no command given.
2) We were using PAGE_SIZE as the size of the buffer instead of
"PAGE_SIZE - pos".
3) snprintf() returns the number of characters that would have been printed if there were enough space. If there was not enough space (and we had fixed the memory corruption bug #2) then it would result in an information leak when we do simple_read_from_buffer(). I've changed it to use scnprintf() instead.
I also removed the initialization at the start of the function, because I thought it made the code a little more clear.
--- drivers/net/wireless/mwifiex/debugfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/debugfs.c +7 -7
@@ -660,7 +660,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, (struct mwifiex_private *) file->private_data;unsigned long addr =get_zeroed_page (GFP_KERNEL );char *buf = (char *) addr; -int pos =0 , ret =0 , i; +int pos, ret, i;u8 value[MAX_EEPROM_DATA ];if (!buf)
@@ -668,7 +668,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,if (saved_offset ==-1 ) {/* No command has been given */ - pos +=snprintf (buf,PAGE_SIZE ,"0" ); + pos =snprintf (buf,PAGE_SIZE ,"0" ); goto done; }
@@ -677,17 +677,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, (u16) saved_bytes, value);if (ret) { ret = -EINVAL ; - goto done; + goto out_free; } - pos +=snprintf (buf,PAGE_SIZE ,"%d %d " , saved_offset, saved_bytes); + pos =snprintf (buf,PAGE_SIZE ,"%d %d " , saved_offset, saved_bytes);for (i =0 ; i < saved_bytes; i++) - pos +=snprintf (buf +strlen (buf),PAGE_SIZE ,"%d " , value[i]); - - ret =simple_read_from_buffer (ubuf, count, ppos, buf, pos); + pos +=scnprintf (buf + pos,PAGE_SIZE - pos,"%d " , value[i]); done: + ret =simple_read_from_buffer (ubuf, count, ppos, buf, pos); +out_free:free_page (addr);return ret; }
Signature · 1 line
1.9.1
PATCH 120/164 dmaengine: dw: convert to __ffs()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 39416677b95bf1ab8bbfa229ec7e511c96ad5d0c upstream.
We replace __fls() by __ffs() since we have to find a *minimum* data width that satisfies both source and destination.
While here, rename dwc_fast_fls() to dwc_fast_ffs() which it really is.
--- drivers/dma/dw/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/dma/dw/core.c +6 -6
@@ -156,7 +156,7 @@ static void dwc_initialize(struct dw_dma_chan *dwc)/*----------------------------------------------------------------------*/ -static inline unsigned int dwc_fast_fls (unsigned long long v) +static inline unsigned int dwc_fast_ffs (unsigned long long v) {/* * We can be a lot more clever here, but this should take care
@@ -704,7 +704,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, dw->data_width[dwc->dst_master]); src_width = dst_width = min_t(unsigned int, data_width, -dwc_fast_fls (src | dest | len)); +dwc_fast_ffs (src | dest | len)); ctllo =DWC_DEFAULT_CTLLO (chan) |DWC_CTLL_DST_WIDTH (dst_width)
@@ -783,7 +783,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,switch (direction) {case DMA_MEM_TO_DEV : - reg_width =__fls (sconfig->dst_addr_width); + reg_width =__ffs (sconfig->dst_addr_width); reg = sconfig->dst_addr; ctllo = (DWC_DEFAULT_CTLLO (chan) | DWC_CTLL_DST_WIDTH(reg_width)
@@ -803,7 +803,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, len =sg_dma_len (sg); mem_width = min_t(unsigned int, - data_width,dwc_fast_fls (mem | len)); + data_width,dwc_fast_ffs (mem | len)); slave_sg_todev_fill_desc: desc =dwc_desc_get (dwc);
@@ -843,7 +843,7 @@ slave_sg_todev_fill_desc: }break ;case DMA_DEV_TO_MEM : - reg_width =__fls (sconfig->src_addr_width); + reg_width =__ffs (sconfig->src_addr_width); reg = sconfig->src_addr; ctllo = (DWC_DEFAULT_CTLLO (chan) | DWC_CTLL_SRC_WIDTH(reg_width)
@@ -863,7 +863,7 @@ slave_sg_todev_fill_desc: len =sg_dma_len (sg); mem_width = min_t(unsigned int, - data_width,dwc_fast_fls (mem | len)); + data_width,dwc_fast_ffs (mem | len)); slave_sg_fromdev_fill_desc: desc =dwc_desc_get (dwc);
Signature · 1 line
1.9.1
PATCH 121/164 tcp: call sk_mark_napi_id() on the child, not the listener
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 38cb52455c2c3e8b5751350a3fb32e43e82e129a upstream.
This fixes a typo : We want to store the NAPI id on child socket. Presumably nobody really uses busy polling, on short lived flows.
--- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +1 -1
@@ -1456,7 +1456,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)if (nsk != sk) {sock_rps_save_rxhash (nsk, skb); -sk_mark_napi_id (sk, skb); +sk_mark_napi_id (nsk, skb);if (tcp_child_process (sk, nsk, skb)) { rsk = nsk; goto reset;
net/ipv6/tcp_ipv6.c +1 -1
@@ -1326,7 +1326,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)*/ if (nsk != sk) {sock_rps_save_rxhash (nsk, skb); -sk_mark_napi_id (sk, skb); +sk_mark_napi_id (nsk, skb);if (tcp_child_process (sk, nsk, skb)) goto reset;if (opt_skb)
Signature · 1 line
1.9.1
PATCH 122/164 vivid: Fix iteration in driver removal path
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ezequiel Garcia <[email protected]>
commit a5d42b8c3b3ddccd88dc1c70957177d31a6699fb upstream.
When the diver is removed and all the resources are deallocated, we should be iterating through the created devices only.
Currently, the iteration ends when vivid_devs[i] is NULL. Since the array contains VIVID_MAX_DEVS elements, it will oops if n_devs=VIVID_MAX_DEVS because in that case, no element is NULL.
--- drivers/media/platform/vivid/vivid-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-core.c +4 -1
@@ -1314,8 +1314,11 @@ static void __exit vivid_exit(void)struct vivid_dev *dev;unsigned i; -for (i =0 ; vivid_devs[i]; i++) { + +for (i =0 ; i < n_devs; i++) { dev = vivid_devs[i]; +if (!dev) +continue ;if (dev->has_vid_cap) { v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
Signature · 1 line
1.9.1
PATCH 123/164 usb: ehci-orion: fix probe for !GENERIC_PHY
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
commit db1319e166c5e872c4be54eac4e47454133708cf upstream.
Commit d445913ce0ab7f ("usb: ehci-orion: add optional PHY support") added support for optional phys, but devm_phy_optional_get returns -ENOSYS if GENERIC_PHY is not enabled.
This causes probe failures, even when there are no phys specified:
[ 1.443365] orion-ehci f1058000.usb: init f1058000.usb fail, -38 [ 1.449403] orion-ehci: probe of f1058000.usb failed with error -38
Similar to dwc3, treat -ENOSYS as no phy.
--- drivers/usb/host/ehci-orion.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-orion.c +2 -1
@@ -218,7 +218,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) priv->phy =devm_phy_optional_get (&pdev->dev,"usb" );if (IS_ERR (priv->phy)) { err =PTR_ERR (priv->phy); - goto err_phy_get; +if (err != -ENOSYS ) + goto err_phy_get; }else { err =phy_init (priv->phy);if (err)
Signature · 1 line
1.9.1
PATCH 124/164 devres: fix a for loop bounds check
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 1f35d04a02a652f14566f875aef3a6f2af4cb77b upstream.
The iomap[] array has PCIM_IOMAP_MAX (6) elements and not DEVICE_COUNT_RESOURCE (16). This bug was found using a static checker. It may be that the "if (!(mask & (1 << i)))" check means we never actually go past the end of the array in real life.
--- lib/devres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/devres.c +1 -1
@@ -395,7 +395,7 @@ void pcim_iounmap_regions(struct pci_dev *pdev, int mask)if (!iomap)return ; -for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) { +for (i =0 ; i <PCIM_IOMAP_MAX ; i++) {if (!(mask & (1 << i)))continue ;
Signature · 1 line
1.9.1
PATCH 125/164 netfilter: remove dead code
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Flavio Leitner <[email protected]>
commit 0647e708344f4bf8b9e3f1855361c597f93d084d upstream.
Remove __nf_conntrack_find() from headers.
--- include/net/netfilter/nf_conntrack.h | 4 ---- 1 file changed, 4 deletions(-)
include/net/netfilter/nf_conntrack.h +0 -4
@@ -184,10 +184,6 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);void nf_ct_free_hashtable (void *hash,unsigned int size); -struct nf_conntrack_tuple_hash * -__nf_conntrack_find (struct net *net,u16 zone, -const struct nf_conntrack_tuple *tuple); -int nf_conntrack_hash_check_insert (struct nf_conn *ct);bool nf_ct_delete (struct nf_conn *ct,u32 pid,int report);
Signature · 1 line
1.9.1
PATCH 126/164 ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 850dcc4d4dd7d5da5c1b2a780c5e649c3b649545 upstream.
After a packet has been encapsulated by a tunnel we should use the tunnel sockets local multicast loopback flag to control if the encapsulated packet should be locally loopback back.
Pass sk into ip_local_out_sk so that in the rare case we are dealing with a tunneled packet whose tunnel destination address is a multicast address the kernel properly decides to loopback this packet.
In practice I don't think this matters as ip_queue_xmit is used by tcp, l2tp and sctp none of which I am aware of uses ip level multicasting as they are all point to point communications protocols. Let's fix this before someone uses ip_queue_xmit for a tunnel protocol that does use multicast.
--- net/ipv4/ip_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ip_output.c +1 -1
@@ -436,7 +436,7 @@ packet_routed: skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; - res =ip_local_out (skb); + res =ip_local_out_sk (sk, skb);rcu_read_unlock ();return res;
Signature · 1 line
1.9.1
PATCH 127/164 i2c: img-scb: enable fencing for all versions of the ip
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 0e59378bc05b084939af54d2066552ac42fa0fee upstream.
The code to read from the master read fifo, and write to the master write fifo, checks a bit in an SCB register before every byte to ensure that the fifo is not full (write fifo) or empty (read fifo). Due to clock domain crossing inside the SCB block the updated value of this bit is only visible after 2 cycles.
The scb_wr_rd_fence() function does 2 dummy writes (to the read-only revision register), and it's called before reading from or writing to the fifos to ensure that subsequent reads of the fifo status bits do not read stale values.
As the 2 dummy writes are required in all versions of the ip, the version check is dropped.
--- drivers/i2c/busses/i2c-img-scb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +2 -6
@@ -278,8 +278,6 @@#define ISR_COMPLETE (err) (ISR_COMPLETE_M | (ISR_STATUS_M & (err)))#define ISR_FATAL (err) (ISR_COMPLETE(err) | ISR_FATAL_M) -#define REL_SOC_IP_SCB_2_2_1 0x00020201 -enum img_i2c_mode {MODE_INACTIVE ,MODE_RAW ,
@@ -1118,10 +1116,8 @@ static int img_i2c_init(struct img_i2c *i2c)return -EINVAL ; } -if (rev ==REL_SOC_IP_SCB_2_2_1 ) { - i2c->need_wr_rd_fence = true; -dev_info (i2c->adap.dev.parent,"fence quirk enabled" ); - } +/* Fencing enabled by default. */ + i2c->need_wr_rd_fence = true; bitrate_khz = i2c->bitrate /1000 ; clk_khz =clk_get_rate (i2c->scb_clk) /1000 ;
Signature · 1 line
1.9.1
PATCH 128/164 i2c: img-scb: do dummy writes before fifo access
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 2aefb1bd4101235be7d9f0d5ac8d56aa979f6081 upstream.
Move scb_wr_rd_fence to before reading from fifo and writing to fifo to make sure the the first read/write is done after the required number of cycles.
--- drivers/i2c/busses/i2c-img-scb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +2 -2
@@ -534,6 +534,7 @@ static void img_i2c_read_fifo(struct img_i2c *i2c)u32 fifo_status;u8 data; +img_i2c_wr_rd_fence (i2c); fifo_status =img_i2c_readl (i2c,SCB_FIFO_STATUS_REG );if (fifo_status &FIFO_READ_EMPTY )break ;
@@ -542,7 +543,6 @@ static void img_i2c_read_fifo(struct img_i2c *i2c) *i2c->msg.buf = data;img_i2c_writel (i2c,SCB_READ_FIFO_REG ,0xff ); -img_i2c_wr_rd_fence (i2c); i2c->msg.len--; i2c->msg.buf++; }
@@ -554,12 +554,12 @@ static void img_i2c_write_fifo(struct img_i2c *i2c)while (i2c->msg.len) {u32 fifo_status; +img_i2c_wr_rd_fence (i2c); fifo_status =img_i2c_readl (i2c,SCB_FIFO_STATUS_REG );if (fifo_status &FIFO_WRITE_FULL )break ;img_i2c_writel (i2c,SCB_WRITE_DATA_REG , *i2c->msg.buf); -img_i2c_wr_rd_fence (i2c); i2c->msg.len--; i2c->msg.buf++; }
Signature · 1 line
1.9.1
PATCH 129/164 i2c: img-scb: use DIV_ROUND_UP to round divisor values
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 5728d95f2458887ae3d95547c04352bba5080ad6 upstream.
Using % can be slow depending on the architecture.
Using DIV_ROUND_UP is nicer and more efficient way to do it.
--- drivers/i2c/busses/i2c-img-scb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +2 -6
@@ -1177,9 +1177,7 @@ static int img_i2c_init(struct img_i2c *i2c) int_bitrate++;/* Setup TCKH value */ - tckh = timing.tckh / clk_period; -if (timing.tckh % clk_period) - tckh++; + tckh =DIV_ROUND_UP (timing.tckh, clk_period);if (tckh >0 ) data = tckh -1 ;
@@ -1199,9 +1197,7 @@ static int img_i2c_init(struct img_i2c *i2c)img_i2c_writel (i2c,SCB_TIME_TCKL_REG , data);/* Setup TSDH value */ - tsdh = timing.tsdh / clk_period; -if (timing.tsdh % clk_period) - tsdh++; + tsdh =DIV_ROUND_UP (timing.tsdh, clk_period);if (tsdh >1 ) data = tsdh -1 ;
Signature · 1 line
1.9.1
PATCH 130/164 i2c: img-scb: fix LOW and HIGH period values for the SCL clock
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 987008dbc48479af250cddda7f36e920a47ef54f upstream.
Currently, after determining the minimum value for the High period (TCKH) the remainder of the internal clock pulses is set as the Low period (TCKL). This causes the i2c clock duty cycle to be much less than 50%.
Modify the starting position to TCKH and TCKL at 50% of the internal clock, and adjusts the TCKH and TCKL values from there should the minimum value for TCKL not be met. This results in duty cycles closer to 50%.
--- drivers/i2c/busses/i2c-img-scb.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +17 -13
@@ -1176,25 +1176,29 @@ static int img_i2c_init(struct img_i2c *i2c) ((bitrate_khz * clk_period) / 2)) int_bitrate++; -/* Setup TCKH value */ - tckh =DIV_ROUND_UP (timing.tckh, clk_period); +/* +* Setup clock duty cycle, start with 50% and adjust TCKH and TCKL +* values from there if they don't meet minimum timing requirements +*/ + tckh = int_bitrate /2 ; + tckl = int_bitrate - tckh; -if (tckh >0 ) - data = tckh -1 ; -else - data =0 ; +/* Adjust TCKH and TCKL values */ + data =DIV_ROUND_UP (timing.tckl, clk_period); -img_i2c_writel (i2c,SCB_TIME_TCKH_REG , data); +if (tckl < data) { + tckl = data; + tckh = int_bitrate - tckl; + } -/* Setup TCKL value */ - tckl = int_bitrate - tckh; +if (tckh >0 ) + --tckh;if (tckl >0 ) - data = tckl -1 ; -else - data =0 ; + --tckl; -img_i2c_writel (i2c,SCB_TIME_TCKL_REG , data); +img_i2c_writel (i2c,SCB_TIME_TCKH_REG , tckh); +img_i2c_writel (i2c,SCB_TIME_TCKL_REG , tckl);/* Setup TSDH value */ tsdh =DIV_ROUND_UP (timing.tsdh, clk_period);
Signature · 1 line
1.9.1
PATCH 131/164 i2c: img-scb: Clear line and interrupt status before starting a transfer
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 1ed6faedfc9741cca2d97b25ab73902ba7177093 upstream.
Clear line status and all generated interrupts from the interrupt status register before starting a transfer, as we may have unserviced interrupts from previous transfers that might be handled in the context of the new transfer.
--- drivers/i2c/busses/i2c-img-scb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/i2c/busses/i2c-img-scb.c +9 -0
@@ -1058,6 +1058,15 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, i2c->last_msg = (i == num -1 );reinit_completion (&i2c->msg_complete); +/* +* Clear line status and all interrupts before starting a +* transfer, as we may have unserviced interrupts from +* previous transfers that might be handled in the context +* of the new transfer. +*/ +img_i2c_writel (i2c,SCB_INT_CLEAR_REG , ~0 ); +img_i2c_writel (i2c,SCB_CLEAR_REG , ~0 ); +if (atomic)img_i2c_atomic_start (i2c);else if (msg->flags &I2C_M_RD )
Signature · 1 line
1.9.1
PATCH 132/164 i2c: img-scb: verify support for requested bit rate
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sifan Naeem <[email protected]>
commit 58b0497dad1abbe389af83e3d7706be584cf3ba2 upstream.
The requested bit rate can be outside the range supported by the driver. The maximum bit rate this driver supports at the moment is 400Khz.
If the requested bit rate is larger than the maximum supported by the driver, set the bitrate to the maximum supported before bitrate_khz is calculated.
Maximum speed supported by the driver can be increased to 1Mhz by adding support for "fast plus mode" in the future.
--- drivers/i2c/busses/i2c-img-scb.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +11 -3
@@ -1128,9 +1128,6 @@ static int img_i2c_init(struct img_i2c *i2c)/* Fencing enabled by default. */ i2c->need_wr_rd_fence = true; - bitrate_khz = i2c->bitrate /1000 ; - clk_khz =clk_get_rate (i2c->scb_clk) /1000 ; -/* Determine what mode we're in from the bitrate */ timing = timings[0 ];for (i =0 ; i <ARRAY_SIZE (timings); i++) {
@@ -1139,6 +1136,17 @@ static int img_i2c_init(struct img_i2c *i2c)break ; } } +if (i2c->bitrate > timings[ARRAY_SIZE (timings) -1 ].max_bitrate) { +dev_warn (i2c->adap.dev.parent, +"requested bitrate (%u) is higher than the max bitrate supported (%u)\n" , + i2c->bitrate, + timings[ARRAY_SIZE (timings) -1 ].max_bitrate); + timing = timings[ARRAY_SIZE (timings) -1 ]; + i2c->bitrate = timing.max_bitrate; + } + + bitrate_khz = i2c->bitrate /1000 ; + clk_khz =clk_get_rate (i2c->scb_clk) /1000 ;/* Find the prescale that would give us that inc (approx delay = 0) */ prescale =SCB_OPT_INC * clk_khz / (256 *16 * bitrate_khz);
Signature · 1 line
1.9.1
PATCH 133/164 hsi: fix double kfree
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit f098a045350ecd6045f2f2d5a50fecf2a98962d7 upstream.
When device_register() fails, kfree() is called in hsi_client_release(), hence there is no need to call kfree in err3 again.
--- drivers/hsi/hsi.c | 1 - 1 file changed, 1 deletion(-)
drivers/hsi/hsi.c +0 -1
@@ -300,7 +300,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port,if (device_register (&cl->device) <0 ) {pr_err ("hsi: failed to register client: %s\n" , name);put_device (&cl->device); - goto err3; }return ;
Signature · 1 line
1.9.1
PATCH 134/164 hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit e74eba049356fdad6713ab66322d9aeb0e85608b upstream.
The error handling path is broken as cawake_gpio was defined as unsigned integer causing the following warnings on boards that don't use SSI port and so don't have cawake_gpio defined. e.g. beagleboard C4.
[ 30.094635] WARNING: CPU: 0 PID: 322 at drivers/gpio/gpiolib.c:86 gpio_to_desc+0xa4/0xb8() [ 30.103363] invalid GPIO -2 [ 30.106292] Modules linked in: omap_ssi_port(+) cpufreq_dt cfbfillrect cfbimgblt leds_gpio cfbcopyarea thermal_sys led_class hwmon gpio_keys encoder_tfp410 connector_analog_tv connector_dvi omap_hdq snd phy_i [ 30.145477] CPU: 0 PID: 322 Comm: modprobe Not tainted 4.3.0-rc4-00030-gca978c0-dirty #335 [ 30.154174] Hardware name: Generic OMAP3-GP (Flattened Device Tree) [ 30.160827] [<c0016ef4>] (unwind_backtrace) from [<c00131f4>] (show_stack+0x10/0x14) [ 30.168975] [<c00131f4>] (show_stack) from [<c033cf08>] (dump_stack+0x80/0x9c) [ 30.176635] [<c033cf08>] (dump_stack) from [<c003e920>] (warn_slowpath_common+0x7c/0xb8) [ 30.185180] [<c003e920>] (warn_slowpath_common) from [<c003e9f0>] (warn_slowpath_fmt+0x30/0x40) [ 30.194366] [<c003e9f0>] (warn_slowpath_fmt) from [<c0376314>] (gpio_to_desc+0xa4/0xb8) [ 30.202819] [<c0376314>] (gpio_to_desc) from [<c0376ac8>] (gpio_request_one+0x14/0x11c) [ 30.211273] [<c0376ac8>] (gpio_request_one) from [<c037370c>] (devm_gpio_request_one+0x3c/0x78) [ 30.220458] [<c037370c>] (devm_gpio_request_one) from [<bf184210>] (ssi_port_probe+0x118/0x504 [omap_ssi_port]) [ 30.231170] [<bf184210>] (ssi_port_probe [omap_ssi_port]) from [<c03d4cfc>] (platform_drv_probe+0x48/0xa4) [ 30.241424] [<c03d4cfc>] (platform_drv_probe) from [<c03d3678>] (driver_probe_device+0x1dc/0x2a0) [ 30.250793] [<c03d3678>] (driver_probe_device) from [<c03d37d0>] (__driver_attach+0x94/0x98) [ 30.259643] [<c03d37d0>] (__driver_attach) from [<c03d1d60>] (bus_for_each_dev+0x54/0x88) [ 30.268249] [<c03d1d60>] (bus_for_each_dev) from [<c03d2d50>] (bus_add_driver+0xe8/0x1f8) [ 30.276916] [<c03d2d50>] (bus_add_driver) from [<c03d4118>] (driver_register+0x78/0xf4) [ 30.285369] [<c03d4118>] (driver_register) from [<c03d5380>] (__platform_driver_probe+0x34/0xd8) [ 30.294647] [<c03d5380>] (__platform_driver_probe) from [<c00097e4>] (do_one_initcall+0x80/0x1d8) [ 30.303985] [<c00097e4>] (do_one_initcall) from [<c011617c>] (do_init_module+0x5c/0x1cc) [ 30.312561] [<c011617c>] (do_init_module) from [<c00c7a68>] (load_module+0x18c8/0x1f0c) [ 30.320983] [<c00c7a68>] (load_module) from [<c00c8188>] (SyS_init_module+0xdc/0x150) [ 30.329223] [<c00c8188>] (SyS_init_module) from [<c000f7e0>] (ret_fast_syscall+0x0/0x1c)
--- drivers/hsi/controllers/omap_ssi_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hsi/controllers/omap_ssi_port.c +1 -1
@@ -1111,7 +1111,7 @@ static int __init ssi_port_probe(struct platform_device *pd)struct omap_ssi_port *omap_port;struct hsi_controller *ssi =dev_get_drvdata (pd->dev.parent);struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); -u32 cawake_gpio =0 ; +int cawake_gpio =0 ;u32 port_id;int err;
Signature · 1 line
1.9.1
PATCH 135/164 regulator: arizona-ldo1: Fix handling of GPIO 0
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit ce938001c08c6580a8da38dc226fa605512afab6 upstream.
The LDO1 driver is using the arizona_of_get_named_gpio helper function which will return 0 if an error was encountered whilst parsing the GPIO, as under the pdata scheme 0 was not being treated as a valid GPIO. However, since the regulator framework was expanded to allow the use of GPIO 0 this causes us to attempt to register GPIO 0 when we encountered an error parsing the device tree.
This patch uses of_get_named_gpio directly and sets the ena_gpio_initialized flag based on the return value.
--- drivers/regulator/arizona-ldo1.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/regulator/arizona-ldo1.c +13 -5
@@ -17,6 +17,7 @@#include <linux/bitops.h> #include <linux/err.h> #include <linux/of.h> +#include <linux/of_gpio.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h>
@@ -184,13 +185,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona, {struct arizona_pdata *pdata = &arizona->pdata;struct arizona_ldo1 *ldo1 = config->driver_data; +struct device_node *np = arizona->dev->of_node;struct device_node *init_node, *dcvdd_node;struct regulator_init_data *init_data; - pdata->ldoena =arizona_of_get_named_gpio (arizona,"wlf,ldoena" , true); + pdata->ldoena =of_get_named_gpio (np,"wlf,ldoena" ,0 ); +if (pdata->ldoena <0 ) { +dev_warn (arizona->dev, +"LDOENA GPIO property missing/malformed: %d\n" , + pdata->ldoena); + pdata->ldoena =0 ; + }else { + config->ena_gpio_initialized = true; + } - init_node =of_get_child_by_name (arizona->dev->of_node,"ldo1" ); - dcvdd_node =of_parse_phandle (arizona->dev->of_node,"DCVDD-supply" ,0 ); + init_node =of_get_child_by_name (np,"ldo1" ); + dcvdd_node =of_parse_phandle (np,"DCVDD-supply" ,0 );if (init_node) { config->of_node = init_node;
@@ -262,8 +272,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev) ret =arizona_ldo1_of_get_pdata (arizona, &config, desc);if (ret <0 )return ret; - - config.ena_gpio_initialized = true; } }
Signature · 1 line
1.9.1
PATCH 136/164 ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 54c09889bff6d99c8733eed4a26c9391b177c88b upstream.
The z2 machine calls pxa27x_set_pwrmode() in order to power off the machine, but this function gets discarded early at boot because it is marked __init, as pointed out by kbuild:
WARNING: vmlinux.o(.text+0x145c4): Section mismatch in reference from the function z2_power_off() to the function .init.text:pxa27x_set_pwrmode() The function z2_power_off() references
the function __init pxa27x_set_pwrmode().
This is often because z2_power_off lacks a __init
annotation or the annotation of pxa27x_set_pwrmode is wrong.
This removes the __init section modifier to fix rebooting and the build error.
--- arch/arm/mach-pxa/include/mach/pxa27x.h | 2 +- arch/arm/mach-pxa/pxa27x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/include/mach/pxa27x.h +1 -1
@@ -19,7 +19,7 @@#define ARB_CORE_PARK (1<<24)/* Be parked with core when idle */ #define ARB_LOCK_FLAG (1<<23)/* Only Locking masters gain access to the bus */ -extern int __init pxa27x_set_pwrmode (unsigned int mode); +extern int pxa27x_set_pwrmode (unsigned int mode);extern void pxa27x_cpu_pm_enter (suspend_state_t state);#endif /* __MACH_PXA27x_H */
arch/arm/mach-pxa/pxa27x.c +1 -1
@@ -251,7 +251,7 @@ static struct clk_lookup pxa27x_clkregs[] = {*/ static unsigned int pwrmode =PWRMODE_SLEEP ; -int __init pxa27x_set_pwrmode (unsigned int mode) +int pxa27x_set_pwrmode (unsigned int mode) {switch (mode) {case PWRMODE_SLEEP :
Signature · 1 line
1.9.1
PATCH 137/164 ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit df4833886f91eea0d20e6e97066adab308625ef8 upstream.
When committed to upstream, these four modules had wrong entries for Makefile. This forces them to be loadable modules even if they're set as built-in.
This commit fixes this bug.
--- sound/firewire/bebob/Makefile | 2 +- sound/firewire/dice/Makefile | 2 +- sound/firewire/fireworks/Makefile | 2 +- sound/firewire/oxfw/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
sound/firewire/bebob/Makefile +1 -1
@@ -1,4 +1,4 @@ snd-bebob-objs := bebob_command.o bebob_stream.o bebob_proc.o bebob_midi.o \ bebob_pcm.o bebob_hwdep.o bebob_terratec.o bebob_yamaha.o \ bebob_focusrite.o bebob_maudio.o bebob.o -obj-m += snd-bebob.o +obj-$(CONFIG_SND_BEBOB) += snd-bebob.o
sound/firewire/dice/Makefile +1 -1
@@ -1,3 +1,3 @@ snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \ dice-pcm.o dice-hwdep.o dice.o -obj-m += snd-dice.o +obj-$(CONFIG_SND_DICE) += snd-dice.o
sound/firewire/fireworks/Makefile +1 -1
@@ -1,4 +1,4 @@ snd-fireworks-objs := fireworks_transaction.o fireworks_command.o \ fireworks_stream.o fireworks_proc.o fireworks_midi.o \ fireworks_pcm.o fireworks_hwdep.o fireworks.o -obj-m += snd-fireworks.o +obj-$(CONFIG_SND_FIREWORKS) += snd-fireworks.o
sound/firewire/oxfw/Makefile +1 -1
@@ -1,3 +1,3 @@ snd-oxfw-objs := oxfw-command.o oxfw-stream.o oxfw-control.o oxfw-pcm.o \ oxfw-proc.o oxfw-midi.o oxfw-hwdep.o oxfw.o -obj-m += snd-oxfw.o +obj-$(CONFIG_SND_OXFW) += snd-oxfw.o
Signature · 1 line
1.9.1
PATCH 138/164 drm: Fix return value of drm_framebuffer_init()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 3c67d839b30c7d6d6ab5c6fddac0f58ec8095d50 upstream.
In its original version, drm_framebuffer_init() returned a negative int if drm_mode_object_get() failed (f453ba046074, "DRM: add mode setting support").
This was accidentally disabled by commit 4b096ac10da0 ("drm: revamp locking around fb creation/destruction"). Thus, drm_framebuffer_init() pretends success if drm_mode_object_get() failed.
Reinstate the original behaviour. Also fix erroneous kernel-doc of drm_mode_object_get().
destruction")
--- drivers/gpu/drm/drm_crtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +2 -3
@@ -312,8 +312,7 @@ static int drm_mode_object_get_reg(struct drm_device *dev,* reference counted modeset objects like framebuffers. * * Returns: -* New unique (relative to other objects in @dev) integer identifier for the -* object. +* Zero on success, error code on failure. */ int drm_mode_object_get (struct drm_device *dev,struct drm_mode_object *obj,uint32_t obj_type)
@@ -427,7 +426,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, out:mutex_unlock (&dev->mode_config.fb_lock); -return 0 ; +return ret; }EXPORT_SYMBOL (drm_framebuffer_init);
Signature · 1 line
1.9.1
PATCH 139/164 ALSA: dice: correct variable types for __be32 data
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 3e93d42a04eea4e621f87bfc51b0ab868e131cb9 upstream.
Some local variables in some functions are typed as unsigned int, while __be32 value is assigned to them. This causes sparse warnings.
dice-stream.c:50:17: warning: incorrect type in assignment (different base types)
dice-stream.c:50:17: expected unsigned int [unsigned] channel
dice-stream.c:50:17: got restricted __be32 [usertype] <noident>
dice-stream.c:74:17: warning: incorrect type in assignment (different base types)
dice-stream.c:74:17: expected unsigned int [unsigned] channel
dice-stream.c:74:17: got restricted __be32 [usertype] <noident>
This commit fixes this bug.
--- sound/firewire/dice/dice-stream.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/firewire/dice/dice-stream.c +6 -6
@@ -44,16 +44,16 @@ int snd_dice_stream_get_rate_mode(struct snd_dice *dice, unsigned int rate,static void release_resources (struct snd_dice *dice,struct fw_iso_resources *resources) { -unsigned int channel; +__be32 channel;/* Reset channel number */ channel =cpu_to_be32 ((u32)-1 );if (resources == &dice->tx_resources)snd_dice_transaction_write_tx (dice,TX_ISOCHRONOUS , - &channel,4 ); + &channel,sizeof (channel));else snd_dice_transaction_write_rx (dice,RX_ISOCHRONOUS , - &channel,4 ); + &channel,sizeof (channel));fw_iso_resources_free (resources); }
@@ -62,7 +62,7 @@ static int keep_resources(struct snd_dice *dice,struct fw_iso_resources *resources, unsigned int max_payload_bytes) { - unsigned int channel; + __be32 channel;int err; err = fw_iso_resources_allocate(resources, max_payload_bytes,
@@ -74,10 +74,10 @@ static int keep_resources(struct snd_dice *dice, channel =cpu_to_be32 (resources->channel);if (resources == &dice->tx_resources) err =snd_dice_transaction_write_tx (dice,TX_ISOCHRONOUS , - &channel,4 ); + &channel,sizeof (channel));else err =snd_dice_transaction_write_rx (dice,RX_ISOCHRONOUS , - &channel,4 ); + &channel,sizeof (channel));if (err <0 )release_resources (dice, resources); end:
Signature · 1 line
1.9.1
PATCH 140/164 ALSA: dice: assign converted data to the same type of variable
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit cbc6f28067aa0aa1193c2bf3546430b2c4dae22c upstream.
In former commit, u32 data was assigned to __be32 variable instead of an int variable. This is not enough solution because it still causes sparse warnings.
dice.c:80:23: warning: incorrect type in assignment (different base types)
dice.c:80:23: expected restricted __be32 [usertype] value
dice.c:80:23: got unsigned int
dice.c:81:21: warning: restricted __be32 degrades to integer dice.c:81:46: warning: restricted __be32 degrades to integer
This commit fixes this bug.
--- sound/firewire/dice/dice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/firewire/dice/dice.c +2 -1
@@ -29,7 +29,8 @@ static int dice_interface_check(struct fw_unit *unit)struct fw_csr_iterator it;int key, val, vendor =-1 , model =-1 , err;unsigned int category, i; -__be32 *pointers, value; +__be32 *pointers; +u32 value;__be32 version; pointers = kmalloc_array(ARRAY_SIZE(min_values), sizeof(__be32),
Signature · 1 line
1.9.1
PATCH 141/164 ALSA: fireworks: use u32 type for be32_to_cpup() macro
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 463543ac2effaeb2b524f0a0a92f2413c23998ca upstream.
In former commit, snd_efw_command_get_phys_meters() was added to handle metering data. The given buffer is used to save transaction result and to convert between endianness. But this causes sparse warnings.
fireworks_command.c:269:25: warning: incorrect type in argument 1 (different base types)
fireworks_command.c:269:25: expected unsigned int [usertype] *p
fireworks_command.c:269:25: got restricted __be32 [usertype] *
This commit fixes this bug.
--- sound/firewire/fireworks/fireworks_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/fireworks/fireworks_command.c +1 -1
@@ -257,7 +257,7 @@ int snd_efw_command_get_phys_meters(struct snd_efw *efw, struct snd_efw_phys_meters *meters, unsigned int len) { -__be32 *buf = (__be32 *)meters; +u32 *buf = (u32 *)meters;unsigned int i;int err;
Signature · 1 line
1.9.1
PATCH 142/164 ALSA: bebob: use correct type for __be32 data
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit fef586d58960bc867c1fa8126ee5d7364a5a89ac upstream.
In former commit, metering is supported for BeBoB based models customized by M-Audio. The data in transaction is aligned to big-endianness, while in the driver code u16 typed variable is assigned to the data. This causes sparse warnings.
bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16
This commit fixes this bug by using __be16 variable for the data.
--- sound/firewire/bebob/bebob_maudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/bebob/bebob_maudio.c +1 -1
@@ -619,7 +619,7 @@ static const char *const special_meter_labels[] = {static int special_meter_get (struct snd_bebob *bebob,u32 *target,unsigned int size) { -u16 *buf; +__be16 *buf;unsigned int i, c, channels;int err;
Signature · 1 line
1.9.1
PATCH 143/164 sunrpc: avoid warning in gss_key_timeout
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit cc6a7aab5570beef884ff95f7cade6634bf815a1 upstream.
The gss_key_timeout() function causes a harmless warning in some configurations, e.g. ARM imx_v6_v7_defconfig with gcc-5.2, if the compiler cannot figure out the state of the 'expire' variable across an rcu_read_unlock():
net/sunrpc/auth_gss/auth_gss.c: In function 'gss_key_timeout':net/sunrpc/auth_gss/auth_gss.c:1422:211: warning: 'expire' may be used uninitialized in this function [-Wmaybe-uninitialized]
To avoid this warning without adding a bogus initialization, this rewrites the function so the comparison is done inside of the critical section. As a side-effect, it also becomes slightly easier to understand because the implementation now more closely resembles the comment above it.
--- net/sunrpc/auth_gss/auth_gss.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +6 -7
@@ -1411,17 +1411,16 @@ gss_key_timeout(struct rpc_cred *rc) { struct gss_cred *gss_cred = container_of(rc, struct gss_cred, gc_base);struct gss_cl_ctx *ctx; -unsigned long now = jiffies; -unsigned long expire; +unsigned long timeout = jiffies + (gss_key_expire_timeo *HZ ); +int ret =0 ;rcu_read_lock (); ctx =rcu_dereference (gss_cred->gc_ctx); -if (ctx) - expire = ctx->gc_expiry - (gss_key_expire_timeo *HZ ); +if (!ctx ||time_after (timeout, ctx->gc_expiry)) + ret = -EACCES ;rcu_read_unlock (); -if (!ctx ||time_after (now, expire)) -return -EACCES ; -return 0 ; + +return ret; } static int
Signature · 1 line
1.9.1
PATCH 144/164 clk: versatile-icst: fix memory leak
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 7bdccef34fc67d3fce6778a018601dd41e43c5ce upstream.
A static code checker found a memory leak in the Versatile ICST code. Fix it.
--- drivers/clk/versatile/clk-icst.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/versatile/clk-icst.c +3 -1
@@ -156,8 +156,10 @@ struct clk *icst_clk_register(struct device *dev, icst->lockreg = base + desc->lock_offset; clk =clk_register (dev, &icst->hw); -if (IS_ERR (clk)) +if (IS_ERR (clk)) { +kfree (pclone);kfree (icst); + }return clk; }
Signature · 1 line
1.9.1
PATCH 145/164 MIPS: atomic: Fix comment describing atomic64_add_unless's return value.
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
commit f25319d2cb439249a6859f53ad42ffa332b0acba upstream.
--- arch/mips/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/atomic.h +1 -1
@@ -500,7 +500,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)* @u: ...unless v is equal to u. * * Atomically adds @a to @v, so long as it was not @u. -* Returns the old value of @v. +* Returns true iff @v was not @u. */ static __inline__int atomic64_add_unless (atomic64_t *v,long a,long u) {
Signature · 1 line
1.9.1
PATCH 146/164 mfd: twl6040: Fix deferred probe handling for clk32k
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit 75c08f17ec87c2d742487bb87408d6feebc526bd upstream.
Commit 68bab8662f49 ("mfd: twl6040: Optional clk32k clock handling") added clock handling for the 32k clock from palmas-clk. However, that patch did not consider a typical situation where twl6040 is built-in, and palmas-clk is a loadable module like we have in omap2plus_defconfig.
If palmas-clk is not loaded before twl6040 probes, we will get a "clk32k is not handled" warning during booting. This means that any drivers relying on this clock will mysteriously fail, including omap5-uevm WLAN and audio.
Note that for WLAN, we probably should also eventually get the clk32kgaudio for MMC3 directly as that's shared between audio and WLAN SDIO at least for omap5-uevm. It seems the WLAN chip cannot get it as otherwise MMC3 won't get properly probed.
--- drivers/mfd/twl6040.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/twl6040.c +2 -0
@@ -647,6 +647,8 @@ static int twl6040_probe(struct i2c_client *client, twl6040->clk32k =devm_clk_get (&client->dev,"clk32k" );if (IS_ERR (twl6040->clk32k)) { +if (PTR_ERR (twl6040->clk32k) == -EPROBE_DEFER ) +return -EPROBE_DEFER ;dev_info (&client->dev,"clk32k is not handled\n" ); twl6040->clk32k =NULL ; }
Signature · 1 line
1.9.1
PATCH 147/164 DT: mmc: sh_mmcif: fix "compatible" property text
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
commit 76d63c2b59d4a1481bedc65a3ef25e9d1354dca3 upstream.
The "compatible" property text contradicts even the example given in the MMCIF binding document itself; moreover, the Renesas MMCIF driver only matches on the generic "compatible" string and doesn't look for the SoC specific strings at all. Thus describe "renesas,sh-mmcif" as a fallback value.
--- Documentation/devicetree/bindings/mmc/renesas,mmcif.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mmc/renesas,mmcif.txt +2 -2
@@ -6,11 +6,11 @@ and the properties used by the MMCIF device. Required properties: -- compatible: must contain one of the following +- compatible: should be "renesas,mmcif-<soctype>", "renesas,sh-mmcif" as a + fallback. Examples with <soctype> are: - "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs - "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs - "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs - - "renesas,sh-mmcif" for the generic MMCIF - clocks: reference to the functional clock
Signature · 1 line
1.9.1
PATCH 148/164 netfilter: nf_nat_redirect: add missing NULL pointer check
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Munehisa Kamata <[email protected]>
commit 94f9cd81436c85d8c3a318ba92e236ede73752fc upstream.
Commit 8b13eddfdf04cbfa561725cfc42d6868fe896f56 ("netfilter: refactor NAT redirect IPv4 to use it from nf_tables") has introduced a trivial logic change which can result in the following crash.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000030 IP: [<ffffffffa033002d>] nf_nat_redirect_ipv4+0x2d/0xa0 [nf_nat_redirect] PGD 3ba662067 PUD 3ba661067 PMD 0 Oops: 0000 [#1] SMP Modules linked in: ipv6(E) xt_REDIRECT(E) nf_nat_redirect(E) xt_tcpudp(E) iptable_nat(E) nf_conntrack_ipv4(E) nf_defrag_ipv4(E) nf_nat_ipv4(E) nf_nat(E) nf_conntrack(E) ip_tables(E) x_tables(E) binfmt_misc(E) xfs(E) libcrc32c(E) evbug(E) evdev(E) psmouse(E) i2c_piix4(E) i2c_core(E) acpi_cpufreq(E) button(E) ext4(E) crc16(E) jbd2(E) mbcache(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) CPU: 0 PID: 2536 Comm: ip Tainted: G E 4.1.7-15.23.amzn1.x86_64 #1 Hardware name: Xen HVM domU, BIOS 4.2.amazon 05/06/2015 task: ffff8800eb438000 ti: ffff8803ba664000 task.ti: ffff8803ba664000 [...] Call Trace: <IRQ> [<ffffffffa0334065>] redirect_tg4+0x15/0x20 [xt_REDIRECT] [<ffffffffa02e2e99>] ipt_do_table+0x2b9/0x5e1 [ip_tables] [<ffffffffa0328045>] iptable_nat_do_chain+0x25/0x30 [iptable_nat] [<ffffffffa031777d>] nf_nat_ipv4_fn+0x13d/0x1f0 [nf_nat_ipv4] [<ffffffffa0328020>] ? iptable_nat_ipv4_fn+0x20/0x20 [iptable_nat] [<ffffffffa031785e>] nf_nat_ipv4_in+0x2e/0x90 [nf_nat_ipv4] [<ffffffffa03280a5>] iptable_nat_ipv4_in+0x15/0x20 [iptable_nat] [<ffffffff81449137>] nf_iterate+0x57/0x80 [<ffffffff814491f7>] nf_hook_slow+0x97/0x100 [<ffffffff814504d4>] ip_rcv+0x314/0x400
unsigned int
nf_nat_redirect_ipv4(struct sk_buff *skb,
...
{
...
rcu_read_lock();
indev = __in_dev_get_rcu(skb->dev);
if (indev != NULL) {
ifa = indev->ifa_list;
newdst = ifa->ifa_local; <---
}
rcu_read_unlock();...
}
Before the commit, 'ifa' had been always checked before access. After the commit, however, it could be accessed even if it's NULL. Interestingly, this was once fixed in 2003.
http://marc.info/?l=netfilter-devel&m=106668497403047&w=2
In addition to the original one, we have seen the crash when packets that need to be redirected somehow arrive on an interface which hasn't been yet fully configured.
This change just reverts the logic to the old behavior to avoid the crash.
--- net/netfilter/nf_nat_redirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_redirect.c +1 -1
@@ -55,7 +55,7 @@ nf_nat_redirect_ipv4(struct sk_buff *skb,rcu_read_lock (); indev =__in_dev_get_rcu (skb->dev); -if (indev !=NULL ) { +if (indev && indev->ifa_list) { ifa = indev->ifa_list; newdst = ifa->ifa_local; }
Signature · 1 line
1.9.1
PATCH 149/164 of/fdt: fix error checking for earlycon address
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
commit 3f5ceec96470050d20d7281d49985e3b1cfc3995 upstream.
fdt_translate_address() returns OF_BAD_ADDR on error. It is defined as a u64 value, so the variable "addr" should be defined as u64 as well.
--- drivers/of/fdt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/of/fdt.c +3 -2
@@ -788,14 +788,15 @@ int __init early_init_dt_scan_chosen_serial(void)return -ENODEV ;while (match->compatible[0 ]) { -unsigned long addr; +u64 addr; +if (fdt_node_check_compatible (fdt, offset, match->compatible)) { match++;continue ; } addr =fdt_translate_address (fdt, offset); -if (!addr) +if (addr ==OF_BAD_ADDR )return -ENXIO ;of_setup_earlycon (addr, match->data);
Signature · 1 line
1.9.1
PATCH 150/164 netfilter: nfnetlink: don't probe module if it exists
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit dbc3617f4c1f9fcbe63612048cb9583fea1e11ab upstream.
nfnetlink_bind request_module()s all the time as nfnetlink_get_subsys() shifts the argument by 8 to obtain the subsys id.
So using type instead of type << 8 always returns NULL.
--- net/netfilter/nfnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink.c +1 -1
@@ -475,7 +475,7 @@ static int nfnetlink_bind(struct net *net, int group) type = nfnl_group2type[group];rcu_read_lock (); - ss =nfnetlink_get_subsys (type); + ss =nfnetlink_get_subsys (type <<8 );rcu_read_unlock ();if (!ss)request_module ("nfnetlink-subsys-%d" , type);
Signature · 1 line
1.9.1
PATCH 151/164 sparc/PCI: Add mem64 resource parsing for root bus
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit af86fa4001ca5644ae20cc2c52cdf67bb7db9752 upstream.
David reported that a T5-8 sparc system failed to boot with:
pci_sun4v f02dbcfc: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io 0x804000000000-0x80400fffffff] (bus address [0x0000-0xfffffff]) pci_bus 0000:00: root bus resource [mem 0x800000000000-0x80007effffff] (bus address [0x00000000-0x7effffff]) pci 0000:00:01.0: can't claim BAR 15 [mem 0x100000000-0x4afffffff pref]: no compatible bridge window
Note that we don't know about a host bridge aperture that contains BAR 15. OF does report a MEM64 aperture, but before this patch, pci_determine_mem_io_space() ignored it.
Add support for host bridge apertures with 64-bit PCI addresses. Also set IORESOURCE_MEM_64 for PCI device and bridge resources in PCI 64-bit memory space.
Sparc doesn't actually print the device and bridge resources, but after this patch, we should have the equivalent of this:
pci_sun4v f02dbcfc: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io 0x804000000000-0x80400fffffff] (bus address [0x0000-0xfffffff]) pci_bus 0000:00: root bus resource [mem 0x800000000000-0x80007effffff] (bus address [0x00000000-0x7effffff]) pci_bus 0000:00: root bus resource [mem 0x800100000000-0x8007ffffffff] (bus address [0x100000000-0x7ffffffff])
pci 0000:00:01.0: bridge window [mem 0x800100000000-0x8004afffffff 64bit pref]
--- arch/sparc/kernel/pci.c | 7 ++++++- arch/sparc/kernel/pci_common.c | 17 +++++++++++++++-- arch/sparc/kernel/pci_impl.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-)
arch/sparc/kernel/pci.c +6 -1
@@ -185,8 +185,10 @@ static unsigned long pci_parse_of_flags(u32 addr0)if (addr0 &0x02000000 ) { flags =IORESOURCE_MEM |PCI_BASE_ADDRESS_SPACE_MEMORY ; - flags |= (addr0 >>22 ) &PCI_BASE_ADDRESS_MEM_TYPE_64 ; flags |= (addr0 >>28 ) &PCI_BASE_ADDRESS_MEM_TYPE_1M ; +if (addr0 &0x01000000 ) + flags |=IORESOURCE_MEM_64 + |PCI_BASE_ADDRESS_MEM_TYPE_64 ;if (addr0 &0x40000000 ) flags |=IORESOURCE_PREFETCH |PCI_BASE_ADDRESS_MEM_PREFETCH ;
@@ -660,6 +662,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, pbm->io_space.start);pci_add_resource_offset (&resources, &pbm->mem_space, pbm->mem_space.start); +if (pbm->mem64_space.flags) +pci_add_resource_offset (&resources, &pbm->mem64_space, + pbm->mem_space.start); pbm->busn.start = pbm->pci_first_busno; pbm->busn.end = pbm->pci_last_busno; pbm->busn.flags =IORESOURCE_BUS ;
arch/sparc/kernel/pci_common.c +15 -2
@@ -406,6 +406,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) } num_pbm_ranges = i /sizeof (*pbm_ranges); +memset (&pbm->mem64_space,0 ,sizeof (struct resource ));for (i =0 ; i < num_pbm_ranges; i++) {const struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
@@ -451,7 +452,12 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)break ;case 3 : -/* XXX 64-bit MEM handling XXX */ +/* 64-bit MEM handling */ + pbm->mem64_space.start = a; + pbm->mem64_space.end = a + size -1UL ; + pbm->mem64_space.flags =IORESOURCE_MEM ; + saw_mem =1 ; +break ;default :break ;
@@ -465,15 +471,22 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)prom_halt (); } -printk ("%s: PCI IO[%llx] MEM[%llx]\n" , +printk ("%s: PCI IO[%llx] MEM[%llx]" , pbm->name, pbm->io_space.start, pbm->mem_space.start); +if (pbm->mem64_space.flags) +printk (" MEM64[%llx]" , + pbm->mem64_space.start); +printk ("\n" ); pbm->io_space.name = pbm->mem_space.name = pbm->name; + pbm->mem64_space.name = pbm->name;request_resource (&ioport_resource, &pbm->io_space);request_resource (&iomem_resource, &pbm->mem_space); +if (pbm->mem64_space.flags) +request_resource (&iomem_resource, &pbm->mem64_space);pci_register_legacy_regions (&pbm->io_space, &pbm->mem_space);
arch/sparc/kernel/pci_impl.h +1 -0
@@ -97,6 +97,7 @@ struct pci_pbm_info {/* PBM I/O and Memory space resources. */ struct resource io_space;struct resource mem_space; +struct resource mem64_space;struct resource busn;/* Base of PCI Config space, can be per-PBM or shared. */
Signature · 1 line
1.9.1
PATCH 152/164 xprtrdma: Re-arm after missed events
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 7b3d770c67bc07db5035999e4f864c5f2ff7b10e upstream.
ib_req_notify_cq(IB_CQ_REPORT_MISSED_EVENTS) returns a positive value if WCs were added to a CQ after the last completion upcall but before the CQ has been re-armed.
Commit 7f23f6f6e388 ("xprtrmda: Reduce lock contention in completion handlers") assumed that when ib_req_notify_cq() returned a positive RC, the CQ had also been successfully re-armed, making it safe to return control to the provider without losing any completion signals. That is an invalid assumption.
Change both completion handlers to continue polling while ib_req_notify_cq() returns a positive value.
--- net/sunrpc/xprtrdma/verbs.c | 66 +++++++-------------------------------------- 1 file changed, 10 insertions(+), 56 deletions(-)
net/sunrpc/xprtrdma/verbs.c +10 -56
@@ -208,38 +208,17 @@ rpcrdma_sendcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)return 0 ; } -/* -* Handle send, fast_reg_mr, and local_inv completions. -* -* Send events are typically suppressed and thus do not result -* in an upcall. Occasionally one is signaled, however. This -* prevents the provider's completion queue from wrapping and -* losing a completion. +/* Handle provider send completion upcalls. */ static void rpcrdma_sendcq_upcall (struct ib_cq *cq,void *cq_context) {struct rpcrdma_ep *ep = (struct rpcrdma_ep *)cq_context; -int rc; - - rc =rpcrdma_sendcq_poll (cq, ep); -if (rc) { -dprintk ("RPC: %s: ib_poll_cq failed: %i\n" , - __func__, rc); -return ; - } - rc =ib_req_notify_cq (cq, -IB_CQ_NEXT_COMP |IB_CQ_REPORT_MISSED_EVENTS ); -if (rc ==0 ) -return ; -if (rc <0 ) { -dprintk ("RPC: %s: ib_req_notify_cq failed: %i\n" , - __func__, rc); -return ; - } - -rpcrdma_sendcq_poll (cq, ep); +do { +rpcrdma_sendcq_poll (cq, ep); + }while (ib_req_notify_cq (cq,IB_CQ_NEXT_COMP | +IB_CQ_REPORT_MISSED_EVENTS ) >0 ); } static void
@@ -304,42 +283,17 @@ out_schedule:return rc; } -/* -* Handle receive completions. -* -* It is reentrant but processes single events in order to maintain -* ordering of receives to keep server credits. -* -* It is the responsibility of the scheduled tasklet to return -* recv buffers to the pool. NOTE: this affects synchronization of -* connection shutdown. That is, the structures required for -* the completion of the reply handler must remain intact until -* all memory has been reclaimed. +/* Handle provider receive completion upcalls. */ static void rpcrdma_recvcq_upcall (struct ib_cq *cq,void *cq_context) {struct rpcrdma_ep *ep = (struct rpcrdma_ep *)cq_context; -int rc; - - rc =rpcrdma_recvcq_poll (cq, ep); -if (rc) { -dprintk ("RPC: %s: ib_poll_cq failed: %i\n" , - __func__, rc); -return ; - } - rc =ib_req_notify_cq (cq, -IB_CQ_NEXT_COMP |IB_CQ_REPORT_MISSED_EVENTS ); -if (rc ==0 ) -return ; -if (rc <0 ) { -dprintk ("RPC: %s: ib_req_notify_cq failed: %i\n" , - __func__, rc); -return ; - } - -rpcrdma_recvcq_poll (cq, ep); +do { +rpcrdma_recvcq_poll (cq, ep); + }while (ib_req_notify_cq (cq,IB_CQ_NEXT_COMP | +IB_CQ_REPORT_MISSED_EVENTS ) >0 ); } static void
Signature · 1 line
1.9.1
PATCH 153/164 ceph: fix message length computation
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 777d738a5e58ba3b6f3932ab1543ce93703f4873 upstream.
create_request_message() computes the maximum length of a message, but uses the wrong type for the time stamp: sizeof(struct timespec) may be 8 or 16 depending on the architecture, while sizeof(struct ceph_timespec) is always 8, and that is what gets put into the message.
Found while auditing the uses of timespec for y2038 problems.
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -1
@@ -1868,7 +1868,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, len =sizeof (*head) + pathlen1 + pathlen2 +2 *(1 +sizeof (u32) +sizeof (u64)) + -sizeof (struct timespec ); +sizeof (struct ceph_timespec );/* calculate (max) length for cap releases */ len += sizeof(struct ceph_mds_request_release) *
Signature · 1 line
1.9.1
PATCH 154/164 tracepoints: Fix documentation of RCU lockdep checks
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Desnoyers <[email protected]>
commit a15920bea0428cd22291637f6c72542b1843e65f upstream.
The documentation on top of __DECLARE_TRACE() does not match its implementation since the condition check has been added to the RCU lockdep checks. Update the documentation to match its implementation.
--- include/linux/tracepoint.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/tracepoint.h +5 -4
@@ -159,10 +159,11 @@ extern void syscall_unregfunc(void);* structure. Force alignment to the same alignment as the section start. * * When lockdep is enabled, we make sure to always do the RCU portions of -* the tracepoint code, regardless of whether tracing is on or we match the -* condition. This lets us find RCU issues triggered with tracepoints even -* when this tracepoint is off. This code has no purpose other than poking -* RCU a bit. +* the tracepoint code, regardless of whether tracing is on. However, +* don't check if the condition is false, due to interaction with idle +* instrumentation. This lets us find RCU issues triggered with tracepoints +* even when this tracepoint is off. This code has no purpose other than +* poking RCU a bit. */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ extern struct tracepoint __tracepoint_##name; \
Signature · 1 line
1.9.1