Commit graph

878,078 commits

Author SHA1 Message Date
Will Deacon
699273787c FROMGIT: samples/hw_breakpoint: drop use of kallsyms_lookup_name()
The 'data_breakpoint' test code is the only modular user of
kallsyms_lookup_name(), which was exported as part of fixing the test in
f60d24d2ad ("hw-breakpoints: Fix broken hw-breakpoint sample module").

In preparation for un-exporting this symbol, switch the test over to using
__symbol_get(), which can be used to place breakpoints on exported
symbols.

Bug: 149978696
Change-Id: I589142af97a34484f9fa551b934148f445b33243
Link: http://lkml.kernel.org/r/20200221114404.14641-3-will@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Quentin Perret <qperret@google.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit e108898157d888c827a7176e02648cc3bd87025b
 https://github.com/hnaz/linux-mm.git master)
Signed-off-by: Quentin Perret <qperret@google.com>
2020-03-12 11:15:54 +00:00
Will Deacon
37e6992fe9 FROMGIT: samples/hw_breakpoint: drop HW_BREAKPOINT_R when reporting writes
Patch series "Unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()".

Despite having just a single modular in-tree user that I could spot,
kallsyms_lookup_name() is exported to modules and provides a mechanism
for out-of-tree modules to access and invoke arbitrary, non-exported
kernel symbols when kallsyms is enabled.

This patch series fixes up that one user and unexports the symbol along
with kallsyms_on_each_symbol(), since that could also be abused in a
similar manner.

I would like to avoid out-of-tree modules being easily able to call
functions that are not exported.  kallsyms_lookup_name() makes this
trivial to the point that there is very little incentive to rework these
modules to either use upstream interfaces correctly or propose
functionality which may be otherwise missing upstream.  Both of these
latter solutions would be pre-requisites to upstreaming these modules, and
the current state of things actively discourages that approach.

The background here is that we are aiming for Android devices to be able
to use a generic binary kernel image closely following upstream, with any
vendor extensions coming in as kernel modules.  In this case, we (Google)
end up maintaining the binary module ABI within the scope of a single LTS
kernel.  Monitoring and managing the ABI surface is not feasible if it
effectively includes all data and functions via kallsyms_lookup_name().
Of course, we could just carry this patch in the Android kernel tree, but
we're aiming to carry as little as possible (ideally nothing) and I think
it's a sensible change in its own right.  I'm surprised you object to it,
in all honesty.

Now, you could turn around and say "that's not upstream's problem", but it
still seems highly undesirable to me to have an upstream bypass for
exported symbols that isn't even used by upstream modules.  It's ripe for
abuse and encourages people to work outside of the upstream tree.  The
usual rule is that we don't export symbols without a user in the tree and
that seems especially relevant in this case.

Joe Lawrence said:

: FWIW, kallsyms was historically used by the out-of-tree kpatch support
: module to resolve external symbols as well as call set_memory_r{w,o}()
: API.  All of that support code has been merged upstream, so modern kpatch
: modules* no longer leverage kallsyms by default.
:
: That said, there are still some users who still use the deprecated support
: module with newer kernels, but that is not officially supported by the
: project.

This patch (of 3):

Given the name of a kernel symbol, the 'data_breakpoint' test claims to
"report any write operations on the kernel symbol".  However, it creates
the breakpoint using both HW_BREAKPOINT_W and HW_BREAKPOINT_R, which menas
it also fires for read access.

Drop HW_BREAKPOINT_R from the breakpoint attributes.

Bug: 149978696
Change-Id: I12f793136a7187c844841e7dd65b90645d5519f6
Link: http://lkml.kernel.org/r/20200221114404.14641-2-will@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Quentin Perret <qperret@google.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 0c1b9251116b972cafa3cf16bd02cb2354535b38
 https://github.com/hnaz/linux-mm.git master)
Signed-off-by: Quentin Perret <qperret@google.com>
2020-03-12 11:15:30 +00:00
Eric Biggers
f8600bc4a0 UPSTREAM: fscrypt: don't evict dirty inodes after removing key
After FS_IOC_REMOVE_ENCRYPTION_KEY removes a key, it syncs the
filesystem and tries to get and put all inodes that were unlocked by the
key so that unused inodes get evicted via fscrypt_drop_inode().
Normally, the inodes are all clean due to the sync.

However, after the filesystem is sync'ed, userspace can modify and close
one of the files.  (Userspace is *supposed* to close the files before
removing the key.  But it doesn't always happen, and the kernel can't
assume it.)  This causes the inode to be dirtied and have i_count == 0.
Then, fscrypt_drop_inode() failed to consider this case and indicated
that the inode can be dropped, causing the write to be lost.

On f2fs, other problems such as a filesystem freeze could occur due to
the inode being freed while still on f2fs's dirty inode list.

Fix this bug by making fscrypt_drop_inode() only drop clean inodes.

I've written an xfstest which detects this bug on ext4, f2fs, and ubifs.

Fixes: b1c0ec3599 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl")
Cc: <stable@vger.kernel.org> # v5.4+
Link: https://lore.kernel.org/r/20200305084138.653498-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>

(cherry picked from commit 2b4eae95c7361e0a147b838715c8baa1380a428f)
Bug: 150589360
Test: kvm-xfstests -c ext4,f2fs -g encrypt
Change-Id: Ia32db980c2fffb68caeaf9f38e5cfbe781b45011
Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-03-11 21:36:59 +00:00
Liangcai Fan
783e9a76d7 ANDROID: ABI/Whitelist: update whitelist of unisoc upstream code
Enable config as m of unisoc upstream code.This adds a whitelist for
the symbols used by the unisoc device.

Also update the ABI representation accordingly:

Leaf changes summary: 97 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 97 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variables

Bug: 147075469
Change-Id: I5f9f2b759af08985060a548d79b6aafbf6bcf3c0
Signed-off-by: Liangcai Fan <liangcai.fan@unisoc.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-03-11 21:28:46 +01:00
Alistair Delva
6ae7daaf75 ANDROID: gki_defconfig: Enable CONFIG_VM_EVENT_COUNTERS
This was "default y" but disabled manually because we set
CONFIG_EXPERT=y. Disabling it does not seem to be a big win and we have
had requests to enable it.

Bug: 150871026
Change-Id: I4a7f8da1e8480dc46f168def89016a5152e421ea
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-11 18:58:14 +00:00
Alistair Delva
0ac7d561e7 ANDROID: gki_defconfig: Enable CONFIG_CLEANCACHE
Bug: 150870780
Change-Id: Ib48738ee065492c4545ebbd525827c5e3c3c162a
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-11 18:58:08 +00:00
Alistair Delva
3d3b21c034 ANDROID: arm64: update the abi with the new gki_defconfig
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 1 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Removed function:

  [D] 'function void* __devres_alloc_node(dr_release_t, size_t, gfp_t, int, const char*)'

Bug: 147894960
Change-Id: I947e7fe2b9fe1fd809a1901a6af2a1cd42ae5b0e
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-11 11:56:42 -07:00
Suren Baghdasaryan
1984c921e8 ANDROID: gki_defconfig: disable CONFIG_DEBUG_DEVRES
Disable CONFIG_DEBUG_DEVRES to fix ABI differences caused by changes to
devres_alloc_node function when this debug option is enabled.

Bug: 151110905
Test: build
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I27ba172843c80ffd1dfbcc6cc4d706c5b18eb5d3
2020-03-11 09:02:30 -07:00
Greg Kroah-Hartman
fdc714f780 ANDROID: Update the abi xml file
Seems no one has done this in a while :(

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

4 Removed functions:

  [D] 'function void __this_cpu_preempt_check(const char*)'
  [D] 'function unsigned int debug_smp_processor_id()'
  [D] 'function void preempt_count_add(int)'
  [D] 'function void preempt_count_sub(int)'

'struct task_struct at sched.h:624:1' changed:
  type size changed from 29184 to 28672 (in bits)
  1 data member deletion:
    'unsigned long int task_struct::preempt_disable_ip', at offset 18816 (in bits) at sched.h:1070:1

  there are data member changes:
   'tlbflush_unmap_batch task_struct::tlb_ubc' offset changed from 18880 to 18816 (in bits) (by -64 bits)
   offset changed from 18880 to 18816 (in bits) (by -64 bits)
   'pipe_inode_info* task_struct::splice_pipe' offset changed from 19008 to 18944 (in bits) (by -64 bits)
   'page_frag task_struct::task_frag' offset changed from 19072 to 19008 (in bits) (by -64 bits)
   'int task_struct::nr_dirtied' offset changed from 19200 to 19136 (in bits) (by -64 bits)
   'int task_struct::nr_dirtied_pause' offset changed from 19232 to 19168 (in bits) (by -64 bits)
   'unsigned long int task_struct::dirty_paused_when' offset changed from 19264 to 19200 (in bits) (by -64 bits)
   'u64 task_struct::timer_slack_ns' offset changed from 19328 to 19264 (in bits) (by -64 bits)
   'u64 task_struct::default_timer_slack_ns' offset changed from 19392 to 19328 (in bits) (by -64 bits)
   'unsigned long int task_struct::trace' offset changed from 19456 to 19392 (in bits) (by -64 bits)
   'unsigned long int task_struct::trace_recursion' offset changed from 19520 to 19456 (in bits) (by -64 bits)
   'mem_cgroup* task_struct::memcg_in_oom' offset changed from 19584 to 19520 (in bits) (by -64 bits)
   'gfp_t task_struct::memcg_oom_gfp_mask' offset changed from 19648 to 19584 (in bits) (by -64 bits)
   'int task_struct::memcg_oom_order' offset changed from 19680 to 19616 (in bits) (by -64 bits)
   'unsigned int task_struct::memcg_nr_pages_over_high' offset changed from 19712 to 19648 (in bits) (by -64 bits)
   'mem_cgroup* task_struct::active_memcg' offset changed from 19776 to 19712 (in bits) (by -64 bits)
   'request_queue* task_struct::throttle_queue' offset changed from 19840 to 19776 (in bits) (by -64 bits)
   'uprobe_task* task_struct::utask' offset changed from 19904 to 19840 (in bits) (by -64 bits)
   'int task_struct::pagefault_disabled' offset changed from 19968 to 19904 (in bits) (by -64 bits)
   'task_struct* task_struct::oom_reaper_list' offset changed from 20032 to 19968 (in bits) (by -64 bits)
   'vm_struct* task_struct::stack_vm_area' offset changed from 20096 to 20032 (in bits) (by -64 bits)
   'refcount_t task_struct::stack_refcount' offset changed from 20160 to 20096 (in bits) (by -64 bits)
   'void* task_struct::security' offset changed from 20224 to 20160 (in bits) (by -64 bits)
   'thread_struct task_struct::thread' offset changed from 20352 to 20224 (in bits) (by -128 bits)

  1372 impacted interfaces:

Change-Id: Ie38f13364e737ee552eb7985e11d6af273c5b12a
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2020-03-11 14:24:06 +01:00
Greg Kroah-Hartman
9c40680311 ANDROID: GKI: arm64: reserve space in cpu_hwcaps and cpu_hwcap_keys arrays
Since cpu_hwcaps and cpu_hwcap_keys are exported symbols, reserve
space in them for any future cpu capabilities or erratas.

Bug: 151154716
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I35930dd52d98817831d812f35560a2605804a553
2020-03-11 12:59:50 +01:00
Baolin Wang
3ebeb56872 FROMGIT: power: supply: Allow charger manager can be built as a module
Allow charger manager can be built as a module like other charger
drivers.

Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/lkml/5e098be25c70e07c37e743f84a901f6f756090e0
.1583461755.git.baolin.wang7@gmail.com/
(cherry picked from commit 241eaabc3c315cdfea505725a43de848f498527f
https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next)
Bug: 148055746
Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
Change-Id: I2dbe3d09a4779c64ca2508417e819428638a3629
2020-03-10 23:34:32 +00:00
Will McVicker
9b41023b4e ANDROID: arm64: gki_defconfig: disable CONFIG_DEBUG_PREEMPT
We don't need this. So disable to improve the ABI diff with vendors.

Signed-off-by: Will McVicker <willmcvicker@google.com>
Bug: 148870985
Test: compile test
Change-Id: I70690c8be2c3ffcc77f7c8c1d472be0ffffd0587
2020-03-10 17:23:55 +00:00
Liam Mark
2f573c4b5b ANDROID: iommu/iova: Fix to use __alloc_and_insert_iova_best_fit
Looks like there was a merge issue when pulling the following upstream
change:
https://lore.kernel.org/lkml/7239ddd532e94a4371289f3be23c66a3@codeaurora.org/

Fix so that it correctly calls __alloc_and_insert_iova_best_fit when
best_fit is set.

Bug: 149544392
Change-Id: I6b9992dedf4991dee088e77767e0dc077758b581
Signed-off-by: Liam Mark <lmark@codeaurora.org>
2020-03-10 09:43:16 -07:00
Greg Kroah-Hartman
e15f370e91 ANDROID: enable CONFIG_WATCHDOG_CORE=y
WATCHDOG was enabled, but we forgot about the watchdog core code, so
turn it on as well so that all vendors do not have to enable it in their
configs.

Reported-by: Orson Zhai <orsonzhai@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iac14e304b15f774d52fb07aa65df86f3dd71797f
2020-03-10 15:01:24 +00:00
Quentin Perret
28c9f3aac1 ANDROID: kbuild: align UNUSED_KSYMS_WHITELIST with upstream
The UNUSED_KSYMS_WHITELIST feature as been merged in ACK as FROMLIST v5,
but the v6 got recently queued with minor changes.

Align the Android code with what will be merged upstream.

Bug: 148277666
Fixes: c5a5b70cff ("FROMLIST: kbuild: allow symbol whitelisting with
TRIM_UNUSED_KSYMS")
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I41726e3fba6e299bb541f93ae9ac31add0c08b60
2020-03-10 13:10:27 +00:00
Daniel Rosenberg
abc6db278c FROMLIST: f2fs: fix wrong check on F2FS_IOC_FSSETXATTR
This fixes the incorrect failure when enabling project quota on
casefold-enabled file.

Cc: Daniel Rosenberg <drosen@google.com>
Cc: kernel-team@android.com
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Link: https://lore.kernel.org/linux-f2fs-devel/20200307002440.GA7944@google.com/
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ib2f8db5e20aabf5a4e6e9ebbc071166e8bd3220f
2020-03-09 15:57:22 -07:00
Will McVicker
63cf6d67c6 ANDROID: gki_defconfig: enable CONFIG_TYPEC
This is a common config across many devices that we'd like to stablize.

Signed-off-by: Will McVicker <willmcvicker@google.com>
Bug: 150877929
Change-Id: Id56250664324ecbac2c1497ab5eb49c3306ee535
2020-03-09 19:51:41 +00:00
Stanley Chu
3f4f220fda UPSTREAM: scsi: ufs: ufs-mediatek: add waiting time for reference clock
Some delays may be required either after gating or before ungating
reference clock for device according to vendor requirements.

Note that in UFS 3.0, the delay time after gating reference
clock can be defined by attribute bRefClkGatingWaitTime. Use the
formal value instead if it can be queried from device.

Bug: 151050916
(cherry picked from commit b3222c326c965f94b2e8e8ac73dc395ca82cd088)
Link: https://lore.kernel.org/r/20200220134848.8807-2-stanley.chu@mediatek.com
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>
Change-Id: I4e5deff2d358ed62bd8a884eb0d186e5651582eb
2020-03-09 17:40:34 +08:00
Stanley Chu
71d7a8660f UPSTREAM: scsi: ufs: introduce common function to disable host TX LCC
Many vendors would like to disable host TX LCC during initialization
flow. Introduce a common function for all users to make drivers easier to
read and maintained. This patch does not change any functionality.

Bug: 151050916
(cherry picked from commit 984eaac133e3d6d993ffd4de9e4bdc2c94de742b)
Link: https://lore.kernel.org/r/20200207070357.17169-3-stanley.chu@mediatek.com
Reviewed-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Change-Id: Ib40f9228475e74377178b41f0ffa6f46470c52e3
2020-03-09 17:40:20 +08:00
Stanley Chu
3de2be2bda UPSTREAM: scsi: ufs: ufs-mediatek: fix TX LCC disabling timing
MediaTek UFS host requires TX LCC to be disabled on both host and device
sides. This can be done by disabling host's local TX LCC before link
startup. Correct TX LCC disabling timing in MediaTek UFS driver.

Bug: 151050916
(cherry picked from commit 618b4d07a4420ca9f01837f183ce7b1ac0b31307)
Link: https://lore.kernel.org/r/20200207070357.17169-2-stanley.chu@mediatek.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Change-Id: Ic37378698fee798462142461a8a9276e8dd3d726
2020-03-09 17:40:08 +08:00
Stanley Chu
6aafe1a049 UPSTREAM: scsi: ufs: ufs-mediatek: gate ref-clk during Auto-Hibern8
In current UFS driver design, hba->uic_link_state will not be changed after
link enters Hibern8 state by Auto-Hibern8 mechanism.  In this case,
reference clock gating will be skipped unless special handling is
implemented in vendor's callbacks.

Support reference clock gating during Auto-Hibern8 period in MediaTek
Chipsets: If link state is already in Hibern8 while Auto-Hibern8 feature is
enabled, gate reference clock in setup_clocks callback.

Bug: 151050916
(cherry picked from commit 722adbbd706569bc547aeb2adcd706f55b2ac6f8)
Link: https://lore.kernel.org/r/20200129105251.12466-5-stanley.chu@mediatek.com
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
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>
Change-Id: I3df8911962ccbcabf07f7a26135fba4fe6c85b8e
2020-03-09 17:39:47 +08:00
Stanley Chu
9d16d4069d UPSTREAM: scsi: ufs: fix Auto-Hibern8 error detection
Auto-Hibern8 may be disabled by some vendors or sysfs in runtime even if
Auto-Hibern8 capability is supported by host. If Auto-Hibern8 capability is
supported by host but not actually enabled, Auto-Hibern8 error shall not
happen.

To fix this, provide a way to detect if Auto-Hibern8 is actually enabled
first, and bypass Auto-Hibern8 disabling case in
ufshcd_is_auto_hibern8_error().

Bug: 151050916
(cherry picked from commit 5a244e0ea67b293abb1d26c825db2ddde5f2862f)
Fixes: 8217444039 ("scsi: ufs: Add error-handling of Auto-Hibernate")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200129105251.12466-4-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
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>
Change-Id: I04557ed9ad16a22cdf68e455e78dd0b4a7417d60
2020-03-09 17:39:35 +08:00
Stanley Chu
9c4239e59e UPSTREAM: scsi: ufs: ufs-mediatek: support linkoff state during suspend
If system suspend or runtime suspend mode is configured as linkoff state,
phy can be powered off and reference clock can be gated in MediaTek
Chipsets.

At the same time, remove redundant reference clock control in suspend and
resume callbacks because such control can be well-handled in setup_clocks
callback.

Bug: 151050916
(cherry picked from commit 2a06ff207445ddb7aa643751f85c54e7e3895fb4)
Link: https://lore.kernel.org/r/20200129105251.12466-3-stanley.chu@mediatek.com
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
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>
Change-Id: Ie20657f1cd249ff6356d4a51f0d4dc6af1c2dd00
2020-03-09 17:39:22 +08:00
Stanley Chu
2b1980eed5 UPSTREAM: scsi: ufs: ufs-mediatek: ensure UniPro is not powered down before linkup
MediaTek Chipsets can enter proprietary UniPro low-power mode during
suspend while link is in hibern8 state. Make sure leaving low-power mode
before every link startup to prevent lockup in any possible error recovery
path.

At the same time, re-factor related funcitons to improve code readability.

Bug: 151050916
(cherry picked from commit 7742ca797aa79f280853ffd3e7d2e2af3cd317a5)
Link: https://lore.kernel.org/r/20200129105251.12466-2-stanley.chu@mediatek.com
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
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>
Change-Id: I98a583a0b3e490465a572e45ba64ae5605bb65e1
2020-03-09 17:38:19 +08:00
Bean Huo
a74f79b3ba UPSTREAM: scsi: ufs: Move ufshcd_get_max_pwr_mode() to ufshcd_device_params_init()
ufshcd_get_max_pwr_mode() only need to be called once while booting, take
it out from ufshcd_probe_hba() and inline into ufshcd_device_params_init().

Bug: 151050916
(cherry picked from commit 2b35b2adfecd456c98b9828e03900e7be9f1b33d)
Link: https://lore.kernel.org/r/20200120130820.1737-5-huobean@gmail.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Change-Id: I45bcece2be78cb76fe5e48179db43a65fec6f58c
2020-03-09 17:36:33 +08:00
Bean Huo
da4217b8a1 BACKPORT: scsi: ufs: Split ufshcd_probe_hba() based on its called flow
This patch has two major non-functionality changes:

1. Take scanning host if-statement out from ufshcd_probe_hba(), and move
into a new added function ufshcd_add_lus().  In this new function
ufshcd_add_lus(), the main functionalitis include: ICC initialization, add
well-known LUs, devfreq initialization, UFS bsg probe and scsi host
scan. The reason for this change is that these functionalities only being
called during booting stage flow ufshcd_init()->ufshcd_async_scan(). In the
processes of error handling and power management ufshcd_suspend(),
ufshcd_resume(), ufshcd_probe_hba() being called, but these functionalitis
above metioned are not hit.

2. Move context of initialization of parameters associated with the UFS
device to a new added function ufshcd_device_params_init().  The reason of
this change is that all of these parameters are used by driver, but only
need to be initialized once when booting. Combine them into an integral
function, make them easier maintain.

Bug: 151050916
(cherry picked from commit 1b9e21412f72d6f89e2bcc5f24b5e9a010c8a74f)
[ Resolved minor conflict in drivers/scsi/ufshcd.c ]
Link: https://lore.kernel.org/r/20200120130820.1737-4-huobean@gmail.com
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Change-Id: I408417f676dc9d5976b5367f0069b38d220776d0
2020-03-09 17:34:34 +08:00
Saravana Kannan
3334f0da66 FROMGIT: driver core: Reevaluate dev->links.need_for_probe as suppliers are added
A previous patch 03324507e66c ("driver core: Allow
fwnode_operations.add_links to differentiate errors") forgot to update
all call sites to fwnode_operations.add_links. This patch fixes that.

Legend:
-> Denotes RHS is an optional/potential supplier for LHS
=> Denotes RHS is a mandatory supplier for LHS

Example:

Device A => Device X
Device A -> Device Y

Before this patch:
1. Device A is added.
2. Device A is marked as waiting for mandatory suppliers
3. Device X is added
4. Device A is left marked as waiting for mandatory suppliers

Step 4 is wrong since all mandatory suppliers of Device A have been
added.

After this patch:
1. Device A is added.
2. Device A is marked as waiting for mandatory suppliers
3. Device X is added
4. Device A is no longer considered as waiting for mandatory suppliers

This is the correct behavior.

Fixes: 03324507e66c ("driver core: Allow fwnode_operations.add_links to differentiate errors")
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20200222014038.180923-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1745d299af5b373abad08fa29bff0d31dc6aff21
https: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git driver-core-next)
Bug: 150980623
Change-Id: I15210d65db4660dd315a09ff18f4499768f24378
2020-03-06 16:14:35 -08:00
Saravana Kannan
a27e0934de FROMGIT: driver core: Call sync_state() even if supplier has no consumers
The initial patch that added sync_state() support didn't handle the case
where a supplier has no consumers. This was because when a device is
successfully bound with a driver, only its suppliers were checked to see
if they are eligible to get a sync_state(). This is not sufficient for
devices that have no consumers but still need to do device state clean
up. So fix this.

Fixes: fc5a251d0fd7ca90 (driver core: Add sync_state driver/bus callback)
Signed-off-by: Saravana Kannan <saravanak@google.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200221080510.197337-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 21eb93f432b1a785df193df1a56a59e9eb3a985f
https: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git driver-core-linus)
Bug: 150980623
Change-Id: I9bebc164f00d7797501f40080c12a04dbe3095b1
2020-03-06 16:14:26 -08:00
Connor O'Brien
71a145c48b ANDROID: cpufreq: times: Remove per-UID time in state tracking
This removes the portion of commit c408992c71 ("ANDROID: cpufreq:
times: track per-uid time in state") adding per-UID tracking, while
preserving an added null check in the per-task tracking code.

Bug: 127641090
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Iae3e0abef32cbbb9fdc674079973040be0060ac7
2020-03-06 20:23:16 +00:00
Connor O'Brien
10fd62c4e1 Revert "ANDROID: proc: Add /proc/uid directory"
This reverts commit 864b400f49.

Bug: 127641090
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I679a4cd5c697e6693c785ccc3535d60420fc7b5d
2020-03-06 20:23:08 +00:00
Connor O'Brien
f6a64d9ab3 Revert "ANDROID: cpufreq: Add time_in_state to /proc/uid directories"
This reverts commit ce765ecd8d.

Bug: 127641090
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: If2218dbb21dfd807f8eed79092c9e77f7e1ea840
2020-03-06 20:22:59 +00:00
Connor O'Brien
45d29ac0ed ANDROID: cpufreq: times: Remove /proc/uid_concurrent_{active,policy}_time
This removes the portion of commit 4242998e5b ("ANDROID: cpufreq:
times: add /proc/uid_concurrent_{active,policy}_time") adding new
files for per-UID stats while preserving a change to skip accounting
for idle tasks.

Bug: 127641090
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I1e334dcc71201118aa62115fa5247263e545e8d6
2020-03-06 20:22:52 +00:00
Jerry (Fangzhi) Zuo
b7e59246ba ANDROID: drm: Add support for DP 1.4 Compliance edid corruption test
Unlike DP 1.2 edid corruption test, DP 1.4 requires to calculate
real CRC value of the last edid data block, and write it back.
Current edid CRC calculates routine adds the last CRC byte,
and check if non-zero.

This behavior is not accurate; actually, we need to return
the actual CRC value when corruption is detected.
This commit changes this issue by returning the calculated CRC,
and initiate the required sequence.

Change since v7
- Fix for CI.CHECKPATCH

Change since v6
- Add return check

Change since v5
- Obtain real CRC value before dumping bad edid

Change since v4
- Fix for CI.CHECKPATCH

Change since v3
- Fix a minor typo.

Change since v2
- Rewrite checksum computation routine to avoid duplicated code.
- Rename to avoid confusion.

Change since v1
- Have separate routine for returning real CRC.

Change-Id: I6a67007357e5176994f54c4f30c07f42a2d57bd7
Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
[abhinavk: resolved conflict with android-5.4's drm_dp_helper.h]
Bug: 139653858
Link: https://patchwork.kernel.org/patch/11375865/
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
2020-03-06 20:13:52 +00:00
Abhinav Kumar
4e5eb362b0 Revert "ANDROID: drm: Add support for DP 1.4 Compliance edid corruption test"
A newer version of the patch is now available upstream.
This reverts commit 132de0efda.

Bug: 139653858
Change-Id: I5a1816bf843f81eb484a8f28fac13cf9660f62be
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
2020-03-06 20:13:44 +00:00
Hridya Valsaraju
2f47611ced ANDROID: staging: ion: Add an in-kernel interface to request heap info.
Add an API to allow in-kernel clients to request heap ID info.

Test: make
Bug: 149961819

Change-Id: I59d26355115f100a60bcf8ade0e3afa4b89c5d0a
Signed-off-by: Hridya Valsaraju <hridya@google.com>
(cherry picked from commit 0a6517f730e883edb85f5d22b786b927dba7102d)
2020-03-06 19:16:52 +00:00
Kees Cook
e21d1db522 FROMLIST: lib: test_stackinit.c: XFAIL switch variable init tests
The tests for initializing a variable defined between a switch
statement's test and its first "case" statement are currently not
initialized in Clang[1] nor the proposed auto-initialization feature in
GCC.

We should retain the test (so that we can evaluate compiler fixes),
but mark it as an "expected fail". The rest of the kernel source will
be adjusted to avoid this corner case.

Also disable -Wswitch-unreachable for the test so that the intentionally
broken code won't trigger warnings for GCC (nor future Clang) when
initialization happens this unhandled place.

[1] https://bugs.llvm.org/show_bug.cgi?id=44916

Suggested-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
[adelva: cherry picking to avoid boot test flakes]
Bug: 144999193
Link: https://lore.kernel.org/lkml/202002191358.2897A07C6@keescook/
Change-Id: I0e691f2299ab42526ea306a92551a1188c469136
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-06 18:56:31 +00:00
Asutosh Das
3fe2bfe139 UPSTREAM: scsi: ufs: Abort gating if clock on request is pending
This change attempts to abort gating of clocks if a request to turn-on
clocks is pending.  This would in turn avoid turning OFF and back ON the
clocks.

Link: https://lore.kernel.org/r/1573798172-20534-7-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 143632303
Change-Id: Idff21e3cd8f2e51554a1ab1f133733bc573d5597
(cherry picked from commit 18f01374b55b4595ad7f56250891bdbdb9d7a052)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 17:35:21 +00:00
Venkat Gopalakrishnan
fe405481ba UPSTREAM: scsi: ufs: Fix irq return code
Return IRQ_HANDLED only if the irq is really handled, this will help in
catching spurious interrupts that go unhandled.

Link: https://lore.kernel.org/r/1573798172-20534-6-git-send-email-cang@codeaurora.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 143632303
Change-Id: I6632a18e4ed01e4534a832fbc24e37bdb583ca37
(cherry picked from commit 9333d77573485c827b4c0fc960c840df3e5ce719)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 17:35:11 +00:00
Can Guo
aa581c5f7c UPSTREAM: scsi: ufs: Fix register dump caused sleep in atomic context
ufshcd_print_host_regs() can be called by interrupt handler, but it may
sleep due to ufshcd_dump_regs() allocates the dump buffer memory with flag
GFP_KERNEL. Fix it by changing GFP_KERNEL to GFP_ATMOIC.

Link: https://lore.kernel.org/r/1573798172-20534-5-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 143632303
Change-Id: I0caae42ac6df8080876046eea674d08933f769ee
(cherry picked from commit cddaebaf3d81584180d647e9cbda4ecbf8e8e71c)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 17:35:02 +00:00
Can Guo
5b3f757aa4 UPSTREAM: scsi: ufs-qcom: Add reset control support for host controller
Add reset control for host controller so that host controller can be reset
as required in its power up sequence.

Link: https://lore.kernel.org/r/1573798172-20534-3-git-send-email-cang@codeaurora.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 143632303
Change-Id: I92e3c0ea0293603e5aa75566dda98b41fa1978be
(cherry picked from commit 870b1279c7a0344c99d85a9cb1619f6023e752ed)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 17:34:54 +00:00
Can Guo
d1a7ad3b94 UPSTREAM: scsi: ufs: Add device reset in link recovery path
In order to recover from hibern8 exit failure, perform a reset in link
recovery path before issuing link start-up.

Link: https://lore.kernel.org/r/1573798172-20534-2-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 143632303
Change-Id: I635845e97f4bcf59fb2b6f4e7c7e09af1123ce20
(cherry picked from commit ebdd1dfde5d2c9b2532ee5b393d66d8bc5f56177)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 17:34:39 +00:00
Can Guo
8b2b5c662a FROMGIT: scsi: ufs-qcom: Delay specific time before gate ref clk
After enter hibern8, as UFS JEDEC ver 3.0 requires, a specific gating wait
time is required before disable the device reference clock. If it is not
specified, use the old delay.

Link: https://lore.kernel.org/r/1581392451-28743-8-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I44b3cbe583741fcfadbb9952fad1037e08175555
(cherry picked from commit 1cbadd0c331fb151fafc698bf2ecc35122953715
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-05 22:28:50 -08:00
Can Guo
0f7ba9fc97 BACKPORT: FROMGIT: scsi: ufs: Add dev ref clock gating wait time support
In UFS version 3.0, a newly added attribute bRefClkGatingWaitTime defines
the minimum time for which the reference clock is required by device during
transition to LS-MODE or HIBERN8 state. Make this change to reflect the new
requirement by adding delays before turning off the clock.

Link: https://lore.kernel.org/r/1581392451-28743-7-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I33b3c50ae0854621364bb3785c96e951dc7031ef
(cherry picked from commit 09f17791e640dcb8b29cc0b3279e73f48985c2be
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
[can: Resolved minor conflict in drivers/scsi/ufs/ufshcd.c]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-05 22:25:32 -08:00
Can Guo
243498bbdd Revert "FROMLIST: scsi: ufs: Add dev ref clock gating wait time support"
Revert commit 1ddc9771d5bc ("FROMLIST: scsi: ufs: Add dev ref clock gating
wait time support") due to it has major changes in its latest version.

Bug: 150892981
Change-Id: I582da6b0093e46a10e58f8f6a48448cd7ae36ac4
[can: Resolved minor conflict in drivers/scsi/ufs/ufs.h]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-05 22:20:22 -08:00
Can Guo
799c84f1e2 FROMGIT: scsi: ufs-qcom: Adjust bus bandwidth voting and unvoting
The bus bandwidth voting is required to be done before the bus clocks are
enabled, and the unvoting is required to be done only after the bus clocks
are disabled.

Link: https://lore.kernel.org/r/1581392451-28743-4-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I27f9a9584fbccbb84231354281f67b67b3d71373
(cherry picked from commit 8240dd97cef42485b0f28553d31bc5c6a23dd0cc
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-05 22:17:30 -08:00
Can Guo
d90dcabef4 Revert "FROMLIST: scsi: ufs-qcom: Adjust bus bandwidth voting and unvoting"
Revert commit cfe099a8bdff ("FROMLIST: scsi: ufs-qcom: Adjust bus bandwidth
voting and unvoting") due to it has major changes in its latest version.

Bug: 150892981
Change-Id: I5a8a4ba287948dda423f2d7be342d8eed9123857
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-05 21:55:17 -08:00
Ramon Pantin
017d67e9a8 ANDROID: CC_FLAGS_CFI add -fno-sanitize-blacklist
Added the clang compiler option -fno-sanitize-blacklist to the
CC_FLAGS_CFI variable.

Without this flag, the make dependecy list files produced by clang,
have the cfi_blacklist.txt as their first dependency.  The dependecy
lists are produced by the -Wp,-MD,filename option (for example:
-Wp,-MD,mm/.mmap.o.d).  The dependency lists are processed by the
scripts/basic/fixdeps.c program, and are transformed into the .o.cmd
files (for example: mm/.mmap.o.cmd).  That file is meant to have the
source code of the file listed in the source_* make variable (for
example: source_mm/mmap.o).  Instead of that that variable refers
to the full pathname to the cfi_blacklist.txt file.  Furthermore, the
deps_* make variable is not supposed to include the source code file
but it does include it.

The cfi_blacklist.txt file is not required by the use of CFI for the
kernel, use of the -fno-sanitize-blacklist causes the .o.cmd file
to have the correct values in its source_* and dep_* variables.

Signed-off-by: Ramon Pantin <pantin@google.com>
Bug: 150504710
Test: interactively
Change-Id: Ic31f0cfc59f29612373ec9ed63a326a84e496b68
2020-03-05 22:14:59 +00:00
Greg Kroah-Hartman
ce5de62e20 This is the 5.4.24 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl5hHjgACgkQONu9yGCS
 aT6CSBAA0c16mnDb59jgmW/sBj/p/MrlD/WJzLriqiKN5BUsPt9++I5mNj8mG+d2
 Glm4086e8L826zv8oKiZm23xk93on+78ExhVFVZvZNaEUpiRNYCGSuDq2NrHW0z+
 kpagkAFLfCUZFoKtmWo+bpl0YtF4dd/fg7+EjyL6qT1DBs8NVMwZx7i/v0xXv7Wc
 0vsGCLYoBLzcW1FB2d9cfAUPCBuGEzL/7TdifNOXRgI9owGsZndFJgXgIzoBUt/P
 tqB8RLjIupCiMEPtsEAZ/rgEQLPFkb3yrBvgjd1wDI8bHUIQU0clqThKVNvmNSmv
 UTBSNgPAhkP8nZG7X9xCkyfEsUefejBJy66da9n4XTGGrXf9ga0BL0nNrOGwOesr
 m+tNnBSFsbFCMqFopQnt4zZSnaf67AOk2mzxbEu4E+sStyW943aDO9MoRRFgaYGH
 pfie3qOKtKta2MuNTJA+q6F0W9H+V5MtMpwbyuy1/dp2eVln2wewBBMvXYdL1YOy
 E/Z87nsQgalsDynz9m/niv32J4JAxHptyOyROkktDLBSzL5RawNn+Op8X5EtmZOe
 sPkiYicqp9CLmMj13qWXJhtuyNdD4wk6FyyAy6cX9mF44+EZGOBkyNP+n8g789Kn
 sqFJ7sfTfOnwLBFciMA5PaMTGNWROyWXNkvvUzO+9t0CyFAnT2U=
 =abGA
 -----END PGP SIGNATURE-----

Merge 5.4.24 into android-5.4

Changes in 5.4.24
	io_uring: grab ->fs as part of async offload
	EDAC: skx_common: downgrade message importance on missing PCI device
	net: dsa: b53: Ensure the default VID is untagged
	net: fib_rules: Correctly set table field when table number exceeds 8 bits
	net: macb: ensure interface is not suspended on at91rm9200
	net: mscc: fix in frame extraction
	net: phy: restore mdio regs in the iproc mdio driver
	net: sched: correct flower port blocking
	net/tls: Fix to avoid gettig invalid tls record
	nfc: pn544: Fix occasional HW initialization failure
	qede: Fix race between rdma destroy workqueue and link change event
	Revert "net: dev: introduce support for sch BYPASS for lockless qdisc"
	udp: rehash on disconnect
	sctp: move the format error check out of __sctp_sf_do_9_1_abort
	bnxt_en: Improve device shutdown method.
	bnxt_en: Issue PCIe FLR in kdump kernel to cleanup pending DMAs.
	bonding: add missing netdev_update_lockdep_key()
	net: export netdev_next_lower_dev_rcu()
	bonding: fix lockdep warning in bond_get_stats()
	ipv6: Fix route replacement with dev-only route
	ipv6: Fix nlmsg_flags when splitting a multipath route
	ipmi:ssif: Handle a possible NULL pointer reference
	drm/msm: Set dma maximum segment size for mdss
	sched/core: Don't skip remote tick for idle CPUs
	timers/nohz: Update NOHZ load in remote tick
	sched/fair: Prevent unlimited runtime on throttled group
	dax: pass NOWAIT flag to iomap_apply
	mac80211: consider more elements in parsing CRC
	cfg80211: check wiphy driver existence for drvinfo report
	s390/zcrypt: fix card and queue total counter wrap
	qmi_wwan: re-add DW5821e pre-production variant
	qmi_wwan: unconditionally reject 2 ep interfaces
	NFSv4: Fix races between open and dentry revalidation
	perf/smmuv3: Use platform_get_irq_optional() for wired interrupt
	perf/x86/intel: Add Elkhart Lake support
	perf/x86/cstate: Add Tremont support
	perf/x86/msr: Add Tremont support
	ceph: do not execute direct write in parallel if O_APPEND is specified
	ARM: dts: sti: fixup sound frame-inversion for stihxxx-b2120.dtsi
	drm/amd/display: Do not set optimized_require to false after plane disable
	RDMA/siw: Remove unwanted WARN_ON in siw_cm_llp_data_ready()
	drm/amd/display: Check engine is not NULL before acquiring
	drm/amd/display: Limit minimum DPPCLK to 100MHz.
	drm/amd/display: Add initialitions for PLL2 clock source
	amdgpu: Prevent build errors regarding soft/hard-float FP ABI tags
	soc/tegra: fuse: Fix build with Tegra194 configuration
	i40e: Fix the conditional for i40e_vc_validate_vqs_bitmaps
	net: ena: fix potential crash when rxfh key is NULL
	net: ena: fix uses of round_jiffies()
	net: ena: add missing ethtool TX timestamping indication
	net: ena: fix incorrect default RSS key
	net: ena: rss: do not allocate key when not supported
	net: ena: rss: fix failure to get indirection table
	net: ena: rss: store hash function as values and not bits
	net: ena: fix incorrectly saving queue numbers when setting RSS indirection table
	net: ena: fix corruption of dev_idx_to_host_tbl
	net: ena: ethtool: use correct value for crc32 hash
	net: ena: ena-com.c: prevent NULL pointer dereference
	ice: update Unit Load Status bitmask to check after reset
	cifs: Fix mode output in debugging statements
	cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE
	mac80211: fix wrong 160/80+80 MHz setting
	net: hns3: add management table after IMP reset
	net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples()
	nvme/tcp: fix bug on double requeue when send fails
	nvme: prevent warning triggered by nvme_stop_keep_alive
	nvme/pci: move cqe check after device shutdown
	ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
	audit: fix error handling in audit_data_to_entry()
	audit: always check the netlink payload length in audit_receive_msg()
	ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
	ACPI: watchdog: Fix gas->access_width usage
	KVM: VMX: check descriptor table exits on instruction emulation
	HID: ite: Only bind to keyboard USB interface on Acer SW5-012 keyboard dock
	HID: core: fix off-by-one memset in hid_report_raw_event()
	HID: core: increase HID report buffer size to 8KiB
	drm/amdgpu: Drop DRIVER_USE_AGP
	drm/radeon: Inline drm_get_pci_dev
	macintosh: therm_windtunnel: fix regression when instantiating devices
	tracing: Disable trace_printk() on post poned tests
	Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
	amdgpu/gmc_v9: save/restore sdpif regs during S3
	cpufreq: Fix policy initialization for internal governor drivers
	io_uring: fix 32-bit compatability with sendmsg/recvmsg
	netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports
	net/smc: transfer fasync_list in case of fallback
	vhost: Check docket sk_family instead of call getname
	netfilter: ipset: Fix forceadd evaluation path
	netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put()
	HID: alps: Fix an error handling path in 'alps_input_configured()'
	HID: hiddev: Fix race in in hiddev_disconnect()
	MIPS: VPE: Fix a double free and a memory leak in 'release_vpe()'
	i2c: altera: Fix potential integer overflow
	i2c: jz4780: silence log flood on txabrt
	drm/i915/gvt: Fix orphan vgpu dmabuf_objs' lifetime
	drm/i915/gvt: Separate display reset from ALL_ENGINES reset
	nl80211: fix potential leak in AP start
	mac80211: Remove a redundant mutex unlock
	kbuild: fix DT binding schema rule to detect command line changes
	hv_netvsc: Fix unwanted wakeup in netvsc_attach()
	usb: charger: assign specific number for enum value
	nvme-pci: Hold cq_poll_lock while completing CQEs
	s390/qeth: vnicc Fix EOPNOTSUPP precedence
	net: netlink: cap max groups which will be considered in netlink_bind()
	net: atlantic: fix use after free kasan warn
	net: atlantic: fix potential error handling
	net: atlantic: fix out of range usage of active_vlans array
	net/smc: no peer ID in CLC decline for SMCD
	net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE
	selftests: Install settings files to fix TIMEOUT failures
	kbuild: remove header compile test
	kbuild: move headers_check rule to usr/include/Makefile
	kbuild: remove unneeded variable, single-all
	kbuild: make single target builds even faster
	namei: only return -ECHILD from follow_dotdot_rcu()
	mwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame()
	mwifiex: delete unused mwifiex_get_intf_num()
	KVM: SVM: Override default MMIO mask if memory encryption is enabled
	KVM: Check for a bad hva before dropping into the ghc slow path
	sched/fair: Optimize select_idle_cpu
	f2fs: fix to add swap extent correctly
	RDMA/hns: Simplify the calculation and usage of wqe idx for post verbs
	RDMA/hns: Bugfix for posting a wqe with sge
	drivers: net: xgene: Fix the order of the arguments of 'alloc_etherdev_mqs()'
	ima: ima/lsm policy rule loading logic bug fixes
	kprobes: Set unoptimized flag after unoptimizing code
	lib/vdso: Make __arch_update_vdso_data() logic understandable
	lib/vdso: Update coarse timekeeper unconditionally
	pwm: omap-dmtimer: put_device() after of_find_device_by_node()
	perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
	perf ui gtk: Add missing zalloc object
	x86/resctrl: Check monitoring static key in the MBM overflow handler
	KVM: x86: Remove spurious kvm_mmu_unload() from vcpu destruction path
	KVM: x86: Remove spurious clearing of async #PF MSR
	rcu: Allow only one expedited GP to run concurrently with wakeups
	ubifs: Fix ino_t format warnings in orphan_delete()
	thermal: db8500: Depromote debug print
	thermal: brcmstb_thermal: Do not use DT coefficients
	netfilter: nft_tunnel: no need to call htons() when dumping ports
	netfilter: nf_flowtable: fix documentation
	bus: tegra-aconnect: Remove PM_CLK dependency
	xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE
	locking/lockdep: Fix lockdep_stats indentation problem
	mm/debug.c: always print flags in dump_page()
	mm/gup: allow FOLL_FORCE for get_user_pages_fast()
	mm/huge_memory.c: use head to check huge zero page
	mm, thp: fix defrag setting if newline is not used
	kvm: nVMX: VMWRITE checks VMCS-link pointer before VMCS field
	kvm: nVMX: VMWRITE checks unsupported field before read-only field
	blktrace: Protect q->blk_trace with RCU
	Linux 5.4.24

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0b31557e16c72bd30d1e6938ed199918ff326d88
2020-03-05 17:42:40 +01:00
Greg Kroah-Hartman
cff670b3eb Linux 5.4.24 2020-03-05 16:43:52 +01:00
Jan Kara
6f9cff84dd blktrace: Protect q->blk_trace with RCU
[ Upstream commit c780e86dd48ef6467a1146cf7d0fe1e05a635039 ]

KASAN is reporting that __blk_add_trace() has a use-after-free issue
when accessing q->blk_trace. Indeed the switching of block tracing (and
thus eventual freeing of q->blk_trace) is completely unsynchronized with
the currently running tracing and thus it can happen that the blk_trace
structure is being freed just while __blk_add_trace() works on it.
Protect accesses to q->blk_trace by RCU during tracing and make sure we
wait for the end of RCU grace period when shutting down tracing. Luckily
that is rare enough event that we can afford that. Note that postponing
the freeing of blk_trace to an RCU callback should better be avoided as
it could have unexpected user visible side-effects as debugfs files
would be still existing for a short while block tracing has been shut
down.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=205711
CC: stable@vger.kernel.org
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reported-by: Tristan Madani <tristmd@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-05 16:43:52 +01:00