Commit Graph

1073566 Commits

Author SHA1 Message Date
Sajid Dalvi
288abb8b19 ANDROID: PCI: dwc: Wait for the link only if it has been started
In dw_pcie_host_init() regardless of whether the link has been
started or not, the code waits for the link to come up. Even in
cases where start_link() is not defined the code ends up spinning
in a loop for 1 second. Since in some systems dw_pcie_host_init()
gets called during probe, this one second loop for each pcie
interface instance ends up extending the boot time.

Wait for the link up in only if the start_link() is defined.

The patch submitted to the upstream kernel (see link below) was not
accepted due to no upstream user.

The change here is a simplified version of that patch, which will wait
for a link only if start_link ops has been defined.

Also, this patch was already applied before in
https://r.android.com/2548250 but the functionality was lost after
https://lore.kernel.org/all/20220624143428.8334-14-Sergey.Semin@baikalelectronics.ru/
was pulled in from the LTS merge.

This patch restores the functionality (of removing the delay) which was
lost during the LTS merge.

Bug: 315052790
Link: https://lore.kernel.org/all/20240112093006.2832105-1-ajayagarwal@google.com/
Change-Id: I4e8d00f6195062728417e41ddd51072880676920
Signed-off-by: Sajid Dalvi <sdalvi@google.com>
2024-02-20 16:13:40 -06:00
Bart Van Assche
ff1e211db6 ANDROID: null_blk: Support configuring the maximum segment size
Add support for configuring the maximum segment size.

Add support for segments smaller than the page size.

This patch enables testing segments smaller than the page size with a
driver that does not call blk_rq_map_sg().

Bug: 308663717
Bug: 319125789
Change-Id: I74165d83e71201116378c4598c2f9a2ff8c8b623
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
0ffd03e67d ANDROID: scsi_debug: Support configuring the maximum segment size
Add a kernel module parameter for configuring the maximum segment size.
This patch enables testing SCSI support for segments smaller than the
page size.

Bug: 308663717
Bug: 319125789
Change-Id: Ib645dead4e10d4aaf5a1dfc1d064038153737bc1
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
3ef8e9009c ANDROID: block: Make sub_page_limit_queues available in debugfs
This new debugfs attribute makes it easier to verify the code that tracks
how many queues require limits below the page size.

Bug: 308663717
Bug: 319125789
Change-Id: I855113cd3898f9641c7c3f1b4732bf4990fc7d3d
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[jyescas@google.com: Wrap #include "blk-mq-debugfs.h" with
                     #ifndef __GENKSYSM__ to avoid ABI CRC
                     changes.]
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
bed88e7c4f ANDROID: block: Add support for filesystem requests and small segments
Add support in the bio splitting code and also in the bio submission code
for bios with segments smaller than the page size.

Bug: 308663717
Bug: 319125789
Change-Id: Iea511675ad96b0c8255c2b87811ad33c3a02c8fa
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[jyescas@google.com: the function bio_may_exceed_limits() does not
                     exists in the 5.15 kernel, so the sub page limit
                     code in block/blk.h was moved to the function
                     __blk_queue_split() in block/blk-merge.c]
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
e99e7de8a6 ANDROID: block: Support submitting passthrough requests with small segments
If the segment size is smaller than the page size there may be multiple
segments per bvec even if a bvec only contains a single page. Hence this
patch.

Bug: 308663717
Bug: 319125789
Change-Id: I446aab83a2c519cb3c42d5d8ffd814dcc34274d2
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
3f6018f1b6 ANDROID: block: Support configuring limits below the page size
Allow block drivers to configure the following:
* Maximum number of hardware sectors values smaller than
  PAGE_SIZE >> SECTOR_SHIFT. For PAGE_SIZE = 4096 this means that values
  below 8 become supported.
* A maximum segment size below the page size. This is most useful
  for page sizes above 4096 bytes.

The blk_sub_page_segments static branch will be used in later patches to
prevent that performance of block drivers that support segments >=
PAGE_SIZE and max_hw_sectors >= PAGE_SIZE >> SECTOR_SHIFT would be affected.

This patch may change the behavior of existing block drivers from not
working into working. If a block driver calls
blk_queue_max_hw_sectors() or blk_queue_max_segment_size(), this is
usually done to configure the maximum supported limits. An attempt to
configure a limit below what is supported by the block layer causes the
block layer to select a larger value. If that value is not supported by
the block driver, this may cause other data to be transferred than
requested, a kernel crash or other undesirable behavior.

Keeps the ABI stable by taking advantage of a hole in the structure!

Bug: 308663717
Bug: 319125789
Bug: 324152549
Change-Id: I4a7b605f0f0d82dde0b4703496c7314064f48acb
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[jyescas@google.com: disable subpage limits in block/blk-sysfs.c
                     instead block/blk-core.c because the function
                     blk_free_queue() is not defined in 5.15 kernel]
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
Bart Van Assche
025c278e84 ANDROID: block: Prepare for supporting sub-page limits
Introduce variables that represent the lower configuration bounds. This
patch does not change any functionality.

Bug: 308663717
Bug: 319125789
Change-Id: Ia39fbe29a0711caba841a7b44d462608216841ec
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:05:55 +00:00
Bart Van Assche
f56ddffe05 ANDROID: block: Use pr_info() instead of printk(KERN_INFO ...)
Switch to the modern style of printing kernel messages. Use %u instead
of %d to print unsigned integers.

The pr_fmt() format is added on top of the file to include __func__
in the pr_info() calls.

Bug: 308663717
Bug: 319125789
Change-Id: Iea0a19c8221fe1a2fcd3f26c5ffd0c3b69935eec
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[jyescas@google.com: define pr_fmt(fmt) to include __func__ in the output]
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:05:55 +00:00
Suren Baghdasaryan
eb7a469127 ANDROID: introduce a vendor hook to allow speculative swap pagefaults
Since SPF is an out-of-tree feature, the risks of changing its behavior
are higher. Add a vendor hook to enable speculative swap pagefaults. By
default it's disabled and should not cause troubles for current users.

Bug: 322762567
Change-Id: I3df7c545aa27d2707ee51ea42368f785c5faa735
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-02-13 21:32:42 +00:00
Suren Baghdasaryan
8014b372fb ANDROID: mm: allow limited speculative page faulting in do_swap_page()
Speculative page handling was disabled in do_swap_page() because it was
unsafe to call migration_entry_wait(). Another calls which are not safe
without taking mmap_lock are ksm_might_need_to_copy() because it relies
on the VMA being stable and readahead. However if we avoid these cases,
the rest seems to be safe. Relax the check to avoid only these unsafe
cases and allow speculation otherwise.

Bug: 322762567
Change-Id: Ic1fda0a5549088d5f37004dbacf3193116a5f868
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-02-13 21:32:42 +00:00
Carlos Llamas
d87717c9e0 ANDROID: GKI: fix ABI breakage in struct ipv6_devconf
The following list of commits, which are in the 5.15.136 release, add a
new field in struct ipv6_devconf and this breaks the abi. Fix this by
using one of the reserved slots for upstream changes and update the stg
file to preserve the build.

  5e13e69ddf ("net: release reference to inet6_dev pointer")
  aade10d51d ("net: change accept_ra_min_rtr_lft to affect all RA lifetimes")
  8f12d2d66c ("net: add sysctl accept_ra_min_rtr_lft")

type 'struct ipv6_devconf' changed
  member 'union { struct { __s32 accept_ra_min_lft; u32 padding; }; struct { u64 android_kabi_reserved1; }; union { }; }' was added
  member 'u64 android_kabi_reserved1' was removed

Bug: 320243175
Change-Id: Icddcad574f3c29f6d3e63b10f8c7e51bdf46fe7f
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-13 01:29:02 +00:00
Carlos Llamas
e9eafb11e1 Reapply "net: release reference to inet6_dev pointer"
This reverts commit 7b3ee41b62.

Bug: 320243175
Change-Id: I4627e1097dddbb697597cbb51e4ba9f4f1af61da
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-13 00:33:47 +00:00
Carlos Llamas
bdf29bd281 Reapply "net: change accept_ra_min_rtr_lft to affect all RA lifetimes"
This reverts commit 9144a81de4.

Bug: 320243175
Change-Id: If51722d74fe9b326d69c96c0cdfca43db6e33b93
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-13 00:33:33 +00:00
Carlos Llamas
aa0920715e Reapply "net: add sysctl accept_ra_min_rtr_lft"
This reverts commit 0a427f1810.

Bug: 320243175
Change-Id: Ia31692230f2f5cbd2ac349edcb2be320497c52f3
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-13 00:33:06 +00:00
Carlos Llamas
cfef864314 ANDROID: GKI: explicit include of stringify.h
The android_kabi.h header file uses the __stringify() macro without
explicitly including its definition via linux/stringify.h. This can
result in build breaking when using the ANDROID_KABI_USE macro:

  common/include/linux/ipv6.h:83:2: error: expected ')'
  ANDROID_KABI_USE(1, struct { __s32 accept_ra_min_lft; u32 padding; });
  ^
  [...]
  common/include/linux/android_kabi.h:44:24: note: expanded from macro '__ANDROID_KABI_CHECK_SIZE_ALIGN'
      __FILE__ ":" __stringify(__LINE__) ": "          \
                   ^

To fix this let android_kabi.h include stringify.h explicitly instead of
relying on includes of previous unrelated header files.

Bug: 324437514
Change-Id: I16cced44e723871b2e1a92b312e60f38e41fea70
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-13 00:29:52 +00:00
Isaac J. Manjarres
1bbef27576 ANDROID: GKI: Preserve CRC value for wireless_send_event()
Commit d7c1a9a0ed ("wifi: nl80211: validate and configure puncturing
bitmap") and commit 9b89495e47 ("wifi: nl80211: Allow authentication
frames and set keys on NAN interface") added two entries to the
nl80211_ext_feature_index enum, which caused the CRC value for the
wireless_send_event() symbol to change.

Fix this by hiding the new enum entries during the CRC generation phase.
While the values of NUM_NL80211_EXT_FEATURES and
MAX_NL80211_EXT_FEATURES have changed, it shouldn't be a problem in this
case, since MAX_NL80211_EXT_FEATURES is not used in the kernel source,
and the one usage of NUM_NL80211_EXT_FEATURES remains unchanged.

Bug: 272227555
Bug: 324871355
Change-Id: I8b5be4c39b1ab72f0f2b3c9ff10f15a981a431db
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
2024-02-12 06:29:23 -08:00
Vinay Gannevaram
6fba8c7e34 BACKPORT: wifi: nl80211: Allow authentication frames and set keys on NAN interface
Wi-Fi Aware R4 specification defines NAN Pairing which uses PASN handshake
to authenticate the peer and generate keys. Hence allow to register and transmit
the PASN authentication frames on NAN interface and set the keys to driver or
underlying modules on NAN interface.

The driver needs to configure the feature flag NL80211_EXT_FEATURE_SECURE_NAN,
which also helps userspace modules to know if the driver supports secure NAN.

Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
Link: https://lore.kernel.org/r/1675519179-24174-1-git-send-email-quic_vganneva@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: Ib8e15683772cf9696b51fb5360642813ca0a078b
(cherry picked from commit 9b89495e47)
[shivbara: replace reserved UAPI attribute with corresponding upstream
attribute]
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
(cherry picked from commit 092199e995efc58b29d568614581b3f63a05ca8c)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:33 -08:00
Rameshkumar Sundaram
a2c880b765 UPSTREAM: wifi: cfg80211: Allow action frames to be transmitted with link BSS in MLD
Currently action frames TX only with ML address as A3(BSSID) are
allowed in an ML AP, but TX for a non-ML Station can happen in any
link of an ML BSS with link BSS address as A3.
In case of an MLD, if User-space has provided a valid link_id in
action frame TX request, allow transmission of the frame in that link.

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Link: https://lore.kernel.org/r/20230201061602.3918-1-quic_ramess@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: Iceb00b0713d9123f040e10e06cbfc412ee6a0375
(cherry picked from commit 19085ef39f)
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
(cherry picked from commit 05164a8564bacb11ed74b2826b27f8bded606a12)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:33 -08:00
Aloka Dixit
a2a5f22724 BACKPORT: wifi: cfg80211: include puncturing bitmap in channel switch events
Add puncturing bitmap in channel switch notifications
and corresponding trace functions.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20230131001227.25014-4-quic_alokad@quicinc.com
[fix qtnfmac]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: I6e5c3ba2be2f1667533918d467fb3713f1d29362
(cherry picked from commit b345f0637c)
[vjakkam: resolve conflicts in mac80211 files]
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
(cherry picked from commit 6bab8a400278f71a89eb17d567eab5d5b688b771)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:33 -08:00
Aloka Dixit
2fe5888b30 BACKPORT: wifi: nl80211: validate and configure puncturing bitmap
- New feature flag, NL80211_EXT_FEATURE_PUNCT, to advertise
  driver support for preamble puncturing in AP mode.
- New attribute, NL80211_ATTR_PUNCT_BITMAP, to receive a puncturing
  bitmap from the userspace during AP bring up (NL80211_CMD_START_AP)
  and channel switch (NL80211_CMD_CHANNEL_SWITCH) operations. Each bit
  corresponds to a 20 MHz channel in the operating bandwidth, lowest
  bit for the lowest channel. Bit set to 1 indicates that the channel
  is punctured. Higher 16 bits are reserved.
- New members added to structures cfg80211_ap_settings and
  cfg80211_csa_settings to propagate the bitmap to the driver after
  validation.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Link: https://lore.kernel.org/r/20230131001227.25014-3-quic_alokad@quicinc.com
[move validation against 0xffff into policy]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: I2d9a90cba8812bfe81d0168133ef2239dcc536ac
(cherry picked from commit d7c1a9a0ed)
[shivbara: replace reserved UAPI attributes with corresponding
upstream attributes]
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
(cherry picked from commit e8a4772f4d125216fe5ea362d48e7f1a7051111a)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:33 -08:00
Aloka Dixit
1ef87d0cd0 BACKPORT: wifi: cfg80211: move puncturing bitmap validation from mac80211
- Move ieee80211_valid_disable_subchannel_bitmap() from mlme.c to
  chan.c, rename it as cfg80211_valid_disable_subchannel_bitmap()
  and export it.
- Modify the prototype to include struct cfg80211_chan_def instead
  of only bandwidth to support a check which returns false if the
  primary channel is punctured.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20230131001227.25014-2-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: I0b5d7829982afc0ae18b105ddd3ad9df7d3dd7ed
(cherry picked from commit b25413fed3)
[shivbara: Skipped changes in net/mac80211 due to missing
dependency changes]
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
(cherry picked from commit 5761541a4eb5b73572602cddeca2f732052b96e2)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:32 -08:00
Alvin Šipraga
c7c4d0de0f UPSTREAM: wifi: nl80211: add MLO_LINK_ID to CMD_STOP_AP event
nl80211_send_ap_stopped() can be called multiple times on the same
netdev for each link when using Multi-Link Operation. Add the
MLO_LINK_ID attribute to the event to allow userspace to distinguish
which link the event is for.

Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Link: https://lore.kernel.org/r/20230128125844.2407135-2-alvin@pqrs.dk
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 272227555
Change-Id: I02104259eda61893f5f40bcd18a5e89bf6871ae6
(cherry picked from commit cba7217a92)
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
(cherry picked from commit 267de69e07c3246ec07eec621689d17bef1bb377)
Signed-off-by: Lee Jones <joneslee@google.com>
2024-02-12 06:09:32 -08:00
Ben Fennema
e17b1173b0 ANDROID: GKI: add symbol list for pixel watch
1 function symbol(s) added
  'void add_taint(unsigned int, enum lockdep_ok)'

1 variable symbol(s) added
  'struct bus_type spi_bus_type'

Bug: 321098228
Change-Id: I13c8e6da30dcb512706fcf6a951f30649449ba48
Signed-off-by: Ben Fennema <fennema@google.com>
2024-02-08 20:59:04 +00:00
Isaac J. Manjarres
cea40c5b94 ANDROID: GKI: Do not export non-existent unsafe DDK header
Merge commit c51de219f5 ("Merge tag 'android14-5.15.131_r00' into
android-14-5.15") brought in upstream commit 7963d4d710 ("usb: typec:
tcpci: move tcpci.h to include/linux/usb/"). However, the reference
to the drivers/usb/typec/tcpm/tcpci.h headers was not removed from
the all_headers_unsafe ddk_headers target.

This causes build failures when building with --allow_ddk_unsafe_headers
as the file cannot be found, so remove it.

Bug: 324422915
Fixes: c51de219f5 ("Merge tag 'android14-5.15.131_r00' into android-14-5.15")
Change-Id: Id65881dd87df6edb3fe9f935e8bb45faa6af2374
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
2024-02-08 09:17:02 -08:00
John Fastabend
7aa924029c UPSTREAM: net: tls, update curr on splice as well
commit c5a595000e2677e865a39f249c056bc05d6e55fd upstream.

The curr pointer must also be updated on the splice similar to how
we do this for other copy types.

Bug: 322282717
Fixes: d829e9c411 ("tls: convert to generic sk_msg interface")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Reported-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20231206232706.374377-2-john.fastabend@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ba5efd8544)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: If942207e6338993096c9fbc8ce4c23a6bbecaf2e
2024-02-06 15:56:46 +00:00
Daniel Rosenberg
cf3a0a202e BACKPORT: f2fs: Restrict max filesize for 16K f2fs
Blocks are tracked by u32, so the max permitted filesize is
(U32_MAX + 1) * BLOCK_SIZE. Additionally, in order to support crypto
data unit sizes of 4K with a 16K block with IV_INO_LBLK_{32,64}, we must
further restrict max filesize to (U32_MAX + 1) * 4096. This does not
affect 4K blocksize f2fs as the natural limit for files are well below
that.

Fixes: ac5dd4e5de6a ("BACKPORT: Support Block Size == Page Size")
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit a6a010f5def544af3efcfe21683905a712b60536)
Change-Id: I8697e37841e1882a3f613e9aab1857ad7e4c3f2f
Bug: 248132568
2024-02-05 22:59:31 +00:00
Daniel Rosenberg
27bd7b3da9 BACKPORT: f2fs: Support Block Size == Page Size
This allows f2fs to support cases where the block size = page size for
both 4K and 16K block sizes. Other sizes should work as well, should the
need arise. This does not currently support 4K Block size filesystems if
the page size is 16K.

Change-Id: Ifab03cddeec1389a6a3fb64174063ffccbb93072
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bug: 248132568
(cherry picked from commit 8b8e202be3264fc33464f8dc319e0c1563ac89d8)
(fixed minor conflict in fs/f2fs/inode.c)
2024-02-05 22:59:31 +00:00
Ard Biesheuvel
e548514692 UPSTREAM: arm64: scs: Disable LTO for SCS patching code
Full LTO takes the '-mbranch-protection=none' passed to the compiler
when generating the dynamic shadow call stack patching code as a hint to
stop emitting PAC instructions altogether. (Thin LTO appears unaffected
by this)

Work around this by disabling LTO for the compilation unit, which
appears to convince the linker that it should still use PAC in the rest
of the kernel..

Fixes: 3b619e22c4 ("arm64: implement dynamic shadow call stack for Clang")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20240123133052.1417449-6-ardb+git@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit d104a6fef3fec137d8d44961224ab76edbd6cbc7)
Bug: 317883735
Change-Id: Ic4bdb0a6e527f8cb2745282b81945aa7b7231502
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2024-02-05 10:13:53 -08:00
Pablo Neira Ayuso
46ed54bf00 UPSTREAM: netfilter: nf_tables: check if catch-all set element is active in next generation
commit b1db244ffd041a49ecc9618e8feb6b5c1afcdaa7 upstream.

When deactivating the catch-all set element, check the state in the next
generation that represents this transaction.

This bug uncovered after the recent removal of the element busy mark
a2dd0233cb ("netfilter: nf_tables: remove busy mark and gc batch API").

Bug: 323034444
Fixes: aaa31047a6 ("netfilter: nftables: add catch-all set element support")
Cc: stable@vger.kernel.org
Reported-by: lonial con <kongln9170@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a372f1d01b)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I40ac92a33db48a2709079d27d7d529946ba297c7
2024-02-05 15:51:10 +00:00
Pindar Yang
c523387084 ANDROID: Update the ABI symbol list
1 function symbol(s) added
  'bool iio_buffer_enabled(struct iio_dev*)'

Bug: 300854197
Change-Id: I12f80e536138be95afbfd5ad9b5c7233c549c0fd
Signed-off-by: Pindar Yang <pindaryang@google.com>
2024-02-05 08:50:54 +00:00
Greg Kroah-Hartman
8d40c367ee Reapply "perf: Fix perf_event_validate_size()"
This reverts commit 63d0d92b34 which is
commit 382c27f4ed28f803b1f1473ac2d8db0afc795a1b upstream.

Bug: 316932704
Change-Id: I69bfbf5180f57592ce285ea14f6f7b7c1b2b0f8f
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-02-02 10:04:47 +00:00
Carlos Llamas
671218461d ANDROID: binder: fix integer as NULL assignment
Fixes the following sparse warning:

  drivers/android/binder_alloc.c:883:25: warning: Using plain integer as NULL pointer

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401190625.6EvaSCpr-lkp@intel.com/
Fixes: 63f7ddea2e ("ANDROID: binder: fix KMI-break due to address type change")
Change-Id: I1ac36c879c3396c1c4945602c1dfdc6e3b192b47
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2024-02-01 23:17:16 +00:00
Matthew Wilcox (Oracle)
d632b78a61 UPSTREAM: ida: Fix crash in ida_free when the bitmap is empty
[ Upstream commit af73483f4e8b6f5c68c9aa63257bdd929a9c194a ]

The IDA usually detects double-frees, but that detection failed to
consider the case when there are no nearby IDs allocated and so we have a
NULL bitmap rather than simply having a clear bit.  Add some tests to the
test-suite to be sure we don't inadvertently reintroduce this problem.
Unfortunately they're quite noisy so include a message to disregard
the warnings.

Bug: 321878978
Reported-by: Zhenghan Wang <wzhmmmmm@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 5dbcdaf4db)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4919e5c64af12f86fe1a91e1e9224a58eedbf345
2024-02-01 10:27:53 +00:00
Phil Sutter
f7b4a1559d UPSTREAM: netfilter: nf_tables: Reject tables of unsupported family
commit f1082dd31f upstream.

An nftables family is merely a hollow container, its family just a
number and such not reliant on compile-time options other than nftables
support itself. Add an artificial check so attempts at using a family
the kernel can't support fail as early as possible. This helps user
space detect kernels which lack e.g. NFPROTO_INET.

Bug: 321815738
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ab3a3aadb3)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I7123795885791a62089d5f7d1e5ff5a3f90e4abd
2024-02-01 10:27:12 +00:00
Minchan Kim
0a649455af ANDROID: ABI break fix caused by kernfs_root and kernfs_elem_dir size increase
Adding kernfs_rwsem in kernfs_root breaks the ABI unfortunately
since it changes the size of kernfs_root structure.
To fix the issue, this patch introduces new data structure
kernfs_root_ext which includes kernfs_root with kernfs_rwsem to
avoid increasing kernfs_root'size. It also introduces kernfs_rwsem
wrapper function to reach kernfs_rwsem from kernfs_root to minimize
change.

Bug: 320903885
Bug: 219424218
Bug: 206126556
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Iabaad9623e9a101210073db3106c93f06847a8b3
2024-01-31 12:33:55 -08:00
Minchan Kim
1de2411a19 UPSTREAM: kernfs: fix NULL dereferencing in kernfs_remove
kernfs_remove supported NULL kernfs_node param to bail out but revent
per-fs lock change introduced regression that dereferencing the
param without NULL check so kernel goes crash.

This patch checks the NULL kernfs_node in kernfs_remove and if so,
just return.

Quote from bug report by Jirka

```
The bug is triggered by running NAS Parallel benchmark suite on
SuperMicro servers with 2x Xeon(R) Gold 6126 CPU. Here is the error
log:

[  247.035564] BUG: kernel NULL pointer dereference, address: 0000000000000008
[  247.036009] #PF: supervisor read access in kernel mode
[  247.036009] #PF: error_code(0x0000) - not-present page
[  247.036009] PGD 0 P4D 0
[  247.036009] Oops: 0000 [#1] PREEMPT SMP PTI
[  247.058060] CPU: 1 PID: 6546 Comm: umount Not tainted
5.16.0393c3714081a53795bbff0e985d24146def6f57f+ #16
[  247.058060] Hardware name: Supermicro Super Server/X11DDW-L, BIOS
2.0b 03/07/2018
[  247.058060] RIP: 0010:kernfs_remove+0x8/0x50
[  247.058060] Code: 4c 89 e0 5b 5d 41 5c 41 5d 41 5e c3 49 c7 c4 f4
ff ff ff eb b2 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1f 44 00 00
41 54 55 <48> 8b 47 08 48 89 fd 48 85 c0 48 0f 44 c7 4c 8b 60 50 49 83
c4 60
[  247.058060] RSP: 0018:ffffbbfa48a27e48 EFLAGS: 00010246
[  247.058060] RAX: 0000000000000001 RBX: ffffffff89e31f98 RCX: 0000000080200018
[  247.058060] RDX: 0000000080200019 RSI: fffff6760786c900 RDI: 0000000000000000
[  247.058060] RBP: ffffffff89e31f98 R08: ffff926b61b24d00 R09: 0000000080200018
[  247.122048] R10: ffff926b61b24d00 R11: ffff926a8040c000 R12: ffff927bd09a2000
[  247.122048] R13: ffffffff89e31fa0 R14: dead000000000122 R15: dead000000000100
[  247.122048] FS:  00007f01be0a8c40(0000) GS:ffff926fa8e40000(0000)
knlGS:0000000000000000
[  247.122048] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  247.122048] CR2: 0000000000000008 CR3: 00000001145c6003 CR4: 00000000007706e0
[  247.122048] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  247.122048] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  247.122048] PKRU: 55555554
[  247.122048] Call Trace:
[  247.122048]  <TASK>
[  247.122048]  rdt_kill_sb+0x29d/0x350
[  247.122048]  deactivate_locked_super+0x36/0xa0
[  247.122048]  cleanup_mnt+0x131/0x190
[  247.122048]  task_work_run+0x5c/0x90
[  247.122048]  exit_to_user_mode_prepare+0x229/0x230
[  247.122048]  syscall_exit_to_user_mode+0x18/0x40
[  247.122048]  do_syscall_64+0x48/0x90
[  247.122048]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  247.122048] RIP: 0033:0x7f01be2d735b
```

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215696
Link: https://lore.kernel.org/lkml/CAE4VaGDZr_4wzRn2___eDYRtmdPaGGJdzu_LCSkJYuY9BEO3cw@mail.gmail.com/
Fixes: 393c371408 (kernfs: switch global kernfs_rwsem lock to per-fs lock)
Cc: stable@vger.kernel.org
Reported-by: Jirka Hladky <jhladky@redhat.com>
Tested-by: Jirka Hladky <jhladky@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Link: https://lore.kernel.org/r/20220427172152.3505364-1-minchan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit ad8d869343)

Bug: 320903885
Bug: 219424218
Bug: 206126556
Change-Id: I5b0a491231ee8913b7f522f22349c22ba0e07d88
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-01-31 12:33:55 -08:00
Minchan Kim
05de9bcede UPSTREAM: kernfs: prevent early freeing of root node
Marek reported the warning below.

  =========================
  WARNING: held lock freed!
  5.16.0-rc2+ #10984 Not tainted
  -------------------------
  kworker/1:0/18 is freeing memory ffff00004034e200-ffff00004034e3ff,
with a lock still held there!
  ffff00004034e348 (&root->kernfs_rwsem){++++}-{3:3}, at:
__kernfs_remove+0x310/0x37c
  3 locks held by kworker/1:0/18:
   #0: ffff000040107938 ((wq_completion)cgroup_destroy){+.+.}-{0:0}, at:
process_one_work+0x1f0/0x6f0
   #1: ffff80000b55bdc0
((work_completion)(&(&css->destroy_rwork)->work)){+.+.}-{0:0}, at:
process_one_work+0x1f0/0x6f0
   #2: ffff00004034e348 (&root->kernfs_rwsem){++++}-{3:3}, at:
__kernfs_remove+0x310/0x37c

  stack backtrace:
  CPU: 1 PID: 18 Comm: kworker/1:0 Not tainted 5.16.0-rc2+ #10984
  Hardware name: Raspberry Pi 4 Model B (DT)
  Workqueue: cgroup_destroy css_free_rwork_fn
  Call trace:
   dump_backtrace+0x0/0x1ac
   show_stack+0x18/0x24
   dump_stack_lvl+0x8c/0xb8
   dump_stack+0x18/0x34
   debug_check_no_locks_freed+0x124/0x140
   kfree+0xf0/0x3a4
   kernfs_put+0x1f8/0x224
   __kernfs_remove+0x1b8/0x37c
   kernfs_destroy_root+0x38/0x50
   css_free_rwork_fn+0x288/0x3d4
   process_one_work+0x288/0x6f0
   worker_thread+0x74/0x470
   kthread+0x188/0x194
   ret_from_fork+0x10/0x20

Since kernfs moves the kernfs_rwsem lock into root, it couldn't hold
the lock when the root node is tearing down. Thus, get the refcount
of root node.

Fixes: 393c371408 ("kernfs: switch global kernfs_rwsem lock to per-fs lock")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Link: https://lore.kernel.org/r/20211201231648.1027165-1-minchan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 555a0ce455)

Bug: 320903885
Change-Id: If96f85b88b662e88430c9c8d1efb436e9a80ddcf
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-01-31 12:33:54 -08:00
Minchan Kim
d8dbc91f9a UPSTREAM: kernfs: switch global kernfs_rwsem lock to per-fs lock
The kernfs implementation has big lock granularity(kernfs_rwsem) so
every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the
lock. It makes trouble for some cases to wait the global lock
for a long time even though they are totally independent contexts
each other.

A general example is process A goes under direct reclaim with holding
the lock when it accessed the file in sysfs and process B is waiting
the lock with exclusive mode and then process C is waiting the lock
until process B could finish the job after it gets the lock from
process A.

This patch switches the global kernfs_rwsem to per-fs lock, which
put the rwsem into kernfs_root.

Suggested-by: Tejun Heo <tj@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Link: https://lore.kernel.org/r/20211118230008.2679780-1-minchan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 393c371408)

Bug: 320903885
Bug: 219424218
Bug: 206126556
Change-Id: I5f942f7a4a18b3c2198496fea789b381ba955d19
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-01-31 12:33:54 -08:00
Greg Kroah-Hartman
73ba66a3c5 Reapply "perf: Disallow mis-matched inherited group reads"
This reverts commit 96e78d17ff3251e17ba5894ad194227c0a44adbb.

Keeps the ABI stable by taking advantage of a hole in the structure!

Bug: 307236803
Change-Id: Ic5f7ebeb3a9b13afdb3bfff7e54c4a93b863dab6
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-01-31 02:02:04 +00:00
T.J. Mercier
076f9f28f5 FROMGIT: mm: memcg: don't periodically flush stats when memcg is disabled
The root memcg is onlined even when memcg is disabled.  When it's onlined
a 2 second periodic stat flush is started, but no stat flushing is
required when memcg is disabled because there can be no child memcgs.
Most calls to flush memcg stats are avoided when memcg is disabled as a
result of the mem_cgroup_disabled check added in 7d7ef0a4686a ("mm: memcg:
restore subtree stats flushing"), but the periodic flushing started in
mem_cgroup_css_online is not.  Skip it.

Link: https://lkml.kernel.org/r/20240126211927.1171338-1-tjmercier@google.com
Fixes: aa48e47e39 ("memcg: infrastructure to flush memcg stats")
Change-Id: Iae6aeb3091d349898ea4987a784a971d9b3c97f7
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Chris Li <chrisl@kernel.org>
Reported-by: Minchan Kim <minchan@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 7e9bccbe57812f888f51d46d7cdbc6327eee24f3
 https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/
 mm-unstable)
Signed-off-by: T.J. Mercier <tjmercier@google.com>
2024-01-30 20:40:26 +00:00
Amit Pundir
a330adce53 UPSTREAM: Revert "drm/bridge: lt9611uxc: Switch to devm MIPI-DSI helpers"
This reverts commit f53a045793.

This and the dependent fixes broke display on RB5.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I4fdd0480c2df048a97dff263fc7da4016110c8f8
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from commit 7aa33c99b5)
2024-01-30 21:43:26 +05:30
Amit Pundir
ac7b9d215a UPSTREAM: Revert "drm/bridge: lt9611uxc: Register and attach our DSI device at probe"
This reverts commit 29aba28ea1.

This and the dependent fixes broke display on RB5.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I30de5ccc3baca99c876a213ca7884b2dbfed6926
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from commit 4a8350a0ea)
2024-01-30 21:43:16 +05:30
Amit Pundir
a9030727b0 UPSTREAM: Revert "drm/bridge: lt9611uxc: fix the race in the error path"
This reverts commit d0d01bb4a5.

This and the dependent fixes broke display on RB5.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: I2b14dacf44678ce65024092f5050ee735d39ea87
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from commit e21817ce16)
2024-01-30 21:42:53 +05:30
Kalesh Singh
d9ce9afcf1 ANDROID: mm: Fix VMA ref count after fast-mremap
Since the cmpxchg() to unlock the VMA (reset ref count from -1), is
enclosed in VM_BUG_ON_VMA() it gets compiled out in non-debug builds
(CONFIG_DEBUG_VM=n). This means that any VMA that underwent a fast-remap
will have it's refcount stuck at -1, making it not be eligible for
future speculative faults, and preventing freeing of the VMA.

Bug: 322411509
Change-Id: If5bf61c7d94268700f2c4f096d946201b68abdb8
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-01-26 04:58:45 +00:00
James Tai
1982cd32ae ANDROID: GKI: Remove CONFIG_MEDIA_CEC_RC
This config will cause the 'CtsHdmiCecHostTestCases' test case to fail.
According to the discussion in bug 309377116, it is recommended to remove this config.

Bug: 322143898
Change-Id: Ied37a6c55f4198dbb9dbb9b6c3156a8a7a0bd945
Signed-off-by: James Tai <james.tai@realtek.com>
2024-01-25 18:22:04 +00:00
Todd Kjos
270ce44fdb Merge "Merge tag 'android14-5.15.144_r00' into branch 'android14-5.15'" into android14-5.15 2024-01-24 17:27:58 +00:00
John Stultz
9a196e8051 ANDROID: uid_sys_stats: Drop CONFIG_UID_SYS_STATS_DEBUG logic
It was pointed out that since commit b6115e140102 ("ANDROID:
uid_sys_stat: split the global lock uid_lock to the fine-grained locks
for each hlist in hash_table") taking a spin_lock in uid_lock()
causes a scheduling while atomic error if CONFIG_UID_SYS_STATS_DEBUG
is enabled, as get_full_task_comm() takes the mmap_write_lock()
which is a semaphore, breaking the proper ordering.

In the GKI CONFIG_UID_SYS_STATS_DEBUG is disabled, so this went
unnoticed.

The uid_sys_stats logic isn't ever going to go upstream (it depends
on reverting upstream logic) and will hopefully be replaced eventually.
So there's not much reason to drag around this debug logic that is
unused.

So drop it. Less code to schlep forward.

Bug: 320184870
Change-Id: I2cfce79d5a25a3eba11a5509444c07b4642ef2de
Signed-off-by: John Stultz <jstultz@google.com>
2024-01-23 17:07:00 +00:00
John Stultz
debd0f470b ANDROID: uid_sys_stats: Fully initialize uid_entry_tmp value
Amit Pundir at Linaro reported seeing crashes in uid_sys_stats
driver when building with GCC.

Looking into it, it seems the uid_entry_tmp value is used
while only partially initialized, causing potential out of bound
access on the uid_entry io arrays.

This likely has gone unnoticed with clang as I believe we're
using the zero initialization for stack variables security
feature.

So change the logic to fully initialize the uid_entry_tmp
value.

Fixes: f68d4f3c3b53 ("ANDROID: uid_sys_stat: instead update_io_stats_uid_locked to update_io_stats_uid")
Reported-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <jstultz@google.com>
Change-Id: I78de245e80ef60aabec78a615c7ba582ab5a2242
2024-01-23 00:56:50 +00:00
Avichal Rakesh
cf1268f696 UPSTREAM: usb: gadget: uvc: Remove nested locking
When handling error status from uvcg_video_usb_req_queue,
uvc_video_complete currently calls uvcg_queue_cancel with
video->req_lock held. uvcg_queue_cancel internally locks
queue->irqlock, which nests queue->irqlock inside
video->req_lock. This isn't a functional bug at the
moment, but does open up possibilities for ABBA
deadlocks in the future.

This patch fixes the accidental nesting by dropping
video->req_lock before calling uvcg_queue_cancel.

Fixes: 6acba0345b68 ("usb:gadget:uvc Do not use worker thread to pump isoc usb requests")
Signed-off-by: Avichal Rakesh <arakesh@google.com>
Link: https://lore.kernel.org/r/20240104215009.2252452-2-arakesh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 314338409
(cherry picked from commit 9866dc4314c6c858e451933f965d64532aec00a9)
Change-Id: I22c79314f6d3ca74c0d53e462a1bde26806d3ff2
Signed-off-by: Avichal Rakesh <arakesh@google.com>
2024-01-22 16:59:57 +00:00