platform/kernel/linux-amlogic.git
5 years agofermitform: add u202 dts config for s905d2 panel. [3/3]
Luan Yuan [Tue, 30 Apr 2019 05:31:53 +0000 (13:31 +0800)]
fermitform: add u202 dts config for s905d2 panel. [3/3]

PD#SWPL-7973

Problem:
s905d2 panel need new projects config.

Solution:
copy dts config from u200

Verify:
no need verify

Change-Id: I37a884ae951b8c6ede7adb065239ce59dca25c3a
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
u202: add dts-id for multi-dts in 32bit. [1/1]

PD#SWPL-7973

Problem:
upgrade failed, because can not found dts.

Solution:
change dts-id

Verify:
verify by u202

Change-Id: I9cfd85ebfda1bff60abc78bd09355f977f25f4bf
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agodi: disable deghost refresh according to motion [1/1]
MingLiang Dong [Wed, 20 Feb 2019 07:15:44 +0000 (02:15 -0500)]
di: disable deghost refresh according to motion [1/1]

PD#SWPL-6423

Problem:
deghost refresh according to motion

Solution:
disable deghost refresh according to motion

Verify:
verify on TL1

Change-Id: Ic3647462e5f5686f6cc182c30797752ea72c013c
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
5 years agodi: pd22 FW parameters need optimize [1/1]
zhiwei.yuan [Fri, 1 Mar 2019 06:47:01 +0000 (14:47 +0800)]
di: pd22 FW parameters need optimize [1/1]

PD#SWPL-5046

Problem:
PD22 para is incorrect

Solution:
correct the parameters

Verify:
verified by t962x2_x301

Change-Id: I0b26914694dd19f9b06cb37c50f7589a200ea0b1
Signed-off-by: zhiwei.yuan <zhiwei.yuan@amlogic.com>
5 years agoavsync: spdif: fix the avsync for ms12 [1/4]
Xiaoming Sui [Mon, 15 Apr 2019 12:38:47 +0000 (20:38 +0800)]
avsync: spdif: fix the avsync for ms12 [1/4]

PD#SWPL-5837

Problem:
dtv is out of avsync when dolby ms12 certificate

Solution:
when the audio is played, recalculate the apts to sync
pcrsrc when pcrmaster.

Verify:
X301

Change-Id: I199383aa1c0de1b4f0ec646d9d066910b3bb2b42
Signed-off-by: Xiaoming Sui <xiaoming.sui@amlogic.com>
avsync: tsync: fix the avsync for ms12 [3/4]

PD#SWPL-5837

Problem:
dtv is out of avsync when dolby ms12 certificate

Solution:
when the audio is played, recalculate the apts to sync
pcrsrc when pcrmaster.

Verify:
X301

Change-Id: Ia121e57ad69c5b0d211e14bf3a61f165457e54c7
Signed-off-by: Xiaoming Sui <xiaoming.sui@amlogic.com>
5 years agopts: fix mvc play is not smooth. [1/1]
shihong.zheng [Tue, 26 Mar 2019 10:40:27 +0000 (18:40 +0800)]
pts: fix mvc play is not smooth. [1/1]

PD#SWPL-6094

Problem:
some mvc stream is not smooth.

Solution:
optimize the condition for pts loockup fail code.

Verify:
x301

Change-Id: I50bb3f317e1245735f9ce0ffcc44376c91e871ed
Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
5 years agotsync: reduce the log information [1/1]
Xiaoming Sui [Tue, 26 Mar 2019 14:06:04 +0000 (22:06 +0800)]
tsync: reduce the log information [1/1]

PD#SWPL-6152

Problem:
in some special cases, there are many sync
log information from serial port.

Solution:
remove this log and add pts realign.

Verify:
X301

Change-Id: I81d1753ef6d4e6c1e39d6c7f38eb3836e07be05d
Signed-off-by: Xiaoming Sui <xiaoming.sui@amlogic.com>
5 years agoavsync: tsync: enable the system up function [1/1]
live.li [Wed, 24 Apr 2019 08:12:26 +0000 (16:12 +0800)]
avsync: tsync: enable the system up function [1/1]

PD#TV-5140

Problem:
   when play some ts stream , the video will hold all the time

Solution:
   when the pcr is invalid ,use apts or vpts as system
   time and enable the system time up funciton

Verify:
x301

Change-Id: Iec01434ab305be1ea32e03549edd8521a8c4620d
Signed-off-by: live.li <live.li@amlogic.com>
5 years agopartition: change vendor size [1/2]
Liang Ji [Fri, 12 Apr 2019 11:05:39 +0000 (19:05 +0800)]
partition: change vendor size [1/2]

PD#SWPL-6586

Problem:
Android P trunk can not compile 64bit kernel
Android P vendor size is not enough,
64bit kernel and isp so  etc ,
the size exceeds 256M

Solution:
change vendor size from 256M into 320M

Verify:
galilei

Change-Id: Icc7b3d7c8d56f5c361acf9722bba6422b8dc3af2
Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agomedia_module: mh264/h265/avs2 [1/2]
Rong Zhang [Mon, 1 Apr 2019 13:11:08 +0000 (21:11 +0800)]
media_module: mh264/h265/avs2 [1/2]

PD#SWPL-6607

Problem:
Not support QOS information for mh264.h265,avs2

Solution:
Support QOS information picking for mh264,h265,avs2
Support QOS information access interface by ioctl

Verify:
Verified franklin

Change-Id: I4e6f85392007bc78a274726aba510c39088018e3
Signed-off-by: Rong Zhang <rong.zhang@amlogic.com>
5 years agoamvideo: fix video block when pts discontinue [1/1]
peter wang [Fri, 12 Apr 2019 05:49:21 +0000 (13:49 +0800)]
amvideo: fix video block when pts discontinue [1/1]

PD#SWPL-5038

Problem:
image will block when pts discontinue

Solution:
do not show the frame when pts greater than pcr

Verify:
tested on Marconi

Change-Id: I57ea973b7fdcdc7cded2c5c9b681be29f0a31a4b
Signed-off-by: peter wang <peter.wang@amlogic.com>
5 years agoethernet: fix suspend resume crash [1/1]
Zhuo Wang [Mon, 22 Apr 2019 04:49:34 +0000 (12:49 +0800)]
ethernet: fix suspend resume crash [1/1]

PD#SWPL-7166

Problem:
suspend resume test failed

Solution:
cancel work queue first

Verify:
verify on u200 board

Change-Id: Ibd1a9587a32edf5583db564d2efe0ff0279d4d10
Signed-off-by: Zhuo Wang <zhuo.wang@amlogic.com>
 Conflicts:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

5 years agoethernet: reset ethernet when resume [1/1]
Zhuo Wang [Tue, 2 Apr 2019 05:43:59 +0000 (13:43 +0800)]
ethernet: reset ethernet when resume [1/1]

PD#SWPL-6608

Problem:
system will report tx error somethime after resume

Solution:
reset ethernet when resume

Verify:
verify on u200 board

Change-Id: I9863a8a50c08addd4e2d8c024f46a2e7568c28b4
Signed-off-by: Zhuo Wang <zhuo.wang@amlogic.com>
5 years agoethernet: set RX delay for exphy and leds [1/1]
Zhuo Wang [Fri, 1 Mar 2019 06:35:34 +0000 (14:35 +0800)]
ethernet: set RX delay for exphy and leds [1/1]

PD#SWPL-5295

Problem:
add RX delay for 8211f and add led setup interface

Solution:
tuning delay and leds

Verify:
verify on u200 board

Change-Id: I45e855894d570fdd976f90fd8f03151ad52a3683
Signed-off-by: Zhuo Wang <zhuo.wang@amlogic.com>
5 years agoRevert "ethernet: handle tx timeout"
Luan Yuan [Tue, 7 May 2019 06:56:56 +0000 (14:56 +0800)]
Revert "ethernet: handle tx timeout"

This reverts commit 6b195f8476e7ffaa9c1c946f5e7b6ea7b75d1b71.

5 years agocpufreq: cpufreq register notify for cluster0 [1/1]
Hong Guo [Wed, 24 Apr 2019 06:02:01 +0000 (14:02 +0800)]
cpufreq: cpufreq register notify for cluster0 [1/1]

PD#SWPL-7707

Problem:
cpufreq register notify for cluster0 

Solution:
cpufreq register notify for cluster0 

Verify:
test pass on g12b_w400

Change-Id: Ia57f320528082c9824dd96f17714d8e636519bb4
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
5 years agocpufreq: dynamic adjustment dsu clk with tm2 cpu clk [1/3]
Hong Guo [Mon, 8 Apr 2019 01:49:29 +0000 (09:49 +0800)]
cpufreq: dynamic adjustment dsu clk with tm2 cpu clk [1/3]

PD#SWPL-6758

Problem:
dynamic adjustment dsu clk with tm2 cpu clk.

Solution:
dynamic adjustment dsu clk with tm2 cpu clk.

Verify:
t962e2_ab319, verify pass

Change-Id: I7eee5ed58b80e0f77603ca505abcd1caf3d131e7
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agocpufreq: free clk if failed to set 1G for fixpll when cpufreq init. [1/1]
Hong Guo [Tue, 26 Mar 2019 07:47:49 +0000 (15:47 +0800)]
cpufreq: free clk if failed to set 1G for fixpll when cpufreq init. [1/1]

PD#SWPL-6394

Problem:
free clk if failed to set 1G for fixpll.

Solution:
free clk if failed to set 1G for fixpll..

Verify:
test pass on A311D-W400

Change-Id: I1a7af6fe459c067e34ff8752453a1a04985edb88
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
5 years ago19af5c5 dtv_demod: add AGC control for board t309 [1/1]
Hui Zhang [Fri, 1 Mar 2019 01:02:26 +0000 (09:02 +0800)]
19af5c5 dtv_demod: add AGC control for board t309 [1/1]
a9eb626 dtv_demod: Prevent NULL pointer crash caused by tuner attach failure [1/1]
d27b145 dtv_demod: TL1 dtmb suspend hangup issue [1/1]
27c05dd dtv_demod: tl1,dvbc, new method for fast channel searching [1/1]
fa80091 dtv_demod: txlx atsc-t loses lock when play video for a long time [1/1]
43db0c5 build: fix build err [1/1]
d4abd67 dtv_demod: TXLX ISDB-T can't search channel [1/1]
70f2c39 dtv_demod: TL1 dvbc search time more than 3 min [1/1]
16d4727 dtv_demod: TL1 dtmb cma allocate fail after dtmb->dvbc->dtmb by cmd [1/1]
b5aa9de media_module: h264/mpeg2/h265 [2/2]
3d6a5ed ppmgr: use light reg for video decoder local reset [1/1]
ppmgr: use light reg for video decoder local reset [1/1]

PD#SWPL-5014

Problem:
ppmgr provider error sometimes in long time run under poor signal

Solution:
use light reg for video decoder local reset

Verify:
X301

Change-Id: I1500c9ddfdce76b3e9cb2b24a35cdee765f82d5f
Signed-off-by: Hui Zhang <hui.zhang@amlogic.com>
media_module: h264/mpeg2/h265 [2/2]

PD#SWPL-3654

Problem:
provide aspect_ratio information by AMSTREAM_IOC_VDECSTAT

Solution:
add ration_control information in vdec_status function for
h264/mh264/vh265/mpeg12/mmpeg12, and normalized it for
aspect_ratio in AMSTREAM_IOC_VDECSTAT message.

Verify:
Verified U212

Change-Id: Icd9270eb8f2ce2f6f7455ec28780d26ac6c56348
Signed-off-by: Rong Zhang <rong.zhang@amlogic.com>
dtv_demod: TL1 dtmb cma allocate fail after dtmb->dvbc->dtmb by cmd [1/1]

PD#TV-1748

Problem:
[Hisense-T962X2-P-customer-DTV]:Failed to lock frequency in dtmb system

Solution:
leave the last mode before enter current mode to release the resources

Verify:
verified by t962x2_x301

Change-Id: Ibd7e1d4c67f5a5ad2191e0031fdd0b81812c8606
Signed-off-by: Zhiwei Yuan <zhiwei.yuan@amlogic.com>
dtv_demod: TL1 dvbc search time more than 3 min [1/1]

PD#SWPL-3555

Problem:
{DVB-C}Hisense needs less than 3 minutes for dvb-c search.(5/5,None)

Solution:
1.use demod internal state machine to optimize time
2.remove j.83b filter setting in dvbc mode for tl1 & txlx

Verify:
verified by t962x2_x301&t962x_r311

Change-Id: Ic922e3da727179e2e35a0fc80e52ac7242c54129
Signed-off-by: Zhiwei Yuan <zhiwei.yuan@amlogic.com>
dtv_demod: TXLX ISDB-T can't search channel [1/1]

PD#SWPL-3987

Problem:
[Einstein]use ISDB-T cannot search any channel

Solution:
release cma memory at leave_mode for ISDB-t&DVB-T

Verify:
verified by t962x_r311

Change-Id: I9b79687a4d5270932ab30afaa3e7d2817e900149
Signed-off-by: Zhiwei Yuan <zhiwei.yuan@amlogic.com>
build: fix build err [1/1]

PD#SWPL-4150

Problem:
When switch to the toolchain shipped with android P, multipile
"-Werror=maybe-uninitialized" error occurs, and the code fail
to be compiled

Solution:
Initialize variables if necessary

Verify:
Locally on Ampere

Change-Id: I280de648914565656831e211539bf41a7dee2b4a
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
dtv_demod: txlx atsc-t loses lock when play video for a long time [1/1]

PD#SWPL-3418

Problem:
[Einstein]when AC off/on,enter live TV ,
TV display blank screen and no signal about 5S

Solution:
use post-eq to track(0x912=0x50)

Verify:
verified by t962x_r311

Change-Id: I924c55a8f1c92328e4371cb730e1b03bd720457f
Signed-off-by: Zhiwei Yuan <zhiwei.yuan@amlogic.com>
dtv_demod: tl1,dvbc, new method for fast channel searching [1/1]

PD#TV-2154

Problem:
[Hisense-T962X2-P-customer-DTV]:DVBC QAM is set to auto to search channels

Solution:
add new searching method
note:
use "demod_dvbc_speedup_en" to mark the new method
it's disabled as default, can be enabled if needed
we can make it always enabled after all testing are passed
enable: echo fast_search on > /sys/kernel/debug/demod/dvbc_channel_fast

Verify:
verified by t962x2_x301

Change-Id: Icaaab9f27eb058a062d7048c6ca9fa2e3bff008e
Signed-off-by: Zhiwei Yuan <zhiwei.yuan@amlogic.com>
dtv_demod: TL1 dtmb suspend hangup issue [1/1]

PD#SWPL-5202

Problem:
cma memory is not released when suspend

Solution:
provide suspend interface to release cma memory

Verify:
verified by t962x2_x301

Change-Id: I1d808a8a6119a2f385961c4c5bded5ab71c9c9d1
Signed-off-by: zhiwei.yuan <zhiwei.yuan@amlogic.com>
dtv_demod: Prevent NULL pointer crash caused by tuner attach failure [1/1]

PD#TV-1539

Problem:
Prevent NULL pointer crash caused by tuner attach failure.

Solution:
Prevent NULL pointer crash caused by tuner attach failure.

Verify:
verified by x301

Change-Id: I57cf32947775626467eb952dd2298ae9ec84601d
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
dtv_demod: add AGC control for board t309 [1/1]

PD#SWPL-5175

Problem:
r842 agc control need be controlled by demod

Solution:
add agc control function

Verify:
verified by t962x2_x301 t962x2_t309

Change-Id: If712e22276b97c457e2e2ed1c79bdf3673813dff
Signed-off-by: zhiwei.yuan <zhiwei.yuan@amlogic.com>
5 years agodi: fix moving character tow line [1/1]
Bencheng Jing [Thu, 2 May 2019 08:27:37 +0000 (16:27 +0800)]
di: fix moving character tow line [1/1]

PD#TV-4346

Problem:
di post buffer switch,motion read mif not switch

Solution:
fix the motion read mif

Verify:
verified by t962x2_x301

Change-Id: I6728e91bfff4241da1f5067398cc412545c7d96f
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
5 years agodebug: add atrace support [1/1]
Tao Guo [Wed, 16 Jan 2019 09:11:54 +0000 (17:11 +0800)]
debug: add atrace support [1/1]

PD#SWPL-4956

Problem:
Need atrace to debug multimedia issue

Solution:
Add atrace functions

Verify:
P212

Change-Id: I0f07387dfa35a33c25e538a474a3a12bd88d5092
Signed-off-by: Tao Guo <tao.guo@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agoRevert "emmc: Clear the value of txdelay in legacy mode on the resume process [1/1]"
Luan Yuan [Sun, 5 May 2019 05:29:51 +0000 (13:29 +0800)]
Revert "emmc: Clear the value of txdelay in legacy mode on the resume process [1/1]"

This reverts commit 2582a9689236c3db53da3b84d21ddb712eae7679.

5 years agoCPUFREQ: update cpufreq 1.512G to 1.5G for sm1. [1/1]
Hong Guo [Thu, 4 Apr 2019 05:17:22 +0000 (13:17 +0800)]
CPUFREQ: update cpufreq 1.512G to 1.5G for sm1. [1/1]

PD#SWPL-6205

Problem:
update cpufreq 1.512G to 1.5G for sm1.

Solution:
update cpufreq 1.512G to 1.5G for sm1.

Verify:
sm1_ac200, verify pass

Change-Id: Ic9c570b2c398e12efb84b4d707f24f773940bbe0
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
5 years agousb: USB keyboard not recognized at low probability [1/1]
he.he [Mon, 22 Apr 2019 10:05:47 +0000 (18:05 +0800)]
usb: USB keyboard not recognized at low probability [1/1]

PD#TV-4365

Problem:
USB keyboard not recognized after reboot repeatedly.

Solution:
Reset the reset_FS_LS_Clock_Divider bit of the usb phy.

Verify:
tl1

Change-Id: I0f4bf35be04d3aff1094bf55641348ccaca072e4
Signed-off-by: he.he <he.he@amlogic.com>
5 years agovideo: reuse initial phase [1/1]
shuanglong.wang [Wed, 20 Mar 2019 08:25:57 +0000 (16:25 +0800)]
video: reuse initial phase [1/1]

PD#SWPL-5664

Problem:
for netflix 23.97fps non-tunnle playback 3:2 patten broken so many times

Solution:
reuse initial phase that Tim use in amazon

Verify:
verify by u212

Change-Id: I5d988e1c3a3dbf1bb728f55a921e8b8fb6990985
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
5 years agovideo: do not compensation when paused [1/1]
shuanglong.wang [Thu, 25 Apr 2019 07:37:38 +0000 (15:37 +0800)]
video: do not compensation when paused [1/1]

PD#SWPL-5664

Problem:
pcr not paused when netflix video non-tunnel mode pause

Solution:
do not compensation when diff between omxpts and pcr too large
Because when paused, continous compensation will lead diff
beween omxpts and pcr will alway inside pcr adjust threshold,
and pcr not set again, then pcr will increase

Verify:
verify by nts

Change-Id: Ib2acea35758d161d1e9db53dd6ff369ba7973351
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
5 years agovideo: compensation omxpts for pcr check [1/1]
shuanglong.wang [Fri, 12 Apr 2019 05:55:06 +0000 (13:55 +0800)]
video: compensation omxpts for pcr check [1/1]

PD#SWPL-5664

Problem:
pcr is probably adjust when test AL1 eyepatch test case

Solution:
the time is not accurate when check pcr and omx_pts differ, because
omx_pts is used the value that be set, but pcr is current. Here add
compensation for omx_pts

Verify:
verify by nts

Change-Id: I3e0f6f006fd79cf7cac4148fd18da72111a333c7
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
 Conflicts:
drivers/amlogic/media/video_sink/video.c

5 years agoschedtune: fix crash when there is cpu boot fail in hmp [1/1]
Jianxin Pan [Tue, 23 Apr 2019 11:37:41 +0000 (19:37 +0800)]
schedtune: fix crash when there is cpu boot fail in hmp [1/1]

PD#SWPL-7656

Problem:
crash when there is cpu boot fail in hmp

Solution:
fix crash when there is cpu boot fail in hmp

Verify:
W400

Change-Id: I0153975593adb0bfcbc3c3bd6543f0fb2e6bf2e0
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
5 years agoemmc: Clear the value of txdelay in legacy mode on the resume process [1/1]
Long Yu [Mon, 15 Apr 2019 08:40:25 +0000 (16:40 +0800)]
emmc: Clear the value of txdelay in legacy mode on the resume process [1/1]

PD#SWPL-7181

Problem:
switch to high-speed from hs200 failed for resume process.

Solution:
set tx_delay as 0 for legacy mode.
clear cfg_cmd_setup

Verify:
verify by TL1

Change-Id: I5dbb1bbc391da864464bf137837a2b0f54ccda42
Signed-off-by: Long Yu <long.yu@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agobandwidth: add min bandwidth read in usage_stat [1/1]
Tao Zeng [Tue, 30 Apr 2019 02:56:18 +0000 (10:56 +0800)]
bandwidth: add min bandwidth read in usage_stat [1/1]

PD#SWPL-7960

Problem:
There is no min ddr bandwidth data

Solution:
Add this value in sysfs

Verify:
p212

Change-Id: I9d90476d30c0ca7789046d8d205f0802de2b4acf
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
5 years agoaudio: add param check for resample [1/1]
Shuai Li [Sun, 28 Apr 2019 13:15:49 +0000 (21:15 +0800)]
audio: add param check for resample [1/1]

PD#SWPL-7798

Problem:
Crashed when audio resample setting params
are invalid.

Solution:
Add check method if the params is invalid.

Verify:
Tl1.

Change-Id: I1e0396be8d401c0a49ff0de9fd7f160f0c8133ca
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
5 years agoddr: bring up bandwidth support for sm1 [1/1]
Tao Zeng [Wed, 10 Apr 2019 03:59:24 +0000 (11:59 +0800)]
ddr: bring up bandwidth support for sm1 [1/1]

PD#SWPL-6865

Problem:
ddr bandwidth measure is not supported on sm1

Solution:
1. Add port description and support for it
2. Record max/average bandwidth support;
3. Support up to 60 continue bandwidth sample
4. Fix bit mismatch of dmc monitor for sm1/tl1.

Verify:
sm1

Change-Id: I0b42db8214099b9cd6d1c3f00174dc65eebfc030
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agoethernet: set tx_amp according chips [1/1]
Zhuo Wang [Thu, 25 Apr 2019 09:00:46 +0000 (17:00 +0800)]
ethernet: set tx_amp according chips [1/1]

PD#SWPL-7765

Problem:
g12b revb efuse not correct

Solution:
set tx_amp with chipid to work around

Verify:
verify on g12b skt board

Change-Id: Id1babce231d866293e4de52685834834a4b65227
Signed-off-by: Zhuo Wang <zhuo.wang@amlogic.com>
5 years agodts: add ppmgr for g12b [1/1]
Luan Yuan [Mon, 22 Apr 2019 02:54:15 +0000 (10:54 +0800)]
dts: add ppmgr for g12b [1/1]

PD#SWPL-6901

Problem:
lack of ppmgr in g12b

Solution:
add ppmgr

Verify:
verify by g12b

Change-Id: Id6d9894d2430cf286e42c90dc340dc10fd0f37c5
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agoidle: sm1: enable sm1 idle function [1/1]
Yan Wang [Wed, 10 Apr 2019 09:34:48 +0000 (17:34 +0800)]
idle: sm1: enable sm1 idle function [1/1]

PD#SWPL-6255

Problem:
sm1 need enable idle for power.

Solution:
enable sm1 idle function.

Verify:
ac200

Change-Id: Ib106ac552660471f0275dc22374405939d521a62
Signed-off-by: Yan Wang <yan.wang@amlogic.com>
5 years agoarm64:defconfig: add mipi csi configurations
Nick Xie [Mon, 5 Aug 2019 06:02:24 +0000 (14:02 +0800)]
arm64:defconfig: add mipi csi configurations

Signed-off-by: Nick Xie <nick@khadas.com>
5 years agocamera: add mipi csi driver for sm1 [1/1]
Guosong Zhou [Mon, 15 Apr 2019 06:56:09 +0000 (02:56 -0400)]
camera: add mipi csi driver for sm1 [1/1]

PD#SWPL-5388

Problem:
sm1 board camera need add mipi csi module

Solution:
add mipi csi module

Verify:
verified on SM1 AC200

Change-Id: I819f2f74aa8da7d725cb59e5636e790185964f79
Signed-off-by: Guosong Zhou <guosong.zhou@amlogic.com>
5 years agowatchdog: fix watchdog get lefttime error [1/1]
Yingyuan Zhu [Wed, 10 Apr 2019 07:26:32 +0000 (15:26 +0800)]
watchdog: fix watchdog get lefttime error [1/1]

PD#SWPL-6937

Problem:
1.get lefttime error by 'cat sys/class/watchdog/watchdog0/timeleft' cmd.
2.if DTS is configured to feed watchdog by Android, the system will
restart automatically after wake up.

Solution:
1.modify the code to get time.
2.when the system wakes up, first judge whether the watchdog runs,
and then decide whether to start the watchdog.

Verify:
test pass on u200

Change-Id: If64888ffdd5651e8cfcace5ea0d0da31641bb397
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
5 years agoarm64: defconfig: enable HDR Prime SL
Nick Xie [Mon, 5 Aug 2019 05:58:21 +0000 (13:58 +0800)]
arm64: defconfig: enable HDR Prime SL

Signed-off-by: Nick Xie <nick@khadas.com>
5 years agohdr_prime: add interface of HDR Prime SL driver [1/1]
Yi Zhou [Thu, 7 Mar 2019 08:12:38 +0000 (16:12 +0800)]
hdr_prime: add interface of HDR Prime SL driver [1/1]

PD#SWPL-5475

Problem:
need to add interface of HDR Prime SL driver

Solution:
add interface of HDR Prime SL driver

Verify:
U212

Change-Id: If0e62b74ccbaa4ede490e7a9896d9f5915480d6f
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
5 years agoamvecm: match uboot sdr2hdr function [1/1]
MingLiang Dong [Fri, 12 Apr 2019 03:03:27 +0000 (23:03 -0400)]
amvecm: match uboot sdr2hdr function  [1/1]

PD#OTT-2524

Problem:
enable sdr2hdr function, uboot logo have color change

Solution:
match uboot sdr2hdr function

Verify:
verify on G12A

Change-Id: I160cd6141d09a385d299ca96a89eb1ebf09c86e8
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
5 years agohdmitx: move work_internal_intr to delayed_work [1/1]
Zongdong Jiao [Mon, 22 Apr 2019 09:20:09 +0000 (17:20 +0800)]
hdmitx: move work_internal_intr to delayed_work [1/1]

PD#SWPL-6894

Problem:
Queue work 'work_internal_intr' cause the hdcp22 flicker

Solution:
Move work_internal_intr to delayed_work

Verify:
G12/U212

Change-Id: Ib05c82bb66c9ad7396790d5eb237ff486c56c980
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agoearlycon: support aml-uart as the name for earlycon [1/1]
Jiamin Ma [Mon, 22 Apr 2019 07:29:53 +0000 (15:29 +0800)]
earlycon: support aml-uart as the name for earlycon [1/1]

PD#SWPL-6969

Problem:
For some historical reason, aml-uart is configured as the earlycon
name in uboot, which is not recognized by 4.9 kernel

Solution:
support aml-uart as the name for earlycon

Verify:
Ampere

Change-Id: I01427f2d512c0bf1972dd545dc71570919c5bc07
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
5 years agovpp: don't overwrite on_pending state when enable vd layer [1/1]
Brian Zhu [Tue, 16 Apr 2019 18:35:27 +0000 (02:35 +0800)]
vpp: don't overwrite on_pending state when enable vd layer [1/1]

PD#OTT-3244

Problem:
When vd layer state is on_pending, calling enable videolayer
function will overwrite the state. Then it will not enable video
layer really.

Solution:
Add the judgement to check if the state is on_pending.

Verify:
verified on W400

Change-Id: I0513a6610fdb108bec05858c7f6c7976be5e7edb
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
5 years agoamvecm: add cm 12bit config for g12a/g12b/sm1
Luan Yuan [Thu, 18 Apr 2019 07:59:14 +0000 (15:59 +0800)]
amvecm: add cm 12bit config for g12a/g12b/sm1

Change-Id: I82a2c54a5b7d7dc8fe0b2e7cc6c1a0af926c8ca3
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
5 years agoamvecm: fix CM/sat/bricon adjust not available [1/2]
Bencheng Jing [Wed, 3 Apr 2019 14:02:02 +0000 (22:02 +0800)]
amvecm: fix CM/sat/bricon adjust not available [1/2]

PD#SWPL-6892

Problem:
fix CM/sat/bricon adjust not available

Solution:
fix CM/sat/bricon adjust not available

Verify:
U212

Change-Id: Ia6a1aebda35550801d4c7e16807714b8349431a4
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
5 years agoamvecm: ioctrl get hist ave error [1/1]
MingLiang Dong [Wed, 9 Jan 2019 09:22:26 +0000 (04:22 -0500)]
amvecm: ioctrl get hist ave error [1/1]

PD#TV-1950

Problem:
VPP_IN_H_V_SIZE register is removed on TL1

Solution:
use preblend size to config hist stts size

Verify:
verify on TL1

Change-Id: I0afc9fd45f69318b2ebd42424aee20e60400d809
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
5 years agoamvecm: fix sm1 green screen when play videos [1/1]
Bencheng Jing [Wed, 17 Apr 2019 03:26:58 +0000 (11:26 +0800)]
amvecm: fix sm1 green screen when play videos [1/1]

PD#SWPL-7302

Problem:
sm1 green screen when play videos

Solution:
add chip support

Verify:
s905D3

Change-Id: I50c0a9f889d72b65157a973bfe1df8dce10db64a
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
5 years agoamvecm: add sharpness0 cvbs table in driver [1/2]
Bencheng Jing [Mon, 18 Mar 2019 11:08:54 +0000 (19:08 +0800)]
amvecm: add sharpness0 cvbs table in driver [1/2]

PD#OTT-2339

Problem:
Testing CVBS Video Index Part FAIL

Solution:
add sharpness0 cvbs table in driver

Verify:
U212

Change-Id: I91047de0e852c77e70ad95aad3e6830fde7097f4
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
5 years agofbcon: use soft cursor instead of hardware cursor
Nick Xie [Thu, 25 Jul 2019 12:52:10 +0000 (20:52 +0800)]
fbcon: use soft cursor instead of hardware cursor

Signed-off-by: Nick Xie <nick@khadas.com>
5 years agofixup build errors after merge upstream code
Nick Xie [Thu, 25 Jul 2019 10:18:46 +0000 (18:18 +0800)]
fixup build errors after merge upstream code

Signed-off-by: Nick Xie <nick@khadas.com>
5 years agoMerge tag 'v4.9.186' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:08:29 +0000 (18:08 +0800)]
Merge tag 'v4.9.186' into khadas-vims-4.9.y-update

This is the 4.9.186 stable release

 Conflicts:
fs/crypto/policy.c

5 years agoMerge tag 'v4.9.185' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:07:39 +0000 (18:07 +0800)]
Merge tag 'v4.9.185' into khadas-vims-4.9.y-update

This is the 4.9.185 stable release

 Conflicts:
Makefile
arch/arm64/kernel/vdso.c

5 years agoMerge tag 'v4.9.184' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:04:22 +0000 (18:04 +0800)]
Merge tag 'v4.9.184' into khadas-vims-4.9.y-update

This is the 4.9.184 stable release

5 years agoMerge tag 'v4.9.183' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:04:19 +0000 (18:04 +0800)]
Merge tag 'v4.9.183' into khadas-vims-4.9.y-update

This is the 4.9.183 stable release

5 years agoMerge tag 'v4.9.182' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:04:16 +0000 (18:04 +0800)]
Merge tag 'v4.9.182' into khadas-vims-4.9.y-update

This is the 4.9.182 stable release

5 years agoMerge tag 'v4.9.181' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 10:03:59 +0000 (18:03 +0800)]
Merge tag 'v4.9.181' into khadas-vims-4.9.y-update

This is the 4.9.181 stable release

 Conflicts:
drivers/android/binder.c
drivers/firmware/efi/libstub/arm-stub.c
drivers/firmware/efi/libstub/efi-stub-helper.c

5 years agoRevert "chardev: add additional check for minor range overlap"
Nick Xie [Thu, 25 Jul 2019 09:55:07 +0000 (17:55 +0800)]
Revert "chardev: add additional check for minor range overlap"

This reverts commit bb22efcb872b8108131a38399ae910dcb0304770.

5 years agoMerge tag 'v4.9.180' into khadas-vims-4.9.y-update
Nick Xie [Thu, 25 Jul 2019 09:03:43 +0000 (17:03 +0800)]
Merge tag 'v4.9.180' into khadas-vims-4.9.y-update

This is the 4.9.180 stable release

 Conflicts:
arch/arm64/mm/proc.S

5 years agofixup! sound: fixup sound card
Nick Xie [Wed, 24 Jul 2019 01:48:57 +0000 (09:48 +0800)]
fixup! sound: fixup sound card

5 years agodrivers/amlogic/mmc: don't use Amlogic partition layout if there is no device tree...
Nick Xie [Tue, 23 Jul 2019 08:20:56 +0000 (16:20 +0800)]
drivers/amlogic/mmc: don't use Amlogic partition layout if there is no device tree node

Signed-off-by: Nick Xie <nick@khadas.com>
5 years agoLinux 4.9.186 v4.9.186
Greg Kroah-Hartman [Sun, 21 Jul 2019 07:06:09 +0000 (09:06 +0200)]
Linux 4.9.186

5 years agos390/qdio: don't touch the dsci in tiqdio_add_input_queues()
Julian Wiedmann [Tue, 18 Jun 2019 11:12:20 +0000 (13:12 +0200)]
s390/qdio: don't touch the dsci in tiqdio_add_input_queues()

commit ac6639cd3db607d386616487902b4cc1850a7be5 upstream.

Current code sets the dsci to 0x00000080. Which doesn't make any sense,
as the indicator area is located in the _left-most_ byte.

Worse: if the dsci is the _shared_ indicator, this potentially clears
the indication of activity for a _different_ device.
tiqdio_thinint_handler() will then have no reason to call that device's
IRQ handler, and the device ends up stalling.

Fixes: d0c9d4a89fff ("[S390] qdio: set correct bit in dsci")
Cc: <stable@vger.kernel.org>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agos390/qdio: (re-)initialize tiqdio list entries
Julian Wiedmann [Tue, 18 Jun 2019 09:25:59 +0000 (11:25 +0200)]
s390/qdio: (re-)initialize tiqdio list entries

commit e54e4785cb5cb4896cf4285964aeef2125612fb2 upstream.

When tiqdio_remove_input_queues() removes a queue from the tiq_list as
part of qdio_shutdown(), it doesn't re-initialize the queue's list entry
and the prev/next pointers go stale.

If a subsequent qdio_establish() fails while sending the ESTABLISH cmd,
it calls qdio_shutdown() again in QDIO_IRQ_STATE_ERR state and
tiqdio_remove_input_queues() will attempt to remove the queue entry a
second time. This dereferences the stale pointers, and bad things ensue.
Fix this by re-initializing the list entry after removing it from the
list.

For good practice also initialize the list entry when the queue is first
allocated, and remove the quirky checks that papered over this omission.
Note that prior to
commit e521813468f7 ("s390/qdio: fix access to uninitialized qdio_q fields"),
these checks were bogus anyway.

setup_queues_misc() clears the whole queue struct, and thus needs to
re-init the prev/next pointers as well.

Fixes: 779e6e1c724d ("[S390] qdio: new qdio driver.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agos390: fix stfle zero padding
Heiko Carstens [Mon, 17 Jun 2019 12:02:41 +0000 (14:02 +0200)]
s390: fix stfle zero padding

commit 4f18d869ffd056c7858f3d617c71345cf19be008 upstream.

The stfle inline assembly returns the number of double words written
(condition code 0) or the double words it would have written
(condition code 3), if the memory array it got as parameter would have
been large enough.

The current stfle implementation assumes that the array is always
large enough and clears those parts of the array that have not been
written to with a subsequent memset call.

If however the array is not large enough memset will get a negative
length parameter, which means that memset clears memory until it gets
an exception and the kernel crashes.

To fix this simply limit the maximum length. Move also the inline
assembly to an extra function to avoid clobbering of register 0, which
might happen because of the added min_t invocation together with code
instrumentation.

The bug was introduced with commit 14375bc4eb8d ("[S390] cleanup
facility list handling") but was rather harmless, since it would only
write to a rather large array. It became a potential problem with
commit 3ab121ab1866 ("[S390] kernel: Add z/VM LGR detection"). Since
then it writes to an array with only four double words, while some
machines already deliver three double words. As soon as machines have
a facility bit within the fifth double a crash on IPL would happen.

Fixes: 14375bc4eb8d ("[S390] cleanup facility list handling")
Cc: <stable@vger.kernel.org> # v2.6.37+
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoARC: hide unused function unw_hdr_alloc
Arnd Bergmann [Wed, 3 Jul 2019 13:39:25 +0000 (15:39 +0200)]
ARC: hide unused function unw_hdr_alloc

commit fd5de2721ea7d16e2b16c4049ac49f229551b290 upstream.

As kernelci.org reports, this function is not used in
vdk_hs38_defconfig:

arch/arc/kernel/unwind.c:188:14: warning: 'unw_hdr_alloc' defined but not used [-Wunused-function]

Fixes: bc79c9a72165 ("ARC: dw2 unwind: Reinstante unwinding out of modules")
Link: https://kernelci.org/build/id/5d1cae3f59b514300340c132/logs/
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodm verity: use message limit for data block corruption message
Milan Broz [Thu, 20 Jun 2019 11:00:19 +0000 (13:00 +0200)]
dm verity: use message limit for data block corruption message

[ Upstream commit 2eba4e640b2c4161e31ae20090a53ee02a518657 ]

DM verity should also use DMERR_LIMIT to limit repeat data block
corruption messages.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoARM: dts: imx6ul: fix PWM[1-4] interrupts
Sébastien Szymanski [Tue, 18 Jun 2019 15:58:34 +0000 (17:58 +0200)]
ARM: dts: imx6ul: fix PWM[1-4] interrupts

[ Upstream commit 3cf10132ac8d536565f2c02f60a3aeb315863a52 ]

According to the i.MX6UL/L RM, table 3.1 "ARM Cortex A7 domain interrupt
summary", the interrupts for the PWM[1-4] go from 83 to 86.

Fixes: b9901fe84f02 ("ARM: dts: imx6ul: add pwm[1-4] nodes")
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agosis900: fix TX completion
Sergej Benilov [Thu, 20 Jun 2019 09:02:18 +0000 (11:02 +0200)]
sis900: fix TX completion

[ Upstream commit 8ac8a01092b2added0749ef937037bf1912e13e3 ]

Since commit 605ad7f184b60cfaacbc038aa6c55ee68dee3c89 "tcp: refine TSO autosizing",
outbound throughput is dramatically reduced for some connections, as sis900
is doing TX completion within idle states only.

Make TX completion happen after every transmitted packet.

Test:
netperf

before patch:
> netperf -H remote -l -2000000 -- -s 1000000
MIGRATED TCP STREAM TEST from 0.0.0.0 () port 0 AF_INET to 95.223.112.76 () port 0 AF_INET : demo
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380 327680 327680    253.44      0.06

after patch:
> netperf -H remote -l -10000000 -- -s 1000000
MIGRATED TCP STREAM TEST from 0.0.0.0 () port 0 AF_INET to 95.223.112.76 () port 0 AF_INET : demo
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380 327680 327680    5.38       14.89

Thx to Dave Miller and Eric Dumazet for helpful hints

Signed-off-by: Sergej Benilov <sergej.benilov@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoppp: mppe: Add softdep to arc4
Takashi Iwai [Wed, 19 Jun 2019 13:34:07 +0000 (15:34 +0200)]
ppp: mppe: Add softdep to arc4

[ Upstream commit aad1dcc4f011ea409850e040363dff1e59aa4175 ]

The arc4 crypto is mandatory at ppp_mppe probe time, so let's put a
softdep line, so that the corresponding module gets prepared
gracefully.  Without this, a simple inclusion to initrd via dracut
failed due to the missing dependency, for example.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agobe2net: fix link failure after ethtool offline test
Petr Oros [Wed, 19 Jun 2019 12:29:42 +0000 (14:29 +0200)]
be2net: fix link failure after ethtool offline test

[ Upstream commit 2e5db6eb3c23e5dc8171eb8f6af7a97ef9fcf3a9 ]

Certain cards in conjunction with certain switches need a little more
time for link setup that results in ethtool link test failure after
offline test. Patch adds a loop that waits for a link setup finish.

Changes in v2:
- added fixes header

Fixes: 4276e47e2d1c ("be2net: Add link test to list of ethtool self tests.")
Signed-off-by: Petr Oros <poros@redhat.com>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoARM: omap2: remove incorrect __init annotation
Arnd Bergmann [Wed, 19 Jun 2019 13:04:54 +0000 (15:04 +0200)]
ARM: omap2: remove incorrect __init annotation

[ Upstream commit 27e23d8975270df6999f8b5b3156fc0c04927451 ]

omap3xxx_prm_enable_io_wakeup() is marked __init, but its caller is not, so
we get a warning with clang-8:

WARNING: vmlinux.o(.text+0x343c8): Section mismatch in reference from the function omap3xxx_prm_late_init() to the function .init.text:omap3xxx_prm_enable_io_wakeup()
The function omap3xxx_prm_late_init() references
the function __init omap3xxx_prm_enable_io_wakeup().
This is often because omap3xxx_prm_late_init lacks a __init
annotation or the annotation of omap3xxx_prm_enable_io_wakeup is wrong.

When building with gcc, omap3xxx_prm_enable_io_wakeup() is always
inlined, so we never noticed in the past.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoperf/core: Fix perf_sample_regs_user() mm check
Peter Zijlstra [Wed, 29 May 2019 12:37:24 +0000 (14:37 +0200)]
perf/core: Fix perf_sample_regs_user() mm check

[ Upstream commit 085ebfe937d7a7a5df1729f35a12d6d655fea68c ]

perf_sample_regs_user() uses 'current->mm' to test for the presence of
userspace, but this is insufficient, consider use_mm().

A better test is: '!(current->flags & PF_KTHREAD)', exec() clears
PF_KTHREAD after it sets the new ->mm but before it drops to userspace
for the first time.

Possibly obsoletes: bf05fc25f268 ("powerpc/perf: Fix oops when kthread execs user process")

Reported-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Reported-by: Young Xiao <92siuyang@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 4018994f3d87 ("perf: Add ability to attach user level registers dump to sample")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoarm64: crypto: remove accidentally backported files
Mark Rutland [Mon, 15 Jul 2019 13:39:23 +0000 (14:39 +0100)]
arm64: crypto: remove accidentally backported files

In the v4.9.y backport commit:

  5ac0682830b31c4fba72a208a3c1c4bbfcc9f7f8

  ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")

... I accidentally added unrelated arm64/crypto files which were not
part of the upstream commit:

  b092201e0020614127f495c092e0a12d26a2116e

... and are not used at all in the v4.9.y tree.

This patch reverts the accidental addition. These files should not have
been backported, and having them in the v4.9.y tree is at best
confusing.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header
Masahiro Yamada [Fri, 12 Jul 2019 03:52:18 +0000 (20:52 -0700)]
nilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header

commit c32cc30c0544f13982ee0185d55f4910319b1a79 upstream.

cpu_to_le32/le32_to_cpu is defined in include/linux/byteorder/generic.h,
which is not exported to user-space.

UAPI headers must use the ones prefixed with double-underscore.

Detected by compile-testing exported headers:

  include/linux/nilfs2_ondisk.h: In function `nilfs_checkpoint_set_snapshot':
  include/linux/nilfs2_ondisk.h:536:17: error: implicit declaration of function `cpu_to_le32' [-Werror=implicit-function-declaration]
    cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                   ^
  include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
   NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
   ^~~~~~~~~~~~~~~~~~~~
  include/linux/nilfs2_ondisk.h:536:29: error: implicit declaration of function `le32_to_cpu' [-Werror=implicit-function-declaration]
    cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                               ^
  include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
   NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
   ^~~~~~~~~~~~~~~~~~~~
  include/linux/nilfs2_ondisk.h: In function `nilfs_segment_usage_set_clean':
  include/linux/nilfs2_ondisk.h:622:19: error: implicit declaration of function `cpu_to_le64' [-Werror=implicit-function-declaration]
    su->su_lastmod = cpu_to_le64(0);
                     ^~~~~~~~~~~

Link: http://lkml.kernel.org/r/20190605053006.14332-1-yamada.masahiro@socionext.com
Fixes: e63e88bc53ba ("nilfs2: move ioctl interface and disk layout to uapi separately")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Cc: <stable@vger.kernel.org> [4.9+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoe1000e: start network tx queue only when link is up
Konstantin Khlebnikov [Wed, 17 Apr 2019 08:13:20 +0000 (11:13 +0300)]
e1000e: start network tx queue only when link is up

commit d17ba0f616a08f597d9348c372d89b8c0405ccf3 upstream.

Driver does not want to keep packets in Tx queue when link is lost.
But present code only reset NIC to flush them, but does not prevent
queuing new packets. Moreover reset sequence itself could generate
new packets via netconsole and NIC falls into endless reset loop.

This patch wakes Tx queue only when NIC is ready to send packets.

This is proper fix for problem addressed by commit 0f9e980bf5ee
("e1000e: fix cyclic resets at link up with active tx").

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Suggested-by: Alexander Duyck <alexander.duyck@gmail.com>
Tested-by: Joseph Yasi <joe.yasi@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "e1000e: fix cyclic resets at link up with active tx"
Konstantin Khlebnikov [Wed, 17 Apr 2019 08:13:16 +0000 (11:13 +0300)]
Revert "e1000e: fix cyclic resets at link up with active tx"

commit caff422ea81e144842bc44bab408d85ac449377b upstream.

This reverts commit 0f9e980bf5ee1a97e2e401c846b2af989eb21c61.

That change cased false-positive warning about hardware hang:

e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
e1000e 0000:00:1f.6 eth0: Detected Hardware Unit Hang:
   TDH                  <0>
   TDT                  <1>
   next_to_use          <1>
   next_to_clean        <0>
buffer_info[next_to_clean]:
   time_stamp           <fffba7a7>
   next_to_watch        <0>
   jiffies              <fffbb140>
   next_to_watch.status <0>
MAC Status             <40080080>
PHY Status             <7949>
PHY 1000BASE-T Status  <0>
PHY Extended Status    <3000>
PCI Status             <10>
e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx

Besides warning everything works fine.
Original issue will be fixed property in following patch.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=203175
Tested-by: Joseph Yasi <joe.yasi@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMIPS: Remove superfluous check for __linux__
Sean Young [Fri, 16 Nov 2018 16:09:39 +0000 (16:09 +0000)]
MIPS: Remove superfluous check for __linux__

commit 1287533d3d95d5ad8b02773733044500b1be06bc upstream.

When building BPF code using "clang -target bpf -c", clang does not
define __linux__.

To build BPF IR decoders the include linux/lirc.h is needed which
includes linux/types.h. Currently this workaround is needed:

https://git.linuxtv.org/v4l-utils.git/commit/?id=dd3ff81f58c4e1e6f33765dc61ad33c48ae6bb07

This check might otherwise be useful to stop users from using a non-linux
compiler, but if you're doing that you are going to have a lot more
trouble anyway.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/21149/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoVMCI: Fix integer overflow in VMCI handle arrays
Vishnu DASA [Fri, 24 May 2019 15:13:10 +0000 (15:13 +0000)]
VMCI: Fix integer overflow in VMCI handle arrays

commit 1c2eb5b2853c9f513690ba6b71072d8eb65da16a upstream.

The VMCI handle array has an integer overflow in
vmci_handle_arr_append_entry when it tries to expand the array. This can be
triggered from a guest, since the doorbell link hypercall doesn't impose a
limit on the number of doorbell handles that a VM can create in the
hypervisor, and these handles are stored in a handle array.

In this change, we introduce a mandatory max capacity for handle
arrays/lists to avoid excessive memory usage.

Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Reviewed-by: Adit Ranadive <aditr@vmware.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocarl9170: fix misuse of device driver API
Christian Lamparter [Sat, 8 Jun 2019 14:49:47 +0000 (16:49 +0200)]
carl9170: fix misuse of device driver API

commit feb09b2933275a70917a869989ea2823e7356be8 upstream.

This patch follows Alan Stern's recent patch:
"p54: Fix race between disconnect and firmware loading"

that overhauled carl9170 buggy firmware loading and driver
unbinding procedures.

Since the carl9170 code was adapted from p54 it uses the
same functions and is likely to have the same problem, but
it's just that the syzbot hasn't reproduce them (yet).

a summary from the changes (copied from the p54 patch):
 * Call usb_driver_release_interface() rather than
   device_release_driver().

 * Lock udev (the interface's parent) before unbinding the
   driver instead of locking udev->parent.

 * During the firmware loading process, take a reference
   to the USB interface instead of the USB device.

 * Don't take an unnecessary reference to the device during
   probe (and then don't drop it during disconnect).

and

 * Make sure to prevent use-after-free bugs by explicitly
   setting the driver context to NULL after signaling the
   completion.

Cc: <stable@vger.kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: amplc_pci230: fix null pointer deref on interrupt
Ian Abbott [Wed, 26 Jun 2019 13:17:39 +0000 (14:17 +0100)]
staging: comedi: amplc_pci230: fix null pointer deref on interrupt

commit 7379e6baeddf580d01feca650ec1ad508b6ea8ee upstream.

The interrupt handler `pci230_interrupt()` causes a null pointer
dereference for a PCI260 card.  There is no analog output subdevice for
a PCI260.  The `dev->write_subdev` subdevice pointer and therefore the
`s_ao` subdevice pointer variable will be `NULL` for a PCI260.  The
following call near the end of the interrupt handler results in the null
pointer dereference for a PCI260:

comedi_handle_events(dev, s_ao);

Fix it by only calling the above function if `s_ao` is valid.

Note that the other uses of `s_ao` in the calls
`pci230_handle_ao_nofifo(dev, s_ao);` and `pci230_handle_ao_fifo(dev,
s_ao);` will never be reached for a PCI260, so they are safe.

Fixes: 39064f23284c ("staging: comedi: amplc_pci230: use comedi_handle_events()")
Cc: <stable@vger.kernel.org> # v3.19+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dt282x: fix a null pointer deref on interrupt
Ian Abbott [Wed, 26 Jun 2019 13:18:04 +0000 (14:18 +0100)]
staging: comedi: dt282x: fix a null pointer deref on interrupt

commit b8336be66dec06bef518030a0df9847122053ec5 upstream.

The interrupt handler `dt282x_interrupt()` causes a null pointer
dereference for those supported boards that have no analog output
support.  For these boards, `dev->write_subdev` will be `NULL` and
therefore the `s_ao` subdevice pointer variable will be `NULL`.  In that
case, the following call near the end of the interrupt handler results
in a null pointer dereference:

comedi_handle_events(dev, s_ao);

Fix it by only calling the above function if `s_ao` is valid.

(There are other uses of `s_ao` by the interrupt handler that may or may
not be reached depending on values of hardware registers.  Trust that
they are reliable for now.)

Note:
commit 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()")
propagates an earlier error from
commit f21c74fa4cfe ("staging: comedi: dt282x: use cfc_handle_events()").

Fixes: 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()")
Cc: <stable@vger.kernel.org> # v3.19+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: renesas_usbhs: add a workaround for a race condition of workqueue
Yoshihiro Shimoda [Wed, 26 Jun 2019 13:06:33 +0000 (22:06 +0900)]
usb: renesas_usbhs: add a workaround for a race condition of workqueue

commit b2357839c56ab7d06bcd4e866ebc2d0e2b7997f3 upstream.

The old commit 6e4b74e4690d ("usb: renesas: fix scheduling in atomic
context bug") fixed an atomic issue by using workqueue for the shdmac
dmaengine driver. However, this has a potential race condition issue
between the work pending and usbhsg_ep_free_request() in gadget mode.
When usbhsg_ep_free_request() is called while pending the queue,
since the work_struct will be freed and then the work handler is
called, kernel panic happens on process_one_work().

To fix the issue, if we could call cancel_work_sync() at somewhere
before the free request, it could be easy. However,
the usbhsg_ep_free_request() is called on atomic (e.g. f_ncm driver
calls free request via gether_disconnect()).

For now, almost all users are having "USB-DMAC" and the DMAengine
driver can be used on atomic. So, this patch adds a workaround for
a race condition to call the DMAengine APIs without the workqueue.

This means we still have TODO on shdmac environment (SH7724), but
since it doesn't have SMP, the race condition might not happen.

Fixes: ab330cf3888d ("usb: renesas_usbhs: add support for USB-DMAC")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agousb: gadget: ether: Fix race between gether_disconnect and rx_submit
Kiruthika Varadarajan [Tue, 18 Jun 2019 08:39:06 +0000 (08:39 +0000)]
usb: gadget: ether: Fix race between gether_disconnect and rx_submit

commit d29fcf7078bc8be2b6366cbd4418265b53c94fac upstream.

On spin lock release in rx_submit, gether_disconnect get a chance to
run, it makes port_usb NULL, rx_submit access NULL port USB, hence null
pointer crash.

Fixed by releasing the lock in rx_submit after port_usb is used.

Fixes: 2b3d942c4878 ("usb ethernet gadget: split out network core")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kiruthika Varadarajan <Kiruthika.Varadarajan@harman.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agop54usb: Fix race between disconnect and firmware loading
Alan Stern [Mon, 20 May 2019 14:44:21 +0000 (10:44 -0400)]
p54usb: Fix race between disconnect and firmware loading

commit 6e41e2257f1094acc37618bf6c856115374c6922 upstream.

The syzbot fuzzer found a bug in the p54 USB wireless driver.  The
issue involves a race between disconnect and the firmware-loader
callback routine, and it has several aspects.

One big problem is that when the firmware can't be loaded, the
callback routine tries to unbind the driver from the USB _device_ (by
calling device_release_driver) instead of from the USB _interface_ to
which it is actually bound (by calling usb_driver_release_interface).

The race involves access to the private data structure.  The driver's
disconnect handler waits for a completion that is signalled by the
firmware-loader callback routine.  As soon as the completion is
signalled, you have to assume that the private data structure may have
been deallocated by the disconnect handler -- even if the firmware was
loaded without errors.  However, the callback routine does access the
private data several times after that point.

Another problem is that, in order to ensure that the USB device
structure hasn't been freed when the callback routine runs, the driver
takes a reference to it.  This isn't good enough any more, because now
that the callback routine calls usb_driver_release_interface, it has
to ensure that the interface structure hasn't been freed.

Finally, the driver takes an unnecessary reference to the USB device
structure in the probe function and drops the reference in the
disconnect handler.  This extra reference doesn't accomplish anything,
because the USB core already guarantees that a device structure won't
be deallocated while a driver is still bound to any of its interfaces.

To fix these problems, this patch makes the following changes:

Call usb_driver_release_interface() rather than
device_release_driver().

Don't signal the completion until after the important
information has been copied out of the private data structure,
and don't refer to the private data at all thereafter.

Lock udev (the interface's parent) before unbinding the driver
instead of locking udev->parent.

During the firmware loading process, take a reference to the
USB interface instead of the USB device.

Don't take an unnecessary reference to the device during probe
(and then don't drop it during disconnect).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com
CC: <stable@vger.kernel.org>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "serial: 8250: Don't service RX FIFO if interrupts are disabled"
Oliver Barta [Wed, 19 Jun 2019 08:16:39 +0000 (10:16 +0200)]
Revert "serial: 8250: Don't service RX FIFO if interrupts are disabled"

commit 3f2640ed7be838c3f05c0d2b0f7c7508e7431e48 upstream.

This reverts commit 2e9fe539108320820016f78ca7704a7342788380.

Reading LSR unconditionally but processing the error flags only if
UART_IIR_RDI bit was set before in IIR may lead to a loss of transmission
error information on UARTs where the transmission error flags are cleared
by a read of LSR. Information are lost in case an error is detected right
before the read of LSR while processing e.g. an UART_IIR_THRI interrupt.

Signed-off-by: Oliver Barta <o.barta89@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: 2e9fe5391083 ("serial: 8250: Don't service RX FIFO if interrupts are disabled")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: serial: option: add support for GosunCn ME3630 RNDIS mode
Jörgen Storvist [Tue, 18 Jun 2019 22:30:19 +0000 (00:30 +0200)]
USB: serial: option: add support for GosunCn ME3630 RNDIS mode

commit aed2a26283528fb69c38e414f649411aa48fb391 upstream.

Added USB IDs for GosunCn ME3630 cellular module in RNDIS mode.

T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=03 Dev#= 18 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=0601 Rev=03.18
S:  Manufacturer=Android
S:  Product=Android
S:  SerialNumber=b950269c
C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
I:  If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option

Signed-off-by: Jörgen Storvist <jorgen.storvist@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: serial: ftdi_sio: add ID for isodebug v1
Andreas Fritiofson [Fri, 28 Jun 2019 13:08:34 +0000 (15:08 +0200)]
USB: serial: ftdi_sio: add ID for isodebug v1

commit f8377eff548170e8ea8022c067a1fbdf9e1c46a8 upstream.

This adds the vid:pid of the isodebug v1 isolated JTAG/SWD+UART. Only the
second channel is available for use as a serial port.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@unjo.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomwifiex: Don't abort on small, spec-compliant vendor IEs
Brian Norris [Sat, 15 Jun 2019 00:13:20 +0000 (17:13 -0700)]
mwifiex: Don't abort on small, spec-compliant vendor IEs

commit 63d7ef36103d26f20325a921ecc96a3288560146 upstream.

Per the 802.11 specification, vendor IEs are (at minimum) only required
to contain an OUI. A type field is also included in ieee80211.h (struct
ieee80211_vendor_ie) but doesn't appear in the specification. The
remaining fields (subtype, version) are a convention used in WMM
headers.

Thus, we should not reject vendor-specific IEs that have only the
minimum length (3 bytes) -- we should skip over them (since we only want
to match longer IEs, that match either WMM or WPA formats). We can
reject elements that don't have the minimum-required 3 byte OUI.

While we're at it, move the non-standard subtype and version fields into
the WMM structs, to avoid this confusion in the future about generic
"vendor header" attributes.

Fixes: 685c9b7750bf ("mwifiex: Abort at too short BSS descriptor element")
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agofscrypt: don't set policy for a dead directory
Hongjie Fang [Wed, 22 May 2019 02:02:53 +0000 (10:02 +0800)]
fscrypt: don't set policy for a dead directory

commit 5858bdad4d0d0fc18bf29f34c3ac836e0b59441f upstream.

The directory may have been removed when entering
fscrypt_ioctl_set_policy().  If so, the empty_dir() check will return
error for ext4 file system.

ext4_rmdir() sets i_size = 0, then ext4_empty_dir() reports an error
because 'inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)'.  If
the fs is mounted with errors=panic, it will trigger a panic issue.

Add the check IS_DEADDIR() to fix this problem.

Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies()
Takashi Iwai [Fri, 31 May 2019 13:18:41 +0000 (15:18 +0200)]
mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies()

commit 69ae4f6aac1578575126319d3f55550e7e440449 upstream.

A few places in mwifiex_uap_parse_tail_ies() perform memcpy()
unconditionally, which may lead to either buffer overflow or read over
boundary.

This patch addresses the issues by checking the read size and the
destination size at each place more properly.  Along with the fixes,
the patch cleans up the code slightly by introducing a temporary
variable for the token size, and unifies the error path with the
standard goto statement.

Reported-by: huangwen <huangwen@venustech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomwifiex: Abort at too short BSS descriptor element
Takashi Iwai [Wed, 29 May 2019 12:52:20 +0000 (14:52 +0200)]
mwifiex: Abort at too short BSS descriptor element

commit 685c9b7750bfacd6fc1db50d86579980593b7869 upstream.

Currently mwifiex_update_bss_desc_with_ie() implicitly assumes that
the source descriptor entries contain the enough size for each type
and performs copying without checking the source size.  This may lead
to read over boundary.

Fix this by putting the source size check in appropriate places.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agox86/tls: Fix possible spectre-v1 in do_get_thread_area()
Dianzhang Chen [Wed, 26 Jun 2019 04:50:30 +0000 (12:50 +0800)]
x86/tls: Fix possible spectre-v1 in do_get_thread_area()

commit 993773d11d45c90cb1c6481c2638c3d9f092ea5b upstream.

The index to access the threads tls array is controlled by userspace
via syscall: sys_ptrace(), hence leading to a potential exploitation
of the Spectre variant 1 vulnerability.

The index can be controlled from:
        ptrace -> arch_ptrace -> do_get_thread_area.

Fix this by sanitizing the user supplied index before using it to access
the p->thread.tls_array.

Signed-off-by: Dianzhang Chen <dianzhangchen0@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1561524630-3642-1-git-send-email-dianzhangchen0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agox86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg()
Dianzhang Chen [Tue, 25 Jun 2019 15:30:17 +0000 (23:30 +0800)]
x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg()

commit 31a2fbb390fee4231281b939e1979e810f945415 upstream.

The index to access the threads ptrace_bps is controlled by userspace via
syscall: sys_ptrace(), hence leading to a potential exploitation of the
Spectre variant 1 vulnerability.

The index can be controlled from:
    ptrace -> arch_ptrace -> ptrace_get_debugreg.

Fix this by sanitizing the user supplied index before using it access
thread->ptrace_bps.

Signed-off-by: Dianzhang Chen <dianzhangchen0@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1561476617-3759-1-git-send-email-dianzhangchen0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoudf: Fix incorrect final NOT_ALLOCATED (hole) extent length
Steven J. Magnani [Mon, 1 Jul 2019 02:39:35 +0000 (21:39 -0500)]
udf: Fix incorrect final NOT_ALLOCATED (hole) extent length

commit fa33cdbf3eceb0206a4f844fe91aeebcf6ff2b7a upstream.

In some cases, using the 'truncate' command to extend a UDF file results
in a mismatch between the length of the file's extents (specifically, due
to incorrect length of the final NOT_ALLOCATED extent) and the information
(file) length. The discrepancy can prevent other operating systems
(i.e., Windows 10) from opening the file.

Two particular errors have been observed when extending a file:

1. The final extent is larger than it should be, having been rounded up
   to a multiple of the block size.

B. The final extent is not shorter than it should be, due to not having
   been updated when the file's information length was increased.

[JK: simplified udf_do_extend_final_block(), fixed up some types]

Fixes: 2c948b3f86e5 ("udf: Avoid IO in udf_clear_inode")
CC: stable@vger.kernel.org
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Link: https://lore.kernel.org/r/1561948775-5878-1-git-send-email-steve@digidescorp.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonet :sunrpc :clnt :Fix xps refcount imbalance on the error path
Lin Yi [Mon, 10 Jun 2019 02:16:56 +0000 (10:16 +0800)]
net :sunrpc :clnt :Fix xps refcount imbalance on the error path

[ Upstream commit b96226148491505318228ac52624956bd98f9e0c ]

rpc_clnt_add_xprt take a reference to struct rpc_xprt_switch, but forget
to release it before return, may lead to a memory leak.

Signed-off-by: Lin Yi <teroincn@163.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoip6_tunnel: allow not to count pkts on tstats by passing dev as NULL
Xin Long [Mon, 17 Jun 2019 13:34:14 +0000 (21:34 +0800)]
ip6_tunnel: allow not to count pkts on tstats by passing dev as NULL

[ Upstream commit 6f6a8622057c92408930c31698394fae1557b188 ]

A similar fix to Patch "ip_tunnel: allow not to count pkts on tstats by
setting skb's dev to NULL" is also needed by ip6_tunnel.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agobnx2x: Check if transceiver implements DDM before access
Mauro S. M. Rodrigues [Thu, 13 Jun 2019 19:25:40 +0000 (16:25 -0300)]
bnx2x: Check if transceiver implements DDM before access

[ Upstream commit cf18cecca911c0db96b868072665347efe6df46f ]

Some transceivers may comply with SFF-8472 even though they do not
implement the Digital Diagnostic Monitoring (DDM) interface described in
the spec. The existence of such area is specified by the 6th bit of byte
92, set to 1 if implemented.

Currently, without checking this bit, bnx2x fails trying to read sfp
module's EEPROM with the follow message:

ethtool -m enP5p1s0f1
Cannot get Module EEPROM data: Input/output error

Because it fails to read the additional 256 bytes in which it is assumed
to exist the DDM data.

This issue was noticed using a Mellanox Passive DAC PN 01FT738. The EEPROM
data was confirmed by Mellanox as correct and similar to other Passive
DACs from other manufacturers.

Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
Acked-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agomd: fix for divide error in status_resync
Mariusz Tkaczyk [Thu, 13 Jun 2019 14:11:41 +0000 (16:11 +0200)]
md: fix for divide error in status_resync

[ Upstream commit 9642fa73d073527b0cbc337cc17a47d545d82cd2 ]

Stopping external metadata arrays during resync/recovery causes
retries, loop of interrupting and starting reconstruction, until it
hit at good moment to stop completely. While these retries
curr_mark_cnt can be small- especially on HDD drives, so subtraction
result can be smaller than 0. However it is casted to uint without
checking. As a result of it the status bar in /proc/mdstat while stopping
is strange (it jumps between 0% and 99%).

The real problem occurs here after commit 72deb455b5ec ("block: remove
CONFIG_LBDAF"). Sector_div() macro has been changed, now the
divisor is casted to uint32. For db = -8 the divisior(db/32-1) becomes 0.

Check if db value can be really counted and replace these macro by
div64_u64() inline.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agomac80211: only warn once on chanctx_conf being NULL
Yibo Zhao [Fri, 14 Jun 2019 11:01:52 +0000 (19:01 +0800)]
mac80211: only warn once on chanctx_conf being NULL

[ Upstream commit 563572340173865a9a356e6bb02579e6998a876d ]

In multiple SSID cases, it takes time to prepare every AP interface
to be ready in initializing phase. If a sta already knows everything it
needs to join one of the APs and sends authentication to the AP which
is not fully prepared at this point of time, AP's channel context
could be NULL. As a result, warning message occurs.

Even worse, if the AP is under attack via tools such as MDK3 and massive
authentication requests are received in a very short time, console will
be hung due to kernel warning messages.

WARN_ON_ONCE() could be a better way for indicating warning messages
without duplicate messages to flood the console.

Johannes: We still need to address the underlying problem, but we
          don't really have a good handle on it yet. Suppress the
          worst side-effects for now.

Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
[johannes: add note, change subject]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5 years agoARM: davinci: da8xx: specify dma_coherent_mask for lcdc
Bartosz Golaszewski [Fri, 7 Jun 2019 14:33:50 +0000 (16:33 +0200)]
ARM: davinci: da8xx: specify dma_coherent_mask for lcdc

[ Upstream commit 68f2515bb31a664ba3e2bc1eb78dd9f529b10067 ]

The lcdc device is missing the dma_coherent_mask definition causing the
following warning on da850-evm:

da8xx_lcdc da8xx_lcdc.0: found Sharp_LK043T1DG01 panel
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at kernel/dma/mapping.c:247 dma_alloc_attrs+0xc8/0x110
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.2.0-rc3-00077-g16d72dd4891f #18
Hardware name: DaVinci DA850/OMAP-L138/AM18x EVM
[<c000fce8>] (unwind_backtrace) from [<c000d900>] (show_stack+0x10/0x14)
[<c000d900>] (show_stack) from [<c001a4f8>] (__warn+0xec/0x114)
[<c001a4f8>] (__warn) from [<c001a634>] (warn_slowpath_null+0x3c/0x48)
[<c001a634>] (warn_slowpath_null) from [<c0065860>] (dma_alloc_attrs+0xc8/0x110)
[<c0065860>] (dma_alloc_attrs) from [<c02820f8>] (fb_probe+0x228/0x5a8)
[<c02820f8>] (fb_probe) from [<c02d3e9c>] (platform_drv_probe+0x48/0x9c)
[<c02d3e9c>] (platform_drv_probe) from [<c02d221c>] (really_probe+0x1d8/0x2d4)
[<c02d221c>] (really_probe) from [<c02d2474>] (driver_probe_device+0x5c/0x168)
[<c02d2474>] (driver_probe_device) from [<c02d2728>] (device_driver_attach+0x58/0x60)
[<c02d2728>] (device_driver_attach) from [<c02d27b0>] (__driver_attach+0x80/0xbc)
[<c02d27b0>] (__driver_attach) from [<c02d047c>] (bus_for_each_dev+0x64/0xb4)
[<c02d047c>] (bus_for_each_dev) from [<c02d1590>] (bus_add_driver+0xe4/0x1d8)
[<c02d1590>] (bus_add_driver) from [<c02d301c>] (driver_register+0x78/0x10c)
[<c02d301c>] (driver_register) from [<c000a5c0>] (do_one_initcall+0x48/0x1bc)
[<c000a5c0>] (do_one_initcall) from [<c05cae6c>] (kernel_init_freeable+0x10c/0x1d8)
[<c05cae6c>] (kernel_init_freeable) from [<c048a000>] (kernel_init+0x8/0xf4)
[<c048a000>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)
Exception stack(0xc6837fb0 to 0xc6837ff8)
7fa0:                                     00000000 00000000 00000000 00000000
7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end trace 8a8073511be81dd2 ]---

Add a 32-bit mask to the platform device's definition.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>