Commit graph

767641 commits

Author SHA1 Message Date
Nicholas Mc Guire
3dc6ddfedc PCI: faraday: Add missing of_node_put()
The call to of_get_next_child() returns a node pointer with refcount
incremented thus it must be explicitly decremented here in the error
path and after the last usage.

Fixes: d3c68e0a7e ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2018-06-29 13:50:27 -05:00
Nicholas Mc Guire
342639d996 PCI: xilinx-nwl: Add missing of_node_put()
The call to of_get_next_child() returns a node pointer with
refcount incremented thus it must be explicitly decremented
here after the last usage.

Fixes: ab597d35ef ("PCI: xilinx-nwl: Add support for Xilinx NWL PCIe Host Controller")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-06-29 13:50:10 -05:00
Nicholas Mc Guire
8c3f9bd851 PCI: xilinx: Add missing of_node_put()
The call to of_get_next_child() returns a node pointer with refcount
incremented thus it must be explicitly decremented here after the last
usage.

Fixes: 8961def568 ("PCI: xilinx: Add Xilinx AXI PCIe Host Bridge IP driver")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
[lorenzo.pieralisi@arm.com: reworked commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-06-29 13:49:54 -05:00
Dan Carpenter
fb0de5b8dc PCI: endpoint: Use after free in pci_epf_unregister_driver()
We need to use list_for_each_entry_safe() because the
pci_ep_cfs_remove_epf_group() function frees "group".

Fixes: ef1433f717 ("PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
2018-06-29 13:49:24 -05:00
Geert Uytterhoeven
9bc5f0833a PCI: controller: dwc: Do not let PCIE_DW_PLAT_HOST default to yes
PCIE_DW_PLAT_HOST does not have any platform dependency, so it should
not default to yes.

Fixes: 1d906b2207 ("PCI: dwc: Add support for EP mode")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
2018-06-29 13:49:04 -05:00
Marek Vasut
3c5777c372 PCI: rcar: Clean up PHY init on failure
If the Gen3 PHY fails to power up, the code does not undo the
initialization caused by phy_init(). Add the missing failure
handling to the rcar_pcie_phy_init_gen3() function.

Fixes: 517ca93a71 ("PCI: rcar: Add R-Car gen3 PHY support")
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
2018-06-29 13:48:54 -05:00
Marek Vasut
4050360f96 PCI: rcar: Shut the PHY down in failpath
If anything fails past phy_init_fn() and the system is a Gen3 with
a PHY, the PHY will be left on and inited. This is caused by the
phy_init_fn, which is in fact a pointer to rcar_pcie_phy_init_gen3()
function, which starts the PHY, yet has no counterpart in the failpath.
Add that counterpart.

Fixes: 517ca93a71 ("PCI: rcar: Add R-Car gen3 PHY support")
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
2018-06-29 13:47:38 -05:00
Stephen Boyd
9cc63791fa Merge branch 'clk-fix-imx6ul-defs' into clk-fixes
* clk-fix-imx6ul-defs:
  dt-bindings: clock: imx6ul: Do not change the clock definition order
2018-06-29 11:40:29 -07:00
Fabio Estevam
55c5e0c602 dt-bindings: clock: imx6ul: Do not change the clock definition order
Commit f5a4670de9 ("clk: imx: Add new clo01 and clo2 controlled
by CCOSR") introduced the CLK_CLKO definitions, but didn't put them
at the end of the list, which may cause dtb breakage when running an old
dtb with a newer kernel.

In order to avoid that, simply add the new CLK_CKO clock definitions
at the end of the list.

Fixes: f5a4670de9 ("clk: imx: Add new clo01 and clo2 controlled by CCOSR")
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2018-06-29 11:40:20 -07:00
Alexei Starovoitov
ca09cb04af Merge branch 'bpf-fixes'
Daniel Borkmann says:

====================
This set contains three fixes that are mostly JIT and set_memory_*()
related. The third in the series in particular fixes the syzkaller
bugs that were still pending; aside from local reproduction & testing,
also 'syz test' wasn't able to trigger them anymore. I've tested this
series on x86_64, arm64 and s390x, and kbuild bot wasn't yelling either
for the rest. For details, please see patches as usual, thanks!
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-06-29 10:47:36 -07:00
Daniel Borkmann
85782e037f bpf: undo prog rejection on read-only lock failure
Partially undo commit 9facc33687 ("bpf: reject any prog that failed
read-only lock") since it caused a regression, that is, syzkaller was
able to manage to cause a panic via fault injection deep in set_memory_ro()
path by letting an allocation fail: In x86's __change_page_attr_set_clr()
it was able to change the attributes of the primary mapping but not in
the alias mapping via cpa_process_alias(), so the second, inner call
to the __change_page_attr() via __change_page_attr_set_clr() had to split
a larger page and failed in the alloc_pages() with the artifically triggered
allocation error which is then propagated down to the call site.

Thus, for set_memory_ro() this means that it returned with an error, but
from debugging a probe_kernel_write() revealed EFAULT on that memory since
the primary mapping succeeded to get changed. Therefore the subsequent
hdr->locked = 0 reset triggered the panic as it was performed on read-only
memory, so call-site assumptions were infact wrong to assume that it would
either succeed /or/ not succeed at all since there's no such rollback in
set_memory_*() calls from partial change of mappings, in other words, we're
left in a state that is "half done". A later undo via set_memory_rw() is
succeeding though due to matching permissions on that part (aka due to the
try_preserve_large_page() succeeding). While reproducing locally with
explicitly triggering this error, the initial splitting only happens on
rare occasions and in real world it would additionally need oom conditions,
but that said, it could partially fail. Therefore, it is definitely wrong
to bail out on set_memory_ro() error and reject the program with the
set_memory_*() semantics we have today. Shouldn't have gone the extra mile
since no other user in tree today infact checks for any set_memory_*()
errors, e.g. neither module_enable_ro() / module_disable_ro() for module
RO/NX handling which is mostly default these days nor kprobes core with
alloc_insn_page() / free_insn_page() as examples that could be invoked long
after bootup and original 314beb9bca ("x86: bpf_jit_comp: secure bpf jit
against spraying attacks") did neither when it got first introduced to BPF
so "improving" with bailing out was clearly not right when set_memory_*()
cannot handle it today.

Kees suggested that if set_memory_*() can fail, we should annotate it with
__must_check, and all callers need to deal with it gracefully given those
set_memory_*() markings aren't "advisory", but they're expected to actually
do what they say. This might be an option worth to move forward in future
but would at the same time require that set_memory_*() calls from supporting
archs are guaranteed to be "atomic" in that they provide rollback if part
of the range fails, once that happened, the transition from RW -> RO could
be made more robust that way, while subsequent RO -> RW transition /must/
continue guaranteeing to always succeed the undo part.

Reported-by: syzbot+a4eb8c7766952a1ca872@syzkaller.appspotmail.com
Reported-by: syzbot+d866d1925855328eac3b@syzkaller.appspotmail.com
Fixes: 9facc33687 ("bpf: reject any prog that failed read-only lock")
Cc: Laura Abbott <labbott@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-06-29 10:47:35 -07:00
Daniel Borkmann
f605ce5eb2 bpf, s390: fix potential memleak when later bpf_jit_prog fails
If we would ever fail in the bpf_jit_prog() pass that writes the
actual insns to the image after we got header via bpf_jit_binary_alloc()
then we also need to make sure to free it through bpf_jit_binary_free()
again when bailing out. Given we had prior bpf_jit_prog() passes to
initially probe for clobbered registers, program size and to fill in
addrs arrray for jump targets, this is more of a theoretical one,
but at least make sure this doesn't break with future changes.

Fixes: 0546231057 ("s390/bpf: Add s390x eBPF JIT compiler backend")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-06-29 10:47:35 -07:00
Daniel Borkmann
18d405af30 bpf, arm32: fix to use bpf_jit_binary_lock_ro api
Any eBPF JIT that where its underlying arch supports ARCH_HAS_SET_MEMORY
would need to use bpf_jit_binary_{un,}lock_ro() pair instead of the
set_memory_{ro,rw}() pair directly as otherwise changes to the former
might break. arm32's eBPF conversion missed to change it, so fix this
up here.

Fixes: 39c13c204b ("arm: eBPF JIT compiler")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-06-29 10:47:35 -07:00
Helge Deller
24b6c22504 parisc: Build kernel without -ffunction-sections
As suggested by Nick Piggin it seems we can drop the -ffunction-sections
compile flag, now that the kernel uses thin archives. Testing with 32-
and 64-bit kernel showed no difference in kernel size.

Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
2018-06-29 17:27:20 +02:00
Jens Axboe
9544bc5347 sg: remove ->sg_magic member
This was introduced more than a decade ago when sg chaining was
added, but we never really caught anything with it. The scatterlist
entry size can be critical, since drivers allocate it, so remove
the magic member. Recently it's been triggering allocation stalls
and failures in NVMe.

Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-06-29 08:48:06 -06:00
Linus Torvalds
cd993fc431 pci-v4.18-fixes-1
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAls2JpMUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vy6Kw//dGmsa6G6+fexMwLj38bRWIN5d7Zb
 h4/szWj362a5xvM9E2dxFVTKkjvuNQMHg0NMysbAPTofmBwgVNs7g/Vb+9PrP6mn
 ef/zkas99Zsqi3BS8Xc0tEdCDTDUTm0uAQHmzFKS19W23VrTySe710i/LR+PA50r
 xqIIjOXyiFI/Va764wrrMaHaq7ADbxVzG+AUGelioHLXoP9mfoWKH6gi/XIflxEp
 j7AnDiPualnJXd3+TgZMGXdlxP+rTWeP4f1WaCWrzBGbucD6uUVZ4eKWRkm3w62b
 U7PKqA5vX1Ri1Sj7GoHAEMouvmGBHMUoJbsh+XRQ6UpmxNJScqUfDyNjWXcMI40u
 LNPKAmKuspeyp0AMjpwsZYNhgqy9A6VOxwtL2MzgVy1Ws7aOKdRXyg03ERyzYmiU
 DttkXt+Qg11WG74vry/vi5b+EfWp526sYwnnTEiux7BDE6wTT/W7LIpR+Varrb1t
 qdf86cAKNwXa5T1+eaTZvFavoFxhPkjELI1kcci+4ehBauLHo5iP5WRU2am1jS3f
 pPK4E2C9kdWWcv41OzneHajxa0vdRFtEO2eSBEh0XHmr+tscPAT2o3I5Q5IFOCsj
 Dbujcnzmv5njgp20wR1TRAePgeSVE5W0GkrMQS4QOHGHz2B+n9N3MxY7XmWfKPlR
 1HSZt/lfSrNA0Mk=
 =hFb/
 -----END PGP SIGNATURE-----

Merge tag 'pci-v4.18-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:

 - Fix crash caused by endpoint library initialization order change
   (Alan Douglas)

 - Fix shpchp NULL pointer dereference regression on non-ACPI platforms
   (Bjorn Helgaas)

 - Move PCI_DOMAINS selection to fix build regression (Lorenzo
   Pieralisi)

* tag 'pci-v4.18-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI: controller: Move PCI_DOMAINS selection to arch Kconfig
  PCI: Initialize endpoint library before controllers
  PCI: shpchp: Manage SHPC unconditionally on non-ACPI systems
2018-06-29 07:22:46 -07:00
Linus Torvalds
5e4e8c55c9 Power management fixes for 4.18-rc3
- Fix the initialization time error handling in the recently added
    Kryo cpufreq driver (Dan Carpenter).
 
  - Fix up the recently added coverage of performance states in the
    generic power domains (genpd) framework (Viresh Kumar).
 
  - Add missing documentation of the new hwp_dynamic_boost sysfs knob
    in the intel_pstate driver (Rafael Wysocki).
 
  - Fix incorrect sysfs path in the intel_pstate driver documentation
    (Rafael Wysocki).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJbNefKAAoJEILEb/54YlRxOgoQALdhhtDm7fDHEh+TJhN4Y8X8
 9PfvRwLQEypyQi2uBl1dQHXjCjt6IYhBzHXN8nMgxPBHQDsMqMmk+lQa5KB2RazM
 xXdMTb6nO4Rd333rsm6hSN+hRFGIOnzFYLmEMMV7nYNIGK6y3Xfo+XFlIBpoLE/h
 mHh4A75mFDIf5bABx+mYVhCfQ4ADwDXqdadkdYKVN4RwmnbLw80dV1FrfBGF+JnS
 9oUPkdueG13q4QA3DveAxtTrO3X7DnlMXbOYDrNoQia2rHKtxzy3ubkTAsbvWn91
 AuEWYWGTbutdBY+ga7smLBGzXUA7iIjNQfvMNZiqB0CGSpD0TzdVXJ9/+h0w+ru7
 Dkw/3ytV7k8LLFO3wZvIc6DQ7Hsq2PxL/Rbm0WNvfv6JhdVmiw4tuP2F8TV9uv28
 ej1w2n1NGUM0Yfi7wL7AyICZMOiwzxZgBpY63AGpk7mNvhZ7oqHzC/ENvJ3l6SLb
 lCviClAeBM+c/VOEXjleMtmf7VSRfvRhrKAl0dL7xLqbW2BrTw3vCmpuYKqMIlQB
 5rpCslgiOqufBvHHdca7UU+9iwuaI66nD6o4KV6VnB1a01THs7D0kgvV0Wj+Xocb
 xdKQ7TbzI6VdYZJ4pPM2ub1rb+fWnQ7d/ASNy/O3C3lV3FYfxPw82idBdfdRq3sa
 0kIEAQLHJIC1TrrZzNsg
 =842O
 -----END PGP SIGNATURE-----

Merge tag 'pm-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix up recently added features (the Kryo cpufreq driver and
  performance states coverage in the generic power domains framework),
  add missing documentation for a recently added sysfs knob in the
  intel_pstate driver and fix an error in its documentation.

  Specifics:

   - Fix the initialization time error handling in the recently added
     Kryo cpufreq driver (Dan Carpenter).

   - Fix up the recently added coverage of performance states in the
     generic power domains (genpd) framework (Viresh Kumar).

   - Add missing documentation of the new hwp_dynamic_boost sysfs knob
     in the intel_pstate driver (Rafael Wysocki).

   - Fix incorrect sysfs path in the intel_pstate driver documentation
     (Rafael Wysocki)"

* tag 'pm-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  Documentation: intel_pstate: Describe hwp_dynamic_boost sysfs knob
  Documentation: admin-guide: intel_pstate: Fix sysfs path
  PM / Domains: Rename opp_node to np
  PM / Domains: Fix return value of of_genpd_opp_to_performance_state()
  cpufreq: qcom-kryo: Fix error handling in probe()
2018-06-29 07:14:41 -07:00
Linus Torvalds
48a3c64b46 amdgpu, mali_dp and meson fixes
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbNa7EAAoJEAx081l5xIa+HssP/iiJ0DnEojSKANbHwk9ZHC9u
 TbRReQ4EwcrVAvUazJOit+MOb/S1aHluWG48hqqcyMAktB0Hx+3E1Dglnm72n/ND
 wdtYpuCvtIbeutLVQbUzYgSR7DC8G4uFVZSgCiNBh+Xw8a2staKi9cI4H9CmZJBb
 0B7dSoGj9Z4HCMaxJ28ORwn2fsD/Y6465PHqKq1Zu5P3diXHPmc91YIlqvDsaPEl
 UzY4BGMnMIeLKamSN3wmhOH7SGwIUjgWPwR/56pLXq55Wy84UqKfQHvjotg6czpl
 jonUtDdbOMfnYDywc+5hmiUFXYRkn8rAatIjOa0U4/fBEI5+u8GHgJCAve0tfA21
 sIRBSnacA5Y2/MOEna5iJVs43AuVSJUGpTzzlZwvvbqyqs84kyyqe9GHpaelXY+b
 8xDL8IuWvR8s+WbtmuCLFefcFP+j9LoelPPY3v73uploycP/dzpXV+CoUB049Ext
 dTT6Kf+qTo4/196TcMAGCLyT4UGYOs1TCQ71+NCvraECs3PyT6WjJ7UTbIwSZEvT
 oEXbQIHBQewonoghVcXLARXsTAqXHXqIOKuBmInETeqn5Ib5+ovfEmcYwOjII29c
 nipTLprSdHgNrSvhk4zbqohavaE31paZO85D5ayHjrvGudOF8A12lBpyPX1JzrbX
 aYhmdk10Dlk6oHxdsVb1
 =Em+E
 -----END PGP SIGNATURE-----

Merge tag 'drm-fixes-2018-06-29' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie:
 "Nothing too major this round:

   - small set of mali-dp fixes

   - single meson fix

   - a bunch of amdgpu fixes (one makes non-4k page sizes not be a bad
     experience)"

* tag 'drm-fixes-2018-06-29' of git://anongit.freedesktop.org/drm/drm:
  drm/amd/display: release spinlock before committing updates to stream
  drm/amdgpu:Support new VCN FW version naming convention
  drm/amdgpu: fix UBSAN: Undefined behaviour for amdgpu_fence.c
  drm/meson: Fix an un-handled error path in 'meson_drv_bind_master()'
  drm/amdgpu: GPU vs CPU page size fixes in amdgpu_vm_bo_split_mapping
  drm/amdgpu: Count disabled CRTCs in commit tail earlier
  drm/mali-dp: Rectify the width and height passed to rotmem_required()
  drm/arm/malidp: Preserve LAYER_FORMAT contents when setting format
  drm: mali-dp: Enable Global SE interrupts mask for DP500
  drm/arm/malidp: Ensure that the crtcs are shutdown before removing any encoder/connector
2018-06-29 07:11:03 -07:00
Linus Torvalds
ff23908bb7 - Fix dm core to use more efficient bio_split() instead of
bio_clone_bioset().  Also fixes splitting bio that has integrity
   payload.
 
 - Three fixes related to properly validating DAX capabilities of a
   stacked DM device that will advertise DAX support.
 
 - Update DM writecache target to use 2-factor allocator arguments.  Kees
   says this is the last related change for 4.18.
 
 - Fix DM zoned target to use GFP_NOIO to avoid triggering reclaim during
   IO submission (caught by lockdep).
 
 - Fix DM thinp to gracefully recover from running out of data space
   while a previous async discard completes (whereby freeing space).
 
 - Fix DM thinp's metadata transaction commit to avoid needless work.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJbNURXAAoJEMUj8QotnQNaPVYIAISzFYsSLEEYiGF5CDn2A07/
 vd4TBIk7sAVQ/zouNGSNUHepoPJZR8E75SLO4lqZ214fyeYl9/48Za3dlyXeHldR
 ziCCYFyHKvKgfZpBpbO43HbZbWvcVplIAt+GhhXepHy9jJC7+XQzMOqGwcvK2pW4
 qCOqLTLaTGdzx5UaoLCG2Yg3E1TrYH0kZei/WLRBGW12WAsCzqNqUsZ5TgeilxCt
 r/5ajPsXkcNjV9BrUNwY43J+WX8eKIuFKRSbnVdjHBEoVCeCwnP1R8WJnMm5/BTh
 KZpyYTlFsBZ+Gvzojt2XI80ttviXtSUoJJNZgze9JT2xR4jMfn4yFQr/odxJucE=
 =ZGTy
 -----END PGP SIGNATURE-----

Merge tag 'for-4.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer:

 - Fix dm core to use more efficient bio_split() instead of
   bio_clone_bioset(). Also fixes splitting bio that has integrity
   payload.

 - Three fixes related to properly validating DAX capabilities of a
   stacked DM device that will advertise DAX support.

 - Update DM writecache target to use 2-factor allocator arguments. Kees
   says this is the last related change for 4.18.

 - Fix DM zoned target to use GFP_NOIO to avoid triggering reclaim
   during IO submission (caught by lockdep).

 - Fix DM thinp to gracefully recover from running out of data space
   while a previous async discard completes (whereby freeing space).

 - Fix DM thinp's metadata transaction commit to avoid needless work.

* tag 'for-4.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm: prevent DAX mounts if not supported
  dax: check for QUEUE_FLAG_DAX in bdev_dax_supported()
  pmem: only set QUEUE_FLAG_DAX for fsdax mode
  dm thin: handle running out of data space vs concurrent discard
  dm raid: don't use 'const' in function return
  dm zoned: avoid triggering reclaim from inside dmz_map()
  dm writecache: use 2-factor allocator arguments
  dm thin metadata: remove needless work from __commit_transaction
  dm: use bio_split() when splitting out the already processed bio
2018-06-29 07:07:25 -07:00
Jens Axboe
49f1c61071 Merge branch 'nvme-4.18' of git://git.infradead.org/nvme into for-linus
Pull single NVMe fix from Christoph.

* 'nvme-4.18' of git://git.infradead.org/nvme:
  nvme-rdma: fix possible double free of controller async event buffer
2018-06-29 07:55:41 -06:00
Bart Van Assche
fad2d4ef63 drbd: Fix drbd_request_prepare() discard handling
Fix the test that verifies whether bio_op(bio) represents a discard
or write zeroes operation. Compile-tested only.

Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Fixes: 7435e9018f ("drbd: zero-out partial unaligned discards on local backend")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-06-29 07:53:21 -06:00
Jens Axboe
1f57f8d442 blk-mq: don't queue more if we get a busy return
Some devices have different queue limits depending on the type of IO. A
classic case is SATA NCQ, where some commands can queue, but others
cannot. If we have NCQ commands inflight and encounter a non-queueable
command, the driver returns busy. Currently we attempt to dispatch more
from the scheduler, if we were able to queue some commands. But for the
case where we ended up stopping due to BUSY, we should not attempt to
retrieve more from the scheduler. If we do, we can get into a situation
where we attempt to queue a non-queueable command, get BUSY, then
successfully retrieve more commands from that scheduler and queue those.
This can repeat forever, starving the non-queuable command indefinitely.

Fix this by NOT attempting to pull more commands from the scheduler, if
we get a BUSY return. This should also be more optimal in terms of
letting requests stay in the scheduler for as long as possible, if we
get a BUSY due to the regular out-of-tags condition.

Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-06-29 07:52:31 -06:00
Avi Kivity
2cd3ae2129 aio: mark __aio_sigset::sigmask const
io_pgetevents() will not change the signal mask.  Mark it const to make
it clear and to reduce the need for casts in user code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Avi Kivity <avi@scylladb.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[hch: reapply the patch that got incorrectly reverted]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-29 06:51:57 -07:00
Christoph Hellwig
e88958e636 net: handle NULL ->poll gracefully
The big aio poll revert broke various network protocols that don't
implement ->poll as a patch in the aio poll serie removed sock_no_poll
and made the common code handle this case.

Reported-by: syzbot+57727883dbad76db2ef0@syzkaller.appspotmail.com
Reported-by: syzbot+cdb0d3176b53d35ad454@syzkaller.appspotmail.com
Reported-by: syzbot+2c7e8f74f8b2571c87e8@syzkaller.appspotmail.com
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Fixes: a11e1d432b ("Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-29 06:51:51 -07:00
David S. Miller
0933cc294f Just three fixes:
* fix HT operation in mesh mode
  * disable preemption in control frame TX
  * check nla_parse_nested() return values
    where missing (two places)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEH1e1rEeCd0AIMq6MB8qZga/fl8QFAls15CcACgkQB8qZga/f
 l8RUkw/+IQjrtvjKN0Y5rdEy8lgvmd16/umIp6XQ+uBDi3sOrcQRy6G0hwMHg+4F
 HZ7UbsazCVDwhwtTL/BPTJLWBJRDM9hTIppw6A4yQy7b9dp7EJVfgk4FxC2nsD1z
 rTzNdTDtrXsLleBOjPxPV0/q6uw4B6fjXhJZvvtPXZUhaB3Uf1gEKrDTMDqHbh5K
 GbPI1DU6k5M0A8co9wwrEyPGBlq0DRd8amftMWzIP0EOZSCK2BD3zIscZkRCT7dG
 +Jd2SFhuvhKvFEHuoQPMxAzotsDpIP7q2ejOSSSs3bHaindTWVmzi7XZgIQ3rT/O
 P8pBV9G4LLaquLNSvM+ihGUxGJXUrYFdsuchvnVr/tYYf3ozGh24XcodVihg47RC
 T7r0y07Ai4wuxI0aYoP26L5pANl4AEsyooKe5lOArUpHDGDWC9c9LiZAveg0d7vJ
 5UtWc+Zlf5n93mHd9/52ktCRo7jqEYFMEU5phwrCKn+YJV6u73BggHp79aAidi9I
 WMOHiLyiOsSfq8PmqASpV2/mz6oStCG188tto6o5CmeMVk6F1EbiMThajdikoNoM
 6K5kGHXYi/wGz4wsohUqWG2KQEM6+pxZeF2GFktGCuKsx7BDfR9V7K2Oub+3VD9Y
 LZXWHYRRq0YDUzXOEaUz1292QE8OAbYyWnNAZTfc8B7whrA5wRA=
 =g4XY
 -----END PGP SIGNATURE-----

Merge tag 'mac80211-for-davem-2018-06-29' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
Just three fixes:
 * fix HT operation in mesh mode
 * disable preemption in control frame TX
 * check nla_parse_nested() return values
   where missing (two places)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 22:09:26 +09:00
Shakeel Butt
e699e2c6a6 net, mm: account sock objects to kmemcg
Currently the kernel accounts the memory for network traffic through
mem_cgroup_[un]charge_skmem() interface. However the memory accounted
only includes the truesize of sk_buff which does not include the size of
sock objects. In our production environment, with opt-out kmem
accounting, the sock kmem caches (TCP[v6], UDP[v6], RAW[v6], UNIX) are
among the top most charged kmem caches and consume a significant amount
of memory which can not be left as system overhead. So, this patch
converts the kmem caches of all sock objects to SLAB_ACCOUNT.

Signed-off-by: Shakeel Butt <shakeelb@google.com>
Suggested-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 21:56:27 +09:00
Stefan Agner
e94595b0f5 drm/exynos: ipp: use correct enum type
The limit_id_fallback array uses enum drm_ipp_size_id to index its
content. The content itself is of type enum drm_exynos_ipp_limit_type.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:09:54 +09:00
Marek Szyprowski
7b7aa62c05 drm/exynos: decon5433: Fix WINCONx reset value
The only bits that should be preserved in decon_win_set_fmt() is
WINCONx_ENWIN_F. All other bits depends on the selected pixel formats and
are set by the mentioned function.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:59 +09:00
Marek Szyprowski
ab337fc274 drm/exynos: decon5433: Fix per-plane global alpha for XRGB modes
Set per-plane global alpha to maximum value to get proper blending of
XRGB and ARGB planes. This fixes the strange order of overlapping planes.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:57 +09:00
Marek Szyprowski
5d5657aac0 drm/exynos: fimc: Use real buffer width for configuring the hardware
DMA hardware should respect buffer pitch, so use the width calculated from
the buffer pitch instead of the virtual one.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:57 +09:00
Marek Szyprowski
dd209ef809 drm/exynos: gsc: Fix support for NV16/61, YUV420/YVU420 and YUV422 modes
Fix following issues related to planar YUV pixel format configuration:
- NV16/61 modes were incorrectly programmed as NV12/21,
- YVU420 was programmed as YUV420 on source,
- YVU420 and YUV422 were programmed as YUV420 on output.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:57 +09:00
Marek Szyprowski
4cc11a5f53 drm/exynos: gsc: Fix DRM_MODE_REFLECT_{X,Y} interpretation
Horizontal (DRM_MODE_REFLECT_Y) and vertical (DMR_MODE_REFLECT_Y) flip
were swapped in GScaler driver. Fix this by swapping code for interpreting
them.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:57 +09:00
Marek Szyprowski
28b676329c drm/exynos: gsc: Increase Exynos5433 buffer width alignment to 16 pixels
Investigation revealed that GScaler hardware requires the real buffer width
(pitch) to be aligned to 16 pixels.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:57 +09:00
Marek Szyprowski
4958a1c0c9 drm/exynos: gsc: Use real buffer width for configuring the hardware
DMA hardware should respect buffer pitch, so use the width calculated from
the buffer pitch instead of the virtual one.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:56 +09:00
Marek Szyprowski
4e1a623031 drm/exynos: scaler: Fix support for YUV420, YUV422 and YUV444 modes
Fix Cb/CR components order in two-planar YUV420, YUV422 and YUV444 modes.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:56 +09:00
Andrzej Pietrasiewicz
280e54c9f6 drm/exynos: scaler: Reset hardware before starting the operation
Ensure that Scaler hardware is properly reset and interrupts are cleared
before processing next image.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:56 +09:00
Marek Szyprowski
1b0966c3e9 drm/exynos: rotator: Fix DRM_MODE_REFLECT_{X,Y} interpretation
Horizontal (DRM_MODE_REFLECT_Y) and vertical (DMR_MODE_REFLECT_Y) flip
were swapped in Rotator driver. Fix this by swapping code for interpreting
them.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:55 +09:00
Marek Szyprowski
69705ad210 drm/exynos: ipp: Rework checking for the correct buffer formats
Prepare a common function for size and scale checks and call it for
source and destination buffers. Then also move there the state-less checks
from exynos_drm_ipp_task_setup_buffer, so the format information is already
available in limits processing. Finally perform the IPP_LIMIT_BUFFER check
on the real width of the buffer (the width calculated from the provided
buffer pitch).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-06-29 18:02:55 +09:00
Rafael J. Wysocki
e27b4d4a7b Merge branch 'pm-domains'
Merge fixups for the recent extenstion of the generic power domains
(genpd) framework covering performance states.

* pm-domains:
  PM / Domains: Rename opp_node to np
  PM / Domains: Fix return value of of_genpd_opp_to_performance_state()
2018-06-29 09:54:20 +02:00
Johannes Berg
95bca62fb7 nl80211: check nla_parse_nested() return values
At the very least we should check the return value if
nla_parse_nested() is called with a non-NULL policy.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2018-06-29 09:44:51 +02:00
Bob Copeland
188f60ab8e nl80211: relax ht operation checks for mesh
Commit 9757235f45, "nl80211: correct checks for
NL80211_MESHCONF_HT_OPMODE value") relaxed the range for the HT
operation field in meshconf, while also adding checks requiring
the non-greenfield and non-ht-sta bits to be set in certain
circumstances.  The latter bit is actually reserved for mesh BSSes
according to Table 9-168 in 802.11-2016, so in fact it should not
be set.

wpa_supplicant sets these bits because the mesh and AP code share
the same implementation, but authsae does not.  As a result, some
meshconf updates from authsae which set only the NONHT_MIXED
protection bits were being rejected.

In order to avoid breaking userspace by changing the rules again,
simply accept the values with or without the bits set, and mask
off the reserved bit to match the spec.

While in here, update the 802.11-2012 reference to 802.11-2016.

Fixes: 9757235f45 ("nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value")
Cc: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Bob Copeland <bobcopeland@fb.com>
Reviewed-by: Masashi Honma <masashi.honma@gmail.com>
Reviewed-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2018-06-29 09:39:30 +02:00
Denis Kenzior
e7441c9274 mac80211: disable BHs/preemption in ieee80211_tx_control_port()
On pre-emption enabled kernels the following print was being seen due to
missing local_bh_disable/local_bh_enable calls.  mac80211 assumes that
pre-emption is disabled in the data path.

    BUG: using smp_processor_id() in preemptible [00000000] code: iwd/517
    caller is __ieee80211_subif_start_xmit+0x144/0x210 [mac80211]
    [...]
    Call Trace:
    dump_stack+0x5c/0x80
    check_preemption_disabled.cold.0+0x46/0x51
    __ieee80211_subif_start_xmit+0x144/0x210 [mac80211]

Fixes: 9118064914 ("mac80211: Add support for tx_control_port")
Signed-off-by: Denis Kenzior <denkenz@gmail.com>
[commit message rewrite, fixes tag]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2018-06-29 09:39:08 +02:00
Wolfram Sang
12b731dd46 i2c: gpio: initialize SCL to HIGH again
It seems that during the conversion from gpio* to gpiod*, the initial
state of SCL was wrongly switched to LOW. Fix it to be HIGH again.

Fixes: 7bb75029ef ("i2c: gpio: Enforce open drain through gpiolib")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
2018-06-29 08:23:12 +02:00
Peter Rosin
9aa613674f i2c: smbus: kill memory leak on emulated and failed DMA SMBus xfers
If DMA safe memory was allocated, but the subsequent I2C transfer
fails the memory is leaked. Plug this leak.

Fixes: 8a77821e74 ("i2c: smbus: use DMA safe buffers for emulated SMBus transactions")
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
2018-06-29 08:19:52 +02:00
Wolfram Sang
2173ed0adc i2c: algos: bit: mention our experience about initial states
So, if somebody wants to re-implement this in the future, we pinpoint to
a problem case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-06-29 08:19:51 +02:00
Wolfram Sang
2a2c8ee2d7 Revert "i2c: algo-bit: init the bus to a known state"
This reverts commit 3e5f06bed7. As per
bugzilla #200045, this caused a regression. I don't really see a way to
fix it without having the hardware. So, revert the patch and I will fix
the issue I was seeing originally in the i2c-gpio driver itself. I
couldn't find new users of this algorithm since, so there should be no
one depending on the new behaviour.

Reported-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Fixes: 3e5f06bed7 ("i2c: algo-bit: init the bus to a known state")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
2018-06-29 08:19:41 +02:00
Jeff Moyer
5a14e91d55 dev-dax: check_vma: ratelimit dev_info-s
This is easily triggered from userspace, so let's ratelimit the
messages.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2018-06-28 18:23:36 -07:00
Dan Williams
b62cc6fdd7 libnvdimm, pmem: Fix memcpy_mcsafe() return code handling in nsio_rw_bytes()
Commit 60622d6822 "x86/asm/memcpy_mcsafe: Return bytes remaining"
converted callers of memcpy_mcsafe() to expect a positive 'bytes
remaining' value rather than a negative error code. The nsio_rw_bytes()
conversion failed to return success. The failure is benign in that
nsio_rw_bytes() will end up writing back what it just read.

Fixes: 60622d6822 ("x86/asm/memcpy_mcsafe: Return bytes remaining")
Cc: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2018-06-28 18:21:30 -07:00
Jann Horn
0da74120c5 selinux: move user accesses in selinuxfs out of locked regions
If a user is accessing a file in selinuxfs with a pointer to a userspace
buffer that is backed by e.g. a userfaultfd, the userspace access can
stall indefinitely, which can block fsi->mutex if it is held.

For sel_read_policy(), remove the locking, since this method doesn't seem
to access anything that requires locking.

For sel_read_bool(), move the user access below the locked region.

For sel_write_bool() and sel_commit_bools_write(), move the user access
up above the locked region.

Cc: stable@vger.kernel.org
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
[PM: removed an unused variable in sel_read_policy()]
Signed-off-by: Paul Moore <paul@paul-moore.com>
2018-06-28 20:39:54 -04:00
David Ahern
4c79579b44 bpf: Change bpf_fib_lookup to return lookup status
For ACLs implemented using either FIB rules or FIB entries, the BPF
program needs the FIB lookup status to be able to drop the packet.
Since the bpf_fib_lookup API has not reached a released kernel yet,
change the return code to contain an encoding of the FIB lookup
result and return the nexthop device index in the params struct.

In addition, inform the BPF program of any post FIB lookup reason as
to why the packet needs to go up the stack.

The fib result for unicast routes must have an egress device, so remove
the check that it is non-NULL.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-06-29 00:02:02 +02:00