Commit graph

886,644 commits

Author SHA1 Message Date
John Stultz
c07e36bfc5 ANDROID: db845c_gki.fragment: Add QCOM_TSENSE config to avoid thermal crashes
This adds QCOM_TSENSE to the db845c_gki.fragment which is
needed to avoid hard crashes seen on db845c (which crash into
USB dump mode). This was causing some troube in our testing
as we'd occasionally see hard crashes in certian CTS tests
(also reproducible with a forkbomb).

After lots of debugging we've narrowed down this config as
the change which avoids the hard crashes.

Thanks to: Vinod Koul <vinod.koul@linaro.org> and
Bjorn Andersson <bjorn.andersson@linaro.org> for helping debug
this issue!

Bug: 146449535
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I0752c85e44028e6272c14b59fa09d2baf2e18feb
2021-05-11 21:25:10 +00:00
Lecopzer Chen
0821bcfb48 UPSTREAM: mm/cma.c: remove redundant cma_mutex lock
The cma_mutex which protects alloc_contig_range() was first appeared in
commit 7ee793a62f ("cma: Remove potential deadlock situation"), at that
time, there is no guarantee the behavior of concurrency inside
alloc_contig_range().

After commit 2c7452a075 ("mm/page_isolation.c: make
start_isolate_page_range() fail if already isolated")

  > However, two subsystems (CMA and gigantic
  > huge pages for example) could attempt operations on the same range.  If
  > this happens, one thread may 'undo' the work another thread is doing.
  > This can result in pageblocks being incorrectly left marked as
  > MIGRATE_ISOLATE and therefore not available for page allocation.

The concurrency inside alloc_contig_range() was clarified.

Now we can find that hugepage and virtio call alloc_contig_range() without
any lock, thus cma_mutex is "redundant" in cma_alloc() now.

Link: https://lkml.kernel.org/r/20201020102241.3729-1-lecopzer.chen@mediatek.com
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: YJ Chiang <yj.chiang@mediatek.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit a4efc174b382fcdb62e2d90d39e78a274a975e38)
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Change-Id: I43755731ddb1a4ac9ac873a6e99c8c96d727ef77
2021-05-06 09:34:26 +00:00
jy.ser
2d5e3ef632 ANDROID: ABI: update allowed list for galaxy
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function int gpiochip_irqchip_add_key(gpio_chip*, irq_chip*, unsigned int, void (irq_desc*)*, unsigned int, bool, lock_class_key*, lock_class_key*)'
  [A] 'function void gpiochip_set_nested_irqchip(gpio_chip*, irq_chip*, unsigned int)'

Bug: 187366261
Signed-off-by: jy.ser <jy.ser@samsung.com>
Change-Id: I97e00013450cea1d47a18b9a135e5e8cff707d2c
2021-05-06 06:02:16 +00:00
Lecopzer Chen
e3e60153a4 BACKPORT: remoteproc: core: Remove casting to rproc_handle_resource_t
There are four different callback functions that are used for the
rproc_handle_resource_t callback that all have different second
parameter types.

rproc_handle_vdev -> struct fw_rsc_vdev
rproc_handle_trace -> struct fw_rsc_trace
rproc_handle_devmem -> struct fw_rsc_devmem
rproc_handle_carveout -> struct fw_rsc_carveout

These callbacks are cast to rproc_handle_resource_t so that there is no
error about incompatible pointer types. Unfortunately, this is a Clang's
Control-Flow Integrity checking violation, which verifies that the
callback function's types match the prototypes exactly before jumping.

[    7.275750] Kernel panic - not syncing: CFI failure (target: rproc_handle_vdev+0x0/0x4)
[    7.283763] CPU: 2 PID: 1 Comm: init Tainted: G         C O      5.4.70-03301-g527af2c96672 #17
[    7.292463] Hardware name: NXP i.MX8MPlus EVK board (DT)
[    7.297779] Call trace:
[    7.300232]  dump_backtrace.cfi_jt+0x0/0x4
[    7.304337]  show_stack+0x18/0x24
[    7.307660]  dump_stack+0xb8/0x114
[    7.311069]  panic+0x164/0x3d4
[    7.314130]  __ubsan_handle_cfi_check_fail_abort+0x0/0x14
[    7.319533]  perf_proc_update_handler+0x0/0xcc
[    7.323983]  __cfi_check+0x63278/0x6a290
[    7.327913]  rproc_boot+0x3f8/0x738
[    7.331404]  rproc_add+0x68/0x110
[    7.334738]  imx_rproc_probe+0x5e4/0x708 [imx_rproc]
[    7.339711]  platform_drv_probe+0xac/0xf0
[    7.343726]  really_probe+0x260/0x65c
[    7.347393]  driver_probe_device+0x64/0x100
[    7.351580]  device_driver_attach+0x6c/0xac
[    7.355766]  __driver_attach+0xdc/0x184
[    7.359609]  bus_for_each_dev+0x98/0x104
[    7.363537]  driver_attach+0x24/0x30
[    7.367117]  bus_add_driver+0x100/0x1e0
[    7.370958]  driver_register+0x78/0x114
[    7.374800]  __platform_driver_register+0x44/0x50
[    7.379514]  init_module+0x20/0xfe8 [imx_rproc]
[    7.384049]  do_one_initcall+0x190/0x348
[    7.387979]  do_init_module+0x5c/0x210
[    7.391731]  load_module+0x2fbc/0x3590
[    7.395485]  __arm64_sys_finit_module+0xb8/0xec
[    7.400025]  el0_svc_common+0xb4/0x19c
[    7.403777]  el0_svc_handler+0x74/0x98
[    7.407531]  el0_svc+0x8/0xc
[    7.410419] SMP: stopping secondary CPUs
[    7.414648] Kernel Offset: disabled
[    7.418142] CPU features: 0x00010002,2000200c
[    7.422501] Memory Limit: none

To fix this, change the second parameter of all functions to void * and
use a local variable with the correct type so that everything works
properly. With this, we can remove casting to rproc_handle_resource_t
for these functions.

Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210224055825.7417-1-jindong.yue@nxp.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

(cherry picked from commit 2bf2346159bc99cf0679e25be20f4daca60f3f5c)
Bug: 187234877
Reported-by: Joy-mi Huang <joy-mi.huang@mediatek.com>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Change-Id: Icc7adeaf98f779fc46a979ff7e9f2ab5f963f636
2021-05-05 14:43:46 +00:00
dongjian
046c52c95b UPSTREAM: scsi: ufs: ufs-mediatek: Correct operator & -> &&
The "lpm" and "->enabled" are all boolean. We should be using &&
rather than the bit operator.

Link: https://lore.kernel.org/r/1615896915-148864-1-git-send-email-dj0227@163.com
Fixes: 488edafb1120 ("scsi: ufs-mediatek: Introduce low-power mode for device power supply")
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: dongjian <dongjian@yulong.com>
Signed-off-by: Yue Hu <huyue2@yulong.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 0fdc7d5d8f3719950478cca452cf7f0f1355be10)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I010318ede5b79f8b0443b3acf72a8736640ae3f8
2021-05-04 15:19:30 -07:00
Masahiro Yamada
0475956802 UPSTREAM: kbuild: do not include include/config/auto.conf from adjust_autoksyms.sh
Commit cd195bc4775a ("kbuild: split adjust_autoksyms.sh in two parts")
split out the code that needs include/config/auto.conf.

This script no longer needs to include include/config/auto.conf.

Fixes: cd195bc4775a ("kbuild: split adjust_autoksyms.sh in two parts")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit 12e9dea6c9766c7403417d00193940cea33ee81a)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I0781bd0198e4a3c8215830f4100ff1371e2d3e82
2021-05-04 15:19:30 -07:00
Dongseok Yi
24797c44c3 UPSTREAM: udp: ipv4: manipulate network header of NATed UDP GRO fraglist
UDP/IP header of UDP GROed frag_skbs are not updated even after NAT
forwarding. Only the header of head_skb from ip_finish_output_gso ->
skb_gso_segment is updated but following frag_skbs are not updated.

A call path skb_mac_gso_segment -> inet_gso_segment ->
udp4_ufo_fragment -> __udp_gso_segment -> __udp_gso_segment_list
does not try to update UDP/IP header of the segment list but copy
only the MAC header.

Update port, addr and check of each skb of the segment list in
__udp_gso_segment_list. It covers both SNAT and DNAT.

Fixes: 9fd1ff5d2ac7 (udp: Support UDP fraglist GRO/GSO.)
Signed-off-by: Dongseok Yi <dseok.yi@samsung.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Link: https://lore.kernel.org/r/1611962007-80092-1-git-send-email-dseok.yi@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit c3df39ac9b0e3747bf8233ea9ce4ed5ceb3199d3)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ib6159d86309fc5ade95c67abd7eab6880accd12b
2021-05-04 15:19:30 -07:00
Dongseok Yi
550b2c0dce UPSTREAM: net: fix use-after-free when UDP GRO with shared fraglist
skbs in fraglist could be shared by a BPF filter loaded at TC. If TC
writes, it will call skb_ensure_writable -> pskb_expand_head to create
a private linear section for the head_skb. And then call
skb_clone_fraglist -> skb_get on each skb in the fraglist.

skb_segment_list overwrites part of the skb linear section of each
fragment itself. Even after skb_clone, the frag_skbs share their
linear section with their clone in PF_PACKET.

Both sk_receive_queue of PF_PACKET and PF_INET (or PF_INET6) can have
a link for the same frag_skbs chain. If a new skb (not frags) is
queued to one of the sk_receive_queue, multiple ptypes can see and
release this. It causes use-after-free.

[ 4443.426215] ------------[ cut here ]------------
[ 4443.426222] refcount_t: underflow; use-after-free.
[ 4443.426291] WARNING: CPU: 7 PID: 28161 at lib/refcount.c:190
refcount_dec_and_test_checked+0xa4/0xc8
[ 4443.426726] pstate: 60400005 (nZCv daif +PAN -UAO)
[ 4443.426732] pc : refcount_dec_and_test_checked+0xa4/0xc8
[ 4443.426737] lr : refcount_dec_and_test_checked+0xa0/0xc8
[ 4443.426808] Call trace:
[ 4443.426813]  refcount_dec_and_test_checked+0xa4/0xc8
[ 4443.426823]  skb_release_data+0x144/0x264
[ 4443.426828]  kfree_skb+0x58/0xc4
[ 4443.426832]  skb_queue_purge+0x64/0x9c
[ 4443.426844]  packet_set_ring+0x5f0/0x820
[ 4443.426849]  packet_setsockopt+0x5a4/0xcd0
[ 4443.426853]  __sys_setsockopt+0x188/0x278
[ 4443.426858]  __arm64_sys_setsockopt+0x28/0x38
[ 4443.426869]  el0_svc_common+0xf0/0x1d0
[ 4443.426873]  el0_svc_handler+0x74/0x98
[ 4443.426880]  el0_svc+0x8/0xc

Fixes: 3a1296a38d0c (net: Support GRO/GSO fraglist chaining.)
Signed-off-by: Dongseok Yi <dseok.yi@samsung.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/1610072918-174177-1-git-send-email-dseok.yi@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 53475c5dd856212e91538a9501162e821cc1f791)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ife87c4296ba12b39be4868b2c5e0ea6130f76d6d
2021-05-03 20:56:18 -07:00
Stanley Chu
e7e2f8329c UPSTREAM: scsi: ufs: Fix possible power drain during system suspend
Currently if device needs to do flush or BKOP operations, the device VCC
power is kept during runtime-suspend period.

However, if system suspend is happening while device is runtime-suspended,
such power may not be disabled successfully.

The reasons may be,

1. If current PM level is the same as SPM level, device will keep
   runtime-suspended by ufshcd_system_suspend().

2. Flush recheck work may not be scheduled successfully during system
   suspend period. If it can wake up the system, this is also not the
   intention of the recheck work.

To fix this issue, simply runtime-resume the device if the flush is allowed
during runtime suspend period. Flush capability will be disabled while
leaving runtime suspend, and also not be allowed in system suspend period.

Link: https://lore.kernel.org/r/20201222072905.32221-2-stanley.chu@mediatek.com
Fixes: 51dd905bd2f6 ("scsi: ufs: Fix WriteBooster flush during runtime suspend")
Reviewed-by: Chaotian Jing <chaotian.jing@mediatek.com>
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 1d53864c3617f5235f891ca0fbe9347c4cd35d46)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I2c7738084d968fd3987d4876f04ea9c9b4318fb1
2021-05-03 20:56:09 -07:00
Stanley Chu
2e09274b7c UPSTREAM: scsi: ufs: Re-enable WriteBooster after device reset
UFS 3.1 specification mentions that the WriteBooster flags listed below
will be set to their default values, i.e. disabled, after power cycle or
any type of reset event. Thus we need to reset the flag variables kept in
struct hba to align with the device status and ensure that
WriteBooster-related functions are configured properly after device reset.

Without this fix, WriteBooster will not be enabled successfully after by
ufshcd_wb_ctrl() after device reset because hba->wb_enabled remains true.

Flags required to be reset to default values:

 - fWriteBoosterEn: hba->wb_enabled

 - fWriteBoosterBufferFlushEn: hba->wb_buf_flush_enabled

 - fWriteBoosterBufferFlushDuringHibernate: No variable mapped

Link: https://lore.kernel.org/r/20201208135635.15326-2-stanley.chu@mediatek.com
Fixes: 3d17b9b5ab11 ("scsi: ufs: Add write booster feature support")
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit bd14bf0e4a084514aa62d24d2109e0f09a93822f)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I994290c3824cac50828e097cdfb4a93e9dcfeb36
2021-05-03 20:56:01 -07:00
Takashi Iwai
b55ed54016 UPSTREAM: driver: core: Fix list corruption after device_del()
The device_links_purge() function (called from device_del()) tries to
remove the links.needs_suppliers list entry, but it's using
list_del(), hence it doesn't initialize after the removal.  This is OK
for normal cases where device_del() is called via device_destroy().
However, it's not guaranteed that the device object will be really
deleted soon after device_del().  In a minor case like HD-audio codec
reconfiguration that re-initializes the device after device_del(), it
may lead to a crash by the corrupted list entry.

As a simple fix, replace list_del() with list_del_init() in order to
make the list intact after the device_del() call.

Fixes: e2ae9bcc4aaa ("driver core: Add support for linking devices during device addition")
Cc: <stable@vger.kernel.org>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20201208190326.27531-1-tiwai@suse.de
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 66482f640755b31cb94371ff6cef17400cda6db5)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: If1c0eb2511292b430eb275e72f7e4ccf55b4f96b
2021-05-03 20:55:52 -07:00
Hyeongseok Kim
d9d13f4b76 UPSTREAM: f2fs: fix double free of unicode map
In case of retrying fill_super with skip_recovery,
s_encoding for casefold would not be loaded again even though it's
already been freed because it's not NULL.
Set NULL after free to prevent double freeing when unmount.

Fixes: eca4873ee1b6 ("f2fs: Use generic casefolding support")
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 89ff6005039a878afac87889fee748fa3f957c3a)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ib29e84c8e77e710fd2f9649a56750d33fd620fba
2021-05-03 20:55:42 -07:00
Vincent Guittot
be192b51bf UPSTREAM: sched/fair: Prefer prev cpu in asymmetric wakeup path
During fast wakeup path, scheduler always check whether local or prev
cpus are good candidates for the task before looking for other cpus in
the domain. With commit b7a331615d25 ("sched/fair: Add asymmetric CPU
capacity wakeup scan") the heterogenous system gains a dedicated path
but doesn't try to reuse prev cpu whenever possible. If the previous
cpu is idle and belong to the LLC domain, we should check it 1st
before looking for another cpu because it stays one of the best
candidate and this also stabilizes task placement on the system.

This change aligns asymmetric path behavior with symmetric one and reduces
cases where the task migrates across all cpus of the sd_asym_cpucapacity
domains at wakeup.

This change does not impact normal EAS mode but only the overloaded case or
when EAS is not used.

- On hikey960 with performance governor (EAS disable)

./perf bench sched pipe -T -l 50000
             mainline           w/ patch
ops/sec        149313(+/-0.28%)   182587(+/- 0.40) +22%

- On hikey with performance governor

./perf bench sched pipe -T -l 50000
             mainline           w/ patch
ops/sec         47721(+/-0.76%)    47899(+/- 0.56) +0.4%

According to test on hikey, the patch doesn't impact symmetric system
compared to current implementation (only tested on arm64)

Also read the uclamped value of task's utilization at most twice instead
instead each time we compare task's utilization with cpu's capacity.

Fixes: b7a331615d25 ("sched/fair: Add asymmetric CPU capacity wakeup scan")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20201029161824.26389-1-vincent.guittot@linaro.org
(cherry picked from commit b4c9c9f15649c98a5b45408919d1ff4fd7f5531c)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Icaba6ae29d5bd23f87ca5492b778869be9e0d9c9
2021-05-03 20:55:31 -07:00
Qinglang Miao
3f54d632a6 UPSTREAM: scsi: ufshcd: Fix missing destroy_workqueue()
Add the missing destroy_workqueue() before return from ufshcd_init in the
error handling case as well as in ufshcd_remove.

Link: https://lore.kernel.org/r/20201110074223.41280-1-miaoqinglang@huawei.com
Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and other error recovery paths")
Suggested-by: Avri Altman <Avri.Altman@wdc.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2e6f11a797a24d1e2141a214a6dd6dfbe709f55d)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I2db2a6c6fb22b1e780ec7e167940d7104aaae267
2021-05-03 20:55:21 -07:00
Dmitry Safonov
e6d3c97bac UPSTREAM: xfrm/compat: Translate by copying XFRMA_UNSPEC attribute
xfrm_xlate32() translates 64-bit message provided by kernel to be sent
for 32-bit listener (acknowledge or monitor). Translator code doesn't
expect XFRMA_UNSPEC attribute as it doesn't know its payload.
Kernel never attaches such attribute, but a user can.

I've searched if any opensource does it and the answer is no.
Nothing on github and google finds only tfcproject that has such code
commented-out.

What will happen if a user sends a netlink message with XFRMA_UNSPEC
attribute? Ipsec code ignores this attribute. But if there is a
monitor-process or 32-bit user requested ack - kernel will try to
translate such message and will hit WARN_ONCE() in xfrm_xlate64_attr().

Deal with XFRMA_UNSPEC by copying the attribute payload with
xfrm_nla_cpy(). In result, the default switch-case in xfrm_xlate64_attr()
becomes an unused code. Leave those 3 lines in case a new xfrm attribute
will be added.

Fixes: 5461fc0c8d9f ("xfrm/compat: Add 64=>32-bit messages translator")
Reported-by: syzbot+a7e701c8385bd8543074@syzkaller.appspotmail.com
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit dbd7ae5154d5fff7e84a9f3010bb06499017ef29)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I11e05ca491155a1dd28f8820ded7ada096595075
2021-05-03 20:55:11 -07:00
Dmitry Safonov
957e971ed9 UPSTREAM: xfrm/compat: memset(0) 64-bit padding at right place
32-bit messages translated by xfrm_compat can have attributes attached.
For all, but XFRMA_SA, XFRMA_POLICY the size of payload is the same
in 32-bit UABI and 64-bit UABI. For XFRMA_SA (struct xfrm_usersa_info)
and XFRMA_POLICY (struct xfrm_userpolicy_info) it's only tail-padding
that is present in 64-bit payload, but not in 32-bit.
The proper size for destination nlattr is already calculated by
xfrm_user_rcv_calculate_len64() and allocated with kvmalloc().

xfrm_attr_cpy32() copies 32-bit copy_len into 64-bit attribute
translated payload, zero-filling possible padding for SA/POLICY.
Due to a typo, *pos already has 64-bit payload size, in a result next
memset(0) is called on the memory after the translated attribute, not on
the tail-padding of it.

Fixes: 5106f4a8acff ("xfrm/compat: Add 32=>64-bit messages translator")
Reported-by: syzbot+c43831072e7df506a646@syzkaller.appspotmail.com
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit d1949d045fd67eab8a32a579a8c1ab1681330854)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ic81e020da215c3fd093a76dc687abf5f86827283
2021-05-03 20:55:02 -07:00
Dmitry Safonov
ee97d20c7e UPSTREAM: xfrm/compat: Don't allocate memory with __GFP_ZERO
32-bit to 64-bit messages translator zerofies needed paddings in the
translation, the rest is the actual payload.
Don't allocate zero pages as they are not needed.

Fixes: 5106f4a8acff ("xfrm/compat: Add 32=>64-bit messages translator")
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit ad37f77fd3659e87fd9833a83692e0e4eba0f5cd)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Icefe6cd5ed03975f0f87cc1b126cfe55b36c35e5
2021-05-03 20:54:51 -07:00
Pujin Shi
a9cedd3032 BACKPORT: scsi: ufs: Fix missing brace warning for old compilers
For older versions of gcc, the array = {0}; will cause warnings:

drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_crypto_keyslot_program':
drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
  union ufs_crypto_cfg_entry cfg = { 0 };
        ^
drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: (near initialization for 'cfg.reg_val') [-Wmissing-braces]
drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_clear_keyslot':
drivers/scsi/ufs/ufshcd-crypto.c:103:8: warning: missing braces around initializer [-Wmissing-braces]
  union ufs_crypto_cfg_entry cfg = { 0 };
        ^
2 warnings generated

Link: https://lore.kernel.org/r/20201002063538.1250-1-shipujin.t@gmail.com
Fixes: 70297a8ac7a7 ("scsi: ufs: UFS crypto API")
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Pujin Shi <shipujin.t@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6500251e590657066a227dce897a0392f302af24)
[drop non-applicable change to ufshcd_crypto_keyslot_program]
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I06c4eacc036cc5e9d80217a986cfe9427fb6e255
2021-05-03 20:54:41 -07:00
Yu Kuai
dee5558ec9 UPSTREAM: net: xfrm: fix memory leak in xfrm_user_policy()
if xfrm_get_translator() failed, xfrm_user_policy() return without
freeing 'data', which is allocated in memdup_sockptr().

Fixes: 96392ee5a13b ("xfrm/compat: Translate 32-bit user_policy from sockptr")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit 48f486e13ffdb49fbb9b38c21d0e108ed60ab1a2)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: If018bce68d0d23491f1c47299443f7011dce3e89
2021-05-03 20:54:32 -07:00
Alexander Lobakin
7db1c96c2d BACKPORT: net: ethtool: add missing NETIF_F_GSO_FRAGLIST feature string
Commit 3b33583265ed ("net: Add fraglist GRO/GSO feature flags") missed
an entry for NETIF_F_GSO_FRAGLIST in netdev_features_strings array. As
a result, fraglist GSO feature is not shown in 'ethtool -k' output and
can't be toggled on/off.
The fix is trivial.

Fixes: 3b33583265ed ("net: Add fraglist GRO/GSO feature flags")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit eddbf5d0204e550ee59de02bdc19fe90d4203dd6)
[netdev_features_strings is in net/core/ethtool.c on this branch, so
apply the change there]
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I20b389538ac02fc63cf8fa59dfb9010296237056
2021-05-03 20:54:20 -07:00
Wei Yongjun
305c5f5486 UPSTREAM: mac80211_hwsim: use GFP_ATOMIC under spin lock
A spin lock is taken here so we should use GFP_ATOMIC.

Fixes: 5d44fe7c9808 ("mac80211_hwsim: add frame transmission support over virtio")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200422020154.112088-1-weiyongjun1@huawei.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit 0379861217dc2dd46e3bc517010060065b0dd6fc)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I16c7f59f3e695ac6a6ffaa25217e3d7309827dca
2021-05-03 20:54:04 -07:00
Masahiro Yamada
48ffcbf0b9 FROMGIT: kbuild: update config_data.gz only when the content of .config is changed
If the timestamp of the .config file is updated, config_data.gz is
regenerated, then vmlinux is re-linked. This occurs even if the content
of the .config has not changed at all.

This issue was mitigated by commit 67424f61f8 ("kconfig: do not write
.config if the content is the same"); Kconfig does not update the
.config when it ends up with the identical configuration.

The issue is remaining when the .config is created by *_defconfig with
some config fragment(s) applied on top.

This is typical for powerpc and mips, where several *_defconfig targets
are constructed by using merge_config.sh.

One workaround is to have the copy of the .config. The filechk rule
updates the copy, kernel/config_data, by checking the content instead
of the timestamp.

With this commit, the second run with the same configuration avoids
the needless rebuilds.

  $ make ARCH=mips defconfig all
   [ snip ]
  $ make ARCH=mips defconfig all
  *** Default configuration is based on target '32r2el_defconfig'
  Using ./arch/mips/configs/generic_defconfig as base
  Merging arch/mips/configs/generic/32r2.config
  Merging arch/mips/configs/generic/el.config
  Merging ./arch/mips/configs/generic/board-boston.config
  Merging ./arch/mips/configs/generic/board-ni169445.config
  Merging ./arch/mips/configs/generic/board-ocelot.config
  Merging ./arch/mips/configs/generic/board-ranchu.config
  Merging ./arch/mips/configs/generic/board-sead-3.config
  Merging ./arch/mips/configs/generic/board-xilfpga.config
  #
  # configuration written to .config
  #
    SYNC    include/config/auto.conf
    CALL    scripts/checksyscalls.sh
    CALL    scripts/atomic/check-atomics.sh
    CHK     include/generated/compile.h
    CHK     include/generated/autoksyms.h

Reported-by: Elliot Berman <eberman@codeaurora.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Bug: 179648610
(cherry picked from commit b33976d90d1ea7652fff662dcc2234f352346a33
 https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
 kbuild)
[eberman: Fixed minor conflicts in kernel/.gitignore]
Change-Id: I8c93147c8d5a48d0f5e9abf855870b10c1a24efc
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2021-04-28 12:57:52 -07:00
Giuliano Procida
c8cd528e75 ANDROID: ABI: add pm_system_cancel_wakeup symbol
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function void pm_system_cancel_wakeup()'

Bug: 186084429
Change-Id: I5ec59917cb2a128b9d0605dd8b3cb8fa7e020af2
Signed-off-by: Venkata Kakani <vkakani@qualcomm.corp-partner.google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-04-26 09:39:26 +01:00
Giuliano Procida
ff320df3e0 ANDROID: power: export pm_system_cancel_wakeup
This symbol is needed by a QCOM driver.

Bug: 186084429
Change-Id: I8001f14a6fded9b58a6dfba424dfa6ebb83543a5
Signed-off-by: Venkata Kakani <vkakani@qualcomm.corp-partner.google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-04-26 08:35:37 +01:00
Jilai Wang
dd2e0a80f1 ANDROID: ABI: Update allowed list for QCOM
Add the following symbols to QCOM allowed-list:
-- bitmap_release_region
-- bitmap_find_free_region

Bug: 186222705

Change-Id: I6dc24587c6e7db35ecac16e6e68d889f79e7dae6
Signed-off-by: Jilai Wang <jilaiw@codeaurora.org>
2021-04-23 17:13:15 -04:00
Paul Lawrence
fad2655cb7 ANDROID: Incremental fs: Set credentials before reading/writing
Use same selinux scheme as incfs v2
Fix memory leak

Bug: 174692664
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I6058ddad9d43ba01b2eabd7d3c576f2cc9b42292
2021-04-22 22:34:21 +00:00
Paul Lawrence
a035201d12 Revert "ANDROID: Incremental fs: Fix memory leak on closing file"
This reverts commit 152fd8f044.
Reason for revert: rolling the three fixes into one with feature flag
Bug: 174692664
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I9a2e6faa0c2293b691efca8e985390fd94bcf01a
2021-04-22 22:34:14 +00:00
Paul Lawrence
dbee4e7bc4 Revert "ANDROID: Incremental fs: Set credentials before reading/writing"
This reverts commit 28688d32ed.

Reason for revert: rolling the three fixes into one with feature flag
Bug: 174692664
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I85cb75b7acb5606659698a6d0e0918ffb731009d
2021-04-22 22:34:05 +00:00
Paul Lawrence
b6221e3495 Revert "ANDROID: Incremental fs: Fix selinux issues"
This reverts commit 75c93eb439.

Reason for revert: rolling the three fixes into one with feature flag
Bug: 174692664
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I838bed85d6682aba44165a58c22e6a0e10c49d58
2021-04-22 22:33:56 +00:00
Mukesh Ojha
0ade8c4105 ANDROID: ABI: update allowed list for QCOM
Update the android/abi_gki_aarch64_qcom with rtc_add_group addition.
No need to update the .xml file, as it is already updated with
rtc_add_group symbol.

Bug: 185539583
Change-Id: I581bcf83a02a4114a9e7a22397fb52934ea0c52b
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
2021-04-22 18:30:58 +00:00
Howard Chen
ccdcd307cf ANDROID: Update the KMI for virtual platform modules
Leaf changes summary: 1 artifact changed (26 filtered out)
Changed leaf types summary: 0 (26 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function void* vmemdup_user(void*, size_t)'

Bug: 184721371
Test: \
    BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh \
    BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.aarch64 build/build.sh \
    BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.aarch64 build/build_abi.sh --update-symbol-list \
    BUILD_CONFIG=common/build.config.gki.aarch64 build/build_abi.sh --update --print-report

Change-Id: Ib945211cb33806687eccdbe52533abf2db04abcf
Signed-off-by: Howard Chen <howardsoc@google.com>
2021-04-22 11:30:41 +08:00
Jindong Yue
b3f4130630 ANDROID: ABI: Update symbol list for imx
Update imx symbol list according to below changes:
 - Replace imx_rproc with imx_rpmsg driver
 - Add two modules: snd-soc-rpmsg-pcm512x.ko and
snd-soc-rpmsg-imx-pcm512x.ko

Leaf changes summary: 4 artifacts changed (26 filtered out)
Changed leaf types summary: 0 (26 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 4 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

4 Added functions:

  [A] 'function int snd_interval_ranges(snd_interval*, unsigned int, const snd_interval*, unsigned int)'
  [A] 'function int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime*, unsigned int, snd_pcm_hw_param_t, const snd_pcm_hw_constraint_ratnums*)'
  [A] 'function int snd_soc_limit_volume(snd_soc_card*, const char*, int)'
  [A] 'function int snd_soc_params_to_frame_size(snd_pcm_hw_params*)'

Bug: 159736148
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I04c696219cdfead30a00201000251bd989814ec5
2021-04-21 10:37:50 +08:00
Nick Desaulniers
67e9dbddb5 ANDROID: clang: update to 12.0.5
Bug: 185804542
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: If3d0c122472d8979b326d8a6fece30d8b2af962a
2021-04-19 19:41:50 +00:00
A. Cody Schuffelen
91d8a13f43 FROMGIT: virt_wifi: Return micros for BSS TSF values
cfg80211_inform_bss expects to receive a TSF value, but is given the
time since boot in nanoseconds. TSF values are expected to be at
microsecond scale rather than nanosecond scale.

Bug: 181840234
Test: atest CtsWifiTestCases:android.net.wifi.cts.ScanResultTest#testScanResultTimeStamp -- --abi x86_64
Signed-off-by: A. Cody Schuffelen <schuffelen@google.com>
Link: https://lore.kernel.org/r/20210318200419.1421034-1-schuffelen@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit b57aa17f07c9270e576ef7df09f142978b5a75f0
https: //git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git master)
Change-Id: Icafc24ad303357926cbe955ffa12e28e0bf31e6f
2021-04-12 20:35:25 -07:00
Matthias Maennich
8aa2c72ddf ANDROID: android/OWNERS: drop gki-abi-approvers@
Group support is not implemented and this rather disturbes downstream
merges. So, drop them.

Fixes: 2fa0951b66b3 ("ANDROID: Initial Android 12 OWNERS for abi metafiles")
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I7d1462ff87b05eb678b1c97f5e0b89b97d4e91a5
2021-04-07 10:22:34 +01:00
Matthias Maennich
9b465a062d ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS
This was generated with
  $ build/synchronize_owners common-mainline/ android-mainline common11-5.4/

Bug: 184248201
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I5e56eb34fcbb5a2a013dd03bc9dcc4f159fb90de
2021-04-01 13:45:14 +00:00
Ram Muthiah
884688fe0c ANDROID: Make vsock virtio packet buff size configurable
When the android virtual device stays up for long periods of time, the
SLAB sustains everincreasing fragmentation. Contributing to this
fragmentation are the virtio packet buffer allocations which are a
drain on 64Kb compound pages. Eventually these can't be allocated due to
fragmentation.

To enable successful allocations for this packet buffer, the packet
buffer's size needs to be reduced.

To enable a reduction without impacting other partners, this var is
being exposed as a command line param.

Bug: 149494272
Test: atest ManagedProfileLifecycleStressTest#testCreateStartDelete on
local cuttlefish device
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: Ia4f9180025b64d61d9e2b882daa84460b8f08fd2
2021-03-25 19:12:07 +00:00
Giuliano Procida
ae37e86392 ANDROID: refresh ABI XML to new version
This is an incompatible ABI XML version change.

Bitfield offsets are now correct.

Bug: 183612421
Change-Id: Id1c656ffb78535b999cae5e395deaf32656b58b2
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-03-25 00:08:43 +00:00
Giuliano Procida
35b7fe6c12 ANDROID: Refresh GKI ABI XML
There are no actually ABI differences. This is just a refresh before
switching to a new version of libabigail and an incompatible ABI XML
version.

Bug: 183612421
Change-Id: I62e7eb766df62dd8b4b459f16fc321d40eb75772
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-03-24 23:59:59 +00:00
Howard Chen
d71d55b76b ANDROID: ABI: Update symbol list for cuttlefish
The cuttlefish symbol list is out-of-date. Add init_user_ns and
ns_capable_noaudit required by vsock.ko

This update is required by the merge to 5.4.86 which saw the vsock.ko
module add a dependency.

Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added function:

  [A] 'function bool ns_capable_noaudit(user_namespace*, int)'

1 Added variable:

  [A] 'user_namespace init_user_ns'

Bug: 183086563
Signed-off-by: Howard Chen <howardsoc@google.com>
Change-Id: I7c175da4ab2fa7220408e6b8d69b3c2803915ce3
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2021-03-24 16:35:47 +00:00
Steve Muckle
a5dc6e5d9e ANDROID: GKI: enable CONFIG_SONY_FF
Bug: 168719305
Signed-off-by: Steve Muckle <smuckle@google.com>
Change-Id: Id9ebb1937b669b999ccc5daccaadb04f88449497
2021-03-24 15:28:35 +00:00
Jian Gong
e01b338f5e ANDROID: ABI: update symbols to unisoc whitelist to android11-k5.4
Update whitelist for the symbols used by the unisoc device and
update the ABI representation accordingly.

Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function void clear_nlink(inode*)'

Bug: 183260329
Change-Id: Ia406458f6f80abf9a34528c77a8184513f3cfc11
Signed-off-by: Jian Gong <jian.gong@unisoc.com>
2021-03-23 11:08:03 +00:00
Xiaowen Wu
c9c1aa8cfe ANDROID: ABI: Update allowed list for QCOM
Leaf changes summary: 5 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 5 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

5 Added functions:

  [A] 'function int drm_gem_shmem_dumb_create(drm_file*, drm_device*, drm_mode_create_dumb*)'
  [A] 'function sg_table* drm_gem_shmem_get_pages_sgt(drm_gem_object*)'
  [A] 'function int drm_gem_shmem_mmap(file*, vm_area_struct*)'
  [A] 'function drm_gem_object* drm_gem_shmem_prime_import_sg_table(drm_device*, dma_buf_attachment*, sg_table*)'
  [A] 'function drm_plane* drm_plane_from_index(drm_device*, int)'

Bug: 183217899
Change-Id: Ifac20381e983ed9030026f232838120df424e9b3
Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org>
2021-03-20 12:03:02 +00:00
Xiaowen Wu
408366e170 ANDROID: GKI: Enable DRM_GEM_SHMEM_HELPER
DRM_GEM_SHMEM_HELPER is needed by DRM driver to support large
shared memory allocation.

Bug: 183221396
Change-Id: I76d58abc357f1685e65fc8dd5e2568e1d307cc38
Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org>
2021-03-20 12:02:49 +00:00
Ashish Chavan
a7c0b02b68 ANDROID: GKI: Update abi_gki_aarch64_qcom
Add alarm_expires_remaining symbol in abi_gki_aarch64_qcom
to be used in smb5 driver.

Bug: 183182450
Change-Id: Ifba9354ed4249c2408782ffef577d965bd4ef206
Signed-off-by: Ashish Chavan <ashichav@codeaurora.org>
2021-03-19 23:11:47 +00:00
Nick Desaulniers
4a669f5150 ANDROID: clang: update to 12.0.4
Bug: 183031914
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ib32ee605e010362c855f11f551755755bbb1e967
2021-03-19 13:17:21 -07:00
Daiyue Zhang
3c6774301d FROMGIT: configfs: fix a use-after-free in __configfs_open_file
Commit b0841eefd9 ("configfs: provide exclusion between IO and removals")
uses ->frag_dead to mark the fragment state, thus no bothering with extra
refcount on config_item when opening a file. The configfs_get_config_item
was removed in __configfs_open_file, but not with config_item_put. So the
refcount on config_item will lost its balance, causing use-after-free
issues in some occasions like this:

Test:
1. Mount configfs on /config with read-only items:
drwxrwx--- 289 root   root            0 2021-04-01 11:55 /config
drwxr-xr-x   2 root   root            0 2021-04-01 11:54 /config/a
--w--w--w-   1 root   root         4096 2021-04-01 11:53 /config/a/1.txt
......

2. Then run:
for file in /config
do
echo $file
grep -R 'key' $file
done

3. __configfs_open_file will be called in parallel, the first one
got called will do:
if (file->f_mode & FMODE_READ) {
	if (!(inode->i_mode & S_IRUGO))
		goto out_put_module;
			config_item_put(buffer->item);
				kref_put()
					package_details_release()
						kfree()

the other one will run into use-after-free issues like this:
BUG: KASAN: use-after-free in __configfs_open_file+0x1bc/0x3b0
Read of size 8 at addr fffffff155f02480 by task grep/13096
CPU: 0 PID: 13096 Comm: grep VIP: 00 Tainted: G        W       4.14.116-kasan #1
TGID: 13096 Comm: grep
Call trace:
dump_stack+0x118/0x160
kasan_report+0x22c/0x294
__asan_load8+0x80/0x88
__configfs_open_file+0x1bc/0x3b0
configfs_open_file+0x28/0x34
do_dentry_open+0x2cc/0x5c0
vfs_open+0x80/0xe0
path_openat+0xd8c/0x2988
do_filp_open+0x1c4/0x2fc
do_sys_open+0x23c/0x404
SyS_openat+0x38/0x48

Allocated by task 2138:
kasan_kmalloc+0xe0/0x1ac
kmem_cache_alloc_trace+0x334/0x394
packages_make_item+0x4c/0x180
configfs_mkdir+0x358/0x740
vfs_mkdir2+0x1bc/0x2e8
SyS_mkdirat+0x154/0x23c
el0_svc_naked+0x34/0x38

Freed by task 13096:
kasan_slab_free+0xb8/0x194
kfree+0x13c/0x910
package_details_release+0x524/0x56c
kref_put+0xc4/0x104
config_item_put+0x24/0x34
__configfs_open_file+0x35c/0x3b0
configfs_open_file+0x28/0x34
do_dentry_open+0x2cc/0x5c0
vfs_open+0x80/0xe0
path_openat+0xd8c/0x2988
do_filp_open+0x1c4/0x2fc
do_sys_open+0x23c/0x404
SyS_openat+0x38/0x48
el0_svc_naked+0x34/0x38

To fix this issue, remove the config_item_put in
__configfs_open_file to balance the refcount of config_item.

Fixes: b0841eefd9 ("configfs: provide exclusion between IO and removals")
Signed-off-by: Daiyue Zhang <zhangdaiyue1@huawei.com>
Signed-off-by: Yi Chen <chenyi77@huawei.com>
Signed-off-by: Ge Qiu <qiuge@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Bug: 174049066
(cherry picked from commit 14fbbc8297728e880070f7b077b3301a8c698ef9
 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master)
Cc: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I745711ed546c1be97360670b77aedfb929bffcec
2021-03-13 14:31:17 +00:00
Farid Chahla
b0cd259c16 ANDROID: GKI: enable hid-playstation driver/rumble
To enable DualSense driver, i.e. hid-playstation, we need to set
CONFIG_HID_PLAYSTATION to "y". To enable Dualsense rumble, we need to
set CONFIG_PLAYSTATION_FF to "y".

Bug: 167947264
Change-Id: Ic2e31a6f53bfdef113eeee07277ef6b2a28dce2d
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2021-03-12 17:11:37 -08:00
Roderick Colenbrander
fb66b3f219 UPSTREAM: HID: playstation: add DualSense player LED support.
The DualSense features 5 player LEDs below its touchpad, which are
meant as player id indications. The LEDs are configured with a
player ID determined by an ID allocator, which assign player ids
to ps_device instances.

This patch is a combination of the following original patches
minus use of LED framework APIs:
- HID: playstation: add DualSense player LEDs support.
- HID: playstation: DualSense set LEDs to default player id.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Reviewed-by: Barnabás Pőcze <pobrn@protonmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Bug: 167947264
Change-Id: I2a9ef9949bb82df18247a14e64cb8c54e9b3924c
(cherry picked from commit 949aaccda019723050a2cd98d7b4492b06423f27)
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2021-03-12 17:11:37 -08:00
Roderick Colenbrander
faff2c6cd8 UPSTREAM: HID: playstation: add microphone mute support for DualSense.
The DualSense controller has a built-in microphone exposed as an
audio device over USB (or HID using Bluetooth). A dedicated
button on the controller handles mute, but software has to configure
the device to mute the audio stream.

This patch captures the mute button and schedules an output report
to mute/unmute the audio stream as well as toggle the mute LED.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Reviewed-by: Barnabás Pőcze <pobrn@protonmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Bug: 167947264
Change-Id: I6fce08b0b28c1cf41c682a2ff5655f00d7a52843
(cherry picked from commit c26e48b150fccb07c4b7f0f419f2b0a2c42e57d2)
Signed-off-by: Farid Chahla <farid.chahla@sony.com>
2021-03-12 17:11:37 -08:00