platform/kernel/linux-amlogic.git
6 years agonand: fix nand key read issue
yi.zeng [Thu, 17 Aug 2017 02:25:35 +0000 (10:25 +0800)]
nand: fix nand key read issue

PD#146835: nand: fix the nand key read issue caused by overload memory

Change-Id: I53ce06da8ddf5f691898a7546b1b96bb9af486cd
Signed-off-by: yi.zeng <yi.zeng@amlogic.com>
6 years agoaudio: add channel constrains for TDM
Shuai Li [Mon, 28 Aug 2017 03:16:16 +0000 (11:16 +0800)]
audio: add channel constrains for TDM

PD#149888: constrains max channels number by DTS lanes
and tx_mask configs. If not, FIFO will fetch the wrong
data and cause abnormal behavior for I2S data.

Change-Id: Ic10bb773f6360ad0dfee74c227adb279dcc47cec
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
6 years agoaudio: fix codecs kcontrol bugs
Shuai Li [Fri, 25 Aug 2017 11:05:08 +0000 (19:05 +0800)]
audio: fix codecs kcontrol bugs

PD#145715: kernel 4.9 use components to wrapper the codec instance.
When poring form early versions, we have no idea about
this change. And this commit fixes this issue.

Change-Id: I56357b45c1bf93844f77fe89a828911fa9779406
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
6 years agopstore: change pstore address to 0x7400000
Ao Xu [Thu, 24 Aug 2017 11:31:22 +0000 (19:31 +0800)]
pstore: change pstore address to 0x7400000

PD#149300: pstore: change pstore address to 0x7400000

Change-Id: Ic8f4240a2c5c4c2137ad4c050a9af8692be15dba
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
6 years agoframe_sync: fixed the issure of the player that starts slowly [2/2]
Nanxin Qin [Wed, 23 Aug 2017 06:42:54 +0000 (14:42 +0800)]
frame_sync: fixed the issure of the player that starts slowly [2/2]

PD#148146: modify checkin_firstvpts to 0xffffffff

Change-Id: I16d75f8cd0f7ed7582f731db42bc247c49580974
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
6 years agodefconfig: enable configs to fix AndroidO CTS and VTS fail
Ao Xu [Thu, 24 Aug 2017 06:54:27 +0000 (14:54 +0800)]
defconfig: enable configs to fix AndroidO CTS and VTS fail

PD#149771: enable configs to fix AndroidO CTS and VTS fail
CONFIG_IKCONFIG_PROC=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_CPU_FREQ_STAT=y

In order to know how the kernel was configured via /proc,
select the CONFIG_IKCONFIG_PROC is a good choice.

Change-Id: Ief65788029157adfbd3351f6a1d589670e440d76
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
6 years agodts: adjust partition table for Android 8.0 [1/2]
Xindong Xu [Fri, 11 Aug 2017 06:38:48 +0000 (14:38 +0800)]
dts: adjust partition table for Android 8.0 [1/2]

PD#149137: dts: adjust partition table for Android 8.0

1. delete crypt
2. change tee to 32M
3. add param 16M
4. add cri_data 8M
5. add dto 8M
6. change logo to 8M
7. change misc to 8M
8. change boot to 16M
9. change recovery to 24M
10. change system to 1856M
11. change cache to 1120M

Change-Id: Ice80dee7736a127c555cac641bc3a8874aeb519e
Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
6 years agopcie: enable pcie pm.
Yue Wang [Wed, 23 Aug 2017 09:59:56 +0000 (17:59 +0800)]
pcie: enable pcie pm.

PD#147022: pcie: enable pcie pm.

Change-Id: Ide75af5cbe2bb840887e36a174cbfec33691534c
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
6 years agodts: axg: fix error when unistall wifi that call trace
Haibing.An [Wed, 23 Aug 2017 02:01:44 +0000 (10:01 +0800)]
dts: axg: fix error when unistall wifi that call trace

PD#148250: S400 and S420

Change-Id: I690f3ab850e01d3ad8a48fc01d74625a89a8db11
Signed-off-by: Haibing.An <haibing.an@amlogic.com>
6 years agonand: add toshiba 512M(TC58NVG2S0HTA00)
Yonghui Yu [Mon, 14 Aug 2017 08:24:16 +0000 (16:24 +0800)]
nand: add toshiba 512M(TC58NVG2S0HTA00)

PD#149262: mtd:nand : add toshiba 512M(TC58NVG2S0HTA00)

Change-Id: Ib4e5abca5b1b99542df1e9a6dc3ed347474ecfa2
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
6 years agolcd_extern: fix i2c address mistake for dts config
Weiming Liu [Fri, 18 Aug 2017 07:47:39 +0000 (15:47 +0800)]
lcd_extern: fix i2c address mistake for dts config

PD#149233: lcd: add lcd_extern driver za7783
1.add lcd_extern driver za7783
2.modify the axg pll parameters
3.read under the dts lcd_extern i2c address errors

Change-Id: Ib059805a6a82d7896b2394d451d5aedb3f10ecb9
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
6 years agomm: export symbol for show_mem
binqi.zhang [Fri, 11 Aug 2017 07:18:50 +0000 (15:18 +0800)]
mm: export symbol for show_mem

PD#149671: mm: export symbol for show_mem.

export symbol for show_mem() and other modules can use the function

Change-Id: Ia4b0c595ada1db2326e07d67b136ad92c9d3cb67
Signed-off-by: binqi.zhang <binqi.zhang@amlogic.com>
(cherry picked from commit 53577ac0164bcd9e933ec43c18139f2f1c55ea56)

6 years agordma: fixed issure of crash on boot.
Nanxin Qin [Tue, 22 Aug 2017 05:45:03 +0000 (13:45 +0800)]
rdma: fixed issure of crash on boot.

PD#149681: removed the operation of registers in the rdma_init

Change-Id: Iecf12be123952d0a5eb91b77e433d3fb67378d4e
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
6 years agodts: axg: fix bluetooth pinmux problems
Peipeng Zhao [Tue, 22 Aug 2017 07:06:29 +0000 (15:06 +0800)]
dts: axg: fix bluetooth pinmux problems

PD#149672:
modified dts tdma data pinmux, tdma output data pin
need be set tdma_out1. otherwise soc can not send data
to Bluetooth.

Change-Id: I62a0ea89de092c6b9c3504223822e8c7fd58ecad
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agomedia: merged code from 43177e6a on the amlogic-3.14-dev
Nanxin Qin [Mon, 19 Jun 2017 07:34:01 +0000 (15:34 +0800)]
media: merged code from 43177e6a on the amlogic-3.14-dev

PD#146152: merged code from 43177e6a on the amlogic-3.14-dev

1. support for multi-instance features
2. fixed in multi-instance codec_mm memory bugs and added some
debugging information
3. optimization of vfm problems

Change-Id: I43ba9d4894ae71d53c158df667490030735b9e1e
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
Signed-off-by: KeLe Bai <kele.bai@amlogic.com>
6 years agodefconfig: add uid_sys_stats and cpu_freq_stat support
Ao Xu [Fri, 18 Aug 2017 06:51:47 +0000 (14:51 +0800)]
defconfig: add uid_sys_stats and cpu_freq_stat support

PD#149464: defconfig: add uid_sys_stats and cpu_freq_stat support
1. add CONFIG_CPU_FREQ_STAT
2. add CONFIG_UID_SYS_STATS
3. remove CONFIG_FHANDLE

Change-Id: I2b165676619a46e95ed2f75354e6e0a440cac43f
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
6 years agodts: axg: support 128m ddr
Yueguie He [Mon, 21 Aug 2017 04:34:16 +0000 (12:34 +0800)]
dts: axg: support 128m ddr

PD#148955: dts: support 128m ddr

Change-Id: I7694bb10659b748c4e43e665945dcd7e8082a68e
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
6 years agovpp: fix interlace out issue
Dezhi Kong [Fri, 18 Aug 2017 02:23:18 +0000 (10:23 +0800)]
vpp: fix interlace out issue

PD#145318: vpp: fix interlace out issue

Change-Id: I623bbaf0b0795029ca689a81cf10c274afaa1fc3
Signed-off-by: Dezhi Kong <dezhi.kong@amlogic.com>
6 years agosecurity: fix security issues about memory and registers
jianxin.pan [Thu, 17 Aug 2017 12:31:47 +0000 (20:31 +0800)]
security: fix security issues about memory and registers

PD#138714: fix security issuses
1.Kernel Memory Corruption in efuse_read_usr()
Kernel Memory Corruption in efuse_read_usr()

2.Audio SoC DebugFS Entry Allows Kernel Memory Corruption

3.Kernel Stack Buffer Overwrite in clk_test debugfs

4.Register DebugFS Entry Allows Kernel Memory Read

Change-Id: I49373967732dde10e589f07aaab313340ba726e7
Signed-off-by: jianxin.pan <jianxin.pan@amlogic.com>
6 years agodts: axg: enable vrtc for axg
Qiufang Dai [Fri, 18 Aug 2017 02:35:39 +0000 (10:35 +0800)]
dts: axg: enable vrtc for axg

PD#149457: rtc: enable vrtc for axg

Change-Id: Ibb724cdbc767173e84a1238ffd5d33190f09efe0
Signed-off-by: Qiufang Dai <qiufang.dai@amlogic.com>
6 years agoaudio: snd mixer controls for tdm/spdif
Xing Wang [Wed, 16 Aug 2017 07:40:13 +0000 (15:40 +0800)]
audio: snd mixer controls for tdm/spdif

PD#147540: audio: add snd mixer controls for tdm/spdif
1. add gain/mute/swap/mask for tdm/spdif
2. channel status for spdif in/out
3. add loopback for s420, and fix datain channel number

Change-Id: I81d4432dc2b73c7cb0275087fc3d4e23ec83e400
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
6 years agodts: change system partition size
Yueguie He [Thu, 17 Aug 2017 06:10:32 +0000 (14:10 +0800)]
dts: change system partition size

PD#149409: dts: change system partition size

Change-Id: I163b8f09705e3cd81211cfe790e7ef9997ae21dc
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
6 years agodts: add dhd_static_buf for p230 [1/1]
Tellen Yu [Wed, 16 Aug 2017 07:46:04 +0000 (15:46 +0800)]
dts: add dhd_static_buf for p230 [1/1]

PD#146107: dts: add dhd_static_buf for gxl p230.

Change-Id: Ic54abfc97bdae8cdce184aa6562bcbc577f05f74
Signed-off-by: Tellen Yu <tellen.yu@amlogic.com>
6 years agopstore: add CONFIG_PSTORE_PMSG, add dts node in gxl_p212_2g.dts
Ao Xu [Tue, 15 Aug 2017 06:03:53 +0000 (14:03 +0800)]
pstore: add CONFIG_PSTORE_PMSG, add dts node in gxl_p212_2g.dts

PD#149300: pstore: add CONFIG_PSTORE_PMSG, add dts node in gxl_p212_2g.dts

Change-Id: I4407180bcde350fe4204380dacc9c8450ce254e0
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
6 years agoddr: fix ddr window drvir error
Yueguie He [Wed, 16 Aug 2017 06:55:42 +0000 (14:55 +0800)]
ddr: fix ddr window drvir error

PD#149154: ddr: fix ddr window error

Change-Id: Icf3f63e96950a28f0ae30ce7fa470c397bef6495
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
6 years agodts: p230: add cma heap for ion [1/1]
Xindong Xu [Tue, 15 Aug 2017 10:39:20 +0000 (18:39 +0800)]
dts: p230: add cma heap for ion [1/1]

PD#146107: dts: p230: add cma heap for ion on Android 8.0

Change-Id: I37614c6d7417da9bf686295147739ad1d7ed1ef4
Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
6 years agocec: fix rcu stall by bad usage of spinlock
Tao Zeng [Wed, 16 Aug 2017 02:55:34 +0000 (10:55 +0800)]
cec: fix rcu stall by bad usage of spinlock

PD#149212: cec: fix rcu stall by spinlock

Using irqsave/irqrestore API to prevent rcu stall by spinlock

Change-Id: Ia960864e1f9b21f11c1f9656da2c0efbf221a8ac
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
6 years agohdmitx: using BL31 cmd to access hdmi reg
Yi Zhou [Tue, 15 Aug 2017 05:51:28 +0000 (13:51 +0800)]
hdmitx: using BL31 cmd to access hdmi reg

PD#149289: using BL31 cmd to access hdmi reg

1.hdmitx register may be accessed by kernel, bl30, bl31, etc...
To avoid concurrence issue, all should be only one port to access
hdmitx registers.Uniform kernel access to bl31.

2.optimize hdmitx driver style.

Change-Id: Ie5ae4b8bb8a641ccd39375b9addf9a8b01dcf464
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
6 years agonand: add a new nand flash "TC58NVG2S0HBAI6" for SU customer
Yi Zeng [Mon, 14 Aug 2017 03:25:01 +0000 (11:25 +0800)]
nand: add a new nand flash "TC58NVG2S0HBAI6" for SU customer

PD#149218: nand: add a new nand flash "TC58NVG2S0HBAI6" for SU customer

Change-Id: I06b832365db629bd4c46fa6b6fa6ab4656267602
Signed-off-by: Yi Zeng <“yi.zeng@amlogic.com”>
6 years agoaudio: modify lanemask for tdmout
Shuai Li [Fri, 11 Aug 2017 11:09:44 +0000 (19:09 +0800)]
audio: modify lanemask for tdmout

PD#149114: S420 V03 speaker no sound when playing 2-ch wav

S400 & S420 modify the lineout and speaker out on TDMC dataIO2.
This commit make the speaker output available
by the output lanemask setting:

    "dai-tdm-lane-slot-mask-out = <0 0 1 0>;"

It masks the third lane as data output when playing two channel
PCM waves.

Change-Id: Id1627c06f24f3fb57cc645247ca8183f197656db
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
6 years agoMerge branch 'android-4.9' into amlogic-4.9-dev
Victor Wan [Mon, 14 Aug 2017 07:24:11 +0000 (15:24 +0800)]
Merge branch 'android-4.9' into amlogic-4.9-dev

6 years agoMerge "audio: modified tlv320adc3101 to support multi config through amixer" into...
Jianxin Pan [Mon, 14 Aug 2017 06:37:53 +0000 (23:37 -0700)]
Merge "audio: modified tlv320adc3101 to support multi config through amixer" into amlogic-4.9-dev

6 years agoaudio: modified tlv320adc3101 to support multi config through amixer
Peipeng Zhao [Fri, 11 Aug 2017 09:43:18 +0000 (17:43 +0800)]
audio: modified tlv320adc3101 to support multi config through amixer

PD#149164: modified codec tlv320adc3101 to support multi config through
amixer

Change-Id: I8c679a2ef6b977efd84d3951fa6d0012a5c8af50
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agodts: add s420 128m dts
Yueguie He [Mon, 14 Aug 2017 02:09:56 +0000 (10:09 +0800)]
dts: add s420 128m dts

PD#148955: dts: support 128m ddr, when enable SecurOs:setenv initrd_high
0x04000000

Change-Id: If59c049a3cd5af9ba9d15f2fca63a5e3df672e1d
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
6 years agoemmc: clear line_dly on calibration
Nan Li [Tue, 1 Aug 2017 05:28:57 +0000 (13:28 +0800)]
emmc: clear line_dly on calibration

PD#148637: clear line_delay on every line calibration,
so any line's line_delay will not interfere with each other.

Change-Id: I784f66ab9df111b886ab0e45fa007f3bb2dc111e
Signed-off-by: Nan Li <nan.li@amlogic.com>
6 years agoemmc: optimizing emmc hs400 timing process
Long Yu [Fri, 11 Aug 2017 09:09:13 +0000 (17:09 +0800)]
emmc: optimizing emmc hs400 timing process

PD#148082: emmc: optimizing emmc hs400 timing process

Change-Id: I0318dec3e0c89eef3a396b157ada97b2ef768f7f
Signed-off-by: Long Yu <long.yu@amlogic.com>
6 years agosecure_monitor: use reserve mem from secure os
Jiamin Ma [Sat, 12 Aug 2017 09:26:05 +0000 (17:26 +0800)]
secure_monitor: use reserve mem from secure os

PD#148390: add nandkey and secure storage

the reserve mem used by secure monitor comes form secure os.
we should not redefine it in DTS

Change-Id: If42f2410474e090ed5b2bca143d5a9d16260f49c
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
6 years agoaudio: fix multi-codec conf issue
Shuai Li [Thu, 10 Aug 2017 05:29:40 +0000 (13:29 +0800)]
audio: fix multi-codec conf issue

PD#147919: ksize() doesn't return the alloc memory size.
Use card saved num_confs to calc the actual old size.

'amixer controls' will be:
...
numid=10,iface=MIXER,name='3101_B PGA Level Volume'
numid=45,iface=MIXER,name='3101_B Right Input Mixer IN1_R P Switch'
numid=46,iface=MIXER,name='3101_B Right Input Mixer IN2_R P Switch'
numid=47,iface=MIXER,name='3101_B Right Input Mixer IN3_R P Switch'
numid=26,iface=MIXER,name='5707_A Ch1 Switch'
numid=24,iface=MIXER,name='5707_A Ch1 Volume'
numid=27,iface=MIXER,name='5707_A Ch2 Switch'
numid=25,iface=MIXER,name='5707_A Ch2 Volume'
numid=28,iface=MIXER,name='5707_A Fine Master Volume'
numid=23,iface=MIXER,name='5707_A Master Volume'
numid=30,iface=MIXER,name='5707_A Set DRC Enable'
numid=29,iface=MIXER,name='5707_A Set EQ Enable'
numid=34,iface=MIXER,name='5707_B Ch1 Switch'
numid=32,iface=MIXER,name='5707_B Ch1 Volume'
numid=35,iface=MIXER,name='5707_B Ch2 Switch'
numid=33,iface=MIXER,name='5707_B Ch2 Volume'
numid=36,iface=MIXER,name='5707_B Fine Master Volume'
numid=31,iface=MIXER,name='5707_B Master Volume'
numid=38,iface=MIXER,name='5707_B Set DRC Enable'
numid=37,iface=MIXER,name='5707_B Set EQ Enable'

Change-Id: I8e7d977b523c63ee1bb5ce1284892893db34f2f2
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
6 years agoesm: configurate DAM of HDCP correctly
Yi Zhou [Wed, 9 Aug 2017 03:54:37 +0000 (11:54 +0800)]
esm: configurate DAM of HDCP correctly

PD#146713: configurate DMA of HDCP correctly

1.In kernel 4.9, before DMA operation, of_dma_configure function must
be used. Otherwise, it will get a NULL pointer and result in a kernel
crash.

2.For secure reasons, node '/dev/mem' has gone away. But for esm, there
still need this feature for debug. So add a new blob for esay dump:
 dd if=/sys/kernel/debug/esm/blob of=/UPATH/esmmem.

Change-Id: Id86cc88227bf2d14aca3e3d323da32853a46e37f
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
6 years agoaudio: modified dts for S400 & S420 board V03
Peipeng Zhao [Thu, 10 Aug 2017 11:16:26 +0000 (19:16 +0800)]
audio: modified dts for S400 & S420 board V03

PD#149114: modified dts for S400 & S420 board V03

Change-Id: Idd311e0061bc5fcf30f0a4cf3bdfef4aec3767fa
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agoemmc: optimizing emmc hs400 timing process
Long Yu [Mon, 7 Aug 2017 10:44:55 +0000 (18:44 +0800)]
emmc: optimizing emmc hs400 timing process

PD#148082: emmc: optimizing emmc hs400 timing process

1. optimizing emmc hs400 timing

2. adjust the sampling method of the cmd line

3. clear intf3 register after suspending process

Change-Id: Ifb566f267b0cbc21c360ed63e8cdf2b98dfc4313
Signed-off-by: Long Yu <long.yu@amlogic.com>
6 years agoethernet: fix bug for get mc_val_external_phy from dts. [1/1]
Qi Duan [Tue, 8 Aug 2017 11:49:57 +0000 (19:49 +0800)]
ethernet: fix bug for get mc_val_external_phy from dts. [1/1]

PD#148981: ethernet: fix bug for get mc_val_external_phy from dts.

Change-Id: I49378493f1bd7eb3fdab385de698aee323319069
Signed-off-by: Qi Duan <qi.duan@amlogic.com>
6 years agosystem: lock check: remove eth lock warnings [1/1]
Qi Duan [Thu, 10 Aug 2017 02:55:09 +0000 (10:55 +0800)]
system: lock check: remove eth lock warnings [1/1]

PD#149023: system: lock check: remove eth lock warnings.

Change-Id: Ic4e9e5dcb9e236c159f8e2af54ad2d09df2f9f95
Signed-off-by: Qi Duan <qi.duan@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
6 years agolcd: add mipi video mode non-burst support
Evoke Zhang [Tue, 8 Aug 2017 06:50:58 +0000 (14:50 +0800)]
lcd: add mipi video mode non-burst support

PD#148909: lcd: add mipi video mode non-burst support

Change-Id: Id7247927b1f681f19a4a11802a040087fe6b658c
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
6 years agolcd: mipi init table load mistake
Weiming Liu [Wed, 9 Aug 2017 06:51:33 +0000 (14:51 +0800)]
lcd: mipi init table load mistake

PD#148866: lcd: mipi init table load mistake

Change-Id: I50f75b4e252ebd49c82a8c80b2939fecdda2342d
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
6 years agodts: replace the "voice" key with "power" key for axg
xingyu.chen [Wed, 9 Aug 2017 01:14:46 +0000 (09:14 +0800)]
dts: replace the "voice" key with "power" key for axg

PD#147852: dts: replace the "voice" key with "power" key for axg

Change-Id: If565f833c5525e5bb3f1ae5989bd6021244f7b5c
Signed-off-by: xingyu.chen <xingyu.chen@amlogic.com>
6 years agoclk: update pcie pll config
Yun Cai [Wed, 9 Aug 2017 01:35:06 +0000 (09:35 +0800)]
clk: update pcie pll config

PD#148744: update axg pcie pll config

Change-Id: I4adf79f40f70cd23427f018e7030aeaa9bd080c4
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
6 years agodts: add p212/p231 buildroot dts
liangzhuo.xie [Tue, 8 Aug 2017 03:01:02 +0000 (11:01 +0800)]
dts: add p212/p231 buildroot dts

PD#148743: solved the wifi loading wrong.

Change-Id: I3804b835b6bbe70677a8a5bc837b7a52fbaac15c
Signed-off-by: liangzhuo.xie <liangzhuo.xie@amlogic.com>
6 years agoamlvideo: fix bad caps for driver amlvideo.
Lianghu Su [Tue, 25 Jul 2017 08:24:43 +0000 (16:24 +0800)]
amlvideo: fix bad caps for driver amlvideo.

PD#148065: v4l_querycap error when buildroot linux 4.9 startup.

Change-Id: I5ff911f5e08e3d1e57476f84ca3d002a093b9724
Signed-off-by: Lianghu Su <lianghu.su@amlogic.com>
6 years agoamlvideo2: fix amlvideo2 driver crash
Guosong Zhou [Mon, 7 Aug 2017 12:05:53 +0000 (20:05 +0800)]
amlvideo2: fix amlvideo2 driver crash

PD#148065: fix amlvideo2 driver crash

Change-Id: Ie4a2af31332f33800c26547aeea800c514d50857
Signed-off-by: Guosong Zhou <guosong.zhou@amlogic.com>
7 years agobl: add bl_extern driver
Weiming Liu [Tue, 1 Aug 2017 05:52:23 +0000 (13:52 +0800)]
bl: add bl_extern driver

PD#148374: bl: add bl_extern driver

Change-Id: I8019ab4c2d55c37e14f7b266166408fd5a5a58e3
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
7 years agodts: add s400/s420 v03 dts
Alex Deng [Fri, 4 Aug 2017 10:22:37 +0000 (18:22 +0800)]
dts: add s400/s420 v03 dts

PD#148795: dts: add s400/s420 v03 dts

Change-Id: I1b8326646cc7562142b68c18d518a91868a9c2c6
Signed-off-by: Alex Deng <alex.deng@amlogic.com>
7 years agosecure_monitor: add secure storage and nand key support
Jiamin Ma [Sat, 29 Jul 2017 13:40:51 +0000 (21:40 +0800)]
secure_monitor: add secure storage and nand key support

PD#148390: this commit adds secure monitor driver

Change-Id: Iac0a9a36d141d19497165f35b39df099b2c9076a
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agomtd: nand: add nandkey and secure storge
yi.zeng [Sat, 29 Jul 2017 15:57:50 +0000 (23:57 +0800)]
mtd: nand: add nandkey and secure storge

PD#148390: mtd: nand: add nandkey and secure storage

Change-Id: I220688cd14d8bf16105871e0bf0b233591b1bd33
Signed-off-by: yi.zeng <yi.zeng@amlogic.com>
7 years agodts: s400 adjust lcd reset
Weiming Liu [Wed, 2 Aug 2017 09:51:52 +0000 (17:51 +0800)]
dts: s400 adjust lcd reset

PD#147851: dts: s400 adjust lcd reset

Change-Id: Iab1627698b9de8698ba25fff8c552a5aec35a2b7
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
7 years agounifykey: add secure storage and nand key support
Jiamin Ma [Sat, 29 Jul 2017 13:20:06 +0000 (21:20 +0800)]
unifykey: add secure storage and nand key support

PD#148390: this commit fix two problems
1. the previews way to detect storage type is invalid
2. the previews define of max key size for nand and emmc
   is wrong

Change-Id: Ie7c05f3e0d85c2386177e196187f52786e0955f4
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agodts: add a113x & a113d skt config
Yueguie He [Thu, 3 Aug 2017 05:59:00 +0000 (13:59 +0800)]
dts: add a113x & a113d skt config

PD#148646: add a113x & a113d skt config

Change-Id: Id52e858fdb80b236dd504fba6c3ef6f47181d952
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
7 years agomtd: nand: fix false ecc report on infopage
Yonghui Yu [Thu, 20 Jul 2017 14:38:16 +0000 (22:38 +0800)]
mtd: nand: fix false ecc report on infopage

PD#147956: mtd: nand: fix false ecc report on infopage

Infopage must be programed with scrambled to fit romboot.
And all “0xff” page will be reported as uncorrectable falsely
with scramber on.
we have to exclude this by counting the zero byts.

Change-Id: I167491bee69444f64231a09e41d04bcd03f30d65
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agodefconfig: meson32: enable LOCKUP detector
jianxin.pan [Thu, 3 Aug 2017 02:11:18 +0000 (10:11 +0800)]
defconfig: meson32: enable LOCKUP detector

PD#141217: enable LOCKUP detector for meson32

Change-Id: I2a70e7b29ddc12a720704a4edf5d6334802263a5
Signed-off-by: jianxin.pan <jianxin.pan@amlogic.com>
7 years agodvb: modify dvb-frontend
Hualing Chen [Tue, 18 Jul 2017 10:29:48 +0000 (18:29 +0800)]
dvb: modify dvb-frontend

PD#147721: dvb: modify dvb-frontend some struct and add dvb dts

1. add dvbs dvbt info at frontend
2. add blind cmd
3. add dvb dts

Change-Id: I22ab5284e646a17ae060f229bcf7c27ee5b6211f
Signed-off-by: Hualing Chen <hualing.chen@amlogic.com>
7 years agoMerge branch 'android-4.9' into amlogic-4.9-dev
Victor Wan [Tue, 1 Aug 2017 10:38:14 +0000 (18:38 +0800)]
Merge branch 'android-4.9' into amlogic-4.9-dev

7 years agoi2c: add i2c auto test and fix i2c clk error.
Xuhua Zhang [Mon, 26 Jun 2017 07:44:23 +0000 (15:44 +0800)]
i2c: add i2c auto test and fix i2c clk error.

PD#146534: add i2c auto test and fix i2c clk error.

1. add i2c auto test function form 50KHZ to 3.4MHZ.
2. fix i2c clk distortion when the clk go beyond 1MHZ.
3. fix i2c clk distortion when the clk less than 100KHZ.
4. fit for i2c T_low/T_higt time standard.
5. reduce i2c error log.

Change-Id: I2bb5598684848478aa18349b87eaac5bcc44065d
Signed-off-by: Xuhua Zhang <xuhua.zhang@amlogic.com>
7 years agowifi: fix iptable forward cmd issue[1/1]
Rongjun Chen [Tue, 25 Jul 2017 08:20:39 +0000 (16:20 +0800)]
wifi: fix iptable forward cmd issue[1/1]

PD#147462: add some iptabe nat support to fix android NatController
cmd issue

Change-Id: Ia2e8e4f14898c5e3c6b2e2b61007260ff74db193
Signed-off-by: Rongjun Chen <rongjun.chen@amlogic.com>
7 years agoMerge "lcd: enable clkree gate" into amlogic-4.9-dev
Jianxin Pan [Mon, 31 Jul 2017 12:22:19 +0000 (05:22 -0700)]
Merge "lcd: enable clkree gate" into amlogic-4.9-dev

7 years agolcd: enable clkree gate
Weiming Liu [Fri, 28 Jul 2017 05:11:18 +0000 (13:11 +0800)]
lcd: enable clkree gate

PD#146437: lcd: enable clktree gate

Change-Id: I9fcc1b37ec291a27a169092a129663fbdab5aefa
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
7 years agodefconfig: fix coldboot_done too long,reduce /dev/pty* devices
Yixun Lan [Mon, 31 Jul 2017 05:46:21 +0000 (13:46 +0800)]
defconfig: fix coldboot_done too long,reduce /dev/pty* devices

PD#148403: fix coldboot_done too long,reduce /dev/pty* devices

with this change, boot from android
needle:/ # dmesg | grep ueventd
[ 3.657267@2] init: Starting service 'ueventd'...
[ 3.662364@0] ueventd: ueventd started!
[ 4.364547@2] ueventd: Coldboot took 0.70s. // prevous 1.44s

Change-Id: Iedf6b530bffb3aa6411f538e1c0dadb611dc616e
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
7 years agoclk: add mipi enable and bandgap gate
Yun Cai [Tue, 11 Jul 2017 11:28:13 +0000 (19:28 +0800)]
clk: add mipi enable and bandgap gate

PD#146437: axg: add mipi enable and bandgap gate and
update clkmsr for cts_encl_clk

Change-Id: If14ede7ab0a0b649879153cb1089bec04c7412b2
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agounifykey: support both old and new unifykey format
Jiamin Ma [Mon, 24 Jul 2017 10:39:23 +0000 (18:39 +0800)]
unifykey: support both old and new unifykey format

PD#148057: for m8bb m200 platform, we have the latest linux kernel
and a relative old version uboot running on it. For some historic
resons, the unifykey data stored in emmc/nand has totally different
format, which means the key stored by old uboot cannot be fetched
out by new kernel. To solve this problem, we have to support both
the old and new unifykey dataformat in lasted kernel.

Change-Id: Ic70df6543466b345a5ff513bfaabfe4cfcf647ed
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agodts: gxl: add p231 buildroot dts.
liangzhuo.xie [Tue, 25 Jul 2017 04:09:50 +0000 (12:09 +0800)]
dts: gxl: add p231 buildroot dts.

PD#147281: P231 4.9 add wpe-launcher and chromium

Change-Id: Iba74fce849e86f71742526e4a6cf6b999084b2dd
Signed-off-by: liangzhuo.xie <liangzhuo.xie@amlogic.com>
7 years agopwm: fix kernel crash using spinlock_t lock
Jian Hu [Fri, 28 Jul 2017 06:41:05 +0000 (14:41 +0800)]
pwm: fix kernel crash using spinlock_t lock

PD#148269: fix kernel panic when hibenating

1.Using mutex lock instead of spinlock_t lock.
2.Clk_prepare_enable might sleep could not use
  spinlock_t lock.
3.Add spinlock_t lock for clock_mux.
4.Panic message:
BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:97
in_atomic(): 1, irqs_disabled(): 128, pid: 2501, name: sh
Preemption disabled at:[   69.935889@1] [<ffffff80097af728>]
meson_pwm_apply+0x48/0x398

Change-Id: Ib2f42c4d757d1bb4bd8e4df0f90f7924be2fa799
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
7 years agoaudio: fix tdm audio format
Xing Wang [Fri, 21 Jul 2017 08:12:36 +0000 (16:12 +0800)]
audio: fix tdm audio format

PD#146334: audio: fix tdm bclk and fclk revert and skew issue

Change-Id: I1dcb6f8559b3c04a2ddbb7c13a6115001c249c18
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agoANDROID: binder: Don't BUG_ON(!spin_is_locked()).
Martijn Coenen [Thu, 27 Jul 2017 21:52:24 +0000 (23:52 +0200)]
ANDROID: binder: Don't BUG_ON(!spin_is_locked()).

Because is_spin_locked() always returns false on UP
systems.

Use assert_spin_locked() instead, and remove the
WARN_ON() instances, since those were easy to verify.

Bug: 64073116
Change-Id: I9080991c6d67e91928282a3ee64db23e50c7d66a
Signed-off-by: Martijn Coenen <maco@android.com>
7 years agodefconfig: disable LOCKUP detect for meson32/64_defconfig
jianxin.pan [Fri, 28 Jul 2017 06:14:10 +0000 (14:14 +0800)]
defconfig: disable LOCKUP detect for meson32/64_defconfig

PD#138714: disable LOCKUP detect
-CONFIG_LOCKUP_DETECTOR=y
-CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y

Change-Id: I74df363b34e6a2fa95cd0aa30485fd941764be09
Signed-off-by: jianxin.pan <jianxin.pan@amlogic.com>
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agousb: fix adb reboot panic.
Yue Wang [Mon, 24 Jul 2017 08:08:25 +0000 (16:08 +0800)]
usb: fix adb reboot panic.

PD#146539: usb: fix adb reboot panic.

Avoid kernel panic caused by race condition. For example,
1. In the ffs_epfile_io function, data buffer is allocated
for non-halt requests and the address of this buffer is
writed to usb controller registers.
2. After adb process be killed, data buffer is freed and
this memory is allocated for the other. But the address
is hold by the controller.
3. Adbd in PC is running. So, the controller receive the
data and write to this memory.
4. The value of this memory is modified by the controller.
This could cause the kernel panic.

To avoid this, during FunctionFS mount, we allocated the
data buffer for requests. And the memory resources has
been released in kill_sb.

Change-Id: Ie06fae8ce18ea553d71f4841458c3c3af096ff4b
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
7 years agoMerge 4.9.40 into android-4.9
Greg Kroah-Hartman [Thu, 27 Jul 2017 22:24:43 +0000 (15:24 -0700)]
Merge 4.9.40 into android-4.9

Changes in 4.9.40
disable new gcc-7.1.1 warnings for now
ir-core: fix gcc-7 warning on bool arithmetic
dm mpath: cleanup -Wbool-operation warning in choose_pgpath()
s5p-jpeg: don't return a random width/height
thermal: max77620: fix device-node reference imbalance
thermal: cpu_cooling: Avoid accessing potentially freed structures
ath9k: fix tx99 use after free
ath9k: fix tx99 bus error
ath9k: fix an invalid pointer dereference in ath9k_rng_stop()
NFC: fix broken device allocation
NFC: nfcmrvl_uart: add missing tty-device sanity check
NFC: nfcmrvl: do not use device-managed resources
NFC: nfcmrvl: use nfc-device for firmware download
NFC: nfcmrvl: fix firmware-management initialisation
nfc: Ensure presence of required attributes in the activate_target handler
nfc: Fix the sockaddr length sanitization in llcp_sock_connect
NFC: Add sockaddr length checks before accessing sa_family in bind handlers
perf intel-pt: Move decoder error setting into one condition
perf intel-pt: Improve sample timestamp
perf intel-pt: Fix missing stack clear
perf intel-pt: Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
perf intel-pt: Fix last_ip usage
perf intel-pt: Ensure never to set 'last_ip' when packet 'count' is zero
perf intel-pt: Use FUP always when scanning for an IP
perf intel-pt: Clear FUP flag on error
Bluetooth: use constant time memory comparison for secret values
wlcore: fix 64K page support
btrfs: Don't clear SGID when inheriting ACLs
igb: Explicitly select page 0 at initialization
ASoC: compress: Derive substream from stream based on direction
PM / Domains: Fix unsafe iteration over modified list of device links
PM / Domains: Fix unsafe iteration over modified list of domain providers
PM / Domains: Fix unsafe iteration over modified list of domains
scsi: ses: do not add a device to an enclosure if enclosure_add_links() fails.
scsi: Add STARGET_CREATED_REMOVE state to scsi_target_state
iscsi-target: Add login_keys_workaround attribute for non RFC initiators
xen/scsiback: Fix a TMR related use-after-free
powerpc/pseries: Fix passing of pp0 in updatepp() and updateboltedpp()
powerpc/64: Fix atomic64_inc_not_zero() to return an int
powerpc: Fix emulation of mcrf in emulate_step()
powerpc: Fix emulation of mfocrf in emulate_step()
powerpc/asm: Mark cr0 as clobbered in mftb()
powerpc/mm/radix: Properly clear process table entry
af_key: Fix sadb_x_ipsecrequest parsing
PCI: Work around poweroff & suspend-to-RAM issue on Macbook Pro 11
PCI: rockchip: Use normal register bank for config accessors
PCI/PM: Restore the status of PCI devices across hibernation
ipvs: SNAT packet replies only for NATed connections
xhci: fix 20000ms port resume timeout
xhci: Fix NULL pointer dereference when cleaning up streams for removed host
xhci: Bad Ethernet performance plugged in ASM1042A host
mxl111sf: Fix driver to use heap allocate buffers for USB messages
usb: storage: return on error to avoid a null pointer dereference
USB: cdc-acm: add device-id for quirky printer
usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
usb: renesas_usbhs: gadget: disable all eps when the driver stops
md: don't use flush_signals in userspace processes
x86/xen: allow userspace access during hypercalls
cx88: Fix regression in initial video standard setting
libnvdimm, btt: fix btt_rw_page not returning errors
libnvdimm: fix badblock range handling of ARS range
ext2: Don't clear SGID when inheriting ACLs
Raid5 should update rdev->sectors after reshape
s390/syscalls: Fix out of bounds arguments access
drm/amd/amdgpu: Return error if initiating read out of range on vram
drm/radeon/ci: disable mclk switching for high refresh rates (v2)
drm/radeon: Fix eDP for single-display iMac10,1 (v2)
ipmi: use rcu lock around call to intf->handlers->sender()
ipmi:ssif: Add missing unlock in error branch
xfs: Don't clear SGID when inheriting ACLs
f2fs: sanity check size of nat and sit cache
f2fs: Don't clear SGID when inheriting ACLs
drm/ttm: Fix use-after-free in ttm_bo_clean_mm
ovl: drop CAP_SYS_RESOURCE from saved mounter's credentials
vfio: Fix group release deadlock
vfio: New external user group/file match
nvme-rdma: remove race conditions from IB signalling
ftrace: Fix uninitialized variable in match_records()
MIPS: Fix mips_atomic_set() retry condition
MIPS: Fix mips_atomic_set() with EVA
MIPS: Negate error syscall return in trace
ubifs: Don't leak kernel memory to the MTD
ACPI / EC: Drop EC noirq hooks to fix a regression
Revert "ACPI / EC: Enable event freeze mode..." to fix a regression
x86/acpi: Prevent out of bound access caused by broken ACPI tables
x86/ioapic: Pass the correct data to unmask_ioapic_irq()
MIPS: Fix MIPS I ISA /proc/cpuinfo reporting
MIPS: Save static registers before sysmips
MIPS: Actually decode JALX in `__compute_return_epc_for_insn'
MIPS: Fix unaligned PC interpretation in `compute_return_epc'
MIPS: math-emu: Prevent wrong ISA mode instruction emulation
MIPS: Send SIGILL for BPOSGE32 in `__compute_return_epc_for_insn'
MIPS: Rename `sigill_r6' to `sigill_r2r6' in `__compute_return_epc_for_insn'
MIPS: Send SIGILL for linked branches in `__compute_return_epc_for_insn'
MIPS: Send SIGILL for R6 branches in `__compute_return_epc_for_insn'
MIPS: Fix a typo: s/preset/present/ in r2-to-r6 emulation error message
Input: i8042 - fix crash at boot time
IB/iser: Fix connection teardown race condition
IB/core: Namespace is mandatory input for address resolution
sunrpc: use constant time memory comparison for mac
NFS: only invalidate dentrys that are clearly invalid.
udf: Fix deadlock between writeback and udf_setsize()
target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce
iser-target: Avoid isert_conn->cm_id dereference in isert_login_recv_done
perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target
Revert "perf/core: Drop kernel samples even though :u is specified"
staging: rtl8188eu: add TL-WN722N v2 support
staging: comedi: ni_mio_common: fix AO timer off-by-one regression
staging: sm750fb: avoid conflicting vesafb
staging: lustre: ko2iblnd: check copy_from_iter/copy_to_iter return code
ceph: fix race in concurrent readdir
RDMA/core: Initialize port_num in qp_attr
drm/mst: Fix error handling during MST sideband message reception
drm/mst: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
drm/mst: Avoid processing partially received up/down message transactions
mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array
hfsplus: Don't clear SGID when inheriting ACLs
ovl: fix random return value on mount
acpi/nfit: Fix memory corruption/Unregister mce decoder on failure
of: device: Export of_device_{get_modalias, uvent_modalias} to modules
spmi: Include OF based modalias in device uevent
reiserfs: Don't clear SGID when inheriting ACLs
PM / Domains: defer dev_pm_domain_set() until genpd->attach_dev succeeds if present
tracing: Fix kmemleak in instance_rmdir
alarmtimer: don't rate limit one-shot timers
Linux 4.9.40

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
7 years agoLinux 4.9.40 v4.9.40
Greg Kroah-Hartman [Thu, 27 Jul 2017 22:08:24 +0000 (15:08 -0700)]
Linux 4.9.40

7 years agoalarmtimer: don't rate limit one-shot timers
Greg Hackmann [Mon, 24 Jul 2017 17:19:24 +0000 (10:19 -0700)]
alarmtimer: don't rate limit one-shot timers

Commit ff86bf0c65f1 ("alarmtimer: Rate limit periodic intervals") sets a
minimum bound on the alarm timer interval.  This minimum bound shouldn't
be applied if the interval is 0.  Otherwise, one-shot timers will be
converted into periodic ones.

Fixes: ff86bf0c65f1 ("alarmtimer: Rate limit periodic intervals")
Reported-by: Ben Fennema <fennema@google.com>
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Cc: stable@vger.kernel.org
Cc: John Stultz <john.stultz@linaro.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotracing: Fix kmemleak in instance_rmdir
Chunyu Hu [Thu, 20 Jul 2017 10:36:09 +0000 (18:36 +0800)]
tracing: Fix kmemleak in instance_rmdir

commit db9108e054700c96322b0f0028546aa4e643cf0b upstream.

Hit the kmemleak when executing instance_rmdir, it forgot releasing
mem of tracing_cpumask. With this fix, the warn does not appear any
more.

unreferenced object 0xffff93a8dfaa7c18 (size 8):
  comm "mkdir", pid 1436, jiffies 4294763622 (age 9134.308s)
  hex dump (first 8 bytes):
    ff ff ff ff ff ff ff ff                          ........
  backtrace:
    [<ffffffff88b6567a>] kmemleak_alloc+0x4a/0xa0
    [<ffffffff8861ea41>] __kmalloc_node+0xf1/0x280
    [<ffffffff88b505d3>] alloc_cpumask_var_node+0x23/0x30
    [<ffffffff88b5060e>] alloc_cpumask_var+0xe/0x10
    [<ffffffff88571ab0>] instance_mkdir+0x90/0x240
    [<ffffffff886e5100>] tracefs_syscall_mkdir+0x40/0x70
    [<ffffffff886565c9>] vfs_mkdir+0x109/0x1b0
    [<ffffffff8865b1d0>] SyS_mkdir+0xd0/0x100
    [<ffffffff88403857>] do_syscall_64+0x67/0x150
    [<ffffffff88b710e7>] return_from_SYSCALL_64+0x0/0x6a
    [<ffffffffffffffff>] 0xffffffffffffffff

Link: http://lkml.kernel.org/r/1500546969-12594-1-git-send-email-chuhu@redhat.com
Fixes: ccfe9e42e451 ("tracing: Make tracing_cpumask available for all instances")
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoPM / Domains: defer dev_pm_domain_set() until genpd->attach_dev succeeds if present
Sudeep Holla [Fri, 14 Jul 2017 10:51:48 +0000 (11:51 +0100)]
PM / Domains: defer dev_pm_domain_set() until genpd->attach_dev succeeds if present

commit 975e83cfb8dc16e7a2fdc58188c77c0c605876c2 upstream.

If the genpd->attach_dev or genpd->power_on fails, genpd_dev_pm_attach
may return -EPROBE_DEFER initially. However genpd_alloc_dev_data sets
the PM domain for the device unconditionally.

When subsequent attempts are made to call genpd_dev_pm_attach, it may
return -EEXISTS checking dev->pm_domain without re-attempting to call
attach_dev or power_on.

platform_drv_probe then attempts to call drv->probe as the return value
-EEXIST != -EPROBE_DEFER, which may end up in a situation where the
device is accessed without it's power domain switched on.

Fixes: f104e1e5ef57 (PM / Domains: Re-order initialization of generic_pm_domain_data)
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoreiserfs: Don't clear SGID when inheriting ACLs
Jan Kara [Thu, 22 Jun 2017 07:32:49 +0000 (09:32 +0200)]
reiserfs: Don't clear SGID when inheriting ACLs

commit 6883cd7f68245e43e91e5ee583b7550abf14523f upstream.

When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
set, DIR1 is expected to have SGID bit set (and owning group equal to
the owning group of 'DIR0'). However when 'DIR0' also has some default
ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
'DIR1' to get cleared if user is not member of the owning group.

Fix the problem by moving posix_acl_update_mode() out of
__reiserfs_set_acl() into reiserfs_set_acl(). That way the function will
not be called when inheriting ACLs which is what we want as it prevents
SGID bit clearing and the mode has been properly set by
posix_acl_create() anyway.

Fixes: 073931017b49d9458aa351605b43a7e34598caef
CC: reiserfs-devel@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: Include OF based modalias in device uevent
Bjorn Andersson [Thu, 29 Jun 2017 21:46:44 +0000 (14:46 -0700)]
spmi: Include OF based modalias in device uevent

commit d50daa2af2618dab6d21634e65a5fbcf4ae437d6 upstream.

Include the OF-based modalias in the uevent sent when registering SPMI
devices, so that user space has a chance to autoload the kernel module
for the device.

Tested-by: Rob Clark <robdclark@gmail.com>
Reported-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoof: device: Export of_device_{get_modalias, uvent_modalias} to modules
Stephen Boyd [Wed, 28 Dec 2016 22:56:48 +0000 (14:56 -0800)]
of: device: Export of_device_{get_modalias, uvent_modalias} to modules

commit 7a3b7cd332db08546f3cdd984f11773e0d1999e7 upstream.

The ULPI bus can be built as a module, and it will soon be
calling these functions when it supports probing devices from DT.
Export them so they can be used by the ULPI module.

Acked-by: Rob Herring <robh@kernel.org>
Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoacpi/nfit: Fix memory corruption/Unregister mce decoder on failure
Prarit Bhargava [Wed, 31 May 2017 17:32:00 +0000 (13:32 -0400)]
acpi/nfit: Fix memory corruption/Unregister mce decoder on failure

commit 7e700d2c59e5853c9126642976b4f5768f64c9b3 upstream.

nfit_init() calls nfit_mce_register() on module load.  When the module
load fails the nfit mce decoder is not unregistered.  The module's
memory is freed leaving the decoder chain referencing junk.  This will
cause panics as future registrations will reference the free'd memory.

Unregister the nfit mce decoder on module init failure.

[v2]: register and then unregister mce handler to avoid losing mce events
[v3]: also cleanup nfit workqueue

Fixes: 6839a6d96f4e ("nfit: do an ARS scrub on hitting a latent media error")
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>
Cc: Linda Knippers <linda.knippers@hpe.com>
Cc: lszubowi@redhat.com
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoovl: fix random return value on mount
Amir Goldstein [Tue, 11 Jul 2017 12:58:35 +0000 (15:58 +0300)]
ovl: fix random return value on mount

commit 8fc646b44385ff0a9853f6590497e43049eeb311 upstream.

On failure to prepare_creds(), mount fails with a random
return value, as err was last set to an integer cast of
a valid lower mnt pointer or set to 0 if inodes index feature
is enabled.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 3fe6e52f0626 ("ovl: override creds with the ones from ...")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agohfsplus: Don't clear SGID when inheriting ACLs
Jan Kara [Wed, 21 Jun 2017 13:02:47 +0000 (15:02 +0200)]
hfsplus: Don't clear SGID when inheriting ACLs

commit 84969465ddc4f8aeb3b993123b571aa01c5f2683 upstream.

When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
set, DIR1 is expected to have SGID bit set (and owning group equal to
the owning group of 'DIR0'). However when 'DIR0' also has some default
ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
'DIR1' to get cleared if user is not member of the owning group.

Fix the problem by creating __hfsplus_set_posix_acl() function that does
not call posix_acl_update_mode() and use it when inheriting ACLs. That
prevents SGID bit clearing and the mode has been properly set by
posix_acl_create() anyway.

Fixes: 073931017b49d9458aa351605b43a7e34598caef
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array
Bart Van Assche [Mon, 24 Apr 2017 22:15:28 +0000 (15:15 -0700)]
mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array

commit 99975cd4fda52974a767aa44fe0b1a8f74950d9d upstream.

ib_map_mr_sg() can pass an SG-list to .map_mr_sg() that is larger
than what fits into a single MR. .map_mr_sg() must not attempt to
map more SG-list elements than what fits into a single MR.
Hence make sure that mlx5_ib_sg_to_klms() does not write outside
the MR klms[] array.

Fixes: b005d3164713 ("mlx5: Add arbitrary sg list support")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Israel Rukshin <israelr@mellanox.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/mst: Avoid processing partially received up/down message transactions
Imre Deak [Wed, 19 Jul 2017 13:46:32 +0000 (16:46 +0300)]
drm/mst: Avoid processing partially received up/down message transactions

commit 636c4c3e762b62aa93632c645ca65879285b16e3 upstream.

Currently we may process up/down message transactions containing
uninitialized data. This can happen if there was an error during the
reception of any message in the transaction, but we happened to receive
the last message correctly with the end-of-message flag set.

To avoid this abort the reception of the transaction when the first
error is detected, rejecting any messages until a message with the
start-of-message flag is received (which will start a new transaction).
This is also what the DP 1.4 spec 2.11.8.2 calls for in this case.

In addtion this also prevents receiving bogus transactions without the
first message with the the start-of-message flag set.

v2:
- unchanged
v3:
- git add the part that actually skips messages after an error in
  drm_dp_sideband_msg_build()

Cc: Dave Airlie <airlied@redhat.com>
Cc: Lyude <lyude@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Lyude <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170719134632.13366-1-imre.deak@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/mst: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
Imre Deak [Wed, 19 Jul 2017 11:43:29 +0000 (14:43 +0300)]
drm/mst: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()

commit 7f8b3987da54cb4d41ad2545cd4d7958b9a36bdf upstream.

In case of an unknown broadcast message is sent mstb will remain unset,
so check for this.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Lyude <lyude@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Lyude <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170719114330.26540-3-imre.deak@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/mst: Fix error handling during MST sideband message reception
Imre Deak [Wed, 19 Jul 2017 11:43:28 +0000 (14:43 +0300)]
drm/mst: Fix error handling during MST sideband message reception

commit 448421b5e93b9177c5698f0cf6f5e72d2995eeca upstream.

Handle any error due to partial reads, timeouts etc. to avoid parsing
uninitialized data subsequently. Also bail out if the parsing itself
fails.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Lyude <lyude@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Lyude <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170719114330.26540-2-imre.deak@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoRDMA/core: Initialize port_num in qp_attr
Ismail, Mustafa [Fri, 14 Jul 2017 14:41:31 +0000 (09:41 -0500)]
RDMA/core: Initialize port_num in qp_attr

commit a62ab66b13a0f9bcb17b7b761f6670941ed5cd62 upstream.

Initialize the port_num for iWARP in rdma_init_qp_attr.

Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds")
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Tested-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoceph: fix race in concurrent readdir
Yan, Zheng [Thu, 6 Jul 2017 03:12:21 +0000 (11:12 +0800)]
ceph: fix race in concurrent readdir

commit 84583cfb973c4313955c6231cc9cb3772d280b15 upstream.

For a large directory, program needs to issue multiple readdir
syscalls to get all dentries. When there are multiple programs
read the directory concurrently. Following sequence of events
can happen.

 - program calls readdir with pos = 2. ceph sends readdir request
   to mds. The reply contains N1 entries. ceph adds these N1 entries
   to readdir cache.
 - program calls readdir with pos = N1+2. The readdir is satisfied
   by the readdir cache, N2 entries are returned. (Other program
   calls readdir in the middle, which fills the cache)
 - program calls readdir with pos = N1+N2+2. ceph sends readdir
   request to mds. The reply contains N3 entries and it reaches
   directory end. ceph adds these N3 entries to the readdir cache
   and marks directory complete.

The second readdir call does not update fi->readdir_cache_idx.
ceph add the last N3 entries to wrong places.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ko2iblnd: check copy_from_iter/copy_to_iter return code
Arnd Bergmann [Sat, 15 Jul 2017 15:32:08 +0000 (11:32 -0400)]
staging: lustre: ko2iblnd: check copy_from_iter/copy_to_iter return code

commit 566e1ce22e04426fa52328b2adcdf1df49acd98e upstream.

We now get a helpful warning for code that calls copy_{from,to}_iter
without checking the return value, introduced by commit aa28de275a24
("iov_iter/hardening: move object size checks to inlined part").

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 'kiblnd_send':
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1643:2: error: ignoring return value of 'copy_from_iter', declared with attribute warn_unused_result [-Werror=unused-result]
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 'kiblnd_recv':
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1744:3: error: ignoring return value of 'copy_to_iter', declared with attribute warn_unused_result [-Werror=unused-result]

In case we get short copies here, we may get incorrect behavior.
I've added failure handling for both rx and tx now, returning
-EFAULT as expected.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: sm750fb: avoid conflicting vesafb
Teddy Wang [Fri, 30 Jun 2017 20:57:43 +0000 (21:57 +0100)]
staging: sm750fb: avoid conflicting vesafb

commit 740c433ec35187b45abe08bb6c45a321a791be8e upstream.

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

In the previous send, why #ifdef is used was asked.
https://lkml.org/lkml/2017/6/25/57

Answered at: https://lkml.org/lkml/2017/6/25/69
Also pasting here for reference.

'Did a quick research into "why".
The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the
default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags
for a default VGA device and that is being done only for x86.
And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that
needs to be checked only for a x86 and not for other arch.'

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: ni_mio_common: fix AO timer off-by-one regression
Ian Abbott [Fri, 30 Jun 2017 11:02:18 +0000 (12:02 +0100)]
staging: comedi: ni_mio_common: fix AO timer off-by-one regression

commit 15d5193104a457d5151840247e3bce561c42e3e9 upstream.

As reported by Éric Piel on the Comedi mailing list (see
<https://groups.google.com/forum/#!topic/comedi_list/ueZiR7vTLOU/discussion>),
the analog output asynchronous commands are running too fast with a
period 50 ns shorter than it should be.  This affects all boards with AO
command support that are supported by the "ni_pcimio", "ni_atmio", and
"ni_mio_cs" drivers.

This is a regression bug introduced by commit 080e6795cba3 ("staging:
comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd"), specifically,
this line in `ni_ao_cmd_set_update()`:

/* following line: N-1 per STC */
ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);

The `trigvar` variable value comes from a call to `ni_ns_to_timer()`
which converts a timer period in nanoseconds to a hardware divisor
value. The function already reduces the divisor by 1 as required by the
hardware, so the above line should not reduce it further by 1.  Fix it
by replacing `trigvar` by `trigvar - 1` in the above line, and remove
the misleading comment.

Reported-by: Éric Piel <piel@delmic.com>
Fixes: 080e6795cba3 ("staging: comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd")
Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: add TL-WN722N v2 support
Michael Gugino [Mon, 17 Jul 2017 17:29:09 +0000 (13:29 -0400)]
staging: rtl8188eu: add TL-WN722N v2 support

commit 5a1d4c5dd4eb2f1f8a9b30e61762f3b3b564df70 upstream.

Add support for USB Device TP-Link TL-WN722N v2.
VendorID: 0x2357, ProductID: 0x010c

Signed-off-by: Michael Gugino <michael.gugino.2@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoRevert "perf/core: Drop kernel samples even though :u is specified"
Ingo Molnar [Tue, 11 Jul 2017 08:56:54 +0000 (10:56 +0200)]
Revert "perf/core: Drop kernel samples even though :u is specified"

commit 6a8a75f3235724c5941a33e287b2f98966ad14c5 upstream.

This reverts commit cc1582c231ea041fbc68861dfaf957eaf902b829.

This commit introduced a regression that broke rr-project, which uses sampling
events to receive a signal on overflow (but does not care about the contents
of the sample). These signals are critical to the correct operation of rr.

There's been some back and forth about how to fix it - but to not keep
applications in limbo queue up a revert.

Reported-by: Kyle Huey <me@kylehuey.com>
Acked-by: Kyle Huey <me@kylehuey.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20170628105600.GC5981@leverpostej
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoperf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target
Jin Yao [Thu, 8 Jun 2017 06:01:44 +0000 (14:01 +0800)]
perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target

commit 80f62589fa52f530cffc50e78c0b5a2ae572d61e upstream.

When the jump instruction is displayed at the row 0 in annotate view,
the arrow is broken. An example:

 16.86 │   ┌──je     82
  0.01 │      movsd  (%rsp),%xmm0
       │      movsd  0x8(%rsp),%xmm4
       │      movsd  0x8(%rsp),%xmm1
       │      movsd  (%rsp),%xmm3
       │      divsd  %xmm4,%xmm0
       │      divsd  %xmm3,%xmm1
       │      movsd  (%rsp),%xmm2
       │      addsd  %xmm1,%xmm0
       │      addsd  %xmm2,%xmm0
       │      movsd  %xmm0,(%rsp)
       │82:   sub    $0x1,%ebx
 83.03 │    ↑ jne    38
       │      add    $0x10,%rsp
       │      xor    %eax,%eax
       │      pop    %rbx
       │    ← retq

The patch increments the row number before checking with 0.

Signed-off-by: Yao Jin <yao.jin@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 944e1abed9e1 ("perf ui browser: Add method to draw up/down arrow line")
Link: http://lkml.kernel.org/r/1496901704-30275-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoiser-target: Avoid isert_conn->cm_id dereference in isert_login_recv_done
Nicholas Bellinger [Fri, 30 Jun 2017 05:21:31 +0000 (22:21 -0700)]
iser-target: Avoid isert_conn->cm_id dereference in isert_login_recv_done

commit fce50a2fa4e9c6e103915c351b6d4a98661341d6 upstream.

This patch fixes a NULL pointer dereference in isert_login_recv_done()
of isert_conn->cm_id due to isert_cma_handler() -> isert_connect_error()
resetting isert_conn->cm_id = NULL during a failed login attempt.

As per Sagi, we will always see the completion of all recv wrs posted
on the qp (given that we assigned a ->done handler), this is a FLUSH
error completion, we just don't get to verify that because we deref
NULL before.

The issue here, was the assumption that dereferencing the connection
cm_id is always safe, which is not true since:

    commit 4a579da2586bd3b79b025947ea24ede2bbfede62
    Author: Sagi Grimberg <sagig@mellanox.com>
    Date:   Sun Mar 29 15:52:04 2015 +0300

         iser-target: Fix possible deadlock in RDMA_CM connection error

As I see it, we have a direct reference to the isert_device from
isert_conn which is the one-liner fix that we actually need like
we do in isert_rdma_read_done() and isert_rdma_write_done().

Reported-by: Andrea Righi <righi.andrea@gmail.com>
Tested-by: Andrea Righi <righi.andrea@gmail.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotarget: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce
Jiang Yi [Sun, 25 Jun 2017 19:28:50 +0000 (12:28 -0700)]
target: Fix COMPARE_AND_WRITE caw_sem leak during se_cmd quiesce

commit 1d6ef276594a781686058802996e09c8550fd767 upstream.

This patch addresses a COMPARE_AND_WRITE se_device->caw_sem leak,
that would be triggered during normal se_cmd shutdown or abort
via __transport_wait_for_tasks().

This would occur because target_complete_cmd() would catch this
early and do complete_all(&cmd->t_transport_stop_comp), but since
target_complete_ok_work() or target_complete_failure_work() are
never called to invoke se_cmd->transport_complete_callback(),
the COMPARE_AND_WRITE specific callbacks never release caw_sem.

To address this special case, go ahead and release caw_sem
directly from target_complete_cmd().

(Remove '&& success' from check, to release caw_sem regardless
 of scsi_status - nab)

Signed-off-by: Jiang Yi <jiangyilism@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoudf: Fix deadlock between writeback and udf_setsize()
Jan Kara [Tue, 13 Jun 2017 14:20:25 +0000 (16:20 +0200)]
udf: Fix deadlock between writeback and udf_setsize()

commit f2e95355891153f66d4156bf3a142c6489cd78c6 upstream.

udf_setsize() called truncate_setsize() with i_data_sem held. Thus
truncate_pagecache() called from truncate_setsize() could lock a page
under i_data_sem which can deadlock as page lock ranks below
i_data_sem - e. g. writeback can hold page lock and try to acquire
i_data_sem to map a block.

Fix the problem by moving truncate_setsize() calls from under
i_data_sem. It is safe for us to change i_size without holding
i_data_sem as all the places that depend on i_size being stable already
hold inode_lock.

Fixes: 7e49b6f2480cb9a9e7322a91592e56a5c85361f5
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>