GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
19 months agomedia: dvb-frontends: Fix self assign warning
Stricted [Sat, 19 Jun 2021 23:13:05 +0000 (23:13 +0000)]
media: dvb-frontends: Fix self assign warning

Change-Id: Ie343bf04cdc1843395663d1ac5a09cd3a49a43ca

19 months agoamlogic: usb: Remove extra parentheses
Stricted [Sat, 19 Jun 2021 23:12:06 +0000 (23:12 +0000)]
amlogic: usb: Remove extra parentheses

Change-Id: Ide547d68899ef8150344b1f9d43e8db843317f63

19 months agoamlogic: mtd: Remove extra parentheses
Stricted [Sat, 19 Jun 2021 23:11:27 +0000 (23:11 +0000)]
amlogic: mtd: Remove extra parentheses

Change-Id: If0265d086d1f0453c0080b372878390f0050856f

19 months agoamlogic: mmc: Fix null check
Stricted [Sat, 19 Jun 2021 23:10:46 +0000 (23:10 +0000)]
amlogic: mmc: Fix null check

Change-Id: I08b33f1971b753cd443ac2006c08642414cee5fb

19 months agoamlogic: memory_ext: Fix sizeof-array-div warning
Stricted [Sat, 19 Jun 2021 23:09:39 +0000 (23:09 +0000)]
amlogic: memory_ext: Fix sizeof-array-div warning

Change-Id: Ief3bec13d2096c4d94bbbcb0e2654feec2c5dce9

19 months agoamlogic: tvout: Remove extra parentheses
Stricted [Sat, 19 Jun 2021 23:07:43 +0000 (23:07 +0000)]
amlogic: tvout: Remove extra parentheses

Change-Id: I4ec4b04576d043c5898263905a5db3ffa81a6c11

19 months agoamlogic: tvin: Fix enum conversion warnings
Stricted [Sat, 19 Jun 2021 23:06:58 +0000 (23:06 +0000)]
amlogic: tvin: Fix enum conversion warnings

Change-Id: Ib93abbeb272370b9e520a6eabdae8d9f1ca061cc

19 months agoamlogic: osd: Fix self assign warnings
Stricted [Sat, 19 Jun 2021 23:05:13 +0000 (23:05 +0000)]
amlogic: osd: Fix self assign warnings

Change-Id: Ib7cbf268dcaf9115c423f5fea3eb88c5819aea24

19 months agoamlogic: osd: Fix comparsion checks
Stricted [Sat, 19 Jun 2021 23:04:31 +0000 (23:04 +0000)]
amlogic: osd: Fix comparsion checks

Change-Id: Ide1f24ad8b6e6348df9ea5b1902116a2dc6ecae3

19 months agoamlogic: amvecm: Fix if check warnings
Stricted [Sat, 19 Jun 2021 23:03:23 +0000 (23:03 +0000)]
amlogic: amvecm: Fix if check warnings

Change-Id: If3696b4a33677f1a3d4db2fade1524a363d90fc7

19 months agoamlogic: di_multi: Fix enum conversion warnings
Stricted [Sat, 19 Jun 2021 22:56:03 +0000 (22:56 +0000)]
amlogic: di_multi: Fix enum conversion warnings

Change-Id: Ie4c96994a79d1e824ef375d2bb4868da1d41750a

19 months agoamlogic: deinterlace: Fix indentation
Stricted [Sat, 19 Jun 2021 22:53:25 +0000 (22:53 +0000)]
amlogic: deinterlace: Fix indentation

Change-Id: Ia49e62bcab7d4a0d49088e77b15234e8e783b096

19 months agoamlogic: hifi4dsp: Fix null check
Stricted [Sat, 19 Jun 2021 22:52:22 +0000 (22:52 +0000)]
amlogic: hifi4dsp: Fix null check

Change-Id: I3b8bc51863bb69662193d8e5e3f99f4319b81e65

19 months agoamlogic: esm: Fix indentation
Stricted [Sat, 19 Jun 2021 22:51:24 +0000 (22:51 +0000)]
amlogic: esm: Fix indentation

Change-Id: I48cb46f9b6bc1222a5a83273ed6e7f8329a5f2b9

19 months agoamlogic: clk: Remove unused variables
Stricted [Sat, 19 Jun 2021 22:50:37 +0000 (22:50 +0000)]
amlogic: clk: Remove unused variables

Change-Id: I252bdd6b66bc87db7a4242ef5ffdf880bc931a3a

19 months agovmscan: Fix enum conversion warning
Stricted [Sat, 19 Jun 2021 22:48:54 +0000 (22:48 +0000)]
vmscan: Fix enum conversion warning

Change-Id: Ib06e0e5ec2660eb63c14c5e4ad2b5d8bb2261467

19 months agotreewide: Remove unknown warning build flags
Stricted [Sat, 19 Jun 2021 22:46:42 +0000 (22:46 +0000)]
treewide: Remove unknown warning build flags

Change-Id: Ia6ebfc9a9438a0aff23a58fbb660b4e10f144db4

19 months agodrivers: net: usb: Import Google's Realtek RTL8152/RTL8153 changes
deadman96385 [Thu, 22 Jul 2021 00:31:04 +0000 (19:31 -0500)]
drivers: net: usb: Import Google's Realtek RTL8152/RTL8153 changes

Change-Id: I310354ab560e53b1d93bb9414423f51eabfb6b52

19 months agodrivers: amlogic: Import Google's OTG changes
deadman96385 [Thu, 22 Jul 2021 00:22:32 +0000 (19:22 -0500)]
drivers: amlogic: Import Google's OTG changes

Change-Id: I79dfd43e7fae1f79cac2e45e5bf081b2d16240db

19 months agodrivers: usb: Import Google's Type-C driver
deadman96385 [Thu, 22 Jul 2021 00:19:50 +0000 (19:19 -0500)]
drivers: usb: Import Google's Type-C driver

Change-Id: Ib224baf7f88334a07f1f1d106f4d0af36b59c72d

19 months agodrivers: usb: Import Google's role switch driver
deadman96385 [Thu, 22 Jul 2021 00:21:31 +0000 (19:21 -0500)]
drivers: usb: Import Google's role switch driver

Change-Id: Ie8e5b6759feea920d6fe903be43e94a8762842c1

19 months agodrivers: google: Import USB power monitor driver
deadman96385 [Wed, 21 Jul 2021 23:54:28 +0000 (18:54 -0500)]
drivers: google: Import USB power monitor driver

Change-Id: I5f56663798cbd790f4ec9f164e83d07404c157a3

19 months agohdmitx: adjust edid parsing [1/2]
xiang.wu1 [Tue, 25 Oct 2022 14:21:52 +0000 (22:21 +0800)]
hdmitx: adjust edid parsing [1/2]

PD#SWPL-97387
BUG=244782420

Problem:
TVTS/2.4_R2 failed

Solution:
remove useless parsing code, and adjust
edid parsing and fallback policy
1.if edid checksum invalid in any block,
or header of cta extension block is 0,
then use fallback mode list
2.if base block header invalid, or
checksum invalid, then don't parse
base block except dtd / standard timing
3.for cta extension block, if block
byte0 != 0x2, it means not valid
extension block, skip parsing whole
block. if block byte1 <= 2, it means
that it's DVI block, skip parsing data
block, just parse DTD.
4.fallback mode list:
480p/720p/1080p60hz, RGB,8bit, and uplayer
should use 720p60hz RGB,8bit by default

Verify:
ah212

Signed-off-by: xiang.wu1 <xiang.wu1@amlogic.com>
Change-Id: I6e4b04888ce097846d18acaf3ba0df3e92313440

19 months agoamvecm: merge stb eye protect for 4.9 [1/3]
MingLiang Dong [Tue, 28 Jun 2022 11:57:04 +0000 (19:57 +0800)]
amvecm: merge stb eye protect for 4.9 [1/3]

PD#SWPL-61674
PD#SWPL-88705
BUG=239526007
BUG=235156795

Problem:
merge stb eye protect for 4.9

Solution:
merge stb eye protect for 4.9

Verify:
verify on adt3

Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
Change-Id: I0f7979a588a98ffee5a4c20ef96a9dd941eae8ed

19 months agodts: add sg12a_s905y2_deadpool_1g.dts for 1G RAM [1/1]
yidong zhang [Mon, 27 Jun 2022 05:41:25 +0000 (13:41 +0800)]
dts: add sg12a_s905y2_deadpool_1g.dts for 1G RAM [1/1]

PD#SWPL-86236
BUG=236953393

Problem:
add sg12a_s905y2_deadpool_1g.dts for 1G RAM.

Solution:
add sg12a_s905y2_deadpool_1g.dts for 1G RAM.
increase codec_mm

Verify:
adt3

Change-Id: I7fafff5ba3f535e6d95e585b85e365e06cd1428e
Signed-off-by: yidong zhang <yidong.zhang@amlogic.com>
19 months agonet: fix nla_strcmp to handle more then one trailing null character
Maciej Żenczykowski [Wed, 5 May 2021 16:58:31 +0000 (09:58 -0700)]
net: fix nla_strcmp to handle more then one trailing null character

Android userspace has been using TCA_KIND with a char[IFNAMESIZ]
many-null-terminated buffer containing the string 'bpf'.

This works on 4.19 and ceases to work on 5.10.

I'm not entirely sure what fixes tag to use, but I think the issue
was likely introduced in the below mentioned 5.4 commit.

Reported-by: Nucca Chen <nuccachen@google.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Fixes: 62794fc4fbf5 ("net_sched: add max len check for TCA_KIND")
Change-Id: I66dc281f165a2858fc29a44869a270a2d698a82b
Signed-off-by: David S. Miller <davem@davemloft.net>
19 months agoAndroid T: green screen issue [1/1]
lele.liu [Thu, 9 Jun 2022 07:30:44 +0000 (15:30 +0800)]
Android T: green screen issue [1/1]

PD#SWPL-84229
BUG=234891437
BUG=235170159

Problem:
Connecting HDMI after 15+ seconds of device boot gives only green screen

Solution:
create new branch

Verify:
local

Signed-off-by: lele.liu <lele.liu@amlogic.com>
Change-Id: I3addbf52a0ffe2f4b101bc06a71e9c2ee9afcc9c

19 months agoUpdate ap6356 to bcmdhd.101.10.361.x
Hongguang [Fri, 3 Jun 2022 17:18:57 +0000 (10:18 -0700)]
Update ap6356 to bcmdhd.101.10.361.x

Bug: 232494797
Change-Id: Ifc2b73876a0895b7a442dc91aec783333a5ef874

19 months agoUpdate install script to use private modules.
Hongguang [Mon, 23 May 2022 23:56:59 +0000 (16:56 -0700)]
Update install script to use private modules.

Example:
./install_deadpool_artifacts.sh --build_id=8633315 \
   --install_path=/android/tm-tv-dev/device/askey/deadpool-kernel/

Change-Id: I9696a73449760e153a6c541c0478e512b45c70e7

19 months agoInstall firmwares
Hongguang [Tue, 24 May 2022 02:27:25 +0000 (19:27 -0700)]
Install firmwares

Bug: 220644706
Test: make and find the private modules in dist.
Change-Id: I4866d6ade1d13c640d26974d0a0590cba602fde7

19 months agoAdd two optee kos into private module list
Hongguang [Mon, 23 May 2022 23:54:20 +0000 (16:54 -0700)]
Add two optee kos into private module list

Bug: 220644706
Test: make and find the private modules in dist.
Change-Id: I20ce519c5bdea4db191aa20cf742efaebf326542

19 months agoAdd private modules list.
Hongguang [Mon, 23 May 2022 21:58:53 +0000 (14:58 -0700)]
Add private modules list.

Bug: 220644706
Test: make and find the private modules in dist.
Change-Id: Ic563fe6d2bc85a0255c6bc1ab363ce83cdc51793

19 months agoAdd a script to install deadpool artifacts from go/ab
Hongguang [Fri, 13 May 2022 21:43:25 +0000 (14:43 -0700)]
Add a script to install deadpool artifacts from go/ab

Bug: 220644706
Change-Id: I6eb8f7d50016def7275a35b3ca2d358f617a4181

19 months agoADT3: kernel build config file
Max Zhang [Wed, 11 May 2022 05:50:34 +0000 (05:50 +0000)]
ADT3: kernel build config file

Provide the kernel build config file for build server.

Bug: 220644706
Change-Id: Ib52f329fc7082de053fd37e20596d69c4dc7bfc0

19 months agoADT-3: Enable bandwidth limiting options
Max Zhang [Tue, 10 May 2022 18:30:19 +0000 (18:30 +0000)]
ADT-3: Enable bandwidth limiting options

Enable the following options to support go/bandwidth-limiting:
- CONFIG_NET_SCH_TBF
- CONFIG_NET_CLS_MATCHALL
- CONFIG_NET_ACT_POLICE
- CONFIG_NET_ACT_BPF

bug: 157552970
     181855645
Change-Id: I6c7609ca642858d1282c7ddd0e9b1583ff4f4165

19 months agotee: add vp9 prob interfaces [1/2]
Xiaohang Cui [Sun, 1 May 2022 13:13:50 +0000 (21:13 +0800)]
tee: add vp9 prob interfaces [1/2]

PD#SWPL-80006
b/229652967

Problem:
move vp9 prob process to Tee

Solution:
add interfaces for vp9 prob process

refer to:
https://scgit.amlogic.com/#/c/166331/

Verify:
android t + S905Y2-U221

Change-Id: I24002c71e537bef189f2cbfda86c9b855f43a23f
Signed-off-by: Xiaohang Cui <xiaohang.cui@amlogic.com>
19 months agov4lvideo: support max 128 fd [1/1]
jintao xu [Mon, 13 Sep 2021 10:32:59 +0000 (18:32 +0800)]
v4lvideo: support max 128 fd [1/1]

PD#SWPL-57099
b/228938762

Problem:
TvtsJankHostTestCases need keep too many fd

Solution:
support max 128 fd

Verify:
T3

Change-Id: I082d6252250614344130233f92baf3845c1048ba
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
19 months agovts: vts_ltp_test_arm fail [1/1]
weifang.liu [Sat, 2 Apr 2022 04:47:41 +0000 (12:47 +0800)]
vts: vts_ltp_test_arm fail [1/1]

PD#SWPL-75722

Problem:
need skip this test to rm CONFIG_CHECKPOINT_RESTORE

Solution:
rm CONFIG_CHECKPOINT_RESTORE to test

Verify:
Verify local

Change-Id: Ia53d0c5b55ee17e7223c418ddc8d23dfb97dcf56
Signed-off-by: weifang.liu <weifang.liu@amlogic.com>
19 months agodts: ramoops: enable ramoops [1/1]
pengzhao.liu [Wed, 30 Mar 2022 09:29:29 +0000 (17:29 +0800)]
dts: ramoops: enable ramoops [1/1]

PD#SWPL-76989
Bug: 227141269

Problem:
enable ramoops ramoops

Solution:
enable ramoops ramoops

Verify:
adt3

Signed-off-by: pengzhao.liu <pengzhao.liu@amlogic.com>
Change-Id: I76b01359c048f9945ccfbde676c14d218510b17a

19 months agovts: 2 Testcases failed in the module "vts_fs_test" [1/2]
hao.qi [Tue, 29 Mar 2022 09:35:43 +0000 (17:35 +0800)]
vts: 2 Testcases failed in the module "vts_fs_test" [1/2]

PD#SWPL-75717
b/225279764

Problem:
2 Testcases failed in the module "vts_fs_test"

Solution:
change data partition to userdata
move partition mount from dts to fstab

Verify:
S905Y2-U221

Change-Id: I4a530337ef8c4220b68b3b1a49860c89044b89f9
Signed-off-by: hao.qi <hao.qi@amlogic.com>
19 months agoANDROID: selinux: modify RTM_GETNEIGH [1/1]
pengzhao.liu [Tue, 22 Mar 2022 06:03:33 +0000 (14:03 +0800)]
ANDROID: selinux: modify RTM_GETNEIGH [1/1]

PD#SWPL-71742
Bug: 171572148

Problem:
Map the permission gating RTM_GETNEIGH/RTM_GETNEIGHTBL messages to a
new permission so that it can be distinguished from the other netlink
route permissions in selinux policy. The new permission is triggered by
a flag set in system images T and up.

Solution:
This change is intended to be backported to all kernels that a T system
image can run on top of.

Verify:
on adt3-t kernel

Test: ateddst NetworkInterfaceTest
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Test: atest bionic-unit-tests-static
Test: On Cuttlefish, run combinations of:
    - Policy bit set or omitted (see https://r.android.com/1701847)
    - This patch applied or omitted
    - App having nlmsg_readneigh permission or not
  Verify that only the combination of this patch + the policy bit being
  set + the app not having the nlmsg_readneigh permission prevents the
  app from sending RTM_GETNEIGH messages.

Change-Id: I4bcfce4decb34ea9388eeedfc4be67403de8a980
Signed-off-by: Bram Bonné <brambonne@google.com>
Signed-off-by: pengzhao.liu <pengzhao.liu@amlogic.com>
Change-Id: Ic9d51cebab8c195537d54a28a23a7e93f09ba0b3

19 months agovts: netd_integration_test fail [1/1]
weifang.liu [Fri, 18 Mar 2022 07:13:06 +0000 (15:13 +0800)]
vts: netd_integration_test fail [1/1]

PD#SWPL-75333
BUG=225139017

Problem:
KernelTest#TestRateLimitingSupport fail

Solution:
add related kernel config

Verify:
local

Change-Id: Id1ec210fbe5d927061a70675652523079934b522
Signed-off-by: weifang.liu <weifang.liu@amlogic.com>
19 months agoMerge changes Ifc5bd922,I57affad1,I92d3d3ce into android-tv-deadpool-4.9-android12
TreeHugger Robot [Tue, 4 Jan 2022 20:28:48 +0000 (20:28 +0000)]
Merge changes Ifc5bd922,I57affad1,I92d3d3ce into android-tv-deadpool-4.9-android12

* changes:
  VPP: VPP code style modify [1/1]
  vpp: coding style modify [1/1]
  vpp: coding style modify [2/6]

19 months agoRevert "Enable CONFIG_DM_BOW for checkpointing"
Robin Lee [Thu, 4 Nov 2021 07:26:45 +0000 (07:26 +0000)]
Revert "Enable CONFIG_DM_BOW for checkpointing"

This reverts commit 830f673c981ba4da2663a91cc8590eed9fc2032e.

Reason for revert: Merged wrong CL

Change-Id: I16d4614c52a41f48fb657db48caff92aa5bff419

19 months agoMerge "Enable CONFIG_DM_BOW for checkpointing" into android-tv-deadpool-4.9-android12
Robin Lee [Thu, 4 Nov 2021 07:26:28 +0000 (07:26 +0000)]
Merge "Enable CONFIG_DM_BOW for checkpointing" into android-tv-deadpool-4.9-android12

19 months agovts: vts_kernel_checkpoint_test [1/2]
lele.liu [Thu, 4 Nov 2021 01:46:43 +0000 (01:46 +0000)]
vts: vts_kernel_checkpoint_test [1/2]

PD#SWPL-63211

Problem:
short of dm_bow config

Solution:
enable dm_bow config

Verify:
local

Change-Id: I503d20b44651b91ab13449d51814c2b1b668d9d7
Signed-off-by: lele.liu <lele.liu@amlogic.com>
19 months agoRevert "fstab: checkpoint configuration [1/1]"
liang ji [Thu, 4 Nov 2021 02:57:34 +0000 (02:57 +0000)]
Revert "fstab: checkpoint configuration [1/1]"

This reverts commit 8e0c306593c39066dca21a87151dcfba4a1c3957.

Reason for revert:
Reason for revert: a better formatted patch will be submitted later

Change-Id: Ieb7dfa4f0bcbec9a4e26904618575baf840741e7

19 months agofstab: checkpoint configuration [1/1]
Pengfei Zhao [Wed, 3 Nov 2021 14:47:34 +0000 (22:47 +0800)]
fstab: checkpoint configuration [1/1]

PD#NONE

Problem:
vts_kernel_checkpoint_test fail

Solution:
add config checkpoint and DB_BOW

Verify:
adt3

Signed-off-by: Pengfei Zhao <pengfei.zhao@amlogic.com>
Change-Id: I62102ab3d2c37afbb40c7c7a3e4ca212d83fe7e3

19 months agoadt3: Release 52 MB of unused memory allocated in "ion-dev" [1/1]
Liang Ji [Tue, 19 Oct 2021 02:12:12 +0000 (10:12 +0800)]
adt3: Release 52 MB of unused memory allocated in "ion-dev" [1/1]

PD#SWPL-61729
BUG=203412562

Problem:
Release 52 MB of unused memory allocated in "ion-dev"

Solution:
Release 52 MB of unused memory allocated in "ion-dev"

Verify:
adt3-S

Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Change-Id: I87a24212cbf5b6ffac39fff94d52c498b226bb65

19 months agoBACKPORT: gup: document and work around "COW can break either way" issue
yao zhang1 [Fri, 15 Oct 2021 06:45:28 +0000 (06:45 +0000)]
BACKPORT: gup: document and work around "COW can break either way" issue

PD#SWPL-61507
BUG=202208062

commit 17839856fd588f4ab6b789f482ed3ffd7c403e1f upstream.

Doing a "get_user_pages()" on a copy-on-write page for reading can be
ambiguous: the page can be COW'ed at any time afterwards, and the
direction of a COW event isn't defined.

Yes, whoever writes to it will generally do the COW, but if the thread
that did the get_user_pages() unmapped the page before the write (and
that could happen due to memory pressure in addition to any outright
action), the writer could also just take over the old page instead.

End result: the get_user_pages() call might result in a page pointer
that is no longer associated with the original VM, and is associated
with - and controlled by - another VM having taken it over instead.

So when doing a get_user_pages() on a COW mapping, the only really safe
thing to do would be to break the COW when getting the page, even when
only getting it for reading.

At the same time, some users simply don't even care.

For example, the perf code wants to look up the page not because it
cares about the page, but because the code simply wants to look up the
physical address of the access for informational purposes, and doesn't
really care about races when a page might be unmapped and remapped
elsewhere.

This adds logic to force a COW event by setting FOLL_WRITE on any
copy-on-write mapping when FOLL_GET (or FOLL_PIN) is used to get a page
pointer as a result.

The current semantics end up being:

 - __get_user_pages_fast(): no change. If you don't ask for a write,
   you won't break COW. You'd better know what you're doing.

 - get_user_pages_fast(): the fast-case "look it up in the page tables
   without anything getting mmap_sem" now refuses to follow a read-only
   page, since it might need COW breaking.  Which happens in the slow
   path - the fast path doesn't know if the memory might be COW or not.

 - get_user_pages() (including the slow-path fallback for gup_fast()):
   for a COW mapping, turn on FOLL_WRITE for FOLL_GET/FOLL_PIN, with
   very similar semantics to FOLL_FORCE.

If it turns out that we want finer granularity (ie "only break COW when
it might actually matter" - things like the zero page are special and
don't need to be broken) we might need to push these semantics deeper
into the lookup fault path.  So if people care enough, it's possible
that we might end up adding a new internal FOLL_BREAK_COW flag to go
with the internal FOLL_COW flag we already have for tracking "I had a
COW".

Alternatively, if it turns out that different callers might want to
explicitly control the forced COW break behavior, we might even want to
make such a flag visible to the users of get_user_pages() instead of
using the above default semantics.

But for now, this is mostly commentary on the issue (this commit message
being a lot bigger than the patch, and that patch in turn is almost all
comments), with that minimal "enable COW breaking early" logic using the
existing FOLL_WRITE behavior.

[ It might be worth noting that we've always had this ambiguity, and it
  could arguably be seen as a user-space issue.

  You only get private COW mappings that could break either way in
  situations where user space is doing cooperative things (ie fork()
  before an execve() etc), but it _is_ surprising and very subtle, and
  fork() is supposed to give you independent address spaces.

  So let's treat this as a kernel issue and make the semantics of
  get_user_pages() easier to understand. Note that obviously a true
  shared mapping will still get a page that can change under us, so this
  does _not_ mean that get_user_pages() somehow returns any "stable"
  page ]

[surenb: backport notes
Replaced (gup_flags | FOLL_WRITE) with write=1 in gup_pgd_range.
Removed FOLL_PIN usage in should_force_cow_break since it's missing in
the earlier kernels.
        Since gup_pgd_range does not exist, made appropriate changes on
        the the gup_huge_pgd, gup_huge_pd and gup_pud_range calls]

Reported-by: Jann Horn <jannh@google.com>
Tested-by: Christoph Hellwig <hch@lst.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kirill Shutemov <kirill@shutemov.name>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[surenb: backport to 4.9 kernel]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: yao zhang1 <yao.zhang1@amlogic.com>
Change-Id: I877999f7b789aee6078ccade2ae54b827d88368f

19 months agov4lvideo: workaround for ctsMediaTest
binqi zhang [Thu, 30 Sep 2021 12:08:35 +0000 (20:08 +0800)]
v4lvideo: workaround for ctsMediaTest

PD#SWPL-54808
BUG=197895076

Problem:
CtsMediaTestCases 44 DecodeAccuracyTest cases failed

Solution:
add extend column and row for special resolution cts
add dump yuv data interface
add debug flag for cts workaround

Verify:
adt3

Change-Id: Ie461422fddab008d4d905930f5f40a612bb1a98b
Signed-off-by: binqi zhang <binqi.zhang@amlogic.com>
Signed-off-by: Pengfei Zhao <pengfei.zhao@amlogic.com>
19 months agomemory: use new stratedy for all R+ device [2/2]
Shuide Chen [Wed, 22 Sep 2021 10:33:29 +0000 (18:33 +0800)]
memory: use new stratedy for all R+ device [2/2]

SWPL-59636

Problem:
cma shrinker is not standard implement, which may cause
app being unexpected killed

Solution:
use lmkd to kill app.
disable cma shrinker

Signed-off-by: Shuide Chen <shuide.chen@amlogic.com>
Change-Id: I9e510f837047fdb2c8617efb3ba403c69d8f1b9c

19 months agoionvideo: support no drop i for cts [1/1]
jintao xu [Tue, 20 Jul 2021 12:47:54 +0000 (20:47 +0800)]
ionvideo: support no drop i for cts [1/1]

PD#SWPL-54823

Problem:
ionvideo drop i cause cts fail

Solution:
ionvideo not drop i

Verify:
U221

Change-Id: Icbfcb56b69a657a43aaee26428568a5140836167
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
19 months agov4lvideo: set field V4L2_FIELD_INTERLACED when video is interlace [1/2]
jintao xu [Fri, 21 Aug 2020 09:04:16 +0000 (17:04 +0800)]
v4lvideo: set field V4L2_FIELD_INTERLACED when video is interlace [1/2]

PD#SWPL-32080

Problem:
omx need know interlace or not

Solution:
v4lvideo sent interlace info to omx

Verify:
AH212

Change-Id: I4ce4c5e8aeafe5ed920855cc5e1f3f2245eec9ce
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
19 months agoDisable debugfs in ADT3 kernel
Max Zhang [Mon, 13 Sep 2021 23:18:17 +0000 (23:18 +0000)]
Disable debugfs in ADT3 kernel

debug_fs should be disable in release build and pass XTS

Change-Id: Ica01a743a9ad64dab3c79ff00edea5d92202fd8e

19 months agohdmitx: add extra uevents to supplement extcon [4/4]
hang cheng [Wed, 1 Sep 2021 12:50:35 +0000 (20:50 +0800)]
hdmitx: add extra uevents to supplement extcon [4/4]

PD#SWPL-57172

Problem:
hal can't receive suspend/resume uevent
on android S + 4.9-q

Solution:
add extra uevents to supplement extcon;
on android S, it will only listen to uevent
on android Q, it will only listen to extcon

Verify:
u221

Change-Id: I52fbe9756a824d6876753ae3ff36c7bb7b9b6f97
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agohdmitx: correct hdmipwr uevent init state [3/4]
hang cheng [Fri, 7 May 2021 09:09:13 +0000 (17:09 +0800)]
hdmitx: correct hdmipwr uevent init state [3/4]

PD#SWPL-49008

Problem:
hdmi early suspend uevent is not received by sysctl

Solution:
correct hdmipwr uevent init state

Verify:
AC214

Change-Id: I91f4e1643a58d54a8d0ca0f8cf50bd9ab6e1bd13
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agohdmitx: adjust the hdmi resume power uevent [2/4]
Zongdong Jiao [Tue, 10 Aug 2021 05:15:14 +0000 (13:15 +0800)]
hdmitx: adjust the hdmi resume power uevent [2/4]

PD#SWPL-56597

Problem:
Current the hdmi resume power uevent is early and before reading
edid, and this will make application can't get sink capability and
set the 480p as default

Solution:
Adjust the hdmi resume power uevent after reading edid

Verify:
g12/u212

Change-Id: I20acd118762d167ccfbf790c8fbace3171b0fda3
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
19 months agohdmitx: head the hdmi_pwr in resume [1/4]
Zongdong Jiao [Mon, 26 Jul 2021 14:21:29 +0000 (22:21 +0800)]
hdmitx: head the hdmi_pwr in resume [1/4]

PD#SWPL-55323

Problem:
the hdmi_pwr is too late in resume

Solution:
head the hdmi_pwr in resume

Verify:
G12/U212

Change-Id: I86bd4dfd0c6b51578cb09fd4fc8902b858de9eae
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
19 months agoosd: avoid color_info NULL [1/1]
jian.cao [Fri, 27 Aug 2021 06:21:43 +0000 (14:21 +0800)]
osd: avoid color_info NULL [1/1]

PD#SWPL-57980

Problem:
after the device is powered on
plug in the HDMI cable a few seconds
then OSD panic

Solution:
avoid color_info NULL

Verify:
g12a

Change-Id: I69202bc06d889e59a391b50b609237689eb29d31
Signed-off-by: jian.cao <jian.cao@amlogic.com>
19 months agodefconfig: open DEBUG_FS by defconfig [1/1]
song.han [Mon, 23 Aug 2021 08:32:52 +0000 (16:32 +0800)]
defconfig: open DEBUG_FS by defconfig [1/1]

PD#SWPL-57714

Problem:
can't open DEBUG_FS by Kconfig

Solution:
CONFIG_DEBUG_FS=y

Verify:
local

Change-Id: Idc201854cb819c23059f981eab6f7341273ba58e
Signed-off-by: song.han <song.han@amlogic.com>
19 months agomedia: osd: fix depend error in arm32 user version [2/4]
jian.cao [Tue, 3 Aug 2021 06:39:42 +0000 (14:39 +0800)]
media: osd: fix depend error in arm32 user version [2/4]

PD#SWPL-47101

Problem:
CONFIG_AMLOGIC_MEDIA_FB_OSD_SYNC_FENCE depends on CONFIG_DEBUG_FS
and is not enabled in arm32 user version

Solution:
fix depend error

Verify:
s4 ap222

Change-Id: I5ff794630ca933cb33c523b49b83f6185c18182d
Signed-off-by: jian.cao <jian.cao@amlogic.com>
(cherry picked from commit 8e8cabbd2b8a20ce4e06d7898682b2665187012c)

19 months agoKconfig: close DEBUG_FS select by TRACING [3/4]
song.han [Fri, 13 Aug 2021 08:18:23 +0000 (16:18 +0800)]
Kconfig: close DEBUG_FS select by TRACING [3/4]

PD#SWPL-57714

Problem:
can't close DEBUG_FS by config

Solution:
modify Kconfig about TRACING

Verify:
local

Change-Id: I6b926143fd94f952214e0f1fff2551fb891b1020
Signed-off-by: song.han <song.han@amlogic.com>
19 months agoclkmsr: adjust register debugfs [1/4]
Bichao Zheng [Mon, 16 Aug 2021 08:00:54 +0000 (16:00 +0800)]
clkmsr: adjust register debugfs [1/4]

PD#SWPL-57735

Problem:
close DEBUG_FS then clkmsr crash.

Solution:
adjust register debugfs

Verify:
g12a_u212

Change-Id: I7988c6d4a9508dad26a6f886289ec3509c0af1df
Signed-off-by: Bichao Zheng <bichao.zheng@amlogic.com>
19 months agohdmitx: fix edid parse crash [1/1]
hang cheng [Tue, 29 Jun 2021 12:59:51 +0000 (20:59 +0800)]
hdmitx: fix edid parse crash [1/1]

PD#SWPL-56548

Problem:
may block during spinlock cause crash

Solution:
move block outside of spinlock

Verify:
AB311

Change-Id: If0086cf3dd53b3426c8c2132e4718e36d06cb866
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agoIncrease framebuffer memory pool so it can hold 6 framebuffers [1/1]
Liang Ji [Tue, 10 Aug 2021 06:47:05 +0000 (14:47 +0800)]
Increase framebuffer memory pool so it can hold 6 framebuffers [1/1]

PD#GH-1202
BUG=190485198

Problem:
Increase framebuffer memory pool so it can hold 6 framebuffers

Solution:
Increase framebuffer memory pool so it can hold 6 framebuffers

Verify:
adt3

Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Change-Id: I2711107539efacdb810e8e10ca1f14f3e3d14533

19 months agohdmitx: correct the unit of physical size [1/1]
Zongdong Jiao [Tue, 27 Jul 2021 11:45:30 +0000 (19:45 +0800)]
hdmitx: correct the unit of physical size [1/1]

PD#SWPL-54362

Problem:
The physical size is cm, while the screen size is mm.
Need unify the unit.

Solution:
Correct the unit of physical size as mm.

Verify:
g12/u212

Change-Id: I0c1f3d71f2df4930d8a91f692b713ad537133a55
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
19 months agoAndroid S bt: kernel get BT-WAKE,do not send power key[1/1]
lele.liu [Wed, 28 Jul 2021 06:34:12 +0000 (14:34 +0800)]
Android S bt: kernel get BT-WAKE,do not send power key[1/1]

PD#SWPL-49147

Problem:
Bluetooth wakes up device unexpectedly

Solution:
kernel get BT-WAKE,do not send power key

Verify:
local

Signed-off-by: lele.liu <lele.liu@amlogic.com>
Change-Id: I8ccc0a719f8b54537b932c66f29a52c4a956d69b
Signed-off-by: lele.liu <lele.liu@amlogic.com>
19 months agocec: fix complie issue [1/1]
hang cheng [Mon, 7 Jun 2021 11:20:36 +0000 (19:20 +0800)]
cec: fix complie issue [1/1]

PD#SWPL-52256

Problem:
CONFIG_AMLOGIC_HDMITX macro is not defined on
TV platform, cause complie issue

Solution:
fix complie issue

Verify:
am301

Change-Id: Ib9bcfe3d613f8affe2469adcce4383b315eee3fc
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agovideo_composer: add in the uvm type to check whether has vframe. [1/1]
jintao xu [Mon, 21 Jun 2021 06:43:18 +0000 (14:43 +0800)]
video_composer: add in the uvm type to check whether has vframe. [1/1]

PD#SWPL-52333

Problem:
hdmitx audio setting function is called on TV
platform and cause crash

Solution:
if hdmitx driver is not enabled, export function
just return

Verify:
pb

Signed-off-by: jintao xu <jintao.xu@amlogic.com>
Change-Id: Ic87135d8621a2a37e74c2ac8ddc6d7096e3d75d1

19 months agoion: add fb heap for hw-fb [1/1]
Dezhi Kong [Fri, 19 Mar 2021 08:23:10 +0000 (16:23 +0800)]
ion: add fb heap for hw-fb [1/1]

PD#SWPL-45003

Problem:
hw-fb may alloc fail from cma heap,
which will result in display messed up

Solution:
add a separate ion fb heap only used for HW_FB

Verify:
sm1-newton-ac214
g12a-franklin-u212

Change-Id: I154fe5c61ad1c92cfc652234a093090284c4d2f3
Signed-off-by: Dezhi Kong <dezhi.kong@amlogic.com>
19 months agocts: fix CtsDownloadManagerApi28 1 fail [1/2]
Yonghui Yu [Fri, 18 Jun 2021 14:03:06 +0000 (22:03 +0800)]
cts: fix CtsDownloadManagerApi28 1 fail [1/2]

PD#SWPL-51104

Problem:
CtsDownloadManagerApi28 fail because of ioctrl
failure on EXT4_IOC_FSGETXATTR and EXT4_IOC_FSSETXATTR.

Solution:
Add those two IOC to the compat_ioctrl.

Verify:
adt3

Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
Change-Id: I2ed64202819b15d6b8aa75b6aefd255a3580cbd1

19 months agopicdec: skip putting vframe if current buffer is being in used [1/1]
Cao Jian [Wed, 16 Jun 2021 05:51:44 +0000 (13:51 +0800)]
picdec: skip putting vframe if current buffer is being in used [1/1]

PD#SWPL-52807

Problem:
GIF pictures flicker after quickly switching pictures

Solution:
skip putting vframe if current buffer is being in used

Verify:
on t5

Change-Id: Id1366ead409967a6055d5de5413f16774407c778
Signed-off-by: Cao Jian <jian.cao@amlogic.com>
19 months agohdmitx: enhance robustness for export function [1/1]
hang cheng [Tue, 15 Jun 2021 06:37:48 +0000 (14:37 +0800)]
hdmitx: enhance robustness for export function [1/1]

PD#SWPL-52333

Problem:
hdmitx audio setting function is called on TV
platform and cause crash

Solution:
if hdmitx driver is not enabled, export function
just return

Verify:
am301

Change-Id: I5e369e6951dfbb5da1784a7245b9c08bc7684c6f
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agoemmc: build fake bootloader0 & bootloader1 [1/1]
Ruixuan Li [Tue, 8 Jun 2021 07:31:23 +0000 (15:31 +0800)]
emmc: build fake bootloader0 & bootloader1 [1/1]

PD#SWPL-52307

Problem:
need bootloader0 & bootloader1 offset from 1 sector

Solution:
add fake partition

Verify:
passed on t3_t982

Signed-off-by: Ruixuan Li <ruixuan.li@amlogic.com>
Change-Id: Iddac88632af72fb9251a19c4941efc9a29cd6b59

19 months agodemux: clean demux output buffer [1/1]
Pengfei Liu [Tue, 15 Jun 2021 09:07:46 +0000 (17:07 +0800)]
demux: clean demux output buffer [1/1]

PD#SWPL-52784

Problem:
 dmx have remaining data.

Solution:
 clean dmx output buffer

Verify:
 verified at vo svp.

Signed-off-by: Pengfei Liu <pengfei.liu@amlogic.com>
Change-Id: Ia392e83533a0ec8e3b6d9ed13a219a07a23eced3

19 months agohdmitx: fix 1.4 cts 7-19 [1/2]
hang cheng [Thu, 10 Jun 2021 04:41:43 +0000 (12:41 +0800)]
hdmitx: fix 1.4 cts 7-19 [1/2]

PD#SWPL-52240

Problem:
hdmi1.4 cts 7-19 fail, it will sent
non-zero CD in GCP under y422

Solution:
set CD of GCP to 0 when EDID not support
deep color

Verify:
ap222

Change-Id: I500a470188d6f045ff054ac4ac44fce09f64a6af
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agoosd: fix osd dummy alpha set error issue [1/1]
Pengcheng Chen [Wed, 2 Jun 2021 01:57:30 +0000 (09:57 +0800)]
osd: fix osd dummy alpha set error issue [1/1]

PD#SWPL-51971

Problem:
osd dummy alpha error in 1080i

Solution:
fix osd dummy alpha set in 1080i

Verify:
u212

Change-Id: Iaa7271fd3def8fde3098fb517010f0650fe3c096
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
19 months agosc2: AUCPU secure fw loading [3/4]
Lawrence Mok [Wed, 3 Mar 2021 01:17:17 +0000 (17:17 -0800)]
sc2: AUCPU secure fw loading [3/4]

PD#SWPL-49064

Problem:
Need to support signed and encrypted AUCPU firmware.

Solution:
Add bl31 smc command to load signed/encrypted fw

Verify:
Load signed/encrypted AUCPU fw:
  Sign/encrypt aucpu_fw.bin
  mkdir /lib/firmware
  cp -v aucpu_fw.bin.dblk /lib/firmware/aucpu_fw.bin
  insmod aml_aucpu.ko print_level=0

Change-Id: Ib63e4332e5a21f27787365a2df59c0a69ccd1537
Signed-off-by: Lawrence Mok <lawrence.mok@amlogic.com>
19 months agoSTR: fix suspend abort cause system resume by powerkey event [1/1]
Qiufang Dai [Mon, 7 Jun 2021 12:58:00 +0000 (20:58 +0800)]
STR: fix suspend abort cause system resume by powerkey event [1/1]

PD#SWPL-52156

Problem:
When suspend abort happens, device driver resume call back call
get_resume_method() which always feedback the last resume method.
It cause a wrong powerkey event report by driver resume call back.

Solution:
Clr resume method in suspend prepare notify.
Provide a stationary get_resume_reason() api.

Verify:
SC2_AH212

Change-Id: I4f6577201125af6ce93dfc36b24b4c80fd812e46
Signed-off-by: Qiufang Dai <qiufang.dai@amlogic.com>
19 months agodemux: pts secure mem protect fail [1/1]
Chuangcheng Peng [Wed, 9 Jun 2021 08:06:43 +0000 (16:06 +0800)]
demux: pts secure mem protect fail [1/1]

PD#SWPL-52439

Problem:
 can't get video data

Solution:
 pts secure mem protect fail, it need 64K alignm.
 pointer don't use cache.

Verify:
 verified at AH219

Signed-off-by: Chuangcheng Peng <chuangcheng.peng@amlogic.com>
Change-Id: I52ddb975eb1d455ca38108fbcabb3895bb646b1c

19 months agocodec_mm: Modify a warning print for tvp free [1/1]
shipeng.sun [Mon, 7 Jun 2021 02:05:26 +0000 (10:05 +0800)]
codec_mm: Modify a warning print for tvp free [1/1]

PD#SWPL-52149

Problem:
Modify a warning print for tvp free

Solution:
1. Modify a warning print when tvp pool free later.

Verify:
local

Change-Id: I958ff7e8c4db5a0900e7d23eda337490567e044e
Signed-off-by: shipeng.sun <shipeng.sun@amlogic.com>
19 months agoDV: FEL display black in adaptive mode [1/1]
yao liu [Wed, 2 Jun 2021 10:30:15 +0000 (18:30 +0800)]
DV: FEL display black in adaptive mode [1/1]

PD#SWPL-51701

Problem:
FEL is treat as SDR video, but still send
dv vsif pkt

Solution:
not send hdmi visf pkt ahead for FEL

Verify:
sc2

Signed-off-by: yao liu <yao.liu@amlogic.com>
Change-Id: I708af63d0e818083a6f1e8365bd19c5e8a065b22

19 months agohdmirx: add hdmi plug & cec rx msg uevent [1/1]
hang cheng [Sat, 8 May 2021 10:16:59 +0000 (18:16 +0800)]
hdmirx: add hdmi plug & cec rx msg uevent [1/1]

PD#SWPL-47310

Problem:
1.need hdmi plug uevent to check connection status
2.need cec rx msg uevent instead of poll
3.hdmitx hdcp result for uevent is wrong

Solution:
1.add hdmitx/rx hotplug & cec rx msg uevent
2.correct hdcp result for drm uevent

Verify:
ab311

Change-Id: I60bc0e869770965df676ff22801ee1ff7981916b
Signed-off-by: hang cheng <hang.cheng@amlogic.com>
19 months agonand: fix some parameter modification [1/1]
Liang Yang [Thu, 3 Jun 2021 09:36:02 +0000 (17:36 +0800)]
nand: fix some parameter modification [1/1]

PD#SWPL-50970

Problem:
nand base interface is changed after sync

Solution:
fix the interface which is changed.

Verify:
none

Change-Id: I97946d2e5b400ade809ffe1b935c469aad7c38f2
Signed-off-by: Liang Yang <liang.yang@amlogic.com>
19 months agoadt3-S kernel/common source code [1/1]
Liang Ji [Tue, 15 Jun 2021 02:23:51 +0000 (10:23 +0800)]
adt3-S kernel/common source code [1/1]

internal tot CL:
BACKPORT: HID: playstation: Add device ids to hid_have_special_driver list.

SWPL-52212

On 4.9 and 4.14 kernel we need to put the hid device ids to
hid_have_special_driver list, to instruct kernel to use special driver
rather than hid-generic.
Fixed the incorrect kernel device type on 4.9 kernel and 4.14 kernel.

Bug: 185139160

Signed-off-by: Chris Ye <lzye@google.com>
Change-Id(Iced67cda47bc83f34a46c2de03b2906e788e56d2)

Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Change-Id: I3aaeb4c6153ab8f7516ea1f290a9e27da80b3765

19 months agoRevert "media: dvb_frontend: get rid of set_property() callback"
Christian Hoffmann [Mon, 6 Feb 2023 20:58:43 +0000 (21:58 +0100)]
Revert "media: dvb_frontend: get rid of set_property() callback"

This partially reverts commit 43619b35587ebef4070f5f4d61761766e0e3136a as amlogic relies on it

Change-Id: Ia72198b7d64ff1e54d5deedc08964d8cf9729efa

19 months agoMerge android.googlesource.com/kernel/common
Christian Hoffmann [Sun, 12 Feb 2023 08:08:38 +0000 (09:08 +0100)]
Merge android.googlesource.com/kernel/common

* Branch: android-4.9-q
* SHA1: e7f15a9ebb2885905683dce8e287ada8f8aca0f2
* Version: 4.9.269

19 months agoRevert "dvb: add 32/64 bits compatibility support"
Christian Hoffmann [Sat, 4 Feb 2023 18:41:04 +0000 (19:41 +0100)]
Revert "dvb: add 32/64 bits compatibility support"

This partially reverts commit 7b663ab7ed43e81d9017b770eaa7b3b2fcc1b629.

Change-Id: If809d096901809b2a67b34cea3c0cef7657d01e7

19 months agoRevert "dvb: add configuration items to control dvb module compilation. [1\2]"
Christian Hoffmann [Sat, 4 Feb 2023 18:27:16 +0000 (19:27 +0100)]
Revert "dvb: add configuration items to control dvb module compilation. [1\2]"

This partially reverts commit 37434e0be62710ffd76760e13bd121e4d12cf2d0.

Change-Id: Iaa9bfc0e34923b5c65eca406df7eb538e51575c4

19 months agoRevert "dvb-core: compatile with 32bit in 64bit kernel [1/1]"
Christian Hoffmann [Sat, 4 Feb 2023 18:19:39 +0000 (19:19 +0100)]
Revert "dvb-core: compatile with 32bit in 64bit kernel [1/1]"

This reverts commit 93f63edd13a85e1a681de86774f52fb7b740a380.

19 months agoRevert "net: stmmac: use correct DMA buffer size in the RX descriptor"
Christian Hoffmann [Tue, 31 Jan 2023 22:20:55 +0000 (23:20 +0100)]
Revert "net: stmmac: use correct DMA buffer size in the RX descriptor"

This reverts commit 231f1d4c1c1184bfa6b59031eb40958be50393d3.

19 months agoRevert "HID: core: move Usage Page concatenation to Main item [1/1]"
Christian Hoffmann [Tue, 31 Jan 2023 22:06:15 +0000 (23:06 +0100)]
Revert "HID: core: move Usage Page concatenation to Main item [1/1]"

This reverts commit e611bb331f9099d54274d5bd5cf68f233e254198.

19 months agokernel: source code upgrade for adt3-R [1/1]
Liang Ji [Fri, 19 Mar 2021 02:37:59 +0000 (10:37 +0800)]
kernel: source code upgrade for adt3-R [1/1]

in amlogic side
the tot CL:
    commit a02cbbb86f9a570b88f6a52d1fed52c8481f61f2
    Author: binqi zhang <binqi.zhang@amlogic.com>
    Date:   Mon Mar 15 17:27:12 2021 +0800

    uvm: fix kernel panic after exit playback [2/2]

    PD#SWPL-45047

    Problem:
    fixed realloc buffer size is not reasonable

    Solution:
    realloc buffer size need real buffer size

    Verify:
    adt3

    Change-Id: I307b37d4b12daf23eb4b8612e71af0452932a75a
Signed-off-by: binqi zhang <binqi.zhang@amlogic.com>
Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Change-Id: Iead8da7ba7c8eef9767ce87cf22ac515d78feb91

3 years agoMerge 4.9.269 into android-4.9-q
Greg Kroah-Hartman [Sat, 22 May 2021 08:53:37 +0000 (10:53 +0200)]
Merge 4.9.269 into android-4.9-q

Changes in 4.9.269
net: usb: ax88179_178a: initialize local variables before use
iwlwifi: Fix softirq/hardirq disabling in iwl_pcie_enqueue_hcmd()
ALSA: usb-audio: Add MIDI quirk for Vox ToneLab EX
USB: Add LPM quirk for Lenovo ThinkPad USB-C Dock Gen2 Ethernet
USB: Add reset-resume quirk for WD19's Realtek Hub
platform/x86: thinkpad_acpi: Correct thermal sensor allocation
s390/disassembler: increase ebpf disasm buffer size
ACPI: custom_method: fix potential use-after-free issue
ACPI: custom_method: fix a possible memory leak
arm64: dts: mt8173: fix property typo of 'phys' in dsi node
ecryptfs: fix kernel panic with null dev_name
mmc: core: Do a power cycle when the CMD11 fails
mmc: core: Set read only for SD cards with permanent write protect bit
btrfs: fix metadata extent leak after failure to create subvolume
fbdev: zero-fill colormap in fbcmap.c
staging: wimax/i2400m: fix byte-order issue
usb: gadget: uvc: add bInterval checking for HS mode
usb: dwc3: gadget: Ignore EP queue requests during bus reset
usb: xhci: Fix port minor revision
PCI: PM: Do not read power state in pci_enable_device_flags()
x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS)
spi: dln2: Fix reference leak to master
spi: omap-100k: Fix reference leak to master
intel_th: Consistency and off-by-one fix
phy: phy-twl4030-usb: Fix possible use-after-free in twl4030_usb_remove()
btrfs: convert logic BUG_ON()'s in replace_path to ASSERT()'s
scsi: target: pscsi: Fix warning in pscsi_complete_cmd()
media: ite-cir: check for receive overflow
extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged
media: media/saa7164: fix saa7164_encoder_register() memory leak bugs
media: gspca/sq905.c: fix uninitialized variable
power: supply: Use IRQF_ONESHOT
scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats()
scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg()
media: em28xx: fix memory leak
clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
power: supply: generic-adc-battery: fix possible use-after-free in gab_remove()
power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove()
media: adv7604: fix possible use-after-free in adv76xx_remove()
media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove()
media: i2c: adv7842: fix possible use-after-free in adv7842_remove()
media: dvb-usb: fix memory leak in dvb_usb_adapter_init
media: gscpa/stv06xx: fix memory leak
drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal
drm/amdgpu: fix NULL pointer dereference
scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response
scsi: libfc: Fix a format specifier
ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer
ALSA: sb: Fix two use after free in snd_sb_qsound_build
arm64/vdso: Discard .note.gnu.property sections in vDSO
openvswitch: fix stack OOB read while fragmenting IPv4 packets
NFSv4: Don't discard segments marked for return in _pnfs_return_layout()
jffs2: Fix kasan slab-out-of-bounds problem
powerpc/eeh: Fix EEH handling for hugepages in ioremap space.
powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
jffs2: check the validity of dstlen in jffs2_zlib_compress()
Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
ftrace: Handle commands when closing set_ftrace_filter file
ext4: fix check to prevent false positive report of incorrect used inodes
ext4: fix error code in ext4_commit_super
media: dvbdev: Fix memory leak in dvb_media_device_free()
usb: gadget: dummy_hcd: fix gpf in gadget_setup
usb: gadget: Fix double free of device descriptor pointers
usb: gadget/function/f_fs string table fix for multiple languages
dm persistent data: packed struct should have an aligned() attribute too
dm space map common: fix division bug in sm_ll_find_free_block()
dm rq: fix double free of blk_mq_tag_set in dev remove after table load fails
Bluetooth: verify AMP hci_chan before amp_destroy
hsr: use netdev_err() instead of WARN_ONCE()
bluetooth: eliminate the potential race condition when removing the HCI controller
net/nfc: fix use-after-free llcp_sock_bind/connect
FDDI: defxx: Bail out gracefully with unassigned PCI resource for CSR
misc: lis3lv02d: Fix false-positive WARN on various HP models
misc: vmw_vmci: explicitly initialize vmci_notify_bm_set_msg struct
misc: vmw_vmci: explicitly initialize vmci_datagram payload
tracing: Treat recording comm for idle task as a success
tracing: Use strlcpy() instead of strcpy() in __trace_find_cmdline()
tracing: Map all PIDs to command lines
tracing: Restructure trace_clock_global() to never block
md-cluster: fix use-after-free issue when removing rdev
md: factor out a mddev_find_locked helper from mddev_find
md: md_open returns -EBUSY when entering racing area
ipw2x00: potential buffer overflow in libipw_wx_set_encodeext()
cfg80211: scan: drop entry from hidden_list on overflow
drm/radeon: fix copy of uninitialized variable back to userspace
ALSA: hda/realtek: Re-order ALC882 Acer quirk table entries
ALSA: hda/realtek: Re-order ALC882 Sony quirk table entries
ALSA: hda/realtek: Re-order ALC269 Sony quirk table entries
ALSA: hda/realtek: Re-order ALC269 Lenovo quirk table entries
ALSA: hda/realtek: Remove redundant entry for ALC861 Haier/Uniwill devices
usb: gadget: pch_udc: Revert d3cb25a12138 completely
memory: gpmc: fix out of bounds read and dereference on gpmc_cs[]
ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250
ARM: dts: exynos: correct PMIC interrupt trigger level on Snow
serial: stm32: fix incorrect characters on console
usb: gadget: pch_udc: Replace cpu_to_le32() by lower_32_bits()
usb: gadget: pch_udc: Check if driver is present before calling ->setup()
usb: gadget: pch_udc: Check for DMA mapping error
crypto: qat - don't release uninitialized resources
crypto: qat - ADF_STATUS_PF_RUNNING should be set after adf_dev_init
fotg210-udc: Fix DMA on EP0 for length > max packet size
fotg210-udc: Fix EP0 IN requests bigger than two packets
fotg210-udc: Remove a dubious condition leading to fotg210_done
fotg210-udc: Mask GRP2 interrupts we don't handle
fotg210-udc: Don't DMA more than the buffer can take
fotg210-udc: Complete OUT requests on short packets
mtd: require write permissions for locking and badblock ioctls
bus: qcom: Put child node before return
crypto: qat - fix error path in adf_isr_resource_alloc()
mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
staging: rtl8192u: Fix potential infinite loop
staging: greybus: uart: fix unprivileged TIOCCSERIAL
crypto: qat - Fix a double free in adf_create_ring
usb: gadget: r8a66597: Add missing null check on return from platform_get_resource
USB: cdc-acm: fix unprivileged TIOCCSERIAL
tty: actually undefine superseded ASYNC flags
tty: fix return value for unsupported ioctls
firmware: qcom-scm: Fix QCOM_SCM configuration
x86/platform/uv: Fix !KEXEC build failure
Drivers: hv: vmbus: Increase wait time for VMbus unload
ttyprintk: Add TTY hangup callback.
media: vivid: fix assignment of dev->fbuf_out_flags
media: omap4iss: return error code when omap4iss_get() failed
media: m88rs6000t: avoid potential out-of-bounds reads on arrays
pata_arasan_cf: fix IRQ check
pata_ipx4xx_cf: fix IRQ check
sata_mv: add IRQ checks
ata: libahci_platform: fix IRQ check
scsi: fcoe: Fix mismatched fcoe_wwn_from_mac declaration
media: dvb-usb-remote: fix dvb_usb_nec_rc_key_to_event type mismatch
clk: uniphier: Fix potential infinite loop
scsi: jazz_esp: Add IRQ check
scsi: sun3x_esp: Add IRQ check
scsi: sni_53c710: Add IRQ check
HSI: core: fix resource leaks in hsi_add_client_from_dt()
x86/events/amd/iommu: Fix sysfs type mismatch
HID: plantronics: Workaround for double volume key presses
perf symbols: Fix dso__fprintf_symbols_by_name() to return the number of printed chars
net: lapbether: Prevent racing when checking whether the netif is running
powerpc/prom: Mark identical_pvr_fixup as __init
ALSA: core: remove redundant spin_lock pair in snd_card_disconnect
nfc: pn533: prevent potential memory corruption
ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls
liquidio: Fix unintented sign extension of a left shift of a u16
powerpc/perf: Fix PMU constraint check for EBB events
powerpc: iommu: fix build when neither PCI or IBMVIO is set
mac80211: bail out if cipher schemes are invalid
mt7601u: fix always true expression
net: thunderx: Fix unintentional sign extension issue
i2c: cadence: add IRQ check
i2c: emev2: add IRQ check
i2c: jz4780: add IRQ check
i2c: sh7760: add IRQ check
MIPS: pci-legacy: stop using of_pci_range_to_resource
powerpc/pseries: extract host bridge from pci_bus prior to bus removal
i2c: sh7760: fix IRQ error path
mwl8k: Fix a double Free in mwl8k_probe_hw
vsock/vmci: log once the failed queue pair allocation
RDMA/i40iw: Fix error unwinding when i40iw_hmc_sd_one fails
net: davinci_emac: Fix incorrect masking of tx and rx error channel
ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
powerpc/52xx: Fix an invalid ASM expression ('addi' used instead of 'add')
net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
kfifo: fix ternary sign extension bugs
Revert "net/sctp: fix race condition in sctp_destroy_sock"
sctp: delay auto_asconf init until binding the first addr
Revert "of/fdt: Make sure no-map does not remove already reserved regions"
Revert "fdt: Properly handle "no-map" field in the memory region"
fs: dlm: fix debugfs dump
tipc: convert dest node's address to network order
net: stmmac: Set FIFO sizes for ipq806x
ALSA: hdsp: don't disable if not enabled
ALSA: hdspm: don't disable if not enabled
ALSA: rme9652: don't disable if not enabled
Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default
Bluetooth: initialize skb_queue_head at l2cap_chan_create()
ip6_vti: proper dev_{hold|put} in ndo_[un]init methods
mac80211: clear the beacon's CRC after channel switch
cuse: prevent clone
selftests: Set CC to clang in lib.mk if LLVM is set
kconfig: nconf: stop endless search loops
sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
ASoC: rt286: Generalize support for ALC3263 codec
samples/bpf: Fix broken tracex1 due to kprobe argument change
powerpc/pseries: Stop calling printk in rtas_stop_self()
wl3501_cs: Fix out-of-bounds warnings in wl3501_send_pkt
wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join
powerpc/iommu: Annotate nested lock for lockdep
net: ethernet: mtk_eth_soc: fix RX VLAN offload
ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
f2fs: fix a redundant call to f2fs_balance_fs if an error occurs
PCI: Release OF node in pci_scan_device()'s error path
ARM: 9064/1: hw_breakpoint: Do not directly check the event's overflow_handler hook
NFSv4.2: Always flush out writes in nfs42_proc_fallocate()
NFS: Deal correctly with attribute generation counter overflow
pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()
NFSv4.2 fix handling of sr_eof in SEEK's reply
sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b
drm/radeon: Fix off-by-one power_state index heap overwrite
khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate()
mm/hugeltb: handle the error case in hugetlb_fix_reserve_counts()
ksm: fix potential missing rmap_item for stable_node
kernel: kexec_file: fix error return code of kexec_calculate_store_digests()
ARC: entry: fix off-by-one error in syscall number validation
powerpc/64s: Fix crashes when toggling entry flush barrier
squashfs: fix divide error in calculate_skip()
iio: proximity: pulsedlight: Fix rumtime PM imbalance on error
usb: fotg210-hcd: Fix an error message
ACPI: scan: Fix a memory leak in an error handling path
usb: xhci: Increase timeout for HC halt
usb: dwc2: Fix gadget DMA unmap direction
usb: core: hub: fix race condition about TRSMRCY of resume
KVM: x86: Cancel pvclock_gtod_work on module removal
FDDI: defxx: Make MMIO the configuration default except for EISA
MIPS: Reinstate platform `__div64_32' handler
MIPS: Avoid DIVU in `__div64_32' is result would be zero
MIPS: Avoid handcoded DIVU in `__div64_32' altogether
thermal/core/fair share: Lock the thermal zone while looping over instances
dm ioctl: fix out of bounds array access when no devices
kobject_uevent: remove warning in init_uevent_argv()
netfilter: conntrack: Make global sysctls readonly in non-init netns
clk: exynos7: Mark aclk_fsys1_200 as critical
x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes
extcon: adc-jack: Fix incompatible pointer type warning
kgdb: fix gcc-11 warning on indentation
usb: sl811-hcd: improve misleading indentation
cxgb4: Fix the -Wmisleading-indentation warning
isdn: capi: fix mismatched prototypes
ACPI / hotplug / PCI: Fix reference count leak in enable_slot()
Input: silead - add workaround for x86 BIOS-es which bring the chip up in a stuck state
um: Mark all kernel symbols as local
ceph: fix fscache invalidation
ALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP
lib: stackdepot: turn depot_lock spinlock to raw_spinlock
sit: proper dev_{hold|put} in ndo_[un]init methods
ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods
xhci: Do not use GFP_KERNEL in (potentially) atomic context
ipv6: remove extra dev_hold() for fallback tunnels
Linux 4.9.269

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

3 years agoLinux 4.9.269
Greg Kroah-Hartman [Sat, 22 May 2021 08:40:34 +0000 (10:40 +0200)]
Linux 4.9.269

Link: https://lore.kernel.org/r/20210520092108.587553970@linuxfoundation.org
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Jason Self <jason@bluehome.net>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoipv6: remove extra dev_hold() for fallback tunnels
Eric Dumazet [Wed, 31 Mar 2021 21:38:11 +0000 (14:38 -0700)]
ipv6: remove extra dev_hold() for fallback tunnels

commit 0d7a7b2014b1a499a0fe24c9f3063d7856b5aaaf upstream.

My previous commits added a dev_hold() in tunnels ndo_init(),
but forgot to remove it from special functions setting up fallback tunnels.

Fallback tunnels do call their respective ndo_init()

This leads to various reports like :

unregister_netdevice: waiting for ip6gre0 to become free. Usage count = 2

Fixes: 48bb5697269a ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 6289a98f0817 ("sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 40cb881b5aaa ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 7f700334be9a ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoxhci: Do not use GFP_KERNEL in (potentially) atomic context
Christophe JAILLET [Wed, 12 May 2021 08:08:14 +0000 (11:08 +0300)]
xhci: Do not use GFP_KERNEL in (potentially) atomic context

commit dda32c00c9a0fa103b5d54ef72c477b7aa993679 upstream.

'xhci_urb_enqueue()' is passed a 'mem_flags' argument, because "URBs may be
submitted in interrupt context" (see comment related to 'usb_submit_urb()'
in 'drivers/usb/core/urb.c')

So this flag should be used in all the calling chain.
Up to now, 'xhci_check_maxpacket()' which is only called from
'xhci_urb_enqueue()', uses GFP_KERNEL.

Be safe and pass the mem_flags to this function as well.

Fixes: ddba5cd0aeff ("xhci: Use command structures when queuing commands on the command ring")
Cc: <stable@vger.kernel.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210512080816.866037-4-mathias.nyman@linux.intel.com
[iwamatsu: Adjust context]
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods
Eric Dumazet [Tue, 30 Mar 2021 06:45:51 +0000 (23:45 -0700)]
ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods

commit 48bb5697269a7cbe5194dbb044dc38c517e34c58 upstream.

Same reasons than for the previous commits :
6289a98f0817 ("sit: proper dev_{hold|put} in ndo_[un]init methods")
40cb881b5aaa ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
7f700334be9a ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods")

After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
a warning [1]

Issue here is that:

- all dev_put() should be paired with a corresponding prior dev_hold().

- A driver doing a dev_put() in its ndo_uninit() MUST also
  do a dev_hold() in its ndo_init(), only when ndo_init()
  is returning 0.

Otherwise, register_netdevice() would call ndo_uninit()
in its error path and release a refcount too soon.

[1]
WARNING: CPU: 1 PID: 21059 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
Modules linked in:
CPU: 1 PID: 21059 Comm: syz-executor.4 Not tainted 5.12.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
Code: 1d 6a 5a e8 09 31 ff 89 de e8 8d 1a ab fd 84 db 75 e0 e8 d4 13 ab fd 48 c7 c7 a0 e1 c1 89 c6 05 4a 5a e8 09 01 e8 2e 36 fb 04 <0f> 0b eb c4 e8 b8 13 ab fd 0f b6 1d 39 5a e8 09 31 ff 89 de e8 58
RSP: 0018:ffffc900025aefe8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000040000 RSI: ffffffff815c51f5 RDI: fffff520004b5def
RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815bdf8e R11: 0000000000000000 R12: ffff888023488568
R13: ffff8880254e9000 R14: 00000000dfd82cfd R15: ffff88802ee2d7c0
FS:  00007f13bc590700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0943e74000 CR3: 0000000025273000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __refcount_dec include/linux/refcount.h:344 [inline]
 refcount_dec include/linux/refcount.h:359 [inline]
 dev_put include/linux/netdevice.h:4135 [inline]
 ip6_tnl_dev_uninit+0x370/0x3d0 net/ipv6/ip6_tunnel.c:387
 register_netdevice+0xadf/0x1500 net/core/dev.c:10308
 ip6_tnl_create2+0x1b5/0x400 net/ipv6/ip6_tunnel.c:263
 ip6_tnl_newlink+0x312/0x580 net/ipv6/ip6_tunnel.c:2052
 __rtnl_newlink+0x1062/0x1710 net/core/rtnetlink.c:3443
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:674
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: 919067cc845f ("net: add CONFIG_PCPU_DEV_REFCNT")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agosit: proper dev_{hold|put} in ndo_[un]init methods
Eric Dumazet [Mon, 29 Mar 2021 19:25:22 +0000 (12:25 -0700)]
sit: proper dev_{hold|put} in ndo_[un]init methods

commit 6289a98f0817a4a457750d6345e754838eae9439 upstream.

After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
a warning [1]

Issue here is that:

- all dev_put() should be paired with a corresponding prior dev_hold().

- A driver doing a dev_put() in its ndo_uninit() MUST also
  do a dev_hold() in its ndo_init(), only when ndo_init()
  is returning 0.

Otherwise, register_netdevice() would call ndo_uninit()
in its error path and release a refcount too soon.

Fixes: 919067cc845f ("net: add CONFIG_PCPU_DEV_REFCNT")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>