4.9.104-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainercover 4.9.104-stable review
This is the start of the stable review cycle for the 4.9.104 release. There are 329 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 30 10:00:51 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.104-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.104-rc1
Randy Dunlap <[email protected]>
kdb: make "mdr" command repeat
Bjorn Andersson <[email protected]>
pinctrl: msm: Use dynamic GPIO numbering
Christophe JAILLET <[email protected]>
regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulator_match()'
Laurent Pinchart <[email protected]>
ARM: dts: porter: Fix HDMI output routing
Aapo Vienamo <[email protected]>
ARM: dts: imx7d: cl-som-imx7: fix pinctrl_enet
Charles Keepax <[email protected]>
regmap: Correct comparison in regmap_cached
Richard Haines <[email protected]>
netlabel: If PF_INET6, check sk_buff ip header version
Prashant Bhole <[email protected]>
selftests/net: fixes psock_fanout eBPF test case
Jiri Olsa <[email protected]>
perf report: Fix memory corruption in --branch-history mode --branch-history
Jiri Olsa <[email protected]>
perf tests: Use arch__compare_symbol_names to compare symbols
Baoquan He <[email protected]>
x86/apic: Set up through-local-APIC mode on the boot CPU if 'noapic' specified
Ørjan Eide <[email protected]>
drm/rockchip: Respect page offset for PRIME mmap calls
Joe Perches <[email protected]>
MIPS: Octeon: Fix logging messages with spurious periods after newlines
Takeshi Kihara <[email protected]>
pinctrl: sh-pfc: r8a7796: Fix MOD_SEL register pin assignment for SSI pins group
Tejun Heo <[email protected]>
rcu: Call touch_nmi_watchdog() while printing stall warnings
Richard Guy Briggs <[email protected]>
audit: return on memory error to avoid null pointer dereference
Stefan Wahren <[email protected]>
ARM: dts: bcm283x: Fix probing of bcm2835-i2s
Jan Kara <[email protected]>
udf: Provide saner default for invalid uid / gid
Thomas Vincent-Cross <[email protected]>
PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
Viresh Kumar <[email protected]>
cpufreq: Reorder cpufreq_online() error code path
Niklas Cassel <[email protected]>
net: stmmac: ensure that the MSS desc is the last desc to set the own bit
Niklas Cassel <[email protected]>
net: stmmac: ensure that the device has released ownership before reading data
Srinivas Kandagatla <[email protected]>
dmaengine: qcom: bam_dma: get num-channels and num-ees from dt
[email protected] <[email protected]>
hwrng: stm32 - add reset during probe
Govindarajulu Varadarajan <[email protected]>
enic: enable rq before updating rq descriptors
Yoshihiro Shimoda <[email protected]>
dmaengine: rcar-dmac: Check the done lists in rcar_dmac_chan_get_residue()
Qi Hou <[email protected]>
dmaengine: pl330: fix a race condition in case of threaded irqs
Takashi Iwai <[email protected]>
ALSA: vmaster: Propagate slave error
Ivan Gorinov <[email protected]>
x86/devicetree: Fix device IRQ settings in DT
Ivan Gorinov <[email protected]>
x86/devicetree: Initialize device tree before using it
Andreas Gruenbacher <[email protected]>
gfs2: Fix fallocate chunk size
Bjorn Andersson <[email protected]>
soc: qcom: wcnss_ctrl: Fix increment in NV upload
Ilia Lin <[email protected]>
arm64: dts: qcom: Fix SPI5 config on MSM8996
Kan Liang <[email protected]>
perf/x86/intel: Fix event update for auto-reload
Kan Liang <[email protected]>
perf/x86/intel: Fix large period handling on Broadwell CPUs
Maurizio Lombardi <[email protected]>
cdrom: do not call check_disk_change() inside cdrom_open()
Kan Liang <[email protected]>
perf/x86/intel: Properly save/restore the PMU state in the NMI handler
Guenter Roeck <[email protected]>
hwmon: (pmbus/adm1275) Accept negative page register values
Guenter Roeck <[email protected]>
hwmon: (pmbus/max8688) Accept negative page register values
Eric Anholt <[email protected]>
drm/panel: simple: Fix the bus format for the Ontat panel
Peter Zijlstra <[email protected]>
perf/core: Fix perf_output_read_group()
Chao Yu <[email protected]>
f2fs: fix to check extent cache in f2fs_drop_extent_tree
Mathieu Malaterre <[email protected]>
powerpc: Add missing prototype for arch_irq_work_raise()
Kamlakant Patel <[email protected]>
ipmi_ssif: Fix kernel panic at msg_done_handler
Rafael J. Wysocki <[email protected]>
PCI: Restore config space on runtime resume despite being unbound
Mathias Kresin <[email protected]>
MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
Christophe Jaillet <[email protected]>
spi: bcm-qspi: fIX some error handling paths
Christophe Jaillet <[email protected]>
regulator: gpio: Fix some error handling paths in 'gpio_regulator_probe()'
Parav Pandit <[email protected]>
IB/core: Honor port_num while resolving GID for IB link layer
Thomas Richter <[email protected]>
perf stat: Fix core dump when flag T is used
Yisheng Xie <[email protected]>
perf top: Fix top.call-graph config option reading
Vitaly Kuznetsov <[email protected]>
KVM: lapic: stop advertising DIRECTED_EOI when in-kernel IOAPIC is in use
Gregory CLEMENT <[email protected]>
i2c: mv64xxx: Apply errata delay only in standard mode
Arjun Vynipadath <[email protected]>
cxgb4: Fix queue free path of ULD drivers
Seunghun Han <[email protected]>
ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
Erik Schmauss <[email protected]>
ACPICA: Events: add a return on failure from acpi_hw_register_read
Coly Li <[email protected]>
bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
Michael Schmitz <[email protected]>
zorro: Set up z->dev.dma_mask for the DMA API
Chunyu Hu <[email protected]>
cpufreq: cppc_cpufreq: Fix cppc_cpufreq_init() failure path
Philipp Puschmann <[email protected]>
arm: dts: socfpga: fix GIC PPI warning
Jay Vosburgh <[email protected]>
virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
Petr Vorel <[email protected]>
ima: Fallback to the builtin hash algorithm
Arjun Vynipadath <[email protected]>
cxgb4: Setup FW queues before registering netdev
Karthikeyan Periyasamy <[email protected]>
ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
Leon Romanovsky <[email protected]>
net/mlx5: Protect from command bit overflow
Michael Ellerman <[email protected]>
selftests: Print the test we're running to /dev/kmsg
Frank Asseg <[email protected]>
tools/thermal: tmon: fix for segfault
Michael Ellerman <[email protected]>
powerpc/perf: Fix kernel address leak via sampling registers
Madhavan Srinivasan <[email protected]>
powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
Guenter Roeck <[email protected]>
hwmon: (nct6775) Fix writing pwmX_mode
Helge Deller <[email protected]>
parisc/pci: Switch LBA PCI bus from Hard Fail to Soft Fail mode
Greg Ungerer <[email protected]>
m68k: set dma and coherent masks for platform FEC ethernets
Michael Ellerman <[email protected]>
powerpc/mpic: Check if cpu_possible() in mpic_physmask()
Lenny Szubowicz <[email protected]>
ACPI: acpi_pad: Fix memory leak in power saving threads
Aaro Koskinen <[email protected]>
drivers: macintosh: rack-meter: really fix bogus memsets
Dan Carpenter <[email protected]>
xen/acpi: off by one in read_acpi_id()
David Howells <[email protected]>
rxrpc: Don't treat call aborts as conn aborts
David Howells <[email protected]>
rxrpc: Fix Tx ring annotation after initial Tx failure
Jeff Mahoney <[email protected]>
btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
Filipe Manana <[email protected]>
Btrfs: fix copy_items() return value when logging an inode
Qu Wenruo <[email protected]>
btrfs: tests/qgroup: Fix wrong tree backref level
Florian Fainelli <[email protected]>
net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
David S. Miller <[email protected]>
sparc64: Make atomic_xchg() an inline function rather than a macro.
David Howells <[email protected]>
fscache: Fix hanging wait on page discarded by writeback
Sean Christopherson <[email protected]>
KVM: VMX: raise internal error for exception during invalid protected mode state
Davidlohr Bueso <[email protected]>
sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
Jun Piao <[email protected]>
ocfs2/dlm: don't handle migrate lockres if already in shutdown
Nikolay Borisov <[email protected]>
btrfs: Fix possible softlock on single core machines
Liu Bo <[email protected]>
Btrfs: fix NULL pointer dereference in log_dir_items
Liu Bo <[email protected]>
Btrfs: bail out on error during replay_dir_deletes
Huang Ying <[email protected]>
mm: fix races between address_space dereference and free in page_evicatable
Claudio Imbrenda <[email protected]>
mm/ksm: fix interaction with THP
Esben Haabendal <[email protected]>
dp83640: Ensure against premature access to PHY registers after reset
Shunyong Yang <[email protected]>
cpufreq: CPPC: Initialize shared perf capabilities of CPUs
Carlos Maiolino <[email protected]>
Force log to disk before reading the AGF during a fstrim
Jens Axboe <[email protected]>
sr: get/drop reference to device in revalidate and check_events
Tom Abraham <[email protected]>
swap: divide-by-zero when zero length swap file on ssd
Danilo Krummrich <[email protected]>
fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
Dave Hansen <[email protected]>
x86/mm: Do not forbid _PAGE_RW before init for __ro_after_init
Joerg Roedel <[email protected]>
x86/pgtable: Don't set huge PUD/PMD on non-leaf entries
Johannes Thumshirn <[email protected]>
nvme: don't send keep-alives to the discovery controller
Rich Felker <[email protected]>
sh: fix debug trap failure to process signals before return to user
Yelena Krivosheev <[email protected]>
net: mvneta: fix enable of all initialized RXQs
Toshiaki Makita <[email protected]>
net: Fix untag for vlan packets without ethernet header
Vinayak Menon <[email protected]>
mm/kmemleak.c: wait for scan completion before disabling free
Jan Kiszka <[email protected]>
builddeb: Fix header package regarding dtc source links
Cong Wang <[email protected]>
llc: properly handle dev_queue_xmit() return value
Stephane Eranian <[email protected]>
perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs
Pawel Dembicki <[email protected]>
net: qmi_wwan: add BroadMobi BM806U 2020:2033
Jinbum Park <[email protected]>
ARM: 8748/1: mm: Define vdso_start, vdso_end as array
Linus Lüssing <[email protected]>
batman-adv: fix packet loss for broadcasted DHCP packets to a server
Linus Lüssing <[email protected]>
batman-adv: fix multicast-via-unicast transmission with AP isolation
Masami Hiramatsu <[email protected]>
selftests: ftrace: Add a testcase for probepoint
Masami Hiramatsu <[email protected]>
selftests: ftrace: Add a testcase for string type with kprobe_event
Masami Hiramatsu <[email protected]>
selftests: ftrace: Add probe event argument syntax testcase
David Rientjes <[email protected]>
mm, thp: do not cause memcg oom for thp
Yisheng Xie <[email protected]>
mm/mempolicy.c: avoid use uninitialized preferred_node
Dan Carpenter <[email protected]>
macsec: missing dev_put() on error in macsec_newlink()
Kalderon, Michal <[email protected]>
RDMA/qedr: Fix rc initialization on CNQ allocation failure
Kalderon, Michal <[email protected]>
RDMA/qedr: fix QP's ack timeout configuration
Chien Tin Tung <[email protected]>
RDMA/ucma: Correct option size check using optlen
Nicolas Pitre <[email protected]>
kbuild: make scripts/adjust_autoksyms.sh robust against timestamp races
Stefan Wahren <[email protected]>
brcmfmac: Fix check for ISO3166 code
Song Liu <[email protected]>
perf/cgroup: Fix child event counting bug
Stefano Brivio <[email protected]>
vti4: Don't override MTU passed on link creation via IFLA_MTU
Stefano Brivio <[email protected]>
vti4: Don't count header length twice on tunnel setup
Sven Eckelmann <[email protected]>
batman-adv: Fix skbuff rcsum on packet reroute
Matthias Schiffer <[email protected]>
batman-adv: fix header size check in batadv_dbg_arp()
Toshiaki Makita <[email protected]>
net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off
Rob Herring <[email protected]>
microblaze: switch to NO_BOOTMEM
Lucas Stach <[email protected]>
drm/imx: move arming of the vblank event to atomic_flush
Cathy Zhou <[email protected]>
sunvnet: does not support GSO for sctp
Sabrina Dubroca <[email protected]>
ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu
Arvind Yadav <[email protected]>
workqueue: use put_device() instead of kfree()
Michael Chan <[email protected]>
bnxt_en: Check valid VNIC ID in bnxt_hwrm_vnic_set_tpa().
Florian Westphal <[email protected]>
netfilter: ebtables: fix erroneous reject of last rule
Gregory CLEMENT <[email protected]>
dmaengine: mv_xor_v2: Fix clock resource by adding a register clock
Marc Zyngier <[email protected]>
arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
Arvind Yadav <[email protected]>
xen: xenbus: use put_device() instead of kfree()
Parav Pandit <[email protected]>
IB/core: Fix possible crash to access NULL netdev
Jeremy Linton <[email protected]>
net: smsc911x: Fix unload crash when link is up
Hemanth Puranik <[email protected]>
net: qcom/emac: Use proper free methods during TX
Denis Kirjanov <[email protected]>
fsl/fman: avoid sleeping in atomic context while adding an address
Peter Malone <[email protected]>
fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
Dan Carpenter <[email protected]>
IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
Jack M <[email protected]>
IB/mlx4: Include GID type when deleting GIDs from HW table under RoCE
Jack Morgenstein <[email protected]>
IB/mlx4: Fix corruption of RoCEv2 IPv4 GIDs
Kalderon, Michal <[email protected]>
RDMA/qedr: Fix iWARP write and send with immediate
Kalderon, Michal <[email protected]>
RDMA/qedr: Fix kernel panic when running fio over NFSoRDMA
Davidlohr Bueso <[email protected]>
ia64/err-inject: Use get_user_pages_fast()
Pierre-Yves Kerbrat <[email protected]>
e1000e: allocate ring descriptors with dma_zalloc_coherent
Benjamin Poirier <[email protected]>
e1000e: Fix check_for_link return value with autoneg off
Linus Lüssing <[email protected]>
batman-adv: Fix multicast packet loss with a single WANT_ALL_IPV4/6 flag
Jayachandran C <[email protected]>
watchdog: sbsa: use 32-bit read for WCV
Igor Pylypiv <[email protected]>
watchdog: f71808e_wdt: Fix magic close handling
Sara Sharon <[email protected]>
iwlwifi: mvm: fix TX of CCMP 256
Paul Mackerras <[email protected]>
KVM: PPC: Book3S HV: Fix VRMA initialization with 2MB or 1GB memory backing
Michael Ellerman <[email protected]>
selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable
Filipe Manana <[email protected]>
Btrfs: send, fix issuing write op when processing hole in no data mode
Giulio Benetti <[email protected]>
drm/sun4i: Fix dclk_set_phase
Roger Pau Monne <[email protected]>
xen/pirq: fix error path cleanup when binding MSIs
Max Gurtovoy <[email protected]>
nvmet: fix PSDT field check in command format
Joey Pabalinas <[email protected]>
net/tcp/illinois: replace broken algorithm reference link
Claudiu Manoil <[email protected]>
gianfar: Fix Rx byte accounting for ndev stats
Guenter Roeck <[email protected]>
powerpc/boot: Fix random libfdt related build errors
Florian Fainelli <[email protected]>
ARM: dts: NSP: Fix amount of RAM on BCM958625HR
Xin Long <[email protected]>
sit: fix IFLA_MTU ignored on NEWLINK
Xin Long <[email protected]>
ip6_tunnel: fix IFLA_MTU ignored on NEWLINK
Tang Junhui <[email protected]>
bcache: fix kcrashes with fio in RAID5 backend dev
Yoshihiro Shimoda <[email protected]>
dmaengine: rcar-dmac: fix max_chunk_size for R-Car Gen3
Dave Airlie <[email protected]>
virtio-gpu: fix ioctl and expose the fixed status to userspace.
Eric Dumazet <[email protected]>
r8152: fix tx packets accounting
Ramon Fried <[email protected]>
qrtr: add MODULE_ALIAS macro to smd
David S. Miller <[email protected]>
ARM: orion5x: Revert commit 4904dbda41c8.
Chengguang Xu <[email protected]>
ceph: fix dentry leak when failing to init debugfs
Colin Ian King <[email protected]>
clocksource/drivers/fsl_ftm_timer: Fix error return checking
Jianchao Wang <[email protected]>
nvme-pci: Fix nvme queue cleanup if IRQ setup fails
Sven Eckelmann <[email protected]>
batman-adv: Fix netlink dumping of BLA backbones
Sven Eckelmann <[email protected]>
batman-adv: Fix netlink dumping of BLA claims
Sven Eckelmann <[email protected]>
batman-adv: Ignore invalid batadv_v_gw during netlink send
Sven Eckelmann <[email protected]>
batman-adv: Ignore invalid batadv_iv_gw during netlink send
Florian Westphal <[email protected]>
netfilter: ebtables: convert BUG_ONs to WARN_ONs
Matthias Schiffer <[email protected]>
batman-adv: invalidate checksum on fragment reassembly
Matthias Schiffer <[email protected]>
batman-adv: fix packet checksum in receive path
Yufen Yu <[email protected]>
md/raid1: fix NULL pointer dereference
BingJing Chang <[email protected]>
md: fix a potential deadlock of raid5/raid10 reshape
Will Deacon <[email protected]>
fs: dcache: Use READ_ONCE when accessing i_dir_seq
Will Deacon <[email protected]>
fs: dcache: Avoid livelock between d_alloc_parallel and __d_add
Sebastian Ott <[email protected]>
kvm: fix warning for CONFIG_HAVE_KVM_EVENTFD builds
Alexey Kodanev <[email protected]>
macvlan: fix use-after-free in macvlan_common_newlink()
Pratyush Anand <[email protected]>
arm64: fix unwind_frame() for filtered out fn for function graph tracing
Felix Fietkau <[email protected]>
mac80211: drop frames with unexpected DS bits from fast-rx to slow path
Samuel Neves <[email protected]>
x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations
Andrea Parri <[email protected]>
locking/xchg/alpha: Fix xchg() and cmpxchg() memory ordering bugs
Randy Dunlap <[email protected]>
integrity/security: fix digsig.c build error with header file
Johannes Berg <[email protected]>
regulatory: add NUL to request alpha2
Eric Dumazet <[email protected]>
smsc75xx: fix smsc75xx_set_features()
Tony Lindgren <[email protected]>
ARM: OMAP: Fix dmtimer init for omap1
Eric Biggers <[email protected]>
PKCS#7: fix direct verification of SignerInfo signature
Sebastian Ott <[email protected]>
s390/cio: clear timer when terminating driver I/O
Sebastian Ott <[email protected]>
s390/cio: fix return code after missing interrupt
Sebastian Ott <[email protected]>
s390/cio: fix ccw_device_start_timeout API
Mark Lord <[email protected]>
powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access
David Rientjes <[email protected]>
kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
Arnd Bergmann <[email protected]>
md: raid5: avoid string overflow warning
Andrea Parri <[email protected]>
locking/xchg/alpha: Add unconditional memory barrier to cmpxchg()
Markus Elfring <[email protected]>
drm/exynos: g2d: Delete an error message for a failed memory allocation in two functions
Wolfram Sang <[email protected]>
drm/exynos: fix comparison to bitshift when dealing with a mask
Arnd Bergmann <[email protected]>
drm/exynos: g2d: use monotonic timestamps
Yufen Yu <[email protected]>
md raid10: fix NULL deference in handle_write_completed()
Ilan Peer <[email protected]>
mac80211: Do not disconnect on invalid operating class
Sara Sharon <[email protected]>
mac80211: fix calling sleeping function in atomic context
Sara Sharon <[email protected]>
mac80211: fix a possible leak of station stats
Felix Fietkau <[email protected]>
mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple of 4
David Howells <[email protected]>
rxrpc: Work around usercopy check
Kees Cook <[email protected]>
NFC: llcp: Limit size of SDP URI
Naftali Goldstein <[email protected]>
iwlwifi: mvm: always init rs with 20mhz bandwidth rates
Sara Sharon <[email protected]>
iwlwifi: mvm: fix security bug in PN checking
Thomas Falcon <[email protected]>
ibmvnic: Free RX socket buffer in case of adapter error
Geert Uytterhoeven <[email protected]>
ARM: OMAP1: clock: Fix debugfs_create_*() usage
Tony Lindgren <[email protected]>
ARM: OMAP3: Fix prm wake interrupt for resume
Qi Hou <[email protected]>
ARM: OMAP2+: timer: fix a kmemleak caused in omap_get_timer_dt
Anders Roxell <[email protected]>
selftests: memfd: add config fragment for fuse
Naresh Kamboju <[email protected]>
selftests: pstore: Adding config fragment CONFIG_PSTORE_RAM=m
Dong Bo <[email protected]>
libata: Fix compile warning with ATA_DEBUG enabled
Jason Wang <[email protected]>
ptr_ring: prevent integer overflow when calculating size
Ulf Magnusson <[email protected]>
ARC: Fix malformed ARC_EMUL_UNALIGNED default
Mark Salter <[email protected]>
irqchip/gic-v3: Change pr_debug message to pr_devel
Michael Kelley <[email protected]>
cpumask: Make for_each_cpu_wrap() available on UP as well
Stephen Boyd <[email protected]>
irqchip/gic-v3: Ignore disabled ITS nodes
Will Deacon <[email protected]>
locking/qspinlock: Ensure node->count is updated before initialising node
Jia Zhang <[email protected]>
vfs/proc/kcore, x86/mm/kcore: Fix SMAP fault when dumping vsyscall user page
Daniel Borkmann <[email protected]>
bpf: fix rlimit in reuseport net selftest
Jesper Dangaard Brouer <[email protected]>
tools/libbpf: handle issues with bpf ELF objects containing .eh_frames
Tang Junhui <[email protected]>
bcache: return attach error when no cache set exist
Tang Junhui <[email protected]>
bcache: fix for data collapse after re-attaching an attached device
Tang Junhui <[email protected]>
bcache: fix for allocator and register thread race
Coly Li <[email protected]>
bcache: properly set task state in bch_writeback_thread()
Arnd Bergmann <[email protected]>
cifs: silence compiler warnings showing up with gcc-8.0.0
Alexey Dobriyan <[email protected]>
proc: fix /proc/*/map_files lookup
Will Deacon <[email protected]>
arm64: spinlock: Fix theoretical trylock() A-B-A with LSE atomics
Guanglei Li <[email protected]>
RDS: IB: Fix null pointer issue
Ross Lagerwall <[email protected]>
xen/grant-table: Use put_page instead of free_page
Ross Lagerwall <[email protected]>
xen-netfront: Fix race between device setup and open
Matt Redfearn <[email protected]>
MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
James Hogan <[email protected]>
MIPS: generic: Fix machine compatible matching
Yonghong Song <[email protected]>
bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y
Hans de Goede <[email protected]>
ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs
Chen Yu <[email protected]>
ACPI: processor_perflib: Do not send _PPC change notification if not ready
Jean Delvare <[email protected]>
firmware: dmi_scan: Fix handling of empty DMI strings
Arnd Bergmann <[email protected]>
x86/power: Fix swsusp_arch_resume prototype
Subash Abhinov Kasiviswanathan <[email protected]>
netfilter: ipv6: nf_defrag: Kill frag queue on RFC2460 failure
Karol Herbst <[email protected]>
drm/nouveau/pmu/fuc: don't use movw directly anymore
Alex Estrin <[email protected]>
IB/ipoib: Fix for potential no-carrier state
Ed Swierk <[email protected]>
openvswitch: Remove padding from packet before L3+ conntrack processing
shidao.ytt <[email protected]>
mm/fadvise: discard partial page if endbyte is also EOF
Mel Gorman <[email protected]>
mm: pin address_space before dereferencing it while isolating an LRU page
Yang Shi <[email protected]>
mm: thp: use down_read_trylock() in khugepaged to avoid long block
Nitin Gupta <[email protected]>
sparc64: update pmdp_invalidate() to return old pmd value
Kirill A. Shutemov <[email protected]>
asm-generic: provide generic_pmdp_establish()
Yisheng Xie <[email protected]>
mm/mempolicy: add nodes_empty check in SYSC_migrate_pages
Yisheng Xie <[email protected]>
mm/mempolicy: fix the check of nodemask from user
piaojun <[email protected]>
ocfs2: return error when we attempt to access a dirty bh in jbd2
piaojun <[email protected]>
ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
piaojun <[email protected]>
ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
KarimAllah Ahmed <[email protected]>
kvm: Map PFN-type memory regions as writable (if possible)
Gustavo A. R. Silva <[email protected]>
tcp_nv: fix potential integer overflow in tcpnv_acked
Andy Spencer <[email protected]>
gianfar: prevent integer wrapping in the rx handler
Logan Gunthorpe <[email protected]>
ntb_transport: Fix bug with max_mw_size parameter
Leon Romanovsky <[email protected]>
RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
Michael Bringmann <[email protected]>
powerpc/numa: Ensure nodes initialized for hotplug
Michael Bringmann <[email protected]>
powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
Jake Daryll Obina <[email protected]>
jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
Andy Shevchenko <[email protected]>
device property: Define type of PROPERTY_ENRTY_*() macros
Ngai-Mint Kwan <[email protected]>
fm10k: fix "failed to kill vid" message for VF
Dan Carpenter <[email protected]>
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
Anand Jain <[email protected]>
btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
Liu Bo <[email protected]>
Btrfs: fix scrub to repair raid6 corruption
Nikolay Borisov <[email protected]>
btrfs: Fix out of bounds access in btrfs_search_slot
Liu Bo <[email protected]>
Btrfs: set plug for fsync
Wei Yongjun <[email protected]>
ipmi/powernv: Fix error return code in ipmi_powernv_probe()
weiyongjun (A) <[email protected]>
mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()
Ulf Magnusson <[email protected]>
kconfig: Fix expr_free() E_NOT leak
Ulf Magnusson <[email protected]>
kconfig: Fix automatic menu creation mem leak
Ulf Magnusson <[email protected]>
kconfig: Don't leak main menus during parsing
Guenter Roeck <[email protected]>
watchdog: sp5100_tco: Fix watchdog disable bit
Jan Chochol <[email protected]>
nfs: Do not convert nfs_idmap_cache_timeout to jiffies
Martin Blumenstingl <[email protected]>
net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock
Martin Blumenstingl <[email protected]>
net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b
mulhern <[email protected]>
dm thin: fix documentation relative to low water mark threshold
Peter Xu <[email protected]>
iommu/vt-d: Use domain instead of cache fetching
Thomas Richter <[email protected]>
perf record: Fix failed memory allocation for get_cpuid_str
Steven Rostedt (VMware) <[email protected]>
tools lib traceevent: Fix get_field_str() for dynamic strings
Arnaldo Carvalho de Melo <[email protected]>
perf callchain: Fix attr.sample_max_stack setting
Steven Rostedt (VMware) <[email protected]>
tools lib traceevent: Simplify pointer print logic and fix %pF
Shiraz Saleem <[email protected]>
i40iw: Zero-out consumer key on allocate stag for FMR
Dmitry Torokhov <[email protected]>
Input: psmouse - fix Synaptics detection when protocol is disabled
Alex Williamson <[email protected]>
PCI: Add function 1 DMA alias quirk for Marvell 9128
Anna-Maria Gleixner <[email protected]>
tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
Subash Abhinov Kasiviswanathan <[email protected]>
netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460
Paolo Bonzini <[email protected]>
kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
Takashi Iwai <[email protected]>
ALSA: hda - Use IS_REACHABLE() for dependency on input
NeilBrown <[email protected]>
NFSv4: always set NFS_LOCK_LOST when a lock is lost.
Peter Zijlstra <[email protected]>
x86/tsc: Allow TSC calibration without PIT
Hector Martin <[email protected]>
firewire-ohci: work around oversized DMA reads on JMicron controllers
Jim Mattson <[email protected]>
kvm: x86: IA32_ARCH_CAPABILITIES is always supported
Wei Huang <[email protected]>
KVM: x86: Update cpuid properly when CR4.OSXAVE or CR4.PKE is changed
David Hildenbrand <[email protected]>
KVM: s390: vsie: fix < 8k check for the itdba
Konrad Rzeszutek Wilk <[email protected]>
KVM/VMX: Expose SSBD properly to guests
zhongjiang <[email protected]>
kernel/signal.c: avoid undefined behaviour in kill_something_info
Gustavo A. R. Silva <[email protected]>
kernel/sys.c: fix potential Spectre v1 issue
David Hildenbrand <[email protected]>
kasan: fix memory hotplug during boot
Davidlohr Bueso <[email protected]>
ipc/shm: fix shmat() nil address after round-down when remapping
Davidlohr Bueso <[email protected]>
Revert "ipc/shm: Fix shmat mmap nil-page protection"
Michael J. Ruhl <[email protected]>
IB/hfi1: Use after free race condition in send context error path
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix 32-bit VMW_PORT_HB_[IN|OUT] macros
Joe Jin <[email protected]>
xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
Sudip Mukherjee <[email protected]>
libata: blacklist Micron 500IT SSD with MU01 firmware
Tejun Heo <[email protected]>
libata: Blacklist some Sandisk SSDs for NCQ
Corneliu Doban <[email protected]>
mmc: sdhci-iproc: fix 32bit writes for TRANSFER_MODE register
Srinath Mannam <[email protected]>
mmc: sdhci-iproc: remove hard coded mmc cap 1.8v
Al Viro <[email protected]>
do d_instantiate/unlock_new_inode combinations safely
Ben Hutchings <[email protected]>
ALSA: timer: Fix pause event notification
Al Viro <[email protected]>
aio: fix io_destroy(2) vs. lookup_ioctx() race
Al Viro <[email protected]>
affs_lookup(): close a race with affs_remove_link()
Colin Ian King <[email protected]>
KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable"
Maciej W. Rozycki <[email protected]>
MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
Maciej W. Rozycki <[email protected]>
MIPS: ptrace: Expose FIR register through FP regset
NeilBrown <[email protected]>
MIPS: c-r4k: Fix data corruption related to cache coherence
-------------
Diffstat:
Documentation/device-mapper/thin-provisioning.txt | 8 +- .../devicetree/bindings/dma/mv-xor-v2.txt | 6 +- Makefile | 4 +- arch/alpha/include/asm/xchg.h | 30 +- arch/arc/Kconfig | 1 - arch/arm/boot/dts/bcm283x.dtsi | 4 +- arch/arm/boot/dts/bcm958625hr.dts | 2 +- arch/arm/boot/dts/imx7d-cl-som-imx7.dts | 52 +- arch/arm/boot/dts/r8a7791-porter.dts | 2 +- arch/arm/boot/dts/socfpga.dtsi | 2 +- arch/arm/include/asm/vdso.h | 2 - arch/arm/kernel/vdso.c | 12 +- arch/arm/mach-omap1/clock.c | 6 +- arch/arm/mach-omap2/pm.c | 4 +- arch/arm/mach-omap2/timer.c | 19 +- arch/arm/mach-orion5x/Kconfig | 3 - arch/arm/mach-orion5x/dns323-setup.c | 53 +- arch/arm/mach-orion5x/tsx09-common.c | 49 +- arch/arm/plat-omap/dmtimer.c | 7 +- arch/arm64/boot/dts/qcom/msm8996.dtsi | 4 +- arch/arm64/include/asm/spinlock.h | 4 +- arch/arm64/include/asm/stacktrace.h | 2 +- arch/arm64/kernel/cpu_errata.c | 4 +- arch/arm64/kernel/stacktrace.c | 5 + arch/arm64/kernel/time.c | 2 +- arch/ia64/kernel/err_inject.c | 2 +- arch/m68k/coldfire/device.c | 12 +- arch/microblaze/Kconfig | 1 + arch/microblaze/mm/init.c | 56 +- arch/mips/cavium-octeon/octeon-irq.c | 10 +- arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 2 +- arch/mips/include/asm/machine.h | 2 +- arch/mips/kernel/ptrace.c | 22 +- arch/mips/kernel/ptrace32.c | 4 +- arch/mips/kvm/mips.c | 2 +- arch/mips/mm/c-r4k.c | 9 +- arch/mips/txx9/rbtx4939/setup.c | 4 +- arch/powerpc/boot/Makefile | 3 +- arch/powerpc/include/asm/irq_work.h | 1 + arch/powerpc/kvm/book3s_hv.c | 12 +- arch/powerpc/mm/numa.c | 78 +- arch/powerpc/net/bpf_jit_comp.c | 3 + arch/powerpc/perf/core-book3s.c | 25 + arch/powerpc/sysdev/mpic.c | 2 +- arch/s390/kvm/vsie.c | 2 +- arch/sh/kernel/entry-common.S | 2 +- arch/sparc/include/asm/atomic_64.h | 6 +- arch/sparc/include/asm/pgtable_64.h | 2 +- arch/sparc/mm/tlb.c | 23 +- arch/x86/events/core.c | 15 +- arch/x86/events/intel/core.c | 12 +- arch/x86/events/intel/ds.c | 117 ++- arch/x86/events/perf_event.h | 2 +- arch/x86/include/asm/i8259.h | 5 + arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/devicetree.c | 21 +- arch/x86/kernel/smpboot.c | 1 + arch/x86/kernel/tsc.c | 18 + arch/x86/kvm/cpuid.c | 7 +- arch/x86/kvm/lapic.c | 10 +- arch/x86/kvm/vmx.c | 20 +- arch/x86/kvm/x86.c | 12 +- arch/x86/mm/init_64.c | 3 +- arch/x86/mm/pageattr.c | 6 +- arch/x86/mm/pgtable.c | 9 + arch/x86/power/hibernate_32.c | 2 +- arch/x86/power/hibernate_64.c | 2 +- crypto/asymmetric_keys/pkcs7_trust.c | 1 + drivers/acpi/acpi_pad.c | 3 + drivers/acpi/acpica/evevent.c | 9 +- drivers/acpi/acpica/nseval.c | 8 + drivers/acpi/processor_perflib.c | 2 +- drivers/acpi/scan.c | 20 +- drivers/ata/libata-core.c | 6 + drivers/ata/libata-scsi.c | 2 +- drivers/base/regmap/regmap.c | 2 +- drivers/block/paride/pcd.c | 2 + drivers/cdrom/cdrom.c | 3 - drivers/cdrom/gdrom.c | 3 + drivers/char/hw_random/stm32-rng.c | 9 + drivers/char/ipmi/ipmi_powernv.c | 5 +- drivers/char/ipmi/ipmi_ssif.c | 4 +- drivers/clocksource/fsl_ftm_timer.c | 2 +- drivers/cpufreq/cppc_cpufreq.c | 23 +- drivers/cpufreq/cpufreq.c | 6 +- drivers/dma/mv_xor_v2.c | 25 +- drivers/dma/pl330.c | 6 +- drivers/dma/qcom/bam_dma.c | 27 +- drivers/dma/sh/rcar-dmac.c | 11 +- drivers/firewire/ohci.c | 8 +- drivers/firmware/dmi_scan.c | 22 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 12 +- drivers/gpu/drm/exynos/regs-fimc.h | 2 +- drivers/gpu/drm/imx/ipuv3-crtc.c | 5 + .../drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h | 746 +++++++-------- .../drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h | 802 ++++++++-------- .../drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h | 1006 ++++++++++---------- .../gpu/drm/nouveau/nvkm/subdev/pmu/fuc/memx.fuc | 30 +- drivers/gpu/drm/panel/panel-simple.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 7 +- drivers/gpu/drm/sun4i/sun4i_dotclock.c | 5 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +- drivers/gpu/drm/vmwgfx/vmwgfx_msg.h | 25 +- drivers/hid/hid-roccat-kovaplus.c | 2 + drivers/hwmon/nct6775.c | 10 +- drivers/hwmon/pmbus/adm1275.c | 4 +- drivers/hwmon/pmbus/max8688.c | 2 +- drivers/i2c/busses/i2c-mv64xxx.c | 8 +- drivers/ide/ide-cd.c | 2 + drivers/infiniband/core/multicast.c | 26 +- drivers/infiniband/core/sa_query.c | 7 +- drivers/infiniband/core/ucma.c | 2 +- drivers/infiniband/hw/hfi1/chip.c | 4 + drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 + drivers/infiniband/hw/mlx4/main.c | 11 +- drivers/infiniband/hw/mlx5/qp.c | 9 +- drivers/infiniband/hw/qedr/main.c | 3 +- drivers/infiniband/hw/qedr/verbs.c | 38 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 + drivers/input/mouse/psmouse-base.c | 34 +- drivers/iommu/intel-iommu.c | 3 +- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 + drivers/irqchip/irq-gic-v3-its-platform-msi.c | 2 + drivers/irqchip/irq-gic-v3-its.c | 2 + drivers/irqchip/irq-gic-v3.c | 2 +- drivers/macintosh/rack-meter.c | 4 +- drivers/md/bcache/alloc.c | 4 +- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/btree.c | 9 +- drivers/md/bcache/request.c | 2 +- drivers/md/bcache/super.c | 23 +- drivers/md/bcache/sysfs.c | 11 +- drivers/md/bcache/writeback.c | 27 +- drivers/md/md.c | 13 + drivers/md/raid1.c | 11 + drivers/md/raid10.c | 14 +- drivers/md/raid5.c | 15 +- drivers/mmc/host/sdhci-iproc.c | 31 +- drivers/net/ethernet/broadcom/bgmac.c | 3 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 11 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 1 + drivers/net/ethernet/cisco/enic/enic_main.c | 10 +- drivers/net/ethernet/freescale/fman/fman_dtsec.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 16 +- drivers/net/ethernet/ibm/ibmvnic.c | 1 + drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 +- drivers/net/ethernet/intel/e1000e/mac.c | 2 +- drivers/net/ethernet/intel/e1000e/netdev.c | 4 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 +- drivers/net/ethernet/marvell/mvneta.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 +- drivers/net/ethernet/smsc/smsc911x.c | 4 +- .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +- drivers/net/ethernet/sun/sunvnet.c | 2 +- drivers/net/macsec.c | 5 +- drivers/net/macvlan.c | 2 +- drivers/net/phy/dp83640.c | 18 + drivers/net/usb/qmi_wwan.c | 1 + drivers/net/usb/r8152.c | 2 +- drivers/net/usb/smsc75xx.c | 7 +- drivers/net/virtio_net.c | 2 +- drivers/net/wireless/ath/ath10k/mac.c | 10 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 + drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 28 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 39 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 7 +- drivers/net/wireless/mac80211_hwsim.c | 4 +- drivers/net/xen-netfront.c | 46 +- drivers/ntb/ntb_transport.c | 3 + drivers/nvme/host/fabrics.c | 4 +- drivers/nvme/host/pci.c | 5 +- drivers/nvme/target/core.c | 9 +- drivers/parisc/lba_pci.c | 20 +- drivers/pci/pci-driver.c | 17 +- drivers/pci/quirks.c | 5 + drivers/pinctrl/qcom/pinctrl-msm.c | 2 +- drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 40 +- drivers/regulator/gpio-regulator.c | 16 +- drivers/regulator/of_regulator.c | 1 + drivers/s390/cio/device_fsm.c | 7 +- drivers/s390/cio/device_ops.c | 72 +- drivers/s390/cio/io_sch.h | 1 + drivers/scsi/sr.c | 21 +- drivers/soc/qcom/wcnss_ctrl.c | 2 +- drivers/spi/spi-bcm-qspi.c | 4 +- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 + drivers/video/fbdev/sbuslib.c | 4 +- drivers/watchdog/f71808e_wdt.c | 3 +- drivers/watchdog/sbsa_gwdt.c | 3 +- drivers/watchdog/sp5100_tco.h | 2 +- drivers/xen/events/events_base.c | 4 +- drivers/xen/grant-table.c | 4 +- drivers/xen/swiotlb-xen.c | 2 +- drivers/xen/xen-acpi-processor.c | 6 +- drivers/xen/xenbus/xenbus_probe.c | 5 +- drivers/zorro/zorro.c | 12 + fs/affs/namei.c | 10 +- fs/aio.c | 4 +- fs/btrfs/ctree.c | 12 +- fs/btrfs/disk-io.c | 8 +- fs/btrfs/extent-tree.c | 1 + fs/btrfs/file.c | 9 + fs/btrfs/inode.c | 16 +- fs/btrfs/raid56.c | 18 +- fs/btrfs/send.c | 3 + fs/btrfs/tests/qgroup-tests.c | 2 +- fs/btrfs/tree-log.c | 12 +- fs/btrfs/volumes.c | 9 +- fs/ceph/super.c | 16 +- fs/cifs/cifssmb.c | 4 +- fs/dcache.c | 32 +- fs/ecryptfs/inode.c | 3 +- fs/ext2/namei.c | 6 +- fs/ext4/namei.c | 6 +- fs/f2fs/extent_cache.c | 3 + fs/f2fs/namei.c | 12 +- fs/fscache/page.c | 13 +- fs/gfs2/file.c | 5 +- fs/gfs2/quota.h | 2 + fs/jffs2/dir.c | 12 +- fs/jffs2/fs.c | 1 - fs/jfs/namei.c | 12 +- fs/nfs/nfs4proc.c | 12 +- fs/nfs/nfs4state.c | 5 +- fs/nfs/nfs4sysctl.c | 2 +- fs/nilfs2/namei.c | 6 +- fs/ocfs2/acl.c | 6 + fs/ocfs2/dlm/dlmdomain.c | 14 - fs/ocfs2/dlm/dlmdomain.h | 25 +- fs/ocfs2/dlm/dlmrecovery.c | 9 + fs/ocfs2/journal.c | 23 +- fs/ocfs2/super.c | 5 +- fs/ocfs2/xattr.c | 2 + fs/orangefs/namei.c | 9 +- fs/proc/base.c | 29 +- fs/proc/kcore.c | 4 + fs/proc/proc_sysctl.c | 3 + fs/reiserfs/namei.c | 12 +- fs/udf/namei.c | 6 +- fs/udf/super.c | 5 +- fs/ufs/namei.c | 6 +- fs/xfs/xfs_discard.c | 14 +- include/asm-generic/pgtable.h | 15 + include/linux/cpumask.h | 2 + include/linux/dcache.h | 1 + include/linux/kcore.h | 1 + include/linux/kvm_host.h | 3 +- include/linux/property.h | 10 +- include/linux/ptr_ring.h | 2 +- include/linux/suspend.h | 2 + include/net/ip.h | 11 +- include/net/ip_fib.h | 1 + include/net/llc_conn.h | 2 +- include/net/mac80211.h | 2 +- include/net/regulatory.h | 2 +- include/net/route.h | 3 +- include/trace/events/timer.h | 20 +- include/uapi/drm/virtgpu_drm.h | 1 + include/uapi/linux/if_ether.h | 1 + ipc/shm.c | 19 +- kernel/audit.c | 2 + kernel/debug/kdb/kdb_main.c | 27 +- kernel/events/core.c | 24 +- kernel/locking/qspinlock.c | 8 + kernel/power/power.h | 3 - kernel/rcu/tree_plugin.h | 14 +- kernel/relay.c | 2 +- kernel/sched/rt.c | 2 + kernel/signal.c | 4 + kernel/sys.c | 1 + kernel/workqueue.c | 2 +- lib/test_bpf.c | 31 +- mm/fadvise.c | 10 +- mm/huge_memory.c | 5 +- mm/kasan/kasan.c | 2 +- mm/khugepaged.c | 20 +- mm/kmemleak.c | 12 +- mm/ksm.c | 28 + mm/mempolicy.c | 36 +- mm/swapfile.c | 4 + mm/vmscan.c | 22 +- net/batman-adv/bat_iv_ogm.c | 2 +- net/batman-adv/bat_v.c | 2 +- net/batman-adv/bridge_loop_avoidance.c | 22 +- net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/fragmentation.c | 3 +- net/batman-adv/gateway_client.c | 3 + net/batman-adv/multicast.c | 8 +- net/batman-adv/routing.c | 15 +- net/batman-adv/soft-interface.c | 8 +- net/bridge/netfilter/ebtables.c | 33 +- net/core/skbuff.c | 9 +- net/ipv4/ip_vti.c | 2 - net/ipv4/route.c | 26 +- net/ipv4/tcp_illinois.c | 2 +- net/ipv4/tcp_nv.c | 2 +- net/ipv4/xfrm4_policy.c | 1 + net/ipv6/ip6_tunnel.c | 12 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 16 +- net/ipv6/sit.c | 7 + net/llc/llc_c_ac.c | 15 +- net/llc/llc_conn.c | 32 +- net/mac80211/rx.c | 2 +- net/mac80211/spectmgmt.c | 7 +- net/mac80211/sta_info.c | 3 +- net/netlabel/netlabel_unlabeled.c | 10 + net/nfc/llcp_commands.c | 4 + net/nfc/netlink.c | 3 +- net/openvswitch/conntrack.c | 34 + net/qrtr/smd.c | 1 + net/rds/ib.c | 3 +- net/rxrpc/input.c | 15 +- net/rxrpc/recvmsg.c | 5 +- net/rxrpc/sendmsg.c | 4 +- scripts/adjust_autoksyms.sh | 7 + scripts/kconfig/expr.c | 2 +- scripts/kconfig/menu.c | 1 + scripts/kconfig/zconf.y | 33 +- scripts/package/builddeb | 2 +- security/integrity/digsig.c | 1 + security/integrity/ima/ima_crypto.c | 2 + security/integrity/ima/ima_main.c | 13 + sound/core/timer.c | 4 +- sound/core/vmaster.c | 5 +- sound/pci/hda/Kconfig | 1 - sound/pci/hda/patch_realtek.c | 5 + tools/lib/bpf/libbpf.c | 26 + tools/lib/traceevent/event-parse.c | 17 +- tools/lib/traceevent/parse-filter.c | 10 +- tools/perf/arch/x86/util/header.c | 2 +- tools/perf/builtin-stat.c | 9 +- tools/perf/builtin-top.c | 6 +- tools/perf/tests/vmlinux-kallsyms.c | 2 +- tools/perf/util/evsel.c | 8 +- tools/perf/util/hist.c | 4 +- tools/perf/util/hist.h | 1 - tools/testing/selftests/Makefile | 1 + .../ftrace/test.d/kprobe/kprobe_args_string.tc | 46 + .../ftrace/test.d/kprobe/kprobe_args_syntax.tc | 97 ++ .../selftests/ftrace/test.d/kprobe/probepoint.tc | 43 + tools/testing/selftests/memfd/config | 1 + tools/testing/selftests/net/psock_fanout.c | 3 +- tools/testing/selftests/net/reuseport_bpf.c | 21 +- tools/testing/selftests/powerpc/mm/subpage_prot.c | 14 + tools/testing/selftests/pstore/config | 1 + tools/thermal/tmon/sysfs.c | 12 +- tools/thermal/tmon/tmon.c | 1 - virt/kvm/kvm_main.c | 7 +- 352 files changed, 3835 insertions(+), 2292 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/329 MIPS: c-r4k: Fix data corruption related to cache coherence
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 55a2aa08b3af519a9693f99cdf7fa6d8b62d9f65 upstream.
When DMA will be performed to a MIPS32 1004K CPS, the L1-cache for the range needs to be flushed and invalidated first.
The code currently takes one of two approaches.
1/ If the range is less than the size of the dcache, then HIT type
requests flush/invalidate cache lines for the particular addresses. HIT-type requests a globalised by the CPS so this is safe on SMP.
2/ If the range is larger than the size of dcache, then INDEX type
requests flush/invalidate the whole cache. INDEX type requests affect the local cache only. CPS does not propagate them in any way. So this invalidation is not safe on SMP CPS systems.
Data corruption due to '2' can quite easily be demonstrated by repeatedly "echo 3 > /proc/sys/vm/drop_caches" and then sha1sum a file that is several times the size of available memory. Dropping caches means that large contiguous extents (large than dcache) are more likely.
This was not a problem before Linux-4.8 because option 2 was never used if CONFIG_MIPS_CPS was defined. The commit which removed that apparently didn't appreciate the full consequence of the change.
We could, in theory, globalize the INDEX based flush by sending an IPI to other cores. These cache invalidation routines can be called with interrupts disabled and synchronous IPI require interrupts to be enabled. Asynchronous IPI may not trigger writeback soon enough. So we cannot use IPI in practice.
We can already test if IPI would be needed for an INDEX operation with r4k_op_needs_ipi(R4K_INDEX). If this is true then we mustn't try the INDEX approach as we cannot use IPI. If this is false (e.g. when there is only one core and hence one L1 cache) then it is safe to use the INDEX approach without IPI.
This patch avoids options 2 if r4k_op_needs_ipi(R4K_INDEX), and so eliminates the corruption.
Patchwork: https://patchwork.linux-mips.org/patch/19259/
--- arch/mips/mm/c-r4k.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/mips/mm/c-r4k.c +6 -3
@@ -851,9 +851,12 @@ static void r4k_dma_cache_wback_inv(unsi/* * Either no secondary cache or the available caches don't have the * subset property so we have to flush the primary caches -* explicitly +* explicitly. +* If we would need IPI to perform an INDEX-type operation, then +* we have to use the HIT-type alternative as IPI cannot be used +* here due to interrupts possibly being disabled. */ -if (size >= dcache_size) { +if (!r4k_op_needs_ipi (R4K_INDEX ) && size >= dcache_size) {r4k_blast_dcache (); }else {R4600_HIT_CACHEOP_WAR_IMPL ;
@@ -890,7 +893,7 @@ static void r4k_dma_cache_inv(unsigned lreturn ; } -if (size >= dcache_size) { +if (!r4k_op_needs_ipi (R4K_INDEX ) && size >= dcache_size) {r4k_blast_dcache (); }else {R4600_HIT_CACHEOP_WAR_IMPL ;
Greg Kroah-Hartman
maintainerPATCH 2/329 MIPS: ptrace: Expose FIR register through FP regset
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 71e909c0cdad28a1df1fa14442929e68615dee45 upstream.
Correct commit 7aeb753b5353 ("MIPS: Implement task_user_regset_view.") and expose the FIR register using the unused 4 bytes at the end of the NT_PRFPREG regset. Without that register included clients cannot use the PTRACE_GETREGSET request to retrieve the complete FPU register set and have to resort to one of the older interfaces, either PTRACE_PEEKUSR or PTRACE_GETFPREGS, to retrieve the missing piece of data. Also the register is irreversibly missing from core dumps.
This register is architecturally hardwired and read-only so the write path does not matter. Ignore data supplied on writes then.
Patchwork: https://patchwork.linux-mips.org/patch/19273/
--- arch/mips/kernel/ptrace.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
arch/mips/kernel/ptrace.c +16 -2
@@ -483,7 +483,7 @@ static int fpr_get_msa(struct task_struc/* * Copy the floating-point context to the supplied NT_PRFPREG buffer. * Choose the appropriate helper for general registers, and then copy -* the FCSR register separately. +* the FCSR and FIR registers separately. */ static int fpr_get(struct task_struct *target, const struct user_regset *regset,
@@ -491,6 +491,7 @@ static int fpr_get(struct task_struct *t void *kbuf, void __user *ubuf) {const int fcr31_pos =NUM_FPU_REGS *sizeof (elf_fpreg_t); +const int fir_pos = fcr31_pos +sizeof (u32);int err;if (sizeof (target->thread.fpu.fpr[0 ]) ==sizeof (elf_fpreg_t))
@@ -503,6 +504,12 @@ static int fpr_get(struct task_struct *t err =user_regset_copyout (&pos, &count, &kbuf, &ubuf, &target->thread.fpu.fcr31, fcr31_pos, fcr31_pos +sizeof (u32)); +if (err) +return err; + + err =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + &boot_cpu_data.fpu_id, + fir_pos, fir_pos +sizeof (u32));return err; }
@@ -551,7 +558,8 @@ static int fpr_set_msa(struct task_struc/* * Copy the supplied NT_PRFPREG buffer to the floating-point context. * Choose the appropriate helper for general registers, and then copy -* the FCSR register separately. +* the FCSR register separately. Ignore the incoming FIR register +* contents though, as the register is read-only. * * We optimize for the case where `count % sizeof(elf_fpreg_t) == 0', * which is supposed to have been guaranteed by the kernel before
@@ -565,6 +573,7 @@ static int fpr_set(struct task_struct *t const void *kbuf, const void __user *ubuf) { const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t); +const int fir_pos = fcr31_pos +sizeof (u32);u32 fcr31;int err;
@@ -592,6 +601,11 @@ static int fpr_set(struct task_struct *tptrace_setfcr31 (target, fcr31); } +if (count >0 ) + err =user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, + fir_pos, + fir_pos +sizeof (u32)); +return err; }
Greg Kroah-Hartman
maintainerPATCH 3/329 MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 9a3a92ccfe3620743d4ae57c987dc8e9c5f88996 upstream.
Check the TIF_32BIT_FPREGS task setting of the tracee rather than the tracer in determining the layout of floating-point general registers in the floating-point context, correcting access to odd-numbered registers for o32 tracees where the setting disagrees between the two processes.
--- arch/mips/kernel/ptrace.c | 4 ++-- arch/mips/kernel/ptrace32.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/kernel/ptrace.c +2 -2
@@ -827,7 +827,7 @@ long arch_ptrace(struct task_struct *chi fregs =get_fpu_regs (child);#ifdef CONFIG_32BIT -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
@@ -916,7 +916,7 @@ long arch_ptrace(struct task_struct *chiinit_fp_ctx (child);#ifdef CONFIG_32BIT -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
arch/mips/kernel/ptrace32.c +2 -2
@@ -97,7 +97,7 @@ long compat_arch_ptrace(struct task_strubreak ; } fregs =get_fpu_regs (child); -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
@@ -204,7 +204,7 @@ long compat_arch_ptrace(struct task_stru sizeof(child->thread.fpu)); child->thread.fpu.fcr31 =0 ; } -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
Greg Kroah-Hartman
maintainerPATCH 4/329 KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable"
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit ba3696e94d9d590d9a7e55f68e81c25dba515191 upstream.
Trivial fix to spelling mistake in debugfs_entries text.
--- arch/mips/kvm/mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kvm/mips.c +1 -1
@@ -42,7 +42,7 @@ struct kvm_stats_debugfs_item debugfs_en { "cache", VCPU_STAT(cache_exits), KVM_STAT_VCPU }, { "signal", VCPU_STAT(signal_exits), KVM_STAT_VCPU }, { "interrupt", VCPU_STAT(int_exits), KVM_STAT_VCPU }, - { "cop_unsuable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU }, + { "cop_unusable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU }, { "tlbmod", VCPU_STAT(tlbmod_exits), KVM_STAT_VCPU }, { "tlbmiss_ld", VCPU_STAT(tlbmiss_ld_exits), KVM_STAT_VCPU }, { "tlbmiss_st", VCPU_STAT(tlbmiss_st_exits), KVM_STAT_VCPU },
Greg Kroah-Hartman
maintainerPATCH 5/329 affs_lookup(): close a race with affs_remove_link()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 30da870ce4a4e007c901858a96e9e394a1daa74a upstream.
we unlock the directory hash too early - if we are looking at secondary link and primary (in another directory) gets removed just as we unlock, we could have the old primary moved in place of the secondary, leaving us to look into freed entry (and leaving our dentry with ->d_fsdata pointing to a freed entry).
--- fs/affs/namei.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/affs/namei.c +7 -3
@@ -224,9 +224,10 @@ affs_lookup(struct inode *dir, struct deaffs_lock_dir (dir); bh =affs_find_entry (dir, dentry); -affs_unlock_dir (dir); -if (IS_ERR (bh)) +if (IS_ERR (bh)) { +affs_unlock_dir (dir);return ERR_CAST (bh); + }if (bh) {u32 ino = bh->b_blocknr;
@@ -240,10 +241,13 @@ affs_lookup(struct inode *dir, struct de }affs_brelse (bh); inode =affs_iget (sb, ino); -if (IS_ERR (inode)) +if (IS_ERR (inode)) { +affs_unlock_dir (dir);return ERR_CAST (inode); + } }d_add (dentry, inode); +affs_unlock_dir (dir);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 6/329 aio: fix io_destroy(2) vs. lookup_ioctx() race
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit baf10564fbb66ea222cae66fbff11c444590ffd9 upstream.
kill_ioctx() used to have an explicit RCU delay between removing the reference from ->ioctx_table and percpu_ref_kill() dropping the refcount. At some point that delay had been removed, on the theory that percpu_ref_kill() itself contained an RCU delay. Unfortunately, that was the wrong kind of RCU delay and it didn't care about rcu_read_lock() used by lookup_ioctx(). As the result, we could get ctx freed right under lookup_ioctx(). Tejun has fixed that in a6d7cff472e ("fs/aio: Add explicit RCU grace period when freeing kioctx"); however, that fix is not enough.
Suppose io_destroy() from one thread races with e.g. io_setup() from another; CPU1 removes the reference from current->mm->ioctx_table[...] just as CPU2 has picked it (under rcu_read_lock()). Then CPU1 proceeds to drop the refcount, getting it to 0 and triggering a call of free_ioctx_users(), which proceeds to drop the secondary refcount and once that reaches zero calls free_ioctx_reqs(). That does
INIT_RCU_WORK(&ctx->free_rwork, free_ioctx);
queue_rcu_work(system_wq, &ctx->free_rwork);and schedules freeing the whole thing after RCU delay.
In the meanwhile CPU2 has gotten around to percpu_ref_get(), bumping the refcount from 0 to 1 and returned the reference to io_setup().
Tejun's fix (that queue_rcu_work() in there) guarantees that ctx won't get freed until after percpu_ref_get(). Sure, we'd increment the counter before ctx can be freed. Now we are out of rcu_read_lock() and there's nothing to stop freeing of the whole thing. Unfortunately, CPU2 assumes that since it has grabbed the reference, ctx is *NOT* going away until it gets around to dropping that reference.
The fix is obvious - use percpu_ref_tryget_live() and treat failure as miss. It's not costlier than what we currently do in normal case, it's safe to call since freeing *is* delayed and it closes the race window - either lookup_ioctx() comes before percpu_ref_kill() (in which case ctx->users won't reach 0 until the caller of lookup_ioctx() drops it) or lookup_ioctx() fails, ctx->users is unaffected and caller of lookup_ioctx() doesn't see the object in question at all.
--- fs/aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/aio.c +2 -2
@@ -1074,8 +1074,8 @@ static struct kioctx *lookup_ioctx(unsig ctx =rcu_dereference (table->table[id]);if (ctx && ctx->user_id == ctx_id) { -percpu_ref_get (&ctx->users); - ret = ctx; +if (percpu_ref_tryget_live (&ctx->users)) + ret = ctx; } out:rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 7/329 ALSA: timer: Fix pause event notification
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 3ae180972564846e6d794e3615e1ab0a1e6c4ef9 upstream.
Commit f65e0d299807 ("ALSA: timer: Call notifier in the same spinlock") combined the start/continue and stop/pause functions, and in doing so changed the event code for the pause case to SNDRV_TIMER_EVENT_CONTINUE. Change it back to SNDRV_TIMER_EVENT_PAUSE.
--- sound/core/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/timer.c +2 -2
@@ -547,7 +547,7 @@ static int snd_timer_stop1(struct snd_tielse timeri->flags |=SNDRV_TIMER_IFLG_PAUSED ;snd_timer_notify1 (timeri, stop ?SNDRV_TIMER_EVENT_STOP : -SNDRV_TIMER_EVENT_CONTINUE ); +SNDRV_TIMER_EVENT_PAUSE ); unlock:spin_unlock_irqrestore (&timer->lock, flags);return result;
@@ -569,7 +569,7 @@ static int snd_timer_stop_slave(struct slist_del_init (&timeri->ack_list);list_del_init (&timeri->active_list);snd_timer_notify1 (timeri, stop ?SNDRV_TIMER_EVENT_STOP : -SNDRV_TIMER_EVENT_CONTINUE ); +SNDRV_TIMER_EVENT_PAUSE );spin_unlock (&timeri->timer->lock); }spin_unlock_irqrestore (&slave_active_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 8/329 do d_instantiate/unlock_new_inode combinations safely
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.
For anything NFS-exported we do _not_ want to unlock new inode before it has grown an alias; original set of fixes got the ordering right, but missed the nasty complication in case of lockdep being enabled - unlock_new_inode() does
lockdep_annotate_inode_mutex_key(inode)
which can only be done before anyone gets a chance to touch ->i_mutex. Unfortunately, flipping the order and doing unlock_new_inode() before d_instantiate() opens a window when mkdir can race with open-by-fhandle on a guessed fhandle, leading to multiple aliases for a directory inode and all the breakage that follows from that.
Correct solution: a new primitive (d_instantiate_new())
combining these two in the right order - lockdep annotate, then d_instantiate(), then the rest of unlock_new_inode(). All combinations of d_instantiate() with unlock_new_inode() should be converted to that.
--- fs/btrfs/inode.c | 16 ++++------------ fs/dcache.c | 22 ++++++++++++++++++++++ fs/ecryptfs/inode.c | 3 +-- fs/ext2/namei.c | 6 ++---- fs/ext4/namei.c | 6 ++---- fs/f2fs/namei.c | 12 ++++-------- fs/jffs2/dir.c | 12 ++++-------- fs/jfs/namei.c | 12 ++++-------- fs/nilfs2/namei.c | 6 ++---- fs/orangefs/namei.c | 9 +++------ fs/reiserfs/namei.c | 12 ++++-------- fs/udf/namei.c | 6 ++---- fs/ufs/namei.c | 6 ++---- include/linux/dcache.h | 1 + 14 files changed, 57 insertions(+), 72 deletions(-)
fs/btrfs/inode.c +4 -12
@@ -6491,8 +6491,7 @@ static int btrfs_mknod(struct inode *dir goto out_unlock_inode; }else {btrfs_update_inode (trans, root, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); } out_unlock:
@@ -6567,8 +6566,7 @@ static int btrfs_create(struct inode *di goto out_unlock_inode;BTRFS_I (inode)->io_tree.ops = &btrfs_extent_io_ops; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
@@ -6711,12 +6709,7 @@ static int btrfs_mkdir(struct inode *dirif (err) goto out_fail_inode; -d_instantiate (dentry, inode); -/* -* mkdir is special. We're unlocking after we call d_instantiate -* to avoid a race with nfsd calling d_instantiate. -*/ -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); drop_on_err =0 ; out_fail:
@@ -10354,8 +10347,7 @@ static int btrfs_symlink(struct inode *d goto out_unlock_inode; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
fs/dcache.c +22 -0
@@ -1859,6 +1859,28 @@ void d_instantiate(struct dentry *entry, }EXPORT_SYMBOL (d_instantiate); +/* +* This should be equivalent to d_instantiate() + unlock_new_inode(), +* with lockdep-related part of unlock_new_inode() done before +* anything else. Use that instead of open-coding d_instantiate()/ +* unlock_new_inode() combinations. +*/ +void d_instantiate_new (struct dentry *entry,struct inode *inode) +{ +BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +BUG_ON (!inode); +lockdep_annotate_inode_mutex_key (inode); +security_d_instantiate (entry, inode); +spin_lock (&inode->i_lock); +__d_instantiate (entry, inode); +WARN_ON (!(inode->i_state &I_NEW )); + inode->i_state &= ~I_NEW ; +smp_mb (); +wake_up_bit (&inode->i_state, __I_NEW); +spin_unlock (&inode->i_lock); +} +EXPORT_SYMBOL (d_instantiate_new); +/** * d_instantiate_no_diralias - instantiate a non-aliased dentry * @entry: dentry to complete
fs/ecryptfs/inode.c +1 -2
@@ -284,8 +284,7 @@ ecryptfs_create(struct inode *directory_iget_failed (ecryptfs_inode); goto out; } -unlock_new_inode (ecryptfs_inode); -d_instantiate (ecryptfs_dentry, ecryptfs_inode); +d_instantiate_new (ecryptfs_dentry, ecryptfs_inode); out:return rc; }
fs/ext2/namei.c +2 -4
@@ -40,8 +40,7 @@ static inline int ext2_add_nondir(struct {int err =ext2_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -268,8 +267,7 @@ static int ext2_mkdir(struct inode * dirif (err) goto out_fail; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out:return err;
fs/ext4/namei.c +2 -4
@@ -2442,8 +2442,7 @@ static int ext4_add_nondir(handle_t *hanint err =ext4_add_entry (handle, dentry, inode);if (!err) {ext4_mark_inode_dirty (handle, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }drop_nlink (inode);
@@ -2682,8 +2681,7 @@ out_clear_inode: err =ext4_mark_inode_dirty (handle, dir);if (err) goto out_clear_inode; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))ext4_handle_sync (handle);
fs/f2fs/namei.c +4 -8
@@ -158,8 +158,7 @@ static int f2fs_create(struct inode *diralloc_nid_done (sbi, ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
@@ -464,8 +463,7 @@ static int f2fs_symlink(struct inode *di err =page_symlink (inode, disk_link.name, disk_link.len); err_out: -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);/* * Let's flush symlink data in order to avoid broken symlink as much as
@@ -519,8 +517,7 @@ static int f2fs_mkdir(struct inode *dir,alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
@@ -564,8 +561,7 @@ static int f2fs_mknod(struct inode *dir,alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
fs/jffs2/dir.c +4 -8
@@ -209,8 +209,7 @@ static int jffs2_create(struct inode *di __func__, inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->pino_nlink, inode->i_mapping->nrpages); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -430,8 +429,7 @@ static int jffs2_symlink (struct inode *mutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -575,8 +573,7 @@ static int jffs2_mkdir (struct inode *dimutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -747,8 +744,7 @@ static int jffs2_mknod (struct inode *dimutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
fs/jfs/namei.c +4 -8
@@ -178,8 +178,7 @@ static int jfs_create(struct inode *dip,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -313,8 +312,7 @@ static int jfs_mkdir(struct inode *dip,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1059,8 +1057,7 @@ static int jfs_symlink(struct inode *dipunlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1447,8 +1444,7 @@ static int jfs_mknod(struct inode *dir,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out1:
fs/nilfs2/namei.c +2 -4
@@ -46,8 +46,7 @@ static inline int nilfs_add_nondir(strucint err =nilfs_add_link (dentry, inode);if (!err) { -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -243,8 +242,7 @@ static int nilfs_mkdir(struct inode *dir goto out_fail;nilfs_mark_inode_dirty (inode); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); out:if (!err) err =nilfs_transaction_commit (dir->i_sb);
fs/orangefs/namei.c +3 -6
@@ -70,8 +70,7 @@ static int orangefs_create(struct inodeget_khandle_from_ino (inode), dentry); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);orangefs_set_timeout (dentry);ORANGEFS_I (inode)->getattr_time = jiffies -1 ;
@@ -318,8 +317,7 @@ static int orangefs_symlink(struct inode"Assigned symlink inode new number of %pU\n" , get_khandle_from_ino(inode)); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);orangefs_set_timeout (dentry);ORANGEFS_I (inode)->getattr_time = jiffies -1 ;
@@ -382,8 +380,7 @@ static int orangefs_mkdir(struct inode *"Assigned dir inode new number of %pU\n" , get_khandle_from_ino(inode)); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);orangefs_set_timeout (dentry);ORANGEFS_I (inode)->getattr_time = jiffies -1 ;
fs/reiserfs/namei.c +4 -8
@@ -687,8 +687,7 @@ static int reiserfs_create(struct inodereiserfs_update_inode_transaction (inode);reiserfs_update_inode_transaction (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -771,8 +770,7 @@ static int reiserfs_mknod(struct inode * goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -871,8 +869,7 @@ static int reiserfs_mkdir(struct inode */* the above add_entry did not update dir's stat data */ reiserfs_update_sd (&th, dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -1187,8 +1184,7 @@ static int reiserfs_symlink(struct inode goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (parent_dir->i_sb);
fs/udf/namei.c +2 -4
@@ -621,8 +621,7 @@ static int udf_add_nondir(struct dentryif (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }
@@ -732,8 +731,7 @@ static int udf_mkdir(struct inode *dir,inc_nlink (dir); dir->i_ctime = dir->i_mtime =current_time (dir);mark_inode_dirty (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh);
fs/ufs/namei.c +2 -4
@@ -38,8 +38,7 @@ static inline int ufs_add_nondir(struct {int err =ufs_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -192,8 +191,7 @@ static int ufs_mkdir(struct inode * dir,if (err) goto out_fail; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; out_fail:
include/linux/dcache.h +1 -0
@@ -219,6 +219,7 @@ extern seqlock_t rename_lock;* These are the low-level FS interfaces to the dcache.. */ extern void d_instantiate (struct dentry *,struct inode *); +extern void d_instantiate_new (struct dentry *,struct inode *);extern struct dentry *d_instantiate_unique (struct dentry *,struct inode *);extern int d_instantiate_no_diralias (struct dentry *,struct inode *);extern void __d_drop (struct dentry *dentry);
Greg Kroah-Hartman
maintainerPATCH 9/329 mmc: sdhci-iproc: remove hard coded mmc cap 1.8v
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinath Mannam <[email protected]>
commit 4c94238f37af87a2165c3fb491b4a8b50e90649c upstream.
Remove hard coded mmc cap 1.8v from platform data as it is board specific. The 1.8v DDR mmc caps can be enabled using DTS property for those boards that support it.
--- drivers/mmc/host/sdhci-iproc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mmc/host/sdhci-iproc.c +0 -1
@@ -176,7 +176,6 @@ static const struct sdhci_iproc_data ipr .caps1 = SDHCI_DRIVER_TYPE_C | SDHCI_DRIVER_TYPE_D | SDHCI_SUPPORT_DDR50, - .mmc_caps = MMC_CAP_1_8V_DDR, };static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
Greg Kroah-Hartman
maintainerPATCH 10/329 mmc: sdhci-iproc: fix 32bit writes for TRANSFER_MODE register
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corneliu Doban <[email protected]>
commit 5f651b870485ee60f5abbbd85195a6852978894a upstream.
When the host controller accepts only 32bit writes, the value of the 16bit TRANSFER_MODE register, that has the same 32bit address as the 16bit COMMAND register, needs to be saved and it will be written in a 32bit write together with the command as this will trigger the host to send the command on the SD interface.
When sending the tuning command, TRANSFER_MODE is written and then sdhci_set_transfer_mode reads it back to clear AUTO_CMD12 bit and write it again resulting in wrong value to be written because the initial write value was saved in a shadow and the read-back returned a wrong value, from the register.
Fix sdhci_iproc_readw to return the saved value of TRANSFER_MODE when a saved value exist.
Same fix for read of BLOCK_SIZE and BLOCK_COUNT registers, that are saved for a different reason, although a scenario that will cause the mentioned problem on this registers is not probable.
--- drivers/mmc/host/sdhci-iproc.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-iproc.c +25 -5
@@ -33,6 +33,8 @@ struct sdhci_iproc_host {const struct sdhci_iproc_data *data;u32 shadow_cmd;u32 shadow_blk; +bool is_cmd_shadowed; +bool is_blk_shadowed; };#define REG_OFFSET_IN_BITS (reg) ((reg) << 3 & 0x18)
@@ -48,8 +50,22 @@ static inline u32 sdhci_iproc_readl(strustatic u16 sdhci_iproc_readw (struct sdhci_host *host,int reg) { -u32 val =sdhci_iproc_readl (host, (reg & ~3 )); -u16 word = val >>REG_OFFSET_IN_BITS (reg) &0xffff ; +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_iproc_host *iproc_host =sdhci_pltfm_priv (pltfm_host); +u32 val; +u16 word; + +if ((reg ==SDHCI_TRANSFER_MODE ) && iproc_host->is_cmd_shadowed) { +/* Get the saved transfer mode */ + val = iproc_host->shadow_cmd; + }else if ((reg ==SDHCI_BLOCK_SIZE || reg ==SDHCI_BLOCK_COUNT ) && + iproc_host->is_blk_shadowed) { +/* Get the saved block info */ + val = iproc_host->shadow_blk; + }else { + val =sdhci_iproc_readl (host, (reg & ~3 )); + } + word = val >>REG_OFFSET_IN_BITS (reg) &0xffff ;return word; }
@@ -105,13 +121,15 @@ static void sdhci_iproc_writew(struct sdif (reg ==SDHCI_COMMAND ) {/* Write the block now as we are issuing a command */ -if (iproc_host->shadow_blk !=0 ) { +if (iproc_host->is_blk_shadowed) {sdhci_iproc_writel (host, iproc_host->shadow_blk,SDHCI_BLOCK_SIZE ); - iproc_host->shadow_blk =0 ; + iproc_host->is_blk_shadowed = false; } oldval = iproc_host->shadow_cmd; - }else if (reg ==SDHCI_BLOCK_SIZE || reg ==SDHCI_BLOCK_COUNT ) { + iproc_host->is_cmd_shadowed = false; + }else if ((reg ==SDHCI_BLOCK_SIZE || reg ==SDHCI_BLOCK_COUNT ) && + iproc_host->is_blk_shadowed) {/* Block size and count are stored in shadow reg */ oldval = iproc_host->shadow_blk; }else {
@@ -123,9 +141,11 @@ static void sdhci_iproc_writew(struct sdif (reg ==SDHCI_TRANSFER_MODE ) {/* Save the transfer mode until the command is issued */ iproc_host->shadow_cmd = newval; + iproc_host->is_cmd_shadowed = true; }else if (reg ==SDHCI_BLOCK_SIZE || reg ==SDHCI_BLOCK_COUNT ) {/* Save the block info until the command is issued */ iproc_host->shadow_blk = newval; + iproc_host->is_blk_shadowed = true; }else {/* Command or other regular 32-bit write */ sdhci_iproc_writel (host, newval, reg & ~3 );
Greg Kroah-Hartman
maintainerPATCH 11/329 libata: Blacklist some Sandisk SSDs for NCQ
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 322579dcc865b94b47345ad1b6002ad167f85405 upstream.
Sandisk SSDs SD7SN6S256G and SD8SN8U256G are regularly locking up regularly under sustained moderate load with NCQ enabled. Blacklist for now.
--- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
@@ -4366,6 +4366,10 @@ static const struct ata_blacklist_entry/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, + /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on + SD7SN6S256G and SD8SN8U256G */ + { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, }, + /* devices which puke on READ_NATIVE_MAX */ { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, { "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
Greg Kroah-Hartman
maintainerPATCH 12/329 libata: blacklist Micron 500IT SSD with MU01 firmware
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudip Mukherjee <[email protected]>
commit 136d769e0b3475d71350aa3648a116a6ee7a8f6c upstream.
While whitelisting Micron M500DC drives, the tweaked blacklist entry enabled queued TRIM from M500IT variants also. But these do not support queued TRIM. And while using those SSDs with the latest kernel we have seen errors and even the partition table getting corrupted.
Some part from the dmesg:
[ 6.727384] ata1.00: ATA-9: Micron_M500IT_MTFDDAK060MBD, MU01, max UDMA/133 [ 6.727390] ata1.00: 117231408 sectors, multi 16: LBA48 NCQ (depth 31/32), AA [ 6.741026] ata1.00: supports DRM functions and may not be fully accessible [ 6.759887] ata1.00: configured for UDMA/133 [ 6.762256] scsi 0:0:0:0: Direct-Access ATA Micron_M500IT_MT MU01 PQ: 0 ANSI: 5
and then for the error:
[ 120.860334] ata1.00: exception Emask 0x1 SAct 0x7ffc0007 SErr 0x0 action 0x6 frozen
[ 120.860338] ata1.00: irq_stat 0x40000008
[ 120.860342] ata1.00: failed command: SEND FPDMA QUEUED
[ 120.860351] ata1.00: cmd 64/01:00:00:00:00/00:00:00:00:00/a0 tag 0 ncq dma 512 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x5 (timeout)
[ 120.860353] ata1.00: status: { DRDY }
[ 120.860543] ata1: hard resetting link
[ 121.166128] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 121.166376] ata1.00: supports DRM functions and may not be fully accessible
[ 121.186238] ata1.00: supports DRM functions and may not be fully accessible
[ 121.204445] ata1.00: configured for UDMA/133
[ 121.204454] ata1.00: device reported invalid CHS sector 0
[ 121.204541] sd 0:0:0:0: [sda] tag#18 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
[ 121.204546] sd 0:0:0:0: [sda] tag#18 Sense Key : 0x5 [current]
[ 121.204550] sd 0:0:0:0: [sda] tag#18 ASC=0x21 ASCQ=0x4
[ 121.204555] sd 0:0:0:0: [sda] tag#18 CDB: opcode=0x93 93 08 00 00 00 00 00 04 28 80 00 00 00 30 00 00
[ 121.204559] print_req_error: I/O error, dev sda, sector 272512After few reboots with these errors, and the SSD is corrupted. After blacklisting it, the errors are not seen and the SSD does not get corrupted any more.
--- drivers/ata/libata-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/libata-core.c +2 -0
@@ -4430,6 +4430,8 @@ static const struct ata_blacklist_entry { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, }, /* devices that don't properly handle queued TRIM commands */ + { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
Greg Kroah-Hartman
maintainerPATCH 13/329 xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Jin <[email protected]>
commit 4855c92dbb7b3b85c23e88ab7ca04f99b9677b41 upstream.
When run raidconfig from Dom0 we found that the Xen DMA heap is reduced, but Dom Heap is increased by the same size. Tracing raidconfig we found that the related ioctl() in megaraid_sas will call dma_alloc_coherent() to apply memory. If the memory allocated by Dom0 is not in the DMA area, it will exchange memory with Xen to meet the requiment. Later drivers call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent() the check condition (dev_addr + size - 1 <= dma_mask) is always false, it prevents calling xen_destroy_contiguous_region() to return the memory to the Xen DMA heap.
This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing coherent alloc/dealloc check before swizzling the MFNs.".
--- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/swiotlb-xen.c +1 -1
@@ -359,7 +359,7 @@ xen_swiotlb_free_coherent(struct device* physical address */ phys =xen_bus_to_phys (dev_addr); -if (((dev_addr + size -1 > dma_mask)) || +if (((dev_addr + size -1 <= dma_mask)) ||range_straddles_page_boundary (phys, size))xen_destroy_contiguous_region (phys, order);
Greg Kroah-Hartman
maintainerPATCH 14/329 drm/vmwgfx: Fix 32-bit VMW_PORT_HB_[IN|OUT] macros
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit 938ae7259c908ad031da35d551da297640bb640c upstream.
Depending on whether the kernel is compiled with frame-pointer or not, the temporary memory location used for the bp parameter in these macros is referenced relative to the stack pointer or the frame pointer. Hence we can never reference that parameter when we've modified either the stack pointer or the frame pointer, because then the compiler would generate an incorrect stack reference.
Fix this by pushing the temporary memory parameter on a known location on the stack before modifying the stack- and frame pointers.
--- drivers/gpu/drm/vmwgfx/vmwgfx_msg.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.h +17 -8
@@ -135,17 +135,24 @@#else -/* In the 32-bit version of this macro, we use "m" because there is no -* more register left for bp +/* +* In the 32-bit version of this macro, we store bp in a memory location +* because we've ran out of registers. +* Now we can't reference that memory location while we've modified +* %esp or %ebp, so we first push it on the stack, just before we push +* %ebp, and then when we need it we read it from the stack where we +* just pushed it. */ #define VMW_PORT_HB_OUT (cmd, in_ecx, in_si, in_di, \ port_num, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%ebp;" \ - "mov %12, %%ebp;" \ + asm volatile ("push %12;" \ + "push %%ebp;" \ + "mov 0x04(%%esp), %%ebp;" \ "rep outsb;" \ - "pop %%ebp;" : \ + "pop %%ebp;" \ + "add $0x04, %%esp;" : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \
@@ -167,10 +174,12 @@ port_num, magic, bp, \ eax, ebx, ecx, edx, si, di) \ ({ \ - asm volatile ("push %%ebp;" \ - "mov %12, %%ebp;" \ + asm volatile ("push %12;" \ + "push %%ebp;" \ + "mov 0x04(%%esp), %%ebp;" \ "rep insb;" \ - "pop %%ebp" : \ + "pop %%ebp;" \ + "add $0x04, %%esp;" : \ "=a"(eax), \ "=b"(ebx), \ "=c"(ecx), \
Greg Kroah-Hartman
maintainerPATCH 15/329 IB/hfi1: Use after free race condition in send context error path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael J. Ruhl <[email protected]>
commit f9e76ca3771bf23d2142a81a88ddd8f31f5c4c03 upstream.
A pio send egress error can occur when the PSM library attempts to to send a bad packet. That issue is still being investigated.
The pio error interrupt handler then attempts to progress the recovery of the errored pio send context.
Code inspection reveals that the handling lacks the necessary locking if that recovery interleaves with a PSM close of the "context" object contains the pio send context.
The lack of the locking can cause the recovery to access the already freed pio send context object and incorrectly deduce that the pio send context is actually a kernel pio send context as shown by the NULL deref stack below:
[<ffffffff8143d78c>] _dev_info+0x6c/0x90 [<ffffffffc0613230>] sc_restart+0x70/0x1f0 [hfi1] [<ffffffff816ab124>] ? __schedule+0x424/0x9b0 [<ffffffffc06133c5>] sc_halted+0x15/0x20 [hfi1] [<ffffffff810aa3ba>] process_one_work+0x17a/0x440 [<ffffffff810ab086>] worker_thread+0x126/0x3c0 [<ffffffff810aaf60>] ? manage_workers.isra.24+0x2a0/0x2a0 [<ffffffff810b252f>] kthread+0xcf/0xe0 [<ffffffff810b2460>] ? insert_kthread_work+0x40/0x40 [<ffffffff816b8798>] ret_from_fork+0x58/0x90 [<ffffffff810b2460>] ? insert_kthread_work+0x40/0x40
This is the best case scenario and other scenarios can corrupt the already freed memory.
Fix by adding the necessary locking in the pio send context error handler.
--- drivers/infiniband/hw/hfi1/chip.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/hfi1/chip.c +4 -0
@@ -5860,6 +5860,7 @@ static void is_sendctxt_err_int(struct hu64 status;u32 sw_index;int i =0 ; +unsigned long irq_flags; sw_index = dd->hw_to_sw[hw_context];if (sw_index >= dd->num_send_contexts) {
@@ -5869,10 +5870,12 @@ static void is_sendctxt_err_int(struct hreturn ; } sci = &dd->send_contexts[sw_index]; +spin_lock_irqsave (&dd->sc_lock, irq_flags); sc = sci->sc;if (!sc) {dd_dev_err (dd,"%s: context %u(%u): no sc?\n" , __func__, sw_index, hw_context); +spin_unlock_irqrestore (&dd->sc_lock, irq_flags);return ; }
@@ -5894,6 +5897,7 @@ static void is_sendctxt_err_int(struct h*/ if (sc->type !=SC_USER )queue_work (dd->pport->hfi1_wq, &sc->halt_work); +spin_unlock_irqrestore (&dd->sc_lock, irq_flags);/* * Update the counters for the corresponding status bits.
Greg Kroah-Hartman
maintainerPATCH 16/329 Revert "ipc/shm: Fix shmat mmap nil-page protection"
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit a73ab244f0dad8fffb3291b905f73e2d3eaa7c00 upstream.
Patch series "ipc/shm: shmat() fixes around nil-page".
These patches fix two issues reported[1] a while back by Joe and Andrea around how shmat(2) behaves with nil-page.
The first reverts a commit that it was incorrectly thought that mapping nil-page (address=0) was a no no with MAP_FIXED. This is not the case, with the exception of SHM_REMAP; which is address in the second patch.
I chose two patches because it is easier to backport and it explicitly reverts bogus behaviour. Both patches ought to be in -stable and ltp testcases need updated (the added testcase around the cve can be modified to just test for SHM_RND|SHM_REMAP).
[1] lkml.kernel.org/r/20180430172152.nfa564pvgpk3ut7p@linux-n805
This patch (of 2):
Commit 95e91b831f87 ("ipc/shm: Fix shmat mmap nil-page protection") worked on the idea that we should not be mapping as root addr=0 and MAP_FIXED. However, it was reported that this scenario is in fact valid, thus making the patch both bogus and breaks userspace as well.
For example X11's libint10.so relies on shmat(1, SHM_RND) for lowmem initialization[1].
[1] https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/os-support/linux/int10/linux.c#n347
--- ipc/shm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
ipc/shm.c +2 -7
@@ -1127,13 +1127,8 @@ long do_shmat(int shmid, char __user *sh goto out; else if ((addr = (ulong)shmaddr)) {if (addr & (shmlba -1 )) { -/* -* Round down to the nearest multiple of shmlba. -* For sane do_mmap_pgoff() parameters, avoid -* round downs that trigger nil-page and MAP_FIXED. -*/ -if ((shmflg &SHM_RND ) && addr >= shmlba) - addr &= ~(shmlba -1 ); +if (shmflg &SHM_RND ) + addr &= ~(shmlba -1 );/* round down */ else#ifndef __ARCH_FORCE_SHMLBAif (addr & ~PAGE_MASK )
Greg Kroah-Hartman
maintainerPATCH 17/329 ipc/shm: fix shmat() nil address after round-down when remapping
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit 8f89c007b6dec16a1793cb88de88fcc02117bbbc upstream.
shmat()'s SHM_REMAP option forbids passing a nil address for; this is in fact the very first thing we check for. Andrea reported that for SHM_RND|SHM_REMAP cases we can end up bypassing the initial addr check, but we need to check again if the address was rounded down to nil. As of this patch, such cases will return -EINVAL.
--- ipc/shm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
ipc/shm.c +10 -2
@@ -1127,9 +1127,17 @@ long do_shmat(int shmid, char __user *sh goto out; else if ((addr = (ulong)shmaddr)) {if (addr & (shmlba -1 )) { -if (shmflg &SHM_RND ) +if (shmflg &SHM_RND ) { addr &= ~(shmlba -1 );/* round down */ - else + +/* +* Ensure that the round-down is non-nil +* when remapping. This can happen for +* cases when addr < shmlba. +*/ +if (!addr && (shmflg &SHM_REMAP )) + goto out; + } else#ifndef __ARCH_FORCE_SHMLBA if (addr & ~PAGE_MASK)#endif
Greg Kroah-Hartman
maintainerPATCH 18/329 kasan: fix memory hotplug during boot
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 3f1959721558a976aaf9c2024d5bc884e6411bf7 upstream.
Using module_init() is wrong. E.g. ACPI adds and onlines memory before our memory notifier gets registered.
This makes sure that ACPI memory detected during boot up will not result in a kernel crash.
Easily reproducible with QEMU, just specify a DIMM when starting up.
--- mm/kasan/kasan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kasan/kasan.c +1 -1
@@ -800,5 +800,5 @@ static int __init kasan_memhotplug_init( return 0; } -module_init (kasan_memhotplug_init); +core_initcall (kasan_memhotplug_init);#endif
Greg Kroah-Hartman
maintainerPATCH 19/329 kernel/sys.c: fix potential Spectre v1 issue
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 23d6aef74da86a33fa6bb75f79565e0a16ee97c2 upstream.
`resource' can be controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
kernel/sys.c:1474 __do_compat_sys_old_getrlimit() warn: potential spectre issue 'get_current()->signal->rlim' (local cap) kernel/sys.c:1455 __do_sys_old_getrlimit() warn: potential spectre issue 'get_current()->signal->rlim' (local cap)
Fix this by sanitizing *resource* before using it to index current->signal->rlim
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- kernel/sys.c | 1 + 1 file changed, 1 insertion(+)
kernel/sys.c +1 -0
@@ -1313,6 +1313,7 @@ SYSCALL_DEFINE2(old_getrlimit, unsignedif (resource >=RLIM_NLIMITS )return -EINVAL ; + resource =array_index_nospec (resource,RLIM_NLIMITS );task_lock (current->group_leader); x = current->signal->rlim[resource];task_unlock (current->group_leader);
Greg Kroah-Hartman
maintainerPATCH 20/329 kernel/signal.c: avoid undefined behaviour in kill_something_info
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhongjiang <[email protected]>
commit 4ea77014af0d6205b05503d1c7aac6eace11d473 upstream.
When running kill(72057458746458112, 0) in userspace I hit the following issue.
UBSAN: Undefined behaviour in kernel/signal.c:1462:11
negation of -2147483648 cannot be represented in type 'int':
CPU: 226 PID: 9849 Comm: test Tainted: G B ---- ------- 3.10.0-327.53.58.70.x86_64_ubsan+ #116
Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014
Call Trace:
dump_stack+0x19/0x1b
ubsan_epilogue+0xd/0x50
__ubsan_handle_negate_overflow+0x109/0x14e
SYSC_kill+0x43e/0x4d0
SyS_kill+0xe/0x10
system_call_fastpath+0x16/0x1bAdd code to avoid the UBSAN detection.
--- kernel/signal.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/signal.c +4 -0
@@ -1392,6 +1392,10 @@ static int kill_something_info(int sig,return ret; } +/* -INT_MIN is undefined. Exclude this case to avoid a UBSAN warning */ +if (pid ==INT_MIN ) +return -ESRCH ; +read_lock (&tasklist_lock);if (pid !=-1 ) { ret = __kill_pgrp_info(sig, info,
Greg Kroah-Hartman
maintainerPATCH 22/329 KVM: s390: vsie: fix < 8k check for the itdba
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit f4a551b72358facbbe5714248dff78404272feee upstream.
By missing an "L", we might detect some addresses to be <8k, although they are not.
e.g. for itdba = 100001fff
!(gpa & ~0x1fffU) -> 1
!(gpa & ~0x1fffUL) -> 0
So we would report a SIE validity intercept although everything is fine.
--- arch/s390/kvm/vsie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
@@ -549,7 +549,7 @@ static int pin_blocks(struct kvm_vcpu *v gpa = scb_o->itdba & ~0xffUL ;if (gpa && (scb_s->ecb &0x10U )) { -if (!(gpa & ~0x1fffU )) { +if (!(gpa & ~0x1fffUL )) { rc =set_validity_icpt (scb_s,0x0080U ); goto unpin; }
Greg Kroah-Hartman
maintainerPATCH 25/329 firewire-ohci: work around oversized DMA reads on JMicron controllers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 188775181bc05f29372b305ef96485840e351fde ]
At least some JMicron controllers issue buggy oversized DMA reads when fetching context descriptors, always fetching 0x20 bytes at once for descriptors which are only 0x10 bytes long. This is often harmless, but can cause page faults on modern systems with IOMMUs:
DMAR: [DMA Read] Request device [05:00.0] fault addr fff56000 [fault reason 06] PTE Read access is not set firewire_ohci 0000:05:00.0: DMA context IT0 has stopped, error code: evt_descriptor_read
This works around the problem by always leaving 0x10 padding bytes at the end of descriptor buffer pages, which should be harmless to do unconditionally for controllers in case others have the same behavior.
--- drivers/firewire/ohci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firewire/ohci.c +7 -1
@@ -1130,7 +1130,13 @@ static int context_add_buffer(struct conreturn -ENOMEM ; offset = (void *)&desc->buffer - (void *)desc; - desc->buffer_size =PAGE_SIZE - offset; +/* +* Some controllers, like JMicron ones, always issue 0x20-byte DMA reads +* for descriptors, even 0x10-byte ones. This can cause page faults when +* an IOMMU is in use and the oversized read crosses a page boundary. +* Work around this by always leaving at least 0x10 bytes of padding. +*/ + desc->buffer_size =PAGE_SIZE - offset -0x10 ; desc->buffer_bus = bus_addr + offset; desc->used =0 ;
Greg Kroah-Hartman
maintainerPATCH 26/329 x86/tsc: Allow TSC calibration without PIT
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 30c7e5b123673d5e570e238dbada2fb68a87212c ]
Zhang Rui reported that a Surface Pro 4 will fail to boot with lapic=notscdeadline. Part of the problem is that that machine doesn't have a PIT.
If, for some reason, the TSC init has to fall back to TSC calibration, it relies on the PIT to be present.
Allow TSC calibration to reliably fall back to HPET.
The below results in an accurate TSC measurement when forced on a IVB:
tsc: Unable to calibrate against PIT
tsc: No reference (HPET/PMTIMER) available
tsc: Unable to calibrate against PIT
tsc: using HPET reference calibration
tsc: Detected 2792.451 MHz processor
--- arch/x86/include/asm/i8259.h | 5 +++++ arch/x86/kernel/tsc.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
arch/x86/include/asm/i8259.h +5 -0
@@ -68,6 +68,11 @@ struct legacy_pic {extern struct legacy_pic *legacy_pic;extern struct legacy_pic null_legacy_pic; +static inline bool has_legacy_pic (void ) +{ +return legacy_pic != &null_legacy_pic; +} +static inline int nr_legacy_irqs (void ) {return legacy_pic->nr_legacy_irqs;
arch/x86/kernel/tsc.c +18 -0
@@ -24,6 +24,7 @@#include <asm/geode.h> #include <asm/apic.h> #include <asm/intel-family.h> +#include <asm/i8259.h> unsigned int __read_mostly cpu_khz;/* TSC clocks / usec, not used here */ EXPORT_SYMBOL (cpu_khz);
@@ -456,6 +457,20 @@ static unsigned long pit_calibrate_tsc(uunsigned long tscmin, tscmax;int pitcnt; +if (!has_legacy_pic ()) { +/* +* Relies on tsc_early_delay_calibrate() to have given us semi +* usable udelay(), wait for the same 50ms we would have with +* the PIT loop below. +*/ +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +return ULONG_MAX ; + } +/* Set the Gate high, disable speaker */ outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 );
@@ -580,6 +595,9 @@ static unsigned long quick_pit_calibrateu64 tsc, delta;unsigned long d1, d2; +if (!has_legacy_pic ()) +return 0 ; +/* Set the Gate high, disable speaker */ outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 );
Greg Kroah-Hartman
maintainerPATCH 27/329 NFSv4: always set NFS_LOCK_LOST when a lock is lost.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit dce2630c7da73b0634686bca557cc8945cc450c8 ]
There are 2 comments in the NFSv4 code which suggest that SIGLOST should possibly be sent to a process. In these cases a lock has been lost.
The current practice is to set NFS_LOCK_LOST so that read/write returns EIO when a lock is lost.
So change these comments to code when sets NFS_LOCK_LOST.
One case is when lock recovery after apparent server restart fails with NFS4ERR_DENIED, NFS4ERR_RECLAIM_BAD, or NFS4ERRO_RECLAIM_CONFLICT. The other case is when a lock attempt as part of lease recovery fails with NFS4ERR_DENIED.
In an ideal world, these should not happen. However I have a packet trace showing an NFSv4.1 session getting NFS4ERR_BADSESSION after an extended network parition. The NFSv4.1 client treats this like server reboot until/unless it get NFS4ERR_NO_GRACE, in which case it switches over to "nograce" recovery mode. In this network trace, the client attempts to recover a lock and the server (incorrectly) reports NFS4ERR_DENIED rather than NFS4ERR_NO_GRACE. This leads to the ineffective comment and the client then continues to write using the OPEN stateid.
--- fs/nfs/nfs4proc.c | 12 ++++++++---- fs/nfs/nfs4state.c | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-)
fs/nfs/nfs4proc.c +8 -4
@@ -1934,7 +1934,7 @@ static int nfs4_open_reclaim(struct nfs4return ret; } -static int nfs4_handle_delegation_recall_error (struct nfs_server *server,struct nfs4_state *state,const nfs4_stateid *stateid,int err) +static int nfs4_handle_delegation_recall_error (struct nfs_server *server,struct nfs4_state *state,const nfs4_stateid *stateid,struct file_lock *fl,int err) {switch (err) {default :
@@ -1981,7 +1981,11 @@ static int nfs4_handle_delegation_recallreturn -EAGAIN ;case -ENOMEM :case -NFS4ERR_DENIED : -/* kill_proc(fl->fl_pid, SIGLOST, 1); */ +if (fl) { +struct nfs4_lock_state *lsp = fl->fl_u.nfs4_fl.owner; +if (lsp) +set_bit (NFS_LOCK_LOST , &lsp->ls_flags); + }return 0 ; }return err;
@@ -2017,7 +2021,7 @@ int nfs4_open_delegation_recall(struct n err =nfs4_open_recover_helper (opendata,FMODE_READ ); }nfs4_opendata_put (opendata); -return nfs4_handle_delegation_recall_error (server, state, stateid, err); +return nfs4_handle_delegation_recall_error (server, state, stateid,NULL , err); }static void nfs4_open_confirm_prepare (struct rpc_task *task,void *calldata)
@@ -6499,7 +6503,7 @@ int nfs4_lock_delegation_recall(struct fif (err !=0 )return err; err =_nfs4_do_setlk (state,F_SETLK , fl,NFS_LOCK_NEW ); -return nfs4_handle_delegation_recall_error (server, state, stateid, err); +return nfs4_handle_delegation_recall_error (server, state, stateid, fl, err); }struct nfs_release_lockowner_data {
fs/nfs/nfs4state.c +4 -1
@@ -1429,6 +1429,7 @@ static int nfs4_reclaim_locks(struct nfsstruct inode *inode = state->inode;struct nfs_inode *nfsi =NFS_I (inode);struct file_lock *fl; +struct nfs4_lock_state *lsp;int status =0 ;struct file_lock_context *flctx = inode->i_flctx;struct list_head *list;
@@ -1469,7 +1470,9 @@ restart:case -NFS4ERR_DENIED :case -NFS4ERR_RECLAIM_BAD :case -NFS4ERR_RECLAIM_CONFLICT : -/* kill_proc(fl->fl_pid, SIGLOST, 1); */ + lsp = fl->fl_u.nfs4_fl.owner; +if (lsp) +set_bit (NFS_LOCK_LOST , &lsp->ls_flags); status =0 ; }spin_lock (&flctx->flc_lock);
Greg Kroah-Hartman
maintainerPATCH 28/329 ALSA: hda - Use IS_REACHABLE() for dependency on input
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit c469652bb5e8fb715db7d152f46d33b3740c9b87 ]
The commit ffcd28d88e4f ("ALSA: hda - Select INPUT for Realtek HD-audio codec") introduced the reverse-selection of CONFIG_INPUT for Realtek codec in order to avoid the mess with dependency between built-in and modules. Later on, we obtained IS_REACHABLE() macro exactly for this kind of problems, and now we can remove th INPUT selection in Kconfig and put IS_REACHABLE(INPUT) to the appropriate places in the code, so that the driver doesn't need to select other subsystem forcibly.
--- sound/pci/hda/Kconfig | 1 - sound/pci/hda/patch_realtek.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/Kconfig +0 -1
@@ -88,7 +88,6 @@ config SND_HDA_PATCH_LOADER config SND_HDA_CODEC_REALTEK tristate "Build Realtek HD-audio codec support" select SND_HDA_GENERIC - select INPUT help Say Y or M here to include Realtek HD-audio codec support in snd-hda-intel driver, such as ALC880.
sound/pci/hda/patch_realtek.c +5 -0
@@ -3495,6 +3495,7 @@ static void alc280_fixup_hp_gpio4(struct } } +#if IS_REACHABLE (INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event) {
@@ -3627,6 +3628,10 @@ static void alc233_fixup_lenovo_line2_mi spec->kb_dev = NULL; } } +#else /* INPUT */ +#define alc280_fixup_hp_gpio2_mic_hotkey NULL +#define alc233_fixup_lenovo_line2_mic_hotkey NULL +#endif /* INPUT */ static void alc269_fixup_hp_line1_mic1_led (struct hda_codec *codec,const struct hda_fixup *fix,int action)
Greg Kroah-Hartman
maintainerPATCH 29/329 kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
[ Upstream commit 51776043afa415435c7e4636204fbe4f7edc4501 ]
This ioctl is obsolete (it was used by Xenner as far as I know) but still let's not break it gratuitously... Its handler is copying directly into struct kvm. Go through a bounce buffer instead, with the added benefit that we can actually do something useful with the flags argument---the previous code was exiting with -EINVAL but still doing the copy.
This technically is a userspace ABI breakage, but since no one should be using the ioctl, it's a good occasion to see if someone actually complains.
--- arch/x86/kvm/x86.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +4 -3
@@ -4131,13 +4131,14 @@ long kvm_arch_vm_ioctl(struct file *filpmutex_unlock (&kvm->lock);break ;case KVM_XEN_HVM_CONFIG : { +struct kvm_xen_hvm_config xhc; r = -EFAULT ; -if (copy_from_user (&kvm->arch.xen_hvm_config, argp, -sizeof (struct kvm_xen_hvm_config ))) +if (copy_from_user (&xhc, argp,sizeof (xhc))) goto out; r = -EINVAL ; -if (kvm->arch.xen_hvm_config.flags) +if (xhc.flags) goto out; +memcpy (&kvm->arch.xen_hvm_config, &xhc,sizeof (xhc)); r =0 ;break ; }
Greg Kroah-Hartman
maintainerPATCH 30/329 netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit 83f1999caeb14e15df205e80d210699951733287 ]
ipv6_defrag pulls network headers before fragment header. In case of an error, the netfilter layer is currently dropping these packets. This results in failure of some IPv6 standards tests which passed on older kernels due to the netfilter framework using cloning.
The test case run here is a check for ICMPv6 error message replies when some invalid IPv6 fragments are sent. This specific test case is listed in https://www.ipv6ready.org/docs/Core_Conformance_Latest.pdf
in the Extension Header Processing Order section.
A packet with unrecognized option Type 11 is sent and the test expects an ICMP error in line with RFC2460 section 4.2 -
11 - discard the packet and, only if the packet's Destination
Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.
Since netfilter layer now drops all invalid IPv6 frag packets, we no longer see the ICMP error message and fail the test case.
To fix this, save the transport header. If defrag is unable to process the packet due to RFC2460, restore the transport header and allow packet to be processed by stack. There is no change for other packet processing paths.
Tested by confirming that stack sends an ICMP error when it receives these packets. Also tested that fragmented ICMP pings succeed.
v1->v2: Instead of cloning always, save the transport_header and restore it in case of this specific error. Update the title and commit message accordingly.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +10 -5
@@ -230,7 +230,7 @@ static int nf_ct_frag6_queue(struct fragif ((unsigned int )end >IPV6_MAXPLEN ) {pr_debug ("offset is too large.\n" ); -return -1 ; +return -EINVAL ; } ecn =ip6_frag_ecn (ipv6_hdr (skb));
@@ -263,7 +263,7 @@ static int nf_ct_frag6_queue(struct frag* this case. -DaveM */ pr_debug ("end of fragment not rounded to 8 bytes.\n" ); -return -1 ; +return -EPROTO ; }if (end > fq->q.len) {/* Some bits beyond end -> corruption. */
@@ -357,7 +357,7 @@ found: discard_fq:inet_frag_kill (&fq->q, &nf_frags); err: -return -1 ; +return -EINVAL ; }/*
@@ -566,6 +566,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *int nf_ct_frag6_gather (struct net *net,struct sk_buff *skb,u32 user) { +u16 savethdr = skb->transport_header;struct net_device *dev = skb->dev;int fhoff, nhoff, ret;struct frag_hdr *fhdr;
@@ -599,8 +600,12 @@ int nf_ct_frag6_gather(struct net *net,spin_lock_bh (&fq->q.lock); -if (nf_ct_frag6_queue (fq, skb, fhdr, nhoff) <0 ) { - ret = -EINVAL ; + ret =nf_ct_frag6_queue (fq, skb, fhdr, nhoff); +if (ret <0 ) { +if (ret == -EPROTO ) { + skb->transport_header = savethdr; + ret =0 ; + } goto out_unlock; }
Greg Kroah-Hartman
maintainerPATCH 31/329 tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna-Maria Gleixner <[email protected]>
[ Upstream commit 91633eed73a3ac37aaece5c8c1f93a18bae616a9 ]
So far only CLOCK_MONOTONIC and CLOCK_REALTIME were taken into account as well as HRTIMER_MODE_ABS/REL in the hrtimer_init tracepoint. The query for detecting the ABS or REL timer modes is not valid anymore, it got broken by the introduction of HRTIMER_MODE_PINNED.
HRTIMER_MODE_PINNED is not evaluated in the hrtimer_init() call, but for the sake of completeness print all given modes.
--- include/trace/events/timer.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
include/trace/events/timer.h +16 -4
@@ -125,6 +125,20 @@ DEFINE_EVENT(timer_class, timer_cancel,TP_ARGS (timer) ); +#define decode_clockid (type) \ + __print_symbolic(type, \ + { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ + { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, \ + { CLOCK_BOOTTIME, "CLOCK_BOOTTIME" }, \ + { CLOCK_TAI, "CLOCK_TAI" }) + +#define decode_hrtimer_mode (mode) \ + __print_symbolic(mode, \ + { HRTIMER_MODE_ABS, "ABS" }, \ + { HRTIMER_MODE_REL, "REL" }, \ + { HRTIMER_MODE_ABS_PINNED, "ABS|PINNED" }, \ + { HRTIMER_MODE_REL_PINNED, "REL|PINNED" }) +/** * hrtimer_init - called when the hrtimer is initialized * @hrtimer: pointer to struct hrtimer
@@ -151,10 +165,8 @@ TRACE_EVENT(hrtimer_init, ),TP_printk ("hrtimer=%p clockid=%s mode=%s" , __entry->hrtimer, - __entry->clockid ==CLOCK_REALTIME ? -"CLOCK_REALTIME" :"CLOCK_MONOTONIC" , - __entry->mode ==HRTIMER_MODE_ABS ? -"HRTIMER_MODE_ABS" :"HRTIMER_MODE_REL" ) +decode_clockid (__entry->clockid), +decode_hrtimer_mode (__entry->mode)) );/**
Greg Kroah-Hartman
maintainerPATCH 32/329 PCI: Add function 1 DMA alias quirk for Marvell 9128
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
[ Upstream commit aa008206634363ef800fbd5f0262016c9ff81dea ]
The Marvell 9128 is the original device generating bug 42679, from which many other Marvell DMA alias quirks have been sourced, but we didn't have positive confirmation of the fix on 9128 until now.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -3857,6 +3857,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M quirk_dma_func1_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9123 , quirk_dma_func1_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9128 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9130 , quirk_dma_func1_alias);
Greg Kroah-Hartman
maintainerPATCH 33/329 Input: psmouse - fix Synaptics detection when protocol is disabled
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit 2bc4298f59d2f15175bb568e2d356b5912d0cdd9 ]
When Synaptics protocol is disabled, we still need to try and detect the hardware, so we can switch to SMBus device if SMbus is detected, or we know that it is Synaptics device and reset it properly for the bare PS/2 protocol.
--- drivers/input/mouse/psmouse-base.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/input/mouse/psmouse-base.c +21 -13
@@ -937,6 +937,21 @@ static void psmouse_apply_defaults(struc psmouse->pt_deactivate =NULL ; } +static bool psmouse_do_detect (int (*detect)(struct psmouse *,bool ), +struct psmouse *psmouse,bool allow_passthrough, +bool set_properties) +{ +if (psmouse->ps2dev.serio->id.type ==SERIO_PS_PSTHRU && + !allow_passthrough) { +return false; + } + +if (set_properties) +psmouse_apply_defaults (psmouse); + +return detect (psmouse, set_properties) ==0 ; +} + static bool psmouse_try_protocol(struct psmouse *psmouse, enum psmouse_type type, unsigned int *max_proto,
@@ -948,15 +963,8 @@ static bool psmouse_try_protocol(structif (!proto)return false; -if (psmouse->ps2dev.serio->id.type ==SERIO_PS_PSTHRU && - !proto->try_passthru) { -return false; - } - -if (set_properties) -psmouse_apply_defaults (psmouse); - -if (proto->detect (psmouse, set_properties) !=0 ) +if (!psmouse_do_detect (proto->detect, psmouse, proto->try_passthru, + set_properties))return false;if (set_properties && proto->init && init_allowed) {
@@ -988,8 +996,8 @@ static int psmouse_extensions(struct psm* Always check for focaltech, this is safe as it uses pnp-id * matching. */ -if (psmouse_try_protocol (psmouse,PSMOUSE_FOCALTECH , - &max_proto, set_properties, false)) { +if (psmouse_do_detect (focaltech_detect, + psmouse, false, set_properties)) {if (max_proto >PSMOUSE_IMEX &&IS_ENABLED (CONFIG_MOUSE_PS2_FOCALTECH ) && (!set_properties ||focaltech_init (psmouse) ==0 )) {
@@ -1035,8 +1043,8 @@ static int psmouse_extensions(struct psm* probing for IntelliMouse. */ if (max_proto >PSMOUSE_PS2 && -psmouse_try_protocol (psmouse,PSMOUSE_SYNAPTICS , &max_proto, - set_properties, false)) { +psmouse_do_detect (synaptics_detect, + psmouse, false, set_properties)) { synaptics_hardware = true;if (max_proto >PSMOUSE_IMEX ) {
Greg Kroah-Hartman
maintainerPATCH 34/329 i40iw: Zero-out consumer key on allocate stag for FMR
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiraz Saleem <[email protected]>
[ Upstream commit 6376e926af1a8661dd1b2e6d0896e07f84a35844 ]
If the application invalidates the MR before the FMR WR, HW parses the consumer key portion of the stag and returns an invalid stag key Asynchronous Event (AE) that tears down the QP.
Fix this by zeroing-out the consumer key portion of the allocated stag returned to application for FMR.
--- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/i40iw/i40iw_verbs.c +1 -0
@@ -1515,6 +1515,7 @@ static struct ib_mr *i40iw_alloc_mr(stru err_code = -EOVERFLOW ; goto err; } + stag &= ~I40IW_CQPSQ_STAG_KEY_MASK ; iwmr->stag = stag; iwmr->ibmr.rkey = stag; iwmr->ibmr.lkey = stag;
Greg Kroah-Hartman
maintainerPATCH 35/329 tools lib traceevent: Simplify pointer print logic and fix %pF
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 38d70b7ca1769f26c0b79f3c08ff2cc949712b59 ]
When processing %pX in pretty_print(), simplify the logic slightly by incrementing the ptr to the format string if isalnum(ptr[1]) is true. This follows the logic a bit more closely to what is in the kernel.
Also, this fixes a small bug where %pF was not giving the offset of the function.
--- tools/lib/traceevent/event-parse.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +9 -8
@@ -4927,21 +4927,22 @@ static void pretty_print(struct trace_seelse ls =2 ; -if (*(ptr+1 ) =='F' || *(ptr+1 ) =='f' || - *(ptr+1 ) =='S' || *(ptr+1 ) =='s' ) { +if (isalnum (ptr[1 ])) ptr++; + +if (*ptr =='F' || *ptr =='f' || + *ptr =='S' || *ptr =='s' ) { show_func = *ptr; - }else if (*(ptr+1 ) =='M' || *(ptr+1 ) =='m' ) { -print_mac_arg (s, *(ptr+1 ), data, size, event, arg); - ptr++; + }else if (*ptr =='M' || *ptr =='m' ) { +print_mac_arg (s, *ptr, data, size, event, arg); arg = arg->next;break ; - }else if (*(ptr+1 ) =='I' || *(ptr+1 ) =='i' ) { + }else if (*ptr =='I' || *ptr =='i' ) {int n; - n =print_ip_arg (s, ptr+1 , data, size, event, arg); + n =print_ip_arg (s, ptr, data, size, event, arg);if (n >0 ) { - ptr += n; + ptr += n -1 ; arg = arg->next;break ; }
Greg Kroah-Hartman
maintainerPATCH 36/329 perf callchain: Fix attr.sample_max_stack setting
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 249d98e567e25dd03e015e2d31e1b7b9648f34df ]
When setting the "dwarf" unwinder for a specific event and not specifying the max-stack, the attr.sample_max_stack ended up using an uninitialized callchain_param.max_stack, fix it by using designated initializers for that callchain_param variable, zeroing all non explicitely initialized struct members.
Here is what happened:
# perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
callchain: type DWARF
callchain: stack dump size 8192
perf_event_attr:
type 2
size 112
config 0x730
{ sample_period, sample_freq } 1
sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
exclude_callchain_user 1
{ wakeup_events, wakeup_watermark } 1
sample_regs_user 0xff0fff
sample_stack_user 8192
sample_max_stack 50656
sys_perf_event_open failed, error -75
Value too large for defined data type
# perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
callchain: type DWARF
callchain: stack dump size 8192
perf_event_attr:
type 2
size 112
config 0x730
sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
exclude_callchain_user 1
sample_regs_user 0xff0fff
sample_stack_user 8192
sample_max_stack 30448
sys_perf_event_open failed, error -75
Value too large for defined data type
#Now the attr.sample_max_stack is set to zero and the above works as expected:
# perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.072 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.072/0.072/0.072/0.000 ms
0.000 probe_libc:inet_pton:(7feb7a998350))
__inet_pton (inlined)
gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
__GI_getaddrinfo (inlined)
[0xffffaa39b6108f3f] (/usr/bin/ping)#
--- tools/perf/util/evsel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/evsel.c +4 -4
@@ -681,14 +681,14 @@ static void apply_config_terms(struct pestruct perf_evsel_config_term *term;struct list_head *config_terms = &evsel->config_terms;struct perf_event_attr *attr = &evsel->attr; -struct callchain_param param; +/* callgraph default */ +struct callchain_param param = { + .record_mode = callchain_param.record_mode, + };u32 dump_size =0 ;int max_stack =0 ;const char *callgraph_buf =NULL ; -/* callgraph default */ - param.record_mode = callchain_param.record_mode; -list_for_each_entry (term, config_terms, list) {switch (term->type) {case PERF_EVSEL__CONFIG_TERM_PERIOD :
Greg Kroah-Hartman
maintainerPATCH 37/329 tools lib traceevent: Fix get_field_str() for dynamic strings
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit d777f8de99b05d399c0e4e51cdce016f26bd971b ]
If a field is a dynamic string, get_field_str() returned just the offset/size value and not the string. Have it parse the offset/size correctly to return the actual string. Otherwise filtering fails when trying to filter fields that are dynamic strings.
--- tools/lib/traceevent/parse-filter.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +9 -1
@@ -1879,17 +1879,25 @@ static const char *get_field_str(structstruct pevent *pevent;unsigned long long addr;const char *val =NULL ; +unsigned int size;char hex[64 ];/* If the field is not a string convert it */ if (arg->str.field->flags &FIELD_IS_STRING ) { val = record->data + arg->str.field->offset; + size = arg->str.field->size; + +if (arg->str.field->flags &FIELD_IS_DYNAMIC ) { + addr = *(unsigned int *)val; + val = record->data + (addr &0xffff ); + size = addr >>16 ; + }/* * We need to copy the data since we can't be sure the field * is null terminated. */ -if (*(val + arg->str.field->size -1 )) { +if (*(val + size -1 )) {/* copy it */ memcpy (arg->str.buffer, val, arg->str.field->size);/* the buffer is already NULL terminated */
Greg Kroah-Hartman
maintainerPATCH 38/329 perf record: Fix failed memory allocation for get_cpuid_str
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit 81fccd6ca507d3b2012eaf1edeb9b1dbf4bd22db ]
In x86 architecture dependend part function get_cpuid_str() mallocs a 128 byte buffer, but does not check if the memory allocation succeeded or not.
When the memory allocation fails, function __get_cpuid() is called with first parameter being a NULL pointer. However this function references its first parameter and operates on a NULL pointer which might cause core dumps.
--- tools/perf/arch/x86/util/header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/header.c +1 -1
@@ -69,7 +69,7 @@ get_cpuid_str(void) {char *buf =malloc (128 ); -if (__get_cpuid (buf,128 ,"%s-%u-%X$" ) <0 ) { +if (buf &&__get_cpuid (buf,128 ,"%s-%u-%X$" ) <0 ) {free (buf);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 39/329 iommu/vt-d: Use domain instead of cache fetching
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Xu <[email protected]>
[ Upstream commit 9d2e6505f6d6934e681aed502f566198cb25c74a ]
after commit a1ddcbe93010 ("iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi", 2015-08-12), we have domain pointer as parameter to iommu_flush_iotlb_psi(), so no need to fetch it from cache again.
More importantly, a NULL reference pointer bug is reported on RHEL7 (and it can be reproduced on some old upstream kernels too, e.g., v4.13) by unplugging an 40g nic from a VM (hard to test unplug on real host, but it should be the same):
https://bugzilla.redhat.com/show_bug.cgi?id=1531367
[ 24.391863] pciehp 0000:00:03.0:pcie004: Slot(0): Attention button pressed [ 24.393442] pciehp 0000:00:03.0:pcie004: Slot(0): Powering off due to button press [ 29.721068] i40evf 0000:01:00.0: Unable to send opcode 2 to PF, err I40E_ERR_QUEUE_EMPTY, aq_err OK [ 29.783557] iommu: Removing device 0000:01:00.0 from group 3 [ 29.784662] BUG: unable to handle kernel NULL pointer dereference at 0000000000000304 [ 29.785817] IP: iommu_flush_iotlb_psi+0xcf/0x120 [ 29.786486] PGD 0 [ 29.786487] P4D 0 [ 29.786812] [ 29.787390] Oops: 0000 [#1] SMP [ 29.787876] Modules linked in: ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_ng [ 29.795371] CPU: 0 PID: 156 Comm: kworker/0:2 Not tainted 4.13.0 #14 [ 29.796366] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.11.0-1.el7 04/01/2014 [ 29.797593] Workqueue: pciehp-0 pciehp_power_thread [ 29.798328] task: ffff94f5745b4a00 task.stack: ffffb326805ac000 [ 29.799178] RIP: 0010:iommu_flush_iotlb_psi+0xcf/0x120 [ 29.799919] RSP: 0018:ffffb326805afbd0 EFLAGS: 00010086 [ 29.800666] RAX: ffff94f5bc56e800 RBX: 0000000000000000 RCX: 0000000200000025 [ 29.801667] RDX: ffff94f5bc56e000 RSI: 0000000000000082 RDI: 0000000000000000 [ 29.802755] RBP: ffffb326805afbf8 R08: 0000000000000000 R09: ffff94f5bc86bbf0 [ 29.803772] R10: ffffb326805afba8 R11: 00000000000ffdc4 R12: ffff94f5bc86a400 [ 29.804789] R13: 0000000000000000 R14: 00000000ffdc4000 R15: 0000000000000000 [ 29.805792] FS: 0000000000000000(0000) GS:ffff94f5bfc00000(0000) knlGS:0000000000000000 [ 29.806923] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 29.807736] CR2: 0000000000000304 CR3: 000000003499d000 CR4: 00000000000006f0 [ 29.808747] Call Trace: [ 29.809156] flush_unmaps_timeout+0x126/0x1c0 [ 29.809800] domain_exit+0xd6/0x100 [ 29.810322] device_notifier+0x6b/0x70 [ 29.810902] notifier_call_chain+0x4a/0x70 [ 29.812822] __blocking_notifier_call_chain+0x47/0x60 [ 29.814499] blocking_notifier_call_chain+0x16/0x20 [ 29.816137] device_del+0x233/0x320 [ 29.817588] pci_remove_bus_device+0x6f/0x110 [ 29.819133] pci_stop_and_remove_bus_device+0x1a/0x20 [ 29.820817] pciehp_unconfigure_device+0x7a/0x1d0 [ 29.822434] pciehp_disable_slot+0x52/0xe0 [ 29.823931] pciehp_power_thread+0x8a/0xa0 [ 29.825411] process_one_work+0x18c/0x3a0 [ 29.826875] worker_thread+0x4e/0x3b0 [ 29.828263] kthread+0x109/0x140 [ 29.829564] ? process_one_work+0x3a0/0x3a0 [ 29.831081] ? kthread_park+0x60/0x60 [ 29.832464] ret_from_fork+0x25/0x30 [ 29.833794] Code: 85 ed 74 0b 5b 41 5c 41 5d 41 5e 41 5f 5d c3 49 8b 54 24 60 44 89 f8 0f b6 c4 48 8b 04 c2 48 85 c0 74 49 45 0f b6 ff 4a 8b 3c f8 <80> bf [ 29.838514] RIP: iommu_flush_iotlb_psi+0xcf/0x120 RSP: ffffb326805afbd0 [ 29.840362] CR2: 0000000000000304 [ 29.841716] ---[ end trace b10ec0d6900868d3 ]---
This patch fixes that problem if applied to v4.13 kernel.
The bug does not exist on latest upstream kernel since it's fixed as a side effect of commit 13cf01744608 ("iommu/vt-d: Make use of iova deferred flushing", 2017-08-15). But IMHO it's still good to have this patch upstream.
--- drivers/iommu/intel-iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/intel-iommu.c +1 -2
@@ -1612,8 +1612,7 @@ static void iommu_flush_iotlb_psi(struct* flush. However, device IOTLB doesn't need to be flushed in this case. */ if (!cap_caching_mode (iommu->cap) || !map) -iommu_flush_dev_iotlb (get_iommu_domain (iommu, did), - addr, mask); +iommu_flush_dev_iotlb (domain, addr, mask); }static void iommu_disable_protect_mem_regions (struct intel_iommu *iommu)
Greg Kroah-Hartman
maintainerPATCH 40/329 dm thin: fix documentation relative to low water mark threshold
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: mulhern <[email protected]>
[ Upstream commit 9b28a1102efc75d81298198166ead87d643a29ce ]
Fixes:
1. The use of "exceeds" when the opposite of exceeds, falls below, was meant.
2. Properly speaking, a table can not exceed a threshold.
It emphasizes the important point, which is that it is the userspace daemon's responsibility to check for low free space when a device is resumed, since it won't get a special event indicating low free space in that situation.
--- Documentation/device-mapper/thin-provisioning.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/device-mapper/thin-provisioning.txt +5 -3
@@ -112,9 +112,11 @@ $low_water_mark is expressed in blocks o free space on the data device drops below this level then a dm event will be triggered which a userspace daemon should catch allowing it to extend the pool device. Only one such event will be sent. -Resuming a device with a new table itself triggers an event so the -userspace daemon can use this to detect a situation where a new table -already exceeds the threshold. + +No special event is triggered if a just resumed device's free space is below +the low water mark. However, resuming a device always triggers an +event; a userspace daemon should verify that free space exceeds the low +water mark when handling this event. A low water mark for the metadata device is maintained in the kernel and will trigger a dm event if free space on the metadata device drops below
Greg Kroah-Hartman
maintainerPATCH 41/329 net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
[ Upstream commit 433c6cab9d298687c097f6ee82e49157044dc7c6 ]
Meson8b only supports MPLL2 as clock input. The rate of the MPLL2 clock set by Odroid-C1's u-boot is close to (but not exactly) 500MHz. The exact rate is 500002394Hz, which is calculated in drivers/clk/meson/clk-mpll.c using the following formula:DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, (SDM_DEN * n2) + sdm) Odroid-C1's u-boot configures MPLL2 with the following values:
- SDM_DEN = 16384
- SDM = 1638
- N2 = 5
The 250MHz clock (m250_div) inside dwmac-meson8b driver is derived from the MPLL2 clock. Due to MPLL2 running slightly faster than 500MHz the common clock framework chooses a divider which is too big to generate the 250MHz clock (a divider of 2 would be needed, but this is rounded up to a divider of 3). This breaks the RTL8211F RGMII PHY on Odroid-C1 because it requires a (close to) 125MHz RGMII TX clock (on Gbit speeds, the IP block internally divides that down to 25MHz on 100Mbit/s connections and 2.5MHz on 10Mbit/s connections - we don't need any special configuration for that).
Round the divider to the closest value to prevent this issue on Meson8b. This means we'll now end up with a clock rate for the RGMII TX clock of 125001197Hz (= 125MHz plus 1197Hz), which is close-enough to 125MHz. This has no effect on the Meson GX SoCs since there fclk_div2 is used as input clock, which has a rate of 1000MHz (and thus is divisible cleanly to 250MHz and 125MHz).
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +3 -1
@@ -146,7 +146,9 @@ static int meson8b_init_clk(struct meson dwmac->m250_div.shift =PRG_ETH0_CLK_M250_DIV_SHIFT ; dwmac->m250_div.width =PRG_ETH0_CLK_M250_DIV_WIDTH ; dwmac->m250_div.hw.init = &init; - dwmac->m250_div.flags =CLK_DIVIDER_ONE_BASED |CLK_DIVIDER_ALLOW_ZERO ; + dwmac->m250_div.flags =CLK_DIVIDER_ONE_BASED | +CLK_DIVIDER_ALLOW_ZERO | +CLK_DIVIDER_ROUND_CLOSEST ; dwmac->m250_div_clk =devm_clk_register (dev, &dwmac->m250_div.hw);if (WARN_ON (IS_ERR (dwmac->m250_div_clk)))
Greg Kroah-Hartman
maintainerPATCH 42/329 net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
[ Upstream commit fb7d38a70e1d8ffd54f7a7464dcc4889d7e490ad ]
On Meson8b the only valid input clock is MPLL2. The bootloader configures that to run at 500002394Hz which cannot be divided evenly down to 125MHz using the m250_div clock. Currently the common clock framework chooses a m250_div of 2 - with the internal fixed "divide by 10" this results in a RGMII TX clock of 125001197Hz (120Hz above the requested 125MHz).
Letting the common clock framework propagate the rate changes up to the parent of m250_mux allows us to get the best possible clock rate. With this patch the common clock framework calculates a rate of very-close-to-250MHz (249999701Hz to be exact) for the MPLL2 clock (which is the mux input). Dividing that by 2 (which is an internal, fixed divider for the RGMII TX clock) gives us an RGMII TX clock of 124999850Hz (which is only 150Hz off the requested 125MHz, compared to 1197Hz based on the MPLL2 rate set by u-boot and the Amlogic GPL kernel sources).
SoCs from the Meson GX series are not affected by this change because the input clock is FCLK_DIV2 whose rate cannot be changed (which is fine since it's running at 1GHz, so it's already a multiple of 250MHz and 125MHz).
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
@@ -118,7 +118,7 @@ static int meson8b_init_clk(struct mesonsnprintf (clk_name,sizeof (clk_name),"%s#m250_sel" ,dev_name (dev)); init.name = clk_name; init.ops = &clk_mux_ops; - init.flags =0 ; + init.flags =CLK_SET_RATE_PARENT ; init.parent_names = mux_parent_names; init.num_parents =MUX_CLK_NUM_PARENTS ;
Greg Kroah-Hartman
maintainerPATCH 43/329 nfs: Do not convert nfs_idmap_cache_timeout to jiffies
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Chochol <[email protected]>
[ Upstream commit cbebc6ef4fc830f4040d4140bf53484812d5d5d9 ]
Since commit 57e62324e469 ("NFS: Store the legacy idmapper result in the keyring") nfs_idmap_cache_timeout changed units from jiffies to seconds. Unfortunately sysctl interface was not updated accordingly.
As a effect updating /proc/sys/fs/nfs/idmap_cache_timeout with some value will incorrectly multiply this value by HZ.
Also reading /proc/sys/fs/nfs/idmap_cache_timeout will show real value divided by HZ.
--- fs/nfs/nfs4sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4sysctl.c +1 -1
@@ -31,7 +31,7 @@ static struct ctl_table nfs4_cb_sysctls[ .data = &nfs_idmap_cache_timeout, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec_jiffies, + .proc_handler = proc_dointvec, }, { } };
Greg Kroah-Hartman
maintainerPATCH 45/329 kconfig: Dont leak main menus during parsing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Magnusson <[email protected]>
[ Upstream commit 0724a7c32a54e3e50d28e19e30c59014f61d4e2c ]
If a 'mainmenu' entry appeared in the Kconfig files, two things would leak:
- The 'struct property' allocated for the default "Linux Kernel Configuration" prompt.
- The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l.
To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 344,440 bytes in 14,350 blocks ...
--- scripts/kconfig/zconf.y | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
scripts/kconfig/zconf.y +24 -9
@@ -107,7 +107,27 @@ static struct menu *current_menu, *curre %% input: nl start | start; -start: mainmenu_stmt stmt_list | stmt_list; +start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; + +/* mainmenu entry */ + +mainmenu_stmt: T_MAINMENU prompt nl +{ + menu_add_prompt(P_MENU, $2, NULL); +}; + +/* Default main menu, if there's no mainmenu entry */ + +no_mainmenu_stmt: /* empty */ +{ + /* + * Hack: Keep the main menu title on the heap so we can safely free it + * later regardless of whether it comes from the 'prompt' in + * mainmenu_stmt or here + */ + menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL); +}; + stmt_list: /* empty */
@@ -344,13 +364,6 @@ if_block: | if_block choice_stmt ; -/* mainmenu entry */ - -mainmenu_stmt: T_MAINMENU prompt nl -{ - menu_add_prompt(P_MENU, $2, NULL); -}; - /* menu entry */ menu: T_MENU prompt T_EOL
@@ -495,6 +508,7 @@ word_opt: /* empty */ { $$ = NULL; } void conf_parse(const char *name) { + const char *tmp; struct symbol *sym; int i;
@@ -502,7 +516,6 @@ void conf_parse(const char *name) sym_init(); _menu_init(); - rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); if (getenv("ZCONF_DEBUG")) zconfdebug = 1;
@@ -512,8 +525,10 @@ void conf_parse(const char *name) if (!modules_sym) modules_sym = sym_find( "n" ); + tmp = rootmenu.prompt->text; rootmenu.prompt->text = _(rootmenu.prompt->text); rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); + free((char*)tmp); menu_finalize(&rootmenu); for_all_symbols(i, sym) {
Greg Kroah-Hartman
maintainerPATCH 46/329 kconfig: Fix automatic menu creation mem leak
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Magnusson <[email protected]>
[ Upstream commit ae7440ef0c8013d68c00dad6900e7cce5311bb1c ]
expr_trans_compare() always allocates and returns a new expression, giving the following leak outline:
...
*Allocate*
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
...
for (menu = parent->next; menu; menu = menu->next) {
...
*Copy*
dep2 = expr_copy(basedep);
...
*Free copy*
expr_free(dep2);
}
*basedep lost!*Fix by freeing 'basedep' after the loop.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 344,376 bytes in 14,349 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ...
--- scripts/kconfig/menu.c | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/menu.c +1 -0
@@ -364,6 +364,7 @@ void menu_finalize(struct menu *parent) menu->parent = parent; last_menu = menu; } +expr_free (basedep);if (last_menu) { parent->list = parent->next; parent->next = last_menu->next;
Greg Kroah-Hartman
maintainerPATCH 47/329 kconfig: Fix expr_free() E_NOT leak
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Magnusson <[email protected]>
[ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]
Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak:
switch (e->type) {
...
case E_NOT:
expr_free(e->left.expr);
return;
...
}
*Never reached, 'e' leaked*
free(e);Fix by changing the 'return' to a 'break'.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ...
--- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/expr.c +1 -1
@@ -113,7 +113,7 @@ void expr_free(struct expr *e)break ;case E_NOT :expr_free (e->left.expr); -return ; +break ;case E_EQUAL :case E_GEQ :case E_GTH :
Greg Kroah-Hartman
maintainerPATCH 48/329 mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "weiyongjun (A)" <[email protected]>
[ Upstream commit 0ddcff49b672239dda94d70d0fcf50317a9f4b51 ]
'hwname' is malloced in hwsim_new_radio_nl() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.
--- drivers/net/wireless/mac80211_hwsim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +3 -1
@@ -3084,8 +3084,10 @@ static int hwsim_new_radio_nl(struct sk_if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG ]) {u32 idx =nla_get_u32 (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG ]); -if (idx >=ARRAY_SIZE (hwsim_world_regdom_custom)) +if (idx >=ARRAY_SIZE (hwsim_world_regdom_custom)) { +kfree (hwname);return -EINVAL ; + } param.regd = hwsim_world_regdom_custom[idx]; }
Greg Kroah-Hartman
maintainerPATCH 49/329 ipmi/powernv: Fix error return code in ipmi_powernv_probe()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
[ Upstream commit e749d328b0b450aa78d562fa26a0cd8872325dd9 ]
Fix to return a negative error code from the request_irq() error handling case instead of 0, as done elsewhere in this function.
--- drivers/char/ipmi/ipmi_powernv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_powernv.c +3 -2
@@ -251,8 +251,9 @@ static int ipmi_powernv_probe(struct pla ipmi->irq =opal_event_request (prop); } -if (request_irq (ipmi->irq, ipmi_opal_event,IRQ_TYPE_LEVEL_HIGH , -"opal-ipmi" , ipmi)) { + rc =request_irq (ipmi->irq, ipmi_opal_event,IRQ_TYPE_LEVEL_HIGH , +"opal-ipmi" , ipmi); +if (rc) {dev_warn (dev,"Unable to request irq\n" ); goto err_dispose; }
Greg Kroah-Hartman
maintainerPATCH 50/329 Btrfs: set plug for fsync
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit 343e4fc1c60971b0734de26dbbd475d433950982 ]
Setting plug can merge adjacent IOs before dispatching IOs to the disk driver.
Without plug, it'd not be a problem for single disk usecases, but for multiple disks using raid profile, a large IO can be split to several IOs of stripe length, and plug can be helpful to bring them together for each disk so that we can save several disk access.
Moreover, fsync issues synchronous writes, so plug can really take effect.
--- fs/btrfs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/btrfs/file.c +9 -0
@@ -1912,10 +1912,19 @@ int btrfs_release_file(struct inode *inostatic int start_ordered_ops (struct inode *inode,loff_t start,loff_t end) {int ret; +struct blk_plug plug; +/* +* This is only called in fsync, which would do synchronous writes, so +* a plug can merge adjacent IOs as much as possible. Esp. in case of +* multiple disks using raid profile, a large IO can be split to +* several segments of stripe length (currently 64K). +*/ +blk_start_plug (&plug);atomic_inc (&BTRFS_I (inode)->sync_writers); ret =btrfs_fdatawrite_range (inode, start, end);atomic_dec (&BTRFS_I (inode)->sync_writers); +blk_finish_plug (&plug);return ret; }
Greg Kroah-Hartman
maintainerPATCH 51/329 btrfs: Fix out of bounds access in btrfs_search_slot
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
[ Upstream commit 9ea2c7c9da13c9073e371c046cbbc45481ecb459 ]
When modifying a tree where the root is at BTRFS_MAX_LEVEL - 1 then the level variable is going to be 7 (this is the max height of the tree). On the other hand btrfs_cow_block is always called with "level + 1" as an index into the nodes and slots arrays. This leads to an out of bounds access. Admittdely this will be benign since an OOB access of the nodes array will likely read the 0th element from the slots array, which in this case is going to be 0 (since we start CoW at the top of the tree). The OOB access into the slots array in turn will read the 0th and 1st values of the locks array, which would both be 0 at the time. However, this benign behavior relies on the fact that the path being passed hasn't been initialised, if it has already been used to query a btree then it could potentially have populated the nodes/slots arrays.
Fix it by explicitly checking if we are at level 7 (the maximum allowed index in nodes/slots arrays) and explicitly call the CoW routine with NULL for parent's node/slot.
Fixes-coverity-id: 711515
--- fs/btrfs/ctree.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/btrfs/ctree.c +9 -3
@@ -2760,6 +2760,8 @@ again:* contention with the cow code */ if (cow) { +bool last_level = (level == (BTRFS_MAX_LEVEL -1 )); +/* * if we don't really need to cow this block * then we don't want to set the path blocking,
@@ -2784,9 +2786,13 @@ again: }btrfs_set_path_blocking (p); - err =btrfs_cow_block (trans, root, b, - p->nodes[level +1 ], - p->slots[level +1 ], &b); +if (last_level) + err =btrfs_cow_block (trans, root, b,NULL ,0 , + &b); +else + err =btrfs_cow_block (trans, root, b, + p->nodes[level +1 ], + p->slots[level +1 ], &b);if (err) { ret = err; goto done;
Greg Kroah-Hartman
maintainerPATCH 52/329 Btrfs: fix scrub to repair raid6 corruption
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit 762221f095e3932669093466aaf4b85ed9ad2ac1 ]
The raid6 corruption is that,
suppose that all disks can be read without problems and if the content that was read out doesn't match its checksum, currently for raid6 btrfs at most retries twice,
- the 1st retry is to rebuild with all other stripes, it'll eventually be a raid5 xor rebuild,
- if the 1st fails, the 2nd retry will deliberately fail parity p so that it will do raid6 style rebuild,
however, the chances are that another non-parity stripe content also has something corrupted, so that the above retries are not able to return correct content.
We've fixed normal reads to rebuild raid6 correctly with more retries in Patch "Btrfs: make raid6 rebuild retry more"[1], this is to fix scrub to do the exactly same rebuild process.
[1]: https://patchwork.kernel.org/patch/10091755/
--- fs/btrfs/raid56.c | 18 ++++++++++++++---- fs/btrfs/volumes.c | 9 ++++++++- 2 files changed, 22 insertions(+), 5 deletions(-)
fs/btrfs/raid56.c +14 -4
@@ -2161,11 +2161,21 @@ int raid56_parity_recover(struct btrfs_r }/* -* reconstruct from the q stripe if they are -* asking for mirror 3 +* Loop retry: +* for 'mirror == 2', reconstruct from all other stripes. +* for 'mirror_num > 2', select a stripe to fail on every retry. */ -if (mirror_num ==3 ) - rbio->failb = rbio->real_stripes -2 ; +if (mirror_num >2 ) { +/* +* 'mirror == 3' is to fail the p stripe and +* reconstruct from the q stripe. 'mirror > 3' is to +* fail a data stripe and reconstruct from p+q stripe. +*/ + rbio->failb = rbio->real_stripes - (mirror_num -1 ); +ASSERT (rbio->failb >0 ); +if (rbio->failb <= rbio->faila) + rbio->failb--; + } ret =lock_stripe_add (rbio);
fs/btrfs/volumes.c +8 -1
@@ -5186,7 +5186,14 @@ int btrfs_num_copies(struct btrfs_fs_infelse if (map->type &BTRFS_BLOCK_GROUP_RAID5 ) ret =2 ;else if (map->type &BTRFS_BLOCK_GROUP_RAID6 ) - ret =3 ; +/* +* There could be two corrupted data stripes, we need +* to loop retry in order to rebuild the correct data. +* +* Fail a stripe at a time on every retry except the +* stripe under reconstruction. +*/ + ret = map->num_stripes;else ret =1 ;free_extent_map (em);
Greg Kroah-Hartman
maintainerPATCH 53/329 btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
[ Upstream commit 6f794e3c5c8f8fdd3b5bb20d9ded894e685b5bbe ]
It appears from the original commit [1] that there isn't any design specific reason not to fail the mount instead of just warning. This patch will change it to fail.
[1]
commit 319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation check
--- fs/btrfs/disk-io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +4 -2
@@ -4142,9 +4142,11 @@ static int btrfs_check_super_valid(strucbtrfs_err (fs_info,"no valid FS found" ); ret = -EINVAL ; } -if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) -btrfs_warn (fs_info,"unrecognized super flag: %llu" , +if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) { +btrfs_err (fs_info,"unrecognized or unsupported super flag: %llu" ,btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ); + ret = -EINVAL ; + }if (btrfs_super_root_level (sb) >=BTRFS_MAX_LEVEL ) {btrfs_err (fs_info,"tree_root level too big: %d >= %d" ,btrfs_super_root_level (sb),BTRFS_MAX_LEVEL );
Greg Kroah-Hartman
maintainerPATCH 54/329 HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ]
We get the "new_profile_index" value from the mouse device when we're handling raw events. Smatch taints it as untrusted data and complains that we need a bounds check. This seems like a reasonable warning otherwise there is a small read beyond the end of the array.
--- drivers/hid/hid-roccat-kovaplus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-roccat-kovaplus.c +2 -0
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(ustatic void kovaplus_profile_activated (struct kovaplus_device *kovaplus,uint new_profile_index) { +if (new_profile_index >=ARRAY_SIZE (kovaplus->profile_settings)) +return ; kovaplus->actual_profile = new_profile_index; kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
Greg Kroah-Hartman
maintainerPATCH 55/329 fm10k: fix "failed to kill vid" message for VF
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ngai-Mint Kwan <[email protected]>
[ Upstream commit cf315ea596ec26d7aa542a9ce354990875a920c0 ]
When a VF is under PF VLAN assignment:
ip link set <pf> vf <#> vlan <vid>
This will remove all previous entries in the VLAN table including those generated by VLAN interfaces created on the VF. The issue arises when the VF is under PF VLAN assignment and one or more of these VLAN interfaces of the VF are deleted. When deleting these VLAN interfaces, the following message will be generated in "dmesg":
failed to kill vid 0081/<vid> for device <vf>
This is due to the fact that "ndo_vlan_rx_kill_vid" exits with an error. The handler for this ndo is "fm10k_update_vid". Any calls to this function while under PF VLAN management will exit prematurely and, thus, it will generate the failure message.
Additionally, since "fm10k_update_vid" exits prematurely, none of the VLAN update is performed. So, even though the actual VLAN interfaces of the VF will be deleted, the active_vlans bitmask is not cleared. When the VF is no longer under PF VLAN assignment, the driver mistakenly restores the previous entries of the VLAN table based on an unsynchronized list of active VLANs.
The solution to this issue involves checking the VLAN update action type before exiting "fm10k_update_vid". If the VLAN update action type is to "add", this action will not be permitted while the VF is under PF VLAN assignment and the VLAN update is abandoned like before.
However, if the VLAN update action type is to "kill", then we need to also clear the active_vlans bitmask. However, we don't need to actually queue any messages to the PF, because the MAC and VLAN tables have already been cleared, and the PF would silently ignore these requests anyways.
--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +12 -2
@@ -803,8 +803,12 @@ static int fm10k_update_vid(struct net_dif (vid >=VLAN_N_VID )return -EINVAL ; -/* Verify we have permission to add VLANs */ -if (hw->mac.vlan_override) +/* Verify that we have permission to add VLANs. If this is a request +* to remove a VLAN, we still want to allow the user to remove the +* VLAN device. In that case, we need to clear the bit in the +* active_vlans bitmask. +*/ +if (set && hw->mac.vlan_override)return -EACCES ;/* update active_vlans bitmask */
@@ -823,6 +827,12 @@ static int fm10k_update_vid(struct net_d rx_ring->vid &= ~FM10K_VLAN_CLEAR ; } +/* If our VLAN has been overridden, there is no reason to send VLAN +* removal requests as they will be silently ignored. +*/ +if (hw->mac.vlan_override) +return 0 ; +/* Do not remove default VLAN ID related entries from VLAN and MAC * tables */
Greg Kroah-Hartman
maintainerPATCH 56/329 device property: Define type of PROPERTY_ENRTY_*() macros
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit c505cbd45f6e9c539d57dd171d95ec7e5e9f9cd0 ]
Some of the drivers may use the macro at runtime flow, like
struct property_entry p[10];
...
p[index++] = PROPERTY_ENTRY_U8("u8 property", u8_data);
In that case and absence of the data type compiler fails the build:
drivers/char/ipmi/ipmi_dmi.c:79:29: error: Expected ; at end of statement drivers/char/ipmi/ipmi_dmi.c:79:29: error: got {
--- include/linux/property.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/property.h +5 -5
@@ -187,7 +187,7 @@ struct property_entry {*/ #define PROPERTY_ENTRY_INTEGER_ARRAY (_name_, _type_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ .is_array = true, \
@@ -205,7 +205,7 @@ struct property_entry { PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, _val_)#define PROPERTY_ENTRY_STRING_ARRAY (_name_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ .is_array = true, \
@@ -214,7 +214,7 @@ struct property_entry { }#define PROPERTY_ENTRY_INTEGER (_name_, _type_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = sizeof(_type_), \ .is_string = false, \
@@ -231,7 +231,7 @@ struct property_entry { PROPERTY_ENTRY_INTEGER(_name_, u64, _val_)#define PROPERTY_ENTRY_STRING (_name_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = sizeof(_val_), \ .is_string = true, \
@@ -239,7 +239,7 @@ struct property_entry { }#define PROPERTY_ENTRY_BOOL (_name_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ }
Greg Kroah-Hartman
maintainerPATCH 57/329 jffs2: Fix use-after-free bug in jffs2_iget()s error handling path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jake Daryll Obina <[email protected]>
[ Upstream commit 5bdd0c6f89fba430e18d636493398389dadc3b17 ]
If jffs2_iget() fails for a newly-allocated inode, jffs2_do_clear_inode() can get called twice in the error handling path, the first call in jffs2_iget() itself and the second through iget_failed(). This can result to a use-after-free error in the second jffs2_do_clear_inode() call, such as shown by the oops below wherein the second jffs2_do_clear_inode() call was trying to free node fragments that were already freed in the first jffs2_do_clear_inode() call.
[ 78.178860] jffs2: error: (1904) jffs2_do_read_inode_internal: CRC failed for read_inode of inode 24 at physical location 0x1fc00c [ 78.178914] Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b7b [ 78.185871] pgd = ffffffc03a567000 [ 78.188794] [6b6b6b6b6b6b6b7b] *pgd=0000000000000000, *pud=0000000000000000 [ 78.194968] Internal error: Oops: 96000004 [#1] PREEMPT SMP ... [ 78.513147] PC is at rb_first_postorder+0xc/0x28 [ 78.516503] LR is at jffs2_kill_fragtree+0x28/0x90 [jffs2] [ 78.520672] pc : [<ffffff8008323d28>] lr : [<ffffff8000eb1cc8>] pstate: 60000105 [ 78.526757] sp : ffffff800cea38f0 [ 78.528753] x29: ffffff800cea38f0 x28: ffffffc01f3f8e80 [ 78.532754] x27: 0000000000000000 x26: ffffff800cea3c70 [ 78.536756] x25: 00000000dc67c8ae x24: ffffffc033d6945d [ 78.540759] x23: ffffffc036811740 x22: ffffff800891a5b8 [ 78.544760] x21: 0000000000000000 x20: 0000000000000000 [ 78.548762] x19: ffffffc037d48910 x18: ffffff800891a588 [ 78.552764] x17: 0000000000000800 x16: 0000000000000c00 [ 78.556766] x15: 0000000000000010 x14: 6f2065646f6e695f [ 78.560767] x13: 6461657220726f66 x12: 2064656c69616620 [ 78.564769] x11: 435243203a6c616e x10: 7265746e695f6564 [ 78.568771] x9 : 6f6e695f64616572 x8 : ffffffc037974038 [ 78.572774] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008 [ 78.576775] x5 : 002f91d85bd44a2f x4 : 0000000000000000 [ 78.580777] x3 : 0000000000000000 x2 : 000000403755e000 [ 78.584779] x1 : 6b6b6b6b6b6b6b6b x0 : 6b6b6b6b6b6b6b6b ... [ 79.038551] [<ffffff8008323d28>] rb_first_postorder+0xc/0x28 [ 79.042962] [<ffffff8000eb5578>] jffs2_do_clear_inode+0x88/0x100 [jffs2] [ 79.048395] [<ffffff8000eb9ddc>] jffs2_evict_inode+0x3c/0x48 [jffs2] [ 79.053443] [<ffffff8008201ca8>] evict+0xb0/0x168 [ 79.056835] [<ffffff8008202650>] iput+0x1c0/0x200 [ 79.060228] [<ffffff800820408c>] iget_failed+0x30/0x3c [ 79.064097] [<ffffff8000eba0c0>] jffs2_iget+0x2d8/0x360 [jffs2] [ 79.068740] [<ffffff8000eb0a60>] jffs2_lookup+0xe8/0x130 [jffs2] [ 79.073434] [<ffffff80081f1a28>] lookup_slow+0x118/0x190 [ 79.077435] [<ffffff80081f4708>] walk_component+0xfc/0x28c [ 79.081610] [<ffffff80081f4dd0>] path_lookupat+0x84/0x108 [ 79.085699] [<ffffff80081f5578>] filename_lookup+0x88/0x100 [ 79.089960] [<ffffff80081f572c>] user_path_at_empty+0x58/0x6c [ 79.094396] [<ffffff80081ebe14>] vfs_statx+0xa4/0x114 [ 79.098138] [<ffffff80081ec44c>] SyS_newfstatat+0x58/0x98 [ 79.102227] [<ffffff800808354c>] __sys_trace_return+0x0/0x4 [ 79.106489] Code: d65f03c0 f9400001 b40000e1 aa0103e0 (f9400821)
The jffs2_do_clear_inode() call in jffs2_iget() is unnecessary since iget_failed() will eventually call jffs2_do_clear_inode() if needed, so just remove it.
--- fs/jffs2/fs.c | 1 - 1 file changed, 1 deletion(-)
fs/jffs2/fs.c +0 -1
@@ -361,7 +361,6 @@ error_io: ret = -EIO ; error:mutex_unlock (&f->sem); -jffs2_do_clear_inode (c, f);iget_failed (inode);return ERR_PTR (ret); }
Greg Kroah-Hartman
maintainerPATCH 58/329 powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bringmann <[email protected]>
[ Upstream commit a346137e9142b039fd13af2e59696e3d40c487ef ]
On powerpc systems which allow 'hot-add' of CPU or memory resources, it may occur that the new resources are to be inserted into nodes that were not used for these resources at bootup. In the kernel, any node that is used must be defined and initialized. These empty nodes may occur when,
* Dedicated vs. shared resources. Shared resources require information such as the VPHN hcall for CPU assignment to nodes. Associativity decisions made based on dedicated resource rules, such as associativity properties in the device tree, may vary from decisions made using the values returned by the VPHN hcall.
* memoryless nodes at boot. Nodes need to be defined as 'possible' at boot for operation with other code modules. Previously, the powerpc code would limit the set of possible nodes to those which have memory assigned at boot, and were thus online. Subsequent add/remove of CPUs or memory would only work with this subset of possible nodes.
* memoryless nodes with CPUs at boot. Due to the previous restriction on nodes, nodes that had CPUs but no memory were being collapsed into other nodes that did have memory at boot. In practice this meant that the node assignment presented by the runtime kernel differed from the affinity and associativity attributes presented by the device tree or VPHN hcalls. Nodes that might be known to the pHyp were not 'possible' in the runtime kernel because they did not have memory at boot.
This patch ensures that sufficient nodes are defined to support configuration requirements after boot, as well as at boot. This patch set fixes a couple of problems.
* Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node. * Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting to one of the set of nodes that were known to have memory at boot.
This patch extracts the value of the lowest domain level (number of allocable resources) from the device tree property "ibm,max-associativity-domains" to use as the maximum number of nodes to setup as possibly available in the system. This new setting will override the instruction:
nodes_and(node_possible_map, node_possible_map, node_online_map);
presently seen in the function arch/powerpc/mm/numa.c:initmem_init().
If the "ibm,max-associativity-domains" property is not present at boot, no operation will be performed to define or enable additional nodes, or enable the above 'nodes_and()'.
--- arch/powerpc/mm/numa.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
arch/powerpc/mm/numa.c +34 -3
@@ -904,6 +904,34 @@ static void __init setup_node_data(int nNODE_DATA (nid)->node_spanned_pages = spanned_pages; } +static void __init find_possible_nodes (void ) +{ +struct device_node *rtas; +u32 numnodes, i; + +if (min_common_depth <=0 ) +return ; + + rtas =of_find_node_by_path ("/rtas" ); +if (!rtas) +return ; + +if (of_property_read_u32_index (rtas, +"ibm,max-associativity-domains" , + min_common_depth, &numnodes)) + goto out; + +for (i =0 ; i < numnodes; i++) { +if (!node_possible (i)) { +setup_node_data (i,0 ,0 ); +node_set (i, node_possible_map); + } + } + +out: +of_node_put (rtas); +} +void __init initmem_init (void ) {int nid, cpu;
@@ -917,12 +945,15 @@ void __init initmem_init(void)memblock_dump_all ();/* -* Reduce the possible NUMA nodes to the online NUMA nodes, -* since we do not support node hotplug. This ensures that we -* lower the maximum NUMA node ID to what is actually present. +* Modify the set of possible NUMA nodes to reflect information +* available about the set of online nodes, and the set of nodes +* that we expect to make use of for this platform's affinity +* calculations. */ nodes_and (node_possible_map, node_possible_map, node_online_map); +find_possible_nodes (); +for_each_online_node (nid) {unsigned long start_pfn, end_pfn;
Greg Kroah-Hartman
maintainerPATCH 59/329 powerpc/numa: Ensure nodes initialized for hotplug
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bringmann <[email protected]>
[ Upstream commit ea05ba7c559c8e5a5946c3a94a2a266e9a6680a6 ]
This patch fixes some problems encountered at runtime with configurations that support memory-less nodes, or that hot-add CPUs into nodes that are memoryless during system execution after boot. The problems of interest include:
* Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node.
* Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting the references to one of the set of nodes known to have memory at boot.
Note that this software operates under the context of CPU hotplug. We are not doing memory hotplug in this code, but rather updating the kernel's CPU topology (i.e. arch_update_cpu_topology / numa_update_cpu_topology). We are initializing a node that may be used by CPUs or memory before it can be referenced as invalid by a CPU hotplug operation. CPU hotplug operations are protected by a range of APIs including cpu_maps_update_begin/cpu_maps_update_done, cpus_read/write_lock / cpus_read/write_unlock, device locks, and more. Memory hotplug operations, including try_online_node, are protected by mem_hotplug_begin/mem_hotplug_done, device locks, and more. In the case of CPUs being hot-added to a previously memoryless node, the try_online_node operation occurs wholly within the CPU locks with no overlap. Using HMC hot-add/hot-remove operations, we have been able to add and remove CPUs to any possible node without failures. HMC operations involve a degree self-serialization, though.
--- arch/powerpc/mm/numa.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)
arch/powerpc/mm/numa.c +37 -10
@@ -551,7 +551,7 @@ static int numa_setup_cpu(unsigned long nid =of_node_to_nid_single (cpu); out_present: -if (nid <0 || !node_online (nid)) +if (nid <0 || !node_possible (nid)) nid = first_online_node;map_cpu_to_node (lcpu, nid);
@@ -922,10 +922,8 @@ static void __init find_possible_nodes(v goto out;for (i =0 ; i < numnodes; i++) { -if (!node_possible (i)) { -setup_node_data (i,0 ,0 ); +if (!node_possible (i))node_set (i, node_possible_map); - } } out:
@@ -1305,6 +1303,40 @@ static long vphn_get_associativity(unsigreturn rc; } +static inline int find_and_online_cpu_nid (int cpu) +{ +__be32 associativity[VPHN_ASSOC_BUFSIZE ] = {0 }; +int new_nid; + +/* Use associativity from first thread for all siblings */ +vphn_get_associativity (cpu, associativity); + new_nid =associativity_to_nid (associativity); +if (new_nid <0 || !node_possible (new_nid)) + new_nid = first_online_node; + +if (NODE_DATA (new_nid) ==NULL ) { +#ifdef CONFIG_MEMORY_HOTPLUG +/* +* Need to ensure that NODE_DATA is initialized for a node from +* available memory (see memblock_alloc_try_nid). If unable to +* init the node, then default to nearest node that has memory +* installed. +*/ +if (try_online_node (new_nid)) + new_nid = first_online_node; +#else +/* +* Default to using the nearest node that has memory installed. +* Otherwise, it would be necessary to patch the kernel MM code +* to deal with more memoryless-node error conditions. +*/ + new_nid = first_online_node; +#endif + } + +return new_nid; +} +/* * Update the CPU maps and sysfs entries for a single CPU when its NUMA * characteristics change. This function doesn't perform any locking and is
@@ -1370,7 +1402,6 @@ int arch_update_cpu_topology(void) {unsigned int cpu, sibling, changed =0 ;struct topology_update_data *updates, *ud; -__be32 associativity[VPHN_ASSOC_BUFSIZE ] = {0 };cpumask_t updated_cpus;struct device *dev;int weight, new_nid, i =0 ;
@@ -1405,11 +1436,7 @@ int arch_update_cpu_topology(void)continue ; } -/* Use associativity from first thread for all siblings */ -vphn_get_associativity (cpu, associativity); - new_nid =associativity_to_nid (associativity); -if (new_nid <0 || !node_online (new_nid)) - new_nid = first_online_node; + new_nid =find_and_online_cpu_nid (cpu);if (new_nid == numa_cpu_lookup_table[cpu]) { cpumask_andnot(&cpu_associativity_changes_mask,
Greg Kroah-Hartman
maintainerPATCH 60/329 RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit b081808a66345ba725b77ecd8d759bee874cd937 ]
Failure in XRCD FW deallocation command leaves memory leaked and returns error to the user which he can't do anything about it.
This patch changes behavior to always free memory and always return success to the user.
--- drivers/infiniband/hw/mlx5/qp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +1 -4
@@ -4610,13 +4610,10 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcdint err; err =mlx5_core_xrcd_dealloc (dev->mdev, xrcdn); -if (err) { +if (err)mlx5_ib_warn (dev,"failed to dealloc xrcdn 0x%x\n" , xrcdn); -return err; - }kfree (xrcd); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 61/329 ntb_transport: Fix bug with max_mw_size parameter
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Logan Gunthorpe <[email protected]>
[ Upstream commit cbd27448faff4843ac4b66cc71445a10623ff48d ]
When using the max_mw_size parameter of ntb_transport to limit the size of the Memory windows, communication cannot be established and the queues freeze.
This is because the mw_size that's reported to the peer is correctly limited but the size used locally is not. So the MW is initialized with a buffer smaller than the window but the TX side is using the full window. This means the TX side will be writing to a region of the window that points nowhere.
This is easily fixed by applying the same limit to tx_size in ntb_transport_init_queue().
--- drivers/ntb/ntb_transport.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ntb/ntb_transport.c +3 -0
@@ -996,6 +996,9 @@ static int ntb_transport_init_queue(stru mw_base = nt->mw_vec[mw_num].phys_addr; mw_size = nt->mw_vec[mw_num].phys_size; +if (max_mw_size && mw_size > max_mw_size) + mw_size = max_mw_size; + tx_size = (unsigned int )mw_size / num_qps_mw; qp_offset = tx_size * (qp_num / mw_count);
Greg Kroah-Hartman
maintainerPATCH 62/329 gianfar: prevent integer wrapping in the rx handler
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Spencer <[email protected]>
[ Upstream commit 202a0a70e445caee1d0ec7aae814e64b1189fa4d ]
When the frame check sequence (FCS) is split across the last two frames of a fragmented packet, part of the FCS gets counted twice, once when subtracting the FCS, and again when subtracting the previously received data.
For example, if 1602 bytes are received, and the first fragment contains the first 1600 bytes (including the first two bytes of the FCS), and the second fragment contains the last two bytes of the FCS:
'skb->len == 1600' from the first fragment
size = lstatus & BD_LENGTH_MASK; # 1602
size -= ETH_FCS_LEN; # 1598
size -= skb->len; # -2
Since the size is unsigned, it wraps around and causes a BUG later in the packet handling, as shown below:
kernel BUG at ./include/linux/skbuff.h:2068!
Oops: Exception in kernel mode, sig: 5 [#1] ... NIP [c021ec60] skb_pull+0x24/0x44 LR [c01e2fbc] gfar_clean_rx_ring+0x498/0x690 Call Trace: [df7edeb0] [c01e2c1c] gfar_clean_rx_ring+0xf8/0x690 (unreliable) [df7edf20] [c01e33a8] gfar_poll_rx_sq+0x3c/0x9c [df7edf40] [c023352c] net_rx_action+0x21c/0x274 [df7edf90] [c0329000] __do_softirq+0xd8/0x240 [df7edff0] [c000c108] call_do_irq+0x24/0x3c [c0597e90] [c00041dc] do_IRQ+0x64/0xc4 [c0597eb0] [c000d920] ret_from_except+0x0/0x18 --- interrupt: 501 at arch_cpu_idle+0x24/0x5c
Change the size to a signed integer and then trim off any part of the FCS that was received prior to the last fragment.
--- drivers/net/ethernet/freescale/gianfar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +7 -2
@@ -2935,7 +2935,7 @@ static irqreturn_t gfar_transmit(int irqstatic bool gfar_add_rx_frag (struct gfar_rx_buff *rxb,u32 lstatus,struct sk_buff *skb,bool first) { -unsigned int size = lstatus &BD_LENGTH_MASK ; +int size = lstatus &BD_LENGTH_MASK ;struct page *page = rxb->page;bool last = !!(lstatus &BD_LFLAG (RXBD_LAST ));
@@ -2950,11 +2950,16 @@ static bool gfar_add_rx_frag(struct gfarif (last) size -= skb->len; -/* in case the last fragment consisted only of the FCS */ +/* Add the last fragment if it contains something other than +* the FCS, otherwise drop it and trim off any part of the FCS +* that was already received. +*/ if (size >0 )skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, page, rxb->page_offset +RXBUF_ALIGNMENT , size,GFAR_RXB_TRUESIZE ); +else if (size <0 ) +pskb_trim (skb, skb->len + size); }/* try reuse page */
Greg Kroah-Hartman
maintainerPATCH 63/329 tcp_nv: fix potential integer overflow in tcpnv_acked
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit e4823fbd229bfbba368b40cdadb8f4eeb20604cc ]
Add suffix ULL to constant 80000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type u64.
The current cast to u64 effectively applies to the whole expression as an argument of type u64 to be passed to div64_u64, but it does not prevent it from being evaluated using 32-bit arithmetic instead of 64-bit arithmetic.
Also, once the expression is properly evaluated using 64-bit arithmentic, there is no need for the parentheses and the external cast to u64.
Addresses-Coverity-ID: 1357588 ("Unintentional integer overflow")
--- net/ipv4/tcp_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_nv.c +1 -1
@@ -338,7 +338,7 @@ static void tcpnv_acked(struct sock *sk,*/ cwnd_by_slope = (u32 )div64_u64 (((u64 )ca->nv_rtt_max_rate) * ca->nv_min_rtt, - (u64)(80000 * tp->mss_cache)); +80000ULL * tp->mss_cache); max_win = cwnd_by_slope + nv_pad;/* If cwnd > max_win, decrease cwnd
Greg Kroah-Hartman
maintainerPATCH 65/329 ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: piaojun <[email protected]>
[ Upstream commit 025bcbde3634b2c9b316f227fed13ad6ad6817fb ]
If metadata is corrupted such as 'invalid inode block', we will get failed by calling 'mount()' and then set filesystem readonly as below:
ocfs2_mount
ocfs2_initialize_super
ocfs2_init_global_system_inodes
ocfs2_iget
ocfs2_read_locked_inode
ocfs2_validate_inode_block
ocfs2_error
ocfs2_handle_error
ocfs2_set_ro_flag(osb, 0); // set readonlyIn this situation we need return -EROFS to 'mount.ocfs2', so that user can fix it by fsck. And then mount again. In addition, 'mount.ocfs2' should be updated correspondingly as it only return 1 for all errno. And I will post a patch for 'mount.ocfs2' too.
--- fs/ocfs2/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/ocfs2/super.c +2 -3
@@ -473,9 +473,8 @@ static int ocfs2_init_global_system_inod new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog_errno (status); -/* FIXME: Should ERROR_RO_FS */ mlog (ML_ERROR ,"Unable to load system inode %d, " "possibly corrupt fs?" , i); goto bail;
@@ -504,7 +503,7 @@ static int ocfs2_init_local_system_inode new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog (ML_ERROR ,"status=%d, sysfile=%d, slot=%d\n" , status, i, osb->slot_num); goto bail;
Greg Kroah-Hartman
maintainerPATCH 66/329 ocfs2/acl: use ip_xattr_sem to protect getting extended attribute
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: piaojun <[email protected]>
[ Upstream commit 16c8d569f5704a84164f30ff01b29879f3438065 ]
The race between *set_acl and *get_acl will cause getting incomplete xattr data as below:
processA processB
ocfs2_set_acl
ocfs2_xattr_set
__ocfs2_xattr_set_handle
ocfs2_get_acl_nolock
ocfs2_xattr_get_nolock:
processB may get incomplete xattr data if processA hasn't set_acl done.
So we should use 'ip_xattr_sem' to protect getting extended attribute in ocfs2_get_acl_nolock(), as other processes could be changing it concurrently.
--- fs/ocfs2/acl.c | 6 ++++++ fs/ocfs2/xattr.c | 2 ++ 2 files changed, 8 insertions(+)
fs/ocfs2/acl.c +6 -0
@@ -314,7 +314,9 @@ struct posix_acl *ocfs2_iop_get_acl(strureturn ERR_PTR (ret); } +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode, type, di_bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);ocfs2_inode_unlock (inode,0 );brelse (di_bh);
@@ -333,7 +335,9 @@ int ocfs2_acl_chmod(struct inode *inode,if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return 0 ; +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);if (IS_ERR (acl) || !acl)return PTR_ERR (acl); ret =__posix_acl_chmod (&acl,GFP_KERNEL , inode->i_mode);
@@ -364,8 +368,10 @@ int ocfs2_init_acl(handle_t *handle,if (!S_ISLNK (inode->i_mode)) {if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (dir,ACL_TYPE_DEFAULT , dir_bh); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (IS_ERR (acl))return PTR_ERR (acl); }
fs/ocfs2/xattr.c +2 -0
@@ -638,9 +638,11 @@ int ocfs2_calc_xattr_init(struct inode * si->value_len);if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl_len =ocfs2_xattr_get_nolock (dir, dir_bh,OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ,"" ,NULL ,0 ); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (acl_len >0 ) { a_size =ocfs2_xattr_entry_real_size (0 , acl_len);if (S_ISDIR (mode))
Greg Kroah-Hartman
maintainerPATCH 67/329 ocfs2: return error when we attempt to access a dirty bh in jbd2
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: piaojun <[email protected]>
[ Upstream commit d984187e3a1ad7d12447a7ab2c43ce3717a2b5b3 ]
We should not reuse the dirty bh in jbd2 directly due to the following situation:
1. When removing extent rec, we will dirty the bhs of extent rec and truncate log at the same time, and hand them over to jbd2.
2. The bhs are submitted to jbd2 area successfully.
3. The write-back thread of device help flush the bhs to disk but encounter write error due to abnormal storage link.
4. After a while the storage link become normal. Truncate log flush worker triggered by the next space reclaiming found the dirty bh of truncate log and clear its 'BH_Write_EIO' and then set it uptodate in __ocfs2_journal_access():
ocfs2_truncate_log_worker
ocfs2_flush_truncate_log
__ocfs2_flush_truncate_log
ocfs2_replay_truncate_records
ocfs2_journal_access_di
__ocfs2_journal_access // here we clear io_error and set 'tl_bh' uptodata.
5. Then jbd2 will flush the bh of truncate log to disk, but the bh of extent rec is still in error state, and unfortunately nobody will take care of it.
6. At last the space of extent rec was not reduced, but truncate log flush worker have given it back to globalalloc. That will cause duplicate cluster problem which could be identified by fsck.ocfs2.
Sadly we can hardly revert this but set fs read-only in case of ruining atomicity and consistency of space reclaim.
--- fs/ocfs2/journal.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
fs/ocfs2/journal.c +12 -11
@@ -666,23 +666,24 @@ static int __ocfs2_journal_access(handle/* we can safely remove this assertion after testing. */ if (!buffer_uptodate (bh)) {mlog (ML_ERROR ,"giving me a buffer that's not uptodate!\n" ); -mlog (ML_ERROR ,"b_blocknr=%llu\n" , - (unsigned long long )bh->b_blocknr); +mlog (ML_ERROR ,"b_blocknr=%llu, b_state=0x%lx\n" , + (unsigned long long )bh->b_blocknr, bh->b_state);lock_buffer (bh);/* -* A previous attempt to write this buffer head failed. -* Nothing we can do but to retry the write and hope for -* the best. +* A previous transaction with a couple of buffer heads fail +* to checkpoint, so all the bhs are marked as BH_Write_EIO. +* For current transaction, the bh is just among those error +* bhs which previous transaction handle. We can't just clear +* its BH_Write_EIO and reuse directly, since other bhs are +* not written to disk yet and that will cause metadata +* inconsistency. So we should set fs read-only to avoid +* further damage. */ if (buffer_write_io_error (bh) && !buffer_uptodate (bh)) { -clear_buffer_write_io_error (bh); -set_buffer_uptodate (bh); - } - -if (!buffer_uptodate (bh)) {unlock_buffer (bh); -return -EIO ; +return ocfs2_error (osb->sb,"A previous attempt to " +"write this buffer head failed\n" ); }unlock_buffer (bh); }
Greg Kroah-Hartman
maintainerPATCH 68/329 mm/mempolicy: fix the check of nodemask from user
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
[ Upstream commit 56521e7a02b7b84a5e72691a1fb15570e6055545 ]
As Xiaojun reported the ltp of migrate_pages01 will fail on arm64 system which has 4 nodes[0...3], all have memory and CONFIG_NODES_SHIFT=2:
migrate_pages01 0 TINFO : test_invalid_nodes migrate_pages01 14 TFAIL : migrate_pages_common.c:45: unexpected failure - returned value = 0, expected: -1 migrate_pages01 15 TFAIL : migrate_pages_common.c:55: call succeeded unexpectedly
In this case the test_invalid_nodes of migrate_pages01 will call:SYSC_migrate_pages as:
migrate_pages(0, , {0x0000000000000001}, 64, , {0x0000000000000010}, 64) = 0
The new nodes specifies one or more node IDs that are greater than the maximum supported node ID, however, the errno is not set to EINVAL as expected.
As man pages of set_mempolicy[1], mbind[2], and migrate_pages[3] mentioned, when nodemask specifies one or more node IDs that are greater than the maximum supported node ID, the errno should set to EINVAL. However, get_nodes only check whether the part of bits [BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES), maxnode) is zero or not, and remain [MAX_NUMNODES, BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES) unchecked.
This patch is to check the bits of [MAX_NUMNODES, maxnode) in get_nodes to let migrate_pages set the errno to EINVAL when nodemask specifies one or more node IDs that are greater than the maximum supported node ID, which follows the manpage's guide.
[1] http://man7.org/linux/man-pages/man2/set_mempolicy.2.html
[2] http://man7.org/linux/man-pages/man2/mbind.2.html
[3] http://man7.org/linux/man-pages/man2/migrate_pages.2.html
--- mm/mempolicy.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
mm/mempolicy.c +20 -3
@@ -1264,6 +1264,7 @@ static int get_nodes(nodemask_t *nodes, unsigned long maxnode) {unsigned long k; +unsigned long t;unsigned long nlongs;unsigned long endmask;
@@ -1280,13 +1281,19 @@ static int get_nodes(nodemask_t *nodes,else endmask = (1UL << (maxnode %BITS_PER_LONG )) -1 ; -/* When the user specified more nodes than supported just check -if the non supported part is all zero. */ +/* +* When the user specified more nodes than supported just check +* if the non supported part is all zero. +* +* If maxnode have more longs than MAX_NUMNODES, check +* the bits in that area first. And then go through to +* check the rest bits which equal or bigger than MAX_NUMNODES. +* Otherwise, just check bits [MAX_NUMNODES, maxnode). +*/ if (nlongs >BITS_TO_LONGS (MAX_NUMNODES )) {if (nlongs >PAGE_SIZE /sizeof (long ))return -EINVAL ;for (k =BITS_TO_LONGS (MAX_NUMNODES ); k < nlongs; k++) { -unsigned long t;if (get_user (t, nmask + k))return -EFAULT ;if (k == nlongs -1 ) {
@@ -1299,6 +1306,16 @@ static int get_nodes(nodemask_t *nodes, endmask = ~0UL ; } +if (maxnode >MAX_NUMNODES &&MAX_NUMNODES %BITS_PER_LONG !=0 ) { +unsigned long valid_mask = endmask; + + valid_mask &= ~((1UL << (MAX_NUMNODES %BITS_PER_LONG )) -1 ); +if (get_user (t, nmask + nlongs -1 )) +return -EFAULT ; +if (t & valid_mask) +return -EINVAL ; + } +if (copy_from_user (nodes_addr (*nodes), nmask, nlongs*sizeof (unsigned long )))return -EFAULT ;nodes_addr (*nodes)[nlongs-1 ] &= endmask;
Greg Kroah-Hartman
maintainerPATCH 69/329 mm/mempolicy: add nodes_empty check in SYSC_migrate_pages
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
[ Upstream commit 0486a38bcc4749808edbc848f1bcf232042770fc ]
As in manpage of migrate_pages, the errno should be set to EINVAL when none of the node IDs specified by new_nodes are on-line and allowed by the process's current cpuset context, or none of the specified nodes contain memory. However, when test by following case:
new_nodes = 0; old_nodes = 0xf; ret = migrate_pages(pid, old_nodes, new_nodes, MAX);
The ret will be 0 and no errno is set. As the new_nodes is empty, we should expect EINVAL as documented.
To fix the case like above, this patch check whether target nodes AND current task_nodes is empty, and then check whether AND node_states[N_MEMORY] is empty.
--- mm/mempolicy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/mempolicy.c +7 -3
@@ -1442,10 +1442,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pi goto out_put; } -if (!nodes_subset (*new, node_states[N_MEMORY ])) { - err = -EINVAL ; + task_nodes =cpuset_mems_allowed (current); +nodes_and (*new, *new, task_nodes); +if (nodes_empty (*new)) + goto out_put; + +nodes_and (*new, *new, node_states[N_MEMORY ]); +if (nodes_empty (*new)) goto out_put; - } err =security_task_movememory (task);if (err)
Greg Kroah-Hartman
maintainerPATCH 70/329 asm-generic: provide generic_pmdp_establish()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit c58f0bb77ed8bf93dfdde762b01cb67eebbdfc29 ]
Patch series "Do not lose dirty bit on THP pages", v4.
Vlastimil noted that pmdp_invalidate() is not atomic and we can lose dirty and access bits if CPU sets them after pmdp dereference, but before set_pmd_at().
The bug can lead to data loss, but the race window is tiny and I haven't seen any reports that suggested that it happens in reality. So I don't think it worth sending it to stable.
Unfortunately, there's no way to address the issue in a generic way. We need to fix all architectures that support THP one-by-one.
All architectures that have THP supported have to provide atomic pmdp_invalidate() that returns previous value.
If generic implementation of pmdp_invalidate() is used, architecture needs to provide atomic pmdp_estabish().
pmdp_estabish() is not used out-side generic implementation of pmdp_invalidate() so far, but I think this can change in the future.
This patch (of 12):
This is an implementation of pmdp_establish() that is only suitable for an architecture that doesn't have hardware dirty/accessed bits. In this case we can't race with CPU which sets these bits and non-atomic approach is fine.
--- include/asm-generic/pgtable.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/asm-generic/pgtable.h +15 -0
@@ -234,6 +234,21 @@ extern void pgtable_trans_huge_deposit(sextern pgtable_t pgtable_trans_huge_withdraw (struct mm_struct *mm,pmd_t *pmdp);#endif +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +/* +* This is an implementation of pmdp_establish() that is only suitable for an +* architecture that doesn't have hardware dirty/accessed bits. In this case we +* can't race with CPU which sets these bits and non-atomic aproach is fine. +*/ +static inline pmd_t generic_pmdp_establish (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp,pmd_t pmd) +{ +pmd_t old_pmd = *pmdp; +set_pmd_at (vma->vm_mm, address, pmdp, pmd); +return old_pmd; +} +#endif +#ifndef __HAVE_ARCH_PMDP_INVALIDATEextern void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);
Greg Kroah-Hartman
maintainerPATCH 71/329 sparc64: update pmdp_invalidate() to return old pmd value
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitin Gupta <[email protected]>
[ Upstream commit a8e654f01cb725d0bfd741ebca1bf4c9337969cc ]
It's required to avoid losing dirty and accessed bits.
--- arch/sparc/include/asm/pgtable_64.h | 2 +- arch/sparc/mm/tlb.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-)
arch/sparc/include/asm/pgtable_64.h +1 -1
@@ -952,7 +952,7 @@ void update_mmu_cache_pmd(struct vm_area pmd_t *pmd);#define __HAVE_ARCH_PMDP_INVALIDATE -extern void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address, +extern pmd_t pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);#define __HAVE_ARCH_PGTABLE_DEPOSIT
arch/sparc/mm/tlb.c +18 -5
@@ -219,17 +219,28 @@ void set_pmd_at(struct mm_struct *mm, un } } +static inline pmd_t pmdp_establish (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp,pmd_t pmd) +{ +pmd_t old; + +do { + old = *pmdp; + }while (cmpxchg64 (&pmdp->pmd, old.pmd, pmd.pmd) != old.pmd); + +return old; +} +/* * This routine is only called when splitting a THP */ -void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address, +pmd_t pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp) { -pmd_t entry = *pmdp; - -pmd_val (entry) &= ~_PAGE_VALID; +pmd_t old, entry; -set_pmd_at (vma->vm_mm, address, pmdp, entry); + entry =__pmd (pmd_val (*pmdp) & ~_PAGE_VALID); + old =pmdp_establish (vma, address, pmdp, entry);flush_tlb_range (vma, address, address +HPAGE_PMD_SIZE );/*
@@ -240,6 +251,8 @@ void pmdp_invalidate(struct vm_area_struif ((pmd_val (entry) & _PAGE_PMD_HUGE) && !is_huge_zero_page (pmd_page (entry))) (vma->vm_mm)->context.thp_pte_count--; + +return old; } void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
Greg Kroah-Hartman
maintainerPATCH 73/329 mm: pin address_space before dereferencing it while isolating an LRU page
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
[ Upstream commit 69d763fc6d3aee787a3e8c8c35092b4f4960fa5d ]
Minchan Kim asked the following question -- what locks protects address_space destroying when race happens between inode trauncation and __isolate_lru_page? Jan Kara clarified by describing the race as follows
CPU1 CPU2
truncate(inode) __isolate_lru_page()
...
truncate_inode_page(mapping, page);
delete_from_page_cache(page)
spin_lock_irqsave(&mapping->tree_lock, flags);
__delete_from_page_cache(page, NULL)
page_cache_tree_delete(..)
... mapping = page_mapping(page);
page->mapping = NULL;
...
spin_unlock_irqrestore(&mapping->tree_lock, flags);
page_cache_free_page(mapping, page)
put_page(page)
if (put_page_testzero(page)) -> false- inode now has no pages and can be freed including embedded address_space
if (mapping && !mapping->a_ops->migratepage)
- we've dereferenced mapping which is potentially already free.
The race is theoretically possible but unlikely. Before the delete_from_page_cache, truncate_cleanup_page is called so the page is likely to be !PageDirty or PageWriteback which gets skipped by the only caller that checks the mappping in __isolate_lru_page. Even if the race occurs, a substantial amount of work has to happen during a tiny window with no preemption but it could potentially be done using a virtual machine to artifically slow one CPU or halt it during the critical window.
This patch should eliminate the race with truncation by try-locking the page before derefencing mapping and aborting if the lock was not acquired. There was a suggestion from Huang Ying to use RCU as a side-effect to prevent mapping being freed. However, I do not like the solution as it's an unconventional means of preserving a mapping and it's not a context where rcu_read_lock is obviously protecting rcu data.
--- mm/vmscan.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/vmscan.c +12 -2
@@ -1374,6 +1374,7 @@ int __isolate_lru_page(struct page *pageif (PageDirty (page)) {struct address_space *mapping; +bool migrate_dirty;/* ISOLATE_CLEAN means only clean pages */ if (mode &ISOLATE_CLEAN )
@@ -1382,10 +1383,19 @@ int __isolate_lru_page(struct page *page/* * Only pages without mappings or that have a * ->migratepage callback are possible to migrate -* without blocking +* without blocking. However, we can be racing with +* truncation so it's necessary to lock the page +* to stabilise the mapping as truncation holds +* the page lock until after the page is removed +* from the page cache. */ +if (!trylock_page (page)) +return ret; + mapping =page_mapping (page); -if (mapping && !mapping->a_ops->migratepage) + migrate_dirty = mapping && mapping->a_ops->migratepage; +unlock_page (page); +if (!migrate_dirty)return ret; } }
Greg Kroah-Hartman
maintainerPATCH 74/329 mm/fadvise: discard partial page if endbyte is also EOF
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "shidao.ytt" <[email protected]>
[ Upstream commit a7ab400d6fe73d0119fdc234e9982a6f80faea9f ]
During our recent testing with fadvise(FADV_DONTNEED), we find that if given offset/length is not page-aligned, the last page will not be discarded. The tool we use is vmtouch (https://hoytech.com/vmtouch/),
we map a 10KB-sized file into memory and then try to run this tool to evict the whole file mapping, but the last single page always remains staying in the memory:
$./vmtouch -e test_10K
Files: 1
Directories: 0
Evicted Pages: 3 (12K)
Elapsed: 2.1e-05 seconds
$./vmtouch test_10K
Files: 1
Directories: 0
Resident Pages: 1/3 4K/12K 33.3%
Elapsed: 5.5e-05 seconds
However when we test with an older kernel, say 3.10, this problem is gone. So we wonder if this is a regression:
$./vmtouch -e test_10K
Files: 1
Directories: 0
Evicted Pages: 3 (12K)
Elapsed: 8.2e-05 seconds
$./vmtouch test_10K
Files: 1
Directories: 0
Resident Pages: 0/3 0/12K 0% <-- partial page also discarded
Elapsed: 5e-05 seconds
After digging a little bit into this problem, we find it seems not a regression. Not discarding partial page is likely to be on purpose according to commit 441c228f817f ("mm: fadvise: document the fadvise(FADV_DONTNEED) behaviour for partial pages") written by Mel Gorman. He explained why partial pages should be preserved instead of being discarded when using fadvise(FADV_DONTNEED).
However, the interesting part is that the actual code did NOT work as the same as it was described, the partial page was still discarded anyway, due to a calculation mistake of `end_index' passed to invalidate_mapping_pages(). This mistake has not been fixed until recently, that's why we fail to reproduce our problem in old kernels. The fix is done in commit 18aba41cbf ("mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED") by Oleg Drokin.
Back to the original testing, our problem becomes that there is a special case that, if the page-unaligned `endbyte' is also the end of file, it is not necessary at all to preserve the last partial page, as we all know no one else will use the rest of it. It should be safe enough if we just discard the whole page. So we add an EOF check in this patch.
We also find a poosbile real world issue in mainline kernel. Assume such scenario: A userspace backup application want to backup a huge amount of small files (<4k) at once, the developer might (I guess) want to use fadvise(FADV_DONTNEED) to save memory. However, FADV_DONTNEED won't really happen since the only page mapped is a partial page, and kernel will preserve it. Our patch also fixes this problem, since we know the endbyte is EOF, so we discard it.
Here is a simple reproducer to reproduce and verify each scenario we described above:
test_fadvise.c
==============================
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int i, fd, ret, len;
struct stat buf;
void *addr;
unsigned char *vec;
char *strbuf;
ssize_t pagesize = getpagesize();
ssize_t filesize;
fd = open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
if (fd < 0)
return -1;
filesize = strtoul(argv[2], NULL, 10);
strbuf = malloc(filesize);
memset(strbuf, 42, filesize);
write(fd, strbuf, filesize);
free(strbuf);
fsync(fd);
len = (filesize + pagesize - 1) / pagesize;
printf("length of pages: %d\n", len);
addr = mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED)
return -1;
ret = posix_fadvise(fd, 0, filesize, POSIX_FADV_DONTNEED);
if (ret < 0)
return -1;
vec = malloc(len);
ret = mincore(addr, filesize, (void *)vec);
if (ret < 0)
return -1;
for (i = 0; i < len; i++)
printf("pages[%d]: %x\n", i, vec[i] & 0x1);
free(vec);
close(fd);
return 0;
}
==============================Test 1: running on kernel with commit 18aba41cbf reverted:
[root@caspar ~]# uname -r
4.15.0-rc6.revert+
[root@caspar ~]# ./test_fadvise file1 1024
length of pages: 1
pages[0]: 0 # <-- partial page discarded
[root@caspar ~]# ./test_fadvise file2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise file3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 0 # <-- partial page discarded
Test 2: running on mainline kernel:
[root@caspar ~]# uname -r
4.15.0-rc6+
[root@caspar ~]# ./test_fadvise test1 1024
length of pages: 1
pages[0]: 1 # <-- partial and the only page not discarded
[root@caspar ~]# ./test_fadvise test2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise test3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 1 # <-- partial page not discarded
Test 3: running on kernel with this patch:
[root@caspar ~]# uname -r
4.15.0-rc6.patched+
[root@caspar ~]# ./test_fadvise test1 1024
length of pages: 1
pages[0]: 0 # <-- partial page and EOF, discarded
[root@caspar ~]# ./test_fadvise test2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise test3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 0 # <-- partial page and EOF, discarded
--- mm/fadvise.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
mm/fadvise.c +9 -1
@@ -126,7 +126,15 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, l*/ start_index = (offset+(PAGE_SIZE -1 )) >>PAGE_SHIFT ; end_index = (endbyte >>PAGE_SHIFT ); -if ((endbyte & ~PAGE_MASK ) != ~PAGE_MASK ) { +/* +* The page at end_index will be inclusively discarded according +* by invalidate_mapping_pages(), so subtracting 1 from +* end_index means we will skip the last page. But if endbyte +* is page aligned or is at the end of file, we should not skip +* that page - discarding the last page is safe enough. +*/ +if ((endbyte & ~PAGE_MASK ) != ~PAGE_MASK && + endbyte != inode->i_size -1 ) {/* First page is tricky as 0 - 1 = -1, but pgoff_t * is unsigned, so the end_index >= start_index * check below would be true and we'll discard the whole
Greg Kroah-Hartman
maintainerPATCH 75/329 openvswitch: Remove padding from packet before L3+ conntrack processing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ed Swierk <[email protected]>
[ Upstream commit 9382fe71c0058465e942a633869629929102843d ]
IPv4 and IPv6 packets may arrive with lower-layer padding that is not included in the L3 length. For example, a short IPv4 packet may have up to 6 bytes of padding following the IP payload when received on an Ethernet device with a minimum packet length of 64 bytes.
Higher-layer processing functions in netfilter (e.g. nf_ip_checksum(), and help() in nf_conntrack_ftp) assume skb->len reflects the length of the L3 header and payload, rather than referring back to ip_hdr->tot_len or ipv6_hdr->payload_len, and get confused by lower-layer padding.
In the normal IPv4 receive path, ip_rcv() trims the packet to ip_hdr->tot_len before invoking netfilter hooks. In the IPv6 receive path, ip6_rcv() does the same using ipv6_hdr->payload_len. Similarly in the br_netfilter receive path, br_validate_ipv4() and br_validate_ipv6() trim the packet to the L3 length before invoking netfilter hooks.
Currently in the OVS conntrack receive path, ovs_ct_execute() pulls the skb to the L3 header but does not trim it to the L3 length before calling nf_conntrack_in(NF_INET_PRE_ROUTING). When nf_conntrack_proto_tcp encounters a packet with lower-layer padding, nf_ip_checksum() fails causing a "nf_ct_tcp: bad TCP checksum" log message. While extra zero bytes don't affect the checksum, the length in the IP pseudoheader does. That length is based on skb->len, and without trimming, it doesn't match the length the sender used when computing the checksum.
In ovs_ct_execute(), trim the skb to the L3 length before higher-layer processing.
--- net/openvswitch/conntrack.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
net/openvswitch/conntrack.c +34 -0
@@ -906,6 +906,36 @@ static int ovs_ct_commit(struct net *netreturn 0 ; } +/* Trim the skb to the length specified by the IP/IPv6 header, +* removing any trailing lower-layer padding. This prepares the skb +* for higher-layer processing that assumes skb->len excludes padding +* (such as nf_ip_checksum). The caller needs to pull the skb to the +* network header, and ensure ip_hdr/ipv6_hdr points to valid data. +*/ +static int ovs_skb_network_trim (struct sk_buff *skb) +{ +unsigned int len; +int err; + +switch (skb->protocol) { +case htons (ETH_P_IP ): + len =ntohs (ip_hdr (skb)->tot_len); +break ; +case htons (ETH_P_IPV6 ): + len =sizeof (struct ipv6hdr ) + +ntohs (ipv6_hdr (skb)->payload_len); +break ; +default : + len = skb->len; + } + + err =pskb_trim_rcsum (skb, len); +if (err) +kfree_skb (skb); + +return err; +} +/* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero * value if 'skb' is freed. */
@@ -920,6 +950,10 @@ int ovs_ct_execute(struct net *net, stru nh_ofs =skb_network_offset (skb);skb_pull_rcsum (skb, nh_ofs); + err =ovs_skb_network_trim (skb); +if (err) +return err; +if (key->ip.frag !=OVS_FRAG_TYPE_NONE ) { err =handle_fragments (net, key, info->zone.id, skb);if (err)
Greg Kroah-Hartman
maintainerPATCH 76/329 IB/ipoib: Fix for potential no-carrier state
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Estrin <[email protected]>
[ Upstream commit 1029361084d18cc270f64dfd39529fafa10cfe01 ]
On reboot SM can program port pkey table before ipoib registered its event handler, which could result in missing pkey event and leave root interface with initial pkey value from index 0.
Since OPA port starts with invalid pkey in index 0, root interface will fail to initialize and stay down with no-carrier flag.
For IB ipoib interface may end up with pkey different from value opensm put in pkey table idx 0, resulting in connectivity issues (different mcast groups, for example).
Close the window by calling event handler after registration to make sure ipoib pkey is in sync with port pkey table.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -0
@@ -2119,6 +2119,9 @@ static struct net_device *ipoib_add_port goto event_failed; } +/* call event handler to ensure pkey in sync */ +queue_work (ipoib_workqueue, &priv->flush_heavy); + result =register_netdev (priv->dev);if (result) { printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
Greg Kroah-Hartman
maintainerPATCH 77/329 drm/nouveau/pmu/fuc: dont use movw directly anymore
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Herbst <[email protected]>
[ Upstream commit fe9748b7b41cee11f8db57fb8b20bc540a33102a ]
Fixes failure to compile with recent envyas as a result of the 'movw' alias being removed for v5.
A bit of history:
v3 only has a 16-bit sign-extended immediate mov op. In order to set the high bits, there's a separate 'sethi' op. envyas validates that the value passed to mov(imm) is between -0x8000 and 0x7fff. In order to simplify macros that load both the low and high word, a 'movw' alias was added which takes an unsigned 16-bit immediate. However the actual hardware op still sign extends.
v5 has a full 32-bit immediate mov op. The v3 16-bit immediate mov op is gone (loads 0 into the dst reg). However due to a bug in envyas, the movw alias still existed, and selected the no-longer-present v3 16-bit immediate mov op. As a result usage of movw on v5 is the same as mov with a 0x0 argument.
The proper fix throughout is to only ever use the 'movw' alias in combination with 'sethi'. Anything else should get the sign-extended validation to ensure that the intended value ends up in the destination register.
Changes in fuc3 binaries is the result of a different encoding being selected for a mov with an 8-bit value.
v2: added commit message written by Ilia, thanks for that!
v3: messed up rebasing, now it should apply
--- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h | 746 +++++------ drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h | 802 +++++------ drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h | 1006 +++++++-------- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/memx.fuc | 30 4 files changed, 1292 insertions(+), 1292 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h +373 -373
@@ -46,8 +46,8 @@ uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x584d454d , -0x00000756 , -0x00000748 , +0x00000754 , +0x00000746 ,0x00000000 ,0x00000000 , 0x00000000,
@@ -68,8 +68,8 @@ uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x46524550 , -0x0000075a ,0x00000758 , +0x00000756 ,0x00000000 ,0x00000000 , 0x00000000,
@@ -90,8 +90,8 @@ uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x5f433249 , -0x00000b8a , -0x00000a2d , +0x00000b88 , +0x00000a2b ,0x00000000 ,0x00000000 , 0x00000000,
@@ -112,8 +112,8 @@ uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x54534554 , -0x00000bb3 , -0x00000b8c , +0x00000bb1 , +0x00000b8a ,0x00000000 ,0x00000000 , 0x00000000,
@@ -134,8 +134,8 @@ uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x454c4449 , -0x00000bbf ,0x00000bbd , +0x00000bbb ,0x00000000 ,0x00000000 , 0x00000000,
@@ -236,19 +236,19 @@ uint32_t gf100_pmu_data[] = {0x000005d3 ,0x00000003 ,0x00000002 , -0x0000069d , +0x0000069b ,0x00040004 ,0x00000000 , -0x000006b9 , +0x000006b7 ,0x00010005 ,0x00000000 , -0x000006d6 , +0x000006d4 ,0x00010006 ,0x00000000 ,0x0000065b ,0x00000007 ,0x00000000 , -0x000006e1 , +0x000006df ,/* 0x03c4: memx_func_tail */ /* 0x03c4: memx_ts_start */ 0x00000000,
@@ -1372,432 +1372,432 @@ uint32_t gf100_pmu_code[] = {/* 0x065b: memx_func_wait_vblank */ 0x9800f840 ,0x66b00016 , -0x130bf400 , +0x120bf400 ,0xf40166b0 ,0x0ef4060b ,/* 0x066d: memx_func_wait_vblank_head1 */ -0x2077f12e , -0x070ef400 , -/* 0x0674: memx_func_wait_vblank_head0 */ -0x000877f1 , -/* 0x0678: memx_func_wait_vblank_0 */ -0x07c467f1 , -0xcf0664b6 , -0x67fd0066 , -0xf31bf404 , -/* 0x0688: memx_func_wait_vblank_1 */ -0x07c467f1 , -0xcf0664b6 , -0x67fd0066 , -0xf30bf404 , -/* 0x0698: memx_func_wait_vblank_fini */ -0xf80410b6 , -/* 0x069d: memx_func_wr32 */ -0x00169800 , -0xb6011598 , -0x60f90810 , -0xd0fc50f9 , -0x21f4e0fc , -0x0242b640 , -0xf8e91bf4 , -/* 0x06b9: memx_func_wait */ -0x2c87f000 , -0xcf0684b6 , -0x1e980088 , -0x011d9800 , -0x98021c98 , -0x10b6031b , -0xa321f410 , -/* 0x06d6: memx_func_delay */ -0x1e9800f8 , -0x0410b600 , -0xf87e21f4 , -/* 0x06e1: memx_func_train */ -/* 0x06e3: memx_exec */ -0xf900f800 , -0xb9d0f9e0 , -0xb2b902c1 , -/* 0x06ed: memx_exec_next */ -0x00139802 , -0xe70410b6 , -0xe701f034 , -0xb601e033 , -0x30f00132 , -0xde35980c , -0x12b855f9 , -0xe41ef406 , -0x98f10b98 , -0xcbbbf20c , -0xc4b7f102 , -0x06b4b607 , -0xfc00bbcf , -0xf5e0fcd0 , -0xf8033621 , -/* 0x0729: memx_info */ -0x01c67000 , -/* 0x072f: memx_info_data */ -0xf10e0bf4 , -0xf103ccc7 , -0xf40800b7 , -/* 0x073a: memx_info_train */ -0xc7f10b0e , -0xb7f10bcc , -/* 0x0742: memx_info_send */ -0x21f50100 , -0x00f80336 , -/* 0x0748: memx_recv */ -0xf401d6b0 , -0xd6b0980b , -0xd80bf400 , -/* 0x0756: memx_init */ -0x00f800f8 , -/* 0x0758: perf_recv */ -/* 0x075a: perf_init */ +0x2077f02c , +/* 0x0673: memx_func_wait_vblank_head0 */ +0xf0060ef4 , +/* 0x0676: memx_func_wait_vblank_0 */ +0x67f10877 , +0x64b607c4 , +0x0066cf06 , +0xf40467fd , +/* 0x0686: memx_func_wait_vblank_1 */ +0x67f1f31b , +0x64b607c4 , +0x0066cf06 , +0xf40467fd , +/* 0x0696: memx_func_wait_vblank_fini */ +0x10b6f30b , +/* 0x069b: memx_func_wr32 */ +0x9800f804 , +0x15980016 , +0x0810b601 , +0x50f960f9 , +0xe0fcd0fc , +0xb64021f4 , +0x1bf40242 , +/* 0x06b7: memx_func_wait */ +0xf000f8e9 , +0x84b62c87 , +0x0088cf06 , +0x98001e98 , +0x1c98011d , +0x031b9802 , +0xf41010b6 , +0x00f8a321 , +/* 0x06d4: memx_func_delay */ +0xb6001e98 , +0x21f40410 , +/* 0x06df: memx_func_train */ +0xf800f87e , +/* 0x06e1: memx_exec */ +0xf9e0f900 , +0x02c1b9d0 , +/* 0x06eb: memx_exec_next */ +0x9802b2b9 , +0x10b60013 , +0xf034e704 , +0xe033e701 , +0x0132b601 , +0x980c30f0 , +0x55f9de35 , +0xf40612b8 , +0x0b98e41e , +0xf20c98f1 , +0xf102cbbb , +0xb607c4b7 , +0xbbcf06b4 , +0xfcd0fc00 , +0x3621f5e0 , +/* 0x0727: memx_info */ +0x7000f803 , +0x0bf401c6 , +/* 0x072d: memx_info_data */ +0xccc7f10e , +0x00b7f103 , +0x0b0ef408 , +/* 0x0738: memx_info_train */ +0x0bccc7f1 , +0x0100b7f1 , +/* 0x0740: memx_info_send */ +0x033621f5 , +/* 0x0746: memx_recv */ +0xd6b000f8 , +0x980bf401 , +0xf400d6b0 , +0x00f8d80b , +/* 0x0754: memx_init */ +/* 0x0756: perf_recv */ 0x00f800f8 , -/* 0x075c: i2c_drive_scl */ -0xf40036b0 , -0x07f1110b , -0x04b607e0 , -0x0001d006 , -0x00f804bd , -/* 0x0770: i2c_drive_scl_lo */ -0x07e407f1 , -0xd00604b6 , -0x04bd0001 , -/* 0x077e: i2c_drive_sda */ +/* 0x0758: perf_init */ +/* 0x075a: i2c_drive_scl */ 0x36b000f8 ,0x110bf400 ,0x07e007f1 ,0xd00604b6 , -0x04bd0002 , -/* 0x0792: i2c_drive_sda_lo */ +0x04bd0001 , +/* 0x076e: i2c_drive_scl_lo */ 0x07f100f8 ,0x04b607e4 , +0x0001d006 , +0x00f804bd , +/* 0x077c: i2c_drive_sda */ +0xf40036b0 , +0x07f1110b , +0x04b607e0 ,0x0002d006 ,0x00f804bd , -/* 0x07a0: i2c_sense_scl */ -0xf10132f4 , -0xb607c437 , -0x33cf0634 , -0x0431fd00 , -0xf4060bf4 , -/* 0x07b6: i2c_sense_scl_done */ -0x00f80131 , -/* 0x07b8: i2c_sense_sda */ -0xf10132f4 , -0xb607c437 , -0x33cf0634 , -0x0432fd00 , -0xf4060bf4 , -/* 0x07ce: i2c_sense_sda_done */ -0x00f80131 , -/* 0x07d0: i2c_raise_scl */ -0x47f140f9 , -0x37f00898 , -0x5c21f501 , -/* 0x07dd: i2c_raise_scl_wait */ -0xe8e7f107 , -0x7e21f403 , -0x07a021f5 , -0xb60901f4 , -0x1bf40142 , -/* 0x07f1: i2c_raise_scl_done */ -0xf840fcef , -/* 0x07f5: i2c_start */ -0xa021f500 , -0x0d11f407 , -0x07b821f5 , -0xf40611f4 , -/* 0x0806: i2c_start_rep */ -0x37f0300e , -0x5c21f500 , -0x0137f007 , -0x077e21f5 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0xd021f550 , -0x0464b607 , -/* 0x0833: i2c_start_send */ -0xf01f11f4 , +/* 0x0790: i2c_drive_sda_lo */ +0x07e407f1 , +0xd00604b6 , +0x04bd0002 , +/* 0x079e: i2c_sense_scl */ +0x32f400f8 , +0xc437f101 , +0x0634b607 , +0xfd0033cf , +0x0bf40431 , +0x0131f406 , +/* 0x07b4: i2c_sense_scl_done */ +/* 0x07b6: i2c_sense_sda */ +0x32f400f8 , +0xc437f101 , +0x0634b607 , +0xfd0033cf , +0x0bf40432 , +0x0131f406 , +/* 0x07cc: i2c_sense_sda_done */ +/* 0x07ce: i2c_raise_scl */ +0x40f900f8 , +0x089847f1 , +0xf50137f0 , +/* 0x07db: i2c_raise_scl_wait */ +0xf1075a21 , +0xf403e8e7 , +0x21f57e21 , +0x01f4079e , +0x0142b609 , +/* 0x07ef: i2c_raise_scl_done */ +0xfcef1bf4 , +/* 0x07f3: i2c_start */ +0xf500f840 , +0xf4079e21 , +0x21f50d11 , +0x11f407b6 , +0x300ef406 , +/* 0x0804: i2c_start_rep */ +0xf50037f0 , +0xf0075a21 , +0x21f50137 , +0x76bb077c , +0x0465b600 , +0x659450f9 , +0x0256bb04 , +0x75fd50bd , +0xf550fc04 , +0xb607ce21 , +0x11f40464 , +/* 0x0831: i2c_start_send */ +0x0037f01f , +0x077c21f5 , +0x1388e7f1 , +0xf07e21f4 ,0x21f50037 , -0xe7f1077e , +0xe7f1075a ,0x21f41388 , -0x0037f07e , -0x075c21f5 , -0x1388e7f1 , -/* 0x084f: i2c_start_out */ -0xf87e21f4 , -/* 0x0851: i2c_stop */ -0x0037f000 , -0x075c21f5 , -0xf50037f0 , -0xf1077e21 , -0xf403e8e7 , -0x37f07e21 , -0x5c21f501 , -0x88e7f107 , -0x7e21f413 , +/* 0x084d: i2c_start_out */ +/* 0x084f: i2c_stop */ +0xf000f87e , +0x21f50037 , +0x37f0075a , +0x7c21f500 , +0xe8e7f107 , +0x7e21f403 ,0xf50137f0 , -0xf1077e21 , +0xf1075a21 ,0xf41388e7 , -0x00f87e21 , -/* 0x0884: i2c_bitw */ -0x077e21f5 , -0x03e8e7f1 , -0xbb7e21f4 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x07d021f5 , -0xf40464b6 , -0xe7f11811 , -0x21f41388 , -0x0037f07e , -0x075c21f5 , -0x1388e7f1 , -/* 0x08c3: i2c_bitw_out */ -0xf87e21f4 , -/* 0x08c5: i2c_bitr */ -0x0137f000 , -0x077e21f5 , -0x03e8e7f1 , -0xbb7e21f4 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x07d021f5 , -0xf40464b6 , -0x21f51b11 , -0x37f007b8 , -0x5c21f500 , +0x37f07e21 , +0x7c21f501 ,0x88e7f107 ,0x7e21f413 , -0xf4013cf0 , -/* 0x090a: i2c_bitr_done */ -0x00f80131 , -/* 0x090c: i2c_get_byte */ -0xf00057f0 , -/* 0x0912: i2c_get_byte_next */ -0x54b60847 , -0x0076bb01 , +/* 0x0882: i2c_bitw */ +0x21f500f8 , +0xe7f1077c , +0x21f403e8 , +0x0076bb7e ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b608c5 , -0x2b11f404 , -0xb60553fd , -0x1bf40142 , -0x0137f0d8 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0x8421f550 , -0x0464b608 , -/* 0x095c: i2c_get_byte_done */ -/* 0x095e: i2c_put_byte */ -0x47f000f8 , -/* 0x0961: i2c_put_byte_next */ -0x0142b608 , -0xbb3854ff , +0x64b607ce , +0x1811f404 , +0x1388e7f1 , +0xf07e21f4 , +0x21f50037 , +0xe7f1075a , +0x21f41388 , +/* 0x08c1: i2c_bitw_out */ +/* 0x08c3: i2c_bitr */ +0xf000f87e , +0x21f50137 , +0xe7f1077c , +0x21f403e8 , +0x0076bb7e , +0xf90465b6 , +0x04659450 , +0xbd0256bb , +0x0475fd50 , +0x21f550fc , +0x64b607ce , +0x1b11f404 , +0x07b621f5 , +0xf50037f0 , +0xf1075a21 , +0xf41388e7 , +0x3cf07e21 , +0x0131f401 , +/* 0x0908: i2c_bitr_done */ +/* 0x090a: i2c_get_byte */ +0x57f000f8 , +0x0847f000 , +/* 0x0910: i2c_get_byte_next */ +0xbb0154b6 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x088421f5 , +0x08c321f5 ,0xf40464b6 , -0x46b03411 , -0xd81bf400 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0xc521f550 , -0x0464b608 , -0xbb0f11f4 , -0x36b00076 , -0x061bf401 , -/* 0x09b7: i2c_put_byte_done */ -0xf80132f4 , -/* 0x09b9: i2c_addr */ -0x0076bb00 , +0x53fd2b11 , +0x0142b605 , +0xf0d81bf4 , +0x76bb0137 , +0x0465b600 , +0x659450f9 , +0x0256bb04 , +0x75fd50bd , +0xf550fc04 , +0xb6088221 , +/* 0x095a: i2c_get_byte_done */ +0x00f80464 , +/* 0x095c: i2c_put_byte */ +/* 0x095f: i2c_put_byte_next */ +0xb60847f0 , +0x54ff0142 , +0x0076bb38 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b607f5 , -0x2911f404 , -0x012ec3e7 , -0xfd0134b6 , -0x76bb0553 , +0x64b60882 , +0x3411f404 , +0xf40046b0 , +0x76bbd81b ,0x0465b600 ,0x659450f9 ,0x0256bb04 ,0x75fd50bd ,0xf550fc04 , -0xb6095e21 , -/* 0x09fe: i2c_addr_done */ -0x00f80464 , -/* 0x0a00: i2c_acquire_addr */ -0xb6f8cec7 , -0xe0b702e4 , -0xee980d1c , -/* 0x0a0f: i2c_acquire */ -0xf500f800 , -0xf40a0021 , -0xd9f00421 , -0x4021f403 , -/* 0x0a1e: i2c_release */ -0x21f500f8 , -0x21f40a00 , -0x03daf004 , -0xf84021f4 , -/* 0x0a2d: i2c_recv */ -0x0132f400 , -0xb6f8c1c7 , -0x16b00214 , -0x3a1ff528 , -0xf413a001 , -0x0032980c , -0x0ccc13a0 , -0xf4003198 , -0xd0f90231 , -0xd0f9e0f9 , -0x000067f1 , -0x100063f1 , -0xbb016792 , +0xb608c321 , +0x11f40464 , +0x0076bb0f , +0xf40136b0 , +0x32f4061b , +/* 0x09b5: i2c_put_byte_done */ +/* 0x09b7: i2c_addr */ +0xbb00f801 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x0a0f21f5 , -0xfc0464b6 , -0x00d6b0d0 , -0x00b31bf5 , -0xbb0057f0 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x09b921f5 , -0xf50464b6 , -0xc700d011 , -0x76bbe0c5 , -0x0465b600 , -0x659450f9 , -0x0256bb04 , -0x75fd50bd , -0xf550fc04 , -0xb6095e21 , -0x11f50464 , -0x57f000ad , +0x07f321f5 , +0xf40464b6 , +0xc3e72911 , +0x34b6012e , +0x0553fd01 , +0xb60076bb , +0x50f90465 , +0xbb046594 , +0x50bd0256 , +0xfc0475fd , +0x5c21f550 , +0x0464b609 , +/* 0x09fc: i2c_addr_done */ +/* 0x09fe: i2c_acquire_addr */ +0xcec700f8 , +0x02e4b6f8 , +0x0d1ce0b7 , +0xf800ee98 , +/* 0x0a0d: i2c_acquire */ +0xfe21f500 , +0x0421f409 , +0xf403d9f0 , +0x00f84021 , +/* 0x0a1c: i2c_release */ +0x09fe21f5 , +0xf00421f4 , +0x21f403da , +/* 0x0a2b: i2c_recv */ +0xf400f840 , +0xc1c70132 , +0x0214b6f8 , +0xf52816b0 , +0xa0013a1f , +0x980cf413 , +0x13a00032 , +0x31980ccc , +0x0231f400 , +0xe0f9d0f9 , +0x67f1d0f9 , +0x63f10000 , +0x67921000 ,0x0076bb01 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b609b9 , -0x8a11f504 , +0x64b60a0d , +0xb0d0fc04 , +0x1bf500d6 , +0x57f000b3 ,0x0076bb00 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b6090c , -0x6a11f404 , -0xbbe05bcb , +0x64b609b7 , +0xd011f504 , +0xe0c5c700 , +0xb60076bb , +0x50f90465 , +0xbb046594 , +0x50bd0256 , +0xfc0475fd , +0x5c21f550 , +0x0464b609 , +0x00ad11f5 , +0xbb0157f0 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x085121f5 , -0xb90464b6 , -0x74bd025b , -/* 0x0b33: i2c_recv_not_rd08 */ -0xb0430ef4 , -0x1bf401d6 , -0x0057f03d , -0x09b921f5 , -0xc73311f4 , -0x21f5e0c5 , -0x11f4095e , -0x0057f029 , -0x09b921f5 , -0xc71f11f4 , -0x21f5e0b5 , -0x11f4095e , -0x5121f515 , -0xc774bd08 , -0x1bf408c5 , -0x0232f409 , -/* 0x0b73: i2c_recv_not_wr08 */ -/* 0x0b73: i2c_recv_done */ -0xc7030ef4 , -0x21f5f8ce , -0xe0fc0a1e , -0x12f4d0fc , -0x027cb90a , -0x033621f5 , -/* 0x0b88: i2c_recv_exit */ -/* 0x0b8a: i2c_init */ -0x00f800f8 , -/* 0x0b8c: test_recv */ -0x05d817f1 , +0x09b721f5 , +0xf50464b6 , +0xbb008a11 , +0x65b60076 , +0x9450f904 , +0x56bb0465 , +0xfd50bd02 , +0x50fc0475 , +0x090a21f5 , +0xf40464b6 , +0x5bcb6a11 , +0x0076bbe0 , +0xf90465b6 , +0x04659450 , +0xbd0256bb , +0x0475fd50 , +0x21f550fc , +0x64b6084f , +0x025bb904 , +0x0ef474bd , +/* 0x0b31: i2c_recv_not_rd08 */ +0x01d6b043 , +0xf03d1bf4 , +0x21f50057 , +0x11f409b7 , +0xe0c5c733 , +0x095c21f5 , +0xf02911f4 , +0x21f50057 , +0x11f409b7 , +0xe0b5c71f , +0x095c21f5 , +0xf51511f4 , +0xbd084f21 , +0x08c5c774 , +0xf4091bf4 , +0x0ef40232 , +/* 0x0b71: i2c_recv_not_wr08 */ +/* 0x0b71: i2c_recv_done */ +0xf8cec703 , +0x0a1c21f5 , +0xd0fce0fc , +0xb90a12f4 , +0x21f5027c , +/* 0x0b86: i2c_recv_exit */ +0x00f80336 , +/* 0x0b88: i2c_init */ +/* 0x0b8a: test_recv */ +0x17f100f8 , +0x14b605d8 , +0x0011cf06 , +0xf10110b6 , +0xb605d807 , +0x01d00604 , +0xf104bd00 , +0xf1d900e7 , +0xf5134fe3 , +0xf8025621 , +/* 0x0bb1: test_init */ +0x00e7f100 , +0x5621f508 , +/* 0x0bbb: idle_recv */ +0xf800f802 , +/* 0x0bbd: idle */ +0x0031f400 , +0x05d417f1 ,0xcf0614b6 ,0x10b60011 , -0xd807f101 , +0xd407f101 ,0x0604b605 ,0xbd0001d0 , -0x00e7f104 , -0x4fe3f1d9 , -0x5621f513 , -/* 0x0bb3: test_init */ -0xf100f802 , -0xf50800e7 , -0xf8025621 , -/* 0x0bbd: idle_recv */ -/* 0x0bbf: idle */ -0xf400f800 , -0x17f10031 , -0x14b605d4 , -0x0011cf06 , -0xf10110b6 , -0xb605d407 , -0x01d00604 , -/* 0x0bdb: idle_loop */ -0xf004bd00 , -0x32f45817 , -/* 0x0be1: idle_proc */ -/* 0x0be1: idle_proc_exec */ -0xb910f902 , -0x21f5021e , -0x10fc033f , -0xf40911f4 , -0x0ef40231 , -/* 0x0bf5: idle_proc_next */ -0x5810b6ef , -0xf4061fb8 , -0x02f4e61b , -0x0028f4dd , -0x00bb0ef4 , +/* 0x0bd9: idle_loop */ +0x5817f004 , +/* 0x0bdf: idle_proc */ +/* 0x0bdf: idle_proc_exec */ +0xf90232f4 , +0x021eb910 , +0x033f21f5 , +0x11f410fc , +0x0231f409 , +/* 0x0bf3: idle_proc_next */ +0xb6ef0ef4 , +0x1fb85810 , +0xe61bf406 , +0xf4dd02f4 , +0x0ef40028 , +0x000000bb ,0x00000000 ,0x00000000 , 0x00000000,
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h +401 -401
917 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h +503 -503
1,125 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/memx.fuc +15 -15
@@ -82,15 +82,15 @@ memx_train_tail: // $r0 - zero memx_func_enter: #if NVKM_PPWR_CHIPSET == GT215 - movw $r8 0x1610 + mov $r8 0x1610 nv_rd32($r7, $r8) imm32($r6, 0xfffffffc) and $r7 $r6 - movw $r6 0x2 + mov $r6 0x2 or $r7 $r6 nv_wr32($r8, $r7) #else - movw $r6 0x001620 + mov $r6 0x001620 imm32($r7, ~0x00000aa2); nv_rd32($r8, $r6) and $r8 $r7
@@ -101,7 +101,7 @@ memx_func_enter: and $r8 $r7 nv_wr32($r6, $r8) - movw $r6 0x0026f0 + mov $r6 0x0026f0 nv_rd32($r8, $r6) and $r8 $r7 nv_wr32($r6, $r8)
@@ -136,19 +136,19 @@ memx_func_leave: bra nz #memx_func_leave_wait #if NVKM_PPWR_CHIPSET == GT215 - movw $r8 0x1610 + mov $r8 0x1610 nv_rd32($r7, $r8) imm32($r6, 0xffffffcc) and $r7 $r6 nv_wr32($r8, $r7) #else - movw $r6 0x0026f0 + mov $r6 0x0026f0 imm32($r7, 0x00000001) nv_rd32($r8, $r6) or $r8 $r7 nv_wr32($r6, $r8) - movw $r6 0x001620 + mov $r6 0x001620 nv_rd32($r8, $r6) or $r8 $r7 nv_wr32($r6, $r8)
@@ -177,11 +177,11 @@ memx_func_wait_vblank: bra #memx_func_wait_vblank_fini memx_func_wait_vblank_head1: - movw $r7 0x20 + mov $r7 0x20 bra #memx_func_wait_vblank_0 memx_func_wait_vblank_head0: - movw $r7 0x8 + mov $r7 0x8 memx_func_wait_vblank_0: nv_iord($r6, NV_PPWR_INPUT)
@@ -273,13 +273,13 @@ memx_func_train: // $r5 - outer loop counter // $r6 - inner loop counter // $r7 - entry counter (#memx_train_head + $r7) - movw $r5 0x3 - movw $r7 0x0 + mov $r5 0x3 + mov $r7 0x0 // Read random memory to wake up... things imm32($r9, 0x700000) nv_rd32($r8,$r9) - movw $r14 0x2710 + mov $r14 0x2710 call(nsec) memx_func_train_loop_outer:
@@ -289,9 +289,9 @@ memx_func_train: nv_wr32($r9, $r8) push $r5 - movw $r6 0x0 + mov $r6 0x0 memx_func_train_loop_inner: - movw $r8 0x1111 + mov $r8 0x1111 mulu $r9 $r6 $r8 shl b32 $r8 $r9 0x10 or $r8 $r9
@@ -315,7 +315,7 @@ memx_func_train: // $r5 - inner inner loop counter // $r9 - result - movw $r5 0 + mov $r5 0 imm32($r9, 0x8300ffff)
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Greg Kroah-Hartman
maintainerPATCH 78/329 netfilter: ipv6: nf_defrag: Kill frag queue on RFC2460 failure
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit ea23d5e3bf340e413b8e05c13da233c99c64142b ]
Failures were seen in ICMPv6 fragmentation timeout tests if they were run after the RFC2460 failure tests. Kernel was not sending out the ICMPv6 fragment reassembly time exceeded packet after the fragmentation reassembly timeout of 1 minute had elapsed.
This happened because the frag queue was not released if an error in IPv6 fragmentation header was detected by RFC2460.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -0
@@ -263,6 +263,7 @@ static int nf_ct_frag6_queue(struct frag* this case. -DaveM */ pr_debug ("end of fragment not rounded to 8 bytes.\n" ); +inet_frag_kill (&fq->q, &nf_frags);return -EPROTO ; }if (end > fq->q.len) {
Greg Kroah-Hartman
maintainerPATCH 79/329 x86/power: Fix swsusp_arch_resume prototype
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 328008a72d38b5bde6491e463405c34a81a65d3e ]
The declaration for swsusp_arch_resume marks it as 'asmlinkage', but the definition in x86-32 does not, and it fails to include the header with the declaration. This leads to a warning when building with link-time-optimizations:
kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
extern asmlinkage int swsusp_arch_resume(void);
^arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
int swsusp_arch_resume(void)
This moves the declaration into a globally visible header file and fixes up both x86 definitions to match it.
--- arch/x86/power/hibernate_32.c | 2 +- arch/x86/power/hibernate_64.c | 2 +- include/linux/suspend.h | 2 ++ kernel/power/power.h | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/power/hibernate_32.c +1 -1
@@ -142,7 +142,7 @@ static inline void resume_init_first_lev#endif } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
arch/x86/power/hibernate_64.c +1 -1
@@ -149,7 +149,7 @@ static int relocate_restore_code(void)return 0 ; } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
include/linux/suspend.h +2 -0
@@ -378,6 +378,8 @@ extern int swsusp_page_is_forbidden(struextern void swsusp_set_page_free (struct page *);extern void swsusp_unset_page_free (struct page *);extern unsigned long get_safe_page (gfp_t gfp_mask); +extern asmlinkage int swsusp_arch_suspend(void); +extern asmlinkage int swsusp_arch_resume(void);extern void hibernation_set_ops (const struct platform_hibernation_ops *ops);extern int hibernate (void );
kernel/power/power.h +0 -3
@@ -103,9 +103,6 @@ extern int in_suspend;extern dev_t swsusp_resume_device;extern sector_t swsusp_resume_block; -extern asmlinkage int swsusp_arch_suspend(void); -extern asmlinkage int swsusp_arch_resume(void); -extern int create_basic_memory_bitmaps (void );extern void free_basic_memory_bitmaps (void );extern int hibernate_preallocate_memory (void );
Greg Kroah-Hartman
maintainerPATCH 80/329 firmware: dmi_scan: Fix handling of empty DMI strings
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
[ Upstream commit a7770ae194569e96a93c48aceb304edded9cc648 ]
The handling of empty DMI strings looks quite broken to me:
* Strings from 1 to 7 spaces are not considered empty.
* True empty DMI strings (string index set to 0) are not considered empty, and result in allocating a 0-char string.
* Strings with invalid index also result in allocating a 0-char string.
* Strings starting with 8 spaces are all considered empty, even if non-space characters follow (sounds like a weird thing to do, but I have actually seen occurrences of this in DMI tables before.)
* Strings which are considered empty are reported as 8 spaces, instead of being actually empty.
Some of these issues are the result of an off-by-one error in memcmp, the rest is incorrect by design.
So let's get it square: missing strings and strings made of only spaces, regardless of their length, should be treated as empty and no memory should be allocated for them. All other strings are non-empty and should be allocated.
--- drivers/firmware/dmi_scan.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/firmware/dmi_scan.c +9 -13
@@ -18,7 +18,7 @@ EXPORT_SYMBOL_GPL(dmi_kobj);* of and an antecedent to, SMBIOS, which stands for System * Management BIOS. See further: http://www.dmtf.org/standards */ -static const char dmi_empty_string[] =" " ; +static const char dmi_empty_string[] ="" ;static u32 dmi_ver__initdata ;static u32 dmi_len;
@@ -44,25 +44,21 @@ static int dmi_memdev_nr;static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length; +const u8 *nsp;if (s) { - s--; -while (s >0 && *bp) { +while (--s >0 && *bp) bp +=strlen (bp) +1 ; - s--; - } -if (*bp !=0 ) { -size_t len =strlen (bp)+1 ; -size_t cmp_len = len >8 ?8 : len; - -if (!memcmp (bp, dmi_empty_string, cmp_len)) -return dmi_empty_string; +/* Strings containing only spaces are considered empty */ + nsp = bp; +while (*nsp ==' ' ) + nsp++; +if (*nsp !='\0' )return bp; - } } -return "" ; +return dmi_empty_string; }static const char *__init dmi_string (const struct dmi_header *dm,u8 s)
Greg Kroah-Hartman
maintainerPATCH 81/329 ACPI: processor_perflib: Do not send _PPC change notification if not ready
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
[ Upstream commit ba1edb9a5125a617d612f98eead14b9b84e75c3a ]
The following warning was triggered after resumed from S3 - if all the nonboot CPUs were put offline before suspend:
[ 1840.329515] unchecked MSR access error: RDMSR from 0x771 at rIP: 0xffffffff86061e3a (native_read_msr+0xa/0x30) [ 1840.329516] Call Trace: [ 1840.329521] __rdmsr_on_cpu+0x33/0x50 [ 1840.329525] generic_exec_single+0x81/0xb0 [ 1840.329527] smp_call_function_single+0xd2/0x100 [ 1840.329530] ? acpi_ds_result_pop+0xdd/0xf2 [ 1840.329532] ? acpi_ds_create_operand+0x215/0x23c [ 1840.329534] rdmsrl_on_cpu+0x57/0x80 [ 1840.329536] ? cpumask_next+0x1b/0x20 [ 1840.329538] ? rdmsrl_on_cpu+0x57/0x80 [ 1840.329541] intel_pstate_update_perf_limits+0xf3/0x220 [ 1840.329544] ? notifier_call_chain+0x4a/0x70 [ 1840.329546] intel_pstate_set_policy+0x4e/0x150 [ 1840.329548] cpufreq_set_policy+0xcd/0x2f0 [ 1840.329550] cpufreq_update_policy+0xb2/0x130 [ 1840.329552] ? cpufreq_update_policy+0x130/0x130 [ 1840.329556] acpi_processor_ppc_has_changed+0x65/0x80 [ 1840.329558] acpi_processor_notify+0x80/0x100 [ 1840.329561] acpi_ev_notify_dispatch+0x44/0x5c [ 1840.329563] acpi_os_execute_deferred+0x14/0x20 [ 1840.329565] process_one_work+0x193/0x3c0 [ 1840.329567] worker_thread+0x35/0x3b0 [ 1840.329569] kthread+0x125/0x140 [ 1840.329571] ? process_one_work+0x3c0/0x3c0 [ 1840.329572] ? kthread_park+0x60/0x60 [ 1840.329575] ? do_syscall_64+0x67/0x180 [ 1840.329577] ret_from_fork+0x25/0x30 [ 1840.329585] unchecked MSR access error: WRMSR to 0x774 (tried to write 0x0000000000000000) at rIP: 0xffffffff86061f78 (native_write_msr+0x8/0x30) [ 1840.329586] Call Trace: [ 1840.329587] __wrmsr_on_cpu+0x37/0x40 [ 1840.329589] generic_exec_single+0x81/0xb0 [ 1840.329592] smp_call_function_single+0xd2/0x100 [ 1840.329594] ? acpi_ds_create_operand+0x215/0x23c [ 1840.329595] ? cpumask_next+0x1b/0x20 [ 1840.329597] wrmsrl_on_cpu+0x57/0x70 [ 1840.329598] ? rdmsrl_on_cpu+0x57/0x80 [ 1840.329599] ? wrmsrl_on_cpu+0x57/0x70 [ 1840.329602] intel_pstate_hwp_set+0xd3/0x150 [ 1840.329604] intel_pstate_set_policy+0x119/0x150 [ 1840.329606] cpufreq_set_policy+0xcd/0x2f0 [ 1840.329607] cpufreq_update_policy+0xb2/0x130 [ 1840.329610] ? cpufreq_update_policy+0x130/0x130 [ 1840.329613] acpi_processor_ppc_has_changed+0x65/0x80 [ 1840.329615] acpi_processor_notify+0x80/0x100 [ 1840.329617] acpi_ev_notify_dispatch+0x44/0x5c [ 1840.329619] acpi_os_execute_deferred+0x14/0x20 [ 1840.329620] process_one_work+0x193/0x3c0 [ 1840.329622] worker_thread+0x35/0x3b0 [ 1840.329624] kthread+0x125/0x140 [ 1840.329625] ? process_one_work+0x3c0/0x3c0 [ 1840.329626] ? kthread_park+0x60/0x60 [ 1840.329628] ? do_syscall_64+0x67/0x180 [ 1840.329631] ret_from_fork+0x25/0x30
This is because if there's only one online CPU, the MSR_PM_ENABLE (package wide)can not be enabled after resumed, due to intel_pstate_hwp_enable() will only be invoked on AP's online process after resumed - if there's no AP online, the HWP remains disabled after resumed (BIOS has disabled it in S3). Then if there comes a _PPC change notification which touches HWP register during this stage, the warning is triggered.
Since we don't call acpi_processor_register_performance() when HWP is enabled, the pr->performance will be NULL. When this is NULL we don't need to do _PPC change notification.
--- drivers/acpi/processor_perflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_perflib.c +1 -1
@@ -161,7 +161,7 @@ int acpi_processor_ppc_has_changed(struc {int ret; -if (ignore_ppc) { +if (ignore_ppc || !pr->performance) {/* * Only when it is notification event, the _OST object * will be evaluated. Otherwise it is skipped.
Greg Kroah-Hartman
maintainerPATCH 82/329 ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 63347db0affadcbccd5613116ea8431c70139b3e ]
The acpi_get_bus_status wrapper for acpi_bus_get_status_handle has some code to handle certain device quirks, in some cases we also need this quirk handling for the initial _STA call.
Specifically on some devices calling _STA before all _DEP dependencies are met results in errors like these:
[ 0.123579] ACPI Error: No handler for Region [ECRM] (00000000ba9edc4c)
[GenericSerialBus] (20170831/evregion-166)
[ 0.123601] ACPI Error: Region GenericSerialBus (ID=9) has no handler
(20170831/exfldio-299)
[ 0.123618] ACPI Error: Method parse/execution failed
\_SB.I2C1.BAT1._STA, AE_NOT_EXIST (20170831/psparse-550)acpi_get_bus_status already has code to avoid this, so by using it we also silence these errors from the initial _STA call.
Note that in order for the acpi_get_bus_status handling for this to work, we initialize dep_unmet to 1 until acpi_device_dep_initialize gets called, this means that battery devices will be instantiated with an initial status of 0. This is not a problem, acpi_bus_attach will get called soon after the instantiation anyways and it will update the status as first point of order.
--- drivers/acpi/scan.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/scan.c +17 -3
@@ -1422,6 +1422,8 @@ void acpi_init_device_object(struct acpidevice_initialize (&device->dev);dev_set_uevent_suppress (&device->dev, true);acpi_init_coherency (device); +/* Assume there are unmet deps until acpi_device_dep_initialize() runs */ + device->dep_unmet =1 ; }void acpi_device_add_finalize (struct acpi_device *device)
@@ -1445,6 +1447,14 @@ static int acpi_add_single_object(struct }acpi_init_device_object (device, handle, type, sta); +/* +* For ACPI_BUS_TYPE_DEVICE getting the status is delayed till here so +* that we can call acpi_bus_get_status() and use its quirk handling. +* Note this must be done before the get power-/wakeup_dev-flags calls. +*/ +if (type ==ACPI_BUS_TYPE_DEVICE ) +acpi_bus_get_status (device); +acpi_bus_get_power_flags (device);acpi_bus_get_wakeup_device_flags (device);
@@ -1517,9 +1527,11 @@ static int acpi_bus_type_and_status(acpireturn -ENODEV ; *type =ACPI_BUS_TYPE_DEVICE ; - status =acpi_bus_get_status_handle (handle, sta); -if (ACPI_FAILURE (status)) - *sta =0 ; +/* +* acpi_add_single_object updates this once we've an acpi_device +* so that acpi_bus_get_status' quirk handling can be used. +*/ + *sta =0 ;break ;case ACPI_TYPE_PROCESSOR : *type =ACPI_BUS_TYPE_PROCESSOR ;
@@ -1621,6 +1633,8 @@ static void acpi_device_dep_initialize(sacpi_status status;int i; + adev->dep_unmet =0 ; +if (!acpi_has_method (adev->handle,"_DEP" ))return ;
Greg Kroah-Hartman
maintainerPATCH 83/329 bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 09584b406742413ac4c8d7e030374d4daa045b69 ]
With CONFIG_BPF_JIT_ALWAYS_ON is defined in the config file, tools/testing/selftests/bpf/test_kmod.sh failed like below:
[root@localhost bpf]# ./test_kmod.sh
sysctl: setting key "net.core.bpf_jit_enable": Invalid argument [ JIT enabled:0 hardened:0 ]
[ 132.175681] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 132.458834] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:0 ] [ 133.456025] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 133.730935] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:1 ] [ 134.769730] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 135.050864] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:2 ] [ 136.442882] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 136.821810] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [root@localhost bpf]#
The test_kmod.sh load/remove test_bpf.ko multiple times with different settings for sysctl net.core.bpf_jit_{enable,harden}. The failed test #297 of test_bpf.ko is designed such that JIT always fails.
Commit 290af86629b2 (bpf: introduce BPF_JIT_ALWAYS_ON config) introduced the following tightening logic:
...
if (!bpf_prog_is_dev_bound(fp->aux)) {
fp = bpf_int_jit_compile(fp);
#ifdef CONFIG_BPF_JIT_ALWAYS_ON
if (!fp->jited) {
*err = -ENOTSUPP;
return fp;
}
#endif
...With this logic, Test #297 always gets return value -ENOTSUPP when CONFIG_BPF_JIT_ALWAYS_ON is defined, causing the test failure.
This patch fixed the failure by marking Test #297 as expected failure when CONFIG_BPF_JIT_ALWAYS_ON is defined.
--- lib/test_bpf.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
lib/test_bpf.c +26 -5
@@ -83,6 +83,7 @@ struct bpf_test {__u32 result; } test[MAX_SUBTESTS ];int (*fill_helper)(struct bpf_test *self); +int expected_errcode;/* used when FLAG_EXPECTED_FAIL is set in the aux */ __u8 frag_data[MAX_DATA ]; };
@@ -1900,7 +1901,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: div_k_0",
@@ -1910,7 +1913,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: unknown insn",
@@ -1921,7 +1926,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: out of range spill/fill",
@@ -1931,7 +1938,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "JUMPS + HOLES",
@@ -2023,6 +2032,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { "check: LDX + RET X",
@@ -2033,6 +2044,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { /* Mainly checking JIT here. */ "M[]: alt STX + LDX",
@@ -2207,6 +2220,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { /* Passes checker but fails during runtime. */ "LD [SKF_AD_OFF-1]",
@@ -4803,6 +4818,7 @@ static struct bpf_test tests[] = { { }, { }, .fill_helper = bpf_fill_maxinsns4, + .expected_errcode = -EINVAL, }, {/* Mainly checking JIT here. */ "BPF_MAXINSNS: Very long jump",
@@ -4858,10 +4874,15 @@ static struct bpf_test tests[] = { { "BPF_MAXINSNS: Jump, gap, jump, ...", { }, +#ifdef CONFIG_BPF_JIT_ALWAYS_ON + CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, +#else CLASSIC | FLAG_NO_DATA, +#endif { }, { { 0, 0xababcbac } }, .fill_helper = bpf_fill_maxinsns11, + .expected_errcode = -ENOTSUPP, }, { "BPF_MAXINSNS: ld_abs+get_processor_id",
@@ -5632,7 +5653,7 @@ static struct bpf_prog *generate_filter( *err =bpf_prog_create (&fp, &fprog);if (tests[which].aux &FLAG_EXPECTED_FAIL ) { -if (*err == -EINVAL ) { +if (*err == tests[which].expected_errcode) {pr_cont ("PASS\n" );/* Verifier rejected filter as expected. */ *err =0 ;
Greg Kroah-Hartman
maintainerPATCH 84/329 MIPS: generic: Fix machine compatible matching
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
[ Upstream commit 9a9ab3078e2744a1a55163cfaec73a5798aae33e ]
We now have a platform (Ranchu) in the "generic" platform which matches based on the FDT compatible string using mips_machine_is_compatible(), however that function doesn't stop at a blank struct of_device_id::compatible as that is an array in the struct, not a pointer to a string.
Fix the loop completion to check the first byte of the compatible array rather than the address of the compatible array in the struct.
Patchwork: https://patchwork.linux-mips.org/patch/18580/
--- arch/mips/include/asm/machine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/machine.h +1 -1
@@ -52,7 +52,7 @@ mips_machine_is_compatible(const structif (!mach->matches)return NULL ; -for (match = mach->matches; match->compatible; match++) { +for (match = mach->matches; match->compatible[0 ]; match++) {if (fdt_node_check_compatible (fdt,0 , match->compatible) ==0 )return match; }
Greg Kroah-Hartman
maintainerPATCH 85/329 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Redfearn <[email protected]>
[ Upstream commit 0cde5b44a30f1daaef1c34e08191239dc63271c4 ]
When commit b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support") added board support for the RBTX4939, it added a call to led_classdev_register even if the LED class is built as a module. Built-in arch code cannot call module code directly like this. Commit b33b44073734 ("MIPS: TXX9: use IS_ENABLED() macro") subsequently changed the inclusion of this code to a single check that CONFIG_LEDS_CLASS is either builtin or a module, but the same issue remains.
This leads to MIPS allmodconfig builds failing when CONFIG_MACH_TX49XX=y is set:
arch/mips/txx9/rbtx4939/setup.o: In function `rbtx4939_led_probe':
setup.c:(.init.text+0xc0): undefined reference to `of_led_classdev_register'
make: *** [Makefile:999: vmlinux] Error 1
Fix this by using the IS_BUILTIN() macro instead.
Patchwork: https://patchwork.linux-mips.org/patch/18544/
--- arch/mips/txx9/rbtx4939/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/txx9/rbtx4939/setup.c +2 -2
@@ -186,7 +186,7 @@ static void __init rbtx4939_update_ioc_p#define RBTX4939_MAX_7SEGLEDS 8 -#if IS_ENABLED(CONFIG_LEDS_CLASS) +#if IS_BUILTIN(CONFIG_LEDS_CLASS) static u8 led_val[RBTX4939_MAX_7SEGLEDS]; struct rbtx4939_led_data { struct led_classdev cdev;
@@ -261,7 +261,7 @@ static inline void rbtx4939_led_setup(vostatic void __rbtx4939_7segled_putc (unsigned int pos,unsigned char val) { -#if IS_ENABLED (CONFIG_LEDS_CLASS ) +#if IS_BUILTIN (CONFIG_LEDS_CLASS )unsigned long flags;local_irq_save (flags);/* bit7: reserved for LED class */
Greg Kroah-Hartman
maintainerPATCH 86/329 xen-netfront: Fix race between device setup and open
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
[ Upstream commit f599c64fdf7d9c108e8717fb04bc41c680120da4 ]
When a netfront device is set up it registers a netdev fairly early on, before it has set up the queues and is actually usable. A userspace tool like NetworkManager will immediately try to open it and access its state as soon as it appears. The bug can be reproduced by hotplugging VIFs until the VM runs out of grant refs. It registers the netdev but fails to set up any queues (since there are no more grant refs). In the meantime, NetworkManager opens the device and the kernel crashes trying to access the queues (of which there are none).
Fix this in two ways:
* For initial setup, register the netdev much later, after the queues are setup. This avoids the race entirely.
* During a suspend/resume cycle, the frontend reconnects to the backend and the queues are recreated. It is possible (though highly unlikely) to race with something opening the device and accessing the queues after they have been destroyed but before they have been recreated. Extend the region covered by the rtnl semaphore to protect against this race. There is a possibility that we fail to recreate the queues so check for this in the open function.
--- drivers/net/xen-netfront.c | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-)
drivers/net/xen-netfront.c +24 -22
@@ -350,6 +350,9 @@ static int xennet_open(struct net_deviceunsigned int i =0 ;struct netfront_queue *queue =NULL ; +if (!np->queues) +return -ENODEV ; +for (i =0 ; i < num_queues; ++i) { queue = &np->queues[i];napi_enable (&queue->napi);
@@ -1377,18 +1380,8 @@ static int netfront_probe(struct xenbus_#ifdef CONFIG_SYSFS info->netdev->sysfs_groups[0 ] = &xennet_dev_group;#endif - err =register_netdev (info->netdev); -if (err) { -pr_warn ("%s: register_netdev err=%d\n" , __func__, err); - goto fail; - }return 0 ; - - fail: -xennet_free_netdev (netdev); -dev_set_drvdata (&dev->dev,NULL ); -return err; }static void xennet_end_access (int ref,void *page)
@@ -1757,8 +1750,6 @@ static void xennet_destroy_queues(struct {unsigned int i; -rtnl_lock (); -for (i =0 ; i < info->netdev->real_num_tx_queues; i++) {struct netfront_queue *queue = &info->queues[i];
@@ -1767,8 +1758,6 @@ static void xennet_destroy_queues(structnetif_napi_del (&queue->napi); } -rtnl_unlock (); -kfree (info->queues); info->queues =NULL ; }
@@ -1784,8 +1773,6 @@ static int xennet_create_queues(struct nif (!info->queues)return -ENOMEM ; -rtnl_lock (); -for (i =0 ; i < *num_queues; i++) {struct netfront_queue *queue = &info->queues[i];
@@ -1794,7 +1781,7 @@ static int xennet_create_queues(struct n ret =xennet_init_queue (queue);if (ret <0 ) { -dev_warn (&info->netdev->dev, +dev_warn (&info->xbdev->dev,"only created %d queues\n" , i); *num_queues = i;break ;
@@ -1808,10 +1795,8 @@ static int xennet_create_queues(struct nnetif_set_real_num_tx_queues (info->netdev, *num_queues); -rtnl_unlock (); -if (*num_queues ==0 ) { -dev_err (&info->netdev->dev,"no queues\n" ); +dev_err (&info->xbdev->dev,"no queues\n" );return -EINVAL ; }return 0 ;
@@ -1853,6 +1838,7 @@ static int talk_to_netback(struct xenbus goto out; } +rtnl_lock ();if (info->queues)xennet_destroy_queues (info);
@@ -1863,6 +1849,7 @@ static int talk_to_netback(struct xenbus info->queues =NULL ; goto out; } +rtnl_unlock ();/* Create shared ring, alloc event channel -- for each queue */ for (i =0 ; i < num_queues; ++i) {
@@ -1959,8 +1946,10 @@ abort_transaction_no_dev_fatal:xenbus_transaction_end (xbt,1 ); destroy_ring:xennet_disconnect_backend (info); +rtnl_lock ();xennet_destroy_queues (info); out: +rtnl_unlock ();device_unregister (&dev->dev);return err; }
@@ -1996,6 +1985,15 @@ static int xennet_connect(struct net_devnetdev_update_features (dev);rtnl_unlock (); +if (dev->reg_state ==NETREG_UNINITIALIZED ) { + err =register_netdev (dev); +if (err) { +pr_warn ("%s: register_netdev err=%d\n" , __func__, err); +device_unregister (&np->xbdev->dev); +return err; + } + } +/* * All public and private state should now be sane. Get * ready to start sending and receiving packets and give the driver
@@ -2186,10 +2184,14 @@ static int xennet_remove(struct xenbus_dxennet_disconnect_backend (info); -unregister_netdev (info->netdev); +if (info->netdev->reg_state ==NETREG_REGISTERED ) +unregister_netdev (info->netdev); -if (info->queues) +if (info->queues) { +rtnl_lock ();xennet_destroy_queues (info); +rtnl_unlock (); + }xennet_free_netdev (info->netdev);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 87/329 xen/grant-table: Use put_page instead of free_page
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
[ Upstream commit 3ac7292a25db1c607a50752055a18aba32ac2176 ]
The page given to gnttab_end_foreign_access() to free could be a compound page so use put_page() instead of free_page() since it can handle both compound and single pages correctly.
This bug was discovered when migrating a Xen VM with several VIFs and CONFIG_DEBUG_VM enabled. It hits a BUG usually after fewer than 10 iterations. All netfront devices disconnect from the backend during a suspend/resume and this will call gnttab_end_foreign_access() if a netfront queue has an outstanding skb. The mismatch between calling get_page() and free_page() on a compound page causes a reference counting error which is detected when DEBUG_VM is enabled.
--- drivers/xen/grant-table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/grant-table.c +2 -2
@@ -327,7 +327,7 @@ static void gnttab_handle_deferred(unsigif (entry->page) {pr_debug ("freeing g.e. %#x (pfn %#lx)\n" , entry->ref,page_to_pfn (entry->page)); -__free_page (entry->page); +put_page (entry->page); }else pr_info ("freeing g.e. %#x\n" , entry->ref);kfree (entry);
@@ -383,7 +383,7 @@ void gnttab_end_foreign_access(grant_refif (gnttab_end_foreign_access_ref (ref, readonly)) {put_free_entry (ref);if (page !=0 ) -free_page (page); +put_page (virt_to_page (page)); }else gnttab_add_deferred (ref, readonly, page ?virt_to_page (page) :NULL );
Greg Kroah-Hartman
maintainerPATCH 88/329 RDS: IB: Fix null pointer issue
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanglei Li <[email protected]>
[ Upstream commit 2c0aa08631b86a4678dbc93b9caa5248014b4458 ]
Scenario:
1. Port down and do fail over
2. Ap do rds_bind syscall
PID: 47039 TASK: ffff89887e2fe640 CPU: 47 COMMAND: "kworker/u:6"
#0 [ffff898e35f159f0] machine_kexec at ffffffff8103abf9 #1 [ffff898e35f15a60] crash_kexec at ffffffff810b96e3 #2 [ffff898e35f15b30] oops_end at ffffffff8150f518
#3 [ffff898e35f15b60] no_context at ffffffff8104854c
#4 [ffff898e35f15ba0] __bad_area_nosemaphore at ffffffff81048675 #5 [ffff898e35f15bf0] bad_area_nosemaphore at ffffffff810487d3 #6 [ffff898e35f15c00] do_page_fault at ffffffff815120b8 #7 [ffff898e35f15d10] page_fault at ffffffff8150ea95
[exception RIP: unknown or invalid address]
RIP: 0000000000000000 RSP: ffff898e35f15dc8 RFLAGS: 00010282
RAX: 00000000fffffffe RBX: ffff889b77f6fc00 RCX:ffffffff81c99d88
RDX: 0000000000000000 RSI: ffff896019ee08e8 RDI:ffff889b77f6fc00
RBP: ffff898e35f15df0 R8: ffff896019ee08c8 R9:0000000000000000
R10: 0000000000000400 R11: 0000000000000000 R12:ffff896019ee08c0
R13: ffff889b77f6fe68 R14: ffffffff81c99d80 R15: ffffffffa022a1e0
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #8 [ffff898e35f15dc8] cma_ndev_work_handler at ffffffffa022a228 [rdma_cm] #9 [ffff898e35f15df8] process_one_work at ffffffff8108a7c6 #10 [ffff898e35f15e58] worker_thread at ffffffff8108bda0
#11 [ffff898e35f15ee8] kthread at ffffffff81090fe6
PID: 45659 TASK: ffff880d313d2500 CPU: 31 COMMAND: "oracle_45659_ap"
#0 [ffff881024ccfc98] __schedule at ffffffff8150bac4
#1 [ffff881024ccfd40] schedule at ffffffff8150c2cf
#2 [ffff881024ccfd50] __mutex_lock_slowpath at ffffffff8150cee7 #3 [ffff881024ccfdc0] mutex_lock at ffffffff8150cdeb
#4 [ffff881024ccfde0] rdma_destroy_id at ffffffffa022a027 [rdma_cm] #5 [ffff881024ccfe10] rds_ib_laddr_check at ffffffffa0357857 [rds_rdma] #6 [ffff881024ccfe50] rds_trans_get_preferred at ffffffffa0324c2a [rds] #7 [ffff881024ccfe80] rds_bind at ffffffffa031d690 [rds]
#8 [ffff881024ccfeb0] sys_bind at ffffffff8142a670
PID: 45659 PID: 47039rds_ib_laddr_check
/* create id_priv with a null event_handler */ rdma_create_id
rdma_bind_addr
cma_acquire_dev
/* add id_priv to cma_dev->id_list */
cma_attach_to_dev
cma_ndev_work_handler
/* event_hanlder is null */
id_priv->id.event_handler--- net/rds/ib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/rds/ib.c +2 -1
@@ -336,7 +336,8 @@ static int rds_ib_laddr_check(struct net/* Create a CMA ID and try to bind it. This catches both * IB and iWARP capable NICs. */ - cm_id =rdma_create_id (&init_net,NULL ,NULL ,RDMA_PS_TCP ,IB_QPT_RC ); + cm_id =rdma_create_id (&init_net, rds_rdma_cm_event_handler, +NULL ,RDMA_PS_TCP ,IB_QPT_RC );if (IS_ERR (cm_id))return PTR_ERR (cm_id);
Greg Kroah-Hartman
maintainerPATCH 89/329 arm64: spinlock: Fix theoretical trylock() A-B-A with LSE atomics
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 202fb4ef81e3ec765c23bd1e6746a5c25b797d0e ]
If the spinlock "next" ticket wraps around between the initial LDR and the cmpxchg in the LSE version of spin_trylock, then we can erroneously think that we have successfuly acquired the lock because we only check whether the next ticket return by the cmpxchg is equal to the owner ticket in our updated lock word.
This patch fixes the issue by performing a full 32-bit check of the lock word when trying to determine whether or not the CASA instruction updated memory.
--- arch/arm64/include/asm/spinlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/spinlock.h +2 -2
@@ -141,8 +141,8 @@ static inline int arch_spin_trylock(arch" cbnz %w1, 1f\n" " add %w1, %w0, %3\n" " casa %w0, %w1, %2\n" -" and %w1, %w1, #0xffff\n" -" eor %w1, %w1, %w0, lsr #16\n" +" sub %w1, %w1, %3\n" +" eor %w1, %w1, %w0\n" "1:") : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) : "I" (1 << TICKET_SHIFT)
Greg Kroah-Hartman
maintainerPATCH 90/329 proc: fix /proc/*/map_files lookup
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Dobriyan <[email protected]>
[ Upstream commit ac7f1061c2c11bb8936b1b6a94cdb48de732f7a4 ]
Current code does:
if (sscanf(dentry->d_name.name, "%lx-%lx", start, end) != 2)
However sscanf() is broken garbage.
It silently accepts whitespace between format specifiers (did you know that?).
It silently accepts valid strings which result in integer overflow.
Do not use sscanf() for any even remotely reliable parsing code.
OK # readlink '/proc/1/map_files/55a23af39000-55a23b05b000' /lib/systemd/systemd broken # readlink '/proc/1/map_files/ 55a23af39000-55a23b05b000' /lib/systemd/systemd broken # readlink '/proc/1/map_files/55a23af39000-55a23b05b000 ' /lib/systemd/systemd very broken # readlink '/proc/1/map_files/1000000000000000055a23af39000-55a23b05b000' /lib/systemd/systemd
Andrei said:
: This patch breaks criu. It was a bug in criu. And this bug is on a minor : path, which works when memfd_create() isn't available. It is a reason why : I ask to not backport this patch to stable kernels.
:
: In CRIU this bug can be triggered, only if this patch will be backported : to a kernel which version is lower than v3.16.
--- fs/proc/base.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
fs/proc/base.c +28 -1
@@ -94,6 +94,8 @@#include "internal.h" #include "fd.h" +#include "../../lib/kstrtox.h" +/* NOTE: * Implementing inode permission operations in /proc is almost * certainly an error. Permission checks need to happen during
@@ -1864,8 +1866,33 @@ end_instantiate:static int dname_to_vma_addr (struct dentry *dentry,unsigned long *start,unsigned long *end) { -if (sscanf (dentry->d_name.name,"%lx-%lx" , start, end) !=2 ) +const char *str = dentry->d_name.name; +unsigned long long sval, eval; +unsigned int len; + + len =_parse_integer (str,16 , &sval); +if (len &KSTRTOX_OVERFLOW ) +return -EINVAL ; +if (sval != (unsigned long )sval)return -EINVAL ; + str += len; + +if (*str !='-' ) +return -EINVAL ; + str++; + + len =_parse_integer (str,16 , &eval); +if (len &KSTRTOX_OVERFLOW ) +return -EINVAL ; +if (eval != (unsigned long )eval) +return -EINVAL ; + str += len; + +if (*str !='\0' ) +return -EINVAL ; + + *start = sval; + *end = eval;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 91/329 cifs: silence compiler warnings showing up with gcc-8.0.0
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit ade7db991b47ab3016a414468164f4966bd08202 ]
This bug was fixed before, but came up again with the latest compiler in another function:
fs/cifs/cifssmb.c: In function 'CIFSSMBSetEA':fs/cifs/cifssmb.c:6362:3: error: 'strncpy' offset 8 is out of the bounds [0, 4] [-Werror=array-bounds]
strncpy(parm_data->list[0].name, ea_name, name_len);
Let's apply the same fix that was used for the other instances.
--- fs/cifs/cifssmb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/cifs/cifssmb.c +1 -3
@@ -6413,9 +6413,7 @@ SetEARetry: pSMB->InformationLevel =cpu_to_le16 (SMB_SET_FILE_EA ); - parm_data = - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data = (void *)pSMB + offsetof(struct smb_hdr , Protocol) + offset; pSMB->ParameterOffset =cpu_to_le16 (param_offset); pSMB->DataOffset =cpu_to_le16 (offset); pSMB->SetupCount =1 ;
Greg Kroah-Hartman
maintainerPATCH 92/329 bcache: properly set task state in bch_writeback_thread()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
[ Upstream commit 99361bbf26337186f02561109c17a4c4b1a7536a ]
Kernel thread routine bch_writeback_thread() has the following code block,
447 down_write(&dc->writeback_lock);
448~450 if (check conditions) {
451 up_write(&dc->writeback_lock);
452 set_current_state(TASK_INTERRUPTIBLE);
453
454 if (kthread_should_stop())
455 return 0;
456
457 schedule();
458 continue;
459 }
If condition check is true, its task state is set to TASK_INTERRUPTIBLE and call schedule() to wait for others to wake up it.
There are 2 issues in current code,
1, Task state is set to TASK_INTERRUPTIBLE after the condition checks, if
another process changes the condition and call wake_up_process(dc-> writeback_thread), then at line 452 task state is set back to TASK_INTERRUPTIBLE, the writeback kernel thread will lose a chance to be waken up.
2, At line 454 if kthread_should_stop() is true, writeback kernel thread
will return to kernel/kthread.c:kthread() with TASK_INTERRUPTIBLE and call do_exit(). It is not good to enter do_exit() with task state TASK_INTERRUPTIBLE, in following code path might_sleep() is called and a warning message is reported by __might_sleep(): "WARNING: do not call blocking ops when !TASK_RUNNING; state=1 set at [xxxx]".
For the first issue, task state should be set before condition checks. Ineed because dc->writeback_lock is required when modifying all the conditions, calling set_current_state() inside code block where dc-> writeback_lock is hold is safe. But this is quite implicit, so I still move set_current_state() before all the condition checks.
For the second issue, frankley speaking it does not hurt when kernel thread exits with TASK_INTERRUPTIBLE state, but this warning message scares users, makes them feel there might be something risky with bcache and hurt their data. Setting task state to TASK_RUNNING before returning fixes this problem.
In alloc.c:allocator_wait(), there is also a similar issue, and is also fixed in this patch.
Changelog:
v3: merge two similar fixes into one patch
v2: fix the race issue in v1 patch.
v1: initial buggy fix.
--- drivers/md/bcache/alloc.c | 4 +++- drivers/md/bcache/writeback.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/md/bcache/alloc.c +3 -1
@@ -284,8 +284,10 @@ do { \break ; \ \mutex_unlock (&(ca)->set->bucket_lock); \ -if (kthread_should_stop ()) \ +if (kthread_should_stop ()) { \ +set_current_state (TASK_RUNNING ); \return 0 ; \ + } \ \schedule (); \mutex_lock (&(ca)->set->bucket_lock); \
drivers/md/bcache/writeback.c +5 -2
@@ -420,18 +420,21 @@ static int bch_writeback_thread(void *arwhile (!kthread_should_stop ()) {down_write (&dc->writeback_lock); +set_current_state (TASK_INTERRUPTIBLE );if (!atomic_read (&dc->has_dirty) || (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && !dc->writeback_running)) {up_write (&dc->writeback_lock); -set_current_state (TASK_INTERRUPTIBLE ); -if (kthread_should_stop ()) +if (kthread_should_stop ()) { +set_current_state (TASK_RUNNING );return 0 ; + }schedule ();continue ; } +set_current_state (TASK_RUNNING ); searched_full_index =refill_dirty (dc);
Greg Kroah-Hartman
maintainerPATCH 94/329 bcache: fix for data collapse after re-attaching an attached device
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tang Junhui <[email protected]>
[ Upstream commit 73ac105be390c1de42a2f21643c9778a5e002930 ]
back-end device sdm has already attached a cache_set with ID f67ebe1f-f8bc-4d73-bfe5-9dc88607f119, then try to attach with another cache set, and it returns with an error:
[root]# cd /sys/block/sdm/bcache
[root]# echo 5ccd0a63-148e-48b8-afa2-aca9cbd6279f > attach -bash: echo: write error: Invalid argument
After that, execute a command to modify the label of bcache device:
[root]# echo data_disk1 > label
Then we reboot the system, when the system power on, the back-end device can not attach to cache_set, a messages show in the log:
Feb 5 12:05:52 ceph152 kernel: [922385.508498] bcache:
bch_cached_dev_attach() couldn't find uuid for sdm in set
In sysfs_attach(), dc->sb.set_uuid was assigned to the value which input through sysfs, no matter whether it is success or not in bch_cached_dev_attach(). For example, If the back-end device has already attached to an cache set, bch_cached_dev_attach() would fail, but dc->sb.set_uuid was changed. Then modify the label of bcache device, it will call bch_write_bdev_super(), which would write the dc->sb.set_uuid to the super block, so we record a wrong cache set ID in the super block, after the system reboot, the cache set couldn't find the uuid of the back-end device, so the bcache device couldn't exist and use any more.
In this patch, we don't assigned cache set ID to dc->sb.set_uuid in sysfs_attach() directly, but input it into bch_cached_dev_attach(), and assigned dc->sb.set_uuid to the cache set ID after the back-end device attached to the cache set successful.
--- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/super.c | 10 ++++++---- drivers/md/bcache/sysfs.c | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-)
drivers/md/bcache/bcache.h +1 -1
@@ -904,7 +904,7 @@ void bcache_write_super(struct cache_setint bch_flash_dev_create (struct cache_set *c,uint64_t size); -int bch_cached_dev_attach (struct cached_dev *,struct cache_set *); +int bch_cached_dev_attach (struct cached_dev *,struct cache_set *,uint8_t *);void bch_cached_dev_detach (struct cached_dev *);void bch_cached_dev_run (struct cached_dev *);void bcache_device_stop (struct bcache_device *);
drivers/md/bcache/super.c +6 -4
@@ -938,7 +938,8 @@ void bch_cached_dev_detach(struct cachedcached_dev_put (dc); } -int bch_cached_dev_attach (struct cached_dev *dc,struct cache_set *c) +int bch_cached_dev_attach (struct cached_dev *dc,struct cache_set *c, +uint8_t *set_uuid) {uint32_t rtime =cpu_to_le32 (get_seconds ());struct uuid_entry *u;
@@ -947,7 +948,8 @@ int bch_cached_dev_attach(struct cached_bdevname (dc->bdev, buf); -if (memcmp (dc->sb.set_uuid, c->sb.set_uuid,16 )) +if ((set_uuid &&memcmp (set_uuid, c->sb.set_uuid,16 )) || + (!set_uuid &&memcmp (dc->sb.set_uuid, c->sb.set_uuid,16 )))return -ENOENT ;if (dc->disk.c) {
@@ -1191,7 +1193,7 @@ static void register_bdev(struct cache_slist_add (&dc->list, &uncached_devices);list_for_each_entry (c, &bch_cache_sets, list) -bch_cached_dev_attach (dc, c); +bch_cached_dev_attach (dc, c,NULL );if (BDEV_STATE (&dc->sb) ==BDEV_STATE_NONE ||BDEV_STATE (&dc->sb) ==BDEV_STATE_STALE )
@@ -1714,7 +1716,7 @@ static void run_cache_set(struct cache_sbcache_write_super (c);list_for_each_entry_safe (dc, t, &uncached_devices, list) -bch_cached_dev_attach (dc, c); +bch_cached_dev_attach (dc, c,NULL );flash_devs_run (c);
drivers/md/bcache/sysfs.c +4 -2
@@ -263,11 +263,13 @@ STORE(__cached_dev) }if (attr == &sysfs_attach) { -if (bch_parse_uuid (buf, dc->sb.set_uuid) <16 ) +uint8_t set_uuid[16 ]; + +if (bch_parse_uuid (buf, set_uuid) <16 )return -EINVAL ;list_for_each_entry (c, &bch_cache_sets, list) { - v =bch_cached_dev_attach (dc, c); + v =bch_cached_dev_attach (dc, c, set_uuid);if (!v)return size; }
Greg Kroah-Hartman
maintainerPATCH 95/329 bcache: return attach error when no cache set exist
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tang Junhui <[email protected]>
[ Upstream commit 7f4fc93d4713394ee8f1cd44c238e046e11b4f15 ]
I attach a back-end device to a cache set, and the cache set is not registered yet, this back-end device did not attach successfully, and no error returned:
[root]# echo 87859280-fec6-4bcc-20df7ca8f86b > /sys/block/sde/bcache/attach [root]#
In sysfs_attach(), the return value "v" is initialized to "size" in the beginning, and if no cache set exist in bch_cache_sets, the "v" value would not change any more, and return to sysfs, sysfs regard it as success since the "size" is a positive number.
This patch fixes this issue by assigning "v" with "-ENOENT" in the initialization.
--- drivers/md/bcache/sysfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/bcache/sysfs.c +3 -2
@@ -191,7 +191,7 @@ STORE(__cached_dev) { struct cached_dev *dc = container_of(kobj, struct cached_dev, disk.kobj); -ssize_t v = size; +ssize_t v;struct cache_set *c;struct kobj_uevent_env *env;
@@ -268,6 +268,7 @@ STORE(__cached_dev)if (bch_parse_uuid (buf, set_uuid) <16 )return -EINVAL ; + v = -ENOENT ;list_for_each_entry (c, &bch_cache_sets, list) { v =bch_cached_dev_attach (dc, c, set_uuid);if (!v)
@@ -275,7 +276,7 @@ STORE(__cached_dev) }pr_err ("Can't attach %s: cache set not found" , buf); - size = v; +return v; }if (attr == &sysfs_detach && dc->disk.c)
Greg Kroah-Hartman
maintainerPATCH 96/329 tools/libbpf: handle issues with bpf ELF objects containing .eh_frames
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit e3d91b0ca523d53158f435a3e13df7f0cb360ea2 ]
V3: More generic skipping of relo-section (suggested by Daniel)
If clang >= 4.0.1 is missing the option '-target bpf', it will cause llc/llvm to create two ELF sections for "Exception Frames", with section names '.eh_frame' and '.rel.eh_frame'.
The BPF ELF loader library libbpf fails when loading files with these sections. The other in-kernel BPF ELF loader in samples/bpf/bpf_load.c, handle this gracefully. And iproute2 loader also seems to work with these "eh" sections.
The issue in libbpf is caused by bpf_object__elf_collect() skipping some sections, and later when performing relocation it will be pointing to a skipped section, as these sections cannot be found by bpf_object__find_prog_by_idx() in bpf_object__collect_reloc().
This is a general issue that also occurs for other sections, like debug sections which are also skipped and can have relo section.
As suggested by Daniel. To avoid keeping state about all skipped sections, instead perform a direct qlookup in the ELF object. Lookup the section that the relo-section points to and check if it contains executable machine instructions (denoted by the sh_flags SHF_EXECINSTR). Use this check to also skip irrelevant relo-sections.
Note, for samples/bpf/ the '-target bpf' parameter to clang cannot be used due to incompatibility with asm embedded headers, that some of the samples include. This is explained in more details by Yonghong Song in bpf_devel_QA.
--- tools/lib/bpf/libbpf.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
tools/lib/bpf/libbpf.c +26 -0
@@ -590,6 +590,24 @@ bpf_object__init_maps_name(struct bpf_obreturn 0 ; } +static bool section_have_execinstr (struct bpf_object *obj,int idx) +{ +Elf_Scn *scn; +GElf_Shdr sh; + + scn =elf_getscn (obj->efile.elf, idx); +if (!scn) +return false; + +if (gelf_getshdr (scn, &sh) != &sh) +return false; + +if (sh.sh_flags &SHF_EXECINSTR ) +return true; + +return false; +} +static int bpf_object__elf_collect (struct bpf_object *obj) {Elf *elf = obj->efile.elf;
@@ -673,6 +691,14 @@ static int bpf_object__elf_collect(struc }else if (sh.sh_type ==SHT_REL ) {void *reloc = obj->efile.reloc;int nr_reloc = obj->efile.nr_reloc +1 ; +int sec = sh.sh_info;/* points to other section */ + +/* Only do relo for section with exec instructions */ +if (!section_have_execinstr (obj, sec)) { +pr_debug ("skip relo %s(%d) for section(%d)\n" , + name, idx, sec); +continue ; + } reloc =realloc (reloc,sizeof (*obj->efile.reloc) * nr_reloc);
Greg Kroah-Hartman
maintainerPATCH 97/329 bpf: fix rlimit in reuseport net selftest
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 941ff6f11c020913f5cddf543a9ec63475d7c082 ]
Fix two issues in the reuseport_bpf selftests that were reported by Linaro CI:
[...]
+ ./reuseport_bpf
---- IPv4 UDP ----
Testing EBPF mod 10...
Reprograming, testing mod 5...
./reuseport_bpf: ebpf error. log:
0: (bf) r6 = r1
1: (20) r0 = *(u32 *)skb[0]
2: (97) r0 %= 10
3: (95) exit
processed 4 insns
: Operation not permitted
+ echo FAIL
[...]
---- IPv4 TCP ----
Testing EBPF mod 10...
./reuseport_bpf: failed to bind send socket: Address already in use
+ echo FAIL
[...]
For the former adjust rlimit since this was the cause of failure for loading the BPF prog, and for the latter add SO_REUSEADDR.
--- tools/testing/selftests/net/reuseport_bpf.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
tools/testing/selftests/net/reuseport_bpf.c +20 -1
@@ -21,6 +21,7 @@#include <sys/epoll.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/resource.h> #include <unistd.h> #ifndef ARRAY_SIZE
@@ -190,11 +191,14 @@ static void send_from(struct test_paramsstruct sockaddr *const saddr =new_any_sockaddr (p.send_family, sport);struct sockaddr *const daddr =new_loopback_sockaddr (p.send_family, p.recv_port); -const int fd =socket (p.send_family, p.protocol,0 ); +const int fd =socket (p.send_family, p.protocol,0 ), one =1 ;if (fd <0 )error (1 , errno,"failed to create send socket" ); +if (setsockopt (fd,SOL_SOCKET ,SO_REUSEADDR , &one,sizeof (one))) +error (1 , errno,"failed to set reuseaddr" ); +if (bind (fd, saddr,sockaddr_size ()))error (1 , errno,"failed to bind send socket" );
@@ -433,6 +437,21 @@ void enable_fastopen(void) } } +static struct rlimit rlim_old, rlim_new; + +static __attribute__((constructor))void main_ctor (void ) +{ +getrlimit (RLIMIT_MEMLOCK , &rlim_old); + rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL <<20 ); + rlim_new.rlim_max = rlim_old.rlim_max + (1UL <<20 ); +setrlimit (RLIMIT_MEMLOCK , &rlim_new); +} + +static __attribute__((destructor))void main_dtor (void ) +{ +setrlimit (RLIMIT_MEMLOCK , &rlim_old); +} +int main (void ) {fprintf (stderr,"---- IPv4 UDP ----\n" );
Greg Kroah-Hartman
maintainerPATCH 98/329 vfs/proc/kcore, x86/mm/kcore: Fix SMAP fault when dumping vsyscall user page
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Zhang <[email protected]>
[ Upstream commit 595dd46ebfc10be041a365d0a3fa99df50b6ba73 ]
Commit:
df04abfd181a ("fs/proc/kcore.c: Add bounce buffer for ktext data")
... introduced a bounce buffer to work around CONFIG_HARDENED_USERCOPY=y. However, accessing the vsyscall user page will cause an SMAP fault.
Replace memcpy() with copy_from_user() to fix this bug works, but adding a common way to handle this sort of user page may be useful for future.
Currently, only vsyscall page requires KCORE_USER.
--- arch/x86/mm/init_64.c | 3 +-- fs/proc/kcore.c | 4 ++++ include/linux/kcore.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
@@ -1014,8 +1014,7 @@ void __init mem_init(void) after_bootmem =1 ;/* Register memory areas for /proc/kcore */ -kclist_add (&kcore_vsyscall, (void *)VSYSCALL_ADDR , -PAGE_SIZE ,KCORE_OTHER ); +kclist_add (&kcore_vsyscall, (void *)VSYSCALL_ADDR ,PAGE_SIZE ,KCORE_USER );mem_init_print_info (NULL ); }
fs/proc/kcore.c +4 -0
@@ -505,6 +505,10 @@ read_kcore(struct file *file, char __use/* we have to zero-fill user buffer even if no read */ if (copy_to_user (buffer, buf, tsz))return -EFAULT ; + }else if (m->type ==KCORE_USER ) { +/* User page is handled prior to normal kernel page: */ +if (copy_to_user (buffer, (char *)start, tsz)) +return -EFAULT ; }else {if (kern_addr_valid (start)) {/*
include/linux/kcore.h +1 -0
@@ -9,6 +9,7 @@ enum kcore_type {KCORE_VMALLOC ,KCORE_RAM ,KCORE_VMEMMAP , +KCORE_USER , KCORE_OTHER, };
Greg Kroah-Hartman
maintainerPATCH 99/329 locking/qspinlock: Ensure node->count is updated before initialising node
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 11dc13224c975efcec96647a4768a6f1bb7a19a8 ]
When queuing on the qspinlock, the count field for the current CPU's head node is incremented. This needn't be atomic because locking in e.g. IRQ context is balanced and so an IRQ will return with node->count as it found it.
However, the compiler could in theory reorder the initialisation of node[idx] before the increment of the head node->count, causing an IRQ to overwrite the initialised node and potentially corrupt the lock state.
Avoid the potential for this harmful compiler reordering by placing a barrier() between the increment of the head node->count and the subsequent node initialisation.
--- kernel/locking/qspinlock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/locking/qspinlock.c +8 -0
@@ -495,6 +495,14 @@ queue: tail =encode_tail (smp_processor_id (), idx); node += idx; + +/* +* Ensure that we increment the head node->count before initialising +* the actual node. If the compiler is kind enough to reorder these +* stores, then an IRQ could overwrite our assignments. +*/ +barrier (); + node->locked =0 ; node->next =NULL ;pv_init_node (node);
Greg Kroah-Hartman
maintainerPATCH 100/329 irqchip/gic-v3: Ignore disabled ITS nodes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
[ Upstream commit 95a2562590c2f64a0398183f978d5cf3db6d0284 ]
On some platforms there's an ITS available but it's not enabled because reading or writing the registers is denied by the firmware. In fact, reading or writing them will cause the system to reset. We could remove the node from DT in such a case, but it's better to skip nodes that are marked as "disabled" in DT so that we can describe the hardware that exists and use the status property to indicate how the firmware has configured things.
--- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 ++ drivers/irqchip/irq-gic-v3-its-platform-msi.c | 2 ++ drivers/irqchip/irq-gic-v3-its.c | 2 ++ drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++ 4 files changed, 8 insertions(+)
drivers/irqchip/irq-gic-v3-its-pci-msi.c +2 -0
@@ -133,6 +133,8 @@ static int __init its_pci_of_msi_init(vofor (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
drivers/irqchip/irq-gic-v3-its-platform-msi.c +2 -0
@@ -80,6 +80,8 @@ static int __init its_pmsi_init(void)for (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
drivers/irqchip/irq-gic-v3-its.c +2 -0
@@ -1807,6 +1807,8 @@ static int __init its_of_probe(struct defor (np =of_find_matching_node (node, its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" )) {pr_warn ("%s: no msi-controller property, ITS ignored\n" , np->full_name);
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +2 -0
@@ -75,6 +75,8 @@ int __init its_fsl_mc_msi_init(void)for (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
Greg Kroah-Hartman
maintainerPATCH 101/329 cpumask: Make for_each_cpu_wrap() available on UP as well
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
[ Upstream commit d207af2eab3f8668b95ad02b21930481c42806fd ]
for_each_cpu_wrap() was originally added in the #else half of a large "#if NR_CPUS == 1" statement, but was omitted in the #if half. This patch adds the missing #if half to prevent compile errors when NR_CPUS is 1.
--- include/linux/cpumask.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/cpumask.h +2 -0
@@ -164,6 +164,8 @@ static inline unsigned int cpumask_local for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)#define for_each_cpu_not (cpu, mask) \ for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) +#define for_each_cpu_wrap (cpu, mask, start) \ + for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)(start))#define for_each_cpu_and (cpu, mask, and) \ for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and)#else
Greg Kroah-Hartman
maintainerPATCH 102/329 irqchip/gic-v3: Change pr_debug message to pr_devel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Salter <[email protected]>
[ Upstream commit b6dd4d83dc2f78cebc9a7e6e7e4bc2be4d29b94d ]
The pr_debug() in gic-v3 gic_send_sgi() can trigger a circular locking warning:
GICv3: CPU10: ICC_SGI1R_EL1 5000400
======================================================
WARNING: possible circular locking dependency detected
4.15.0+ #1 Tainted: G W
------------------------------------------------------
dynamic_debug01/1873 is trying to acquire lock:
((console_sem).lock){-...}, at: [<0000000099c891ec>] down_trylock+0x20/0x4c
but task is already holding lock:
(&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&rq->lock){-.-.}:
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock+0x4c/0x60
task_fork_fair+0x3c/0x148
sched_fork+0x10c/0x214
copy_process.isra.32.part.33+0x4e8/0x14f0
_do_fork+0xe8/0x78c
kernel_thread+0x48/0x54
rest_init+0x34/0x2a4
start_kernel+0x45c/0x488-> #1 (&p->pi_lock){-.-.}:
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock_irqsave+0x58/0x70
try_to_wake_up+0x48/0x600
wake_up_process+0x28/0x34
__up.isra.0+0x60/0x6c
up+0x60/0x68
__up_console_sem+0x4c/0x7c
console_unlock+0x328/0x634
vprintk_emit+0x25c/0x390
dev_vprintk_emit+0xc4/0x1fc
dev_printk_emit+0x88/0xa8
__dev_printk+0x58/0x9c
_dev_info+0x84/0xa8
usb_new_device+0x100/0x474
hub_port_connect+0x280/0x92c
hub_event+0x740/0xa84
process_one_work+0x240/0x70c
worker_thread+0x60/0x400
kthread+0x110/0x13c
ret_from_fork+0x10/0x18-> #0 ((console_sem).lock){-...}:
validate_chain.isra.34+0x6e4/0xa20
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock_irqsave+0x58/0x70
down_trylock+0x20/0x4c
__down_trylock_console_sem+0x3c/0x9c
console_trylock+0x20/0xb0
vprintk_emit+0x254/0x390
vprintk_default+0x58/0x90
vprintk_func+0xbc/0x164
printk+0x80/0xa0
__dynamic_pr_debug+0x84/0xac
gic_raise_softirq+0x184/0x18c
smp_cross_call+0xac/0x218
smp_send_reschedule+0x3c/0x48
resched_curr+0x60/0x9c
check_preempt_curr+0x70/0xdc
wake_up_new_task+0x310/0x470
_do_fork+0x188/0x78c
SyS_clone+0x44/0x50
__sys_trace_return+0x0/0x4other info that might help us debug this:
Chain exists of: (console_sem).lock --> &p->pi_lock --> &rq->lock Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&rq->lock);
lock(&p->pi_lock);
lock(&rq->lock);lock((console_sem).lock);
*** DEADLOCK ***
2 locks held by dynamic_debug01/1873:
#0: (&p->pi_lock){-.-.}, at: [<000000001366df53>] wake_up_new_task+0x40/0x470 #1: (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
stack backtrace: CPU: 10 PID: 1873 Comm: dynamic_debug01 Tainted: G W 4.15.0+ #1 Hardware name: GIGABYTE R120-T34-00/MT30-GS2-00, BIOS T48 10/02/2017 Call trace: dump_backtrace+0x0/0x188 show_stack+0x24/0x2c dump_stack+0xa4/0xe0 print_circular_bug.isra.31+0x29c/0x2b8 check_prev_add.constprop.39+0x6c8/0x6dc validate_chain.isra.34+0x6e4/0xa20 __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock_irqsave+0x58/0x70 down_trylock+0x20/0x4c __down_trylock_console_sem+0x3c/0x9c console_trylock+0x20/0xb0 vprintk_emit+0x254/0x390 vprintk_default+0x58/0x90 vprintk_func+0xbc/0x164 printk+0x80/0xa0 __dynamic_pr_debug+0x84/0xac gic_raise_softirq+0x184/0x18c smp_cross_call+0xac/0x218 smp_send_reschedule+0x3c/0x48 resched_curr+0x60/0x9c check_preempt_curr+0x70/0xdc wake_up_new_task+0x310/0x470 _do_fork+0x188/0x78c SyS_clone+0x44/0x50 __sys_trace_return+0x0/0x4 GICv3: CPU0: ICC_SGI1R_EL1 12000
This could be fixed with printk_deferred() but that might lessen its usefulness for debugging. So change it to pr_devel to keep it out of production kernels. Developers working on gic-v3 can enable it as needed in their kernels.
--- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -601,7 +601,7 @@ static void gic_send_sgi(u64 cluster_id,MPIDR_TO_SGI_AFFINITY (cluster_id,1 ) | tlist << ICC_SGI1R_TARGET_LIST_SHIFT); -pr_debug ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val); +pr_devel ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val);gic_write_sgi1r (val); }
Greg Kroah-Hartman
maintainerPATCH 103/329 ARC: Fix malformed ARC_EMUL_UNALIGNED default
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Magnusson <[email protected]>
[ Upstream commit 827cc2fa024dd6517d62de7a44c7b42f32af371b ]
'default N' should be 'default n', though they happen to have the same effect here, due to undefined symbols (N in this case) evaluating to n in a tristate sense.
Remove the default from ARC_EMUL_UNALIGNED instead of changing it. bool and tristate symbols implicitly default to n.
--- arch/arc/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arc/Kconfig +0 -1
@@ -495,7 +495,6 @@ config ARC_CURR_IN_REG config ARC_EMUL_UNALIGNED bool "Emulate unaligned memory access (userspace only)" - default N select SYSCTL_ARCH_UNALIGN_NO_WARN select SYSCTL_ARCH_UNALIGN_ALLOW depends on ISA_ARCOMPACT
Greg Kroah-Hartman
maintainerPATCH 104/329 ptr_ring: prevent integer overflow when calculating size
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit 54e02162d4454a99227f520948bf4494c3d972d0 ]
Switch to use dividing to prevent integer overflow when size is too big to calculate allocation size properly.
--- include/linux/ptr_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/ptr_ring.h +1 -1
@@ -351,7 +351,7 @@ static inline void *ptr_ring_consume_bh(static inline void **__ptr_ring_init_queue_alloc (unsigned int size,gfp_t gfp) { -if (size *sizeof (void *) >KMALLOC_MAX_SIZE ) +if (size >KMALLOC_MAX_SIZE /sizeof (void *))return NULL ;return kcalloc (size,sizeof (void *), gfp); }
Greg Kroah-Hartman
maintainerPATCH 105/329 libata: Fix compile warning with ATA_DEBUG enabled
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dong Bo <[email protected]>
[ Upstream commit 0d3e45bc6507bd1f8728bf586ebd16c2d9e40613 ]
This fixs the following comile warnings with ATA_DEBUG enabled, which detected by Linaro GCC 5.2-2015.11:
drivers/ata/libata-scsi.c: In function 'ata_scsi_dump_cdb':
./include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 6 has type 'u64 {aka long
long unsigned int}' [-Wformat=]
tj: Patch hand-applied and description trimmed.
--- drivers/ata/libata-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-scsi.c +1 -1
@@ -4156,7 +4156,7 @@ static inline void ata_scsi_dump_cdb(str#ifdef ATA_DEBUG struct scsi_device *scsidev = cmd->device; -DPRINTK ("CDB (%u:%d,%d,%d) %9ph\n" , +DPRINTK ("CDB (%u:%d,%d,%lld) %9ph\n" , ap->print_id, scsidev->channel, scsidev->id, scsidev->lun, cmd->cmnd);
Greg Kroah-Hartman
maintainerPATCH 106/329 selftests: pstore: Adding config fragment CONFIG_PSTORE_RAM=m
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naresh Kamboju <[email protected]>
[ Upstream commit 9a379e77033f02c4a071891afdf0f0a01eff8ccb ]
pstore_tests and pstore_post_reboot_tests need CONFIG_PSTORE_RAM=m
--- tools/testing/selftests/pstore/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/pstore/config +1 -0
@@ -2,3 +2,4 @@ CONFIG_MISC_FILESYSTEMS=y CONFIG_PSTORE=y CONFIG_PSTORE_PMSG=y CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_RAM=m
Greg Kroah-Hartman
maintainerPATCH 108/329 ARM: OMAP2+: timer: fix a kmemleak caused in omap_get_timer_dt
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Hou <[email protected]>
[ Upstream commit db35340c536f1af0108ec9a0b2126a05d358d14a ]
When more than one GP timers are used as kernel system timers and the corresponding nodes in device-tree are marked with the same "disabled" property, then the "attr" field of the property will be initialized more than once as the property being added to sys file system via __of_add_property_sysfs().
In __of_add_property_sysfs(), the "name" field of pp->attr.attr is set directly to the return value of safe_name(), without taking care of whether it's already a valid pointer to a memory block. If it is, its old value will always be overwritten by the new one and the memory block allocated before will a "ghost", then a kmemleak happened.
That the same "disabled" property being added to different nodes of device tree would cause that kind of kmemleak overhead, at least once.
To fix it, allocate the property dynamically, and delete static one.
--- arch/arm/mach-omap2/timer.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/timer.c +11 -8
@@ -136,12 +136,6 @@ static struct clock_event_device clockev .tick_resume = omap2_gp_timer_shutdown, }; -static struct property device_disabled = { - .name ="status" , - .length =sizeof ("disabled" ), - .value ="disabled" , -}; -static const struct of_device_id omap_timer_match[]__initconst = { { .compatible ="ti,omap2420-timer" , }, { .compatible ="ti,omap3430-timer" , },
@@ -183,8 +177,17 @@ static struct device_node * __init omap_ of_get_property(np, "ti,timer-secure", NULL))) continue; -if (!of_device_is_compatible (np,"ti,omap-counter32k" )) -of_add_property (np, &device_disabled); +if (!of_device_is_compatible (np,"ti,omap-counter32k" )) { +struct property *prop; + + prop =kzalloc (sizeof (*prop),GFP_KERNEL ); +if (!prop) +return NULL ; + prop->name ="status" ; + prop->value ="disabled" ; + prop->length =strlen (prop->value); +of_add_property (np, prop); + }return np; }
Greg Kroah-Hartman
maintainerPATCH 109/329 ARM: OMAP3: Fix prm wake interrupt for resume
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit d3be6d2a08bd26580562d9714d3d97ea9ba22c73 ]
For platform_suspend_ops, the finish call is too late to re-enable wake irqs and we need re-enable wake irqs on wake call instead.
Otherwise noirq resume for devices has already happened. And then dev_pm_disarm_wake_irq() has already disabled the dedicated wake irqs when the interrupt triggers and the wake irq is never handled.
For devices that are already in PM runtime suspended state when we enter suspend this means that a possible wake irq will never trigger.
And this can lead into a situation where a device has a pending padconf wake irq, and the device will stay unresponsive to any further wake irqs.
This issue can be easily reproduced by setting serial console log level to zero, letting the serial console idle, and suspend the system from an ssh terminal. Then try to wake up the system by typing to the serial console.
Note that this affects only omap3 PRM interrupt as that's currently the only omap variant that does anything in omap_pm_wake().
In general, for the wake irqs to work, the interrupt must have either IRQF_NO_SUSPEND or IRQF_EARLY_RESUME set for it to trigger before dev_pm_disarm_wake_irq() disables the wake irqs.
--- arch/arm/mach-omap2/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm.c +2 -2
@@ -225,7 +225,7 @@ static void omap_pm_end(void)cpu_idle_poll_ctrl (false); } -static void omap_pm_finish (void ) +static void omap_pm_wake (void ) {if (cpu_is_omap34xx ())omap_prcm_irq_complete ();
@@ -235,7 +235,7 @@ static const struct platform_suspend_ops .begin = omap_pm_begin, .end = omap_pm_end, .enter = omap_pm_enter, - .finish = omap_pm_finish, + .wake = omap_pm_wake, .valid = suspend_valid_only_mem, };
Greg Kroah-Hartman
maintainerPATCH 110/329 ARM: OMAP1: clock: Fix debugfs_create_*() usage
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 8cbbf1745dcde7ba7e423dc70619d223de90fd43 ]
When exposing data access through debugfs, the correct debugfs_create_*() functions must be used, depending on data type.
Remove all casts from data pointers passed to debugfs_create_*() functions, as such casts prevent the compiler from flagging bugs.
Correct all wrong usage:
- clk.rate is unsigned long, not u32,
- clk.flags is u8, not u32, which exposed the successive clk.rate_offset and clk.src_offset fields.
--- arch/arm/mach-omap1/clock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap1/clock.c +3 -3
@@ -1031,17 +1031,17 @@ static int clk_debugfs_register_one(strureturn -ENOMEM ; c->dent = d; - d =debugfs_create_u8 ("usecount" ,S_IRUGO , c->dent, (u8 *)&c->usecount); + d =debugfs_create_u8 ("usecount" ,S_IRUGO , c->dent, &c->usecount);if (!d) { err = -ENOMEM ; goto err_out; } - d =debugfs_create_u32 ("rate" ,S_IRUGO , c->dent, (u32 *)&c->rate); + d =debugfs_create_ulong ("rate" ,S_IRUGO , c->dent, &c->rate);if (!d) { err = -ENOMEM ; goto err_out; } - d =debugfs_create_x32 ("flags" ,S_IRUGO , c->dent, (u32 *)&c->flags); + d =debugfs_create_x8 ("flags" ,S_IRUGO , c->dent, &c->flags);if (!d) { err = -ENOMEM ; goto err_out;
Greg Kroah-Hartman
maintainerPATCH 111/329 ibmvnic: Free RX socket buffer in case of adapter error
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Falcon <[email protected]>
[ Upstream commit 4b9b0f01350500173f17e2b2e65beb4df4ef99c7 ]
If a RX buffer is returned to the client driver with an error, free the corresponding socket buffer before continuing.
--- drivers/net/ethernet/ibm/ibmvnic.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ibm/ibmvnic.c +1 -0
@@ -994,6 +994,7 @@ restart_poll:netdev_err (netdev,"rx error %x\n" , next->rx_comp.rc);/* free the entry */ next->rx_comp.first =0 ; +dev_kfree_skb_any (rx_buff->skb);remove_buff_from_pool (adapter, rx_buff);break ; }
Greg Kroah-Hartman
maintainerPATCH 112/329 iwlwifi: mvm: fix security bug in PN checking
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit 5ab2ba931255d8bf03009c06d58dce97de32797c ]
A previous patch allowed the same PN for packets originating from the same AMSDU by copying PN only for the last packet in the series.
This however is bogus since we cannot assume the last frame will be received on the same queue, and if it is received on a different ueue we will end up not incrementing the PN and possibly let the next packet to have the same PN and pass through.
Change the logic instead to driver explicitly indicate for the second sub frame and on to be allowed to have the same PN as the first subframe. Indicate it to mac80211 as well for the fallback queue.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 39 +++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +20 -19
@@ -72,6 +72,7 @@ static inline int iwl_mvm_check_pn(strucstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct ieee80211_rx_status *stats =IEEE80211_SKB_RXCB (skb);struct iwl_mvm_key_pn *ptk_pn; +int res;u8 tid, keyidx;u8 pn[IEEE80211_CCMP_PN_LEN ];u8 *extiv;
@@ -128,12 +129,13 @@ static inline int iwl_mvm_check_pn(struc pn[4 ] = extiv[1 ]; pn[5 ] = extiv[0 ]; -if (memcmp (pn, ptk_pn->q[queue].pn[tid], -IEEE80211_CCMP_PN_LEN ) <=0 ) + res =memcmp (pn, ptk_pn->q[queue].pn[tid],IEEE80211_CCMP_PN_LEN ); +if (res <0 ) +return -1 ; +if (!res && !(stats->flag &RX_FLAG_ALLOW_SAME_PN ))return -1 ; -if (!(stats->flag &RX_FLAG_AMSDU_MORE )) -memcpy (ptk_pn->q[queue].pn[tid], pn,IEEE80211_CCMP_PN_LEN ); +memcpy (ptk_pn->q[queue].pn[tid], pn,IEEE80211_CCMP_PN_LEN ); stats->flag |=RX_FLAG_PN_VALIDATED ;return 0 ;
@@ -295,28 +297,21 @@ static void iwl_mvm_rx_csum(struct ieee8 }/* -* returns true if a packet outside BA session is a duplicate and -* should be dropped +* returns true if a packet is a duplicate and should be dropped. +* Updates AMSDU PN tracking info */ -static bool iwl_mvm_is_nonagg_dup (struct ieee80211_sta *sta,int queue, -struct ieee80211_rx_status *rx_status, -struct ieee80211_hdr *hdr, -struct iwl_rx_mpdu_desc *desc) +static bool iwl_mvm_is_dup (struct ieee80211_sta *sta,int queue, +struct ieee80211_rx_status *rx_status, +struct ieee80211_hdr *hdr, +struct iwl_rx_mpdu_desc *desc) {struct iwl_mvm_sta *mvm_sta;struct iwl_mvm_rxq_dup_data *dup_data; -u8 baid, tid, sub_frame_idx; +u8 tid, sub_frame_idx;if (WARN_ON (IS_ERR_OR_NULL (sta)))return false; - baid = (le32_to_cpu (desc->reorder_data) & -IWL_RX_MPDU_REORDER_BAID_MASK ) >> -IWL_RX_MPDU_REORDER_BAID_SHIFT ; - -if (baid !=IWL_RX_REORDER_DATA_INVALID_BAID ) -return false; - mvm_sta =iwl_mvm_sta_from_mac80211 (sta); dup_data = &mvm_sta->dup_data[queue];
@@ -346,6 +341,12 @@ static bool iwl_mvm_is_nonagg_dup(struct dup_data->last_sub_frame[tid] >= sub_frame_idx))return true; +/* Allow same PN as the first subframe for following sub frames */ +if (dup_data->last_seq[tid] == hdr->seq_ctrl && + sub_frame_idx > dup_data->last_sub_frame[tid] && + desc->mac_flags2 &IWL_RX_MPDU_MFLG2_AMSDU ) + rx_status->flag |=RX_FLAG_ALLOW_SAME_PN ; + dup_data->last_seq[tid] = hdr->seq_ctrl; dup_data->last_sub_frame[tid] = sub_frame_idx;
@@ -882,7 +883,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *if (ieee80211_is_data (hdr->frame_control))iwl_mvm_rx_csum (sta, skb, desc); -if (iwl_mvm_is_nonagg_dup (sta, queue, rx_status, hdr, desc)) { +if (iwl_mvm_is_dup (sta, queue, rx_status, hdr, desc)) {kfree_skb (skb);rcu_read_unlock ();return ;
Greg Kroah-Hartman
maintainerPATCH 113/329 iwlwifi: mvm: always init rs with 20mhz bandwidth rates
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naftali Goldstein <[email protected]>
[ Upstream commit 6b7a5aea71b342ec0593d23b08383e1f33da4c9a ]
In AP mode, when a new station associates, rs is initialized immediately upon association completion, before the phy context is updated with the association parameters, so the sta bandwidth might be wider than the phy context allows.
To avoid this issue, always initialize rs with 20mhz bandwidth rate, and after authorization, when the phy context is already up-to-date, re-init rs with the correct bw.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 +++ drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 28 +++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4 -0
@@ -2585,6 +2585,10 @@ static int iwl_mvm_mac_sta_state(struct/* enable beacon filtering */ WARN_ON (iwl_mvm_enable_beacon_filter (mvm, vif,0 )); + +iwl_mvm_rs_rate_init (mvm, sta, mvmvif->phy_ctxt->channel->band, + false); + ret =0 ; }else if (old_state ==IEEE80211_STA_AUTHORIZED && new_state ==IEEE80211_STA_ASSOC ) {
drivers/net/wireless/intel/iwlwifi/mvm/rs.c +20 -8
@@ -2709,7 +2709,8 @@ static void rs_get_initial_rate(struct istruct ieee80211_sta *sta, struct iwl_lq_sta *lq_sta, enum nl80211_band band, - struct rs_rate *rate) + struct rs_rate *rate, + bool init) { int i, nentries;unsigned long active_rate;
@@ -2763,14 +2764,25 @@ static void rs_get_initial_rate(struct i*/ if (sta->vht_cap.vht_supported && best_rssi >IWL_RS_LOW_RSSI_THRESHOLD ) { -switch (sta->bandwidth) { -case IEEE80211_STA_RX_BW_160 : -case IEEE80211_STA_RX_BW_80 : -case IEEE80211_STA_RX_BW_40 : +/* +* In AP mode, when a new station associates, rs is initialized +* immediately upon association completion, before the phy +* context is updated with the association parameters, so the +* sta bandwidth might be wider than the phy context allows. +* To avoid this issue, always initialize rs with 20mhz +* bandwidth rate, and after authorization, when the phy context +* is already up-to-date, re-init rs with the correct bw. +*/ +u32 bw = init ?RATE_MCS_CHAN_WIDTH_20 :rs_bw_from_sta_bw (sta); + +switch (bw) { +case RATE_MCS_CHAN_WIDTH_40 : +case RATE_MCS_CHAN_WIDTH_80 : +case RATE_MCS_CHAN_WIDTH_160 : initial_rates = rs_optimal_rates_vht; nentries =ARRAY_SIZE (rs_optimal_rates_vht);break ; -case IEEE80211_STA_RX_BW_20 : +case RATE_MCS_CHAN_WIDTH_20 : initial_rates = rs_optimal_rates_vht_20mhz; nentries =ARRAY_SIZE (rs_optimal_rates_vht_20mhz);break ;
@@ -2781,7 +2793,7 @@ static void rs_get_initial_rate(struct i active_rate = lq_sta->active_siso_rate; rate->type =LQ_VHT_SISO ; - rate->bw =rs_bw_from_sta_bw (sta); + rate->bw = bw; }else if (sta->ht_cap.ht_supported && best_rssi >IWL_RS_LOW_RSSI_THRESHOLD ) { initial_rates = rs_optimal_rates_ht;
@@ -2863,7 +2875,7 @@ static void rs_initialize_lq(struct iwl_ tbl = &(lq_sta->lq_info[active_tbl]); rate = &tbl->rate; -rs_get_initial_rate (mvm, sta, lq_sta, band, rate); +rs_get_initial_rate (mvm, sta, lq_sta, band, rate, init);rs_init_optimal_rate (mvm, sta, lq_sta);WARN_ON_ONCE (rate->ant !=ANT_A && rate->ant !=ANT_B );
Greg Kroah-Hartman
maintainerPATCH 114/329 NFC: llcp: Limit size of SDP URI
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit fe9c842695e26d8116b61b80bfb905356f07834b ]
The tlv_len is u8, so we need to limit the size of the SDP URI. Enforce this both in the NLA policy and in the code that performs the allocation and copy, to avoid writing past the end of the allocated buffer.
--- net/nfc/llcp_commands.c | 4 ++++ net/nfc/netlink.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
net/nfc/llcp_commands.c +4 -0
@@ -149,6 +149,10 @@ struct nfc_llcp_sdp_tlv *nfc_llcp_build_pr_debug ("uri: %s, len: %zu\n" , uri, uri_len); +/* sdreq->tlv_len is u8, takes uri_len, + 3 for header, + 1 for NULL */ +if (WARN_ON_ONCE (uri_len >U8_MAX -4 )) +return NULL ; + sdreq =kzalloc (sizeof (struct nfc_llcp_sdp_tlv ),GFP_KERNEL );if (sdreq ==NULL )return NULL ;
net/nfc/netlink.c +2 -1
@@ -68,7 +68,8 @@ static const struct nla_policy nfc_genl_ };static const struct nla_policy nfc_sdp_genl_policy[NFC_SDP_ATTR_MAX +1 ] = { - [NFC_SDP_ATTR_URI ] = { .type =NLA_STRING }, + [NFC_SDP_ATTR_URI ] = { .type =NLA_STRING , + .len =U8_MAX -4 }, [NFC_SDP_ATTR_SAP ] = { .type =NLA_U8 }, };
Greg Kroah-Hartman
maintainerPATCH 115/329 rxrpc: Work around usercopy check
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit a16b8d0cf2ec1e626d24bc2a7b9e64ace6f7501d ]
Due to a check recently added to copy_to_user(), it's now not permitted to copy from slab-held data to userspace unless the slab is whitelisted. This affects rxrpc_recvmsg() when it attempts to place an RXRPC_USER_CALL_ID control message in the userspace control message buffer. A warning is generated by usercopy_warn() because the source is the copy of the user_call_ID retained in the rxrpc_call struct.
Work around the issue by copying the user_call_ID to a variable on the stack and passing that to put_cmsg().
The warning generated looks like:
Bad or missing usercopy whitelist? Kernel memory exposure attempt detected from SLUB object 'dmaengine-unmap-128' (offset 680, size 8)! WARNING: CPU: 0 PID: 1401 at mm/usercopy.c:81 usercopy_warn+0x7e/0xa0 ... RIP: 0010:usercopy_warn+0x7e/0xa0 ... Call Trace: __check_object_size+0x9c/0x1a0 put_cmsg+0x98/0x120 rxrpc_recvmsg+0x6fc/0x1010 [rxrpc] ? finish_wait+0x80/0x80 ___sys_recvmsg+0xf8/0x240 ? __clear_rsb+0x25/0x3d ? __clear_rsb+0x15/0x3d ? __clear_rsb+0x25/0x3d ? __clear_rsb+0x15/0x3d ? __clear_rsb+0x25/0x3d ? __clear_rsb+0x15/0x3d ? __clear_rsb+0x25/0x3d ? __clear_rsb+0x15/0x3d ? finish_task_switch+0xa6/0x2b0 ? trace_hardirqs_on_caller+0xed/0x180 ? _raw_spin_unlock_irq+0x29/0x40 ? __sys_recvmsg+0x4e/0x90 __sys_recvmsg+0x4e/0x90 do_syscall_64+0x7a/0x220 entry_SYSCALL_64_after_hwframe+0x26/0x9b
--- net/rxrpc/recvmsg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/rxrpc/recvmsg.c +3 -2
@@ -493,9 +493,10 @@ try_again: ret =put_cmsg (msg,SOL_RXRPC ,RXRPC_USER_CALL_ID ,sizeof (unsigned int ), &id32); }else { +unsigned long idl = call->user_call_ID; + ret =put_cmsg (msg,SOL_RXRPC ,RXRPC_USER_CALL_ID , -sizeof (unsigned long ), - &call->user_call_ID); +sizeof (unsigned long ), &idl); }if (ret <0 ) goto error;
Greg Kroah-Hartman
maintainerPATCH 116/329 mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple of 4
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 651b9920d7a694ffb1f885aef2bbb068a25d9d66 ]
This ensures that mac80211 allocated management frames are properly aligned, which makes copying them more efficient.
For instance, mt76 uses iowrite32_copy to copy beacon frames to beacon template memory on the chip.
Misaligned 32-bit accesses cause CPU exceptions on MIPS and should be avoided.
--- include/net/mac80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mac80211.h +1 -1
@@ -4091,7 +4091,7 @@ void ieee80211_sta_uapsd_trigger(struct* The TX headroom reserved by mac80211 for its own tx_status functions. * This is enough for the radiotap header. */ -#define IEEE80211_TX_STATUS_HEADROOM 14 +#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4)/** * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
Greg Kroah-Hartman
maintainerPATCH 117/329 mac80211: fix a possible leak of station stats
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit d78d9ee9d40aca4781d2c5334972544601a4c3a2 ]
If sta_info_alloc fails after allocating the per CPU statistics, they are not properly freed.
--- net/mac80211/sta_info.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/sta_info.c +1 -0
@@ -433,6 +433,7 @@ free_txq:if (sta->sta.txq[0 ])kfree (to_txq_info (sta->sta.txq[0 ])); free: +free_percpu (sta->pcpu_rx_stats);#ifdef CONFIG_MAC80211_MESH kfree (sta->mesh);#endif
Greg Kroah-Hartman
maintainerPATCH 118/329 mac80211: fix calling sleeping function in atomic context
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit 95f3ce6a77893ac828ba841df44421620de4314b ]
sta_info_alloc can be called from atomic paths (such as RX path) so we need to call pcpu_alloc with the correct gfp.
--- net/mac80211/sta_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/sta_info.c +1 -1
@@ -313,7 +313,7 @@ struct sta_info *sta_info_alloc(struct iif (ieee80211_hw_check (hw,USES_RSS )) { sta->pcpu_rx_stats = - alloc_percpu(struct ieee80211_sta_rx_stats); + alloc_percpu_gfp(struct ieee80211_sta_rx_stats, gfp);if (!sta->pcpu_rx_stats) goto free; }
Greg Kroah-Hartman
maintainerPATCH 119/329 mac80211: Do not disconnect on invalid operating class
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
[ Upstream commit 191da271ac260700db3e5b4bb982a17ca78769d6 ]
Some APs include a non global operating class in their extended channel switch information element. In such a case, as the operating class is not known, mac80211 would decide to disconnect.
However the specification states that the operating class needs to be taken from Annex E, but it does not specify from which table it should be taken, so it is valid for an AP to use a non global operating class.
To avoid possibly unneeded disconnection, in such a case ignore the operating class and assume that the current band is used, and if the resulting channel and band configuration is invalid disconnect.
--- net/mac80211/spectmgmt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/mac80211/spectmgmt.c +3 -4
@@ -8,6 +8,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2007-2008, Intel Corporation * Copyright 2008, Johannes Berg <[email protected]> +* Copyright (C) 2018 Intel Corporation * * 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
@@ -27,7 +28,7 @@ int ieee80211_parse_ch_switch_ie(struct u32 sta_flags, u8 *bssid, struct ieee80211_csa_ie *csa_ie) { - enum nl80211_band new_band; + enum nl80211_band new_band = current_band;int new_freq;u8 new_chan_no;struct ieee80211_channel *new_chan;
@@ -53,15 +54,13 @@ int ieee80211_parse_ch_switch_ie(struct elems->ext_chansw_ie->new_operating_class, &new_band)) {sdata_info (sdata, -"cannot understand ECSA IE operating class %d, disconnecting\n" , +"cannot understand ECSA IE operating class, %d, ignoring\n" , elems->ext_chansw_ie->new_operating_class); -return -EINVAL ; } new_chan_no = elems->ext_chansw_ie->new_ch_num; csa_ie->count = elems->ext_chansw_ie->count; csa_ie->mode = elems->ext_chansw_ie->mode; }else if (elems->ch_switch_ie) { - new_band = current_band; new_chan_no = elems->ch_switch_ie->new_ch_num; csa_ie->count = elems->ch_switch_ie->count; csa_ie->mode = elems->ch_switch_ie->mode;
Greg Kroah-Hartman
maintainerPATCH 120/329 md raid10: fix NULL deference in handle_write_completed()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yufen Yu <[email protected]>
[ Upstream commit 01a69cab01c184d3786af09e9339311123d63d22 ]
In the case of 'recover', an r10bio with R10BIO_WriteError & R10BIO_IsRecover will be progressed by handle_write_completed(). This function traverses all r10bio->devs[copies].
If devs[m].repl_bio != NULL, it thinks conf->mirrors[dev].replacement is also not NULL. However, this is not always true.
When there is an rdev of raid10 has replacement, then each r10bio ->devs[m].repl_bio != NULL in conf->r10buf_pool. However, in 'recover', even if corresponded replacement is NULL, it doesn't clear r10bio ->devs[m].repl_bio, resulting in replacement NULL deference.
This bug was introduced when replacement support for raid10 was added in Linux 3.3.
As NeilBrown suggested:
Elsewhere the determination of "is this device part of the resync/recovery" is made by resting bio->bi_end_io. If this is end_sync_write, then we tried to write here. If it is NULL, then we didn't try to write.
--- drivers/md/raid10.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/md/raid10.c +4 -2
@@ -2636,7 +2636,8 @@ static void handle_write_completed(strucfor (m =0 ; m < conf->copies; m++) {int dev = r10_bio->devs[m].devnum; rdev = conf->mirrors[dev].rdev; -if (r10_bio->devs[m].bio ==NULL ) +if (r10_bio->devs[m].bio ==NULL || + r10_bio->devs[m].bio->bi_end_io ==NULL )continue ;if (!r10_bio->devs[m].bio->bi_error) { rdev_clear_badblocks(
@@ -2651,7 +2652,8 @@ static void handle_write_completed(strucmd_error (conf->mddev, rdev); } rdev = conf->mirrors[dev].replacement; -if (r10_bio->devs[m].repl_bio ==NULL ) +if (r10_bio->devs[m].repl_bio ==NULL || + r10_bio->devs[m].repl_bio->bi_end_io ==NULL )continue ;if (!r10_bio->devs[m].repl_bio->bi_error) {
Greg Kroah-Hartman
maintainerPATCH 121/329 drm/exynos: g2d: use monotonic timestamps
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a588a8bb7b25a3fb4f7fed00feb7aec541fc2632 ]
The exynos DRM driver uses real-time 'struct timeval' values for exporting its timestamps to user space. This has multiple problems:
1. signed seconds overflow in y2038
2. the 'struct timeval' definition is deprecated in the kernel
3. time may jump or go backwards after a 'settimeofday()' syscall
4. other DRM timestamps are in CLOCK_MONOTONIC domain, so they can't be compared
5. exporting microseconds requires a division by 1000, which may be slow on some architectures.
The code existed in two places before, but the IPP portion was removed in 8ded59413ccc ("drm/exynos: ipp: Remove Exynos DRM IPP subsystem"), so we no longer need to worry about it.
Ideally timestamps should just use 64-bit nanoseconds instead, but of course we can't change that now. Instead, this tries to address the first four points above by using monotonic 'timespec' values.
According to Tobias Jakobi, user space doesn't care about the timestamp at the moment, so we can change the format. Even if there is something looking at them, it will work just fine with monotonic times as long as the application only looks at the relative values between two events.
--- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_g2d.c +3 -3
@@ -926,7 +926,7 @@ static void g2d_finish_event(struct g2d_struct drm_device *drm_dev = g2d->subdrv.drm_dev;struct g2d_runqueue_node *runqueue_node = g2d->runqueue_node;struct drm_exynos_pending_g2d_event *e; -struct timeval now; +struct timespec64 now;if (list_empty (&runqueue_node->event_list))return ;
@@ -934,9 +934,9 @@ static void g2d_finish_event(struct g2d_ e =list_first_entry (&runqueue_node->event_list, struct drm_exynos_pending_g2d_event, base.link); -do_gettimeofday (&now); +ktime_get_ts64 (&now); e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; + e->event.tv_usec = now.tv_nsec /NSEC_PER_USEC ; e->event.cmdlist_no = cmdlist_no;drm_send_event (drm_dev, &e->base);
Greg Kroah-Hartman
maintainerPATCH 122/329 drm/exynos: fix comparison to bitshift when dealing with a mask
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 1293b6191010672c0c9dacae8f71c6f3e4d70cbe ]
Due to a typo, the mask was destroyed by a comparison instead of a bit shift.
--- drivers/gpu/drm/exynos/regs-fimc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/regs-fimc.h +1 -1
@@ -569,7 +569,7 @@#define EXYNOS_CIIMGEFF_FIN_EMBOSSING (4 << 26)#define EXYNOS_CIIMGEFF_FIN_SILHOUETTE (5 << 26)#define EXYNOS_CIIMGEFF_FIN_MASK (7 << 26) -#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK ((0xff < 13) | (0xff < 0)) +#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK ((0xff << 13) | (0xff << 0))/* Real input DMA size register */ #define EXYNOS_CIREAL_ISIZE_AUTOLOAD_ENABLE (1 << 31)
Greg Kroah-Hartman
maintainerPATCH 123/329 drm/exynos: g2d: Delete an error message for a failed memory allocation in two functions
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Elfring <[email protected]>
[ Upstream commit 6f0a60298bbbea43ab5e3955913ab19c153076f3 ]
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_g2d.c +2 -4
@@ -286,7 +286,6 @@ static int g2d_init_cmdlist(struct g2d_d node =kcalloc (G2D_CMDLIST_NUM ,sizeof (*node),GFP_KERNEL );if (!node) { -dev_err (dev,"failed to allocate memory\n" ); ret = -ENOMEM ; goto err; }
@@ -1358,10 +1357,9 @@ int exynos_g2d_exec_ioctl(struct drm_devreturn -EFAULT ; runqueue_node =kmem_cache_alloc (g2d->runqueue_slab,GFP_KERNEL ); -if (!runqueue_node) { -dev_err (dev,"failed to allocate memory\n" ); +if (!runqueue_node)return -ENOMEM ; - } + run_cmdlist = &runqueue_node->run_cmdlist; event_list = &runqueue_node->event_list;INIT_LIST_HEAD (run_cmdlist);
Greg Kroah-Hartman
maintainerPATCH 124/329 locking/xchg/alpha: Add unconditional memory barrier to cmpxchg()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
[ Upstream commit cb13b424e986aed68d74cbaec3449ea23c50e167 ]
Continuing along with the fight against smp_read_barrier_depends() [1] (or rather, against its improper use), add an unconditional barrier to cmpxchg. This guarantees that dependency ordering is preserved when a dependency is headed by an unsuccessful cmpxchg. As it turns out, the change could enable further simplification of LKMM as proposed in [2].
[1] https://marc.info/?l=linux-kernel&m=150884953419377&w=2
https://marc.info/?l=linux-kernel&m=150884946319353&w=2 https://marc.info/?l=linux-kernel&m=151215810824468&w=2 https://marc.info/?l=linux-kernel&m=151215816324484&w=2
[2] https://marc.info/?l=linux-kernel&m=151881978314872&w=2
--- arch/alpha/include/asm/xchg.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
arch/alpha/include/asm/xchg.h +7 -8
@@ -127,10 +127,9 @@ ____xchg(, volatile void *ptr, unsigned* store NEW in MEM. Return the initial value in MEM. Success is * indicated by comparing RETURN with OLD. * -* The memory barrier should be placed in SMP only when we actually -* make the change. If we don't change anything (so if the returned -* prev is equal to old) then we aren't acquiring anything new and -* we don't need any memory barrier as far I can tell. +* The memory barrier is placed in SMP unconditionally, in order to +* guarantee that dependency ordering is preserved when a dependency +* is headed by an unsuccessful operation. */ static inline unsigned long
@@ -149,8 +148,8 @@ ____cmpxchg(_u8, volatile char *m, unsig" or %1,%2,%2\n" " stq_c %2,0(%4)\n" " beq %2,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -176,8 +175,8 @@ ____cmpxchg(_u16, volatile short *m, uns" or %1,%2,%2\n" " stq_c %2,0(%4)\n" " beq %2,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -199,8 +198,8 @@ ____cmpxchg(_u32, volatile int *m, int o" mov %4,%1\n" " stl_c %1,%2\n" " beq %1,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -222,8 +221,8 @@ ____cmpxchg(_u64, volatile long *m, unsi" mov %4,%1\n" " stq_c %1,%2\n" " beq %1,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
Greg Kroah-Hartman
maintainerPATCH 125/329 md: raid5: avoid string overflow warning
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 53b8d89ddbdbb0e4625a46d2cdbb6f106c52f801 ]
gcc warns about a possible overflow of the kmem_cache string, when adding four characters to a string of the same length:
drivers/md/raid5.c: In function 'setup_conf':drivers/md/raid5.c:2207:34: error: '-alt' directive writing 4 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]);
^~~~drivers/md/raid5.c:2207:2: note: 'sprintf' output between 5 and 36 bytes into a destination of size 32
sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I'm counting correctly, we need 11 characters for the fixed part of the string and 18 characters for a 64-bit pointer (when no gendisk is used), so that leaves three characters for conf->level, which should always be sufficient.
This makes the code use snprintf() with the correct length, to make the code more robust against changes, and to get the compiler to shut up.
In commit f4be6b43f1ac ("md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk") from 2010, Neil said that the pointer could be removed "shortly" once devices without gendisk are disallowed. I have no idea if that happened, but if it did, that should probably be changed as well.
--- drivers/md/raid5.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/md/raid5.c +4 -3
@@ -2049,15 +2049,16 @@ static int grow_one_stripe(struct r5confstatic int grow_stripes (struct r5conf *conf,int num) {struct kmem_cache *sc; +size_t namelen =sizeof (conf->cache_name[0 ]);int devs =max (conf->raid_disks, conf->previous_raid_disks);if (conf->mddev->gendisk) -sprintf (conf->cache_name[0 ], +snprintf (conf->cache_name[0 ], namelen,"raid%d-%s" , conf->level,mdname (conf->mddev));else -sprintf (conf->cache_name[0 ], +snprintf (conf->cache_name[0 ], namelen,"raid%d-%p" , conf->level, conf->mddev); -sprintf (conf->cache_name[1 ],"%s-alt" , conf->cache_name[0 ]); +snprintf (conf->cache_name[1 ], namelen,"%.27s-alt" , conf->cache_name[0 ]); conf->active_name =0 ; sc = kmem_cache_create(conf->cache_name[conf->active_name],
Greg Kroah-Hartman
maintainerPATCH 126/329 kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
[ Upstream commit 88913bd8ea2a75d7e460a4bed5f75e1c32660d7e ]
chan->n_subbufs is set by the user and relay_create_buf() does a kmalloc() of chan->n_subbufs * sizeof(size_t *).
kmalloc_slab() will generate a warning when this fails if chan->subbufs * sizeof(size_t *) > KMALLOC_MAX_SIZE.
Limit chan->n_subbufs to the maximum allowed kmalloc() size.
--- kernel/relay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/relay.c +1 -1
@@ -163,7 +163,7 @@ static struct rchan_buf *relay_create_bu {struct rchan_buf *buf; -if (chan->n_subbufs >UINT_MAX /sizeof (size_t *)) +if (chan->n_subbufs >KMALLOC_MAX_SIZE /sizeof (size_t *))return NULL ; buf =kzalloc (sizeof (struct rchan_buf ),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 127/329 powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Lord <[email protected]>
[ Upstream commit 083b20907185b076f21c265b30fe5b5f24c03d8c ]
I am using SECCOMP to filter syscalls on a ppc32 platform, and noticed that the JIT compiler was failing on the BPF even though the interpreter was working fine.
The issue was that the compiler was missing one of the instructions used by SECCOMP, so here is a patch to enable JIT for that instruction.
--- arch/powerpc/net/bpf_jit_comp.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/net/bpf_jit_comp.c +3 -0
@@ -329,6 +329,9 @@ static int bpf_jit_build_body(struct bpf BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);PPC_LWZ_OFFS (r_A, r_skb, offsetof(struct sk_buff , len));break ; +case BPF_LDX |BPF_W |BPF_ABS :/* A = *((u32 *)(seccomp_data + K)); */ +PPC_LWZ_OFFS (r_A, r_skb,K ); +break ;case BPF_LDX |BPF_W |BPF_LEN :/* X = skb->len; */ PPC_LWZ_OFFS (r_X, r_skb, offsetof(struct sk_buff , len));break ;
Greg Kroah-Hartman
maintainerPATCH 128/329 s390/cio: fix ccw_device_start_timeout API
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
[ Upstream commit f97a6b6c47d2f329a24f92cc0ca3c6df5727ba73 ]
There are cases a device driver can't start IO because the device is currently in use by cio. In this case the device driver is notified when the device is usable again.
Using ccw_device_start_timeout we would set the timeout (and change an existing timeout) before we test for internal usage. Worst case this could lead to an unexpected timer deletion.
Fix this by setting the timeout after we test for internal usage.
--- drivers/s390/cio/device_ops.c | 72 ++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 40 deletions(-)
drivers/s390/cio/device_ops.c +32 -40
@@ -158,7 +158,7 @@ int ccw_device_clear(struct ccw_device * }/** -* ccw_device_start_key() - start a s390 channel program with key +* ccw_device_start_timeout_key() - start a s390 channel program with timeout and key * @cdev: target ccw device * @cpa: logical start address of channel program * @intparm: user specific interruption parameter; will be presented back to
@@ -169,10 +169,15 @@ int ccw_device_clear(struct ccw_device ** @key: storage key to be used for the I/O * @flags: additional flags; defines the action to be performed for I/O * processing. +* @expires: timeout value in jiffies * * Start a S/390 channel program. When the interrupt arrives, the * IRQ handler is called, either immediately, delayed (dev-end missing, * or sense required) or never (no IRQ handler registered). +* This function notifies the device driver if the channel program has not +* completed during the time specified by @expires. If a timeout occurs, the +* channel program is terminated via xsch, hsch or csch, and the device's +* interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT). * Returns: * %0, if the operation was successful; * -%EBUSY, if the device is busy, or status pending;
@@ -181,9 +186,9 @@ int ccw_device_clear(struct ccw_device ** Context: * Interrupts disabled, ccw device lock held */ -int ccw_device_start_key (struct ccw_device *cdev,struct ccw1 *cpa, -unsigned long intparm,__u8 lpm,__u8 key, -unsigned long flags) +int ccw_device_start_timeout_key (struct ccw_device *cdev,struct ccw1 *cpa, +unsigned long intparm,__u8 lpm,__u8 key, +unsigned long flags,int expires) {struct subchannel *sch;int ret;
@@ -223,6 +228,8 @@ int ccw_device_start_key(struct ccw_deviswitch (ret) {case 0 : cdev->private->intparm = intparm; +if (expires) +ccw_device_set_timeout (cdev, expires);break ;case -EACCES :case -ENODEV :
@@ -233,7 +240,7 @@ int ccw_device_start_key(struct ccw_devi }/** -* ccw_device_start_timeout_key() - start a s390 channel program with timeout and key +* ccw_device_start_key() - start a s390 channel program with key * @cdev: target ccw device * @cpa: logical start address of channel program * @intparm: user specific interruption parameter; will be presented back to
@@ -244,15 +251,10 @@ int ccw_device_start_key(struct ccw_devi* @key: storage key to be used for the I/O * @flags: additional flags; defines the action to be performed for I/O * processing. -* @expires: timeout value in jiffies * * Start a S/390 channel program. When the interrupt arrives, the * IRQ handler is called, either immediately, delayed (dev-end missing, * or sense required) or never (no IRQ handler registered). -* This function notifies the device driver if the channel program has not -* completed during the time specified by @expires. If a timeout occurs, the -* channel program is terminated via xsch, hsch or csch, and the device's -* interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT). * Returns: * %0, if the operation was successful; * -%EBUSY, if the device is busy, or status pending;
@@ -261,19 +263,12 @@ int ccw_device_start_key(struct ccw_devi* Context: * Interrupts disabled, ccw device lock held */ -int ccw_device_start_timeout_key (struct ccw_device *cdev,struct ccw1 *cpa, -unsigned long intparm,__u8 lpm,__u8 key, -unsigned long flags,int expires) +int ccw_device_start_key (struct ccw_device *cdev,struct ccw1 *cpa, +unsigned long intparm,__u8 lpm,__u8 key, +unsigned long flags) { -int ret; - -if (!cdev) -return -ENODEV ; -ccw_device_set_timeout (cdev, expires); - ret =ccw_device_start_key (cdev, cpa, intparm, lpm, key, flags); -if (ret !=0 ) -ccw_device_set_timeout (cdev,0 ); -return ret; +return ccw_device_start_timeout_key (cdev, cpa, intparm, lpm, key, + flags,0 ); }/**
@@ -488,18 +483,20 @@ void ccw_device_get_id(struct ccw_deviceEXPORT_SYMBOL (ccw_device_get_id);/** -* ccw_device_tm_start_key() - perform start function +* ccw_device_tm_start_timeout_key() - perform start function * @cdev: ccw device on which to perform the start function * @tcw: transport-command word to be started * @intparm: user defined parameter to be passed to the interrupt handler * @lpm: mask of paths to use * @key: storage key to use for storage access +* @expires: time span in jiffies after which to abort request * * Start the tcw on the given ccw device. Return zero on success, non-zero * otherwise. */ -int ccw_device_tm_start_key (struct ccw_device *cdev,struct tcw *tcw, -unsigned long intparm,u8 lpm,u8 key) +int ccw_device_tm_start_timeout_key (struct ccw_device *cdev,struct tcw *tcw, +unsigned long intparm,u8 lpm,u8 key, +int expires) {struct subchannel *sch;int rc;
@@ -526,37 +523,32 @@ int ccw_device_tm_start_key(struct ccw_dreturn -EACCES ; } rc =cio_tm_start_key (sch, tcw, lpm, key); -if (rc ==0 ) +if (rc ==0 ) { cdev->private->intparm = intparm; +if (expires) +ccw_device_set_timeout (cdev, expires); + }return rc; } -EXPORT_SYMBOL (ccw_device_tm_start_key); +EXPORT_SYMBOL (ccw_device_tm_start_timeout_key);/** -* ccw_device_tm_start_timeout_key() - perform start function +* ccw_device_tm_start_key() - perform start function * @cdev: ccw device on which to perform the start function * @tcw: transport-command word to be started * @intparm: user defined parameter to be passed to the interrupt handler * @lpm: mask of paths to use * @key: storage key to use for storage access -* @expires: time span in jiffies after which to abort request * * Start the tcw on the given ccw device. Return zero on success, non-zero * otherwise. */ -int ccw_device_tm_start_timeout_key (struct ccw_device *cdev,struct tcw *tcw, -unsigned long intparm,u8 lpm,u8 key, -int expires) +int ccw_device_tm_start_key (struct ccw_device *cdev,struct tcw *tcw, +unsigned long intparm,u8 lpm,u8 key) { -int ret; - -ccw_device_set_timeout (cdev, expires); - ret =ccw_device_tm_start_key (cdev, tcw, intparm, lpm, key); -if (ret !=0 ) -ccw_device_set_timeout (cdev,0 ); -return ret; +return ccw_device_tm_start_timeout_key (cdev, tcw, intparm, lpm, key,0 ); } -EXPORT_SYMBOL (ccw_device_tm_start_timeout_key); +EXPORT_SYMBOL (ccw_device_tm_start_key);/** * ccw_device_tm_start() - perform start function
Greg Kroah-Hartman
maintainerPATCH 129/329 s390/cio: fix return code after missing interrupt
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
[ Upstream commit 770b55c995d171f026a9efb85e71e3b1ea47b93d ]
When a timeout occurs for users of ccw_device_start_timeout we will stop the IO and call the drivers int handler with the irb pointer set to ERR_PTR(-ETIMEDOUT). Sometimes however we'd set the irb pointer to ERR_PTR(-EIO) which is not intended. Just set the correct value in all codepaths.
--- drivers/s390/cio/device_fsm.c | 6 ++++-- drivers/s390/cio/io_sch.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/s390/cio/device_fsm.c +4 -2
@@ -822,6 +822,7 @@ ccw_device_online_timeout(struct ccw_devccw_device_set_timeout (cdev,0 ); cdev->private->iretry =255 ; + cdev->private->async_kill_io_rc = -ETIMEDOUT ; ret =ccw_device_cancel_halt_clear (cdev);if (ret == -EBUSY ) {ccw_device_set_timeout (cdev,3 *HZ );
@@ -898,7 +899,7 @@ ccw_device_killing_irq(struct ccw_device/* OK, i/o is dead now. Call interrupt handler. */ if (cdev->handler) cdev->handler (cdev, cdev->private->intparm, -ERR_PTR (-EIO )); +ERR_PTR (cdev->private->async_kill_io_rc)); } static void
@@ -915,7 +916,7 @@ ccw_device_killing_timeout(struct ccw_deccw_device_online_verify (cdev,0 );if (cdev->handler) cdev->handler (cdev, cdev->private->intparm, -ERR_PTR (-EIO )); +ERR_PTR (cdev->private->async_kill_io_rc)); }void ccw_device_kill_io (struct ccw_device *cdev)
@@ -923,6 +924,7 @@ void ccw_device_kill_io(struct ccw_devicint ret; cdev->private->iretry =255 ; + cdev->private->async_kill_io_rc = -EIO ; ret =ccw_device_cancel_halt_clear (cdev);if (ret == -EBUSY ) {ccw_device_set_timeout (cdev,3 *HZ );
drivers/s390/cio/io_sch.h +1 -0
@@ -154,6 +154,7 @@ struct ccw_device_private {unsigned long intparm;/* user interruption parameter */ struct qdio_irq *qdio_data;struct irb irb;/* device status */ +int async_kill_io_rc;struct senseid senseid;/* SenseID info */ struct pgid pgid[8 ];/* path group IDs per chpid*/ struct ccw1 iccws[2 ];/* ccws for SNID/SID/SPGID commands */
Greg Kroah-Hartman
maintainerPATCH 130/329 s390/cio: clear timer when terminating driver I/O
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
[ Upstream commit 410d5e13e7638bc146321671e223d56495fbf3c7 ]
When we terminate driver I/O (because we need to stop using a certain channel path) we also need to ensure that a timer (which may have been set up using ccw_device_start_timeout) is cleared.
--- drivers/s390/cio/device_fsm.c | 1 + 1 file changed, 1 insertion(+)
drivers/s390/cio/device_fsm.c +1 -0
@@ -923,6 +923,7 @@ void ccw_device_kill_io(struct ccw_devic {int ret; +ccw_device_set_timeout (cdev,0 ); cdev->private->iretry =255 ; cdev->private->async_kill_io_rc = -EIO ; ret =ccw_device_cancel_halt_clear (cdev);
Greg Kroah-Hartman
maintainerPATCH 131/329 PKCS#7: fix direct verification of SignerInfo signature
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit 6459ae386699a5fe0dc52cf30255f75274fa43a4 ]
If none of the certificates in a SignerInfo's certificate chain match a trusted key, nor is the last certificate signed by a trusted key, then pkcs7_validate_trust_one() tries to check whether the SignerInfo's signature was made directly by a trusted key. But, it actually fails to set the 'sig' variable correctly, so it actually verifies the last signature seen. That will only be the SignerInfo's signature if the certificate chain is empty; otherwise it will actually be the last certificate's signature.
This is not by itself a security problem, since verifying any of the certificates in the chain should be sufficient to verify the SignerInfo. Still, it's not working as intended so it should be fixed.
Fix it by setting 'sig' correctly for the direct verification case.
--- crypto/asymmetric_keys/pkcs7_trust.c | 1 + 1 file changed, 1 insertion(+)
crypto/asymmetric_keys/pkcs7_trust.c +1 -0
@@ -106,6 +106,7 @@ static int pkcs7_validate_trust_one(strupr_devel ("sinfo %u: Direct signer is key %x\n" , sinfo->index,key_serial (key)); x509 =NULL ; + sig = sinfo->sig; goto matched; }if (PTR_ERR (key) != -ENOKEY )
Greg Kroah-Hartman
maintainerPATCH 132/329 ARM: OMAP: Fix dmtimer init for omap1
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit ba6887836178d43b3665b9da075c2c5dfe1d207c ]
We need to enable PM runtime on omap1 also as otherwise we will get errors:
omap_timer omap_timer.1: omap_dm_timer_probe: pm_runtime_get_sync failed!omap_timer: probe of omap_timer.1 failed with error -13
...
We are checking for OMAP_TIMER_NEEDS_RESET flag elsewhere so this is safe to do.
--- arch/arm/plat-omap/dmtimer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/arm/plat-omap/dmtimer.c +2 -5
@@ -890,11 +890,8 @@ static int omap_dm_timer_probe(struct pl timer->irq = irq->start; timer->pdev = pdev; -/* Skip pm_runtime_enable for OMAP1 */ -if (!(timer->capability &OMAP_TIMER_NEEDS_RESET )) { -pm_runtime_enable (dev); -pm_runtime_irq_safe (dev); - } +pm_runtime_enable (dev); +pm_runtime_irq_safe (dev);if (!timer->reserved) { ret =pm_runtime_get_sync (dev);
Greg Kroah-Hartman
maintainerPATCH 133/329 smsc75xx: fix smsc75xx_set_features()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 88e80c62671ceecdbb77c902731ec95a4bfa62f9 ]
If an attempt is made to disable RX checksums, USB adapter is changed but netdev->features is not, because smsc75xx_set_features() returns a non zero value.
This throws errors from netdev_rx_csum_fault() :
<devname>: hw csum failure
--- drivers/net/usb/smsc75xx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/usb/smsc75xx.c +4 -3
@@ -957,10 +957,11 @@ static int smsc75xx_set_features(struct/* it's racing here! */ ret =smsc75xx_write_reg (dev,RFE_CTL , pdata->rfe_ctl); -if (ret <0 ) +if (ret <0 ) {netdev_warn (dev->net,"Error writing RFE_CTL\n" ); - -return ret; +return ret; + } +return 0 ; }static int smsc75xx_wait_ready (struct usbnet *dev,int in_pm)
Greg Kroah-Hartman
maintainerPATCH 134/329 regulatory: add NUL to request alpha2
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 657308f73e674e86b60509a430a46e569bf02846 ]
Similar to the ancient commit a5fe8e7695dc ("regulatory: add NUL to alpha2"), add another byte to alpha2 in the request struct so that when we use nla_put_string(), we don't overrun anything.
--- include/net/regulatory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/regulatory.h +1 -1
@@ -78,7 +78,7 @@ struct regulatory_request {int wiphy_idx;enum nl80211_reg_initiator initiator;enum nl80211_user_reg_hint_type user_reg_hint_type; -char alpha2[2 ]; +char alpha2[3 ];enum nl80211_dfs_regions dfs_region;bool intersect;bool processed;
Greg Kroah-Hartman
maintainerPATCH 135/329 integrity/security: fix digsig.c build error with header file
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 120f3b11ef88fc38ce1d0ff9c9a4b37860ad3140 ]
security/integrity/digsig.c has build errors on some $ARCH due to a missing header file, so add it.
security/integrity/digsig.c:146:2: error: implicit declaration of function 'vfree' [-Werror=implicit-function-declaration]
--- security/integrity/digsig.c | 1 + 1 file changed, 1 insertion(+)
security/integrity/digsig.c +1 -0
@@ -18,6 +18,7 @@#include <linux/cred.h> #include <linux/key-type.h> #include <linux/digsig.h> +#include <linux/vmalloc.h> #include <crypto/public_key.h> #include <keys/system_keyring.h>
Greg Kroah-Hartman
maintainerPATCH 136/329 locking/xchg/alpha: Fix xchg() and cmpxchg() memory ordering bugs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
[ Upstream commit 472e8c55cf6622d1c112dc2bc777f68bbd4189db ]
Successful RMW operations are supposed to be fully ordered, but Alpha's xchg() and cmpxchg() do not meet this requirement.
Will Deacon noticed the bug:
Quoted 9 lines
So MP using xchg:
WRITE_ONCE(x, 1)xchg(y, 1)
smp_load_acquire(y)== 1READ_ONCE(x)== 0would be allowed.
... which thus violates the above requirement.
Fix it by adding a leading smp_mb() to the xchg() and cmpxchg() implementations.
--- arch/alpha/include/asm/xchg.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
arch/alpha/include/asm/xchg.h +18 -3
@@ -11,6 +11,10 @@* Atomic exchange. * Since it can be used to implement critical sections * it must clobber "memory" (also for interrupts in UP). +* +* The leading and the trailing memory barriers guarantee that these +* operations are fully ordered. +* */ static inline unsigned long
@@ -18,6 +22,7 @@ ____xchg(_u8, volatile char *m, unsigned {unsigned long ret, tmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %4,7,%3\n" " insbl %1,%4,%1\n"
@@ -42,6 +47,7 @@ ____xchg(_u16, volatile short *m, unsign {unsigned long ret, tmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %4,7,%3\n" " inswl %1,%4,%1\n"
@@ -66,6 +72,7 @@ ____xchg(_u32, volatile int *m, unsigned {unsigned long dummy; +smp_mb (); __asm__ __volatile__("1: ldl_l %0,%4\n" " bis $31,%3,%1\n"
@@ -86,6 +93,7 @@ ____xchg(_u64, volatile long *m, unsigne {unsigned long dummy; +smp_mb (); __asm__ __volatile__("1: ldq_l %0,%4\n" " bis $31,%3,%1\n"
@@ -127,9 +135,12 @@ ____xchg(, volatile void *ptr, unsigned* store NEW in MEM. Return the initial value in MEM. Success is * indicated by comparing RETURN with OLD. * -* The memory barrier is placed in SMP unconditionally, in order to -* guarantee that dependency ordering is preserved when a dependency -* is headed by an unsuccessful operation. +* The leading and the trailing memory barriers guarantee that these +* operations are fully ordered. +* +* The trailing memory barrier is placed in SMP unconditionally, in +* order to guarantee that dependency ordering is preserved when a +* dependency is headed by an unsuccessful operation. */ static inline unsigned long
@@ -137,6 +148,7 @@ ____cmpxchg(_u8, volatile char *m, unsig {unsigned long prev, tmp, cmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %5,7,%4\n" " insbl %1,%5,%1\n"
@@ -164,6 +176,7 @@ ____cmpxchg(_u16, volatile short *m, uns {unsigned long prev, tmp, cmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %5,7,%4\n" " inswl %1,%5,%1\n"
@@ -191,6 +204,7 @@ ____cmpxchg(_u32, volatile int *m, int o {unsigned long prev, cmp; +smp_mb (); __asm__ __volatile__("1: ldl_l %0,%5\n" " cmpeq %0,%3,%1\n"
@@ -214,6 +228,7 @@ ____cmpxchg(_u64, volatile long *m, unsi {unsigned long prev, cmp; +smp_mb (); __asm__ __volatile__("1: ldq_l %0,%5\n" " cmpeq %0,%3,%1\n"
Greg Kroah-Hartman
maintainerPATCH 137/329 x86/topology: Update the cpu cores field in /proc/cpuinfo correctly across CPU hotplug operations
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Neves <[email protected]>
[ Upstream commit 4596749339e06dc7a424fc08a15eded850ed78b7 ]
Without this fix, /proc/cpuinfo will display an incorrect amount of CPU cores, after bringing them offline and online again, as exemplified below:
$ cat /proc/cpuinfo | grep cores cpu cores : 4 cpu cores : 8 cpu cores : 8 cpu cores : 20 cpu cores : 4 cpu cores : 3 cpu cores : 2 cpu cores : 2
This patch fixes this by always zeroing the booted_cores variable upon turning off a logical CPU.
--- arch/x86/kernel/smpboot.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/smpboot.c +1 -0
@@ -1497,6 +1497,7 @@ static void remove_siblinginfo(int cpu)cpumask_clear (topology_core_cpumask (cpu)); c->phys_proc_id =0 ; c->cpu_core_id =0 ; + c->booted_cores =0 ;cpumask_clear_cpu (cpu, cpu_sibling_setup_mask);recompute_smt_state (); }
Greg Kroah-Hartman
maintainerPATCH 138/329 mac80211: drop frames with unexpected DS bits from fast-rx to slow path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit b323ac19b7734a1c464b2785a082ee50bccd3b91 ]
Fixes rx for 4-addr packets in AP mode. These may be used for setting up a 4-addr link for stations that are allowed to do so.
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -3907,7 +3907,7 @@ static bool ieee80211_invoke_fast_rx(strif ((hdr->frame_control &cpu_to_le16 (IEEE80211_FCTL_FROMDS |IEEE80211_FCTL_TODS )) != fast_rx->expected_ds_bits) - goto drop; +return false;/* assign the key to drop unencrypted frames (later) * and strip the IV/MIC if necessary
Greg Kroah-Hartman
maintainerPATCH 139/329 arm64: fix unwind_frame() for filtered out fn for function graph tracing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Anand <[email protected]>
[ Upstream commit 9f416319f40cd857d2bb517630e5855a905ef3fb ]
do_task_stat() calls get_wchan(), which further does unwind_frame(). unwind_frame() restores frame->pc to original value in case function graph tracer has modified a return address (LR) in a stack frame to hook a function return. However, if function graph tracer has hit a filtered function, then we can't unwind it as ftrace_push_return_trace() has biased the index(frame->graph) with a 'huge negative' offset(-FTRACE_NOTRACE_DEPTH).
Moreover, arm64 stack walker defines index(frame->graph) as unsigned int, which can not compare a -ve number.
Similar problem we can have with calling of walk_stackframe() from save_stack_trace_tsk() or dump_backtrace().
This patch fixes unwind_frame() to test the index for -ve value and restore index accordingly before we can restore frame->pc.
Reproducer:
cd /sys/kernel/debug/tracing/
echo schedule > set_graph_notrace
echo 1 > options/display-graph
echo wakeup > current_tracer
ps -ef | grep -i agent
Above commands result in:
Unable to handle kernel paging request at virtual address ffff801bd3d1e000 pgd = ffff8003cbe97c00 [ffff801bd3d1e000] *pgd=0000000000000000, *pud=0000000000000000 Internal error: Oops: 96000006 [#1] SMP [...] CPU: 5 PID: 11696 Comm: ps Not tainted 4.11.0+ #33
[...]
task: ffff8003c21ba000 task.stack: ffff8003cc6c0000 PC is at unwind_frame+0x12c/0x180
LR is at get_wchan+0xd4/0x134
pc : [<ffff00000808892c>] lr : [<ffff0000080860b8>] pstate: 60000145
sp : ffff8003cc6c3ab0
x29: ffff8003cc6c3ab0 x28: 0000000000000001
x27: 0000000000000026 x26: 0000000000000026
x25: 00000000000012d8 x24: 0000000000000000
x23: ffff8003c1c04000 x22: ffff000008c83000
x21: ffff8003c1c00000 x20: 000000000000000f
x19: ffff8003c1bc0000 x18: 0000fffffc593690
x17: 0000000000000000 x16: 0000000000000001
x15: 0000b855670e2b60 x14: 0003e97f22cf1d0f
x13: 0000000000000001 x12: 0000000000000000
x11: 00000000e8f4883e x10: 0000000154f47ec8
x9 : 0000000070f367c0 x8 : 0000000000000000
x7 : 00008003f7290000 x6 : 0000000000000018
x5 : 0000000000000000 x4 : ffff8003c1c03cb0
x3 : ffff8003c1c03ca0 x2 : 00000017ffe80000
x1 : ffff8003cc6c3af8 x0 : ffff8003d3e9e000
Process ps (pid: 11696, stack limit = 0xffff8003cc6c0000)
Stack: (0xffff8003cc6c3ab0 to 0xffff8003cc6c4000) [...] [<ffff00000808892c>] unwind_frame+0x12c/0x180 [<ffff000008305008>] do_task_stat+0x864/0x870 [<ffff000008305c44>] proc_tgid_stat+0x3c/0x48 [<ffff0000082fde0c>] proc_single_show+0x5c/0xb8 [<ffff0000082b27e0>] seq_read+0x160/0x414 [<ffff000008289e6c>] __vfs_read+0x58/0x164 [<ffff00000828b164>] vfs_read+0x88/0x144 [<ffff00000828c2e8>] SyS_read+0x60/0xc0 [<ffff0000080834a0>] __sys_trace_return+0x0/0x4
--- arch/arm64/include/asm/stacktrace.h | 2 +- arch/arm64/kernel/stacktrace.c | 5 +++++ arch/arm64/kernel/time.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
arch/arm64/include/asm/stacktrace.h +1 -1
@@ -23,7 +23,7 @@ struct stackframe {unsigned long sp;unsigned long pc;#ifdef CONFIG_FUNCTION_GRAPH_TRACER -unsigned int graph; +int graph;#endif };
arch/arm64/kernel/stacktrace.c +5 -0
@@ -72,6 +72,11 @@ int notrace unwind_frame(struct task_str#ifdef CONFIG_FUNCTION_GRAPH_TRACER if (tsk->ret_stack && (frame->pc == (unsigned long )return_to_handler)) { +if (WARN_ON_ONCE (frame->graph ==-1 )) +return -EINVAL ; +if (frame->graph <-1 ) + frame->graph +=FTRACE_NOTRACE_DEPTH ; +/* * This is a case where function graph tracer has * modified a return address (LR) in a stack frame
arch/arm64/kernel/time.c +1 -1
@@ -53,7 +53,7 @@ unsigned long profile_pc(struct pt_regs frame.sp = regs->sp; frame.pc = regs->pc;#ifdef CONFIG_FUNCTION_GRAPH_TRACER - frame.graph =-1 ;/* no task info */ + frame.graph = current->curr_ret_stack;#endif do { int ret = unwind_frame(NULL, &frame);
Greg Kroah-Hartman
maintainerPATCH 140/329 macvlan: fix use-after-free in macvlan_common_newlink()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
[ Upstream commit 4e14bf4236490306004782813b8b4494b18f5e60 ]
The following use-after-free was reported by KASan when running LTP macvtap01 test on 4.16-rc2:
[10642.528443] BUG: KASAN: use-after-free in
macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
[10642.626607] Read of size 8 at addr ffff880ba49f2100 by task ip/18450
...
[10642.963873] Call Trace:
[10642.994352] dump_stack+0x5c/0x7c
[10643.035325] print_address_description+0x75/0x290
[10643.092938] kasan_report+0x28d/0x390
[10643.137971] ? macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
[10643.207963] macvlan_common_newlink+0x12ef/0x14a0 [macvlan]
[10643.275978] macvtap_newlink+0x171/0x260 [macvtap]
[10643.334532] rtnl_newlink+0xd4f/0x1300
...
[10646.256176] Allocated by task 18450:
[10646.299964] kasan_kmalloc+0xa6/0xd0
[10646.343746] kmem_cache_alloc_trace+0xf1/0x210
[10646.397826] macvlan_common_newlink+0x6de/0x14a0 [macvlan]
[10646.464386] macvtap_newlink+0x171/0x260 [macvtap]
[10646.522728] rtnl_newlink+0xd4f/0x1300
...
[10647.022028] Freed by task 18450:
[10647.061549] __kasan_slab_free+0x138/0x180
[10647.111468] kfree+0x9e/0x1c0
[10647.147869] macvlan_port_destroy+0x3db/0x650 [macvlan]
[10647.211411] rollback_registered_many+0x5b9/0xb10
[10647.268715] rollback_registered+0xd9/0x190
[10647.319675] register_netdevice+0x8eb/0xc70
[10647.370635] macvlan_common_newlink+0xe58/0x14a0 [macvlan]
[10647.437195] macvtap_newlink+0x171/0x260 [macvtap]Commit d02fd6e7d293 ("macvlan: Fix one possible double free") handles the case when register_netdevice() invokes ndo_uninit() on error and as a result free the port. But 'macvlan_port_get_rtnl(dev))' check (returns dev->rx_handler_data), which was added by this commit in order to prevent double free, is not quite correct:
* for macvlan it always returns NULL because 'lowerdev' is the one that was used to register rx handler (port) in macvlan_port_create() as well as to unregister it in macvlan_port_destroy().
* for macvtap it always returns a valid pointer because macvtap registers its own rx handler before macvlan_common_newlink().
--- drivers/net/macvlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macvlan.c +1 -1
@@ -1384,7 +1384,7 @@ destroy_macvlan_port:/* the macvlan port may be freed by macvlan_uninit when fail to register. * so we destroy the macvlan port only when it's valid. */ -if (create &&macvlan_port_get_rtnl (dev)) +if (create &&macvlan_port_get_rtnl (lowerdev))macvlan_port_destroy (port->dev);return err; }
Greg Kroah-Hartman
maintainerPATCH 141/329 kvm: fix warning for CONFIG_HAVE_KVM_EVENTFD builds
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
[ Upstream commit 076467490b8176eb96eddc548a14d4135c7b5852 ]
Move the kvm_arch_irq_routing_update() prototype outside of ifdef CONFIG_HAVE_KVM_EVENTFD guards to fix the following sparse warning:
arch/s390/kvm/../../../virt/kvm/irqchip.c:171:28: warning: symbol 'kvm_arch_irq_routing_update' was not declared. Should it be static?
--- include/linux/kvm_host.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/kvm_host.h +2 -1
@@ -1070,7 +1070,6 @@ static inline void kvm_irq_routing_updat { }#endif -void kvm_arch_irq_routing_update (struct kvm *kvm);static inline int kvm_ioeventfd (struct kvm *kvm,struct kvm_ioeventfd *args) {
@@ -1079,6 +1078,8 @@ static inline int kvm_ioeventfd(struct k#endif /* CONFIG_HAVE_KVM_EVENTFD */ +void kvm_arch_irq_routing_update (struct kvm *kvm); +static inline void kvm_make_request (int req,struct kvm_vcpu *vcpu) {/*
Greg Kroah-Hartman
maintainerPATCH 142/329 fs: dcache: Avoid livelock between d_alloc_parallel and __d_add
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 015555fd4d2930bc0c86952c46ad88b3392f66e4 ]
If d_alloc_parallel runs concurrently with __d_add, it is possible for d_alloc_parallel to continuously retry whilst i_dir_seq has been incremented to an odd value by __d_add:
CPU0:__d_add
n = start_dir_add(dir); cmpxchg(&dir->i_dir_seq, n, n + 1) == n
CPU1:d_alloc_parallel
retry:
seq = smp_load_acquire(&parent->d_inode->i_dir_seq) & ~1; hlist_bl_lock(b); bit_spin_lock(0, (unsigned long *)b); // Always succeeds
CPU0:
__d_lookup_done(dentry) hlist_bl_lock bit_spin_lock(0, (unsigned long *)b); // Never succeeds
CPU1:
if (unlikely(parent->d_inode->i_dir_seq != seq)) {
hlist_bl_unlock(b);
goto retry;
}Since the simple bit_spin_lock used to implement hlist_bl_lock does not provide any fairness guarantees, then CPU1 can starve CPU0 of the lock and prevent it from reaching end_dir_add(dir), therefore CPU1 cannot exit its retry loop because the sequence number always has the bottom bit set.
This patch resolves the livelock by not taking hlist_bl_lock in d_alloc_parallel if the sequence counter is odd, since any subsequent masked comparison with i_dir_seq will fail anyway.
--- fs/dcache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/dcache.c +7 -1
@@ -2474,7 +2474,7 @@ struct dentry *d_alloc_parallel(struct d retry:rcu_read_lock (); - seq =smp_load_acquire (&parent->d_inode->i_dir_seq) & ~1 ; + seq =smp_load_acquire (&parent->d_inode->i_dir_seq); r_seq =read_seqbegin (&rename_lock); dentry =__d_lookup_rcu (parent, name, &d_seq);if (unlikely (dentry)) {
@@ -2495,6 +2495,12 @@ retry:rcu_read_unlock (); goto retry; } + +if (unlikely (seq &1 )) { +rcu_read_unlock (); + goto retry; + } +hlist_bl_lock (b);if (unlikely (parent->d_inode->i_dir_seq != seq)) {hlist_bl_unlock (b);
Greg Kroah-Hartman
maintainerPATCH 143/329 fs: dcache: Use READ_ONCE when accessing i_dir_seq
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 8cc07c808c9d595e81cbe5aad419b7769eb2e5c9 ]
i_dir_seq is subject to concurrent modification by a cmpxchg or store-release operation, so ensure that the relaxed access in d_alloc_parallel uses READ_ONCE.
--- fs/dcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dcache.c +1 -1
@@ -2502,7 +2502,7 @@ retry: }hlist_bl_lock (b); -if (unlikely (parent->d_inode->i_dir_seq != seq)) { +if (unlikely (READ_ONCE (parent->d_inode->i_dir_seq) != seq)) {hlist_bl_unlock (b);rcu_read_unlock (); goto retry;
Greg Kroah-Hartman
maintainerPATCH 144/329 md: fix a potential deadlock of raid5/raid10 reshape
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: BingJing Chang <[email protected]>
[ Upstream commit 8876391e440ba615b10eef729576e111f0315f87 ]
There is a potential deadlock if mount/umount happens when raid5_finish_reshape() tries to grow the size of emulated disk.
How the deadlock happens?
1) The raid5 resync thread finished reshape (expanding array).
2) The mount or umount thread holds VFS sb->s_umount lock and tries to write through critical data into raid5 emulated block device. So it waits for raid5 kernel thread handling stripes in order to finish it I/Os.
3) In the routine of raid5 kernel thread, md_check_recovery() will be called first in order to reap the raid5 resync thread. That is, raid5_finish_reshape() will be called. In this function, it will try to update conf and call VFS revalidate_disk() to grow the raid5 emulated block device. It will try to acquire VFS sb->s_umount lock.
The raid5 kernel thread cannot continue, so no one can handle mount/ umount I/Os (stripes). Once the write-through I/Os cannot be finished, mount/umount will not release sb->s_umount lock. The deadlock happens.
The raid5 kernel thread is an emulated block device. It is responible to handle I/Os (stripes) from upper layers. The emulated block device should not request any I/Os on itself. That is, it should not call VFS layer functions. (If it did, it will try to acquire VFS locks to guarantee the I/Os sequence.) So we have the resync thread to send resync I/O requests and to wait for the results.
For solving this potential deadlock, we can put the size growth of the emulated block device as the final step of reshape thread.
2017/12/29:
Thanks to Guoqing Jiang <[email protected]>,
we confirmed that there is the same deadlock issue in raid10. It's reproducible and can be fixed by this patch. For raid10.c, we can remove the similar code to prevent deadlock as well since they has been called before.
--- drivers/md/md.c | 13 +++++++++++++ drivers/md/raid10.c | 8 +------- drivers/md/raid5.c | 8 +------- 3 files changed, 15 insertions(+), 14 deletions(-)
drivers/md/md.c +13 -0
@@ -8200,6 +8200,19 @@ void md_do_sync(struct md_thread *threadset_mask_bits (&mddev->flags,0 ,BIT (MD_CHANGE_PENDING ) |BIT (MD_CHANGE_DEVS )); +if (test_bit (MD_RECOVERY_RESHAPE , &mddev->recovery) && + !test_bit (MD_RECOVERY_INTR , &mddev->recovery) && + mddev->delta_disks >0 && + mddev->pers->finish_reshape && + mddev->pers->size && + mddev->queue) { +mddev_lock_nointr (mddev); +md_set_array_sectors (mddev, mddev->pers->size (mddev,0 ,0 )); +mddev_unlock (mddev); +set_capacity (mddev->gendisk, mddev->array_sectors); +revalidate_disk (mddev->gendisk); + } +spin_lock (&mddev->lock);if (!test_bit (MD_RECOVERY_INTR , &mddev->recovery)) {/* We completed so min/max setting can be forgotten if used. */
drivers/md/raid10.c +1 -7
@@ -4684,17 +4684,11 @@ static void raid10_finish_reshape(structreturn ;if (mddev->delta_disks >0 ) { -sector_t size =raid10_size (mddev,0 ,0 ); -md_set_array_sectors (mddev, size);if (mddev->recovery_cp > mddev->resync_max_sectors) { mddev->recovery_cp = mddev->resync_max_sectors;set_bit (MD_RECOVERY_NEEDED , &mddev->recovery); } - mddev->resync_max_sectors = size; -if (mddev->queue) { -set_capacity (mddev->gendisk, mddev->array_sectors); -revalidate_disk (mddev->gendisk); - } + mddev->resync_max_sectors = mddev->array_sectors; }else {int d;rcu_read_lock ();
drivers/md/raid5.c +1 -7
@@ -7615,13 +7615,7 @@ static void raid5_finish_reshape(structif (!test_bit (MD_RECOVERY_INTR , &mddev->recovery)) { -if (mddev->delta_disks >0 ) { -md_set_array_sectors (mddev,raid5_size (mddev,0 ,0 )); -if (mddev->queue) { -set_capacity (mddev->gendisk, mddev->array_sectors); -revalidate_disk (mddev->gendisk); - } - }else { +if (mddev->delta_disks <=0 ) {int d;spin_lock_irq (&conf->device_lock); mddev->degraded =calc_degraded (conf);
Greg Kroah-Hartman
maintainerPATCH 145/329 md/raid1: fix NULL pointer dereference
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yufen Yu <[email protected]>
[ Upstream commit 3de59bb9d551428cbdc76a9ea57883f82e350b4d ]
In handle_write_finished(), if r1_bio->bios[m] != NULL, it thinks the corresponding conf->mirrors[m].rdev is also not NULL. But, it is not always true.
Even if some io hold replacement rdev(i.e. rdev->nr_pending.count > 0), raid1_remove_disk() can also set the rdev as NULL. That means, bios[m] != NULL, but mirrors[m].rdev is NULL, resulting in NULL pointer dereference in handle_write_finished and sync_request_write.
This patch can fix BUGs as follows:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000140 IP: [<ffffffff815bbbbd>] raid1d+0x2bd/0xfc0 PGD 12ab52067 PUD 12f587067 PMD 0 Oops: 0000 [#1] SMP CPU: 1 PID: 2008 Comm: md3_raid1 Not tainted 4.1.44+ #130 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014 Call Trace: ? schedule+0x37/0x90 ? prepare_to_wait_event+0x83/0xf0 md_thread+0x144/0x150 ? wake_atomic_t_function+0x70/0x70 ? md_start_sync+0xf0/0xf0 kthread+0xd8/0xf0 ? kthread_worker_fn+0x160/0x160 ret_from_fork+0x42/0x70 ? kthread_worker_fn+0x160/0x160 BUG: unable to handle kernel NULL pointer dereference at 00000000000000b8 IP: sync_request_write+0x9e/0x980 PGD 800000007c518067 P4D 800000007c518067 PUD 8002b067 PMD 0 Oops: 0000 [#1] SMP PTI CPU: 24 PID: 2549 Comm: md3_raid1 Not tainted 4.15.0+ #118 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014 Call Trace: ? sched_clock+0x5/0x10 ? sched_clock_cpu+0xc/0xb0 ? flush_pending_writes+0x3a/0xd0 ? pick_next_task_fair+0x4d5/0x5f0 ? __switch_to+0xa2/0x430 raid1d+0x65a/0x870 ? find_pers+0x70/0x70 ? find_pers+0x70/0x70 ? md_thread+0x11c/0x160 md_thread+0x11c/0x160 ? finish_wait+0x80/0x80 kthread+0x111/0x130 ? kthread_create_worker_on_cpu+0x70/0x70 ? do_syscall_64+0x6f/0x190 ? SyS_exit_group+0x10/0x10 ret_from_fork+0x35/0x40
--- drivers/md/raid1.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/md/raid1.c +11 -0
@@ -1673,6 +1673,17 @@ static int raid1_remove_disk(struct mddestruct md_rdev *repl = conf->mirrors[conf->raid_disks + number].rdev;freeze_array (conf,0 ); +if (atomic_read (&repl->nr_pending)) { +/* It means that some queued IO of retry_list +* hold repl. Thus, we cannot set replacement +* as NULL, avoiding rdev NULL pointer +* dereference in sync_request_write and +* handle_write_finished. +*/ + err = -EBUSY ; +unfreeze_array (conf); + goto abort; + }clear_bit (Replacement, &repl->flags); p->rdev = repl; conf->mirrors[conf->raid_disks + number].rdev =NULL ;
Greg Kroah-Hartman
maintainerPATCH 146/329 batman-adv: fix packet checksum in receive path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit abd6360591d3f8259f41c34e31ac4826dfe621b8 ]
eth_type_trans() internally calls skb_pull(), which does not adjust the skb checksum; skb_postpull_rcsum() is necessary to avoid log spam of the form "bat0: hw csum failure" when packets with CHECKSUM_COMPLETE are received.
Note that in usual setups, packets don't reach batman-adv with CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see batadv's ethtype?), which is why the log messages do not occur on every system using batman-adv. I could reproduce this issue by stacking batman-adv on top of a VXLAN interface.
--- net/batman-adv/soft-interface.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
net/batman-adv/soft-interface.c +1 -7
@@ -448,13 +448,7 @@ void batadv_interface_rx(struct net_devi/* skb->dev & skb->pkt_type are set here */ skb->protocol =eth_type_trans (skb, soft_iface); - -/* should not be necessary anymore as we use skb_pull_rcsum() -* TODO: please verify this and remove this TODO -* -- Dec 21st 2009, Simon Wunderlich -*/ - -/* skb->ip_summed = CHECKSUM_UNNECESSARY; */ +skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN );batadv_inc_counter (bat_priv,BATADV_CNT_RX ); batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
Greg Kroah-Hartman
maintainerPATCH 147/329 batman-adv: invalidate checksum on fragment reassembly
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 3bf2a09da956b43ecfaa630a2ef9a477f991a46a ]
A more sophisticated implementation could try to combine fragment checksums when all fragments have CHECKSUM_COMPLETE and are split at even offsets. For now, we just set ip_summed to CHECKSUM_NONE to avoid "hw csum failure" warnings in the kernel log when fragmented frames are received. In consequence, skb_pull_rcsum() can be replaced with skb_pull().
Note that in usual setups, packets don't reach batman-adv with CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see batadv's ethtype?), which is why the log messages do not occur on every system using batman-adv. I could reproduce this issue by stacking batman-adv on top of a VXLAN interface.
--- net/batman-adv/fragmentation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/batman-adv/fragmentation.c +2 -1
@@ -276,7 +276,8 @@ batadv_frag_merge_packets(struct hlist_h/* Move the existing MAC header to just before the payload. (Override * the fragment header.) */ -skb_pull_rcsum (skb_out, hdr_size); +skb_pull (skb_out, hdr_size); + skb_out->ip_summed =CHECKSUM_NONE ;memmove (skb_out->data -ETH_HLEN ,skb_mac_header (skb_out),ETH_HLEN );skb_set_mac_header (skb_out, -ETH_HLEN );skb_reset_network_header (skb_out);
Greg Kroah-Hartman
maintainerPATCH 148/329 netfilter: ebtables: convert BUG_ONs to WARN_ONs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit fc6a5d0601c5ac1d02f283a46f60b87b2033e5ca ]
All of these conditions are not fatal and should have been WARN_ONs from the get-go.
Convert them to WARN_ONs and bail out.
--- net/bridge/netfilter/ebtables.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
net/bridge/netfilter/ebtables.c +18 -9
@@ -1625,7 +1625,8 @@ static int compat_match_to_user(struct eint off =ebt_compat_match_offset (match, m->match_size);compat_uint_t msize = m->match_size - off; -BUG_ON (off >= m->match_size); +if (WARN_ON (off >= m->match_size)) +return -EINVAL ;if (copy_to_user (cm->u.name, match->name,strlen (match->name) +1 ) ||put_user (msize, &cm->match_size))
@@ -1652,7 +1653,8 @@ static int compat_target_to_user(structint off =xt_compat_target_offset (target);compat_uint_t tsize = t->target_size - off; -BUG_ON (off >= t->target_size); +if (WARN_ON (off >= t->target_size)) +return -EINVAL ;if (copy_to_user (cm->u.name, target->name,strlen (target->name) +1 ) ||put_user (tsize, &cm->match_size))
@@ -1880,7 +1882,8 @@ static int ebt_buf_add(struct ebt_entrieif (state->buf_kern_start ==NULL ) goto count_only; -BUG_ON (state->buf_kern_offset + sz > state->buf_kern_len); +if (WARN_ON (state->buf_kern_offset + sz > state->buf_kern_len)) +return -EINVAL ;memcpy (state->buf_kern_start + state->buf_kern_offset, data, sz);
@@ -1893,7 +1896,8 @@ static int ebt_buf_add_pad(struct ebt_en {char *b = state->buf_kern_start; -BUG_ON (b && state->buf_kern_offset > state->buf_kern_len); +if (WARN_ON (b && state->buf_kern_offset > state->buf_kern_len)) +return -EINVAL ;if (b !=NULL && sz >0 )memset (b + state->buf_kern_offset,0 , sz);
@@ -1970,8 +1974,10 @@ static int compat_mtw_from_user(struct c pad =XT_ALIGN (size_kern) - size_kern;if (pad >0 && dst) { -BUG_ON (state->buf_kern_len <= pad); -BUG_ON (state->buf_kern_offset - (match_size + off) + size_kern > state->buf_kern_len - pad); +if (WARN_ON (state->buf_kern_len <= pad)) +return -EINVAL ; +if (WARN_ON (state->buf_kern_offset - (match_size + off) + size_kern > state->buf_kern_len - pad)) +return -EINVAL ;memset (dst + size_kern,0 , pad); }return off + match_size;
@@ -2021,7 +2027,8 @@ static int ebt_size_mwt(struct compat_ebif (ret <0 )return ret; -BUG_ON (ret < match32->match_size); +if (WARN_ON (ret < match32->match_size)) +return -EINVAL ; growth += ret - match32->match_size; growth +=ebt_compat_entry_padsize ();
@@ -2130,7 +2137,8 @@ static int size_entry_mwt(struct ebt_ent startoff = state->buf_user_offset - startoff; -BUG_ON (*total < startoff); +if (WARN_ON (*total < startoff)) +return -EINVAL ; *total -= startoff;return 0 ; }
@@ -2257,7 +2265,8 @@ static int compat_do_replace(struct net state.buf_kern_len = size64; ret =compat_copy_entries (entries_tmp, tmp.entries_size, &state); -BUG_ON (ret <0 );/* parses same data again */ +if (WARN_ON (ret <0 )) + goto out_unlock;vfree (entries_tmp); tmp.entries_size = size64;
Greg Kroah-Hartman
maintainerPATCH 149/329 batman-adv: Ignore invalid batadv_iv_gw during netlink send
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 10d570284258a30dc104c50787c5289ec49f3d23 ]
The function batadv_iv_gw_dump stops the processing loop when batadv_iv_gw_dump_entry returns a non-0 return code. This should only happen when the buffer is full. Otherwise, an empty message may be returned by batadv_gw_dump. This empty message will then stop the netlink dumping of gateway entries. At worst, not a single entry is returned to userspace even when plenty of possible gateways exist.
--- net/batman-adv/bat_iv_ogm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +1 -1
@@ -2705,7 +2705,7 @@ static int batadv_iv_gw_dump_entry(strucstruct batadv_neigh_ifinfo *router_ifinfo =NULL ;struct batadv_neigh_node *router;struct batadv_gw_node *curr_gw; -int ret = -EINVAL ; +int ret =0 ;void *hdr; router =batadv_orig_router_get (gw_node->orig_node,BATADV_IF_DEFAULT );