platform/kernel/linux-amlogic.git
6 years agoG12A: initial dts porting for pxp
Qiufang Dai [Tue, 12 Dec 2017 11:55:02 +0000 (19:55 +0800)]
G12A: initial dts porting for pxp

PD#156734: G12A: initial dts porting for pxp

Change-Id: I84d9bd5eb97c0ae0e04f17cd1e41b68fead0ed05
Signed-off-by: Qiufang Dai <qiufang.dai@amlogic.com>
6 years agoARM64: DTS: drop the q200 dts
Yixun Lan [Fri, 23 Feb 2018 07:19:28 +0000 (15:19 +0800)]
ARM64: DTS: drop the q200 dts

PD#NONE: ARM64: DTS: drop the q200 dts

This will revert the Merge commit fa121b2d3444 which introduced
by accident. After this is done, the result version is equal to
commit cc1dabc1824c

Change-Id: I0a4e5b9a41c09f9fc6eaaf55c4453219c17c59ab
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
6 years agoPD#NONE: test git right
Yalong Liu [Fri, 23 Feb 2018 06:12:34 +0000 (14:12 +0800)]
PD#NONE: test git right

Signed-off-by: Yalong Liu <yalong.liu@amlogic.com>
6 years agoMerge branch 'amlogic-4.9-dev' of git://git.myamlogic.com/kernel/common into amlogic...
Yalong Liu [Thu, 22 Feb 2018 02:15:48 +0000 (10:15 +0800)]
Merge branch 'amlogic-4.9-dev' of git://git.myamlogic.com/kernel/common into amlogic-4.9-dev

6 years agomedia: codec_mm: fixed some bugs
Zhi Zhou [Wed, 20 Sep 2017 03:31:55 +0000 (11:31 +0800)]
media: codec_mm: fixed some bugs

PD#154520: media: fixed some bugs
1. codec_mm: fixed alloc & free statistics error bug
2. codec_mm: when some buffers have used. a big size alloc failed,
   because of faragmented.
   add retry for alloc small size.
   and del some dump infos
3. codec_mm: fixed codec_mm fast play bug
4. don't used system's cma pool

Change-Id: I047f1bed75729cf6fe14040243d82906832c9497
Signed-off-by: Zhi Zhou <zhi.zhou@amlogic.com>
6 years agohdmirx: fix hdmirx soundless issue
Yicheng Shen [Wed, 14 Feb 2018 02:49:21 +0000 (10:49 +0800)]
hdmirx: fix hdmirx soundless issue

PD#159963 hdmirx: fix hdmirx soundless issue

Change-Id: I60a63af785d3a9c737814ad2d079905e4f0f07a8
Signed-off-by: Yicheng Shen <yicheng.shen@amlogic.com>
6 years agodi: decoder buffer mangement changed for multi decode
kele bai [Tue, 13 Feb 2018 07:44:13 +0000 (15:44 +0800)]
di: decoder buffer mangement changed for multi decode

PD#152765: di: no put decoder buffer after unreg

Change-Id: Ifb68b53ab35ac94905b59b0400213814a5ee6ec9
Signed-off-by: kele bai <kele.bai@amlogic.com>
6 years agohdmi_tx: solve audiopolicy update at flash plug issue[1/1]
Lianlian Zhu [Wed, 7 Feb 2018 14:08:16 +0000 (22:08 +0800)]
hdmi_tx: solve audiopolicy update at flash plug issue[1/1]

PD#155057: add a delay of 2000ms for disconect to filt the flash plug

Change-Id: Ic5402ccf9f03293a87ee0321c7f8754b2a1c5310
Signed-off-by: Lianlian Zhu <lianlian.zhu@amlogic.com>
6 years agovdin: fix black screen caused by vdin_check_vs
Bencheng Jing [Fri, 9 Feb 2018 14:55:08 +0000 (22:55 +0800)]
vdin: fix black screen caused by vdin_check_vs

PD#160716: vdin: fix black screen caused by vdin_check_vs

1.add vdin msrclk in dts
2.remove vdin_check_vf

Change-Id: Ie0a63821f2eea85cf8f67202b067e4f2b491066c
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
6 years agodrm: enable q200 drm dts
Yalong Liu [Tue, 23 Jan 2018 05:57:35 +0000 (13:57 +0800)]
drm: enable q200 drm dts

PD#158474: enable q200 drm dts

Change-Id: If9f08e4b78c9cd0ba4c3307740ad9b53dc73937a
Signed-off-by: Yalong Liu <yalong.liu@amlogic.com>
6 years agosound: resove external loopback for 2ch pdm + 2ch loopback on axg
Peipeng Zhao [Sun, 11 Feb 2018 07:07:19 +0000 (15:07 +0800)]
sound: resove external loopback for 2ch pdm + 2ch loopback on axg

PD#160814: sound: resove external loopback for 2ch pdm + 2ch loopback

Change-Id: I7a558dcc3850d4d174faa3c9259394b78bf8f45b
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agodi: fix pulldown crash caused by wrong pointer
Bencheng Jing [Thu, 1 Feb 2018 13:33:01 +0000 (21:33 +0800)]
di: fix pulldown crash caused by wrong pointer

PD#160099: di: fix pulldown crash
1) fix pulldown info bit error

Change-Id: I9c111cda6efb7b3161f601d6ffe3c17838108b4a
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
6 years agotvafe: fix palm/n flash on adjust CROSS
Nian Jing [Wed, 7 Feb 2018 03:40:59 +0000 (11:40 +0800)]
tvafe: fix palm/n flash on adjust CROSS

PD#160251: fix palm/n flash on adjust CROSS

Change-Id: Ic4a122b45a0bbeba7cbc277d73fc720e8c4d212e
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
6 years agohdmitx: remove unused print message
Zongdong Jiao [Wed, 7 Feb 2018 07:21:55 +0000 (15:21 +0800)]
hdmitx: remove unused print message

PD#160315: hdmitx: remove unused print message
1. if current cmd is correct, no need print extra info any more.
2. correct cmd judgement

Change-Id: I088ace66eba224359b57f6cf190eefee3076304b
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
6 years agoDRM: fix gem_prime_get_sg_table
Yalong Liu [Tue, 6 Feb 2018 08:24:48 +0000 (16:24 +0800)]
DRM: fix gem_prime_get_sg_table

PD#158474: fixed gem_prime_get_sg_table

modified gem_prime_get_sg_table by allocating
a sg_table for this GEM object through
sg_alloc_table and sg_set_page APIs

Change-Id: Idb7446e8ffa8700a2b8e2a2b2db1c5c3c4d62eb5
Signed-off-by: Yalong Liu <yalong.liu@amlogic.com>
6 years agomm: Improve page trace and mm debug function
tao zeng [Wed, 7 Feb 2018 02:18:07 +0000 (10:18 +0800)]
mm: Improve page trace and mm debug function

PD#160479: mm: Improve page trace and mm debug function

1. Use page->flags to store trace value in 64bit Kernel;
   And this feature can be enabled default, without any
   memory usage increase;
2. Sort and optimize common caller find function in pagetrace;
3. Add some debug print for secmon/of-reserved memory.

Change-Id: I70ce1629889934a5bf31b91df570afa537339479
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
6 years agotvafe: modify avdetect config process
Nian Jing [Wed, 3 Jan 2018 03:19:44 +0000 (11:19 +0800)]
tvafe: modify avdetect config process

PD#154265: modify avdetect config process

Change-Id: I889e4244abf1a8e3ed83e7cb3d1a2d4983dc09ba
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
6 years agoMerge "amvecm: fix pq load fail" into amlogic-4.9-dev
Jianxin Pan [Tue, 6 Feb 2018 02:29:17 +0000 (18:29 -0800)]
Merge "amvecm: fix pq load fail" into amlogic-4.9-dev

6 years agoamvecm: fix pq load fail
MingLiang Dong [Sat, 3 Feb 2018 05:54:10 +0000 (13:54 +0800)]
amvecm: fix pq load fail

PD#158996: amvecm: fix pq load fail

Change-Id: I23d26427ebff2d13c2ea95ffa0b97c9b9a14f865
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
6 years agocec: add unlock for every return
hongmin hua [Fri, 2 Feb 2018 08:41:32 +0000 (16:41 +0800)]
cec: add unlock for every return

PD#158781: cec: add unlock for every return

Change-Id: If4b0b563040c8c5fa62cd7e2cd3487d3663042dc
Signed-off-by: hongmin hua <hongmin.hua@amlogic.com>
6 years agohdmitx: 2160p50zh contains 2160p50hz420 etc.[1/2]
Luan Yuan [Mon, 5 Feb 2018 02:59:50 +0000 (10:59 +0800)]
hdmitx: 2160p50zh contains 2160p50hz420 etc.[1/2]

PD#158454: hdmitx: uniform the sysfs node 'disp_cap'

Previous handling of node 'disp_cap' may contains both '2160p50hz'
and '2160p50hz420', which may confuse the application.
Now start to uniform the 'disp_cap', which will only contains valid
mode, without colorspace information. Not each combination of 'disp_cap'
and 'dc_cap' is valid, please use 'valid_mode' to test combination.

Change-Id: I2d1c97b33272ddd439acf8cadef9e35dfc2dbe82
Signed-off-by: Luan Yuan <luan.yuan@amlogic.com>
6 years agodi: speed up input mif read efficiency
kele bai [Wed, 31 Jan 2018 02:10:38 +0000 (10:10 +0800)]
di: speed up input mif read efficiency

PD#159864: di: speed up input mif read efficiency

1) change input mif read pass ratio from 50% to 66.6% according
   to vlsi's suggestment
2) pass ratio = (pass_cnt + 1)/(pass_cnt + 1 + hold_cnt + 1)

Change-Id: Ib5bc274f40e3e085c22f807effbac436a02b0d76
Signed-off-by: kele bai <kele.bai@amlogic.com>
6 years agoaudio: dts: disabled dmic
Xing Wang [Wed, 31 Jan 2018 07:49:44 +0000 (15:49 +0800)]
audio: dts: disabled dmic

PD#157997: audio: dts: disabled dmic

Change-Id: Id8a71dbf1c51db46ae2ca678952a8108707dcf03
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
6 years agodi: fix pq load fail
Bencheng Jing [Fri, 2 Feb 2018 02:38:56 +0000 (10:38 +0800)]
di: fix pq load fail

PD#158740: di: fix pq load fail

1) problem: load reg in thread run into gate turn off
2) solution: load reg in size config after gate on
   add debug information for load reg fail&successful

Change-Id: I46e57f15c9231bcf4f3e889e357009e8c9b0fbaa
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
6 years agodi: fix flash black issue
Dezhi Kong [Thu, 1 Feb 2018 12:27:57 +0000 (20:27 +0800)]
di: fix flash black issue

PD#159372: di: fix flash black issue

Change-Id: Ib37b257ba1ce88d6923f68341a4782b1924ac4c6
Signed-off-by: Dezhi Kong <dezhi.kong@amlogic.com>
6 years agosound: fixed pdm record data slow error
Peipeng Zhao [Fri, 2 Feb 2018 06:26:32 +0000 (14:26 +0800)]
sound: fixed pdm record data slow error

PD#160225: sound: fixed pdm record data slow error

Change-Id: I8a6a0ae3207c27c6928342057df44b6454de55c2
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agohdmitx: eliminate the unreasonable mutex
Yi Zhou [Wed, 24 Jan 2018 07:22:15 +0000 (15:22 +0800)]
hdmitx: eliminate the unreasonable mutex

PD#157189: hdmitx: eliminate the unreasonable mutex

Change-Id: I0ce4ebb1440c8a346602f892cae7afafa38cbfe7
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
6 years agoaudio: add axg audio efuse module support
Lianlian Zhu [Thu, 1 Feb 2018 07:02:39 +0000 (15:02 +0800)]
audio: add axg audio efuse module support

PD#160113: audio:add axg audio efuse module support

Change-Id: I3b18ea4c7b8eb5069a1038a5c5c6b11b46d198c7
Signed-off-by: Lianlian Zhu <lianlian.zhu@amlogic.com>
6 years agosound: changed endian mode of pcm
Peipeng Zhao [Wed, 31 Jan 2018 07:05:51 +0000 (15:05 +0800)]
sound: changed endian mode of pcm

and fixed pdm in i2s code clk error for gxl chip

PD#160061: sound: changed endian mode of pcm

and fixed pdm in i2s code clk error for gxl chip

Change-Id: Idb0f8bc32dbe49dafbab73c30ca20491a7e6891a
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agocec: modify dts pintrl selection to default
hongmin hua [Sun, 28 Jan 2018 04:58:12 +0000 (12:58 +0800)]
cec: modify dts pintrl selection to default

PD#158936: cec: modify dts pintrl selection to default

Change-Id: Id6718d7920b08d856081e39806458f3baf998b4e
Signed-off-by: hongmin hua <hongmin.hua@amlogic.com>
6 years agotee: add tee load dynamic control
Yvonne Chen [Thu, 18 Jan 2018 08:34:30 +0000 (16:34 +0800)]
tee: add tee load dynamic control

PD#159071:  tee load dynamic control using disable_flag

using disable flag to disable tee load

Change-Id: I9c138e3830412ee04dcd82812b1a00cbed1ab940
Signed-off-by: Yvonne Chen <yvonne.chen@amlogic.com>
6 years agotee: firmware: add new parameter vdec type
Pengguang Zhu [Wed, 10 Jan 2018 06:39:33 +0000 (14:39 +0800)]
tee: firmware: add new parameter vdec type

PD#159071: add new parameter vdec type

Change-Id: Ib3d49d2bbc56a36844d0c53a7c8a46d30543ebdc
Signed-off-by: Pengguang Zhu <pengguang.zhu@amlogic.com>
6 years agolcd: optimize lcd notifier event for power sequence
Evoke Zhang [Mon, 22 Jan 2018 03:37:13 +0000 (11:37 +0800)]
lcd: optimize lcd notifier event for power sequence

PD#158197: lcd: optimize lcd notifier event for power sequence

Change-Id: I6b91bf1c2c6e31dfa3133f078d37d32fdce2a5bd
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
6 years agodi: optimize wire drawing in pulldown22 video appears on gxlx
wenfeng.guo [Fri, 19 Jan 2018 06:50:12 +0000 (14:50 +0800)]
di: optimize wire drawing in pulldown22 video appears on gxlx

PD#157033: di: optimize wire drawing in pulldown22 video appears on gxlx

Change-Id: I4c56cee942059794aac4969febbf35c0ef565fd3
Signed-off-by: wenfeng.guo <wenfeng.guo@amlogic.com>
6 years agohdmitx: add delay for plugout
Kaifu Hu [Wed, 24 Jan 2018 08:14:14 +0000 (16:14 +0800)]
hdmitx: add delay for plugout

PD#157869: hdmitx: add delay for plugout

1. add delay for plugout and ignore plugout work when boot.
2. delete set display when plugin.

Change-Id: I21fee9d3f68dc5fe84bcd76efc0a8572e3976ef6
Signed-off-by: Kaifu Hu <kaifu.hu@amlogic.com>
6 years agodi: fix pulldown crash for 1080i&1088i timing
Bencheng Jing [Fri, 26 Jan 2018 12:22:10 +0000 (20:22 +0800)]
di: fix pulldown crash for 1080i&1088i timing

PD#159599: di: fix pulldown crash for 1080i&1088i timing

Change-Id: I1f89920e195feaaa643f94d9227bf2e1a0268b15
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
6 years agocvbs: fix display set mode block
Nian Jing [Wed, 24 Jan 2018 06:00:34 +0000 (14:00 +0800)]
cvbs: fix display set mode block

PD#157658: add delaywork enable dac

Change-Id: I2682c80c7a28d8bfdb88e038141c3e83aea33c46
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
6 years agocec: set reg map before irq enable
hongmin hua [Mon, 4 Dec 2017 11:46:55 +0000 (19:46 +0800)]
cec: set reg map before irq enable

PD#158921: cec: change the order of irq in probe

Change-Id: I8099e918a06c9d741de890b773ec6ca47ab44aba
Signed-off-by: hongmin hua <hongmin.hua@amlogic.com>
6 years agocrypto: Enable EXT4_ENCRYPTION for file based encryption [2/4]
Matthew Shyu [Mon, 15 Jan 2018 09:07:21 +0000 (17:07 +0800)]
crypto: Enable EXT4_ENCRYPTION for file based encryption [2/4]

PD#158397: crypto: enable FBE

Encrypto CONFIG_EXT4_ENCRYPTION for file based encryption

Change-Id: Iaad3679bc9ac05eea1d44ad7c6d30a0324e82e89
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
6 years agoppmgr:enable ppmgr module [1/1]
Tellen Yu [Fri, 26 Jan 2018 07:18:22 +0000 (15:18 +0800)]
ppmgr:enable ppmgr module [1/1]

PD#157786: enable ppmgr

enable txlx ppmgr feature

Change-Id: I3939724e5a9c51349875bc340e5fcd47c2774e12
Signed-off-by: Tellen Yu <tellen.yu@amlogic.com>
6 years agoaudio: add audio external loopback feature for axg chip
Peipeng Zhao [Thu, 25 Jan 2018 05:49:44 +0000 (13:49 +0800)]
audio: add audio external loopback feature for axg chip

PD#159617: audio: add audio external loopback feature for axg chip

For S400 & S420 board, please modify dts to enable external loopback
please read following file:
Documentation/devicetree/bindings/amlogic/axg-sound-loopback.txt

Change-Id: Ie96d10eb8e6ae81aaff0b3e6965aa4e22f07f0b8
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
6 years agotouchscreen: goodix gt9xx driver support
Sunny Luo [Sat, 20 Jan 2018 10:02:17 +0000 (18:02 +0800)]
touchscreen: goodix gt9xx driver support

PD#158973: goodix gt9xx driver support

Change-Id: Iffac9172ab1869521ecff731f7d50ddf7ea01b14
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
6 years agohdmitx: update gxm dts
Yi Zhou [Fri, 19 Jan 2018 08:48:09 +0000 (16:48 +0800)]
hdmitx: update gxm dts

PD#154260: hdmitx: update gxm dts

Change-Id: Iddf3aa4512e5073f7e7dd1ba4558f38eb7998d58
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
6 years agodts: fix 8.1 r311 bt open fail
Kuibao Zhang [Mon, 22 Jan 2018 07:20:35 +0000 (15:20 +0800)]
dts: fix 8.1 r311 bt open fail

PD#159307: BT fix 8.1 r311 bt open fail
1.DTS,change bt en pin
2.FIX bt en pinmux

Change-Id: I59c5978a5b52b49f9aa1aeede93d2761bca62959
Signed-off-by: Kuibao Zhang <kuibao.zhang@amlogic.com>
6 years agohdmitx: update txlx dts
Kaifu Hu [Tue, 23 Jan 2018 02:49:06 +0000 (10:49 +0800)]
hdmitx: update txlx dts

PD#159209: hdmitx: update txlx dts

add hdcp22_skpclk and hdcp22_esmclk.

Change-Id: I2a1cc3fd31cf3bb5002cdc1673573f18349f612d
Signed-off-by: Kaifu Hu <kaifu.hu@amlogic.com>
6 years agovbi: fix vbi crash on switch channel
Nian Jing [Fri, 19 Jan 2018 07:38:51 +0000 (15:38 +0800)]
vbi: fix vbi crash on switch channel

PD#158142: fix vbi crash on switch channel

Change-Id: I0d4a585479b142cc585db0b00efb9d8772cc61ee
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
6 years agolcd: add lcd_extern p070acb driver
Weiming Liu [Thu, 18 Jan 2018 02:21:13 +0000 (10:21 +0800)]
lcd: add lcd_extern p070acb driver

PD#159016: lcd_extern: add p070acb driver

Change-Id: Id2fd949f37815de1ec9bbd90170dce459b661256
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
6 years agoMerge branch 'android-4.9' into amlogic-4.9-dev
Victor Wan [Mon, 22 Jan 2018 12:17:25 +0000 (20:17 +0800)]
Merge branch 'android-4.9' into amlogic-4.9-dev

Conflicts:
Makefile
init/main.c

6 years agonand: Rsv zone bug fix
Liang Yang [Wed, 13 Dec 2017 09:15:01 +0000 (17:15 +0800)]
nand: Rsv zone bug fix

PD#156785: enhance rsv ecc&incomplete abnormal handler

NOTE: Relative commit(bug156785), patch together.

Change-Id: I05f9a4c521b75f5fcd071fdf09ca76a3f0aae033
Signed-off-by: Liang Yang <liang.yang@amlogic.com>
6 years agoaudio: dts: fix i2c for tas5707 and i2s pinmux
Xing Wang [Fri, 19 Jan 2018 15:07:58 +0000 (23:07 +0800)]
audio: dts: fix i2c for tas5707 and i2s pinmux

PD#159131: audio: dts : fix i2c for tas5707 and i2s pinmux

Change-Id: Ic4a2de8b5dcba668a793bf0c0c17d660418933b2
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
6 years agolcd: optimize gpio register function for init value
Evoke Zhang [Fri, 19 Jan 2018 07:15:07 +0000 (15:15 +0800)]
lcd: optimize gpio register function for init value

PD#158752: lcd: optimize gpio register function for init value

For gpio register required init value, we can't register gpio when
lcd probe, otherwise it maybe change the gpio value which is working
by bootloader init.
So we register gpio when first calling by lcd power step controlling.

Change-Id: I629143f50924aac7e3ea27aa1a2c4b12a1992b71
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
6 years agoionvideo: update ionvideo dts for tv
Jian Wang [Fri, 19 Jan 2018 10:08:58 +0000 (18:08 +0800)]
ionvideo: update ionvideo dts for tv

PD#158997: update ionvideo dts for tv

Change-Id: Iefa4ed1b93dc244d23aa0892e04722aed2836eb7
Signed-off-by: Jian Wang <jian.wang@amlogic.com>
6 years agoPD#158974: touchscreen: goodix GT1X driver support
Sunny Luo [Thu, 18 Jan 2018 13:27:27 +0000 (21:27 +0800)]
PD#158974: touchscreen: goodix GT1X driver support

Change-Id: I45b6e97a2fdba801c681e1858a155e2df7f050fd
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
6 years agodi: add dummy buffer for first field
kele bai [Tue, 16 Jan 2018 10:46:05 +0000 (18:46 +0800)]
di: add dummy buffer for first field

PD#158592: di: add dummy buffer for first field

1) only middle buffer can be process in di

Change-Id: Ide92f1a17428cf5c27468a6dfc086ad2f4685fe3
Signed-off-by: kele bai <kele.bai@amlogic.com>
6 years agochar_dev: extend dynamic allocation of majors into a higher range
Logan Gunthorpe [Thu, 15 Jun 2017 20:05:20 +0000 (14:05 -0600)]
char_dev: extend dynamic allocation of majors into a higher range

PD#159028: char_dev: extend dynamic allocation of majors into a higher range

We've run into problems with running out of dynamicly assign char
device majors particullarly on automated test systems with
all-yes-configs. Roughly 40 dynamic assignments can be made with such
kernels at this time while space is reserved for only 20.

Currently, the kernel only prints a warning when dynamic allocation
overflows the reserved region. And when this happens drivers that have
fixed assignments can randomly fail depending on the order of
initialization of other drivers. Thus, adding a new char device can cause
unexpected failures in completely unrelated parts of the kernel.

This patch solves the problem by extending dynamic major number
allocations down from 511 once the 234-254 region fills up. Fixed
majors already exist above 255 so the infrastructure to support
high number majors is already in place. The patch reserves an
additional 128 major numbers which should hopefully last us a while.

Kernels that don't require more than 20 dynamic majors assigned (which
is pretty typical) should not be affected by this change.

Change-Id: Ibf1ddaf0b7ce623c9f1a18c42a1ad39a89bb3f41
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Link: https://lkml.org/lkml/2017/6/4/107
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
6 years agopinctrl: correct spelling mistakes for txlx and axg
Xingyu Chen [Thu, 18 Jan 2018 09:41:00 +0000 (17:41 +0800)]
pinctrl: correct spelling mistakes for txlx and axg

PD#158937: pinctrl: correct spelling mistakes for txlx and axg

Change-Id: I465cd138b9b9a5e7089715c8495f47137d21e6ad
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
6 years agomedia: fixed the issure of crash when get pts rec num.
Nanxin Qin [Tue, 16 Jan 2018 08:02:49 +0000 (16:02 +0800)]
media: fixed the issure of crash when get pts rec num.

PD#158950: fixed the issure of crash when get pts rec num.

Change-Id: Iadba80bd5c0c1c4dc001e0321ed0e1a460c57ced
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
6 years agoDRM: fix gem object leak in PRIME_EXPORT operation.
sky zhou [Wed, 17 Jan 2018 04:12:59 +0000 (12:12 +0800)]
DRM: fix gem object leak in PRIME_EXPORT operation.

PD#158474: fixed exported fd leaked.

Exported fd didnot bind correct release function,
use core gem-prime function to re-write export function.
The import function is not provded, for now we only import
the buffer created from meson driver.

Change-Id: I15fad65741631ee2b367d088e733f20af8b0cf5a
Signed-off-by: sky zhou <sky.zhou@amlogic.com>
6 years agoPD#158972: touchscreen: focaltech ft3x27 driver support
Sunny Luo [Thu, 18 Jan 2018 06:08:22 +0000 (14:08 +0800)]
PD#158972: touchscreen: focaltech ft3x27 driver support

Change-Id: I5e1de4a6074a75c288d52fd388323978415610bd
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
6 years agosd: add txlx r311 sd_uart support
Nan Li [Wed, 17 Jan 2018 02:58:29 +0000 (10:58 +0800)]
sd: add txlx r311 sd_uart support

PD#158480: r321 sd_emmc_b port is sdio wifi,
so modify r321 dts b port pinname.

Change-Id: I6a7e44c7b567f1ba9467c2696b6d5637b12939de
Signed-off-by: Nan Li <nan.li@amlogic.com>
6 years agoemmc: optimize emmc dts config
Nan Li [Tue, 16 Jan 2018 07:05:44 +0000 (15:05 +0800)]
emmc: optimize emmc dts config

PD#158871: optimize emmc dts config,
delete "status" cfg.

Change-Id: I5ae2aa66384db84619ffcad7354facd4aa2bac54
Signed-off-by: Nan Li <nan.li@amlogic.com>
6 years agoRevert "drm: force ARGB8888 format to osd display"
Yalong Liu [Thu, 18 Jan 2018 00:11:35 +0000 (08:11 +0800)]
Revert "drm: force ARGB8888 format to osd display"

PD#152825: Revert "drm: force ARGB8888 format to osd display"
This reverts commit 63a6fdd4fa329e0ac41da0ac672d014b7ad5a5ef.

Change-Id: Icc99d5ec3bcbf6e879bedf9385b4b56be679741b
Signed-off-by: Yalong Liu <yalong.liu@amlogic.com>
6 years agoledring: add suspend/resume for ledring
Renjun Xu [Wed, 17 Jan 2018 02:42:13 +0000 (10:42 +0800)]
ledring: add suspend/resume for ledring

PD#158940: add suspend/resume for ledring

Change-Id: I64827cd230708481768be7aabc3b4f814af8b636
Signed-off-by: Renjun Xu <renjun.xu@amlogic.com>
6 years agomm: fix compile error on other configs
tao zeng [Tue, 16 Jan 2018 06:47:49 +0000 (14:47 +0800)]
mm: fix compile error on other configs

PD#153120: mm:fix compile error on other configs

Change-Id: I8e72afa508c44149f69c6d8c34698d13848e539c
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
6 years agonand: add llseek for fw_env tools
Liang Yang [Fri, 12 Jan 2018 06:18:52 +0000 (14:18 +0800)]
nand: add llseek for fw_env tools

PD#158552: Implememt llseek for fw_printenv/fw_setenv tools

Change-Id: Ie6176903c7155cdb7daf17049a7356ed8f61e463
Signed-off-by: Liang Yang <liang.yang@amlogic.com>
6 years agosd: add txlx r311 sd_uart support
Nan Li [Thu, 11 Jan 2018 08:43:14 +0000 (16:43 +0800)]
sd: add txlx r311 sd_uart support

PD#158480: add sd_uart support on txlx r311.

Change-Id: I62a094e66ca5934e0992cc6a5cc44d14e8ce20c3
Signed-off-by: Nan Li <nan.li@amlogic.com>
6 years agomm: close debug print of cma alloc
tao zeng [Mon, 15 Jan 2018 06:04:52 +0000 (14:04 +0800)]
mm: close debug print of cma alloc

PD#153120: mm: close debug print of cma alloc

These print message may print a lot when video playback
And cause it not smooth.

Change-Id: If1f18d5e8a0234f1daca2c6e803a23ba90354414
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
6 years agomm: check pfn overflow for low memory platform
tao zeng [Tue, 9 Jan 2018 06:03:15 +0000 (14:03 +0800)]
mm: check pfn overflow for low memory platform

PD#158373: mm: check pfn overflow for low memory platform

On ARM64 platform, when vmemmap_populate is called for reserve
memory for struct page, it reserved based 1GB a loop. And 16MB
memory will be reserved at least. This caused memory waste if
total RAM is less than 1GB.

Basically reserve memory size for struct page is calculated by:

    reserve size = sizeof(struct page) * number of pages.

For example, currently struct page is 64 bytes on ARM64. A page
is 4KB. So reserve size table can be:

    Memory  |  page count  |  reserve size(bytes)
-------------------------------------------------
     128MB  |       32768  |         2097152(2MB)
     256MB  |       65536  |         4194304(4MB)
     512MB  |      131072  |         8388608(8MB)

Note, This reserve is aligned at 2MB.

Change-Id: I912ab01252d68fd065eb94fa2c5556cefa59a256
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
6 years agoledring: modify ioctl support 32bit and 64bit
Renjun Xu [Thu, 11 Jan 2018 05:54:10 +0000 (13:54 +0800)]
ledring: modify ioctl support 32bit and 64bit

PD#157849: modify ioctl support 32bit and 64bit

Change-Id: I2f2395110454a2a05ec089601a937a1c884fa800
Signed-off-by: Renjun Xu <renjun.xu@amlogic.com>
6 years agoclkmsr: init clkmsr earlier for lcd driver called
Evoke Zhang [Thu, 11 Jan 2018 08:51:36 +0000 (16:51 +0800)]
clkmsr: init clkmsr earlier for lcd driver called

PD#158608: clkmsr: init clkmsr earlier for lcd driver called.
also add missed pwm config in dts for backlight,
and add pwm pointer protection in backlight driver.

Change-Id: Ib3d435a0f4418e31d94e65b1cee9919f1f6325c8
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
6 years agoemmc: optimize emmc driver configs.
Nan Li [Tue, 9 Jan 2018 11:44:58 +0000 (19:44 +0800)]
emmc: optimize emmc driver configs.

PD#158348: modify emmc dts config data to match data.

Change-Id: Id1f29a8f5b47342376cfa976c6dba7e88bcc5514
Signed-off-by: Nan Li <nan.li@amlogic.com>
6 years agoMerge 4.9.76 into android-4.9
Greg Kroah-Hartman [Wed, 10 Jan 2018 08:51:38 +0000 (09:51 +0100)]
Merge 4.9.76 into android-4.9

Changes in 4.9.76
kernel/acct.c: fix the acct->needcheck check in check_free_space()
crypto: n2 - cure use after free
crypto: chacha20poly1305 - validate the digest size
crypto: pcrypt - fix freeing pcrypt instances
sunxi-rsb: Include OF based modalias in device uevent
fscache: Fix the default for fscache_maybe_release_page()
nbd: fix use-after-free of rq/bio in the xmit path
kernel: make groups_sort calling a responsibility group_info allocators
kernel/signal.c: protect the traced SIGNAL_UNKILLABLE tasks from SIGKILL
kernel/signal.c: protect the SIGNAL_UNKILLABLE tasks from !sig_kernel_only() signals
kernel/signal.c: remove the no longer needed SIGNAL_UNKILLABLE check in complete_signal()
iommu/arm-smmu-v3: Don't free page table ops twice
iommu/arm-smmu-v3: Cope with duplicated Stream IDs
ARC: uaccess: dont use "l" gcc inline asm constraint modifier
Input: elantech - add new icbody type 15
x86/microcode/AMD: Add support for fam17h microcode loading
parisc: Fix alignment of pa_tlb_lock in assembly on 32-bit SMP kernel
parisc: qemu idle sleep support
x86/tlb: Drop the _GPL from the cpu_tlbstate export
Map the vsyscall page with _PAGE_USER
mtd: nand: pxa3xx: Fix READOOB implementation
Linux 4.9.76

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
6 years agoaudio: tdm: set tdmin max channals by dts
Yueguie He [Wed, 10 Jan 2018 05:22:33 +0000 (13:22 +0800)]
audio: tdm: set tdmin max channals by dts

PD#158473: set tdmin max channals by dts

Change-Id: Ia6ff262fec6b3c156ac35f89b72cd690621f12fc
Signed-off-by: Yueguie He <yuegui.he@amlogic.com>
6 years agodi: add protection for no mirror function
kele bai [Wed, 20 Dec 2017 02:12:46 +0000 (10:12 +0800)]
di: add protection for no mirror function

PD#157314: di: add protection for no mirror function

1) disable mirror function, set keep frame to 0 avoid post process
   buffer
2) modify for keep function, avoid crash caused by calling de post
   in blankout mode
3) move mutex operation out of tasklet
4) remove framereset in hw disable function

Change-Id: I6166a855a7fe6ad38a21c570e9ad0a6f9a204424
Signed-off-by: kele bai <kele.bai@amlogic.com>
6 years agoLinux 4.9.76 v4.9.76
Greg Kroah-Hartman [Wed, 10 Jan 2018 08:29:55 +0000 (09:29 +0100)]
Linux 4.9.76

6 years agomtd: nand: pxa3xx: Fix READOOB implementation
Boris Brezillon [Mon, 18 Dec 2017 10:32:45 +0000 (11:32 +0100)]
mtd: nand: pxa3xx: Fix READOOB implementation

commit fee4380f368e84ed216b62ccd2fbc4126f2bf40b upstream.

In the current driver, OOB bytes are accessed in raw mode, and when a
page access is done with NDCR_SPARE_EN set and NDCR_ECC_EN cleared, the
driver must read the whole spare area (64 bytes in case of a 2k page,
16 bytes for a 512 page). The driver was only reading the free OOB
bytes, which was leaving some unread data in the FIFO and was somehow
leading to a timeout.

We could patch the driver to read ->spare_size + ->ecc_size instead of
just ->spare_size when READOOB is requested, but we'd better make
in-band and OOB accesses consistent.
Since the driver is always accessing in-band data in non-raw mode (with
the ECC engine enabled), we should also access OOB data in this mode.
That's particularly useful when using the BCH engine because in this
mode the free OOB bytes are also ECC protected.

Fixes: 43bcfd2bb24a ("mtd: nand: pxa3xx: Add driver-specific ECC BCH support")
Reported-by: Sean Nyekjær <sean.nyekjaer@prevas.dk>
Tested-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Tested-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMap the vsyscall page with _PAGE_USER
Borislav Petkov [Thu, 4 Jan 2018 16:42:45 +0000 (17:42 +0100)]
Map the vsyscall page with _PAGE_USER

This needs to happen early in kaiser_pagetable_walk(), before the
hierarchy is established so that _PAGE_USER permission can be really
set.

A proper fix would be to teach kaiser_pagetable_walk() to update those
permissions but the vsyscall page is the only exception here so ...

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agox86/tlb: Drop the _GPL from the cpu_tlbstate export
Thomas Gleixner [Thu, 4 Jan 2018 21:19:04 +0000 (22:19 +0100)]
x86/tlb: Drop the _GPL from the cpu_tlbstate export

commit 1e5476815fd7f98b888e01a0f9522b63085f96c9 upstream.

The recent changes for PTI touch cpu_tlbstate from various tlb_flush
inlines. cpu_tlbstate is exported as GPL symbol, so this causes a
regression when building out of tree drivers for certain graphics cards.

Aside of that the export was wrong since it was introduced as it should
have been EXPORT_PER_CPU_SYMBOL_GPL().

Use the correct PER_CPU export and drop the _GPL to restore the previous
state which allows users to utilize the cards they payed for.

As always I'm really thrilled to make this kind of change to support the
#friends (or however the hot hashtag of today is spelled) from that closet
sauce graphics corp.

Fixes: 1e02ce4cccdc ("x86: Store a per-cpu shadow copy of CR4")
Fixes: 6fd166aae78c ("x86/mm: Use/Fix PCID to optimize user/kernel switches")
Reported-by: Kees Cook <keescook@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Backlund <tmb@mageia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoparisc: qemu idle sleep support
Helge Deller [Fri, 5 Jan 2018 20:55:38 +0000 (21:55 +0100)]
parisc: qemu idle sleep support

commit 310d82784fb4d60c80569f5ca9f53a7f3bf1d477 upstream.

Add qemu idle sleep support when running under qemu with SeaBIOS PDC
firmware.

Like the power architecture we use the "or" assembler instructions,
which translate to nops on real hardware, to indicate that qemu shall
idle sleep.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoparisc: Fix alignment of pa_tlb_lock in assembly on 32-bit SMP kernel
Helge Deller [Tue, 2 Jan 2018 19:36:44 +0000 (20:36 +0100)]
parisc: Fix alignment of pa_tlb_lock in assembly on 32-bit SMP kernel

commit 88776c0e70be0290f8357019d844aae15edaa967 upstream.

Qemu for PARISC reported on a 32bit SMP parisc kernel strange failures
about "Not-handled unaligned insn 0x0e8011d6 and 0x0c2011c9."

Those opcodes evaluate to the ldcw() assembly instruction which requires
(on 32bit) an alignment of 16 bytes to ensure atomicity.

As it turns out, qemu is correct and in our assembly code in entry.S and
pacache.S we don't pay attention to the required alignment.

This patch fixes the problem by aligning the lock offset in assembly
code in the same manner as we do in our C-code.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agox86/microcode/AMD: Add support for fam17h microcode loading
Tom Lendacky [Thu, 30 Nov 2017 22:46:40 +0000 (16:46 -0600)]
x86/microcode/AMD: Add support for fam17h microcode loading

commit f4e9b7af0cd58dd039a0fb2cd67d57cea4889abf upstream.

The size for the Microcode Patch Block (MPB) for an AMD family 17h
processor is 3200 bytes.  Add a #define for fam17h so that it does
not default to 2048 bytes and fail a microcode load/update.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/20171130224640.15391.40247.stgit@tlendack-t1.amdoffice.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Alice Ferrazzi <alicef@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoInput: elantech - add new icbody type 15
Aaron Ma [Sun, 26 Nov 2017 00:48:41 +0000 (16:48 -0800)]
Input: elantech - add new icbody type 15

commit 10d900303f1c3a821eb0bef4e7b7ece16768fba4 upstream.

The touchpad of Lenovo Thinkpad L480 reports it's version as 15.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoARC: uaccess: dont use "l" gcc inline asm constraint modifier
Vineet Gupta [Fri, 8 Dec 2017 16:26:58 +0000 (08:26 -0800)]
ARC: uaccess: dont use "l" gcc inline asm constraint modifier

commit 79435ac78d160e4c245544d457850a56f805ac0d upstream.

This used to setup the LP_COUNT register automatically, but now has been
removed.

There was an earlier fix 3c7c7a2fc8811 which fixed instance in delay.h but
somehow missed this one as gcc change had not made its way into
production toolchains and was not pedantic as it is now !

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoiommu/arm-smmu-v3: Cope with duplicated Stream IDs
Robin Murphy [Tue, 2 Jan 2018 12:33:14 +0000 (12:33 +0000)]
iommu/arm-smmu-v3: Cope with duplicated Stream IDs

commit 563b5cbe334e9503ab2b234e279d500fc4f76018 upstream.

For PCI devices behind an aliasing PCIe-to-PCI/X bridge, the bridge
alias to DevFn 0.0 on the subordinate bus may match the original RID of
the device, resulting in the same SID being present in the device's
fwspec twice. This causes trouble later in arm_smmu_write_strtab_ent()
when we wind up visiting the STE a second time and find it already live.

Avoid the issue by giving arm_smmu_install_ste_for_dev() the cleverness
to skip over duplicates. It seems mildly counterintuitive compared to
preventing the duplicates from existing in the first place, but since
the DT and ACPI probe paths build their fwspecs differently, this is
actually the cleanest and most self-contained way to deal with it.

Fixes: 8f78515425da ("iommu/arm-smmu: Implement of_xlate() for SMMUv3")
Reported-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com>
Tested-by: Tomasz Nowicki <Tomasz.Nowicki@cavium.com>
Tested-by: Jayachandran C. <jnair@caviumnetworks.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoiommu/arm-smmu-v3: Don't free page table ops twice
Jean-Philippe Brucker [Thu, 14 Dec 2017 11:03:01 +0000 (11:03 +0000)]
iommu/arm-smmu-v3: Don't free page table ops twice

commit 57d72e159b60456c8bb281736c02ddd3164037aa upstream.

Kasan reports a double free when finalise_stage_fn fails: the io_pgtable
ops are freed by arm_smmu_domain_finalise and then again by
arm_smmu_domain_free. Prevent this by leaving pgtbl_ops empty on failure.

Fixes: 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agokernel/signal.c: remove the no longer needed SIGNAL_UNKILLABLE check in complete_signal()
Oleg Nesterov [Fri, 17 Nov 2017 23:30:08 +0000 (15:30 -0800)]
kernel/signal.c: remove the no longer needed SIGNAL_UNKILLABLE check in complete_signal()

commit 426915796ccaf9c2bd9bb06dc5702225957bc2e5 upstream.

complete_signal() checks SIGNAL_UNKILLABLE before it starts to destroy
the thread group, today this is wrong in many ways.

If nothing else, fatal_signal_pending() should always imply that the
whole thread group (except ->group_exit_task if it is not NULL) is
killed, this check breaks the rule.

After the previous changes we can rely on sig_task_ignored();
sig_fatal(sig) && SIGNAL_UNKILLABLE can only be true if we actually want
to kill this task and sig == SIGKILL OR it is traced and debugger can
intercept the signal.

This should hopefully fix the problem reported by Dmitry.  This
test-case

static int init(void *arg)
{
for (;;)
pause();
}

int main(void)
{
char stack[16 * 1024];

for (;;) {
int pid = clone(init, stack + sizeof(stack)/2,
CLONE_NEWPID | SIGCHLD, NULL);
assert(pid > 0);

assert(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
assert(waitpid(-1, NULL, WSTOPPED) == pid);

assert(ptrace(PTRACE_DETACH, pid, 0, SIGSTOP) == 0);
assert(syscall(__NR_tkill, pid, SIGKILL) == 0);
assert(pid == wait(NULL));
}
}

triggers the WARN_ON_ONCE(!(task->jobctl & JOBCTL_STOP_PENDING)) in
task_participate_group_stop().  do_signal_stop()->signal_group_exit()
checks SIGNAL_GROUP_EXIT and return false, but task_set_jobctl_pending()
checks fatal_signal_pending() and does not set JOBCTL_STOP_PENDING.

And his should fix the minor security problem reported by Kyle,
SECCOMP_RET_TRACE can miss fatal_signal_pending() the same way if the
task is the root of a pid namespace.

Link: http://lkml.kernel.org/r/20171103184246.GD21036@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: Kyle Huey <me@kylehuey.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Kyle Huey <me@kylehuey.com>
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>
6 years agokernel/signal.c: protect the SIGNAL_UNKILLABLE tasks from !sig_kernel_only() signals
Oleg Nesterov [Fri, 17 Nov 2017 23:30:04 +0000 (15:30 -0800)]
kernel/signal.c: protect the SIGNAL_UNKILLABLE tasks from !sig_kernel_only() signals

commit ac25385089f673560867eb5179228a44ade0cfc1 upstream.

Change sig_task_ignored() to drop the SIG_DFL && !sig_kernel_only()
signals even if force == T.  This simplifies the next change and this
matches the same check in get_signal() which will drop these signals
anyway.

Link: http://lkml.kernel.org/r/20171103184227.GC21036@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Tested-by: Kyle Huey <me@kylehuey.com>
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>
6 years agokernel/signal.c: protect the traced SIGNAL_UNKILLABLE tasks from SIGKILL
Oleg Nesterov [Fri, 17 Nov 2017 23:30:01 +0000 (15:30 -0800)]
kernel/signal.c: protect the traced SIGNAL_UNKILLABLE tasks from SIGKILL

commit 628c1bcba204052d19b686b5bac149a644cdb72e upstream.

The comment in sig_ignored() says "Tracers may want to know about even
ignored signals" but SIGKILL can not be reported to debugger and it is
just wrong to return 0 in this case: SIGKILL should only kill the
SIGNAL_UNKILLABLE task if it comes from the parent ns.

Change sig_ignored() to ignore ->ptrace if sig == SIGKILL and rely on
sig_task_ignored().

SISGTOP coming from within the namespace is not really right too but at
least debugger can intercept it, and we can't drop it here because this
will break "gdb -p 1": ptrace_attach() won't work.  Perhaps we will add
another ->ptrace check later, we will see.

Link: http://lkml.kernel.org/r/20171103184206.GB21036@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Tested-by: Kyle Huey <me@kylehuey.com>
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>
6 years agokernel: make groups_sort calling a responsibility group_info allocators
Thiago Rafael Becker [Thu, 14 Dec 2017 23:33:12 +0000 (15:33 -0800)]
kernel: make groups_sort calling a responsibility group_info allocators

commit bdcf0a423ea1c40bbb40e7ee483b50fc8aa3d758 upstream.

In testing, we found that nfsd threads may call set_groups in parallel
for the same entry cached in auth.unix.gid, racing in the call of
groups_sort, corrupting the groups for that entry and leading to
permission denials for the client.

This patch:
 - Make groups_sort globally visible.
 - Move the call to groups_sort to the modifiers of group_info
 - Remove the call to groups_sort from set_groups

Link: http://lkml.kernel.org/r/20171211151420.18655-1-thiago.becker@gmail.com
Signed-off-by: Thiago Rafael Becker <thiago.becker@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Acked-by: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
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>
6 years agonbd: fix use-after-free of rq/bio in the xmit path
Jens Axboe [Thu, 17 Nov 2016 19:30:37 +0000 (12:30 -0700)]
nbd: fix use-after-free of rq/bio in the xmit path

commit 429a787be6793554ee02aacc7e1f11ebcecc4453 upstream.

For writes, we can get a completion in while we're still iterating
the request and bio chain. If that happens, we're reading freed
memory and we can crash.

Break out after the last segment and avoid having the iterator
read freed memory.

Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agofscache: Fix the default for fscache_maybe_release_page()
David Howells [Tue, 2 Jan 2018 10:02:19 +0000 (10:02 +0000)]
fscache: Fix the default for fscache_maybe_release_page()

commit 98801506552593c9b8ac11021b0cdad12cab4f6b upstream.

Fix the default for fscache_maybe_release_page() for when the cookie isn't
valid or the page isn't cached.  It mustn't return false as that indicates
the page cannot yet be freed.

The problem with the default is that if, say, there's no cache, but a
network filesystem's pages are using up almost all the available memory, a
system can OOM because the filesystem ->releasepage() op will not allow
them to be released as fscache_maybe_release_page() incorrectly prevents
it.

This can be tested by writing a sequence of 512MiB files to an AFS mount.
It does not affect NFS or CIFS because both of those wrap the call in a
check of PG_fscache and it shouldn't bother Ceph as that only has
PG_private set whilst writeback is in progress.  This might be an issue for
9P, however.

Note that the pages aren't entirely stuck.  Removing a file or unmounting
will clear things because that uses ->invalidatepage() instead.

Fixes: 201a15428bd5 ("FS-Cache: Handle pages pending storage that get evicted under OOM conditions")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agosunxi-rsb: Include OF based modalias in device uevent
Stefan Brüns [Mon, 27 Nov 2017 19:05:34 +0000 (20:05 +0100)]
sunxi-rsb: Include OF based modalias in device uevent

commit e2bf801ecd4e62222a46d1ba9e57e710171d29c1 upstream.

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

Fixes a regression caused by commit 3f241bfa60bd ("arm64: allwinner: a64:
pine64: Use dcdc1 regulator for mmc0"). When the axp20x-rsb module for
the AXP803 PMIC is built as a module, it is not loaded and the system
ends up with an disfunctional MMC controller.

Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agocrypto: pcrypt - fix freeing pcrypt instances
Eric Biggers [Wed, 20 Dec 2017 22:28:25 +0000 (14:28 -0800)]
crypto: pcrypt - fix freeing pcrypt instances

commit d76c68109f37cb85b243a1cf0f40313afd2bae68 upstream.

pcrypt is using the old way of freeing instances, where the ->free()
method specified in the 'struct crypto_template' is passed a pointer to
the 'struct crypto_instance'.  But the crypto_instance is being
kfree()'d directly, which is incorrect because the memory was actually
allocated as an aead_instance, which contains the crypto_instance at a
nonzero offset.  Thus, the wrong pointer was being kfree()'d.

Fix it by switching to the new way to free aead_instance's where the
->free() method is specified in the aead_instance itself.

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: 0496f56065e0 ("crypto: pcrypt - Add support for new AEAD interface")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agocrypto: chacha20poly1305 - validate the digest size
Eric Biggers [Mon, 11 Dec 2017 20:15:17 +0000 (12:15 -0800)]
crypto: chacha20poly1305 - validate the digest size

commit e57121d08c38dabec15cf3e1e2ad46721af30cae upstream.

If the rfc7539 template was instantiated with a hash algorithm with
digest size larger than 16 bytes (POLY1305_DIGEST_SIZE), then the digest
overran the 'tag' buffer in 'struct chachapoly_req_ctx', corrupting the
subsequent memory, including 'cryptlen'.  This caused a crash during
crypto_skcipher_decrypt().

Fix it by, when instantiating the template, requiring that the
underlying hash algorithm has the digest size expected for Poly1305.

Reproducer:

    #include <linux/if_alg.h>
    #include <sys/socket.h>
    #include <unistd.h>

    int main()
    {
            int algfd, reqfd;
            struct sockaddr_alg addr = {
                    .salg_type = "aead",
                    .salg_name = "rfc7539(chacha20,sha256)",
            };
            unsigned char buf[32] = { 0 };

            algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
            bind(algfd, (void *)&addr, sizeof(addr));
            setsockopt(algfd, SOL_ALG, ALG_SET_KEY, buf, sizeof(buf));
            reqfd = accept(algfd, 0, 0);
            write(reqfd, buf, 16);
            read(reqfd, buf, 16);
    }

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: 71ebc4d1b27d ("crypto: chacha20poly1305 - Add a ChaCha20-Poly1305 AEAD construction, RFC7539")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agocrypto: n2 - cure use after free
Jan Engelhardt [Tue, 19 Dec 2017 18:09:07 +0000 (19:09 +0100)]
crypto: n2 - cure use after free

commit 203f45003a3d03eea8fa28d74cfc74c354416fdb upstream.

queue_cache_init is first called for the Control Word Queue
(n2_crypto_probe). At that time, queue_cache[0] is NULL and a new
kmem_cache will be allocated. If the subsequent n2_register_algs call
fails, the kmem_cache will be released in queue_cache_destroy, but
queue_cache_init[0] is not set back to NULL.

So when the Module Arithmetic Unit gets probed next (n2_mau_probe),
queue_cache_init will not allocate a kmem_cache again, but leave it
as its bogus value, causing a BUG() to trigger when queue_cache[0] is
eventually passed to kmem_cache_zalloc:

n2_crypto: Found N2CP at /virtual-devices@100/n2cp@7
n2_crypto: Registered NCS HVAPI version 2.0
called queue_cache_init
n2_crypto: md5 alg registration failed
n2cp f028687c: /virtual-devices@100/n2cp@7: Unable to register algorithms.
called queue_cache_destroy
n2cp: probe of f028687c failed with error -22
n2_crypto: Found NCP at /virtual-devices@100/ncp@6
n2_crypto: Registered NCS HVAPI version 2.0
called queue_cache_init
kernel BUG at mm/slab.c:2993!
Call Trace:
 [0000000000604488] kmem_cache_alloc+0x1a8/0x1e0
                  (inlined) kmem_cache_zalloc
                  (inlined) new_queue
                  (inlined) spu_queue_setup
                  (inlined) handle_exec_unit
 [0000000010c61eb4] spu_mdesc_scan+0x1f4/0x460 [n2_crypto]
 [0000000010c62b80] n2_mau_probe+0x100/0x220 [n2_crypto]
 [000000000084b174] platform_drv_probe+0x34/0xc0

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agokernel/acct.c: fix the acct->needcheck check in check_free_space()
Oleg Nesterov [Fri, 5 Jan 2018 00:17:49 +0000 (16:17 -0800)]
kernel/acct.c: fix the acct->needcheck check in check_free_space()

commit 4d9570158b6260f449e317a5f9ed030c2504a615 upstream.

As Tsukada explains, the time_is_before_jiffies(acct->needcheck) check
is very wrong, we need time_is_after_jiffies() to make sys_acct() work.

Ignoring the overflows, the code should "goto out" if needcheck >
jiffies, while currently it checks "needcheck < jiffies" and thus in the
likely case check_free_space() does nothing until jiffies overflow.

In particular this means that sys_acct() is simply broken, acct_on()
sets acct->needcheck = jiffies and expects that check_free_space()
should set acct->active = 1 after the free-space check, but this won't
happen if jiffies increments in between.

This was broken by commit 32dc73086015 ("get rid of timer in
kern/acct.c") in 2011, then another (correct) commit 795a2f22a8ea
("acct() should honour the limits from the very beginning") made the
problem more visible.

Link: http://lkml.kernel.org/r/20171213133940.GA6554@redhat.com
Fixes: 32dc73086015 ("get rid of timer in kern/acct.c")
Reported-by: TSUKADA Koutaro <tsukada@ascade.co.jp>
Suggested-by: TSUKADA Koutaro <tsukada@ascade.co.jp>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
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>
6 years agoled: modify ledring for mic board
Renjun Xu [Tue, 9 Jan 2018 07:53:15 +0000 (15:53 +0800)]
led: modify ledring for mic board

PD#157849: modify ledring for mic board

Change-Id: I81c8400ee559dcf6f2bc3620d75e449c360df4f3
Signed-off-by: Renjun Xu <renjun.xu@amlogic.com>
6 years agowifi: add wifi build in support[2/2]
Rongjun Chen [Tue, 5 Dec 2017 06:12:35 +0000 (14:12 +0800)]
wifi: add wifi build in support[2/2]

PD#158061: wifi: add wifi build in supportD

Change-Id: I42987b8579035cc0ca83d286f7a46fc0b83047e9
Signed-off-by: Rongjun Chen <rongjun.chen@amlogic.com>
6 years agoalarm: fixed the tiemerE counter's reading order
hong.guo [Tue, 9 Jan 2018 08:36:07 +0000 (16:36 +0800)]
alarm: fixed the tiemerE counter's reading order

PD#157845: fixed the tiemerE counter's reading order

Change-Id: Ieccfc2fded45da398fa45e957497eff670790fa6
Signed-off-by: hong.guo <hong.guo@amlogic.com>
6 years agoclocksource: arch_timer: make virtual counter access configurable
Greg Hackmann [Tue, 19 Sep 2017 17:55:17 +0000 (10:55 -0700)]
clocksource: arch_timer: make virtual counter access configurable

Change-Id: Ibdb1fd768b748002b90bfc165612c12c8311f8a2
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>