platform/kernel/linux-amlogic.git
7 years agoclk: add ao clk for axg
Yun Cai [Thu, 18 May 2017 07:01:03 +0000 (15:01 +0800)]
clk: add ao clk for axg

PD#142470: add ao clk saradc for axg

Change-Id: Icadbbf6e631a6158daade2feb4bfae31bed3c471
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agocfg80211: wifi: force to skip cfg80211_leave_all
Lianghu Su [Thu, 15 Jun 2017 07:01:57 +0000 (15:01 +0800)]
cfg80211: wifi: force to skip cfg80211_leave_all

PD#145741: wifi: bcm: fix unable to enter deep suspend mode issue

for the wowlan (wake on wireless lan) function under Linux platfrom,
we have problem to configure it via wpa_supplicant as we do it at Android
platform. so here when it enter into suspend mode, we try to skip calling
cfg80211_leave_all() function at the wire core path.

since this modify the wifi core code, it will also affect other
wifi drivers (not only bcm wifi).

Change-Id: I51eb9b2864afe1bb478ab9411eb7c590f995cd6e
Signed-off-by: Lianghu Su <lianghu.su@amlogic.com>
7 years agowifi: add pwm configuration for wifi 32k
Jian Hu [Mon, 19 Jun 2017 08:45:35 +0000 (16:45 +0800)]
wifi: add pwm configuration for wifi 32k

PD#146170: wifi: add pwm configuration for wifi 32k

Change-Id: If35f0a495b5b3f9a3ced9cf73ddb0ec7dc1f8ea6
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
7 years agolcd: add lcd driver for axg
Evoke Zhang [Fri, 9 Jun 2017 02:46:09 +0000 (10:46 +0800)]
lcd: add lcd driver for axg

PD#142470: lcd: add lcd driver for axg

Change-Id: I58e2a2af474bafbbe3718f51493c9b46cb07cf31
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agomtd: nand: fix oob read pannic.
Yonghui Yu [Thu, 8 Jun 2017 13:00:13 +0000 (21:00 +0800)]
mtd: nand: fix oob read pannic.

PD#145890: nand: fix oob read

When reading oob by nandread from toolbox of andriod,
the oob should be protected. so we read back the whole
page with ecc on, and copy out oob only.

Change-Id: I08f35396015316a35631727dfbfedb862567d913
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agomtd: nand: enhance the robust of env
Yonghui Yu [Wed, 14 Jun 2017 13:19:51 +0000 (21:19 +0800)]
mtd: nand: enhance the robust of env

PD#145594: nand: enhance the robust of env

1)enhance sudden power lost and ecc-error protection
2)add mtd env mutex for kernel

Change-Id: I0a454149c408f882924543d84db5d46591230d3d
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agoosd: add osd driver for axg
Pengcheng Chen [Fri, 5 May 2017 05:48:36 +0000 (13:48 +0800)]
osd: add osd driver for axg

PD#146066: osd: add osd driver for axg bringup

Change-Id: Iea6889046d2a0bd0d7c79f106e4d89ed9828d035
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agopcie: add pcie reset mode.
Yue Wang [Fri, 16 Jun 2017 03:04:35 +0000 (11:04 +0800)]
pcie: add pcie reset mode.

PD#142470: pcie: add pcie reset mode.

Change-Id: I76999754af16890a7c74d0f31978db69b7710191
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agopcie: power on pcie in the probe.
Yue Wang [Tue, 13 Jun 2017 03:05:06 +0000 (11:05 +0800)]
pcie: power on pcie in the probe.

PD#146002: pcie: power on pcie in the probe.

Change-Id: I36ec41c19a7d6bfbe364ddefeaa2c48f181d5d3b
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agodts: gxl: disable uart_B
Lianghu Su [Tue, 13 Jun 2017 08:15:50 +0000 (16:15 +0800)]
dts: gxl: disable uart_B

PD#145722: gpio conflict between uart_B and sysled, both of them use
GPIODV_24.

Change-Id: I75ff92b8166244044034a94cd79e4cfc24a39f81
Signed-off-by: Lianghu Su <lianghu.su@amlogic.com>
7 years agoclk: fix mpll3 jitter too large
Yun Cai [Mon, 12 Jun 2017 09:02:36 +0000 (17:02 +0800)]
clk: fix mpll3 jitter too large

PD#142470: fix mpll3 jitter too large

Change-Id: I106bf9c627a0125ec61ec221d02c0689e547c965
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agopinctrl&gpio: add new interface to set pull-down/up
xingyu.chen [Wed, 7 Jun 2017 08:02:31 +0000 (16:02 +0800)]
pinctrl&gpio: add new interface to set pull-down/up

PD#142470: pinctrl&gpio: add new interface to set pull-down/up

1. add property file 'pull' in directory /sys/class/gpio/gpioX/
pull-up:      echo up > pull
pull-down:    echo down > pull
pull-disable: echo disable > pull

2. add new functions, as follows:
+ gpiod_set_pull(struct gpio_desc *desc, int value)
+ gpiod_set_pull_cansleep(struct gpio_desc *desc, int value)

'value' can be set:
GPIOD_PULL_DIS
GPIOD_PULL_DOWN
GPIOD_PULL_UP

Change-Id: Iba750729288651a897ebac827093ebc6c143f16b
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
7 years agovpu: add vpu support for axg
Evoke Zhang [Thu, 11 May 2017 09:13:07 +0000 (17:13 +0800)]
vpu: add vpu support for axg

PD#142470: add vpu support for axg

Change-Id: I9be3f440ac25f09e393544121aa33446ff76ff58
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agopinctrl: fixed some pull configuration errors for gxl/gxm
xingyu.chen [Thu, 8 Jun 2017 09:03:30 +0000 (17:03 +0800)]
pinctrl: fixed some pull configuration errors for gxl/gxm

PD#138714: pinctrl: fixed some pull configuration errors for gxl/gxm

Change-Id: I77db8754c17efcdf139a79086ef9009cb7488929
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
7 years agoclkmsr: add special setting for axg audio
Yun Cai [Fri, 26 May 2017 02:23:55 +0000 (10:23 +0800)]
clkmsr: add special setting for axg audio

PD#142470:
1. add special setting for axg audio for AXG
2. update iomap for axg

Change-Id: I1a6ca7bd440aabd1010c854ba0c700b63a105d01
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agopinctrl: avoid requesting the same pin for mux and gpio
xingyu.chen [Mon, 5 Jun 2017 08:16:52 +0000 (16:16 +0800)]
pinctrl: avoid requesting the same pin for mux and gpio

PD#142470: pinctrl: avoid requesting the same pin for mux and gpio

Change-Id: I768aa7d8ffa2792c14c7d932314328d2475c0574
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
7 years agoPD#145277: ge2d: export the symbo of the ge2d funs to media modules.
Nanxin Qin [Wed, 31 May 2017 15:59:14 +0000 (23:59 +0800)]
PD#145277: ge2d: export the symbo of the ge2d funs to media modules.

Change-Id: I4e87b8550869ebeb62ab2fe5252601dd7ac9d40e
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
7 years agoMerge branch 'android-4.9' into amlogic-4.9-dev
Victor Wan [Thu, 8 Jun 2017 02:59:07 +0000 (10:59 +0800)]
Merge branch 'android-4.9' into amlogic-4.9-dev

7 years agoosd: osd support cma, reserved, and ion memory depend on dts config
Pengcheng Chen [Sat, 27 May 2017 03:22:26 +0000 (11:22 +0800)]
osd: osd support cma, reserved, and ion memory depend on dts config

PD#143435: osd support cma, reserved, and ion memory depend on dts config

Change-Id: I79f1a8cebccdb016cee6a6ca54c0356d19fb2657
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agodts: m400: audio: disable i2sclk disable on startup
Peipeng Zhao [Tue, 6 Jun 2017 05:51:58 +0000 (13:51 +0800)]
dts: m400: audio: disable i2sclk disable on startup

PD#141217: audio: fix M400 board noise when device startup

Change-Id: I7030a2648df5e49580d72eaa784fe2c3d0bbdc81
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agopcie: add pcie phy control register access.
Yue Wang [Fri, 2 Jun 2017 07:58:45 +0000 (15:58 +0800)]
pcie: add pcie phy control register access.

PD#142470: pcie: add pcie phy control register access.

Change-Id: I832b05763a722c074980f19682c6249915c0363d
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agodts: axg: add thermal config
Tao Zeng [Wed, 31 May 2017 08:46:05 +0000 (16:46 +0800)]
dts: axg: add thermal config

PD#142470: thermal: enable thermal for axg

1. add thermal node for all axg devices;
2. calculate thermal parameters for all axg device.

Change-Id: I78b7fbe24bfb7910fa52223ade63c93265a6d6e1
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
7 years agounifykey: initial add unifykey driver for m8bb
Jiamin Ma [Wed, 17 May 2017 02:56:23 +0000 (10:56 +0800)]
unifykey: initial add unifykey driver for m8bb

PD#141217: initial add unifykey driver for m8bb

known issues:
1. do not support efuse mode for key storage
2. do not support nand key storage
3. do not suppot unifykey ops in multi-thread env
changelists:
1. use internal sha apis
how to use:
su
cd /sys/class/unifykeys
echo 1 > attach
echo mac > name
echo 001122 > write
echo mac > name
cat read

Change-Id: I0586f1a41ded72553afe3cc4cc199dbc4b563bf1
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agopinctrl: fix some errors and add new function groups for gxl/gxm
xingyu.chen [Thu, 1 Jun 2017 07:52:40 +0000 (15:52 +0800)]
pinctrl: fix some errors and add new function groups for gxl/gxm

PD#138714: pinctrl: fix some errors and add new function groups

Change-Id: I25a99b8715d22c887f07f0cbbbe5b9a3ba42f927
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
7 years agonand: enable 8 copies bl2 for axg by default[3/3]
Yonghui Yu [Mon, 5 Jun 2017 04:45:41 +0000 (12:45 +0800)]
nand: enable 8 copies bl2 for axg by default[3/3]

PD#145459: nand: write 8 copies info-page for axg by default

Change-Id: Id53907f6219678a73581ac9725721d5795993051
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agodtsi: axg: add remote config
Zan Peng [Mon, 5 Jun 2017 12:37:57 +0000 (20:37 +0800)]
dtsi: axg: add remote config

PD#142470: dtsi: axg add remote config

Change-Id: Idb10aea3385d5f48f89fe0dd9fa8c76d4bb49fac
Signed-off-by: Zan Peng <zan.peng@amlogic.com>
7 years agopinctrl: add TEST_N and GPIOCLK bank pins support
xingyu.chen [Thu, 1 Jun 2017 06:07:23 +0000 (14:07 +0800)]
pinctrl: add TEST_N and GPIOCLK bank pins support

PD#142470: pinctrl: add TEST_N and GPIOCK bank pins support

1. add TEST_N pin support for axg and gxl/gxm
2. add GPIOCLK bank pins support for gxl/gxm

Change-Id: I8248ffe94b883a38f971ce07910258602b488cf2
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
7 years agodts: S400: change tdm-b for audio capture
Peipeng Zhao [Fri, 26 May 2017 09:43:37 +0000 (17:43 +0800)]
dts: S400: change tdm-b for audio capture

PD#145484: audio: support snd_soc_dai_set_sysclk for mutli codec

Change-Id: I3a2e24e1321e9251029e0abe79e97a9852a68450
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agoaudio: add pcm186x, ssm3515, ssm3525 codec driver
Peipeng Zhao [Fri, 12 May 2017 10:38:18 +0000 (18:38 +0800)]
audio: add pcm186x, ssm3515, ssm3525 codec driver

PD#145486: audio: add codec driver

Change-Id: Ief27ff9892ffabba81f676f4bed2ec6b4ead74f5
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agodts: m400: add wifi/bt config
Peipeng Zhao [Fri, 2 Jun 2017 10:39:17 +0000 (18:39 +0800)]
dts: m400: add wifi/bt config

PD#141217: add wifi/bt config on dts for board M400

Change-Id: I241607a40ab2341748b22072806f744c7a24f873
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agosdio: slove sdio & emmc dealocks on m8b
Nan Li [Tue, 23 May 2017 07:03:35 +0000 (15:03 +0800)]
sdio: slove sdio & emmc dealocks on m8b

PD#141217: slove sdio & emmc dealocks on m8b.
1) Add a semaphore to avoid emmc deadlocks occur and sdio
when they shared the same controller.
2) remove sd ro of dts.
3) add m400 dts support.

Change-Id: I5fe0a76517a341313513e5abdbc16366724cbbe9
Signed-off-by: Nan Li <nan.li@amlogic.com>
7 years agoaudio: enable pdm module firstly
Xing Wang [Fri, 2 Jun 2017 12:32:15 +0000 (20:32 +0800)]
audio: enable pdm module firstly

PD#142470: audio: ensure pdm module enable firstly
1) Ensure pdm clk and module enable firstly
2) add control that hcic shift gain would be fixed with coeff

Change-Id: I9c0dd7cf0e36d2e653c3f593c853f5d14d1dfdcf
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agoaudio: add tdm lanemask config
Shuai Li [Mon, 5 Jun 2017 00:37:30 +0000 (17:37 -0700)]
audio: add tdm lanemask config

PD#142470: audio: add lanesmask

Change-Id: I56d01ff4f77c90c4fb5575fc654b3459fec1ed14
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
7 years agosecurity: arm: meson: add tee support [2/2]
Peifu Jiang [Wed, 24 May 2017 10:34:15 +0000 (18:34 +0800)]
security: arm: meson: add tee support [2/2]

PD#145094: security: arm: meson: add tee support

Change-Id: I8789ef2b6d774abb6252e60c0726e7384127339f
Signed-off-by: Peifu Jiang <peifu.jiang@amlogic.com>
7 years agoemmc: add emmc HS400 function
Long Yu [Fri, 19 May 2017 01:54:22 +0000 (09:54 +0800)]
emmc: add emmc HS400 function

PD#142470: emmc: support hs400 busmode

1. refix source clock 400MHZ
2. add hs400 timming function

Change-Id: I9cc767262379ba2be5ab5d3e68aae87c1f18c242
Signed-off-by: Long Yu <long.yu@amlogic.com>
7 years agodts: axg: s400,s420: support uart bt
Weiguang Ruan [Tue, 23 May 2017 04:14:34 +0000 (12:14 +0800)]
dts: axg: s400,s420: support uart bt

PD#142470: bt: add s400 & s420 uart bt support

1. add bt power enable configuration: bt-dev
2. enable uart_a
3. add cts rts pin mux for uart_a

Change-Id: I96bbb3c885da3c860bc1015b2b33971ee9740b26
Signed-off-by: Weiguang Ruan <Weiguang.ruan@amlogic.com>
7 years agoaudio: add asoc auge driver for axg
Xing Wang [Tue, 30 May 2017 13:22:31 +0000 (21:22 +0800)]
audio: add asoc auge driver for axg

PD#142470: audio: new Asoc driver
1) tdm module
2) spdif module
3) pdm module
4) audio clock

Change-Id: I064975f4cb036d013a7ca74d781a91c31e7c2436
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agoBACKPORT [FROMLIST] New getsockopt option to get socket cookie
Chenbo Feng [Thu, 6 Apr 2017 02:00:55 +0000 (19:00 -0700)]
BACKPORT [FROMLIST] New getsockopt option to get socket cookie

Cherry-pick from linux net-next branch commit
http://patchwork.ozlabs.org/patch/747590/

Introduce a new getsockopt operation to retrieve the socket cookie
for a specific socket based on the socket fd.  It returns a unique
non-decreasing cookie for each socket.
Tested: https://android-review.googlesource.com/#/c/358163/

Test: Unit test added in kernel/tests

Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Chenbo Feng <fengc@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoUPSTREAM: bpf: cgroup: fix documentation of __cgroup_bpf_update()
Daniel Mack [Mon, 28 Nov 2016 13:11:04 +0000 (14:11 +0100)]
UPSTREAM: bpf: cgroup: fix documentation of __cgroup_bpf_update()

There's a 'not' missing in one paragraph. Add it.

Fixes: 3007098494be ("cgroup: add support for eBPF programs")
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-by: Rami Rosen <roszenrami@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: Change-Id: I3df35d8d3b1261503f9b5bcd90b18c9358f1ac28
       ("cgroup: add support for eBPF programs")
(cherry picked from commit 01ae87eab53675cbdabd5c4d727c4a35e397cce0)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoBACKPORT: bpf: introduce BPF_F_ALLOW_OVERRIDE flag
Alexei Starovoitov [Sat, 11 Feb 2017 04:28:24 +0000 (20:28 -0800)]
BACKPORT: bpf: introduce BPF_F_ALLOW_OVERRIDE flag

If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command
to the given cgroup the descendent cgroup will be able to override
effective bpf program that was inherited from this cgroup.
By default it's not passed, therefore override is disallowed.

Examples:
1.
prog X attached to /A with default
prog Y fails to attach to /A/B and /A/B/C
Everything under /A runs prog X

2.
prog X attached to /A with allow_override.
prog Y fails to attach to /A/B with default (non-override)
prog M attached to /A/B with allow_override.
Everything under /A/B runs prog M only.

3.
prog X attached to /A with allow_override.
prog Y fails to attach to /A with default.
The user has to detach first to switch the mode.

In the future this behavior may be extended with a chain of
non-overridable programs.

Also fix the bug where detach from cgroup where nothing is attached
was not throwing error. Return ENOENT in such case.

Add several testcases and adjust libbpf.

Fixes: 3007098494be ("cgroup: add support for eBPF programs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: Change-Id: I3df35d8d3b1261503f9b5bcd90b18c9358f1ac28
       ("cgroup: add support for eBPF programs")
[AmitP: Refactored original patch for android-4.9 where libbpf sources
        are in samples/bpf/ and test_cgrp2_attach2, test_cgrp2_sock,
        and test_cgrp2_sock2 sample tests do not exist.]
(cherry picked from commit 7f677633379b4abb3281cdbe7e7006f049305c03)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoUPSTREAM: bpf: restore skb->sk before pskb_trim() call
Eric Dumazet [Wed, 26 Apr 2017 16:09:23 +0000 (09:09 -0700)]
UPSTREAM: bpf: restore skb->sk before pskb_trim() call

While testing a fix [1] in ___pskb_trim(), addressing the WARN_ON_ONCE()
in skb_try_coalesce() reported by Andrey, I found that we had an skb
with skb->sk set but no skb->destructor.

This invalidated heuristic found in commit 158f323b9868 ("net: adjust
skb->truesize in pskb_expand_head()") and in cited patch.

Considering the BUG_ON(skb->sk) we have in skb_orphan(), we should
restrain the temporary setting to a minimal section.

[1] https://patchwork.ozlabs.org/patch/755570/
    net: adjust skb->truesize in ___pskb_trim()

Fixes: 8f917bba0042 ("bpf: pass sk to helper functions")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: Change-Id: Ifcbcbe2ab2882dc79c56f9707be1d6aef08c7fd3
       ("BACKPORT: UPSTREAM: bpf: pass sk to helper functions")
(cherry picked from commit d1f496fd8f34a40458d0eda6be0655926559e546)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoUPSTREAM: cgroup: move CONFIG_SOCK_CGROUP_DATA to init/Kconfig
Arnd Bergmann [Tue, 10 Jan 2017 12:08:06 +0000 (13:08 +0100)]
UPSTREAM: cgroup: move CONFIG_SOCK_CGROUP_DATA to init/Kconfig

We now 'select SOCK_CGROUP_DATA' but Kconfig complains that this is
not right when CONFIG_NET is disabled and there is no socket interface:

warning: (CGROUP_BPF) selects SOCK_CGROUP_DATA which has unmet direct dependencies (NET)

I don't know what the correct solution for this is, but simply removing
the dependency on NET from SOCK_CGROUP_DATA by moving it out of the
'if NET' section avoids the warning and does not produce other build
errors.

Fixes: 483c4933ea09 ("cgroup: Fix CGROUP_BPF config")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: Change-Id: Ib41ef78fba02eb9e592558ddbf06f9ec0aa337b6
       ("UPSTREAM: cgroup: Fix CGROUP_BPF config")
(cherry picked from commit 73b351473547e543e9c8166dd67fd99c64c15b0b)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoUPSTREAM: cgroup, bpf: remove unnecessary #include
Alexei Starovoitov [Wed, 30 Nov 2016 18:16:08 +0000 (10:16 -0800)]
UPSTREAM: cgroup, bpf: remove unnecessary #include

this #include is unnecessary and brings whole set of
other headers into cgroup-defs.h. Remove it.

Fixes: 3007098494be ("cgroup: add support for eBPF programs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Rami Rosen <roszenrami@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: Change-Id: I3df35d8d3b1261503f9b5bcd90b18c9358f1ac28
       ("cgroup: add support for eBPF programs")
(cherry picked from commit b634d30a79ecc2d28e61cbe5b1f4443952f37a8f)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoANDROID: mnt: Fix next_descendent
Daniel Rosenberg [Mon, 29 May 2017 23:38:16 +0000 (16:38 -0700)]
ANDROID: mnt: Fix next_descendent

next_descendent did not properly handle the case
where the initial mount had no slaves. In this case,
we would look for the next slave, but since don't
have a master, the check for wrapping around to the
start of the list will always fail. Instead, we check
for this case, and ensure that we end the iteration
when we come back to the root.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 62094374
Change-Id: I43dfcee041aa3730cb4b9a1161418974ef84812e

7 years agodts: s420; remove ethmac config
Alex Deng [Sat, 27 May 2017 14:06:28 +0000 (22:06 +0800)]
dts: s420; remove ethmac config

PD#142470: eth: A113x no eth

Change-Id: I39ee67276a4126b7ecf741285d1b5129eb12cf4b
Signed-off-by: Alex Deng <alex.deng@amlogic.com>
7 years agowifi: meson64: support ath10k pcie wifi and sdio wifi in s400/s420
Weiguang Ruan [Tue, 16 May 2017 14:32:52 +0000 (22:32 +0800)]
wifi: meson64: support ath10k pcie wifi and sdio wifi in s400/s420

PD#142470: wifi
1. add ath10k driver compile as module
add cfg80211_wext_compat to support wext command.

CONFIG_CFG80211_WEXT=y
CONFIG_ATH_COMMON=m
CONFIG_ATH10K=m
CONFIG_ATH10K_PCI=m

2. fix wifi enalbe & irq pin num
3. add pwm config for 32k
4. add 32k pin mux

Change-Id: I71872ceef147b6cc49a76bce837a9aff0d5be66f
Signed-off-by: Weiguang Ruan <Weiguang.ruan@amlogic.com>
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agodts: add watchdog support for axg
Bo Yang [Tue, 9 May 2017 06:54:08 +0000 (14:54 +0800)]
dts: add watchdog support for axg

PD#142470: dts: add watchdog support for axg

Default disable watchdog.

Change-Id: I1d314594eff9773d04aeb4943a4e89604c35f100
Signed-off-by: Bo Yang <bo.yang@amlogic.com>
7 years agoeth: add ethernet function for axg
Yizhou Jiang [Wed, 17 May 2017 02:33:14 +0000 (10:33 +0800)]
eth: add ethernet function for axg

PD#142470: eth: add ethernet for axg

1.for external phy
2.not set regs that did not exist in axg

Change-Id: I4d9f8732f35a0e9e605f1a4a4a9a0285236e705f
Signed-off-by: Yizhou Jiang <yizhou.jiang@amlogic.com>
7 years agopinctrl: add enable interface for gpio request
xingyu.chen [Thu, 18 May 2017 04:48:38 +0000 (12:48 +0800)]
pinctrl: add enable interface for gpio request

PD#142470: pinctrl and fix tas5707 reset pin
1. add enable interface for gpio request
mux register be set '0x0' when pin requested as gpio
2. fix reset pin of gpio ao in dts.
3. fix gpio ctl when no reset pin defined in dts

Change-Id: I866d29a96025811b1d0436eb5d157e4dff1ff7ca
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
Signed-off-by: Alex Deng <alex.deng@amlogic.com>
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agoemmc/sdio: support emmc/sdio driver for new host controller
Long Yu [Tue, 16 May 2017 15:26:41 +0000 (23:26 +0800)]
emmc/sdio: support emmc/sdio driver for new host controller

PD#142470: emmc/sdio: support emmc/sdio driver for new host controller
1. add emmc support
2. support emmc DDR52 Busmode
3. add sdio support
4: axg_s400: disabled emmc function

Change-Id: Iaccca580393477f0ad96e7638dfa4d9e2809c37d
Signed-off-by: Long Yu <long.yu@amlogic.com>
7 years agodts: all uart dts setting [1/1]
Qi Duan [Mon, 15 May 2017 09:48:40 +0000 (17:48 +0800)]
dts: all uart dts setting [1/1]

PD#142470: all uart dts setting

all uart node added.default is disable
If want to enable, 1. status = okay 2.set the right pinmux

Change-Id: I744db5735212f3a3217a4b9e26f4ebe074aa5bdc
Signed-off-by: Qi Duan <qi.duan@amlogic.com>
7 years agonand: update config for mtd driver
Yonghui Yu [Mon, 15 May 2017 03:49:39 +0000 (11:49 +0800)]
nand: update config for mtd driver

PD#142470: update nand config for mtd
1. update dts of skt&s400
2. update clock reg
3. update regbase
4. update bchmode for infopage
5. mtd: support desctrete uboot layout for slc
   change uboot layout for slc [3/3]

multi bootloaders were stored in mlc/slc/emmc.

For emmc/mlc, there's enough space at the begining.
bl2&fip can be stored together which we may call it
as compact mode.
    |bl2|fip|bl2|fip|bl2|fip|rsv|normal|

But for slc, space is restricted by romboot. bl2 and
fip had to be stored discretely.
    |bl2|bl2|bl2|bl2|rsv|fip|fip|fip|fip|normal|

If kernle want mtd driver use descrete mode.
1. bl_mode in dts should be set as 1.
2. fip_copies and fip_size should be the same as uboot which
   was described by marco CONFIG_TPL_COPY_NUM&CONFIG_TPL_SIZE_PER_COPY.
3. And the tpl partition should be added in mtd partition table whose
    offset and size are negligible.

when using, mtd0 is for bl2, mtd1 is for tpl(fip)

Change-Id: I0ed07168ba7497d674a7160f7966ebb484a123d5
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agoMakefile: lock kernel version without localversion appended
Yixun Lan [Thu, 25 May 2017 04:27:15 +0000 (12:27 +0800)]
Makefile: lock kernel version without localversion appended

PD#144946: Makefile: lock kernel version without localversion appended

after this change, we will lock kernel version to 4.x.y
but we can still get out the exact commit version from dmesg.

1) uname -r : 4.9.27
2) dmesg |grep "Linux version"
  [    0.000000@0] Linux version 4.9.27-638106-g5de5d7a  ....

Change-Id: I35072b399af403d3a1737300a8786cf36063c668
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
7 years agospicc: add spicc driver for axg
Sunny Luo [Fri, 5 May 2017 12:45:58 +0000 (20:45 +0800)]
spicc: add spicc driver for axg

PD#142470: add spicc driver for axg and fix spicc-b
interrupt number error

Change-Id: Ibbda6d8526c4141992fcbe307d6f1e0fbc570cfe
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
7 years agousb: dts: set otg switch for board axg
Yue Wang [Fri, 12 May 2017 06:52:39 +0000 (14:52 +0800)]
usb: dts: set otg switch for board axg

PD#142470: set otg switch for board axg

Change-Id: I97500402a2747910d82b9928a55419d35ce2f826
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agopcie: add pcie driver for axg
Yue Wang [Fri, 12 May 2017 01:55:03 +0000 (09:55 +0800)]
pcie: add pcie driver for axg

PD#142470: add pcie driver for axg
1. update dts of skt&s400
2. update pcie driver

Change-Id: Ic569e8fed1a4434e54847580299703f0fe07cd9b
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agoclk: update clk for axg
Yun Cai [Fri, 5 May 2017 06:41:21 +0000 (14:41 +0800)]
clk: update clk for axg

PD#142470:
1. add amlogic,axg-clkc.h for mesonaxg.dtsi
and fix clkc reg value
2. update pcie and hifi pll setting for axg

PD#142470: update hifi pll setting for axg

Change-Id: I34aac4ead8384e6a150ae8630034c247f53ac27a
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agocrypto: sha driver update
Matthew Shyu [Fri, 31 Mar 2017 10:33:40 +0000 (18:33 +0800)]
crypto: sha driver update

PD#142470: crypto: sha driver update for txlx and beyond

Change-Id: Ia5eb0c1750bedd0894e3db1e7f0796de23cce1dd
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
7 years agoi2c: add i2c support for axg
Xuhua Zhang [Thu, 11 May 2017 11:18:13 +0000 (19:18 +0800)]
i2c: add i2c support for axg

PD#142470: i2c: add i2c support fot axg and fix i2c_ao error on axg

Change-Id: I15c00bc5833dd10c94562e939c6b53d0138ac231
Signed-off-by: Xuhua Zhang <xuhua.zhang@amlogic.com>
7 years agopwm: add pwm support for axg
Jian Hu [Fri, 5 May 2017 06:04:24 +0000 (14:04 +0800)]
pwm: add pwm support for axg

PD#142470: pwm: add pwm support fot axg

the pwm groups's addresses are the same with txlx,
just add several macros to support axg.

Change-Id: Iaefa3c2a31fc8f43e4dc80448c6548c2df62fa8f
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
7 years agodts: add dts for A113D socket and development boards
Yun Cai [Sat, 27 May 2017 06:06:57 +0000 (14:06 +0800)]
dts: add dts for A113D socket and development boards

PD#142470: add axg_a113d_skt.dts axg_s400.dts and axg_s420.dts

Change-Id: If8c5b1e0fa5b6a21a91ce1323fa1107d608c4af7
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agoMerge 4.9.30 into android-4.9
Greg Kroah-Hartman [Thu, 25 May 2017 15:32:43 +0000 (17:32 +0200)]
Merge 4.9.30 into android-4.9

Changes in 4.9.30
usb: misc: legousbtower: Fix buffers on stack
usb: misc: legousbtower: Fix memory leak
USB: ene_usb6250: fix DMA to the stack
watchdog: pcwd_usb: fix NULL-deref at probe
char: lp: fix possible integer overflow in lp_setup()
USB: core: replace %p with %pK
tpm_tis_core: Choose appropriate timeout for reading burstcount
ALSA: hda: Fix cpu lockup when stopping the cmd dmas
ARM: tegra: paz00: Mark panel regulator as enabled on boot
fanotify: don't expose EOPENSTALE to userspace
tpm_tis_spi: Use single function to transfer data
tpm_tis_spi: Abort transfer when too many wait states are signaled
tpm_tis_spi: Check correct byte for wait state indicator
tpm_tis_spi: Remove limitation of transfers to MAX_SPI_FRAMESIZE bytes
tpm_tis_spi: Add small delay after last transfer
tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver
tpm: add sleep only for retry in i2c_nuvoton_write_status()
tpm_crb: check for bad response size
ASoC: cs4271: configure reset GPIO as output
mlx5: Fix mlx5_ib_map_mr_sg mr length
infiniband: call ipv6 route lookup via the stub interface
dm btree: fix for dm_btree_find_lowest_key()
dm raid: select the Kconfig option CONFIG_MD_RAID0
dm bufio: avoid a possible ABBA deadlock
dm bufio: check new buffer allocation watermark every 30 seconds
dm mpath: split and rename activate_path() to prepare for its expanded use
dm cache metadata: fail operations if fail_io mode has been established
dm bufio: make the parameter "retain_bytes" unsigned long
dm thin metadata: call precommit before saving the roots
dm space map disk: fix some book keeping in the disk space map
md: update slab_cache before releasing new stripes when stripes resizing
md: MD_CLOSING needs to be cleared after called md_set_readonly or do_md_stop
rtlwifi: rtl8821ae: setup 8812ae RFE according to device type
mwifiex: MAC randomization should not be persistent
mwifiex: pcie: fix cmd_buf use-after-free in remove/reset
ima: accept previously set IMA_NEW_FILE
KVM: x86: Fix load damaged SSEx MXCSR register
KVM: x86: Fix potential preemption when get the current kvmclock timestamp
KVM: X86: Fix read out-of-bounds vulnerability in kvm pio emulation
x86: fix 32-bit case of __get_user_asm_u64()
regulator: rk808: Fix RK818 LDO2
regulator: tps65023: Fix inverted core enable logic.
s390/kdump: Add final note
s390/cputime: fix incorrect system time
ath9k_htc: Add support of AirTies 1eda:2315 AR9271 device
ath9k_htc: fix NULL-deref at probe
drm/amdgpu: Make display watermark calculations more accurate
drm/amdgpu: Avoid overflows/divide-by-zero in latency_watermark calculations.
drm/amdgpu: Add missing lb_vblank_lead_lines setup to DCE-6 path.
drm/nouveau/therm: remove ineffective workarounds for alarm bugs
drm/nouveau/tmr: ack interrupt before processing alarms
drm/nouveau/tmr: fix corruption of the pending list when rescheduling an alarm
drm/nouveau/tmr: avoid processing completed alarms when adding a new one
drm/nouveau/tmr: handle races with hw when updating the next alarm time
gpio: omap: return error if requested debounce time is not possible
cdc-acm: fix possible invalid access when processing notification
ohci-pci: add qemu quirk
cxl: Force context lock during EEH flow
cxl: Route eeh events to all drivers in cxl_pci_error_detected()
proc: Fix unbalanced hard link numbers
of: fix sparse warning in of_pci_range_parser_one
of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes()
of: fdt: add missing allocation-failure check
ibmvscsis: Do not send aborted task response
iio: dac: ad7303: fix channel description
IIO: bmp280-core.c: fix error in humidity calculation
IB/hfi1: Return an error on memory allocation failure
IB/hfi1: Fix a subcontext memory leak
pid_ns: Sleep in TASK_INTERRUPTIBLE in zap_pid_ns_processes
pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()
USB: serial: ftdi_sio: fix setting latency for unprivileged users
USB: serial: ftdi_sio: add Olimex ARM-USB-TINY(H) PIDs
USB: chaoskey: fix Alea quirk on big-endian hosts
f2fs: check entire encrypted bigname when finding a dentry
fscrypt: avoid collisions when presenting long encrypted filenames
libnvdimm: fix clear length of nvdimm_forget_poison()
xhci: remove GFP_DMA flag from allocation
usb: host: xhci-plat: propagate return value of platform_get_irq()
xhci: apply PME_STUCK_QUIRK and MISSING_CAS quirk for Denverton
usb: host: xhci-mem: allocate zeroed Scratchpad Buffer
net: irda: irda-usb: fix firmware name on big-endian hosts
usbvision: fix NULL-deref at probe
mceusb: fix NULL-deref at probe
ttusb2: limit messages to buffer size
dvb-usb-dibusb-mc-common: Add MODULE_LICENSE
usb: dwc3: gadget: Prevent losing events in event cache
usb: musb: tusb6010_omap: Do not reset the other direction's packet size
usb: musb: Fix trying to suspend while active for OTG configurations
USB: iowarrior: fix info ioctl on big-endian hosts
usb: serial: option: add Telit ME910 support
USB: serial: qcserial: add more Lenovo EM74xx device IDs
USB: serial: mct_u232: fix big-endian baud-rate handling
USB: serial: io_ti: fix div-by-zero in set_termios
USB: hub: fix SS hub-descriptor handling
USB: hub: fix non-SS hub-descriptor handling
ipx: call ipxitf_put() in ioctl error path
iio: proximity: as3935: fix as3935_write
iio: hid-sensor: Store restore poll and hysteresis on S3
s5p-mfc: Fix race between interrupt routine and device functions
gspca: konica: add missing endpoint sanity check
s5p-mfc: Fix unbalanced call to clock management
dib0700: fix NULL-deref at probe
zr364xx: enforce minimum size when reading header
dvb-frontends/cxd2841er: define symbol_rate_min/max in T/C fe-ops
digitv: limit messages to buffer size
dw2102: limit messages to buffer size
cx231xx-audio: fix init error path
cx231xx-audio: fix NULL-deref at probe
cx231xx-cards: fix NULL-deref at probe
powerpc/mm: Ensure IRQs are off in switch_mm()
powerpc/eeh: Avoid use after free in eeh_handle_special_event()
powerpc/book3s/mce: Move add_taint() later in virtual mode
powerpc/pseries: Fix of_node_put() underflow during DLPAR remove
powerpc/iommu: Do not call PageTransHuge() on tail pages
powerpc/64e: Fix hang when debugging programs with relocated kernel
powerpc/tm: Fix FP and VMX register corruption
arm64: KVM: Do not use stack-protector to compile EL2 code
arm: KVM: Do not use stack-protector to compile HYP code
KVM: arm: plug potential guest hardware debug leakage
ARM: 8662/1: module: split core and init PLT sections
ARM: 8670/1: V7M: Do not corrupt vector table around v7m_invalidate_l1 call
ARM: dts: at91: sama5d3_xplained: fix ADC vref
ARM: dts: at91: sama5d3_xplained: not all ADC channels are available
ARM: dts: imx6sx-sdb: Remove OPP override
arm64: dts: hi6220: Reset the mmc hosts
arm64: xchg: hazard against entire exchange variable
arm64: ensure extension of smp_store_release value
arm64: armv8_deprecated: ensure extension of addr
arm64: uaccess: ensure extension of access_ok() addr
arm64: documentation: document tagged pointer stack constraints
staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.
staging: rtl8192e: fix 2 byte alignment of register BSSIDR.
staging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD.
staging: rtl8192e: GetTs Fix invalid TID 7 warning.
iommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings
metag/uaccess: Fix access_ok()
metag/uaccess: Check access_ok in strncpy_from_user
stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms
uwb: fix device quirk on big-endian hosts
genirq: Fix chained interrupt data ordering
nvme: unmap CMB and remove sysfs file in reset path
MIPS: Loongson-3: Select MIPS_L1_CACHE_SHIFT_6
osf_wait4(): fix infoleak
um: Fix to call read_initrd after init_bootmem
tracing/kprobes: Enforce kprobes teardown after testing
PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC
PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
PCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms
PCI: Fix another sanity check bug in /proc/pci mmap
PCI: Only allow WC mmap on prefetchable resources
PCI: Freeze PME scan before suspending devices
mtd: nand: orion: fix clk handling
mtd: nand: omap2: Fix partition creation via cmdline mtdparts
mtd: nand: add ooblayout for old hamming layout
drm/edid: Add 10 bpc quirk for LGD 764 panel in HP zBook 17 G2
NFSv4: Fix a hang in OPEN related to server reboot
NFS: Fix use after free in write error path
NFS: Use GFP_NOIO for two allocations in writeback
nfsd: fix undefined behavior in nfsd4_layout_verify
nfsd: encoders mustn't use unitialized values in error cases
drivers: char: mem: Check for address space wraparound with mmap()
drm/i915/gvt: Disable access to stolen memory as a guest
Linux 4.9.30

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
7 years agoLinux 4.9.30 v4.9.30
Greg Kroah-Hartman [Thu, 25 May 2017 13:45:05 +0000 (15:45 +0200)]
Linux 4.9.30

7 years agodrm/i915/gvt: Disable access to stolen memory as a guest
Chris Wilson [Wed, 9 Nov 2016 10:39:05 +0000 (10:39 +0000)]
drm/i915/gvt: Disable access to stolen memory as a guest

commit 04a68a35ce6d7b54749989f943993020f48fed62 upstream.

Explicitly disable stolen memory when running as a guest in a virtual
machine, since the memory is not mediated between clients and reserved
entirely for the host. The actual size should be reported as zero, but
like every other quirk we want to tell the user what is happening.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161109103905.17860-1-chris@chris-wilson.co.uk
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: char: mem: Check for address space wraparound with mmap()
Julius Werner [Fri, 12 May 2017 21:42:58 +0000 (14:42 -0700)]
drivers: char: mem: Check for address space wraparound with mmap()

commit b299cde245b0b76c977f4291162cf668e087b408 upstream.

/dev/mem currently allows mmap() mappings that wrap around the end of
the physical address space, which should probably be illegal. It
circumvents the existing STRICT_DEVMEM permission check because the loop
immediately terminates (as the start address is already higher than the
end address). On the x86_64 architecture it will then cause a panic
(from the BUG(start >= end) in arch/x86/mm/pat.c:reserve_memtype()).

This patch adds an explicit check to make sure offset + size will not
wrap around in the physical address type.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonfsd: encoders mustn't use unitialized values in error cases
J. Bruce Fields [Fri, 5 May 2017 20:17:57 +0000 (16:17 -0400)]
nfsd: encoders mustn't use unitialized values in error cases

commit f961e3f2acae94b727380c0b74e2d3954d0edf79 upstream.

In error cases, lgp->lg_layout_type may be out of bounds; so we
shouldn't be using it until after the check of nfserr.

This was seen to crash nfsd threads when the server receives a LAYOUTGET
request with a large layout type.

GETDEVICEINFO has the same problem.

Reported-by: Ari Kauppi <Ari.Kauppi@synopsys.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonfsd: fix undefined behavior in nfsd4_layout_verify
Ari Kauppi [Fri, 5 May 2017 20:07:55 +0000 (16:07 -0400)]
nfsd: fix undefined behavior in nfsd4_layout_verify

commit b550a32e60a4941994b437a8d662432a486235a5 upstream.

  UBSAN: Undefined behaviour in fs/nfsd/nfs4proc.c:1262:34
  shift exponent 128 is too large for 32-bit type 'int'

Depending on compiler+architecture, this may cause the check for
layout_type to succeed for overly large values (which seems to be the
case with amd64). The large value will be later used in de-referencing
nfsd4_layout_ops for function pointers.

Reported-by: Jani Tuovila <tuovila@synopsys.com>
Signed-off-by: Ari Kauppi <ari@synopsys.com>
[colin.king@canonical.com: use LAYOUT_TYPE_MAX instead of 32]
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoNFS: Use GFP_NOIO for two allocations in writeback
Benjamin Coddington [Wed, 19 Apr 2017 14:11:33 +0000 (10:11 -0400)]
NFS: Use GFP_NOIO for two allocations in writeback

commit ae97aa524ef495b6276fd26f5d5449fb22975d7c upstream.

Prevent a deadlock that can occur if we wait on allocations
that try to write back our pages.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Fixes: 00bfa30abe869 ("NFS: Create a common pgio_alloc and pgio_release...")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoNFS: Fix use after free in write error path
Fred Isaman [Fri, 14 Apr 2017 18:24:28 +0000 (14:24 -0400)]
NFS: Fix use after free in write error path

commit 1f84ccdf37d0db3a70714d02d51b0b6d45887fb8 upstream.

Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Fixes: 0bcbf039f6b2b ("nfs: handle request add failure properly")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoNFSv4: Fix a hang in OPEN related to server reboot
Trond Myklebust [Sat, 15 Apr 2017 23:20:01 +0000 (19:20 -0400)]
NFSv4: Fix a hang in OPEN related to server reboot

commit 56e0d71ef12f026d96213e45a662bde6bbff4676 upstream.

If the server fails to return the attributes as part of an OPEN
reply, and then reboots, we can end up hanging. The reason is that
the client attempts to send a GETATTR in order to pick up the
missing OPEN call, but fails to release the slot first, causing
reboot recovery to deadlock.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Fixes: 2e80dbe7ac51a ("NFSv4.1: Close callback races for OPEN, LAYOUTGET...")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/edid: Add 10 bpc quirk for LGD 764 panel in HP zBook 17 G2
Mario Kleiner [Fri, 21 Apr 2017 15:05:08 +0000 (17:05 +0200)]
drm/edid: Add 10 bpc quirk for LGD 764 panel in HP zBook 17 G2

commit e345da82bd6bdfa8492f80b3ce4370acfd868d95 upstream.

The builtin eDP panel in the HP zBook 17 G2 supports 10 bpc,
as advertised by the Laptops product specs and verified via
injecting a fixed edid + photometer measurements, but edid
reports unknown depth, so drivers fall back to 6 bpc.

Add a quirk to get the full 10 bpc.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1492787108-23959-1-git-send-email-mario.kleiner.de@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomtd: nand: add ooblayout for old hamming layout
Alexander Couzens [Tue, 2 May 2017 10:19:00 +0000 (12:19 +0200)]
mtd: nand: add ooblayout for old hamming layout

commit 6a623e07694437ad09f382a13f76cffc32239a7f upstream.

The old 1-bit hamming layout requires ECC data to be placed at a
fixed offset, and not necessarily at the end of the OOB area.
Add this old layout back in order to fix legacy setups.

Fixes: 41b207a70d3a ("mtd: nand: implement the default mtd_ooblayout_ops")
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomtd: nand: omap2: Fix partition creation via cmdline mtdparts
Roger Quadros [Thu, 30 Mar 2017 07:37:50 +0000 (10:37 +0300)]
mtd: nand: omap2: Fix partition creation via cmdline mtdparts

commit 2d283ede59869159f4bb84ae689258c5caffce54 upstream.

commit c9711ec5250b ("mtd: nand: omap: Clean up device tree support")
caused the parent device name to be changed from "omap2-nand.0"
to "<base address>.nand"  (e.g. 30000000.nand on omap3 platforms).
This caused mtd->name to be changed as well. This breaks partition
creation via mtdparts passed by u-boot as it uses "omap2-nand.0"
for the mtd-id.

Fix this by explicitly setting the mtd->name to "omap2-nand.<CS number>"
if it isn't already set by nand_set_flash_node(). CS number is the
NAND controller instance ID.

Fixes: c9711ec5250b ("mtd: nand: omap: Clean up device tree support")
Reported-by: Leto Enrico <enrico.leto@siemens.com>
Reported-by: Adam Ford <aford173@gmail.com>
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomtd: nand: orion: fix clk handling
Simon Baatz [Mon, 27 Mar 2017 18:02:07 +0000 (20:02 +0200)]
mtd: nand: orion: fix clk handling

commit 675b11d94ce9baa5eb365a51b35d2793f77c8ab8 upstream.

The clk handling in orion_nand.c had two problems:

- In the probe function, clk_put() was called for an enabled clock,
  which violates the API (see documentation for clk_put() in
  include/linux/clk.h)

- In the error path of the probe function, clk_put() could be called
  twice for the same clock.

In order to clean this up, use the managed function devm_clk_get() and
store the pointer to the clk in the driver data.

Fixes: baffab28b13120694fa3ebab08d3e99667a851d2 ('ARM: Orion: fix driver probe error handling with respect to clk')
Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: Freeze PME scan before suspending devices
Lukas Wunner [Tue, 18 Apr 2017 18:44:30 +0000 (20:44 +0200)]
PCI: Freeze PME scan before suspending devices

commit ea00353f36b64375518662a8ad15e39218a1f324 upstream.

Laurent Pinchart reported that the Renesas R-Car H2 Lager board (r8a7790)
crashes during suspend tests.  Geert Uytterhoeven managed to reproduce the
issue on an M2-W Koelsch board (r8a7791):

  It occurs when the PME scan runs, once per second.  During PME scan, the
  PCI host bridge (rcar-pci) registers are accessed while its module clock
  has already been disabled, leading to the crash.

One reproducer is to configure s2ram to use "s2idle" instead of "deep"
suspend:

  # echo 0 > /sys/module/printk/parameters/console_suspend
  # echo s2idle > /sys/power/mem_sleep
  # echo mem > /sys/power/state

Another reproducer is to write either "platform" or "processors" to
/sys/power/pm_test.  It does not (or is less likely) to happen during full
system suspend ("core" or "none") because system suspend also disables
timers, and thus the workqueue handling PME scans no longer runs.  Geert
believes the issue may still happen in the small window between disabling
module clocks and disabling timers:

  # echo 0 > /sys/module/printk/parameters/console_suspend
  # echo platform > /sys/power/pm_test    # Or "processors"
  # echo mem > /sys/power/state

(Make sure CONFIG_PCI_RCAR_GEN2 and CONFIG_USB_OHCI_HCD_PCI are enabled.)

Rafael Wysocki agrees that PME scans should be suspended before the host
bridge registers become inaccessible.  To that end, queue the task on a
workqueue that gets frozen before devices suspend.

Rafael notes however that as a result, some wakeup events may be missed if
they are delivered via PME from a device without working IRQ (which hence
must be polled) and occur after the workqueue has been frozen.  If that
turns out to be an issue in practice, it may be possible to solve it by
calling pci_pme_list_scan() once directly from one of the host bridge's
pm_ops callbacks.

Stacktrace for posterity:

  PM: Syncing filesystems ... [   38.566237] done.
  PM: Preparing system for sleep (mem)
  Freezing user space processes ... [   38.579813] (elapsed 0.001 seconds) done.
  Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
  PM: Suspending system (mem)
  PM: suspend of devices complete after 152.456 msecs
  PM: late suspend of devices complete after 2.809 msecs
  PM: noirq suspend of devices complete after 29.863 msecs
  suspend debug: Waiting for 5 second(s).
  Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
  pgd = c0003000
  [00000000] *pgd=80000040004003, *pmd=00000000
  Internal error: : 1211 [#1] SMP ARM
  Modules linked in:
  CPU: 1 PID: 20 Comm: kworker/1:1 Not tainted
  4.9.0-rc1-koelsch-00011-g68db9bc814362e7f #3383
  Hardware name: Generic R8A7791 (Flattened Device Tree)
  Workqueue: events pci_pme_list_scan
  task: eb56e140 task.stack: eb58e000
  PC is at pci_generic_config_read+0x64/0x6c
  LR is at rcar_pci_cfg_base+0x64/0x84
  pc : [<c041d7b4>]    lr : [<c04309a0>]    psr: 600d0093
  sp : eb58fe98  ip : c041d750  fp : 00000008
  r10: c0e2283c  r9 : 00000000  r8 : 600d0013
  r7 : 00000008  r6 : eb58fed6  r5 : 00000002  r4 : eb58feb4
  r3 : 00000000  r2 : 00000044  r1 : 00000008  r0 : 00000000
  Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
  Control: 30c5387d  Table: 6a9f6c80  DAC: 55555555
  Process kworker/1:1 (pid: 20, stack limit = 0xeb58e210)
  Stack: (0xeb58fe98 to 0xeb590000)
  fe80:                                                       00000002 00000044
  fea0: eb6f5800 c041d9b0 eb58feb4 00000008 00000044 00000000 eb78a000 eb78a000
  fec0: 00000044 00000000 eb9aff00 c0424bf0 eb78a000 00000000 eb78a000 c0e22830
  fee0: ea8a6fc0 c0424c5c eaae79c0 c0424ce0 eb55f380 c0e22838 eb9a9800 c0235fbc
  ff00: eb55f380 c0e22838 eb55f380 eb9a9800 eb9a9800 eb58e000 eb9a9824 c0e02100
  ff20: eb55f398 c02366c4 eb56e140 eb5631c0 00000000 eb55f380 c023641c 00000000
  ff40: 00000000 00000000 00000000 c023a928 cd105598 00000000 40506a34 eb55f380
  ff60: 00000000 00000000 dead4ead ffffffff ffffffff eb58ff74 eb58ff74 00000000
  ff80: 00000000 dead4ead ffffffff ffffffff eb58ff90 eb58ff90 eb58ffac eb5631c0
  ffa0: c023a844 00000000 00000000 c0206d68 00000000 00000000 00000000 00000000
  ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 3a81336c 10ccd1dd
  [<c041d7b4>] (pci_generic_config_read) from [<c041d9b0>]
  (pci_bus_read_config_word+0x58/0x80)
  [<c041d9b0>] (pci_bus_read_config_word) from [<c0424bf0>]
  (pci_check_pme_status+0x34/0x78)
  [<c0424bf0>] (pci_check_pme_status) from [<c0424c5c>] (pci_pme_wakeup+0x28/0x54)
  [<c0424c5c>] (pci_pme_wakeup) from [<c0424ce0>] (pci_pme_list_scan+0x58/0xb4)
  [<c0424ce0>] (pci_pme_list_scan) from [<c0235fbc>]
  (process_one_work+0x1bc/0x308)
  [<c0235fbc>] (process_one_work) from [<c02366c4>] (worker_thread+0x2a8/0x3e0)
  [<c02366c4>] (worker_thread) from [<c023a928>] (kthread+0xe4/0xfc)
  [<c023a928>] (kthread) from [<c0206d68>] (ret_from_fork+0x14/0x2c)
  Code: ea000000 e5903000 f57ff04f e3a00000 (e5843000)
  ---[ end trace 667d43ba3aa9e589 ]---

Fixes: df17e62e5bff ("PCI: Add support for polling PME state on suspended legacy PCI devices")
Reported-and-tested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reported-and-tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: Only allow WC mmap on prefetchable resources
David Woodhouse [Wed, 12 Apr 2017 12:25:52 +0000 (13:25 +0100)]
PCI: Only allow WC mmap on prefetchable resources

commit cef4d02305a06be581bb7f4353446717a1b319ec upstream.

The /proc/bus/pci mmap interface allows the user to specify whether they
want WC or not.  Don't let them do so on non-prefetchable BARs.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: Fix another sanity check bug in /proc/pci mmap
David Woodhouse [Wed, 12 Apr 2017 12:25:51 +0000 (13:25 +0100)]
PCI: Fix another sanity check bug in /proc/pci mmap

commit 17caf56731311c9596e7d38a70c88fcb6afa6a1b upstream.

Don't match MMIO maps with I/O BARs and vice versa.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms
David Woodhouse [Wed, 12 Apr 2017 12:25:50 +0000 (13:25 +0100)]
PCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms

commit 6bccc7f426abd640f08d8c75fb22f99483f201b4 upstream.

In the PCI_MMAP_PROCFS case when the address being passed by the user is a
'user visible' resource address based on the bus window, and not the actual
contents of the resource, that's what we need to be checking it against.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
K. Y. Srinivasan [Fri, 24 Mar 2017 18:07:21 +0000 (11:07 -0700)]
PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs

commit 433fcf6b7b31f1f233dd50aeb9d066a0f6ed4b9d upstream.

When we have 32 or more CPUs in the affinity mask, we should use a special
constant to specify that to the host. Fix this issue.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPCI: hv: Allocate interrupt descriptors with GFP_ATOMIC
K. Y. Srinivasan [Fri, 24 Mar 2017 18:07:22 +0000 (11:07 -0700)]
PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC

commit 59c58ceeea9cdc6144d7b0303753e6bd26d87455 upstream.

The memory allocation here needs to be non-blocking.  Fix the issue.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotracing/kprobes: Enforce kprobes teardown after testing
Thomas Gleixner [Wed, 17 May 2017 08:19:49 +0000 (10:19 +0200)]
tracing/kprobes: Enforce kprobes teardown after testing

commit 30e7d894c1478c88d50ce94ddcdbd7f9763d9cdd upstream.

Enabling the tracer selftest triggers occasionally the warning in
text_poke(), which warns when the to be modified page is not marked
reserved.

The reason is that the tracer selftest installs kprobes on functions marked
__init for testing. These probes are removed after the tests, but that
removal schedules the delayed kprobes_optimizer work, which will do the
actual text poke. If the work is executed after the init text is freed,
then the warning triggers. The bug can be reproduced reliably when the work
delay is increased.

Flush the optimizer work and wait for the optimizing/unoptimizing lists to
become empty before returning from the kprobes tracer selftest. That
ensures that all operations which were queued due to the probes removal
have completed.

Link: http://lkml.kernel.org/r/20170516094802.76a468bb@gandalf.local.home
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 6274de498 ("kprobes: Support delayed unoptimizing")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoum: Fix to call read_initrd after init_bootmem
Masami Hiramatsu [Thu, 27 Apr 2017 03:15:10 +0000 (12:15 +0900)]
um: Fix to call read_initrd after init_bootmem

commit 5b4236e17cc1bd9fa14b2b0c7a4ae632d41f2e20 upstream.

Since read_initrd() invokes alloc_bootmem() for allocating
memory to load initrd image, it must be called after init_bootmem.

This makes read_initrd() called directly from setup_arch()
after init_bootmem() and mem_total_pages().

Fixes: b63236972e1 ("um: Setup physical memory in setup_arch()")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoosf_wait4(): fix infoleak
Al Viro [Mon, 15 May 2017 01:47:25 +0000 (21:47 -0400)]
osf_wait4(): fix infoleak

commit a8c39544a6eb2093c04afd5005b6192bd0e880c6 upstream.

failing sys_wait4() won't fill struct rusage...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Loongson-3: Select MIPS_L1_CACHE_SHIFT_6
Huacai Chen [Thu, 16 Mar 2017 13:00:28 +0000 (21:00 +0800)]
MIPS: Loongson-3: Select MIPS_L1_CACHE_SHIFT_6

commit 17c99d9421695a0e0de18bf1e7091d859e20ec1d upstream.

Some newer Loongson-3 have 64 bytes cache lines, so select
MIPS_L1_CACHE_SHIFT_6.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J . Hill <Steven.Hill@caviumnetworks.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15755/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonvme: unmap CMB and remove sysfs file in reset path
Jon Derrick [Fri, 5 May 2017 20:52:06 +0000 (14:52 -0600)]
nvme: unmap CMB and remove sysfs file in reset path

commit f63572dff1421b6ca6abce71d46e03411e605c94 upstream.

CMB doesn't get unmapped until removal while getting remapped on every
reset. Add the unmapping and sysfs file removal to the reset path in
nvme_pci_disable to match the mapping path in nvme_pci_enable.

Fixes: 202021c1a ("nvme : Add sysfs entry for NVMe CMBs when appropriate")

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Acked-by: Keith Busch <keith.busch@intel.com>
Reviewed-By: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agogenirq: Fix chained interrupt data ordering
Thomas Gleixner [Thu, 11 May 2017 11:54:11 +0000 (13:54 +0200)]
genirq: Fix chained interrupt data ordering

commit 2c4569ca26986d18243f282dd727da27e9adae4c upstream.

irq_set_chained_handler_and_data() sets up the chained interrupt and then
stores the handler data.

That's racy against an immediate interrupt which gets handled before the
store of the handler data happened. The handler will dereference a NULL
pointer and crash.

Cure it by storing handler data before installing the chained handler.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agouwb: fix device quirk on big-endian hosts
Johan Hovold [Fri, 12 May 2017 10:06:32 +0000 (12:06 +0200)]
uwb: fix device quirk on big-endian hosts

commit 41318a2b82f5d5fe1fb408f6d6e0b22aa557111d upstream.

Add missing endianness conversion when using the USB device-descriptor
idProduct field to apply a hardware quirk.

Fixes: 1ba47da52712 ("uwb: add the i1480 DFU driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostackprotector: Increase the per-task stack canary's random range from 32 bits to...
Daniel Micay [Thu, 4 May 2017 13:32:09 +0000 (09:32 -0400)]
stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms

commit 5ea30e4e58040cfd6434c2f33dc3ea76e2c15b05 upstream.

The stack canary is an 'unsigned long' and should be fully initialized to
random data rather than only 32 bits of random data.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Arjan van Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170504133209.3053-1-danielmicay@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agometag/uaccess: Check access_ok in strncpy_from_user
James Hogan [Tue, 2 May 2017 18:41:06 +0000 (19:41 +0100)]
metag/uaccess: Check access_ok in strncpy_from_user

commit 3a158a62da0673db918b53ac1440845a5b64fd90 upstream.

The metag implementation of strncpy_from_user() doesn't validate the src
pointer, which could allow reading of arbitrary kernel memory. Add a
short access_ok() check to prevent that.

Its still possible for it to read across the user/kernel boundary, but
it will invariably reach a NUL character after only 9 bytes, leaking
only a static kernel address being loaded into D0Re0 at the beginning of
__start, which is acceptable for the immediate fix.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agometag/uaccess: Fix access_ok()
James Hogan [Fri, 28 Apr 2017 09:50:26 +0000 (10:50 +0100)]
metag/uaccess: Fix access_ok()

commit 8a8b56638bcac4e64cccc88bf95a0f9f4b19a2fb upstream.

The __user_bad() macro used by access_ok() has a few corner cases
noticed by Al Viro where it doesn't behave correctly:

 - The kernel range check has off by 1 errors which permit access to the
   first and last byte of the kernel mapped range.

 - The kernel range check ends at LINCORE_BASE rather than
   META_MEMORY_LIMIT, which is ineffective when the kernel is in global
   space (an extremely uncommon configuration).

There are a couple of other shortcomings here too:

 - Access to the whole of the other address space is permitted (i.e. the
   global half of the address space when the kernel is in local space).
   This isn't ideal as it could theoretically still contain privileged
   mappings set up by the bootloader.

 - The size argument is unused, permitting user copies which start on
   valid pages at the end of the user address range and cross the
   boundary into the kernel address space (e.g. addr = 0x3ffffff0, size
   > 0x10).

It isn't very convenient to add size checks when disallowing certain
regions, and it seems far safer to be sure and explicit about what
userland is able to access, so invert the logic to allow certain regions
instead, and fix the off by 1 errors and missing size checks. This also
allows the get_fs() == KERNEL_DS check to be more easily optimised into
the user address range case.

We now have 3 such allowed regions:

 - The user address range (incorporating the get_fs() == KERNEL_DS
   check).

 - NULL (some kernel code expects this to work, and we'll always catch
   the fault anyway).

 - The core code memory region.

Fixes: 373cd784d0fc ("metag: Memory handling")
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoiommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings
KarimAllah Ahmed [Fri, 5 May 2017 18:39:59 +0000 (11:39 -0700)]
iommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings

commit f73a7eee900e95404b61408a23a1df5c5811704c upstream.

Ever since commit 091d42e43d ("iommu/vt-d: Copy translation tables from
old kernel") the kdump kernel copies the IOMMU context tables from the
previous kernel. Each device mappings will be destroyed once the driver
for the respective device takes over.

This unfortunately breaks the workflow of mapping and unmapping a new
context to the IOMMU. The mapping function assumes that either:

1) Unmapping did the proper IOMMU flushing and it only ever flush if the
   IOMMU unit supports caching invalid entries.
2) The system just booted and the initialization code took care of
   flushing all IOMMU caches.

This assumption is not true for the kdump kernel since the context
tables have been copied from the previous kernel and translations could
have been cached ever since. So make sure to flush the IOTLB as well
when we destroy these old copied mappings.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Anthony Liguori <aliguori@amazon.com>
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Fixes: 091d42e43d ("iommu/vt-d: Copy translation tables from old kernel")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: GetTs Fix invalid TID 7 warning.
Malcolm Priestley [Thu, 11 May 2017 17:57:46 +0000 (18:57 +0100)]
staging: rtl8192e: GetTs Fix invalid TID 7 warning.

commit 95d93e271d920dfda369d4740b1cc1061d41fe7f upstream.

TID 7 is a valid value for QoS IEEE 802.11e.

The switch statement that follows states 7 is valid.

Remove function IsACValid and use the default case to filter
invalid TIDs.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD.
Malcolm Priestley [Thu, 11 May 2017 17:57:45 +0000 (18:57 +0100)]
staging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD.

commit 90be652c9f157d44b9c2803f902a8839796c090d upstream.

EPROM_CMD is 2 byte aligned on PCI map so calling with rtl92e_readl
will return invalid data so use rtl92e_readw.

The device is unable to select the right eeprom type.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: fix 2 byte alignment of register BSSIDR.
Malcolm Priestley [Thu, 11 May 2017 17:57:44 +0000 (18:57 +0100)]
staging: rtl8192e: fix 2 byte alignment of register BSSIDR.

commit 867510bde14e7b7fc6dd0f50b48f6753cfbd227a upstream.

BSSIDR has two byte alignment on PCI ioremap correct the write
by swapping to 16 bits first.

This fixes a problem that the device associates fail because
the filter is not set correctly.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.
Malcolm Priestley [Thu, 11 May 2017 17:57:43 +0000 (18:57 +0100)]
staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.

commit baabd567f87be05330faa5140f72a91960e7405a upstream.

The driver attempts to alter memory that is mapped to PCI device.

This is because tx_fwinfo_8190pci points to skb->data

Move the pci_map_single to when completed buffer is ready to be mapped with
psdec is empty to drop on mapping error.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoarm64: documentation: document tagged pointer stack constraints
Kristina Martsenko [Wed, 3 May 2017 15:37:48 +0000 (16:37 +0100)]
arm64: documentation: document tagged pointer stack constraints

commit f0e421b1bf7af97f026e1bb8bfe4c5a7a8c08f42 upstream.

Some kernel features don't currently work if a task puts a non-zero
address tag in its stack pointer, frame pointer, or frame record entries
(FP, LR).

For example, with a tagged stack pointer, the kernel can't deliver
signals to the process, and the task is killed instead. As another
example, with a tagged frame pointer or frame records, perf fails to
generate call graphs or resolve symbols.

For now, just document these limitations, instead of finding and fixing
everything that doesn't work, as it's not known if anyone needs to use
tags in these places anyway.

In addition, as requested by Dave Martin, generalize the limitations
into a general kernel address tag policy, and refactor
tagged-pointers.txt to include it.

Fixes: d50240a5f6ce ("arm64: mm: permit use of tagged pointers at EL0")
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoarm64: uaccess: ensure extension of access_ok() addr
Mark Rutland [Wed, 3 May 2017 15:09:35 +0000 (16:09 +0100)]
arm64: uaccess: ensure extension of access_ok() addr

commit a06040d7a791a9177581dcf7293941bd92400856 upstream.

Our access_ok() simply hands its arguments over to __range_ok(), which
implicitly assummes that the addr parameter is 64 bits wide. This isn't
necessarily true for compat code, which might pass down a 32-bit address
parameter.

In these cases, we don't have a guarantee that the address has been zero
extended to 64 bits, and the upper bits of the register may contain
unknown values, potentially resulting in a suprious failure.

Avoid this by explicitly casting the addr parameter to an unsigned long
(as is done on other architectures), ensuring that the parameter is
widened appropriately.

Fixes: 0aea86a2176c ("arm64: User access library functions")
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoarm64: armv8_deprecated: ensure extension of addr
Mark Rutland [Wed, 3 May 2017 15:09:36 +0000 (16:09 +0100)]
arm64: armv8_deprecated: ensure extension of addr

commit 55de49f9aa17b0b2b144dd2af587177b9aadf429 upstream.

Our compat swp emulation holds the compat user address in an unsigned
int, which it passes to __user_swpX_asm(). When a 32-bit value is passed
in a register, the upper 32 bits of the register are unknown, and we
must extend the value to 64 bits before we can use it as a base address.

This patch casts the address to unsigned long to ensure it has been
suitably extended, avoiding the potential issue, and silencing a related
warning from clang.

Fixes: bd35a4adc413 ("arm64: Port SWP/SWPB emulation support from arm")
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoarm64: ensure extension of smp_store_release value
Mark Rutland [Wed, 3 May 2017 15:09:34 +0000 (16:09 +0100)]
arm64: ensure extension of smp_store_release value

commit 994870bead4ab19087a79492400a5478e2906196 upstream.

When an inline assembly operand's type is narrower than the register it
is allocated to, the least significant bits of the register (up to the
operand type's width) are valid, and any other bits are permitted to
contain any arbitrary value. This aligns with the AAPCS64 parameter
passing rules.

Our __smp_store_release() implementation does not account for this, and
implicitly assumes that operands have been zero-extended to the width of
the type being stored to. Thus, we may store unknown values to memory
when the value type is narrower than the pointer type (e.g. when storing
a char to a long).

This patch fixes the issue by casting the value operand to the same
width as the pointer operand in all cases, which ensures that the value
is zero-extended as we expect. We use the same union trickery as
__smp_load_acquire and {READ,WRITE}_ONCE() to avoid GCC complaining that
pointers are potentially cast to narrower width integers in unreachable
paths.

A whitespace issue at the top of __smp_store_release() is also
corrected.

No changes are necessary for __smp_load_acquire(). Load instructions
implicitly clear any upper bits of the register, and the compiler will
only consider the least significant bits of the register as valid
regardless.

Fixes: 47933ad41a86 ("arch: Introduce smp_load_acquire(), smp_store_release()")
Fixes: 878a84d5a8a1 ("arm64: add missing data types in smp_load_acquire/smp_store_release")
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoarm64: xchg: hazard against entire exchange variable
Mark Rutland [Wed, 3 May 2017 15:09:33 +0000 (16:09 +0100)]
arm64: xchg: hazard against entire exchange variable

commit fee960bed5e857eb126c4e56dd9ff85938356579 upstream.

The inline assembly in __XCHG_CASE() uses a +Q constraint to hazard
against other accesses to the memory location being exchanged. However,
the pointer passed to the constraint is a u8 pointer, and thus the
hazard only applies to the first byte of the location.

GCC can take advantage of this, assuming that other portions of the
location are unchanged, as demonstrated with the following test case:

union u {
unsigned long l;
unsigned int i[2];
};

unsigned long update_char_hazard(union u *u)
{
unsigned int a, b;

a = u->i[1];
asm ("str %1, %0" : "+Q" (*(char *)&u->l) : "r" (0UL));
b = u->i[1];

return a ^ b;
}

unsigned long update_long_hazard(union u *u)
{
unsigned int a, b;

a = u->i[1];
asm ("str %1, %0" : "+Q" (*(long *)&u->l) : "r" (0UL));
b = u->i[1];

return a ^ b;
}

The linaro 15.08 GCC 5.1.1 toolchain compiles the above as follows when
using -O2 or above:

0000000000000000 <update_char_hazard>:
   0: d2800001  mov x1, #0x0                    // #0
   4: f9000001  str x1, [x0]
   8: d2800000  mov x0, #0x0                    // #0
   c: d65f03c0  ret

0000000000000010 <update_long_hazard>:
  10: b9400401  ldr w1, [x0,#4]
  14: d2800002  mov x2, #0x0                    // #0
  18: f9000002  str x2, [x0]
  1c: b9400400  ldr w0, [x0,#4]
  20: 4a000020  eor w0, w1, w0
  24: d65f03c0  ret

This patch fixes the issue by passing an unsigned long pointer into the
+Q constraint, as we do for our cmpxchg code. This may hazard against
more than is necessary, but this is better than missing a necessary
hazard.

Fixes: 305d454aaa29 ("arm64: atomics: implement native {relaxed, acquire, release} atomics")
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>