Commit Graph

877877 Commits

Author SHA1 Message Date
przekichane
58a0ded1fe arch: arm64: configs: thyme: Switch to TECHPACK_CAMERA_XIAOMI_CAS
Without this, the camera doesn't work.

Change-Id: I0b557c461c748b5d7397fa79d066abad93bdef39
2024-12-17 17:38:14 +08:00
Nanhumly
83b521195d drivers: power: supply: ti: Fix bq25790 driver build
* Missing in d14354fb62.

Change-Id: I9e830109711769cd272d91980a231ac2ac801e80
2024-09-13 10:27:55 +00:00
Sebastiano Barezzi
30d4eb062a arch: arm64: boot: dts: vendor: Adapt IR SPI binding for upstream driver
Change-Id: I9002f2e8d3a214195fe6131cc38d2a09e4c4c6f2
2024-08-28 16:49:28 +02:00
Sebastiano Barezzi
b9aa362724 arch: arm64: configs: xiaomi: Enable IR SPI driver
Change-Id: Ic3847f01a898d6ca39d138bcbc9bdbea38556ab7
2024-08-28 16:49:28 +02:00
Ivan Vecera
de0f99e2ca media: rc: ir-spi: enlarge transmit buffer
Xiaomi's remote controller app uses frequency up to 60kHz and
transmit buffer up to 64kB (32768 of 16bit words).

Signed-off-by: Ivan Vecera <ivan@cera.cz>
Change-Id: I9b1da638fc981b09e0208d06f82ce0c5cf159654
2024-08-28 16:49:27 +02:00
Sebastiano Barezzi
38dae67fea arch: arm64: configs: xiaomi: Stop building Xiaomi IR SPI driver
Change-Id: I63a8ec655adacb0c805e0e374fc4b73df7b59ade
2024-08-28 16:07:19 +02:00
Sebastiano Barezzi
b052ffa187 Revert "drivers: media: rc: Import Xiaomi IR SPI driver"
This reverts commit 5a6bd9b704.

Change-Id: I8608a1420260750af6a10e34aadd5ac3d721a623
2024-08-28 16:07:18 +02:00
Kazuki H
fe02d9b4ad fixup! drivers: bq2597x: Remove floating point arithmetics
Change-Id: Ic52be19e44698951e9f08fec32c3b18cc80c114e
2024-08-28 16:07:18 +02:00
Sebastiano Barezzi
a233d72472 drivers: power: supply: qcom: munch: Fix misleading indentation
Change-Id: I81fce9c77c3d976e2b3ef84fe7222b912c82bb80
2024-08-28 16:00:47 +02:00
althafvly
509ebf233a drivers: power: Fix misleading indentation
Change-Id: I9f43e382d8caf54c4b5ebc4325072d07c614d0ee
2024-08-24 09:48:58 +05:30
althafvly
8431e60de2 techpack: display: Fix misleading indentation
Change-Id: I6e5924323d8d4047c1740e8b1eeaf78c4a8f7821
2024-08-24 09:48:54 +05:30
Kazuki H
71358d0ac0 drivers: bq2597x: Remove floating point arithmetics
Change-Id: I04ee389f100fc88019d72f817f7856ee738ca0c1
Signed-off-by: Kazuki H <kazukih0205@gmail.com>
2024-08-22 20:37:14 +05:30
Sebastiano Barezzi
b8aeeeba56 Merge remote-tracking branch 'qcom_sm8250/lineage-20' into lineage-21
Change-Id: I3159ae2c81329a81f9f6d4feba3fd1324a86b4f6
2024-08-21 19:34:30 +02:00
Michael Bestas
c0fa8756ad net: aquantia: Fix misleading indentation
Change-Id: I188275a824a02e1ec0f37e7bd30724c75b8b0225
2024-08-19 13:44:38 +03:00
Michael Bestas
4da46f8047 max31760: Fix misleading indentation
Change-Id: Ib50db1c3418c8b4e3aa3880f7052aed37252598b
2024-08-19 13:38:41 +03:00
Alexander Winkowski
fd4f634bbc techpack: audio: Fix indentation in wsa881x_visense_adc_ctrl()
Cross-checked with msm-4.14 and msm-5.15 tags. The change does not exist
as a separate commit and is squashed into the initial import.

Change-Id: Ib3defedf0fbd5b7cdccdfba26383313ff05b4ef0
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2024-08-19 12:58:31 +03:00
Alexander Winkowski
2b7f56236b techpack: camera-bengal: Add missing braces in cam_ope_mgr_create_kmd_buf()
Cross-checked with msm-5.15 tag. The change does not exist as a separate
commit and is squashed into the initial import.

Change-Id: Ie922c512d7ea24661d3179cfd156ab8eb6fcc363
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2024-08-19 12:44:44 +03:00
Hridaya Prajapati
1f337f06c2 fscrypt: Fix misleading indentation
fs/crypto/policy.c:656:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  656 |                         return 0;
      |                         ^
fs/crypto/policy.c:654:3: note: previous statement is here
  654 |                 if (!strcmp(boot, SDHCI) && !strcmp(file_system_type, "f2fs"))
      |                 ^
1 error generated.

Change-Id: I14c5d8aec6ff611be24548dd228ee0264c72ab38
2024-08-19 07:25:59 +00:00
Hridaya Prajapati
b5891ee6b6 dcc_v2: Fix misleading indentations
Change-Id: Ic6145100d9c402b5cd9db51377b45527c8ff41fe
2024-08-19 07:25:59 +00:00
Hridaya Prajapati
c4d84c574d usb_bam: Fix misleading indentations
drivers/platform/msm/usb_bam.c:1158:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
 1158 |                         spin_unlock(&ctx->usb_bam_lock);
      |                         ^
drivers/platform/msm/usb_bam.c:1156:3: note: previous statement is here
 1156 |                 else
      |                 ^
drivers/platform/msm/usb_bam.c:1279:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
 1279 |                         spin_unlock(&ctx->usb_bam_lock);
      |                         ^
drivers/platform/msm/usb_bam.c:1277:3: note: previous statement is here
 1277 |                 else
      |                 ^
2 errors generated.

Change-Id: Iff4ccebdbb25d8294f74ebdb7f9053a5f6b1da85
2024-08-19 07:25:59 +00:00
Jordan Crouse
68a4bcad10 crypto: msm: Fix compile errors
Fix an out of order definition of MODULE_DEVICE_TABLE, add missing
brackets to fix a suspect indentation warning and mark an
implcit switch fall through.

Fixes: 377c69bf3e72 ("crypto: msm: Add QTI crypto drivers")
Change-Id: Ic0dedbada33fd2e5c692e5f0d64fd0e7b7afb5f1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2024-08-19 07:25:59 +00:00
Jordan Crouse
d0bee3c223 crypto: msm: Fix incorrect boolean logic
Fix the following warning from gcc 7.4.1 with -Werror enabled:

 drivers/crypto/msm/qce50.c:4668:28: error: ‘~’ on a boolean expression
  [-Werror=bool-operation]
  pce_dev->cadence_flag = ~pce_dev->cadence_flag;

 drivers/crypto/msm/qce50.c:4668:28: note: did you mean to use logical not?.

Fixes: 377c69bf3e72 ("crypto: msm: Add QTI crypto drivers")
Change-Id: Ic0dedbad73c49d059d68d9412009b74583d33154
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2024-08-19 07:25:59 +00:00
Hridaya Prajapati
24f2bc34eb Makefile: Enable misleading indentation and bool operation warnings
This reverts commit 3d60097193.

Let's fix these warnings.

Change-Id: I9e00c4f60f2030a62955aa6bb403ffc27d2d596c
2024-08-19 07:25:59 +00:00
Nathan Chancellor
f64cfc7a78 kbuild: Remove '-mno-global-merge'
This flag is specific to clang, where it is only used by the 32-bit and
64-bit ARM backends. In certain situations, the presence of this flag
will cause a warning, as shown by commit 6580c5c18fb3 ("um: clang: Strip
out -mno-global-merge from USER_CFLAGS").

Since commit 61163efae0 ("kbuild: LLVMLinux: Add Kbuild support for
building kernel with Clang") that added this flag back in 2014, there
have been quite a few changes to the GlobalMerge pass in LLVM. Building
several different ARCH=arm and ARCH=arm64 configurations with LLVM 11
(minimum) and 15 (current main version) with this flag removed (i.e.,
with the default of '-mglobal-merge') reveals no modpost warnings, so it
is likely that the issue noted in the comment is no longer relevant due
to changes in LLVM or modpost, meaning this flag can be removed.

If any new warnings show up that are a result of the removal of this
flag, it can be added back under arch/arm{,64}/Makefile to avoid
warnings on other architectures.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: David Gow <davidgow@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit cf300b83c793c25c6b485fdaf7a4447d8ea4c655)
Change-Id: Ice39a960619319828b83c8091798fe383395a2b0
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2024-08-19 07:25:59 +00:00
Danny Lin
a2f77b87fa Revert "ANDROID: HACK: arm64, LLVMLinux: use -mno-implicit-float"
This reverts commit f3fda57f6a.

Unnecessary with Clang 6.0+.

Change-Id: I6f29ca050566e9027e51605e64bf6893602344ef
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2024-08-19 07:25:59 +00:00
Maciej Żenczykowski
315125306c ANDROID: fully revert ANDROID_PARANOID_NETWORK
Revert "ANDROID: net: paranoid: security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable()."
This reverts commit 944c75118e.

Revert "ANDROID: net: paranoid: Only NET_ADMIN is allowed to fully control TUN interfaces."
This reverts commit 6ac0eb6d0d.

Revert "ANDROID: net: paranoid: Replace AID_NET_RAW checks with capable(CAP_NET_RAW)."
This reverts commit 336442ab5c.

Revert "ANDROID: net: Paranoid network."
This reverts commit bac1ef3ca9.

Test: Results of:
  git grep 'ANDROID_PARANOID_NETWORK|[^A-Z_]AID_'
  look reasonable
Bug: 138428914
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibfd6c538ca87e645ab8cf28affb40abd6be0858e
2024-08-19 07:25:59 +00:00
Maciej Żenczykowski
c036663544 ANDROID: revert all xt_qtaguid stuff
Revert "ANDROID: xt_qtaguid: fix UAF race"
This reverts commit 5efc888dcb.

Revert "ANDROID: xt_qtaguid: Remove tag_entry from process list on untag"
This reverts commit 5a7c121b2903285f0f97c3352e560274116ab984.

Revert "ANDROID: xt_qtaguid: Remove unnecessary null checks to device's name"
This reverts commit 441e17f79c.

Revert "ANDROID: qtaguid: Fix the UAF probelm with tag_ref_tree"
This reverts commit b4d74821e0.

Revert "ANDROID: netfilter: xt_qtaguid: Fix 4.14 compilation"
This reverts commit 2f6e1d62d4.

Revert "ANDROID: netfilter: xt_qtaguid: Use sk_uid to replace uid get from socket file"
This reverts commit 109379668e.

Revert "ANDROID: netfilter: xt_qtaguid: fix handling for cases where tunnels are used."
This reverts commit 972ca00dc9.

Revert "ANDROID: netfilter: xt_qtaguid: handle properly request sockets"
This reverts commit 5824b89fe0.

Revert "ANDROID: netfilter: xt_qtaguid: Add untag hacks to inet_release function"
This reverts commit f2ad6ade89.

Revert "ANDROID: netfilter: xt_qtaguid: don't check if embedded arrays are NULL"
This reverts commit 65a7a5ee5b.

Revert "ANDROID: netfilter: xt_qtaguid: fix the deadlock when enable DDEBUG"
This reverts commit 8ccc999c5e.

Revert "ANDROID: netfilter: xt_qtaguid: Don't show empty tag stats for unprivileged uids"
This reverts commit 6cdbac6f3e.

Revert "ANDROID: netfilter: xt_qtaguid: Fix panic caused by processing non-full socket."
This reverts commit f20252d7da.

Revert "ANDROID: netfilter: xt_qtaguid: Fix panic caused by synack processing"
This reverts commit af798507c0.

Revert "ANDROID: netfilter: xt_qtaguid: fix a race condition in if_tag_stat_update"
This reverts commit ca58d2242f.

Revert "ANDROID: netfilter: xt_qtaguid: xt_socket: build fixes"
This reverts commit 5dfb5c0e04.

Revert "ANDROID: netfilter: xt_qtaguid: Use sk_callback_lock read locks before reading sk->sk_socket"
This reverts commit 06ac276ee6.

Revert "ANDROID: netfilter: xt_qtaguid/xt_socket: Build fixups"
This reverts commit 9b19736f43.

Revert "ANDROID: netfilter: xt_qtaguid: Fix boot panic"
This reverts commit 6fc67945ea.

Revert "ANDROID: netfilter: xt_qtaguid: fix bad tcp_time_wait sock handling"
This reverts commit a89db3e49d.

Revert "ANDROID: netfilter: xt_qtaguid: 3.10 fixes"
This reverts commit 1474b38fe6.

Revert "ANDROID: netfilter: xt_qtaguid: rate limit some of the printks"
This reverts commit bc1e31b839.

Revert "ANDROID: netfilter: xt_qtaguid: Allow tracking loopback"
This reverts commit 11a32dfd17.

Revert "ANDROID: netfilter: xt_qtaguid: extend iface stat to report protocols"
This reverts commit 2170698b06.

Revert "ANDROID: netfilter: xt_qtaguid: remove AID_* dependency for access control"
This reverts commit 5fecf3b1a1.

Revert "ANDROID: netfilter: xt_qtaguid: Don't BUG_ON if create_if_tag_stat fails"
This reverts commit 61a97f2011.

Revert "ANDROID: netfilter: xt_qtaguid: fix error exit that would keep a spinlock."
This reverts commit 260b664522.

Revert "ANDROID: netfilter: xt_qtaguid: report only uid tags to non-privileged processes"
This reverts commit 22ecb1cbf8.

Revert "ANDROID: netfilter: xt_qtaguid: start tracking iface rx/tx at low level"
This reverts commit a2d25419f8.

Revert "ANDROID: netfilter: xt_qtaguid: fix ipv6 protocol lookup"
This reverts commit 588f1e1dbb.

Revert "ANDROID: netfilter: xt_qtaguid: add qtaguid matching module"
This reverts commit 00f57e8b30.

Based on:
  athina:/git/AND-B5R3 ((0a5c1622fe85...))$ git log --oneline --no-merges remotes/android/kernel/common/android-4.19-q..HEAD | egrep qtaguid
  441e17f79c ANDROID: xt_qtaguid: Remove unnecessary null checks to device's name
  b4d74821e0 ANDROID: qtaguid: Fix the UAF probelm with tag_ref_tree
  2f6e1d62d4 ANDROID: netfilter: xt_qtaguid: Fix 4.14 compilation
  109379668e ANDROID: netfilter: xt_qtaguid: Use sk_uid to replace uid get from socket file
  972ca00dc9 ANDROID: netfilter: xt_qtaguid: fix handling for cases where tunnels are used.
  5824b89fe0 ANDROID: netfilter: xt_qtaguid: handle properly request sockets
  f2ad6ade89 ANDROID: netfilter: xt_qtaguid: Add untag hacks to inet_release function
  65a7a5ee5b ANDROID: netfilter: xt_qtaguid: don't check if embedded arrays are NULL
  8ccc999c5e ANDROID: netfilter: xt_qtaguid: fix the deadlock when enable DDEBUG
  6cdbac6f3e ANDROID: netfilter: xt_qtaguid: Don't show empty tag stats for unprivileged uids
  f20252d7da ANDROID: netfilter: xt_qtaguid: Fix panic caused by processing non-full socket.
  af798507c0 ANDROID: netfilter: xt_qtaguid: Fix panic caused by synack processing
  ca58d2242f ANDROID: netfilter: xt_qtaguid: fix a race condition in if_tag_stat_update
  5dfb5c0e04 ANDROID: netfilter: xt_qtaguid: xt_socket: build fixes
  06ac276ee6 ANDROID: netfilter: xt_qtaguid: Use sk_callback_lock read locks before reading sk->sk_socket
  9b19736f43 ANDROID: netfilter: xt_qtaguid/xt_socket: Build fixups
  6fc67945ea ANDROID: netfilter: xt_qtaguid: Fix boot panic
  a89db3e49d ANDROID: netfilter: xt_qtaguid: fix bad tcp_time_wait sock handling
  1474b38fe6 ANDROID: netfilter: xt_qtaguid: 3.10 fixes
  bc1e31b839 ANDROID: netfilter: xt_qtaguid: rate limit some of the printks
  11a32dfd17 ANDROID: netfilter: xt_qtaguid: Allow tracking loopback
  2170698b06 ANDROID: netfilter: xt_qtaguid: extend iface stat to report protocols
  5fecf3b1a1 ANDROID: netfilter: xt_qtaguid: remove AID_* dependency for access control
  61a97f2011 ANDROID: netfilter: xt_qtaguid: Don't BUG_ON if create_if_tag_stat fails
  260b664522 ANDROID: netfilter: xt_qtaguid: fix error exit that would keep a spinlock.
  22ecb1cbf8 ANDROID: netfilter: xt_qtaguid: report only uid tags to non-privileged processes
  a2d25419f8 ANDROID: netfilter: xt_qtaguid: start tracking iface rx/tx at low level
  588f1e1dbb ANDROID: netfilter: xt_qtaguid: fix ipv6 protocol lookup
  00f57e8b30 ANDROID: netfilter: xt_qtaguid: add qtaguid matching module

Generated via:
  git log --oneline --no-merges remotes/android/kernel/common/android-4.19-q..HEAD \
  | egrep qtaguid | while read a b; do git revert $a; done
and squashing the result.

Test:
  $ git grep -i qtaguid
  arch/arm/configs/ranchu_defconfig:108:CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
  arch/arm64/configs/ranchu64_defconfig:110:CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
  arch/x86/configs/i386_ranchu_defconfig:142:CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
  arch/x86/configs/x86_64_ranchu_defconfig:140:CONFIG_NETFILTER_XT_MATCH_QTAGUID=y

Bug: 138428914
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ida83e0ba51c5debbc509f99b35d6013be01ddedf
2024-08-19 07:25:59 +00:00
Masahiro Yamada
a2f94eff3a UPSTREAM: kbuild: use CONFIG_CC_VERSION_TEXT to construct LINUX_COMPILER macro
scripts/mkcompile_h runs $(CC) just for getting the version string.
Reuse CONFIG_CC_VERSION_TEXT for optimization.

For GCC, this slightly changes the version string. I do not think it
is a big deal as we do not have the defined format for LINUX_COMPILER.
In fact, the recent commit 4831f7ad6c569 ("kbuild: mkcompile_h:
Include $LD version in /proc/version") added the linker version.

Bug: 168274246

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit 9a950154668729a472d17b8e307d92e7c60f45f7)
Signed-off-by: Mars Lin <marslin@google.com>
Change-Id: I66bac5b44bf764e7c0e432ae17bcdf06d79c96d0
2024-08-19 07:25:59 +00:00
Masahiro Yamada
c3cc53672a UPSTREAM: kbuild: do not pass $(KBUILD_CFLAGS) to scripts/mkcompile_h
scripts/mkcompile_h uses $(CC) only for getting the version string.

I suspected there was a specific reason why the additional flags were
needed, and dug the commit history. This code dates back to at least
2002 [1], but I could not get any more clue.

Just get rid of it.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=29f3df7eba8ddf91a55183f9967f76fbcc3ab742

Bug: 168274246

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
(cherry picked from commit 01a6126b5f7efdf75480a2b970377f5724cb885a)
Signed-off-by: Mars Lin <marslin@google.com>
Change-Id: If887ea1e9e43b9ce83bf8fe9cc0db809818c3bb8
2024-08-19 07:25:59 +00:00
Masahiro Yamada
f629b2faba UPSTREAM: kbuild: ensure full rebuild when the compiler is updated
Commit 21c54b7747 ("kconfig: show compiler version text in the top
comment") added the environment variable, CC_VERSION_TEXT in the comment
of the top Kconfig file. It can detect the compiler update, and invoke
the syncconfig because all environment variables referenced in Kconfig
files are recorded in include/config/auto.conf.cmd

This commit makes it a CONFIG option in order to ensure the full rebuild
when the compiler is updated.

This works like follows:

include/config/kconfig.h contains "CONFIG_CC_VERSION_TEXT" in the comment
block.

The top Makefile specifies "-include $(srctree)/include/linux/kconfig.h"
to guarantee it is included from all kernel source files.

fixdep parses every source file and all headers included from it,
searching for words prefixed with "CONFIG_". Then, fixdep finds
CONFIG_CC_VERSION_TEXT in include/config/kconfig.h and adds
include/config/cc/version/text.h into every .*.cmd file.

When the compiler is updated, syncconfig is invoked because init/Kconfig
contains the reference to the environment variable CC_VERTION_TEXT.
CONFIG_CC_VERSION_TEXT is updated to the new version string, and
include/config/cc/version/text.h is touched.

In the next rebuild, Make will rebuild every files since the timestamp
of include/config/cc/version/text.h is newer than that of target.

Bug: 168274246

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit 8b59cd81dc5e724eaea283fa6006985891c7bff4)
Signed-off-by: Mars Lin <marslin@google.com>
Change-Id: Ie52bb8e33b95d0e97998024d28c0d8d7caf8aa59
2024-08-19 07:25:59 +00:00
Nathan Chancellor
58db0d99d2 tracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro
After r372664 in clang, the IF_ASSIGN macro causes a couple hundred
warnings along the lines of:

kernel/trace/trace_output.c:1331:2: warning: converting the enum
constant to a boolean [-Wint-in-bool-context]
kernel/trace/trace.h:409:3: note: expanded from macro
'trace_assign_type'
                IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry,
                ^
kernel/trace/trace.h:371:14: note: expanded from macro 'IF_ASSIGN'
                WARN_ON(id && (entry)->type != id);     \
                           ^
264 warnings generated.

This warning can catch issues with constructs like:

    if (state == A || B)

where the developer really meant:

    if (state == A || state == B)

This is currently the only occurrence of the warning in the kernel
tree across defconfig, allyesconfig, allmodconfig for arm32, arm64,
and x86_64. Add the implicit '!= 0' to the WARN_ON statement to fix
the warnings and find potential issues in the future.

Link: 28b38c277a
Link: https://github.com/ClangBuiltLinux/linux/issues/686
Link: http://lkml.kernel.org/r/20190926162258.466321-1-natechancellor@gmail.com

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ie386f06316743073363f974e7539d43ff769b91c
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2024-08-19 07:25:59 +00:00
Alexander Winkowski
2bdade3e09 Revert "BACKPORT: kgsl: hwsched: Don't cross dereference kgsl_mem_entry pointer"
This reverts commit d4244a4269.

According to Qualcomm, this platform is not affected [1]. It causes NULL
pointer dereference on older kernels due to the lack of 976b6d97c6.

[1] https://docs.qualcomm.com/product/publicresources/securitybulletin/june-2024-bulletin.html#_cve-2024-21478
Change-Id: Ic50a8c89ec9f0b4f56ac90125be646147bae5f20
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2024-08-19 09:24:32 +03:00
Sheenam Monga
19be8f1d72 BACKPORT: qcacmn: Fix potential OOB read in util_scan_parse_rnr_ie
Currently, while parsing scan RNR Ie data is moved to
next neighbor_ap_info_field after parsing the current
neighbor_ap_info_field. But in last iteration pointer may
try to access invalid data if (uint8_t *)ie + rnr_ie_len + 2)
bytes are less than sizeof neighbor_ap_info_field and same
is the case with tbtt_length access.

Fix is to add a length check of data + next data size to be parsed
< (uint8_t *)ie + rnr_ie_len + 2) instead of adding a validation
of data length only.

CRs-Fixed: 3710080
Change-Id: I05e5a9a02f0f4f9bc468db894588e676f0a248c0
2024-08-16 01:19:18 +03:00
Harshdeep Dhatt
d4244a4269 BACKPORT: kgsl: hwsched: Don't cross dereference kgsl_mem_entry pointer
The passed in pointer in kgsl_count_hw_fences() can be a
kgsl_mem_entry pointer. This gets cross dereferenced to
a kgsl_drawobj_sync_event pointer and causes a NULL pointer
dereference. To avoid this cross dereference, decouple the two
paths and call kgsl_count_hw_fences() only in the appropriate
path.

Change-Id: I1088a0b67f1f82a20ddc94c94cbdd31a44b18da6
Signed-off-by: Harshdeep Dhatt <quic_hdhatt@quicinc.com>
2024-08-16 01:19:06 +03:00
Michael Bestas
5b696ce758 Merge branch 'android-4.19-stable' of https://android.googlesource.com/kernel/common into android13-4.19-kona
* 'android-4.19-stable' of https://android.googlesource.com/kernel/common: (415 commits)
  Linux 4.19.318
  i2c: rcar: bring hardware to known state when probing
  nilfs2: fix kernel bug on rename operation of broken directory
  SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
  tcp: avoid too many retransmit packets
  tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
  net: tcp: fix unexcepted socket die when snd_wnd is 0
  tcp: refactor tcp_retransmit_timer()
  libceph: fix race between delayed_work() and ceph_monc_stop()
  hpet: Support 32-bit userspace
  USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor
  usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
  USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k
  USB: serial: option: add Rolling RW350-GL variants
  USB: serial: option: add Netprisma LCUK54 series modules
  USB: serial: option: add support for Foxconn T99W651
  USB: serial: option: add Fibocom FM350-GL
  USB: serial: option: add Telit FN912 rmnet compositions
  USB: serial: option: add Telit generic core-dump composition
  ARM: davinci: Convert comma to semicolon
  ...

 Conflicts:
	drivers/net/usb/ax88179_178a.c
	drivers/scsi/ufs/ufshcd.c

Change-Id: I63f3c3862218db4d5d13828c76e11f21da54ca42
2024-08-06 00:36:59 +03:00
Greg Kroah-Hartman
82f9317bbb Merge 4.19.318 into android-4.19-stable
Changes in 4.19.318
	asm-generic: Move common compat types to asm-generic/compat.h
	media: dvb: as102-fe: Fix as10x_register_addr packing
	media: dvb-usb: dib0700_devices: Add missing release_firmware()
	IB/core: Implement a limit on UMAD receive List
	drm/amd/display: Skip finding free audio for unknown engine_id
	media: dw2102: Don't translate i2c read into write
	sctp: prefer struct_size over open coded arithmetic
	firmware: dmi: Stop decoding on broken entry
	Input: ff-core - prefer struct_size over open coded arithmetic
	net: dsa: mv88e6xxx: Correct check for empty list
	media: dvb-frontends: tda18271c2dd: Remove casting during div
	media: s2255: Use refcount_t instead of atomic_t for num_channels
	media: dvb-frontends: tda10048: Fix integer overflow
	i2c: i801: Annotate apanel_addr as __ro_after_init
	powerpc/64: Set _IO_BASE to POISON_POINTER_DELTA not 0 for CONFIG_PCI=n
	orangefs: fix out-of-bounds fsid access
	powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#"
	jffs2: Fix potential illegal address access in jffs2_free_inode
	s390/pkey: Wipe sensitive data on failure
	tcp: take care of compressed acks in tcp_add_reno_sack()
	tcp: tcp_mark_head_lost is only valid for sack-tcp
	tcp: add ece_ack flag to reno sack functions
	net: tcp better handling of reordering then loss cases
	UPSTREAM: tcp: fix DSACK undo in fast recovery to call tcp_try_to_open()
	tcp_metrics: validate source addr length
	bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()
	selftests: fix OOM in msg_zerocopy selftest
	selftests: make order checking verbose in msg_zerocopy selftest
	inet_diag: Initialize pad field in struct inet_diag_req_v2
	nilfs2: fix inode number range checks
	nilfs2: add missing check for inode numbers on directory entries
	mm: optimize the redundant loop of mm_update_owner_next()
	Bluetooth: Fix incorrect pointer arithmatic in ext_adv_report_evt
	can: kvaser_usb: Explicitly initialize family in leafimx driver_info struct
	fsnotify: Do not generate events for O_PATH file descriptors
	Revert "mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again"
	drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes
	drm/amdgpu/atomfirmware: silence UBSAN warning
	bnx2x: Fix multiple UBSAN array-index-out-of-bounds
	media: dw2102: fix a potential buffer overflow
	i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr
	nilfs2: fix incorrect inode allocation from reserved inodes
	drm/i915: make find_fw_domain work on intel_uncore
	tcp: fix incorrect undo caused by DSACK of TLP retransmit
	net: lantiq_etop: add blank line after declaration
	net: ethernet: lantiq_etop: fix double free in detach
	ppp: reject claimed-as-LCP but actually malformed packets
	ARM: davinci: Convert comma to semicolon
	USB: serial: option: add Telit generic core-dump composition
	USB: serial: option: add Telit FN912 rmnet compositions
	USB: serial: option: add Fibocom FM350-GL
	USB: serial: option: add support for Foxconn T99W651
	USB: serial: option: add Netprisma LCUK54 series modules
	USB: serial: option: add Rolling RW350-GL variants
	USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k
	usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
	USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor
	hpet: Support 32-bit userspace
	libceph: fix race between delayed_work() and ceph_monc_stop()
	tcp: refactor tcp_retransmit_timer()
	net: tcp: fix unexcepted socket die when snd_wnd is 0
	tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
	tcp: avoid too many retransmit packets
	SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
	nilfs2: fix kernel bug on rename operation of broken directory
	i2c: rcar: bring hardware to known state when probing
	Linux 4.19.318

Change-Id: I6d2646a308c3f44976d00ee372e87568c3e40c23
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-07-19 13:17:59 +00:00
Greg Kroah-Hartman
18b61cc1d0 Linux 4.19.318
Link: https://lore.kernel.org/r/20240716152738.161055634@linuxfoundation.org
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240717063749.349549112@linuxfoundation.org
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Link: https://lore.kernel.org/r/20240717101028.579732070@linuxfoundation.org
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:39 +02:00
Wolfram Sang
a291702b35 i2c: rcar: bring hardware to known state when probing
[ Upstream commit 4e36c0f20cb1c74c7bd7ea31ba432c1c4a989031 ]

When probing, the hardware is not brought into a known state. This may
be a problem when a hypervisor restarts Linux without resetting the
hardware, leaving an old state running. Make sure the hardware gets
initialized, especially interrupts should be cleared and disabled.

Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Closes: https://lore.kernel.org/r/20240702045535.2000393-1-dirk.behme@de.bosch.com
Fixes: 6ccbe60713 ("i2c: add Renesas R-Car I2C driver")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-18 11:39:39 +02:00
Ryusuke Konishi
ff9767ba2c nilfs2: fix kernel bug on rename operation of broken directory
commit a9e1ddc09ca55746079cc479aa3eb6411f0d99d4 upstream.

Syzbot reported that in rename directory operation on broken directory on
nilfs2, __block_write_begin_int() called to prepare block write may fail
BUG_ON check for access exceeding the folio/page size.

This is because nilfs_dotdot(), which gets parent directory reference
entry ("..") of the directory to be moved or renamed, does not check
consistency enough, and may return location exceeding folio/page size for
broken directories.

Fix this issue by checking required directory entries ("." and "..") in
the first chunk of the directory in nilfs_dotdot().

Link: https://lkml.kernel.org/r/20240628165107.9006-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+d3abed1ad3d367fa2627@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d3abed1ad3d367fa2627
Fixes: 2ba466d74e ("nilfs2: directory entry operations")
Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:39 +02:00
felix
17866066b8 SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
commit bfca5fb4e97c46503ddfc582335917b0cc228264 upstream.

RPC client pipefs dentries cleanup is in separated rpc_remove_pipedir()
workqueue,which takes care about pipefs superblock locking.
In some special scenarios, when kernel frees the pipefs sb of the
current client and immediately alloctes a new pipefs sb,
rpc_remove_pipedir function would misjudge the existence of pipefs
sb which is not the one it used to hold. As a result,
the rpc_remove_pipedir would clean the released freed pipefs dentries.

To fix this issue, rpc_remove_pipedir should check whether the
current pipefs sb is consistent with the original pipefs sb.

This error can be catched by KASAN:
=========================================================
[  250.497700] BUG: KASAN: slab-use-after-free in dget_parent+0x195/0x200
[  250.498315] Read of size 4 at addr ffff88800a2ab804 by task kworker/0:18/106503
[  250.500549] Workqueue: events rpc_free_client_work
[  250.501001] Call Trace:
[  250.502880]  kasan_report+0xb6/0xf0
[  250.503209]  ? dget_parent+0x195/0x200
[  250.503561]  dget_parent+0x195/0x200
[  250.503897]  ? __pfx_rpc_clntdir_depopulate+0x10/0x10
[  250.504384]  rpc_rmdir_depopulate+0x1b/0x90
[  250.504781]  rpc_remove_client_dir+0xf5/0x150
[  250.505195]  rpc_free_client_work+0xe4/0x230
[  250.505598]  process_one_work+0x8ee/0x13b0
...
[   22.039056] Allocated by task 244:
[   22.039390]  kasan_save_stack+0x22/0x50
[   22.039758]  kasan_set_track+0x25/0x30
[   22.040109]  __kasan_slab_alloc+0x59/0x70
[   22.040487]  kmem_cache_alloc_lru+0xf0/0x240
[   22.040889]  __d_alloc+0x31/0x8e0
[   22.041207]  d_alloc+0x44/0x1f0
[   22.041514]  __rpc_lookup_create_exclusive+0x11c/0x140
[   22.041987]  rpc_mkdir_populate.constprop.0+0x5f/0x110
[   22.042459]  rpc_create_client_dir+0x34/0x150
[   22.042874]  rpc_setup_pipedir_sb+0x102/0x1c0
[   22.043284]  rpc_client_register+0x136/0x4e0
[   22.043689]  rpc_new_client+0x911/0x1020
[   22.044057]  rpc_create_xprt+0xcb/0x370
[   22.044417]  rpc_create+0x36b/0x6c0
...
[   22.049524] Freed by task 0:
[   22.049803]  kasan_save_stack+0x22/0x50
[   22.050165]  kasan_set_track+0x25/0x30
[   22.050520]  kasan_save_free_info+0x2b/0x50
[   22.050921]  __kasan_slab_free+0x10e/0x1a0
[   22.051306]  kmem_cache_free+0xa5/0x390
[   22.051667]  rcu_core+0x62c/0x1930
[   22.051995]  __do_softirq+0x165/0x52a
[   22.052347]
[   22.052503] Last potentially related work creation:
[   22.052952]  kasan_save_stack+0x22/0x50
[   22.053313]  __kasan_record_aux_stack+0x8e/0xa0
[   22.053739]  __call_rcu_common.constprop.0+0x6b/0x8b0
[   22.054209]  dentry_free+0xb2/0x140
[   22.054540]  __dentry_kill+0x3be/0x540
[   22.054900]  shrink_dentry_list+0x199/0x510
[   22.055293]  shrink_dcache_parent+0x190/0x240
[   22.055703]  do_one_tree+0x11/0x40
[   22.056028]  shrink_dcache_for_umount+0x61/0x140
[   22.056461]  generic_shutdown_super+0x70/0x590
[   22.056879]  kill_anon_super+0x3a/0x60
[   22.057234]  rpc_kill_sb+0x121/0x200

Fixes: 0157d021d2 ("SUNRPC: handle RPC client pipefs dentries by network namespace aware routines")
Signed-off-by: felix <fuzhen5@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:39 +02:00
Eric Dumazet
7bb7670f92 tcp: avoid too many retransmit packets
commit 97a9063518f198ec0adb2ecb89789de342bb8283 upstream.

If a TCP socket is using TCP_USER_TIMEOUT, and the other peer
retracted its window to zero, tcp_retransmit_timer() can
retransmit a packet every two jiffies (2 ms for HZ=1000),
for about 4 minutes after TCP_USER_TIMEOUT has 'expired'.

The fix is to make sure tcp_rtx_probe0_timed_out() takes
icsk->icsk_user_timeout into account.

Before blamed commit, the socket would not timeout after
icsk->icsk_user_timeout, but would use standard exponential
backoff for the retransmits.

Also worth noting that before commit e89688e3e978 ("net: tcp:
fix unexcepted socket die when snd_wnd is 0"), the issue
would last 2 minutes instead of 4.

Fixes: b701a99e43 ("tcp: Add tcp_clamp_rto_to_user_timeout() helper to improve accuracy")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Reviewed-by: Jon Maxwell <jmaxwell37@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20240710001402.2758273-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Eric Dumazet
0fe6516462 tcp: use signed arithmetic in tcp_rtx_probe0_timed_out()
commit 36534d3c54537bf098224a32dc31397793d4594d upstream.

Due to timer wheel implementation, a timer will usually fire
after its schedule.

For instance, for HZ=1000, a timeout between 512ms and 4s
has a granularity of 64ms.
For this range of values, the extra delay could be up to 63ms.

For TCP, this means that tp->rcv_tstamp may be after
inet_csk(sk)->icsk_timeout whenever the timer interrupt
finally triggers, if one packet came during the extra delay.

We need to make sure tcp_rtx_probe0_timed_out() handles this case.

Fixes: e89688e3e978 ("net: tcp: fix unexcepted socket die when snd_wnd is 0")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Menglong Dong <imagedong@tencent.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Link: https://lore.kernel.org/r/20240607125652.1472540-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Menglong Dong
faa0a1fc2a net: tcp: fix unexcepted socket die when snd_wnd is 0
commit e89688e3e97868451a5d05b38a9d2633d6785cd4 upstream.

In tcp_retransmit_timer(), a window shrunk connection will be regarded
as timeout if 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX'. This is not
right all the time.

The retransmits will become zero-window probes in tcp_retransmit_timer()
if the 'snd_wnd==0'. Therefore, the icsk->icsk_rto will come up to
TCP_RTO_MAX sooner or later.

However, the timer can be delayed and be triggered after 122877ms, not
TCP_RTO_MAX, as I tested.

Therefore, 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX' is always true
once the RTO come up to TCP_RTO_MAX, and the socket will die.

Fix this by replacing the 'tcp_jiffies32' with '(u32)icsk->icsk_timeout',
which is exact the timestamp of the timeout.

However, "tp->rcv_tstamp" can restart from idle, then tp->rcv_tstamp
could already be a long time (minutes or hours) in the past even on the
first RTO. So we double check the timeout with the duration of the
retransmission.

Meanwhile, making "2 * TCP_RTO_MAX" as the timeout to avoid the socket
dying too soon.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/netdev/CADxym3YyMiO+zMD4zj03YPM3FBi-1LHi6gSD2XT8pyAMM096pg@mail.gmail.com/
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Eric Dumazet
e5a1f7427f tcp: refactor tcp_retransmit_timer()
commit 0d580fbd2db084a5c96ee9c00492236a279d5e0f upstream.

It appears linux-4.14 stable needs a backport of commit
88f8598d0a30 ("tcp: exit if nothing to retransmit on RTO timeout")

Since tcp_rtx_queue_empty() is not in pre 4.15 kernels,
let's refactor tcp_retransmit_timer() to only use tcp_rtx_queue_head()

I will provide to stable teams the squashed patches.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Ilya Dryomov
1177afeca8 libceph: fix race between delayed_work() and ceph_monc_stop()
commit 69c7b2fe4c9cc1d3b1186d1c5606627ecf0de883 upstream.

The way the delayed work is handled in ceph_monc_stop() is prone to
races with mon_fault() and possibly also finish_hunting().  Both of
these can requeue the delayed work which wouldn't be canceled by any of
the following code in case that happens after cancel_delayed_work_sync()
runs -- __close_session() doesn't mess with the delayed work in order
to avoid interfering with the hunting interval logic.  This part was
missed in commit b5d91704f5 ("libceph: behave in mon_fault() if
cur_mon < 0") and use-after-free can still ensue on monc and objects
that hang off of it, with monc->auth and monc->monmap being
particularly susceptible to quickly being reused.

To fix this:

- clear monc->cur_mon and monc->hunting as part of closing the session
  in ceph_monc_stop()
- bail from delayed_work() if monc->cur_mon is cleared, similar to how
  it's done in mon_fault() and finish_hunting() (based on monc->hunting)
- call cancel_delayed_work_sync() after the session is closed

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/66857
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
He Zhe
e2cb94465d hpet: Support 32-bit userspace
commit 4e60131d0d36af65ab9c9144f4f163fe97ae36e8 upstream.

hpet_compat_ioctl and read file operations failed to handle parameters from
32-bit userspace and thus samples/timers/hpet_example.c fails as below.

root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: HPET_IRQFREQ failed

This patch fixes cmd and arg handling in hpet_compat_ioctl and adds compat
handling for 32-bit userspace in hpet_read.

hpet_example now shows that it works for both 64-bit and 32-bit.

root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: info.hi_flags 0x0
hpet_poll: expired time = 0xf4298
hpet_poll: revents = 0x1
hpet_poll: data 0x1
hpet_poll: expired time = 0xf4235
hpet_poll: revents = 0x1
hpet_poll: data 0x1
root@intel-x86-64:~# ./hpet_example-64.out poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: info.hi_flags 0x0
hpet_poll: expired time = 0xf42a1
hpet_poll: revents = 0x1
hpet_poll: data 0x1
hpet_poll: expired time = 0xf4232
hpet_poll: revents = 0x1
hpet_poll: data 0x1

Cc: stable@vger.kernel.org
Signed-off-by: He Zhe <zhe.he@windriver.com>
Fixes: 54066a57c5 ("hpet: kill BKL, add compat_ioctl")
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240606123908.738733-1-zhe.he@windriver.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Alan Stern
d8418fd083 USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor
commit a368ecde8a5055b627749b09c6218ef793043e47 upstream.

Syzbot has identified a bug in usbcore (see the Closes: tag below)
caused by our assumption that the reserved bits in an endpoint
descriptor's bEndpointAddress field will always be 0.  As a result of
the bug, the endpoint_is_duplicate() routine in config.c (and possibly
other routines as well) may believe that two descriptors are for
distinct endpoints, even though they have the same direction and
endpoint number.  This can lead to confusion, including the bug
identified by syzbot (two descriptors with matching endpoint numbers
and directions, where one was interrupt and the other was bulk).

To fix the bug, we will clear the reserved bits in bEndpointAddress
when we parse the descriptor.  (Note that both the USB-2.0 and USB-3.1
specs say these bits are "Reserved, reset to zero".)  This requires us
to make a copy of the descriptor earlier in usb_parse_endpoint() and
use the copy instead of the original when checking for duplicates.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+8693a0bb9c10b554272a@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-usb/0000000000003d868e061bc0f554@google.com/
Fixes: 0a8fd13462 ("USB: fix problems with duplicate endpoint addresses")
CC: Oliver Neukum <oneukum@suse.com>
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/205a5edc-7fef-4159-b64a-80374b6b101a@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Lee Jones
a444c3fc26 usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
commit 6d3c721e686ea6c59e18289b400cc95c76e927e0 upstream.

Userspace provided string 's' could trivially have the length zero. Left
unchecked this will firstly result in an OOB read in the form
`if (str[0 - 1] == '\n') followed closely by an OOB write in the form
`str[0 - 1] = '\0'`.

There is already a validating check to catch strings that are too long.
Let's supply an additional check for invalid strings that are too short.

Signed-off-by: Lee Jones <lee@kernel.org>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20240705074339.633717-1-lee@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
WangYuli
1d1f3d6029 USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k
commit 3859e85de30815a20bce7db712ce3d94d40a682d upstream.

START BP-850K is a dot matrix printer that crashes when
it receives a Set-Interface request and needs USB_QUIRK_NO_SET_INTF
to work properly.

Cc: stable <stable@kernel.org>
Signed-off-by: jinxiaobo <jinxiaobo@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
Link: https://lore.kernel.org/r/202E4B2BD0F0FEA4+20240702154408.631201-1-wangyuli@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:38 +02:00
Vanillan Wang
5bc1f4bee4 USB: serial: option: add Rolling RW350-GL variants
commit ae420771551bd9f04347c59744dd062332bdec3e upstream.

Update the USB serial option driver support for the Rolling
RW350-GL
- VID:PID 33f8:0802, RW350-GL are laptop M.2 cards (with
MBIM interfaces for /Linux/Chrome OS)

Here are the outputs of usb-devices:

usbmode=63: mbim, pipe

T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
D:  Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
P:  Vendor=33f8 ProdID=0802 Rev=00.01
S:  Manufacturer=Rolling Wireless S.a.r.l.
S:  Product=USB DATA CARD
C:  #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms

usbmode=64: mbim, others at (If#= 5 adb)

MBIM(MI0) + GNSS(MI2) + AP log(MI3) + AP META(MI4) + ADB(MI5) +
MD AT(MI6) + MD META(MI7) + NPT(MI8) + Debug(MI9)

T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
D:  Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
P:  Vendor=33f8 ProdID=0802 Rev=00.01
S:  Manufacturer=Rolling Wireless S.a.r.l.
S:  Product=USB DATA CARD
C:  #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=896mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=07(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=08(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=09(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=8a(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms

Signed-off-by: Vanillan Wang <vanillanwang@163.com>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 11:39:37 +02:00