7 years agoARM: rockchip: rk3228: add grf definition
Chen Liang [Mon, 9 Nov 2015 08:29:52 +0000 (16:29 +0800)]
ARM: rockchip: rk3228: add grf definition

Change-Id: Ifea3e16e7d0141b09d9df26a247e884d0c9f72e7
Signed-off-by: Chen Liang <>
7 years agork: restore file mode
Huang, Tao [Mon, 9 Nov 2015 09:00:56 +0000 (17:00 +0800)]
rk: restore file mode

Change-Id: I3ac6ae87fc7ed90fa5ece0b6cb0ffe1a2561fa1d
Signed-off-by: Huang, Tao <>
7 years agoASoC: restore spdif_receiver.c and spdif_transciever.c
Huang, Tao [Mon, 9 Nov 2015 08:32:40 +0000 (16:32 +0800)]
ASoC: restore spdif_receiver.c and spdif_transciever.c

Change-Id: I2eeca8b4be12c35bcc3d172f8b165c417a2561c8
Signed-off-by: Huang, Tao <>
7 years agork_fb.h: remove multiple definitions
Huang Jiachai [Mon, 9 Nov 2015 01:45:28 +0000 (09:45 +0800)]
rk_fb.h: remove multiple definitions

Change-Id: I34b7d0a4db251521693a5d13ace0d33ccad1717e
Signed-off-by: Huang Jiachai <>
7 years agoARM: dts: rk3228: add usb node
Yunzhi Li [Thu, 5 Nov 2015 07:30:20 +0000 (15:30 +0800)]
ARM: dts: rk3228: add usb node

Change-Id: I4ccd1fb9ad2cd5b036d0cfde736fe990ad0673d0
Signed-off-by: Yunzhi Li <>
7 years agommc: dw_mmc: fix the CardThreshold boundary at CardThrCtl register
Jaehoon Chung [Fri, 6 Nov 2015 03:39:39 +0000 (11:39 +0800)]
mmc: dw_mmc: fix the CardThreshold boundary at CardThrCtl register

According to DesignWare DoC file, CardThreshold bit should be
So it's correct to use (0xFFF << 16), not (0x1FFF << 16).

Change-Id: I184fff75e6e72624a22cdfc6b0ffcc236ffb07c2
Signed-off-by: Jaehoon Chung <>
Reviewed-by: Alim Akhtar <>
Signed-off-by: Ulf Hansson <>
Signed-off-by: Shawn Lin <>
7 years agoARM: dtsi: rk3228: add dram timing node
Tang Yun ping [Thu, 5 Nov 2015 03:23:39 +0000 (11:23 +0800)]
ARM: dtsi: rk3228: add dram timing node

Change-Id: Ieb7c43f6e546e75e72c7db99894d6ca0cfbb31a1
Signed-off-by: Tang Yun ping <>
7 years agovideo: lcdc: rk3228: fix colorspace for output YCBCR
Mark Yao [Thu, 29 Oct 2015 08:23:14 +0000 (16:23 +0800)]
video: lcdc: rk3228: fix colorspace for output YCBCR

Change-Id: I192a85c6d60a09c5f9a80b518690f0aac025becd
Signed-off-by: Mark Yao <>
7 years agovideo: lcdc: rk3228: add vop tvout support
Mark Yao [Thu, 29 Oct 2015 08:21:16 +0000 (16:21 +0800)]
video: lcdc: rk3228: add vop tvout support

Change-Id: Ibfa16c73735132e0a50f7b52efb75681e61d9b20
Signed-off-by: Mark Yao <>
7 years agovideo: lcdc: rk3228: fix interlace display
Mark Yao [Thu, 29 Oct 2015 08:18:06 +0000 (16:18 +0800)]
video: lcdc: rk3228: fix interlace display

New version H/W don't need yszie div 2 anymore.

Change-Id: I1c8927ad5dd00fd1af16ef9ca60c9979b4db696e
Signed-off-by: Mark Yao <>
7 years agovideo: hdmi: judge interlace mode from vmode bit mask
Mark Yao [Tue, 3 Nov 2015 02:21:26 +0000 (10:21 +0800)]
video: hdmi: judge interlace mode from vmode bit mask

Vmode is a flag with bit mask, we can't judge interlace mode
from equal compare, need mask its bit.

Change-Id: Iad69bd52173c5ea179639deaff25f9a4ed3fc5d3
Signed-off-by: Mark Yao <>
7 years agovideo: lcdc: judge interlace mode from vmode bit mask
Mark Yao [Tue, 3 Nov 2015 02:21:26 +0000 (10:21 +0800)]
video: lcdc: judge interlace mode from vmode bit mask

Vmode is a flag with bit mask, we can't judge interlace mode
from equal compare, need mask its bit.

Change-Id: I0cc53503198f98dc58369f4c9e6dd78b47095968
Signed-off-by: Mark Yao <>
7 years agork_fb: add RGB BT709/BT2020 format
Mark Yao [Thu, 29 Oct 2015 07:57:23 +0000 (15:57 +0800)]
rk_fb: add RGB BT709/BT2020 format

Change-Id: I9581f78955c3efe77375bfa5e8ac571ac1d5aae4
Signed-off-by: Mark Yao <>
7 years agork_fb: set interlace flag for dts timing
Mark Yao [Thu, 29 Oct 2015 07:54:11 +0000 (15:54 +0800)]
rk_fb: set interlace flag for dts timing

Change-Id: I8711cefdf224af88214ed39d9ae225be8bc62304
Signed-off-by: Mark Yao <>
7 years agocamera: rk_camsys: rk3288: change gpio map method in camsys_gpio.h
zyc [Wed, 4 Nov 2015 02:19:46 +0000 (10:19 +0800)]
camera: rk_camsys: rk3288: change gpio map method in camsys_gpio.h

rk3288 gpio bank0 only has 24 pins not 32 pins,so modify the gpio map
method for rk3288.

Change-Id: I1d59b25d9acb0f51f9a1ad8ec74db2952534b1f2
Signed-off-by: ZhongYichong <>
7 years agoARM: dts: rk3228-sdk: enable nandc
Zhaoyifeng [Tue, 3 Nov 2015 06:04:59 +0000 (14:04 +0800)]
ARM: dts: rk3228-sdk: enable nandc

Change-Id: I449544595eb93f6cb9d7154aced253bebe1dceb7
Signed-off-by: Zhaoyifeng <>
7 years ago ARM: dts: rk3228: add nandc support
Zhaoyifeng [Tue, 3 Nov 2015 03:54:18 +0000 (11:54 +0800)]
 ARM: dts: rk3228: add nandc support

Change-Id: I40ddba4f4ce56a34ca5e448f1dfbcc06c2ad445c
Signed-off-by: Zhaoyifeng <>
7 years agommc: Allow forward compatibility for eMMC
Romain Izard [Tue, 3 Nov 2015 08:33:28 +0000 (16:33 +0800)]
mmc: Allow forward compatibility for eMMC

As stated by the eMMC 5.0 specification, a chip should not be rejected
only because of the revision stated in the EXT_CSD_REV field of the
EXT_CSD register.

Remove the control on this value, the control of the CSD_STRUCTURE field
should be sufficient to reject future incompatible changes.

Change-Id: Ib69314bee902a4036183ef9a3565d9f0423ec971
Signed-off-by: Romain Izard <>
Signed-off-by: Ulf Hansson <>
Signed-off-by: Shawn Lin <>
7 years agoARM: dts: rk3228-sdk: enable psci
Jianhong Chen [Mon, 2 Nov 2015 02:17:18 +0000 (10:17 +0800)]
ARM: dts: rk3228-sdk: enable psci

Change-Id: I0d965a15e2938f8b54d056d0b7e21ec9ce33ee57
Signed-off-by: Jianhong Chen <>
7 years agoARM: dtsi: rk3228: add psci support
Jianhong Chen [Mon, 2 Nov 2015 02:16:09 +0000 (10:16 +0800)]
ARM: dtsi: rk3228: add psci support

This is just add psci code into kernel, if you want to enable psci,
you must add psci=enable in the Command Line.

Change-Id: Iaf0e0116cbaba0d210cb99d59c0ee82768bf54bb
Signed-off-by: Jianhong Chen <>
7 years agoARM: rockchip: support arch32 psci suspend
Jianhong Chen [Mon, 2 Nov 2015 02:10:18 +0000 (10:10 +0800)]
ARM: rockchip: support arch32 psci suspend

Change-Id: I0341d1c019b8c00376af574cd9f51e87fafa8601
Signed-off-by: Jianhong Chen <>
7 years agoarm: rockchip: rk3228: dts: add pwm remote-ctrl
Huang zhibao [Fri, 30 Oct 2015 09:20:46 +0000 (17:20 +0800)]
arm: rockchip: rk3228: dts: add pwm remote-ctrl

Change-Id: Iccb31c2472238887b24ca61d7c7bdcb54a1e0778
Signed-off-by: Huang zhibao <>
7 years agovideo: rockchip: fb: delete DISPLAY_POLICY_BOX_TEMP
Zheng Yang [Fri, 30 Oct 2015 08:52:16 +0000 (16:52 +0800)]
video: rockchip: fb: delete DISPLAY_POLICY_BOX_TEMP

Change-Id: I59147b833754d5417d2813eb902923b4f700a9b0
Signed-off-by: Zheng Yang <>
7 years agoARM: dts: rk3288-box: set disp-policy to DISPLAY_POLICY_BOX
Zheng Yang [Fri, 30 Oct 2015 08:47:59 +0000 (16:47 +0800)]
ARM: dts: rk3288-box: set disp-policy to DISPLAY_POLICY_BOX

Change-Id: I3ede07d2c26aaef44ec7165353a3b3d6a6177f6e
Signed-off-by: Zheng Yang <>
7 years agoARM64: dts: rk3368-box: set disp-policy to DISPLAY_POLICY_BOX
Zheng Yang [Fri, 30 Oct 2015 08:42:54 +0000 (16:42 +0800)]
ARM64: dts: rk3368-box: set disp-policy to DISPLAY_POLICY_BOX

Change-Id: Ib97c581b7488926d5f4203ea1d61ff706118bcc5
Signed-off-by: Zheng Yang <>
7 years agoi2c: rockchip: fix power off issue for rk818
David Wu [Wed, 28 Oct 2015 23:25:37 +0000 (07:25 +0800)]
i2c: rockchip: fix power off issue for rk818

The power off sequence is behind of i2c bus shutdown func,
it would prevent the rk818 to do power off action. The irq was
disabled when rk818 power off, it could let rk818 to power off
through i2c bus.

Change-Id: Ia6155f137ab2fa36dbe19e06878b0228670b1398
Signed-off-by: David Wu <>
7 years agohdmi: cec: add HDMI_IOCTL_CECWAKESTATE
Shen Zhenyi [Fri, 30 Oct 2015 05:59:55 +0000 (13:59 +0800)]

android HDMI CEC HAL need to know cec state when resume,

Change-Id: Iff942c6085d10891200cd873cc2ba53e9a2d6cad
Signed-off-by: Shen Zhenyi <>
7 years agoarm64: rockchip: rk3368: dts: modify dvfs_table for core
Xiao Feng [Thu, 29 Oct 2015 08:37:51 +0000 (16:37 +0800)]
arm64: rockchip: rk3368: dts: modify dvfs_table for core

Change-Id: I73c4a277b9fa38160f5206ebd8603984535f0ade
Signed-off-by: Xiao Feng <>
7 years agopinctrl: rockchip: fix crashed issue during pinctrl suspend
David Wu [Wed, 28 Oct 2015 23:06:04 +0000 (07:06 +0800)]
pinctrl: rockchip: fix crashed issue during pinctrl suspend

if the chip was rk3288, it didn't use pinctrl-rk3368.c,
but pinctrl-rockchip.c, driver of pinctrl-rk3368 was not registered.
It would make the NULL pointer at pinctrl-rk3368 suspend func.

Change-Id: I09dd4fb9b8bf001a4222ed9bef62347785b9906f
Signed-off-by: David Wu <>
7 years agork312x, mali_400: upgrade rk_ko_ver to 5.
chenzhen [Thu, 29 Oct 2015 08:06:37 +0000 (16:06 +0800)]
rk312x, mali_400: upgrade rk_ko_ver to 5.

Change-Id: If1851d44e75ef16e1b916ecb910526f749822be0
Signed-off-by: chenzhen <>
7 years agoion: rockchip-ion: add API to set memory region secured
Jianqun Xu [Tue, 20 Oct 2015 01:15:06 +0000 (09:15 +0800)]
ion: rockchip-ion: add API to set memory region secured

Add ion ioctl command -ION_IOC_SET_SECURED
for user to set memory region secured.

Change-Id: Ic4a7432ab8d2fd9f60fdfe7457e92f7c99768e12
Signed-off-by: Jianqun Xu <>
7 years agoARM: rockchip-psci: add interface for ion to set memory secured
Jianqun Xu [Tue, 20 Oct 2015 00:42:59 +0000 (08:42 +0800)]
ARM: rockchip-psci: add interface for ion to set memory secured

Add function "psci_set_memory_secure" for device to set memory
region secured.

Change-Id: Ife807c91d37ae66a5e1a0a3d8263c68cd601937d
Signed-off-by: Jianqun Xu <>
7 years agork312x, mali_400: make it more 'difficult' to dump down in mali_dvfs_list.
chenzhen [Wed, 28 Oct 2015 08:45:04 +0000 (16:45 +0800)]
rk312x, mali_400: make it more 'difficult' to dump down in mali_dvfs_list.

Change-Id: If5fd646aa6ca7f7383db70c84ff71f1570fe23b1
Signed-off-by: chenzhen <>
7 years agoARM: rockchip: rockchip_defconfig enable IP_MULTICAST
Huang, Tao [Wed, 28 Oct 2015 08:37:41 +0000 (16:37 +0800)]
ARM: rockchip: rockchip_defconfig enable IP_MULTICAST

Change-Id: Ic40cb94753f9fedc548ae6a77b36d0bed5754d88
Signed-off-by: Huang, Tao <>
7 years agoARM: rockchip: rockchip_defconfig enable UID_CPUTIME
Huang, Tao [Wed, 28 Oct 2015 08:34:00 +0000 (16:34 +0800)]
ARM: rockchip: rockchip_defconfig enable UID_CPUTIME

Change-Id: Ifb92e539e868ed15561ae8698b226422fae5fee8
Signed-off-by: Huang, Tao <>
7 years agoARM: rockchip: rockchip_defconfig enable kernel-mode NEON and NEON based cypto
Huang, Tao [Wed, 28 Oct 2015 07:03:34 +0000 (15:03 +0800)]
ARM: rockchip: rockchip_defconfig enable kernel-mode NEON and NEON based cypto

Change-Id: Ie3975cd780bbbedaaa2e3384d49e9f90734b65fe
Signed-off-by: Huang, Tao <>
7 years agoARM: rockchip-psci: add function id for secure memory set
Jianqun Xu [Tue, 20 Oct 2015 00:39:16 +0000 (08:39 +0800)]
ARM: rockchip-psci: add function id for secure memory set

Change-Id: I73c0b2c603a4b72f07804c684cd89bc82e5529c4
Signed-off-by: Jianqun Xu <>
7 years agoARM: rockchip: psci support arch32 and arch64 smc call
Jianhong Chen [Tue, 27 Oct 2015 08:25:11 +0000 (16:25 +0800)]
ARM: rockchip: psci support arch32 and arch64 smc call

Change-Id: I736c6c15cbb41d52aa9ef1e98cb9ebdd6ac9ebfc
Signed-off-by: Jianhong Chen <>
7 years agoarm64: rockchip: rockchip_defconfig enable IP_MULTICAST
Huang, Tao [Wed, 28 Oct 2015 06:27:11 +0000 (14:27 +0800)]
arm64: rockchip: rockchip_defconfig enable IP_MULTICAST

Change-Id: I07f7ad04f89c54b582b756c43d9841d99883e6df
Signed-off-by: Huang, Tao <>
7 years agoarm64: rockchip: rockchip_defconfig enable UID_CPUTIME
Huang, Tao [Wed, 28 Oct 2015 02:36:28 +0000 (10:36 +0800)]
arm64: rockchip: rockchip_defconfig enable UID_CPUTIME

Change-Id: Ia6f86bf86220261eda27ae1bba880fdf61241d5c
Signed-off-by: Huang, Tao <>
7 years agoARM: dts: rk3228: add ion node
Jianqun Xu [Tue, 13 Oct 2015 08:43:24 +0000 (16:43 +0800)]
ARM: dts: rk3228: add ion node

Add ion node, with two memory reserved region,
cma-heap and system-heap

Change-Id: Ic6c4da56e0c608135653f901f37adfed7bc7cb15
Signed-off-by: Jianqun Xu <>
7 years agoarm64: rockchip: rockchip_defconfig enable ARM v8 crypto
Huang, Tao [Tue, 27 Oct 2015 11:55:26 +0000 (19:55 +0800)]
arm64: rockchip: rockchip_defconfig enable ARM v8 crypto

Change-Id: I67d9ab8d0e8412e9899e64378beba8dd0764b310
Signed-off-by: Huang, Tao <>
7 years agoarm64: rockchip: add support for kernel mode NEON
Huang, Tao [Tue, 27 Oct 2015 11:54:13 +0000 (19:54 +0800)]
arm64: rockchip: add support for kernel mode NEON

Change-Id: I964c5dad5562f0342b1d11d9a0483fcac0394e4d
Signed-off-by: Huang, Tao <>
7 years agorockchip: quiet module_request personality-8
Huang, Tao [Tue, 27 Oct 2015 11:25:27 +0000 (19:25 +0800)]
rockchip: quiet module_request personality-8

In Android-M, below change in bionic was introduced

Which caused lot of SELinux denials to be logged regarding
module_request (similar to below one) for 32bit systems,
There is quite a lot of module_request denials when any 32bit
executable is executed.

type=1400 audit(946685139.719:12): avc: denied { module_request }
for pid=1970 comm="tzdatacheck" kmod="personality-8"
scontext=u:r:tzdatacheck:s0 tcontext=u:r:kernel:s0 tclass=system

So we patch the kernel to not attempt module loading for alternate
execution environments.

Change-Id: I7bd2c5fc08fd00fa7ff53d3ced401564b474fad4
Signed-off-by: Huang, Tao <>
7 years agommc: dw_mmc: fix the max_blk_count in IDMAC
Shawn Lin [Tue, 27 Oct 2015 09:53:06 +0000 (17:53 +0800)]
mmc: dw_mmc: fix the max_blk_count in IDMAC

Even though 1MB is reserved for descriptor table in IDMAC,
the dw_mmc host driver is allowed to receive only maximum
128KB block length in one request. This is caused by setting
improper max_blk_count. It needs to be e adjusted so that
descriptor table is used fully. It is found that the performance
is improved with the increased the max_blk_count.

Change-Id: Ie4042f9e1924e0f575b9865aa721b7b61305c13d
Signed-off-by: Seungwon Jeon <>
Acked-by: Jaehoon Chung <>
Signed-off-by: Alim Akhtar <>
Reviewed-by: Shawn Lin <>
Signed-off-by: Shawn Lin <>
Signed-off-by: Ulf Hansson <>
7 years agoARM: dts: rk3228: hdmi: add pinctrl and pclk_hdmi_phy
Zheng Yang [Tue, 27 Oct 2015 06:28:46 +0000 (14:28 +0800)]
ARM: dts: rk3228: hdmi: add pinctrl and pclk_hdmi_phy

Change-Id: I5570a3bf1970e6f8748cab55fea06a11af5c4f3e
Signed-off-by: Zheng Yang <>
7 years agoMerge branch 'android-3.10'
Huang, Tao [Tue, 27 Oct 2015 09:35:20 +0000 (17:35 +0800)]
Merge branch 'android-3.10'

ext4 crypto
nl80211: fix scheduled scan RSSI matchset attribute confusion
Add wlan platform partial_resume handler
wlan: Add WLAN_PLAT_AP_FLAG for SOFTAP country code

7 years agouid_cputime: Check for the range while removing range of UIDs.
Ruchi Kandoi [Sat, 24 Oct 2015 00:49:11 +0000 (17:49 -0700)]
uid_cputime: Check for the range while removing range of UIDs.

Checking if the uid_entry->uid matches the uid intended to be removed will
prevent deleting unwanted uid_entry.
Type cast the key for the hashtable to the same size, as when they were
inserted. This will make sure that we can find the uid_entry we want.

Bug: 25195548
Change-Id: I567942123cfb20e4b61ad624da19ec4cc84642c1
Signed-off: Ruchi kandoi <>
(cherry picked from commit 170458885df2e4e081d3f8489cfd4f66a9598995)

7 years agoRevert "android: binder: Change binder mutex to rtmutex."
Riley Andrews [Wed, 14 Oct 2015 18:54:15 +0000 (11:54 -0700)]
Revert "android: binder: Change binder mutex to rtmutex."

This reverts commit ebce7cd30b3e00232c8be23d0f04d7c0599089b5.

This ends up doing more damage than good on most devices. Go back to
using a standard mutex.

(cherry picked from commit ea93186577de4fae3a2273c296bfcf1839048df0)

7 years agoipv6: inet6_sk() should use sk_fullsock()
Eric Dumazet [Mon, 5 Oct 2015 04:08:09 +0000 (21:08 -0700)]
ipv6: inet6_sk() should use sk_fullsock()

SYN_RECV & TIMEWAIT sockets are not full blown, they do not have a pinet6

Bug: 24163529
Change-Id: I6ce67a190d67d200c6ebeb81d2daeb9c86cd7581
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
Signed-off-by: Lorenzo Colitti <>
(cherry picked from commit feee3c175c23ae72ed17154caaa82a3002de0023)

7 years agonet: add sk_fullsock() helper
Eric Dumazet [Mon, 16 Mar 2015 04:12:12 +0000 (21:12 -0700)]
net: add sk_fullsock() helper

We have many places where we want to check if a socket is
not a timewait or request socket. Use a helper to avoid
hard coding this.

Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
[backported from net-next 1d0ab253872cdd3d8e7913f59c266c7fd01771d0]
[ removed TCPF_NEW_SYN_RECV, and added a comment to add it back.]

Signed-off-by: Lorenzo Colitti <>
Bug: 24163529
Change-Id: Ibf09017e1ab00af5e6925273117c335d7f515d73
(cherry picked from commit cdab04e3612c55f0906c84c3c05996a0507eab7d)

7 years agolowmemorykiller: trace kill events.
Martijn Coenen [Tue, 26 May 2015 09:28:47 +0000 (11:28 +0200)]
lowmemorykiller: trace kill events.

Allows for capturing lmk kill events and
their rationale.

Change-Id: Ibe215db5bb9806fc550c72c0b9832c85cbd56bf6
Signed-off-by: Martijn Coenen <>
(cherry picked from commit 6cfb58f07af4b913508f087fe551a08f5a21eb88)

7 years agoarm64/crypto: use crypto instructions to generate AES key schedule
Ard Biesheuvel [Mon, 3 Nov 2014 16:50:01 +0000 (16:50 +0000)]
arm64/crypto: use crypto instructions to generate AES key schedule

(cherry pick from commit 12ac3efe74f888a13cb4df88b38bb01e8034dea8)

This patch implements the AES key schedule generation using ARMv8
Crypto Instructions. It replaces the table based C implementation
in aes_generic.ko, which means we can drop the dependency on that

Tested-by: Steve Capper <>
Acked-by: Steve Capper <>
Signed-off-by: Ard Biesheuvel <>
Signed-off-by: Will Deacon <>
Signed-off-by: Mark Salyzyn <>
Bug: 23181629
(cherry picked from commit 60b9dd6043fdc26860d850c364fd92b1f4e170fc)

7 years agoarm64: crypto: Change priority of arm64 aes cipher.
Riley Andrews [Wed, 26 Aug 2015 22:12:00 +0000 (15:12 -0700)]
arm64: crypto: Change priority of arm64 aes cipher.

(cherry pick from commit d802476e8db2eb616d47d0a06310276532cc2ffa)

Change-Id: I0c614e0eca71b65945ff8bd17c65b03a02918b18
Signed-off-by: Riley Andrews <>
Signed-off-by: Mark Salyzyn <>
Bug: 23181629
(cherry picked from commit 52d464160266101140ce95992256c25cc03e2bb3)

7 years agoselinux: do not check open perm on ftruncate call
Jeff Vander Stoep [Fri, 18 Sep 2015 19:39:46 +0000 (12:39 -0700)]
selinux: do not check open perm on ftruncate call

Use the ATTR_FILE attribute to distinguish between truncate()
and ftruncate() system calls. The two other cases where
do_truncate is called with a filp (and therefore ATTR_FILE is set)
are for coredump files and for open(O_TRUNC). In both of those cases
the open permission has already been checked during file open and
therefore does not need to be repeated.

Commit 95dbf739313f ("SELinux: check OPEN on truncate calls")
fixed a major issue where domains were allowed to truncate files
without the open permission. However, it introduced a new bug where
a domain with the write permission can no longer ftruncate files
without the open permission, even when they receive an already open

(cherry picked from commit b21800f304392ee5d20f411c37470183cc779f11)

Bug: 22567870
Change-Id: Id7c305e46beba5091c2c777529bd468216aae1c3

Signed-off-by: Jeff Vander Stoep <>
Acked-by: Stephen Smalley <>
Signed-off-by: Paul Moore <>
(cherry picked from commit df46bc83c1fc9b64b2e86290935a3ad550b2e56e)

7 years agoFix NULL pointer dereference in tcp_nuke_addr.
Lorenzo Colitti [Mon, 14 Sep 2015 15:14:23 +0000 (00:14 +0900)]
Fix NULL pointer dereference in tcp_nuke_addr.

tcp_nuke addr only grabs the bottom half socket lock, but not the
userspace socket lock. This allows a userspace program to call
close() while the socket is running, which causes a NULL pointer
dereference in inet_put_port.

Bug: 23663111
Bug: 24072792
Change-Id: Iecb63af68c2db4764c74785153d1c9054f76b94f
Signed-off-by: Lorenzo Colitti <>
(cherry picked from commit 74d66ee756afcc3269e4c1341f793c52be629af9)

7 years agousb: phy: fix dual role sysfs build if kernel modules are supported
Amit Pundir [Wed, 2 Sep 2015 11:08:31 +0000 (16:38 +0530)]
usb: phy: fix dual role sysfs build if kernel modules are supported

Add a missing ";" after EXPORT_SYMBOL() otherwise we run
into following build error if Kernel Modules are supported:
  CC      drivers/usb/phy/class-dual-role.o
drivers/usb/phy/class-dual-role.c:91:1: error: expected ',' or ';' before 'int'
 int dual_role_get_property(struct dual_role_phy_instance *dual_role,
make[3]: *** [drivers/usb/phy/class-dual-role.o] Error 1

Signed-off-by: Amit Pundir <>
(cherry picked from commit 9ff158f4c245c2fecb1489a4aae62ca67c0846a1)

Change-Id: I7ec77584b3a753448ddc50a74204a20f4636f8a4
(cherry picked from commit f5af56b478111455ce9041d958b83f13bc742af6)

7 years agoion: Handle the memory mapping correctly on x86
Vinil Cheeramvelil [Wed, 8 Jul 2015 02:35:06 +0000 (10:35 +0800)]
ion: Handle the memory mapping correctly on x86

This patch modifies the ion page pool code to address
limitation in x86 PAT. When one physical page is mapped
to multiple virtual pages, the same cache policy
should be used. Add set_memory_wc/uc call to avoid aliases.
If not, all mappings will be cached(write back).

Change-Id: I98ee8902df0c80135dddfa998c4ca4c2bb44e40e
Signed-off-by: Zhebin Jin <>
Signed-off-by: Vinil Cheeramvelil <>
(cherry picked from commit 6db47cc7e2f1d8dd8fc84912202ed749d6781a76)


7 years agousb: phy: Dual role sysfs class definition
Badhri Jagan Sridharan [Thu, 27 Aug 2015 04:12:54 +0000 (21:12 -0700)]
usb: phy: Dual role sysfs class definition

This CL adds a new class to monitor and change
dual role usb ports from userspace. The usb
phy drivers can register to the dual_role_usb
class and expose the capabilities of the ports.
The phy drivers can decide on whether a specific
attribute can be changed from userspace by
choosing to implement the appropriate callback.

Signed-off-by: Badhri Jagan Sridharan <>
Bug: 21615151
Change-Id: I121b4a94437972b5abe8f781e3007efa8531978
(cherry picked from commit f3061b9d608ce2314f24088281131ebadafa3985)

7 years agotrace/events: fix compilation error
Jin Qian [Wed, 26 Aug 2015 18:55:28 +0000 (11:55 -0700)]
trace/events: fix compilation error

include/trace/events/filemap.h: In function 'ftrace_raw_output_mm_filemap_find_page_cache_miss':
include/trace/ftrace.h:232:9: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' [-Werror=format=]

Change-Id: Ic2d76f18fc8802cf1e2246f96d84a06d267a30ad
Signed-off-by: Jin Qian <>
(cherry picked from commit c91e2d317307431283b96ce040e8aefd44b0b286)

7 years agosysrq: Emergency Remount R/O in reverse order
Amir Goldstein [Mon, 4 Aug 2014 16:29:32 +0000 (19:29 +0300)]
sysrq: Emergency Remount R/O in reverse order

This change fixes a problem where reboot on Android panics the kernel
almost every time when file systems are mounted over loop devices.

Android reboot command does:
- sync
- echo u > /proc/sysrq-trigger
- syscall_reboot

The problem is with sysrq emergency remount R/O trying to remount-ro
in wrong order.
since /data is re-mounted ro before loop devices, loop device
remount-ro fails to flush the journal and panics the kernel:

  EXT4-fs (loop0): Remounting filesystem read-only
  EXT4-fs (loop0): previous I/O error to superblock detected
  loop: Write error at byte offset 0, length 4096.
  Buffer I/O error on device loop0, logical block 0
  lost page write due to I/O error on loop0
  Kernel panic - not syncing: EXT4-fs panic from previous error

The fix is quite simple. In do_emergency_remount(), use
list_for_each_entry_reverse() on sb list instead of list_for_each_entry().
It makes a lot of sense to umount the file systems in reverse order in
which they were added to sb list.

Change-Id: I4370e39b5873bd16ade5d5f9ddb2704beb02a2bb
Signed-off-by: Amir Goldstein <>
Acked-by: Oren Laadan <>
(cherry picked from commit 334cc257d864f112b64fb885be908e6cdd644c08)

7 years agopstore: pmsg: return -ENOMEM on vmalloc failure
Mark Salyzyn [Thu, 20 Aug 2015 21:21:34 +0000 (14:21 -0700)]
pstore: pmsg: return -ENOMEM on vmalloc failure

Signed-off-by: Mark Salyzyn <>
Bug: 23385441
Change-Id: I294cb72c25bddafbba4e64fdb0a18ae46655a05d
(cherry picked from commit 62bb84973c1d55a4cc35cc4d95cb723ce0aa2c0b)

7 years agoPage cache miss tracing using ftrace on mm/filemap
Daniel Campello [Mon, 20 Jul 2015 17:37:56 +0000 (10:37 -0700)]
Page cache miss tracing using ftrace on mm/filemap

This patch includes two trace events on generic_perform_write and
do_generic_file_read to check on the address_space mapping for the
pages to be accessed by the request.

Change-Id: Ib319b9b2c971b9e5c76645be6cfd995ef9465d77
Signed-off-by: Daniel Campello <>
(cherry picked from commit d3952c50853166bd04562766c9603ed86ab0da75)


7 years agowakeup_reason: use vsnprintf instead of snsprintf for vargs.
Ruchi Kandoi [Thu, 6 Aug 2015 00:09:39 +0000 (17:09 -0700)]
wakeup_reason: use vsnprintf instead of snsprintf for vargs.

Bug: 22368519
Signed-off-by: Ruchi Kandoi <>
(cherry picked from commit 26dfa1394af4da60bf8ce7c5e56168b1ad8f2179)

7 years agouid_cputime: Iterates over all the threads instead of processes.
Ruchi Kandoi [Fri, 31 Jul 2015 17:17:54 +0000 (10:17 -0700)]
uid_cputime: Iterates over all the threads instead of processes.

Bug: 22833116
Change-Id: I775a18f61bd2f4df2bec23d01bd49421d0969f87
Signed-off-by: Ruchi Kandoi <>
(cherry picked from commit eb9cf7d0d416edc93edfe6e784189f02c82701a1)

7 years agoipv6: sysctl to restrict candidate source addresses
Erik Kline [Wed, 22 Jul 2015 07:38:25 +0000 (16:38 +0900)]
ipv6: sysctl to restrict candidate source addresses

Per RFC 6724, section 4, "Candidate Source Addresses":

    It is RECOMMENDED that the candidate source addresses be the set
    of unicast addresses assigned to the interface that will be used
    to send to the destination (the "outgoing" interface).

Add a sysctl to enable this behaviour.

Signed-off-by: Erik Kline <>
Signed-off-by: David S. Miller <>
[Simplified back-port of net-next 3985e8a3611a93bb36789f65db862e5700aab65e]

Bug: 19470192
Bug: 21832279
Bug: 22464419
Change-Id: Ib74ef945dcabe64215064f15ee1660b6524d65ce
(cherry picked from commit 0633924e7776754ccb473d649e5fa9ee45617a46)

7 years agouid_cputime: fix cputime overflow
Jin Qian [Tue, 14 Jul 2015 01:16:55 +0000 (18:16 -0700)]
uid_cputime: fix cputime overflow

Converting cputime_t to usec caused overflow when the value is greater
than 1 hour. Use msec and convert to unsigned long long to support bigger

Bug: 22461683

Change-Id: I853fe3e8e7dbf0d3e2cc5c6f9688a5a6e1f1fb3e
Signed-off-by: Jin Qian <>
(cherry picked from commit 75bf23fe4bfb1805b411965b5ce3c4b81b957898)

7 years agoinitramfs: Add skip_initramfs command line option
Rom Lemarchand [Mon, 6 Jul 2015 23:50:33 +0000 (16:50 -0700)]
initramfs: Add skip_initramfs command line option

Add a skip_initramfs option to allow choosing whether to boot using
the initramfs or not at runtime.

Change-Id: If30428fa748c1d4d3d7b9d97c1f781de5e4558c3
Signed-off-by: Rom Lemarchand <>
(cherry picked from commit 6f36227aa43c9e4b17a2dcda6a38e79d1b00d1b5)

7 years agocpu_power: Avoids race condition when the task exits.
Ruchi Kandoi [Sat, 27 Jun 2015 02:02:08 +0000 (19:02 -0700)]
cpu_power: Avoids race condition when the task exits.

When the task is terminated, the cpu_power for that particular task is
added to the terminated tasks. cpu_power is set to ULLONG_MAX at this
point to avoid double accounting of the power. It is possible that before the
task releases all the resources, cpu reschedules the task or a timer
interrupt is fired. At this point we will try to add the additional time
to the process, which will cause the accounting to be skewed. This
avoids the case where we change the cpu_power when it is already set to

Bug: 22064385
Change-Id: I405733725d535b0a864088516bf52fa3638ee6aa
Signed-off-by: Jin Qian <>
Signed-off-by: Ruchi Kandoi <>
(cherry picked from commit fd72341df7e6e8b834f5d4ec86a30f248eb96385)

7 years agoFix arch/arm/crypto/sha256_glue.c
Sami Tolvanen [Fri, 19 Jun 2015 09:42:41 +0000 (10:42 +0100)]
Fix arch/arm/crypto/sha256_glue.c


Signed-off-by: Sami Tolvanen <>
Change-Id: I24803dbbbf7ac7889bc027f69af371b594eca835
(cherry picked from 5eb3cca16fcf9c62753058aaf73bb12b71acba79)

(cherry picked from commit 9645fcee58b4af5f9f9a530f0fb514e7245012a8)

7 years agoof: add empty of_find_node_by_path() for !OF
Alexander Shiyan [Wed, 16 Apr 2014 06:49:20 +0000 (10:49 +0400)]
of: add empty of_find_node_by_path() for !OF

Add an empty version of of_find_node_by_path().
This fixes following build error for asoc tree:
sound/soc/fsl/fsl_ssi.c: In function 'fsl_ssi_probe':
sound/soc/fsl/fsl_ssi.c:1471:2: error: implicit declaration of function 'of_find_node_by_path' [-Werror=implicit-function-declaration]
  sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);

Change-Id: Ib635dffb97877a2820fb80b99db96a285a6d2d14
Reported-by: Stephen Rothwell <>
Signed-off-by: Alexander Shiyan <>
Signed-off-by: Rob Herring <>
(cherry picked from commit 9e7f1b065a312062eb8acdb1c505ddb3792b7583)

7 years agouid_cputime: Avoids double accounting of process stime, utime and cpu_power in
Ruchi Kandoi [Fri, 26 Jun 2015 21:19:21 +0000 (14:19 -0700)]
uid_cputime: Avoids double accounting of process stime, utime and cpu_power in
task exit.

This avoids the race where a particular process is terminating and we
read the show_uid_stats. At this time since the task_struct still exists
and we will account for the terminating process as one of the active
task, where as the stats would have been added in the task exit

Bug: 22064385
Change-Id: Id2ae04b33fcd230eda9683a41b6019d4dd8f5d85
Signed-off-by: Jin Qian <>
Signed-off-by: Ruchi Kandoi <>
(cherry picked from commit ddd9aac59e0aea3d5a4df485173115e8ecb3e17d)

7 years agoShrink ashmem directly through shmem_fallocate
Tobias Lindskog [Mon, 9 Feb 2015 07:10:39 +0000 (08:10 +0100)]
Shrink ashmem directly through shmem_fallocate

When ashmem_shrink is called from direct reclaim on a user thread, a
call to do_fallocate will check for permissions against the security
policy of that user thread.  It can thus fail by chance if called on a
thread that isn't permitted to modify the relevant ashmem areas.

Because we know that we have a shmem file underneath, call the shmem
implementation of fallocate directly instead of going through the
user-space interface for fallocate.

Area: Kernel/Linux Kernel

Bug: 21951515
Change-Id: Ie98fff18a2bdeb535cd24d4fbdd13677e12681a7
Signed-off-by: Jeff Vander Stoep <>
(cherry picked from commit 2ecc7f173a30ee7df10240d6944108252a5f5b7d)

7 years agocpufreq: Iterate over all the possible cpus to create powerstats.
Ruchi Kandoi [Sat, 6 Jun 2015 01:21:56 +0000 (18:21 -0700)]
cpufreq: Iterate over all the possible cpus to create powerstats.

For architectures which support a single policy for multiple cpus,
powerstats will not be initalized for all the cores. This change will
make sure powerstats is initialized for all the cores.

Also minor changes to increase code readability.

Bug: 21498425
Change-Id: I938f45e92ff6d5371c32c4d0e37274e6de66769c
Signed-off-by: Ruchi Kandoi <>
(cherry picked from commit 5862c50d1970886b5b5a57b5b52ecfd6feb95ebd)

7 years agoMerge tag 'v3.10.92'
Huang, Tao [Tue, 27 Oct 2015 06:09:58 +0000 (14:09 +0800)]
Merge tag 'v3.10.92'

This is the 3.10.92 stable release

7 years agoMerge tag 'lsk-v3.10-15.10-android'
Huang, Tao [Tue, 27 Oct 2015 06:07:45 +0000 (14:07 +0800)]
Merge tag 'lsk-v3.10-15.10-android'

LSK Android 15.10 v3.10

7 years agouart: rockchip: add uart supported for rk3228
David Wu [Thu, 22 Oct 2015 08:51:47 +0000 (16:51 +0800)]
uart: rockchip: add uart supported for rk3228

Change-Id: I86b49f20954a739645b9277e45d6b75058ff9c2b
Signed-off-by: David Wu <>
7 years agoARM: dts: rk3228: tsadc: support tsadc for rk3228
zhangqing [Tue, 27 Oct 2015 09:54:03 +0000 (02:54 -0700)]
ARM: dts: rk3228: tsadc: support tsadc for rk3228

add rk3228 tsadc parameter for dtsi.

Change-Id: I74cc9b6c2e4d53aa5e3391d5a820937925f07077
Signed-off-by: zhangqing <>
7 years agoLinux 3.10.92
Greg Kroah-Hartman [Tue, 27 Oct 2015 00:45:05 +0000 (09:45 +0900)]
Linux 3.10.92

7 years agorbd: fix double free on rbd_dev->header_name
Ilya Dryomov [Mon, 31 Aug 2015 12:21:39 +0000 (15:21 +0300)]
rbd: fix double free on rbd_dev->header_name

commit 3ebe138ac642a195c7f2efdb918f464734421fd6 upstream.

If rbd_dev_image_probe() in rbd_dev_probe_parent() fails, header_name
is freed twice: once in rbd_dev_probe_parent() and then in its caller
rbd_dev_image_probe() (rbd_dev_image_probe() is called recursively to
handle parent images).

rbd_dev_probe_parent() is responsible for probing the parent, so it
shouldn't muck with clone's fields.

Signed-off-by: Ilya Dryomov <>
Reviewed-by: Alex Elder <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agodm thin: fix missing pool reference count decrement in pool_ctr error path
Mike Snitzer [Tue, 13 Oct 2015 16:04:28 +0000 (12:04 -0400)]
dm thin: fix missing pool reference count decrement in pool_ctr error path

commit ba30670f4d5292c4e7f7980bbd5071f7c4794cdd upstream.

Fixes: ac8c3f3df ("dm thin: generate event when metadata threshold passed")
Signed-off-by: Mike Snitzer <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoworkqueue: make sure delayed work run in local cpu
Shaohua Li [Wed, 30 Sep 2015 16:05:30 +0000 (09:05 -0700)]
workqueue: make sure delayed work run in local cpu

commit 874bbfe600a660cba9c776b3957b1ce393151b76 upstream.

My system keeps crashing with below message. vmstat_update() schedules a delayed
work in current cpu and expects the work runs in the cpu.
schedule_delayed_work() is expected to make delayed work run in local cpu. The
problem is timer can be migrated with NO_HZ. __queue_work() queues work in
timer handler, which could run in a different cpu other than where the delayed
work is scheduled. The end result is the delayed work runs in different cpu.
The patch makes __queue_delayed_work records local cpu earlier. Where the timer
runs doesn't change where the work runs with the change.

[   28.010131] ------------[ cut here ]------------
[   28.010609] kernel BUG at ../mm/vmstat.c:1392!
[   28.011099] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN
[   28.011860] Modules linked in:
[   28.012245] CPU: 0 PID: 289 Comm: kworker/0:3 Tainted: G        W4.3.0-rc3+ #634
[   28.013065] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140709_153802- 04/01/2014
[   28.014160] Workqueue: events vmstat_update
[   28.014571] task: ffff880117682580 ti: ffff8800ba428000 task.ti: ffff8800ba428000
[   28.015445] RIP: 0010:[<ffffffff8115f921>]  [<ffffffff8115f921>]vmstat_update+0x31/0x80
[   28.016282] RSP: 0018:ffff8800ba42fd80  EFLAGS: 00010297
[   28.016812] RAX: 0000000000000000 RBX: ffff88011a858dc0 RCX:0000000000000000
[   28.017585] RDX: ffff880117682580 RSI: ffffffff81f14d8c RDI:ffffffff81f4df8d
[   28.018366] RBP: ffff8800ba42fd90 R08: 0000000000000001 R09:0000000000000000
[   28.019169] R10: 0000000000000000 R11: 0000000000000121 R12:ffff8800baa9f640
[   28.019947] R13: ffff88011a81e340 R14: ffff88011a823700 R15:0000000000000000
[   28.020071] FS:  0000000000000000(0000) GS:ffff88011a800000(0000)knlGS:0000000000000000
[   28.020071] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   28.020071] CR2: 00007ff6144b01d0 CR3: 00000000b8e93000 CR4:00000000000006f0
[   28.020071] Stack:
[   28.020071]  ffff88011a858dc0 ffff8800baa9f640 ffff8800ba42fe00ffffffff8106bd88
[   28.020071]  ffffffff8106bd0b 0000000000000096 0000000000000000ffffffff82f9b1e8
[   28.020071]  ffffffff829f0b10 0000000000000000 ffffffff81f18460ffff88011a81e340
[   28.020071] Call Trace:
[   28.020071]  [<ffffffff8106bd88>] process_one_work+0x1c8/0x540
[   28.020071]  [<ffffffff8106bd0b>] ? process_one_work+0x14b/0x540
[   28.020071]  [<ffffffff8106c214>] worker_thread+0x114/0x460
[   28.020071]  [<ffffffff8106c100>] ? process_one_work+0x540/0x540
[   28.020071]  [<ffffffff81071bf8>] kthread+0xf8/0x110
[   28.020071]  [<ffffffff81071b00>] ?kthread_create_on_node+0x200/0x200
[   28.020071]  [<ffffffff81a6522f>] ret_from_fork+0x3f/0x70
[   28.020071]  [<ffffffff81071b00>] ?kthread_create_on_node+0x200/0x200

Signed-off-by: Shaohua Li <>
Signed-off-by: Tejun Heo <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoi2c: rcar: enable RuntimePM before registering to the core
Wolfram Sang [Fri, 9 Oct 2015 09:39:25 +0000 (10:39 +0100)]
i2c: rcar: enable RuntimePM before registering to the core

commit 4f7effddf4549d57114289f273710f077c4c330a upstream.

The core may register clients attached to this master which may use
funtionality from the master. So, RuntimePM must be enabled before, otherwise
this will fail. While here, move drvdata, too.

Reported-by: Geert Uytterhoeven <>
Signed-off-by: Wolfram Sang <>
Signed-off-by: Wolfram Sang <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agocrypto: ahash - ensure statesize is non-zero
Russell King [Fri, 9 Oct 2015 19:43:33 +0000 (20:43 +0100)]
crypto: ahash - ensure statesize is non-zero

commit 8996eafdcbad149ac0f772fb1649fbb75c482a6a upstream.

Unlike shash algorithms, ahash drivers must implement export
and import as their descriptors may contain hardware state and
cannot be exported as is.  Unfortunately some ahash drivers did
not provide them and end up causing crashes with algif_hash.

This patch adds a check to prevent these drivers from registering
ahash algorithms until they are fixed.

Signed-off-by: Russell King <>
Signed-off-by: Herbert Xu <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agocrypto: sparc - initialize blkcipher.ivsize
Dave Kleikamp [Mon, 5 Oct 2015 15:08:51 +0000 (10:08 -0500)]
crypto: sparc - initialize blkcipher.ivsize

commit a66d7f724a96d6fd279bfbd2ee488def6b081bea upstream.

Some of the crypto algorithms write to the initialization vector,
but no space has been allocated for it. This clobbers adjacent memory.

Signed-off-by: Dave Kleikamp <>
Signed-off-by: Herbert Xu <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agom68k/uaccess: Fix asm constraints for userspace access
Geert Uytterhoeven [Sun, 9 Jun 2013 18:12:42 +0000 (20:12 +0200)]
m68k/uaccess: Fix asm constraints for userspace access

commit 631d8b674f5f8235e9cb7e628b0fe9e5200e3158 upstream.

When compiling a MMU kernel with CPU_HAS_ADDRESS_SPACES=n (e.g. "MMU=y
allnoconfig": "echo CONFIG_MMU=y > allno.config && make KCONFIG_ALLCONFIG=1
allnoconfig"), we use plain "move" instead of "moves", and I got:

  CC      arch/m68k/lib/uaccess.o
{standard input}: Assembler messages:
{standard input}:47: Error: operands mismatch -- statement `move.b %a0,(%a1)' ignored

This happens because plain "move" doesn't support byte transfers between
memory and address registers, while "moves" does.

Fix the asm constraints for __generic_copy_from_user(),
__generic_copy_to_user(), and __clear_user() to only use data registers
when accessing userspace.

Also, relax the asm constraints for 16-bit userspace accesses in
__put_user() and __get_user(), as both "move" and "moves" do support
such transfers between memory and address registers.

Signed-off-by: Geert Uytterhoeven <>
Cc: Guenter Roeck <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoasix: Do full reset during ax88772_bind
Charles Keepax [Thu, 6 Nov 2014 15:49:41 +0000 (15:49 +0000)]
asix: Do full reset during ax88772_bind

[ Upstream commit 436c2a5036b6ffe813310df2cf327d3b69be0734 ]

commit 3cc81d85ee01 ("asix: Don't reset PHY on if_up for ASIX 88772")
causes the ethernet on Arndale to no longer function. This appears to
be because the Arndale ethernet requires a full reset before it will
function correctly, however simply reverting the above patch causes
problems with ethtool settings getting reset.

It seems the problem is that the ethernet is not properly reset during
bind, and indeed the code in ax88772_bind that resets the device is a
very small subset of the actual ax88772_reset function. This patch uses
ax88772_reset in place of the existing reset code in ax88772_bind which
removes some code duplication and fixes the ethernet on Arndale.

It is still possible that the original patch causes some issues with
suspend and resume but that seems like a separate issue and I haven't
had a chance to test that yet.

Signed-off-by: Charles Keepax <>
Tested-by: Riku Voipio <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoasix: Don't reset PHY on if_up for ASIX 88772
Michel Stam [Thu, 2 Oct 2014 08:22:02 +0000 (10:22 +0200)]
asix: Don't reset PHY on if_up for ASIX 88772

[ Upstream commit 3cc81d85ee01e5a0b7ea2f4190e2ed1165f53c31 ]

I've noticed every time the interface is set to 'up,', the kernel
reports that the link speed is set to 100 Mbps/Full Duplex, even
when ethtool is used to set autonegotiation to 'off', half
duplex, 10 Mbps.
It can be tested by:
 ifconfig eth0 down
 ethtool -s eth0 autoneg off speed 10 duplex half
 ifconfig eth0 up

Then checking 'dmesg' for the link speed.

Signed-off-by: Michel Stam <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoethtool: Use kcalloc instead of kmalloc for ethtool_get_strings
Joe Perches [Wed, 14 Oct 2015 08:09:40 +0000 (01:09 -0700)]
ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings

[ Upstream commit 077cb37fcf6f00a45f375161200b5ee0cd4e937b ]

It seems that kernel memory can leak into userspace by a
kmalloc, ethtool_get_strings, then copy_to_user sequence.

Avoid this by using kcalloc to zero fill the copied buffer.

Signed-off-by: Joe Perches <>
Acked-by: Ben Hutchings <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoppp: don't override sk->sk_state in pppoe_flush_dev()
Guillaume Nault [Wed, 30 Sep 2015 09:45:33 +0000 (11:45 +0200)]
ppp: don't override sk->sk_state in pppoe_flush_dev()

[ Upstream commit e6740165b8f7f06d8caee0fceab3fb9d790a6fed ]

Since commit 2b018d57ff18 ("pppoe: drop PPPOX_ZOMBIEs in pppoe_release"),
pppoe_release() calls dev_put(po->pppoe_dev) if sk is in the
PPPOX_ZOMBIE state. But pppoe_flush_dev() can set sk->sk_state to
PPPOX_ZOMBIE _and_ reset po->pppoe_dev to NULL. This leads to the
following oops:

[  570.140800] BUG: unable to handle kernel NULL pointer dereference at 00000000000004e0
[  570.142931] IP: [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe]
[  570.144601] PGD 3d119067 PUD 3dbc1067 PMD 0
[  570.144601] Oops: 0000 [#1] SMP
[  570.144601] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core ip6_udp_tunnel udp_tunnel pppoe pppox ppp_generic slhc loop crc32c_intel ghash_clmulni_intel jitterentropy_rng sha256_generic hmac drbg ansi_cprng aesni_intel aes_x86_64 ablk_helper cryptd lrw gf128mul glue_helper acpi_cpufreq evdev serio_raw processor button ext4 crc16 mbcache jbd2 virtio_net virtio_blk virtio_pci virtio_ring virtio
[  570.144601] CPU: 1 PID: 15738 Comm: ppp-apitest Not tainted 4.2.0 #1
[  570.144601] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
[  570.144601] task: ffff88003d30d600 ti: ffff880036b60000 task.ti: ffff880036b60000
[  570.144601] RIP: 0010:[<ffffffffa018c701>]  [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe]
[  570.144601] RSP: 0018:ffff880036b63e08  EFLAGS: 00010202
[  570.144601] RAX: 0000000000000000 RBX: ffff880034340000 RCX: 0000000000000206
[  570.144601] RDX: 0000000000000006 RSI: ffff88003d30dd20 RDI: ffff88003d30dd20
[  570.144601] RBP: ffff880036b63e28 R08: 0000000000000001 R09: 0000000000000000
[  570.144601] R10: 00007ffee9b50420 R11: ffff880034340078 R12: ffff8800387ec780
[  570.144601] R13: ffff8800387ec7b0 R14: ffff88003e222aa0 R15: ffff8800387ec7b0
[  570.144601] FS:  00007f5672f48700(0000) GS:ffff88003fc80000(0000) knlGS:0000000000000000
[  570.144601] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  570.144601] CR2: 00000000000004e0 CR3: 0000000037f7e000 CR4: 00000000000406a0
[  570.144601] Stack:
[  570.144601]  ffffffffa018f240 ffff8800387ec780 ffffffffa018f240 ffff8800387ec7b0
[  570.144601]  ffff880036b63e48 ffffffff812caabe ffff880039e4e000 0000000000000008
[  570.144601]  ffff880036b63e58 ffffffff812cabad ffff880036b63ea8 ffffffff811347f5
[  570.144601] Call Trace:
[  570.144601]  [<ffffffff812caabe>] sock_release+0x1a/0x75
[  570.144601]  [<ffffffff812cabad>] sock_close+0xd/0x11
[  570.144601]  [<ffffffff811347f5>] __fput+0xff/0x1a5
[  570.144601]  [<ffffffff811348cb>] ____fput+0x9/0xb
[  570.144601]  [<ffffffff81056682>] task_work_run+0x66/0x90
[  570.144601]  [<ffffffff8100189e>] prepare_exit_to_usermode+0x8c/0xa7
[  570.144601]  [<ffffffff81001a26>] syscall_return_slowpath+0x16d/0x19b
[  570.144601]  [<ffffffff813babb1>] int_ret_from_sys_call+0x25/0x9f
[  570.144601] Code: 48 8b 83 c8 01 00 00 a8 01 74 12 48 89 df e8 8b 27 14 e1 b8 f7 ff ff ff e9 b7 00 00 00 8a 43 12 a8 0b 74 1c 48 8b 83 a8 04 00 00 <48> 8b 80 e0 04 00 00 65 ff 08 48 c7 83 a8 04 00 00 00 00 00 00
[  570.144601] RIP  [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe]
[  570.144601]  RSP <ffff880036b63e08>
[  570.144601] CR2: 00000000000004e0
[  570.200518] ---[ end trace 46956baf17349563 ]---

pppoe_flush_dev() has no reason to override sk->sk_state with
PPPOX_ZOMBIE. pppox_unbind_sock() already sets sk->sk_state to
PPPOX_DEAD, which is the correct state given that sk is unbound and
po->pppoe_dev is NULL.

Fixes: 2b018d57ff18 ("pppoe: drop PPPOX_ZOMBIEs in pppoe_release")
Tested-by: Oleksii Berezhniak <>
Signed-off-by: Guillaume Nault <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agonet: add pfmemalloc check in sk_add_backlog()
Eric Dumazet [Wed, 30 Sep 2015 01:52:25 +0000 (18:52 -0700)]
net: add pfmemalloc check in sk_add_backlog()

[ Upstream commit c7c49b8fde26b74277188bdc6c9dca38db6fa35b ]

Greg reported crashes hitting the following check in __sk_backlog_rcv()

BUG_ON(!sock_flag(sk, SOCK_MEMALLOC));

The pfmemalloc bit is currently checked in sk_filter().

This works correctly for TCP, because sk_filter() is ran in
tcp_v[46]_rcv() before hitting the prequeue or backlog checks.

For UDP or other protocols, this does not work, because the sk_filter()
is ran from sock_queue_rcv_skb(), which might be called _after_ backlog
queuing if socket is owned by user by the time packet is processed by
softirq handler.

Fixes: b4b9e35585089 ("netvm: set PF_MEMALLOC as appropriate during SKB processing")
Signed-off-by: Eric Dumazet <>
Reported-by: Greg Thelen <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoskbuff: Fix skb checksum partial check.
Pravin B Shelar [Tue, 29 Sep 2015 00:24:25 +0000 (17:24 -0700)]
skbuff: Fix skb checksum partial check.

[ Upstream commit 31b33dfb0a144469dd805514c9e63f4993729a48 ]

Earlier patch 6ae459bda tried to detect void ckecksum partial
skb by comparing pull length to checksum offset. But it does
not work for all cases since checksum-offset depends on
updates to skb->data.

Following patch fixes it by validating checksum start offset
after skb-data pointer is updated. Negative value of checksum
offset start means there is no need to checksum.

Fixes: 6ae459bda ("skbuff: Fix skb checksum flag on skb pull")
Reported-by: Andrew Vagin <>
Signed-off-by: Pravin B Shelar <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoskbuff: Fix skb checksum flag on skb pull
Pravin B Shelar [Tue, 22 Sep 2015 19:57:53 +0000 (12:57 -0700)]
skbuff: Fix skb checksum flag on skb pull

[ Upstream commit 6ae459bdaaeebc632b16e54dcbabb490c6931d61 ]

VXLAN device can receive skb with checksum partial. But the checksum
offset could be in outer header which is pulled on receive. This results
in negative checksum offset for the skb. Such skb can cause the assert
failure in skb_checksum_help(). Following patch fixes the bug by setting
checksum-none while pulling outer header.

Following is the kernel panic msg from old kernel hitting the bug.

------------[ cut here ]------------
kernel BUG at net/core/dev.c:1906!
RIP: 0010:[<ffffffff81518034>] skb_checksum_help+0x144/0x150
Call Trace:
[<ffffffffa0164c28>] queue_userspace_packet+0x408/0x470 [openvswitch]
[<ffffffffa016614d>] ovs_dp_upcall+0x5d/0x60 [openvswitch]
[<ffffffffa0166236>] ovs_dp_process_packet_with_key+0xe6/0x100 [openvswitch]
[<ffffffffa016629b>] ovs_dp_process_received_packet+0x4b/0x80 [openvswitch]
[<ffffffffa016c51a>] ovs_vport_receive+0x2a/0x30 [openvswitch]
[<ffffffffa0171383>] vxlan_rcv+0x53/0x60 [openvswitch]
[<ffffffffa01734cb>] vxlan_udp_encap_recv+0x8b/0xf0 [openvswitch]
[<ffffffff8157addc>] udp_queue_rcv_skb+0x2dc/0x3b0
[<ffffffff8157b56f>] __udp4_lib_rcv+0x1cf/0x6c0
[<ffffffff8157ba7a>] udp_rcv+0x1a/0x20
[<ffffffff8154fdbd>] ip_local_deliver_finish+0xdd/0x280
[<ffffffff81550128>] ip_local_deliver+0x88/0x90
[<ffffffff8154fa7d>] ip_rcv_finish+0x10d/0x370
[<ffffffff81550365>] ip_rcv+0x235/0x300
[<ffffffff8151ba1d>] __netif_receive_skb+0x55d/0x620
[<ffffffff8151c360>] netif_receive_skb+0x80/0x90
[<ffffffff81459935>] virtnet_poll+0x555/0x6f0
[<ffffffff8151cd04>] net_rx_action+0x134/0x290
[<ffffffff810683d8>] __do_softirq+0xa8/0x210
[<ffffffff8162fe6c>] call_softirq+0x1c/0x30
[<ffffffff810161a5>] do_softirq+0x65/0xa0
[<ffffffff810687be>] irq_exit+0x8e/0xb0
[<ffffffff81630733>] do_IRQ+0x63/0xe0
[<ffffffff81625f2e>] common_interrupt+0x6e/0x6e

Reported-by: Anupam Chanda <>
Signed-off-by: Pravin B Shelar <>
Acked-by: Tom Herbert <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoaf_unix: return data from multiple SKBs on recv() with MSG_PEEK flag
Aaron Conole [Sat, 26 Sep 2015 22:50:43 +0000 (18:50 -0400)]
af_unix: return data from multiple SKBs on recv() with MSG_PEEK flag

[ Upstream commit 9f389e35674f5b086edd70ed524ca0f287259725 ]

AF_UNIX sockets now return multiple skbs from recv() when MSG_PEEK flag
is set.

This is referenced in kernel bugzilla #12323 @

As described both in the BZ and lkml thread @ calling recv() with MSG_PEEK on an
AF_UNIX socket only reads a single skb, where the desired effect is
to return as much skb data has been queued, until hitting the recv
buffer size (whichever comes first).

The modified MSG_PEEK path will now move to the next skb in the tree
and jump to the again: label, rather than following the natural loop
structure. This requires duplicating some of the loop head actions.

This was tested using the python socketpair python code attached to
the bugzilla issue.

Signed-off-by: Aaron Conole <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agoaf_unix: Convert the unix_sk macro to an inline function for type safety
Aaron Conole [Sat, 26 Sep 2015 22:50:42 +0000 (18:50 -0400)]
af_unix: Convert the unix_sk macro to an inline function for type safety

[ Upstream commit 4613012db1d911f80897f9446a49de817b2c4c47 ]

As suggested by Eric Dumazet this change replaces the
#define with a static inline function to enjoy
complaints by the compiler when misusing the API.

Signed-off-by: Aaron Conole <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agol2tp: protect tunnel->del_work by ref_count
Alexander Couzens [Mon, 28 Sep 2015 09:32:42 +0000 (11:32 +0200)]
l2tp: protect tunnel->del_work by ref_count

[ Upstream commit 06a15f51cf3618e32a73871ee6a547ef7fd902b5 ]

There is a small chance that tunnel_free() is called before tunnel->del_work scheduled
resulting in a zero pointer dereference.

Signed-off-by: Alexander Couzens <>
Acked-by: James Chapman <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
7 years agopwm: rockchip: add pwm supported for rk3228
David Wu [Thu, 22 Oct 2015 08:38:25 +0000 (16:38 +0800)]
pwm: rockchip: add pwm supported for rk3228

Change-Id: I30d816d4bca2fb532b009505947d1465732a2f07
Signed-off-by: David Wu <>
7 years agoi2c: rockchip: add i2c supported for rk3228
David Wu [Thu, 22 Oct 2015 08:25:35 +0000 (16:25 +0800)]
i2c: rockchip: add i2c supported for rk3228

Change-Id: I3836b589f3ba456869f20a0ad97e6cde031debfd
Signed-off-by: David Wu <>
7 years agork3228: pinctrl: add rk3288-pinctrl func supported
David Wu [Tue, 20 Oct 2015 02:17:45 +0000 (10:17 +0800)]
rk3228: pinctrl: add rk3288-pinctrl func supported

Change-Id: I9d85f55d6478bcd5dfcee704b235585ee0ba7c75
Signed-off-by: David Wu <>
7 years agommc: rk_sdmmc: fix NULL pointer in printout
Shawn Lin [Fri, 23 Oct 2015 09:19:50 +0000 (17:19 +0800)]
mmc: rk_sdmmc: fix NULL pointer in printout

This patch fix NULL pointer to chan_id while requsting
external dma channel failed.

Change-Id: I0abe1acb0a892cbaec0cadb24fe215b46e2e9abb
Signed-off-by: Shawn Lin <>