From: Celeste Liu <uwu(a)coelacanthus.name>
This issue was found by Runcheng Lu when develop HSCanT USB to CAN FD
converter[1]. The original developers may have only 3 interfaces
device to test so they write 3 here and wait for future change.
During the HSCanT development, we actually used 4 interfaces, so the
limitation of 3 is not enough now. But just increase one is not
future-proofed. Since the channel index type in gs_host_frame is u8,
just make canch[] become a flexible array with a u8 index, so it
naturally constraint by U8_MAX and avoid statically allocate 256
pointer for every gs_usb device.
[1]: https://github.com/cherry-embedded/HSCanT-hardware
Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Reported-by: Runcheng Lu <runcheng.lu(a)hpmicro.com>
Cc: stable(a)vger.kernel.org
Reviewed-by: Vincent Mailhol <mailhol(a)kernel.org>
Signed-off-by: Celeste Liu <uwu(a)coelacanthus.name>
Link: https://patch.msgid.link/20250930-gs-usb-max-if-v5-1-863330bf6666@coelacant…
Signed-off-by: Marc Kleine-Budde <mkl(a)pengutronix.de>
---
drivers/net/can/usb/gs_usb.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index c9482d6e947b..9fb4cbbd6d6d 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -289,11 +289,6 @@ struct gs_host_frame {
#define GS_MAX_RX_URBS 30
#define GS_NAPI_WEIGHT 32
-/* Maximum number of interfaces the driver supports per device.
- * Current hardware only supports 3 interfaces. The future may vary.
- */
-#define GS_MAX_INTF 3
-
struct gs_tx_context {
struct gs_can *dev;
unsigned int echo_id;
@@ -324,7 +319,6 @@ struct gs_can {
/* usb interface struct */
struct gs_usb {
- struct gs_can *canch[GS_MAX_INTF];
struct usb_anchor rx_submitted;
struct usb_device *udev;
@@ -336,9 +330,11 @@ struct gs_usb {
unsigned int hf_size_rx;
u8 active_channels;
+ u8 channel_cnt;
unsigned int pipe_in;
unsigned int pipe_out;
+ struct gs_can *canch[] __counted_by(channel_cnt);
};
/* 'allocate' a tx context.
@@ -599,7 +595,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
}
/* device reports out of range channel id */
- if (hf->channel >= GS_MAX_INTF)
+ if (hf->channel >= parent->channel_cnt)
goto device_detach;
dev = parent->canch[hf->channel];
@@ -699,7 +695,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
/* USB failure take down all interfaces */
if (rc == -ENODEV) {
device_detach:
- for (rc = 0; rc < GS_MAX_INTF; rc++) {
+ for (rc = 0; rc < parent->channel_cnt; rc++) {
if (parent->canch[rc])
netif_device_detach(parent->canch[rc]->netdev);
}
@@ -1460,17 +1456,19 @@ static int gs_usb_probe(struct usb_interface *intf,
icount = dconf.icount + 1;
dev_info(&intf->dev, "Configuring for %u interfaces\n", icount);
- if (icount > GS_MAX_INTF) {
+ if (icount > type_max(parent->channel_cnt)) {
dev_err(&intf->dev,
"Driver cannot handle more that %u CAN interfaces\n",
- GS_MAX_INTF);
+ type_max(parent->channel_cnt));
return -EINVAL;
}
- parent = kzalloc(sizeof(*parent), GFP_KERNEL);
+ parent = kzalloc(struct_size(parent, canch, icount), GFP_KERNEL);
if (!parent)
return -ENOMEM;
+ parent->channel_cnt = icount;
+
init_usb_anchor(&parent->rx_submitted);
usb_set_intfdata(intf, parent);
@@ -1531,7 +1529,7 @@ static void gs_usb_disconnect(struct usb_interface *intf)
return;
}
- for (i = 0; i < GS_MAX_INTF; i++)
+ for (i = 0; i < parent->channel_cnt; i++)
if (parent->canch[i])
gs_destroy_candev(parent->canch[i]);
base-commit: 2c95a756e0cfc19af6d0b32b0c6cf3bada334998
--
2.51.0
This is the start of the stable review cycle for the 6.17.2 release.
There are 26 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 Sun, 12 Oct 2025 13:13:18 +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/v6.x/stable-review/patch-6.17.2-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.17.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.17.2-rc1
Ankit Khushwaha <ankitkhushwaha.linux(a)gmail.com>
ring buffer: Propagate __rb_map_vma return value to caller
Chao Yu <chao(a)kernel.org>
f2fs: fix to do sanity check on node footer for non inode dnode
Sean Christopherson <seanjc(a)google.com>
KVM: x86: Don't (re)check L1 intercepts when completing userspace I/O
Nalivayko Sergey <Sergey.Nalivayko(a)kaspersky.com>
net/9p: fix double req put in p9_fd_cancelled
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: rng - Ensure set_ent is always present
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: zstd - Fix compression bug caused by truncation
Herbert Xu <herbert(a)gondor.apana.org.au>
Revert "crypto: testmgr - desupport SHA-1 for FIPS 140"
Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
driver core/PM: Set power.no_callbacks along with power.no_pm
Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
driver core: faux: Set power.no_pm for faux devices
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: flush RX FIFO on read errors
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix TX handling on copy_from_user() failure
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix maximum TX packet length check
Raphael Gallais-Pou <raphael.gallais-pou(a)foss.st.com>
serial: stm32: allow selecting console when the driver is module
Carlos Llamas <cmllamas(a)google.com>
binder: fix double-free in dbitmap
Max Kellermann <max.kellermann(a)ionos.com>
drivers/misc/amd-sbi/Kconfig: select REGMAP_I2C
Michael Walle <mwalle(a)kernel.org>
nvmem: layouts: fix automatic module loading
Krzysztof Kozlowski <krzysztof.kozlowski(a)linaro.org>
serial: qcom-geni: Fix blocked task
Rahul Rameshbabu <sergeantsagara(a)protonmail.com>
rust: pci: fix incorrect platform reference in PCI driver unbind doc comment
Rahul Rameshbabu <sergeantsagara(a)protonmail.com>
rust: pci: fix incorrect platform reference in PCI driver probe doc comment
Miguel Ojeda <ojeda(a)kernel.org>
rust: block: fix `srctree/` links
Miguel Ojeda <ojeda(a)kernel.org>
rust: drm: fix `srctree/` links
Bitterblue Smith <rtl8821cerfe2(a)gmail.com>
wifi: rtl8xxxu: Don't claim USB ID 07b8:8188
Bitterblue Smith <rtl8821cerfe2(a)gmail.com>
wifi: rtlwifi: rtl8192cu: Don't claim USB ID 07b8:8188
Zenm Chen <zenmchen(a)gmail.com>
Bluetooth: btusb: Add USB ID 2001:332a for D-Link AX9U rev. A1
Xiaowei Li <xiaowei.li(a)simcom.com>
USB: serial: option: add SIMCom 8230C compositions
Mario Limonciello <mario.limonciello(a)amd.com>
drm/amdgpu: Enable MES lr_compute_wa by default
-------------
Diffstat:
Makefile | 4 +-
arch/x86/kvm/emulate.c | 9 +-
arch/x86/kvm/kvm_emulate.h | 3 +-
arch/x86/kvm/x86.c | 15 +-
crypto/rng.c | 8 +
crypto/testmgr.c | 5 +
crypto/zstd.c | 2 +-
drivers/android/dbitmap.h | 1 +
drivers/base/faux.c | 1 +
drivers/bluetooth/btusb.c | 2 +
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 6 +
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 5 +
drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 +-
drivers/gpu/drm/amd/include/mes_v12_api_def.h | 3 +-
drivers/misc/amd-sbi/Kconfig | 1 +
drivers/net/wireless/realtek/rtl8xxxu/core.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 1 -
drivers/nvmem/layouts.c | 13 ++
drivers/staging/axis-fifo/axis-fifo.c | 68 ++++----
drivers/tty/serial/Kconfig | 2 +-
drivers/tty/serial/qcom_geni_serial.c | 176 ++-------------------
drivers/usb/serial/option.c | 6 +
fs/f2fs/f2fs.h | 4 +-
fs/f2fs/gc.c | 4 +-
fs/f2fs/node.c | 58 ++++---
fs/f2fs/node.h | 1 +
fs/f2fs/recovery.c | 2 +-
include/linux/device.h | 3 +
kernel/trace/ring_buffer.c | 2 +-
net/9p/trans_fd.c | 8 +-
rust/kernel/block/mq/gen_disk.rs | 2 +-
rust/kernel/drm/device.rs | 2 +-
rust/kernel/drm/driver.rs | 2 +-
rust/kernel/drm/file.rs | 2 +-
rust/kernel/drm/gem/mod.rs | 2 +-
rust/kernel/drm/ioctl.rs | 2 +-
rust/kernel/pci.rs | 6 +-
37 files changed, 179 insertions(+), 257 deletions(-)
This is the start of the stable review cycle for the 6.12.52 release.
There are 35 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 Sun, 12 Oct 2025 13:13:18 +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/v6.x/stable-review/patch-6.12.52-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.12.52-rc1
Sean Christopherson <seanjc(a)google.com>
KVM: x86: Don't (re)check L1 intercepts when completing userspace I/O
Nalivayko Sergey <Sergey.Nalivayko(a)kaspersky.com>
net/9p: fix double req put in p9_fd_cancelled
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: rng - Ensure set_ent is always present
Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
driver core/PM: Set power.no_callbacks along with power.no_pm
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: flush RX FIFO on read errors
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix TX handling on copy_from_user() failure
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix maximum TX packet length check
Raphael Gallais-Pou <raphael.gallais-pou(a)foss.st.com>
serial: stm32: allow selecting console when the driver is module
Carlos Llamas <cmllamas(a)google.com>
binder: fix double-free in dbitmap
Michael Walle <mwalle(a)kernel.org>
nvmem: layouts: fix automatic module loading
Arnaud Lecomte <contact(a)arnaud-lcm.com>
hid: fix I2C read buffer overflow in raw_event() for mcp2221
Jeongjun Park <aha310510(a)gmail.com>
ALSA: usb-audio: fix race condition to UAF in snd_usbmidi_free
Takashi Iwai <tiwai(a)suse.de>
ALSA: usb-audio: Kill timer properly at removal
Mario Limonciello <mario.limonciello(a)amd.com>
drm/amdgpu: Enable MES lr_compute_wa by default
Shaoyun Liu <shaoyun.liu(a)amd.com>
drm/amd/include : Update MES v12 API for fence update
Shaoyun Liu <shaoyun.liu(a)amd.com>
drm/amd/include : MES v11 and v12 API header update
Shaoyun Liu <shaoyun.liu(a)amd.com>
drm/amd : Update MES API header file for v11 & v12
Christoffer Sandberg <cs(a)tuxedo.de>
platform/x86/amd/pmc: Add Stellaris Slim Gen6 AMD to spurious 8042 quirks list
Duy Nguyen <duy.nguyen.rh(a)renesas.com>
can: rcar_canfd: Fix controller mode setting
Chen Yufeng <chenyufeng(a)iie.ac.cn>
can: hi311x: fix null pointer dereference when resuming from sleep before interface was enabled
Lizhi Xu <lizhi.xu(a)windriver.com>
netfs: Prevent duplicate unlocking
David Sterba <dsterba(a)suse.com>
btrfs: ref-verify: handle damaged extent root tree
Jack Yu <jack.yu(a)realtek.com>
ASoC: rt5682s: Adjust SAR ADC button mode to fix noise issue
Shyam Sundar S K <Shyam-sundar.S-k(a)amd.com>
platform/x86/amd/pmf: Support new ACPI ID AMDI0108
hupu <hupu.gm(a)gmail.com>
perf subcmd: avoid crash in exclude_cmds when excludes is empty
aprilgrimoire <aprilgrimoire(a)proton.me>
platform/x86/amd/pmc: Add MECHREVO Yilong15Pro to spurious_8042 list
Mikulas Patocka <mpatocka(a)redhat.com>
dm-integrity: limit MAX_TAG_SIZE to 255
Venkata Prasad Potturu <venkataprasad.potturu(a)amd.com>
ASoC: amd: acp: Adjust pdm gain value
Miguel Ojeda <ojeda(a)kernel.org>
rust: block: fix `srctree/` links
Bitterblue Smith <rtl8821cerfe2(a)gmail.com>
wifi: rtl8xxxu: Don't claim USB ID 07b8:8188
Bitterblue Smith <rtl8821cerfe2(a)gmail.com>
wifi: rtlwifi: rtl8192cu: Don't claim USB ID 07b8:8188
Zenm Chen <zenmchen(a)gmail.com>
Bluetooth: btusb: Add USB ID 2001:332a for D-Link AX9U rev. A1
Xiaowei Li <xiaowei.li(a)simcom.com>
USB: serial: option: add SIMCom 8230C compositions
Duoming Zhou <duoming(a)zju.edu.cn>
media: i2c: tc358743: Fix use-after-free bugs caused by orphan timer in probe
Fedor Pchelkin <pchelkin(a)ispras.ru>
wifi: rtw89: fix use-after-free in rtw89_core_tx_kick_off_and_wait()
-------------
Diffstat:
Makefile | 4 +-
arch/x86/kvm/emulate.c | 9 ++-
arch/x86/kvm/kvm_emulate.h | 3 +-
arch/x86/kvm/x86.c | 15 +++--
crypto/rng.c | 8 +++
drivers/android/dbitmap.h | 1 +
drivers/bluetooth/btusb.c | 2 +
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 6 ++
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 5 ++
drivers/gpu/drm/amd/include/mes_v11_api_def.h | 47 +++++++++++++-
drivers/gpu/drm/amd/include/mes_v12_api_def.h | 74 +++++++++++++++++++++-
drivers/hid/hid-mcp2221.c | 4 ++
drivers/md/dm-integrity.c | 2 +-
drivers/media/i2c/tc358743.c | 4 +-
drivers/net/can/rcar/rcar_canfd.c | 7 +-
drivers/net/can/spi/hi311x.c | 33 +++++-----
drivers/net/wireless/realtek/rtl8xxxu/core.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 1 -
drivers/net/wireless/realtek/rtw89/core.c | 31 +++++++--
drivers/net/wireless/realtek/rtw89/core.h | 35 +++++++++-
drivers/net/wireless/realtek/rtw89/pci.c | 3 +-
drivers/net/wireless/realtek/rtw89/ser.c | 3 +
drivers/nvmem/layouts.c | 13 ++++
drivers/platform/x86/amd/pmc/pmc-quirks.c | 15 +++++
drivers/platform/x86/amd/pmf/core.c | 1 +
drivers/staging/axis-fifo/axis-fifo.c | 68 +++++++++-----------
drivers/tty/serial/Kconfig | 2 +-
drivers/usb/serial/option.c | 6 ++
fs/btrfs/ref-verify.c | 9 ++-
fs/netfs/buffered_write.c | 2 +-
include/linux/device.h | 3 +
net/9p/trans_fd.c | 8 +--
rust/kernel/block/mq/gen_disk.rs | 2 +-
sound/soc/amd/acp/amd.h | 2 +-
sound/soc/codecs/rt5682s.c | 17 ++---
sound/usb/midi.c | 10 +--
tools/lib/subcmd/help.c | 3 +
37 files changed, 347 insertions(+), 113 deletions(-)
This is the start of the stable review cycle for the 6.6.111 release.
There are 28 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 Sun, 12 Oct 2025 13:13:18 +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/v6.x/stable-review/patch-6.6.111-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.6.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.6.111-rc1
Sean Christopherson <seanjc(a)google.com>
KVM: x86: Don't (re)check L1 intercepts when completing userspace I/O
Nalivayko Sergey <Sergey.Nalivayko(a)kaspersky.com>
net/9p: fix double req put in p9_fd_cancelled
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: rng - Ensure set_ent is always present
Charlie Jenkins <charlie(a)rivosinc.com>
riscv: mm: Do not restrict mmap address based on hint
Charlie Jenkins <charlie(a)rivosinc.com>
riscv: mm: Use hint address in mmap if available
Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
driver core/PM: Set power.no_callbacks along with power.no_pm
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: flush RX FIFO on read errors
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix TX handling on copy_from_user() failure
Ovidiu Panait <ovidiu.panait.oss(a)gmail.com>
staging: axis-fifo: fix maximum TX packet length check
Raphael Gallais-Pou <raphael.gallais-pou(a)foss.st.com>
serial: stm32: allow selecting console when the driver is module
Arnaud Lecomte <contact(a)arnaud-lcm.com>
hid: fix I2C read buffer overflow in raw_event() for mcp2221
Jeongjun Park <aha310510(a)gmail.com>
ALSA: usb-audio: fix race condition to UAF in snd_usbmidi_free
Takashi Iwai <tiwai(a)suse.de>
ALSA: usb-audio: Kill timer properly at removal
Christoffer Sandberg <cs(a)tuxedo.de>
platform/x86/amd/pmc: Add Stellaris Slim Gen6 AMD to spurious 8042 quirks list
Duy Nguyen <duy.nguyen.rh(a)renesas.com>
can: rcar_canfd: Fix controller mode setting
Chen Yufeng <chenyufeng(a)iie.ac.cn>
can: hi311x: fix null pointer dereference when resuming from sleep before interface was enabled
David Sterba <dsterba(a)suse.com>
btrfs: ref-verify: handle damaged extent root tree
Jack Yu <jack.yu(a)realtek.com>
ASoC: rt5682s: Adjust SAR ADC button mode to fix noise issue
hupu <hupu.gm(a)gmail.com>
perf subcmd: avoid crash in exclude_cmds when excludes is empty
aprilgrimoire <aprilgrimoire(a)proton.me>
platform/x86/amd/pmc: Add MECHREVO Yilong15Pro to spurious_8042 list
Mikulas Patocka <mpatocka(a)redhat.com>
dm-integrity: limit MAX_TAG_SIZE to 255
Venkata Prasad Potturu <venkataprasad.potturu(a)amd.com>
ASoC: amd: acp: Adjust pdm gain value
Bitterblue Smith <rtl8821cerfe2(a)gmail.com>
wifi: rtlwifi: rtl8192cu: Don't claim USB ID 07b8:8188
Xiaowei Li <xiaowei.li(a)simcom.com>
USB: serial: option: add SIMCom 8230C compositions
Duoming Zhou <duoming(a)zju.edu.cn>
media: i2c: tc358743: Fix use-after-free bugs caused by orphan timer in probe
Duoming Zhou <duoming(a)zju.edu.cn>
media: tuner: xc5000: Fix use-after-free in xc5000_release
Ricardo Ribalda <ribalda(a)chromium.org>
media: tunner: xc5000: Refactor firmware load
Will Deacon <will(a)kernel.org>
KVM: arm64: Fix softirq masking in FPSIMD register saving sequence
-------------
Diffstat:
Makefile | 4 +-
arch/arm64/kernel/fpsimd.c | 8 ++-
arch/riscv/include/asm/processor.h | 33 ++---------
arch/x86/kvm/emulate.c | 9 ++-
arch/x86/kvm/kvm_emulate.h | 3 +-
arch/x86/kvm/x86.c | 15 ++---
crypto/rng.c | 8 +++
drivers/hid/hid-mcp2221.c | 4 ++
drivers/md/dm-integrity.c | 2 +-
drivers/media/i2c/tc358743.c | 4 +-
drivers/media/tuners/xc5000.c | 41 ++++++-------
drivers/net/can/rcar/rcar_canfd.c | 7 ++-
drivers/net/can/spi/hi311x.c | 33 ++++++-----
.../net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 1 -
drivers/platform/x86/amd/pmc/pmc-quirks.c | 15 +++++
drivers/staging/axis-fifo/axis-fifo.c | 68 ++++++++++------------
drivers/tty/serial/Kconfig | 2 +-
drivers/usb/serial/option.c | 6 ++
fs/btrfs/ref-verify.c | 9 ++-
include/linux/device.h | 3 +
net/9p/trans_fd.c | 8 +--
sound/soc/amd/acp/amd.h | 2 +-
sound/soc/codecs/rt5682s.c | 17 +++---
sound/usb/midi.c | 10 ++--
tools/lib/subcmd/help.c | 3 +
25 files changed, 166 insertions(+), 149 deletions(-)