4.9.288-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.288-rc1 review
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +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/v4.x/stable-review/patch-4.9.288-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-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.288-rc1
Nick Desaulniers <[email protected]>
ARM: 9122/1: select HAVE_FUTEX_CMPXCHG
Steven Rostedt (VMware) <[email protected]>
tracing: Have all levels of checks prevent recursion
Yanfei Xu <[email protected]>
net: mdiobus: Fix memory leak in __mdiobus_register
Oliver Neukum <[email protected]>
usbnet: sanity check for maxpacket
Kai Vehmanen <[email protected]>
ALSA: hda: avoid write to STATESTS if controller is in reset
Prashant Malani <[email protected]>
platform/x86: intel_scu_ipc: Update timeout value in comment
Zheyu Ma <[email protected]>
isdn: mISDN: Fix sleeping function called from invalid context
Herve Codina <[email protected]>
ARM: dts: spear3xx: Fix gmac node
Vegard Nossum <[email protected]>
netfilter: Kconfig: use 'default y' instead of 'm' for bool config option
Xiaolong Huang <[email protected]>
isdn: cpai: check ctr->cnr to avoid array index out of bound
Lin Ma <[email protected]>
nfc: nci: fix the UAF of rf_conn_info object
Takashi Iwai <[email protected]>
ASoC: DAPM: Fix missing kctl change notifications
Brendan Grieve <[email protected]>
ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headset
Matthew Wilcox (Oracle) <[email protected]>
vfs: check fd has read access in kernel_read_file_from_fd()
Lukas Bulwahn <[email protected]>
elfcore: correct reference to CONFIG_UML
Valentin Vidic <[email protected]>
ocfs2: mount fails with buffer overflow in strlen
Jan Kara <[email protected]>
ocfs2: fix data corruption after conversion from inline format
Zheyu Ma <[email protected]>
can: peak_pci: peak_pci_remove(): fix UAF
Stephane Grosjean <[email protected]>
can: peak_usb: pcan_usb_fd_decode_status(): fix back to ERROR_ACTIVE state notification
Yoshihiro Shimoda <[email protected]>
can: rcar_can: fix suspend/resume
Randy Dunlap <[email protected]>
NIOS2: irqflags: rename a redefined register name
Antoine Tenart <[email protected]>
netfilter: ipvs: make global sysctl readonly in non-init netns
Benjamin Coddington <[email protected]>
NFSD: Keep existing listeners on portlist error
Guenter Roeck <[email protected]>
xtensa: xtfpga: Try software restart before simulating CPU reset
Max Filippov <[email protected]>
xtensa: xtfpga: use CONFIG_USE_OF instead of CONFIG_OF
Vegard Nossum <[email protected]>
r8152: select CRC32 and CRYPTO/CRYPTO_HASH/CRYPTO_SHA256
Dan Carpenter <[email protected]>
drm/msm/dsi: fix off by one in dsi_bus_clk_enable error handling
Colin Ian King <[email protected]>
drm/msm: Fix null pointer dereference on pointer edp
Dan Carpenter <[email protected]>
pata_legacy: fix a couple uninitialized variable bugs
Ziyang Xuan <[email protected]>
NFC: digital: fix possible memory leak in digital_in_send_sdd_req()
Ziyang Xuan <[email protected]>
NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()
Ziyang Xuan <[email protected]>
nfc: fix error handling of nfc_proto_register()
Arnd Bergmann <[email protected]>
ethernet: s2io: fix setting mac address during resume
Nanyong Sun <[email protected]>
net: encx24j600: check error in devm_regmap_init_encx24j600
Vegard Nossum <[email protected]>
net: korina: select CRC32
Vegard Nossum <[email protected]>
net: arc: select CRC32
Dan Carpenter <[email protected]>
iio: ssp_sensors: fix error code in ssp_print_mcu_debug()
Dan Carpenter <[email protected]>
iio: ssp_sensors: add more range checking in ssp_parse_dataframe()
Jiri Valek - 2N <[email protected]>
iio: light: opt3001: Fixed timeout error when 0 lux
Christophe JAILLET <[email protected]>
iio: adc128s052: Fix the error handling path of 'adc128_probe()'
Stephen Boyd <[email protected]>
nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells
Daniele Palmas <[email protected]>
USB: serial: option: add Telit LE910Cx composition 0x1204
Aleksander Morgado <[email protected]>
USB: serial: qcserial: add EM9191 QDL support
Michael Cullen <[email protected]>
Input: xpad - add support for another USB ID of Nacon GC-100
Zhang Jianhua <[email protected]>
efi: Change down_interruptible() in virt_efi_reset_system() to down_trylock()
Ard Biesheuvel <[email protected]>
efi/cper: use stack buffer for error record decoding
Arnd Bergmann <[email protected]>
cb710: avoid NULL pointer subtraction
Nikolay Martynov <[email protected]>
xhci: Enable trust tx length quirk for Fresco FL11 USB controller
Roberto Sassu <[email protected]>
s390: fix strrchr() implementation
Takashi Iwai <[email protected]>
ALSA: seq: Fix a potential UAF by wrong private_free call order
-------------
Diffstat:
Makefile | 4 +- arch/arm/Kconfig | 1 + arch/arm/boot/dts/spear3xx.dtsi | 2 +- arch/nios2/include/asm/irqflags.h | 4 +- arch/nios2/include/asm/registers.h | 2 +- arch/s390/lib/string.c | 15 +++-- arch/xtensa/platforms/xtfpga/setup.c | 12 ++-- drivers/ata/pata_legacy.c | 6 +- drivers/firmware/efi/cper.c | 4 +- drivers/firmware/efi/runtime-wrappers.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/edp/edp_ctrl.c | 3 +- drivers/iio/adc/ti-adc128s052.c | 6 ++ drivers/iio/common/ssp_sensors/ssp_spi.c | 11 +++- drivers/iio/light/opt3001.c | 6 +- drivers/input/joystick/xpad.c | 2 + drivers/isdn/capi/kcapi.c | 5 ++ drivers/isdn/hardware/mISDN/netjet.c | 2 +- drivers/misc/cb710/sgbuf2.c | 2 +- drivers/net/can/rcar/rcar_can.c | 20 ++++--- drivers/net/can/sja1000/peak_pci.c | 9 ++- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 5 +- drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/arc/Kconfig | 1 + drivers/net/ethernet/microchip/encx24j600-regmap.c | 10 +++- drivers/net/ethernet/microchip/encx24j600.c | 5 +- drivers/net/ethernet/microchip/encx24j600_hw.h | 4 +- drivers/net/ethernet/neterion/s2io.c | 2 +- drivers/net/phy/mdio_bus.c | 1 + drivers/net/usb/Kconfig | 4 ++ drivers/net/usb/usbnet.c | 4 ++ drivers/nvmem/core.c | 3 +- drivers/platform/x86/intel_scu_ipc.c | 2 +- drivers/usb/host/xhci-pci.c | 2 + drivers/usb/serial/option.c | 2 + drivers/usb/serial/qcserial.c | 1 + fs/exec.c | 2 +- fs/nfsd/nfsctl.c | 5 +- fs/ocfs2/alloc.c | 46 ++++------------ fs/ocfs2/super.c | 14 +++-- include/linux/elfcore.h | 2 +- kernel/trace/ftrace.c | 4 +- kernel/trace/trace.h | 64 +++++++--------------- kernel/trace/trace_functions.c | 2 +- net/netfilter/Kconfig | 2 +- net/netfilter/ipvs/ip_vs_ctl.c | 5 ++ net/nfc/af_nfc.c | 3 + net/nfc/digital_core.c | 9 ++- net/nfc/digital_technology.c | 8 ++- net/nfc/nci/rsp.c | 2 + sound/core/seq/seq_device.c | 8 +-- sound/hda/hdac_controller.c | 5 +- sound/soc/soc-dapm.c | 13 +++-- sound/usb/quirks-table.h | 32 +++++++++++ 54 files changed, 232 insertions(+), 161 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/50 ALSA: seq: Fix a potential UAF by wrong private_free call order
From: Takashi Iwai <[email protected]>
commit 1f8763c59c4ec6254d629fe77c0a52220bd907aa upstream.
John Keeping reported and posted a patch for a potential UAF in rawmidi sequencer destruction: the snd_rawmidi_dev_seq_free() may be called after the associated rawmidi object got already freed. After a deeper look, it turned out that the bug is rather the incorrect private_free call order for a snd_seq_device. The snd_seq_device private_free gets called at the release callback of the sequencer device object, while this was rather expected to be executed at the snd_device call chains that runs at the beginning of the whole card-free procedure. It's been broken since the rewrite of sequencer-device binding (although it hasn't surfaced because the sequencer device release happens usually right along with the card device release).
This patch corrects the private_free call to be done in the right place, at snd_seq_device_dev_free().
--- sound/core/seq/seq_device.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
sound/core/seq/seq_device.c +3 -5
@@ -162,6 +162,8 @@ static int snd_seq_device_dev_free(strucstruct snd_seq_device *dev = device->device_data;cancel_autoload_drivers (); +if (dev->private_free) + dev->private_free (dev);put_device (&dev->dev);return 0 ; }
@@ -189,11 +191,7 @@ static int snd_seq_device_dev_disconnectstatic void snd_seq_dev_release (struct device *dev) { -struct snd_seq_device *sdev =to_seq_dev (dev); - -if (sdev->private_free) - sdev->private_free (sdev); -kfree (sdev); +kfree (to_seq_dev (dev)); }/*
Greg Kroah-Hartman
maintainerPATCH 2/50 s390: fix strrchr() implementation
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 8e0ab8e26b72a80e991c66a8abc16e6c856abe3d upstream.
Fix two problems found in the strrchr() implementation for s390
architectures: evaluate empty strings (return the string address instead of NULL, if '\0' is passed as second argument); evaluate the first character of non-empty strings (the current implementation stops at the second).
--- arch/s390/lib/string.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/s390/lib/string.c +6 -7
@@ -225,14 +225,13 @@ EXPORT_SYMBOL(strcmp);*/ char *strrchr (const char * s,int c) { -size_t len =__strend (s) - s; +ssize_t len =__strend (s) - s; -if (len) -do { -if (s[len] == (char ) c) -return (char *) s + len; - }while (--len >0 ); -return NULL ; +do { +if (s[len] == (char )c) +return (char *)s + len; + }while (--len >=0 ); +return NULL ; }EXPORT_SYMBOL (strrchr);
Greg Kroah-Hartman
maintainerPATCH 3/50 xhci: Enable trust tx length quirk for Fresco FL11 USB controller
In reply to Greg Kroah-HartmanFrom: Nikolay Martynov <[email protected]>
commit ea0f69d8211963c4b2cc1998b86779a500adb502 upstream.
Tested on SD5200T TB3 dock which has Fresco Logic FL1100 USB 3.0 Host Controller.
Before this patch streaming video from USB cam made mouse and keyboard connected to the same USB bus unusable. Also video was jerky. With this patch streaming video doesn't have any effect on other periferals and video is smooth.
--- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-pci.c +2 -0
@@ -38,6 +38,7 @@#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 +#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 0x1100#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400#define PCI_VENDOR_ID_ETRON 0x1b6f
@@ -91,6 +92,7 @@ static void xhci_pci_quirks(struct devic/* Look for vendor-specific quirks */ if (pdev->vendor ==PCI_VENDOR_ID_FRESCO_LOGIC && (pdev->device ==PCI_DEVICE_ID_FRESCO_LOGIC_PDK || + pdev->device ==PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || pdev->device ==PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 )) {if (pdev->device ==PCI_DEVICE_ID_FRESCO_LOGIC_PDK && pdev->revision ==0x0 ) {
Greg Kroah-Hartman
maintainerPATCH 4/50 cb710: avoid NULL pointer subtraction
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 42641042c10c757fe10cc09088cf3f436cec5007 upstream.
clang-14 complains about an unusual way of converting a pointer to an integer:
drivers/misc/cb710/sgbuf2.c:50:15: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
return ((ptr - NULL) & 3) != 0;
Replace this with a normal cast to uintptr_t.
--- drivers/misc/cb710/sgbuf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cb710/sgbuf2.c +1 -1
@@ -50,7 +50,7 @@ static inline bool needs_unaligned_copy(#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS return false;#else -return ((ptr -NULL ) &3 ) !=0 ; +return ((uintptr_t )ptr &3 ) !=0 ;#endif }
Greg Kroah-Hartman
maintainerPATCH 5/50 efi/cper: use stack buffer for error record decoding
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit b3a72ca80351917cc23f9e24c35f3c3979d3c121 upstream.
Joe reports that using a statically allocated buffer for converting CPER error records into human readable text is probably a bad idea. Even though we are not aware of any actual issues, a stack buffer is clearly a better choice here anyway, so let's move the buffer into the stack frames of the two functions that refer to it.
--- drivers/firmware/efi/cper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/cper.c +2 -2
@@ -35,8 +35,6 @@#define INDENT_SP " " -static char rcd_decode_str[CPER_REC_LEN ]; -/* * CPER record ID need to be unique even after reboot, because record * ID is used as index for ERST storage, while CPER records from
@@ -293,6 +291,7 @@ const char *cper_mem_err_unpack(struct t struct cper_mem_err_compact *cmem) {const char *ret =trace_seq_buffer_ptr (p); +char rcd_decode_str[CPER_REC_LEN ];if (cper_mem_err_location (cmem, rcd_decode_str))trace_seq_printf (p,"%s" , rcd_decode_str);
@@ -307,6 +306,7 @@ static void cper_print_mem(const char *p int len) {struct cper_mem_err_compact cmem; +char rcd_decode_str[CPER_REC_LEN ];/* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ if (len == sizeof(struct cper_sec_mem_err_old) &&
Greg Kroah-Hartman
maintainerPATCH 6/50 efi: Change down_interruptible() in virt_efi_reset_system() to down_trylock()
In reply to Greg Kroah-HartmanFrom: Zhang Jianhua <[email protected]>
commit 38fa3206bf441911258e5001ac8b6738693f8d82 upstream.
While reboot the system by sysrq, the following bug will be occur.
BUG: sleeping function called from invalid context at kernel/locking/semaphore.c:90 in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 10052, name: rc.shutdown CPU: 3 PID: 10052 Comm: rc.shutdown Tainted: G W O 5.10.0 #1 Call trace: dump_backtrace+0x0/0x1c8 show_stack+0x18/0x28 dump_stack+0xd0/0x110 ___might_sleep+0x14c/0x160 __might_sleep+0x74/0x88 down_interruptible+0x40/0x118 virt_efi_reset_system+0x3c/0xd0 efi_reboot+0xd4/0x11c machine_restart+0x60/0x9c emergency_restart+0x1c/0x2c sysrq_handle_reboot+0x1c/0x2c __handle_sysrq+0xd0/0x194 write_sysrq_trigger+0xbc/0xe4 proc_reg_write+0xd4/0xf0 vfs_write+0xa8/0x148 ksys_write+0x6c/0xd8 __arm64_sys_write+0x18/0x28 el0_svc_common.constprop.3+0xe4/0x16c do_el0_svc+0x1c/0x2c el0_svc+0x20/0x30 el0_sync_handler+0x80/0x17c el0_sync+0x158/0x180
The reason for this problem is that irq has been disabled in machine_restart() and then it calls down_interruptible() in virt_efi_reset_system(), which would occur sleep in irq context, it is dangerous! Commit 99409b935c9a("locking/semaphore: Add might_sleep() to down_*() family") add might_sleep() in down_interruptible(), so the bug info is here. down_trylock() can solve this problem, cause there is no might_sleep.
--------
--- drivers/firmware/efi/runtime-wrappers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/runtime-wrappers.c +1 -1
@@ -259,7 +259,7 @@ static void virt_efi_reset_system(int re unsigned long data_size, efi_char16_t *data) { -if (down_interruptible (&efi_runtime_lock)) { +if (down_trylock (&efi_runtime_lock)) {pr_warn ("failed to invoke the reset_system() runtime service:\n" "could not get exclusive access to the firmware\n" );return ;
Greg Kroah-Hartman
maintainerPATCH 7/50 Input: xpad - add support for another USB ID of Nacon GC-100
In reply to Greg Kroah-HartmanFrom: Michael Cullen <[email protected]>
commit 3378a07daa6cdd11e042797454c706d1c69f9ca6 upstream.
The Nacon GX100XF is already mapped, but it seems there is a Nacon GC-100 (identified as NC5136Wht PCGC-100WHITE though I believe other colours exist) with a different USB ID when in XInput mode.
--- drivers/input/joystick/xpad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/joystick/xpad.c +2 -0
@@ -348,6 +348,7 @@ static const struct xpad_device { { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
@@ -464,6 +465,7 @@ static const struct usb_device_id xpad_tXPAD_XBOXONE_VENDOR (0x24c6 ),/* PowerA Controllers */ XPAD_XBOXONE_VENDOR (0x2e24 ),/* Hyperkin Duke X-Box One pad */ XPAD_XBOX360_VENDOR (0x2f24 ),/* GameSir Controllers */ + XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ { } };
Greg Kroah-Hartman
maintainerPATCH 8/50 USB: serial: qcserial: add EM9191 QDL support
In reply to Greg Kroah-HartmanFrom: Aleksander Morgado <[email protected]>
commit 11c52d250b34a0862edc29db03fbec23b30db6da upstream.
When the module boots into QDL download mode it exposes the 1199:90d2 ids, which can be mapped to the qcserial driver, and used to run firmware upgrades (e.g. with the qmi-firmware-update program).
T: Bus=01 Lev=03 Prnt=08 Port=03 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1199 ProdID=90d2 Rev=00.00 S: Manufacturer=Sierra Wireless, Incorporated S: Product=Sierra Wireless EM9191 S: SerialNumber=8W0382004102A109 C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=2mA I: If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=10 Driver=qcserial
--- drivers/usb/serial/qcserial.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/qcserial.c +1 -0
@@ -169,6 +169,7 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ + {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
Greg Kroah-Hartman
maintainerPATCH 9/50 USB: serial: option: add Telit LE910Cx composition 0x1204
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
commit f5a8a07edafed8bede17a95ef8940fe3a57a77d5 upstream.
Add the following Telit LE910Cx composition:
0x1204: tty, adb, mbim, tty, tty, tty, tty
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1209,6 +1209,8 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ .driver_info = NCTRL(2) | RSVD(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1204, 0xff), /* Telit LE910Cx (MBIM) */ + .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
Greg Kroah-Hartman
maintainerPATCH 10/50 nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit 5d388fa01fa6eb310ac023a363a6cb216d9d8fe9 upstream.
If a cell has 'nbits' equal to a multiple of BITS_PER_BYTE the logic
*p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0);
will become undefined behavior because nbits modulo BITS_PER_BYTE is 0, and we subtract one from that making a large number that is then shifted more than the number of bits that fit into an unsigned long.
UBSAN reports this problem:
UBSAN: shift-out-of-bounds in drivers/nvmem/core.c:1386:8 shift exponent 64 is too large for 64-bit type 'unsigned long' CPU: 6 PID: 7 Comm: kworker/u16:0 Not tainted 5.15.0-rc3+ #9 Hardware name: Google Lazor (rev3+) with KB Backlight (DT) Workqueue: events_unbound deferred_probe_work_func Call trace: dump_backtrace+0x0/0x170 show_stack+0x24/0x30 dump_stack_lvl+0x64/0x7c dump_stack+0x18/0x38 ubsan_epilogue+0x10/0x54 __ubsan_handle_shift_out_of_bounds+0x180/0x194 __nvmem_cell_read+0x1ec/0x21c nvmem_cell_read+0x58/0x94 nvmem_cell_read_variable_common+0x4c/0xb0 nvmem_cell_read_variable_le_u32+0x40/0x100 a6xx_gpu_init+0x170/0x2f4 adreno_bind+0x174/0x284 component_bind_all+0xf0/0x264 msm_drm_bind+0x1d8/0x7a0 try_to_bring_up_master+0x164/0x1ac __component_add+0xbc/0x13c component_add+0x20/0x2c dp_display_probe+0x340/0x384 platform_probe+0xc0/0x100 really_probe+0x110/0x304 __driver_probe_device+0xb8/0x120 driver_probe_device+0x4c/0xfc __device_attach_driver+0xb0/0x128 bus_for_each_drv+0x90/0xdc __device_attach+0xc8/0x174 device_initial_probe+0x20/0x2c bus_probe_device+0x40/0xa4 deferred_probe_work_func+0x7c/0xb8 process_one_work+0x128/0x21c process_scheduled_works+0x40/0x54 worker_thread+0x1ec/0x2a8 kthread+0x138/0x158 ret_from_fork+0x10/0x20
Fix it by making sure there are any bits to mask out.
--- drivers/nvmem/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvmem/core.c +2 -1
@@ -967,7 +967,8 @@ static inline void nvmem_shift_read_buff *p-- =0 ;/* clear msb bits if any leftover in the last byte */ - *p &=GENMASK ((cell->nbits%BITS_PER_BYTE ) -1 ,0 ); +if (cell->nbits %BITS_PER_BYTE ) + *p &=GENMASK ((cell->nbits %BITS_PER_BYTE ) -1 ,0 ); } static int __nvmem_cell_read(struct nvmem_device *nvmem,
Greg Kroah-Hartman
maintainerPATCH 11/50 iio: adc128s052: Fix the error handling path of adc128_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit bbcf40816b547b3c37af49168950491d20d81ce1 upstream.
A successful 'regulator_enable()' call should be balanced by a corresponding 'regulator_disable()' call in the error handling path of the probe, as already done in the remove function.
Update the error handling path accordingly.
--- drivers/iio/adc/ti-adc128s052.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iio/adc/ti-adc128s052.c +6 -0
@@ -169,7 +169,13 @@ static int adc128_probe(struct spi_devicmutex_init (&adc->lock); ret =iio_device_register (indio_dev); +if (ret) + goto err_disable_regulator; +return 0 ; + +err_disable_regulator: +regulator_disable (adc->reg);return ret; }
Greg Kroah-Hartman
maintainerPATCH 12/50 iio: light: opt3001: Fixed timeout error when 0 lux
In reply to Greg Kroah-HartmanFrom: Jiri Valek - 2N <[email protected]>
commit 26d90b5590579def54382a2fc34cfbe8518a9851 upstream.
Reading from sensor returned timeout error under
zero light conditions.
--- drivers/iio/light/opt3001.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/light/opt3001.c +3 -3
@@ -283,6 +283,8 @@ static int opt3001_get_lux(struct opt300 ret =wait_event_timeout (opt->result_ready_queue, opt->result_ready,msecs_to_jiffies (OPT3001_RESULT_READY_LONG )); +if (ret ==0 ) +return -ETIMEDOUT ; }else {/* Sleep for result ready time */ timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
@@ -319,9 +321,7 @@ err:/* Disallow IRQ to access the device while lock is active */ opt->ok_to_ignore_lock = false; -if (ret ==0 ) -return -ETIMEDOUT ; -else if (ret <0 ) +if (ret <0 )return ret;if (opt->use_irq) {
Greg Kroah-Hartman
maintainerPATCH 13/50 iio: ssp_sensors: add more range checking in ssp_parse_dataframe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 8167c9a375ccceed19048ad9d68cb2d02ed276e0 upstream.
The "idx" is validated at the start of the loop but it gets incremented during the iteration so it needs to be checked again.
--- drivers/iio/common/ssp_sensors/ssp_spi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_spi.c +8 -1
@@ -286,6 +286,8 @@ static int ssp_parse_dataframe(struct ssfor (idx =0 ; idx < len;) {switch (dataframe[idx++]) {case SSP_MSG2AP_INST_BYPASS_DATA : +if (idx >= len) +return -EPROTO ; sd = dataframe[idx++];if (sd <0 || sd >=SSP_SENSOR_MAX ) { dev_err(SSP_DEV,
@@ -295,10 +297,13 @@ static int ssp_parse_dataframe(struct ssif (indio_devs[sd]) { spd =iio_priv (indio_devs[sd]); -if (spd->process_data) +if (spd->process_data) { +if (idx >= len) +return -EPROTO ; spd->process_data (indio_devs[sd], &dataframe[idx], data->timestamp); + } }else {dev_err (SSP_DEV ,"no client for frame\n" ); }
@@ -306,6 +311,8 @@ static int ssp_parse_dataframe(struct ss idx += ssp_offset_map[sd];break ;case SSP_MSG2AP_INST_DEBUG_DATA : +if (idx >= len) +return -EPROTO ; sd =ssp_print_mcu_debug (dataframe, &idx, len);if (sd) { dev_err(SSP_DEV,
Greg Kroah-Hartman
maintainerPATCH 14/50 iio: ssp_sensors: fix error code in ssp_print_mcu_debug()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 4170d3dd1467e9d78cb9af374b19357dc324b328 upstream.
The ssp_print_mcu_debug() function should return negative error codes on error. Returning "length" is meaningless. This change does not affect runtime because the callers only care about zero/non-zero.
--- drivers/iio/common/ssp_sensors/ssp_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_spi.c +1 -1
@@ -147,7 +147,7 @@ static int ssp_print_mcu_debug(char *datif (length > received_len - *data_index || length <=0 ) {ssp_dbg ("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n" , length, received_len); -return length ? length : -EPROTO ; +return -EPROTO ; }ssp_dbg ("[SSP]: MSG From MCU - %s\n" , &data_frame[*data_index]);
Greg Kroah-Hartman
maintainerPATCH 15/50 net: arc: select CRC32
In reply to Greg Kroah-HartmanFrom: Vegard Nossum <[email protected]>
commit e599ee234ad4fdfe241d937bbabd96e0d8f9d868 upstream.
Fix the following build/link error by adding a dependency on the CRC32 routines:
ld: drivers/net/ethernet/arc/emac_main.o: in function `arc_emac_set_rx_mode':
emac_main.c:(.text+0xb11): undefined reference to `crc32_le'
The crc32_le() call comes through the ether_crc_le() call in arc_emac_set_rx_mode().
[v2: moved the select to ARC_EMAC_CORE; the Makefile is a bit confusing, but the error comes from emac_main.o, which is part of the arc_emac module, which in turn is enabled by CONFIG_ARC_EMAC_CORE. Note that arc_emac is different from emac_arc...]
--- drivers/net/ethernet/arc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/arc/Kconfig +1 -0
@@ -19,6 +19,7 @@ config ARC_EMAC_CORE tristate select MII select PHYLIB + select CRC32 config ARC_EMAC tristate "ARC EMAC support"
Greg Kroah-Hartman
maintainerPATCH 16/50 net: korina: select CRC32
In reply to Greg Kroah-HartmanFrom: Vegard Nossum <[email protected]>
commit 427f974d9727ca681085ddcd0530c97ab5811ae0 upstream.
Fix the following build/link error by adding a dependency on the CRC32 routines:
ld: drivers/net/ethernet/korina.o: in function `korina_multicast_list':
korina.c:(.text+0x1af): undefined reference to `crc32_le'
--- drivers/net/ethernet/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/Kconfig +1 -0
@@ -96,6 +96,7 @@ config JME config KORINA tristate "Korina (IDT RC32434) Ethernet support" depends on MIKROTIK_RB532 + select CRC32 ---help--- If you have a Mikrotik RouterBoard 500 or IDT RC32434 based system say Y. Otherwise say N.
Greg Kroah-Hartman
maintainerPATCH 17/50 net: encx24j600: check error in devm_regmap_init_encx24j600
In reply to Greg Kroah-HartmanFrom: Nanyong Sun <[email protected]>
commit f03dca0c9e2297c84a018e306f8a9cd534ee4287 upstream.
devm_regmap_init may return error which caused by like out of memory, this will results in null pointer dereference later when reading or writing register:
general protection fault in encx24j600_spi_probe KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097] CPU: 0 PID: 286 Comm: spi-encx24j600- Not tainted 5.15.0-rc2-00142-g9978db750e31-dirty #11 9c53a778c1306b1b02359f3c2bbedc0222cba652 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:regcache_cache_bypass drivers/base/regmap/regcache.c:540 Code: 54 41 89 f4 55 53 48 89 fb 48 83 ec 08 e8 26 94 a8 fe 48 8d bb a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 4a 03 00 00 4c 8d ab b0 00 00 00 48 8b ab a0 00 RSP: 0018:ffffc900010476b8 EFLAGS: 00010207 RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: 0000000000000000 RDX: 0000000000000012 RSI: ffff888002de0000 RDI: 0000000000000094 RBP: ffff888013c9a000 R08: 0000000000000000 R09: fffffbfff3f9cc6a R10: ffffc900010476e8 R11: fffffbfff3f9cc69 R12: 0000000000000001 R13: 000000000000000a R14: ffff888013c9af54 R15: ffff888013c9ad08 FS: 00007ffa984ab580(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055a6384136c8 CR3: 000000003bbe6003 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: encx24j600_spi_probe drivers/net/ethernet/microchip/encx24j600.c:459 spi_probe drivers/spi/spi.c:397 really_probe drivers/base/dd.c:517 __driver_probe_device drivers/base/dd.c:751 driver_probe_device drivers/base/dd.c:782 __device_attach_driver drivers/base/dd.c:899 bus_for_each_drv drivers/base/bus.c:427 __device_attach drivers/base/dd.c:971 bus_probe_device drivers/base/bus.c:487 device_add drivers/base/core.c:3364 __spi_add_device drivers/spi/spi.c:599 spi_add_device drivers/spi/spi.c:641 spi_new_device drivers/spi/spi.c:717 new_device_store+0x18c/0x1f1 [spi_stub 4e02719357f1ff33f5a43d00630982840568e85e] dev_attr_store drivers/base/core.c:2074 sysfs_kf_write fs/sysfs/file.c:139 kernfs_fop_write_iter fs/kernfs/file.c:300 new_sync_write fs/read_write.c:508 (discriminator 4) vfs_write fs/read_write.c:594 ksys_write fs/read_write.c:648 do_syscall_64 arch/x86/entry/common.c:50 entry_SYSCALL_64_after_hwframe arch/x86/entry/entry_64.S:113
Add error check in devm_regmap_init_encx24j600 to avoid this situation.
--- drivers/net/ethernet/microchip/encx24j600-regmap.c | 10 ++++++++-- drivers/net/ethernet/microchip/encx24j600.c | 5 ++++- drivers/net/ethernet/microchip/encx24j600_hw.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/ethernet/microchip/encx24j600-regmap.c +8 -2
@@ -500,13 +500,19 @@ static struct regmap_bus phymap_encx24j6 .reg_read = regmap_encx24j600_phy_reg_read, }; -void devm_regmap_init_encx24j600 (struct device *dev, -struct encx24j600_context *ctx) +int devm_regmap_init_encx24j600 (struct device *dev, +struct encx24j600_context *ctx) {mutex_init (&ctx->mutex); regcfg.lock_arg = ctx; ctx->regmap =devm_regmap_init (dev, ®map_encx24j600, ctx, ®cfg); +if (IS_ERR (ctx->regmap)) +return PTR_ERR (ctx->regmap); ctx->phymap =devm_regmap_init (dev, &phymap_encx24j600, ctx, &phycfg); +if (IS_ERR (ctx->phymap)) +return PTR_ERR (ctx->phymap); + +return 0 ; }EXPORT_SYMBOL_GPL (devm_regmap_init_encx24j600);
drivers/net/ethernet/microchip/encx24j600.c +4 -1
@@ -1015,10 +1015,13 @@ static int encx24j600_spi_probe(struct s priv->speed =SPEED_100 ; priv->ctx.spi = spi; -devm_regmap_init_encx24j600 (&spi->dev, &priv->ctx); ndev->irq = spi->irq; ndev->netdev_ops = &encx24j600_netdev_ops; + ret =devm_regmap_init_encx24j600 (&spi->dev, &priv->ctx); +if (ret) + goto out_free; +mutex_init (&priv->lock);/* Reset device and check if it is connected */
drivers/net/ethernet/microchip/encx24j600_hw.h +2 -2
@@ -14,8 +14,8 @@ struct encx24j600_context {int bank; }; -void devm_regmap_init_encx24j600 (struct device *dev, -struct encx24j600_context *ctx); +int devm_regmap_init_encx24j600 (struct device *dev, +struct encx24j600_context *ctx);/* Single-byte instructions */ #define BANK_SELECT (bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1))
Greg Kroah-Hartman
maintainerPATCH 18/50 ethernet: s2io: fix setting mac address during resume
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 40507e7aada8422c38aafa0c8a1a09e4623c712a upstream.
After recent cleanups, gcc started warning about a suspicious memcpy() call during the s2io_io_resume() function:
In function '__dev_addr_set',
inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
4648 | memcpy(dev->dev_addr, addr, len);
| ^~~~~~What apparently happened is that an old cleanup changed the calling conventions for s2io_set_mac_addr() from taking an ethernet address as a character array to taking a struct sockaddr, but one of the callers was not changed at the same time.
Change it to instead call the low-level do_s2io_prog_unicast() function that still takes the old argument type.
--- drivers/net/ethernet/neterion/s2io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/neterion/s2io.c +1 -1
@@ -8618,7 +8618,7 @@ static void s2io_io_resume(struct pci_dereturn ; } -if (s2io_set_mac_addr (netdev, netdev->dev_addr) ==FAILURE ) { +if (do_s2io_prog_unicast (netdev, netdev->dev_addr) ==FAILURE ) {s2io_card_down (sp);pr_err ("Can't restore mac addr after reset.\n" );return ;
Greg Kroah-Hartman
maintainerPATCH 19/50 nfc: fix error handling of nfc_proto_register()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
commit 0911ab31896f0e908540746414a77dd63912748d upstream.
When nfc proto id is using, nfc_proto_register() return -EBUSY error code, but forgot to unregister proto. Fix it by adding proto_unregister() in the error handling case.
--- net/nfc/af_nfc.c | 3 +++ 1 file changed, 3 insertions(+)
net/nfc/af_nfc.c +3 -0
@@ -72,6 +72,9 @@ int nfc_proto_register(const struct nfc_ proto_tab[nfc_proto->id] = nfc_proto;write_unlock (&proto_tab_lock); +if (rc) +proto_unregister (nfc_proto->proto); +return rc; }EXPORT_SYMBOL (nfc_proto_register);
Greg Kroah-Hartman
maintainerPATCH 20/50 NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
commit 58e7dcc9ca29c14e44267a4d0ea61e3229124907 upstream.
'params' is allocated in digital_tg_listen_mdaa(), but not free when digital_send_cmd() failed, which will cause memory leak. Fix it by freeing 'params' if digital_send_cmd() return failed.
--- net/nfc/digital_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/nfc/digital_core.c +7 -2
@@ -286,6 +286,7 @@ int digital_tg_configure_hw(struct nfc_dstatic int digital_tg_listen_mdaa (struct nfc_digital_dev *ddev,u8 rf_tech) {struct digital_tg_mdaa_params *params; +int rc; params =kzalloc (sizeof (struct digital_tg_mdaa_params ),GFP_KERNEL );if (!params)
@@ -300,8 +301,12 @@ static int digital_tg_listen_mdaa(structget_random_bytes (params->nfcid2 +2 ,NFC_NFCID2_MAXSIZE -2 ); params->sc =DIGITAL_SENSF_FELICA_SC ; -return digital_send_cmd (ddev,DIGITAL_CMD_TG_LISTEN_MDAA ,NULL , params, -500 , digital_tg_recv_atr_req,NULL ); + rc =digital_send_cmd (ddev,DIGITAL_CMD_TG_LISTEN_MDAA ,NULL , params, +500 , digital_tg_recv_atr_req,NULL ); +if (rc) +kfree (params); + +return rc; }static int digital_tg_listen_md (struct nfc_digital_dev *ddev,u8 rf_tech)
Greg Kroah-Hartman
maintainerPATCH 21/50 NFC: digital: fix possible memory leak in digital_in_send_sdd_req()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
commit 291c932fc3692e4d211a445ba8aa35663831bac7 upstream.
'skb' is allocated in digital_in_send_sdd_req(), but not free when digital_in_send_cmd() failed, which will cause memory leak. Fix it by freeing 'skb' if digital_in_send_cmd() return failed.
--- net/nfc/digital_technology.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/nfc/digital_technology.c +6 -2
@@ -473,8 +473,12 @@ static int digital_in_send_sdd_req(struc *skb_put (skb,sizeof (u8)) = sel_cmd; *skb_put (skb,sizeof (u8)) =DIGITAL_SDD_REQ_SEL_PAR ; -return digital_in_send_cmd (ddev, skb,30 , digital_in_recv_sdd_res, - target); + rc =digital_in_send_cmd (ddev, skb,30 , digital_in_recv_sdd_res, + target); +if (rc) +kfree_skb (skb); + +return rc; } static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg,
Greg Kroah-Hartman
maintainerPATCH 22/50 pata_legacy: fix a couple uninitialized variable bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 013923477cb311293df9079332cf8b806ed0e6f2 upstream.
The last byte of "pad" is used without being initialized.
--- drivers/ata/pata_legacy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/pata_legacy.c +4 -2
@@ -328,7 +328,8 @@ static unsigned int pdc_data_xfer_vlb(stiowrite32_rep (ap->ioaddr.data_addr, buf, buflen >>2 );if (unlikely (slop)) { -__le32 pad; +__le32 pad =0 ; +if (rw ==READ ) { pad =cpu_to_le32 (ioread32 (ap->ioaddr.data_addr));memcpy (buf + buflen - slop, &pad, slop);
@@ -716,7 +717,8 @@ static unsigned int vlb32_data_xfer(struioread32_rep (ap->ioaddr.data_addr, buf, buflen >>2 );if (unlikely (slop)) { -__le32 pad; +__le32 pad =0 ; +if (rw ==WRITE ) {memcpy (&pad, buf + buflen - slop, slop);iowrite32 (le32_to_cpu (pad), ap->ioaddr.data_addr);
Greg Kroah-Hartman
maintainerPATCH 23/50 drm/msm: Fix null pointer dereference on pointer edp
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit 2133c4fc8e1348dcb752f267a143fe2254613b34 upstream.
The initialization of pointer dev dereferences pointer edp before edp is null checked, so there is a potential null pointer deference issue. Fix this by only dereferencing edp after edp has been null checked.
Addresses-Coverity: ("Dereference before null check")
--- drivers/gpu/drm/msm/edp/edp_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/edp/edp_ctrl.c +2 -1
@@ -1090,7 +1090,7 @@ void msm_edp_ctrl_power(struct edp_ctrlint msm_edp_ctrl_init (struct msm_edp *edp) {struct edp_ctrl *ctrl =NULL ; -struct device *dev = &edp->pdev->dev; +struct device *dev;int ret;if (!edp) {
@@ -1098,6 +1098,7 @@ int msm_edp_ctrl_init(struct msm_edp *edreturn -EINVAL ; } + dev = &edp->pdev->dev; ctrl =devm_kzalloc (dev,sizeof (*ctrl),GFP_KERNEL );if (!ctrl)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 24/50 drm/msm/dsi: fix off by one in dsi_bus_clk_enable error handling
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit c8f01ffc83923a91e8087aaa077de13354a7aa59 upstream.
This disables a lock which wasn't enabled and it does not disable the first lock in the array.
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -1
@@ -439,7 +439,7 @@ static int dsi_bus_clk_enable(struct msmreturn 0 ; err: -for (; i >0 ; i--) +while (--i >=0 )clk_disable_unprepare (msm_host->bus_clks[i]);return ret;
Greg Kroah-Hartman
maintainerPATCH 25/50 r8152: select CRC32 and CRYPTO/CRYPTO_HASH/CRYPTO_SHA256
In reply to Greg Kroah-HartmanFrom: Vegard Nossum <[email protected]>
commit 9973a43012b6ad1720dbc4d5faf5302c28635b8c upstream.
Fix the following build/link errors by adding a dependency on CRYPTO, CRYPTO_HASH, CRYPTO_SHA256 and CRC32:
ld: drivers/net/usb/r8152.o: in function `rtl8152_fw_verify_checksum':
r8152.c:(.text+0x2b2a): undefined reference to `crypto_alloc_shash'
ld: r8152.c:(.text+0x2bed): undefined reference to `crypto_shash_digest'
ld: r8152.c:(.text+0x2c50): undefined reference to `crypto_destroy_tfm'
ld: drivers/net/usb/r8152.o: in function `_rtl8152_set_rx_mode':
r8152.c:(.text+0xdcb0): undefined reference to `crc32_le'
--- drivers/net/usb/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/Kconfig +4 -0
@@ -98,6 +98,10 @@ config USB_RTL8150 config USB_RTL8152 tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" select MII + select CRC32 + select CRYPTO + select CRYPTO_HASH + select CRYPTO_SHA256 help This option adds support for Realtek RTL8152 based USB 2.0 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000
Greg Kroah-Hartman
maintainerPATCH 26/50 xtensa: xtfpga: use CONFIG_USE_OF instead of CONFIG_OF
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit f3d7c2cdf6dc0d5402ec29c3673893b3542c5ad1 ]
Use platform data to initialize xtfpga device drivers when CONFIG_USE_OF is not selected. This fixes xtfpga networking when CONFIG_USE_OF is not selected but CONFIG_OF is.
--- arch/xtensa/platforms/xtfpga/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/xtensa/platforms/xtfpga/setup.c +2 -2
@@ -85,7 +85,7 @@ void __init platform_calibrate_ccount(void)#endif -#ifdef CONFIG_OF +#ifdef CONFIG_USE_OF static void __init xtfpga_clk_setup (struct device_node *np) {
@@ -303,4 +303,4 @@ static int __init xtavnet_init(void)*/ arch_initcall (xtavnet_init); -#endif /* CONFIG_OF */ +#endif /* CONFIG_USE_OF */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 27/50 xtensa: xtfpga: Try software restart before simulating CPU reset
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 012e974501a270d8dfd4ee2039e1fdf7579c907e ]
Rebooting xtensa images loaded with the '-kernel' option in qemu does not work. When executing a reboot command, the qemu session either hangs or experiences an endless sequence of error messages.
Kernel panic - not syncing: Unrecoverable error in exception handler
Reset code jumps to the CPU restart address, but Linux can not recover from there because code and data in the kernel init sections have been discarded and overwritten at this point.
XTFPGA platforms have a means to reset the CPU by writing 0xdead into a specific FPGA IO address. When used in QEMU the kernel image loaded with the '-kernel' option gets restored to its original state allowing the machine to boot successfully.
Use that mechanism to attempt a platform reset. If it does not work, fall back to the existing mechanism.
--- arch/xtensa/platforms/xtfpga/setup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/xtensa/platforms/xtfpga/setup.c +6 -2
@@ -54,8 +54,12 @@ void platform_power_off(void)void platform_restart (void ) { -/* Flush and reset the mmu, simulate a processor reset, and -* jump to the reset vector. */ +/* Try software reset first. */ +WRITE_ONCE (*(u32 *)XTFPGA_SWRST_VADDR ,0xdead ); + +/* If software reset did not work, flush and reset the mmu, +* simulate a processor reset, and jump to the reset vector. +*/ cpu_reset ();/* control never gets here */ }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 28/50 NFSD: Keep existing listeners on portlist error
In reply to Greg Kroah-HartmanFrom: Benjamin Coddington <[email protected]>
[ Upstream commit c20106944eb679fa3ab7e686fe5f6ba30fbc51e5 ]
If nfsd has existing listening sockets without any processes, then an error returned from svc_create_xprt() for an additional transport will remove those existing listeners. We're seeing this in practice when userspace attempts to create rpcrdma transports without having the rpcrdma modules present before creating nfsd kernel processes. Fix this by checking for existing sockets before calling nfsd_destroy().
--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfsd/nfsctl.c +4 -1
@@ -765,7 +765,10 @@ out_close:svc_xprt_put (xprt); } out_err: -nfsd_destroy (net); +if (!list_empty (&nn->nfsd_serv->sv_permsocks)) + nn->nfsd_serv->sv_nrthreads--; +else +nfsd_destroy (net);return err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 29/50 netfilter: ipvs: make global sysctl readonly in non-init netns
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 174c376278949c44aad89c514a6b5db6cee8db59 ]
Because the data pointer of net/ipv4/vs/debug_level is not updated per netns, it must be marked as read-only in non-init netns.
--- net/netfilter/ipvs/ip_vs_ctl.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/ipvs/ip_vs_ctl.c +5 -0
@@ -3987,6 +3987,11 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) tbl[idx++].data = &ipvs->sysctl_conn_reuse_mode; tbl[idx++].data = &ipvs->sysctl_schedule_icmp; tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; +#ifdef CONFIG_IP_VS_DEBUG +/* Global sysctls must be ro in non-init netns */ +if (!net_eq (net, &init_net)) + tbl[idx++].mode =0444 ; +#endif ipvs->sysctl_hdr =register_net_sysctl (net,"net/ipv4/vs" , tbl);if (ipvs->sysctl_hdr ==NULL ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 30/50 NIOS2: irqflags: rename a redefined register name
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 4cce60f15c04d69eff6ffc539ab09137dbe15070 ]
Both arch/nios2/ and drivers/mmc/host/tmio_mmc.c define a macro with the name "CTL_STATUS". Change the one in arch/nios2/ to be "CTL_FSTATUS" (flags status) to eliminate the build warning.
In file included from ../drivers/mmc/host/tmio_mmc.c:22:drivers/mmc/host/tmio_mmc.h:31: warning: "CTL_STATUS" redefined
31 | #define CTL_STATUS 0x1carch/nios2/include/asm/registers.h:14: note: this is the location of the previous definition
14 | #define CTL_STATUS 0
--- arch/nios2/include/asm/irqflags.h | 4 ++-- arch/nios2/include/asm/registers.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/nios2/include/asm/irqflags.h +2 -2
@@ -22,7 +22,7 @@static inline unsigned long arch_local_save_flags (void ) { -return RDCTL (CTL_STATUS ); +return RDCTL (CTL_FSTATUS ); }/*
@@ -31,7 +31,7 @@ static inline unsigned long arch_local_save_flags(void)*/ static inline void arch_local_irq_restore (unsigned long flags) { -WRCTL (CTL_STATUS , flags); +WRCTL (CTL_FSTATUS , flags); }static inline void arch_local_irq_disable (void )
arch/nios2/include/asm/registers.h +1 -1
@@ -24,7 +24,7 @@#endif /* control register numbers */ -#define CTL_STATUS 0 +#define CTL_FSTATUS 0#define CTL_ESTATUS 1#define CTL_BSTATUS 2#define CTL_IENABLE 3
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 31/50 can: rcar_can: fix suspend/resume
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
commit f7c05c3987dcfde9a4e8c2d533db013fabebca0d upstream.
If the driver was not opened, rcar_can_suspend() should not call clk_disable() because the clock was not enabled.
--- drivers/net/can/rcar/rcar_can.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/can/rcar/rcar_can.c +12 -8
@@ -858,10 +858,12 @@ static int __maybe_unused rcar_can_suspestruct rcar_can_priv *priv =netdev_priv (ndev);u16 ctlr; -if (netif_running (ndev)) { -netif_stop_queue (ndev); -netif_device_detach (ndev); - } +if (!netif_running (ndev)) +return 0 ; + +netif_stop_queue (ndev); +netif_device_detach (ndev); + ctlr =readw (&priv->regs->ctlr); ctlr |=RCAR_CAN_CTLR_CANM_HALT ;writew (ctlr, &priv->regs->ctlr);
@@ -880,6 +882,9 @@ static int __maybe_unused rcar_can_resumu16 ctlr;int err; +if (!netif_running (ndev)) +return 0 ; + err =clk_enable (priv->clk);if (err) {netdev_err (ndev,"clk_enable() failed, error %d\n" , err);
@@ -893,10 +898,9 @@ static int __maybe_unused rcar_can_resumwritew (ctlr, &priv->regs->ctlr); priv->can.state =CAN_STATE_ERROR_ACTIVE ; -if (netif_running (ndev)) { -netif_device_attach (ndev); -netif_start_queue (ndev); - } +netif_device_attach (ndev); +netif_start_queue (ndev); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 32/50 can: peak_usb: pcan_usb_fd_decode_status(): fix back to ERROR_ACTIVE state notification
In reply to Greg Kroah-HartmanFrom: Stephane Grosjean <[email protected]>
commit 3d031abc7e7249573148871180c28ecedb5e27df upstream.
This corrects the lack of notification of a return to ERROR_ACTIVE state for USB - CANFD devices from PEAK-System.
--- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +2 -3
@@ -559,11 +559,10 @@ static int pcan_usb_fd_decode_status(str }else if (sm->channel_p_w_b &PUCAN_BUS_WARNING ) { new_state =CAN_STATE_ERROR_WARNING ; }else { -/* no error bit (so, no error skb, back to active state) */ - dev->can.state =CAN_STATE_ERROR_ACTIVE ; +/* back to (or still in) ERROR_ACTIVE state */ + new_state =CAN_STATE_ERROR_ACTIVE ; pdev->bec.txerr =0 ; pdev->bec.rxerr =0 ; -return 0 ; }/* state hasn't changed */
Greg Kroah-Hartman
maintainerPATCH 33/50 can: peak_pci: peak_pci_remove(): fix UAF
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
commit 949fe9b35570361bc6ee2652f89a0561b26eec98 upstream.
When remove the module peek_pci, referencing 'chan' again after releasing 'dev' will cause UAF.
Fix this by releasing 'dev' later.
The following log reveals it:
[ 35.961814 ] BUG: KASAN: use-after-free in peak_pci_remove+0x16f/0x270 [peak_pci] [ 35.963414 ] Read of size 8 at addr ffff888136998ee8 by task modprobe/5537 [ 35.965513 ] Call Trace: [ 35.965718 ] dump_stack_lvl+0xa8/0xd1 [ 35.966028 ] print_address_description+0x87/0x3b0 [ 35.966420 ] kasan_report+0x172/0x1c0 [ 35.966725 ] ? peak_pci_remove+0x16f/0x270 [peak_pci] [ 35.967137 ] ? trace_irq_enable_rcuidle+0x10/0x170 [ 35.967529 ] ? peak_pci_remove+0x16f/0x270 [peak_pci] [ 35.967945 ] __asan_report_load8_noabort+0x14/0x20 [ 35.968346 ] peak_pci_remove+0x16f/0x270 [peak_pci] [ 35.968752 ] pci_device_remove+0xa9/0x250
--- drivers/net/can/sja1000/peak_pci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/can/sja1000/peak_pci.c +4 -5
@@ -736,16 +736,15 @@ static void peak_pci_remove(struct pci_dstruct net_device *prev_dev = chan->prev_dev;dev_info (&pdev->dev,"removing device %s\n" , dev->name); +/* do that only for first channel */ +if (!prev_dev && chan->pciec_card) +peak_pciec_remove (chan->pciec_card);unregister_sja1000dev (dev);free_sja1000dev (dev); dev = prev_dev; -if (!dev) { -/* do that only for first channel */ -if (chan->pciec_card) -peak_pciec_remove (chan->pciec_card); +if (!dev)break ; - } priv =netdev_priv (dev); chan = priv->priv; }
Greg Kroah-Hartman
maintainerPATCH 34/50 ocfs2: fix data corruption after conversion from inline format
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 5314454ea3ff6fc746eaf71b9a7ceebed52888fa upstream.
Commit 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") uncovered a latent bug in ocfs2 conversion from inline inode format to a normal inode format.
The code in ocfs2_convert_inline_data_to_extents() attempts to zero out the whole cluster allocated for file data by grabbing, zeroing, and dirtying all pages covering this cluster. However these pages are beyond i_size, thus writeback code generally ignores these dirty pages and no blocks were ever actually zeroed on the disk.
This oversight was fixed by commit 693c241a5f6a ("ocfs2: No need to zero pages past i_size.") for standard ocfs2 write path, inline conversion path was apparently forgotten; the commit log also has a reasoning why the zeroing actually is not needed.
After commit 6dbf7bb55598, things became worse as writeback code stopped invalidating buffers on pages beyond i_size and thus these pages end up with clean PageDirty bit but with buffers attached to these pages being still dirty. So when a file is converted from inline format, then writeback triggers, and then the file is grown so that these pages become valid, the invalid dirtiness state is preserved, mark_buffer_dirty() does nothing on these pages (buffers are already dirty) but page is never written back because it is clean. So data written to these pages is lost once pages are reclaimed.
Simple reproducer for the problem is:
xfs_io -f -c "pwrite 0 2000" -c "pwrite 2000 2000" -c "fsync" \
-c "pwrite 4000 2000" ocfs2_fileAfter unmounting and mounting the fs again, you can observe that end of 'ocfs2_file' has lost its contents.
Fix the problem by not doing the pointless zeroing during conversion from inline format similarly as in the standard write path.
[[email protected]: fix whitespace, per Joseph]
--- fs/ocfs2/alloc.c | 46 ++++++++++++---------------------------------- 1 file changed, 12 insertions(+), 34 deletions(-)
fs/ocfs2/alloc.c +12 -34
@@ -6891,7 +6891,7 @@ void ocfs2_set_inode_data_inline(structint ocfs2_convert_inline_data_to_extents (struct inode *inode,struct buffer_head *di_bh) { -int ret, i, has_data, num_pages =0 ; +int ret, has_data, num_pages =0 ;int need_free =0 ;u32 bit_off, num;handle_t *handle;
@@ -6900,26 +6900,17 @@ int ocfs2_convert_inline_data_to_extentsstruct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;struct ocfs2_alloc_context *data_ac =NULL ; -struct page **pages =NULL ; -loff_t end = osb->s_clustersize; +struct page *page =NULL ;struct ocfs2_extent_tree et;int did_quota =0 ; has_data =i_size_read (inode) ?1 :0 ;if (has_data) { - pages =kcalloc (ocfs2_pages_per_cluster (osb->sb), -sizeof (struct page *),GFP_NOFS ); -if (pages ==NULL ) { - ret = -ENOMEM ; -mlog_errno (ret); -return ret; - } - ret =ocfs2_reserve_clusters (osb,1 , &data_ac);if (ret) {mlog_errno (ret); - goto free_pages; + goto out; } }
@@ -6939,7 +6930,8 @@ int ocfs2_convert_inline_data_to_extents }if (has_data) { -unsigned int page_end; +unsigned int page_end =min_t (unsigned,PAGE_SIZE , + osb->s_clustersize);u64 phys; ret = dquot_alloc_space_nodirty(inode,
@@ -6963,15 +6955,8 @@ int ocfs2_convert_inline_data_to_extents*/ block = phys =ocfs2_clusters_to_blocks (inode->i_sb, bit_off); -/* -* Non sparse file systems zero on extend, so no need -* to do that now. -*/ -if (!ocfs2_sparse_alloc (osb) && -PAGE_SIZE < osb->s_clustersize) - end =PAGE_SIZE ; - - ret =ocfs2_grab_eof_pages (inode,0 , end, pages, &num_pages); + ret =ocfs2_grab_eof_pages (inode,0 , page_end, &page, + &num_pages);if (ret) {mlog_errno (ret); need_free =1 ;
@@ -6982,20 +6967,15 @@ int ocfs2_convert_inline_data_to_extents* This should populate the 1st page for us and mark * it up to date. */ - ret =ocfs2_read_inline_data (inode, pages[0 ], di_bh); + ret =ocfs2_read_inline_data (inode, page, di_bh);if (ret) {mlog_errno (ret); need_free =1 ; goto out_unlock; } - page_end =PAGE_SIZE ; -if (PAGE_SIZE > osb->s_clustersize) - page_end = osb->s_clustersize; - -for (i =0 ; i < num_pages; i++) -ocfs2_map_and_dirty_page (inode, handle,0 , page_end, - pages[i], i >0 , &phys); +ocfs2_map_and_dirty_page (inode, handle,0 , page_end, page,0 , + &phys); }spin_lock (&oi->ip_lock);
@@ -7026,8 +7006,8 @@ int ocfs2_convert_inline_data_to_extents } out_unlock: -if (pages) -ocfs2_unlock_and_free_pages (pages, num_pages); +if (page) +ocfs2_unlock_and_free_pages (&page, num_pages); out_commit:if (ret <0 && did_quota)
@@ -7051,8 +7031,6 @@ out_commit: out:if (data_ac)ocfs2_free_alloc_context (data_ac); -free_pages: -kfree (pages);return ret; }
Greg Kroah-Hartman
maintainerPATCH 35/50 ocfs2: mount fails with buffer overflow in strlen
In reply to Greg Kroah-HartmanFrom: Valentin Vidic <[email protected]>
commit b15fa9224e6e1239414525d8d556d824701849fc upstream.
Starting with kernel 5.11 built with CONFIG_FORTIFY_SOURCE mouting an ocfs2 filesystem with either o2cb or pcmk cluster stack fails with the trace below. Problem seems to be that strings for cluster stack and cluster name are not guaranteed to be null terminated in the disk representation, while strlcpy assumes that the source string is always null terminated. This causes a read outside of the source string triggering the buffer overflow detection.
detected buffer overflow in strlen
------------[ cut here ]------------
kernel BUG at lib/string.c:1149!
invalid opcode: 0000 [#1] SMP PTI
CPU: 1 PID: 910 Comm: mount.ocfs2 Not tainted 5.14.0-1-amd64 #1
Debian 5.14.6-2
RIP: 0010:fortify_panic+0xf/0x11
...
Call Trace:
ocfs2_initialize_super.isra.0.cold+0xc/0x18 [ocfs2]
ocfs2_fill_super+0x359/0x19b0 [ocfs2]
mount_bdev+0x185/0x1b0
legacy_get_tree+0x27/0x40
vfs_get_tree+0x25/0xb0
path_mount+0x454/0xa20
__x64_sys_mount+0x103/0x140
do_syscall_64+0x3b/0xc0
entry_SYSCALL_64_after_hwframe+0x44/0xae--- fs/ocfs2/super.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/ocfs2/super.c +10 -4
@@ -2189,11 +2189,17 @@ static int ocfs2_initialize_super(struct }if (ocfs2_clusterinfo_valid (osb)) { +/* +* ci_stack and ci_cluster in ocfs2_cluster_info may not be null +* terminated, so make sure no overflow happens here by using +* memcpy. Destination strings will always be null terminated +* because osb is allocated using kzalloc. +*/ osb->osb_stackflags =OCFS2_RAW_SB (di)->s_cluster_info.ci_stackflags; -strlcpy (osb->osb_cluster_stack, +memcpy (osb->osb_cluster_stack,OCFS2_RAW_SB (di)->s_cluster_info.ci_stack, -OCFS2_STACK_LABEL_LEN +1 ); +OCFS2_STACK_LABEL_LEN );if (strlen (osb->osb_cluster_stack) !=OCFS2_STACK_LABEL_LEN ) {mlog (ML_ERROR , "couldn't mount because of an invalid "
@@ -2202,9 +2208,9 @@ static int ocfs2_initialize_super(struct status = -EINVAL ; goto bail; } -strlcpy (osb->osb_cluster_name, +memcpy (osb->osb_cluster_name,OCFS2_RAW_SB (di)->s_cluster_info.ci_cluster, -OCFS2_CLUSTER_NAME_LEN +1 ); +OCFS2_CLUSTER_NAME_LEN ); }else {/* The empty string is identical with classic tools that * don't know about s_cluster_info. */
Greg Kroah-Hartman
maintainerPATCH 36/50 elfcore: correct reference to CONFIG_UML
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
commit b0e901280d9860a0a35055f220e8e457f300f40a upstream.
Commit 6e7b64b9dd6d ("elfcore: fix building with clang") introduces special handling for two architectures, ia64 and User Mode Linux. However, the wrong name, i.e., CONFIG_UM, for the intended Kconfig symbol for User-Mode Linux was used.
Although the directory for User Mode Linux is ./arch/um; the Kconfig symbol for this architecture is called CONFIG_UML.
Luckily, ./scripts/checkkconfigsymbols.py warns on non-existing configs:
UM
Referencing files: include/linux/elfcore.h
Similar symbols: UML, NUMA
Correct the name of the config to the intended one.
--- include/linux/elfcore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/elfcore.h +1 -1
@@ -55,7 +55,7 @@ static inline int elf_core_copy_task_xfp }#endif -#if defined(CONFIG_UM ) || defined(CONFIG_IA64 ) +#if (defined(CONFIG_UML ) && defined(CONFIG_X86_32 )) || defined(CONFIG_IA64 )/* * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out * extra segments containing the gate DSO contents. Dumping its
Greg Kroah-Hartman
maintainerPATCH 37/50 vfs: check fd has read access in kernel_read_file_from_fd()
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 032146cda85566abcd1c4884d9d23e4e30a07e9a upstream.
If we open a file without read access and then pass the fd to a syscall whose implementation calls kernel_read_file_from_fd(), we get a warning from __kernel_read():
if (WARN_ON_ONCE(!(file->f_mode & FMODE_READ)))
This currently affects both finit_module() and kexec_file_load(), but it could affect other syscalls in the future.
--- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c +1 -1
@@ -994,7 +994,7 @@ int kernel_read_file_from_fd(int fd, voistruct fd f =fdget (fd);int ret = -EBADF ; -if (!f.file) +if (!f.file || !(f.file->f_mode &FMODE_READ )) goto out; ret =kernel_read_file (f.file, buf, size, max_size, id);
Greg Kroah-Hartman
maintainerPATCH 38/50 ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headset
In reply to Greg Kroah-HartmanFrom: Brendan Grieve <[email protected]>
commit 3c414eb65c294719a91a746260085363413f91c1 upstream.
As per discussion at: https://github.com/szszoke/sennheiser-gsp670-pulseaudio-profile/issues/13
The GSP670 has 2 playback and 1 recording device that by default are detected in an incompatible order for alsa. This may have been done to make it compatible for the console by the manufacturer and only affects the latest firmware which uses its own ID.
This quirk will resolve this by reordering the channels.
--- sound/usb/quirks-table.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
sound/usb/quirks-table.h +32 -0
@@ -3446,5 +3446,37 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge } } }, +{ +/* +* Sennheiser GSP670 +* Change order of interfaces loaded +*/ + USB_DEVICE(0x1395, 0x0300), + .bInterfaceClass = USB_CLASS_PER_INTERFACE, + .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = &(const struct snd_usb_audio_quirk []) { +// Communication + { + .ifnum =3 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, +// Recording + { + .ifnum =4 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, +// Main + { + .ifnum =1 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum =-1 + } + } + } +}, #undef USB_DEVICE_VENDOR_SPEC
Greg Kroah-Hartman
maintainerPATCH 39/50 ASoC: DAPM: Fix missing kctl change notifications
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 5af82c81b2c49cfb1cad84d9eb6eab0e3d1c4842 upstream.
The put callback of a kcontrol is supposed to return 1 when the value is changed, and this will be notified to user-space. However, some DAPM kcontrols always return 0 (except for errors), hence the user-space misses the update of a control value.
This patch corrects the behavior by properly returning 1 when the value gets updated.
--- sound/soc/soc-dapm.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
sound/soc/soc-dapm.c +8 -5
@@ -2410,6 +2410,7 @@ static int snd_soc_dapm_set_pin(struct s const char *pin, int status) {struct snd_soc_dapm_widget *w =dapm_find_widget (dapm, pin, true); +int ret =0 ;dapm_assert_locked (dapm);
@@ -2422,13 +2423,14 @@ static int snd_soc_dapm_set_pin(struct sdapm_mark_dirty (w,"pin configuration" );dapm_widget_invalidate_input_paths (w);dapm_widget_invalidate_output_paths (w); + ret =1 ; } w->connected = status;if (status ==0 ) w->force =0 ; -return 0 ; +return ret; }/**
@@ -3323,14 +3325,15 @@ int snd_soc_dapm_put_pin_switch(struct s {struct snd_soc_card *card =snd_kcontrol_chip (kcontrol);const char *pin = (const char *)kcontrol->private_value; +int ret;if (ucontrol->value.integer.value[0 ]) -snd_soc_dapm_enable_pin (&card->dapm, pin); + ret =snd_soc_dapm_enable_pin (&card->dapm, pin);else -snd_soc_dapm_disable_pin (&card->dapm, pin); + ret =snd_soc_dapm_disable_pin (&card->dapm, pin);snd_soc_dapm_sync (&card->dapm); -return 0 ; +return ret; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_pin_switch);
@@ -3706,7 +3709,7 @@ static int snd_soc_dapm_dai_link_put(str w->params_select = ucontrol->value.enumerated.item[0 ]; -return 0 ; +return 1 ; } int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
Greg Kroah-Hartman
maintainerPATCH 40/50 nfc: nci: fix the UAF of rf_conn_info object
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
commit 1b1499a817c90fd1ce9453a2c98d2a01cca0e775 upstream.
The nci_core_conn_close_rsp_packet() function will release the conn_info with given conn_id. However, it needs to set the rf_conn_info to NULL to prevent other routines like nci_rf_intf_activated_ntf_packet() to trigger the UAF.
--- net/nfc/nci/rsp.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/nci/rsp.c +2 -0
@@ -289,6 +289,8 @@ static void nci_core_conn_close_rsp_pack ndev->cur_conn_id);if (conn_info) {list_del (&conn_info->list); +if (conn_info == ndev->rf_conn_info) + ndev->rf_conn_info =NULL ;devm_kfree (&ndev->nfc_dev->dev, conn_info); } }
Greg Kroah-Hartman
maintainerPATCH 41/50 isdn: cpai: check ctr->cnr to avoid array index out of bound
In reply to Greg Kroah-HartmanFrom: Xiaolong Huang <[email protected]>
commit 1f3e2e97c003f80c4b087092b225c8787ff91e4d upstream.
The cmtp_add_connection() would add a cmtp session to a controller and run a kernel thread to process cmtp.
__module_get(THIS_MODULE); session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", session->num);
During this process, the kernel thread would call detach_capi_ctr() to detach a register controller. if the controller
was not attached yet, detach_capi_ctr() would
trigger an array-index-out-bounds bug.
[ 46.866069][ T6479] UBSAN: array-index-out-of-bounds in drivers/isdn/capi/kcapi.c:483:21 [ 46.867196][ T6479] index -1 is out of range for type 'capi_ctr *[32]' [ 46.867982][ T6479] CPU: 1 PID: 6479 Comm: kcmtpd_ctr_0 Not tainted 5.15.0-rc2+ #8 [ 46.869002][ T6479] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 [ 46.870107][ T6479] Call Trace: [ 46.870473][ T6479] dump_stack_lvl+0x57/0x7d [ 46.870974][ T6479] ubsan_epilogue+0x5/0x40 [ 46.871458][ T6479] __ubsan_handle_out_of_bounds.cold+0x43/0x48 [ 46.872135][ T6479] detach_capi_ctr+0x64/0xc0 [ 46.872639][ T6479] cmtp_session+0x5c8/0x5d0 [ 46.873131][ T6479] ? __init_waitqueue_head+0x60/0x60 [ 46.873712][ T6479] ? cmtp_add_msgpart+0x120/0x120 [ 46.874256][ T6479] kthread+0x147/0x170 [ 46.874709][ T6479] ? set_kthread_struct+0x40/0x40 [ 46.875248][ T6479] ret_from_fork+0x1f/0x30 [ 46.875773][ T6479]
--- drivers/isdn/capi/kcapi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/isdn/capi/kcapi.c +5 -0
@@ -564,6 +564,11 @@ int detach_capi_ctr(struct capi_ctr *ctrctr_down (ctr,CAPI_CTR_DETACHED ); +if (ctr->cnr <1 || ctr->cnr -1 >=CAPI_MAXCONTR ) { + err = -EINVAL ; + goto unlock_out; + } +if (capi_controller[ctr->cnr -1 ] != ctr) { err = -EINVAL ; goto unlock_out;
Greg Kroah-Hartman
maintainerPATCH 42/50 netfilter: Kconfig: use default y instead of m for bool config option
In reply to Greg Kroah-HartmanFrom: Vegard Nossum <[email protected]>
commit 77076934afdcd46516caf18ed88b2f88025c9ddb upstream.
This option, NF_CONNTRACK_SECMARK, is a bool, so it can never be 'm'.
--- net/netfilter/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/Kconfig +1 -1
@@ -71,7 +71,7 @@ config NF_CONNTRACK_MARK config NF_CONNTRACK_SECMARK bool 'Connection tracking security mark support' depends on NETWORK_SECMARK - default m if NETFILTER_ADVANCED=n + default y if NETFILTER_ADVANCED=n help This option enables security markings to be applied to connections. Typically they are copied to connections from
Greg Kroah-Hartman
maintainerPATCH 43/50 ARM: dts: spear3xx: Fix gmac node
In reply to Greg Kroah-HartmanFrom: Herve Codina <[email protected]>
[ Upstream commit 6636fec29cdf6665bd219564609e8651f6ddc142 ]
On SPEAr3xx, ethernet driver is not compatible with the SPEAr600 one.
Indeed, SPEAr3xx uses an earlier version of this IP (v3.40) and needs some driver tuning compare to SPEAr600.
The v3.40 IP support was added to stmmac driver and this patch fixes this issue and use the correct compatible string for SPEAr3xx
--- arch/arm/boot/dts/spear3xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/spear3xx.dtsi +1 -1
@@ -53,7 +53,7 @@ }; gmac: eth@e0800000 { - compatible = "st,spear600-gmac"; + compatible = "snps,dwmac-3.40a"; reg = <0xe0800000 0x8000>; interrupts = <23 22>; interrupt-names = "macirq", "eth_wake_irq";
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 44/50 isdn: mISDN: Fix sleeping function called from invalid context
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 6510e80a0b81b5d814e3aea6297ba42f5e76f73c ]
The driver can call card->isac.release() function from an atomic context.
Fix this by calling this function after releasing the lock.
The following log reveals it:
[ 44.168226 ] BUG: sleeping function called from invalid context at kernel/workqueue.c:3018 [ 44.168941 ] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 5475, name: modprobe [ 44.169574 ] INFO: lockdep is turned off. [ 44.169899 ] irq event stamp: 0 [ 44.170160 ] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [ 44.170627 ] hardirqs last disabled at (0): [<ffffffff814209ed>] copy_process+0x132d/0x3e00 [ 44.171240 ] softirqs last enabled at (0): [<ffffffff81420a1a>] copy_process+0x135a/0x3e00 [ 44.171852 ] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 44.172318 ] Preemption disabled at: [ 44.172320 ] [<ffffffffa009b0a9>] nj_release+0x69/0x500 [netjet] [ 44.174441 ] Call Trace: [ 44.174630 ] dump_stack_lvl+0xa8/0xd1 [ 44.174912 ] dump_stack+0x15/0x17 [ 44.175166 ] ___might_sleep+0x3a2/0x510 [ 44.175459 ] ? nj_release+0x69/0x500 [netjet] [ 44.175791 ] __might_sleep+0x82/0xe0 [ 44.176063 ] ? start_flush_work+0x20/0x7b0 [ 44.176375 ] start_flush_work+0x33/0x7b0 [ 44.176672 ] ? trace_irq_enable_rcuidle+0x85/0x170 [ 44.177034 ] ? kasan_quarantine_put+0xaa/0x1f0 [ 44.177372 ] ? kasan_quarantine_put+0xaa/0x1f0 [ 44.177711 ] __flush_work+0x11a/0x1a0 [ 44.177991 ] ? flush_work+0x20/0x20 [ 44.178257 ] ? lock_release+0x13c/0x8f0 [ 44.178550 ] ? __kasan_check_write+0x14/0x20 [ 44.178872 ] ? do_raw_spin_lock+0x148/0x360 [ 44.179187 ] ? read_lock_is_recursive+0x20/0x20 [ 44.179530 ] ? __kasan_check_read+0x11/0x20 [ 44.179846 ] ? do_raw_spin_unlock+0x55/0x900 [ 44.180168 ] ? ____kasan_slab_free+0x116/0x140 [ 44.180505 ] ? _raw_spin_unlock_irqrestore+0x41/0x60 [ 44.180878 ] ? skb_queue_purge+0x1a3/0x1c0 [ 44.181189 ] ? kfree+0x13e/0x290 [ 44.181438 ] flush_work+0x17/0x20 [ 44.181695 ] mISDN_freedchannel+0xe8/0x100 [ 44.182006 ] isac_release+0x210/0x260 [mISDNipac] [ 44.182366 ] nj_release+0xf6/0x500 [netjet] [ 44.182685 ] nj_remove+0x48/0x70 [netjet] [ 44.182989 ] pci_device_remove+0xa9/0x250
--- drivers/isdn/hardware/mISDN/netjet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/hardware/mISDN/netjet.c +1 -1
@@ -963,8 +963,8 @@ nj_release(struct tiger_hw *card)nj_disable_hwirq (card);mode_tiger (&card->bc[0 ],ISDN_P_NONE );mode_tiger (&card->bc[1 ],ISDN_P_NONE ); - card->isac.release (&card->isac);spin_unlock_irqrestore (&card->lock, flags); + card->isac.release (&card->isac);release_region (card->base, card->base_s); card->base_s =0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 45/50 platform/x86: intel_scu_ipc: Update timeout value in comment
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
[ Upstream commit a0c5814b9933f25ecb6de169483c5b88cf632bca ]
The comment decribing the IPC timeout hadn't been updated when the actual timeout was changed from 3 to 5 seconds in
commit a7d53dbbc70a ("platform/x86: intel_scu_ipc: Increase virtual timeout from 3 to 5 seconds") .
Since the value is anyway updated to 10s now, take this opportunity to update the value in the comment too.
--- drivers/platform/x86/intel_scu_ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel_scu_ipc.c +1 -1
@@ -187,7 +187,7 @@ static inline int busy_loop(struct intel_scu_ipc_dev *scu)return 0 ; } -/* Wait till ipc ioc interrupt is received or timeout in 3 HZ */ +/* Wait till ipc ioc interrupt is received or timeout in 10 HZ */ static inline int ipc_wait_for_interrupt (struct intel_scu_ipc_dev *scu) {int status;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 46/50 ALSA: hda: avoid write to STATESTS if controller is in reset
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit b37a15188eae9d4c49c5bb035e0c8d4058e4d9b3 ]
The snd_hdac_bus_reset_link() contains logic to clear STATESTS register before performing controller reset. This code dates back to an old bugfix in commit e8a7f136f5ed ("[ALSA] hda-intel - Improve HD-audio codec probing robustness"). Originally the code was added to azx_reset().
The code was moved around in commit a41d122449be ("ALSA: hda - Embed bus into controller object") and ended up to snd_hdac_bus_reset_link() and called primarily via snd_hdac_bus_init_chip().
The logic to clear STATESTS is correct when snd_hdac_bus_init_chip() is called when controller is not in reset. In this case, STATESTS can be cleared. This can be useful e.g. when forcing a controller reset to retry codec probe. A normal non-power-on reset will not clear the bits.
However, this old logic is problematic when controller is already in reset. The HDA specification states that controller must be taken out of reset before writing to registers other than GCTL.CRST (1.0a spec, 3.3.7). The write to STATESTS in snd_hdac_bus_reset_link() will be lost if the controller is already in reset per the HDA specification mentioned.
This has been harmless on older hardware. On newer generation of Intel PCIe based HDA controllers, if configured to report issues, this write will emit an unsupported request error. If ACPI Platform Error Interface (APEI) is enabled in kernel, this will end up to kernel log.
Fix the code in snd_hdac_bus_reset_link() to only clear the STATESTS if the function is called when controller is not in reset. Otherwise clearing the bits is not possible and should be skipped.
--- sound/hda/hdac_controller.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/hda/hdac_controller.c +3 -2
@@ -389,8 +389,9 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)if (!full_reset) goto skip_reset; -/* clear STATESTS */ -snd_hdac_chip_writew (bus,STATESTS ,STATESTS_INT_MASK ); +/* clear STATESTS if not in reset */ +if (snd_hdac_chip_readb (bus,GCTL ) &AZX_GCTL_RESET ) +snd_hdac_chip_writew (bus,STATESTS ,STATESTS_INT_MASK );/* reset controller */ snd_hdac_bus_enter_link_reset (bus);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 47/50 usbnet: sanity check for maxpacket
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 397430b50a363d8b7bdda00522123f82df6adc5e upstream.
maxpacket of 0 makes no sense and oopses as we need to divide by it. Give up.
V2: fixed typo in log and stylistic issues
--- drivers/net/usb/usbnet.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/usbnet.c +4 -0
@@ -1740,6 +1740,10 @@ usbnet_probe (struct usb_interface *udevif (!dev->rx_urb_size) dev->rx_urb_size = dev->hard_mtu; dev->maxpacket =usb_maxpacket (dev->udev, dev->out,1 ); +if (dev->maxpacket ==0 ) { +/* that is a broken device */ + goto out4; + }/* let userspace know we have a random address */ if (ether_addr_equal (net->dev_addr, node_id))
Greg Kroah-Hartman
maintainerPATCH 48/50 net: mdiobus: Fix memory leak in __mdiobus_register
In reply to Greg Kroah-HartmanFrom: Yanfei Xu <[email protected]>
commit ab609f25d19858513919369ff3d9a63c02cd9e2e upstream.
Once device_register() failed, we should call put_device() to decrement reference count for cleanup. Or it will cause memory leak.
BUG: memory leak
unreferenced object 0xffff888114032e00 (size 256):
comm "kworker/1:3", pid 2960, jiffies 4294943572 (age 15.920s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 2e 03 14 81 88 ff ff ................
08 2e 03 14 81 88 ff ff 90 76 65 82 ff ff ff ff .........ve.....
backtrace:
[<ffffffff8265cfab>] kmalloc include/linux/slab.h:591 [inline]
[<ffffffff8265cfab>] kzalloc include/linux/slab.h:721 [inline]
[<ffffffff8265cfab>] device_private_init drivers/base/core.c:3203 [inline]
[<ffffffff8265cfab>] device_add+0x89b/0xdf0 drivers/base/core.c:3253
[<ffffffff828dd643>] __mdiobus_register+0xc3/0x450 drivers/net/phy/mdio_bus.c:537
[<ffffffff828cb835>] __devm_mdiobus_register+0x75/0xf0 drivers/net/phy/mdio_devres.c:87
[<ffffffff82b92a00>] ax88772_init_mdio drivers/net/usb/asix_devices.c:676 [inline]
[<ffffffff82b92a00>] ax88772_bind+0x330/0x480 drivers/net/usb/asix_devices.c:786
[<ffffffff82baa33f>] usbnet_probe+0x3ff/0xdf0 drivers/net/usb/usbnet.c:1745
[<ffffffff82c36e17>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<ffffffff82661d17>] call_driver_probe drivers/base/dd.c:517 [inline]
[<ffffffff82661d17>] really_probe.part.0+0xe7/0x380 drivers/base/dd.c:596
[<ffffffff826620bc>] really_probe drivers/base/dd.c:558 [inline]
[<ffffffff826620bc>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:751
[<ffffffff826621ba>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:781
[<ffffffff82662a26>] __device_attach_driver+0xf6/0x140 drivers/base/dd.c:898
[<ffffffff8265eca7>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
[<ffffffff826625a2>] __device_attach+0x122/0x260 drivers/base/dd.c:969
[<ffffffff82660916>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:487
[<ffffffff8265cd0b>] device_add+0x5fb/0xdf0 drivers/base/core.c:3359
[<ffffffff82c343b9>] usb_set_configuration+0x9d9/0xb90 drivers/usb/core/message.c:2170
[<ffffffff82c4473c>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
BUG: memory leak
unreferenced object 0xffff888116f06900 (size 32):
comm "kworker/0:2", pid 2670, jiffies 4294944448 (age 7.160s)
hex dump (first 32 bytes):
75 73 62 2d 30 30 31 3a 30 30 33 00 00 00 00 00 usb-001:003.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81484516>] kstrdup+0x36/0x70 mm/util.c:60
[<ffffffff814845a3>] kstrdup_const+0x53/0x80 mm/util.c:83
[<ffffffff82296ba2>] kvasprintf_const+0xc2/0x110 lib/kasprintf.c:48
[<ffffffff82358d4b>] kobject_set_name_vargs+0x3b/0xe0 lib/kobject.c:289
[<ffffffff826575f3>] dev_set_name+0x63/0x90 drivers/base/core.c:3147
[<ffffffff828dd63b>] __mdiobus_register+0xbb/0x450 drivers/net/phy/mdio_bus.c:535
[<ffffffff828cb835>] __devm_mdiobus_register+0x75/0xf0 drivers/net/phy/mdio_devres.c:87
[<ffffffff82b92a00>] ax88772_init_mdio drivers/net/usb/asix_devices.c:676 [inline]
[<ffffffff82b92a00>] ax88772_bind+0x330/0x480 drivers/net/usb/asix_devices.c:786
[<ffffffff82baa33f>] usbnet_probe+0x3ff/0xdf0 drivers/net/usb/usbnet.c:1745
[<ffffffff82c36e17>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<ffffffff82661d17>] call_driver_probe drivers/base/dd.c:517 [inline]
[<ffffffff82661d17>] really_probe.part.0+0xe7/0x380 drivers/base/dd.c:596
[<ffffffff826620bc>] really_probe drivers/base/dd.c:558 [inline]
[<ffffffff826620bc>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:751
[<ffffffff826621ba>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:781
[<ffffffff82662a26>] __device_attach_driver+0xf6/0x140 drivers/base/dd.c:898
[<ffffffff8265eca7>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
[<ffffffff826625a2>] __device_attach+0x122/0x260 drivers/base/dd.c:969--- drivers/net/phy/mdio_bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/mdio_bus.c +1 -0
@@ -326,6 +326,7 @@ int __mdiobus_register(struct mii_bus *b err =device_register (&bus->dev);if (err) {pr_err ("mii_bus %s failed to register\n" , bus->id); +put_device (&bus->dev);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 49/50 tracing: Have all levels of checks prevent recursion
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit ed65df63a39a3f6ed04f7258de8b6789e5021c18 upstream.
While writing an email explaining the "bit = 0" logic for a discussion on making ftrace_test_recursion_trylock() disable preemption, I discovered a path that makes the "not do the logic if bit is zero" unsafe.
The recursion logic is done in hot paths like the function tracer. Thus, any code executed causes noticeable overhead. Thus, tricks are done to try to limit the amount of code executed. This included the recursion testing logic.
Having recursion testing is important, as there are many paths that can end up in an infinite recursion cycle when tracing every function in the kernel. Thus protection is needed to prevent that from happening.
Because it is OK to recurse due to different running context levels (e.g. an interrupt preempts a trace, and then a trace occurs in the interrupt handler), a set of bits are used to know which context one is in (normal, softirq, irq and NMI). If a recursion occurs in the same level, it is prevented*.
Then there are infrastructure levels of recursion as well. When more than one callback is attached to the same function to trace, it calls a loop function to iterate over all the callbacks. Both the callbacks and the loop function have recursion protection. The callbacks use the "ftrace_test_recursion_trylock()" which has a "function" set of context bits to test, and the loop function calls the internal trace_test_and_set_recursion() directly, with an "internal" set of bits.
If an architecture does not implement all the features supported by ftrace then the callbacks are never called directly, and the loop function is called instead, which will implement the features of ftrace.
Since both the loop function and the callbacks do recursion protection, it was seemed unnecessary to do it in both locations. Thus, a trick was made to have the internal set of recursion bits at a more significant bit location than the function bits. Then, if any of the higher bits were set, the logic of the function bits could be skipped, as any new recursion would first have to go through the loop function.
This is true for architectures that do not support all the ftrace features, because all functions being traced must first go through the loop function before going to the callbacks. But this is not true for architectures that support all the ftrace features. That's because the loop function could be called due to two callbacks attached to the same function, but then a recursion function inside the callback could be called that does not share any other callback, and it will be called directly.
i.e.
traced_function_1: [ more than one callback tracing it ]
call loop_func
loop_func:
trace_recursion set internal bit
call callback
callback:
trace_recursion [ skipped because internal bit is set, return 0 ] call traced_function_2
traced_function_2: [ only traced by above callback ]
call callback
callback:
trace_recursion [ skipped because internal bit is set, return 0 ] call traced_function_2
[ wash, rinse, repeat, BOOM! out of shampoo! ]
Thus, the "bit == 0 skip" trick is not safe, unless the loop function is call for all functions.
Since we want to encourage architectures to implement all ftrace features, having them slow down due to this extra logic may encourage the maintainers to update to the latest ftrace features. And because this logic is only safe for them, remove it completely.
[*] There is on layer of recursion that is allowed, and that is to allow
for the transition between interrupt context (normal -> softirq ->
irq -> NMI), because a trace may occur before the context update is
visible to the trace recursion logic.--- kernel/trace/ftrace.c | 4 +- kernel/trace/trace.h | 64 ++++++++++++----------------------------- kernel/trace/trace_functions.c | 2 - 3 files changed, 23 insertions(+), 47 deletions(-)
kernel/trace/ftrace.c +2 -2
@@ -5288,7 +5288,7 @@ __ftrace_ops_list_func(unsigned long ip,struct ftrace_ops *op;int bit; - bit =trace_test_and_set_recursion (TRACE_LIST_START ,TRACE_LIST_MAX ); + bit =trace_test_and_set_recursion (TRACE_LIST_START );if (bit <0 )return ;
@@ -5363,7 +5363,7 @@ static void ftrace_ops_assist_func(unsig {int bit; - bit =trace_test_and_set_recursion (TRACE_LIST_START ,TRACE_LIST_MAX ); + bit =trace_test_and_set_recursion (TRACE_LIST_START );if (bit <0 )return ;
kernel/trace/trace.h +20 -44
138 lines not on this page · raw message
kernel/trace/trace_functions.c +1 -1
@@ -137,7 +137,7 @@ function_trace_call(unsigned long ip, un pc =preempt_count ();preempt_disable_notrace (); - bit =trace_test_and_set_recursion (TRACE_FTRACE_START ,TRACE_FTRACE_MAX ); + bit =trace_test_and_set_recursion (TRACE_FTRACE_START );if (bit <0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 50/50 ARM: 9122/1: select HAVE_FUTEX_CMPXCHG
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit 9d417cbe36eee7afdd85c2e871685f8dab7c2dba upstream.
tglx notes:
This function [futex_detect_cmpxchg] is only needed when an architecture has to runtime discover whether the CPU supports it or not. ARM has unconditional support for this, so the obvious thing to do is the below.
Fixes linkage failure from Clang randconfigs:
kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text' and boot failures for CONFIG_THUMB2_KERNEL.
Comments from Nick Desaulniers:
See-also: 03b8c7b623c8 ("futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test")
--- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
@@ -55,6 +55,7 @@ config ARM select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL) select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_GENERIC_DMA_COHERENT select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +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/v4.x/stable-review/patch-4.9.288-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +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/v4.x/stable-review/patch-4.9.288-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
32 tests: 32 pass, 0 failLinux version: 4.9.288-rc1-g668dc542cb38
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +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/v4.x/stable-review/patch-4.9.288-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 4.9.288-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-4.9.y
* git commit: 668dc542cb3809809a8ed643f9c717f8f5146890
* git describe: v4.9.287-51-g668dc542cb38
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.9.y/build/v4.9.287-51-g668dc542cb38
## No regressions (compared to v4.9.287-47-g0e4a453b84fe)
## No fixes (compared to v4.9.287-47-g0e4a453b84fe)
## Test result summary
total: 66578, pass: 52090, fail: 593, skip: 11947, xfail: 1948
## Build Summary
* arm: 129 total, 129 passed, 0 failed
* arm64: 34 total, 34 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 18 total, 18 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 22 total, 22 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 18 total, 18 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-arm64/arm64.btitest.bti_c_func
* kselftest-arm64/arm64.btitest.bti_j_func
* kselftest-arm64/arm64.btitest.bti_jc_func
* kselftest-arm64/arm64.btitest.bti_none_func
* kselftest-arm64/arm64.btitest.nohint_func
* kselftest-arm64/arm64.btitest.paciasp_func
* kselftest-arm64/arm64.nobtitest.bti_c_func
* kselftest-arm64/arm64.nobtitest.bti_j_func
* kselftest-arm64/arm64.nobtitest.bti_jc_func
* kselftest-arm64/arm64.nobtitest.bti_none_func
* kselftest-arm64/arm64.nobtitest.nohint_func
* kselftest-arm64/arm64.nobtitest.paciasp_func
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-net
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.288-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Upgrading to Ubuntu 21.10 caused issues with the boot related to zstd compression which is the default initramfs.conf for 21.10
If others run into this:
Changing the default to lz4 is the answer for 4.9
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.288 release. There are 50 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 Wed, 27 Oct 2021 19:07:44 +0000. Anything received after that time might be too late.
Build results:
total: 163 pass: 163 fail: 0 Qemu test results: total: 394 pass: 394 fail: 0
Guenter