5.4.243-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 1/282 counter: 104-quad-8: Fix race condition between FLAG and CNTR reads
In reply to Greg Kroah-HartmanFrom: William Breathitt Gray <[email protected]>
commit 4aa3b75c74603c3374877d5fd18ad9cc3a9a62ed upstream.
The Counter (CNTR) register is 24 bits wide, but we can have an effective 25-bit count value by setting bit 24 to the XOR of the Borrow flag and Carry flag. The flags can be read from the FLAG register, but a race condition exists: the Borrow flag and Carry flag are instantaneous and could change by the time the count value is read from the CNTR register.
Since the race condition could result in an incorrect 25-bit count value, remove support for 25-bit count values from this driver; hard-coded maximum count values are replaced by a LS7267_CNTR_MAX define for consistency and clarity.
--- drivers/counter/104-quad-8.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-)
drivers/counter/104-quad-8.c +4 -26
@@ -57,10 +57,6 @@ struct quad8_iio {#define QUAD8_REG_CHAN_OP 0x11#define QUAD8_REG_INDEX_INPUT_LEVELS 0x16 -/* Borrow Toggle flip-flop */ -#define QUAD8_FLAG_BT BIT(0) -/* Carry Toggle flip-flop */ -#define QUAD8_FLAG_CT BIT(1)/* Error flag */ #define QUAD8_FLAG_E BIT(4)/* Up/Down flag */
@@ -97,9 +93,6 @@ static int quad8_read_raw(struct iio_dev {struct quad8_iio *const priv =iio_priv (indio_dev);const int base_offset = priv->base +2 * chan->channel; -unsigned int flags; -unsigned int borrow; -unsigned int carry;int i;switch (mask) {
@@ -110,12 +103,7 @@ static int quad8_read_raw(struct iio_devreturn IIO_VAL_INT ; } - flags =inb (base_offset +1 ); - borrow = flags &QUAD8_FLAG_BT ; - carry = !!(flags &QUAD8_FLAG_CT ); - -/* Borrow XOR Carry effectively doubles count range */ - *val = (borrow ^ carry) <<24 ; + *val =0 ;mutex_lock (&priv->lock);
@@ -639,19 +627,9 @@ static int quad8_count_read(struct count {struct quad8_iio *const priv = counter->priv;const int base_offset = priv->base +2 * count->id; -unsigned int flags; -unsigned int borrow; -unsigned int carry; -unsigned long position; +unsigned long position =0 ;int i; - flags =inb (base_offset +1 ); - borrow = flags &QUAD8_FLAG_BT ; - carry = !!(flags &QUAD8_FLAG_CT ); - -/* Borrow XOR Carry effectively doubles count range */ - position = (unsigned long )(borrow ^ carry) <<24 ; -mutex_lock (&priv->lock);/* Reset Byte Pointer; transfer Counter to Output Latch */
@@ -1204,8 +1182,8 @@ static ssize_t quad8_count_ceiling_read(mutex_unlock (&priv->lock); -/* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ -return sprintf (buf,"33554431\n" ); +/* By default 0xFFFFFF (24 bits unsigned) is maximum count */ +return sprintf (buf,"16777215\n" ); } static ssize_t quad8_count_ceiling_write(struct counter_device *counter,
Greg Kroah-Hartman
maintainerPATCH 2/282 wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
In reply to Greg Kroah-HartmanFrom: Jisoo Jang <[email protected]>
commit 0da40e018fd034d87c9460123fa7f897b69fdee7 upstream.
Fix a slab-out-of-bounds read that occurs in kmemdup() called from brcmf_get_assoc_ies().
The bug could occur when assoc_info->req_len, data from a URB provided by a USB device, is bigger than the size of buffer which is defined as WL_EXTRA_BUF_MAX.
Add the size check for req_len/resp_len of assoc_info.
Found by a modified version of syzkaller.
[ 46.592467][ T7] ================================================================== [ 46.594687][ T7] BUG: KASAN: slab-out-of-bounds in kmemdup+0x3e/0x50 [ 46.596572][ T7] Read of size 3014656 at addr ffff888019442000 by task kworker/0:1/7 [ 46.598575][ T7] [ 46.599157][ T7] CPU: 0 PID: 7 Comm: kworker/0:1 Tainted: G O 5.14.0+ #145 [ 46.601333][ T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 46.604360][ T7] Workqueue: events brcmf_fweh_event_worker [ 46.605943][ T7] Call Trace: [ 46.606584][ T7] dump_stack_lvl+0x8e/0xd1 [ 46.607446][ T7] print_address_description.constprop.0.cold+0x93/0x334 [ 46.608610][ T7] ? kmemdup+0x3e/0x50 [ 46.609341][ T7] kasan_report.cold+0x79/0xd5 [ 46.610151][ T7] ? kmemdup+0x3e/0x50 [ 46.610796][ T7] kasan_check_range+0x14e/0x1b0 [ 46.611691][ T7] memcpy+0x20/0x60 [ 46.612323][ T7] kmemdup+0x3e/0x50 [ 46.612987][ T7] brcmf_get_assoc_ies+0x967/0xf60 [ 46.613904][ T7] ? brcmf_notify_vif_event+0x3d0/0x3d0 [ 46.614831][ T7] ? lock_chain_count+0x20/0x20 [ 46.615683][ T7] ? mark_lock.part.0+0xfc/0x2770 [ 46.616552][ T7] ? lock_chain_count+0x20/0x20 [ 46.617409][ T7] ? mark_lock.part.0+0xfc/0x2770 [ 46.618244][ T7] ? lock_chain_count+0x20/0x20 [ 46.619024][ T7] brcmf_bss_connect_done.constprop.0+0x241/0x2e0 [ 46.620019][ T7] ? brcmf_parse_configure_security.isra.0+0x2a0/0x2a0 [ 46.620818][ T7] ? __lock_acquire+0x181f/0x5790 [ 46.621462][ T7] brcmf_notify_connect_status+0x448/0x1950 [ 46.622134][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 46.622736][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0 [ 46.623390][ T7] ? find_held_lock+0x2d/0x110 [ 46.623962][ T7] ? brcmf_fweh_event_worker+0x19f/0xc60 [ 46.624603][ T7] ? mark_held_locks+0x9f/0xe0 [ 46.625145][ T7] ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0 [ 46.625871][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0 [ 46.626545][ T7] brcmf_fweh_call_event_handler.isra.0+0x90/0x100 [ 46.627338][ T7] brcmf_fweh_event_worker+0x557/0xc60 [ 46.627962][ T7] ? brcmf_fweh_call_event_handler.isra.0+0x100/0x100 [ 46.628736][ T7] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 46.629396][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 46.629970][ T7] ? lockdep_hardirqs_on_prepare+0x273/0x3e0 [ 46.630649][ T7] process_one_work+0x92b/0x1460 [ 46.631205][ T7] ? pwq_dec_nr_in_flight+0x330/0x330 [ 46.631821][ T7] ? rwlock_bug.part.0+0x90/0x90 [ 46.632347][ T7] worker_thread+0x95/0xe00 [ 46.632832][ T7] ? __kthread_parkme+0x115/0x1e0 [ 46.633393][ T7] ? process_one_work+0x1460/0x1460 [ 46.633957][ T7] kthread+0x3a1/0x480 [ 46.634369][ T7] ? set_kthread_struct+0x120/0x120 [ 46.634933][ T7] ret_from_fork+0x1f/0x30 [ 46.635431][ T7] [ 46.635687][ T7] Allocated by task 7: [ 46.636151][ T7] kasan_save_stack+0x1b/0x40 [ 46.636628][ T7] __kasan_kmalloc+0x7c/0x90 [ 46.637108][ T7] kmem_cache_alloc_trace+0x19e/0x330 [ 46.637696][ T7] brcmf_cfg80211_attach+0x4a0/0x4040 [ 46.638275][ T7] brcmf_attach+0x389/0xd40 [ 46.638739][ T7] brcmf_usb_probe+0x12de/0x1690 [ 46.639279][ T7] usb_probe_interface+0x2aa/0x760 [ 46.639820][ T7] really_probe+0x205/0xb70 [ 46.640342][ T7] __driver_probe_device+0x311/0x4b0 [ 46.640876][ T7] driver_probe_device+0x4e/0x150 [ 46.641445][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.642000][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.642543][ T7] __device_attach+0x23f/0x3a0 [ 46.643065][ T7] bus_probe_device+0x1da/0x290 [ 46.643644][ T7] device_add+0xb7b/0x1eb0 [ 46.644130][ T7] usb_set_configuration+0xf59/0x16f0 [ 46.644720][ T7] usb_generic_driver_probe+0x82/0xa0 [ 46.645295][ T7] usb_probe_device+0xbb/0x250 [ 46.645786][ T7] really_probe+0x205/0xb70 [ 46.646258][ T7] __driver_probe_device+0x311/0x4b0 [ 46.646804][ T7] driver_probe_device+0x4e/0x150 [ 46.647387][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.647926][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.648454][ T7] __device_attach+0x23f/0x3a0 [ 46.648939][ T7] bus_probe_device+0x1da/0x290 [ 46.649478][ T7] device_add+0xb7b/0x1eb0 [ 46.649936][ T7] usb_new_device.cold+0x49c/0x1029 [ 46.650526][ T7] hub_event+0x1c98/0x3950 [ 46.650975][ T7] process_one_work+0x92b/0x1460 [ 46.651535][ T7] worker_thread+0x95/0xe00 [ 46.651991][ T7] kthread+0x3a1/0x480 [ 46.652413][ T7] ret_from_fork+0x1f/0x30 [ 46.652885][ T7] [ 46.653131][ T7] The buggy address belongs to the object at ffff888019442000 [ 46.653131][ T7] which belongs to the cache kmalloc-2k of size 2048 [ 46.654669][ T7] The buggy address is located 0 bytes inside of [ 46.654669][ T7] 2048-byte region [ffff888019442000, ffff888019442800) [ 46.656137][ T7] The buggy address belongs to the page: [ 46.656720][ T7] page:ffffea0000651000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19440 [ 46.657792][ T7] head:ffffea0000651000 order:3 compound_mapcount:0 compound_pincount:0 [ 46.658673][ T7] flags: 0x100000000010200(slab|head|node=0|zone=1) [ 46.659422][ T7] raw: 0100000000010200 0000000000000000 dead000000000122 ffff888100042000 [ 46.660363][ T7] raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 [ 46.661236][ T7] page dumped because: kasan: bad access detected [ 46.661956][ T7] page_owner tracks the page as allocated [ 46.662588][ T7] page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 7, ts 31136961085, free_ts 0 [ 46.664271][ T7] prep_new_page+0x1aa/0x240 [ 46.664763][ T7] get_page_from_freelist+0x159a/0x27c0 [ 46.665340][ T7] __alloc_pages+0x2da/0x6a0 [ 46.665847][ T7] alloc_pages+0xec/0x1e0 [ 46.666308][ T7] allocate_slab+0x380/0x4e0 [ 46.666770][ T7] ___slab_alloc+0x5bc/0x940 [ 46.667264][ T7] __slab_alloc+0x6d/0x80 [ 46.667712][ T7] kmem_cache_alloc_trace+0x30a/0x330 [ 46.668299][ T7] brcmf_usbdev_qinit.constprop.0+0x50/0x470 [ 46.668885][ T7] brcmf_usb_probe+0xc97/0x1690 [ 46.669438][ T7] usb_probe_interface+0x2aa/0x760 [ 46.669988][ T7] really_probe+0x205/0xb70 [ 46.670487][ T7] __driver_probe_device+0x311/0x4b0 [ 46.671031][ T7] driver_probe_device+0x4e/0x150 [ 46.671604][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.672192][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.672739][ T7] page_owner free stack trace missing [ 46.673335][ T7] [ 46.673620][ T7] Memory state around the buggy address: [ 46.674213][ T7] ffff888019442700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 46.675083][ T7] ffff888019442780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 46.675994][ T7] >ffff888019442800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.676875][ T7] ^ [ 46.677323][ T7] ffff888019442880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.678190][ T7] ffff888019442900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.679052][ T7] ================================================================== [ 46.679945][ T7] Disabling lock debugging due to kernel taint [ 46.680725][ T7] Kernel panic - not syncing:
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +5 -0
@@ -5466,6 +5466,11 @@ static s32 brcmf_get_assoc_ies(struct br (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf; req_len =le32_to_cpu (assoc_info->req_len); resp_len =le32_to_cpu (assoc_info->resp_len); +if (req_len >WL_EXTRA_BUF_MAX || resp_len >WL_EXTRA_BUF_MAX ) { +bphy_err (drvr,"invalid lengths in assoc info: req %u resp %u\n" , + req_len, resp_len); +return -EINVAL ; + }if (req_len) { err = brcmf_fil_iovar_data_get(ifp, "assoc_req_ies", cfg->extra_buf,
Greg Kroah-Hartman
maintainerPATCH 3/282 drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
In reply to Greg Kroah-HartmanFrom: Daniel Vetter <[email protected]>
commit 1935f0deb6116dd785ea64d8035eab0ff441255b upstream.
Drivers are supposed to fix this up if needed if they don't outright reject it. Uncovered by 6c11df58fd1a ("fbmem: Check virtual screen sizes in fb_set_var()").
--- drivers/gpu/drm/drm_fb_helper.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +3 -0
@@ -1340,6 +1340,9 @@ int drm_fb_helper_check_var(struct fb_vareturn -EINVAL ; } + var->xres_virtual = fb->width; + var->yres_virtual = fb->height; +/* * Workaround for SDL 1.2, which is known to be setting all pixel format * fields values to zero in some cases. We treat this situation as a
Greg Kroah-Hartman
maintainerPATCH 4/282 bluetooth: Perform careful capability checks in hci_sock_ioctl()
In reply to Greg Kroah-HartmanFrom: Ruihan Li <[email protected]>
commit 25c150ac103a4ebeed0319994c742a90634ddf18 upstream.
Previously, capability was checked using capable(), which verified that the caller of the ioctl system call had the required capability. In addition, the result of the check would be stored in the HCI_SOCK_TRUSTED flag, making it persistent for the socket.
However, malicious programs can abuse this approach by deliberately sharing an HCI socket with a privileged task. The HCI socket will be marked as trusted when the privileged task occasionally makes an ioctl call.
This problem can be solved by using sk_capable() to check capability, which ensures that not only the current task but also the socket opener has the specified capability, thus reducing the risk of privilege escalation through the previously identified vulnerability.
--- net/bluetooth/hci_sock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/hci_sock.c +8 -1
@@ -989,7 +989,14 @@ static int hci_sock_ioctl(struct socketif (hci_sock_gen_cookie (sk)) {struct sk_buff *skb; -if (capable (CAP_NET_ADMIN )) +/* Perform careful checks before setting the HCI_SOCK_TRUSTED +* flag. Make sure that not only the current task but also +* the socket opener has the required capability, since +* privileged programs can be tricked into making ioctl calls +* on HCI sockets, and the socket should not be marked as +* trusted simply because the ioctl caller is privileged. +*/ +if (sk_capable (sk,CAP_NET_ADMIN ))hci_sock_set_flag (sk,HCI_SOCK_TRUSTED );/* Send event to monitor */
Greg Kroah-Hartman
maintainerPATCH 5/282 USB: serial: option: add UNISOC vendor and TOZED LT70C product
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
commit a095edfc15f0832e046ae23964e249ef5c95af87 upstream.
Add UNISOC vendor ID and TOZED LT70-C modem which is based from UNISOC SL8563. The modem supports the NCM mode. Interface 0 is used for running the AT commands. Interface 12 is the ADB interface.
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1782 ProdID=4055 Rev=04.04 S: Manufacturer=Unisoc Phone S: Product=Unisoc Phone S: SerialNumber=<redacted> C: #Ifs=14 Cfg#= 1 Atr=c0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=10 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=11 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=12 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=13 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 3 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=86(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=88(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -595,6 +595,11 @@ static void option_instat_callback(struc#define SIERRA_VENDOR_ID 0x1199#define SIERRA_PRODUCT_EM9191 0x90d3 +/* UNISOC (Spreadtrum) products */ +#define UNISOC_VENDOR_ID 0x1782 +/* TOZED LT70-C based on UNISOC SL8563 uses UNISOC's vendor ID */ +#define TOZED_PRODUCT_LT70C 0x4055 +/* Device flags */ /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -2225,6 +2230,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg Kroah-Hartman
maintainerPATCH 6/282 iio: adc: palmas_gpadc: fix NULL dereference on rmmod
In reply to Greg Kroah-HartmanFrom: Patrik Dahlström <[email protected]>
[ Upstream commit 49f76c499d38bf67803438eee88c8300d0f6ce09 ]
Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL.
--- drivers/iio/adc/palmas_gpadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/palmas_gpadc.c +1 -1
@@ -630,7 +630,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev)static int palmas_gpadc_remove (struct platform_device *pdev) { -struct iio_dev *indio_dev =dev_to_iio_dev (&pdev->dev); +struct iio_dev *indio_dev =dev_get_drvdata (&pdev->dev);struct palmas_gpadc *adc =iio_priv (indio_dev);if (adc->wakeup1_enable || adc->wakeup2_enable)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainercover 5.4.243-rc1 review
This is the start of the stable review cycle for the 5.4.243 release. There are 282 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, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.243-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.243-rc1
Aurabindo Pillai <[email protected]>
drm/amd/display: Fix hang when skipping modeset
Tetsuo Handa <[email protected]>
mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock
Tian Tao <[email protected]>
drm/exynos: move to use request_irq by IRQF_NO_AUTOEN flag
Akhil P Oommen <[email protected]>
drm/msm/adreno: Fix null ptr access in adreno_gpu_cleanup()
Yang Yingliang <[email protected]>
firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe()
Maximilian Luz <[email protected]>
drm/msm: Fix double pm_runtime_disable() call
Zhang Qilong <[email protected]>
spi: imx: fix reference leak in two imx operations
Sascha Hauer <[email protected]>
spi: imx: fix runtime pm support for !CONFIG_PM
Geert Uytterhoeven <[email protected]>
PM: domains: Restore comment indentation for generic_pm_domain.child_links
Tetsuo Handa <[email protected]>
printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
Lukas Wunner <[email protected]>
PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock
Hans de Goede <[email protected]>
PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors
Christoph Böhmwalder <[email protected]>
drbd: correctly submit flush bio on barrier
Ilpo Järvinen <[email protected]>
serial: 8250: Fix serial8250_tx_empty() race with DMA Tx
Ilpo Järvinen <[email protected]>
tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH
Theodore Ts'o <[email protected]>
ext4: fix invalid free tracking in ext4_xattr_move_to_block()
Theodore Ts'o <[email protected]>
ext4: remove a BUG_ON in ext4_mb_release_group_pa()
Theodore Ts'o <[email protected]>
ext4: bail out of ext4_xattr_ibody_get() fails for any reason
Theodore Ts'o <[email protected]>
ext4: add bounds checking in get_max_inline_xattr_value_size()
Theodore Ts'o <[email protected]>
ext4: fix deadlock when converting an inline directory in nojournal mode
Theodore Ts'o <[email protected]>
ext4: improve error recovery code paths in __ext4_remount()
Jan Kara <[email protected]>
ext4: fix data races when using cached status extents
Tudor Ambarus <[email protected]>
ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
Ye Bin <[email protected]>
ext4: fix WARNING in mb_find_extent
Ping Cheng <[email protected]>
HID: wacom: insert timestamp to packed Bluetooth (BT) events
Ping Cheng <[email protected]>
HID: wacom: Set a default resolution for older tablets
Guchun Chen <[email protected]>
drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend
Guchun Chen <[email protected]>
drm/amdgpu/gfx: disable gfx9 cp_ecc_error_irq only when enabling legacy gfx ras
Hamza Mahfooz <[email protected]>
drm/amdgpu: fix an amdgpu_irq_put() issue in gmc_v9_0_hw_fini()
James Cowgill <[email protected]>
drm/panel: otm8009a: Set backlight parent to panel device
Jaegeuk Kim <[email protected]>
f2fs: fix potential corruption when moving a directory
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: correct MIPI CSIS clock name
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: fix WM8960 clock name in Itop Elite
Mathieu Poirier <[email protected]>
remoteproc: st: Call of_node_put() on iteration error
Mathieu Poirier <[email protected]>
remoteproc: stm32: Call of_node_put() on iteration error
Randy Dunlap <[email protected]>
sh: nmi_debug: fix return value of __setup handler
Randy Dunlap <[email protected]>
sh: init: use OF_EARLY_FLATTREE for early init
Randy Dunlap <[email protected]>
sh: math-emu: fix macro redefined warning
Jan Kara <[email protected]>
inotify: Avoid reporting event with invalid wd
Andrey Avdeev <[email protected]>
platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i
Pawel Witek <[email protected]>
cifs: fix pcchunk length type in smb2_copychunk_range
Anastasia Belova <[email protected]>
btrfs: print-tree: parent bytenr must be aligned to sector size
Josef Bacik <[email protected]>
btrfs: don't free qgroup space unless specified
Filipe Manana <[email protected]>
btrfs: fix btrfs_prev_leaf() to not return the same key twice
Yang Jihong <[email protected]>
perf symbols: Fix return incorrect build_id size in elf_read_build_id()
Markus Elfring <[email protected]>
perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()
Kajol Jain <[email protected]>
perf vendor events power9: Remove UTF-8 characters from JSON files
Florian Fainelli <[email protected]>
net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
Wenliang Wang <[email protected]>
virtio_net: suppress cpu stall when free_unused_bufs
Xuan Zhuo <[email protected]>
virtio_net: split free_unused_bufs()
Arınç ÜNAL <[email protected]>
net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL MT7621
Ruliang Lin <[email protected]>
ALSA: caiaq: input: Add error handling for unsupported input methods in snd_usb_caiaq_input_init
Chia-I Wu <[email protected]>
drm/amdgpu: add a missing lock for AMDGPU_SCHED
Kuniyuki Iwashima <[email protected]>
af_packet: Don't send zero-byte data in packet_sendmsg_spkt().
Shannon Nelson <[email protected]>
ionic: remove noise from ethtool rxnfc error msg
David Howells <[email protected]>
rxrpc: Fix hard call timeout units
Victor Nogueira <[email protected]>
net/sched: act_mirred: Add carrier check
Maxim Korotkov <[email protected]>
writeback: fix call of incorrect macro
Angelo Dureghello <[email protected]>
net: dsa: mv88e6xxx: add mv88e6321 rsvd2cpu
Cong Wang <[email protected]>
sit: update dev->needed_headroom in ipip6_tunnel_bind_dev()
Vlad Buslov <[email protected]>
net/sched: cls_api: remove block_cb from driver_list before freeing
Cosmo Chou <[email protected]>
net/ncsi: clear Tx enable mode when handling a Config required AEN
Zhang Zhengming <[email protected]>
relayfs: fix out-of-bounds access in relay_file_read
Pengcheng Yang <[email protected]>
kernel/relay.c: fix read_pos error when multiple readers
Jonathan McDowell <[email protected]>
crypto: safexcel - Cleanup ring IRQ workqueues on load failure
Sven Auhagen <[email protected]>
crypto: inside-secure - irq balance
Yeongjin Gil <[email protected]>
dm verity: fix error handling for check_at_most_once on FEC
Akilesh Kailash <[email protected]>
dm verity: skip redundant verity_handle_err() on I/O errors
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix counts of child nodes
Christophe JAILLET <[email protected]>
mailbox: zynq: Switch to flexible array to simplify code
Joel Fernandes (Google) <[email protected]>
tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
Frederic Weisbecker <[email protected]>
nohz: Add TICK_DEP_BIT_RCU
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: deactivate anonymous set from preparation phase
Thomas Gleixner <[email protected]>
debugobject: Ensure pool refill (again)
Adrian Hunter <[email protected]>
perf intel-pt: Fix CYC timestamps after standalone CBR
Adrian Hunter <[email protected]>
perf auxtrace: Fix address filter entire kernel size
Mike Snitzer <[email protected]>
dm ioctl: fix nested locking in table_clear() to remove deadlock concern
Mikulas Patocka <[email protected]>
dm flakey: fix a crash with invalid table line
Mike Snitzer <[email protected]>
dm integrity: call kmem_cache_destroy() in dm_integrity_init() error path
Mike Snitzer <[email protected]>
dm clone: call kmem_cache_destroy() in dm_clone_init() error path
Stefan Haberland <[email protected]>
s390/dasd: fix hanging blockdevice after request requeue
Qu Wenruo <[email protected]>
btrfs: scrub: reject unsupported scrub flags
Peng Liu <[email protected]>
scripts/gdb: fix lx-timerlist for Python3
Quentin Schulz <[email protected]>
clk: rockchip: rk3399: allow clk_cifout to force clk_cifout_src to reparent
Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: RTL8192EU always needs full init
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix typo in IPI documentation
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix IPI isr handling
Li Nan <[email protected]>
md/raid10: fix null-ptr-deref in raid10_sync_request
Ryusuke Konishi <[email protected]>
nilfs2: fix infinite loop in nilfs_mdt_get_block()
Ryusuke Konishi <[email protected]>
nilfs2: do not write dirty data after degenerating to read-only
Helge Deller <[email protected]>
parisc: Fix argument pointer in real64_call_asm()
Marc Dionne <[email protected]>
afs: Fix updating of i_size with dv jump from server
Claudiu Beznea <[email protected]>
dmaengine: at_xdmac: do not enable all cyclic channels
Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing
Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to change for continuous transfer
Gaosheng Cui <[email protected]>
phy: tegra: xusb: Add missing tegra_xusb_port_unregister for usb2_port and ulpi_port
AngeloGioacchino Del Regno <[email protected]>
pwm: mtk-disp: Disable shadow registers before setting backlight values
Jitao Shi <[email protected]>
pwm: mtk-disp: Adjust the clocks to avoid them mismatch
Uwe Kleine-König <[email protected]>
pwm: mtk-disp: Don't check the return code of pwmchip_remove()
Christophe JAILLET <[email protected]>
dmaengine: mv_xor_v2: Fix an error code.
Randy Dunlap <[email protected]>
leds: TI_LMU_COMMON: select REGMAP instead of depending on it
Ye Bin <[email protected]>
ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline
Stafford Horne <[email protected]>
openrisc: Properly store r31 to pt_regs on unhandled exceptions
Qinrun Dai <[email protected]>
clocksource/drivers/davinci: Fix memory leak in davinci_timer_register when init fails
Christophe JAILLET <[email protected]>
clocksource: davinci: axe a pointless __GFP_NOFAIL
Christophe JAILLET <[email protected]>
clocksource/drivers/davinci: Avoid trailing '\n' hidden in pr_fmt()
Mark Zhang <[email protected]>
RDMA/mlx5: Use correct device num_ports when modify DC
Dai Ngo <[email protected]>
SUNRPC: remove the maximum number of retries in call_bind_status
Miaoqian Lin <[email protected]>
Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe
Nicolas Saenz Julienne <[email protected]>
input: raspberrypi-ts: Release firmware handle when not needed
Nicolas Saenz Julienne <[email protected]>
firmware: raspberrypi: Introduce devm_rpi_firmware_get()
Nicolas Saenz Julienne <[email protected]>
firmware: raspberrypi: Keep count of all consumers
Trond Myklebust <[email protected]>
NFSv4.1: Always send a RECLAIM_COMPLETE after establishing lease
Patrick Kelsey <[email protected]>
IB/hfi1: Fix SDMA mmu_rb_node not being evicted in LRU order
Tetsuo Handa <[email protected]>
RDMA/siw: Remove namespace check from siw_netdev_event()
Clément Léger <[email protected]>
clk: add missing of_node_put() in "assigned-clocks" property parsing
Sebastian Reichel <[email protected]>
power: supply: generic-adc-battery: fix unit scaling
Martin Blumenstingl <[email protected]>
rtc: meson-vrtc: Use ktime_get_real_ts64() to get the current time
Dan Carpenter <[email protected]>
RDMA/mlx4: Prevent shift wrapping in set_user_sq_size()
Krzysztof Kozlowski <[email protected]>
rtc: omap: include header for omap_rtc_power_off_program prototype
Natalia Petrova <[email protected]>
RDMA/rdmavt: Delete unnecessary NULL check
Daniil Dulov <[email protected]>
RDMA/siw: Fix potential page_array out of range access
Yang Jihong <[email protected]>
perf/core: Fix hardlockup failure caused by perf throttle
Nathan Lynch <[email protected]>
powerpc/rtas: use memmove for potentially overlapping buffer copy
Randy Dunlap <[email protected]>
macintosh: via-pmu-led: requires ATA to be set
Randy Dunlap <[email protected]>
powerpc/sysdev/tsi108: fix resource printk format warnings
Randy Dunlap <[email protected]>
powerpc/wii: fix resource printk format warnings
Randy Dunlap <[email protected]>
powerpc/mpc512x: fix resource printk format warning
Liang He <[email protected]>
macintosh/windfarm_smu_sat: Add missing of_node_put()
Jishnu Prakash <[email protected]>
spmi: Add a check for remove callback when removing a SPMI driver
Philipp Hortmann <[email protected]>
staging: rtl8192e: Fix W_DISABLE# does not work after stop/start
Florian Fainelli <[email protected]>
serial: 8250: Add missing wakeup event reporting
Shenwei Wang <[email protected]>
tty: serial: fsl_lpuart: adjust buffer length to the intended size
Dan Carpenter <[email protected]>
firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe
Chunfeng Yun <[email protected]>
usb: mtu3: fix kernel panic at qmu transfer done irq handler
Yinhao Hu <[email protected]>
usb: chipidea: fix missing goto in ci_hdrc_probe
John Paul Adrian Glaubitz <[email protected]>
sh: sq: Fix incorrect element size for allocating bitmap buffer
Kevin Brodsky <[email protected]>
uapi/linux/const.h: prefer ISO-friendly __typeof__
Dhruva Gole <[email protected]>
spi: cadence-quadspi: fix suspend-resume implementations
Vignesh Raghavendra <[email protected]>
mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel
Vignesh Raghavendra <[email protected]>
mtd: spi-nor: cadence-quadspi: Don't initialize rx_dma_complete on failure
Vignesh Raghavendra <[email protected]>
mtd: spi-nor: cadence-quadspi: Provide a way to disable DAC mode
Vignesh Raghavendra <[email protected]>
mtd: spi-nor: cadence-quadspi: Make driver independent of flash geometry
Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no generic PD
Kees Cook <[email protected]>
PM: domains: Fix up terminology with parent/child
Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no clocks
Randy Dunlap <[email protected]>
ia64: salinfo: placate defined-but-not-used warning
Randy Dunlap <[email protected]>
ia64: mm/contig: fix section mismatch warning/error
Miquel Raynal <[email protected]>
of: Fix modalias string generation
Dae R. Jeong <[email protected]>
vmci_host: fix a race condition in vmci_host_poll() causing GPF
Christophe Leroy <[email protected]>
spi: fsl-spi: Fix CPM/QE mode Litte Endian
Uwe Kleine-König <[email protected]>
spi: qup: Don't skip cleanup in remove's error path
Randy Dunlap <[email protected]>
linux/vt_buffer.h: allow either builtin or modular for macros
Cristian Ciocaltea <[email protected]>
ASoC: es8316: Handle optional IRQ assignment
Hans de Goede <[email protected]>
ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ
Barry Song <[email protected]>
genirq: Add IRQF_NO_AUTOEN for request_irq/nmi()
H. Nikolaus Schaller <[email protected]>
PCI: imx6: Install the fault handler only on compatible match
Zheng Wang <[email protected]>
usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
Uwe Kleine-König <[email protected]>
spi: imx: Don't skip cleanup in remove's error path
Minghao Chi <[email protected]>
spi: spi-imx: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Clark Wang <[email protected]>
spi: imx: enable runtime pm support
Linus Walleij <[email protected]>
spi: imx/fsl-lpspi: Convert to GPIO descriptors
Krzysztof Kozlowski <[email protected]>
iio: light: max44009: add missing OF device matching
Marco Pagani <[email protected]>
fpga: bridge: fix kernel-doc parameter description
Wolfram Sang <[email protected]>
usb: host: xhci-rcar: remove leftover quirk handling
John Stultz <[email protected]>
pstore: Revert pmsg_lock back to a normal mutex
Kuniyuki Iwashima <[email protected]>
tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.
Gencen Gan <[email protected]>
net: amd: Fix link leak when verifying config failed
Kuniyuki Iwashima <[email protected]>
netlink: Use copy_to_user() for optval in netlink_getsockopt().
Liu Jian <[email protected]>
Revert "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"
Ziyang Xuan <[email protected]>
ipv4: Fix potential uninit variable access bug in __ip_make_skb()
Florian Westphal <[email protected]>
netfilter: nf_tables: don't write table validation state without mutex
Stanislav Fomichev <[email protected]>
bpf: Don't EFAULT for getsockopt with optval=NULL
Joe Damato <[email protected]>
ixgbe: Enable setting RSS table to default values
Joe Damato <[email protected]>
ixgbe: Allow flow hash to be set via ethtool
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: check firmware response size
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: make the loop for card preparation effective
Yu Kuai <[email protected]>
md/raid10: fix memleak of md thread
Christoph Hellwig <[email protected]>
md: update the optimal I/O size on reshape
Yu Kuai <[email protected]>
md/raid10: fix memleak for 'conf->bio_split'
Yu Kuai <[email protected]>
md/raid10: fix leak of 'r10bio->remaining' for recovery
Daniel Borkmann <[email protected]>
bpf, sockmap: Revert buggy deadlock fix in the sockhash and sockmap
Ming Lei <[email protected]>
nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage"Keith Busch <[email protected]>
nvme: fix async event trace event
Michael Kelley <[email protected]>
nvme: handle the persistent internal error AER
Xin Liu <[email protected]>
bpf, sockmap: fix deadlocks in the sockhash and sockmap
Shuchang Li <[email protected]>
scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()
Herbert Xu <[email protected]>
crypto: drbg - Only fail when jent is unavailable in FIPS mode
Nicolai Stange <[email protected]>
crypto: drbg - make drbg_prepare_hrng() handle jent instantiation errors
Quentin Monnet <[email protected]>
bpftool: Fix bug for long instructions in program CFG dumps
Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()
Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()
Larry Finger <[email protected]>
rtlwifi: Replace RT_TRACE with rtl_dbg
Larry Finger <[email protected]>
rtlwifi: Start changing RT_TRACE into rtl_dbg
Yangtao Li <[email protected]>
f2fs: handle dqget error in f2fs_transfer_project_quota()
Danila Chernetsov <[email protected]>
scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS
Mike Christie <[email protected]>
scsi: target: iscsit: Fix TAS handling during conn cleanup
Eric Dumazet <[email protected]>
net/packet: convert po->auxdata to an atomic flag
Eric Dumazet <[email protected]>
net/packet: convert po->origdev to an atomic flag
Eric Dumazet <[email protected]>
net/packet: annotate accesses to po->xmit
Vadim Fedorenko <[email protected]>
vlan: partially enable SIOCSHWTSTAMP in container
Alexander Mikhalitsyn <[email protected]>
scm: fix MSG_CTRUNC setting condition for SO_PASSSEC
Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
Luis Gerhorst <[email protected]>
tools: bpftool: Remove invalid \' json escape
Fedor Pchelkin <[email protected]>
wifi: ath6kl: reduce WARN to dev_dbg() in callback
Dan Carpenter <[email protected]>
wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()
Fedor Pchelkin <[email protected]>
wifi: ath9k: hif_usb: fix memory leak of remain_skbs
Alexey V. Vissarionov <[email protected]>
wifi: ath6kl: minor fix for allocation size
Sebastian Andrzej Siewior <[email protected]>
tick/common: Align tick period with the HZ tick.
Thomas Gleixner <[email protected]>
tick: Get rid of tick_period
Thomas Gleixner <[email protected]>
tick/sched: Optimize tick_do_update_jiffies64() further
Yunfeng Ye <[email protected]>
tick/sched: Reduce seqcount held scope in tick_do_update_jiffies64()
Thomas Gleixner <[email protected]>
tick/sched: Use tick_next_period for lockless quick check
Thomas Gleixner <[email protected]>
timekeeping: Split jiffies seqlock
Thomas Gleixner <[email protected]>
debugobject: Prevent init race with static objects
Sumit Garg <[email protected]>
arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step
Saurabh Sengar <[email protected]>
x86/ioapic: Don't return 0 from arch_dynirq_lower_bound()
YAN SHI <[email protected]>
regulator: stm32-pwr: fix of_iomap leak
Florian Fainelli <[email protected]>
media: rc: gpio-ir-recv: Fix support for wake-up
Miaoqian Lin <[email protected]>
media: rcar_fdp1: Fix refcount leak in probe and remove function
Tang Bin <[email protected]>
media: rcar_fdp1: Fix the correct variable assignments
Cai Huoqing <[email protected]>
media: rcar_fdp1: Make use of the helper function devm_platform_ioremap_resource()
Mauro Carvalho Chehab <[email protected]>
media: rcar_fdp1: fix pm_runtime_get_sync() usage count
Mauro Carvalho Chehab <[email protected]>
media: rcar_fdp1: simplify error check logic at fdp_open()
Zheng Wang <[email protected]>
media: saa7134: fix use after free bug in saa7134_finidev due to race condition
Zheng Wang <[email protected]>
media: dm1105: Fix use after free bug in dm1105_remove due to race condition
Uros Bizjak <[email protected]>
x86/apic: Fix atomic update of offset in reserve_eilvt_offset()
Douglas Anderson <[email protected]>
regulator: core: Avoid lockdep reports when resolving supplies
Douglas Anderson <[email protected]>
regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
Harshit Mogalapalli <[email protected]>
drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()
Georgii Kruglov <[email protected]>
mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
Johan Hovold <[email protected]>
drm/msm/adreno: drop bogus pm_runtime_set_active()
Rob Clark <[email protected]>
drm/msm/adreno: Defer enabling runpm until hw_init()
Jonathan Marek <[email protected]>
drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}Mukesh Ojha <[email protected]>
firmware: qcom_scm: Clear download bit during reboot
Dan Carpenter <[email protected]>
media: av7110: prevent underflow in write_ts_to_decoder()
Dafna Hirschfeld <[email protected]>
media: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.
Jiasheng Jiang <[email protected]>
media: bdisp: Add missing check for create_workqueue
Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq8064: Fix the PCI I/O port range
Christian Marangi <[email protected]>
ARM: dts: qcom: ipq8064: reduce pci IO size to 64K
Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq4019: Fix the PCI I/O port range
Qiuxu Zhuo <[email protected]>
EDAC/skx: Fix overflows on the DRAM row address mapping arrays
Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table
Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table
Dom Cobley <[email protected]>
drm/probe-helper: Cancel previous job before starting new one
Maíra Canal <[email protected]>
drm/vgem: add missing mutex_destroy
Rob Clark <[email protected]>
drm/rockchip: Drop unbalanced obj unref
Jingbo Xu <[email protected]>
erofs: fix potential overflow calculating xattr_isize
Gao Xiang <[email protected]>
erofs: stop parsing non-compact HEAD index if clusterofs is invalid
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Do not skip reset of original interrupt vector
Paul Moore <[email protected]>
selinux: ensure av_permissions.h is built when needed
Ondrej Mosnacek <[email protected]>
selinux: fix Makefile dependencies of flask.h
Mårten Lindahl <[email protected]>
ubifs: Free memory for tmpfile name
Wang YanQing <[email protected]>
ubi: Fix return value overwrite issue in try_write_vid_and_data()
Zhihao Cheng <[email protected]>
ubifs: Fix memleak when insert_old_idx() failed
Zhihao Cheng <[email protected]>
Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
Reid Tonking <[email protected]>
i2c: omap: Fix standard mode false ACK readings
Sean Christopherson <[email protected]>
KVM: nVMX: Emulate NOPs in L2, and PAUSE if it's not intercepted
Roberto Sassu <[email protected]>
reiserfs: Add security prefix to xattr name in reiserfs_security_write()
Johannes Berg <[email protected]>
ring-buffer: Sync IRQ works before buffer destruction
Heiner Kallweit <[email protected]>
pwm: meson: Fix g12a ao clk81 name
Heiner Kallweit <[email protected]>
pwm: meson: Fix axg ao mux parents
Kees Cook <[email protected]>
kheaders: Use array declaration instead of char
Zhang Yuchen <[email protected]>
ipmi: fix SSIF not responding under certain cond.
Corey Minyard <[email protected]>
ipmi:ssif: Add send_retries increment
Jiaxun Yang <[email protected]>
MIPS: fw: Allow firmware to pass a empty env
Johan Hovold <[email protected]>
xhci: fix debugfs register accesses while suspended
Geert Uytterhoeven <[email protected]>
debugfs: regset32: Add Runtime PM support
Nuno Sá <[email protected]>
staging: iio: resolver: ads1210: fix config mode
Arnaldo Carvalho de Melo <[email protected]>
perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE)
Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on unbind
Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on probe errors
Randy Dunlap <[email protected]>
IMA: allow/fix UML builds
Vladimir Oltean <[email protected]>
asm-generic/io.h: suppress endianness warnings for readq() and writeq()
Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750
Patrik Dahlström <[email protected]>
iio: adc: palmas_gpadc: fix NULL dereference on rmmod
Arınç ÜNAL <[email protected]>
USB: serial: option: add UNISOC vendor and TOZED LT70C product
Ruihan Li <[email protected]>
bluetooth: Perform careful capability checks in hci_sock_ioctl()
Daniel Vetter <[email protected]>
drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
Jisoo Jang <[email protected]>
wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
William Breathitt Gray <[email protected]>
counter: 104-quad-8: Fix race condition between FLAG and CNTR reads
-------------
Diffstat:
Documentation/media/uapi/v4l/subdev-formats.rst | 27 ++ Makefile | 4 +- arch/arm/boot/dts/exynos4412-itop-elite.dts | 2 +- arch/arm/boot/dts/qcom-ipq4019.dtsi | 4 +- arch/arm/boot/dts/qcom-ipq8064.dtsi | 12 +- arch/arm/boot/dts/s5pv210.dtsi | 2 +- arch/arm/mach-imx/devices-imx27.h | 10 +- arch/arm/mach-imx/devices-imx31.h | 10 +- arch/arm/mach-imx/devices/devices-common.h | 5 +- arch/arm/mach-imx/devices/platform-spi_imx.c | 9 +- arch/arm/mach-imx/mach-mx27_3ds.c | 40 ++- arch/arm/mach-imx/mach-mx31_3ds.c | 13 +- arch/arm/mach-imx/mach-mx31lilly.c | 14 +- arch/arm/mach-imx/mach-mx31lite.c | 19 +- arch/arm/mach-imx/mach-mx31moboard.c | 12 +- arch/arm/mach-imx/mach-pca100.c | 21 +- arch/arm/mach-imx/mach-pcm037_eet.c | 7 +- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 3 - arch/arm64/boot/dts/renesas/r8a77990.dtsi | 3 - arch/arm64/include/asm/debug-monitors.h | 1 + arch/arm64/kernel/debug-monitors.c | 5 + arch/arm64/kernel/kgdb.c | 2 + arch/ia64/kernel/salinfo.c | 2 +- arch/ia64/mm/contig.c | 2 +- arch/mips/fw/lib/cmdline.c | 2 +- arch/openrisc/kernel/entry.S | 6 +- arch/parisc/kernel/real2.S | 5 +- arch/powerpc/kernel/rtas.c | 2 +- arch/powerpc/platforms/512x/clock-commonclk.c | 2 +- arch/powerpc/platforms/embedded6xx/flipper-pic.c | 2 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 2 +- arch/powerpc/platforms/embedded6xx/wii.c | 4 +- arch/powerpc/sysdev/tsi108_pci.c | 5 +- arch/sh/kernel/cpu/sh4/sq.c | 2 +- arch/sh/kernel/head_32.S | 6 +- arch/sh/kernel/nmi_debug.c | 4 +- arch/sh/kernel/setup.c | 4 +- arch/sh/math-emu/sfp-util.h | 4 - arch/x86/kernel/apic/apic.c | 5 +- arch/x86/kernel/apic/io_apic.c | 14 +- arch/x86/kvm/vmx/vmx.c | 15 ++ crypto/drbg.c | 16 +- drivers/base/cpu.c | 3 +- drivers/base/power/domain.c | 194 +++++++------- drivers/base/power/domain_governor.c | 12 +- drivers/block/drbd/drbd_receiver.c | 2 +- drivers/bluetooth/btsdio.c | 1 - drivers/char/ipmi/ipmi_ssif.c | 8 +- drivers/char/tpm/tpm_tis_core.c | 29 +-- drivers/clk/clk-conf.c | 12 +- drivers/clk/rockchip/clk-rk3399.c | 2 +- drivers/clocksource/timer-davinci.c | 48 ++-- drivers/counter/104-quad-8.c | 30 +-- drivers/crypto/inside-secure/safexcel.c | 50 +++- drivers/crypto/inside-secure/safexcel.h | 3 + drivers/dma/at_xdmac.c | 5 +- drivers/dma/dw-edma/dw-edma-core.c | 27 +- drivers/dma/mv_xor_v2.c | 2 +- drivers/edac/skx_base.c | 4 +- drivers/firmware/qcom_scm.c | 3 +- drivers/firmware/raspberrypi.c | 70 ++++- drivers/firmware/stratix10-svc.c | 4 +- drivers/fpga/fpga-bridge.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 - drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 + drivers/gpu/drm/drm_fb_helper.c | 3 + drivers/gpu/drm/drm_probe_helper.c | 5 +- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 7 +- drivers/gpu/drm/lima/lima_drv.c | 6 +- drivers/gpu/drm/msm/adreno/adreno_device.c | 7 +- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 +- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 3 - drivers/gpu/drm/vgem/vgem_fence.c | 1 + drivers/hid/wacom_wac.c | 38 ++- drivers/hid/wacom_wac.h | 1 + drivers/i2c/busses/i2c-omap.c | 2 +- drivers/iio/adc/palmas_gpadc.c | 2 +- drivers/iio/light/max44009.c | 13 +- drivers/infiniband/hw/hfi1/mmu_rb.c | 13 +- drivers/infiniband/hw/mlx4/qp.c | 8 +- drivers/infiniband/hw/mlx5/qp.c | 2 +- drivers/infiniband/sw/rdmavt/qp.c | 2 - drivers/infiniband/sw/siw/siw_main.c | 3 - drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +- drivers/input/touchscreen/raspberrypi-ts.c | 3 +- drivers/leds/Kconfig | 2 +- drivers/macintosh/Kconfig | 1 + drivers/macintosh/windfarm_smu_sat.c | 1 + drivers/mailbox/zynqmp-ipi-mailbox.c | 19 +- drivers/md/dm-clone-target.c | 1 + drivers/md/dm-flakey.c | 4 +- drivers/md/dm-integrity.c | 8 +- drivers/md/dm-ioctl.c | 7 +- drivers/md/dm-verity-target.c | 17 +- drivers/md/raid10.c | 96 +++---- drivers/md/raid5.c | 10 +- drivers/media/pci/dm1105/dm1105.c | 1 + drivers/media/pci/saa7134/saa7134-ts.c | 1 + drivers/media/pci/saa7134/saa7134-vbi.c | 1 + drivers/media/pci/saa7134/saa7134-video.c | 1 + drivers/media/pci/ttpci/av7110_av.c | 4 +- drivers/media/platform/rcar_fdp1.c | 50 ++-- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 + drivers/media/rc/gpio-ir-recv.c | 2 + drivers/misc/vmw_vmci/vmci_host.c | 8 +- drivers/mmc/host/sdhci-of-esdhc.c | 24 +- drivers/mtd/spi-nor/cadence-quadspi.c | 77 +++--- drivers/mtd/ubi/eba.c | 19 +- drivers/net/dsa/mt7530.c | 4 +- drivers/net/dsa/mv88e6xxx/chip.c | 1 + drivers/net/ethernet/amd/nmclan_cs.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 23 +- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- drivers/net/virtio_net.c | 43 ++-- drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- drivers/net/wireless/ath/ath6kl/bmi.c | 2 +- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 4 +- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 ++ .../broadcom/brcm80211/brcmfmac/cfg80211.c | 5 + drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 10 + drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + drivers/net/wireless/realtek/rtlwifi/base.c | 144 +++++------ drivers/net/wireless/realtek/rtlwifi/cam.c | 82 +++--- drivers/net/wireless/realtek/rtlwifi/core.c | 259 +++++++++---------- drivers/net/wireless/realtek/rtlwifi/debug.c | 16 +- drivers/net/wireless/realtek/rtlwifi/debug.h | 11 + drivers/net/wireless/realtek/rtlwifi/efuse.c | 72 +++--- drivers/net/wireless/realtek/rtlwifi/pci.c | 282 ++++++++++----------- drivers/net/wireless/realtek/rtlwifi/ps.c | 98 +++---- drivers/net/wireless/realtek/rtlwifi/regd.c | 18 +- drivers/net/wireless/realtek/rtlwifi/usb.c | 18 +- drivers/net/wireless/realtek/rtw88/mac.c | 8 +- drivers/nvme/host/core.c | 34 ++- drivers/nvme/host/trace.h | 15 +- drivers/nvme/target/fcloop.c | 48 ++-- drivers/of/device.c | 7 +- drivers/pci/controller/dwc/pci-imx6.c | 7 + drivers/pci/hotplug/pciehp.h | 3 + drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 19 +- drivers/pci/hotplug/pciehp_pci.c | 15 ++ drivers/phy/tegra/xusb.c | 2 + drivers/platform/x86/touchscreen_dmi.c | 24 ++ drivers/power/supply/generic-adc-battery.c | 3 + drivers/pwm/pwm-meson.c | 6 +- drivers/pwm/pwm-mtk-disp.c | 98 ++++--- drivers/regulator/core.c | 93 ++++++- drivers/regulator/stm32-pwr.c | 7 +- drivers/remoteproc/st_remoteproc.c | 5 +- drivers/remoteproc/stm32_rproc.c | 6 +- drivers/rtc/rtc-meson-vrtc.c | 4 +- drivers/rtc/rtc-omap.c | 1 + drivers/s390/block/dasd.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 10 +- drivers/scsi/megaraid.c | 1 + drivers/spi/spi-fsl-lpspi.c | 47 +--- drivers/spi/spi-fsl-spi.c | 12 +- drivers/spi/spi-imx.c | 209 +++++++-------- drivers/spi/spi-qup.c | 22 +- drivers/spmi/spmi.c | 3 +- drivers/staging/iio/resolver/ad2s1210.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 + drivers/target/iscsi/iscsi_target.c | 16 +- drivers/tty/serial/8250/8250.h | 12 + drivers/tty/serial/8250/8250_port.c | 16 +- drivers/tty/serial/fsl_lpuart.c | 2 +- drivers/tty/tty_io.c | 4 +- drivers/tty/tty_ioctl.c | 47 +++- drivers/usb/chipidea/core.c | 2 +- drivers/usb/dwc3/core.c | 15 +- drivers/usb/gadget/udc/renesas_usb3.c | 1 + drivers/usb/host/xhci-debugfs.c | 1 + drivers/usb/host/xhci-rcar.c | 3 - drivers/usb/mtu3/mtu3_qmu.c | 5 +- drivers/usb/serial/option.c | 6 + fs/afs/inode.c | 1 + fs/btrfs/block-rsv.c | 3 +- fs/btrfs/ctree.c | 32 ++- fs/btrfs/ioctl.c | 5 + fs/btrfs/print-tree.c | 6 +- fs/cifs/smb2ops.c | 2 +- fs/debugfs/file.c | 8 + fs/erofs/internal.h | 2 +- fs/erofs/zmap.c | 4 + fs/ext4/balloc.c | 25 ++ fs/ext4/extents.c | 3 +- fs/ext4/extents_status.c | 30 +-- fs/ext4/inline.c | 17 +- fs/ext4/mballoc.c | 6 +- fs/ext4/super.c | 19 +- fs/ext4/xattr.c | 5 +- fs/f2fs/file.c | 15 +- fs/f2fs/namei.c | 16 +- fs/fs-writeback.c | 2 +- fs/nfs/nfs4state.c | 4 + fs/nilfs2/bmap.c | 16 +- fs/nilfs2/segment.c | 5 +- fs/notify/inotify/inotify_fsnotify.c | 11 +- fs/pstore/pmsg.c | 7 +- fs/reiserfs/xattr_security.c | 8 +- fs/ubifs/dir.c | 1 + fs/ubifs/tnc.c | 144 ++++++----- include/asm-generic/io.h | 4 +- include/linux/debugfs.h | 1 + include/linux/interrupt.h | 4 + include/linux/mailbox/zynqmp-ipi-message.h | 2 +- include/linux/netfilter/nfnetlink.h | 1 - include/linux/nvme.h | 4 + include/linux/platform_data/spi-imx.h | 33 --- include/linux/pm_domain.h | 12 +- include/linux/printk.h | 19 ++ include/linux/sunrpc/sched.h | 3 +- include/linux/tick.h | 9 +- include/linux/tty.h | 2 + include/linux/vt_buffer.h | 2 +- include/net/netfilter/nf_tables.h | 1 + include/net/scm.h | 13 +- include/soc/bcm2835/raspberrypi-firmware.h | 10 + include/trace/events/timer.h | 3 +- include/uapi/linux/btrfs.h | 1 + include/uapi/linux/const.h | 2 +- include/uapi/linux/media-bus-format.h | 8 + kernel/bpf/cgroup.c | 9 +- kernel/events/core.c | 4 +- kernel/irq/manage.c | 11 +- kernel/kheaders.c | 10 +- kernel/relay.c | 18 +- kernel/time/jiffies.c | 7 +- kernel/time/tick-broadcast.c | 2 +- kernel/time/tick-common.c | 30 ++- kernel/time/tick-internal.h | 1 - kernel/time/tick-sched.c | 127 ++++++---- kernel/time/timekeeping.c | 6 +- kernel/time/timekeeping.h | 3 +- kernel/trace/ring_buffer.c | 4 + lib/debugobjects.c | 141 ++++++----- mm/page_alloc.c | 16 ++ net/8021q/vlan_dev.c | 2 +- net/bluetooth/hci_sock.c | 9 +- net/core/skbuff.c | 3 + net/ipv4/ip_output.c | 16 +- net/ipv6/sit.c | 8 +- net/ncsi/ncsi-aen.c | 1 + net/netfilter/nf_tables_api.c | 20 +- net/netfilter/nfnetlink.c | 2 - net/netfilter/nft_dynset.c | 2 +- net/netfilter/nft_lookup.c | 2 +- net/netfilter/nft_objref.c | 2 +- net/netlink/af_netlink.c | 75 ++---- net/packet/af_packet.c | 32 +-- net/packet/diag.c | 4 +- net/packet/internal.h | 26 +- net/rxrpc/sendmsg.c | 2 +- net/sched/act_mirred.c | 2 +- net/sched/cls_api.c | 1 + net/sunrpc/clnt.c | 3 - net/sunrpc/sched.c | 1 - scripts/gdb/linux/clk.py | 2 + scripts/gdb/linux/genpd.py | 16 +- scripts/gdb/linux/timerlist.py | 4 +- scripts/gdb/linux/utils.py | 5 +- security/integrity/ima/Kconfig | 2 +- security/selinux/Makefile | 4 +- sound/soc/codecs/es8316.c | 17 +- sound/soc/intel/boards/bytcr_rt5640.c | 12 + sound/usb/caiaq/input.c | 1 + tools/bpf/bpftool/json_writer.c | 3 - tools/bpf/bpftool/xlated_dumper.c | 7 + tools/perf/builtin-sched.c | 2 +- .../perf/pmu-events/arch/powerpc/power9/other.json | 4 +- .../pmu-events/arch/powerpc/power9/pipeline.json | 2 +- tools/perf/util/auxtrace.c | 5 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 + tools/perf/util/sort.c | 3 +- tools/perf/util/symbol-elf.c | 2 +- 283 files changed, 2682 insertions(+), 1866 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 8/282 asm-generic/io.h: suppress endianness warnings for readq() and writeq()
From: Vladimir Oltean <[email protected]>
[ Upstream commit d564fa1ff19e893e2971d66e5c8f49dc1cdc8ffc ]
Commit c1d55d50139b ("asm-generic/io.h: Fix sparse warnings on big-endian architectures") missed fixing the 64-bit accessors.
Arnd explains in the attached link why the casts are necessary, even if __raw_readq() and __raw_writeq() do not take endian-specific types.
--- include/asm-generic/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/io.h +2 -2
@@ -190,7 +190,7 @@ static inline u64 readq(const volatile void __iomem *addr)u64 val;__io_br (); - val =__le64_to_cpu (__raw_readq (addr)); + val =__le64_to_cpu ((__le64 __force )__raw_readq (addr));__io_ar (val);return val; }
@@ -233,7 +233,7 @@ static inline void writel(u32 value, volatile void __iomem *addr)static inline void writeq (u64 value,volatile void __iomem *addr) {__io_bw (); -__raw_writeq (__cpu_to_le64 (value), addr); +__raw_writeq ((u64 __force )__cpu_to_le64 (value), addr);__io_aw (); }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 17/282 ipmi:ssif: Add send_retries increment
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
commit 6ce7995a43febe693d4894033c6e29314970646a upstream.
A recent change removed an increment of send_retries, re-add it.
--- drivers/char/ipmi/ipmi_ssif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +3 -1
@@ -562,8 +562,10 @@ static void retry_timeout(struct timer_lif (waiting)start_get (ssif_info); -if (resend) +if (resend) {start_resend (ssif_info); +ssif_inc_stat (ssif_info, send_retries); + } }static void watch_timeout (struct timer_list *t)
Greg Kroah-Hartman
maintainerPATCH 18/282 ipmi: fix SSIF not responding under certain cond.
In reply to Greg Kroah-HartmanFrom: Zhang Yuchen <[email protected]>
commit 6d2555cde2918409b0331560e66f84a0ad4849c6 upstream.
The ipmi communication is not restored after a specific version of BMC is upgraded on our server.
The ipmi driver does not respond after printing the following log:
ipmi_ssif: Invalid response getting flags: 1c 1
I found that after entering this branch, ssif_info->ssif_state always holds SSIF_GETTING_FLAGS and never return to IDLE.
As a result, the driver cannot be loaded, because the driver status is checked during the unload process and must be IDLE in shutdown_ssif():
while (ssif_info->ssif_state != SSIF_IDLE)
schedule_timeout(1);The process trigger this problem is:
1. One msg timeout and next msg start send, and call ssif_set_need_watch().
2. ssif_set_need_watch()->watch_timeout()->start_flag_fetch() change ssif_state to SSIF_GETTING_FLAGS.
3. In msg_done_handler() ssif_state == SSIF_GETTING_FLAGS, if an error message is received, the second branch does not modify the ssif_state.
4. All retry action need IS_SSIF_IDLE() == True. Include retry action in watch_timeout(), msg_done_handler(). Sending msg does not work either. SSIF_IDLE is also checked in start_next_msg().
5. The only thing that can be triggered in the SSIF driver is watch_timeout(), after destory_user(), this timer will stop too.
So, if enter this branch, the ssif_state will remain SSIF_GETTING_FLAGS and can't send msg, no timer started, can't unload.
We did a comparative test before and after adding this patch, and the result is effective.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_ssif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +2 -2
@@ -791,9 +791,9 @@ static void msg_done_handler(struct ssif }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_GET_MSG_FLAGS_CMD ) {/* -* Don't abort here, maybe it was a queued -* response to a previous command. +* Recv error response, give up. */ + ssif_info->ssif_state =SSIF_IDLE ;ipmi_ssif_unlock_cond (ssif_info, flags); dev_warn(&ssif_info->client->dev, "Invalid response getting flags: %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 19/282 kheaders: Use array declaration instead of char
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit b69edab47f1da8edd8e7bfdf8c70f51a2a5d89fb upstream.
Under CONFIG_FORTIFY_SOURCE, memcpy() will check the size of destination and source buffers. Defining kernel_headers_data as "char" would trip this check. Since these addresses are treated as byte arrays, define them as arrays (as done everywhere else).
This was seen with:
$ cat /sys/kernel/kheaders.tar.xz >> /dev/null
detected buffer overflow in memcpy
kernel BUG at lib/string_helpers.c:1027!
...
RIP: 0010:fortify_panic+0xf/0x20 [...] Call Trace: <TASK> ikheaders_read+0x45/0x50 [kheaders] kernfs_fop_read_iter+0x1a4/0x2f0 ...
--- kernel/kheaders.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/kheaders.c +5 -5
@@ -26,15 +26,15 @@ asm (" .popsection \n" ); -extern char kernel_headers_data; -extern char kernel_headers_data_end; +extern char kernel_headers_data[]; +extern char kernel_headers_data_end[];static ssize_t ikheaders_read (struct file *file,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t len) { -memcpy (buf, &kernel_headers_data + off, len); +memcpy (buf, &kernel_headers_data[off], len);return len; }
@@ -48,8 +48,8 @@ static struct bin_attribute kheaders_attr __ro_after_init = {static int __init ikheaders_init (void ) { - kheaders_attr.size = (&kernel_headers_data_end - - &kernel_headers_data); + kheaders_attr.size = (kernel_headers_data_end - + kernel_headers_data);return sysfs_create_bin_file (kernel_kobj, &kheaders_attr); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 20/282 pwm: meson: Fix axg ao mux parents
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
commit eb411c0cf59ae6344b34bc6f0d298a22b300627e upstream.
This fix is basically the same as 9bce02ef0dfa ("pwm: meson: Fix the G12A AO clock parents order"). Vendor driver referenced there has xtal as first parent also for axg ao. In addition fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the axg clock driver.
--- drivers/pwm/pwm-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-meson.c +1 -1
@@ -424,7 +424,7 @@ static const struct meson_pwm_data pwm_a };static const char *const pwm_axg_ao_parent_names[] = { -"aoclk81" ,"xtal" ,"fclk_div4" ,"fclk_div5" +"xtal" ,"axg_ao_clk81" ,"fclk_div4" ,"fclk_div5" };static const struct meson_pwm_data pwm_axg_ao_data = {
Greg Kroah-Hartman
maintainerPATCH 21/282 pwm: meson: Fix g12a ao clk81 name
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
commit 9e4fa80ab7ef9eb4f7b1ea9fc31e0eb040e85e25 upstream.
Fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the g12a clock driver.
--- drivers/pwm/pwm-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-meson.c +2 -2
@@ -433,7 +433,7 @@ static const struct meson_pwm_data pwm_a };static const char *const pwm_g12a_ao_ab_parent_names[] = { -"xtal" ,"aoclk81" ,"fclk_div4" ,"fclk_div5" +"xtal" ,"g12a_ao_clk81" ,"fclk_div4" ,"fclk_div5" };static const struct meson_pwm_data pwm_g12a_ao_ab_data = {
@@ -442,7 +442,7 @@ static const struct meson_pwm_data pwm_g };static const char *const pwm_g12a_ao_cd_parent_names[] = { -"xtal" ,"aoclk81" , +"xtal" ,"g12a_ao_clk81" , };static const struct meson_pwm_data pwm_g12a_ao_cd_data = {
Greg Kroah-Hartman
maintainerPATCH 22/282 ring-buffer: Sync IRQ works before buffer destruction
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 675751bb20634f981498c7d66161584080cc061e upstream.
If something was written to the buffer just before destruction, it may be possible (maybe not in a real system, but it did happen in ARCH=um with time-travel) to destroy the ringbuffer before the IRQ work ran, leading this KASAN report (or a crash without KASAN):
BUG: KASAN: slab-use-after-free in irq_work_run_list+0x11a/0x13a
Read of size 8 at addr 000000006d640a48 by task swapper/0
CPU: 0 PID: 0 Comm: swapper Tainted: G W O 6.3.0-rc1 #7
Stack:
60c4f20f 0c203d48 41b58ab3 60f224fc
600477fa 60f35687 60c4f20f 601273dd
00000008 6101eb00 6101eab0 615be548
Call Trace:
[<60047a58>] show_stack+0x25e/0x282
[<60c609e0>] dump_stack_lvl+0x96/0xfd
[<60c50d4c>] print_report+0x1a7/0x5a8
[<603078d3>] kasan_report+0xc1/0xe9
[<60308950>] __asan_report_load8_noabort+0x1b/0x1d
[<60232844>] irq_work_run_list+0x11a/0x13a
[<602328b4>] irq_work_tick+0x24/0x34
[<6017f9dc>] update_process_times+0x162/0x196
[<6019f335>] tick_sched_handle+0x1a4/0x1c3
[<6019fd9e>] tick_sched_timer+0x79/0x10c
[<601812b9>] __hrtimer_run_queues.constprop.0+0x425/0x695
[<60182913>] hrtimer_interrupt+0x16c/0x2c4
[<600486a3>] um_timer+0x164/0x183
[...]
Allocated by task 411:
save_stack_trace+0x99/0xb5
stack_trace_save+0x81/0x9b
kasan_save_stack+0x2d/0x54
kasan_set_track+0x34/0x3e
kasan_save_alloc_info+0x25/0x28
____kasan_kmalloc+0x8b/0x97
__kasan_kmalloc+0x10/0x12
__kmalloc+0xb2/0xe8
load_elf_phdrs+0xee/0x182
[...]
The buggy address belongs to the object at 000000006d640800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 584 bytes inside of
freed 1024-byte region [000000006d640800, 000000006d640c00)Add the appropriate irq_work_sync() so the work finishes before the buffers are destroyed.
Prior to the commit in the Fixes tag below, there was only a single global IRQ work, so this issue didn't exist.
--- kernel/trace/ring_buffer.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/ring_buffer.c +4 -0
@@ -1393,6 +1393,8 @@ static void rb_free_cpu_buffer(struct ristruct list_head *head = cpu_buffer->pages;struct buffer_page *bpage, *tmp; +irq_work_sync (&cpu_buffer->irq_work.work); +free_buffer_page (cpu_buffer->reader_page);if (head) {
@@ -1498,6 +1500,8 @@ ring_buffer_free(struct ring_buffer *bufcpuhp_state_remove_instance (CPUHP_TRACE_RB_PREPARE , &buffer->node); +irq_work_sync (&buffer->irq_work.work); +for_each_buffer_cpu (buffer, cpu)rb_free_cpu_buffer (buffer->buffers[cpu]);
Greg Kroah-Hartman
maintainerPATCH 23/282 reiserfs: Add security prefix to xattr name in reiserfs_security_write()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit d82dcd9e21b77d338dc4875f3d4111f0db314a7c upstream.
Reiserfs sets a security xattr at inode creation time in two stages: first, it calls reiserfs_security_init() to obtain the xattr from active LSMs; then, it calls reiserfs_security_write() to actually write that xattr.
Unfortunately, it seems there is a wrong expectation that LSMs provide the full xattr name in the form 'security.<suffix>'. However, LSMs always provided just the suffix, causing reiserfs to not write the xattr at all (if the suffix is shorter than the prefix), or to write an xattr with the wrong name.
Add a temporary buffer in reiserfs_security_write(), and write to it the full xattr name, before passing it to reiserfs_xattr_set_handle().
Also replace the name length check with a check that the full xattr name is not larger than XATTR_NAME_MAX.
--- fs/reiserfs/xattr_security.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/reiserfs/xattr_security.c +6 -2
@@ -81,11 +81,15 @@ int reiserfs_security_write(struct reisestruct inode *inode, struct reiserfs_security_handle *sec) { + char xattr_name[XATTR_NAME_MAX + 1] = XATTR_SECURITY_PREFIX;int error; -if (strlen (sec->name) <sizeof (XATTR_SECURITY_PREFIX )) + +if (XATTR_SECURITY_PREFIX_LEN +strlen (sec->name) >XATTR_NAME_MAX )return -EINVAL ; - error =reiserfs_xattr_set_handle (th, inode, sec->name, sec->value, +strlcat (xattr_name, sec->name,sizeof (xattr_name)); + + error =reiserfs_xattr_set_handle (th, inode, xattr_name, sec->value, sec->length,XATTR_CREATE );if (error == -ENODATA || error == -EOPNOTSUPP ) error =0 ;
Greg Kroah-Hartman
maintainerPATCH 24/282 KVM: nVMX: Emulate NOPs in L2, and PAUSE if its not intercepted
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 4984563823f0034d3533854c1b50e729f5191089 upstream.
Extend VMX's nested intercept logic for emulated instructions to handle "pause" interception, in quotes because KVM's emulator doesn't filter out NOPs when checking for nested intercepts. Failure to allow emulation of NOPs results in KVM injecting a #UD into L2 on any NOP that collides with the emulator's definition of PAUSE, i.e. on all single-byte NOPs.
For PAUSE itself, honor L1's PAUSE-exiting control, but ignore PLE to avoid unnecessarily injecting a #UD into L2. Per the SDM, the first execution of PAUSE after VM-Entry is treated as the beginning of a new loop, i.e. will never trigger a PLE VM-Exit, and so L1 can't expect any given execution of PAUSE to deterministically exit.
... the processor considers this execution to be the first execution of PAUSE in a loop. (It also does so for the first execution of PAUSE at CPL 0 after VM entry.)
All that said, the PLE side of things is currently a moot point, as KVM doesn't expose PLE to L1.
Note, vmx_check_intercept() is still wildly broken when L1 wants to intercept an instruction, as KVM injects a #UD instead of synthesizing a nested VM-Exit. That issue extends far beyond NOP/PAUSE and needs far more effort to fix, i.e. is a problem for the future.
--- arch/x86/kvm/vmx/vmx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/kvm/vmx/vmx.c +15 -0
@@ -7266,6 +7266,21 @@ static int vmx_check_intercept(struct kv/* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */ break ; +case x86_intercept_pause: +/* +* PAUSE is a single-byte NOP with a REPE prefix, i.e. collides +* with vanilla NOPs in the emulator. Apply the interception +* check only to actual PAUSE instructions. Don't check +* PAUSE-loop-exiting, software can't expect a given PAUSE to +* exit, i.e. KVM is within its rights to allow L2 to execute +* the PAUSE. +*/ +if ((info->rep_prefix !=REPE_PREFIX ) || + !nested_cpu_has2 (vmcs12,CPU_BASED_PAUSE_EXITING )) +return X86EMUL_CONTINUE ; + +break ; +/* TODO: check more intercepts... */ default :break ;
Greg Kroah-Hartman
maintainerPATCH 25/282 i2c: omap: Fix standard mode false ACK readings
In reply to Greg Kroah-HartmanFrom: Reid Tonking <[email protected]>
commit c770657bd2611b077ec1e7b1fe6aa92f249399bd upstream.
Using standard mode, rare false ACK responses were appearing with i2cdetect tool. This was happening due to NACK interrupt triggering ISR thread before register access interrupt was ready. Removing the NACK interrupt's ability to trigger ISR thread lets register access ready interrupt do this instead.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -1058,7 +1058,7 @@ omap_i2c_isr(int irq, void *dev_id)u16 stat; stat =omap_i2c_read_reg (omap,OMAP_I2C_STAT_REG ); - mask =omap_i2c_read_reg (omap,OMAP_I2C_IE_REG ); + mask =omap_i2c_read_reg (omap,OMAP_I2C_IE_REG ) & ~OMAP_I2C_STAT_NACK ;if (stat & mask) ret =IRQ_WAKE_THREAD ;
Greg Kroah-Hartman
maintainerPATCH 26/282 Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 7d01cb27f6aebc54efbe28d8961a973b8f795b13 upstream.
This reverts commit 122deabfe1428 (ubifs: dirty_cow_znode: Fix memleak in error handling path).
After commit 122deabfe1428 applied, if insert_old_idx() failed, old index neither exists in TNC nor in old-index tree. Which means that old index node could be overwritten in layout_leb_in_gaps(), then ubifs image will be corrupted in power-cut.
--- fs/ubifs/tnc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
fs/ubifs/tnc.c +1 -8
@@ -267,18 +267,11 @@ static struct ubifs_znode *dirty_cow_znoif (zbr->len) { err =insert_old_idx (c, zbr->lnum, zbr->offs);if (unlikely (err)) -/* -* Obsolete znodes will be freed by tnc_destroy_cnext() -* or free_obsolete_znodes(), copied up znodes should -* be added back to tnc and freed by -* ubifs_destroy_tnc_subtree(). -*/ - goto out; +return ERR_PTR (err); err =add_idx_dirt (c, zbr->lnum, zbr->len); }else err =0 ; -out: zbr->znode = zn; zbr->lnum =0 ; zbr->offs =0 ;
Greg Kroah-Hartman
maintainerPATCH 9/282 IMA: allow/fix UML builds
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 644f17412f5acf01a19af9d04a921937a2bc86c6 upstream.
UML supports HAS_IOMEM since 0bbadafdc49d (um: allow disabling NO_IOMEM).
Current IMA build on UML fails on allmodconfig (with TCG_TPM=m):
ld: security/integrity/ima/ima_queue.o: in function `ima_add_template_entry':
ima_queue.c:(.text+0x2d9): undefined reference to `tpm_pcr_extend'
ld: security/integrity/ima/ima_init.o: in function `ima_init':
ima_init.c:(.init.text+0x43f): undefined reference to `tpm_default_chip'
ld: security/integrity/ima/ima_crypto.o: in function `ima_calc_boot_aggregate_tfm':
ima_crypto.c:(.text+0x1044): undefined reference to `tpm_pcr_read'
ld: ima_crypto.c:(.text+0x10d8): undefined reference to `tpm_pcr_read'
Modify the IMA Kconfig entry so that it selects TCG_TPM if HAS_IOMEM is set, regardless of the UML Kconfig setting.
This updates TCG_TPM from =m to =y and fixes the linker errors.
--- security/integrity/ima/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/Kconfig +1 -1
@@ -8,7 +8,7 @@ config IMA select CRYPTO_HMAC select CRYPTO_SHA1 select CRYPTO_HASH_INFO - select TCG_TPM if HAS_IOMEM && !UML + select TCG_TPM if HAS_IOMEM select TCG_TIS if TCG_TPM && X86 select TCG_CRB if TCG_TPM && ACPI select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES
Greg Kroah-Hartman
maintainerPATCH 27/282 ubifs: Fix memleak when insert_old_idx() failed
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit b5fda08ef213352ac2df7447611eb4d383cce929 upstream.
Following process will cause a memleak for copied up znode:
dirty_cow_znode
zn = copy_znode(c, znode);
err = insert_old_idx(c, zbr->lnum, zbr->offs);
if (unlikely(err))
return ERR_PTR(err); // No one refers to zn.
Fetch a reproducer in [Link].
Function copy_znode() is split into 2 parts: resource allocation and znode replacement, insert_old_idx() is split in similar way, so resource cleanup could be done in error handling path without corrupting metadata(mem & disk).
It's okay that old index inserting is put behind of add_idx_dirt(), old index is used in layout_leb_in_gaps(), so the two processes do not depend on each other.
--- fs/ubifs/tnc.c | 137 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 50 deletions(-)
fs/ubifs/tnc.c +87 -50
@@ -44,6 +44,33 @@ enum { NOT_ON_MEDIA = 3, }; +static void do_insert_old_idx (struct ubifs_info *c, +struct ubifs_old_idx *old_idx) +{ +struct ubifs_old_idx *o; +struct rb_node **p, *parent =NULL ; + + p = &c->old_idx.rb_node; +while (*p) { + parent = *p; + o = rb_entry(parent, struct ubifs_old_idx, rb); +if (old_idx->lnum < o->lnum) + p = &(*p)->rb_left; +else if (old_idx->lnum > o->lnum) + p = &(*p)->rb_right; +else if (old_idx->offs < o->offs) + p = &(*p)->rb_left; +else if (old_idx->offs > o->offs) + p = &(*p)->rb_right; +else { +ubifs_err (c,"old idx added twice!" ); +kfree (old_idx); + } + } +rb_link_node (&old_idx->rb, parent, p); +rb_insert_color (&old_idx->rb, &c->old_idx); +} +/** * insert_old_idx - record an index node obsoleted since the last commit start. * @c: UBIFS file-system description object
@@ -69,35 +96,15 @@ enum {*/ static int insert_old_idx (struct ubifs_info *c,int lnum,int offs) { -struct ubifs_old_idx *old_idx, *o; -struct rb_node **p, *parent =NULL ; +struct ubifs_old_idx *old_idx; old_idx =kmalloc (sizeof (struct ubifs_old_idx ),GFP_NOFS );if (unlikely (!old_idx))return -ENOMEM ; old_idx->lnum = lnum; old_idx->offs = offs; +do_insert_old_idx (c, old_idx); - p = &c->old_idx.rb_node; -while (*p) { - parent = *p; - o = rb_entry(parent, struct ubifs_old_idx, rb); -if (lnum < o->lnum) - p = &(*p)->rb_left; -else if (lnum > o->lnum) - p = &(*p)->rb_right; -else if (offs < o->offs) - p = &(*p)->rb_left; -else if (offs > o->offs) - p = &(*p)->rb_right; -else { -ubifs_err (c,"old idx added twice!" ); -kfree (old_idx); -return 0 ; - } - } -rb_link_node (&old_idx->rb, parent, p); -rb_insert_color (&old_idx->rb, &c->old_idx);return 0 ; }
@@ -199,23 +206,6 @@ static struct ubifs_znode *copy_znode(st__set_bit (DIRTY_ZNODE , &zn->flags);__clear_bit (COW_ZNODE , &zn->flags); -ubifs_assert (c, !ubifs_zn_obsolete (znode)); -__set_bit (OBSOLETE_ZNODE , &znode->flags); - -if (znode->level !=0 ) { -int i; -const int n = zn->child_cnt; - -/* The children now have new parent */ -for (i =0 ; i < n; i++) { -struct ubifs_zbranch *zbr = &zn->zbranch[i]; - -if (zbr->znode) - zbr->znode->parent = zn; - } - } - -atomic_long_inc (&c->dirty_zn_cnt);return zn; }
@@ -234,6 +224,42 @@ static int add_idx_dirt(struct ubifs_inf }/** +* replace_znode - replace old znode with new znode. +* @c: UBIFS file-system description object +* @new_zn: new znode +* @old_zn: old znode +* @zbr: the branch of parent znode +* +* Replace old znode with new znode in TNC. +*/ +static void replace_znode (struct ubifs_info *c,struct ubifs_znode *new_zn, +struct ubifs_znode *old_zn,struct ubifs_zbranch *zbr) +{ +ubifs_assert (c, !ubifs_zn_obsolete (old_zn)); +__set_bit (OBSOLETE_ZNODE , &old_zn->flags); + +if (old_zn->level !=0 ) { +int i; +const int n = new_zn->child_cnt; + +/* The children now have new parent */ +for (i =0 ; i < n; i++) { +struct ubifs_zbranch *child = &new_zn->zbranch[i]; + +if (child->znode) + child->znode->parent = new_zn; + } + } + + zbr->znode = new_zn; + zbr->lnum =0 ; + zbr->offs =0 ; + zbr->len =0 ; + +atomic_long_inc (&c->dirty_zn_cnt); +} + +/** * dirty_cow_znode - ensure a znode is not being committed. * @c: UBIFS file-system description object * @zbr: branch of znode to check
@@ -265,21 +291,32 @@ static struct ubifs_znode *dirty_cow_znoreturn zn;if (zbr->len) { - err =insert_old_idx (c, zbr->lnum, zbr->offs); -if (unlikely (err)) -return ERR_PTR (err); +struct ubifs_old_idx *old_idx; + + old_idx =kmalloc (sizeof (struct ubifs_old_idx ),GFP_NOFS ); +if (unlikely (!old_idx)) { + err = -ENOMEM ; + goto out; + } + old_idx->lnum = zbr->lnum; + old_idx->offs = zbr->offs; + err =add_idx_dirt (c, zbr->lnum, zbr->len); - }else - err =0 ; +if (err) { +kfree (old_idx); + goto out; + } - zbr->znode = zn; - zbr->lnum =0 ; - zbr->offs =0 ; - zbr->len =0 ; +do_insert_old_idx (c, old_idx); + } + +replace_znode (c, zn, znode, zbr); -if (unlikely (err)) -return ERR_PTR (err);return zn; + +out: +kfree (zn); +return ERR_PTR (err); }/**
Greg Kroah-Hartman
maintainerPATCH 28/282 ubi: Fix return value overwrite issue in try_write_vid_and_data()
In reply to Greg Kroah-HartmanFrom: Wang YanQing <[email protected]>
commit 31a149d5c13c4cbcf97de3435817263a2d8c9d6e upstream.
The commit 2d78aee426d8 ("UBI: simplify LEB write and atomic LEB change code") adds helper function, try_write_vid_and_data(), to simplify the code, but this helper function has bug, it will return 0 (success) when ubi_io_write_vid_hdr() or the ubi_io_write_data() return error number (-EIO, etc), because the return value of ubi_wl_put_peb() will overwrite the original return value.
This issue will cause unexpected data loss issue, because the caller of this function and UBIFS willn't know the data is lost.
--- drivers/mtd/ubi/eba.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/mtd/ubi/eba.c +14 -5
@@ -947,7 +947,7 @@ static int try_write_vid_and_data(struct int offset, int len) {struct ubi_device *ubi = vol->ubi; -int pnum, opnum, err, vol_id = vol->vol_id; +int pnum, opnum, err, err2, vol_id = vol->vol_id; pnum =ubi_wl_get_peb (ubi);if (pnum <0 ) {
@@ -982,10 +982,19 @@ static int try_write_vid_and_data(struct out_put:up_read (&ubi->fm_eba_sem); -if (err && pnum >=0 ) - err =ubi_wl_put_peb (ubi, vol_id, lnum, pnum,1 ); -else if (!err && opnum >=0 ) - err =ubi_wl_put_peb (ubi, vol_id, lnum, opnum,0 ); +if (err && pnum >=0 ) { + err2 =ubi_wl_put_peb (ubi, vol_id, lnum, pnum,1 ); +if (err2) { +ubi_warn (ubi,"failed to return physical eraseblock %d, error %d" , + pnum, err2); + } + }else if (!err && opnum >=0 ) { + err2 =ubi_wl_put_peb (ubi, vol_id, lnum, opnum,0 ); +if (err2) { +ubi_warn (ubi,"failed to return physical eraseblock %d, error %d" , + opnum, err2); + } + }return err; }
Greg Kroah-Hartman
maintainerPATCH 29/282 ubifs: Free memory for tmpfile name
In reply to Greg Kroah-HartmanFrom: Mårten Lindahl <[email protected]>
commit 1fb815b38bb31d6af9bd0540b8652a0d6fe6cfd3 upstream.
When opening a ubifs tmpfile on an encrypted directory, function fscrypt_setup_filename allocates memory for the name that is to be stored in the directory entry, but after the name has been copied to the directory entry inode, the memory is not freed.
When running kmemleak on it we see that it is registered as a leak. The report below is triggered by a simple program 'tmpfile' just opening a tmpfile:
unreferenced object 0xffff88810178f380 (size 32):
comm "tmpfile", pid 509, jiffies 4294934744 (age 1524.742s)
backtrace:
__kmem_cache_alloc_node
__kmalloc
fscrypt_setup_filename
ubifs_tmpfile
vfs_tmpfile
path_openatFree this memory after it has been copied to the inode.
--- fs/ubifs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/ubifs/dir.c +1 -0
@@ -433,6 +433,7 @@ static int do_tmpfile(struct inode *dir,mutex_unlock (&dir_ui->ui_mutex);ubifs_release_budget (c, &req); +fscrypt_free_filename (&nm);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 30/282 selinux: fix Makefile dependencies of flask.h
In reply to Greg Kroah-HartmanFrom: Ondrej Mosnacek <[email protected]>
[ Upstream commit bcab1adeaad4b39a1e04cb98979a367d08253f03 ]
Make the flask.h target depend on the genheaders binary instead of classmap.h to ensure that it is rebuilt if any of the dependencies of genheaders are changed.
Notably this fixes flask.h not being rebuilt wheninitial_sid_to_string.h is modified.
--- security/selinux/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/Makefile +2 -2
@@ -19,8 +19,8 @@ ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include $(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h quiet_cmd_flask = GEN $(obj)/flask.h $(obj)/av_permissions.h - cmd_flask = scripts/selinux/genheaders/genheaders $(obj)/flask.h $(obj)/av_permissions.h + cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h targets += flask.h av_permissions.h -$(obj)/flask.h: $(src)/include/classmap.h FORCE +$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE $(call if_changed,flask)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 31/282 selinux: ensure av_permissions.h is built when needed
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
[ Upstream commit 4ce1f694eb5d8ca607fed8542d32a33b4f1217a5 ]
The Makefile rule responsible for building flask.h and av_permissions.h only lists flask.h as a target which means that av_permissions.h is only generated when flask.h needs to be generated. This patch fixes this by adding av_permissions.h as a target to the rule.
--- security/selinux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/Makefile +1 -1
@@ -22,5 +22,5 @@ quiet_cmd_flask = GEN $(obj)/flask.h $(obj)/av_permissions.h cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h targets += flask.h av_permissions.h -$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE +$(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/genheaders/genheaders FORCE $(call if_changed,flask)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 32/282 tpm, tpm_tis: Do not skip reset of original interrupt vector
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit ed9be0e6c892a783800d77a41ca4c7255c6af8c5 ]
If in tpm_tis_probe_irq_single() an error occurs after the original interrupt vector has been read, restore the interrupts before the error is returned.
Since the caller does not check the error value, return -1 in any case that the TPM_CHIP_FLAG_IRQ flag is not set. Since the return value of function tpm_tis_gen_interrupt() is not longer used, make it a void function.
--- drivers/char/tpm/tpm_tis_core.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -18
@@ -613,7 +613,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)return IRQ_HANDLED ; } -static int tpm_tis_gen_interrupt (struct tpm_chip *chip) +static void tpm_tis_gen_interrupt (struct tpm_chip *chip) {const char *desc ="attempting to generate an interrupt" ;u32 cap2;
@@ -622,7 +622,7 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) ret =request_locality (chip,0 );if (ret <0 ) -return ret; +return ;if (chip->flags &TPM_CHIP_FLAG_TPM2 ) ret =tpm2_get_tpm_pt (chip,0x100 , &cap2, desc);
@@ -630,8 +630,6 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) ret =tpm1_getcap (chip,TPM_CAP_PROP_TIS_TIMEOUT , &cap, desc,0 );release_locality (chip,0 ); - -return ret; }/* Register the IRQ and issue a command that will cause an interrupt. If an
@@ -661,42 +659,37 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, rc =tpm_tis_write8 (priv,TPM_INT_VECTOR (priv->locality), irq);if (rc <0 ) -return rc; + goto restore_irqs; rc =tpm_tis_read32 (priv,TPM_INT_STATUS (priv->locality), &int_status);if (rc <0 ) -return rc; + goto restore_irqs;/* Clear all existing */ rc =tpm_tis_write32 (priv,TPM_INT_STATUS (priv->locality), int_status);if (rc <0 ) -return rc; - + goto restore_irqs;/* Turn on */ rc =tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), intmask |TPM_GLOBAL_INT_ENABLE );if (rc <0 ) -return rc; + goto restore_irqs; priv->irq_tested = false;/* Generate an interrupt by having the core call through to * tpm_tis_send */ - rc =tpm_tis_gen_interrupt (chip); -if (rc <0 ) -return rc; +tpm_tis_gen_interrupt (chip); +restore_irqs:/* tpm_tis_send will either confirm the interrupt is working or it * will call disable_irq which undoes all of the above. */ if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) { - rc =tpm_tis_write8 (priv, original_int_vec, -TPM_INT_VECTOR (priv->locality)); -if (rc <0 ) -return rc; - -return 1 ; +tpm_tis_write8 (priv, original_int_vec, +TPM_INT_VECTOR (priv->locality)); +return -1 ; }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 33/282 erofs: stop parsing non-compact HEAD index if clusterofs is invalid
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit cc4efd3dd2ac9f89143e5d881609747ecff04164 ]
Syzbot generated a crafted image [1] with a non-compact HEAD index of clusterofs 33024 while valid numbers should be 0 ~ lclustersize-1, which causes the following unexpected behavior as below:
BUG: unable to handle page fault for address: fffff52101a3fff9 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 23ffed067 P4D 23ffed067 PUD 0 Oops: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 4398 Comm: kworker/u5:1 Not tainted 6.3.0-rc6-syzkaller-g09a9639e56c0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Workqueue: erofs_worker z_erofs_decompressqueue_work RIP: 0010:z_erofs_decompress_queue+0xb7e/0x2b40 ... Call Trace: <TASK> z_erofs_decompressqueue_work+0x99/0xe0 process_one_work+0x8f6/0x1170 worker_thread+0xa63/0x1210 kthread+0x270/0x300 ret_from_fork+0x1f/0x30
Note that normal images or images using compact indexes are not impacted. Let's fix this now.
[1] https://lore.kernel.org/r/[email protected]
--- fs/erofs/zmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/erofs/zmap.c +4 -0
@@ -179,6 +179,10 @@ static int vle_legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :case Z_EROFS_VLE_CLUSTER_TYPE_HEAD : m->clusterofs =le16_to_cpu (di->di_clusterofs); +if (m->clusterofs >=1 << vi->z_logical_clusterbits) { +DBG_BUGON (1 ); +return -EFSCORRUPTED ; + } m->pblk =le32_to_cpu (di->di_u.blkaddr);break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 34/282 erofs: fix potential overflow calculating xattr_isize
In reply to Greg Kroah-HartmanFrom: Jingbo Xu <[email protected]>
[ Upstream commit 1b3567a1969b26f709d82a874498c0754ea841c3 ]
Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4).
Thus declare xattr_isize as unsigned int to avoid the potential overflow.
--- fs/erofs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/internal.h +1 -1
@@ -226,7 +226,7 @@ struct erofs_inode {unsigned char datalayout;unsigned char inode_isize; -unsigned short xattr_isize; +unsigned int xattr_isize;unsigned int xattr_shared_count;unsigned int *xattr_shared_xattrs;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 35/282 drm/rockchip: Drop unbalanced obj unref
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 8ee3b0e85f6ccd9e6c527bc50eaba774c3bb18d0 ]
In the error path, rockchip_drm_gem_object_mmap() is dropping an obj reference that it doesn't own.
--- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +0 -3
@@ -249,9 +249,6 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,else ret =rockchip_drm_gem_object_mmap_dma (obj, vma); -if (ret) -drm_gem_vm_close (vma); -return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 36/282 drm/vgem: add missing mutex_destroy
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 7c18189b14b33c1fbf76480b1bd217877c086e67 ]
vgem_fence_open() instantiates a mutex for a particular fence instance, but never destroys it by calling mutex_destroy() in vgem_fence_close().
So, add the missing mutex_destroy() to guarantee proper resource destruction.
--- drivers/gpu/drm/vgem/vgem_fence.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vgem/vgem_fence.c +1 -0
@@ -249,4 +249,5 @@ void vgem_fence_close(struct vgem_file *vfile) {idr_for_each (&vfile->fence_idr, __vgem_fence_idr_fini, vfile);idr_destroy (&vfile->fence_idr); +mutex_destroy (&vfile->fence_mutex); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 10/282 USB: dwc3: fix runtime pm imbalance on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 upstream.
Make sure not to suspend the device when probe fails to avoid disabling clocks and phys multiple times.
--- drivers/usb/dwc3/core.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/usb/dwc3/core.c +5 -9
@@ -1496,13 +1496,11 @@ static int dwc3_probe(struct platform_despin_lock_init (&dwc->lock); +pm_runtime_get_noresume (dev);pm_runtime_set_active (dev);pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,DWC3_DEFAULT_AUTOSUSPEND_DELAY );pm_runtime_enable (dev); - ret =pm_runtime_get_sync (dev); -if (ret <0 ) - goto err1;pm_runtime_forbid (dev);
@@ -1562,12 +1560,10 @@ err3:dwc3_free_event_buffers (dwc); err2: -pm_runtime_allow (&pdev->dev); - -err1: -pm_runtime_put_sync (&pdev->dev); -pm_runtime_disable (&pdev->dev); - +pm_runtime_allow (dev); +pm_runtime_disable (dev); +pm_runtime_set_suspended (dev); +pm_runtime_put_noidle (dev); disable_clks:clk_bulk_disable_unprepare (dwc->num_clks, dwc->clks); assert_reset:
Greg Kroah-Hartman
maintainerPATCH 37/282 drm/probe-helper: Cancel previous job before starting new one
In reply to Greg Kroah-HartmanFrom: Dom Cobley <[email protected]>
[ Upstream commit a8e47884f1906cd7440fafa056adc8817568e73e ]
Currently we schedule a call to output_poll_execute from drm_kms_helper_poll_enable for 10s in future. Later we try to replace that in drm_helper_probe_single_connector_modes with a 0s schedule with delayed_event set.
But as there is already a job in the queue this fails, and the immediate job we wanted with delayed_event set doesn't occur until 10s later.
And that call acts as if connector state has changed, reprobing modes. This has a side effect of waking up a display that has been blanked.
Make sure we cancel the old job before submitting the immediate one.
--- drivers/gpu/drm/drm_probe_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_probe_helper.c +3 -2
@@ -460,8 +460,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,*/ dev->mode_config.delayed_event = true;if (dev->mode_config.poll_enabled) -schedule_delayed_work (&dev->mode_config.output_poll_work, -0 ); +mod_delayed_work (system_wq, + &dev->mode_config.output_poll_work, +0 ); }/* Re-enable polling in case the global poll config changed. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 11/282 USB: dwc3: fix runtime pm imbalance on unbind
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 44d257e9012ee8040e41d224d0e5bfb5ef5427ea upstream.
Make sure to balance the runtime PM usage count on driver unbind by adding back the pm_runtime_allow() call that had been erroneously removed.
--- drivers/usb/dwc3/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/core.c +1 -0
@@ -1584,6 +1584,7 @@ static int dwc3_remove(struct platform_ddwc3_core_exit (dwc);dwc3_ulpi_exit (dwc); +pm_runtime_allow (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 12/282 perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE)
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit d08c84e01afa7a7eee6badab25d5420fa847f783 upstream.
In fedora rawhide the PTHREAD_STACK_MIN define may end up expanded to a sysconf() call, and that will return 'long int', breaking the build:
45 fedora:rawhide : FAIL gcc version 11.1.1 20210623 (Red Hat 11.1.1-6) (GCC)
builtin-sched.c: In function 'create_tasks':
/git/perf-5.14.0-rc1/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
43 | (void) (&_max1 == &_max2); \
| ^~
builtin-sched.c:673:34: note: in expansion of macro 'max'
673 | (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
| ^~~
cc1: all warnings being treated as errors
$ grep __sysconf /usr/include/*/*.h /usr/include/bits/pthread_stack_min-dynamic.h:extern long int __sysconf (int __name) __THROW; /usr/include/bits/pthread_stack_min-dynamic.h:# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE) /usr/include/bits/time.h:extern long int __sysconf (int); /usr/include/bits/time.h:# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ $
So cast it to int to cope with that.
--- tools/perf/builtin-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-sched.c +1 -1
@@ -666,7 +666,7 @@ static void create_tasks(struct perf_sch err =pthread_attr_init (&attr);BUG_ON (err); err =pthread_attr_setstacksize (&attr, - (size_t )max (16 *1024 ,PTHREAD_STACK_MIN )); + (size_t )max (16 *1024 , (int )PTHREAD_STACK_MIN ));BUG_ON (err); err =pthread_mutex_lock (&sched->start_work_mutex);BUG_ON (err);
Greg Kroah-Hartman
maintainerPATCH 13/282 staging: iio: resolver: ads1210: fix config mode
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
commit 16313403d873ff17a587818b61f84c8cb4971cef upstream.
As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode.
[1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf
--- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +1 -1
@@ -101,7 +101,7 @@ struct ad2s1210_state {static const int ad2s1210_mode_vals[4 ][2 ] = { [MOD_POS ] = {0 ,0 }, [MOD_VEL ] = {0 ,1 }, - [MOD_CONFIG ] = {1 ,0 }, + [MOD_CONFIG ] = {1 ,1 }, }; static inline void ad2s1210_set_mode(enum ad2s1210_mode mode,
Greg Kroah-Hartman
maintainerPATCH 14/282 debugfs: regset32: Add Runtime PM support
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
commit 30332eeefec8f83afcea00c360f99ef64b87f220 upstream.
Hardware registers of devices under control of power management cannot be accessed at all times. If such a device is suspended, register accesses may lead to undefined behavior, like reading bogus values, or causing exceptions or system lock-ups.
Extend struct debugfs_regset32 with an optional field to let device drivers specify the device the registers in the set belong to. This allows debugfs_show_regset32() to make sure the device is resumed while its registers are being read.
--- fs/debugfs/file.c | 8 ++++++++ include/linux/debugfs.h | 1 + 2 files changed, 9 insertions(+)
fs/debugfs/file.c +8 -0
@@ -18,6 +18,7 @@#include <linux/slab.h> #include <linux/atomic.h> #include <linux/device.h> +#include <linux/pm_runtime.h> #include <linux/poll.h> #include <linux/security.h>
@@ -1119,7 +1120,14 @@ static int debugfs_show_regset32(struct {struct debugfs_regset32 *regset = s->private; +if (regset->dev) +pm_runtime_get_sync (regset->dev); +debugfs_print_regs32 (s, regset->regs, regset->nregs, regset->base,"" ); + +if (regset->dev) +pm_runtime_put (regset->dev); +return 0 ; }
include/linux/debugfs.h +1 -0
@@ -35,6 +35,7 @@ struct debugfs_regset32 {const struct debugfs_reg32 *regs;int nregs;void __iomem *base; +struct device *dev;/* Optional device for Runtime PM */ };extern struct dentry *arch_debugfs_dir;
Greg Kroah-Hartman
maintainerPATCH 15/282 xhci: fix debugfs register accesses while suspended
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 735baf1b23458f71a8b15cb924af22c9ff9cd125 upstream.
Wire up the debugfs regset device pointer so that the controller is resumed before accessing registers to avoid crashing or locking up if it happens to be runtime suspended.
--- drivers/usb/host/xhci-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-debugfs.c +1 -0
@@ -132,6 +132,7 @@ static void xhci_debugfs_regset(struct x regset->regs = regs; regset->nregs = nregs; regset->base = hcd->regs + base; + regset->dev = hcd->self.controller;debugfs_create_regset32 ((const char *)rgs->name,0444 , parent, regset); }
Greg Kroah-Hartman
maintainerPATCH 16/282 MIPS: fw: Allow firmware to pass a empty env
In reply to Greg Kroah-HartmanFrom: Jiaxun Yang <[email protected]>
commit ee1809ed7bc456a72dc8410b475b73021a3a68d5 upstream.
fw_getenv will use env entry to determine style of env, however it is legal for firmware to just pass a empty list.
Check if first entry exist before running strchr to avoid null pointer dereference.
--- arch/mips/fw/lib/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/fw/lib/cmdline.c +1 -1
@@ -51,7 +51,7 @@ char *fw_getenv(char *envname) {char *result =NULL ; -if (_fw_envp !=NULL ) { +if (_fw_envp !=NULL &&fw_envp (0 ) !=NULL ) {/* * Return a pointer to the given environment variable. * YAMON uses "name", "value" pairs, while U-Boot uses
Greg Kroah-Hartman
maintainerPATCH 7/282 ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit e38c5e80c3d293a883c6f1d553f2146ec0bda35e ]
The Acer Iconia One 7 B1-750 tablet mostly works fine with the defaults for an Bay Trail CR tablet. Except for the internal mic, instead of an analog mic on IN3 a digital mic on DMIC1 is uses.
Add a quirk with these settings for this tablet.
--- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
@@ -391,6 +391,18 @@ static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,/* Please keep this list alphabetically sorted */ static const struct dmi_system_id byt_rt5640_quirk_table[] = { + {/* Acer Iconia One 7 B1-750 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Insyde" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"VESPA2" ), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD1_IN4P | +BYT_RT5640_OVCD_TH_1500UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF1 | +BYT_RT5640_MCLK_EN ), + }, {/* Acer Iconia Tab 8 W1-810 */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Acer" ),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 39/282 arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 554edc3e9239bb81e61be9f0f5dbbeb528a69e72 ]
According to the RZ/G Series, 2nd Generation Hardware User’s Manual Rev. 1.11, the System CPU cores on RZ/G2E do not have their own power supply, but use the common internal power supply (typical 1.03V).
Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.
--- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a774c0.dtsi +0 -3
@@ -49,17 +49,14 @@ opp-shared; opp-800000000 { opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1200000000 { opp-hz = /bits/ 64 <1200000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; opp-suspend; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 48/282 drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}
In reply to Greg Kroah-HartmanFrom: Jonathan Marek <[email protected]>
[ Upstream commit 17e822f7591fb66162aca07685dc0b01468e5480 ]
adreno_gpu_init calls pm_runtime_enable, so adreno_gpu_cleanup needs to call pm_runtime_disable.
Stable-dep-of: db7662d076c9 ("drm/msm/adreno: drop bogus pm_runtime_set_active()")
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +3 -0
@@ -908,11 +908,14 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,void adreno_gpu_cleanup (struct adreno_gpu *adreno_gpu) {struct msm_gpu *gpu = &adreno_gpu->base; +struct msm_drm_private *priv = gpu->dev->dev_private;unsigned int i;for (i =0 ; i <ARRAY_SIZE (adreno_gpu->info->fw); i++)release_firmware (adreno_gpu->fw[i]); +pm_runtime_disable (&priv->gpu_pdev->dev); +icc_put (gpu->icc_path);msm_gpu_cleanup (&adreno_gpu->base);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 49/282 drm/msm/adreno: Defer enabling runpm until hw_init()
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 4b18299b33655fa9672b774b6df774dc03d6aee8 ]
To avoid preventing the display from coming up before the rootfs is mounted, without resorting to packing fw in the initrd, the GPU has this limbo state where the device is probed, but we aren't ready to start sending commands to it. This is particularly problematic for a6xx, since the GMU (which requires fw to be loaded) is the one that is controlling the power/clk/icc votes.
So defer enabling runpm until we are ready to call gpu->hw_init(), as that is a point where we know we have all the needed fw and are ready to start sending commands to the coproc's.
Patchwork: https://patchwork.freedesktop.org/patch/489337/
Stable-dep-of: db7662d076c9 ("drm/msm/adreno: drop bogus pm_runtime_set_active()")
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++++++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +6 -0
@@ -233,6 +233,12 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)if (ret)return NULL ; +/* +* Now that we have firmware loaded, and are ready to begin +* booting the gpu, go ahead and enable runpm: +*/ +pm_runtime_enable (&pdev->dev); +/* Make sure pm runtime is active and reset any previous errors */ pm_runtime_set_active (&pdev->dev);
drivers/gpu/drm/msm/adreno/adreno_gpu.c +0 -1
@@ -899,7 +899,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,pm_runtime_set_autosuspend_delay (&pdev->dev, adreno_gpu->info->inactive_period);pm_runtime_use_autosuspend (&pdev->dev); -pm_runtime_enable (&pdev->dev);return msm_gpu_init (drm, pdev, &adreno_gpu->base, &funcs->base, adreno_gpu->info->name, &adreno_gpu_config);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 50/282 drm/msm/adreno: drop bogus pm_runtime_set_active()
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit db7662d076c973072d788bd0e8130e04430307a1 ]
The runtime PM status can only be updated while runtime PM is disabled.
Drop the bogus pm_runtime_set_active() call that was made after enabling runtime PM and which (incidentally but correctly) left the runtime PM status set to 'suspended'.
Patchwork: https://patchwork.freedesktop.org/patch/524972/
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +0 -3
@@ -239,9 +239,6 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)*/ pm_runtime_enable (&pdev->dev); -/* Make sure pm runtime is active and reset any previous errors */ -pm_runtime_set_active (&pdev->dev); - ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) {pm_runtime_put_sync (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 51/282 mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
In reply to Greg Kroah-HartmanFrom: Georgii Kruglov <[email protected]>
[ Upstream commit 0dd8316037a2a6d85b2be208bef9991de7b42170 ]
If spec_reg is equal to 'SDHCI_PRESENT_STATE', esdhc_readl_fixup() fixes up register value and returns it immediately. As a result, the further block
(spec_reg == SDHCI_PRESENT_STATE)
&&(esdhc->quirk_ignore_data_inhibit == true),
is never executed.
The patch merges the second block into the first one.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +11 -13
@@ -124,6 +124,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,return ret; } } +/* * The DAT[3:0] line signal levels and the CMD line signal level are * not compatible with standard SDHC register. The line signal levels
@@ -135,6 +136,16 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, ret = value &0x000fffff ; ret |= (value >>4 ) &SDHCI_DATA_LVL_MASK ; ret |= (value <<1 ) &SDHCI_CMD_LVL ; + +/* +* Some controllers have unreliable Data Line Active +* bit for commands with busy signal. This affects +* Command Inhibit (data) bit. Just ignore it since +* MMC core driver has already polled card status +* with CMD13 after any command with busy siganl. +*/ +if (esdhc->quirk_ignore_data_inhibit) + ret &= ~SDHCI_DATA_INHIBIT ;return ret; }
@@ -149,19 +160,6 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,return ret; } -/* -* Some controllers have unreliable Data Line Active -* bit for commands with busy signal. This affects -* Command Inhibit (data) bit. Just ignore it since -* MMC core driver has already polled card status -* with CMD13 after any command with busy siganl. -*/ -if ((spec_reg ==SDHCI_PRESENT_STATE ) && - (esdhc->quirk_ignore_data_inhibit == true)) { - ret = value & ~SDHCI_DATA_INHIBIT ; -return ret; - } - ret = value;return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 52/282 drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit c5647cae2704e58d1c4e5fedbf63f11bca6376c9 ]
Smatch reports:drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
missing unwind goto?
Store return value in err and goto 'err_out0' which has lima_sched_slab_fini() before returning.
--- drivers/gpu/drm/lima/lima_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/lima/lima_drv.c +4 -2
@@ -300,8 +300,10 @@ static int lima_pdev_probe(struct platform_device *pdev)/* Allocate and initialize the DRM device. */ ddev =drm_dev_alloc (&lima_drm_driver, &pdev->dev); -if (IS_ERR (ddev)) -return PTR_ERR (ddev); +if (IS_ERR (ddev)) { + err =PTR_ERR (ddev); + goto err_out0; + } ddev->dev_private = ldev; ldev->ddev = ddev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 53/282 regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b83a1772be854f87602de14726737d3e5b06e1f4 ]
When a codepath locks a rdev using ww_mutex_lock_slow() directly then that codepath is responsible for incrementing the "ref_cnt" and also setting the "mutex_owner" to "current".
The regulator core consistently got that right for "ref_cnt" but didn't always get it right for "mutex_owner". Let's fix this.
It's unlikely that this truly matters because the "mutex_owner" is only needed if we're going to do subsequent locking of the same rdev. However, even though it's not truly needed it seems less surprising if we consistently set "mutex_owner" properly.
--- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/core.c +2 -0
@@ -344,6 +344,7 @@ static void regulator_lock_dependent(struct regulator_dev *rdev,ww_mutex_lock_slow (&new_contended_rdev->mutex, ww_ctx); old_contended_rdev = new_contended_rdev; old_contended_rdev->ref_cnt++; + old_contended_rdev->mutex_owner = current; } err = regulator_lock_recursive(rdev,
@@ -5659,6 +5660,7 @@ static void regulator_summary_lock(struct ww_acquire_ctx *ww_ctx)ww_mutex_lock_slow (&new_contended_rdev->mutex, ww_ctx); old_contended_rdev = new_contended_rdev; old_contended_rdev->ref_cnt++; + old_contended_rdev->mutex_owner = current; } err = regulator_summary_lock_all(ww_ctx,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 54/282 regulator: core: Avoid lockdep reports when resolving supplies
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit cba6cfdc7c3f1516f0d08ddfb24e689af0932573 ]
An automated bot told me that there was a potential lockdep problem
with regulators. This was on the chromeos-5.15 kernel, but I see
nothing that would be different downstream compared to upstream. The
bot said:
============================================
WARNING: possible recursive locking detected 5.15.104-lockdep-17461-gc1e499ed6604 #1 Not tainted
--------------------------------------------
kworker/u16:4/115 is trying to acquire lock:
ffffff8083110170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: create_regulator+0x398/0x7ec
but task is already holding lock:
ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(regulator_ww_class_mutex);
lock(regulator_ww_class_mutex);*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by kworker/u16:4/115:
#0: ffffff808006a948 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x520/0x1348 #1: ffffffc00e0a7cc0 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work+0x55c/0x1348 #2: ffffff80828a2260 (&dev->mutex){....}-{3:3}, at: __device_attach_async_helper+0xd0/0x2a4 #3: ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8
stack backtrace: CPU: 2 PID: 115 Comm: kworker/u16:4 Not tainted 5.15.104-lockdep-17461-gc1e499ed6604 #1 9292e52fa83c0e23762b2b3aa1bacf5787a4d5da Hardware name: Google Quackingstick (rev0+) (DT) Workqueue: events_unbound async_run_entry_fn Call trace: dump_backtrace+0x0/0x4ec show_stack+0x34/0x50 dump_stack_lvl+0xdc/0x11c dump_stack+0x1c/0x48 __lock_acquire+0x16d4/0x6c74 lock_acquire+0x208/0x750 __mutex_lock_common+0x11c/0x11f8 ww_mutex_lock+0xc0/0x440 create_regulator+0x398/0x7ec regulator_resolve_supply+0x654/0x7c4 regulator_register_resolve_supply+0x30/0x120 class_for_each_device+0x1b8/0x230 regulator_register+0x17a4/0x1f40 devm_regulator_register+0x60/0xd0 reg_fixed_voltage_probe+0x728/0xaec platform_probe+0x150/0x1c8 really_probe+0x274/0xa20 __driver_probe_device+0x1dc/0x3f4 driver_probe_device+0x78/0x1c0 __device_attach_driver+0x1ac/0x2c8 bus_for_each_drv+0x11c/0x190 __device_attach_async_helper+0x1e4/0x2a4 async_run_entry_fn+0xa0/0x3ac process_one_work+0x638/0x1348 worker_thread+0x4a8/0x9c4 kthread+0x2e4/0x3a0 ret_from_fork+0x10/0x20
The problem was first reported soon after we made many of the regulators probe asynchronously, though nothing I've seen implies that the problems couldn't have also happened even without that.
I haven't personally been able to reproduce the lockdep issue, but the issue does look somewhat legitimate. Specifically, it looks like in regulator_resolve_supply() we are holding a "rdev" lock while calling set_supply() -> create_regulator() which grabs the lock of a _different_ "rdev" (the one for our supply). This is not necessarily safe from a lockdep perspective since there is no documented ordering between these two locks.
In reality, we should always be locking a regulator before the supplying regulator, so I don't expect there to be any real deadlocks in practice. However, the regulator framework in general doesn't express this to lockdep.
Let's fix the issue by simply grabbing the two locks involved in the same way we grab multiple locks elsewhere in the regulator framework:
using the "wound/wait" mechanisms.
--- drivers/regulator/core.c | 91 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 8 deletions(-)
drivers/regulator/core.c +83 -8
@@ -217,6 +217,78 @@ void regulator_unlock(struct regulator_dev *rdev) }EXPORT_SYMBOL_GPL (regulator_unlock); +/** +* regulator_lock_two - lock two regulators +* @rdev1: first regulator +* @rdev2: second regulator +* @ww_ctx: w/w mutex acquire context +* +* Locks both rdevs using the regulator_ww_class. +*/ +static void regulator_lock_two (struct regulator_dev *rdev1, +struct regulator_dev *rdev2, +struct ww_acquire_ctx *ww_ctx) +{ +struct regulator_dev *tmp; +int ret; + +ww_acquire_init (ww_ctx, ®ulator_ww_class); + +/* Try to just grab both of them */ + ret =regulator_lock_nested (rdev1, ww_ctx); +WARN_ON (ret); + ret =regulator_lock_nested (rdev2, ww_ctx); +if (ret != -EDEADLOCK ) { +WARN_ON (ret); + goto exit; + } + +while (true) { +/* +* Start of loop: rdev1 was locked and rdev2 was contended. +* Need to unlock rdev1, slowly lock rdev2, then try rdev1 +* again. +*/ +regulator_unlock (rdev1); + +ww_mutex_lock_slow (&rdev2->mutex, ww_ctx); + rdev2->ref_cnt++; + rdev2->mutex_owner = current; + ret =regulator_lock_nested (rdev1, ww_ctx); + +if (ret == -EDEADLOCK ) { +/* More contention; swap which needs to be slow */ + tmp = rdev1; + rdev1 = rdev2; + rdev2 = tmp; + }else { +WARN_ON (ret); +break ; + } + } + +exit: +ww_acquire_done (ww_ctx); +} + +/** +* regulator_unlock_two - unlock two regulators +* @rdev1: first regulator +* @rdev2: second regulator +* @ww_ctx: w/w mutex acquire context +* +* The inverse of regulator_lock_two(). +*/ + +static void regulator_unlock_two (struct regulator_dev *rdev1, +struct regulator_dev *rdev2, +struct ww_acquire_ctx *ww_ctx) +{ +regulator_unlock (rdev2); +regulator_unlock (rdev1); +ww_acquire_fini (ww_ctx); +} +static bool regulator_supply_is_couple (struct regulator_dev *rdev) {struct regulator_dev *c_rdev;
@@ -1419,8 +1491,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)/** * set_supply - set regulator supply regulator -* @rdev: regulator name -* @supply_rdev: supply regulator name +* @rdev: regulator (locked) +* @supply_rdev: supply regulator (locked)) * * Called by platform initialisation code to set the supply regulator for this * regulator. This ensures that a regulators supply will also be enabled by the
@@ -1592,6 +1664,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,struct regulator *regulator;int err =0 ; +lockdep_assert_held_once (&rdev->mutex.base); +if (dev) {char buf[REG_STR_SIZE ];int size;
@@ -1619,9 +1693,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, regulator->rdev = rdev; regulator->supply_name = supply_name; -regulator_lock (rdev);list_add (®ulator->list, &rdev->consumer_list); -regulator_unlock (rdev);if (dev) { regulator->dev = dev;
@@ -1787,6 +1859,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) {struct regulator_dev *r;struct device *dev = rdev->dev.parent; +struct ww_acquire_ctx ww_ctx;int ret =0 ;/* No supply to resolve? */
@@ -1853,23 +1926,23 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)* between rdev->supply null check and setting rdev->supply in * set_supply() from concurrent tasks. */ -regulator_lock (rdev); +regulator_lock_two (rdev, r, &ww_ctx);/* Supply just resolved by a concurrent task? */ if (rdev->supply) { -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);put_device (&r->dev); goto out; } ret =set_supply (rdev, r);if (ret <0 ) { -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);put_device (&r->dev); goto out; } -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);/* * In set_machine_constraints() we may have turned this regulator on
@@ -1984,7 +2057,9 @@ struct regulator *_regulator_get(struct device *dev, const char *id,return regulator; } +regulator_lock (rdev); regulator =create_regulator (rdev, dev, id); +regulator_unlock (rdev);if (regulator ==NULL ) { regulator =ERR_PTR (-ENOMEM );module_put (rdev->owner);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 55/282 x86/apic: Fix atomic update of offset in reserve_eilvt_offset()
In reply to Greg Kroah-HartmanFrom: Uros Bizjak <[email protected]>
[ Upstream commit f96fb2df3eb31ede1b34b0521560967310267750 ]
The detection of atomic update failure in reserve_eilvt_offset() is not correct. The value returned by atomic_cmpxchg() should be compared to the old value from the location to be updated.
If these two are the same, then atomic update succeeded and "eilvt_offsets[offset]" location is updated to "new" in an atomic way.
Otherwise, the atomic update failed and it should be retried with the value from "eilvt_offsets[offset]" - exactly what atomic_try_cmpxchg() does in a correct and more optimal way.
--- arch/x86/kernel/apic/apic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/apic.c +2 -3
@@ -410,10 +410,9 @@ static unsigned int reserve_eilvt_offset(int offset, unsigned int new)if (vector && !eilvt_entry_is_changeable (vector, new))/* may not change if vectors are different */ return rsvd; - rsvd =atomic_cmpxchg (&eilvt_offsets[offset], rsvd, new); - }while (rsvd != new); + }while (!atomic_try_cmpxchg (&eilvt_offsets[offset], &rsvd, new)); - rsvd &= ~APIC_EILVT_MASKED ; + rsvd = new & ~APIC_EILVT_MASKED ;if (rsvd && rsvd != vector)pr_info ("LVT offset %d assigned for vector 0x%02x\n" , offset, rsvd);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 56/282 media: dm1105: Fix use after free bug in dm1105_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 5abda7a16698d4d1f47af1168d8fa2c640116b4a ]
In dm1105_probe, it called dm1105_ir_init and bound &dm1105->ir.work with dm1105_emit_key.
When it handles IRQ request with dm1105_irq, it may call schedule_work to start the work.
When we call dm1105_remove to remove the driver, there may be a sequence as follows:
Fix it by finishing the work before cleanup in dm1105_remove
CPU0 CPU1
|dm1105_emit_key
dm1105_remove |
dm1105_ir_exit |
rc_unregister_device |
rc_free_device |
rc_dev_release |
kfree(dev); |
|
| rc_keydown
| //use--- drivers/media/pci/dm1105/dm1105.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/dm1105/dm1105.c +1 -0
@@ -1179,6 +1179,7 @@ static void dm1105_remove(struct pci_dev *pdev)struct dvb_demux *dvbdemux = &dev->demux;struct dmx_demux *dmx = &dvbdemux->dmx; +cancel_work_sync (&dev->ir.work);dm1105_ir_exit (dev); dmx->close (dmx);dvb_net_release (&dev->dvbnet);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 57/282 media: saa7134: fix use after free bug in saa7134_finidev due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 30cf57da176cca80f11df0d9b7f71581fe601389 ]
In saa7134_initdev, it will call saa7134_hwinit1. There are three function invoking here: saa7134_video_init1, saa7134_ts_init1 and saa7134_vbi_init1.
All of them will init a timer with same function. Take saa7134_video_init1 as an example. It'll bound &dev->video_q.timeout with saa7134_buffer_timeout.
In buffer_activate, the timer funtcion is started.
If we remove the module or device which will call saa7134_finidev to make cleanup, there may be a unfinished work. The possible sequence is as follows, which will cause a typical UAF bug.
Fix it by canceling the timer works accordingly before cleanup in saa7134_finidev.
CPU0 CPU1
|saa7134_buffer_timeout
saa7134_finidev |
kfree(dev); |
|
| saa7134_buffer_next
| //use dev--- drivers/media/pci/saa7134/saa7134-ts.c | 1 + drivers/media/pci/saa7134/saa7134-vbi.c | 1 + drivers/media/pci/saa7134/saa7134-video.c | 1 + 3 files changed, 3 insertions(+)
drivers/media/pci/saa7134/saa7134-ts.c +1 -0
@@ -300,6 +300,7 @@ int saa7134_ts_start(struct saa7134_dev *dev)int saa7134_ts_fini (struct saa7134_dev *dev) { +del_timer_sync (&dev->ts_q.timeout);saa7134_pgtable_free (dev->pci, &dev->ts_q.pt);return 0 ; }
drivers/media/pci/saa7134/saa7134-vbi.c +1 -0
@@ -185,6 +185,7 @@ int saa7134_vbi_init1(struct saa7134_dev *dev)int saa7134_vbi_fini (struct saa7134_dev *dev) {/* nothing */ +del_timer_sync (&dev->vbi_q.timeout);return 0 ; }
drivers/media/pci/saa7134/saa7134-video.c +1 -0
@@ -2154,6 +2154,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)void saa7134_video_fini (struct saa7134_dev *dev) { +del_timer_sync (&dev->video_q.timeout);/* free stuff */ vb2_queue_release (&dev->video_vbq);saa7134_pgtable_free (dev->pci, &dev->video_q.pt);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 40/282 EDAC/skx: Fix overflows on the DRAM row address mapping arrays
In reply to Greg Kroah-HartmanFrom: Qiuxu Zhuo <[email protected]>
[ Upstream commit 71b1e3ba3fed5a34c5fac6d3a15c2634b04c1eb7 ]
The current DRAM row address mapping arrays skx_{open,close}_row[] only support ranks with sizes up to 16G. Decoding a rank address to a DRAM row address for a 32G rank by using either one of the above arrays by the skx_edac driver, will result in an overflow on the array.
For a 32G rank, the most significant DRAM row address bit (the bit17) is mapped from the bit34 of the rank address. Add this new mapping item to both arrays to fix the overflow issue.
--- drivers/edac/skx_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/skx_base.c +2 -2
@@ -459,7 +459,7 @@ static bool skx_rir_decode(struct decoded_addr *res) }static u8 skx_close_row[] = { -15 ,16 ,17 ,18 ,20 ,21 ,22 ,28 ,10 ,11 ,12 ,13 ,29 ,30 ,31 ,32 ,33 +15 ,16 ,17 ,18 ,20 ,21 ,22 ,28 ,10 ,11 ,12 ,13 ,29 ,30 ,31 ,32 ,33 ,34 };static u8 skx_close_column[] = {
@@ -467,7 +467,7 @@ static u8 skx_close_column[] = { };static u8 skx_open_row[] = { -14 ,15 ,16 ,20 ,28 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,29 ,30 ,31 ,32 ,33 +14 ,15 ,16 ,20 ,28 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,29 ,30 ,31 ,32 ,33 ,34 };static u8 skx_open_column[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 58/282 media: rcar_fdp1: simplify error check logic at fdp_open()
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit fa9f443f7c962d072d150472e2bb77de39817a9a ]
Avoid some code duplication by moving the common error path logic at fdp_open().
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/media/platform/rcar_fdp1.c +8 -7
@@ -2121,9 +2121,7 @@ static int fdp1_open(struct file *file)if (ctx->hdl.error) { ret = ctx->hdl.error; -v4l2_ctrl_handler_free (&ctx->hdl); -kfree (ctx); - goto done; + goto error_ctx; } ctx->fh.ctrl_handler = &ctx->hdl;
@@ -2137,10 +2135,7 @@ static int fdp1_open(struct file *file)if (IS_ERR (ctx->fh.m2m_ctx)) { ret =PTR_ERR (ctx->fh.m2m_ctx); - -v4l2_ctrl_handler_free (&ctx->hdl); -kfree (ctx); - goto done; + goto error_ctx; }/* Perform any power management required */
@@ -2151,6 +2146,12 @@ static int fdp1_open(struct file *file)dprintk (fdp1,"Created instance: %p, m2m_ctx: %p\n" , ctx, ctx->fh.m2m_ctx); +mutex_unlock (&fdp1->dev_mutex); +return 0 ; + +error_ctx: +v4l2_ctrl_handler_free (&ctx->hdl); +kfree (ctx); done:mutex_unlock (&fdp1->dev_mutex);return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 59/282 media: rcar_fdp1: fix pm_runtime_get_sync() usage count
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 45e75a8c6fa455a5909ac04db76a4b15d6bb8368 ]
The pm_runtime_get_sync() internally increments thedev->power.usage_count without decrementing it, even on errors.
Replace it by the new pm_runtime_resume_and_get(), introduced by:
commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter, avoiding
a potential PM usage counter leak.
Also, right now, the driver is ignoring any troubles when trying to do PM resume. So, add the proper error handling for the code.
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/media/platform/rcar_fdp1.c +11 -2
@@ -2139,7 +2139,9 @@ static int fdp1_open(struct file *file) }/* Perform any power management required */ -pm_runtime_get_sync (fdp1->dev); + ret =pm_runtime_resume_and_get (fdp1->dev); +if (ret <0 ) + goto error_pm;v4l2_fh_add (&ctx->fh);
@@ -2149,6 +2151,8 @@ static int fdp1_open(struct file *file)mutex_unlock (&fdp1->dev_mutex);return 0 ; +error_pm: +v4l2_m2m_ctx_release (ctx->fh.m2m_ctx); error_ctx:v4l2_ctrl_handler_free (&ctx->hdl);kfree (ctx);
@@ -2356,7 +2360,9 @@ static int fdp1_probe(struct platform_device *pdev)/* Power up the cells to read HW */ pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (fdp1->dev); + ret =pm_runtime_resume_and_get (fdp1->dev); +if (ret <0 ) + goto disable_pm; hw_version =fdp1_read (fdp1,FD1_IP_INTDATA );switch (hw_version) {
@@ -2385,6 +2391,9 @@ static int fdp1_probe(struct platform_device *pdev)return 0 ; +disable_pm: +pm_runtime_disable (fdp1->dev); + release_m2m:v4l2_m2m_release (fdp1->m2m_dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 60/282 media: rcar_fdp1: Make use of the helper function devm_platform_ioremap_resource()
In reply to Greg Kroah-HartmanFrom: Cai Huoqing <[email protected]>
[ Upstream commit 736cce12fa630e28705de06570d74f0513d948d5 ]
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/rcar_fdp1.c +1 -3
@@ -2260,7 +2260,6 @@ static int fdp1_probe(struct platform_device *pdev)struct fdp1_dev *fdp1;struct video_device *vfd;struct device_node *fcp_node; -struct resource *res;struct clk *clk;unsigned int i;
@@ -2287,8 +2286,7 @@ static int fdp1_probe(struct platform_device *pdev)platform_set_drvdata (pdev, fdp1);/* Memory-mapped registers */ - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - fdp1->regs =devm_ioremap_resource (&pdev->dev, res); + fdp1->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (fdp1->regs))return PTR_ERR (fdp1->regs);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 61/282 media: rcar_fdp1: Fix the correct variable assignments
In reply to Greg Kroah-HartmanFrom: Tang Bin <[email protected]>
[ Upstream commit af88c2adbb72a09ab1bb5c37ba388c98fecca69b ]
In the function fdp1_probe(), when get irq failed, the function platform_get_irq() log an error message, so remove redundant message here. And the variable type of "ret" is int, the "fdp1->irq" is unsigned int, when irq failed, this place maybe wrong, thus fix it.
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/media/platform/rcar_fdp1.c +3 -4
@@ -2291,11 +2291,10 @@ static int fdp1_probe(struct platform_device *pdev)return PTR_ERR (fdp1->regs);/* Interrupt service routine registration */ - fdp1->irq = ret =platform_get_irq (pdev,0 ); -if (ret <0 ) { -dev_err (&pdev->dev,"cannot find IRQ\n" ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 )return ret; - } + fdp1->irq = ret; ret =devm_request_irq (&pdev->dev, fdp1->irq, fdp1_irq_handler,0 ,dev_name (&pdev->dev), fdp1);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 62/282 media: rcar_fdp1: Fix refcount leak in probe and remove function
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit c766c90faf93897b77c9c5daa603cffab85ba907 ]
rcar_fcp_get() take reference, which should be balanced with rcar_fcp_put(). Add missing rcar_fcp_put() in fdp1_remove and the error paths of fdp1_probe() to fix this.
--- drivers/media/platform/rcar_fdp1.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/rcar_fdp1.c +8 -3
@@ -2317,8 +2317,10 @@ static int fdp1_probe(struct platform_device *pdev)/* Determine our clock rate */ clk =clk_get (&pdev->dev,NULL ); -if (IS_ERR (clk)) -return PTR_ERR (clk); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); + goto put_dev; + } fdp1->clk_rate =clk_get_rate (clk);clk_put (clk);
@@ -2327,7 +2329,7 @@ static int fdp1_probe(struct platform_device *pdev) ret =v4l2_device_register (&pdev->dev, &fdp1->v4l2_dev);if (ret) {v4l2_err (&fdp1->v4l2_dev,"Failed to register video device\n" ); -return ret; + goto put_dev; }/* M2M registration */
@@ -2397,6 +2399,8 @@ static int fdp1_probe(struct platform_device *pdev) unreg_dev:v4l2_device_unregister (&fdp1->v4l2_dev); +put_dev: +rcar_fcp_put (fdp1->fcp);return ret; }
@@ -2408,6 +2412,7 @@ static int fdp1_remove(struct platform_device *pdev)video_unregister_device (&fdp1->vfd);v4l2_device_unregister (&fdp1->v4l2_dev);pm_runtime_disable (&pdev->dev); +rcar_fcp_put (fdp1->fcp);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 63/282 media: rc: gpio-ir-recv: Fix support for wake-up
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 9c592f8ab114875fdb3b2040f01818e53de44991 ]
The driver was intended from the start to be a wake-up source for the system, however due to the absence of a suitable call to device_set_wakeup_capable(), the device_may_wakeup() call used to decide whether to enable the GPIO interrupt as a wake-up source would never happen. Lookup the DT standard "wakeup-source" property and call device_init_wakeup() to ensure the device is flagged as being wakeup capable.
--- drivers/media/rc/gpio-ir-recv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/gpio-ir-recv.c +2 -0
@@ -83,6 +83,8 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) rcdev->map_name =RC_MAP_EMPTY ; gpio_dev->rcdev = rcdev; +if (of_property_read_bool (np,"wakeup-source" )) +device_init_wakeup (dev, true); rc =devm_rc_register_device (dev, rcdev);if (rc <0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 64/282 regulator: stm32-pwr: fix of_iomap leak
In reply to Greg Kroah-HartmanFrom: YAN SHI <[email protected]>
[ Upstream commit c4a413e56d16a2ae84e6d8992f215c4dcc7fac20 ]
Smatch reports:drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.
In stm32_pwr_regulator_probe(), base is not released when devm_kzalloc() fails to allocate memory or devm_regulator_register() fails to register a new regulator device, which may cause a leak.
To fix this issue, replace of_iomap() with devm_platform_ioremap_resource(). devm_platform_ioremap_resource() is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe function succeeds or fails.
Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource() can either be a pointer to the remapped memory or an ERR_PTR() encoded error code if the operation fails.
--- drivers/regulator/stm32-pwr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/stm32-pwr.c +3 -4
@@ -129,17 +129,16 @@ static const struct regulator_desc stm32_pwr_desc[] = {static int stm32_pwr_regulator_probe (struct platform_device *pdev) { -struct device_node *np = pdev->dev.of_node;struct stm32_pwr_reg *priv;void __iomem *base;struct regulator_dev *rdev;struct regulator_config config = { };int i, ret =0 ; - base =of_iomap (np,0 ); -if (!base) { + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map IO memory\n" ); -return -ENOMEM ; +return PTR_ERR (base); } config.dev = &pdev->dev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 65/282 x86/ioapic: Dont return 0 from arch_dynirq_lower_bound()
In reply to Greg Kroah-HartmanFrom: Saurabh Sengar <[email protected]>
[ Upstream commit 5af507bef93c09a94fb8f058213b489178f4cbe5 ]
arch_dynirq_lower_bound() is invoked by the core interrupt code to retrieve the lowest possible Linux interrupt number for dynamically allocated interrupts like MSI.
The x86 implementation uses this to exclude the IO/APIC GSI space. This works correctly as long as there is an IO/APIC registered, but returns 0 if not. This has been observed in VMs where the BIOS does not advertise an IO/APIC.
0 is an invalid interrupt number except for the legacy timer interrupt on x86. The return value is unchecked in the core code, so it ends up to allocate interrupt number 0 which is subsequently considered to be invalid by the caller, e.g. the MSI allocation code.
The function has already a check for 0 in the case that an IO/APIC is registered, as ioapic_dynirq_base is 0 in case of device tree setups.
Consolidate this and zero check for both ioapic_dynirq_base and gsi_top, which is used in the case that no IO/APIC is registered.
--- arch/x86/kernel/apic/io_apic.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +9 -5
@@ -2455,17 +2455,21 @@ static int io_apic_get_redir_entries(int ioapic)unsigned int arch_dynirq_lower_bound (unsigned int from) { +unsigned int ret; +/* * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use * gsi_top if ioapic_dynirq_base hasn't been initialized yet. */ -if (!ioapic_initialized) -return gsi_top; + ret = ioapic_dynirq_base ? : gsi_top; +/* -* For DT enabled machines ioapic_dynirq_base is irrelevant and not -* updated. So simply return @from if ioapic_dynirq_base == 0. +* For DT enabled machines ioapic_dynirq_base is irrelevant and +* always 0. gsi_top can be 0 if there is no IO/APIC registered. +* 0 is an invalid interrupt number for dynamic allocations. Return +* @from instead. */ -return ioapic_dynirq_base ? : from; +return ret ? : from; }#ifdef CONFIG_X86_32
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 66/282 arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step
In reply to Greg Kroah-HartmanFrom: Sumit Garg <[email protected]>
[ Upstream commit af6c0bd59f4f3ad5daad2f7b777954b1954551d5 ]
Currently only the first attempt to single-step has any effect. After that all further stepping remains "stuck" at the same program counter value.
Refer to the ARM Architecture Reference Manual (ARM DDI 0487E.a) D2.12, PSTATE.SS=1 should be set at each step before transferring the PE to the 'Active-not-pending' state. The problem here is PSTATE.SS=1 is not set since the second single-step.
After the first single-step, the PE transferes to the 'Inactive' state, with PSTATE.SS=0 and MDSCR.SS=1, thus PSTATE.SS won't be set to 1 due to kernel_active_single_step()=true. Then the PE transferes to the 'Active-pending' state when ERET and returns to the debugger by step exception.
Before this patch:
==================
Entering kdb (current=0xffff3376039f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb>
[0]kdb>
[0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffa45c13d09290 (write_sysrq_trigger)
is enabled addr at ffffa45c13d09290, hardtype=0 installed=0
[0]kdb> go
$ echo h > /proc/sysrq-trigger
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to Breakpoint @ 0xffffad651a309290 [1]kdb> ss
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb> ss
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb>
After this patch:
=================
Entering kdb (current=0xffff6851c39f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffc02d2dd09290 (write_sysrq_trigger)
is enabled addr at ffffc02d2dd09290, hardtype=0 installed=0
[0]kdb> go
$ echo h > /proc/sysrq-trigger
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to Breakpoint @ 0xffffc02d2dd09290 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09294 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09298 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd0929c [1]kdb>
--- arch/arm64/include/asm/debug-monitors.h | 1 + arch/arm64/kernel/debug-monitors.c | 5 +++++ arch/arm64/kernel/kgdb.c | 2 ++ 3 files changed, 8 insertions(+)
arch/arm64/include/asm/debug-monitors.h +1 -0
@@ -116,6 +116,7 @@ void user_regs_reset_single_step(struct user_pt_regs *regs,void kernel_enable_single_step (struct pt_regs *regs);void kernel_disable_single_step (void );int kernel_active_single_step (void ); +void kernel_rewind_single_step (struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT int reinstall_suspended_bps (struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +5 -0
@@ -441,6 +441,11 @@ int kernel_active_single_step(void) }NOKPROBE_SYMBOL (kernel_active_single_step); +void kernel_rewind_single_step (struct pt_regs *regs) +{ +set_regs_spsr_ss (regs); +} +/* ptrace API */ void user_enable_single_step (struct task_struct *task) {
arch/arm64/kernel/kgdb.c +2 -0
@@ -223,6 +223,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,*/ if (!kernel_active_single_step ())kernel_enable_single_step (linux_regs); +else +kernel_rewind_single_step (linux_regs); err =0 ;break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 67/282 debugobject: Prevent init race with static objects
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 63a759694eed61025713b3e14dd827c8548daadc ]
Statically initialized objects are usually not initialized via the init() function of the subsystem. They are special cased and the subsystem provides a function to validate whether an object which is not yet tracked by debugobjects is statically initialized. This means the object is started to be tracked on first use, e.g. activation.
This works perfectly fine, unless there are two concurrent operations on that object. Schspa decoded the problem:
T0 T1
debug_object_assert_init(addr)
lock_hash_bucket()
obj = lookup_object(addr);
if (!obj) {
unlock_hash_bucket();
- > preemption
lock_subsytem_object(addr);
activate_object(addr)
lock_hash_bucket();
obj = lookup_object(addr);
if (!obj) {
unlock_hash_bucket();
if (is_static_object(addr))
init_and_track(addr);
lock_hash_bucket();
obj = lookup_object(addr);
obj->state = ACTIVATED;
unlock_hash_bucket();
subsys function modifies content of addr,
so static object detection does
not longer work.
unlock_subsytem_object(addr);
if (is_static_object(addr)) <- Fails
debugobject emits a warning and invokes the fixup function which
reinitializes the already active object in the worst case.This race exists forever, but was never observed until mod_timer() got a debug_object_assert_init() added which is outside of the timer base lock held section right at the beginning of the function to cover the lockless early exit points too.
Rework the code so that the lookup, the static object check and the tracking object association happens atomically under the hash bucket lock. This prevents the issue completely as all callers are serialized on the hash bucket lock and therefore cannot observe inconsistent state.
--- lib/debugobjects.c | 125 ++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 59 deletions(-)
lib/debugobjects.c +66 -59
@@ -218,10 +218,6 @@ static struct debug_obj *__alloc_object(struct hlist_head *list)return obj; } -/* -* Allocate a new object. If the pool is empty, switch off the debugger. -* Must be called with interrupts disabled. -*/ static struct debug_obj *alloc_object (void *addr,struct debug_bucket *b,struct debug_obj_descr *descr) {
@@ -528,11 +524,49 @@ static void debug_object_is_on_stack(void *addr, int onstack)WARN_ON (1 ); } +static struct debug_obj *lookup_object_or_alloc (void *addr,struct debug_bucket *b, +struct debug_obj_descr *descr, +bool onstack,bool alloc_ifstatic) +{ +struct debug_obj *obj =lookup_object (addr, b); +enum debug_obj_state state =ODEBUG_STATE_NONE ; + +if (likely (obj)) +return obj; + +/* +* debug_object_init() unconditionally allocates untracked +* objects. It does not matter whether it is a static object or +* not. +* +* debug_object_assert_init() and debug_object_activate() allow +* allocation only if the descriptor callback confirms that the +* object is static and considered initialized. For non-static +* objects the allocation needs to be done from the fixup callback. +*/ +if (unlikely (alloc_ifstatic)) { +if (!descr->is_static_object || !descr->is_static_object (addr)) +return ERR_PTR (-ENOENT ); +/* Statically allocated objects are considered initialized */ + state =ODEBUG_STATE_INIT ; + } + + obj =alloc_object (addr, b, descr); +if (likely (obj)) { + obj->state = state; +debug_object_is_on_stack (addr, onstack); +return obj; + } + +/* Out of memory. Do the cleanup outside of the locked region */ + debug_objects_enabled =0 ; +return NULL ; +} +static void __debug_object_init (void *addr,struct debug_obj_descr *descr,int onstack) {enum debug_obj_state state; -bool check_stack = false;struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;
@@ -543,16 +577,11 @@ __debug_object_init(void *addr, struct debug_obj_descr *descr, int onstack)raw_spin_lock_irqsave (&db->lock, flags); - obj =lookup_object (addr, db); -if (!obj) { - obj =alloc_object (addr, db, descr); -if (!obj) { - debug_objects_enabled =0 ; -raw_spin_unlock_irqrestore (&db->lock, flags); -debug_objects_oom (); -return ; - } - check_stack = true; + obj =lookup_object_or_alloc (addr, db, descr, onstack, false); +if (unlikely (!obj)) { +raw_spin_unlock_irqrestore (&db->lock, flags); +debug_objects_oom (); +return ; }switch (obj->state) {
@@ -578,8 +607,6 @@ __debug_object_init(void *addr, struct debug_obj_descr *descr, int onstack) }raw_spin_unlock_irqrestore (&db->lock, flags); -if (check_stack) -debug_object_is_on_stack (addr, onstack); }/**
@@ -619,14 +646,12 @@ EXPORT_SYMBOL_GPL(debug_object_init_on_stack);*/ int debug_object_activate (void *addr,struct debug_obj_descr *descr) { +struct debug_obj o = { .object = addr, .state =ODEBUG_STATE_NOTAVAILABLE , .descr = descr };enum debug_obj_state state;struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;int ret; -struct debug_obj o = { .object = addr, - .state =ODEBUG_STATE_NOTAVAILABLE , - .descr = descr };if (!debug_objects_enabled)return 0 ;
@@ -635,8 +660,8 @@ int debug_object_activate(void *addr, struct debug_obj_descr *descr)raw_spin_lock_irqsave (&db->lock, flags); - obj =lookup_object (addr, db); -if (obj) { + obj =lookup_object_or_alloc (addr, db, descr, false, true); +if (likely (!IS_ERR_OR_NULL (obj))) {bool print_object = false;switch (obj->state) {
@@ -669,24 +694,16 @@ int debug_object_activate(void *addr, struct debug_obj_descr *descr)raw_spin_unlock_irqrestore (&db->lock, flags); -/* -* We are here when a static object is activated. We -* let the type specific code confirm whether this is -* true or not. if true, we just make sure that the -* static object is tracked in the object tracker. If -* not, this must be a bug, so we try to fix it up. -*/ -if (descr->is_static_object && descr->is_static_object (addr)) { -/* track this static object */ -debug_object_init (addr, descr); -debug_object_activate (addr, descr); - }else { -debug_print_object (&o,"activate" ); - ret =debug_object_fixup (descr->fixup_activate, addr, -ODEBUG_STATE_NOTAVAILABLE ); -return ret ?0 : -EINVAL ; +/* If NULL the allocation has hit OOM */ +if (!obj) { +debug_objects_oom (); +return 0 ; } -return 0 ; + +/* Object is neither static nor tracked. It's not initialized */ +debug_print_object (&o,"activate" ); + ret =debug_object_fixup (descr->fixup_activate, addr,ODEBUG_STATE_NOTAVAILABLE ); +return ret ?0 : -EINVAL ; }EXPORT_SYMBOL_GPL (debug_object_activate);
@@ -840,6 +857,7 @@ EXPORT_SYMBOL_GPL(debug_object_free);*/ void debug_object_assert_init (void *addr,struct debug_obj_descr *descr) { +struct debug_obj o = { .object = addr, .state =ODEBUG_STATE_NOTAVAILABLE , .descr = descr };struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;
@@ -850,31 +868,20 @@ void debug_object_assert_init(void *addr, struct debug_obj_descr *descr) db =get_bucket ((unsigned long ) addr);raw_spin_lock_irqsave (&db->lock, flags); + obj =lookup_object_or_alloc (addr, db, descr, false, true); +raw_spin_unlock_irqrestore (&db->lock, flags); +if (likely (!IS_ERR_OR_NULL (obj))) +return ; - obj =lookup_object (addr, db); +/* If NULL the allocation has hit OOM */ if (!obj) { -struct debug_obj o = { .object = addr, - .state =ODEBUG_STATE_NOTAVAILABLE , - .descr = descr }; - -raw_spin_unlock_irqrestore (&db->lock, flags); -/* -* Maybe the object is static, and we let the type specific -* code confirm. Track this static object if true, else invoke -* fixup. -*/ -if (descr->is_static_object && descr->is_static_object (addr)) { -/* Track this static object */ -debug_object_init (addr, descr); - }else { -debug_print_object (&o,"assert_init" ); -debug_object_fixup (descr->fixup_assert_init, addr, -ODEBUG_STATE_NOTAVAILABLE ); - } +debug_objects_oom ();return ; } -raw_spin_unlock_irqrestore (&db->lock, flags); +/* Object is neither tracked nor static. It's not initialized. */ +debug_print_object (&o,"assert_init" ); +debug_object_fixup (descr->fixup_assert_init, addr,ODEBUG_STATE_NOTAVAILABLE ); }EXPORT_SYMBOL_GPL (debug_object_assert_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 41/282 ARM: dts: qcom: ipq4019: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 2540279e9a9e74fc880d1e4c83754ecfcbe290a0 ]
For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI address (0x40200000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses.
--- arch/arm/boot/dts/qcom-ipq4019.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -2
@@ -393,8 +393,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000>, - <0x82000000 0 0x40300000 0x40300000 0 0x00d00000>; + ranges = <0x81000000 0x0 0x00000000 0x40200000 0x0 0x00100000>, + <0x82000000 0x0 0x40300000 0x40300000 0x0 0x00d00000>; interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 68/282 timekeeping: Split jiffies seqlock
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit e5d4d1756b07d9490a0269a9e68c1e05ee1feb9b ]
seqlock consists of a sequence counter and a spinlock_t which is used to serialize the writers. spinlock_t is substituted by a "sleeping" spinlock on PREEMPT_RT enabled kernels which breaks the usage in the timekeeping code as the writers are executed in hard interrupt and therefore non-preemptible context even on PREEMPT_RT.
The spinlock in seqlock cannot be unconditionally replaced by a raw_spinlock_t as many seqlock users have nesting spinlock sections or other code which is not suitable to run in truly atomic context on RT.
Instead of providing a raw_seqlock API for a single use case, open code the seqlock for the jiffies use case and implement it with a raw_spinlock_t and a sequence counter.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/jiffies.c | 7 ++++--- kernel/time/tick-common.c | 10 ++++++---- kernel/time/tick-sched.c | 19 ++++++++++++------- kernel/time/timekeeping.c | 6 ++++-- kernel/time/timekeeping.h | 3 ++- 5 files changed, 28 insertions(+), 17 deletions(-)
kernel/time/jiffies.c +4 -3
@@ -58,7 +58,8 @@ static struct clocksource clocksource_jiffies = { .max_cycles = 10, }; -__cacheline_aligned_in_smp DEFINE_SEQLOCK (jiffies_lock ); +__cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK (jiffies_lock ); +__cacheline_aligned_in_smp seqcount_t jiffies_seq;#if (BITS_PER_LONG <64 )u64 get_jiffies_64 (void )
@@ -67,9 +68,9 @@ u64 get_jiffies_64(void)u64 ret;do { - seq =read_seqbegin (&jiffies_lock); + seq =read_seqcount_begin (&jiffies_seq); ret = jiffies_64; - }while (read_seqretry (&jiffies_lock, seq)); + }while (read_seqcount_retry (&jiffies_seq, seq));return ret; }EXPORT_SYMBOL (get_jiffies_64);
kernel/time/tick-common.c +6 -4
@@ -84,13 +84,15 @@ int tick_is_oneshot_available(void)static void tick_periodic (int cpu) {if (tick_do_timer_cpu == cpu) { -write_seqlock (&jiffies_lock); +raw_spin_lock (&jiffies_lock); +write_seqcount_begin (&jiffies_seq);/* Keep track of the next tick event */ tick_next_period =ktime_add (tick_next_period, tick_period);do_timer (1 ); -write_sequnlock (&jiffies_lock); +write_seqcount_end (&jiffies_seq); +raw_spin_unlock (&jiffies_lock);update_wall_time (); }
@@ -162,9 +164,9 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)ktime_t next;do { - seq =read_seqbegin (&jiffies_lock); + seq =read_seqcount_begin (&jiffies_seq); next = tick_next_period; - }while (read_seqretry (&jiffies_lock, seq)); + }while (read_seqcount_retry (&jiffies_seq, seq));clockevents_switch_state (dev,CLOCK_EVT_STATE_ONESHOT );
kernel/time/tick-sched.c +12 -7
@@ -65,7 +65,8 @@ static void tick_do_update_jiffies64(ktime_t now)return ;/* Reevaluate with jiffies_lock held */ -write_seqlock (&jiffies_lock); +raw_spin_lock (&jiffies_lock); +write_seqcount_begin (&jiffies_seq); delta =ktime_sub (now, last_jiffies_update);if (delta >= tick_period) {
@@ -91,10 +92,12 @@ static void tick_do_update_jiffies64(ktime_t now)/* Keep the tick_next_period variable up to date */ tick_next_period =ktime_add (last_jiffies_update, tick_period); }else { -write_sequnlock (&jiffies_lock); +write_seqcount_end (&jiffies_seq); +raw_spin_unlock (&jiffies_lock);return ; } -write_sequnlock (&jiffies_lock); +write_seqcount_end (&jiffies_seq); +raw_spin_unlock (&jiffies_lock);update_wall_time (); }
@@ -105,12 +108,14 @@ static ktime_t tick_init_jiffy_update(void) {ktime_t period; -write_seqlock (&jiffies_lock); +raw_spin_lock (&jiffies_lock); +write_seqcount_begin (&jiffies_seq);/* Did we start the jiffies update yet ? */ if (last_jiffies_update ==0 ) last_jiffies_update = tick_next_period; period = last_jiffies_update; -write_sequnlock (&jiffies_lock); +write_seqcount_end (&jiffies_seq); +raw_spin_unlock (&jiffies_lock);return period; }
@@ -665,10 +670,10 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)/* Read jiffies and the time when jiffies were updated last */ do { - seq =read_seqbegin (&jiffies_lock); + seq =read_seqcount_begin (&jiffies_seq); basemono = last_jiffies_update; basejiff = jiffies; - }while (read_seqretry (&jiffies_lock, seq)); + }while (read_seqcount_retry (&jiffies_seq, seq)); ts->last_jiffies = basejiff; ts->timer_expires_base = basemono;
kernel/time/timekeeping.c +4 -2
@@ -2415,8 +2415,10 @@ EXPORT_SYMBOL(hardpps);*/ void xtime_update (unsigned long ticks) { -write_seqlock (&jiffies_lock); +raw_spin_lock (&jiffies_lock); +write_seqcount_begin (&jiffies_seq);do_timer (ticks); -write_sequnlock (&jiffies_lock); +write_seqcount_end (&jiffies_seq); +raw_spin_unlock (&jiffies_lock);update_wall_time (); }
kernel/time/timekeeping.h +2 -1
@@ -25,7 +25,8 @@ static inline void sched_clock_resume(void) { }extern void do_timer (unsigned long ticks);extern void update_wall_time (void ); -extern seqlock_t jiffies_lock; +extern raw_spinlock_t jiffies_lock; +extern seqcount_t jiffies_seq;#define CS_NAME_LEN 32
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 69/282 tick/sched: Use tick_next_period for lockless quick check
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 372acbbaa80940189593f9d69c7c069955f24f7a ]
No point in doing calculations.
tick_next_period = last_jiffies_update + tick_period
Just check whether now is before tick_next_period to figure out whether jiffies need an update.
Add a comment why the intentional data race in the quick check is safe or not so safe in a 32bit corner case and why we don't worry about it.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 46 ++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-)
kernel/time/tick-sched.c +33 -13
@@ -57,11 +57,29 @@ static void tick_do_update_jiffies64(ktime_t now)ktime_t delta;/* -* Do a quick check without holding jiffies_lock: -* The READ_ONCE() pairs with two updates done later in this function. +* Do a quick check without holding jiffies_lock. The READ_ONCE() +* pairs with the update done later in this function. +* +* This is also an intentional data race which is even safe on +* 32bit in theory. If there is a concurrent update then the check +* might give a random answer. It does not matter because if it +* returns then the concurrent update is already taking care, if it +* falls through then it will pointlessly contend on jiffies_lock. +* +* Though there is one nasty case on 32bit due to store tearing of +* the 64bit value. If the first 32bit store makes the quick check +* return on all other CPUs and the writing CPU context gets +* delayed to complete the second store (scheduled out on virt) +* then jiffies can become stale for up to ~2^32 nanoseconds +* without noticing. After that point all CPUs will wait for +* jiffies lock. +* +* OTOH, this is not any different than the situation with NOHZ=off +* where one CPU is responsible for updating jiffies and +* timekeeping. If that CPU goes out for lunch then all other CPUs +* will operate on stale jiffies until it decides to come back. */ - delta =ktime_sub (now,READ_ONCE (last_jiffies_update)); -if (delta < tick_period) +if (ktime_before (now,READ_ONCE (tick_next_period)))return ;/* Reevaluate with jiffies_lock held */
@@ -72,9 +90,8 @@ static void tick_do_update_jiffies64(ktime_t now)if (delta >= tick_period) { delta =ktime_sub (delta, tick_period); -/* Pairs with the lockless read in this function. */ -WRITE_ONCE (last_jiffies_update, -ktime_add (last_jiffies_update, tick_period)); + last_jiffies_update =ktime_add (last_jiffies_update, + tick_period);/* Slow path for long timeouts */ if (unlikely (delta >= tick_period)) {
@@ -82,15 +99,18 @@ static void tick_do_update_jiffies64(ktime_t now) ticks =ktime_divns (delta, incr); -/* Pairs with the lockless read in this function. */ -WRITE_ONCE (last_jiffies_update, -ktime_add_ns (last_jiffies_update, - incr * ticks)); + last_jiffies_update =ktime_add_ns (last_jiffies_update, + incr * ticks); }do_timer (++ticks); -/* Keep the tick_next_period variable up to date */ - tick_next_period =ktime_add (last_jiffies_update, tick_period); +/* +* Keep the tick_next_period variable up to date. +* WRITE_ONCE() pairs with the READ_ONCE() in the lockless +* quick check above. +*/ +WRITE_ONCE (tick_next_period, +ktime_add (last_jiffies_update, tick_period)); }else {write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 42/282 ARM: dts: qcom: ipq8064: reduce pci IO size to 64K
In reply to Greg Kroah-HartmanFrom: Christian Marangi <[email protected]>
[ Upstream commit 8fafb7e5c041814876266259e5e439f93571dcef ]
The current value for pci IO is problematic for ath10k wifi card commonly connected to ipq8064 SoC.
The current value is probably a typo and is actually uncommon to find 1MB IO space even on a x86 arch. Also with recent changes to the pci driver, pci1 and pci2 now fails to function as any connected device fails any reg read/write. Reduce this to 64K as it should be more than enough and 3 * 64K of total IO space doesn't exceed the IO_SPACE_LIMIT hardcoded for the ARM arch.
Stable-dep-of: 0b16b34e4916 ("ARM: dts: qcom: ipq8064: Fix the PCI I/O port range")
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +3 -3
@@ -451,7 +451,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
@@ -502,7 +502,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
@@ -553,7 +553,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 43/282 ARM: dts: qcom: ipq8064: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 0b16b34e491629016109e56747ad64588074194b ]
For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI addresses (0x0fe00000, 0x31e00000, 0x35e00000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses.
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +6 -6
@@ -451,8 +451,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x0fe00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x08000000 0x08000000 0x0 0x07e00000>; /* MEM */ interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -502,8 +502,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x31e00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x2e000000 0x2e000000 0x0 0x03e00000>; /* MEM */ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -553,8 +553,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x35e00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x32000000 0x32000000 0x0 0x03e00000>; /* MEM */ interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 44/282 media: bdisp: Add missing check for create_workqueue
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 2371adeab717d8fe32144a84f3491a03c5838cfb ]
Add the check for the return value of the create_workqueue in order to avoid NULL pointer dereference.
--- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +2 -0
@@ -1308,6 +1308,8 @@ static int bdisp_probe(struct platform_device *pdev)init_waitqueue_head (&bdisp->irq_queue);INIT_DELAYED_WORK (&bdisp->timeout_work, bdisp_irq_timeout); bdisp->work_queue =create_workqueue (BDISP_NAME ); +if (!bdisp->work_queue) +return -ENOMEM ;spin_lock_init (&bdisp->slock);mutex_init (&bdisp->lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 45/282 media: uapi: add MEDIA_BUS_FMT_METADATA_FIXED media bus format.
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 6ad253cc3436269fc6bcff03d704c672f368da0a ]
MEDIA_BUS_FMT_METADATA_FIXED should be used when the same driver handles both sides of the link and the bus format is a fixed metadata format that is not configurable from userspace.
The width and height will be set to 0 for this format.
Stable-dep-of: eed9496a0501 ("media: av7110: prevent underflow in write_ts_to_decoder()")
--- .../media/uapi/v4l/subdev-formats.rst | 27 +++++++++++++++++++ include/uapi/linux/media-bus-format.h | 8 ++++++ 2 files changed, 35 insertions(+)
Documentation/media/uapi/v4l/subdev-formats.rst +27 -0
@@ -7794,3 +7794,30 @@ formats. - 0x5001 - Interleaved raw UYVY and JPEG image format with embedded meta-data used by Samsung S3C73MX camera sensors. + +.. _v4l2-mbus-metadata-fmts: + +Metadata Formats +^^^^^^^^^^^^^^^^ + +This section lists all metadata formats. + +The following table lists the existing metadata formats. + +.. tabularcolumns:: |p{8.0cm}|p{1.4cm}|p{7.7cm}| + +.. flat-table:: Metadata formats + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Comments + * .. _MEDIA-BUS-FMT-METADATA-FIXED: + + - MEDIA_BUS_FMT_METADATA_FIXED + - 0x7001 + - This format should be used when the same driver handles + both sides of the link and the bus format is a fixed + metadata format that is not configurable from userspace. + Width and height will be set to 0 for this format.
include/uapi/linux/media-bus-format.h +8 -0
@@ -155,4 +155,12 @@/* HSV - next is 0x6002 */ #define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001 +/* +* This format should be used when the same driver handles +* both sides of the link and the bus format is a fixed +* metadata format that is not configurable from userspace. +* Width and height will be set to 0 for this format. +*/ +#define MEDIA_BUS_FMT_METADATA_FIXED 0x7001 +#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 46/282 media: av7110: prevent underflow in write_ts_to_decoder()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit eed9496a0501357aa326ddd6b71408189ed872eb ]
The buf[4] value comes from the user via ts_play(). It is a value in the u8 range. The final length we pass to av7110_ipack_instant_repack() is "len - (buf[4] + 1) - 4" so add a check to ensure that the length is not negative. It's not clear that passing a negative len value does anything bad necessarily, but it's not best practice.
With the new bounds checking the "if (!len)" condition is no longer possible or required so remove that.
--- drivers/media/pci/ttpci/av7110_av.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/ttpci/av7110_av.c +2 -2
@@ -822,10 +822,10 @@ static int write_ts_to_decoder(struct av7110 *av7110, int type, const u8 *buf, sav7110_ipack_flush (ipack);if (buf[3 ] &ADAPT_FIELD ) { +if (buf[4 ] > len -1 -4 ) +return 0 ; len -= buf[4 ] +1 ; buf += buf[4 ] +1 ; -if (!len) -return 0 ; }av7110_ipack_instant_repack (buf +4 , len -4 , ipack);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 47/282 firmware: qcom_scm: Clear download bit during reboot
In reply to Greg Kroah-HartmanFrom: Mukesh Ojha <[email protected]>
[ Upstream commit 781d32d1c9709fd25655c4e3e3e15370ae4ae4db ]
During normal restart of a system download bit should be cleared irrespective of whether download mode is set or not.
--- drivers/firmware/qcom_scm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/firmware/qcom_scm.c +1 -2
@@ -585,8 +585,7 @@ static int qcom_scm_probe(struct platform_device *pdev)static void qcom_scm_shutdown (struct platform_device *pdev) {/* Clean shutdown, disable download mode to allow normal restart */ -if (download_mode) -qcom_scm_set_download_mode (false); +qcom_scm_set_download_mode (false); }static const struct of_device_id qcom_scm_dt_match[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 38/282 arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit fb76b0fae3ca880363214e1dcd6513ab8bd529e7 ]
According to the R-Car Series, 3rd Generation Hardware User’s Manual Rev. 2.30, the System CPU cores on R-Car E3 do not have their own power supply, but use the common internal power supply (typical 1.03V).
Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.
--- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +0 -3
@@ -60,17 +60,14 @@ opp-shared; opp-800000000 { opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1200000000 { opp-hz = /bits/ 64 <1200000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; opp-suspend; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 71/282 tick/sched: Optimize tick_do_update_jiffies64() further
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 7a35bf2a6a871cd0252cd371d741e7d070b53af9 ]
Now that it's clear that there is always one tick to account, simplify the calculations some more.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/time/tick-sched.c +6 -5
@@ -53,7 +53,7 @@ static ktime_t last_jiffies_update;*/ static void tick_do_update_jiffies64 (ktime_t now) { -unsigned long ticks =0 ; +unsigned long ticks =1 ;ktime_t delta;/*
@@ -91,20 +91,21 @@ static void tick_do_update_jiffies64(ktime_t now)write_seqcount_begin (&jiffies_seq); - last_jiffies_update =ktime_add (last_jiffies_update, tick_period); - delta =ktime_sub (now, tick_next_period);if (unlikely (delta >= tick_period)) {/* Slow path for long idle sleep times */ s64 incr =ktime_to_ns (tick_period); - ticks =ktime_divns (delta, incr); + ticks +=ktime_divns (delta, incr); last_jiffies_update =ktime_add_ns (last_jiffies_update, incr * ticks); + }else { + last_jiffies_update =ktime_add (last_jiffies_update, + tick_period); } -do_timer (++ticks); +do_timer (ticks);/* * Keep the tick_next_period variable up to date. WRITE_ONCE()
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 80/282 wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 15c8e267dfa62f207ee1db666c822324e3362b84 ]
rtw_mac_power_switch() calls rtw_pwr_seq_parser() which can return -EINVAL, -EBUSY or 0. Propagate the original error code instead of unconditionally returning -EINVAL in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/mac.c +4 -2
@@ -224,6 +224,7 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)struct rtw_pwr_seq_cmd **pwr_seq;u8 rpwm;bool cur_pwr; +int ret; rpwm =rtw_read8 (rtwdev, rtwdev->hci.rpwm_addr);
@@ -245,8 +246,9 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)return -EALREADY ; pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq; -if (rtw_pwr_seq_parser (rtwdev, pwr_seq)) -return -EINVAL ; + ret =rtw_pwr_seq_parser (rtwdev, pwr_seq); +if (ret) +return ret;return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 81/282 scm: fix MSG_CTRUNC setting condition for SO_PASSSEC
In reply to Greg Kroah-HartmanFrom: Alexander Mikhalitsyn <[email protected]>
[ Upstream commit a02d83f9947d8f71904eda4de046630c3eb6802c ]
Currently, kernel would set MSG_CTRUNC flag if msg_control buffer wasn't provided and SO_PASSCRED was set or if there was pending SCM_RIGHTS.
For some reason we have no corresponding check for SO_PASSSEC.
In the recvmsg(2) doc we have:
MSG_CTRUNC
indicates that some control data was discarded due to lack of space in the buffer for ancillary data.
So, we need to set MSG_CTRUNC flag for all types of SCM.
This change can break applications those don't check MSG_CTRUNC flag.
v2:
- commit message was rewritten according to Eric's suggestion
--- include/net/scm.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
include/net/scm.h +12 -1
@@ -105,16 +105,27 @@ static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct sc } } } + +static inline bool scm_has_secdata (struct socket *sock) +{ +return test_bit (SOCK_PASSSEC , &sock->flags); +}#else static inline void scm_passec (struct socket *sock,struct msghdr *msg,struct scm_cookie *scm) { } + +static inline bool scm_has_secdata (struct socket *sock) +{ +return false; +}#endif /* CONFIG_SECURITY_NETWORK */ static __inline__void scm_recv (struct socket *sock,struct msghdr *msg,struct scm_cookie *scm,int flags) {if (!msg->msg_control) { -if (test_bit (SOCK_PASSCRED , &sock->flags) || scm->fp) +if (test_bit (SOCK_PASSCRED , &sock->flags) || scm->fp || +scm_has_secdata (sock)) msg->msg_flags |=MSG_CTRUNC ;scm_destroy (scm);return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 82/282 vlan: partially enable SIOCSHWTSTAMP in container
In reply to Greg Kroah-HartmanFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit 731b73dba359e3ff00517c13aa0daa82b34ff466 ]
Setting timestamp filter was explicitly disabled on vlan devices in containers because it might affect other processes on the host. But it's absolutely legit in case when real device is in the same namespace.
--- net/8021q/vlan_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/8021q/vlan_dev.c +1 -1
@@ -366,7 +366,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)switch (cmd) {case SIOCSHWTSTAMP : -if (!net_eq (dev_net (dev), &init_net)) +if (!net_eq (dev_net (dev),dev_net (real_dev)))break ;/* fall through */ case SIOCGMIIPHY :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 83/282 net/packet: annotate accesses to po->xmit
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit b9d83ab8a708f23a4001d60e9d8d0b3be3d9f607 ]
po->xmit can be set from setsockopt(PACKET_QDISC_BYPASS), while read locklessly.
Use READ_ONCE()/WRITE_ONCE() to avoid potential load/store tearing issues.
--- net/packet/af_packet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/packet/af_packet.c +8 -4
@@ -266,7 +266,8 @@ static void packet_cached_dev_reset(struct packet_sock *po)static bool packet_use_direct_xmit (const struct packet_sock *po) { -return po->xmit == packet_direct_xmit; +/* Paired with WRITE_ONCE() in packet_setsockopt() */ +return READ_ONCE (po->xmit) == packet_direct_xmit; }static u16 packet_pick_tx_queue (struct sk_buff *skb)
@@ -2799,7 +2800,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)packet_inc_pending (&po->tx_ring); status =TP_STATUS_SEND_REQUEST ; - err = po->xmit (skb); +/* Paired with WRITE_ONCE() in packet_setsockopt() */ + err =READ_ONCE (po->xmit)(skb);if (unlikely (err !=0 )) {if (err >0 ) err =net_xmit_errno (err);
@@ -3002,7 +3004,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)virtio_net_hdr_set_proto (skb, &vnet_hdr); } - err = po->xmit (skb); +/* Paired with WRITE_ONCE() in packet_setsockopt() */ + err =READ_ONCE (po->xmit)(skb);if (unlikely (err !=0 )) {if (err >0 ) err =net_xmit_errno (err);
@@ -3949,7 +3952,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optvif (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; - po->xmit = val ? packet_direct_xmit : dev_queue_xmit; +/* Paired with all lockless reads of po->xmit */ +WRITE_ONCE (po->xmit, val ? packet_direct_xmit : dev_queue_xmit);return 0 ; }default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 84/282 net/packet: convert po->origdev to an atomic flag
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ee5675ecdf7a4e713ed21d98a70c2871d6ebed01 ]
syzbot/KCAN reported that po->origdev can be read
while another thread is changing its value.
We can avoid this splat by converting this field
to an actual bit.
Following patches will convert remaining 1bit fields.
--- net/packet/af_packet.c | 10 ++++------ net/packet/diag.c | 2 +- net/packet/internal.h | 22 +++++++++++++++++++++- 3 files changed, 26 insertions(+), 8 deletions(-)
net/packet/af_packet.c +4 -6
@@ -2125,7 +2125,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, sll = &PACKET_SKB_CB (skb)->sa.ll; sll->sll_hatype = dev->type; sll->sll_pkttype = skb->pkt_type; -if (unlikely (po->origdev)) +if (unlikely (packet_sock_flag (po,PACKET_SOCK_ORIGDEV ))) sll->sll_ifindex = orig_dev->ifindex;else sll->sll_ifindex = dev->ifindex;
@@ -2393,7 +2393,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, sll->sll_hatype = dev->type; sll->sll_protocol = skb->protocol; sll->sll_pkttype = skb->pkt_type; -if (unlikely (po->origdev)) +if (unlikely (packet_sock_flag (po,PACKET_SOCK_ORIGDEV ))) sll->sll_ifindex = orig_dev->ifindex;else sll->sll_ifindex = dev->ifindex;
@@ -3853,9 +3853,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optvif (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; -lock_sock (sk); - po->origdev = !!val; -release_sock (sk); +packet_sock_flag_set (po,PACKET_SOCK_ORIGDEV , val);return 0 ; }case PACKET_VNET_HDR :
@@ -4007,7 +4005,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, val = po->auxdata;break ;case PACKET_ORIGDEV : - val = po->origdev; + val =packet_sock_flag (po,PACKET_SOCK_ORIGDEV );break ;case PACKET_VNET_HDR : val = po->has_vnet_hdr;
net/packet/diag.c +1 -1
@@ -25,7 +25,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags |=PDI_RUNNING ;if (po->auxdata) pinfo.pdi_flags |=PDI_AUXDATA ; -if (po->origdev) +if (packet_sock_flag (po,PACKET_SOCK_ORIGDEV )) pinfo.pdi_flags |=PDI_ORIGDEV ;if (po->has_vnet_hdr) pinfo.pdi_flags |=PDI_VNETHDR ;
net/packet/internal.h +21 -1
@@ -115,9 +115,9 @@ struct packet_sock {int copy_thresh;spinlock_t bind_lock;struct mutex pg_vec_lock; +unsigned long flags;unsigned int running;/* bind_lock must be held */ unsigned int auxdata:1, /* writer must hold sock lock */ - origdev:1, has_vnet_hdr:1, tp_loss:1, tp_tx_has_off:1;
@@ -143,4 +143,24 @@ static struct packet_sock *pkt_sk(struct sock *sk) return (struct packet_sock *)sk; } +enum packet_sock_flags { +PACKET_SOCK_ORIGDEV , +}; + +static inline void packet_sock_flag_set (struct packet_sock *po, +enum packet_sock_flags flag, +bool val) +{ +if (val) +set_bit (flag, &po->flags); +else +clear_bit (flag, &po->flags); +} + +static inline bool packet_sock_flag (const struct packet_sock *po, +enum packet_sock_flags flag) +{ +return test_bit (flag, &po->flags); +} +#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 85/282 net/packet: convert po->auxdata to an atomic flag
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit fd53c297aa7b077ae98a3d3d2d3aa278a1686ba6 ]
po->auxdata can be read while another thread is changing its value, potentially raising KCSAN splat.
Convert it to PACKET_SOCK_AUXDATA flag.
--- net/packet/af_packet.c | 8 +++----- net/packet/diag.c | 2 +- net/packet/internal.h | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-)
net/packet/af_packet.c +3 -5
@@ -3456,7 +3456,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, copy_len); } -if (pkt_sk (sk)->auxdata) { +if (packet_sock_flag (pkt_sk (sk),PACKET_SOCK_AUXDATA )) {struct tpacket_auxdata aux; aux.tp_status =TP_STATUS_USER ;
@@ -3839,9 +3839,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optvif (copy_from_user (&val, optval,sizeof (val)))return -EFAULT ; -lock_sock (sk); - po->auxdata = !!val; -release_sock (sk); +packet_sock_flag_set (po,PACKET_SOCK_AUXDATA , val);return 0 ; }case PACKET_ORIGDEV :
@@ -4002,7 +4000,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,break ;case PACKET_AUXDATA : - val = po->auxdata; + val =packet_sock_flag (po,PACKET_SOCK_AUXDATA );break ;case PACKET_ORIGDEV : val =packet_sock_flag (po,PACKET_SOCK_ORIGDEV );
net/packet/diag.c +1 -1
@@ -23,7 +23,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags =0 ;if (po->running) pinfo.pdi_flags |=PDI_RUNNING ; -if (po->auxdata) +if (packet_sock_flag (po,PACKET_SOCK_AUXDATA )) pinfo.pdi_flags |=PDI_AUXDATA ;if (packet_sock_flag (po,PACKET_SOCK_ORIGDEV )) pinfo.pdi_flags |=PDI_ORIGDEV ;
net/packet/internal.h +2 -2
@@ -117,8 +117,7 @@ struct packet_sock {struct mutex pg_vec_lock;unsigned long flags;unsigned int running;/* bind_lock must be held */ - unsigned int auxdata:1, /* writer must hold sock lock */ - has_vnet_hdr:1, + unsigned int has_vnet_hdr:1, /* writer must hold sock lock */ tp_loss:1, tp_tx_has_off:1;int pressure;
@@ -145,6 +144,7 @@ static struct packet_sock *pkt_sk(struct sock *sk)enum packet_sock_flags {PACKET_SOCK_ORIGDEV , +PACKET_SOCK_AUXDATA , }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 86/282 scsi: target: iscsit: Fix TAS handling during conn cleanup
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit cc79da306ebb2edb700c3816b90219223182ac3c ]
Fix a bug added in commit f36199355c64 ("scsi: target: iscsi: Fix cmd abort fabric stop race").
If CMD_T_TAS is set on the se_cmd we must call iscsit_free_cmd() to do the last put on the cmd and free it, because the connection is down and we will not up sending the response and doing the put from the normal I/O path.
Add a check for CMD_T_TAS in iscsit_release_commands_from_conn() so we now detect this case and run iscsit_free_cmd().
--- drivers/target/iscsi/iscsi_target.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/target/iscsi/iscsi_target.c +9 -7
@@ -4084,9 +4084,12 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)list_for_each_entry_safe (cmd, cmd_tmp, &tmp_list, i_conn_node) {struct se_cmd *se_cmd = &cmd->se_cmd; -if (se_cmd->se_tfo !=NULL ) { -spin_lock_irq (&se_cmd->t_state_lock); -if (se_cmd->transport_state &CMD_T_ABORTED ) { +if (!se_cmd->se_tfo) +continue ; + +spin_lock_irq (&se_cmd->t_state_lock); +if (se_cmd->transport_state &CMD_T_ABORTED ) { +if (!(se_cmd->transport_state &CMD_T_TAS ))/* * LIO's abort path owns the cleanup for this, * so put it back on the list and let
@@ -4094,11 +4097,10 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)*/ list_move_tail (&cmd->i_conn_node, &conn->conn_cmd_list); - }else { - se_cmd->transport_state |=CMD_T_FABRIC_STOP ; - } -spin_unlock_irq (&se_cmd->t_state_lock); + }else { + se_cmd->transport_state |=CMD_T_FABRIC_STOP ; } +spin_unlock_irq (&se_cmd->t_state_lock); }spin_unlock_bh (&conn->cmd_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 87/282 scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS
In reply to Greg Kroah-HartmanFrom: Danila Chernetsov <[email protected]>
[ Upstream commit 75cb113cd43f06aaf4f1bda0069cfd5b98e909eb ]
When cmdid == CMDID_INT_CMDS, the 'cmds' pointer is NULL but is dereferenced below.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/scsi/megaraid.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/megaraid.c +1 -0
@@ -1439,6 +1439,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)*/ if (cmdid ==CMDID_INT_CMDS ) { scb = &adapter->int_scb; + cmd = scb->cmd;list_del_init (&scb->list); scb->state =SCB_FREE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 88/282 f2fs: handle dqget error in f2fs_transfer_project_quota()
In reply to Greg Kroah-HartmanFrom: Yangtao Li <[email protected]>
[ Upstream commit 8051692f5f23260215bfe9a72e712d93606acc5f ]
We should set the error code when dqget() failed.
--- fs/f2fs/file.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/f2fs/file.c +8 -7
@@ -2821,15 +2821,16 @@ int f2fs_transfer_project_quota(struct inode *inode, kprojid_t kprojid)struct dquot *transfer_to[MAXQUOTAS ] = {};struct f2fs_sb_info *sbi =F2FS_I_SB (inode);struct super_block *sb = sbi->sb; -int err =0 ; +int err; transfer_to[PRJQUOTA ] =dqget (sb,make_kqid_projid (kprojid)); -if (!IS_ERR (transfer_to[PRJQUOTA ])) { - err =__dquot_transfer (inode, transfer_to); -if (err) -set_sbi_flag (sbi,SBI_QUOTA_NEED_REPAIR ); -dqput (transfer_to[PRJQUOTA ]); - } +if (IS_ERR (transfer_to[PRJQUOTA ])) +return PTR_ERR (transfer_to[PRJQUOTA ]); + + err =__dquot_transfer (inode, transfer_to); +if (err) +set_sbi_flag (sbi,SBI_QUOTA_NEED_REPAIR ); +dqput (transfer_to[PRJQUOTA ]);return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 89/282 rtlwifi: Start changing RT_TRACE into rtl_dbg
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
[ Upstream commit 78a7245d84300cd616dbce26e6fc42a039a62279 ]
The macro name RT_TRACE makes it seem that it is used for tracing, when is actually used for debugging. Change the name to RT_DEBUG.
This step creates the new macro while keeping the old RT_TRACE to allow building. It will be removed at the end of the patch series.
Stable-dep-of: 905a9241e4e8 ("wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()")
--- drivers/net/wireless/realtek/rtlwifi/debug.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/realtek/rtlwifi/debug.h +11 -0
@@ -160,6 +160,10 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,const char *titlestring, const void *hexdata, int hexdatalen); +#define rtl_dbg (rtlpriv, comp, level, fmt, ...) \ + _rtl_dbg_trace(rtlpriv, comp, level, \ + fmt, ##__VA_ARGS__) +#define RT_TRACE (rtlpriv, comp, level, fmt, ...) \ _rtl_dbg_trace(rtlpriv, comp, level, \ fmt, ##__VA_ARGS__)
@@ -176,6 +180,13 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,struct rtl_priv ; +__printf(4, 5) +static inline void rtl_dbg (struct rtl_priv *rtlpriv, +u64 comp,int level, +const char *fmt, ...) +{ +} + __printf(4, 5) static inline void RT_TRACE(struct rtl_priv *rtlpriv, u64 comp, int level,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 72/282 tick: Get rid of tick_period
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit b996544916429946bf4934c1c01a306d1690972c ]
The variable tick_period is initialized to NSEC_PER_TICK / HZ during boot and never updated again.
If NSEC_PER_TICK is not an integer multiple of HZ this computation is less accurate than TICK_NSEC which has proper rounding in place.
Aside of the inaccuracy there is no reason for having this variable at all. It's just a pointless indirection and all usage sites can just use the TICK_NSEC constant.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-broadcast.c | 2 +- kernel/time/tick-common.c | 8 +++----- kernel/time/tick-internal.h | 1 - kernel/time/tick-sched.c | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 18 deletions(-)
kernel/time/tick-broadcast.c +1 -1
@@ -331,7 +331,7 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) bc_local =tick_do_periodic_broadcast ();if (clockevent_state_oneshot (dev)) { -ktime_t next =ktime_add (dev->next_event, tick_period); +ktime_t next =ktime_add_ns (dev->next_event,TICK_NSEC );clockevents_program_event (dev, next, true); }
kernel/time/tick-common.c +3 -5
@@ -30,7 +30,6 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);* Tick next event: keeps track of the tick time */ ktime_t tick_next_period; -ktime_t tick_period;/* * tick_do_timer_cpu is a timer core internal variable which holds the CPU NR
@@ -88,7 +87,7 @@ static void tick_periodic(int cpu)write_seqcount_begin (&jiffies_seq);/* Keep track of the next tick event */ - tick_next_period =ktime_add (tick_next_period, tick_period); + tick_next_period =ktime_add_ns (tick_next_period,TICK_NSEC );do_timer (1 );write_seqcount_end (&jiffies_seq);
@@ -127,7 +126,7 @@ void tick_handle_periodic(struct clock_event_device *dev)* Setup the next period for devices, which do not have * periodic mode: */ - next =ktime_add (next, tick_period); + next =ktime_add_ns (next,TICK_NSEC );if (!clockevents_program_event (dev, next, false))return ;
@@ -173,7 +172,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)for (;;) {if (!clockevents_program_event (dev, next, false))return ; - next =ktime_add (next, tick_period); + next =ktime_add_ns (next,TICK_NSEC ); } } }
@@ -220,7 +219,6 @@ static void tick_setup_device(struct tick_device *td, tick_do_timer_cpu = cpu; tick_next_period =ktime_get (); - tick_period =NSEC_PER_SEC /HZ ;#ifdef CONFIG_NO_HZ_FULL /* * The boot CPU may be nohz_full, in which case set
kernel/time/tick-internal.h +0 -1
@@ -15,7 +15,6 @@ DECLARE_PER_CPU(struct tick_device, tick_cpu_device);extern ktime_t tick_next_period; -extern ktime_t tick_period;extern int tick_do_timer_cpu__read_mostly ;extern void tick_setup_periodic (struct clock_event_device *dev,int broadcast);
kernel/time/tick-sched.c +11 -11
@@ -92,17 +92,17 @@ static void tick_do_update_jiffies64(ktime_t now)write_seqcount_begin (&jiffies_seq); delta =ktime_sub (now, tick_next_period); -if (unlikely (delta >= tick_period)) { +if (unlikely (delta >=TICK_NSEC )) {/* Slow path for long idle sleep times */ -s64 incr =ktime_to_ns (tick_period); +s64 incr =TICK_NSEC ; ticks +=ktime_divns (delta, incr); last_jiffies_update =ktime_add_ns (last_jiffies_update, incr * ticks); }else { - last_jiffies_update =ktime_add (last_jiffies_update, - tick_period); + last_jiffies_update =ktime_add_ns (last_jiffies_update, +TICK_NSEC ); }do_timer (ticks);
@@ -112,7 +112,7 @@ static void tick_do_update_jiffies64(ktime_t now)* pairs with the READ_ONCE() in the lockless quick check above. */ WRITE_ONCE (tick_next_period, -ktime_add (last_jiffies_update, tick_period)); +ktime_add_ns (last_jiffies_update,TICK_NSEC ));write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);
@@ -659,7 +659,7 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)hrtimer_set_expires (&ts->sched_timer, ts->last_tick);/* Forward the time to expire in the future */ -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );if (ts->nohz_mode ==NOHZ_MODE_HIGHRES ) { hrtimer_start_expires(&ts->sched_timer,
@@ -1221,7 +1221,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)if (unlikely (ts->tick_stopped))return ; -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );tick_program_event (hrtimer_get_expires (&ts->sched_timer),1 ); }
@@ -1258,7 +1258,7 @@ static void tick_nohz_switch_to_nohz(void) next =tick_init_jiffy_update ();hrtimer_set_expires (&ts->sched_timer, next); -hrtimer_forward_now (&ts->sched_timer, tick_period); +hrtimer_forward_now (&ts->sched_timer,TICK_NSEC );tick_program_event (hrtimer_get_expires (&ts->sched_timer),1 );tick_nohz_activate (ts,NOHZ_MODE_LOWRES ); }
@@ -1324,7 +1324,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)if (unlikely (ts->tick_stopped))return HRTIMER_NORESTART ; -hrtimer_forward (timer, now, tick_period); +hrtimer_forward (timer, now,TICK_NSEC );return HRTIMER_RESTART ; }
@@ -1358,13 +1358,13 @@ void tick_setup_sched_timer(void)/* Offset the tick to avert jiffies_lock contention. */ if (sched_skew_tick) { -u64 offset =ktime_to_ns (tick_period) >>1 ; +u64 offset =TICK_NSEC >>1 ;do_div (offset,num_possible_cpus ()); offset *=smp_processor_id ();hrtimer_add_expires_ns (&ts->sched_timer, offset); } -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );hrtimer_start_expires (&ts->sched_timer,HRTIMER_MODE_ABS_PINNED_HARD );tick_nohz_activate (ts,NOHZ_MODE_HIGHRES ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 90/282 rtlwifi: Replace RT_TRACE with rtl_dbg
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
[ Upstream commit f108a420e50a62e0bc5cdcd7d4a2440986b526e3 ]
The macro name RT_TRACE makes it seem that it is used for tracing, when is actually used for debugging. Change the name to rtl_dbg. Any Sparse errors exposed by this change were also fixed.
Stable-dep-of: 905a9241e4e8 ("wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()")
--- drivers/net/wireless/realtek/rtlwifi/base.c | 144 +++++----- drivers/net/wireless/realtek/rtlwifi/cam.c | 82 +++--- drivers/net/wireless/realtek/rtlwifi/core.c | 259 ++++++++--------- drivers/net/wireless/realtek/rtlwifi/debug.c | 4 +- drivers/net/wireless/realtek/rtlwifi/efuse.c | 72 ++--- drivers/net/wireless/realtek/rtlwifi/pci.c | 282 +++++++++---------- drivers/net/wireless/realtek/rtlwifi/ps.c | 98 +++---- drivers/net/wireless/realtek/rtlwifi/regd.c | 18 +- drivers/net/wireless/realtek/rtlwifi/usb.c | 18 +- 9 files changed, 488 insertions(+), 489 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +72 -72
@@ -195,8 +195,8 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, }else {if (get_rf_type (rtlphy) ==RF_1T2R ||get_rf_type (rtlphy) ==RF_2T2R ) { -RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG , -"1T2R or 2T2R\n" ); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_DMESG , +"1T2R or 2T2R\n" ); ht_cap->mcs.rx_mask[0 ] =0xFF ; ht_cap->mcs.rx_mask[1 ] =0xFF ; ht_cap->mcs.rx_mask[4 ] =0x01 ;
@@ -204,7 +204,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, ht_cap->mcs.rx_highest =cpu_to_le16 (MAX_BIT_RATE_40MHZ_MCS15 ); }else if (get_rf_type (rtlphy) ==RF_1T1R ) { -RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG ,"1T1R\n" ); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_DMESG ,"1T1R\n" ); ht_cap->mcs.rx_mask[0 ] =0xFF ; ht_cap->mcs.rx_mask[1 ] =0x00 ;
@@ -1324,7 +1324,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) rtlpriv->cfg->ops->chk_switch_dmdp (hw); }if (ieee80211_is_auth (fc)) { -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG ,"MAC80211_LINKING\n" ); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG ,"MAC80211_LINKING\n" ); mac->link_state =MAC80211_LINKING ;/* Dul mac */
@@ -1385,7 +1385,7 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)if (mac->act_scanning)return false; -RT_TRACE (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , +rtl_dbg (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG ,"%s ACT_ADDBAREQ From :%pM\n" , is_tx ?"Tx" :"Rx" , hdr->addr2); RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "req\n",
@@ -1400,8 +1400,8 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)rcu_read_lock (); sta =rtl_find_sta (hw, hdr->addr3);if (sta ==NULL ) { -RT_TRACE (rtlpriv,COMP_SEND |COMP_RECV , -DBG_DMESG ,"sta is NULL\n" ); +rtl_dbg (rtlpriv,COMP_SEND |COMP_RECV , +DBG_DMESG ,"sta is NULL\n" );rcu_read_unlock ();return true; }
@@ -1428,13 +1428,13 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) }break ;case ACT_ADDBARSP : -RT_TRACE (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , -"%s ACT_ADDBARSP From :%pM\n" , - is_tx ?"Tx" :"Rx" , hdr->addr2); +rtl_dbg (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , +"%s ACT_ADDBARSP From :%pM\n" , + is_tx ?"Tx" :"Rx" , hdr->addr2);break ;case ACT_DELBA : -RT_TRACE (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , -"ACT_ADDBADEL From :%pM\n" , hdr->addr2); +rtl_dbg (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , +"ACT_ADDBADEL From :%pM\n" , hdr->addr2);break ; }break ;
@@ -1519,9 +1519,9 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,/* 68 : UDP BOOTP client * 67 : UDP BOOTP server */ -RT_TRACE (rtlpriv, (COMP_SEND |COMP_RECV ), -DBG_DMESG ,"dhcp %s !!\n" , - (is_tx) ?"Tx" :"Rx" ); +rtl_dbg (rtlpriv, (COMP_SEND |COMP_RECV ), +DBG_DMESG ,"dhcp %s !!\n" , + (is_tx) ?"Tx" :"Rx" );if (is_tx) setup_special_tx(rtlpriv, ppsc,
@@ -1540,8 +1540,8 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx, rtlpriv->btcoexist.btc_info.in_4way = true; rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies; -RT_TRACE (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , -"802.1X %s EAPOL pkt!!\n" , (is_tx) ?"Tx" :"Rx" ); +rtl_dbg (rtlpriv, (COMP_SEND |COMP_RECV ),DBG_DMESG , +"802.1X %s EAPOL pkt!!\n" , (is_tx) ?"Tx" :"Rx" );if (is_tx) { rtlpriv->ra.is_special_data = true;
@@ -1583,12 +1583,12 @@ static void rtl_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, info =IEEE80211_SKB_CB (skb);ieee80211_tx_info_clear_status (info);if (ack) { -RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_LOUD , -"tx report: ack\n" ); +rtl_dbg (rtlpriv,COMP_TX_REPORT ,DBG_LOUD , +"tx report: ack\n" ); info->flags |=IEEE80211_TX_STAT_ACK ; }else { -RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_LOUD , -"tx report: not ack\n" ); +rtl_dbg (rtlpriv,COMP_TX_REPORT ,DBG_LOUD , +"tx report: not ack\n" ); info->flags &= ~IEEE80211_TX_STAT_ACK ; }ieee80211_tx_status_irqsafe (hw, skb);
@@ -1626,8 +1626,8 @@ static u16 rtl_get_tx_report_sn(struct ieee80211_hw *hw, tx_report->last_sent_time = jiffies; tx_info->sn = sn; tx_info->send_time = tx_report->last_sent_time; -RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , -"Send TX-Report sn=0x%X\n" , sn); +rtl_dbg (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , +"Send TX-Report sn=0x%X\n" , sn);return sn; }
@@ -1674,9 +1674,9 @@ void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf, u8 c2h_cmd_len)break ; } } -RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , -"Recv TX-Report st=0x%02X sn=0x%X retry=0x%X\n" , - st, sn, retry); +rtl_dbg (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , +"Recv TX-Report st=0x%02X sn=0x%X retry=0x%X\n" , + st, sn, retry); }EXPORT_SYMBOL_GPL (rtl_tx_report_handler);
@@ -1689,9 +1689,9 @@ bool rtl_check_tx_report_acked(struct ieee80211_hw *hw)return true;if (time_before (tx_report->last_sent_time +3 *HZ , jiffies)) { -RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_WARNING , -"Check TX-Report timeout!! s_sn=0x%X r_sn=0x%X\n" , - tx_report->last_sent_sn, tx_report->last_recv_sn); +rtl_dbg (rtlpriv,COMP_TX_REPORT ,DBG_WARNING , +"Check TX-Report timeout!! s_sn=0x%X r_sn=0x%X\n" , + tx_report->last_sent_sn, tx_report->last_recv_sn);return true;/* 3 sec. (timeout) seen as acked */ }
@@ -1707,8 +1707,8 @@ void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms)if (rtl_check_tx_report_acked (hw))break ;usleep_range (1000 ,2000 ); -RT_TRACE (rtlpriv,COMP_SEC ,DBG_DMESG , -"Wait 1ms (%d/%d) to disable key.\n" , i, wait_ms); +rtl_dbg (rtlpriv,COMP_SEC ,DBG_DMESG , +"Wait 1ms (%d/%d) to disable key.\n" , i, wait_ms); } }
@@ -1770,9 +1770,9 @@ int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,return -ENXIO ; tid_data = &sta_entry->tids[tid]; -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG , -"on ra = %pM tid = %d seq:%d\n" , sta->addr, tid, - *ssn); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG , +"on ra = %pM tid = %d seq:%d\n" , sta->addr, tid, + *ssn); tid_data->agg.agg_state =RTL_AGG_START ;
@@ -1789,8 +1789,8 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,if (sta ==NULL )return -EINVAL ; -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG , -"on ra = %pM tid = %d\n" , sta->addr, tid); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG , +"on ra = %pM tid = %d\n" , sta->addr, tid);if (unlikely (tid >=MAX_TID_COUNT ))return -EINVAL ;
@@ -1829,8 +1829,8 @@ int rtl_rx_agg_start(struct ieee80211_hw *hw,return -ENXIO ; tid_data = &sta_entry->tids[tid]; -RT_TRACE (rtlpriv,COMP_RECV ,DBG_DMESG , -"on ra = %pM tid = %d\n" , sta->addr, tid); +rtl_dbg (rtlpriv,COMP_RECV ,DBG_DMESG , +"on ra = %pM tid = %d\n" , sta->addr, tid); tid_data->agg.rx_agg_state =RTL_RX_AGG_START ;return 0 ;
@@ -1845,8 +1845,8 @@ int rtl_rx_agg_stop(struct ieee80211_hw *hw,if (sta ==NULL )return -EINVAL ; -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG , -"on ra = %pM tid = %d\n" , sta->addr, tid); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG , +"on ra = %pM tid = %d\n" , sta->addr, tid);if (unlikely (tid >=MAX_TID_COUNT ))return -EINVAL ;
@@ -1866,8 +1866,8 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,if (sta ==NULL )return -EINVAL ; -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG , -"on ra = %pM tid = %d\n" , sta->addr, tid); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG , +"on ra = %pM tid = %d\n" , sta->addr, tid);if (unlikely (tid >=MAX_TID_COUNT ))return -EINVAL ;
@@ -1887,9 +1887,9 @@ void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv) btc_ops->btc_get_ampdu_cfg (rtlpriv, &reject_agg, &ctrl_agg_size, &agg_size); -RT_TRACE (rtlpriv,COMP_BT_COEXIST ,DBG_DMESG , -"Set RX AMPDU: coex - reject=%d, ctrl_agg_size=%d, size=%d" , - reject_agg, ctrl_agg_size, agg_size); +rtl_dbg (rtlpriv,COMP_BT_COEXIST ,DBG_DMESG , +"Set RX AMPDU: coex - reject=%d, ctrl_agg_size=%d, size=%d" , + reject_agg, ctrl_agg_size, agg_size); rtlpriv->hw->max_rx_aggregation_subframes = (ctrl_agg_size ? agg_size :IEEE80211_MAX_AMPDU_BUF_HT );
@@ -1977,9 +1977,9 @@ void rtl_scan_list_expire(struct ieee80211_hw *hw)list_del (&entry->list); rtlpriv->scan_list.num--; -RT_TRACE (rtlpriv,COMP_SCAN ,DBG_LOUD , -"BSSID=%pM is expire in scan list (total=%d)\n" , - entry->bssid, rtlpriv->scan_list.num); +rtl_dbg (rtlpriv,COMP_SCAN ,DBG_LOUD , +"BSSID=%pM is expire in scan list (total=%d)\n" , + entry->bssid, rtlpriv->scan_list.num);kfree (entry); }
@@ -2013,9 +2013,9 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb)if (memcmp (entry->bssid, hdr->addr3,ETH_ALEN ) ==0 ) {list_del_init (&entry->list); entry_found = true; -RT_TRACE (rtlpriv,COMP_SCAN ,DBG_LOUD , -"Update BSSID=%pM to scan list (total=%d)\n" , - hdr->addr3, rtlpriv->scan_list.num); +rtl_dbg (rtlpriv,COMP_SCAN ,DBG_LOUD , +"Update BSSID=%pM to scan list (total=%d)\n" , + hdr->addr3, rtlpriv->scan_list.num);break ; } }
@@ -2029,9 +2029,9 @@ void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb)memcpy (entry->bssid, hdr->addr3,ETH_ALEN ); rtlpriv->scan_list.num++; -RT_TRACE (rtlpriv,COMP_SCAN ,DBG_LOUD , -"Add BSSID=%pM to scan list (total=%d)\n" , - hdr->addr3, rtlpriv->scan_list.num); +rtl_dbg (rtlpriv,COMP_SCAN ,DBG_LOUD , +"Add BSSID=%pM to scan list (total=%d)\n" , + hdr->addr3, rtlpriv->scan_list.num); } entry->age = jiffies;
@@ -2191,8 +2191,8 @@ void rtl_watchdog_wq_callback(void *data)if ((rtlpriv->link_info.bcn_rx_inperiod + rtlpriv->link_info.num_rx_inperiod) ==0 ) { rtlpriv->link_info.roam_times++; -RT_TRACE (rtlpriv,COMP_ERR ,DBG_DMESG , -"AP off for %d s\n" , +rtl_dbg (rtlpriv,COMP_ERR ,DBG_DMESG , +"AP off for %d s\n" , (rtlpriv->link_info.roam_times *2 ));/* if we can't recv beacon for 10s,
@@ -2305,11 +2305,11 @@ static void rtl_c2h_content_parsing(struct ieee80211_hw *hw,switch (cmd_id) {case C2H_DBG : -RT_TRACE (rtlpriv,COMP_FW ,DBG_LOUD ,"[C2H], C2H_DBG!!\n" ); +rtl_dbg (rtlpriv,COMP_FW ,DBG_LOUD ,"[C2H], C2H_DBG!!\n" );break ;case C2H_TXBF : -RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE , -"[C2H], C2H_TXBF!!\n" ); +rtl_dbg (rtlpriv,COMP_FW ,DBG_TRACE , +"[C2H], C2H_TXBF!!\n" );break ;case C2H_TX_REPORT :rtl_tx_report_handler (hw, cmd_buf, cmd_len);
@@ -2319,20 +2319,20 @@ static void rtl_c2h_content_parsing(struct ieee80211_hw *hw, hal_ops->c2h_ra_report_handler (hw, cmd_buf, cmd_len);break ;case C2H_BT_INFO : -RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE , -"[C2H], C2H_BT_INFO!!\n" ); +rtl_dbg (rtlpriv,COMP_FW ,DBG_TRACE , +"[C2H], C2H_BT_INFO!!\n" );if (rtlpriv->cfg->ops->get_btc_status ()) btc_ops->btc_btinfo_notify (rtlpriv, cmd_buf, cmd_len);break ;case C2H_BT_MP : -RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE , -"[C2H], C2H_BT_MP!!\n" ); +rtl_dbg (rtlpriv,COMP_FW ,DBG_TRACE , +"[C2H], C2H_BT_MP!!\n" );if (rtlpriv->cfg->ops->get_btc_status ()) btc_ops->btc_btmpinfo_notify (rtlpriv, cmd_buf, cmd_len);break ;default : -RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE , -"[C2H], Unknown packet!! cmd_id(%#X)!\n" , cmd_id); +rtl_dbg (rtlpriv,COMP_FW ,DBG_TRACE , +"[C2H], Unknown packet!! cmd_id(%#X)!\n" , cmd_id);break ; } }
@@ -2356,8 +2356,8 @@ void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec)if (!skb)break ; -RT_TRACE (rtlpriv,COMP_FW ,DBG_DMESG ,"C2H rx_desc_shift=%d\n" , - *((u8 *)skb->cb)); +rtl_dbg (rtlpriv,COMP_FW ,DBG_DMESG ,"C2H rx_desc_shift=%d\n" , + *((u8 *)skb->cb));RT_PRINT_DATA (rtlpriv,COMP_FW ,DBG_DMESG ,"C2H data: " , skb->data, skb->len);
@@ -2702,29 +2702,29 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) (memcmp(mac->bssid, ap5_6, 3) == 0) || vendor == PEER_ATH) { vendor =PEER_ATH ; -RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>ath find\n" ); +rtl_dbg (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>ath find\n" ); } else if ((memcmp(mac->bssid, ap4_4, 3) == 0) || (memcmp(mac->bssid, ap4_5, 3) == 0) || (memcmp(mac->bssid, ap4_1, 3) == 0) || (memcmp(mac->bssid, ap4_2, 3) == 0) || (memcmp(mac->bssid, ap4_3, 3) == 0) || vendor == PEER_RAL) { -RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>ral find\n" ); +rtl_dbg (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>ral find\n" ); vendor =PEER_RAL ; } else if (memcmp(mac->bssid, ap6_1, 3) == 0 || vendor == PEER_CISCO) { vendor =PEER_CISCO ; -RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>cisco find\n" ); +rtl_dbg (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>cisco find\n" ); } else if ((memcmp(mac->bssid, ap3_1, 3) == 0) || (memcmp(mac->bssid, ap3_2, 3) == 0) || (memcmp(mac->bssid, ap3_3, 3) == 0) || vendor == PEER_BROAD) { -RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>broad find\n" ); +rtl_dbg (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>broad find\n" ); vendor =PEER_BROAD ; } else if (memcmp(mac->bssid, ap7_1, 3) == 0 || vendor == PEER_MARV) { vendor =PEER_MARV ; -RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>marv find\n" ); +rtl_dbg (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"=>marv find\n" ); } mac->vendor = vendor;
drivers/net/wireless/realtek/rtlwifi/cam.c +40 -42
147 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/core.c +130 -129
599 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/debug.c +2 -2
@@ -404,8 +404,8 @@ static ssize_t rtl_debugfs_set_write_rfreg(struct file *filp, &path, &addr, &bitmask, &data);if (num !=4 ) { -RT_TRACE (rtlpriv,COMP_ERR ,DBG_DMESG , -"Format is <path> <addr> <mask> <data>\n" ); +rtl_dbg (rtlpriv,COMP_ERR ,DBG_DMESG , +"Format is <path> <addr> <mask> <data>\n" );return count; }
drivers/net/wireless/realtek/rtlwifi/efuse.c +36 -36
157 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/pci.c +141 -141
551 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/ps.c +49 -49
203 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/regd.c +9 -9
@@ -393,13 +393,13 @@ int rtl_regd_init(struct ieee80211_hw *hw, rtlpriv->regd.country_code =channel_plan_to_country_code (rtlpriv->efuse.channel_plan); -RT_TRACE (rtlpriv,COMP_REGD ,DBG_DMESG , -"rtl: EEPROM regdomain: 0x%0x country code: %d\n" , - rtlpriv->efuse.channel_plan, rtlpriv->regd.country_code); +rtl_dbg (rtlpriv,COMP_REGD ,DBG_DMESG , +"rtl: EEPROM regdomain: 0x%0x country code: %d\n" , + rtlpriv->efuse.channel_plan, rtlpriv->regd.country_code);if (rtlpriv->regd.country_code >=COUNTRY_CODE_MAX ) { -RT_TRACE (rtlpriv,COMP_REGD ,DBG_DMESG , -"rtl: EEPROM indicates invalid country code, world wide 13 should be used\n" ); +rtl_dbg (rtlpriv,COMP_REGD ,DBG_DMESG , +"rtl: EEPROM indicates invalid country code, world wide 13 should be used\n" ); rtlpriv->regd.country_code =COUNTRY_CODE_WORLD_WIDE_13 ; }
@@ -414,9 +414,9 @@ int rtl_regd_init(struct ieee80211_hw *hw, rtlpriv->regd.alpha2[1 ] ='0' ; } -RT_TRACE (rtlpriv,COMP_REGD ,DBG_TRACE , -"rtl: Country alpha2 being used: %c%c\n" , - rtlpriv->regd.alpha2[0 ], rtlpriv->regd.alpha2[1 ]); +rtl_dbg (rtlpriv,COMP_REGD ,DBG_TRACE , +"rtl: Country alpha2 being used: %c%c\n" , + rtlpriv->regd.alpha2[0 ], rtlpriv->regd.alpha2[1 ]);_rtl_regd_init_wiphy (&rtlpriv->regd, wiphy, reg_notifier);
@@ -428,7 +428,7 @@ void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)struct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy);struct rtl_priv *rtlpriv =rtl_priv (hw); -RT_TRACE (rtlpriv,COMP_REGD ,DBG_LOUD ,"\n" ); +rtl_dbg (rtlpriv,COMP_REGD ,DBG_LOUD ,"\n" );_rtl_reg_notifier_apply (wiphy, request, &rtlpriv->regd); }
drivers/net/wireless/realtek/rtlwifi/usb.c +9 -9
@@ -259,15 +259,15 @@ static int _rtl_usb_init_tx(struct ieee80211_hw *hw) ? USB_HIGH_SPEED_BULK_SIZE :USB_FULL_SPEED_BULK_SIZE ; -RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG ,"USB Max Bulk-out Size=%d\n" , - rtlusb->max_bulk_out_size); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_DMESG ,"USB Max Bulk-out Size=%d\n" , + rtlusb->max_bulk_out_size);for (i =0 ; i < __RTL_TXQ_NUM; i++) {u32 ep_num = rtlusb->ep_map.ep_mapping[i];if (!ep_num) { -RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG , -"Invalid endpoint map setting!\n" ); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_DMESG , +"Invalid endpoint map setting!\n" );return -EINVAL ; } }
@@ -337,10 +337,10 @@ static int _rtl_usb_init(struct ieee80211_hw *hw)else if (usb_endpoint_dir_out (pep_desc)) rtlusb->out_ep_nums++; -RT_TRACE (rtlpriv,COMP_INIT ,DBG_DMESG , -"USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n" , - pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, - pep_desc->bInterval); +rtl_dbg (rtlpriv,COMP_INIT ,DBG_DMESG , +"USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n" , + pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, + pep_desc->bInterval); }if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) {pr_err ("Too few input end points found\n" );
@@ -931,7 +931,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw,memset (&tcb_desc,0 ,sizeof (struct rtl_tcb_desc ));if (ieee80211_is_auth (fc)) { -RT_TRACE (rtlpriv,COMP_SEND ,DBG_DMESG ,"MAC80211_LINKING\n" ); +rtl_dbg (rtlpriv,COMP_SEND ,DBG_DMESG ,"MAC80211_LINKING\n" ); }if (rtlpriv->psc.sw_ps_enabled) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 91/282 wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()
In reply to Greg Kroah-HartmanFrom: Wei Chen <[email protected]>
[ Upstream commit 905a9241e4e8c15d2c084fee916280514848fe35 ]
If there is a failure during copy_from_user or user-provided data buffer is invalid, rtl_debugfs_set_write_rfreg should return negative error code instead of a positive value count.
Fix this bug by returning correct error code. Moreover, the check of buffer against null is removed since it will be handled by copy_from_user.
--- drivers/net/wireless/realtek/rtlwifi/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +3 -3
@@ -395,8 +395,8 @@ static ssize_t rtl_debugfs_set_write_rfreg(struct file *filp, tmp_len = (count >sizeof (tmp) -1 ?sizeof (tmp) -1 : count); -if (!buffer ||copy_from_user (tmp, buffer, tmp_len)) -return count; +if (copy_from_user (tmp, buffer, tmp_len)) +return -EFAULT ; tmp[tmp_len] ='\0' ;
@@ -406,7 +406,7 @@ static ssize_t rtl_debugfs_set_write_rfreg(struct file *filp,if (num !=4 ) {rtl_dbg (rtlpriv,COMP_ERR ,DBG_DMESG ,"Format is <path> <addr> <mask> <data>\n" ); -return count; +return -EINVAL ; }rtl_set_rfreg (hw, path, addr, bitmask, data);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 92/282 wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()
In reply to Greg Kroah-HartmanFrom: Wei Chen <[email protected]>
[ Upstream commit 5dbe1f8eb8c5ac69394400a5b86fd81775e96c43 ]
If there is a failure during copy_from_user or user-provided data buffer is invalid, rtl_debugfs_set_write_reg should return negative error code instead of a positive value count.
Fix this bug by returning correct error code. Moreover, the check of buffer against null is removed since it will be handled by copy_from_user.
--- drivers/net/wireless/realtek/rtlwifi/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +3 -3
@@ -298,8 +298,8 @@ static ssize_t rtl_debugfs_set_write_reg(struct file *filp, tmp_len = (count >sizeof (tmp) -1 ?sizeof (tmp) -1 : count); -if (!buffer ||copy_from_user (tmp, buffer, tmp_len)) -return count; +if (copy_from_user (tmp, buffer, tmp_len)) +return -EFAULT ; tmp[tmp_len] ='\0' ;
@@ -307,7 +307,7 @@ static ssize_t rtl_debugfs_set_write_reg(struct file *filp, num =sscanf (tmp,"%x %x %x" , &addr, &val, &len);if (num !=3 ) -return count; +return -EINVAL ;switch (len) {case 1 :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 93/282 bpftool: Fix bug for long instructions in program CFG dumps
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit 67cf52cdb6c8fa6365d29106555dacf95c9fd374 ]
When dumping the control flow graphs for programs using the 16-byte long load instruction, we need to skip the second part of this instruction when looking for the next instruction to process. Otherwise, we end up printing "BUG_ld_00" from the kernel disassembler in the CFG.
--- tools/bpf/bpftool/xlated_dumper.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/bpf/bpftool/xlated_dumper.c +7 -0
@@ -363,8 +363,15 @@ void dump_xlated_for_graph(struct dump_data *dd, void *buf_start, void *buf_end,struct bpf_insn *insn_start = buf_start;struct bpf_insn *insn_end = buf_end;struct bpf_insn *cur = insn_start; +bool double_insn = false;for (; cur <= insn_end; cur++) { +if (double_insn) { + double_insn = false; +continue ; + } + double_insn = cur->code == (BPF_LD |BPF_IMM |BPF_DW ); +printf ("% 4d: " , (int )(cur - insn_start + start_idx));print_bpf_insn (&cbs, cur, true);if (cur != insn_end)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 94/282 crypto: drbg - make drbg_prepare_hrng() handle jent instantiation errors
In reply to Greg Kroah-HartmanFrom: Nicolai Stange <[email protected]>
[ Upstream commit 559edd47cce4cc407d606b4d7f376822816fd4b8 ]
Now that drbg_prepare_hrng() doesn't do anything but to instantiate a jitterentropy crypto_rng instance, it looks a little odd to have the related error handling at its only caller, drbg_instantiate().
Move the handling of jitterentropy allocation failures from drbg_instantiate() close to the allocation itself in drbg_prepare_hrng().
There is no change in behaviour.
Stable-dep-of: 686cd976b6dd ("crypto: drbg - Only fail when jent is unavailable in FIPS mode")
--- crypto/drbg.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
crypto/drbg.c +8 -8
@@ -1515,6 +1515,14 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)return 0 ; drbg->jent =crypto_alloc_rng ("jitterentropy_rng" ,0 ,0 ); +if (IS_ERR (drbg->jent)) { +const int err =PTR_ERR (drbg->jent); + + drbg->jent =NULL ; +if (fips_enabled || err != -ENOENT ) +return err; +pr_info ("DRBG: Continuing without Jitter RNG\n" ); + }return 0 ; }
@@ -1570,14 +1578,6 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers,if (ret) goto free_everything; -if (IS_ERR (drbg->jent)) { - ret =PTR_ERR (drbg->jent); - drbg->jent =NULL ; -if (fips_enabled || ret != -ENOENT ) - goto free_everything; -pr_info ("DRBG: Continuing without Jitter RNG\n" ); - } - reseed = false; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 95/282 crypto: drbg - Only fail when jent is unavailable in FIPS mode
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 686cd976b6ddedeeb1a1fb09ba53a891d3cc9a03 ]
When jent initialisation fails for any reason other than ENOENT, the entire drbg fails to initialise, even when we're not in FIPS mode. This is wrong because we can still use the kernel RNG when we're not in FIPS mode.
Change it so that it only fails when we are in FIPS mode.
--- crypto/drbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/drbg.c +1 -1
@@ -1519,7 +1519,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)const int err =PTR_ERR (drbg->jent); drbg->jent =NULL ; -if (fips_enabled || err != -ENOENT ) +if (fips_enabled)return err;pr_info ("DRBG: Continuing without Jitter RNG\n" ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 96/282 scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()
In reply to Greg Kroah-HartmanFrom: Shuchang Li <[email protected]>
[ Upstream commit 91a0c0c1413239d0548b5aac4c82f38f6d53a91e ]
When if_type equals zero and pci_resource_start(pdev, PCI_64BIT_BAR4) returns false, drbl_regs_memmap_p is not remapped. This passes a NULL pointer to iounmap(), which can trigger a WARN() on certain arches.
When if_type equals six and pci_resource_start(pdev, PCI_64BIT_BAR4) returns true, drbl_regs_memmap_p may has been remapped and ctrl_regs_memmap_p is not remapped. This is a resource leak and passes a NULL pointer to iounmap().
To fix these issues, we need to add null checks before iounmap(), and change some goto labels.
--- drivers/scsi/lpfc/lpfc_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +6 -4
@@ -10226,7 +10226,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) goto out_iounmap_all; }else { error = -ENOMEM ; - goto out_iounmap_all; + goto out_iounmap_ctrl; } }
@@ -10244,7 +10244,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)dev_err (&pdev->dev,"ioremap failed for SLI4 HBA dpp registers.\n" ); error = -ENOMEM ; - goto out_iounmap_ctrl; + goto out_iounmap_all; } phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; }
@@ -10269,9 +10269,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)return 0 ; out_iounmap_all: -iounmap (phba->sli4_hba.drbl_regs_memmap_p); +if (phba->sli4_hba.drbl_regs_memmap_p) +iounmap (phba->sli4_hba.drbl_regs_memmap_p); out_iounmap_ctrl: -iounmap (phba->sli4_hba.ctrl_regs_memmap_p); +if (phba->sli4_hba.ctrl_regs_memmap_p) +iounmap (phba->sli4_hba.ctrl_regs_memmap_p); out_iounmap_conf:iounmap (phba->sli4_hba.conf_regs_memmap_p);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 97/282 bpf, sockmap: fix deadlocks in the sockhash and sockmap
In reply to Greg Kroah-HartmanFrom: Xin Liu <[email protected]>
[ Upstream commit ed17aa92dc56b6d8883e4b7a8f1c6fbf5ed6cd29 ]
When huang uses sched_switch tracepoint, the tracepoint does only one thing in the mounted ebpf program, which deletes the fixed elements in sockhash ([0])
It seems that elements in sockhash are rarely actively deleted by users or ebpf program. Therefore, we do not pay much attention to their deletion. Compared with hash maps, sockhash only provides spin_lock_bh protection. This causes it to appear to have self-locking behavior in the interrupt context.
[0]:https://lore.kernel.org/all/CABcoxUayum5oOqFMMqAeWuS8+EzojquSOSyDA3J_2omY=2EeAg@mail.gmail.com/
--- net/core/sock_map.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/core/sock_map.c +6 -4
@@ -322,8 +322,9 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test, {struct sock *sk;int err =0 ; +unsigned long flags; -raw_spin_lock_bh (&stab->lock); +raw_spin_lock_irqsave (&stab->lock, flags); sk = *psk;if (!sk_test || sk_test == sk) sk =xchg (psk,NULL );
@@ -333,7 +334,7 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,else err = -EINVAL ; -raw_spin_unlock_bh (&stab->lock); +raw_spin_unlock_irqrestore (&stab->lock, flags);return err; }
@@ -655,11 +656,12 @@ static int sock_hash_delete_elem(struct bpf_map *map, void *key)struct bpf_htab_bucket *bucket;struct bpf_htab_elem *elem;int ret = -ENOENT ; +unsigned long flags; hash =sock_hash_bucket_hash (key, key_size); bucket =sock_hash_select_bucket (htab, hash); -raw_spin_lock_bh (&bucket->lock); +raw_spin_lock_irqsave (&bucket->lock, flags); elem =sock_hash_lookup_elem_raw (&bucket->head, hash, key, key_size);if (elem) {hlist_del_rcu (&elem->node);
@@ -667,7 +669,7 @@ static int sock_hash_delete_elem(struct bpf_map *map, void *key)sock_hash_free_elem (htab, elem); ret =0 ; } -raw_spin_unlock_bh (&bucket->lock); +raw_spin_unlock_irqrestore (&bucket->lock, flags);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 98/282 nvme: handle the persistent internal error AER
In reply to Greg Kroah-HartmanFrom: Michael Kelley <[email protected]>
[ Upstream commit 2c61c97fb12b806e1c8eb15f04c277ad097ec95e ]
In the NVM Express Revision 1.4 spec, Figure 145 describes possible values for an AER with event type "Error" (value 000b). For a Persistent Internal Error (value 03h), the host should perform a controller reset.
Add support for this error using code that already exists for doing a controller reset. As part of this support, introduce two utility functions for parsing the AER type and subtype.
This new support was tested in a lab environment where we can generate the persistent internal error on demand, and observe both the Linux side and NVMe controller side to see that the controller reset has been done.
Stable-dep-of: 6622b76fe922 ("nvme: fix async event trace event")
--- drivers/nvme/host/core.c | 31 +++++++++++++++++++++++++++++-- include/linux/nvme.h | 4 ++++ 2 files changed, 33 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +29 -2
@@ -3976,9 +3976,19 @@ static void nvme_fw_act_work(struct work_struct *work)nvme_get_fw_slot_info (ctrl); } +static u32 nvme_aer_type (u32 result) +{ +return result &0x7 ; +} + +static u32 nvme_aer_subtype (u32 result) +{ +return (result &0xff00 ) >>8 ; +} +static void nvme_handle_aen_notice (struct nvme_ctrl *ctrl,u32 result) { -u32 aer_notice_type = (result &0xff00 ) >>8 ; +u32 aer_notice_type =nvme_aer_subtype (result);trace_nvme_async_event (ctrl, aer_notice_type);
@@ -4011,11 +4021,19 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result) } } +static void nvme_handle_aer_persistent_error (struct nvme_ctrl *ctrl) +{ +trace_nvme_async_event (ctrl,NVME_AER_ERROR ); +dev_warn (ctrl->device,"resetting controller due to AER\n" ); +nvme_reset_ctrl (ctrl); +} +void nvme_complete_async_event (struct nvme_ctrl *ctrl,__le16 status,volatile union nvme_result *res) {u32 result =le32_to_cpu (res->u32); -u32 aer_type = result &0x07 ; +u32 aer_type =nvme_aer_type (result); +u32 aer_subtype =nvme_aer_subtype (result);if (le16_to_cpu (status) >>1 !=NVME_SC_SUCCESS )return ;
@@ -4025,6 +4043,15 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,nvme_handle_aen_notice (ctrl, result);break ;case NVME_AER_ERROR : +/* +* For a persistent internal error, don't run async_event_work +* to submit a new AER. The controller reset will do it. +*/ +if (aer_subtype ==NVME_AER_ERROR_PERSIST_INT_ERR ) { +nvme_handle_aer_persistent_error (ctrl); +return ; + } + fallthrough;case NVME_AER_SMART :case NVME_AER_CSS :case NVME_AER_VS :
include/linux/nvme.h +4 -0
@@ -522,6 +522,10 @@ enum { NVME_AER_VS = 7, }; +enum { +NVME_AER_ERROR_PERSIST_INT_ERR =0x03 , +}; +enum {NVME_AER_NOTICE_NS_CHANGED =0x00 ,NVME_AER_NOTICE_FW_ACT_STARTING =0x01 ,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 99/282 nvme: fix async event trace event
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 6622b76fe922b94189499a90ccdb714a4a8d0773 ]
Mixing AER Event Type and Event Info has masking clashes. Just print the event type, but also include the event info of the AER result in the trace.
--- drivers/nvme/host/core.c | 5 +---- drivers/nvme/host/trace.h | 15 ++++++--------- 2 files changed, 7 insertions(+), 13 deletions(-)
drivers/nvme/host/core.c +1 -4
@@ -3990,8 +3990,6 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result) {u32 aer_notice_type =nvme_aer_subtype (result); -trace_nvme_async_event (ctrl, aer_notice_type); -switch (aer_notice_type) {case NVME_AER_NOTICE_NS_CHANGED :set_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events);
@@ -4023,7 +4021,6 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)static void nvme_handle_aer_persistent_error (struct nvme_ctrl *ctrl) { -trace_nvme_async_event (ctrl,NVME_AER_ERROR );dev_warn (ctrl->device,"resetting controller due to AER\n" );nvme_reset_ctrl (ctrl); }
@@ -4038,6 +4035,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,if (le16_to_cpu (status) >>1 !=NVME_SC_SUCCESS )return ; +trace_nvme_async_event (ctrl, result);switch (aer_type) {case NVME_AER_NOTICE :nvme_handle_aen_notice (ctrl, result);
@@ -4055,7 +4053,6 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,case NVME_AER_SMART :case NVME_AER_CSS :case NVME_AER_VS : -trace_nvme_async_event (ctrl, aer_type); ctrl->aen_result = result;break ;default :
drivers/nvme/host/trace.h +6 -9
@@ -127,15 +127,12 @@ TRACE_EVENT(nvme_async_event, ),TP_printk ("nvme%d: NVME_AEN=%#08x [%s]" , __entry->ctrl_id, __entry->result, -__print_symbolic (__entry->result, -aer_name (NVME_AER_NOTICE_NS_CHANGED ), -aer_name (NVME_AER_NOTICE_ANA ), -aer_name (NVME_AER_NOTICE_FW_ACT_STARTING ), -aer_name (NVME_AER_NOTICE_DISC_CHANGED ), -aer_name (NVME_AER_ERROR ), -aer_name (NVME_AER_SMART ), -aer_name (NVME_AER_CSS ), -aer_name (NVME_AER_VS )) +__print_symbolic (__entry->result &0x7 , +aer_name (NVME_AER_ERROR ), +aer_name (NVME_AER_SMART ), +aer_name (NVME_AER_NOTICE ), +aer_name (NVME_AER_CSS ), +aer_name (NVME_AER_VS )) ) );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 73/282 tick/common: Align tick period with the HZ tick.
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit e9523a0d81899361214d118ad60ef76f0e92f71d ]
With HIGHRES enabled tick_sched_timer() is programmed every jiffy to expire the timer_list timers. This timer is programmed accurate in respect to CLOCK_MONOTONIC so that 0 seconds and nanoseconds is the first tick and the next one is 1000/CONFIG_HZ ms later. For HZ=250 it is every 4 ms and so based on the current time the next tick can be computed.
This accuracy broke since the commit mentioned below because the jiffy based clocksource is initialized with higher accuracy in read_persistent_wall_and_boot_offset(). This higher accuracy is inherited during the setup in tick_setup_device(). The timer still fires every 4ms with HZ=250 but timer is no longer aligned with CLOCK_MONOTONIC with 0 as it origin but has an offset in the us/ns part of the timestamp. The offset differs with every boot and makes it impossible for user land to align with the tick.
Align the tick period with CLOCK_MONOTONIC ensuring that it is always a multiple of 1000/CONFIG_HZ ms.
--- kernel/time/tick-common.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/time/tick-common.c +11 -1
@@ -216,9 +216,19 @@ static void tick_setup_device(struct tick_device *td,* this cpu: */ if (tick_do_timer_cpu ==TICK_DO_TIMER_BOOT ) { +ktime_t next_p; +u32 rem; + tick_do_timer_cpu = cpu; - tick_next_period =ktime_get (); + next_p =ktime_get (); +div_u64_rem (next_p,TICK_NSEC , &rem); +if (rem) { + next_p -= rem; + next_p +=TICK_NSEC ; + } + + tick_next_period = next_p;#ifdef CONFIG_NO_HZ_FULL /* * The boot CPU may be nohz_full, in which case set
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 100/282 nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage"
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 4f86a6ff6fbd891232dda3ca97fd1b9630b59809 ]
fcloop_fcp_op() could be called from flush request's ->end_io(flush_end_io) in which the spinlock of fq->mq_flush_lock is grabbed with irq saved/disabled.
So fcloop_fcp_op() can't call spin_unlock_irq(&tfcp_req->reqlock) simply which enables irq unconditionally.
Fixes the warning by switching to spin_lock_irqsave()/spin_unlock_irqrestore()
--- drivers/nvme/target/fcloop.c | 48 ++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-)
drivers/nvme/target/fcloop.c +27 -21
@@ -431,10 +431,11 @@ fcloop_fcp_recv_work(struct work_struct *work)struct fcloop_fcpreq *tfcp_req = container_of(work, struct fcloop_fcpreq, fcp_rcv_work);struct nvmefc_fcp_req *fcpreq = tfcp_req->fcpreq; +unsigned long flags;int ret =0 ;bool aborted = false; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags);switch (tfcp_req->inistate) {case INI_IO_START : tfcp_req->inistate =INI_IO_ACTIVE ;
@@ -443,11 +444,11 @@ fcloop_fcp_recv_work(struct work_struct *work) aborted = true;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (aborted)) ret = -ECANCELED ;
@@ -468,8 +469,9 @@ fcloop_fcp_abort_recv_work(struct work_struct *work) container_of(work, struct fcloop_fcpreq, abort_rcv_work);struct nvmefc_fcp_req *fcpreq;bool completed = false; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq;switch (tfcp_req->inistate) {case INI_IO_ABORTED :
@@ -478,11 +480,11 @@ fcloop_fcp_abort_recv_work(struct work_struct *work) completed = true;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (completed)) {/* remove reference taken in original abort downcall */
@@ -494,9 +496,9 @@ fcloop_fcp_abort_recv_work(struct work_struct *work)nvmet_fc_rcv_fcp_abort (tfcp_req->tport->targetport, &tfcp_req->tgt_fcp_req); -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->fcpreq =NULL ; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);fcloop_call_host_done (fcpreq, tfcp_req, -ECANCELED );/* call_host_done releases reference for abort downcall */
@@ -512,11 +514,12 @@ fcloop_tgt_fcprqst_done_work(struct work_struct *work)struct fcloop_fcpreq *tfcp_req = container_of(work, struct fcloop_fcpreq, tio_done_work);struct nvmefc_fcp_req *fcpreq; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq; tfcp_req->inistate =INI_IO_COMPLETED ; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);fcloop_call_host_done (fcpreq, tfcp_req, tfcp_req->status); }
@@ -620,13 +623,14 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,u32 rsplen =0 , xfrlen =0 ;int fcp_err =0 , active, aborted;u8 op = tgt_fcpreq->op; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq; active = tfcp_req->active; aborted = tfcp_req->aborted; tfcp_req->active = true; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (active))/* illegal - call while i/o active */
@@ -634,9 +638,9 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,if (unlikely (aborted)) {/* target transport has aborted i/o prior */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->active = false; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tgt_fcpreq->transferred_length =0 ; tgt_fcpreq->fcp_error = -ECANCELED ; tgt_fcpreq->done (tgt_fcpreq);
@@ -693,9 +697,9 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,break ; } -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->active = false; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tgt_fcpreq->transferred_length = xfrlen; tgt_fcpreq->fcp_error = fcp_err;
@@ -709,15 +713,16 @@ fcloop_tgt_fcp_abort(struct nvmet_fc_target_port *tgtport, struct nvmefc_tgt_fcp_req *tgt_fcpreq) {struct fcloop_fcpreq *tfcp_req =tgt_fcp_req_to_fcpreq (tgt_fcpreq); +unsigned long flags;/* * mark aborted only in case there were 2 threads in transport * (one doing io, other doing abort) and only kills ops posted * after the abort request */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->aborted = true; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tfcp_req->status =NVME_SC_INTERNAL ;
@@ -753,6 +758,7 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport,struct fcloop_ini_fcpreq *inireq = fcpreq->private;struct fcloop_fcpreq *tfcp_req;bool abortio = true; +unsigned long flags;spin_lock (&inireq->inilock); tfcp_req = inireq->tfcp_req;
@@ -765,7 +771,7 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport,return ;/* break initiator/target relationship for io */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags);switch (tfcp_req->inistate) {case INI_IO_START :case INI_IO_ACTIVE :
@@ -775,11 +781,11 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport, abortio = false;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (abortio)/* leave the reference while the work item is scheduled */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 74/282 wifi: ath6kl: minor fix for allocation size
In reply to Greg Kroah-HartmanFrom: Alexey V. Vissarionov <[email protected]>
[ Upstream commit 778f83f889e7fca37780d9640fcbd0229ae38eaa ]
Although the "param" pointer occupies more or equal space compared to "*param", the allocation size should use the size of variable itself.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/ath/ath6kl/bmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/bmi.c +1 -1
@@ -246,7 +246,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)return -EACCES ; } - size =sizeof (cid) +sizeof (addr) +sizeof (param); + size =sizeof (cid) +sizeof (addr) +sizeof (*param);if (size > ar->bmi.max_cmd_size) {WARN_ON (1 );return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 75/282 wifi: ath9k: hif_usb: fix memory leak of remain_skbs
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 7654cc03eb699297130b693ec34e25f77b17c947 ]
hif_dev->remain_skb is allocated and used exclusively in ath9k_hif_usb_rx_stream(). It is implied that an allocated remain_skb is processed and subsequently freed (in error paths) only during the next call of ath9k_hif_usb_rx_stream().
So, if the urbs are deallocated between those two calls due to the device deinitialization or suspend, it is possible that ath9k_hif_usb_rx_stream() is not called next time and the allocated remain_skb is leaked. Our local Syzkaller instance was able to trigger that.
remain_skb makes sense when receiving two consecutive urbs which are logically linked together, i.e. a specific data field from the first skb indicates a cached skb to be allocated, memcpy'd with some data and subsequently processed in the next call to ath9k_hif_usb_rx_stream(). Urbs deallocation supposedly makes that link irrelevant so we need to free the cached skb in those cases.
Fix the leak by introducing a function to explicitly free remain_skb (if it is not NULL) when the rx urbs have been deallocated. remain_skb is NULL when it has not been allocated at all (hif_dev struct is kzalloced) or when it has been processed in next call to ath9k_hif_usb_rx_stream().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +19 -0
@@ -534,6 +534,24 @@ static struct ath9k_htc_hif hif_usb = { .send = hif_usb_send, }; +/* Need to free remain_skb allocated in ath9k_hif_usb_rx_stream +* in case ath9k_hif_usb_rx_stream wasn't called next time to +* process the buffer and subsequently free it. +*/ +static void ath9k_hif_usb_free_rx_remain_skb (struct hif_device_usb *hif_dev) +{ +unsigned long flags; + +spin_lock_irqsave (&hif_dev->rx_lock, flags); +if (hif_dev->remain_skb) { +dev_kfree_skb_any (hif_dev->remain_skb); + hif_dev->remain_skb =NULL ; + hif_dev->rx_remain_len =0 ; +RX_STAT_INC (hif_dev, skb_dropped); + } +spin_unlock_irqrestore (&hif_dev->rx_lock, flags); +} +static void ath9k_hif_usb_rx_stream (struct hif_device_usb *hif_dev,struct sk_buff *skb) {
@@ -868,6 +886,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)static void ath9k_hif_usb_dealloc_rx_urbs (struct hif_device_usb *hif_dev) {usb_kill_anchored_urbs (&hif_dev->rx_submitted); +ath9k_hif_usb_free_rx_remain_skb (hif_dev); }static int ath9k_hif_usb_alloc_rx_urbs (struct hif_device_usb *hif_dev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 76/282 wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4c856ee12df85aabd437c3836ed9f68d94268358 ]
This loop checks that i < max at the start of loop but then it does i++ which could put it past the end of the array. It's harmless to check again and prevent a potential out of bounds.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/eeprom.c +1 -1
@@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, ee->ee_n_piers[mode]++; freq2 = (val >>8 ) &0xff ; -if (!freq2) +if (!freq2 || i >= max)break ; pc[i++].freq = ath5k_eeprom_bin2freq(ee,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 77/282 wifi: ath6kl: reduce WARN to dev_dbg() in callback
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 75c4a8154cb6c7239fb55d5550f481f6765fb83c ]
The warn is triggered on a known race condition, documented in the code above the test, that is correctly handled. Using WARN() hinders automated testing. Reducing severity.
--- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath6kl/htc_pipe.c +2 -2
@@ -960,8 +960,8 @@ static int ath6kl_htc_pipe_rx_complete(struct ath6kl *ar, struct sk_buff *skb,* Thus the possibility of ar->htc_target being NULL * via ath6kl_recv_complete -> ath6kl_usb_io_comp_work. */ -if (WARN_ON_ONCE (!target)) { -ath6kl_err ("Target not yet initialized\n" ); +if (!target) { +ath6kl_dbg (ATH6KL_DBG_HTC ,"Target not yet initialized\n" ); status = -EINVAL ; goto free_skb; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 78/282 tools: bpftool: Remove invalid \ json escape
In reply to Greg Kroah-HartmanFrom: Luis Gerhorst <[email protected]>
[ Upstream commit c679bbd611c08b0559ffae079330bc4e5574696a ]
RFC8259 ("The JavaScript Object Notation (JSON) Data Interchange Format") only specifies \", \\, \/, \b, \f, \n, \r, and \r as valid two-character escape sequences. This does not include \', which is not required in JSON because it exclusively uses double quotes as string separators.
Solidus (/) may be escaped, but does not have to. Only reverse solidus (\), double quotes ("), and the control characters have to be escaped. Therefore, with this fix, bpftool correctly supports all valid two-character escape sequences (but still does not support characters that require multi-character escape sequences).
Witout this fix, attempting to load a JSON file generated by bpftool using Python 3.10.6's default json.load() may fail with the error "Invalid \escape" if the file contains the invalid escaped single quote (\').
--- tools/bpf/bpftool/json_writer.c | 3 --- 1 file changed, 3 deletions(-)
tools/bpf/bpftool/json_writer.c +0 -3
@@ -80,9 +80,6 @@ static void jsonw_puts(json_writer_t *self, const char *str)case '"' :fputs ("\\\"" , self->out);break ; -case '\'' : -fputs ("\\\'" , self->out); -break ;default :putc (*str, self->out); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 79/282 wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit b7ed9fa2cb76ca7a3c3cd4a6d35748fe1fbda9f6 ]
rtw_pwr_seq_parser() calls rtw_sub_pwr_seq_parser() which can either return -EBUSY, -EINVAL or 0. Propagate the original error code instead of unconditionally returning -EBUSY in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/mac.c +1 -1
@@ -210,7 +210,7 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ret =rtw_sub_pwr_seq_parser (rtwdev, intf_mask, cut_mask, cmd);if (ret) -return -EBUSY ; +return ret; idx++; }while (1 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 70/282 tick/sched: Reduce seqcount held scope in tick_do_update_jiffies64()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 94ad2e3cedb82af034f6d97c58022f162b669f9b ]
If jiffies are up to date already (caller lost the race against another CPU) there is no point to change the sequence count. Doing that just forces other CPUs into the seqcount retry loop in tick_nohz_next_event() for nothing.
Just bail out early.
[ tglx: Rewrote most of it ]
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 47 +++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 25 deletions(-)
kernel/time/tick-sched.c +22 -25
@@ -84,38 +84,35 @@ static void tick_do_update_jiffies64(ktime_t now)/* Reevaluate with jiffies_lock held */ raw_spin_lock (&jiffies_lock); +if (ktime_before (now, tick_next_period)) { +raw_spin_unlock (&jiffies_lock); +return ; + } +write_seqcount_begin (&jiffies_seq); - delta =ktime_sub (now, last_jiffies_update); -if (delta >= tick_period) { + last_jiffies_update =ktime_add (last_jiffies_update, tick_period); - delta =ktime_sub (delta, tick_period); - last_jiffies_update =ktime_add (last_jiffies_update, - tick_period); + delta =ktime_sub (now, tick_next_period); +if (unlikely (delta >= tick_period)) { +/* Slow path for long idle sleep times */ +s64 incr =ktime_to_ns (tick_period); -/* Slow path for long timeouts */ -if (unlikely (delta >= tick_period)) { -s64 incr =ktime_to_ns (tick_period); + ticks =ktime_divns (delta, incr); - ticks =ktime_divns (delta, incr); + last_jiffies_update =ktime_add_ns (last_jiffies_update, + incr * ticks); + } - last_jiffies_update =ktime_add_ns (last_jiffies_update, - incr * ticks); - } -do_timer (++ticks); +do_timer (++ticks); + +/* +* Keep the tick_next_period variable up to date. WRITE_ONCE() +* pairs with the READ_ONCE() in the lockless quick check above. +*/ +WRITE_ONCE (tick_next_period, +ktime_add (last_jiffies_update, tick_period)); -/* -* Keep the tick_next_period variable up to date. -* WRITE_ONCE() pairs with the READ_ONCE() in the lockless -* quick check above. -*/ -WRITE_ONCE (tick_next_period, -ktime_add (last_jiffies_update, tick_period)); - }else { -write_seqcount_end (&jiffies_seq); -raw_spin_unlock (&jiffies_lock); -return ; - }write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);update_wall_time ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 102/282 md/raid10: fix leak of r10bio->remaining for recovery
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 26208a7cffd0c7cbf14237ccd20c7270b3ffeb7e ]
raid10_sync_request() will add 'r10bio->remaining' for both rdev and replacement rdev. However, if the read io fails, recovery_request_write() returns without issuing the write io, in this case, end_sync_request() is only called once and 'remaining' is leaked, cause an io hang.
Fix the problem by decreasing 'remaining' according to if 'bio' and 'repl_bio' is valid.
--- drivers/md/raid10.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/md/raid10.c +13 -10
@@ -2229,11 +2229,22 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) {struct r10conf *conf = mddev->private;int d; -struct bio *wbio, *wbio2; +struct bio *wbio = r10_bio->devs[1 ].bio; +struct bio *wbio2 = r10_bio->devs[1 ].repl_bio; + +/* Need to test wbio2->bi_end_io before we call +* generic_make_request as if the former is NULL, +* the latter is free to free wbio2. +*/ +if (wbio2 && !wbio2->bi_end_io) + wbio2 =NULL ;if (!test_bit (R10BIO_Uptodate, &r10_bio->state)) {fix_recovery_read_error (r10_bio); -end_sync_request (r10_bio); +if (wbio->bi_end_io) +end_sync_request (r10_bio); +if (wbio2) +end_sync_request (r10_bio);return ; }
@@ -2242,14 +2253,6 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio)* and submit the write request */ d = r10_bio->devs[1 ].devnum; - wbio = r10_bio->devs[1 ].bio; - wbio2 = r10_bio->devs[1 ].repl_bio; -/* Need to test wbio2->bi_end_io before we call -* generic_make_request as if the former is NULL, -* the latter is free to free wbio2. -*/ -if (wbio2 && !wbio2->bi_end_io) - wbio2 =NULL ;if (wbio->bi_end_io) {atomic_inc (&conf->mirrors[d].rdev->nr_pending);md_sync_acct (conf->mirrors[d].rdev->bdev,bio_sectors (wbio));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 111/282 netfilter: nf_tables: dont write table validation state without mutex
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 9a32e9850686599ed194ccdceb6cd3dd56b2d9b9 ]
The ->cleanup callback needs to be removed, this doesn't work anymore as the transaction mutex is already released in the ->abort function.
Just do it after a successful validation pass, this either happens from commit or abort phases where transaction mutex is held.
--- include/linux/netfilter/nfnetlink.h | 1 - net/netfilter/nf_tables_api.c | 8 ++------ net/netfilter/nfnetlink.c | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-)
include/linux/netfilter/nfnetlink.h +0 -1
@@ -39,7 +39,6 @@ struct nfnetlink_subsystem {int (*commit)(struct net *net,struct sk_buff *skb);int (*abort)(struct net *net,struct sk_buff *skb,enum nfnl_abort_action action); -void (*cleanup)(struct net *net);bool (*valid_genid)(struct net *net,u32 genid); };
net/netfilter/nf_tables_api.c +2 -6
@@ -6491,6 +6491,8 @@ static int nf_tables_validate(struct net *net)if (nft_table_validate (net, table) <0 )return -EAGAIN ; } + +nft_validate_state_update (net,NFT_VALIDATE_SKIP );break ; }
@@ -7172,11 +7174,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)return 0 ; } -static void nf_tables_cleanup (struct net *net) -{ -nft_validate_state_update (net,NFT_VALIDATE_SKIP ); -} -static int nf_tables_abort (struct net *net,struct sk_buff *skb,enum nfnl_abort_action action) {
@@ -7208,7 +7205,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = { .cb = nf_tables_cb, .commit = nf_tables_commit, .abort = nf_tables_abort, - .cleanup = nf_tables_cleanup, .valid_genid = nf_tables_valid_genid, .owner = THIS_MODULE, };
net/netfilter/nfnetlink.c +0 -2
@@ -512,8 +512,6 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, goto replay_abort; } } -if (ss->cleanup) - ss->cleanup (net);nfnl_err_deliver (&err_list, oskb);kfree_skb (skb);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 112/282 ipv4: Fix potential uninit variable access bug in __ip_make_skb()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 99e5acae193e369b71217efe6f1dad42f3f18815 ]
Like commit ea30388baebc ("ipv6: Fix an uninit variable access bug in __ip6_make_skb()"). icmphdr does not in skb linear region under the scenario of SOCK_RAW socket. Access icmp_hdr(skb)->type directly will trigger the uninit variable access bug.
Use a local variable icmp_type to carry the correct value in different scenarios.
--- net/ipv4/ip_output.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/ipv4/ip_output.c +13 -3
@@ -1559,9 +1559,19 @@ struct sk_buff *__ip_make_skb(struct sock *sk, cork->dst =NULL ;skb_dst_set (skb, &rt->dst); -if (iph->protocol ==IPPROTO_ICMP ) -icmp_out_count (net, ((struct icmphdr *) -skb_transport_header (skb))->type); +if (iph->protocol ==IPPROTO_ICMP ) { +u8 icmp_type; + +/* For such sockets, transhdrlen is zero when do ip_append_data(), +* so icmphdr does not in skb linear region and can not get icmp_type +* by icmp_hdr(skb)->type. +*/ +if (sk->sk_type ==SOCK_RAW && !inet_sk (sk)->hdrincl) + icmp_type = fl4->fl4_icmp_type; +else + icmp_type =icmp_hdr (skb)->type; +icmp_out_count (net, icmp_type); + }ip_cork_release (cork); out:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 113/282 Revert "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit db2bf510bd5d57f064d9e1db395ed86a08320c54 ]
This reverts commit 1e9ac114c4428fdb7ff4635b45d4f46017e8916f.
This patch introduces a possible null-ptr-def problem. Revert it. And the fixed bug by this patch have resolved by commit 73f7b171b7c0 ("Bluetooth:
btsdio: fix use after free bug in btsdio_remove due to race condition").
--- drivers/bluetooth/btsdio.c | 1 - 1 file changed, 1 deletion(-)
drivers/bluetooth/btsdio.c +0 -1
@@ -343,7 +343,6 @@ static void btsdio_remove(struct sdio_func *func)BT_DBG ("func %p" , func); -cancel_work_sync (&data->work);if (!data)return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 114/282 netlink: Use copy_to_user() for optval in netlink_getsockopt().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit d913d32cc2707e9cd24fe6fa6d7d470e9c728980 ]
Brad Spencer provided a detailed report [0] that when calling getsockopt() for AF_NETLINK, some SOL_NETLINK options set only 1 byte even though such options require at least sizeof(int) as length.
The options return a flag value that fits into 1 byte, but such behaviour confuses users who do not initialise the variable before calling getsockopt() and do not strictly check the returned value as char.
Currently, netlink_getsockopt() uses put_user() to copy data to optlen and optval, but put_user() casts the data based on the pointer, char *optval. As a result, only 1 byte is set to optval.
To avoid this behaviour, we need to use copy_to_user() or cast optval for put_user().
Note that this changes the behaviour on big-endian systems, but we document that the size of optval is int in the man page.
$ man 7 netlink
...
Socket options
To set or get a netlink socket option, call getsockopt(2) to read
or setsockopt(2) to write the option with the option level argument
set to SOL_NETLINK. Unless otherwise noted, optval is a pointer to
an int.--- net/netlink/af_netlink.c | 75 ++++++++++++---------------------------- 1 file changed, 23 insertions(+), 52 deletions(-)
net/netlink/af_netlink.c +23 -52
@@ -1743,7 +1743,8 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk;struct netlink_sock *nlk =nlk_sk (sk); -int len, val, err; +unsigned int flag; +int len, val;if (level !=SOL_NETLINK )return -ENOPROTOOPT ;
@@ -1755,39 +1756,17 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,switch (optname) {case NETLINK_PKTINFO : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_RECV_PKTINFO ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_RECV_PKTINFO ;break ;case NETLINK_BROADCAST_ERROR : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_BROADCAST_SEND_ERROR ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_BROADCAST_SEND_ERROR ;break ;case NETLINK_NO_ENOBUFS : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_RECV_NO_ENOBUFS ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_RECV_NO_ENOBUFS ;break ;case NETLINK_LIST_MEMBERSHIPS : { -int pos, idx, shift; +int pos, idx, shift, err =0 ; - err =0 ;netlink_lock_table ();for (pos =0 ; pos *8 < nlk->ngroups; pos +=sizeof (u32)) {if (len - pos <sizeof (u32))
@@ -1804,40 +1783,32 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,if (put_user (ALIGN (nlk->ngroups /8 ,sizeof (u32)), optlen)) err = -EFAULT ;netlink_unlock_table (); -break ; +return err; }case NETLINK_CAP_ACK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_CAP_ACK ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_CAP_ACK ;break ;case NETLINK_EXT_ACK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_EXT_ACK ?1 :0 ; -if (put_user (len, optlen) ||put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_EXT_ACK ;break ;case NETLINK_GET_STRICT_CHK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_STRICT_CHK ?1 :0 ; -if (put_user (len, optlen) ||put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_STRICT_CHK ;break ;default : - err = -ENOPROTOOPT ; +return -ENOPROTOOPT ; } -return err; + +if (len <sizeof (int )) +return -EINVAL ; + + len =sizeof (int ); + val = nlk->flags & flag ?1 :0 ; + +if (put_user (len, optlen) || +copy_to_user (optval, &val, len)) +return -EFAULT ; + +return 0 ; }static void netlink_cmsg_recv_pktinfo (struct msghdr *msg,struct sk_buff *skb)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 115/282 net: amd: Fix link leak when verifying config failed
In reply to Greg Kroah-HartmanFrom: Gencen Gan <[email protected]>
[ Upstream commit d325c34d9e7e38d371c0a299d415e9b07f66a1fb ]
After failing to verify configuration, it returns directly without releasing link, which may cause memory leak.
Paolo Abeni thinks that the whole code of this driver is quite "suboptimal" and looks unmainatained since at least ~15y, so he suggests that we could simply remove the whole driver, please take it into consideration.
Simon Horman suggests that the fix label should be set to "Linux-2.6.12-rc2" considering that the problem has existed since the driver was introduced and the commit above doesn't seem to exist in net/net-next.
--- drivers/net/ethernet/amd/nmclan_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/nmclan_cs.c +1 -1
@@ -652,7 +652,7 @@ static int nmclan_config(struct pcmcia_device *link) }else {pr_notice ("mace id not found: %x %x should be 0x40 0x?9\n" , sig[0 ], sig[1 ]); -return -ENODEV ; + goto failed; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 116/282 tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 50749f2dd6854a41830996ad302aef2ffaf011d8 ]
syzkaller reported [0] memory leaks of an UDP socket and ZEROCOPY skbs. We can reproduce the problem with these sequences:
sk = socket(AF_INET, SOCK_DGRAM, 0) sk.setsockopt(SOL_SOCKET, SO_TIMESTAMPING, SOF_TIMESTAMPING_TX_SOFTWARE) sk.setsockopt(SOL_SOCKET, SO_ZEROCOPY, 1)
sk.sendto(b'', MSG_ZEROCOPY, ('127.0.0.1', 53))
sk.close()
sendmsg() calls msg_zerocopy_alloc(), which allocates a skb, sets skb->cb->ubuf.refcnt to 1, and calls sock_hold(). Here, struct ubuf_info_msgzc indirectly holds a refcnt of the socket. When the skb is sent, __skb_tstamp_tx() clones it and puts the clone into the socket's error queue with the TX timestamp.
When the original skb is received locally, skb_copy_ubufs() calls skb_unclone(), and pskb_expand_head() increments skb->cb->ubuf.refcnt. This additional count is decremented while freeing the skb, but struct ubuf_info_msgzc still has a refcnt, so __msg_zerocopy_callback() is not called.
The last refcnt is not released unless we retrieve the TX timestamped skb by recvmsg(). Since we clear the error queue in inet_sock_destruct() after the socket's refcnt reaches 0, there is a circular dependency. If we close() the socket holding such skbs, we never call sock_put() and leak the count, sk, and skb.
TCP has the same problem, and commit e0c8bccd40fc ("net: stream:
purge sk_error_queue in sk_stream_kill_queues()") tried to fix it by calling skb_queue_purge() during close(). However, there is a small chance that skb queued in a qdisc or device could be put into the error queue after the skb_queue_purge() call.
In __skb_tstamp_tx(), the cloned skb should not have a reference to the ubuf to remove the circular dependency, but skb_clone() does not call skb_copy_ubufs() for zerocopy skb. So, we need to call skb_orphan_frags_rx() for the cloned skb to call skb_copy_ubufs().
[0]:
BUG: memory leak
unreferenced object 0xffff88800c6d2d00 (size 1152):
comm "syz-executor392", pid 264, jiffies 4294785440 (age 13.044s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 cd af e8 81 00 00 00 00 ................
02 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............
backtrace:
[<0000000055636812>] sk_prot_alloc+0x64/0x2a0 net/core/sock.c:2024
[<0000000054d77b7a>] sk_alloc+0x3b/0x800 net/core/sock.c:2083
[<0000000066f3c7e0>] inet_create net/ipv4/af_inet.c:319 [inline]
[<0000000066f3c7e0>] inet_create+0x31e/0xe40 net/ipv4/af_inet.c:245
[<000000009b83af97>] __sock_create+0x2ab/0x550 net/socket.c:1515
[<00000000b9b11231>] sock_create net/socket.c:1566 [inline]
[<00000000b9b11231>] __sys_socket_create net/socket.c:1603 [inline]
[<00000000b9b11231>] __sys_socket_create net/socket.c:1588 [inline]
[<00000000b9b11231>] __sys_socket+0x138/0x250 net/socket.c:1636
[<000000004fb45142>] __do_sys_socket net/socket.c:1649 [inline]
[<000000004fb45142>] __se_sys_socket net/socket.c:1647 [inline]
[<000000004fb45142>] __x64_sys_socket+0x73/0xb0 net/socket.c:1647
[<0000000066999e0e>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<0000000066999e0e>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
[<0000000017f238c1>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
BUG: memory leak
unreferenced object 0xffff888017633a00 (size 240):
comm "syz-executor392", pid 264, jiffies 4294785440 (age 13.044s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 2d 6d 0c 80 88 ff ff .........-m.....
backtrace:
[<000000002b1c4368>] __alloc_skb+0x229/0x320 net/core/skbuff.c:497
[<00000000143579a6>] alloc_skb include/linux/skbuff.h:1265 [inline]
[<00000000143579a6>] sock_omalloc+0xaa/0x190 net/core/sock.c:2596
[<00000000be626478>] msg_zerocopy_alloc net/core/skbuff.c:1294 [inline]
[<00000000be626478>] msg_zerocopy_realloc+0x1ce/0x7f0 net/core/skbuff.c:1370
[<00000000cbfc9870>] __ip_append_data+0x2adf/0x3b30 net/ipv4/ip_output.c:1037
[<0000000089869146>] ip_make_skb+0x26c/0x2e0 net/ipv4/ip_output.c:1652
[<00000000098015c2>] udp_sendmsg+0x1bac/0x2390 net/ipv4/udp.c:1253
[<0000000045e0e95e>] inet_sendmsg+0x10a/0x150 net/ipv4/af_inet.c:819
[<000000008d31bfde>] sock_sendmsg_nosec net/socket.c:714 [inline]
[<000000008d31bfde>] sock_sendmsg+0x141/0x190 net/socket.c:734
[<0000000021e21aa4>] __sys_sendto+0x243/0x360 net/socket.c:2117
[<00000000ac0af00c>] __do_sys_sendto net/socket.c:2129 [inline]
[<00000000ac0af00c>] __se_sys_sendto net/socket.c:2125 [inline]
[<00000000ac0af00c>] __x64_sys_sendto+0xe1/0x1c0 net/socket.c:2125
[<0000000066999e0e>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<0000000066999e0e>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
[<0000000017f238c1>] entry_SYSCALL_64_after_hwframe+0x63/0xcd--- net/core/skbuff.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/skbuff.c +3 -0
@@ -4632,6 +4632,9 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, skb =alloc_skb (0 ,GFP_ATOMIC ); }else { skb =skb_clone (orig_skb,GFP_ATOMIC ); + +if (skb_orphan_frags_rx (skb,GFP_ATOMIC )) +return ; }if (!skb)return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 117/282 pstore: Revert pmsg_lock back to a normal mutex
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 5239a89b06d6b199f133bf0ffea421683187f257 ]
This reverts commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721.
So while priority inversion on the pmsg_lock is an occasional problem that an rt_mutex would help with, in uses where logging is writing to pmsg heavily from multiple threads, the pmsg_lock can be heavily contended.
After this change landed, it was reported that cases where the mutex locking overhead was commonly adding on the order of 10s of usecs delay had suddenly jumped to ~msec delay with rtmutex.
It seems the slight differences in the locks under this level of contention causes the normal mutexes to utilize the spinning optimizations, while the rtmutexes end up in the sleeping slowpath (which allows additional threads to pile on trying to take the lock).
In this case, it devolves to a worse case senerio where the lock acquisition and scheduling overhead dominates, and each thread is waiting on the order of ~ms to do ~us of work.
Obviously, having tons of threads all contending on a single lock for logging is non-optimal, so the proper fix is probably reworking pstore pmsg to have per-cpu buffers so we don't have contention.
Additionally, Steven Rostedt has provided some furhter optimizations for rtmutexes that improves the rtmutex spinning path, but at least in my testing, I still see the test tripping into the sleeping path on rtmutexes while utilizing the spinning path with mutexes.
But in the short term, lets revert the change to the rt_mutex and go back to normal mutexes to avoid a potentially major performance regression. And we can work on optimizations to both rtmutexes and finer-grained locking for pstore pmsg in the future.
--- fs/pstore/pmsg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/pstore/pmsg.c +3 -4
@@ -7,10 +7,9 @@#include <linux/device.h> #include <linux/fs.h> #include <linux/uaccess.h> -#include <linux/rtmutex.h> #include "internal.h" -static DEFINE_RT_MUTEX (pmsg_lock); +static DEFINE_MUTEX (pmsg_lock);static ssize_t write_pmsg (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -29,9 +28,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,if (!access_ok (buf, count))return -EFAULT ; -rt_mutex_lock (&pmsg_lock); +mutex_lock (&pmsg_lock); ret = psinfo->write_user (&record, buf); -rt_mutex_unlock (&pmsg_lock); +mutex_unlock (&pmsg_lock);return ret ? ret : count; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 118/282 usb: host: xhci-rcar: remove leftover quirk handling
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 5d67f4861884762ebc2bddb5d667444e45f25782 ]
Loading V3 firmware does not need a quirk anymore, remove the leftover code.
--- drivers/usb/host/xhci-rcar.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/host/xhci-rcar.c +0 -3
@@ -74,7 +74,6 @@ MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3);/* For soc_device_attribute */ #define RCAR_XHCI_FIRMWARE_V2 BIT(0)/* FIRMWARE V2 */ -#define RCAR_XHCI_FIRMWARE_V3 BIT(1)/* FIRMWARE V3 */ static const struct soc_device_attribute rcar_quirks_match[] = { {
@@ -147,8 +146,6 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)if (quirks &RCAR_XHCI_FIRMWARE_V2 ) firmware_name =XHCI_RCAR_FIRMWARE_NAME_V2 ; -else if (quirks &RCAR_XHCI_FIRMWARE_V3 ) - firmware_name =XHCI_RCAR_FIRMWARE_NAME_V3 ;else firmware_name = priv->firmware_name;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 119/282 fpga: bridge: fix kernel-doc parameter description
In reply to Greg Kroah-HartmanFrom: Marco Pagani <[email protected]>
[ Upstream commit 7ef1a2c1c9dffa177ecc3ea50b7f5ee63a621137 ]
Fix the kernel-doc description for the "struct fpga_image_info *info" parameter of the fpga_bridge_get() function.
--- drivers/fpga/fpga-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/fpga-bridge.c +1 -1
@@ -115,7 +115,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)/** * fpga_bridge_get - get an exclusive reference to a fpga bridge * @dev: parent device that fpga bridge was registered with -* @info: fpga manager info +* @info: fpga image specific information * * Given a device, get an exclusive reference to a fpga bridge. *
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 120/282 iio: light: max44009: add missing OF device matching
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit b29c49026c3c05a11f845dba17cad0b3ba06836d ]
The driver currently matches only via i2c_device_id, but also has of_device_id table:
drivers/iio/light/max44009.c:545:34: error: ‘max44009_of_match’ defined but not used [-Werror=unused-const-variable=]
--- drivers/iio/light/max44009.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/iio/light/max44009.c +7 -6
@@ -529,6 +529,12 @@ static int max44009_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } +static const struct of_device_id max44009_of_match[] = { + { .compatible ="maxim,max44009" }, + { } +}; +MODULE_DEVICE_TABLE (of, max44009_of_match); +static const struct i2c_device_id max44009_id[] = { {"max44009" ,0 }, { }
@@ -538,18 +544,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id);static struct i2c_driver max44009_driver = { .driver = { .name =MAX44009_DRV_NAME , + .of_match_table = max44009_of_match, }, .probe = max44009_probe, .id_table = max44009_id, };module_i2c_driver (max44009_driver); -static const struct of_device_id max44009_of_match[] = { - { .compatible ="maxim,max44009" }, - { } -}; -MODULE_DEVICE_TABLE (of, max44009_of_match); -MODULE_AUTHOR ("Robert Eshleman <[email protected]>" );MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("MAX44009 ambient light sensor driver" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 103/282 md/raid10: fix memleak for conf->bio_split
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit c9ac2acde53f5385de185bccf6aaa91cf9ac1541 ]
In the error path of raid10_run(), 'conf' need be freed, however, 'conf->bio_split' is missed and memory will be leaked.
Since there are 3 places to free 'conf', factor out a helper to fix the problem.
--- drivers/md/raid10.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/md/raid10.c +17 -20
@@ -3635,6 +3635,20 @@ static int setup_geo(struct geom *geo, struct mddev *mddev, enum geo_type new)return nc*fc; } +static void raid10_free_conf (struct r10conf *conf) +{ +if (!conf) +return ; + +mempool_exit (&conf->r10bio_pool); +kfree (conf->mirrors); +kfree (conf->mirrors_old); +kfree (conf->mirrors_new); +safe_put_page (conf->tmppage); +bioset_exit (&conf->bio_split); +kfree (conf); +} +static struct r10conf *setup_conf (struct mddev *mddev) {struct r10conf *conf =NULL ;
@@ -3717,13 +3731,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)return conf; out: -if (conf) { -mempool_exit (&conf->r10bio_pool); -kfree (conf->mirrors); -safe_put_page (conf->tmppage); -bioset_exit (&conf->bio_split); -kfree (conf); - } +raid10_free_conf (conf);return ERR_PTR (err); }
@@ -3937,10 +3945,7 @@ static int raid10_run(struct mddev *mddev) out_free_conf:md_unregister_thread (&mddev->thread); -mempool_exit (&conf->r10bio_pool); -safe_put_page (conf->tmppage); -kfree (conf->mirrors); -kfree (conf); +raid10_free_conf (conf); mddev->private =NULL ; out:return -EIO ;
@@ -3948,15 +3953,7 @@ static int raid10_run(struct mddev *mddev)static void raid10_free (struct mddev *mddev,void *priv) { -struct r10conf *conf = priv; - -mempool_exit (&conf->r10bio_pool); -safe_put_page (conf->tmppage); -kfree (conf->mirrors); -kfree (conf->mirrors_old); -kfree (conf->mirrors_new); -bioset_exit (&conf->bio_split); -kfree (conf); +raid10_free_conf (priv); }static void raid10_quiesce (struct mddev *mddev,int quiesce)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 121/282 spi: imx/fsl-lpspi: Convert to GPIO descriptors
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 8cdcd8aeee2819199ec7f68114b77b04c10611d3 ]
This converts the two Freescale i.MX SPI drivers Freescale i.MX (CONFIG_SPI_IMX) and Freescale i.MX LPSPI (CONFIG_SPI_FSL_LPSPI) to use GPIO descriptors handled in the SPI core for GPIO chip selects whether defined in the device tree or a board file.
The reason why both are converted at the same time is that they were both using the same platform data and platform device population helpers when using board files intertwining the code so this gives a cleaner cut.
The platform device creation was passing a platform data container from each boardfile down to the driver using struct spi_imx_master from <linux/platform_data/spi-imx.h>, but this was only conveying the number of chipselects and an int * array of the chipselect GPIO numbers.
The imx27 and imx31 platforms had code passing the now-unused platform data when creating the platform devices, this has been repurposed to pass around GPIO descriptor tables. The platform data struct that was just passing an array of integers and number of chip selects for the GPIO lines has been removed.
The number of chipselects used to be passed from the board file, because this number also limits the number of native chipselects that the platform can use. To deal with this we just augment the i.MX (CONFIG_SPI_IMX) driver to support 3 chipselects if the platform does not define "num-cs" as a device property (such as from the device tree). This covers all the legacy boards as these use <= 3 native chip selects (or GPIO lines, and in that case the number of chip selects is determined by the core from the number of available GPIO lines). Any new boards should use device tree, so this is a reasonable simplification to cover all old boards.
The LPSPI driver never assigned the number of chipselects and thus always fall back to the core default of 1 chip select if no GPIOs are defined in the device tree.
The Freescale i.MX driver was already partly utilizing the SPI core to obtain the GPIO numbers from the device tree, so this completes the transtion to let the core handle all of it.
All board files and the core i.MX boardfile registration code is augmented to account for these changes.
This has been compile-tested with the imx_v4_v5_defconfig and the imx_v6_v7_defconfig.
Stable-dep-of: 11951c9e3f36 ("spi: imx: Don't skip cleanup in remove's error path")
--- arch/arm/mach-imx/devices-imx27.h | 10 +-- arch/arm/mach-imx/devices-imx31.h | 10 +-- arch/arm/mach-imx/devices/devices-common.h | 5 +- arch/arm/mach-imx/devices/platform-spi_imx.c | 9 +- arch/arm/mach-imx/mach-mx27_3ds.c | 40 ++++++--- arch/arm/mach-imx/mach-mx31_3ds.c | 13 +-- arch/arm/mach-imx/mach-mx31lilly.c | 14 +-- arch/arm/mach-imx/mach-mx31lite.c | 19 +--- arch/arm/mach-imx/mach-mx31moboard.c | 12 +-- arch/arm/mach-imx/mach-pca100.c | 21 +++-- arch/arm/mach-imx/mach-pcm037_eet.c | 7 +- drivers/spi/spi-fsl-lpspi.c | 47 +--------- drivers/spi/spi-imx.c | 92 ++++---------------- include/linux/platform_data/spi-imx.h | 33 ------- 14 files changed, 88 insertions(+), 244 deletions(-) delete mode 100644 include/linux/platform_data/spi-imx.h
arch/arm/mach-imx/devices-imx27.h +5 -5
@@ -75,11 +75,11 @@ extern const struct imx_mxc_w1_data imx27_mxc_w1_data; imx_add_mxc_w1(&imx27_mxc_w1_data)extern const struct imx_spi_imx_data imx27_cspi_data[]; -#define imx27_add_cspi (id, pdata) \ - imx_add_spi_imx(&imx27_cspi_data[id], pdata) -#define imx27_add_spi_imx0 (pdata) imx27_add_cspi(0, pdata) -#define imx27_add_spi_imx1 (pdata) imx27_add_cspi(1, pdata) -#define imx27_add_spi_imx2 (pdata) imx27_add_cspi(2, pdata) +#define imx27_add_cspi (id, gtable) \ + imx_add_spi_imx(&imx27_cspi_data[id], gtable) +#define imx27_add_spi_imx0 (gtable) imx27_add_cspi(0, gtable) +#define imx27_add_spi_imx1 (gtable) imx27_add_cspi(1, gtable) +#define imx27_add_spi_imx2 (gtable) imx27_add_cspi(2, gtable)extern const struct imx_pata_imx_data imx27_pata_imx_data;#define imx27_add_pata_imx () \
arch/arm/mach-imx/devices-imx31.h +5 -5
@@ -69,11 +69,11 @@ extern const struct imx_mxc_w1_data imx31_mxc_w1_data; imx_add_mxc_w1(&imx31_mxc_w1_data)extern const struct imx_spi_imx_data imx31_cspi_data[]; -#define imx31_add_cspi (id, pdata) \ - imx_add_spi_imx(&imx31_cspi_data[id], pdata) -#define imx31_add_spi_imx0 (pdata) imx31_add_cspi(0, pdata) -#define imx31_add_spi_imx1 (pdata) imx31_add_cspi(1, pdata) -#define imx31_add_spi_imx2 (pdata) imx31_add_cspi(2, pdata) +#define imx31_add_cspi (id, gtable) \ + imx_add_spi_imx(&imx31_cspi_data[id], gtable) +#define imx31_add_spi_imx0 (gtable) imx31_add_cspi(0, gtable) +#define imx31_add_spi_imx1 (gtable) imx31_add_cspi(1, gtable) +#define imx31_add_spi_imx2 (gtable) imx31_add_cspi(2, gtable)extern const struct imx_pata_imx_data imx31_pata_imx_data;#define imx31_add_pata_imx () \
arch/arm/mach-imx/devices/devices-common.h +2 -3
@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/init.h> +#include <linux/gpio/machine.h> #include <linux/platform_data/dma-imx-sdma.h> extern struct device mxc_aips_bus;
@@ -276,7 +277,6 @@ struct platform_device *__init imx_add_sdhci_esdhc_imx(const struct imx_sdhci_esdhc_imx_data *data, const struct esdhc_platform_data *pdata); -#include <linux/platform_data/spi-imx.h> struct imx_spi_imx_data {const char *devid;int id;
@@ -285,8 +285,7 @@ struct imx_spi_imx_data {int irq; };struct platform_device *__init imx_add_spi_imx ( -const struct imx_spi_imx_data *data, -const struct spi_imx_master *pdata); +const struct imx_spi_imx_data *data,struct gpiod_lookup_table *gtable);struct platform_device *imx_add_imx_dma (char *name,resource_size_t iobase,int irq,int irq_err);
arch/arm/mach-imx/devices/platform-spi_imx.c +5 -4
@@ -3,6 +3,7 @@* Copyright (C) 2009-2010 Pengutronix * Uwe Kleine-Koenig <[email protected]> */ +#include <linux/gpio/machine.h> #include "../hardware.h" #include "devices-common.h"
@@ -57,8 +58,7 @@ const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {#endif /* ifdef CONFIG_SOC_IMX35 */ struct platform_device *__init imx_add_spi_imx ( -const struct imx_spi_imx_data *data, -const struct spi_imx_master *pdata) +const struct imx_spi_imx_data *data,struct gpiod_lookup_table *gtable) {struct resource res[] = { {
@@ -71,7 +71,8 @@ struct platform_device *__init imx_add_spi_imx( .flags = IORESOURCE_IRQ, }, }; - +if (gtable) +gpiod_add_lookup_table (gtable);return imx_add_platform_device (data->devid, data->id, - res,ARRAY_SIZE (res), pdata,sizeof (*pdata)); + res,ARRAY_SIZE (res),NULL ,0 ); }
arch/arm/mach-imx/mach-mx27_3ds.c +28 -12
@@ -304,18 +304,34 @@ static struct imx_ssi_platform_data mx27_3ds_ssi_pdata = { };/* SPI */ -static int spi1_chipselect[] = {SPI1_SS0 }; - -static const struct spi_imx_master spi1_pdata__initconst = { - .chipselect = spi1_chipselect, - .num_chipselect =ARRAY_SIZE (spi1_chipselect), +static struct gpiod_lookup_table mx27_spi1_gpiod_table = { + .dev_id ="imx27-cspi.0" ,/* Actual device name for spi1 */ + .table = { +/* +* The i.MX27 has the i.MX21 GPIO controller, the SPI1 CS GPIO +* SPI1_SS0 is numbered IMX_GPIO_NR(4, 28). +* +* This is in "bank 4" which is subtracted by one in the macro +* so this is actually bank 3 on "imx21-gpio.3". +*/ +GPIO_LOOKUP_IDX ("imx21-gpio.3" ,28 ,"cs" ,0 ,GPIO_ACTIVE_LOW ), + { }, + }, }; -static int spi2_chipselect[] = {SPI2_SS0 }; - -static const struct spi_imx_master spi2_pdata__initconst = { - .chipselect = spi2_chipselect, - .num_chipselect =ARRAY_SIZE (spi2_chipselect), +static struct gpiod_lookup_table mx27_spi2_gpiod_table = { + .dev_id ="imx27-cspi.1" ,/* Actual device name for spi2 */ + .table = { +/* +* The i.MX27 has the i.MX21 GPIO controller, the SPI2 CS GPIO +* SPI2_SS0 is numbered IMX_GPIO_NR(4, 21). +* +* This is in "bank 4" which is subtracted by one in the macro +* so this is actually bank 3 on "imx21-gpio.3". +*/ +GPIO_LOOKUP_IDX ("imx21-gpio.3" ,21 ,"cs" ,0 ,GPIO_ACTIVE_LOW ), + { }, + }, };static struct imx_fb_videomode mx27_3ds_modes[] = {
@@ -389,8 +405,8 @@ static void __init mx27pdk_init(void)imx27_add_imx_keypad (&mx27_3ds_keymap_data);imx27_add_imx2_wdt (); -imx27_add_spi_imx1 (&spi2_pdata); -imx27_add_spi_imx0 (&spi1_pdata); +imx27_add_spi_imx1 (&mx27_spi2_gpiod_table); +imx27_add_spi_imx0 (&mx27_spi1_gpiod_table);imx27_add_imx_i2c (0 , &mx27_3ds_i2c0_data);imx27_add_imx_fb (&mx27_3ds_fb_data);
arch/arm/mach-imx/mach-mx31_3ds.c +2 -11
@@ -364,15 +364,6 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = { .flags = IMX_SSI_DMA | IMX_SSI_NET, }; -/* SPI */ -static const struct spi_imx_master spi0_pdata__initconst = { - .num_chipselect =3 , -}; - -static const struct spi_imx_master spi1_pdata__initconst = { - .num_chipselect =3 , -}; -static struct spi_board_info mx31_3ds_spi_devs[]__initdata = { { .modalias ="mc13783" ,
@@ -548,14 +539,14 @@ static void __init mx31_3ds_init(void)imx31_add_imx_uart0 (&uart_pdata);imx31_add_mxc_nand (&mx31_3ds_nand_board_info); -imx31_add_spi_imx1 (&spi1_pdata); +imx31_add_spi_imx1 (NULL );imx31_add_imx_keypad (&mx31_3ds_keymap_data);imx31_add_imx2_wdt ();imx31_add_imx_i2c0 (&mx31_3ds_i2c0_data); -imx31_add_spi_imx0 (&spi0_pdata); +imx31_add_spi_imx0 (NULL );imx31_add_ipu_core ();imx31_add_mx3_sdc_fb (&mx3fb_pdata);
arch/arm/mach-imx/mach-mx31lilly.c +2 -12
@@ -215,16 +215,6 @@ static void __init lilly1131_usb_init(void)imx31_add_mxc_ehci_hs (2 , &usbh2_pdata); } -/* SPI */ - -static const struct spi_imx_master spi0_pdata__initconst = { - .num_chipselect =3 , -}; - -static const struct spi_imx_master spi1_pdata__initconst = { - .num_chipselect =3 , -}; -static struct mc13xxx_platform_data mc13783_pdata__initdata = { .flags =MC13XXX_USE_RTC |MC13XXX_USE_TOUCHSCREEN , };
@@ -281,8 +271,8 @@ static void __init mx31lilly_board_init(void)mxc_iomux_alloc_pin (MX31_PIN_CSPI2_SS1__SS1 ,"SPI2_SS1" );mxc_iomux_alloc_pin (MX31_PIN_CSPI2_SS2__SS2 ,"SPI2_SS2" ); -imx31_add_spi_imx0 (&spi0_pdata); -imx31_add_spi_imx1 (&spi1_pdata); +imx31_add_spi_imx0 (NULL ); +imx31_add_spi_imx1 (NULL );regulator_register_fixed (0 , dummy_supplies,ARRAY_SIZE (dummy_supplies)); }
arch/arm/mach-imx/mach-mx31lite.c +2 -17
@@ -73,11 +73,6 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -/* SPI */ -static const struct spi_imx_master spi0_pdata__initconst = { - .num_chipselect =3 , -}; -static const struct mxc_nand_platform_data mx31lite_nand_board_info__initconst = { .width =1 ,
@@ -111,16 +106,6 @@ static struct platform_device smsc911x_device = { }, }; -/* -* SPI -* -* The MC13783 is the only hard-wired SPI device on the module. -*/ - -static const struct spi_imx_master spi1_pdata__initconst = { - .num_chipselect =1 , -}; -static struct mc13xxx_platform_data mc13783_pdata__initdata = { .flags =MC13XXX_USE_RTC , };
@@ -246,13 +231,13 @@ static void __init mx31lite_init(void) "mx31lite");imx31_add_imx_uart0 (&uart_pdata); -imx31_add_spi_imx0 (&spi0_pdata); +imx31_add_spi_imx0 (NULL );/* NOR and NAND flash */ platform_device_register (&physmap_flash_device);imx31_add_mxc_nand (&mx31lite_nand_board_info); -imx31_add_spi_imx1 (&spi1_pdata); +imx31_add_spi_imx1 (NULL );regulator_register_fixed (0 , dummy_supplies,ARRAY_SIZE (dummy_supplies)); }
arch/arm/mach-imx/mach-mx31moboard.c +2 -10
@@ -143,10 +143,6 @@ static const struct imxi2c_platform_data moboard_i2c1_data __initconst = { .bitrate = 100000, }; -static const struct spi_imx_master moboard_spi1_pdata__initconst = { - .num_chipselect =3 , -}; -static struct regulator_consumer_supply sdhc_consumers[] = { { .dev_name ="imx31-mmc.0" ,
@@ -287,10 +283,6 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = { }, }; -static const struct spi_imx_master moboard_spi2_pdata__initconst = { - .num_chipselect =2 , -}; -#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)#define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
@@ -514,8 +506,8 @@ static void __init mx31moboard_init(void)imx31_add_imx_i2c0 (&moboard_i2c0_data);imx31_add_imx_i2c1 (&moboard_i2c1_data); -imx31_add_spi_imx1 (&moboard_spi1_pdata); -imx31_add_spi_imx2 (&moboard_spi2_pdata); +imx31_add_spi_imx1 (NULL ); +imx31_add_spi_imx2 (NULL );mx31moboard_init_cam ();
arch/arm/mach-imx/mach-pca100.c +15 -6
@@ -14,6 +14,7 @@#include <linux/irq.h> #include <linux/delay.h> #include <linux/gpio.h> +#include <linux/gpio/machine.h> #include <linux/usb/otg.h> #include <linux/usb/ulpi.h>
@@ -188,11 +189,19 @@ static struct spi_board_info pca100_spi_board_info[] __initdata = { }, }; -static int pca100_spi_cs[] = {SPI1_SS0 ,SPI1_SS1 }; - -static const struct spi_imx_master pca100_spi0_data__initconst = { - .chipselect = pca100_spi_cs, - .num_chipselect =ARRAY_SIZE (pca100_spi_cs), +static struct gpiod_lookup_table pca100_spi0_gpiod_table = { + .dev_id ="imx27-cspi.0" ,/* Actual device name for spi0 */ + .table = { +/* +* The i.MX27 has the i.MX21 GPIO controller, port D is +* bank 3 and thus named "imx21-gpio.3". +* SPI1_SS0 is GPIO_PORTD + 28 +* SPI1_SS1 is GPIO_PORTD + 27 +*/ +GPIO_LOOKUP_IDX ("imx21-gpio.3" ,28 ,"cs" ,0 ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP_IDX ("imx21-gpio.3" ,27 ,"cs" ,1 ,GPIO_ACTIVE_LOW ), + { }, + }, };static void pca100_ac97_warm_reset (struct snd_ac97 *ac97)
@@ -362,7 +371,7 @@ static void __init pca100_init(void)mxc_gpio_mode (GPIO_PORTD |27 |GPIO_GPIO |GPIO_IN );spi_register_board_info (pca100_spi_board_info,ARRAY_SIZE (pca100_spi_board_info)); -imx27_add_spi_imx0 (&pca100_spi0_data); +imx27_add_spi_imx0 (&pca100_spi0_gpiod_table);imx27_add_imx_fb (&pca100_fb_data);
arch/arm/mach-imx/mach-pcm037_eet.c +1 -6
@@ -52,11 +52,6 @@ static struct spi_board_info pcm037_spi_dev[] = { }, }; -/* Platform Data for MXC CSPI */ -static const struct spi_imx_master pcm037_spi1_pdata__initconst = { - .num_chipselect =2 , -}; -/* GPIO-keys input device */ static struct gpio_keys_button pcm037_gpio_keys[] = { {
@@ -163,7 +158,7 @@ int __init pcm037_eet_init_devices(void)/* SPI */ spi_register_board_info (pcm037_spi_dev,ARRAY_SIZE (pcm037_spi_dev)); -imx31_add_spi_imx0 (&pcm037_spi1_pdata); +imx31_add_spi_imx0 (NULL );imx_add_gpio_keys (&pcm037_gpio_keys_platform_data);
drivers/spi/spi-fsl-lpspi.c +3 -44
89 lines not on this page · raw message
drivers/spi/spi-imx.c +16 -76
167 lines not on this page · raw message
include/linux/platform_data/spi-imx.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef __MACH_SPI_H_ -#define __MACH_SPI_H_ - -/* -* struct spi_imx_master - device.platform_data for SPI controller devices. -* @chipselect: Array of chipselects for this master or NULL. Numbers >= 0 -* mean GPIO pins, -ENOENT means internal CSPI chipselect -* matching the position in the array. E.g., if chipselect[1] = -* -ENOENT then a SPI slave using chip select 1 will use the -* native SS1 line of the CSPI. Omitting the array will use -* all native chip selects. - -* Normally you want to use gpio based chip selects as the CSPI -* module tries to be intelligent about when to assert the -* chipselect: The CSPI module deasserts the chipselect once it -* runs out of input data. The other problem is that it is not -* possible to mix between high active and low active chipselects -* on one single bus using the internal chipselects. -* Unfortunately, on some SoCs, Freescale decided to put some -* chipselects on dedicated pins which are not usable as gpios, -* so we have to support the internal chipselects. -* -* @num_chipselect: If @chipselect is specified, ARRAY_SIZE(chipselect), -* otherwise the number of native chip selects. -*/ -struct spi_imx_master { -int *chipselect; -int num_chipselect; -}; - -#endif /* __MACH_SPI_H_*/
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 122/282 spi: imx: enable runtime pm support
In reply to Greg Kroah-HartmanFrom: Clark Wang <[email protected]>
[ Upstream commit 525c9e5a32bd7951eae3f06d9d077fea51718a6c ]
Enable runtime pm support for spi-imx driver.
Stable-dep-of: 11951c9e3f36 ("spi: imx: Don't skip cleanup in remove's error path")
--- drivers/spi/spi-imx.c | 121 ++++++++++++++++++++++++++++++------------ 1 file changed, 88 insertions(+), 33 deletions(-)
drivers/spi/spi-imx.c +88 -33
@@ -13,7 +13,9 @@#include <linux/irq.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/pinctrl/consumer.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/spi/spi.h> #include <linux/spi/spi_bitbang.h>
@@ -30,6 +32,8 @@ static bool use_dma = true;module_param (use_dma, bool,0644 );MODULE_PARM_DESC (use_dma,"Enable usage of DMA when available (default)" ); +#define MXC_RPM_TIMEOUT 2000/* 2000ms */ +#define MXC_CSPIRXDATA 0x00#define MXC_CSPITXDATA 0x04#define MXC_CSPICTRL 0x08
@@ -1532,20 +1536,16 @@ spi_imx_prepare_message(struct spi_master *master, struct spi_message *msg)struct spi_imx_data *spi_imx =spi_master_get_devdata (master);int ret; - ret =clk_enable (spi_imx->clk_per); -if (ret) -return ret; - - ret =clk_enable (spi_imx->clk_ipg); -if (ret) { -clk_disable (spi_imx->clk_per); + ret =pm_runtime_get_sync (spi_imx->dev); +if (ret <0 ) { +dev_err (spi_imx->dev,"failed to enable clock\n" );return ret; } ret = spi_imx->devtype_data->prepare_message (spi_imx, msg);if (ret) { -clk_disable (spi_imx->clk_ipg); -clk_disable (spi_imx->clk_per); +pm_runtime_mark_last_busy (spi_imx->dev); +pm_runtime_put_autosuspend (spi_imx->dev); }return ret;
@@ -1556,8 +1556,8 @@ spi_imx_unprepare_message(struct spi_master *master, struct spi_message *msg) {struct spi_imx_data *spi_imx =spi_master_get_devdata (master); -clk_disable (spi_imx->clk_ipg); -clk_disable (spi_imx->clk_per); +pm_runtime_mark_last_busy (spi_imx->dev); +pm_runtime_put_autosuspend (spi_imx->dev);return 0 ; }
@@ -1676,13 +1676,15 @@ static int spi_imx_probe(struct platform_device *pdev) goto out_master_put; } - ret =clk_prepare_enable (spi_imx->clk_per); -if (ret) - goto out_master_put; +pm_runtime_enable (spi_imx->dev); +pm_runtime_set_autosuspend_delay (spi_imx->dev,MXC_RPM_TIMEOUT ); +pm_runtime_use_autosuspend (spi_imx->dev); - ret =clk_prepare_enable (spi_imx->clk_ipg); -if (ret) - goto out_put_per; + ret =pm_runtime_get_sync (spi_imx->dev); +if (ret <0 ) { +dev_err (spi_imx->dev,"failed to enable clock\n" ); + goto out_runtime_pm_put; + } spi_imx->spi_clk =clk_get_rate (spi_imx->clk_per);/*
@@ -1692,7 +1694,7 @@ static int spi_imx_probe(struct platform_device *pdev)if (spi_imx->devtype_data->has_dmamode) { ret =spi_imx_sdma_init (&pdev->dev, spi_imx, master);if (ret == -EPROBE_DEFER ) - goto out_clk_put; + goto out_runtime_pm_put;if (ret <0 ) dev_err(&pdev->dev, "dma setup error %d, use pio\n",
@@ -1707,19 +1709,20 @@ static int spi_imx_probe(struct platform_device *pdev) ret =spi_bitbang_start (&spi_imx->bitbang);if (ret) {dev_err (&pdev->dev,"bitbang start failed with %d\n" , ret); - goto out_clk_put; + goto out_runtime_pm_put; }dev_info (&pdev->dev,"probed\n" ); -clk_disable (spi_imx->clk_ipg); -clk_disable (spi_imx->clk_per); +pm_runtime_mark_last_busy (spi_imx->dev); +pm_runtime_put_autosuspend (spi_imx->dev); +return ret; -out_clk_put: -clk_disable_unprepare (spi_imx->clk_ipg); -out_put_per: -clk_disable_unprepare (spi_imx->clk_per); +out_runtime_pm_put: +pm_runtime_dont_use_autosuspend (spi_imx->dev); +pm_runtime_put_sync (spi_imx->dev); +pm_runtime_disable (spi_imx->dev); out_master_put:spi_master_put (master);
@@ -1734,30 +1737,82 @@ static int spi_imx_remove(struct platform_device *pdev)spi_bitbang_stop (&spi_imx->bitbang); - ret =clk_enable (spi_imx->clk_per); + ret =pm_runtime_get_sync (spi_imx->dev); +if (ret <0 ) { +dev_err (spi_imx->dev,"failed to enable clock\n" ); +return ret; + } + +writel (0 , spi_imx->base +MXC_CSPICTRL ); + +pm_runtime_dont_use_autosuspend (spi_imx->dev); +pm_runtime_put_sync (spi_imx->dev); +pm_runtime_disable (spi_imx->dev); + +spi_imx_sdma_exit (spi_imx); +spi_master_put (master); + +return 0 ; +} + +static int __maybe_unused spi_imx_runtime_resume (struct device *dev) +{ +struct spi_master *master =dev_get_drvdata (dev); +struct spi_imx_data *spi_imx; +int ret; + + spi_imx =spi_master_get_devdata (master); + + ret =clk_prepare_enable (spi_imx->clk_per);if (ret)return ret; - ret =clk_enable (spi_imx->clk_ipg); + ret =clk_prepare_enable (spi_imx->clk_ipg);if (ret) { -clk_disable (spi_imx->clk_per); +clk_disable_unprepare (spi_imx->clk_per);return ret; } -writel (0 , spi_imx->base +MXC_CSPICTRL ); -clk_disable_unprepare (spi_imx->clk_ipg); +return 0 ; +} + +static int __maybe_unused spi_imx_runtime_suspend (struct device *dev) +{ +struct spi_master *master =dev_get_drvdata (dev); +struct spi_imx_data *spi_imx; + + spi_imx =spi_master_get_devdata (master); +clk_disable_unprepare (spi_imx->clk_per); -spi_imx_sdma_exit (spi_imx); -spi_master_put (master); +clk_disable_unprepare (spi_imx->clk_ipg); + +return 0 ; +} +static int __maybe_unused spi_imx_suspend (struct device *dev) +{ +pinctrl_pm_select_sleep_state (dev);return 0 ; } +static int __maybe_unused spi_imx_resume (struct device *dev) +{ +pinctrl_pm_select_default_state (dev); +return 0 ; +} + +static const struct dev_pm_ops imx_spi_pm = { + SET_RUNTIME_PM_OPS(spi_imx_runtime_suspend, + spi_imx_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (spi_imx_suspend, spi_imx_resume) +}; +static struct platform_driver spi_imx_driver = { .driver = { .name =DRIVER_NAME , .of_match_table = spi_imx_dt_ids, - }, + .pm = &imx_spi_pm, + }, .id_table = spi_imx_devtype, .probe = spi_imx_probe, .remove = spi_imx_remove,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 123/282 spi: spi-imx: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Minghao Chi <[email protected]>
[ Upstream commit 7d34ff58f35c82207698f43af79817a05e1342e5 ]
Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and pm_runtime_put_noidle. This change is just to simplify the code, no actual functional changes.
Stable-dep-of: 11951c9e3f36 ("spi: imx: Don't skip cleanup in remove's error path")
--- drivers/spi/spi-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-imx.c +2 -2
@@ -1536,7 +1536,7 @@ spi_imx_prepare_message(struct spi_master *master, struct spi_message *msg)struct spi_imx_data *spi_imx =spi_master_get_devdata (master);int ret; - ret =pm_runtime_get_sync (spi_imx->dev); + ret =pm_runtime_resume_and_get (spi_imx->dev);if (ret <0 ) {dev_err (spi_imx->dev,"failed to enable clock\n" );return ret;
@@ -1737,7 +1737,7 @@ static int spi_imx_remove(struct platform_device *pdev)spi_bitbang_stop (&spi_imx->bitbang); - ret =pm_runtime_get_sync (spi_imx->dev); + ret =pm_runtime_resume_and_get (spi_imx->dev);if (ret <0 ) {dev_err (spi_imx->dev,"failed to enable clock\n" );return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 124/282 spi: imx: Dont skip cleanup in removes error path
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 11951c9e3f364d7ae3b568a0e52c8335d43066b5 ]
Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails.
--- drivers/spi/spi-imx.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/spi/spi-imx.c +5 -7
@@ -1737,13 +1737,11 @@ static int spi_imx_remove(struct platform_device *pdev)spi_bitbang_stop (&spi_imx->bitbang); - ret =pm_runtime_resume_and_get (spi_imx->dev); -if (ret <0 ) { -dev_err (spi_imx->dev,"failed to enable clock\n" ); -return ret; - } - -writel (0 , spi_imx->base +MXC_CSPICTRL ); + ret =pm_runtime_get_sync (spi_imx->dev); +if (ret >=0 ) +writel (0 , spi_imx->base +MXC_CSPICTRL ); +else +dev_warn (spi_imx->dev,"failed to enable clock, skip hw disable\n" );pm_runtime_dont_use_autosuspend (spi_imx->dev);pm_runtime_put_sync (spi_imx->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 125/282 usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 2b947f8769be8b8181dc795fd292d3e7120f5204 ]
In renesas_usb3_probe, role_work is bound with renesas_usb3_role_work. renesas_usb3_start will be called to start the work.
If we remove the driver which will call usbhs_remove, there may be an unfinished work. The possible sequence is as follows:
CPU0 CPU1
renesas_usb3_role_workrenesas_usb3_removeusb_role_switch_unregisterdevice_unregister
kfree(sw)
//free usb3->role_sw
usb_role_switch_set_role
//use usb3->role_swThe usb3->role_sw could be freed under such circumstance and then used in usb_role_switch_set_role.
This bug was found by static analysis. And note that removing a driver is a root-only operation, and should never happen in normal case. But the root user may directly remove the device which will also trigger the remove function.
Fix it by canceling the work before cleanup in the renesas_usb3_remove.
--- drivers/usb/gadget/udc/renesas_usb3.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/renesas_usb3.c +1 -0
@@ -2553,6 +2553,7 @@ static int renesas_usb3_remove(struct platform_device *pdev)debugfs_remove_recursive (usb3->dentry);device_remove_file (&pdev->dev, &dev_attr_role); +cancel_work_sync (&usb3->role_work);usb_role_switch_unregister (usb3->role_sw);usb_del_gadget_udc (&usb3->gadget);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 126/282 PCI: imx6: Install the fault handler only on compatible match
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit 5f5ac460dfe7f4e11f99de9870f240e39189cf72 ]
commit bb38919ec56e ("PCI: imx6: Add support for i.MX6 PCIe controller") added a fault hook to this driver in the probe function. So it was only installed if needed.
commit bde4a5a00e76 ("PCI: imx6: Allow probe deferral by reset GPIO") moved it from probe to driver init which installs the hook unconditionally as soon as the driver is compiled into a kernel.
When this driver is compiled as a module, the hook is not registered until after the driver has been matched with a .compatible and loaded.
commit 415b6185c541 ("PCI: imx6: Fix config read timeout handling") extended the fault handling code.
commit 2d8ed461dbc9 ("PCI: imx6: Add support for i.MX8MQ") added some protection for non-ARM architectures, but this does not protect non-i.MX ARM architectures.
Since fault handlers can be triggered on any architecture for different reasons, there is no guarantee that they will be triggered only for the assumed situation, leading to improper error handling (i.MX6-specific imx6q_pcie_abort_handler) on foreign systems.
I had seen strange L3 imprecise external abort messages several times on OMAP4 and OMAP5 devices and couldn't make sense of them until I realized they were related to this unused imx6q driver because I had CONFIG_PCI_IMX6=y.
Note that CONFIG_PCI_IMX6=y is useful for kernel binaries that are designed to run on different ARM SoC and be differentiated only by device tree binaries. So turning off CONFIG_PCI_IMX6 is not a solution.
Therefore we check the compatible in the init function before registering the fault handler.
--- drivers/pci/controller/dwc/pci-imx6.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +7 -0
@@ -1295,6 +1295,13 @@ DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd,static int __init imx6_pcie_init (void ) {#ifdef CONFIG_ARM +struct device_node *np; + + np =of_find_matching_node (NULL , imx6_pcie_of_match); +if (!np) +return -ENODEV ; +of_node_put (np); +/* * Since probe() can be deferred we need to make sure that * hook_fault_code is not called after __init memory is freed
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 127/282 genirq: Add IRQF_NO_AUTOEN for request_irq/nmi()
In reply to Greg Kroah-HartmanFrom: Barry Song <[email protected]>
[ Upstream commit cbe16f35bee6880becca6f20d2ebf6b457148552 ]
Many drivers don't want interrupts enabled automatically via request_irq(). So they are handling this issue by either way of the below two:
(1)
irq_set_status_flags(irq, IRQ_NOAUTOEN);
request_irq(dev, irq...);
(2)
request_irq(dev, irq...);
disable_irq(irq);
The code in the second way is silly and unsafe. In the small time gap between request_irq() and disable_irq(), interrupts can still come.
The code in the first way is safe though it's subobtimal.
Add a new IRQF_NO_AUTOEN flag which can be handed in by drivers to request_irq() and request_nmi(). It prevents the automatic enabling of the requested interrupt/nmi in the same safe way as #1 above. With that the various usage sites of #1 and #2 above can be simplified and corrected.
Stable-dep-of: 39db65a0a17b ("ASoC: es8316: Handle optional IRQ assignment")
--- include/linux/interrupt.h | 4 ++++ kernel/irq/manage.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
include/linux/interrupt.h +4 -0
@@ -61,6 +61,9 @@* interrupt handler after suspending interrupts. For system * wakeup devices users need to implement wakeup detection in * their interrupt handlers. +* IRQF_NO_AUTOEN - Don't enable IRQ or NMI automatically when users request it. +* Users will enable it explicitly by enable_irq() or enable_nmi() +* later. */ #define IRQF_SHARED 0x00000080#define IRQF_PROBE_SHARED 0x00000100
@@ -74,6 +77,7 @@#define IRQF_NO_THREAD 0x00010000#define IRQF_EARLY_RESUME 0x00020000#define IRQF_COND_SUSPEND 0x00040000 +#define IRQF_NO_AUTOEN 0x00080000#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
kernel/irq/manage.c +9 -2
@@ -1610,7 +1610,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)irqd_set (&desc->irq_data,IRQD_NO_BALANCING ); } -if (irq_settings_can_autoenable (desc)) { +if (!(new->flags &IRQF_NO_AUTOEN ) && +irq_settings_can_autoenable (desc)) {irq_startup (desc,IRQ_RESEND ,IRQ_START_COND ); }else {/*
@@ -2041,10 +2042,15 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,* which interrupt is which (messes up the interrupt freeing * logic etc). * +* Also shared interrupts do not go well with disabling auto enable. +* The sharing interrupt might request it while it's still disabled +* and then wait for interrupts forever. +* * Also IRQF_COND_SUSPEND only makes sense for shared interrupts and * it cannot be set along with IRQF_NO_SUSPEND. */ if (((irqflags &IRQF_SHARED ) && !dev_id) || + ((irqflags &IRQF_SHARED ) && (irqflags &IRQF_NO_AUTOEN )) || (!(irqflags &IRQF_SHARED ) && (irqflags &IRQF_COND_SUSPEND )) || ((irqflags &IRQF_NO_SUSPEND ) && (irqflags &IRQF_COND_SUSPEND )))return -EINVAL ;
@@ -2200,7 +2206,8 @@ int request_nmi(unsigned int irq, irq_handler_t handler, desc =irq_to_desc (irq); -if (!desc ||irq_settings_can_autoenable (desc) || +if (!desc || (irq_settings_can_autoenable (desc) && + !(irqflags &IRQF_NO_AUTOEN )) || !irq_settings_can_request (desc) ||WARN_ON (irq_settings_is_per_cpu_devid (desc)) || !irq_supports_nmi (desc))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 128/282 ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 1cf2aa665901054b140eb71748661ceae99b6b5a ]
Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then disabling it immediately after requesting it.
This fixes a possible race where the IRQ might trigger between requesting and disabling it; and this also leads to a small code cleanup.
Stable-dep-of: 39db65a0a17b ("ASoC: es8316: Handle optional IRQ assignment")
--- sound/soc/codecs/es8316.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
sound/soc/codecs/es8316.c +2 -5
@@ -807,12 +807,9 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client,mutex_init (&es8316->lock); ret =devm_request_threaded_irq (dev, es8316->irq,NULL , es8316_irq, -IRQF_TRIGGER_HIGH |IRQF_ONESHOT , +IRQF_TRIGGER_HIGH |IRQF_ONESHOT |IRQF_NO_AUTOEN ,"es8316" , es8316); -if (ret ==0 ) { -/* Gets re-enabled by es8316_set_jack() */ -disable_irq (es8316->irq); - }else { +if (ret) {dev_warn (dev,"Failed to get IRQ %d: %d\n" , es8316->irq, ret); es8316->irq = -ENXIO ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 129/282 ASoC: es8316: Handle optional IRQ assignment
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 39db65a0a17b54915b269d3685f253a4731f344c ]
The driver is able to work fine without relying on a mandatory interrupt being assigned to the I2C device. This is only needed when making use of the jack-detect support.
However, the following warning message is always emitted when there is no such interrupt available:
es8316 0-0011: Failed to get IRQ 0: -22
Do not attempt to request an IRQ if it is not available/valid. This also ensures the rather misleading message is not displayed anymore.
Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c /
ACPI: Use 0 to indicate that device does not have interrupt assigned").
--- sound/soc/codecs/es8316.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
sound/soc/codecs/es8316.c +8 -6
@@ -806,12 +806,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client, es8316->irq = i2c_client->irq;mutex_init (&es8316->lock); - ret =devm_request_threaded_irq (dev, es8316->irq,NULL , es8316_irq, -IRQF_TRIGGER_HIGH |IRQF_ONESHOT |IRQF_NO_AUTOEN , -"es8316" , es8316); -if (ret) { -dev_warn (dev,"Failed to get IRQ %d: %d\n" , es8316->irq, ret); - es8316->irq = -ENXIO ; +if (es8316->irq >0 ) { + ret =devm_request_threaded_irq (dev, es8316->irq,NULL , es8316_irq, +IRQF_TRIGGER_HIGH |IRQF_ONESHOT |IRQF_NO_AUTOEN , +"es8316" , es8316); +if (ret) { +dev_warn (dev,"Failed to get IRQ %d: %d\n" , es8316->irq, ret); + es8316->irq = -ENXIO ; + } } return devm_snd_soc_register_component(&i2c_client->dev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 130/282 linux/vt_buffer.h: allow either builtin or modular for macros
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 2b76ffe81e32afd6d318dc4547e2ba8c46207b77 ]
Fix build errors on ARCH=alpha when CONFIG_MDA_CONSOLE=m. This allows the ARCH macros to be the only ones defined.
In file included from ../drivers/video/console/mdacon.c:37:../arch/alpha/include/asm/vga.h:17:40: error: expected identifier or '(' before 'volatile'
17 | static inline void scr_writew(u16 val, volatile u16 *addr)
| ^~~~~~~~../include/linux/vt_buffer.h:24:34: note: in definition of macro 'scr_writew'
24 | #define scr_writew(val, addr) (*(addr) = (val))
| ^~~~../include/linux/vt_buffer.h:24:40: error: expected ')' before '=' token
24 | #define scr_writew(val, addr) (*(addr) = (val))
| ^../arch/alpha/include/asm/vga.h:17:20: note: in expansion of macro 'scr_writew'
17 | static inline void scr_writew(u16 val, volatile u16 *addr)
| ^~~~~~~~~~
../arch/alpha/include/asm/vga.h:25:29: error: expected identifier or '(' before 'volatile'
25 | static inline u16 scr_readw(volatile const u16 *addr)
| ^~~~~~~~
--- include/linux/vt_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/vt_buffer.h +1 -1
@@ -16,7 +16,7 @@#include <linux/string.h> -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_MDA_CONSOLE ) +#if IS_ENABLED (CONFIG_VGA_CONSOLE ) ||IS_ENABLED (CONFIG_MDA_CONSOLE )#include <asm/vga.h> #endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 104/282 md: update the optimal I/O size on reshape
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 16ef510139315a2147ee7525796f8dbd4e4b7864 ]
The raid5 and raid10 drivers currently update the read-ahead size, but not the optimal I/O size on reshape. To prepare for deriving the read-ahead size from the optimal I/O size make sure it is updated as well.
Stable-dep-of: f0ddb83da3cb ("md/raid10: fix memleak of md thread")
--- drivers/md/raid10.c | 22 ++++++++++++++-------- drivers/md/raid5.c | 10 ++++++++-- 2 files changed, 22 insertions(+), 10 deletions(-)
drivers/md/raid10.c +14 -8
@@ -3735,10 +3735,20 @@ static struct r10conf *setup_conf(struct mddev *mddev)return ERR_PTR (err); } +static void raid10_set_io_opt (struct r10conf *conf) +{ +int raid_disks = conf->geo.raid_disks; + +if (!(conf->geo.raid_disks % conf->geo.near_copies)) + raid_disks /= conf->geo.near_copies; +blk_queue_io_opt (conf->mddev->queue, (conf->mddev->chunk_sectors <<9 ) * + raid_disks); +} +static int raid10_run (struct mddev *mddev) {struct r10conf *conf; -int i, disk_idx, chunk_size; +int i, disk_idx;struct raid10_info *disk;struct md_rdev *rdev;sector_t size;
@@ -3774,18 +3784,13 @@ static int raid10_run(struct mddev *mddev) mddev->thread = conf->thread; conf->thread =NULL ; - chunk_size = mddev->chunk_sectors <<9 ;if (mddev->queue) {blk_queue_max_discard_sectors (mddev->queue, mddev->chunk_sectors);blk_queue_max_write_same_sectors (mddev->queue,0 );blk_queue_max_write_zeroes_sectors (mddev->queue,0 ); -blk_queue_io_min (mddev->queue, chunk_size); -if (conf->geo.raid_disks % conf->geo.near_copies) -blk_queue_io_opt (mddev->queue, chunk_size * conf->geo.raid_disks); -else -blk_queue_io_opt (mddev->queue, chunk_size * - (conf->geo.raid_disks / conf->geo.near_copies)); +blk_queue_io_min (mddev->queue, mddev->chunk_sectors <<9 ); +raid10_set_io_opt (conf); }rdev_for_each (rdev, mddev) {
@@ -4748,6 +4753,7 @@ static void end_reshape(struct r10conf *conf) stripe /= conf->geo.near_copies;if (conf->mddev->queue->backing_dev_info->ra_pages <2 * stripe) conf->mddev->queue->backing_dev_info->ra_pages =2 * stripe; +raid10_set_io_opt (conf); } conf->fullsync =0 ; }
drivers/md/raid5.c +8 -2
@@ -7159,6 +7159,12 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degradedreturn 0 ; } +static void raid5_set_io_opt (struct r5conf *conf) +{ +blk_queue_io_opt (conf->mddev->queue, (conf->chunk_sectors <<9 ) * + (conf->raid_disks - conf->max_degraded)); +} +static int raid5_run (struct mddev *mddev) {struct r5conf *conf;
@@ -7448,8 +7454,7 @@ static int raid5_run(struct mddev *mddev) chunk_size = mddev->chunk_sectors <<9 ;blk_queue_io_min (mddev->queue, chunk_size); -blk_queue_io_opt (mddev->queue, chunk_size * - (conf->raid_disks - conf->max_degraded)); +raid5_set_io_opt (conf); mddev->queue->limits.raid_partial_stripes_expensive =1 ;/* * We can only discard a whole stripe. It doesn't make sense to
@@ -8043,6 +8048,7 @@ static void end_reshape(struct r5conf *conf) / PAGE_SIZE);if (conf->mddev->queue->backing_dev_info->ra_pages <2 * stripe) conf->mddev->queue->backing_dev_info->ra_pages =2 * stripe; +raid5_set_io_opt (conf); } } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 131/282 spi: qup: Dont skip cleanup in removes error path
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 61f49171a43ab1f80c73c5c88c508770c461e0f2 ]
Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails.
--- drivers/spi/spi-qup.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/spi/spi-qup.c +13 -9
@@ -1276,18 +1276,22 @@ static int spi_qup_remove(struct platform_device *pdev)struct spi_qup *controller =spi_master_get_devdata (master);int ret; - ret =pm_runtime_resume_and_get (&pdev->dev); -if (ret <0 ) -return ret; + ret =pm_runtime_get_sync (&pdev->dev); - ret =spi_qup_set_state (controller,QUP_STATE_RESET ); -if (ret) -return ret; +if (ret >=0 ) { + ret =spi_qup_set_state (controller,QUP_STATE_RESET ); +if (ret) +dev_warn (&pdev->dev,"failed to reset controller (%pe)\n" , +ERR_PTR (ret)); -spi_qup_release_dma (master); +clk_disable_unprepare (controller->cclk); +clk_disable_unprepare (controller->iclk); + }else { +dev_warn (&pdev->dev,"failed to resume, skip hw disable (%pe)\n" , +ERR_PTR (ret)); + } -clk_disable_unprepare (controller->cclk); -clk_disable_unprepare (controller->iclk); +spi_qup_release_dma (master);pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 105/282 md/raid10: fix memleak of md thread
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit f0ddb83da3cbbf8a1f9087a642c448ff52ee9abd ]
In raid10_run(), if setup_conf() succeed and raid10_run() failed before setting 'mddev->thread', then in the error path 'conf->thread' is not freed.
Fix the problem by setting 'mddev->thread' right after setup_conf().
--- drivers/md/raid10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/raid10.c +3 -3
@@ -3769,6 +3769,9 @@ static int raid10_run(struct mddev *mddev)if (!conf) goto out; + mddev->thread = conf->thread; + conf->thread =NULL ; +if (mddev_is_clustered (conf->mddev)) {int fc, fo;
@@ -3781,9 +3784,6 @@ static int raid10_run(struct mddev *mddev) } } - mddev->thread = conf->thread; - conf->thread =NULL ; -if (mddev->queue) {blk_queue_max_discard_sectors (mddev->queue, mddev->chunk_sectors);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 106/282 wifi: iwlwifi: make the loop for card preparation effective
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 28965ec0b5d9112585f725660e2ff13218505ace ]
Since we didn't reset t to 0, only the first iteration of the loop did checked the ready bit several times.
Quoted 1 line
From the second iteration and on, we just tested the bit once and
continued to the next iteration.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +2 -1
@@ -630,7 +630,6 @@ static int iwl_pcie_set_hw_ready(struct iwl_trans *trans)int iwl_pcie_prepare_card_hw (struct iwl_trans *trans) {int ret; -int t =0 ;int iter;IWL_DEBUG_INFO (trans,"iwl_trans_prepare_card_hw enter\n" );
@@ -645,6 +644,8 @@ int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)usleep_range (1000 ,2000 );for (iter =0 ; iter <10 ; iter++) { +int t =0 ; +/* If HW is not ready, prepare the conditions to check again */ iwl_set_bit (trans,CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_PREPARE );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 107/282 wifi: iwlwifi: mvm: check firmware response size
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 13513cec93ac9902d0b896976d8bab3758a9881c ]
Check the firmware response size for responses to the memory read/write command in debugfs before using it.
--- drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +10 -0
@@ -1877,6 +1877,11 @@ static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,if (ret <0 )return ret; +if (iwl_rx_packet_payload_len (hcmd.resp_pkt) <sizeof (*rsp)) { + ret = -EIO ; + goto out; + } + rsp = (void *)hcmd.resp_pkt->data;if (le32_to_cpu (rsp->status) !=DEBUG_MEM_STATUS_SUCCESS ) { ret = -ENXIO ;
@@ -1954,6 +1959,11 @@ static ssize_t iwl_dbgfs_mem_write(struct file *file,if (ret <0 )return ret; +if (iwl_rx_packet_payload_len (hcmd.resp_pkt) <sizeof (*rsp)) { + ret = -EIO ; + goto out; + } + rsp = (void *)hcmd.resp_pkt->data;if (rsp->status !=DEBUG_MEM_STATUS_SUCCESS ) { ret = -ENXIO ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 108/282 ixgbe: Allow flow hash to be set via ethtool
In reply to Greg Kroah-HartmanFrom: Joe Damato <[email protected]>
[ Upstream commit 4f3ed1293feb9502dc254b05802faf1ad3317ac6 ]
ixgbe currently returns EINVAL whenever the flowhash it set by ethtool because the ethtool code in the kernel passes a non-zero value for hfunc that ixgbe should allow.
When ethtool is called with ETHTOOL_SRXFHINDIR, ethtool_set_rxfh_indir will call ixgbe's set_rxfh function with ETH_RSS_HASH_NO_CHANGE. This value should be accepted.
When ethtool is called with ETHTOOL_SRSSH, ethtool_set_rxfh will call ixgbe's set_rxfh function with rxfh.hfunc, which appears to be hardcoded in ixgbe to always be ETH_RSS_HASH_TOP. This value should also be accepted.
Before this patch:
$ sudo ethtool -L eth1 combined 10 $ sudo ethtool -X eth1 default Cannot set RX flow hash configuration: Invalid argument
After this patch:
$ sudo ethtool -L eth1 combined 10
$ sudo ethtool -X eth1 default
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 10 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 0 1 2 3 4 5
16: 6 7 8 9 0 1 2 3
24: 4 5 6 7 8 9 0 1
...--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +2 -2
@@ -3008,8 +3008,8 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,int i;u32 reta_entries =ixgbe_rss_indir_tbl_entries (adapter); -if (hfunc) -return -EINVAL ; +if (hfunc !=ETH_RSS_HASH_NO_CHANGE && hfunc !=ETH_RSS_HASH_TOP ) +return -EOPNOTSUPP ;/* Fill out the redirection table */ if (indir) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 109/282 ixgbe: Enable setting RSS table to default values
In reply to Greg Kroah-HartmanFrom: Joe Damato <[email protected]>
[ Upstream commit e85d3d55875f7a1079edfbc4e4e98d6f8aea9ac7 ]
ethtool uses ETHTOOL_GRXRINGS to compute how many queues are supported by RSS. The driver should return the smaller of either:
- The maximum number of RSS queues the device supports, OR
- The number of RX queues configured
Prior to this change, running ethtool -X $iface default fails if the number of queues configured is larger than the number supported by RSS, even though changing the queue count correctly resets the flowhash to use all supported queues.
Other drivers (for example, i40e) will succeed but the flow hash will reset to support the maximum number of queues supported by RSS, even if that amount is smaller than the configured amount.
Prior to this change:
$ sudo ethtool -L eth1 combined 20
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 20 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
24: 8 9 10 11 12 13 14 15
32: 0 1 2 3 4 5 6 7
...You can see that the flowhash was correctly set to use the maximum number of queues supported by the driver (16).
However, asking the NIC to reset to "default" fails:
$ sudo ethtool -X eth1 default Cannot set RX flow hash configuration: Invalid argument
After this change, the flowhash can be reset to default which will use all of the available RSS queues (16) or the configured queue count, whichever is smaller.
Starting with eth1 which has 10 queues and a flowhash distributing to all 10 queues:
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 10 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 0 1 2 3 4 5
16: 6 7 8 9 0 1 2 3
...Increasing the queue count to 48 resets the flowhash to distribute to 16 queues, as it did before this patch:
$ sudo ethtool -L eth1 combined 48
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
...Due to the other bugfix in this series, the flowhash can be set to use queues 0-5:
$ sudo ethtool -X eth1 equal 5
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 0 1 2
8: 3 4 0 1 2 3 4 0
16: 1 2 3 4 0 1 2 3
...Due to this bugfix, the flowhash can be reset to default and use 16 queues:
$ sudo ethtool -X eth1 default
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
...--- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10 -9
@@ -2542,6 +2542,14 @@ static int ixgbe_get_rss_hash_opts(struct ixgbe_adapter *adapter,return 0 ; } +static int ixgbe_rss_indir_tbl_max (struct ixgbe_adapter *adapter) +{ +if (adapter->hw.mac.type < ixgbe_mac_X550) +return 16 ; +else +return 64 ; +} +static int ixgbe_get_rxnfc (struct net_device *dev,struct ethtool_rxnfc *cmd,u32 *rule_locs) {
@@ -2550,7 +2558,8 @@ static int ixgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,switch (cmd->cmd) {case ETHTOOL_GRXRINGS : - cmd->data = adapter->num_rx_queues; + cmd->data =min_t (int, adapter->num_rx_queues, +ixgbe_rss_indir_tbl_max (adapter)); ret =0 ;break ;case ETHTOOL_GRXCLSRLCNT :
@@ -2952,14 +2961,6 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; } -static int ixgbe_rss_indir_tbl_max (struct ixgbe_adapter *adapter) -{ -if (adapter->hw.mac.type < ixgbe_mac_X550) -return 16 ; -else -return 64 ; -} -static u32 ixgbe_get_rxfh_key_size (struct net_device *netdev) {return IXGBE_RSS_KEY_SIZE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 110/282 bpf: Dont EFAULT for getsockopt with optval=NULL
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 00e74ae0863827d944e36e56a4ce1e77e50edb91 ]
Some socket options do getsockopt with optval=NULL to estimate the size of the final buffer (which is returned via optlen). This breaks BPF getsockopt assumptions about permitted optval buffer size. Let's enforce these assumptions only when non-NULL optval is provided.
--- kernel/bpf/cgroup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/cgroup.c +6 -3
@@ -1131,7 +1131,7 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, goto out; } -if (ctx.optlen > max_optlen || ctx.optlen <0 ) { +if (optval && (ctx.optlen > max_optlen || ctx.optlen <0 )) { ret = -EFAULT ; goto out; }
@@ -1145,8 +1145,11 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, }if (ctx.optlen !=0 ) { -if (copy_to_user (optval, ctx.optval, ctx.optlen) || -put_user (ctx.optlen, optlen)) { +if (optval &©_to_user (optval, ctx.optval, ctx.optlen)) { + ret = -EFAULT ; + goto out; + } +if (put_user (ctx.optlen, optlen)) { ret = -EFAULT ; goto out; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 101/282 bpf, sockmap: Revert buggy deadlock fix in the sockhash and sockmap
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 8c5c2a4898e3d6bad86e29d471e023c8a19ba799 ]
syzbot reported a splat and bisected it to recent commit ed17aa92dc56 ("bpf,
sockmap: fix deadlocks in the sockhash and sockmap"):
[...]
WARNING: CPU: 1 PID: 9280 at kernel/softirq.c:376 __local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376 Modules linked in: CPU: 1 PID: 9280 Comm: syz-executor.1 Not tainted 6.2.0-syzkaller-13249-gd319f344561d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 RIP: 0010:__local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376 [...] Call Trace: <TASK> spin_unlock_bh include/linux/spinlock.h:395 [inline] sock_map_del_link+0x2ea/0x510 net/core/sock_map.c:165 sock_map_unref+0xb0/0x1d0 net/core/sock_map.c:184 sock_hash_delete_elem+0x1ec/0x2a0 net/core/sock_map.c:945 map_delete_elem kernel/bpf/syscall.c:1536 [inline] __sys_bpf+0x2edc/0x53e0 kernel/bpf/syscall.c:5053 __do_sys_bpf kernel/bpf/syscall.c:5166 [inline] __se_sys_bpf kernel/bpf/syscall.c:5164 [inline] __x64_sys_bpf+0x79/0xc0 kernel/bpf/syscall.c:5164 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe8f7c8c169 </TASK> [...]
Revert for now until we have a proper solution.
--- net/core/sock_map.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/core/sock_map.c +4 -6
@@ -322,9 +322,8 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test, {struct sock *sk;int err =0 ; -unsigned long flags; -raw_spin_lock_irqsave (&stab->lock, flags); +raw_spin_lock_bh (&stab->lock); sk = *psk;if (!sk_test || sk_test == sk) sk =xchg (psk,NULL );
@@ -334,7 +333,7 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,else err = -EINVAL ; -raw_spin_unlock_irqrestore (&stab->lock, flags); +raw_spin_unlock_bh (&stab->lock);return err; }
@@ -656,12 +655,11 @@ static int sock_hash_delete_elem(struct bpf_map *map, void *key)struct bpf_htab_bucket *bucket;struct bpf_htab_elem *elem;int ret = -ENOENT ; -unsigned long flags; hash =sock_hash_bucket_hash (key, key_size); bucket =sock_hash_select_bucket (htab, hash); -raw_spin_lock_irqsave (&bucket->lock, flags); +raw_spin_lock_bh (&bucket->lock); elem =sock_hash_lookup_elem_raw (&bucket->head, hash, key, key_size);if (elem) {hlist_del_rcu (&elem->node);
@@ -669,7 +667,7 @@ static int sock_hash_delete_elem(struct bpf_map *map, void *key)sock_hash_free_elem (htab, elem); ret =0 ; } -raw_spin_unlock_irqrestore (&bucket->lock, flags); +raw_spin_unlock_bh (&bucket->lock);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 133/282 vmci_host: fix a race condition in vmci_host_poll() causing GPF
In reply to Greg Kroah-HartmanFrom: Dae R. Jeong <[email protected]>
[ Upstream commit ae13381da5ff0e8e084c0323c3cc0a945e43e9c7 ]
During fuzzing, a general protection fault is observed in vmci_host_poll().
general protection fault, probably for non-canonical address 0xdffffc0000000019: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000c8-0x00000000000000cf] RIP: 0010:__lock_acquire+0xf3/0x5e00 kernel/locking/lockdep.c:4926 <- omitting registers -> Call Trace: <TASK> lock_acquire+0x1a4/0x4a0 kernel/locking/lockdep.c:5672 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:162 add_wait_queue+0x3d/0x260 kernel/sched/wait.c:22 poll_wait include/linux/poll.h:49 [inline] vmci_host_poll+0xf8/0x2b0 drivers/misc/vmw_vmci/vmci_host.c:174 vfs_poll include/linux/poll.h:88 [inline] do_pollfd fs/select.c:873 [inline] do_poll fs/select.c:921 [inline] do_sys_poll+0xc7c/0x1aa0 fs/select.c:1015 __do_sys_ppoll fs/select.c:1121 [inline] __se_sys_ppoll+0x2cc/0x330 fs/select.c:1101 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4e/0xa0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x46/0xb0
Example thread interleaving that causes the general protection fault is as follows:
CPU1 (vmci_host_poll) CPU2 (vmci_host_do_init_context)
----- -----
// Read uninitialized context
context = vmci_host_dev->context;
// Initialize context
vmci_host_dev->context = vmci_ctx_create();
vmci_host_dev->ct_type = VMCIOBJ_CONTEXT;if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) {
// Dereferencing the wrong pointer
poll_wait(..., &context->host_context);
}In this scenario, vmci_host_poll() reads vmci_host_dev->context first, and then reads vmci_host_dev->ct_type to check that vmci_host_dev->context is initialized. However, since these two reads are not atomically executed, there is a chance of a race condition as described above.
To fix this race condition, read vmci_host_dev->context after checking the value of vmci_host_dev->ct_type so that vmci_host_poll() always reads an initialized context.
--- drivers/misc/vmw_vmci/vmci_host.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_host.c +7 -1
@@ -160,10 +160,16 @@ static int vmci_host_close(struct inode *inode, struct file *filp)static __poll_t vmci_host_poll (struct file *filp,poll_table *wait) {struct vmci_host_dev *vmci_host_dev = filp->private_data; -struct vmci_ctx *context = vmci_host_dev->context; +struct vmci_ctx *context;__poll_t mask =0 ;if (vmci_host_dev->ct_type ==VMCIOBJ_CONTEXT ) { +/* +* Read context only if ct_type == VMCIOBJ_CONTEXT to make +* sure that context is initialized +*/ + context = vmci_host_dev->context; +/* Check for VMCI calls to this VM context. */ if (wait) poll_wait(filp, &context->host_context.wait_queue,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 142/282 mtd: spi-nor: cadence-quadspi: Dont initialize rx_dma_complete on failure
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit 48aae57f0f9f57797772bd462b4d64902b1b4ae1 ]
If driver fails to acquire DMA channel then don't initialize rx_dma_complete struct as it won't be used.
Stable-dep-of: 2087e85bb66e ("spi: cadence-quadspi: fix suspend-resume implementations")
--- drivers/mtd/spi-nor/cadence-quadspi.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/cadence-quadspi.c +1 -0
@@ -1179,6 +1179,7 @@ static void cqspi_request_mmap_dma(struct cqspi_st *cqspi)if (IS_ERR (cqspi->rx_chan)) {dev_err (&cqspi->pdev->dev,"No Rx DMA available\n" ); cqspi->rx_chan =NULL ; +return ; }init_completion (&cqspi->rx_dma_complete); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 143/282 mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit 935da5e5100f57d843cac4781b21f1c235059aa0 ]
dma_request_chan_by_mask() can throw EPROBE_DEFER if DMA provider is not yet probed. Currently driver just falls back to using PIO mode (which is less efficient) in this case. Instead return probe deferral error as is so that driver will be re probed once DMA provider is available.
Stable-dep-of: 2087e85bb66e ("spi: cadence-quadspi: fix suspend-resume implementations")
--- drivers/mtd/spi-nor/cadence-quadspi.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/mtd/spi-nor/cadence-quadspi.c +13 -5
@@ -1168,7 +1168,7 @@ static void cqspi_controller_init(struct cqspi_st *cqspi)cqspi_controller_enable (cqspi,1 ); } -static void cqspi_request_mmap_dma (struct cqspi_st *cqspi) +static int cqspi_request_mmap_dma (struct cqspi_st *cqspi) {dma_cap_mask_t mask;
@@ -1177,11 +1177,16 @@ static void cqspi_request_mmap_dma(struct cqspi_st *cqspi) cqspi->rx_chan =dma_request_chan_by_mask (&mask);if (IS_ERR (cqspi->rx_chan)) { -dev_err (&cqspi->pdev->dev,"No Rx DMA available\n" ); +int ret =PTR_ERR (cqspi->rx_chan); + +if (ret != -EPROBE_DEFER ) +dev_err (&cqspi->pdev->dev,"No Rx DMA available\n" ); cqspi->rx_chan =NULL ; -return ; +return ret; }init_completion (&cqspi->rx_dma_complete); + +return 0 ; }static int cqspi_setup_flash (struct cqspi_st *cqspi,struct device_node *np)
@@ -1265,8 +1270,11 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)dev_dbg (nor->dev,"using direct mode for %s\n" , mtd->name); -if (!cqspi->rx_chan) -cqspi_request_mmap_dma (cqspi); +if (!cqspi->rx_chan) { + ret =cqspi_request_mmap_dma (cqspi); +if (ret == -EPROBE_DEFER ) + goto err; + } } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 144/282 spi: cadence-quadspi: fix suspend-resume implementations
In reply to Greg Kroah-HartmanFrom: Dhruva Gole <[email protected]>
[ Upstream commit 2087e85bb66ee3652dafe732bb9b9b896229eafc ]
The cadence QSPI driver misbehaves after performing a full system suspend resume:
...
spi-nor spi0.0: resume() failed
...
This results in a flash connected via OSPI interface after system suspend- resume to be unusable.
fix these suspend and resume functions.
--- drivers/mtd/spi-nor/cadence-quadspi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/cadence-quadspi.c +16 -3
@@ -1441,17 +1441,30 @@ static int cqspi_remove(struct platform_device *pdev)static int cqspi_suspend (struct device *dev) {struct cqspi_st *cqspi =dev_get_drvdata (dev); +struct spi_master *master =dev_get_drvdata (dev); +int ret; + ret =spi_master_suspend (master);cqspi_controller_enable (cqspi,0 ); -return 0 ; + +clk_disable_unprepare (cqspi->clk); + +return ret; }static int cqspi_resume (struct device *dev) {struct cqspi_st *cqspi =dev_get_drvdata (dev); +struct spi_master *master =dev_get_drvdata (dev); -cqspi_controller_enable (cqspi,1 ); -return 0 ; +clk_prepare_enable (cqspi->clk); +cqspi_wait_idle (cqspi); +cqspi_controller_init (cqspi); + + cqspi->current_cs =-1 ; + cqspi->sclk =0 ; + +return spi_master_resume (master); }static const struct dev_pm_ops cqspi__dev_pm_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 145/282 uapi/linux/const.h: prefer ISO-friendly __typeof__
In reply to Greg Kroah-HartmanFrom: Kevin Brodsky <[email protected]>
[ Upstream commit 31088f6f7906253ef4577f6a9b84e2d42447dba0 ]
typeof is (still) a GNU extension, which means that it cannot be used when building ISO C (e.g. -std=c99). It should therefore be avoided in uapi headers in favour of the ISO-friendly __typeof__.
Unfortunately this issue could not be detected by CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in any uapi header.
This matters from a userspace perspective, not a kernel one. uapi headers and their contents are expected to be usable in a variety of situations, and in particular when building ISO C applications (with -std=c99 or similar).
This particular problem can be reproduced by trying to use the __ALIGN_KERNEL macro directly in application code, say:
#include <linux/const.h>
int align(int x, int a)
{
return __KERNEL_ALIGN(x, a);
}and trying to build that with -std=c99.
--- include/uapi/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/const.h +1 -1
@@ -28,7 +28,7 @@#define _BITUL (x) (_UL(1) << (x))#define _BITULL (x) (_ULL(1) << (x)) -#define __ALIGN_KERNEL (x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) +#define __ALIGN_KERNEL (x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)#define __ALIGN_KERNEL_MASK (x, mask) (((x) + (mask)) & ~(mask))#define __KERNEL_DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 146/282 sh: sq: Fix incorrect element size for allocating bitmap buffer
In reply to Greg Kroah-HartmanFrom: John Paul Adrian Glaubitz <[email protected]>
[ Upstream commit 80f746e2bd0e1da3fdb49a53570e54a1a225faac ]
The Store Queue code allocates a bitmap buffer with the size of multiple of sizeof(long) in sq_api_init(). While the buffer size is calculated correctly, the code uses the wrong element size to allocate the buffer which results in the allocated bitmap buffer being too small.
Fix this by allocating the buffer with kcalloc() with element size sizeof(long) instead of kzalloc() whose elements size defaults to sizeof(char).
--- arch/sh/kernel/cpu/sh4/sq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/cpu/sh4/sq.c +1 -1
@@ -380,7 +380,7 @@ static int __init sq_api_init(void)if (unlikely (!sq_cache))return ret; - sq_bitmap =kzalloc (size,GFP_KERNEL ); + sq_bitmap =kcalloc (size,sizeof (long ),GFP_KERNEL );if (unlikely (!sq_bitmap)) goto out;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 147/282 usb: chipidea: fix missing goto in `ci_hdrc_probe`
In reply to Greg Kroah-HartmanFrom: Yinhao Hu <[email protected]>
[ Upstream commit d6f712f53b79f5017cdcefafb7a5aea9ec52da5d ]
Quoted 1 line
From the comment of
ci_usb_phy_init, it returns an error code if
usb_phy_init has failed, and it should do some clean up, not just return directly.
Fix this by goto the error handling.
--- drivers/usb/chipidea/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/core.c +1 -1
@@ -1084,7 +1084,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ret =ci_usb_phy_init (ci);if (ret) {dev_err (dev,"unable to init phy: %d\n" , ret); -return ret; + goto ulpi_exit; } ci->hw_bank.phys = res->start;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 148/282 usb: mtu3: fix kernel panic at qmu transfer done irq handler
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit d28f4091ea7ec3510fd6a3c6d433234e7a2bef14 ]
When handle qmu transfer irq, it will unlock @mtu->lock before give back request, if another thread handle disconnect event at the same time, and try to disable ep, it may lock @mtu->lock and free qmu ring, then qmu irq hanlder may get a NULL gpd, avoid the KE by checking gpd's value before handling it.
e.g.
qmu done irq on cpu0 thread running on cpu1
qmu_done_tx()
handle gpd [0]
mtu3_requ_complete() mtu3_gadget_ep_disable()
unlock @mtu->lock
give back request lock @mtu->lock
mtu3_ep_disable()
mtu3_gpd_ring_free()
unlock @mtu->lock
lock @mtu->lock
get next gpd [1][1]: goto [0] to handle next gpd, and next gpd may be NULL.
--- drivers/usb/mtu3/mtu3_qmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/mtu3/mtu3_qmu.c +3 -2
@@ -210,6 +210,7 @@ static struct qmu_gpd *advance_enq_gpd(struct mtu3_gpd_ring *ring)return ring->enqueue; } +/* @dequeue may be NULL if ring is unallocated or freed */ static struct qmu_gpd *advance_deq_gpd (struct mtu3_gpd_ring *ring) {if (ring->dequeue < ring->end)
@@ -484,7 +485,7 @@ static void qmu_done_tx(struct mtu3 *mtu, u8 epnum)dev_dbg (mtu->dev,"%s EP%d, last=%p, current=%p, enq=%p\n" , __func__, epnum, gpd, gpd_current, ring->enqueue); -while (gpd != gpd_current && !GET_GPD_HWO (gpd)) { +while (gpd && gpd != gpd_current && !GET_GPD_HWO (gpd)) { mreq =next_request (mep);
@@ -523,7 +524,7 @@ static void qmu_done_rx(struct mtu3 *mtu, u8 epnum)dev_dbg (mtu->dev,"%s EP%d, last=%p, current=%p, enq=%p\n" , __func__, epnum, gpd, gpd_current, ring->enqueue); -while (gpd != gpd_current && !GET_GPD_HWO (gpd)) { +while (gpd && gpd != gpd_current && !GET_GPD_HWO (gpd)) { mreq =next_request (mep);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 149/282 firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e1d6ca042e62c2a69513235f8629eb6e62ca79c5 ]
The svc_create_memory_pool() function returns error pointers. It never returns NULL. Fix the check.
--- drivers/firmware/stratix10-svc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/stratix10-svc.c +2 -2
@@ -981,8 +981,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)return ret; genpool =svc_create_memory_pool (pdev, sh_memory); -if (!genpool) -return -ENOMEM ; +if (IS_ERR (genpool)) +return PTR_ERR (genpool);/* allocate service controller and supporting channel */ controller =devm_kzalloc (dev,sizeof (*controller),GFP_KERNEL );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 150/282 tty: serial: fsl_lpuart: adjust buffer length to the intended size
In reply to Greg Kroah-HartmanFrom: Shenwei Wang <[email protected]>
[ Upstream commit f73fd750552524b06b5d77ebfdd106ccc8fcac61 ]
Based on the fls function definition provided below, we should not subtract 1 to obtain the correct buffer length:
fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
--- drivers/tty/serial/fsl_lpuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/fsl_lpuart.c +1 -1
@@ -1172,7 +1172,7 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport)* 10ms at any baud rate. */ sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits /1000 ) *2 ; - sport->rx_dma_rng_buf_len = (1 << (fls (sport->rx_dma_rng_buf_len) -1 )); + sport->rx_dma_rng_buf_len = (1 <<fls (sport->rx_dma_rng_buf_len));if (sport->rx_dma_rng_buf_len <16 ) sport->rx_dma_rng_buf_len =16 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 151/282 serial: 8250: Add missing wakeup event reporting
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 0ba9e3a13c6adfa99e32b2576d20820ab10ad48a ]
An 8250 UART configured as a wake-up source would not have reported itself through sysfs as being the source of wake-up, correct that.
--- drivers/tty/serial/8250/8250_port.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_port.c +4 -0
@@ -19,6 +19,7 @@#include <linux/moduleparam.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/irq.h> #include <linux/console.h> #include <linux/sysrq.h> #include <linux/delay.h>
@@ -1840,6 +1841,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)unsigned char status;unsigned long flags;struct uart_8250_port *up =up_to_u8250p (port); +struct tty_port *tport = &port->state->port;bool skip_rx = false;if (iir &UART_IIR_NO_INT )
@@ -1863,6 +1865,8 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) skip_rx = true;if (status & (UART_LSR_DR |UART_LSR_BI ) && !skip_rx) { +if (irqd_is_wakeup_set (irq_get_irq_data (port->irq))) +pm_wakeup_event (tport->tty->dev,0 );if (!up->dma ||handle_rx_dma (up, iir)) status =serial8250_rx_chars (up, status); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 134/282 of: Fix modalias string generation
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit b19a4266c52de78496fe40f0b37580a3b762e67d ]
The helper generating an OF based modalias (of_device_get_modalias()) works fine, but due to the use of snprintf() internally it needs a buffer one byte longer than what should be needed just for the entire string (excluding the '\0'). Most users of this helper are sysfs hooks providing the modalias string to users. They all provide a PAGE_SIZE buffer which is way above the number of bytes required to fit the modalias string and hence do not suffer from this issue.
There is another user though, of_device_request_module(), which is only called by drivers/usb/common/ulpi.c. This request module function is faulty, but maybe because in most cases there is an alternative, ULPI driver users have not noticed it.
In this function, of_device_get_modalias() is called twice. The first time without buffer just to get the number of bytes required by the modalias string (excluding the null byte), and a second time, after buffer allocation, to fill the buffer. The allocation asks for an additional byte, in order to store the trailing '\0'. However, the buffer *length* provided to of_device_get_modalias() excludes this extra byte. The internal use of snprintf() with a length that is exactly the number of bytes to be written has the effect of using the last available byte to store a '\0', which then smashes the last character of the modalias string.
Provide the actual size of the buffer to of_device_get_modalias() to fix this issue.
Note: the "str[size - 1] = '\0';" line is not really needed as snprintf will anyway end the string with a null byte, but there is a possibility that this function might be called on a struct device_node without compatible, in this case snprintf() would not be executed. So we keep it just to avoid possible unbounded strings.
--- drivers/of/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/of/device.c +5 -2
@@ -246,12 +246,15 @@ int of_device_request_module(struct device *dev)if (size <0 )return size; - str =kmalloc (size +1 ,GFP_KERNEL ); +/* Reserve an additional byte for the trailing '\0' */ + size++; + + str =kmalloc (size,GFP_KERNEL );if (!str)return -ENOMEM ;of_device_get_modalias (dev, str, size); - str[size] ='\0' ; + str[size -1 ] ='\0' ; ret =request_module (str);kfree (str);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 152/282 staging: rtl8192e: Fix W_DISABLE# does not work after stop/start
In reply to Greg Kroah-HartmanFrom: Philipp Hortmann <[email protected]>
[ Upstream commit 3fac2397f562eb669ddc2f45867a253f3fc26184 ]
When loading the driver for rtl8192e, the W_DISABLE# switch is working as intended. But when the WLAN is turned off in software and then turned on again the W_DISABLE# does not work anymore. Reason for this is that in the function _rtl92e_dm_check_rf_ctrl_gpio() the bfirst_after_down is checked and returned when true. bfirst_after_down is set true when switching the WLAN off in software. But it is not set to false again when WLAN is turned on again.
Add bfirst_after_down = false in _rtl92e_sta_up to reset bit and fix above described bug.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -0
@@ -767,6 +767,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset)else netif_wake_queue (dev); + priv->bfirst_after_down = false;return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 153/282 spmi: Add a check for remove callback when removing a SPMI driver
In reply to Greg Kroah-HartmanFrom: Jishnu Prakash <[email protected]>
[ Upstream commit b56eef3e16d888883fefab47425036de80dd38fc ]
When removing a SPMI driver, there can be a crash due to NULL pointer dereference if it does not have a remove callback defined. This is one such call trace observed when removing the QCOM SPMI PMIC driver:
dump_backtrace.cfi_jt+0x0/0x8 dump_stack_lvl+0xd8/0x16c panic+0x188/0x498 __cfi_slowpath+0x0/0x214 __cfi_slowpath+0x1dc/0x214 spmi_drv_remove+0x16c/0x1e0 device_release_driver_internal+0x468/0x79c driver_detach+0x11c/0x1a0 bus_remove_driver+0xc4/0x124 driver_unregister+0x58/0x84 cleanup_module+0x1c/0xc24 [qcom_spmi_pmic] __do_sys_delete_module+0x3ec/0x53c __arm64_sys_delete_module+0x18/0x28 el0_svc_common+0xdc/0x294 el0_svc+0x38/0x9c el0_sync_handler+0x8c/0xf0 el0_sync+0x1b4/0x1c0
If a driver has all its resources allocated through devm_() APIs and does not need any other explicit cleanup, it would not require a remove callback to be defined. Hence, add a check for remove callback presence before calling it when removing a SPMI driver.
--- drivers/spmi/spmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spmi/spmi.c +2 -1
@@ -348,7 +348,8 @@ static int spmi_drv_remove(struct device *dev)const struct spmi_driver *sdrv =to_spmi_driver (dev->driver);pm_runtime_get_sync (dev); - sdrv->remove (to_spmi_device (dev)); +if (sdrv->remove) + sdrv->remove (to_spmi_device (dev));pm_runtime_put_noidle (dev);pm_runtime_disable (dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 154/282 macintosh/windfarm_smu_sat: Add missing of_node_put()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 631cf002826007ab7415258ee647dcaf8845ad5a ]
We call of_node_get() in wf_sat_probe() after sat is created, so we need the of_node_put() before *kfree(sat)*.
--- drivers/macintosh/windfarm_smu_sat.c | 1 + 1 file changed, 1 insertion(+)
drivers/macintosh/windfarm_smu_sat.c +1 -0
@@ -171,6 +171,7 @@ static void wf_sat_release(struct kref *ref)if (sat->nr >=0 ) sats[sat->nr] =NULL ; +of_node_put (sat->node);kfree (sat); }
Signature · 1 line
2.39.2