linux-block.git
2 years agostaging: rts5208: fix Lines should not end with a '('.
Samuel Sjöberg [Wed, 2 Mar 2022 15:03:28 +0000 (16:03 +0100)]
staging: rts5208: fix Lines should not end with a '('.

Fix the following check reported by checkpatch.pl:

CHECK: Lines should not end with a '('
                                        retval = ms_transfer_tpc(

Signed-off-by: Samuel Sjöberg <info@samuelsjoberg.se>
Link: https://lore.kernel.org/r/20220302150328.2722-1-info@samuelsjoberg.se
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: pi433: prevent uninitialized data from being printed out
Paulo Miguel Almeida [Sat, 26 Feb 2022 04:25:31 +0000 (17:25 +1300)]
staging: pi433: prevent uninitialized data from being printed out

local_buffer is not initialised before data is passed to
spi_sync_transfer. In case spi* function fails then the dev_dbg
statement after that can potentially print out uninitialised data

this patch initialises local_buffer array.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/Yhmruyr2BUn0+3O3@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to read the "order" bit
Martin Kaiser [Sun, 27 Feb 2022 16:41:47 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helper to read the "order" bit

Use the ieee80211 helper to read the "order" bit. The driver-specific
macro GetOrder can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to read the protected bit
Martin Kaiser [Sun, 27 Feb 2022 16:41:46 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helper to read the protected bit

Use the ieee80211 helper to read the "protected" bit.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to read "more data"
Martin Kaiser [Sun, 27 Feb 2022 16:41:45 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helper to read "more data"

Use the ieee80211 helper to read the "more data" bit. The driver-specific
macro GetMData can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to check for more fragments
Martin Kaiser [Sun, 27 Feb 2022 16:41:44 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helper to check for more fragments

Use the ieee80211 helper to check the "more fragments" bit. Remove the
internal GetMFrag macro.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper for qos bit
Martin Kaiser [Sun, 27 Feb 2022 16:41:43 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helper for qos bit

Use the ieee80211_is_data_qos helper function to read the qos bit.

This helper function returns a bool. Change the qos field in struct
rx_pkt_attrib from u8 to bool and fix up the other places where it
is used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: refactor validate_recv_frame's error handling
Martin Kaiser [Sun, 27 Feb 2022 16:41:42 +0000 (17:41 +0100)]
staging: r8188eu: refactor validate_recv_frame's error handling

Refactor the error handling of validate_recv_frame. It's simpler to
default to _FAIL.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helpers to check the frame type
Martin Kaiser [Sun, 27 Feb 2022 16:41:41 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 helpers to check the frame type

Use the ieee80211_is_... helper functions to check the frame type in
the validate_recv_frame function. Add a temporary variable for the
16-bit frame control field.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 define for management frame type
Martin Kaiser [Sun, 27 Feb 2022 16:41:40 +0000 (17:41 +0100)]
staging: r8188eu: use ieee80211 define for management frame type

Replace the driver-internal define for management frame type with
IEEE80211_FTYPE_MGMT.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused define
Martin Kaiser [Sat, 26 Feb 2022 18:14:57 +0000 (19:14 +0100)]
staging: r8188eu: remove unused define

Remove the rtw_dequeue_recvframe define, which is not used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: get_rx_status is not used
Martin Kaiser [Sat, 26 Feb 2022 18:14:56 +0000 (19:14 +0100)]
staging: r8188eu: get_rx_status is not used

Remove the unused function get_rx_status.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: recvframe_push is not used
Martin Kaiser [Sat, 26 Feb 2022 18:14:55 +0000 (19:14 +0100)]
staging: r8188eu: recvframe_push is not used

The recvframe_push function is not used. It can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: cnt is set but not used
Martin Kaiser [Sat, 26 Feb 2022 18:14:54 +0000 (19:14 +0100)]
staging: r8188eu: cnt is set but not used

In function recv_func, the cnt variable is set but not used.
It can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: fix endless loop in recv_func
Martin Kaiser [Sat, 26 Feb 2022 18:14:53 +0000 (19:14 +0100)]
staging: r8188eu: fix endless loop in recv_func

Fix an endless loop in recv_func. If pending_frame is not NULL, we're
stuck in the while loop forever. We have to call rtw_alloc_recvframe
each time we loop.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Reported-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: irq_prepare_beacon_tasklet is unused
Martin Kaiser [Sat, 26 Feb 2022 18:14:52 +0000 (19:14 +0100)]
staging: r8188eu: irq_prepare_beacon_tasklet is unused

irq_prepare_beacon_tasklet in struct recv_priv is not used for r8188eu.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: smooth_rssi_data is not used
Martin Kaiser [Sat, 26 Feb 2022 18:14:51 +0000 (19:14 +0100)]
staging: r8188eu: smooth_rssi_data is not used

struct smooth_rssi_data is not used in this driver.
It can be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: pi433: remove rf69_get_flag function resolving enum conflict
Paulo Miguel Almeida [Fri, 25 Feb 2022 22:40:33 +0000 (11:40 +1300)]
staging: pi433: remove rf69_get_flag function resolving enum conflict

The reason why rf69_get_flag() existed was to provide a high-level way
to obtain values out of 1 (of 2) flags registers using bit masking. The
idea was to map the possible flag values found in the data sheet like
shown in page 70 of the RFM69HCW datasheet.

However, due to the fact that enums values in C must be unique, there
was a naming conflict on 'fifo_not_empty' which is used by the
tx_start_condition enum. So the author decided to create a 'fifo_empty'
one which would negate the value that comes from the flag register as
the solution to that conflict (which is very confusing).

this patch removes rf69_get_flag function which subsequently solves the
enum redeclaration problem so kernel developers can follow the data
sheet more easily.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/Yhla4a1Clpguoo2h@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove _linked_rx_signal_strength_display()
Michael Straube [Fri, 25 Feb 2022 17:48:27 +0000 (18:48 +0100)]
staging: r8188eu: remove _linked_rx_signal_strength_display()

The function _linked_rx_signal_strength_display() only sets two local
variables that are not used after setting. Remove the function and
remove resulting dead code.

The HW_DEF_RA_INFO_DUMP case in GetHalDefVar8188EUsb() does not set
the passed variable. It just calls check_fwstate() which does nothing
than return true or false. So it is safe to remove this call to
GetHalDefVar8188EUsb().

The HAL_DEF_UNDERCORATEDSMOOTHEDPWDB case in GetHalDefVar8188EUsb()
does nothing than set the passed variable and it is safe to remove
this call to GetHalDefVar8188EUsb() as well.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220225174827.15927-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: pi433: remove TODOs-related item from the TODO file
Paulo Miguel Almeida [Sat, 26 Feb 2022 04:52:59 +0000 (17:52 +1300)]
staging: pi433: remove TODOs-related item from the TODO file

All occurences of code annotated with TODO in this driver have been
addressed in the last couple of years by the community. The last
occurrence of the word "TODO" was in the form of a multi-line comment in
the header file intended to be exposed to userspace once this driver
moves away from the staging folder.

This patch removes that TODO as well as the TODO-related item from the
driver's TODO file

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/YhmyK1Utaoj924im@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMerge 5.17-rc6 into staging-next
Greg Kroah-Hartman [Mon, 28 Feb 2022 07:44:22 +0000 (08:44 +0100)]
Merge 5.17-rc6 into staging-next

We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoLinux 5.17-rc6 v5.17-rc6
Linus Torvalds [Sun, 27 Feb 2022 22:36:33 +0000 (14:36 -0800)]
Linux 5.17-rc6

2 years agoMerge tag 'irq-urgent-2022-02-27' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 27 Feb 2022 21:07:40 +0000 (13:07 -0800)]
Merge tag 'irq-urgent-2022-02-27' of git://git./linux/kernel/git/tip/tip

Pull irq fix from Thomas Gleixner:
 "A single fix for a regression caused by the recent PCI/MSI rework
  which resulted in a recursive locking problem in the VMD driver.

  The cure is to cache the relevant information upfront instead of
  retrieving it at runtime"

* tag 'irq-urgent-2022-02-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  PCI: vmd: Prevent recursive locking on interrupt allocation

2 years agoMerge tag 'dma-mapping-5.17-1' of git://git.infradead.org/users/hch/dma-mapping
Linus Torvalds [Sun, 27 Feb 2022 20:42:37 +0000 (12:42 -0800)]
Merge tag 'dma-mapping-5.17-1' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fix from Christoph Hellwig:

 - fix a swiotlb info leak (Halil Pasic)

* tag 'dma-mapping-5.17-1' of git://git.infradead.org/users/hch/dma-mapping:
  swiotlb: fix info leak with DMA_FROM_DEVICE

2 years agoMerge tag 'pinctrl-v5-17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
Linus Torvalds [Sun, 27 Feb 2022 20:30:54 +0000 (12:30 -0800)]
Merge tag 'pinctrl-v5-17-3' of git://git./linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:

 - Fix some drive strength and pull-up code in the K210 driver.

 - Add the Alder Lake-M ACPI ID so it starts to work properly.

 - Use a static name for the StarFive GPIO irq_chip, forestalling an
   upcoming fixes series from Marc Zyngier.

 - Fix an ages old bug in the Tegra 186 driver where we were indexing at
   random into struct and being lucky getting the right member.

* tag 'pinctrl-v5-17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  gpio: tegra186: Fix chip_data type confusion
  pinctrl: starfive: Use a static name for the GPIO irq_chip
  pinctrl: tigerlake: Revert "Add Alder Lake-M ACPI ID"
  pinctrl: k210: Fix bias-pull-up
  pinctrl: fix loop in k210_pinconf_get_drive()

2 years agoMerge tag 'trace-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Sat, 26 Feb 2022 20:10:17 +0000 (12:10 -0800)]
Merge tag 'trace-v5.17-rc4' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:

 - rtla (Real-Time Linux Analysis tool):
    - fix typo in man page
    - Update API -e to -E before it is released
    - Error message fix and memory leak fix

 - Partially uninline trace event soft disable to shrink text

 - Fix function graph start up test

 - Have triggers affect the trace instance they are in and not top level

 - Have osnoise sleep in the units it says it uses

 - Remove unused ftrace stub function

 - Remove event probe redundant info from event in the buffer

 - Fix group ownership setting in tracefs

 - Ensure trace buffer is minimum size to prevent crashes

* tag 'trace-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  rtla/osnoise: Fix error message when failing to enable trace instance
  rtla/osnoise: Free params at the exit
  rtla/hist: Make -E the short version of --entries
  tracing: Fix selftest config check for function graph start up test
  tracefs: Set the group ownership in apply_options() not parse_options()
  tracing/osnoise: Make osnoise_main to sleep for microseconds
  ftrace: Remove unused ftrace_startup_enable() stub
  tracing: Ensure trace buffer is at least 4096 bytes large
  tracing: Uninline trace_trigger_soft_disabled() partly
  eprobes: Remove redundant event type information
  tracing: Have traceon and traceoff trigger honor the instance
  tracing: Dump stacktrace trigger to the corresponding instance
  rtla: Fix systme -> system typo on man page

2 years agoMerge tag 'fixes-2022-02-26' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt...
Linus Torvalds [Sat, 26 Feb 2022 20:00:44 +0000 (12:00 -0800)]
Merge tag 'fixes-2022-02-26' of git://git./linux/kernel/git/rppt/memblock

Pull memblock fix from Mike Rapoport:
 "Use kfree() to release kmalloced memblock regions

  memblock.{reserved,memory}.regions may be allocated using kmalloc()
  in memblock_double_array(). Use kfree() to release these kmalloced
  regions"

* tag 'fixes-2022-02-26' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock: use kfree() to release kmalloced memblock regions

2 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Sat, 26 Feb 2022 19:52:14 +0000 (11:52 -0800)]
Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "12 patches.

  Subsystems affected by this patch series: MAINTAINERS, mailmap, memfd,
  and mm (hugetlb, kasan, hugetlbfs, pagemap, selftests, memcg, and
  slab)"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  selftests/memfd: clean up mapping in mfd_fail_write
  mailmap: update Roman Gushchin's email
  MAINTAINERS, SLAB: add Roman as reviewer, git tree
  MAINTAINERS: add Shakeel as a memcg co-maintainer
  MAINTAINERS: remove Vladimir from memcg maintainers
  MAINTAINERS: add Roman as a memcg co-maintainer
  selftest/vm: fix map_fixed_noreplace test failure
  mm: fix use-after-free bug when mm->mmap is reused after being freed
  hugetlbfs: fix a truncation issue in hugepages parameter
  kasan: test: prevent cache merging in kmem_cache_double_destroy
  mm/hugetlb: fix kernel crash with hugetlb mremap
  MAINTAINERS: add sysctl-next git tree

2 years agoMerge tag 'riscv-for-linus-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 26 Feb 2022 18:26:24 +0000 (10:26 -0800)]
Merge tag 'riscv-for-linus-5.17-rc6' of git://git./linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

 - A fix for the K210 sdcard defconfig, to avoid using a
   fixed delay for the root FS

 - A fix to make sure there's a proper call frame for
   trace_hardirqs_{on,off}().

* tag 'riscv-for-linus-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: fix oops caused by irqsoff latency tracer
  riscv: fix nommu_k210_sdcard_defconfig

2 years agoMerge tag 'xfs-5.17-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Linus Torvalds [Sat, 26 Feb 2022 17:53:19 +0000 (09:53 -0800)]
Merge tag 'xfs-5.17-fixes-2' of git://git./fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:
 "Nothing exciting, just more fixes for not returning sync_filesystem
  error values (and eliding it when it's not necessary).

  Summary:

   - Only call sync_filesystem when we're remounting the filesystem
     readonly readonly, and actually check its return value"

* tag 'xfs-5.17-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: only bother with sync_filesystem during readonly remount

2 years agoselftests/memfd: clean up mapping in mfd_fail_write
Mike Kravetz [Sat, 26 Feb 2022 03:11:26 +0000 (19:11 -0800)]
selftests/memfd: clean up mapping in mfd_fail_write

Running the memfd script ./run_hugetlbfs_test.sh will often end in error
as follows:

    memfd-hugetlb: CREATE
    memfd-hugetlb: BASIC
    memfd-hugetlb: SEAL-WRITE
    memfd-hugetlb: SEAL-FUTURE-WRITE
    memfd-hugetlb: SEAL-SHRINK
    fallocate(ALLOC) failed: No space left on device
    ./run_hugetlbfs_test.sh: line 60: 166855 Aborted                 (core dumped) ./memfd_test hugetlbfs
    opening: ./mnt/memfd
    fuse: DONE

If no hugetlb pages have been preallocated, run_hugetlbfs_test.sh will
allocate 'just enough' pages to run the test.  In the SEAL-FUTURE-WRITE
test the mfd_fail_write routine maps the file, but does not unmap.  As a
result, two hugetlb pages remain reserved for the mapping.  When the
fallocate call in the SEAL-SHRINK test attempts allocate all hugetlb
pages, it is short by the two reserved pages.

Fix by making sure to unmap in mfd_fail_write.

Link: https://lkml.kernel.org/r/20220219004340.56478-1-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agomailmap: update Roman Gushchin's email
Roman Gushchin [Sat, 26 Feb 2022 03:11:23 +0000 (19:11 -0800)]
mailmap: update Roman Gushchin's email

I'm moving to a @linux.dev account. Map my old addresses.

Link: https://lkml.kernel.org/r/20220221200006.416377-1-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMAINTAINERS, SLAB: add Roman as reviewer, git tree
Vlastimil Babka [Sat, 26 Feb 2022 03:11:20 +0000 (19:11 -0800)]
MAINTAINERS, SLAB: add Roman as reviewer, git tree

The slab code has an overlap with kmem accounting, where Roman has done
a lot of work recently and it would be useful to make sure he's CC'd on
patches that potentially affect it.  Thus add him as a reviewer for the
SLAB subsystem.

Also while at it, add the link to slab git tree.

Link: https://lkml.kernel.org/r/20220222103104.13241-1-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMAINTAINERS: add Shakeel as a memcg co-maintainer
Shakeel Butt [Sat, 26 Feb 2022 03:11:17 +0000 (19:11 -0800)]
MAINTAINERS: add Shakeel as a memcg co-maintainer

I have been contributing and reviewing to the memcg codebase for last
couple of years.  So, making it official.

Link: https://lkml.kernel.org/r/20220224060148.4092228-1-shakeelb@google.com
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMAINTAINERS: remove Vladimir from memcg maintainers
Vladimir Davydov [Sat, 26 Feb 2022 03:11:14 +0000 (19:11 -0800)]
MAINTAINERS: remove Vladimir from memcg maintainers

Link: https://lkml.kernel.org/r/4ad1f8da49d7b71c84a0c15bd5347f5ce704e730.1645608825.git.vdavydov.dev@gmail.com
Signed-off-by: Vladimir Davydov <vdavydov.dev@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMAINTAINERS: add Roman as a memcg co-maintainer
Roman Gushchin [Sat, 26 Feb 2022 03:11:11 +0000 (19:11 -0800)]
MAINTAINERS: add Roman as a memcg co-maintainer

Add myself as a memcg co-maintainer.  My primary focus over last few
years was the kernel memory accounting stack, but I do work on some
other parts of the memory controller as well.

Link: https://lkml.kernel.org/r/20220221233951.659048-1-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoselftest/vm: fix map_fixed_noreplace test failure
Aneesh Kumar K.V [Sat, 26 Feb 2022 03:11:08 +0000 (19:11 -0800)]
selftest/vm: fix map_fixed_noreplace test failure

On the latest RHEL the test fails due to executable mapped at 256MB
address

     # ./map_fixed_noreplace
    mmap() @ 0x10000000-0x10050000 p=0xffffffffffffffff result=File exists
    10000000-10010000 r-xp 00000000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
    10010000-10020000 r--p 00000000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
    10020000-10030000 rw-p 00010000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
    10029b90000-10029bc0000 rw-p 00000000 00:00 0                            [heap]
    7fffbb510000-7fffbb750000 r-xp 00000000 fd:04 24534                      /usr/lib64/libc.so.6
    7fffbb750000-7fffbb760000 r--p 00230000 fd:04 24534                      /usr/lib64/libc.so.6
    7fffbb760000-7fffbb770000 rw-p 00240000 fd:04 24534                      /usr/lib64/libc.so.6
    7fffbb780000-7fffbb7a0000 r--p 00000000 00:00 0                          [vvar]
    7fffbb7a0000-7fffbb7b0000 r-xp 00000000 00:00 0                          [vdso]
    7fffbb7b0000-7fffbb800000 r-xp 00000000 fd:04 24514                      /usr/lib64/ld64.so.2
    7fffbb800000-7fffbb810000 r--p 00040000 fd:04 24514                      /usr/lib64/ld64.so.2
    7fffbb810000-7fffbb820000 rw-p 00050000 fd:04 24514                      /usr/lib64/ld64.so.2
    7fffd93f0000-7fffd9420000 rw-p 00000000 00:00 0                          [stack]
    Error: couldn't map the space we need for the test

Fix this by finding a free address using mmap instead of hardcoding
BASE_ADDRESS.

Link: https://lkml.kernel.org/r/20220217083417.373823-1-aneesh.kumar@linux.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Jann Horn <jannh@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agomm: fix use-after-free bug when mm->mmap is reused after being freed
Suren Baghdasaryan [Sat, 26 Feb 2022 03:11:05 +0000 (19:11 -0800)]
mm: fix use-after-free bug when mm->mmap is reused after being freed

oom reaping (__oom_reap_task_mm) relies on a 2 way synchronization with
exit_mmap.  First it relies on the mmap_lock to exclude from unlock
path[1], page tables tear down (free_pgtables) and vma destruction.
This alone is not sufficient because mm->mmap is never reset.

For historical reasons[2] the lock is taken there is also MMF_OOM_SKIP
set for oom victims before.

The oom reaper only ever looks at oom victims so the whole scheme works
properly but process_mrelease can opearate on any task (with fatal
signals pending) which doesn't really imply oom victims.  That means
that the MMF_OOM_SKIP part of the synchronization doesn't work and it
can see a task after the whole address space has been demolished and
traverse an already released mm->mmap list.  This leads to use after
free as properly caught up by KASAN report.

Fix the issue by reseting mm->mmap so that MMF_OOM_SKIP synchronization
is not needed anymore.  The MMF_OOM_SKIP is not removed from exit_mmap
yet but it acts mostly as an optimization now.

[1] 27ae357fa82b ("mm, oom: fix concurrent munlock and oom reaper unmap, v3")
[2] 212925802454 ("mm: oom: let oom_reap_task and exit_mmap run concurrently")

[mhocko@suse.com: changelog rewrite]

Link: https://lore.kernel.org/all/00000000000072ef2c05d7f81950@google.com/
Link: https://lkml.kernel.org/r/20220215201922.1908156-1-surenb@google.com
Fixes: 64591e8605d6 ("mm: protect free_pgtables with mmap_lock write lock in exit_mmap")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reported-by: syzbot+2ccf63a4bd07cf39cab0@syzkaller.appspotmail.com
Suggested-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Rik van Riel <riel@surriel.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Rik van Riel <riel@surriel.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Jan Engelhardt <jengelh@inai.de>
Cc: Tim Murray <timmurray@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agohugetlbfs: fix a truncation issue in hugepages parameter
Liu Yuntao [Sat, 26 Feb 2022 03:11:02 +0000 (19:11 -0800)]
hugetlbfs: fix a truncation issue in hugepages parameter

When we specify a large number for node in hugepages parameter, it may
be parsed to another number due to truncation in this statement:

node = tmp;

For example, add following parameter in command line:

hugepagesz=1G hugepages=4294967297:5

and kernel will allocate 5 hugepages for node 1 instead of ignoring it.

I move the validation check earlier to fix this issue, and slightly
simplifies the condition here.

Link: https://lkml.kernel.org/r/20220209134018.8242-1-liuyuntao10@huawei.com
Fixes: b5389086ad7be0 ("hugetlbfs: extend the definition of hugepages parameter to support node allocation")
Signed-off-by: Liu Yuntao <liuyuntao10@huawei.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agokasan: test: prevent cache merging in kmem_cache_double_destroy
Andrey Konovalov [Sat, 26 Feb 2022 03:10:59 +0000 (19:10 -0800)]
kasan: test: prevent cache merging in kmem_cache_double_destroy

With HW_TAGS KASAN and kasan.stacktrace=off, the cache created in the
kmem_cache_double_destroy() test might get merged with an existing one.
Thus, the first kmem_cache_destroy() call won't actually destroy it but
will only decrease the refcount.  This causes the test to fail.

Provide an empty constructor for the created cache to prevent the cache
from getting merged.

Link: https://lkml.kernel.org/r/b597bd434c49591d8af00ee3993a42c609dc9a59.1644346040.git.andreyknvl@google.com
Fixes: f98f966cd750 ("kasan: test: add test case for double-kmem_cache_destroy()")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agomm/hugetlb: fix kernel crash with hugetlb mremap
Aneesh Kumar K.V [Sat, 26 Feb 2022 03:10:56 +0000 (19:10 -0800)]
mm/hugetlb: fix kernel crash with hugetlb mremap

This fixes the below crash:

  kernel BUG at include/linux/mm.h:2373!
  cpu 0x5d: Vector: 700 (Program Check) at [c00000003c6e76e0]
      pc: c000000000581a54: pmd_to_page+0x54/0x80
      lr: c00000000058d184: move_hugetlb_page_tables+0x4e4/0x5b0
      sp: c00000003c6e7980
     msr: 9000000000029033
    current = 0xc00000003bd8d980
    paca    = 0xc000200fff610100   irqmask: 0x03   irq_happened: 0x01
      pid   = 9349, comm = hugepage-mremap
  kernel BUG at include/linux/mm.h:2373!
    move_hugetlb_page_tables+0x4e4/0x5b0 (link register)
    move_hugetlb_page_tables+0x22c/0x5b0 (unreliable)
    move_page_tables+0xdbc/0x1010
    move_vma+0x254/0x5f0
    sys_mremap+0x7c0/0x900
    system_call_exception+0x160/0x2c0

the kernel can't use huge_pte_offset before it set the pte entry because
a page table lookup check for huge PTE bit in the page table to
differentiate between a huge pte entry and a pointer to pte page.  A
huge_pte_alloc won't mark the page table entry huge and hence kernel
should not use huge_pte_offset after a huge_pte_alloc.

Link: https://lkml.kernel.org/r/20220211063221.99293-1-aneesh.kumar@linux.ibm.com
Fixes: 550a7d60bd5e ("mm, hugepages: add mremap() support for hugepage backed vma")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Mina Almasry <almasrymina@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMAINTAINERS: add sysctl-next git tree
Luis Chamberlain [Sat, 26 Feb 2022 03:10:53 +0000 (19:10 -0800)]
MAINTAINERS: add sysctl-next git tree

Add a git tree for sysctls as there's been quite a bit of work lately to
remove all the syctls out of kernel/sysctl.c and move to their respective
places, so coordination has been needed to avoid conflicts.  This tree
will also help soak these changes on linux-next prior to getting to Linus.

Link: https://lkml.kernel.org/r/20220218182736.3694508-1-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agortla/osnoise: Fix error message when failing to enable trace instance
Daniel Bristot de Oliveira [Fri, 18 Feb 2022 17:57:09 +0000 (18:57 +0100)]
rtla/osnoise: Fix error message when failing to enable trace instance

When a trace instance creation fails, tools are printing:

Could not enable -> osnoiser <- tracer for tracing

Print the actual (and correct) name of the tracer it fails to enable.

Link: https://lkml.kernel.org/r/53ef0582605af91eca14b19dba9fc9febb95d4f9.1645206561.git.bristot@kernel.org
Fixes: b1696371d865 ("rtla: Helper functions for rtla")
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agortla/osnoise: Free params at the exit
Daniel Bristot de Oliveira [Fri, 18 Feb 2022 17:57:08 +0000 (18:57 +0100)]
rtla/osnoise: Free params at the exit

The variable that stores the parsed command line arguments are not
being free()d at the rtla osnoise top exit path.

Free params variable before exiting.

Link: https://lkml.kernel.org/r/0be31d8259c7c53b98a39769d60cfeecd8421785.1645206561.git.bristot@kernel.org
Fixes: 1eceb2fc2ca5 ("rtla/osnoise: Add osnoise top mode")
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agortla/hist: Make -E the short version of --entries
Daniel Bristot de Oliveira [Fri, 18 Feb 2022 17:57:07 +0000 (18:57 +0100)]
rtla/hist: Make -E the short version of --entries

Currently, --entries uses -e as the short version in the hist mode of
timerlat and osnoise tools. But as -e is already used to enable events
on trace sessions by other tools, thus let's keep it available for the
same usage for all rtla tools.

Make -E the short version of --entries for hist mode on all tools.

Note: rtla was merged in this merge window, so rtla was not released yet.

Link: https://lkml.kernel.org/r/5dbf0cbe7364d3a05e708926b41a097c59a02b1e.1645206561.git.bristot@kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing: Fix selftest config check for function graph start up test
Christophe Leroy [Mon, 20 Dec 2021 16:38:06 +0000 (16:38 +0000)]
tracing: Fix selftest config check for function graph start up test

CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test
direct tramp.

Link: https://lkml.kernel.org/r/bdc7e594e13b0891c1d61bc8d56c94b1890eaed7.1640017960.git.christophe.leroy@csgroup.eu
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracefs: Set the group ownership in apply_options() not parse_options()
Steven Rostedt (Google) [Fri, 25 Feb 2022 20:34:26 +0000 (15:34 -0500)]
tracefs: Set the group ownership in apply_options() not parse_options()

Al Viro brought it to my attention that the dentries may not be filled
when the parse_options() is called, causing the call to set_gid() to
possibly crash. It should only be called if parse_options() succeeds
totally anyway.

He suggested the logical place to do the update is in apply_options().

Link: https://lore.kernel.org/all/20220225165219.737025658@goodmis.org/
Link: https://lkml.kernel.org/r/20220225153426.1c4cab6b@gandalf.local.home
Cc: stable@vger.kernel.org
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: 48b27b6b5191 ("tracefs: Set all files to the same group ownership as the mount option")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agoMerge tag 'configfs-5.17-2022-02-25' of git://git.infradead.org/users/hch/configfs
Linus Torvalds [Fri, 25 Feb 2022 22:12:36 +0000 (14:12 -0800)]
Merge tag 'configfs-5.17-2022-02-25' of git://git.infradead.org/users/hch/configfs

Pull configfs fix from Christoph Hellwig:

 - fix a race in configfs_{,un}register_subsystem (ChenXiaoSong)

* tag 'configfs-5.17-2022-02-25' of git://git.infradead.org/users/hch/configfs:
  configfs: fix a race in configfs_{,un}register_subsystem()

2 years agoMerge tag 'for-5.17-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
Linus Torvalds [Fri, 25 Feb 2022 22:08:03 +0000 (14:08 -0800)]
Merge tag 'for-5.17-rc5-tag' of git://git./linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
 "This is a hopefully last batch of fixes for defrag that got broken in
  5.16, all stable material.

  The remaining reported problem is excessive IO with autodefrag due to
  various conditions in the defrag code not met or missing"

* tag 'for-5.17-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: reduce extent threshold for autodefrag
  btrfs: autodefrag: only scan one inode once
  btrfs: defrag: don't use merged extent map for their generation check
  btrfs: defrag: bring back the old file extent search behavior
  btrfs: defrag: remove an ambiguous condition for rejection
  btrfs: defrag: don't defrag extents which are already at max capacity
  btrfs: defrag: don't try to merge regular extents with preallocated extents
  btrfs: defrag: allow defrag_one_cluster() to skip large extent which is not a target
  btrfs: prevent copying too big compressed lzo segment

2 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Linus Torvalds [Fri, 25 Feb 2022 21:34:30 +0000 (13:34 -0800)]
Merge tag 'for-linus' of git://git./linux/kernel/git/rdma/rdma

Pull rdma fixes from Jason Gunthorpe:

 - Older "does not even boot" regression in qib from July

 - Bug fixes for error unwind in rtrs

 - Avoid a deadlock syzkaller found in srp

 - Fix another UAF syzkaller found in cma

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  RDMA/cma: Do not change route.addr.src_addr outside state checks
  RDMA/ib_srp: Fix a deadlock
  RDMA/rtrs-clt: Move free_permit from free_clt to rtrs_clt_close
  RDMA/rtrs-clt: Fix possible double free in error case
  IB/qib: Fix duplicate sysfs directory name

2 years agoMerge tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 25 Feb 2022 20:56:11 +0000 (12:56 -0800)]
Merge tag 'gpio-fixes-for-v5.17-rc6' of git://git./linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - fix an bug generating spurious interrupts in gpio-rockchip

 - fix a race condition in gpiod_to_irq() called by GPIO consumers

* tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: Return EPROBE_DEFER if gc->to_irq is NULL
  gpio: rockchip: Reset int_bothedge when changing trigger

2 years agoRDMA/cma: Do not change route.addr.src_addr outside state checks
Jason Gunthorpe [Wed, 23 Feb 2022 15:23:57 +0000 (11:23 -0400)]
RDMA/cma: Do not change route.addr.src_addr outside state checks

If the state is not idle then resolve_prepare_src() should immediately
fail and no change to global state should happen. However, it
unconditionally overwrites the src_addr trying to build a temporary any
address.

For instance if the state is already RDMA_CM_LISTEN then this will corrupt
the src_addr and would cause the test in cma_cancel_operation():

           if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev)

Which would manifest as this trace from syzkaller:

  BUG: KASAN: use-after-free in __list_add_valid+0x93/0xa0 lib/list_debug.c:26
  Read of size 8 at addr ffff8881546491e0 by task syz-executor.1/32204

  CPU: 1 PID: 32204 Comm: syz-executor.1 Not tainted 5.12.0-rc8-syzkaller #0
  Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
  Call Trace:
   __dump_stack lib/dump_stack.c:79 [inline]
   dump_stack+0x141/0x1d7 lib/dump_stack.c:120
   print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232
   __kasan_report mm/kasan/report.c:399 [inline]
   kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
   __list_add_valid+0x93/0xa0 lib/list_debug.c:26
   __list_add include/linux/list.h:67 [inline]
   list_add_tail include/linux/list.h:100 [inline]
   cma_listen_on_all drivers/infiniband/core/cma.c:2557 [inline]
   rdma_listen+0x787/0xe00 drivers/infiniband/core/cma.c:3751
   ucma_listen+0x16a/0x210 drivers/infiniband/core/ucma.c:1102
   ucma_write+0x259/0x350 drivers/infiniband/core/ucma.c:1732
   vfs_write+0x28e/0xa30 fs/read_write.c:603
   ksys_write+0x1ee/0x250 fs/read_write.c:658
   do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
   entry_SYSCALL_64_after_hwframe+0x44/0xae

This is indicating that an rdma_id_private was destroyed without doing
cma_cancel_listens().

Instead of trying to re-use the src_addr memory to indirectly create an
any address derived from the dst build one explicitly on the stack and
bind to that as any other normal flow would do. rdma_bind_addr() will copy
it over the src_addr once it knows the state is valid.

This is similar to commit bc0bdc5afaa7 ("RDMA/cma: Do not change
route.addr.src_addr.ss_family")

Link: https://lore.kernel.org/r/0-v2-e975c8fd9ef2+11e-syz_cma_srcaddr_jgg@nvidia.com
Cc: stable@vger.kernel.org
Fixes: 732d41c545bb ("RDMA/cma: Make the locking for automatic state transition more clear")
Reported-by: syzbot+c94a3675a626f6333d74@syzkaller.appspotmail.com
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2 years agoMerge tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brooni...
Linus Torvalds [Fri, 25 Feb 2022 20:37:41 +0000 (12:37 -0800)]
Merge tag 'spi-fix-v5.17-rc5' of git://git./linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A few small driver specific fixes"

* tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: rockchip: terminate dma transmission when slave abort
  spi: rockchip: Fix error in getting num-cs property
  spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op()

2 years agoMerge tag 'regulator-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 25 Feb 2022 20:33:51 +0000 (12:33 -0800)]
Merge tag 'regulator-fix-v5.17-rc5' of git://git./linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A series of fixes for the da9121 driver"

* tag 'regulator-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: da9121: Remove surplus DA9141 parameters
  regulator: da9121: Fix DA914x voltage value
  regulator: da9121: Fix DA914x current values

2 years agoMerge tag 'regmap-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 25 Feb 2022 20:30:01 +0000 (12:30 -0800)]
Merge tag 'regmap-fix-v5.17-rc5' of git://git./linux/kernel/git/broonie/regmap

Pull regmap fix from Mark Brown:
 "A fix for interrupt controllers which require the explicit
  acknowledgement of interrupts using a different register to the one
  where interrupts are reported.

  Urgent for the few devices this affects"

* tag 'regmap-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap-irq: Update interrupt clear register for proper reset

2 years agoMerge tag 'thermal-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
Linus Torvalds [Fri, 25 Feb 2022 20:25:44 +0000 (12:25 -0800)]
Merge tag 'thermal-5.17-rc6' of git://git./linux/kernel/git/rafael/linux-pm

Pull thermal control fix from Rafael Wysocki:
 "Fix a memory leak in the int340x thermal driver's ACPI notify handler
  (Chuansheng Liu)"

* tag 'thermal-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: int340x: fix memory leak in int3400_notify()

2 years agoMerge tag 'pm-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Linus Torvalds [Fri, 25 Feb 2022 20:17:20 +0000 (12:17 -0800)]
Merge tag 'pm-5.17-rc6' of git://git./linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "Fix the throttle IRQ handling during cpufreq initialization on
  Qualcomm platforms (Bjorn Andersson)"

* tag 'pm-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: qcom-hw: Delay enabling throttle_irq
  cpufreq: Reintroduce ready() callback

2 years agoMerge tag 'char-misc-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
Linus Torvalds [Fri, 25 Feb 2022 20:12:06 +0000 (12:12 -0800)]
Merge tag 'char-misc-5.17-rc6' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are a few small driver fixes for 5.17-rc6 for reported issues.

  The majority of these are IIO fixes for small things, and the other
  two are a mvmem and mtd core conflict fix.

  All of these have been in linux-next with no reported issues"

* tag 'char-misc-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  mtd: core: Fix a conflict between MTD and NVMEM on wp-gpios property
  nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property
  iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
  iio: Fix error handling for PM
  iio: addac: ad74413r: correct comparator gpio getters mask usage
  iio: addac: ad74413r: use ngpio size when iterating over mask
  iio: addac: ad74413r: Do not reference negative array offsets
  iio: adc: men_z188_adc: Fix a resource leak in an error handling path
  iio: frequency: admv1013: remove the always true condition
  iio: accel: fxls8962af: add padding to regmap for SPI
  iio:imu:adis16480: fix buffering for devices with no burst mode
  iio: adc: ad7124: fix mask used for setting AIN_BUFP & AIN_BUFM bits
  iio: adc: tsc2046: fix memory corruption by preventing array overflow

2 years agoMerge tag 'driver-core-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 25 Feb 2022 20:05:40 +0000 (12:05 -0800)]
Merge tag 'driver-core-5.17-rc6' of git://git./linux/kernel/git/gregkh/driver-core

Pull driver core fix from Greg KH:
 "Here is a single driver core fix for 5.17-rc6. It resolves a reported
  problem when the DMA map of a device is not properly released.

  It has been in linux-next with no reported problems"

* tag 'driver-core-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  driver core: Free DMA range map when device is released

2 years agoMerge tag 'staging-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Fri, 25 Feb 2022 19:56:16 +0000 (11:56 -0800)]
Merge tag 'staging-5.17-rc6' of git://git./linux/kernel/git/gregkh/staging

Pull staging driver fix from Greg KH:
 "Here is a single staging driver fix for 5.17-rc6.

  It resolves a reported problem in the fbtft fb_st7789v.c driver that
  could cause the display to be flipped in cold weather.

  It has been in linux-next with no reported problems"

* tag 'staging-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: fbtft: fb_st7789v: reset display before initialization

2 years agoMerge tag 'tty-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Fri, 25 Feb 2022 19:45:29 +0000 (11:45 -0800)]
Merge tag 'tty-5.17-rc6' of git://git./linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
 "Here are some small n_gsm and sc16is7xx serial driver fixes for
  5.17-rc6.

  The n_gsm fixes are from Siemens as it seems they are using the line
  discipline and fixing up a number of issues they found in their
  testing. The sc16is7xx serial driver fix is for a reported problem
  with that chip.

  All of these have been in linux-next with no reported problems"

* tag 'tty-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  sc16is7xx: Fix for incorrect data being transmitted
  tty: n_gsm: fix deadlock in gsmtty_open()
  tty: n_gsm: fix wrong modem processing in convergence layer type 2
  tty: n_gsm: fix wrong tty control line for flow control
  tty: n_gsm: fix NULL pointer access due to DLCI release
  tty: n_gsm: fix proper link termination after failed open
  tty: n_gsm: fix encoding of command/response bit
  tty: n_gsm: fix encoding of control signal octet bit DV

2 years agoMerge tag 'usb-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Fri, 25 Feb 2022 19:36:31 +0000 (11:36 -0800)]
Merge tag 'usb-5.17-rc6' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a number of small USB driver fixes for 5.17-rc6 to resolve
  reported problems and add new device ids. They include:

   - dwc3:
      - device mapping fix
      - new device ids
      - driver fixes

   - xhci driver fixes

   - gadget driver fixes

   - usb-serial driver device id updates

  All of these have been in linux-next with no reported problems"

* tag 'usb-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb: gadget: rndis: add spinlock for rndis response list
  usb: dwc3: gadget: Let the interrupt handler disable bottom halves.
  USB: gadget: validate endpoint index for xilinx udc
  USB: serial: option: add Telit LE910R1 compositions
  USB: serial: option: add support for DW5829e
  Revert "USB: serial: ch341: add new Product ID for CH341A"
  usb: dwc2: drd: fix soft connect when gadget is unconfigured
  usb: dwc3: pci: Fix Bay Trail phy GPIO mappings
  tps6598x: clear int mask on probe failure
  xhci: Prevent futile URB re-submissions due to incorrect return value.
  xhci: re-initialize the HC during resume if HCE was set
  usb: dwc3: pci: Add "snps,dis_u2_susphy_quirk" for Intel Bay Trail
  usb: dwc3: pci: add support for the Intel Raptor Lake-S

2 years agoMerge tag 'ata-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
Linus Torvalds [Fri, 25 Feb 2022 19:22:19 +0000 (11:22 -0800)]
Merge tag 'ata-5.17-rc6' of git://git./linux/kernel/git/dlemoal/libata

Pull ata fixes from Damien Le Moal:
 "Two fixes for the pata_hpt37x driver, both from Sergey:

   - Fix a PCI register access using an incorrect size (8bits instead of
     16bits)

   - Make sure to always disable the primary channel as it is unused"

* tag 'ata-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
  ata: pata_hpt37x: disable primary channel on HPT371
  ata: pata_hpt37x: fix PCI clock detection

2 years agotracing/osnoise: Make osnoise_main to sleep for microseconds
Daniel Bristot de Oliveira [Fri, 18 Feb 2022 15:17:38 +0000 (16:17 +0100)]
tracing/osnoise: Make osnoise_main to sleep for microseconds

osnoise's runtime and period are in the microseconds scale, but it is
currently sleeping in the millisecond's scale. This behavior roots in the
usage of hwlat as the skeleton for osnoise.

Make osnoise to sleep in the microseconds scale. Also, move the sleep to
a specialized function.

Link: https://lkml.kernel.org/r/302aa6c7bdf2d131719b22901905e9da122a11b2.1645197336.git.bristot@kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agoftrace: Remove unused ftrace_startup_enable() stub
Nathan Chancellor [Mon, 14 Feb 2022 19:28:47 +0000 (12:28 -0700)]
ftrace: Remove unused ftrace_startup_enable() stub

When building with clang + CONFIG_DYNAMIC_FTRACE=n + W=1, there is a
warning:

  kernel/trace/ftrace.c:7194:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]
  static inline void ftrace_startup_enable(int command) { }
                     ^
  1 error generated.

Clang warns on instances of static inline functions in .c files with W=1
after commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").

The ftrace_startup_enable() stub has been unused since
commit e1effa0144a1 ("ftrace: Annotate the ops operation on update"),
where its use outside of the CONFIG_DYNAMIC_TRACE section was replaced
by ftrace_startup_all().  Remove it to resolve the warning.

Link: https://lkml.kernel.org/r/20220214192847.488166-1-nathan@kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing: Ensure trace buffer is at least 4096 bytes large
Sven Schnelle [Mon, 14 Feb 2022 13:44:56 +0000 (14:44 +0100)]
tracing: Ensure trace buffer is at least 4096 bytes large

Booting the kernel with 'trace_buf_size=1' give a warning at
boot during the ftrace selftests:

[    0.892809] Running postponed tracer tests:
[    0.892893] Testing tracer function:
[    0.901899] Callback from call_rcu_tasks_trace() invoked.
[    0.983829] Callback from call_rcu_tasks_rude() invoked.
[    1.072003] .. bad ring buffer .. corrupted trace buffer ..
[    1.091944] Callback from call_rcu_tasks() invoked.
[    1.097695] PASSED
[    1.097701] Testing dynamic ftrace: .. filter failed count=0 ..FAILED!
[    1.353474] ------------[ cut here ]------------
[    1.353478] WARNING: CPU: 0 PID: 1 at kernel/trace/trace.c:1951 run_tracer_selftest+0x13c/0x1b0

Therefore enforce a minimum of 4096 bytes to make the selftest pass.

Link: https://lkml.kernel.org/r/20220214134456.1751749-1-svens@linux.ibm.com
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing: Uninline trace_trigger_soft_disabled() partly
Christophe Leroy [Fri, 11 Feb 2022 07:10:18 +0000 (08:10 +0100)]
tracing: Uninline trace_trigger_soft_disabled() partly

On a powerpc32 build with CONFIG_CC_OPTIMISE_FOR_SIZE, the inline
keyword is not honored and trace_trigger_soft_disabled() appears
approx 50 times in vmlinux.

Adding -Winline to the build, the following message appears:

./include/linux/trace_events.h:712:1: error: inlining failed in call to 'trace_trigger_soft_disabled': call is unlikely and code size would grow [-Werror=inline]

That function is rather big for an inlined function:

c003df60 <trace_trigger_soft_disabled>:
c003df60: 94 21 ff f0  stwu    r1,-16(r1)
c003df64: 7c 08 02 a6  mflr    r0
c003df68: 90 01 00 14  stw     r0,20(r1)
c003df6c: bf c1 00 08  stmw    r30,8(r1)
c003df70: 83 e3 00 24  lwz     r31,36(r3)
c003df74: 73 e9 01 00  andi.   r9,r31,256
c003df78: 41 82 00 10  beq     c003df88 <trace_trigger_soft_disabled+0x28>
c003df7c: 38 60 00 00  li      r3,0
c003df80: 39 61 00 10  addi    r11,r1,16
c003df84: 4b fd 60 ac  b       c0014030 <_rest32gpr_30_x>
c003df88: 73 e9 00 80  andi.   r9,r31,128
c003df8c: 7c 7e 1b 78  mr      r30,r3
c003df90: 41 a2 00 14  beq     c003dfa4 <trace_trigger_soft_disabled+0x44>
c003df94: 38 c0 00 00  li      r6,0
c003df98: 38 a0 00 00  li      r5,0
c003df9c: 38 80 00 00  li      r4,0
c003dfa0: 48 05 c5 f1  bl      c009a590 <event_triggers_call>
c003dfa4: 73 e9 00 40  andi.   r9,r31,64
c003dfa8: 40 82 00 28  bne     c003dfd0 <trace_trigger_soft_disabled+0x70>
c003dfac: 73 ff 02 00  andi.   r31,r31,512
c003dfb0: 41 82 ff cc  beq     c003df7c <trace_trigger_soft_disabled+0x1c>
c003dfb4: 80 01 00 14  lwz     r0,20(r1)
c003dfb8: 83 e1 00 0c  lwz     r31,12(r1)
c003dfbc: 7f c3 f3 78  mr      r3,r30
c003dfc0: 83 c1 00 08  lwz     r30,8(r1)
c003dfc4: 7c 08 03 a6  mtlr    r0
c003dfc8: 38 21 00 10  addi    r1,r1,16
c003dfcc: 48 05 6f 6c  b       c0094f38 <trace_event_ignore_this_pid>
c003dfd0: 38 60 00 01  li      r3,1
c003dfd4: 4b ff ff ac  b       c003df80 <trace_trigger_soft_disabled+0x20>

However it is located in a hot path so inlining it is important.
But forcing inlining of the entire function by using __always_inline
leads to increasing the text size by approx 20 kbytes.

Instead, split the fonction in two parts, one part with the likely
fast path, flagged __always_inline, and a second part out of line.

With this change, on a powerpc32 with CONFIG_CC_OPTIMISE_FOR_SIZE
vmlinux text increases by only 1,4 kbytes, which is partly
compensated by a decrease of vmlinux data by 7 kbytes.

On ppc64_defconfig which has CONFIG_CC_OPTIMISE_FOR_SPEED, this
change reduces vmlinux text by more than 30 kbytes.

Link: https://lkml.kernel.org/r/69ce0986a52d026d381d612801d978aa4f977460.1644563295.git.christophe.leroy@csgroup.eu
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agoeprobes: Remove redundant event type information
Steven Rostedt (Google) [Sat, 19 Feb 2022 00:00:57 +0000 (19:00 -0500)]
eprobes: Remove redundant event type information

Currently, the event probes save the type of the event they are attached
to when recording the event. For example:

  # echo 'e:switch sched/sched_switch prev_state=$prev_state prev_prio=$prev_prio next_pid=$next_pid next_prio=$next_prio' > dynamic_events
  # cat events/eprobes/switch/format

 name: switch
 ID: 1717
 format:
        field:unsigned short common_type;       offset:0;       size:2; signed:0;
        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
        field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
        field:int common_pid;   offset:4;       size:4; signed:1;

        field:unsigned int __probe_type;        offset:8;       size:4; signed:0;
        field:u64 prev_state;   offset:12;      size:8; signed:0;
        field:u64 prev_prio;    offset:20;      size:8; signed:0;
        field:u64 next_pid;     offset:28;      size:8; signed:0;
        field:u64 next_prio;    offset:36;      size:8; signed:0;

 print fmt: "(%u) prev_state=0x%Lx prev_prio=0x%Lx next_pid=0x%Lx next_prio=0x%Lx", REC->__probe_type, REC->prev_state, REC->prev_prio, REC->next_pid, REC->next_prio

The __probe_type adds 4 bytes to every event.

One of the reasons for creating eprobes is to limit what is traced in an
event to be able to limit what is written into the ring buffer. Having
this redundant 4 bytes to every event takes away from this.

The event that is recorded can be retrieved from the event probe itself,
that is available when the trace is happening. For user space tools, it
could simply read the dynamic_event file to find the event they are for.
So there is really no reason to write this information into the ring
buffer for every event.

Link: https://lkml.kernel.org/r/20220218190057.2f5a19a8@gandalf.local.home
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Joel Fernandes <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing: Have traceon and traceoff trigger honor the instance
Steven Rostedt (Google) [Thu, 24 Feb 2022 03:38:37 +0000 (22:38 -0500)]
tracing: Have traceon and traceoff trigger honor the instance

If a trigger is set on an event to disable or enable tracing within an
instance, then tracing should be disabled or enabled in the instance and
not at the top level, which is confusing to users.

Link: https://lkml.kernel.org/r/20220223223837.14f94ec3@rorschach.local.home
Cc: stable@vger.kernel.org
Fixes: ae63b31e4d0e2 ("tracing: Separate out trace events from global variables")
Tested-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agostaging: r8188eu: remove ETH_ALEN from ieee80211.h
Michael Straube [Fri, 25 Feb 2022 12:08:43 +0000 (13:08 +0100)]
staging: r8188eu: remove ETH_ALEN from ieee80211.h

The definition of ETH_ALEN in ieee80211.h is redundant as it is an
in-kernel constant. Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220225120843.10674-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove update_bcn_p2p_ie()
Michael Straube [Fri, 25 Feb 2022 12:08:42 +0000 (13:08 +0100)]
staging: r8188eu: remove update_bcn_p2p_ie()

The function update_bcn_p2p_ie() is empty. Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220225120843.10674-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused function prototype
Michael Straube [Fri, 25 Feb 2022 12:08:41 +0000 (13:08 +0100)]
staging: r8188eu: remove unused function prototype

The function prototype rtl8188e_query_rx_phy_status() is not used.
Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220225120843.10674-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: EepromAddressSize is set but not used
Michael Straube [Fri, 25 Feb 2022 12:08:40 +0000 (13:08 +0100)]
staging: r8188eu: EepromAddressSize is set but not used

EepromAddressSize in struct adapter is set but not used. Remove it and
remove the now unused function GetEEPROMSize8188E().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220225120843.10674-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: flags for SPI IRQ were ignored
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:05 +0000 (12:24 +0100)]
staging: wfx: flags for SPI IRQ were ignored

The flags declared in the DT were not forwarded to request_irq().

Fixes: a7efb62509d8 ("staging: wfx: use threaded IRQ with SPI")
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-11-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: ensure HIF request has been sent before polling
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:04 +0000 (12:24 +0100)]
staging: wfx: ensure HIF request has been sent before polling

wfx_bh_request_tx() send HIF request asynchronously through bh_work().
Then the caller will run wfx_bh_poll_irq() to poll the answer.

However it useless to burn CPU cycles for the polling while the request
has yet been sent. Worse, wfx_bh_poll_irq() may get the CPU and prevent
wfx_bh_request_tx() to run. This problem has been observed on mono core
architecture.

This first exchange is correct:
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003004
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003004
    kworker/0:1H-40    [000] ....    : io_read: QUEUE: 08 00 09 0c 00 00 00 00 3a 7b 00 30 (12 bytes)
    kworker/0:1H-40    [000] ....    : piggyback: CONTROL: 00003000
    kworker/0:1H-40    [000] ....    : hif_recv: 0:2:CNF_CONFIGURATION: 00 00 00 00 (8 bytes)
    kworker/0:1H-40    [000] ....    : io_read32: CONFIG: 03010200
    kworker/0:1H-40    [000] ....    : bh_stats: IND/REQ/CNF:  0/  0/  1, REQ in progress:  0, WUP: release

... while the following is not:
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    kworker/u2:1-24    [000] ....    : io_read32: CONTROL: 00003000
    [...loop until timeout...]
    wfx-sdio mmc0:0001:1: time out while polling control register

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-10-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: prefer to wait for an event instead to sleep
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:03 +0000 (12:24 +0100)]
staging: wfx: prefer to wait for an event instead to sleep

When possible it is better to wait for an explicit event instead of wait
an arbitrary amount of time.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-9-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: remove duplicated code in wfx_cmd_send()
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:02 +0000 (12:24 +0100)]
staging: wfx: remove duplicated code in wfx_cmd_send()

The code to execute on end of the function is the same whatever the
command replies or not.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-8-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: drop useless include
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:01 +0000 (12:24 +0100)]
staging: wfx: drop useless include

ieee80211.h is useless since commit 5e911c3d9dbc9 ("staging: wfx: avoid
defining array of flexible struct")

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-7-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: remove useless variable
Jérôme Pouiller [Fri, 25 Feb 2022 11:24:00 +0000 (12:24 +0100)]
staging: wfx: remove useless variable

Obviously, the variable "ret" was useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-6-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: format code on 100 columns
Jérôme Pouiller [Fri, 25 Feb 2022 11:23:59 +0000 (12:23 +0100)]
staging: wfx: format code on 100 columns

A few lines were not yet formatted on 100 columns.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: format comments on 100 columns
Jérôme Pouiller [Fri, 25 Feb 2022 11:23:58 +0000 (12:23 +0100)]
staging: wfx: format comments on 100 columns

A few comments were not yet formatted on 100 columns.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-4-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: fix struct alignment
Jérôme Pouiller [Fri, 25 Feb 2022 11:23:57 +0000 (12:23 +0100)]
staging: wfx: fix struct alignment

There is no reason to add multiple spaces between a variable name and
its type.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-3-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: sta.o was linked twice
Jérôme Pouiller [Fri, 25 Feb 2022 11:23:56 +0000 (12:23 +0100)]
staging: wfx: sta.o was linked twice

sta.o was listed twice in the Makefile.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220225112405.355599-2-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: pi433: add index value to write dev_dbg statement
Paulo Miguel Almeida [Fri, 25 Feb 2022 08:03:17 +0000 (21:03 +1300)]
staging: pi433: add index value to write dev_dbg statement

Add index value to the string that will be printed by dev_dbg for better
easier visualisation when debugging. For instance, if I have a big
message payload that will inevitably get split into chunks, it would be
a hassle trying to debug if the offset of the original payload that got
sent at that time.

This patch adds index value to write dev_dbg statement.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/YhiNRSi7jijxJWCL@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: rework init and exit function
Tong Zhang [Thu, 24 Feb 2022 06:40:31 +0000 (22:40 -0800)]
staging: rtl8192u: rework init and exit function

The init and exit functions are not releasing resource properly. An error
can be observed when we load/unload/load r8192u_usb module due to this
issue. This patch rework init and exit functions to do proper resource
release on init error and module unload.
The __exit attribute is stripped from some functions since they are now
being used by module init functions.

[  493.068012] proc_dir_entry 'net/ieee80211' already registered
[  493.271973]  proc_mkdir+0x18/0x20
[  493.272136]  ieee80211_debug_init+0x28/0xde8 [r8192u_usb]
[  493.272404]  rtl8192_usb_module_init+0x10/0x161 [r8192u_usb]

[   13.910616] proc_dir_entry 'net/rtl819xU' already registered
[   13.918931]  proc_mkdir+0x18/0x20
[   13.919098]  rtl8192_usb_module_init+0x142/0x16d [r8192u_usb]

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20220224064033.1530924-3-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: add empty debug functions
Tong Zhang [Thu, 24 Feb 2022 06:40:30 +0000 (22:40 -0800)]
staging: rtl8192u: add empty debug functions

Add two empty functions to handle the case when CONFIG_IEEE80211_DEBUG
is turned off. These two functions will be used by module init() and
and exit().

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20220224064033.1530924-2-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: fix broken debug macro
Tong Zhang [Thu, 24 Feb 2022 06:40:29 +0000 (22:40 -0800)]
staging: rtl8192u: fix broken debug macro

There is an extra space in the debug macro, when CONFIG_IEEE80211_DEBUG
is switched off, compiler will complain.

drivers/staging/rtl8192u/ieee80211/ieee80211.h:470:42: error: expected ‘)’ before ‘...’ token
  470 | #define IEEE80211_DEBUG (level, fmt, args...) do {} while (0)
drivers/staging/rtl8192u/ieee80211/ieee80211.h:470:47: error: expected ‘;’ before ‘do’
  470 | #define IEEE80211_DEBUG (level, fmt, args...) do {} while (0)

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20220224064033.1530924-1-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove redundant variable reg_0x143
Colin Ian King [Thu, 24 Feb 2022 23:06:58 +0000 (23:06 +0000)]
staging: r8188eu: remove redundant variable reg_0x143

Variable reg_0x143 is being assigned a value, however is not being
read. The variable is redundant and can be removed.

Reviewed-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220224230658.151338-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: clean up rtw_rf.c
Michael Straube [Tue, 22 Feb 2022 08:28:47 +0000 (09:28 +0100)]
staging: r8188eu: clean up rtw_rf.c

Remove unnecessary includes and the unused define _RTW_RF_C_ from
rtw_rf.c.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220222082847.6687-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: refactor rtw_ch2freq()
Michael Straube [Tue, 22 Feb 2022 08:28:46 +0000 (09:28 +0100)]
staging: r8188eu: refactor rtw_ch2freq()

Convert the array ch_freq_map to a simple integer array and use
the indices as channel numbers. This simplifies the code and avoids
looping through the array to get the frequency. To avoid out of
bounds array access return a default value for invalid channel values,
like the original code did.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220222082847.6687-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove 5 GHz channels from ch_freq_map
Michael Straube [Tue, 22 Feb 2022 08:28:45 +0000 (09:28 +0100)]
staging: r8188eu: remove 5 GHz channels from ch_freq_map

According to the Realtek documentation the chips this driver supports
are 2.4 GHz only chips. Frequencies for 5 GHz channels can be removed
from the ch_freq_map array.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220222082847.6687-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused variable from UpdateHalRAMask8188EUsb
Phillip Potter [Tue, 22 Feb 2022 23:35:06 +0000 (23:35 +0000)]
staging: r8188eu: remove unused variable from UpdateHalRAMask8188EUsb

Remove the 'arg' variable from the block inside the if statement in the
UpdateHalRAMask8188EUsb function in hal/usb_halinit.c, as due to the
recent DBG_88E cleanup series, this is now set but not used. Also remove
the rest of the lines in this block that further modify 'arg' as they
are superfluous, due to it never being used afterwards.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20220222233506.72778-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Remove unnecessary line breaks
Philipp Hortmann [Mon, 21 Feb 2022 21:25:29 +0000 (22:25 +0100)]
staging: vt6656: Remove unnecessary line breaks

This patch fixes the checkpatch.pl warning like:
CHECK: Lines should not end with a '('

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/e0d6d3d787051e3aef56fdba1aee8c2bbbe14e89.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Remove ftrace-like logging
Philipp Hortmann [Mon, 21 Feb 2022 21:25:23 +0000 (22:25 +0100)]
staging: vt6656: Remove ftrace-like logging

This patch fixes the checkpatch.pl warning like:
WARNING: Unnecessary ftrace-like logging - prefer using ftrace

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/084064a5c94aad940600ae62d6c21bb26629cb2c.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Change macro to function and moved to better file
Philipp Hortmann [Mon, 21 Feb 2022 21:25:16 +0000 (22:25 +0100)]
staging: vt6656: Change macro to function and moved to better file

This patch fixes the checkpatch.pl warning like:
- CHECK: Macro argument reuse 'uVar' - possible side-effects?
Moved the only twice used function to the file where it is used.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/fa37dde640cfe5093ff23ca0881aba4673751a49.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Fix CamelCase warnings in macro
Philipp Hortmann [Mon, 21 Feb 2022 21:25:10 +0000 (22:25 +0100)]
staging: vt6656: Fix CamelCase warnings in macro

This patch fixes the checkpatch.pl warnings like:
- CHECK: Avoid CamelCase: <uVar>

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/53072a97348b08276b083ce18188b9199cbfaae6.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Add comment for locks
Philipp Hortmann [Mon, 21 Feb 2022 21:25:05 +0000 (22:25 +0100)]
staging: vt6656: Add comment for locks

This patch fixes the checkpatch.pl warnings like:
- CHECK: spinlock_t definition without comment

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/c6a5ef8e7704b488c54145b09ac44bd4880c13b4.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Fix CamelCase warnings in mac.h and mac.c
Philipp Hortmann [Mon, 21 Feb 2022 21:24:59 +0000 (22:24 +0100)]
staging: vt6656: Fix CamelCase warnings in mac.h and mac.c

This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <EnCFG_BBType_a>
175: FILE: drivers/staging/vt6656/mac.h:175:
+#define EnCFG_BBType_a 0x00
and affected places in mac.c

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/d04b36cc5446d1c996ac8bc71ff391d822cedd9d.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: check the return value of devm_kmalloc()
Xiaoke Wang [Tue, 22 Feb 2022 02:00:24 +0000 (10:00 +0800)]
staging: wfx: check the return value of devm_kmalloc()

devm_kmalloc() returns a pointer to allocated memory on success, NULL
on failure. While there is a memory allocation of devm_kmalloc()
without proper check. It is better to check the return value of it to
prevent wrong memory access.
And I use the err label which is introduced by the previous patch to
handle the error.

Link: https://lore.kernel.org/r/tencent_24A24A3EFF61206ECCC4B94B1C5C1454E108@qq.com
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_D9887936F780A393C232DC48C9EC3F1D4405@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoriscv: fix oops caused by irqsoff latency tracer
Changbin Du [Sun, 13 Feb 2022 08:18:45 +0000 (16:18 +0800)]
riscv: fix oops caused by irqsoff latency tracer

The trace_hardirqs_{on,off}() require the caller to setup frame pointer
properly. This because these two functions use macro 'CALLER_ADDR1' (aka.
__builtin_return_address(1)) to acquire caller info. If the $fp is used
for other purpose, the code generated this macro (as below) could trigger
memory access fault.

   0xffffffff8011510e <+80>:    ld      a1,-16(s0)
   0xffffffff80115112 <+84>:    ld      s2,-8(a1)  # <-- paging fault here

The oops message during booting if compiled with 'irqoff' tracer enabled:
[    0.039615][    T0] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8
[    0.041925][    T0] Oops [#1]
[    0.042063][    T0] Modules linked in:
[    0.042864][    T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.0-rc1-00233-g9a20c48d1ed2 #29
[    0.043568][    T0] Hardware name: riscv-virtio,qemu (DT)
[    0.044343][    T0] epc : trace_hardirqs_on+0x56/0xe2
[    0.044601][    T0]  ra : restore_all+0x12/0x6e
[    0.044721][    T0] epc : ffffffff80126a5c ra : ffffffff80003b94 sp : ffffffff81403db0
[    0.044801][    T0]  gp : ffffffff8163acd8 tp : ffffffff81414880 t0 : 0000000000000020
[    0.044882][    T0]  t1 : 0098968000000000 t2 : 0000000000000000 s0 : ffffffff81403de0
[    0.044967][    T0]  s1 : 0000000000000000 a0 : 0000000000000001 a1 : 0000000000000100
[    0.045046][    T0]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
[    0.045124][    T0]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000054494d45
[    0.045210][    T0]  s2 : ffffffff80003b94 s3 : ffffffff81a8f1b0 s4 : ffffffff80e27b50
[    0.045289][    T0]  s5 : ffffffff81414880 s6 : ffffffff8160fa00 s7 : 00000000800120e8
[    0.045389][    T0]  s8 : 0000000080013100 s9 : 000000000000007f s10: 0000000000000000
[    0.045474][    T0]  s11: 0000000000000000 t3 : 7fffffffffffffff t4 : 0000000000000000
[    0.045548][    T0]  t5 : 0000000000000000 t6 : ffffffff814aa368
[    0.045620][    T0] status: 0000000200000100 badaddr: 00000000000000f8 cause: 000000000000000d
[    0.046402][    T0] [<ffffffff80003b94>] restore_all+0x12/0x6e

This because the $fp(aka. $s0) register is not used as frame pointer in the
assembly entry code.

resume_kernel:
REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
bnez s0, restore_all
REG_L s0, TASK_TI_FLAGS(tp)
                andi s0, s0, _TIF_NEED_RESCHED
                beqz s0, restore_all
                call preempt_schedule_irq
                j restore_all

To fix above issue, here we add one extra level wrapper for function
trace_hardirqs_{on,off}() so they can be safely called by low level entry
code.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Fixes: 3c4697982982 ("riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>