5.4.230-rc1 review
Greg Kroah-Hartman
maintainercover 5.4.230-rc1 review
This is the start of the stable review cycle for the 5.4.230 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 24 Jan 2023 15:02:08 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.230-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.230-rc1
Michael Ellerman <[email protected]>
powerpc/vmlinux.lds: Don't discard .comment
Michael Ellerman <[email protected]>
powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds
Michael Ellerman <[email protected]>
powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT
Masahiro Yamada <[email protected]>
s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36
Masahiro Yamada <[email protected]>
arch: fix broken BuildID for arm64 and riscv
YingChi Long <[email protected]>
x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN
Joshua Ashton <[email protected]>
drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix
hongao <[email protected]>
drm/amd/display: Fix set scaling doesn's work
Sasa Dragic <[email protected]>
drm/i915: re-disable RC6p on Sandy Bridge
Khazhismel Kumykov <[email protected]>
gsmi: fix null-deref in gsmi_get_variable
Tobias Schramm <[email protected]>
serial: atmel: fix incorrect baudrate setup
Mohan Kumar <[email protected]>
dmaengine: tegra210-adma: fix global intr clear
Ilpo Järvinen <[email protected]>
serial: pch_uart: Pass correct sg to dma_unmap_sg()
Heiner Kallweit <[email protected]>
dt-bindings: phy: g12a-usb3-pcie-phy: fix compatible string documentation
Juhyung Park <[email protected]>
usb-storage: apply IGNORE_UAS only for HIKSEMI MD202 on RTL9210
Maciej Żenczykowski <[email protected]>
usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()
Daniel Scally <[email protected]>
usb: gadget: g_webcam: Send color matching descriptor per frame
Prashant Malani <[email protected]>
usb: typec: altmodes/displayport: Fix pin assignment calculation
Prashant Malani <[email protected]>
usb: typec: altmodes/displayport: Add pin assignment helper
Alexander Stein <[email protected]>
usb: host: ehci-fsl: Fix module alias
Michael Adler <[email protected]>
USB: serial: cp210x: add SCALANCE LPE-9000 device id
Alan Stern <[email protected]>
USB: gadgetfs: Fix race between mounting and unmounting
Enzo Matsumiya <[email protected]>
cifs: do not include page data when checking signature
Filipe Manana <[email protected]>
btrfs: fix race between quota rescan and disable leading to NULL pointer deref
Samuel Holland <[email protected]>
mmc: sunxi-mmc: Fix clock refcount imbalance during unbind
Ian Abbott <[email protected]>
comedi: adv_pci1760: Fix PWM instruction handling
Flavio Suligoi <[email protected]>
usb: core: hub: disable autosuspend for TI TUSB8041
Ola Jeppsson <[email protected]>
misc: fastrpc: Fix use-after-free race condition for maps
Abel Vesa <[email protected]>
misc: fastrpc: Don't remove map on creater_process and device_release
Greg Kroah-Hartman <[email protected]>
USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100
Duke Xin(辛安文) <[email protected]>
USB: serial: option: add Quectel EM05CN modem
Duke Xin(辛安文) <[email protected]>
USB: serial: option: add Quectel EM05CN (SG) modem
Ali Mirghasemi <[email protected]>
USB: serial: option: add Quectel EC200U modem
Duke Xin(辛安文) <[email protected]>
USB: serial: option: add Quectel EM05-G (RS) modem
Duke Xin(辛安文) <[email protected]>
USB: serial: option: add Quectel EM05-G (CS) modem
Duke Xin(辛安文) <[email protected]>
USB: serial: option: add Quectel EM05-G (GR) modem
Greg Kroah-Hartman <[email protected]>
prlimit: do_prlimit needs to have a speculation check
Mathias Nyman <[email protected]>
xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables
Mathias Nyman <[email protected]>
usb: acpi: add helper to check port lpm capability using acpi _DSM
Mathias Nyman <[email protected]>
xhci: Add a flag to disable USB3 lpm on a xhci root port level.
Mathias Nyman <[email protected]>
xhci: Add update_hub_device override for PCI xHCI hosts
Mathias Nyman <[email protected]>
xhci: Fix null pointer dereference when host dies
Jimmy Hu <[email protected]>
usb: xhci: Check endpoint is valid before dereferencing it
Ricardo Ribalda <[email protected]>
xhci-pci: set the dma max_seg_size
Yuchi Yang <[email protected]>
ALSA: hda/realtek - Turn on power early
Chris Wilson <[email protected]>
drm/i915/gt: Reset twice
Ding Hui <[email protected]>
efi: fix userspace infinite retry read efivars after EFI runtime services page fault
Ryusuke Konishi <[email protected]>
nilfs2: fix general protection fault in nilfs_btree_insert()
Shawn.Shao <[email protected]>
Add exception protection processing for vd in axi_chan_handle_err function
Arend van Spriel <[email protected]>
wifi: brcmfmac: fix regression for Broadcom PCIe wifi devices
Jaegeuk Kim <[email protected]>
f2fs: let's avoid panic if extent_tree is not created
Jiri Slaby (SUSE) <[email protected]>
RDMA/srp: Move large values to a new enum for gcc13
Daniil Tatianin <[email protected]>
net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats
Hao Sun <[email protected]>
selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID
Olga Kornievskaia <[email protected]>
pNFS/filelayout: Fix coalescing test for single DS
-------------
Diffstat:
...ie-phy.yaml => amlogic,g12a-usb3-pcie-phy.yaml} | 6 +- Makefile | 4 +- arch/powerpc/kernel/vmlinux.lds.S | 6 +- arch/s390/kernel/vmlinux.lds.S | 2 + arch/x86/kernel/fpu/init.c | 7 +-- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++ drivers/dma/tegra210-adma.c | 2 +- drivers/firmware/efi/runtime-wrappers.c | 1 + drivers/firmware/google/gsmi.c | 7 ++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +- .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 +- drivers/gpu/drm/i915/gt/intel_reset.c | 34 +++++++++-- drivers/gpu/drm/i915/i915_pci.c | 3 +- drivers/infiniband/ulp/srp/ib_srp.h | 8 ++- drivers/misc/fastrpc.c | 26 +++++---- drivers/mmc/host/sunxi-mmc.c | 8 ++- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +- drivers/staging/comedi/drivers/adv_pci1760.c | 2 +- drivers/tty/serial/atmel_serial.c | 8 +-- drivers/tty/serial/pch_uart.c | 2 +- drivers/usb/core/hub.c | 13 +++++ drivers/usb/core/usb-acpi.c | 65 ++++++++++++++++++++++ drivers/usb/gadget/function/f_ncm.c | 4 +- drivers/usb/gadget/legacy/inode.c | 28 +++++++--- drivers/usb/gadget/legacy/webcam.c | 3 + drivers/usb/host/ehci-fsl.c | 2 +- drivers/usb/host/xhci-pci.c | 45 +++++++++++++++ drivers/usb/host/xhci-ring.c | 5 +- drivers/usb/host/xhci.c | 18 +++++- drivers/usb/host/xhci.h | 5 ++ drivers/usb/misc/iowarrior.c | 2 +- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/option.c | 17 ++++++ drivers/usb/storage/uas-detect.h | 13 +++++ drivers/usb/storage/unusual_uas.h | 7 --- drivers/usb/typec/altmodes/displayport.c | 22 +++++--- fs/btrfs/qgroup.c | 25 ++++++--- fs/cifs/smb2pdu.c | 15 +++-- fs/f2fs/extent_cache.c | 3 +- fs/nfs/filelayout/filelayout.c | 8 +++ fs/nilfs2/btree.c | 15 ++++- include/asm-generic/vmlinux.lds.h | 5 ++ include/linux/usb.h | 3 + kernel/sys.c | 2 + net/core/ethtool.c | 3 +- sound/pci/hda/patch_realtek.c | 30 +++++----- .../selftests/bpf/prog_tests/jeq_infer_not_null.c | 9 +++ .../selftests/bpf/progs/jeq_infer_not_null_fail.c | 42 ++++++++++++++ 48 files changed, 438 insertions(+), 114 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/55 pNFS/filelayout: Fix coalescing test for single DS
From: Olga Kornievskaia <[email protected]>
[ Upstream commit a6b9d2fa0024e7e399c26facd0fb466b7396e2b9 ]
When there is a single DS no striping constraints need to be placed on the IO. When such constraint is applied then buffered reads don't coalesce to the DS's rsize.
--- fs/nfs/filelayout/filelayout.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/nfs/filelayout/filelayout.c +8 -0
@@ -837,6 +837,12 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,return &fl->generic_hdr; } +static bool +filelayout_lseg_is_striped (const struct nfs4_filelayout_segment *flseg) +{ +return flseg->num_fh >1 ; +} +/* * filelayout_pg_test(). Called by nfs_can_coalesce_requests() *
@@ -857,6 +863,8 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, size =pnfs_generic_pg_test (pgio, prev, req);if (!size)return 0 ; +else if (!filelayout_lseg_is_striped (FILELAYOUT_LSEG (pgio->pg_lseg))) +return size;/* see if req and prev are in the same stripe */ if (prev) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 2/55 selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID
In reply to Greg Kroah-HartmanFrom: Hao Sun <[email protected]>
[ Upstream commit cedebd74cf3883f0384af9ec26b4e6f8f1964dd4 ]
Verify that nullness information is not porpagated in the branches of register to register JEQ and JNE operations if one of them is PTR_TO_BTF_ID. Implement this in C level so we can use CO-RE.
--- .../bpf/prog_tests/jeq_infer_not_null.c | 9 ++++ .../bpf/progs/jeq_infer_not_null_fail.c | 42 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c create mode 100644 tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c
tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <test_progs.h> +#include "jeq_infer_not_null_fail.skel.h" + +void test_jeq_infer_not_null (void ) +{ +RUN_TESTS (jeq_infer_not_null_fail); +}
tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 3/55 net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats
In reply to Greg Kroah-HartmanFrom: Daniil Tatianin <[email protected]>
[ Upstream commit 9deb1e9fb88b1120a908676fa33bdf9e2eeaefce ]
It's not very useful to copy back an empty ethtool_stats struct and return 0 if we didn't actually have any stats. This also allows for further simplification of this function in the future commits.
--- net/core/ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/ethtool.c +2 -1
@@ -1947,7 +1947,8 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)return n_stats;if (n_stats >S32_MAX /sizeof (u64))return -ENOMEM ; -WARN_ON_ONCE (!n_stats); +if (WARN_ON_ONCE (!n_stats)) +return -EOPNOTSUPP ;if (copy_from_user (&stats, useraddr,sizeof (stats)))return -EFAULT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 4/55 RDMA/srp: Move large values to a new enum for gcc13
In reply to Greg Kroah-HartmanFrom: Jiri Slaby (SUSE) <[email protected]>
[ Upstream commit 56c5dab20a6391604df9521f812c01d1e3fe1bd0 ]
Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided these two:
SRP_TAG_NO_REQ = ~0U,
SRP_TAG_TSK_MGMT = 1U << 31
all other members are unsigned ints.
Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(), this results in the following warnings:
include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min'
include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min'
So move the large values away to a separate enum, so that they don't affect other members.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
--- drivers/infiniband/ulp/srp/ib_srp.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.h +5 -3
@@ -63,9 +63,6 @@ enum {SRP_DEFAULT_CMD_SQ_SIZE =SRP_DEFAULT_QUEUE_SIZE -SRP_RSP_SQ_SIZE -SRP_TSK_MGMT_SQ_SIZE , -SRP_TAG_NO_REQ = ~0U , -SRP_TAG_TSK_MGMT =1U <<31 , -SRP_MAX_PAGES_PER_MR =512 , SRP_MAX_ADD_CDB_LEN = 16,
@@ -80,6 +77,11 @@ enum { sizeof(struct srp_imm_buf), }; +enum { +SRP_TAG_NO_REQ = ~0U , +SRP_TAG_TSK_MGMT =BIT (31 ), +}; +enum srp_target_state {SRP_TARGET_SCANNING ,SRP_TARGET_LIVE ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 5/55 f2fs: lets avoid panic if extent_tree is not created
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit df9d44b645b83fffccfb4e28c1f93376585fdec8 ]
This patch avoids the below panic.
pc : __lookup_extent_tree+0xd8/0x760 lr : f2fs_do_write_data_page+0x104/0x87c
sp : ffffffc010cbb3c0
x29: ffffffc010cbb3e0 x28: 0000000000000000
x27: ffffff8803e7f020 x26: ffffff8803e7ed40
x25: ffffff8803e7f020 x24: ffffffc010cbb460
x23: ffffffc010cbb480 x22: 0000000000000000
x21: 0000000000000000 x20: ffffffff22e90900
x19: 0000000000000000 x18: ffffffc010c5d080
x17: 0000000000000000 x16: 0000000000000020
x15: ffffffdb1acdbb88 x14: ffffff888759e2b0
x13: 0000000000000000 x12: ffffff802da49000
x11: 000000000a001200 x10: ffffff8803e7ed40 x9 : ffffff8023195800 x8 : ffffff802da49078 x7 : 0000000000000001 x6 : 0000000000000000 x5 : 0000000000000006 x4 : ffffffc010cbba28 x3 : 0000000000000000 x2 : ffffffc010cbb480 x1 : 0000000000000000 x0 : ffffff8803e7ed40
Call trace: __lookup_extent_tree+0xd8/0x760 f2fs_do_write_data_page+0x104/0x87c f2fs_write_single_data_page+0x420/0xb60 f2fs_write_cache_pages+0x418/0xb1c __f2fs_write_data_pages+0x428/0x58c f2fs_write_data_pages+0x30/0x40 do_writepages+0x88/0x190 __writeback_single_inode+0x48/0x448 writeback_sb_inodes+0x468/0x9e8 __writeback_inodes_wb+0xb8/0x2a4 wb_writeback+0x33c/0x740 wb_do_writeback+0x2b4/0x400 wb_workfn+0xe4/0x34c process_one_work+0x24c/0x5bc worker_thread+0x3e8/0xa50 kthread+0x150/0x1b4
--- fs/f2fs/extent_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/extent_cache.c +2 -1
@@ -381,7 +381,8 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,struct extent_node *en;bool ret = false; -f2fs_bug_on (sbi, !et); +if (!et) +return false;trace_f2fs_lookup_extent_tree_start (inode, pgofs);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/55 wifi: brcmfmac: fix regression for Broadcom PCIe wifi devices
In reply to Greg Kroah-HartmanFrom: Arend van Spriel <[email protected]>
commit ed05cb177ae5cd7f02f1d6e7706ba627d30f1696 upstream.
A sanity check was introduced considering maximum flowrings above 256 as insane and effectively aborting the device probe. This resulted in regression for number of users as the value turns out to be sane after all.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1 -1
@@ -1109,7 +1109,7 @@ static int brcmf_pcie_init_ringbuffers(sBRCMF_NROF_H2D_COMMON_MSGRINGS ; max_completionrings =BRCMF_NROF_D2H_COMMON_MSGRINGS ; } -if (max_flowrings >256 ) { +if (max_flowrings >512 ) {brcmf_err (bus,"invalid max_flowrings(%d)\n" , max_flowrings);return -EIO ; }
Greg Kroah-Hartman
maintainerPATCH 7/55 Add exception protection processing for vd in axi_chan_handle_err function
In reply to Greg Kroah-HartmanFrom: Shawn.Shao <[email protected]>
commit 57054fe516d59d03a7bcf1888e82479ccc244f87 upstream.
Since there is no protection for vd, a kernel panic will be triggered here in exceptional cases.
You can refer to the processing of axi_chan_block_xfer_complete function
The triggered kernel panic is as follows:
[ 67.848444] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060 [ 67.848447] Mem abort info: [ 67.848449] ESR = 0x96000004 [ 67.848451] EC = 0x25: DABT (current EL), IL = 32 bits [ 67.848454] SET = 0, FnV = 0 [ 67.848456] EA = 0, S1PTW = 0 [ 67.848458] Data abort info: [ 67.848460] ISV = 0, ISS = 0x00000004 [ 67.848462] CM = 0, WnR = 0 [ 67.848465] user pgtable: 4k pages, 48-bit VAs, pgdp=00000800c4c0b000 [ 67.848468] [0000000000000060] pgd=0000000000000000, p4d=0000000000000000 [ 67.848472] Internal error: Oops: 96000004 [#1] SMP [ 67.848475] Modules linked in: dmatest [ 67.848479] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.100-emu_x2rc+ #11 [ 67.848483] pstate: 62000085 (nZCv daIf -PAN -UAO +TCO BTYPE=--) [ 67.848487] pc : axi_chan_handle_err+0xc4/0x230 [ 67.848491] lr : axi_chan_handle_err+0x30/0x230 [ 67.848493] sp : ffff0803fe55ae50 [ 67.848495] x29: ffff0803fe55ae50 x28: ffff800011212200 [ 67.848500] x27: ffff0800c42c0080 x26: ffff0800c097c080 [ 67.848504] x25: ffff800010d33880 x24: ffff80001139d850 [ 67.848508] x23: ffff0800c097c168 x22: 0000000000000000 [ 67.848512] x21: 0000000000000080 x20: 0000000000002000 [ 67.848517] x19: ffff0800c097c080 x18: 0000000000000000 [ 67.848521] x17: 0000000000000000 x16: 0000000000000000 [ 67.848525] x15: 0000000000000000 x14: 0000000000000000 [ 67.848529] x13: 0000000000000000 x12: 0000000000000040 [ 67.848533] x11: ffff0800c0400248 x10: ffff0800c040024a [ 67.848538] x9 : ffff800010576cd4 x8 : ffff0800c0400270 [ 67.848542] x7 : 0000000000000000 x6 : ffff0800c04003e0 [ 67.848546] x5 : ffff0800c0400248 x4 : ffff0800c4294480 [ 67.848550] x3 : dead000000000100 x2 : dead000000000122 [ 67.848555] x1 : 0000000000000100 x0 : ffff0800c097c168 [ 67.848559] Call trace: [ 67.848562] axi_chan_handle_err+0xc4/0x230 [ 67.848566] dw_axi_dma_interrupt+0xf4/0x590 [ 67.848569] __handle_irq_event_percpu+0x60/0x220 [ 67.848573] handle_irq_event+0x64/0x120 [ 67.848576] handle_fasteoi_irq+0xc4/0x220 [ 67.848580] __handle_domain_irq+0x80/0xe0 [ 67.848583] gic_handle_irq+0xc0/0x138 [ 67.848585] el1_irq+0xc8/0x180 [ 67.848588] arch_cpu_idle+0x14/0x2c [ 67.848591] default_idle_call+0x40/0x16c [ 67.848594] do_idle+0x1f0/0x250 [ 67.848597] cpu_startup_entry+0x2c/0x60 [ 67.848600] rest_init+0xc0/0xcc [ 67.848603] arch_call_rest_init+0x14/0x1c [ 67.848606] start_kernel+0x4cc/0x500 [ 67.848610] Code: eb0002ff 9a9f12d6 f2fbd5a2 f2fbd5a3 (a94602c1) [ 67.848613] ---[ end trace 585a97036f88203a ]---
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +6 -0
@@ -551,6 +551,11 @@ static noinline void axi_chan_handle_err/* The bad descriptor currently is in the head of vc list */ vd =vchan_next_desc (&chan->vc); +if (!vd) { +dev_err (chan2dev (chan),"BUG: %s, IRQ with no descriptors\n" , +axi_chan_name (chan)); + goto out; + }/* Remove the completed descriptor from issued list */ list_del (&vd->node);
@@ -565,6 +570,7 @@ static noinline void axi_chan_handle_err/* Try to restart the controller */ axi_chan_start_first_queued (chan); +out:spin_unlock_irqrestore (&chan->vc.lock, flags); }
Greg Kroah-Hartman
maintainerPATCH 8/55 nilfs2: fix general protection fault in nilfs_btree_insert()
In reply to Greg Kroah-HartmanFrom: Ryusuke Konishi <[email protected]>
commit 7633355e5c7f29c049a9048e461427d1d8ed3051 upstream.
If nilfs2 reads a corrupted disk image and tries to reads a b-tree node block by calling __nilfs_btree_get_block() against an invalid virtual block address, it returns -ENOENT because conversion of the virtual block address to a disk block address fails. However, this return value is the same as the internal code that b-tree lookup routines return to indicate that the block being searched does not exist, so functions that operate on that b-tree may misbehave.
When nilfs_btree_insert() receives this spurious 'not found' code from nilfs_btree_do_lookup(), it misunderstands that the 'not found' check was successful and continues the insert operation using incomplete lookup path data, causing the following crash:
general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f] ... RIP: 0010:nilfs_btree_get_nonroot_node fs/nilfs2/btree.c:418 [inline] RIP: 0010:nilfs_btree_prepare_insert fs/nilfs2/btree.c:1077 [inline] RIP: 0010:nilfs_btree_insert+0x6d3/0x1c10 fs/nilfs2/btree.c:1238 Code: bc 24 80 00 00 00 4c 89 f8 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 ff e8 4b 02 92 fe 4d 8b 3f 49 83 c7 28 4c 89 f8 48 c1 e8 03 <42> 80 3c 28 00 74 08 4c 89 ff e8 2e 02 92 fe 4d 8b 3f 49 83 c7 02 ... Call Trace: <TASK> nilfs_bmap_do_insert fs/nilfs2/bmap.c:121 [inline] nilfs_bmap_insert+0x20d/0x360 fs/nilfs2/bmap.c:147 nilfs_get_block+0x414/0x8d0 fs/nilfs2/inode.c:101 __block_write_begin_int+0x54c/0x1a80 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0x93/0x1e0 fs/buffer.c:2102 nilfs_write_begin+0x9c/0x110 fs/nilfs2/inode.c:261 generic_perform_write+0x2e4/0x5e0 mm/filemap.c:3772 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3900 generic_file_write_iter+0xab/0x310 mm/filemap.c:3932 call_write_iter include/linux/fs.h:2186 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7dc/0xc50 fs/read_write.c:584 ksys_write+0x177/0x2a0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd ... </TASK>
This patch fixes the root cause of this problem by replacing the error code that __nilfs_btree_get_block() returns on block address conversion failure from -ENOENT to another internal code -EINVAL which means that the b-tree metadata is corrupted.
By returning -EINVAL, it propagates without glitches, and for all relevant b-tree operations, functions in the upper bmap layer output an error message indicating corrupted b-tree metadata via nilfs_bmap_convert_error(), and code -EIO will be eventually returned as it should be.
--- fs/nilfs2/btree.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
fs/nilfs2/btree.c +12 -3
@@ -480,9 +480,18 @@ static int __nilfs_btree_get_block(const ret =nilfs_btnode_submit_block (btnc, ptr,0 ,REQ_OP_READ ,0 , &bh, &submit_ptr);if (ret) { -if (ret != -EEXIST ) -return ret; - goto out_check; +if (likely (ret == -EEXIST )) + goto out_check; +if (ret == -ENOENT ) { +/* +* Block address translation failed due to invalid +* value of 'ptr'. In this case, return internal code +* -EINVAL (broken bmap) to notify bmap layer of fatal +* metadata corruption. +*/ + ret = -EINVAL ; + } +return ret; }if (ra) {
Greg Kroah-Hartman
maintainerPATCH 9/55 efi: fix userspace infinite retry read efivars after EFI runtime services page fault
In reply to Greg Kroah-HartmanFrom: Ding Hui <[email protected]>
[ Upstream commit e006ac3003080177cf0b673441a4241f77aaecce ]
After [1][2], if we catch exceptions due to EFI runtime service, we will clear EFI_RUNTIME_SERVICES bit to disable EFI runtime service, then the subsequent routine which invoke the EFI runtime service should fail.
But the userspace cat efivars through /sys/firmware/efi/efivars/ will stuck and infinite loop calling read() due to efivarfs_file_read() return -EINTR.
The -EINTR is converted from EFI_ABORTED by efi_status_to_err(), and is an improper return value in this situation, so let virt_efi_xxx() return EFI_DEVICE_ERROR and converted to -EIO to invoker.
--- drivers/firmware/efi/runtime-wrappers.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/runtime-wrappers.c +1 -0
@@ -62,6 +62,7 @@ struct efi_runtime_work efi_rts_work; \if (!efi_enabled (EFI_RUNTIME_SERVICES )) { \pr_warn_once ("EFI Runtime Services are disabled!\n" ); \ + efi_rts_work.status =EFI_DEVICE_ERROR ; \ goto exit; \ } \ \
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 10/55 drm/i915/gt: Reset twice
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
[ Upstream commit d3de5616d36462a646f5b360ba82d3b09ff668eb ]
After applying an engine reset, on some platforms like Jasperlake, we occasionally detect that the engine state is not cleared until shortly after the resume. As we try to resume the engine with volatile internal state, the first request fails with a spurious CS event (it looks like it reports a lite-restore to the hung context, instead of the expected idle->active context switch).
--- drivers/gpu/drm/i915/gt/intel_reset.c | 34 ++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/intel_reset.c +28 -6
@@ -257,6 +257,7 @@ static int ironlake_do_reset(struct intel_gt *gt,static int gen6_hw_domain_reset (struct intel_gt *gt,u32 hw_domain_mask) {struct intel_uncore *uncore = gt->uncore; +int loops =2 ;int err;/*
@@ -264,17 +265,38 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u32 hw_domain_mask)* for fifo space for the write or forcewake the chip for * the read */ -intel_uncore_write_fw (uncore,GEN6_GDRST , hw_domain_mask); +do { +intel_uncore_write_fw (uncore,GEN6_GDRST , hw_domain_mask); -/* Wait for the device to ack the reset requests */ - err =__intel_wait_for_register_fw (uncore, -GEN6_GDRST , hw_domain_mask,0 , -500 ,0 , -NULL ); +/* +* Wait for the device to ack the reset requests. +* +* On some platforms, e.g. Jasperlake, we see that the +* engine register state is not cleared until shortly after +* GDRST reports completion, causing a failure as we try +* to immediately resume while the internal state is still +* in flux. If we immediately repeat the reset, the second +* reset appears to serialise with the first, and since +* it is a no-op, the registers should retain their reset +* value. However, there is still a concern that upon +* leaving the second reset, the internal engine state +* is still in flux and not ready for resuming. +*/ + err =__intel_wait_for_register_fw (uncore,GEN6_GDRST , + hw_domain_mask,0 , +2000 ,0 , +NULL ); + }while (err ==0 && --loops);if (err)DRM_DEBUG_DRIVER ("Wait for 0x%08x engines reset failed\n" , hw_domain_mask); +/* +* As we have observed that the engine state is still volatile +* after GDRST is acked, impose a small delay to let everything settle. +*/ +udelay (50 ); +return err; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 11/55 ALSA: hda/realtek - Turn on power early
In reply to Greg Kroah-HartmanFrom: Yuchi Yang <[email protected]>
[ Upstream commit 1f680609bf1beac20e2a31ddcb1b88874123c39f ]
Turn on power early to avoid wrong state for power relation register. This can earlier update JD state when resume back.
--- sound/pci/hda/patch_realtek.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
sound/pci/hda/patch_realtek.c +16 -14
@@ -3503,6 +3503,15 @@ static void alc256_init(struct hda_codec *codec)hda_nid_t hp_pin =alc_get_hp_pin (spec);bool hp_pin_sense; +if (spec->ultra_low_power) { +alc_update_coef_idx (codec,0x03 ,1 <<1 ,1 <<1 ); +alc_update_coef_idx (codec,0x08 ,3 <<2 ,3 <<2 ); +alc_update_coef_idx (codec,0x08 ,7 <<4 ,0 ); +alc_update_coef_idx (codec,0x3b ,1 <<15 ,0 ); +alc_update_coef_idx (codec,0x0e ,7 <<6 ,7 <<6 ); +msleep (30 ); + } +if (!hp_pin) hp_pin =0x21 ;
@@ -3514,14 +3523,6 @@ static void alc256_init(struct hda_codec *codec)msleep (2 );alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ -if (spec->ultra_low_power) { -alc_update_coef_idx (codec,0x03 ,1 <<1 ,1 <<1 ); -alc_update_coef_idx (codec,0x08 ,3 <<2 ,3 <<2 ); -alc_update_coef_idx (codec,0x08 ,7 <<4 ,0 ); -alc_update_coef_idx (codec,0x3b ,1 <<15 ,0 ); -alc_update_coef_idx (codec,0x0e ,7 <<6 ,7 <<6 ); -msleep (30 ); - }snd_hda_codec_write (codec, hp_pin,0 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE );
@@ -3603,6 +3604,13 @@ static void alc225_init(struct hda_codec *codec)hda_nid_t hp_pin =alc_get_hp_pin (spec);bool hp1_pin_sense, hp2_pin_sense; +if (spec->ultra_low_power) { +alc_update_coef_idx (codec,0x08 ,0x0f <<2 ,3 <<2 ); +alc_update_coef_idx (codec,0x0e ,7 <<6 ,7 <<6 ); +alc_update_coef_idx (codec,0x33 ,1 <<11 ,0 ); +msleep (30 ); + } +if (!hp_pin) hp_pin =0x21 ;msleep (30 );
@@ -3614,12 +3622,6 @@ static void alc225_init(struct hda_codec *codec)msleep (2 );alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ -if (spec->ultra_low_power) { -alc_update_coef_idx (codec,0x08 ,0x0f <<2 ,3 <<2 ); -alc_update_coef_idx (codec,0x0e ,7 <<6 ,7 <<6 ); -alc_update_coef_idx (codec,0x33 ,1 <<11 ,0 ); -msleep (30 ); - }if (hp1_pin_sense || spec->ultra_low_power) snd_hda_codec_write(codec, hp_pin, 0,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 12/55 xhci-pci: set the dma max_seg_size
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
commit 93915a4170e9defd56a767a18e6c4076f3d18609 upstream.
Allow devices to have dma operations beyond 64K, and avoid warnings such as:
xhci_hcd 0000:00:14.0: mapping sg segment longer than device claims to support [len=98304] [max=65536]
--- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-pci.c +2 -0
@@ -427,6 +427,8 @@ static int xhci_pci_probe(struct pci_devif (xhci->quirks &XHCI_DEFAULT_PM_RUNTIME_ALLOW )pm_runtime_allow (&dev->dev); +dma_set_max_seg_size (&dev->dev,UINT_MAX ); +return 0 ; put_usb3_hcd:
Greg Kroah-Hartman
maintainerPATCH 13/55 usb: xhci: Check endpoint is valid before dereferencing it
In reply to Greg Kroah-HartmanFrom: Jimmy Hu <[email protected]>
commit e8fb5bc76eb86437ab87002d4a36d6da02165654 upstream.
When the host controller is not responding, all URBs queued to all endpoints need to be killed. This can cause a kernel panic if we dereference an invalid endpoint.
Fix this by using xhci_get_virt_ep() helper to find the endpoint and checking if the endpoint is valid before dereferencing it.
[233311.853271] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead [233311.853393] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000e8
[233311.853964] pc : xhci_hc_died+0x10c/0x270 [233311.853971] lr : xhci_hc_died+0x1ac/0x270
[233311.854077] Call trace: [233311.854085] xhci_hc_died+0x10c/0x270 [233311.854093] xhci_stop_endpoint_command_watchdog+0x100/0x1a4 [233311.854105] call_timer_fn+0x50/0x2d4 [233311.854112] expire_timers+0xac/0x2e4 [233311.854118] run_timer_softirq+0x300/0xabc [233311.854127] __do_softirq+0x148/0x528 [233311.854135] irq_exit+0x194/0x1a8 [233311.854143] __handle_domain_irq+0x164/0x1d0 [233311.854149] gic_handle_irq.22273+0x10c/0x188 [233311.854156] el1_irq+0xfc/0x1a8 [233311.854175] lpm_cpuidle_enter+0x25c/0x418 [msm_pm] [233311.854185] cpuidle_enter_state+0x1f0/0x764 [233311.854194] do_idle+0x594/0x6ac [233311.854201] cpu_startup_entry+0x7c/0x80 [233311.854209] secondary_start_kernel+0x170/0x198
Message-ID: <[email protected]>
--- drivers/usb/host/xhci-ring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +4 -1
@@ -921,7 +921,10 @@ static void xhci_kill_endpoint_urbs(strustruct xhci_virt_ep *ep;struct xhci_ring *ring; - ep = &xhci->devs[slot_id]->eps[ep_index]; + ep =xhci_get_virt_ep (xhci, slot_id, ep_index); +if (!ep) +return ; +if ((ep->ep_state &EP_HAS_STREAMS ) || (ep->ep_state &EP_GETTING_NO_STREAMS )) {int stream_id;
Greg Kroah-Hartman
maintainerPATCH 14/55 xhci: Fix null pointer dereference when host dies
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit a2bc47c43e70cf904b1af49f76d572326c08bca7 upstream.
Make sure xhci_free_dev() and xhci_kill_endpoint_urbs() do not race and cause null pointer dereference when host suddenly dies.
Usb core may call xhci_free_dev() which frees the xhci->devs[slot_id] virt device at the same time that xhci_kill_endpoint_urbs() tries to loop through all the device's endpoints, checking if there are any cancelled urbs left to give back.
hold the xhci spinlock while freeing the virt device
--- drivers/usb/host/xhci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci.c +5 -0
@@ -3909,6 +3909,7 @@ static void xhci_free_dev(struct usb_hcdstruct xhci_hcd *xhci =hcd_to_xhci (hcd);struct xhci_virt_device *virt_dev;struct xhci_slot_ctx *slot_ctx; +unsigned long flags;int i, ret;/*
@@ -3937,7 +3938,11 @@ static void xhci_free_dev(struct usb_hcd } virt_dev->udev =NULL ;xhci_disable_slot (xhci, udev->slot_id); + +spin_lock_irqsave (&xhci->lock, flags);xhci_free_virt_device (xhci, udev->slot_id); +spin_unlock_irqrestore (&xhci->lock, flags); + }int xhci_disable_slot (struct xhci_hcd *xhci,u32 slot_id)
Greg Kroah-Hartman
maintainerPATCH 15/55 xhci: Add update_hub_device override for PCI xHCI hosts
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit 23a3b8d5a2365653fd9bc5a9454d1e7f4facbf85 upstream.
Allow PCI hosts to check and tune roothub and port settings before the hub is up and running.
This override is needed to turn off U1 and U2 LPM for some ports based on per port ACPI _DSM, _UPC, or possibly vendor specific mmio values for Intel xHC hosts.
Usb core calls the host update_hub_device once it creates a hub.
Entering U1 or U2 link power save state on ports with this limitation will cause link to fail, turning the usb device unusable in that setup.
--- drivers/usb/host/xhci-pci.c | 9 +++++++++ drivers/usb/host/xhci.c | 5 ++++- drivers/usb/host/xhci.h | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +9 -0
@@ -79,9 +79,12 @@ static const char hcd_name[] = "xhci_hcdstatic struct hc_driver __read_mostly xhci_pci_hc_driver;static int xhci_pci_setup (struct usb_hcd *hcd); +static int xhci_pci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev, +struct usb_tt *tt,gfp_t mem_flags);static const struct xhci_driver_overrides xhci_pci_overrides__initconst = { .reset = xhci_pci_setup, + .update_hub_device = xhci_pci_update_hub_device, };/* called after powerup, by probe or system-pm "wakeup" */
@@ -370,6 +373,12 @@ static int xhci_pci_setup(struct usb_hcdreturn xhci_pci_reinit (xhci, pdev); } +static int xhci_pci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev, +struct usb_tt *tt,gfp_t mem_flags) +{ +return xhci_update_hub_device (hcd, hdev, tt, mem_flags); +} +/* * We need to register our own PCI probe function (instead of the USB core's * function) in order to create a second roothub under xHCI.
drivers/usb/host/xhci.c +4 -1
@@ -5071,7 +5071,7 @@ static int xhci_disable_usb3_lpm_timeout/* Once a hub descriptor is fetched for a device, we need to update the xHC's * internal data structures for the device. */ -static int xhci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev, +int xhci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev,struct usb_tt *tt,gfp_t mem_flags) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -5171,6 +5171,7 @@ static int xhci_update_hub_device(structxhci_free_command (xhci, config_cmd);return ret; } +EXPORT_SYMBOL_GPL (xhci_update_hub_device);static int xhci_get_frame (struct usb_hcd *hcd) {
@@ -5440,6 +5441,8 @@ void xhci_init_driver(struct hc_driver * drv->check_bandwidth = over->check_bandwidth;if (over->reset_bandwidth) drv->reset_bandwidth = over->reset_bandwidth; +if (over->update_hub_device) + drv->update_hub_device = over->update_hub_device; } }EXPORT_SYMBOL_GPL (xhci_init_driver);
drivers/usb/host/xhci.h +4 -0
@@ -1922,6 +1922,8 @@ struct xhci_driver_overrides {int (*start)(struct usb_hcd *hcd);int (*check_bandwidth)(struct usb_hcd *,struct usb_device *);void (*reset_bandwidth)(struct usb_hcd *,struct usb_device *); +int (*update_hub_device)(struct usb_hcd *hcd,struct usb_device *hdev, +struct usb_tt *tt,gfp_t mem_flags); };#define XHCI_CFC_DELAY 10
@@ -2076,6 +2078,8 @@ void xhci_init_driver(struct hc_driver * const struct xhci_driver_overrides *over);int xhci_check_bandwidth (struct usb_hcd *hcd,struct usb_device *udev);void xhci_reset_bandwidth (struct usb_hcd *hcd,struct usb_device *udev); +int xhci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev, +struct usb_tt *tt,gfp_t mem_flags);int xhci_disable_slot (struct xhci_hcd *xhci,u32 slot_id);int xhci_ext_cap_init (struct xhci_hcd *xhci);
Greg Kroah-Hartman
maintainerPATCH 16/55 xhci: Add a flag to disable USB3 lpm on a xhci root port level.
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit 0522b9a1653048440da5f21747f21e498b9220d1 upstream.
One USB3 roothub port may support link power management, while another root port on the same xHC can't due to different retimers used for the ports.
This is the case with Intel Alder Lake, and possible future platforms where retimers used for USB4 ports cause too long exit latecy to enable native USB3 lpm U1 and U2 states.
Add a flag in the xhci port structure to indicate if the port is lpm_incapable, and check it while calculating exit latency.
--- drivers/usb/host/xhci.c | 8 ++++++++ drivers/usb/host/xhci.h | 1 + 2 files changed, 9 insertions(+)
drivers/usb/host/xhci.c +8 -0
@@ -4999,6 +4999,7 @@ static int xhci_enable_usb3_lpm_timeout( struct usb_device *udev, enum usb3_link_state state) { struct xhci_hcd *xhci; +struct xhci_port *port;u16 hub_encoded_timeout;int mel;int ret;
@@ -5012,6 +5013,13 @@ static int xhci_enable_usb3_lpm_timeout( !xhci->devs[udev->slot_id])return USB3_LPM_DISABLED ; +/* If connected to root port then check port can handle lpm */ +if (udev->parent && !udev->parent->parent) { + port = xhci->usb3_rhub.ports[udev->portnum -1 ]; +if (port->lpm_incapable) +return USB3_LPM_DISABLED ; + } + hub_encoded_timeout =xhci_calculate_lpm_timeout (hcd, udev, state); mel =calculate_max_exit_latency (udev, state, hub_encoded_timeout);if (mel <0 ) {
drivers/usb/host/xhci.h +1 -0
@@ -1724,6 +1724,7 @@ struct xhci_port {int hcd_portnum;struct xhci_hub *rhub;struct xhci_port_cap *port_cap; + unsigned int lpm_incapable:1; };struct xhci_hub {
Greg Kroah-Hartman
maintainerPATCH 17/55 usb: acpi: add helper to check port lpm capability using acpi _DSM
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit cd702d18c882d5a4ea44bbdb38edd5d5577ef640 upstream.
Add a helper to evaluate ACPI usb device specific method (_DSM) provided in case the USB3 port shouldn't enter U1 and U2 link states.
This _DSM was added as port specific retimer configuration may lead to exit latencies growing beyond U1/U2 exit limits, and OS needs a way to find which ports can't support U1/U2 link power management states.
This _DSM is also used by windows:
Some patch issues found in testing resolved by Ron Lee
--- drivers/usb/core/usb-acpi.c | 65 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/usb.h | 3 ++ 2 files changed, 68 insertions(+)
drivers/usb/core/usb-acpi.c +65 -0
@@ -37,6 +37,71 @@ bool usb_acpi_power_manageable(struct us }EXPORT_SYMBOL_GPL (usb_acpi_power_manageable); +#define UUID_USB_CONTROLLER_DSM "ce2ee385-00e6-48cb-9f05-2edb927c4899" +#define USB_DSM_DISABLE_U1_U2_FOR_PORT 5 + +/** +* usb_acpi_port_lpm_incapable - check if lpm should be disabled for a port. +* @hdev: USB device belonging to the usb hub +* @index: zero based port index +* +* Some USB3 ports may not support USB3 link power management U1/U2 states +* due to different retimer setup. ACPI provides _DSM method which returns 0x01 +* if U1 and U2 states should be disabled. Evaluate _DSM with: +* Arg0: UUID = ce2ee385-00e6-48cb-9f05-2edb927c4899 +* Arg1: Revision ID = 0 +* Arg2: Function Index = 5 +* Arg3: (empty) +* +* Return 1 if USB3 port is LPM incapable, negative on error, otherwise 0 +*/ + +int usb_acpi_port_lpm_incapable (struct usb_device *hdev,int index) +{ +union acpi_object *obj; +acpi_handle port_handle; +int port1 = index +1 ; +guid_t guid; +int ret; + + ret =guid_parse (UUID_USB_CONTROLLER_DSM , &guid); +if (ret) +return ret; + + port_handle =usb_get_hub_port_acpi_handle (hdev, port1); +if (!port_handle) { +dev_dbg (&hdev->dev,"port-%d no acpi handle\n" , port1); +return -ENODEV ; + } + +if (!acpi_check_dsm (port_handle, &guid,0 , +BIT (USB_DSM_DISABLE_U1_U2_FOR_PORT ))) { +dev_dbg (&hdev->dev,"port-%d no _DSM function %d\n" , + port1,USB_DSM_DISABLE_U1_U2_FOR_PORT ); +return -ENODEV ; + } + + obj =acpi_evaluate_dsm (port_handle, &guid,0 , +USB_DSM_DISABLE_U1_U2_FOR_PORT ,NULL ); + +if (!obj) +return -ENODEV ; + +if (obj->type !=ACPI_TYPE_INTEGER ) { +dev_dbg (&hdev->dev,"evaluate port-%d _DSM failed\n" , port1); +ACPI_FREE (obj); +return -EINVAL ; + } + +if (obj->integer.value ==0x01 ) + ret =1 ; + +ACPI_FREE (obj); + +return ret; +} +EXPORT_SYMBOL_GPL (usb_acpi_port_lpm_incapable); +/** * usb_acpi_set_power_state - control usb port's power via acpi power * resource
include/linux/usb.h +3 -0
@@ -751,11 +751,14 @@ extern void usb_queue_reset_device(strucextern int usb_acpi_set_power_state (struct usb_device *hdev,int index,bool enable);extern bool usb_acpi_power_manageable (struct usb_device *hdev,int index); +extern int usb_acpi_port_lpm_incapable (struct usb_device *hdev,int index);#else static inline int usb_acpi_set_power_state (struct usb_device *hdev,int index,bool enable) {return 0 ; }static inline bool usb_acpi_power_manageable (struct usb_device *hdev,int index) {return true; } +static inline int usb_acpi_port_lpm_incapable (struct usb_device *hdev,int index) + {return 0 ; }#endif /* USB autosuspend and autoresume */
Greg Kroah-Hartman
maintainerPATCH 18/55 xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit 74622f0a81d0c2bcfc39f9192b788124e8c7f0af upstream.
USB3 ports on xHC hosts may have retimers that cause too long exit latency to work with native USB3 U1/U2 link power management states.
For now only use usb_acpi_port_lpm_incapable() to evaluate if port lpm should be disabled while setting up the USB3 roothub.
Other ways to identify lpm incapable ports can be added here later if ACPI _DSM does not exist.
Limit this to Intel hosts for now, this is to my knowledge only an Intel issue.
--- drivers/usb/host/xhci-pci.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/usb/host/xhci-pci.c +34 -0
@@ -339,8 +339,38 @@ static void xhci_pme_acpi_rtd3_enable(st NULL);ACPI_FREE (obj); } + +static void xhci_find_lpm_incapable_ports (struct usb_hcd *hcd,struct usb_device *hdev) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); +struct xhci_hub *rhub = &xhci->usb3_rhub; +int ret; +int i; + +/* This is not the usb3 roothub we are looking for */ +if (hcd != rhub->hcd) +return ; + +if (hdev->maxchild > rhub->num_ports) { +dev_err (&hdev->dev,"USB3 roothub port number mismatch\n" ); +return ; + } + +for (i =0 ; i < hdev->maxchild; i++) { + ret =usb_acpi_port_lpm_incapable (hdev, i); + +dev_dbg (&hdev->dev,"port-%d disable U1/U2 _DSM: %d\n" , i +1 , ret); + +if (ret >=0 ) { + rhub->ports[i]->lpm_incapable = ret; +continue ; + } + } +} +#else static void xhci_pme_acpi_rtd3_enable (struct pci_dev *dev) { } +static void xhci_find_lpm_incapable_ports (struct usb_hcd *hcd,struct usb_device *hdev) { }#endif /* CONFIG_ACPI */ /* called during probe() after chip reset completes */
@@ -376,6 +406,10 @@ static int xhci_pci_setup(struct usb_hcdstatic int xhci_pci_update_hub_device (struct usb_hcd *hcd,struct usb_device *hdev,struct usb_tt *tt,gfp_t mem_flags) { +/* Check if acpi claims some USB3 roothub ports are lpm incapable */ +if (!hdev->parent) +xhci_find_lpm_incapable_ports (hcd, hdev); +return xhci_update_hub_device (hcd, hdev, tt, mem_flags); }
Greg Kroah-Hartman
maintainerPATCH 19/55 prlimit: do_prlimit needs to have a speculation check
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 739790605705ddcf18f21782b9c99ad7d53a8c11 upstream.
do_prlimit() adds the user-controlled resource value to a pointer that will subsequently be dereferenced. In order to help prevent this codepath from being used as a spectre "gadget" a barrier needs to be added after checking the range.
--- kernel/sys.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sys.c +2 -0
@@ -1534,6 +1534,8 @@ int do_prlimit(struct task_struct *tsk,if (resource >=RLIM_NLIMITS )return -EINVAL ; + resource =array_index_nospec (resource,RLIM_NLIMITS ); +if (new_rlim) {if (new_rlim->rlim_cur > new_rlim->rlim_max)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 20/55 USB: serial: option: add Quectel EM05-G (GR) modem
In reply to Greg Kroah-HartmanFrom: Duke Xin(辛安文) <[email protected]>
commit 6c331f32e32ac71eb3e8b93fceda2802d7ecb889 upstream.
The EM05-G (GR) modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:
"RMNET" : AT + DIAG + NMEA + Modem + QMI
"MBIM" : MBIM + AT + DIAG + NMEA + Modem
The detailed description of the USB configuration for each mode as follows:
RMNET Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0313 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
MBIM Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0313 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -256,6 +256,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM05G 0x030a#define QUECTEL_PRODUCT_EM060K 0x030b#define QUECTEL_PRODUCT_EM05G_SG 0x0311 +#define QUECTEL_PRODUCT_EM05G_GR 0x0313#define QUECTEL_PRODUCT_EM12 0x0512#define QUECTEL_PRODUCT_RM500Q 0x0800#define QUECTEL_PRODUCT_RM520N 0x0801
@@ -1161,6 +1162,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff), .driver_info = RSVD(6) | ZLP }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_GR, 0xff), + .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_SG, 0xff), .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
Greg Kroah-Hartman
maintainerPATCH 21/55 USB: serial: option: add Quectel EM05-G (CS) modem
In reply to Greg Kroah-HartmanFrom: Duke Xin(辛安文) <[email protected]>
commit bb78654b0b46316dac687fd4b7dc7cce636f46cd upstream.
The EM05-G (CS) modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:
"RMNET" : AT + DIAG + NMEA + Modem + QMI
"MBIM" : MBIM + AT + DIAG + NMEA + Modem
The detailed description of the USB configuration for each mode as follows:
RMNET Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=030C Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
MBIM Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=030C Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -255,6 +255,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EP06 0x0306#define QUECTEL_PRODUCT_EM05G 0x030a#define QUECTEL_PRODUCT_EM060K 0x030b +#define QUECTEL_PRODUCT_EM05G_CS 0x030c#define QUECTEL_PRODUCT_EM05G_SG 0x0311#define QUECTEL_PRODUCT_EM05G_GR 0x0313#define QUECTEL_PRODUCT_EM12 0x0512
@@ -1164,6 +1165,8 @@ static const struct usb_device_id option .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_GR, 0xff), .driver_info = RSVD(6) | ZLP }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_CS, 0xff), + .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_SG, 0xff), .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
Greg Kroah-Hartman
maintainerPATCH 22/55 USB: serial: option: add Quectel EM05-G (RS) modem
In reply to Greg Kroah-HartmanFrom: Duke Xin(辛安文) <[email protected]>
commit b72d13977689f0c717444010e108c4f20658dfee upstream.
The EM05-G (RS) modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:
"RMNET" : AT + DIAG + NMEA + Modem + QMI
"MBIM" : MBIM + AT + DIAG + NMEA + Modem
The detailed description of the USB configuration for each mode as follows:
RMNET Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0314 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
MBIM Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0314 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-G C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -258,6 +258,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM05G_CS 0x030c#define QUECTEL_PRODUCT_EM05G_SG 0x0311#define QUECTEL_PRODUCT_EM05G_GR 0x0313 +#define QUECTEL_PRODUCT_EM05G_RS 0x0314#define QUECTEL_PRODUCT_EM12 0x0512#define QUECTEL_PRODUCT_RM500Q 0x0800#define QUECTEL_PRODUCT_RM520N 0x0801
@@ -1167,6 +1168,8 @@ static const struct usb_device_id option .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_CS, 0xff), .driver_info = RSVD(6) | ZLP }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_RS, 0xff), + .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_SG, 0xff), .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
Greg Kroah-Hartman
maintainerPATCH 23/55 USB: serial: option: add Quectel EC200U modem
In reply to Greg Kroah-HartmanFrom: Ali Mirghasemi <[email protected]>
commit d9bbb15881046bd76f8710c76e26a740eee997ef upstream.
Add support for EC200U modem
0x0901: EC200U - AT + AP + CP + NMEA + DIAG + MOS
usb-device output:
T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=0901 Rev= 3.18
S: Manufacturer=Android
S: Product=Android
C:* #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=400mA
A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=32ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=83(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=89(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -262,6 +262,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM12 0x0512#define QUECTEL_PRODUCT_RM500Q 0x0800#define QUECTEL_PRODUCT_RM520N 0x0801 +#define QUECTEL_PRODUCT_EC200U 0x0901#define QUECTEL_PRODUCT_EC200S_CN 0x6002#define QUECTEL_PRODUCT_EC200T 0x6026#define QUECTEL_PRODUCT_RM500K 0x7001
@@ -1189,6 +1190,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) },
Greg Kroah-Hartman
maintainerPATCH 24/55 USB: serial: option: add Quectel EM05CN (SG) modem
In reply to Greg Kroah-HartmanFrom: Duke Xin(辛安文) <[email protected]>
commit 1541dd0097c0f8f470e76eddf5120fc55a7e3101 upstream.
The EM05CN (SG) modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:
"MBIM" : AT + MBIM + DIAG + NMEA + MODEM
"RMNET" : AT + DIAG + NMEA + Modem + QMI
The detailed description of the USB configuration for each mode as follows:
MBIM Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0310 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-CN C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
RMNET Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0310 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-CN C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -256,6 +256,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM05G 0x030a#define QUECTEL_PRODUCT_EM060K 0x030b#define QUECTEL_PRODUCT_EM05G_CS 0x030c +#define QUECTEL_PRODUCT_EM05CN_SG 0x0310#define QUECTEL_PRODUCT_EM05G_SG 0x0311#define QUECTEL_PRODUCT_EM05G_GR 0x0313#define QUECTEL_PRODUCT_EM05G_RS 0x0314
@@ -1163,6 +1164,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05CN_SG, 0xff), + .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff), .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_GR, 0xff),
Greg Kroah-Hartman
maintainerPATCH 25/55 USB: serial: option: add Quectel EM05CN modem
In reply to Greg Kroah-HartmanFrom: Duke Xin(辛安文) <[email protected]>
commit 71dfd381a7c051f16a61f82fbd38a4cca563bdca upstream.
The EM05CN modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:
"MBIM" : AT + MBIM + DIAG + NMEA + MODEM
"RMNET" : AT + DIAG + NMEA + Modem + QMI
The detailed description of the USB configuration for each mode as follows:
MBIM Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0312 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-CN C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA A: FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00 I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
RMNET Mode
--------------
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0312 Rev= 3.18 S: Manufacturer=Quectel S: Product=Quectel EM05-CN C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -258,6 +258,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM05G_CS 0x030c#define QUECTEL_PRODUCT_EM05CN_SG 0x0310#define QUECTEL_PRODUCT_EM05G_SG 0x0311 +#define QUECTEL_PRODUCT_EM05CN 0x0312#define QUECTEL_PRODUCT_EM05G_GR 0x0313#define QUECTEL_PRODUCT_EM05G_RS 0x0314#define QUECTEL_PRODUCT_EM12 0x0512
@@ -1164,6 +1165,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05CN, 0xff), + .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05CN_SG, 0xff), .driver_info = RSVD(6) | ZLP }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
Greg Kroah-Hartman
maintainerPATCH 26/55 USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 14ff7460bb58662d86aa50298943cc7d25532e28 upstream.
The USB_DEVICE_ID_CODEMERCS_IOW100 header size was incorrect, it should be 12, not 13.
--- drivers/usb/misc/iowarrior.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/iowarrior.c +1 -1
@@ -817,7 +817,7 @@ static int iowarrior_probe(struct usb_inbreak ;case USB_DEVICE_ID_CODEMERCS_IOW100 : - dev->report_size =13 ; + dev->report_size =12 ;break ; } }
Greg Kroah-Hartman
maintainerPATCH 27/55 misc: fastrpc: Dont remove map on creater_process and device_release
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
commit 5bb96c8f9268e2fdb0e5321cbc358ee5941efc15 upstream.
Do not remove the map from the list on error path in fastrpc_init_create_process, instead call fastrpc_map_put, to avoid use-after-free. Do not remove it on fastrpc_device_release either, call fastrpc_map_put instead.
The fastrpc_free_map is the only proper place to remove the map. This is called only after the reference count is 0.
--- drivers/misc/fastrpc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/misc/fastrpc.c +9 -9
@@ -218,6 +218,13 @@ static void fastrpc_free_map(struct krefdma_buf_put (map->buf); } +if (map->fl) { +spin_lock (&map->fl->lock); +list_del (&map->node); +spin_unlock (&map->fl->lock); + map->fl =NULL ; + } +kfree (map); }
@@ -1080,12 +1087,7 @@ err_invoke: fl->init_mem =NULL ;fastrpc_buf_free (imem); err_alloc: -if (map) { -spin_lock (&fl->lock); -list_del (&map->node); -spin_unlock (&fl->lock); -fastrpc_map_put (map); - } +fastrpc_map_put (map); err:kfree (args);
@@ -1161,10 +1163,8 @@ static int fastrpc_device_release(structfastrpc_context_put (ctx); } -list_for_each_entry_safe (map, m, &fl->maps, node) { -list_del (&map->node); +list_for_each_entry_safe (map, m, &fl->maps, node)fastrpc_map_put (map); - }fastrpc_session_free (cctx, fl->sctx);fastrpc_channel_ctx_put (cctx);
Greg Kroah-Hartman
maintainerPATCH 28/55 misc: fastrpc: Fix use-after-free race condition for maps
In reply to Greg Kroah-HartmanFrom: Ola Jeppsson <[email protected]>
commit 96b328d119eca7563c1edcc4e1039a62e6370ecb upstream.
It is possible that in between calling fastrpc_map_get() until map->fl->lock is taken in fastrpc_free_map(), another thread can call fastrpc_map_lookup() and get a reference to a map that is about to be deleted.
Rewrite fastrpc_map_get() to only increase the reference count of a map if it's non-zero. Propagate this to callers so they can know if a map is about to be deleted.
Fixes this warning:refcount_t: addition on 0; use-after-free.
WARNING: CPU: 5 PID: 10100 at lib/refcount.c:25 refcount_warn_saturate ... Call trace: refcount_warn_saturate [fastrpc_map_get inlined] [fastrpc_map_lookup inlined] fastrpc_map_create fastrpc_internal_invoke fastrpc_device_ioctl __arm64_sys_ioctl invoke_syscall
--- drivers/misc/fastrpc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/misc/fastrpc.c +5 -3
@@ -234,10 +234,12 @@ static void fastrpc_map_put(struct fastrkref_put (&map->refcount, fastrpc_free_map); } -static void fastrpc_map_get (struct fastrpc_map *map) +static int fastrpc_map_get (struct fastrpc_map *map) { -if (map) -kref_get (&map->refcount); +if (!map) +return -ENOENT ; + +return kref_get_unless_zero (&map->refcount) ?0 : -ENOENT ; } static int fastrpc_map_find(struct fastrpc_user *fl, int fd,
Greg Kroah-Hartman
maintainerPATCH 29/55 usb: core: hub: disable autosuspend for TI TUSB8041
In reply to Greg Kroah-HartmanFrom: Flavio Suligoi <[email protected]>
commit 7171b0e261b17de96490adf053b8bb4b00061bcf upstream.
The Texas Instruments TUSB8041 has an autosuspend problem at high temperature.
If there is not USB traffic, after a couple of ms, the device enters in autosuspend mode. In this condition the external clock stops working, to save energy. When the USB activity turns on, ther hub exits the autosuspend state, the clock starts running again and all works fine.
At ambient temperature all works correctly, but at high temperature, when the USB activity turns on, the external clock doesn't restart and the hub disappears from the USB bus.
Disabling the autosuspend mode for this hub solves the issue.
--- drivers/usb/core/hub.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/core/hub.c +13 -0
@@ -41,6 +41,9 @@#define USB_PRODUCT_USB5534B 0x5534#define USB_VENDOR_CYPRESS 0x04b4#define USB_PRODUCT_CY7C65632 0x6570 +#define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451 +#define USB_PRODUCT_TUSB8041_USB3 0x8140 +#define USB_PRODUCT_TUSB8041_USB2 0x8142#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
@@ -5587,6 +5590,16 @@ static const struct usb_device_id hub_id .idVendor = USB_VENDOR_GENESYS_LOGIC, .bInterfaceClass = USB_CLASS_HUB, .driver_info = HUB_QUIRK_CHECK_PORT_AUTOSUSPEND}, + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR + | USB_DEVICE_ID_MATCH_PRODUCT, + .idVendor = USB_VENDOR_TEXAS_INSTRUMENTS, + .idProduct = USB_PRODUCT_TUSB8041_USB2, + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR + | USB_DEVICE_ID_MATCH_PRODUCT, + .idVendor = USB_VENDOR_TEXAS_INSTRUMENTS, + .idProduct = USB_PRODUCT_TUSB8041_USB3, + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, { .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS, .bDeviceClass = USB_CLASS_HUB}, { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
Greg Kroah-Hartman
maintainerPATCH 30/55 comedi: adv_pci1760: Fix PWM instruction handling
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 2efb6edd52dc50273f5e68ad863dd1b1fb2f2d1c upstream.
(Actually, this is fixing the "Read the Current Status" command sent to the device's outgoing mailbox, but it is only currently used for the PWM instructions.)
The PCI-1760 is operated mostly by sending commands to a set of Outgoing Mailbox registers, waiting for the command to complete, and reading the result from the Incoming Mailbox registers. One of these commands is the "Read the Current Status" command. The number of this command is 0x07 (see the User's Manual for the PCI-1760 at
<https://advdownload.advantech.com/productfile/Downloadfile2/1-11P6653/PCI-1760.pdf>.
The PCI1760_CMD_GET_STATUS macro defined in the driver should expand to this command number 0x07, but unfortunately it currently expands to 0x03. (Command number 0x03 is not defined in the User's Manual.) Correct the definition of the PCI1760_CMD_GET_STATUS macro to fix it.
This is used by all the PWM subdevice related instructions handled by pci1760_pwm_insn_config() which are probably all broken. The effect of sending the undefined command number 0x03 is not known.
--- drivers/staging/comedi/drivers/adv_pci1760.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/adv_pci1760.c +1 -1
@@ -59,7 +59,7 @@#define PCI1760_CMD_CLR_IMB2 0x00/* Clears IMB2 */ #define PCI1760_CMD_SET_DO 0x01/* Set output state */ #define PCI1760_CMD_GET_DO 0x02/* Read output status */ -#define PCI1760_CMD_GET_STATUS 0x03/* Read current status */ +#define PCI1760_CMD_GET_STATUS 0x07/* Read current status */ #define PCI1760_CMD_GET_FW_VER 0x0e/* Read firmware version */ #define PCI1760_CMD_GET_HW_VER 0x0f/* Read hardware version */ #define PCI1760_CMD_SET_PWM_HI (x) (0x10 + (x) * 2)/* Set "hi" period */
Greg Kroah-Hartman
maintainerPATCH 31/55 mmc: sunxi-mmc: Fix clock refcount imbalance during unbind
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
commit 8509419758f2cc28dd05370385af0d91573b76b4 upstream.
If the controller is suspended by runtime PM, the clock is already disabled, so do not try to disable it again during removal. Use pm_runtime_disable() to flush any pending runtime PM transitions.
--- drivers/mmc/host/sunxi-mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sunxi-mmc.c +5 -3
@@ -1456,9 +1456,11 @@ static int sunxi_mmc_remove(struct platfstruct sunxi_mmc_host *host =mmc_priv (mmc);mmc_remove_host (mmc); -pm_runtime_force_suspend (&pdev->dev); -disable_irq (host->irq); -sunxi_mmc_disable (host); +pm_runtime_disable (&pdev->dev); +if (!pm_runtime_status_suspended (&pdev->dev)) { +disable_irq (host->irq); +sunxi_mmc_disable (host); + }dma_free_coherent (&pdev->dev,PAGE_SIZE , host->sg_cpu, host->sg_dma);mmc_free_host (mmc);
Greg Kroah-Hartman
maintainerPATCH 32/55 btrfs: fix race between quota rescan and disable leading to NULL pointer deref
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit b7adbf9ada3513d2092362c8eac5cddc5b651f5c upstream.
If we have one task trying to start the quota rescan worker while another one is trying to disable quotas, we can end up hitting a race that results in the quota rescan worker doing a NULL pointer dereference. The steps for this are the following:
1) Quotas are enabled;
2) Task A calls the quota rescan ioctl and enters btrfs_qgroup_rescan(). It calls qgroup_rescan_init() which returns 0 (success) and then joins a transaction and commits it;
3) Task B calls the quota disable ioctl and enters btrfs_quota_disable(). It clears the bit BTRFS_FS_QUOTA_ENABLED from fs_info->flags and calls btrfs_qgroup_wait_for_completion(), which returns immediately since the rescan worker is not yet running.
Then it starts a transaction and locks fs_info->qgroup_ioctl_lock;
4) Task A queues the rescan worker, by calling btrfs_queue_work();
5) The rescan worker starts, and calls rescan_should_stop() at the start of its while loop, which results in 0 iterations of the loop, since the flag BTRFS_FS_QUOTA_ENABLED was cleared from fs_info->flags by task B at step 3);
6) Task B sets fs_info->quota_root to NULL;
7) The rescan worker tries to start a transaction and uses fs_info->quota_root as the root argument for btrfs_start_transaction(). This results in a NULL pointer dereference down the call chain of btrfs_start_transaction(). The stack trace is something like the one reported in Link tag below:
general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]
CPU: 1 PID: 34 Comm: kworker/u4:2 Not tainted 6.1.0-syzkaller-13872-gb6bb9676f216 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Workqueue: btrfs-qgroup-rescan btrfs_work_helper
RIP: 0010:start_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564
Code: 48 89 fb 48 (...)
RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206
RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88801779ba80
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d
R10: fffff52000156f5d R11: 1ffff92000156f5c R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000003
FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
btrfs_qgroup_rescan_worker+0x3bb/0x6a0 fs/btrfs/qgroup.c:3402
btrfs_work_helper+0x312/0x850 fs/btrfs/async-thread.c:280
process_one_work+0x877/0xdb0 kernel/workqueue.c:2289
worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
kthread+0x266/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>
Modules linked in:So fix this by having the rescan worker function not attempt to start a transaction if it didn't do any rescan work.
--- fs/btrfs/qgroup.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
fs/btrfs/qgroup.c +17 -8
@@ -3209,6 +3209,7 @@ static void btrfs_qgroup_rescan_worker(sint err = -ENOMEM ;int ret =0 ;bool stopped = false; +bool did_leaf_rescans = false; path =btrfs_alloc_path ();if (!path)
@@ -3229,6 +3230,7 @@ static void btrfs_qgroup_rescan_worker(s } err =qgroup_rescan_leaf (trans, path); + did_leaf_rescans = true;if (err >0 )btrfs_commit_transaction (trans);
@@ -3249,16 +3251,23 @@ out:mutex_unlock (&fs_info->qgroup_rescan_lock);/* -* only update status, since the previous part has already updated the -* qgroup info. +* Only update status, since the previous part has already updated the +* qgroup info, and only if we did any actual work. This also prevents +* race with a concurrent quota disable, which has already set +* fs_info->quota_root to NULL and cleared BTRFS_FS_QUOTA_ENABLED at +* btrfs_quota_disable(). */ - trans =btrfs_start_transaction (fs_info->quota_root,1 ); -if (IS_ERR (trans)) { - err =PTR_ERR (trans); +if (did_leaf_rescans) { + trans =btrfs_start_transaction (fs_info->quota_root,1 ); +if (IS_ERR (trans)) { + err =PTR_ERR (trans); + trans =NULL ; +btrfs_err (fs_info, +"fail to start transaction for status update: %d" , + err); + } + }else { trans =NULL ; -btrfs_err (fs_info, -"fail to start transaction for status update: %d" , - err); }mutex_lock (&fs_info->qgroup_rescan_lock);
Greg Kroah-Hartman
maintainerPATCH 33/55 cifs: do not include page data when checking signature
In reply to Greg Kroah-HartmanFrom: Enzo Matsumiya <[email protected]>
commit 30b2b2196d6e4cc24cbec633535a2404f258ce69 upstream.
On async reads, page data is allocated before sending. When the response is received but it has no data to fill (e.g. STATUS_END_OF_FILE), __calc_signature() will still include the pages in its computation, leading to an invalid signature check.
This patch fixes this by not setting the async read smb_rqst page data (zeroed by default) if its got_bytes is 0.
This can be reproduced/verified with xfstests generic/465.
--- fs/cifs/smb2pdu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
fs/cifs/smb2pdu.c +9 -6
@@ -3639,12 +3639,15 @@ smb2_readv_callback(struct mid_q_entry * (struct smb2_sync_hdr *)rdata->iov[0 ].iov_base;struct cifs_credits credits = { .value =0 , .instance =0 };struct smb_rqst rqst = { .rq_iov = &rdata->iov[1 ], - .rq_nvec =1 , - .rq_pages = rdata->pages, - .rq_offset = rdata->page_offset, - .rq_npages = rdata->nr_pages, - .rq_pagesz = rdata->pagesz, - .rq_tailsz = rdata->tailsz }; + .rq_nvec =1 , }; + +if (rdata->got_bytes) { + rqst.rq_pages = rdata->pages; + rqst.rq_offset = rdata->page_offset; + rqst.rq_npages = rdata->nr_pages; + rqst.rq_pagesz = rdata->pagesz; + rqst.rq_tailsz = rdata->tailsz; + } cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%u\n", __func__, mid->mid, mid->mid_state, rdata->result,
Greg Kroah-Hartman
maintainerPATCH 34/55 USB: gadgetfs: Fix race between mounting and unmounting
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit d18dcfe9860e842f394e37ba01ca9440ab2178f4 upstream.
The syzbot fuzzer and Gerald Lee have identified a use-after-free bug in the gadgetfs driver, involving processes concurrently mounting and unmounting the gadgetfs filesystem. In particular, gadgetfs_fill_super() can race with gadgetfs_kill_sb(), causing the latter to deallocate the_device while the former is using it. The output from KASAN says, in part:
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline] BUG: KASAN: use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:176 [inline] BUG: KASAN: use-after-free in __refcount_sub_and_test include/linux/refcount.h:272 [inline] BUG: KASAN: use-after-free in __refcount_dec_and_test include/linux/refcount.h:315 [inline] BUG: KASAN: use-after-free in refcount_dec_and_test include/linux/refcount.h:333 [inline] BUG: KASAN: use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:159 [inline] BUG: KASAN: use-after-free in gadgetfs_kill_sb+0x33/0x100 drivers/usb/gadget/legacy/inode.c:2086 Write of size 4 at addr ffff8880276d7840 by task syz-executor126/18689 CPU: 0 PID: 18689 Comm: syz-executor126 Not tainted 6.1.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <TASK> ... atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:176 [inline] __refcount_sub_and_test include/linux/refcount.h:272 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] put_dev drivers/usb/gadget/legacy/inode.c:159 [inline] gadgetfs_kill_sb+0x33/0x100 drivers/usb/gadget/legacy/inode.c:2086 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 vfs_get_super fs/super.c:1190 [inline] get_tree_single+0xd0/0x160 fs/super.c:1207 vfs_get_tree+0x88/0x270 fs/super.c:1531 vfs_fsconfig_locked fs/fsopen.c:232 [inline]
The simplest solution is to ensure that gadgetfs_fill_super() and gadgetfs_kill_sb() are serialized by making them both acquire a new mutex.
--- drivers/usb/gadget/legacy/inode.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
drivers/usb/gadget/legacy/inode.c +21 -7
@@ -229,6 +229,7 @@ static void put_ep (struct ep_data *data*/ static const char *CHIP ; +static DEFINE_MUTEX (sb_mutex);/* Serialize superblock operations */ /*----------------------------------------------------------------------*/
@@ -2013,13 +2014,20 @@ gadgetfs_fill_super (struct super_block {struct inode *inode;struct dev_data *dev; +int rc; -if (the_device) -return -ESRCH ; +mutex_lock (&sb_mutex); + +if (the_device) { + rc = -ESRCH ; + goto Done; + }CHIP =usb_get_gadget_udc_name (); -if (!CHIP ) -return -ENODEV ; +if (!CHIP ) { + rc = -ENODEV ; + goto Done; + }/* superblock */ sb->s_blocksize =PAGE_SIZE ;
@@ -2056,13 +2064,17 @@ gadgetfs_fill_super (struct super_block* from binding to a controller. */ the_device = dev; -return 0 ; + rc =0 ; + goto Done; -Enomem: + Enomem:kfree (CHIP );CHIP =NULL ; + rc = -ENOMEM ; -return -ENOMEM ; + Done: +mutex_unlock (&sb_mutex); +return rc; }/* "mount -t gadgetfs path /dev/gadget" ends up here */
@@ -2084,6 +2096,7 @@ static int gadgetfs_init_fs_context(strustatic void gadgetfs_kill_sb (struct super_block *sb) { +mutex_lock (&sb_mutex);kill_litter_super (sb);if (the_device) {put_dev (the_device);
@@ -2091,6 +2104,7 @@ gadgetfs_kill_sb (struct super_block *sb }kfree (CHIP );CHIP =NULL ; +mutex_unlock (&sb_mutex); }/*----------------------------------------------------------------------*/
Greg Kroah-Hartman
maintainerPATCH 35/55 USB: serial: cp210x: add SCALANCE LPE-9000 device id
In reply to Greg Kroah-HartmanFrom: Michael Adler <[email protected]>
commit 3f9e76e31704a325170e5aec2243c8d084d74854 upstream.
Add the USB serial console device ID for Siemens SCALANCE LPE-9000 which have a USB port for their serial console.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -61,6 +61,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ + { USB_DEVICE(0x0908, 0x0070) }, /* Siemens SCALANCE LPE-9000 USB Serial Console */ { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ { USB_DEVICE(0x0988, 0x0578) }, /* Teraoka AD2000 */ { USB_DEVICE(0x0B00, 0x3070) }, /* Ingenico 3070 */
Greg Kroah-Hartman
maintainerPATCH 36/55 usb: host: ehci-fsl: Fix module alias
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
commit 5d3d01ae15d2f37ed0325c99ab47ef0ae5d05f3c upstream.
Commit ca07e1c1e4a6 ("drivers:usb:fsl:Make fsl ehci drv an independent driver module") changed DRV_NAME which was used for MODULE_ALIAS as well. Starting from this the module alias didn't match the platform device name created in fsl-mph-dr-of.c
Change DRV_NAME to match the driver name for host mode in fsl-mph-dr-of. This is needed for module autoloading on ls1021a.
--- drivers/usb/host/ehci-fsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-fsl.c +1 -1
@@ -29,7 +29,7 @@#include "ehci-fsl.h" #define DRIVER_DESC "Freescale EHCI Host controller driver" -#define DRV_NAME "ehci-fsl" +#define DRV_NAME "fsl-ehci"static struct hc_driver __read_mostly fsl_ehci_hc_driver;
Greg Kroah-Hartman
maintainerPATCH 37/55 usb: typec: altmodes/displayport: Add pin assignment helper
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
commit 582836e3cfab4faafbdc93bbec96fce036a08ee1 upstream.
The code to extract a peripheral's currently supported Pin Assignments is repeated in a couple of locations. Factor it out into a separate function.
This will also make it easier to add fixes (we only need to update 1 location instead of 2).
--- drivers/usb/typec/altmodes/displayport.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/usb/typec/altmodes/displayport.c +14 -8
@@ -407,6 +407,18 @@ static const char * const pin_assignment [DP_PIN_ASSIGN_F] = "F", }; +/* +* Helper function to extract a peripheral's currently supported +* Pin Assignments from its DisplayPort alternate mode state. +*/ +static u8 get_current_pin_assignments (struct dp_altmode *dp) +{ +if (DP_CONF_CURRENTLY (dp->data.conf) ==DP_CONF_DFP_D ) +return DP_CAP_UFP_D_PIN_ASSIGN (dp->alt->vdo); +else +return DP_CAP_DFP_D_PIN_ASSIGN (dp->alt->vdo); +} +static ssize_t pin_assignment_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t size)
@@ -433,10 +445,7 @@ pin_assignment_store(struct device *dev, goto out_unlock; } -if (DP_CONF_CURRENTLY (dp->data.conf) ==DP_CONF_DFP_D ) - assignments =DP_CAP_UFP_D_PIN_ASSIGN (dp->alt->vdo); -else - assignments =DP_CAP_DFP_D_PIN_ASSIGN (dp->alt->vdo); + assignments =get_current_pin_assignments (dp);if (!(DP_CONF_GET_PIN_ASSIGN (conf) & assignments)) { ret = -EINVAL ;
@@ -473,10 +482,7 @@ static ssize_t pin_assignment_show(struc cur =get_count_order (DP_CONF_GET_PIN_ASSIGN (dp->data.conf)); -if (DP_CONF_CURRENTLY (dp->data.conf) ==DP_CONF_DFP_D ) - assignments =DP_CAP_UFP_D_PIN_ASSIGN (dp->alt->vdo); -else - assignments =DP_CAP_DFP_D_PIN_ASSIGN (dp->alt->vdo); + assignments =get_current_pin_assignments (dp);for (i =0 ; assignments; assignments >>=1 , i++) {if (assignments &1 ) {
Greg Kroah-Hartman
maintainerPATCH 38/55 usb: typec: altmodes/displayport: Fix pin assignment calculation
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
commit 9682b41e52cc9f42f5c33caf410464392adaef04 upstream.
Commit c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles") fixed the pin assignment calculation to take into account whether the peripheral was a plug or a receptacle.
But the "pin_assignments" sysfs logic was not updated. Address this by using the macros introduced in the aforementioned commit in the sysfs logic too.
--- drivers/usb/typec/altmodes/displayport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/altmodes/displayport.c +2 -2
@@ -414,9 +414,9 @@ static const char * const pin_assignmentstatic u8 get_current_pin_assignments (struct dp_altmode *dp) {if (DP_CONF_CURRENTLY (dp->data.conf) ==DP_CONF_DFP_D ) -return DP_CAP_UFP_D_PIN_ASSIGN (dp->alt->vdo); +return DP_CAP_PIN_ASSIGN_DFP_D (dp->alt->vdo);else -return DP_CAP_DFP_D_PIN_ASSIGN (dp->alt->vdo); +return DP_CAP_PIN_ASSIGN_UFP_D (dp->alt->vdo); } static ssize_t
Greg Kroah-Hartman
maintainerPATCH 39/55 usb: gadget: g_webcam: Send color matching descriptor per frame
In reply to Greg Kroah-HartmanFrom: Daniel Scally <[email protected]>
commit e95765e97d9cb93258a4840440d410fa6ff7e819 upstream.
Currently the color matching descriptor is only sent across the wire a single time, following the descriptors for each format and frame. According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching Descriptors"):
"Only one instance is allowed for a given format and if present, the Color Matching descriptor shall be placed following the Video and Still Image Frame descriptors for that format".
Add another reference to the color matching descriptor after the yuyv frames so that it's correctly transmitted for that format too.
--- drivers/usb/gadget/legacy/webcam.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/legacy/webcam.c +3 -0
@@ -293,6 +293,7 @@ static const struct uvc_descriptor_heade (const struct uvc_descriptor_header *) &uvc_format_yuv, (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, + (const struct uvc_descriptor_header *) &uvc_color_matching, (const struct uvc_descriptor_header *) &uvc_format_mjpg, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
@@ -305,6 +306,7 @@ static const struct uvc_descriptor_heade (const struct uvc_descriptor_header *) &uvc_format_yuv, (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, + (const struct uvc_descriptor_header *) &uvc_color_matching, (const struct uvc_descriptor_header *) &uvc_format_mjpg, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
@@ -317,6 +319,7 @@ static const struct uvc_descriptor_heade (const struct uvc_descriptor_header *) &uvc_format_yuv, (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p, (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p, + (const struct uvc_descriptor_header *) &uvc_color_matching, (const struct uvc_descriptor_header *) &uvc_format_mjpg, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p, (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
Greg Kroah-Hartman
maintainerPATCH 40/55 usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()
In reply to Greg Kroah-HartmanFrom: Maciej Żenczykowski <[email protected]>
commit c6ec929595c7443250b2a4faea988c62019d5cd2 upstream.
In Google internal bug 265639009 we've received an (as yet) unreproducible crash report from an aarch64 GKI 5.10.149-android13 running device.
AFAICT the source code is at:
https://android.googlesource.com/kernel/common/+/refs/tags/ASB-2022-12-05_13-5.10
The call stack is:
ncm_close() -> ncm_notify() -> ncm_do_notify()
with the crash at:
ncm_do_notify+0x98/0x270 Code: 79000d0b b9000a6c f940012a f9400269 (b9405d4b)
Which I believe disassembles to (I don't know ARM assembly, but it looks sane enough to me...):
// halfword (16-bit) store presumably to event->wLength (at offset 6 of struct usb_cdc_notification)
0B 0D 00 79 strh w11, [x8, #6]
// word (32-bit) store presumably to req->Length (at offset 8 of struct usb_request)
6C 0A 00 B9 str w12, [x19, #8]
// x10 (NULL) was read here from offset 0 of valid pointer x9 // IMHO we're reading 'cdev->gadget' and getting NULL // gadget is indeed at offset 0 of struct usb_composite_dev
2A 01 40 F9 ldr x10, [x9]
// loading req->buf pointer, which is at offset 0 of struct usb_request
69 02 40 F9 ldr x9, [x19]
// x10 is null, crash, appears to be attempt to read cdev->gadget->max_speed
4B 5D 40 B9 ldr w11, [x10, #0x5c]
which seems to line up with ncm_do_notify() case NCM_NOTIFY_SPEED code fragment:
event->wLength = cpu_to_le16(8); req->length = NCM_STATUS_BYTECOUNT; /* SPEED_CHANGE data is up/down speeds in bits/sec */ data = req->buf + sizeof *event; data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget));
My analysis of registers and NULL ptr deref crash offset
(Unable to handle kernel NULL pointer dereference at virtual address 000000000000005c)
heavily suggests that the crash is due to 'cdev->gadget' being NULL when executing:
data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget));
which calls:
ncm_bitrate(NULL)
which then calls:
gadget_is_superspeed(NULL)
which reads
((struct usb_gadget *)NULL)->max_speed
and hits a panic.
AFAICT, if I'm counting right, the offset of max_speed is indeed 0x5C. (remember there's a GKI KABI reservation of 16 bytes in struct work_struct)
It's not at all clear to me how this is all supposed to work... but returning 0 seems much better than panic-ing...
--- drivers/usb/gadget/function/f_ncm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_ncm.c +3 -1
@@ -85,7 +85,9 @@ static inline struct f_ncm *func_to_ncm(/* peak (theoretical) bulk transfer rate in bits-per-second */ static inline unsigned ncm_bitrate (struct usb_gadget *g) { -if (gadget_is_superspeed (g) && g->speed >=USB_SPEED_SUPER_PLUS ) +if (!g) +return 0 ; +else if (gadget_is_superspeed (g) && g->speed >=USB_SPEED_SUPER_PLUS )return 4250000000U ;else if (gadget_is_superspeed (g) && g->speed ==USB_SPEED_SUPER )return 3750000000U ;
Greg Kroah-Hartman
maintainerPATCH 41/55 usb-storage: apply IGNORE_UAS only for HIKSEMI MD202 on RTL9210
In reply to Greg Kroah-HartmanFrom: Juhyung Park <[email protected]>
commit dbd24ec17b85b45f4e823d1aa5607721920f2b05 upstream.
The commit e00b488e813f ("usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS") blacklists UAS for all of RTL9210 enclosures.
The RTL9210 controller was advertised with UAS since its release back in 2019 and was shipped with a lot of enclosure products with different firmware combinations.
Blacklist UAS only for HIKSEMI MD202.
This should hopefully be replaced with more robust method than just comparing strings. But with limited information [1] provided thus far (dmesg when the device is plugged in, which includes manufacturer and product, but no lsusb -v to compare against), this is the best we can do for now.
[1] https://lore.kernel.org/all/[email protected]
--- drivers/usb/storage/uas-detect.h | 13 +++++++++++++ drivers/usb/storage/unusual_uas.h | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/usb/storage/uas-detect.h +13 -0
@@ -116,6 +116,19 @@ static int uas_use_uas_driver(struct usbif (le16_to_cpu (udev->descriptor.idVendor) ==0x0bc2 ) flags |=US_FL_NO_ATA_1X ; +/* +* RTL9210-based enclosure from HIKSEMI, MD202 reportedly have issues +* with UAS. This isn't distinguishable with just idVendor and +* idProduct, use manufacturer and product too. +* +* Reported-by: Hongling Zeng <[email protected]> +*/ +if (le16_to_cpu (udev->descriptor.idVendor) ==0x0bda && +le16_to_cpu (udev->descriptor.idProduct) ==0x9210 && + (udev->manufacturer && !strcmp (udev->manufacturer,"HIKSEMI" )) && + (udev->product && !strcmp (udev->product,"MD202" ))) + flags |=US_FL_IGNORE_UAS ; +usb_stor_adjust_quirks (udev, &flags);if (flags &US_FL_IGNORE_UAS ) {
drivers/usb/storage/unusual_uas.h +0 -7
@@ -83,13 +83,6 @@ UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_LUNS), -/* Reported-by: Hongling Zeng <[email protected]> */ -UNUSUAL_DEV (0x0bda ,0x9210 ,0x0000 ,0x9999 , -"Hiksemi" , -"External HDD" , -USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , -US_FL_IGNORE_UAS ), -/* Reported-by: Benjamin Tissoires <[email protected]> */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation",
Greg Kroah-Hartman
maintainerPATCH 42/55 dt-bindings: phy: g12a-usb3-pcie-phy: fix compatible string documentation
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
commit e181119046a0ec16126b682163040e8e33f310c1 upstream.
The compatible string in the driver doesn't have the meson prefix. Fix this in the documentation and rename the file accordingly.
---
Documentation/devicetree/bindings/phy/amlogic,g12a-usb3-pcie-phy.yaml | 57 ++++++++++
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml | 57 ----------
2 files changed, 57 insertions(+), 57 deletions(-)
rename Documentation/devicetree/bindings/phy/{amlogic,meson-g12a-usb3-pcie-phy.yaml => amlogic,g12a-usb3-pcie-phy.yaml} (82%)Documentation/devicetree/bindings/phy/amlogic,g12a-usb3-pcie-phy.yaml new file +57 -0
@@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 BayLibre, SAS +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/amlogic,g12a-usb3-pcie-phy.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Amlogic G12A USB3 + PCIE Combo PHY + +maintainers: + - Neil Armstrong <[email protected]> + +properties: + compatible: + enum: + - amlogic,g12a-usb3-pcie-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ref_clk + + resets: + maxItems: 1 + + reset-names: + items: + - const: phy + + "#phy-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - reset-names + - "#phy-cells" + +examples: + - | + phy@46000 { + compatible = "amlogic,g12a-usb3-pcie-phy"; + reg = <0x46000 0x2000>; + clocks = <&ref_clk>; + clock-names = "ref_clk"; + resets = <&phy_reset>; + reset-names = "phy"; + #phy-cells = <1>; + };
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml deleted +0 -57
57 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 43/55 serial: pch_uart: Pass correct sg to dma_unmap_sg()
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
commit e8914b52e5b024e4af3d810a935fe0805eee8a36 upstream.
A local variable sg is used to store scatterlist pointer in pch_dma_tx_complete(). The for loop doing Tx byte accounting before dma_unmap_sg() alters sg in its increment statement. Therefore, the pointer passed into dma_unmap_sg() won't match to the one given to dma_map_sg().
To fix the problem, use priv->sg_tx_p directly in dma_unmap_sg() instead of the local variable.
--- drivers/tty/serial/pch_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +1 -1
@@ -776,7 +776,7 @@ static void pch_dma_tx_complete(void *ar } xmit->tail &=UART_XMIT_SIZE -1 ;async_tx_ack (priv->desc_tx); -dma_unmap_sg (port->dev, sg, priv->orig_nent,DMA_TO_DEVICE ); +dma_unmap_sg (port->dev, priv->sg_tx_p, priv->orig_nent,DMA_TO_DEVICE ); priv->tx_dma_use =0 ; priv->nent =0 ; priv->orig_nent =0 ;
Greg Kroah-Hartman
maintainerPATCH 44/55 dmaengine: tegra210-adma: fix global intr clear
In reply to Greg Kroah-HartmanFrom: Mohan Kumar <[email protected]>
commit 9c7e355ccbb33d239360c876dbe49ad5ade65b47 upstream.
The current global interrupt clear programming register offset was not correct. Fix the programming with right offset
--- drivers/dma/tegra210-adma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +1 -1
@@ -224,7 +224,7 @@ static int tegra_adma_init(struct tegra_int ret;/* Clear any interrupts */ -tdma_write (tdma, tdma->cdata->global_int_clear,0x1 ); +tdma_write (tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear,0x1 );/* Assert soft reset */ tdma_write (tdma,ADMA_GLOBAL_SOFT_RESET ,0x1 );
Greg Kroah-Hartman
maintainerPATCH 45/55 serial: atmel: fix incorrect baudrate setup
In reply to Greg Kroah-HartmanFrom: Tobias Schramm <[email protected]>
commit 5bfdd3c654bd879bff50c2e85e42f85ae698b42f upstream.
Commit ba47f97a18f2 ("serial: core: remove baud_rates when serial console setup") changed uart_set_options to select the correct baudrate configuration based on the absolute error between requested baudrate and available standard baudrate settings.
Prior to that commit the baudrate was selected based on which predefined standard baudrate did not exceed the requested baudrate.
This change of selection logic was never reflected in the atmel serial driver. Thus the comment left in the atmel serial driver is no longer accurate.
Additionally the manual rounding up described in that comment and applied via (quot - 1) requests an incorrect baudrate. Since uart_set_options uses tty_termios_encode_baud_rate to determine the appropriate baudrate flags this can cause baudrate selection to fail entirely because tty_termios_encode_baud_rate will only select a baudrate if relative error between requested and selected baudrate does not exceed +/-2%. Fix that by requesting actual, exact baudrate used by the serial.
--- drivers/tty/serial/atmel_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/tty/serial/atmel_serial.c +1 -7
@@ -2642,13 +2642,7 @@ static void __init atmel_console_get_optelse if (mr ==ATMEL_US_PAR_ODD ) *parity ='o' ; -/* -* The serial core only rounds down when matching this to a -* supported baud rate. Make sure we don't end up slightly -* lower than one of those, as it would make us fall through -* to a much lower baud rate than we really want. -*/ - *baud = port->uartclk / (16 * (quot -1 )); + *baud = port->uartclk / (16 * quot); }static int __init atmel_console_setup (struct console *co,char *options)
Greg Kroah-Hartman
maintainerPATCH 46/55 gsmi: fix null-deref in gsmi_get_variable
In reply to Greg Kroah-HartmanFrom: Khazhismel Kumykov <[email protected]>
commit a769b05eeed7accc4019a1ed9799dd72067f1ce8 upstream.
We can get EFI variables without fetching the attribute, so we must allow for that in gsmi.
commit 859748255b43 ("efi: pstore: Omit efivars caching EFI varstore access layer") added a new get_variable call with attr=NULL, which triggers panic in gsmi.
--- drivers/firmware/google/gsmi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/firmware/google/gsmi.c +4 -3
@@ -359,9 +359,10 @@ static efi_status_t gsmi_get_variable(efmemcpy (data, gsmi_dev.data_buf->start, *data_size);/* All variables are have the following attributes */ - *attr =EFI_VARIABLE_NON_VOLATILE | -EFI_VARIABLE_BOOTSERVICE_ACCESS | -EFI_VARIABLE_RUNTIME_ACCESS ; +if (attr) + *attr =EFI_VARIABLE_NON_VOLATILE | +EFI_VARIABLE_BOOTSERVICE_ACCESS | +EFI_VARIABLE_RUNTIME_ACCESS ; }spin_unlock_irqrestore (&gsmi_dev.lock, flags);
Greg Kroah-Hartman
maintainerPATCH 47/55 drm/i915: re-disable RC6p on Sandy Bridge
In reply to Greg Kroah-HartmanFrom: Sasa Dragic <[email protected]>
commit 67b0b4ed259e425b7eed09da75b42c80682ca003 upstream.
RC6p on Sandy Bridge got re-enabled over time, causing visual glitches and GPU hangs.
Disabled originally in commit 1c8ecf80fdee ("drm/i915: do not enable RC6p on Sandy Bridge").
--- drivers/gpu/drm/i915/i915_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_pci.c +2 -1
@@ -418,7 +418,8 @@ static const struct intel_device_info in .has_coherent_ggtt = true, \ .has_llc = 1, \ .has_rc6 = 1, \ - .has_rc6p = 1, \ +/* snb does support rc6p, but enabling it causes various issues */ \ + .has_rc6p = 0, \ .has_rps = true, \ .ppgtt_type = INTEL_PPGTT_FULL, \ .ppgtt_size = 31, \
Greg Kroah-Hartman
maintainerPATCH 48/55 drm/amd/display: Fix set scaling doesns work
In reply to Greg Kroah-HartmanFrom: hongao <[email protected]>
commit 040625ab82ce6dca7772cb3867fe5c9eb279a344 upstream.
[Why]
Setting scaling does not correctly update CRTC state. As a result dc stream state's src (composition area) && dest (addressable area) was not calculated as expected. This causes set scaling doesn's work.
[How]
Correctly update CRTC state when setting scaling property.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
@@ -7409,8 +7409,8 @@ static int amdgpu_dm_atomic_check(struct goto fail; } -if (dm_old_con_state->abm_level != - dm_new_con_state->abm_level) +if (dm_old_con_state->abm_level != dm_new_con_state->abm_level || + dm_old_con_state->scaling != dm_new_con_state->scaling) new_crtc_state->connectors_changed = true; }
Greg Kroah-Hartman
maintainerPATCH 49/55 drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix
In reply to Greg Kroah-HartmanFrom: Joshua Ashton <[email protected]>
commit 973a9c810c785ac270a6d50d8cf862b0c1643a10 upstream.
The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is missing the values for the fourth column of the matrix.
The fourth column of the matrix is essentially just a value that is added given that the color is 3 components in size.
These values are needed to bias the chroma from the [-1, 1] -> [0, 1] range.
This fixes color being very green when using Gamescope HDR on HDMI output which prefers YCC 4:4:4.
--- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +2 -2
@@ -92,8 +92,8 @@ static const struct out_csc_color_matrix {0xE00 ,0xF349 ,0xFEB7 ,0x1000 ,0x6CE ,0x16E3 , 0x24F, 0x200, 0xFCCB, 0xF535, 0xE00, 0x1000} }, { COLOR_SPACE_YCBCR2020_TYPE, - { 0x1000, 0xF149, 0xFEB7, 0x0000, 0x0868, 0x15B2, - 0x01E6, 0x0000, 0xFB88, 0xF478, 0x1000, 0x0000} }, + { 0x1000, 0xF149, 0xFEB7, 0x1004, 0x0868, 0x15B2, + 0x01E6, 0x201, 0xFB88, 0xF478, 0x1000, 0x1004} }, { COLOR_SPACE_YCBCR709_BLACK_TYPE, { 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x1000} },
Greg Kroah-Hartman
maintainerPATCH 50/55 x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN
In reply to Greg Kroah-HartmanFrom: YingChi Long <[email protected]>
commit 55228db2697c09abddcb9487c3d9fa5854a932cd upstream.
WG14 N2350 specifies that it is an undefined behavior to have type definitions within offsetof", see
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
This specification is also part of C23.
Therefore, replace the TYPE_ALIGN macro with the _Alignof builtin to avoid undefined behavior. (_Alignof itself is C11 and the kernel is built with -gnu11).
ISO C11 _Alignof is subtly different from the GNU C extension __alignof__. Latter is the preferred alignment and _Alignof the minimal alignment. For long long on x86 these are 8 and 4 respectively.
The macro TYPE_ALIGN's behavior matches _Alignof rather than __alignof__.
[ bp: Massage commit message. ]
--- arch/x86/kernel/fpu/init.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/kernel/fpu/init.c +2 -5
@@ -139,9 +139,6 @@ static void __init fpu__init_system_geneunsigned int fpu_kernel_xstate_size;EXPORT_SYMBOL_GPL (fpu_kernel_xstate_size); -/* Get alignment of the TYPE. */ -#define TYPE_ALIGN (TYPE ) offsetof(struct { char x; TYPE test; }, test) -/* * Enforce that 'MEMBER' is the last field of 'TYPE'. *
@@ -149,8 +146,8 @@ EXPORT_SYMBOL_GPL(fpu_kernel_xstate_size* because that's how C aligns structs. */ #define CHECK_MEMBER_AT_END_OF (TYPE ,MEMBER ) \ - BUILD_BUG_ON(sizeof(TYPE) != ALIGN(offsetofend(TYPE, MEMBER), \ - TYPE_ALIGN(TYPE))) + BUILD_BUG_ON(sizeof(TYPE) != \ + ALIGN(offsetofend(TYPE, MEMBER), _Alignof(TYPE)))/* * We append the 'struct fpu' to the task_struct:
Greg Kroah-Hartman
maintainerPATCH 51/55 arch: fix broken BuildID for arm64 and riscv
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 99cb0d917ffa1ab628bb67364ca9b162c07699b1 upstream.
Dennis Gilmore reports that the BuildID is missing in the arm64 vmlinux since commit 994b7ac1697b ("arm64: remove special treatment for the link order of head.o").
The issue is that the type of .notes section, which contains the BuildID, changed from NOTES to PROGBITS.
Ard Biesheuvel figured out that whichever object gets linked first gets to decide the type of a section. The PROGBITS type is the result of the compiler emitting .note.GNU-stack as PROGBITS rather than NOTE.
While Ard provided a fix for arm64, I want to fix this globally because the same issue is happening on riscv since commit 2348e6bf4421 ("riscv:
remove special treatment for the link order of head.o"). This problem will happen in general for other architectures if they start to drop unneeded entries from scripts/head-object-list.txt.
Discard .note.GNU-stack in include/asm-generic/vmlinux.lds.h.
--- include/asm-generic/vmlinux.lds.h | 5 +++++ 1 file changed, 5 insertions(+)
include/asm-generic/vmlinux.lds.h +5 -0
@@ -825,7 +825,12 @@#define TRACEDATA #endif +/* +* Discard .note.GNU-stack, which is emitted as PROGBITS by the compiler. +* Otherwise, the type of .notes section would become PROGBITS instead of NOTES. +*/ #define NOTES \ + /DISCARD/ : { *(.note.GNU-stack) } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ __start_notes = .; \ KEEP(*(.note.*)) \
Greg Kroah-Hartman
maintainerPATCH 52/55 s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit a494398bde273143c2352dd373cad8211f7d94b2 upstream.
Nathan Chancellor reports that the s390 vmlinux fails to link with GNU ld < 2.36 since commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv").
It happens for defconfig, or more specifically for CONFIG_EXPOLINE=y.
$ s390x-linux-gnu-ld --version | head -n1 GNU ld (GNU Binutils for Debian) 2.35.2 $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- allnoconfig $ ./scripts/config -e CONFIG_EXPOLINE $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- olddefconfig $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- `.exit.text' referenced in section `.s390_return_reg' of drivers/base/dd.o: defined in discarded section `.exit.text' of drivers/base/dd.o make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1 make: *** [Makefile:1252: vmlinux] Error 2
arch/s390/kernel/vmlinux.lds.S wants to keep EXIT_TEXT:
.exit.text : {
EXIT_TEXT
}But, at the same time, EXIT_TEXT is thrown away by DISCARD because s390 does not define RUNTIME_DISCARD_EXIT.
I still do not understand why the latter wins after 99cb0d917ffa, but defining RUNTIME_DISCARD_EXIT seems correct because the comment line in arch/s390/kernel/vmlinux.lds.S says:
/*
* .exit.text is discarded at runtime, not link time,
* to deal with references from __bug_table */
Nathan also found that binutils commit 21401fc7bf67 ("Duplicate output sections in scripts") cured this issue, so we cannot reproduce it with binutils 2.36+, but it is better to not rely on it.
--- arch/s390/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/vmlinux.lds.S +2 -0
@@ -15,6 +15,8 @@ /* Handle ro_after_init data on our own. */ #define RO_AFTER_INIT_DATA +#define RUNTIME_DISCARD_EXIT + #include <asm-generic/vmlinux.lds.h> #include <asm/vmlinux.lds.h>
Greg Kroah-Hartman
maintainerPATCH 53/55 powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 4b9880dbf3bdba3a7c56445137c3d0e30aaa0a40 upstream.
The powerpc linker script explicitly includes .exit.text, because otherwise the link fails due to references from __bug_table and __ex_table. The code is freed (discarded) at runtime along with .init.text and data.
That has worked in the past despite powerpc not defining RUNTIME_DISCARD_EXIT because DISCARDS appears late in the powerpc linker script (line 410), and the explicit inclusion of .exit.text earlier (line 280) supersedes the discard.
However commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") introduced an earlier use of DISCARD as part of the RO_DATA macro (line 136). With binutils < 2.36 that causes the DISCARD directives later in the script to be applied earlier [1], causing .exit.text to actually be discarded at link time, leading to build errors:
'.exit.text' referenced in section '__bug_table' of crypto/algboss.o: defined in discarded section '.exit.text' of crypto/algboss.o
'.exit.text' referenced in section '__ex_table' of drivers/nvdimm/core.o: defined in discarded section '.exit.text' of drivers/nvdimm/core.o
Fix it by defining RUNTIME_DISCARD_EXIT, which causes the generic DISCARDS macro to not include .exit.text at all.
1: https://lore.kernel.org/lkml/[email protected]/
--- arch/powerpc/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/vmlinux.lds.S +1 -0
@@ -6,6 +6,7 @@ #endif #define BSS_FIRST_SECTIONS *(.bss.prominit) +#define RUNTIME_DISCARD_EXIT #include <asm/page.h> #include <asm-generic/vmlinux.lds.h>
Greg Kroah-Hartman
maintainerPATCH 54/55 powerpc/vmlinux.lds: Dont discard .rela* for relocatable builds
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 07b050f9290ee012a407a0f64151db902a1520f5 upstream.
Relocatable kernels must not discard relocations, they need to be processed at runtime. As such they are included for CONFIG_RELOCATABLE builds in the powerpc linker script (line 340).
However they are also unconditionally discarded later in the script (line 414). Previously that worked because the earlier inclusion superseded the discard.
However commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") introduced an earlier use of DISCARD as part of the RO_DATA macro (line 137). With binutils < 2.36 that causes the DISCARD directives later in the script to be applied earlier, causing .rela* to actually be discarded at link time, leading to build warnings and a kernel that doesn't boot:
ld: warning: discarding dynamic section .rela.init.rodata
Fix it by conditionally discarding .rela* only when CONFIG_RELOCATABLE is disabled.
--- arch/powerpc/kernel/vmlinux.lds.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/vmlinux.lds.S +4 -1
@@ -395,9 +395,12 @@ SECTIONS DISCARDS /DISCARD/ : { *(*.EMB.apuinfo) - *(.glink .iplt .plt .rela* .comment) + *(.glink .iplt .plt .comment) *(.gnu.version*) *(.gnu.attributes) *(.eh_frame) +#ifndef CONFIG_RELOCATABLE + *(.rela*) +#endif } }
Greg Kroah-Hartman
maintainerPATCH 55/55 powerpc/vmlinux.lds: Dont discard .comment
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit be5f95c8779e19779dd81927c8574fec5aaba36c upstream.
Although the powerpc linker script mentions .comment in the DISCARD section, that has never actually caused it to be discarded, because the earlier ELF_DETAILS macro (previously STABS_DEBUG) explicitly includes .comment.
However commit 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv") introduced an earlier use of DISCARD as part of the RO_DATA macro. With binutils < 2.36 that causes the DISCARD directives later in the script to be applied earlier, causing .comment to actually be discarded.
It's confusing to explicitly include and discard .comment, and even more so if the behaviour depends on the toolchain version. So don't discard .comment in order to maintain the existing behaviour in all cases.
--- arch/powerpc/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/vmlinux.lds.S +1 -1
@@ -395,7 +395,7 @@ SECTIONS DISCARDS /DISCARD/ : { *(*.EMB.apuinfo) - *(.glink .iplt .plt .comment) + *(.glink .iplt .plt) *(.gnu.version*) *(.gnu.attributes) *(.eh_frame)
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.230 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 24 Jan 2023 15:02:08 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.230-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions found on i386:
- build/gcc-8-i386_defconfig
Regressions found on powerpc:
- build/gcc-8-mpc83xx_defconfig
- build/gcc-8-ppc64e_defconfig
- build/gcc-8-maple_defconfig
- build/gcc-8-ppc6xx_defconfig
- build/gcc-8-defconfig
- build/gcc-8-tqm8xx_defconfig
- build/gcc-8-cell_defconfig
Regressions found on sh:
- build/gcc-8-dreamcast_defconfig
- build/gcc-8-microdev_defconfig
Regressions found on s390:
- build/gcc-8-defconfig-fe40093d
Regressions found on x86_64:
- build/gcc-8-x86_64_defconfig
Build error:arch/x86/entry/entry_64.o: warning: objtool: .entry.text+0x1c1:
unsupported intra-function call arch/x86/entry/entry_64.o: warning: objtool: If this is a retpoline, please patch it in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE..exit.text' referenced in section .orc_unwind_ip' of arch/x86/events/rapl.o: defined in discarded section `.exit.text' of arch/x86/events/rapl.o.exit.text' referenced in section .orc_unwind_ip' of arch/x86/events/rapl.o: defined in discarded section `.exit.text' of arch/x86/events/rapl.o.exit.text' referenced in section .orc_unwind_ip' of arch/x86/events/intel/uncore.o: defined in discarded section `.exit.text' of arch/x86/events/intel/uncore.o
...
Bisection points to this commit,
arch: fix broken BuildID for arm64 and riscv commit 99cb0d917ffa1ab628bb67364ca9b162c07699b1 upstream.
Upstream discussion thread,
https://lore.kernel.org/all/[email protected]/
Steps to reproduce:
-------------------
# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake # # See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below. # tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-8 --kconfig x86_64_defconfig
Build url:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2KgdmU2GQpPtTDTC696G7v6ytm8/
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.230 release. There are 55 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 24 Jan 2023 15:02:08 +0000. Anything received after that time might be too late.
Build test (gcc version 11.3.1 20230113):
mips: 65 configs -> no failure
arm: 106 configs -> no failure
arm64: 2 configs -> no failurex86_64: 4 configs -> no failure
alpha allmodconfig -> no failure
powerpc allmodconfig -> no failure
riscv allmodconfig -> no failure
s390 allmodconfig -> no failure
xtensa allmodconfig -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
[1]. https://openqa.qa.codethink.co.uk/tests/2695
--
Regards
Sudip