4.19.218-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 156/323 mwifiex: Send DELBA requests according to spec
In reply to Greg Kroah-HartmanFrom: Jonas Dreßler <[email protected]>
[ Upstream commit cc8a8bc37466f79b24d972555237f3d591150602 ]
While looking at on-air packets using Wireshark, I noticed we're never setting the initiator bit when sending DELBA requests to the AP: While we set the bit on our del_ba_param_set bitmask, we forget to actually copy that bitmask over to the command struct, which means we never actually set the initiator bit.
Fix that and copy the bitmask over to the host_cmd_ds_11n_delba command struct.
--- drivers/net/wireless/marvell/mwifiex/11n.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/11n.c +3 -2
@@ -664,14 +664,15 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,uint16_t del_ba_param_set;memset (&delba,0 ,sizeof (delba)); - delba.del_ba_param_set =cpu_to_le16 (tid <<DELBA_TID_POS ); - del_ba_param_set =le16_to_cpu (delba.del_ba_param_set); + del_ba_param_set = tid <<DELBA_TID_POS ; +if (initiator) del_ba_param_set |=IEEE80211_DELBA_PARAM_INITIATOR_MASK ;else del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK ; + delba.del_ba_param_set =cpu_to_le16 (del_ba_param_set);memcpy (&delba.peer_mac_addr, peer_mac,ETH_ALEN );/* We don't wait for the response of this command */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 157/323 phy: micrel: ksz8041nl: do not use power down mode
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 2641b62d2fab52648e34cdc6994b2eacde2d27c1 ]
Some Micrel KSZ8041NL PHY chips exhibit continuous RX errors after using the power down mode bit (0.11). If the PHY is taken out of power down mode in a certain temperature range, the PHY enters a weird state which leads to continuously reporting RX errors. In that state, the MAC is not able to receive or send any Ethernet frames and the activity LED is constantly blinking. Since Linux is using the suspend callback when the interface is taken down, ending up in that state can easily happen during a normal startup.
Micrel confirmed the issue in errata DS80000700A [*], caused by abnormal clock recovery when using power down mode. Even the latest revision (A4, Revision ID 0x1513) seems to suffer that problem, and according to the errata is not going to be fixed.
Remove the suspend/resume callback to avoid using the power down mode completely.
[*] https://ww1.microchip.com/downloads/en/DeviceDoc/80000700A.pdf
--- drivers/net/phy/micrel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +3 -2
@@ -880,8 +880,9 @@ static struct phy_driver ksphy_driver[] = { .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, +/* No suspend/resume callbacks because of errata DS80000700A, +* receiver error following software power down. +*/ }, { .phy_id = PHY_ID_KSZ8041RNLI, .phy_id_mask = MICREL_PHY_ID_MASK,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 158/323 nvme-rdma: fix error code in nvme_rdma_setup_ctrl
In reply to Greg Kroah-HartmanFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 09748122009aed7bfaa7acc33c10c083a4758322 ]
In case that icdoff is not zero or mandatory keyed sgls are not supported by the NVMe/RDMA target, we'll go to error flow but we'll return 0 to the caller. Fix it by returning an appropriate error code.
--- drivers/nvme/host/rdma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/rdma.c +2 -0
@@ -967,11 +967,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)return ret;if (ctrl->ctrl.icdoff) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"icdoff is not supported!\n" ); goto destroy_admin; }if (!(ctrl->ctrl.sgls & (1 <<2 ))) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"Mandatory keyed sgls are not supported!\n" ); goto destroy_admin;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 159/323 PM: hibernate: fix sparse warnings
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
[ Upstream commit 01de5fcd8b1ac0ca28d2bb0921226a54fdd62684 ]
When building the kernel with sparse enabled 'C=1' the following warnings shows up:
kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types)kernel/power/swap.c:390:29: expected int retkernel/power/swap.c:390:29: got restricted blk_status_t
This is due to function hib_wait_io() returns a 'blk_status_t' which is a bitwise u8. Commit 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") seemed to have mixed up the return type. However, the 4e4cbee93d56 ("block: switch bios to blk_status_t") actually broke the behaviour by returning the wrong type.
Rework so function hib_wait_io() returns a 'int' instead of 'blk_status_t' and make sure to call function blk_status_to_errno(hb->error)' when returning from function hib_wait_io() a int gets returned.
--- kernel/power/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/swap.c +1 -1
@@ -294,7 +294,7 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,return error; } -static blk_status_t hib_wait_io (struct hib_bio_batch *hb) +static int hib_wait_io (struct hib_bio_batch *hb) {wait_event (hb->wait,atomic_read (&hb->count) ==0 );return blk_status_to_errno (hb->error);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 160/323 clocksource/drivers/timer-ti-dm: Select TIMER_OF
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit eda9a4f7af6ee47e9e131f20e4f8a41a97379293 ]
When building OMAP_DM_TIMER without TIMER_OF, there are orphan sections due to the use of TIMER_OF_DELCARE() without CONFIG_TIMER_OF. Select CONFIG_TIMER_OF when enaling OMAP_DM_TIMER:
arm-linux-gnueabi-ld: warning: orphan section __timer_of_table' from drivers/clocksource/timer-ti-dm-systimer.o' being placed in section `__timer_of_table'
--- drivers/clocksource/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clocksource/Kconfig +1 -0
@@ -23,6 +23,7 @@ config I8253_LOCK config OMAP_DM_TIMER bool + select TIMER_OF config CLKBLD_I8253 def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 161/323 drm/msm: Fix potential NULL dereference in DPU SSPP
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit 8bf71a5719b6cc5b6ba358096081e5d50ea23ab6 ]
Move initialization of sblk in _sspp_subblk_offset() after NULL check to avoid potential NULL pointer dereference.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +5 -3
@@ -146,11 +146,13 @@ static inline int _sspp_subblk_offset(struct dpu_hw_pipe *ctx, u32 *idx) {int rc =0 ; -const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk; +const struct dpu_sspp_sub_blks *sblk; -if (!ctx) +if (!ctx || !ctx->cap || !ctx->cap->sblk)return -EINVAL ; + sblk = ctx->cap->sblk; +switch (s_id) {case DPU_SSPP_SRC : *idx = sblk->src_blk.base;
@@ -413,7 +415,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx, (void )pe;if (_sspp_subblk_offset (ctx,DPU_SSPP_SCALER_QSEED3 , &idx) || !sspp - || !scaler3_cfg || !ctx || !ctx->cap || !ctx->cap->sblk) + || !scaler3_cfg)return ; dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 162/323 smackfs: use netlbl_cfg_cipsov4_del() for deleting cipso_v4_doi
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 0934ad42bb2c5df90a1b9de690f93de735b622fe ]
syzbot is reporting UAF at cipso_v4_doi_search() [1], for smk_cipso_doi() is calling kfree() without removing from the cipso_v4_doi_list list after netlbl_cfg_cipsov4_map_add() returned an error. We need to use netlbl_cfg_cipsov4_del() in order to remove from the list and wait for RCU grace period before kfree().
--- security/smack/smackfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smackfs.c +1 -1
@@ -740,7 +740,7 @@ static void smk_cipso_doi(void)if (rc !=0 ) {printk (KERN_WARNING "%s:%d map add rc = %d\n" , __func__, __LINE__, rc); -kfree (doip); +netlbl_cfg_cipsov4_del (doip->doi, &nai);return ; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 163/323 s390/gmap: dont unconditionally call pte_unmap_unlock() in __gmap_zap()
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit b159f94c86b43cf7e73e654bc527255b1f4eafc4 ]
... otherwise we will try unlocking a spinlock that was never locked via a garbage pointer.
At the time we reach this code path, we usually successfully looked up a PGSTE already; however, evil user space could have manipulated the VMA layout in the meantime and triggered removal of the page table.
--- arch/s390/mm/gmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/s390/mm/gmap.c +3 -2
@@ -684,9 +684,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr) vmaddr |= gaddr & ~PMD_MASK ;/* Get pointer to the page table entry */ ptep =get_locked_pte (gmap->mm, vmaddr, &ptl); -if (likely (ptep)) +if (likely (ptep)) {ptep_zap_unused (gmap->mm, vmaddr, ptep,0 ); -pte_unmap_unlock (ptep, ptl); +pte_unmap_unlock (ptep, ptl); + } } }EXPORT_SYMBOL_GPL (__gmap_zap);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 164/323 irq: mips: avoid nested irq_enter()
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit c65b52d02f6c1a06ddb20cba175ad49eccd6410d ]
As bcm6345_l1_irq_handle() is a chained irqchip handler, it will be invoked within the context of the root irqchip handler, which must have entered IRQ context already.
When bcm6345_l1_irq_handle() calls arch/mips's do_IRQ() , this will nest another call to irq_enter(), and the resulting nested increment to rcu_data.dynticks_nmi_nesting will cause rcu_is_cpu_rrupt_from_idle() to fail to identify wakeups from idle, resulting in failure to preempt, and RCU stalls.
Chained irqchip handlers must invoke IRQ handlers by way of thee core irqchip code, i.e. generic_handle_irq() or generic_handle_domain_irq() and should not call do_IRQ(), which is intended only for root irqchip handlers.
Fix bcm6345_l1_irq_handle() by calling generic_handle_irq() directly.
--- drivers/irqchip/irq-bcm6345-l1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm6345-l1.c +1 -1
@@ -143,7 +143,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)for_each_set_bit (hwirq, &pending,IRQS_PER_WORD ) { irq =irq_linear_revmap (intc->domain, base + hwirq);if (irq) -do_IRQ (irq); +generic_handle_irq (irq);else spurious_interrupt (); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 165/323 tcp: dont free a FIN sk_buff in tcp_remove_empty_skb()
In reply to Greg Kroah-HartmanFrom: Jon Maxwell <[email protected]>
[ Upstream commit cf12e6f9124629b18a6182deefc0315f0a73a199 ]
v1: Implement a more general statement as recommended by Eric Dumazet. The sequence number will be advanced, so this check will fix the FIN case and other cases.
A customer reported sockets stuck in the CLOSING state. A Vmcore revealed that the write_queue was not empty as determined by tcp_write_queue_empty() but the sk_buff containing the FIN flag had been freed and the socket was zombied in that state. Corresponding pcaps show no FIN from the Linux kernel on the wire.
Some instrumentation was added to the kernel and it was found that there is a timing window where tcp_sendmsg() can run after tcp_send_fin().
tcp_sendmsg() will hit an error, for example:
1269 ▹ if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))↩
1270 ▹ ▹ goto do_error;↩
tcp_remove_empty_skb() will then free the FIN sk_buff as "skb->len == 0". The TCP socket is now wedged in the FIN-WAIT-1 state because the FIN is never sent.
If the other side sends a FIN packet the socket will transition to CLOSING and remain that way until the system is rebooted.
Fix this by checking for the FIN flag in the sk_buff and don't free it if that is the case. Testing confirmed that fixed the issue.
--- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +1 -1
@@ -952,7 +952,7 @@ static int tcp_send_mss(struct sock *sk, int *size_goal, int flags)*/ static void tcp_remove_empty_skb (struct sock *sk,struct sk_buff *skb) { -if (skb && !skb->len) { +if (skb &&TCP_SKB_CB (skb)->seq ==TCP_SKB_CB (skb)->end_seq) {tcp_unlink_write_queue (skb, sk);if (tcp_write_queue_empty (sk))tcp_chrono_stop (sk,TCP_CHRONO_BUSY );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 166/323 samples/kretprobes: Fix return value if register_kretprobe() failed
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit f76fbbbb5061fe14824ba5807c44bd7400a6b4e1 ]
Use the actual return value instead of always -1 if register_kretprobe() failed.
E.g. without this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted
With this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module
--- samples/kprobes/kretprobe_example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/kprobes/kretprobe_example.c +1 -1
@@ -83,7 +83,7 @@ static int __init kretprobe_init(void) ret =register_kretprobe (&my_kretprobe);if (ret <0 ) {pr_err ("register_kretprobe failed, returned %d\n" , ret); -return -1 ; +return ret; }pr_info ("Planted return probe at %s: %p\n" , my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 167/323 KVM: s390: Fix handle_sske page fault handling
In reply to Greg Kroah-HartmanFrom: Janis Schoetterl-Glausch <[email protected]>
[ Upstream commit 85f517b29418158d3e6e90c3f0fc01b306d2f1a1 ]
If handle_sske cannot set the storage key, because there is no page table entry or no present large page entry, it calls fixup_user_fault.
However, currently, if the call succeeds, handle_sske returns -EAGAIN, without having set the storage key.
Instead, retry by continue'ing the loop without incrementing the address.
The same issue in handle_pfmf was fixed bya11bdb1a6b78 ("KVM: s390: Fix pfmf and conditional skey emulation").
--- arch/s390/kvm/priv.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kvm/priv.c +2 -0
@@ -397,6 +397,8 @@ static int handle_sske(struct kvm_vcpu *vcpu)up_read (¤t->mm->mmap_sem);if (rc == -EFAULT )return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING ); +if (rc == -EAGAIN ) +continue ;if (rc <0 )return rc; start +=PAGE_SIZE ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 168/323 libertas_tf: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit d549107305b4634c81223a853701c06bcf657bc3 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88810a2ddc00 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295009893 (age 757.220s) hex dump (first 32 bytes):
00 50 05 18 81 88 ff ff 00 00 00 00 00 00 00 00 .P..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02a1530>] if_usb_probe+0x60/0x37c [libertas_tf_usb]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas_tf/if_usb.c +2 -0
@@ -234,6 +234,7 @@ static int if_usb_probe(struct usb_interface *intf, dealloc:if_usb_free (cardp); +kfree (cardp); error:lbtf_deb_leave (LBTF_DEB_MAIN );return -ENOMEM ;
@@ -258,6 +259,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 169/323 libertas: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 9692151e2fe7a326bafe99836fd1f20a2cc3a049 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88812c7d7400 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295003332 (age 822.830s) hex dump (first 32 bytes):
00 68 1e 04 81 88 ff ff 01 00 00 00 00 00 00 00 .h..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02c9873>] if_usb_probe+0x63/0x446 [usb8xxx]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas/if_usb.c +2 -0
@@ -288,6 +288,7 @@ err_add_card:if_usb_reset_device (cardp); dealloc:if_usb_free (cardp); +kfree (cardp); error:return r;
@@ -312,6 +313,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 170/323 wcn36xx: add proper DMA memory barriers in rx path
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
[ Upstream commit 9bfe38e064af5decba2ffce66a2958ab8b10eaa4 ]
This is essentially exactly following the dma_wmb()/dma_rmb() usage instructions in Documentation/memory-barriers.txt.
The theoretical races here are:
1. DXE (the DMA Transfer Engine in the Wi-Fi subsystem) seeing the dxe->ctrl & WCN36xx_DXE_CTRL_VLD write before the dxe->dst_addr_l write, thus performing DMA into the wrong address.
2. CPU reading dxe->dst_addr_l before DXE unsets dxe->ctrl & WCN36xx_DXE_CTRL_VLD. This should generally be harmless since DXE doesn't write dxe->dst_addr_l (no risk of freeing the wrong skb).
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +11 -1
@@ -565,6 +565,10 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn, dxe = ctl->desc;while (!(READ_ONCE (dxe->ctrl) & WCN36xx_DXE_CTRL_VLD)) { +/* do not read until we own DMA descriptor */ +dma_rmb (); + +/* read/modify DMA descriptor */ skb = ctl->skb; dma_addr = dxe->dst_addr_l; ret =wcn36xx_dxe_fill_skb (wcn->dev, ctl,GFP_ATOMIC );
@@ -575,9 +579,15 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,dma_unmap_single (wcn->dev, dma_addr,WCN36XX_PKT_SIZE ,DMA_FROM_DEVICE );wcn36xx_rx_skb (wcn, skb); - }/* else keep old skb not submitted and use it for rx DMA */ + } +/* else keep old skb not submitted and reuse it for rx DMA +* (dropping the packet that it contained) +*/ +/* flush descriptor changes before re-marking as valid */ +dma_wmb (); dxe->ctrl = ctrl; + ctl = ctl->next; dxe = ctl->desc; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 171/323 net: amd-xgbe: Toggle PLL settings during rate change
In reply to Greg Kroah-HartmanFrom: Shyam Sundar S K <[email protected]>
[ Upstream commit daf182d360e509a494db18666799f4e85d83dda0 ]
For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete.
Without the PLL control setting, the link up takes longer time in a fixed phy configuration.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 8 ++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +8 -0
@@ -1331,6 +1331,10 @@#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056#endif +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 +#endif +#ifndef MDIO_CTRL1_SPEED1G #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)#endif
@@ -1389,6 +1393,10 @@#define XGBE_PMA_RX_RST_0_RESET_ON 0x10#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 +#define XGBE_PMA_PLL_CTRL_MASK BIT(15) +#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15) +#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000 +/* Bit setting and getting macros * The get macro will extract the current bit field value from within * the variable
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +19 -1
@@ -1966,12 +1966,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) } } +static void xgbe_phy_pll_ctrl (struct xgbe_prv_data *pdata,bool enable) +{ +XMDIO_WRITE_BITS (pdata,MDIO_MMD_PMAPMD ,MDIO_VEND2_PMA_MISC_CTRL0 , +XGBE_PMA_PLL_CTRL_MASK , + enable ?XGBE_PMA_PLL_CTRL_ENABLE + :XGBE_PMA_PLL_CTRL_DISABLE ); + +/* Wait for command to complete */ +usleep_range (100 ,200 ); +} +static void xgbe_phy_perform_ratechange (struct xgbe_prv_data *pdata,unsigned int cmd,unsigned int sub_cmd) {unsigned int s0 =0 ;unsigned int wait; +/* Disable PLL re-initialization during FW command processing */ +xgbe_phy_pll_ctrl (pdata, false); +/* Log if a previous command did not complete */ if (XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) { netif_dbg(pdata, link, pdata->netdev,
@@ -1992,7 +2006,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, wait =XGBE_RATECHANGE_COUNT ;while (wait--) {if (!XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) -return ; + goto reenable_pll;usleep_range (1000 ,2000 ); }
@@ -2002,6 +2016,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,/* Reset on error */ xgbe_phy_rx_reset (pdata); + +reenable_pll: +/* Enable PLL re-initialization */ +xgbe_phy_pll_ctrl (pdata, true); }static void xgbe_phy_rrc (struct xgbe_prv_data *pdata)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 172/323 net: phylink: avoid mvneta warning when setting pause parameters
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit fd8d9731bcdfb22d28e45bce789bcb211c868c78 ]
mvneta does not support asymetric pause modes, and it flags this by the lack of AsymPause in the supported field. When setting pause modes, we check that pause->rx_pause == pause->tx_pause, but only when pause autoneg is enabled. When pause autoneg is disabled, we still allow pause->rx_pause != pause->tx_pause, which is incorrect when the MAC does not support asymetric pause, and causes mvneta to issue a warning.
Fix this by removing the test for pause->autoneg, so we always check that pause->rx_pause == pause->tx_pause for network devices that do not support AsymPause.
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -1259,7 +1259,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,return -EOPNOTSUPP ;if (!phylink_test (pl->supported, Asym_Pause) && - !pause->autoneg && pause->rx_pause != pause->tx_pause) + pause->rx_pause != pause->tx_pause)return -EINVAL ; config->pause &= ~(MLO_PAUSE_AN |MLO_PAUSE_TXRX_MASK );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 173/323 crypto: pcrypt - Delay write to padata->info
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 68b6dea802cea0dbdd8bd7ccc60716b5a32a5d8a ]
These three events can race when pcrypt is used multiple times in a template ("pcrypt(pcrypt(...))"):
1. [taskA] The caller makes the crypto request via crypto_aead_encrypt() 2. [kworkerB] padata serializes the inner pcrypt request 3. [kworkerC] padata serializes the outer pcrypt request
3 might finish before the call to crypto_aead_encrypt() returns in 1, resulting in two possible issues.
First, a use-after-free of the crypto request's memory when, for example, taskA writes to the outer pcrypt request's padata->info in pcrypt_aead_enc() after kworkerC completes the request.
Second, the outer pcrypt request overwrites the inner pcrypt request's return code with -EINPROGRESS, making a successful request appear to fail. For instance, kworkerB writes the outer pcrypt request's padata->info in pcrypt_aead_done() and then taskA overwrites it in pcrypt_aead_enc().
Avoid both situations by delaying the write of padata->info until after the inner crypto request's return code is checked. This prevents the use-after-free by not touching the crypto request's memory after the next-inner crypto request is made, and stops padata->info from being overwritten.
--- crypto/pcrypt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
crypto/pcrypt.c +8 -4
@@ -138,12 +138,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_encrypt (req); + ret =crypto_aead_encrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
@@ -180,12 +182,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_decrypt (req); + ret =crypto_aead_decrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 174/323 selftests/bpf: Fix fclose/pclose mismatch in test_progs
In reply to Greg Kroah-HartmanFrom: Andrea Righi <[email protected]>
[ Upstream commit f48ad69097fe79d1de13c4d8fef556d4c11c5e68 ]
Make sure to use pclose() to properly close the pipe opened by popen().
--- tools/testing/selftests/bpf/test_progs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_progs.c +2 -2
@@ -1112,7 +1112,7 @@ static int extract_build_id(char *build_id, size_t size)if (getline (&line, &len, fp) ==-1 ) goto err; -fclose (fp); +pclose (fp);if (len > size) len = size;
@@ -1121,7 +1121,7 @@ static int extract_build_id(char *build_id, size_t size)free (line);return 0 ; err: -fclose (fp); +pclose (fp);return -1 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 175/323 ibmvnic: Process crqs after enabling interrupts
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 6e20d00158f31f7631d68b86996b7e951c4451c8 ]
Soon after registering a CRQ it is possible that we get a fail over or maybe a CRQ_INIT from the VIOS while interrupts were disabled.
Look for any such CRQs after enabling interrupts.
Otherwise we can intermittently fail to bring up ibmvnic adapters during boot, specially in kexec/kdump kernels.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +3 -0
@@ -4603,6 +4603,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) crq->cur =0 ;spin_lock_init (&crq->lock); +/* process any CRQs that were queued before we enabled interrupts */ +tasklet_schedule (&adapter->tasklet); +return retrc; req_irq_failed:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 176/323 RDMA/rxe: Fix wrong port_cap_flags
In reply to Greg Kroah-HartmanFrom: Junji Wei <[email protected]>
[ Upstream commit dcd3f985b20ffcc375f82ca0ca9f241c7025eb5e ]
The port->attr.port_cap_flags should be set to enum ib_port_capability_mask_bits in ib_mad.h, not RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP.
--- drivers/infiniband/sw/rxe/rxe_param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_param.h +1 -1
@@ -143,7 +143,7 @@ enum rxe_port_param {RXE_PORT_MAX_MTU =IB_MTU_4096 ,RXE_PORT_ACTIVE_MTU =IB_MTU_256 ,RXE_PORT_GID_TBL_LEN =1024 , -RXE_PORT_PORT_CAP_FLAGS =RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP , +RXE_PORT_PORT_CAP_FLAGS =IB_PORT_CM_SUP ,RXE_PORT_MAX_MSG_SZ =0x800000 ,RXE_PORT_BAD_PKEY_CNTR =0 , RXE_PORT_QKEY_VIOL_CNTR = 0,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 177/323 ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc()
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 2aa717473ce96c93ae43a5dc8c23cedc8ce7dd9f ]
The s3c24xx_init_intc() returns an error pointer upon failure, not NULL. let's add an error pointer check in s3c24xx_handle_irq.
s3c_intc[0] is not NULL or ERR, we can simplify the code.
--- drivers/irqchip/irq-s3c24xx.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/irqchip/irq-s3c24xx.c +18 -4
@@ -368,11 +368,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) { do { - if (likely(s3c_intc[0])) - if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) - continue; + /* + * For platform based machines, neither ERR nor NULL can happen here. + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds: + * + * s3c_intc[0] = s3c24xx_init_intc() + * + * If this fails, the next calls to s3c24xx_init_intc() won't be executed. + * + * For DT machine, s3c_init_intc_of() could set the IRQ handler without + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no + * such code path, so again the s3c_intc[0] will have a valid pointer if + * set_handle_irq() is called. + * + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something. + */ + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) + continue; - if (s3c_intc[2]) + if (!IS_ERR_OR_NULL(s3c_intc[2])) if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) continue;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 178/323 arm64: dts: rockchip: Fix GPU register width for RK3328
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit 932b4610f55b49f3a158b0db451137bab7ed0e1f ]
As can be seen in RK3328's TRM the register range for the GPU is 0xff300000 to 0xff330000.
It would (and does in vendor kernel) overlap with the registers of the HEVC encoder (node/driver do not exist yet in upstream kernel). See already existing h265e_mmu node.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +1 -1
@@ -536,7 +536,7 @@ gpu: gpu@ff300000 { compatible = "rockchip,rk3328-mali", "arm,mali-450"; - reg = <0x0 0xff300000 0x0 0x40000>; + reg = <0x0 0xff300000 0x0 0x30000>; interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 179/323 RDMA/bnxt_re: Fix query SRQ failure
In reply to Greg Kroah-HartmanFrom: Selvin Xavier <[email protected]>
[ Upstream commit 598d16fa1bf93431ad35bbab3ed1affe4fb7b562 ]
Fill the missing parameters for the FW command while querying SRQ.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -1
@@ -637,12 +637,13 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,int rc =0 ;RCFW_CMD_PREP (req,QUERY_SRQ , cmd_flags); - req.srq_cid =cpu_to_le32 (srq->id);/* Configure the request */ sbuf =bnxt_qplib_rcfw_alloc_sbuf (rcfw,sizeof (*sb));if (!sbuf)return -ENOMEM ; + req.resp_size =sizeof (*sb) /BNXT_QPLIB_CMDQE_UNITS ; + req.srq_cid =cpu_to_le32 (srq->id); sb = sbuf->sb; rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, (void *)sbuf,0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 180/323 ARM: dts: at91: tse850: the emac<->phy interface is rmii
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit dcdbc335a91a26e022a803e1a6b837266989c032 ]
This went unnoticed until commit 7897b071ac3b ("net: macb: convert to phylink") which tickled the problem. The sama5d3 emac has never been capable of rgmii, and it all just happened to work before that commit.
--- arch/arm/boot/dts/at91-tse850-3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-tse850-3.dts +1 -1
@@ -269,7 +269,7 @@ &macb1 { status = "okay"; - phy-mode = "rgmii"; + phy-mode = "rmii"; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 181/323 scsi: dc395: Fix error case unwinding
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit cbd9a3347c757383f3d2b50cf7cfd03eb479c481 ]
dc395x_init_one()->adapter_init() might fail. In this case, the acb is already cleaned up by adapter_init(), no need to do that in adapter_uninit(acb) again.
[ 1.252251] dc395x: adapter init failed [ 1.254900] RIP: 0010:adapter_uninit+0x94/0x170 [dc395x] [ 1.260307] Call Trace: [ 1.260442] dc395x_init_one.cold+0x72a/0x9bb [dc395x]
--- drivers/scsi/dc395x.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/dc395x.c +1 -0
@@ -4805,6 +4805,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)/* initialise the adapter and everything we need */ if (adapter_init (acb, io_port_base, io_port_len, irq)) {dprintkl (KERN_INFO ,"adapter init failed\n" ); + acb =NULL ; goto fail; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 182/323 MIPS: loongson64: make CPU_LOONGSON64 depends on MIPS_FP_SUPPORT
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 7f3b3c2bfa9c93ab9b5595543496f570983dc330 ]
mach/loongson64 fails to build when the FPU support is disabled:
arch/mips/loongson64/cop2-ex.c:45:15: error: implicit declaration of function ‘__is_fpu_owner’; did you mean ‘is_fpu_owner’? [-Werror=implicit-function-declaration] arch/mips/loongson64/cop2-ex.c:98:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:99:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:131:43: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:137:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:203:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:219:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:283:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:301:38: error: ‘struct thread_struct’ has no member named ‘fpu’
--- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -1375,6 +1375,7 @@ config CPU_LOONGSON3 select WEAK_REORDERING_BEYOND_LLSC select MIPS_PGD_C0_CONTEXT select MIPS_L1_CACHE_SHIFT_6 + select MIPS_FP_SUPPORT select GPIOLIB select SWIOTLB help
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 183/323 JFS: fix memleak in jfs_mount
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit c48a14dca2cb57527dde6b960adbe69953935f10 ]
In jfs_mount, when diMount(ipaimap2) fails, it goes to errout35. However, the following code does not free ipaimap2 allocated by diReadSpecial.
Fix this by refactoring the error handling code of jfs_mount. To be specific, modify the lable name and free ipaimap2 when the above error ocurrs.
--- fs/jfs/jfs_mount.c | 51 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 29 deletions(-)
fs/jfs/jfs_mount.c +22 -29
@@ -93,14 +93,14 @@ int jfs_mount(struct super_block *sb)* (initialize mount inode from the superblock) */ if ((rc =chkSuper (sb))) { - goto errout20; + goto out; } ipaimap =diReadSpecial (sb,AGGREGATE_I ,0 );if (ipaimap ==NULL ) {jfs_err ("jfs_mount: Failed to read AGGREGATE_I" ); rc = -EIO ; - goto errout20; + goto out; } sbi->ipaimap = ipaimap;
@@ -111,7 +111,7 @@ int jfs_mount(struct super_block *sb)*/ if ((rc =diMount (ipaimap))) {jfs_err ("jfs_mount: diMount(ipaimap) failed w/rc = %d" , rc); - goto errout21; + goto err_ipaimap; }/*
@@ -120,7 +120,7 @@ int jfs_mount(struct super_block *sb) ipbmap =diReadSpecial (sb,BMAP_I ,0 );if (ipbmap ==NULL ) { rc = -EIO ; - goto errout22; + goto err_umount_ipaimap; }jfs_info ("jfs_mount: ipbmap:0x%p" , ipbmap);
@@ -132,7 +132,7 @@ int jfs_mount(struct super_block *sb)*/ if ((rc =dbMount (ipbmap))) {jfs_err ("jfs_mount: dbMount failed w/rc = %d" , rc); - goto errout22; + goto err_ipbmap; }/*
@@ -151,7 +151,7 @@ int jfs_mount(struct super_block *sb)if (!ipaimap2) {jfs_err ("jfs_mount: Failed to read AGGREGATE_I" ); rc = -EIO ; - goto errout35; + goto err_umount_ipbmap; } sbi->ipaimap2 = ipaimap2;
@@ -163,7 +163,7 @@ int jfs_mount(struct super_block *sb)if ((rc =diMount (ipaimap2))) {jfs_err ("jfs_mount: diMount(ipaimap2) failed, rc = %d" , rc); - goto errout35; + goto err_ipaimap2; } }else /* Secondary aggregate inode table is not valid */
@@ -180,7 +180,7 @@ int jfs_mount(struct super_block *sb)jfs_err ("jfs_mount: Failed to read FILESYSTEM_I" );/* open fileset secondary inode allocation map */ rc = -EIO ; - goto errout40; + goto err_umount_ipaimap2; }jfs_info ("jfs_mount: ipimap:0x%p" , ipimap);
@@ -190,41 +190,34 @@ int jfs_mount(struct super_block *sb)/* initialize fileset inode allocation map */ if ((rc =diMount (ipimap))) {jfs_err ("jfs_mount: diMount failed w/rc = %d" , rc); - goto errout41; + goto err_ipimap; } - goto out; +return rc;/* * unwind on error */ - errout41:/* close fileset inode allocation map inode */ +err_ipimap: +/* close fileset inode allocation map inode */ diFreeSpecial (ipimap); - - errout40:/* fileset closed */ - +err_umount_ipaimap2:/* close secondary aggregate inode allocation map */ -if (ipaimap2) { +if (ipaimap2)diUnmount (ipaimap2,1 ); +err_ipaimap2: +/* close aggregate inodes */ +if (ipaimap2)diFreeSpecial (ipaimap2); - } - - errout35: - -/* close aggregate block allocation map */ +err_umount_ipbmap:/* close aggregate block allocation map */ dbUnmount (ipbmap,1 ); +err_ipbmap:/* close aggregate inodes */ diFreeSpecial (ipbmap); - - errout22:/* close aggregate inode allocation map */ - +err_umount_ipaimap:/* close aggregate inode allocation map */ diUnmount (ipaimap,1 ); - - errout21:/* close aggregate inodes */ +err_ipaimap:/* close aggregate inodes */ diFreeSpecial (ipaimap); - errout20:/* aggregate closed */ - - out: - +out:if (rc)jfs_err ("Mount JFS Failure: %d" , rc);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 184/323 ALSA: hda: Reduce udelay() at SKL+ position reporting
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]
The position reporting on Intel Skylake and later chips via azx_get_pos_skl() contains a udelay(20) call for the capture streams. A call for this alone doesn't sound too harmful. However, as the pointer PCM ops is one of the hottest path in the PCM operations -- especially for the timer-scheduled operations like PulseAudio -- such a delay hogs CPU usage significantly in the total performance.
The code there was taken from the original code in ASoC SST Skylake driver blindly. The udelay() is a workaround for the case where the reported position is behind the period boundary at the timing triggered from interrupts; applications often expect that the full data is available for the whole period when returned (and also that's the definition of the ALSA PCM period).
OTOH, HD-audio (legacy) driver has already some workarounds for the delayed position reporting due to its relatively large FIFO, such as the BDL position adjustment and the delayed period-elapsed call in the work. That said, the udelay() is almost superfluous for HD-audio driver unlike SST, and we can drop the udelay().
Though, the current code doesn't guarantee the full period readiness as mentioned in the above, but rather it checks the wallclock and detects the unexpected jump. That's one missing piece, and the drop of udelay() needs a bit more sanity checks for the delayed handling.
This patch implements those: the drop of udelay() call in azx_get_pos_skl() and the more proper check of hwptr in azx_position_ok(). The latter change is applied only for the case where the stream is running in the normal mode without no_period_wakeup flag. When no_period_wakeup is set, it essentially ignores the period handling and rather concentrates only on the current position; which implies that we don't need to care about the period boundary at all.
--- sound/pci/hda/hda_intel.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
sound/pci/hda/hda_intel.c +23 -5
@@ -743,13 +743,17 @@ static int azx_intel_link_power(struct azx *chip, bool enable)* the update-IRQ timing. The IRQ is issued before actually the * data is processed. So, we need to process it afterwords in a * workqueue. +* +* Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update */ static int azx_position_ok (struct azx *chip,struct azx_dev *azx_dev) {struct snd_pcm_substream *substream = azx_dev->core.substream; +struct snd_pcm_runtime *runtime = substream->runtime;int stream = substream->stream;u32 wallclk;unsigned int pos; +snd_pcm_uframes_t hwptr, target; wallclk =azx_readl (chip,WALLCLK ) - azx_dev->core.start_wallclk;if (wallclk < (azx_dev->core.period_wallclk *2 ) /3 )
@@ -786,6 +790,24 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)/* NG - it's below the first next period boundary */ return chip->bdl_pos_adj ?0 :-1 ; azx_dev->core.start_wallclk += wallclk; + +if (azx_dev->core.no_period_wakeup) +return 1 ;/* OK, no need to check period boundary */ + +if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt) +return 1 ;/* OK, already in hwptr updating process */ + +/* check whether the period gets really elapsed */ + pos =bytes_to_frames (runtime, pos); + hwptr = runtime->hw_ptr_base + pos; +if (hwptr < runtime->status->hw_ptr) + hwptr += runtime->buffer_size; + target = runtime->hw_ptr_interrupt + runtime->period_size; +if (hwptr < target) { +/* too early wakeup, process it later */ +return chip->bdl_pos_adj ?0 :-1 ; + } +return 1 ;/* OK, it's fine */ }
@@ -983,11 +1005,7 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)if (azx_dev->core.substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )return azx_skl_get_dpib_pos (chip, azx_dev); -/* For capture, we need to read posbuf, but it requires a delay -* for the possible boundary overlap; the read of DPIB fetches the -* actual posbuf -*/ -udelay (20 ); +/* read of DPIB fetches the actual posbuf */ azx_skl_get_dpib_pos (chip, azx_dev);return azx_get_pos_posbuf (chip, azx_dev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 185/323 arm: dts: omap3-gta04a4: accelerometer irq fix
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 884ea75d79a36faf3731ad9d6b9c29f58697638d ]
Fix typo in pinctrl. It did only work because the bootloader seems to have initialized it.
--- arch/arm/boot/dts/omap3-gta04.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap3-gta04.dtsi +1 -1
@@ -364,7 +364,7 @@ compatible = "bosch,bma180"; reg = <0x41>; pinctrl-names = "default"; - pintcrl-0 = <&bma180_pins>; + pinctrl-0 = <&bma180_pins>; interrupt-parent = <&gpio4>; interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */ };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 186/323 soc/tegra: Fix an error handling path in tegra_powergate_power_up()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 986b5094708e508baa452a23ffe809870934a7df ]
If an error occurs after a successful tegra_powergate_enable_clocks() call, it must be undone by a tegra_powergate_disable_clocks() call, as already done in the below and above error handling paths of this function.
Update the 'goto' to branch at the correct place of the error handling path.
--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/pmc.c +1 -1
@@ -408,7 +408,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg, err =reset_control_deassert (pg->reset);if (err) - goto powergate_off; + goto disable_clks;usleep_range (10 ,20 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 187/323 memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 4ed2f3545c2e5acfbccd7f85fea5b1a82e9862d7 ]
The error handling code of fsl_ifc_ctrl_probe is problematic. When fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails, it forgets to free the irq and nand_irq. Meanwhile, if request_irq of fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if the request_irq is not successful.
Fix this by refactoring the error handling code.
--- drivers/memory/fsl_ifc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/memory/fsl_ifc.c +6 -7
@@ -276,7 +276,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) ret =fsl_ifc_ctrl_init (fsl_ifc_ctrl_dev);if (ret <0 ) - goto err; + goto err_unmap_nandirq;init_waitqueue_head (&fsl_ifc_ctrl_dev->nand_wait);
@@ -285,7 +285,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)if (ret !=0 ) {dev_err (&dev->dev,"failed to install irq (%d)\n" , fsl_ifc_ctrl_dev->irq); - goto err_irq; + goto err_unmap_nandirq; }if (fsl_ifc_ctrl_dev->nand_irq) {
@@ -294,17 +294,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)if (ret !=0 ) {dev_err (&dev->dev,"failed to install irq (%d)\n" , fsl_ifc_ctrl_dev->nand_irq); - goto err_nandirq; + goto err_free_irq; } }return 0 ; -err_nandirq: -free_irq (fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev); -irq_dispose_mapping (fsl_ifc_ctrl_dev->nand_irq); -err_irq: +err_free_irq:free_irq (fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev); +err_unmap_nandirq: +irq_dispose_mapping (fsl_ifc_ctrl_dev->nand_irq);irq_dispose_mapping (fsl_ifc_ctrl_dev->irq); err:iounmap (fsl_ifc_ctrl_dev->gregs);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 188/323 video: fbdev: chipsfb: use memset_io() instead of memset()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit f2719b26ae27282c145202ffd656d5ff1fe737cc ]
While investigating a lockup at startup on Powerbook 3400C, it was identified that the fbdev driver generates alignment exception at startup:
--- interrupt: 600 at memset+0x60/0xc0
NIP: c0021414 LR: c03fc49c CTR: 00007fff
REGS: ca021c10 TRAP: 0600 Tainted: G W (5.14.2-pmac-00727-g12a41fa69492)
MSR: 00009032 <EE,ME,IR,DR,RI> CR: 44008442 XER: 20000100
DAR: cab80020 DSISR: 00017c07
GPR00: 00000007 ca021cd0 c14412e0 cab80000 00000000 00100000 cab8001c 00000004
GPR08: 00100000 00007fff 00000000 00000000 84008442 00000000 c0006fb4 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00100000
GPR24: 00000000 81800000 00000320 c15fa400 c14d1878 00000000 c14d1800 c094e19c NIP [c0021414] memset+0x60/0xc0
LR [c03fc49c] chipsfb_pci_init+0x160/0x580
--- interrupt: 600
[ca021cd0] [c03fc46c] chipsfb_pci_init+0x130/0x580 (unreliable) [ca021d20] [c03a3a70] pci_device_probe+0xf8/0x1b8
[ca021d50] [c043d584] really_probe.part.0+0xac/0x388
[ca021d70] [c043d914] __driver_probe_device+0xb4/0x170
[ca021d90] [c043da18] driver_probe_device+0x48/0x144
[ca021dc0] [c043e318] __driver_attach+0x11c/0x1c4
[ca021de0] [c043ad30] bus_for_each_dev+0x88/0xf0
[ca021e10] [c043c724] bus_add_driver+0x190/0x22c
[ca021e40] [c043ee94] driver_register+0x9c/0x170
[ca021e60] [c0006c28] do_one_initcall+0x54/0x1ec
[ca021ed0] [c08246e4] kernel_init_freeable+0x1c0/0x270
[ca021f10] [c0006fdc] kernel_init+0x28/0x11c
[ca021f30] [c0017148] ret_from_kernel_thread+0x14/0x1c Instruction dump:
7d4601a4 39490777 7d4701a4 39490888 7d4801a4 39490999 7d4901a4 39290aaa 7d2a01a4 4c00012c 4bfffe88 0fe00000 <4bfffe80> 9421fff0 38210010 48001970
This is due to 'dcbz' instruction being used on non-cached memory. 'dcbz' instruction is used by memset() to zeroize a complete cacheline at once, and memset() is not expected to be used on non cached memory.
When performing a 'sparse' check on fbdev driver, it also appears that the use of memset() is unexpected:
drivers/video/fbdev/chipsfb.c:334:17: warning: incorrect type in argument 1 (different address spaces)
drivers/video/fbdev/chipsfb.c:334:17: expected void *
drivers/video/fbdev/chipsfb.c:334:17: got char [noderef] __iomem *screen_base
drivers/video/fbdev/chipsfb.c:334:15: warning: memset with byte count of 1048576
Use fb_memset() instead of memset(). fb_memset() is defined as memset_io() for powerpc.
--- drivers/video/fbdev/chipsfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/chipsfb.c +1 -1
@@ -332,7 +332,7 @@ static const struct fb_var_screeninfo chipsfb_var = {static void init_chips (struct fb_info *p,unsigned long addr) { -memset (p->screen_base,0 ,0x100000 ); +fb_memset (p->screen_base,0 ,0x100000 ); p->fix = chipsfb_fix; p->fix.smem_start = addr;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 189/323 serial: 8250_dw: Drop wrong use of ACPI_PTR()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit ebabb77a2a115b6c5e68f7364b598310b5f61fb2 ]
ACPI_PTR() is more harmful than helpful. For example, in this case if CONFIG_ACPI=n, the ID table left unused which is not what we want.
Instead of adding ifdeffery here and there, drop ACPI_PTR().
--- drivers/tty/serial/8250/8250_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_dw.c +1 -1
@@ -769,7 +769,7 @@ static struct platform_driver dw8250_platform_driver = { .name = "dw-apb-uart", .pm = &dw8250_pm_ops, .of_match_table = dw8250_of_match, - .acpi_match_table = ACPI_PTR(dw8250_acpi_match), + .acpi_match_table = dw8250_acpi_match, }, .probe = dw8250_probe, .remove = dw8250_remove,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 190/323 usb: gadget: hid: fix error code in do_config()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 68e7c510fdf4f6167404609da52e1979165649f6 ]
Return an error code if usb_get_function() fails. Don't return success.
--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/hid.c +3 -1
@@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c)list_for_each_entry (e, &hidg_func_list, node) { e->f =usb_get_function (e->fi); -if (IS_ERR (e->f)) +if (IS_ERR (e->f)) { + status =PTR_ERR (e->f); goto put; + } status =usb_add_function (c, e->f);if (status <0 ) {usb_put_function (e->f);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 191/323 =?UTF-8?q?power:=20supply:=20rt5033=5Fbattery:=20Change=20voltage?= =?UTF-8?q?=20values=20to=20=C2=B5V?=
In reply to Greg Kroah-HartmanFrom: Jakob Hauser <[email protected]>
[ Upstream commit bf895295e9a73411889816f1a0c1f4f1a2d9c678 ]
Currently the rt5033_battery driver provides voltage values in mV. It should be µV as stated in Documentation/power/power_supply_class.rst.
--- drivers/power/supply/rt5033_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt5033_battery.c +1 -1
@@ -63,7 +63,7 @@ static int rt5033_battery_get_watt_prop(struct i2c_client *client,regmap_read (battery->regmap, regh, &msb);regmap_read (battery->regmap, regl, &lsb); - ret = ((msb <<4 ) + (lsb >>4 )) *1250 /1000 ; + ret = ((msb <<4 ) + (lsb >>4 )) *1250 ;return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 192/323 scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f4875d509a0a78ad294a1a538d534b5ba94e685a ]
This variable is just a temporary variable, used to do an endian conversion. The problem is that the last byte is not initialized. After the conversion is completely done, the last byte is discarded so it doesn't cause a problem. But static checkers and the KMSan runtime checker can detect the uninitialized read and will complain about it.
--- drivers/scsi/csiostor/csio_lnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_lnode.c +1 -1
@@ -619,7 +619,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp)struct fc_els_csp *csp;struct fc_els_cssp *clsp;enum fw_retval retval; -__be32 nport_id; +__be32 nport_id =0 ; retval =FW_CMD_RETVAL_G (ntohl (rsp->alloc_to_len16));if (retval !=FW_SUCCESS ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 193/323 RDMA/mlx4: Return missed an error if device doesnt support steering
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit f4e56ec4452f48b8292dcf0e1c4bdac83506fb8b ]
The error flow fixed in this patch is not possible because all kernel users of create QP interface check that device supports steering before set IB_QP_CREATE_NETIF_QP flag.
--- drivers/infiniband/hw/mlx4/qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/qp.c +3 -1
@@ -1057,8 +1057,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,if (dev->steering_support ==MLX4_STEERING_MODE_DEVICE_MANAGED ) qp->flags |=MLX4_IB_QP_NETIF ; -else +else { + err = -EINVAL ; goto err; + } } err =set_kernel_sq_size (dev, &init_attr->cap, qp_type, qp);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 194/323 ASoC: cs42l42: Correct some register default values
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit d591d4b32aa9552af14a0c7c586a2d3fe9ecc6e0 ]
Some registers had wrong default values in cs42l42_reg_defaults[].
--- sound/soc/codecs/cs42l42.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l42.c +2 -2
@@ -95,7 +95,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { { CS42L42_ASP_RX_INT_MASK, 0x1F }, { CS42L42_ASP_TX_INT_MASK, 0x0F }, { CS42L42_CODEC_INT_MASK, 0x03 }, - { CS42L42_SRCPL_INT_MASK, 0xFF }, + { CS42L42_SRCPL_INT_MASK, 0x7F }, { CS42L42_VPMON_INT_MASK, 0x01 }, { CS42L42_PLL_LOCK_INT_MASK, 0x01 }, { CS42L42_TSRS_PLUG_INT_MASK, 0x0F },
@@ -132,7 +132,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { { CS42L42_MIXER_CHA_VOL, 0x3F }, { CS42L42_MIXER_ADC_VOL, 0x3F }, { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_EQ_COEF_IN0, 0x22 }, + { CS42L42_EQ_COEF_IN0, 0x00 }, { CS42L42_EQ_COEF_IN1, 0x00 }, { CS42L42_EQ_COEF_IN2, 0x00 }, { CS42L42_EQ_COEF_IN3, 0x00 },
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 195/323 ASoC: cs42l42: Defer probe if request_threaded_irq() returns EPROBE_DEFER
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 0306988789d9d91a18ff70bd2bf165d3ae0ef1dd ]
The driver can run without an interrupt so if devm_request_threaded_irq() failed, the probe() just carried on. But if this was EPROBE_DEFER the driver would continue without an interrupt instead of deferring to wait for the interrupt to become available.
--- sound/soc/codecs/cs42l42.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l42.c +3 -2
@@ -1799,8 +1799,9 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,NULL , cs42l42_irq_thread,IRQF_ONESHOT |IRQF_TRIGGER_LOW , "cs42l42", cs42l42); - -if (ret !=0 ) +if (ret == -EPROBE_DEFER ) + goto err_disable; +else if (ret !=0 )dev_err (&i2c_client->dev,"Failed to request IRQ: %d\n" , ret);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 196/323 phy: qcom-qusb2: Fix a memory leak on probe
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit bf7ffcd0069d30e2e7ba2b827f08c89f471cd1f3 ]
On success nvmem_cell_read() returns a pointer to a dynamically allocated buffer, and therefore it shall be freed after usage.
The issue is reported by kmemleak:
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff3b3803e4b280 (size 128):
comm "kworker/u16:1", pid 107, jiffies 4294892861 (age 94.120s)
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 00 00 00 00 00 00 00 ................
backtrace:
[<000000007739afdc>] __kmalloc+0x27c/0x41c
[<0000000071c0fbf8>] nvmem_cell_read+0x40/0xe0
[<00000000e803ef1f>] qusb2_phy_init+0x258/0x5bc
[<00000000fc81fcfa>] phy_init+0x70/0x110
[<00000000e3d48a57>] dwc3_core_soft_reset+0x4c/0x234
[<0000000027d1dbd4>] dwc3_core_init+0x68/0x990
[<000000001965faf9>] dwc3_probe+0x4f4/0x730
[<000000002f7617ca>] platform_probe+0x74/0xf0
[<00000000a2576cac>] really_probe+0xc4/0x470
[<00000000bc77f2c5>] __driver_probe_device+0x11c/0x190
[<00000000130db71f>] driver_probe_device+0x48/0x110
[<0000000019f36c2b>] __device_attach_driver+0xa4/0x140
[<00000000e5812ff7>] bus_for_each_drv+0x84/0xe0
[<00000000f4bac574>] __device_attach+0xe4/0x1c0
[<00000000d3beb631>] device_initial_probe+0x20/0x30
[<000000008019b9db>] bus_probe_device+0xa4/0xb0--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +10 -6
@@ -395,7 +395,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) {struct device *dev = &qphy->phy->dev;const struct qusb2_phy_cfg *cfg = qphy->cfg; -u8 *val; +u8 *val, hstx_trim;/* efuse register is optional */ if (!qphy->cell)
@@ -409,7 +409,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)* set while configuring the phy. */ val =nvmem_cell_read (qphy->cell,NULL ); -if (IS_ERR (val) || !val[0 ]) { +if (IS_ERR (val)) { +dev_dbg (dev,"failed to read a valid hs-tx trim value\n" ); +return ; + } + hstx_trim = val[0 ]; +kfree (val); +if (!hstx_trim) {dev_dbg (dev,"failed to read a valid hs-tx trim value\n" );return ; }
@@ -417,12 +423,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)/* Fused TUNE1/2 value is the higher nibble only */ if (cfg->update_tune1_with_efuse)qusb2_write_mask (qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1 ], - val[0 ] <<HSTX_TRIM_SHIFT , -HSTX_TRIM_MASK ); + hstx_trim <<HSTX_TRIM_SHIFT ,HSTX_TRIM_MASK );else qusb2_write_mask (qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2 ], - val[0 ] <<HSTX_TRIM_SHIFT , -HSTX_TRIM_MASK ); + hstx_trim <<HSTX_TRIM_SHIFT ,HSTX_TRIM_MASK ); }static int qusb2_phy_set_mode (struct phy *phy,enum phy_mode mode)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 197/323 serial: xilinx_uartps: Fix race condition causing stuck TX
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
[ Upstream commit 88b20f84f0fe47409342669caf3e58a3fc64c316 ]
xilinx_uartps .start_tx() clears TXEMPTY when enabling TXEMPTY to avoid any previous TXEVENT event asserting the UART interrupt. This clear operation is done immediately after filling the TX FIFO.
However, if the bytes inserted by cdns_uart_handle_tx() are consumed by the UART before the TXEMPTY is cleared, the clear operation eats the new TXEMPTY event as well, causing cdns_uart_isr() to never receive the TXEMPTY event. If there are bytes still queued in circbuf, TX will get stuck as they will never get transferred to FIFO (unless new bytes are queued to circbuf in which case .start_tx() is called again).
While the racy missed TXEMPTY occurs fairly often with short data sequences (e.g. write 1 byte), in those cases circbuf is usually empty so no action on TXEMPTY would have been needed anyway. On the other hand, longer data sequences make the race much more unlikely as UART takes longer to consume the TX FIFO. Therefore it is rare for this race to cause visible issues in general.
Fix the race by clearing the TXEMPTY bit in ISR *before* filling the FIFO.
The TXEMPTY bit in ISR will only get asserted at the exact moment the TX FIFO *becomes* empty, so clearing the bit before filling FIFO does not cause an extra immediate assertion even if the FIFO is initially empty.
This is hard to reproduce directly on a normal system, but inserting e.g. udelay(200) after cdns_uart_handle_tx(port), setting 4000000 baud, and then running "dd if=/dev/zero bs=128 of=/dev/ttyPS0 count=50" reliably reproduces the issue on my ZynqMP test system unless this fix is applied.
--- drivers/tty/serial/xilinx_uartps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/xilinx_uartps.c +2 -1
@@ -591,9 +591,10 @@ static void cdns_uart_start_tx(struct uart_port *port)if (uart_circ_empty (&port->state->xmit))return ; +writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_ISR ); +cdns_uart_handle_tx (port); -writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_ISR );/* Enable the TX Empty interrupt */ writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_IER ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 198/323 mips: cm: Convert to bitfield API to fix out-of-bounds access
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 18b8f5b6fc53d097cadb94a93d8d6566ba88e389 ]
mips_cm_error_report() extracts the cause and other cause from the error register using shifts. This works fine for the former, as it is stored in the top bits, and the shift will thus remove all non-related bits. However, the latter is stored in the bottom bits, hence thus needs masking to get rid of non-related bits. Without such masking, using it as an index into the cm2_causes[] array will lead to an out-of-bounds access, probably causing a crash.
Fix this by using FIELD_GET() instead. Bite the bullet and convert all MIPS CM handling to the bitfield API, to improve readability and safety.
--- arch/mips/include/asm/mips-cm.h | 12 ++++++------ arch/mips/kernel/mips-cm.c | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-)
arch/mips/include/asm/mips-cm.h +6 -6
@@ -15,6 +15,7 @@#ifndef __MIPS_ASM_MIPS_CM_H__#define __MIPS_ASM_MIPS_CM_H__ +#include <linux/bitfield.h> #include <linux/bitops.h> #include <linux/errno.h>
@@ -157,8 +158,8 @@ GCR_ACCESSOR_RO(32, 0x030, rev)#define CM_GCR_REV_MINOR GENMASK(7, 0)#define CM_ENCODE_REV (major, minor) \ - (((major) << __ffs(CM_GCR_REV_MAJOR)) | \ - ((minor) << __ffs(CM_GCR_REV_MINOR))) + (FIELD_PREP(CM_GCR_REV_MAJOR, major) | \ + FIELD_PREP(CM_GCR_REV_MINOR, minor))#define CM_REV_CM2 CM_ENCODE_REV(6, 0)#define CM_REV_CM2_5 CM_ENCODE_REV(7, 0)
@@ -366,10 +367,10 @@ static inline int mips_cm_revision(void)static inline unsigned int mips_cm_max_vp_width (void ) {extern int smp_num_siblings; -uint32_t cfg;if (mips_cm_revision () >=CM_REV_CM3 ) -return read_gcr_sys_config2 () &CM_GCR_SYS_CONFIG2_MAXVPW ; +return FIELD_GET (CM_GCR_SYS_CONFIG2_MAXVPW , +read_gcr_sys_config2 ());if (mips_cm_present ()) {/*
@@ -377,8 +378,7 @@ static inline unsigned int mips_cm_max_vp_width(void)* number of VP(E)s, and if that ever changes then this will * need revisiting. */ - cfg =read_gcr_cl_config () & CM_GCR_Cx_CONFIG_PVPE; -return (cfg >>__ffs (CM_GCR_Cx_CONFIG_PVPE)) +1 ; +return FIELD_GET (CM_GCR_Cx_CONFIG_PVPE,read_gcr_cl_config ()) +1 ; }if (IS_ENABLED (CONFIG_SMP ))
arch/mips/kernel/mips-cm.c +10 -11
@@ -183,8 +183,7 @@ static void mips_cm_probe_l2sync(void)phys_addr_t addr;/* L2-only sync was introduced with CM major revision 6 */ - major_rev = (read_gcr_rev () &CM_GCR_REV_MAJOR ) >> -__ffs (CM_GCR_REV_MAJOR ); + major_rev =FIELD_GET (CM_GCR_REV_MAJOR ,read_gcr_rev ());if (major_rev <6 )return ;
@@ -267,13 +266,13 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,preempt_disable ();if (cm_rev >=CM_REV_CM3 ) { - val = core <<__ffs (CM3_GCR_Cx_OTHER_CORE); - val |= vp <<__ffs (CM3_GCR_Cx_OTHER_VP); + val =FIELD_PREP (CM3_GCR_Cx_OTHER_CORE, core) | +FIELD_PREP (CM3_GCR_Cx_OTHER_VP, vp);if (cm_rev >=CM_REV_CM3_5 ) { val |= CM_GCR_Cx_OTHER_CLUSTER_EN; - val |= cluster <<__ffs (CM_GCR_Cx_OTHER_CLUSTER); - val |= block <<__ffs (CM_GCR_Cx_OTHER_BLOCK); + val |=FIELD_PREP (CM_GCR_Cx_OTHER_CLUSTER, cluster); + val |=FIELD_PREP (CM_GCR_Cx_OTHER_BLOCK, block); }else {WARN_ON (cluster !=0 );WARN_ON (block != CM_GCR_Cx_OTHER_BLOCK_LOCAL);
@@ -303,7 +302,7 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,spin_lock_irqsave (&per_cpu (cm_core_lock, curr_core),per_cpu (cm_core_lock_flags, curr_core)); - val = core <<__ffs (CM_GCR_Cx_OTHER_CORENUM); + val =FIELD_PREP (CM_GCR_Cx_OTHER_CORENUM, core); }write_gcr_cl_other (val);
@@ -347,8 +346,8 @@ void mips_cm_error_report(void) cm_other =read_gcr_error_mult ();if (revision <CM_REV_CM3 ) {/* CM2 */ - cause = cm_error >>__ffs (CM_GCR_ERROR_CAUSE_ERRTYPE ); - ocause = cm_other >>__ffs (CM_GCR_ERROR_MULT_ERR2ND ); + cause =FIELD_GET (CM_GCR_ERROR_CAUSE_ERRTYPE , cm_error); + ocause =FIELD_GET (CM_GCR_ERROR_MULT_ERR2ND , cm_other);if (!cause)return ;
@@ -390,8 +389,8 @@ void mips_cm_error_report(void)ulong core_id_bits, vp_id_bits, cmd_bits, cmd_group_bits;ulong cm3_cca_bits, mcp_bits, cm3_tr_bits, sched_bit; - cause = cm_error >>__ffs64 (CM3_GCR_ERROR_CAUSE_ERRTYPE ); - ocause = cm_other >>__ffs (CM_GCR_ERROR_MULT_ERR2ND ); + cause =FIELD_GET (CM3_GCR_ERROR_CAUSE_ERRTYPE , cm_error); + ocause =FIELD_GET (CM_GCR_ERROR_MULT_ERR2ND , cm_other);if (!cause)return ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 199/323 power: supply: bq27xxx: Fix kernel crash on IRQ handler register error
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit cdf10ffe8f626d8a2edc354abf063df0078b2d71 ]
When registering the IRQ handler fails, do not just return the error code, this will free the devm_kzalloc()-ed data struct while leaving the queued work queued and the registered power_supply registered with both of them now pointing to free-ed memory, resulting in various kernel crashes soon afterwards.
Instead properly tear-down things on IRQ handler register errors.
--- drivers/power/supply/bq27xxx_battery_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/bq27xxx_battery_i2c.c +2 -1
@@ -195,7 +195,8 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,dev_err (&client->dev,"Unable to register IRQ %d error %d\n" , client->irq, ret); -return ret; +bq27xxx_battery_teardown (di); + goto err_failed; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 200/323 apparmor: fix error check
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit d108370c644b153382632b3e5511ade575c91c86 ]
clang static analysis reports this representative problem:
label.c:1463:16: warning: Assigned value is garbage or undefined
label->hname = name;
^ ~~~~In aa_update_label_name(), this the problem block of code
if (aa_label_acntsxprint(&name, ...) == -1) return res;
On failure, aa_label_acntsxprint() has a more complicated return that just -1. So check for a negative return.
It was also noted that the aa_label_acntsxprint() main comment refers to a nonexistent parameter, so clean up the comment.
--- security/apparmor/label.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/label.c +2 -2
@@ -1463,7 +1463,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp)if (label->hname ||labels_ns (label) != ns)return res; -if (aa_label_acntsxprint (&name, ns, label,FLAGS_NONE , gfp) ==-1 ) +if (aa_label_acntsxprint (&name, ns, label,FLAGS_NONE , gfp) <0 )return res; ls =labels_set (label);
@@ -1713,7 +1713,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label,/** * aa_label_acntsxprint - allocate a __counted string buffer and print label -* @strp: buffer to write to. (MAY BE NULL if @size == 0) +* @strp: buffer to write to. * @ns: namespace profile is being viewed from * @label: label to view (NOT NULL) * @flags: flags controlling what label info is printed
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 201/323 rpmsg: Fix rpmsg_create_ept return when RPMSG config is not defined
In reply to Greg Kroah-HartmanFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 537d3af1bee8ad1415fda9b622d1ea6d1ae76dfa ]
According to the description of the rpmsg_create_ept in rpmsg_core.c the function should return NULL on error.
--- include/linux/rpmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rpmsg.h +1 -1
@@ -177,7 +177,7 @@ static inline struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev/* This shouldn't be possible */ WARN_ON (1 ); -return ERR_PTR (-ENXIO ); +return NULL ; }static inline int rpmsg_send (struct rpmsg_endpoint *ept,void *data,int len)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 202/323 pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds
In reply to Greg Kroah-HartmanFrom: Baptiste Lepers <[email protected]>
[ Upstream commit a2915fa06227b056a8f9b0d79b61dca08ad5cfc6 ]
_nfs4_pnfs_v3/v4_ds_connect do
some work
smp_wmb
ds->ds_clp = clp;
And nfs4_ff_layout_prepare_ds currently does
smp_rmb
if(ds->ds_clp)
...
This patch places the smp_rmb after the if. This ensures that following reads only happen once nfs4_ff_layout_prepare_ds has checked that data has been properly initialized.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 4 ++-- fs/nfs/pnfs_nfs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -2
@@ -429,10 +429,10 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx, goto out_fail; ds = mirror->mirror_ds->ds; +if (READ_ONCE (ds->ds_clp)) + goto out;/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ smp_rmb (); -if (ds->ds_clp) - goto out;/* FIXME: For now we assume the server sent only one version of NFS * to use for the DS.
fs/nfs/pnfs_nfs.c +2 -2
@@ -635,7 +635,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, }smp_wmb (); - ds->ds_clp = clp; +WRITE_ONCE (ds->ds_clp, clp);dprintk ("%s [new] addr: %s\n" , __func__, ds->ds_remotestr); out:return status;
@@ -708,7 +708,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, }smp_wmb (); - ds->ds_clp = clp; +WRITE_ONCE (ds->ds_clp, clp);dprintk ("%s [new] addr: %s\n" , __func__, ds->ds_remotestr); out:return status;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 203/323 drm/plane-helper: fix uninitialized variable reference
In reply to Greg Kroah-HartmanFrom: Alex Xu (Hello71) <[email protected]>
[ Upstream commit 7be28bd73f23e53d6e7f5fe891ba9503fc0c7210 ]
drivers/gpu/drm/drm_plane_helper.c: In function 'drm_primary_helper_update':drivers/gpu/drm/drm_plane_helper.c:113:32: error: 'visible' is used uninitialized [-Werror=uninitialized]
113 | struct drm_plane_state plane_state = {
| ^~~~~~~~~~~
drivers/gpu/drm/drm_plane_helper.c:178:14: note: 'visible' was declared here
178 | bool visible;
| ^~~~~~~cc1: all warnings being treated as errors
visible is an output, not an input. in practice this use might turn out OK but it's still UB.
--- drivers/gpu/drm/drm_plane_helper.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_plane_helper.c +0 -1
@@ -150,7 +150,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane, .crtc_w = drm_rect_width(dst), .crtc_h = drm_rect_height(dst), .rotation = rotation, - .visible = *visible, };struct drm_crtc_state crtc_state = { .crtc = crtc,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 204/323 PCI: aardvark: Dont spam about PIO Response Status
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 464de7e7fff767e87429cd7be09c4f2cb50a6ccb ]
Use dev_dbg() instead of dev_err() in advk_pcie_check_pio_status().
For example CRS is not an error status, it just says that the request should be retried.
--- drivers/pci/controller/pci-aardvark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +1 -1
@@ -404,7 +404,7 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val)else str_posted ="Posted" ; -dev_err (dev,"%s PIO Response Status: %s, %#x @ %#x\n" , +dev_dbg (dev,"%s PIO Response Status: %s, %#x @ %#x\n" , str_posted, strcomp_status, reg,advk_readl (pcie,PIO_ADDR_LS ));return -EFAULT ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 205/323 NFS: Fix deadlocks in nfs_scan_commit_list()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 64a93dbf25d3a1368bb58ddf0f61d0a92d7479e3 ]
Partially revert commit 2ce209c42c01 ("NFS: Wait for requests that are locked on the commit list"), since it can lead to deadlocks between commit requests and nfs_join_page_group().
For now we should assume that any locked requests on the commit list are either about to be removed and committed by another task, or the writes they describe are about to be retransmitted. In either case, we should not need to worry.
--- fs/nfs/write.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
fs/nfs/write.c +2 -15
@@ -1045,25 +1045,11 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,struct nfs_page *req, *tmp;int ret =0 ; -restart:list_for_each_entry_safe (req, tmp, src, wb_list) {kref_get (&req->wb_kref);if (!nfs_lock_request (req)) { -int status; - -/* Prevent deadlock with nfs_lock_and_join_requests */ -if (!list_empty (dst)) { -nfs_release_request (req); -continue ; - } -/* Ensure we make progress to prevent livelock */ -mutex_unlock (&NFS_I (cinfo->inode)->commit_mutex); - status =nfs_wait_on_request (req);nfs_release_request (req); -mutex_lock (&NFS_I (cinfo->inode)->commit_mutex); -if (status <0 ) -break ; - goto restart; +continue ; }nfs_request_remove_commit_list (req, cinfo);clear_bit (PG_COMMIT_TO_DS , &req->wb_flags);
@@ -1911,6 +1897,7 @@ static int __nfs_commit_inode(struct inode *inode, int how,int may_wait = how &FLUSH_SYNC ;int ret, nscan; + how &= ~FLUSH_SYNC ;nfs_init_cinfo_from_inode (&cinfo, inode);nfs_commit_begin (cinfo.mds);for (;;) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 206/323 fs: orangefs: fix error return code of orangefs_revalidate_lookup()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 4c2b46c824a78fc8190d8eafaaea5a9078fe7479 ]
When op_alloc() returns NULL to new_op, no error return code of orangefs_revalidate_lookup() is assigned.
To fix this bug, ret is assigned with -ENOMEM in this case.
--- fs/orangefs/dcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/orangefs/dcache.c +3 -1
@@ -26,8 +26,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)gossip_debug (GOSSIP_DCACHE_DEBUG ,"%s: attempting lookup.\n" , __func__); new_op =op_alloc (ORANGEFS_VFS_OP_LOOKUP ); -if (!new_op) +if (!new_op) { + ret = -ENOMEM ; goto out_put_parent; + } new_op->upcall.req.lookup.sym_follow =ORANGEFS_LOOKUP_LINK_NO_FOLLOW ; new_op->upcall.req.lookup.parent_refn = parent->refn;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 207/323 mtd: spi-nor: hisi-sfc: Remove excessive clk_disable_unprepare()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 78e4d342187625585932bb437ec26e1060f7fc6f ]
hisi_spi_nor_probe() invokes clk_disable_unprepare() on all paths after successful call of clk_prepare_enable(). Besides, the clock is enabled by hispi_spi_nor_prep() and disabled by hispi_spi_nor_unprep(). So at remove time it is not possible to have the clock enabled. The patch removes excessive clk_disable_unprepare() from hisi_spi_nor_remove().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/mtd/spi-nor/hisi-sfc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/spi-nor/hisi-sfc.c +0 -1
@@ -485,7 +485,6 @@ static int hisi_spi_nor_remove(struct platform_device *pdev)hisi_spi_nor_unregister_all (host);mutex_destroy (&host->lock); -clk_disable_unprepare (host->clk);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 208/323 dmaengine: at_xdmac: fix AT_XDMAC_CC_PERID() macro
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 320c88a3104dc955f928a1eecebd551ff89530c0 ]
AT_XDMAC_CC_PERID() should be used to setup bits 24..30 of XDMAC_CC register. Using it without parenthesis around 0x7f & (i) will lead to setting all the time zero for bits 24..30 of XDMAC_CC as the << operator has higher precedence over bitwise &. Thus, add paranthesis around 0x7f & (i).
--- drivers/dma/at_xdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/at_xdmac.c +1 -1
@@ -156,7 +156,7 @@#define AT_XDMAC_CC_WRIP (0x1 << 23)/* Write in Progress (read only) */ #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23)#define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23) -#define AT_XDMAC_CC_PERID (i) (0x7f & (i) << 24)/* Channel Peripheral Identifier */ +#define AT_XDMAC_CC_PERID (i) ((0x7f & (i)) << 24)/* Channel Peripheral Identifier */ #define AT_XDMAC_CDS_MSP 0x2C/* Channel Data Stride Memory Set Pattern */ #define AT_XDMAC_CSUS 0x30/* Channel Source Microblock Stride */ #define AT_XDMAC_CDUS 0x34/* Channel Destination Microblock Stride */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 209/323 auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit afcb5a811ff3ab3969f09666535eb6018a160358 ]
While writing an empty string to a device attribute is a no-op, and thus does not need explicit safeguards, the user can still write a single newline to an attribute file:
echo > .../message
If that happens, img_ascii_lcd_display() trims the newline, yielding an empty string, and causing an infinite loop in img_ascii_lcd_scroll().
Fix this by adding a check for empty strings. Clear the display in case one is encountered.
--- drivers/auxdisplay/img-ascii-lcd.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/auxdisplay/img-ascii-lcd.c +10 -0
@@ -284,6 +284,16 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,if (msg[count -1 ] =='\n' ) count--; +if (!count) { +/* clear the LCD */ +devm_kfree (&ctx->pdev->dev, ctx->message); + ctx->message =NULL ; + ctx->message_len =0 ; +memset (ctx->curr,' ' , ctx->cfg->num_chars); + ctx->cfg->update (ctx); +return 0 ; + } + new_msg =devm_kmalloc (&ctx->pdev->dev, count +1 ,GFP_KERNEL );if (!new_msg)return -ENOMEM ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 210/323 auxdisplay: ht16k33: Connect backlight to fbdev
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 80f9eb70fd9276938f0a131f76d438021bfd8b34 ]
Currently /sys/class/graphics/fb0/bl_curve is not accessible (-ENODEV), as the driver does not connect the backlight to the frame buffer device. Fix this moving backlight initialization up, and filling in fb_info.bl_dev.
--- drivers/auxdisplay/ht16k33.c | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/auxdisplay/ht16k33.c +28 -28
@@ -418,6 +418,33 @@ static int ht16k33_probe(struct i2c_client *client,if (err)return err; +/* Backlight */ +memset (&bl_props,0 ,sizeof (struct backlight_properties )); + bl_props.type =BACKLIGHT_RAW ; + bl_props.max_brightness =MAX_BRIGHTNESS ; + + bl =devm_backlight_device_register (&client->dev,DRIVER_NAME "-bl" , + &client->dev, priv, + &ht16k33_bl_ops, &bl_props); +if (IS_ERR (bl)) { +dev_err (&client->dev,"failed to register backlight\n" ); +return PTR_ERR (bl); + } + + err =of_property_read_u32 (node,"default-brightness-level" , + &dft_brightness); +if (err) { + dft_brightness =MAX_BRIGHTNESS ; + }else if (dft_brightness >MAX_BRIGHTNESS ) { +dev_warn (&client->dev, +"invalid default brightness level: %u, using %u\n" , + dft_brightness,MAX_BRIGHTNESS ); + dft_brightness =MAX_BRIGHTNESS ; + } + + bl->props.brightness = dft_brightness; +ht16k33_bl_update_status (bl); +/* Framebuffer (2 bytes per column) */ BUILD_BUG_ON (PAGE_SIZE <HT16K33_FB_SIZE ); fbdev->buffer = (unsigned char *)get_zeroed_page (GFP_KERNEL );
@@ -450,6 +477,7 @@ static int ht16k33_probe(struct i2c_client *client, fbdev->info->screen_size =HT16K33_FB_SIZE ; fbdev->info->fix = ht16k33_fb_fix; fbdev->info->var = ht16k33_fb_var; + fbdev->info->bl_dev = bl; fbdev->info->pseudo_palette =NULL ; fbdev->info->flags =FBINFO_FLAG_DEFAULT ; fbdev->info->par = priv;
@@ -462,34 +490,6 @@ static int ht16k33_probe(struct i2c_client *client,if (err) goto err_fbdev_unregister; -/* Backlight */ -memset (&bl_props,0 ,sizeof (struct backlight_properties )); - bl_props.type =BACKLIGHT_RAW ; - bl_props.max_brightness =MAX_BRIGHTNESS ; - - bl =devm_backlight_device_register (&client->dev,DRIVER_NAME "-bl" , - &client->dev, priv, - &ht16k33_bl_ops, &bl_props); -if (IS_ERR (bl)) { -dev_err (&client->dev,"failed to register backlight\n" ); - err =PTR_ERR (bl); - goto err_fbdev_unregister; - } - - err =of_property_read_u32 (node,"default-brightness-level" , - &dft_brightness); -if (err) { - dft_brightness =MAX_BRIGHTNESS ; - }else if (dft_brightness >MAX_BRIGHTNESS ) { -dev_warn (&client->dev, -"invalid default brightness level: %u, using %u\n" , - dft_brightness,MAX_BRIGHTNESS ); - dft_brightness =MAX_BRIGHTNESS ; - } - - bl->props.brightness = dft_brightness; -ht16k33_bl_update_status (bl); -ht16k33_fb_queue (priv);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 211/323 auxdisplay: ht16k33: Fix frame buffer device blanking
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 840fe258332544aa7321921e1723d37b772af7a9 ]
As the ht16k33 frame buffer sub-driver does not register an fb_ops.fb_blank() handler, blanking does not work:
$ echo 1 > /sys/class/graphics/fb0/blank
sh: write error: Invalid argumentFix this by providing a handler that always returns zero, to make sure blank events will be sent to the actual device handling the backlight.
--- drivers/auxdisplay/ht16k33.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/auxdisplay/ht16k33.c +10 -0
@@ -219,6 +219,15 @@ static const struct backlight_ops ht16k33_bl_ops = { .check_fb = ht16k33_bl_check_fb, }; +/* +* Blank events will be passed to the actual device handling the backlight when +* we return zero here. +*/ +static int ht16k33_blank (int blank,struct fb_info *info) +{ +return 0 ; +} +static int ht16k33_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct ht16k33_priv *priv = info->par;
@@ -231,6 +240,7 @@ static struct fb_ops ht16k33_fb_ops = { .owner = THIS_MODULE, .fb_read = fb_sys_read, .fb_write = fb_sys_write, + .fb_blank = ht16k33_blank, .fb_fillrect = sys_fillrect, .fb_copyarea = sys_copyarea, .fb_imageblit = sys_imageblit,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 212/323 netfilter: nfnetlink_queue: fix OOB when mac header was cleared
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 5648b5e1169ff1d6d6a46c35c0b5fbebd2a5cbb2 ]
On 64bit platforms the MAC header is set to 0xffff on allocation and also when a helper like skb_unset_mac_header() is called.
dev_parse_header may call skb_mac_header() which assumes valid mac offset:
BUG: KASAN: use-after-free in eth_header_parse+0x75/0x90 Read of size 6 at addr ffff8881075a5c05 by task nf-queue/1364 Call Trace: memcpy+0x20/0x60 eth_header_parse+0x75/0x90 __nfqnl_enqueue_packet+0x1a61/0x3380 __nf_queue+0x597/0x1300 nf_queue+0xf/0x40 nf_hook_slow+0xed/0x190 nf_hook+0x184/0x440 ip_output+0x1c0/0x2a0 nf_reinject+0x26f/0x700 nfqnl_recv_verdict+0xa16/0x18b0 nfnetlink_rcv_msg+0x506/0xe70
The existing code only works if the skb has a mac header.
--- net/netfilter/nfnetlink_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_queue.c +1 -1
@@ -566,7 +566,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, goto nla_put_failure;if (indev && entskb->dev && - entskb->mac_header != entskb->network_header) { +skb_mac_header_was_set (entskb)) {struct nfqnl_msg_packet_hw phw;int len;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 213/323 dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit e7e1e880b114ca640a2f280b0d5d38aed98f98c6 ]
Before the callback_result callback was introduced drivers coded their invocation to the callback in a similar way to:
if (cb->callback) {
spin_unlock(&dma->lock);
cb->callback(cb->callback_param);
spin_lock(&dma->lock);
}With the introduction of callback_result two helpers where introduced to transparently handle both types of callbacks. And drivers where updated to look like this:
if (dmaengine_desc_callback_valid(cb)) {
spin_unlock(&dma->lock);
dmaengine_desc_callback_invoke(cb, ...);
spin_lock(&dma->lock);
}dmaengine_desc_callback_invoke() correctly handles both callback_result and callback. But we forgot to update the dmaengine_desc_callback_valid() function to check for callback_result. As a result DMA descriptors that use the callback_result rather than callback don't have their callback invoked by drivers that follow the pattern above.
Fix this by checking for both callback and callback_result in dmaengine_desc_callback_valid().
--- drivers/dma/dmaengine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dmaengine.h +1 -1
@@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,static inline bool dmaengine_desc_callback_valid (struct dmaengine_desc_callback *cb) { -return (cb->callback) ? true : false; +return cb->callback || cb->callback_result; }#endif
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 214/323 m68k: set a default value for MEMORY_RESERVE
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 1aaa557b2db95c9506ed0981bc34505c32d6b62b ]
'make randconfig' can produce a .config file with "CONFIG_MEMORY_RESERVE=" (no value) since it has no default. When a subsequent 'make all' is done, kconfig restarts the config and prompts for a value for MEMORY_RESERVE. This breaks scripting/automation where there is no interactive user input.
Add a default value for MEMORY_RESERVE. (Any integer value will work here for kconfig.)
Fixes a kconfig warning:
.config:214:warning: symbol value '' invalid for MEMORY_RESERVE
* Restart config...
Memory reservation (MiB) (MEMORY_RESERVE) [] (NEW)
--- arch/m68k/Kconfig.machine | 1 + 1 file changed, 1 insertion(+)
arch/m68k/Kconfig.machine +1 -0
@@ -185,6 +185,7 @@ config INIT_LCD config MEMORY_RESERVE int "Memory reservation (MiB)" depends on (UCSIMM || UCDIMM) + default 0 help Reserve certain memory regions on 68x328 based boards.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 215/323 watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT
In reply to Greg Kroah-HartmanFrom: Ahmad Fatoum <[email protected]>
[ Upstream commit 164483c735190775f29d0dcbac0363adc51a068d ]
The fintek watchdog timer can configure timeouts of second granularity only up to 255 seconds. Beyond that, the timeout needs to be configured with minute granularity. WDIOC_GETTIMEOUT should report the actual timeout configured, not just echo back the timeout configured by the user. Do so.
--- drivers/watchdog/f71808e_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/f71808e_wdt.c +3 -1
@@ -237,15 +237,17 @@ static int watchdog_set_timeout(int timeout)mutex_lock (&watchdog.lock); - watchdog.timeout = timeout;if (timeout >0xff ) { watchdog.timer_val =DIV_ROUND_UP (timeout,60 ); watchdog.minutes_mode = true; + timeout = watchdog.timer_val *60 ; }else { watchdog.timer_val = timeout; watchdog.minutes_mode = false; } + watchdog.timeout = timeout; +mutex_unlock (&watchdog.lock);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 216/323 ar7: fix kernel builds for compiler test
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 28b7ee33a2122569ac065cad578bf23f50cc65c3 ]
TI AR7 Watchdog Timer is only build for 32bit.
Avoid error like:
In file included from drivers/watchdog/ar7_wdt.c:29:./arch/mips/include/asm/mach-ar7/ar7.h: In function ‘ar7_is_titan’:./arch/mips/include/asm/mach-ar7/ar7.h:111:24: error: implicit declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]
111 | return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
| ^~~~~~~~~
| CKSEG1ADDR--- drivers/watchdog/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
@@ -1524,7 +1524,7 @@ config SIBYTE_WDOG config AR7_WDT tristate "TI AR7 Watchdog Timer" - depends on AR7 || (MIPS && COMPILE_TEST) + depends on AR7 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the TI AR7 Watchdog Timer.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 217/323 scsi: qla2xxx: Fix gnl list corruption
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit c98c5daaa24b583cba1369b7d167f93c6ae7299c ]
Current code does list element deletion and addition in and out of lock protection. This patch moves deletion behind lock.
list_add double add: new=ffff9130b5eb89f8, prev=ffff9130b5eb89f8,
next=ffff9130c6a715f0. ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:31! invalid opcode: 0000 [#1] SMP PTI CPU: 1 PID: 182395 Comm: kworker/1:37 Kdump: loaded Tainted: G W OE --------- - - 4.18.0-193.el8.x86_64 #1 Hardware name: HP ProLiant DL160 Gen8, BIOS J03 02/10/2014 Workqueue: qla2xxx_wq qla2x00_iocb_work_fn [qla2xxx] RIP: 0010:__list_add_valid+0x41/0x50 Code: 85 94 00 00 00 48 39 c7 74 0b 48 39 d7 74 06 b8 01 00 00 00 c3 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 60 83 ad 97 e8 4d bd ce ff <0f> 0b 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 48 8b 07 48 8b 57 08 RSP: 0018:ffffaba306f47d68 EFLAGS: 00010046 RAX: 0000000000000058 RBX: ffff9130b5eb8800 RCX: 0000000000000006 RDX: 0000000000000000 RSI: 0000000000000096 RDI: ffff9130b7456a00 RBP: ffff9130c6a70a58 R08: 000000000008d7be R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000001 R12: ffff9130c6a715f0 R13: ffff9130b5eb8824 R14: ffff9130b5eb89f8 R15: ffff9130b5eb89f8 FS: 0000000000000000(0000) GS:ffff9130b7440000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efcaaef11a0 CR3: 000000005200a002 CR4: 00000000000606e0 Call Trace: qla24xx_async_gnl+0x113/0x3c0 [qla2xxx] ? qla2x00_iocb_work_fn+0x53/0x80 [qla2xxx] ? process_one_work+0x1a7/0x3b0 ? worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 ? kthread+0x112/0x130
--- drivers/scsi/qla2xxx/qla_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +1 -3
@@ -797,8 +797,6 @@ qla24xx_async_gnl_sp_done(void *s, int res) sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1 ], sp->u.iocb_cmd.u.mbx.in_mb[2]); -if (res ==QLA_FUNCTION_TIMEOUT ) -return ; sp->fcport->flags &= ~(FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE );memset (&ea,0 ,sizeof (ea));
@@ -837,8 +835,8 @@ qla24xx_async_gnl_sp_done(void *s, int res)spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags);list_for_each_entry_safe (fcport, tf, &h, gnl_entry) { -list_del_init (&fcport->gnl_entry);spin_lock_irqsave (&vha->hw->tgt.sess_lock, flags); +list_del_init (&fcport->gnl_entry); fcport->flags &= ~(FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE );spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags); ea.fcport = fcport;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 218/323 scsi: qla2xxx: Turn off target reset during issue_lip
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 0b7a9fd934a68ebfc1019811b7bdc1742072ad7b ]
When user uses issue_lip to do link bounce, driver sends additional target reset to remote device before resetting the link. The target reset would affect other paths with active I/Os. This patch will remove the unnecessary target reset.
--- drivers/scsi/qla2xxx/qla_gbl.h | 2 -- drivers/scsi/qla2xxx/qla_mr.c | 23 ----------------------- drivers/scsi/qla2xxx/qla_os.c | 27 ++------------------------- 3 files changed, 2 insertions(+), 50 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +0 -2
@@ -144,7 +144,6 @@ extern int ql2xasynctmfenable;extern int ql2xgffidenable;extern int ql2xenabledif;extern int ql2xenablehba_err_chk; -extern int ql2xtargetreset;extern int ql2xdontresethba;extern uint64_t ql2xmaxlun;extern int ql2xmdcapmask;
@@ -754,7 +753,6 @@ extern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *);extern void qlafx00_fxdisc_iocb (srb_t *,struct fxdisc_entry_fx00 *);extern void qlafx00_timer_routine (scsi_qla_host_t *);extern int qlafx00_rescan_isp (scsi_qla_host_t *); -extern int qlafx00_loop_reset (scsi_qla_host_t *vha);/* qla82xx related functions */
drivers/scsi/qla2xxx/qla_mr.c +0 -23
@@ -739,29 +739,6 @@ qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag)return qla2x00_async_tm_cmd (fcport,TCF_LUN_RESET , l, tag); } -int -qlafx00_loop_reset (scsi_qla_host_t *vha) -{ -int ret; -struct fc_port *fcport; -struct qla_hw_data *ha = vha->hw; - -if (ql2xtargetreset) { -list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->port_type !=FCT_TARGET ) -continue ; - - ret = ha->isp_ops->target_reset (fcport,0 ,0 ); -if (ret !=QLA_SUCCESS ) { -ql_dbg (ql_dbg_taskm, vha,0x803d , -"Bus Reset failed: Reset=%d " -"d_id=%x.\n" , ret, fcport->d_id.b24); - } - } - } -return QLA_SUCCESS ; -} -int qlafx00_iospace_config (struct qla_hw_data *ha) {
drivers/scsi/qla2xxx/qla_os.c +2 -25
@@ -188,12 +188,6 @@ MODULE_PARM_DESC(ql2xdbwr," 0 -- Regular doorbell.\n" " 1 -- CAMRAM doorbell (faster).\n"); -int ql2xtargetreset =1 ; -module_param (ql2xtargetreset, int,S_IRUGO ); -MODULE_PARM_DESC (ql2xtargetreset, -"Enable target reset." -"Default is 1 - use hw defaults." ); -int ql2xgffidenable;module_param (ql2xgffidenable, int,S_IRUGO ); MODULE_PARM_DESC(ql2xgffidenable,
@@ -1662,27 +1656,10 @@ int qla2x00_loop_reset(scsi_qla_host_t *vha) {int ret; -struct fc_port *fcport;struct qla_hw_data *ha = vha->hw; -if (IS_QLAFX00 (ha)) { -return qlafx00_loop_reset (vha); - } - -if (ql2xtargetreset ==1 && ha->flags.enable_target_reset) { -list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->port_type !=FCT_TARGET ) -continue ; - - ret = ha->isp_ops->target_reset (fcport,0 ,0 ); -if (ret !=QLA_SUCCESS ) { -ql_dbg (ql_dbg_taskm, vha,0x802c , -"Bus Reset failed: Reset=%d " -"d_id=%x.\n" , ret, fcport->d_id.b24); - } - } - } - +if (IS_QLAFX00 (ha)) +return QLA_SUCCESS ;if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE (ha)) {atomic_set (&vha->loop_state,LOOP_DOWN );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 219/323 i2c: xlr: Fix a resource leak in the error handling path of xlr_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 7f98960c046ee1136e7096aee168eda03aef8a5d ]
A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function.
More specifically, 'clk_prepare_enable()' is used, but 'clk_disable()' is also already called. So just the unprepare step has still to be done.
Update the error handling path accordingly.
--- drivers/i2c/busses/i2c-xlr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xlr.c +5 -1
@@ -433,11 +433,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)i2c_set_adapdata (&priv->adap, priv); ret =i2c_add_numbered_adapter (&priv->adap);if (ret <0 ) -return ret; + goto err_unprepare_clk;platform_set_drvdata (pdev, priv);dev_info (&priv->adap.dev,"Added I2C Bus.\n" );return 0 ; + +err_unprepare_clk: +clk_unprepare (clk); +return ret; }static int xlr_i2c_remove (struct platform_device *pdev)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 220/323 xen-pciback: Fix return in pm_ctrl_init()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 4745ea2628bb43a7ec34b71763b5a56407b33990 ]
Return NULL instead of passing to ERR_PTR while err is zero, this fix smatch warnings:drivers/xen/xen-pciback/conf_space_capability.c:163
pm_ctrl_init() warn: passing zero to 'ERR_PTR'
--- drivers/xen/xen-pciback/conf_space_capability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-pciback/conf_space_capability.c +1 -1
@@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset) } out: -return ERR_PTR (err); +return err ?ERR_PTR (err) :NULL ; }static const struct config_field caplist_pm[] = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 221/323 net: davinci_emac: Fix interrupt pacing disable
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
[ Upstream commit d52bcb47bdf971a59a2467975d2405fcfcb2fa19 ]
This patch allows to use 0 for coal->rx_coalesce_usecs param to disable rx irq coalescing.
Previously we could enable rx irq coalescing via ethtool (For ex: ethtool -C eth0 rx-usecs 2000) but we couldn't disable it because this part rejects 0 value:
if (!coal->rx_coalesce_usecs)
return -EINVAL;--- drivers/net/ethernet/ti/davinci_emac.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +14 -2
@@ -426,8 +426,20 @@ static int emac_set_coalesce(struct net_device *ndev,u32 int_ctrl, num_interrupts =0 ;u32 prescale =0 , addnl_dvdr =1 , coal_intvl =0 ; -if (!coal->rx_coalesce_usecs) -return -EINVAL ; +if (!coal->rx_coalesce_usecs) { + priv->coal_intvl =0 ; + +switch (priv->version) { +case EMAC_VERSION_2 : +emac_ctrl_write (EMAC_DM646X_CMINTCTRL ,0 ); +break ; +default : +emac_ctrl_write (EMAC_CTRL_EWINTTCNT ,0 ); +break ; + } + +return 0 ; + } coal_intvl = coal->rx_coalesce_usecs;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 222/323 net: vlan: fix a UAF in vlan_dev_real_dev()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 563bcbae3ba233c275c244bfce2efe12938f5363 ]
The real_dev of a vlan net_device may be freed after unregister_vlan_dev(). Access the real_dev continually by vlan_dev_real_dev() will trigger the UAF problem for the real_dev like following:
==================================================================
BUG: KASAN: use-after-free in vlan_dev_real_dev+0xf9/0x120 Call Trace: kasan_report.cold+0x83/0xdf vlan_dev_real_dev+0xf9/0x120 is_eth_port_of_netdev_filter.part.0+0xb1/0x2c0 is_eth_port_of_netdev_filter+0x28/0x40 ib_enum_roce_netdev+0x1a3/0x300 ib_enum_all_roce_netdevs+0xc7/0x140 netdevice_event_work_handler+0x9d/0x210
...
Freed by task 9288: kasan_save_stack+0x1b/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0xfc/0x130 slab_free_freelist_hook+0xdd/0x240 kfree+0xe4/0x690 kvfree+0x42/0x50 device_release+0x9f/0x240 kobject_put+0x1c8/0x530 put_device+0x1b/0x30 free_netdev+0x370/0x540 ppp_destroy_interface+0x313/0x3d0
...
Move the put_device(real_dev) to vlan_dev_free(). Ensure real_dev not be freed before vlan_dev unregistered.
--- net/8021q/vlan.c | 3 --- net/8021q/vlan_dev.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
net/8021q/vlan.c +0 -3
@@ -112,9 +112,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) }vlan_vid_del (real_dev, vlan->vlan_proto, vlan_id); - -/* Get rid of the vlan's reference to real_dev */ -dev_put (real_dev); } int vlan_check_real_dev(struct net_device *real_dev,
net/8021q/vlan_dev.c +3 -0
@@ -816,6 +816,9 @@ static void vlan_dev_free(struct net_device *dev)free_percpu (vlan->vlan_pcpu_stats); vlan->vlan_pcpu_stats =NULL ; + +/* Get rid of the vlan's reference to real_dev */ +dev_put (vlan->real_dev); }void vlan_setup (struct net_device *dev)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 223/323 ACPI: PMIC: Fix intel_pmic_regs_handler() read accesses
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 009a789443fe4c8e6b1ecb7c16b4865c026184cd ]
The handling of PMIC register reads through writing 0 to address 4 of the OpRegion is wrong. Instead of returning the read value through the value64, which is a no-op for function == ACPI_WRITE calls, store the value and then on a subsequent function == ACPI_READ with address == 3 (the address for the value field of the OpRegion) return the stored value.
This has been tested on a Xiaomi Mi Pad 2 and makes the ACPI battery dev there mostly functional (unfortunately there are still other issues).
Here are the SET() / GET() functions of the PMIC ACPI device, which use this OpRegion, which clearly show the new behavior to be correct:
OperationRegion (REGS, 0x8F, Zero, 0x50)
Field (REGS, ByteAcc, NoLock, Preserve)
{
CLNT, 8,
SA, 8,
OFF, 8,
VAL, 8,
RWM, 8
}Method (GET, 3, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
RWM = Zero
If ((AVBG == One))
{
GPRW = Zero
}
}
Return (VAL) /* \_SB_.PCI0.I2C7.PMI5.VAL_ */
}Method (SET, 4, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
VAL = Arg3
RWM = One
If ((AVBG == One))
{
GPRW = One
}
}
}
--- drivers/acpi/pmic/intel_pmic.c | 51 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-)
drivers/acpi/pmic/intel_pmic.c +28 -23
@@ -216,31 +216,36 @@ static acpi_status intel_pmic_regs_handler(u32 function, void *handler_context, void *region_context) { struct intel_pmic_opregion *opregion = region_context; -int result =0 ; +int result = -EINVAL ; + +if (function ==ACPI_WRITE ) { +switch (address) { +case 0 : +return AE_OK ; +case 1 : + opregion->ctx.addr |= (*value64 &0xff ) <<8 ; +return AE_OK ; +case 2 : + opregion->ctx.addr |= *value64 &0xff ; +return AE_OK ; +case 3 : + opregion->ctx.val = *value64 &0xff ; +return AE_OK ; +case 4 : +if (*value64) { + result =regmap_write (opregion->regmap, opregion->ctx.addr, + opregion->ctx.val); + }else { + result =regmap_read (opregion->regmap, opregion->ctx.addr, + &opregion->ctx.val); + } + opregion->ctx.addr =0 ; + } + } -switch (address) { -case 0 : -return AE_OK ; -case 1 : - opregion->ctx.addr |= (*value64 &0xff ) <<8 ; +if (function ==ACPI_READ && address ==3 ) { + *value64 = opregion->ctx.val;return AE_OK ; -case 2 : - opregion->ctx.addr |= *value64 &0xff ; -return AE_OK ; -case 3 : - opregion->ctx.val = *value64 &0xff ; -return AE_OK ; -case 4 : -if (*value64) { - result =regmap_write (opregion->regmap, opregion->ctx.addr, - opregion->ctx.val); - }else { - result =regmap_read (opregion->regmap, opregion->ctx.addr, - &opregion->ctx.val); -if (result ==0 ) - *value64 = opregion->ctx.val; - } -memset (&opregion->ctx,0x00 ,sizeof (opregion->ctx)); }if (result <0 ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 224/323 bonding: Fix a use-after-free problem when bond_sysfs_slave_add() failed
In reply to Greg Kroah-HartmanFrom: Huang Guobin <[email protected]>
[ Upstream commit b93c6a911a3fe926b00add28f3b932007827c4ca ]
When I do fuzz test for bonding device interface, I got the following use-after-free Calltrace:
==================================================================
BUG: KASAN: use-after-free in bond_enslave+0x1521/0x24f0
Read of size 8 at addr ffff88825bc11c00 by task ifenslave/7365
CPU: 5 PID: 7365 Comm: ifenslave Tainted: G E 5.15.0-rc1+ #13
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
Call Trace:
dump_stack_lvl+0x6c/0x8b
print_address_description.constprop.0+0x48/0x70
kasan_report.cold+0x82/0xdb
__asan_load8+0x69/0x90
bond_enslave+0x1521/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f19159cf577
Code: b3 66 90 48 8b 05 11 89 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 78
RSP: 002b:00007ffeb3083c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffeb3084bca RCX: 00007f19159cf577
RDX: 00007ffeb3083ce0 RSI: 0000000000008990 RDI: 0000000000000003
RBP: 00007ffeb3084bc4 R08: 0000000000000040 R09: 0000000000000000
R10: 00007ffeb3084bc0 R11: 0000000000000246 R12: 00007ffeb3083ce0
R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffeb3083cb0
Allocated by task 7365:
kasan_save_stack+0x23/0x50
__kasan_kmalloc+0x83/0xa0
kmem_cache_alloc_trace+0x22e/0x470
bond_enslave+0x2e1/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
Freed by task 7365:
kasan_save_stack+0x23/0x50
kasan_set_track+0x20/0x30
kasan_set_free_info+0x24/0x40
__kasan_slab_free+0xf2/0x130
kfree+0xd1/0x5c0
slave_kobj_release+0x61/0x90
kobject_put+0x102/0x180
bond_sysfs_slave_add+0x7a/0xa0
bond_enslave+0x11b6/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
Last potentially related work creation:
kasan_save_stack+0x23/0x50
kasan_record_aux_stack+0xb7/0xd0
insert_work+0x43/0x190
__queue_work+0x2e3/0x970
delayed_work_timer_fn+0x3e/0x50
call_timer_fn+0x148/0x470
run_timer_softirq+0x8a8/0xc50
__do_softirq+0x107/0x55f
Second to last potentially related work creation:
kasan_save_stack+0x23/0x50
kasan_record_aux_stack+0xb7/0xd0
insert_work+0x43/0x190
__queue_work+0x2e3/0x970
__queue_delayed_work+0x130/0x180
queue_delayed_work_on+0xa7/0xb0
bond_enslave+0xe25/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
The buggy address belongs to the object at ffff88825bc11c00
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes inside of
1024-byte region [ffff88825bc11c00, ffff88825bc12000)
The buggy address belongs to the page:
page:ffffea00096f0400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25bc10
head:ffffea00096f0400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 ffffea0009a71c08 ffff888240001968 ffff88810004dbc0
raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88825bc11b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88825bc11b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88825bc11c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88825bc11c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88825bc11d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================Put new_slave in bond_sysfs_slave_add() will cause use-after-free problems when new_slave is accessed in the subsequent error handling process. Since new_slave will be put in the subsequent error handling process, remove the unnecessary put to fix it.
In addition, when sysfs_create_file() fails, if some files have been crea- ted successfully, we need to call sysfs_remove_file() to remove them. Since there are sysfs_create_files() & sysfs_remove_files() can be used, use these two functions instead.
--- drivers/net/bonding/bond_sysfs_slave.c | 36 ++++++++------------------ 1 file changed, 11 insertions(+), 25 deletions(-)
drivers/net/bonding/bond_sysfs_slave.c +11 -25
@@ -112,15 +112,15 @@ static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf) }static SLAVE_ATTR_RO (ad_partner_oper_port_state); -static const struct slave_attribute *slave_attrs[] = { - &slave_attr_state, - &slave_attr_mii_status, - &slave_attr_link_failure_count, - &slave_attr_perm_hwaddr, - &slave_attr_queue_id, - &slave_attr_ad_aggregator_id, - &slave_attr_ad_actor_oper_port_state, - &slave_attr_ad_partner_oper_port_state, +static const struct attribute *slave_attrs[] = { + &slave_attr_state.attr, + &slave_attr_mii_status.attr, + &slave_attr_link_failure_count.attr, + &slave_attr_perm_hwaddr.attr, + &slave_attr_queue_id.attr, + &slave_attr_ad_aggregator_id.attr, + &slave_attr_ad_actor_oper_port_state.attr, + &slave_attr_ad_partner_oper_port_state.attr,NULL };
@@ -141,24 +141,10 @@ const struct sysfs_ops slave_sysfs_ops = {int bond_sysfs_slave_add (struct slave *slave) { -const struct slave_attribute **a; -int err; - -for (a = slave_attrs; *a; ++a) { - err =sysfs_create_file (&slave->kobj, &((*a)->attr)); -if (err) { -kobject_put (&slave->kobj); -return err; - } - } - -return 0 ; +return sysfs_create_files (&slave->kobj, slave_attrs); }void bond_sysfs_slave_del (struct slave *slave) { -const struct slave_attribute **a; - -for (a = slave_attrs; *a; ++a) -sysfs_remove_file (&slave->kobj, &((*a)->attr)); +sysfs_remove_files (&slave->kobj, slave_attrs); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 225/323 mm/zsmalloc.c: close race window between zs_pool_dec_isolated() and zs_unregister_migration()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit afe8605ca45424629fdddfd85984b442c763dc47 ]
There is one possible race window between zs_pool_dec_isolated() and zs_unregister_migration() because wait_for_isolated_drain() checks the isolated count without holding class->lock and there is no order inside zs_pool_dec_isolated(). Thus the below race window could be possible:
zs_pool_dec_isolated zs_unregister_migration
check pool->destroying != 0
pool->destroying = true;
smp_mb();
wait_for_isolated_drain()
wait for pool->isolated_pages == 0
atomic_long_dec(&pool->isolated_pages);
atomic_long_read(&pool->isolated_pages) == 0Since we observe the pool->destroying (false) before atomic_long_dec() for pool->isolated_pages, waking pool->migration_wait up is missed.
Fix this by ensure checking pool->destroying happens after the atomic_long_dec(&pool->isolated_pages).
--- mm/zsmalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/zsmalloc.c +4 -3
@@ -1904,10 +1904,11 @@ static inline void zs_pool_dec_isolated(struct zs_pool *pool)VM_BUG_ON (atomic_long_read (&pool->isolated_pages) <=0 );atomic_long_dec (&pool->isolated_pages);/* -* There's no possibility of racing, since wait_for_isolated_drain() -* checks the isolated count under &class->lock after enqueuing -* on migration_wait. +* Checking pool->destroying must happen after atomic_long_dec() +* for pool->isolated_pages above. Paired with the smp_mb() in +* zs_unregister_migration(). */ +smp_mb__after_atomic ();if (atomic_long_read (&pool->isolated_pages) ==0 && pool->destroying)wake_up_all (&pool->migration_wait); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 226/323 zram: off by one in read_block_state()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a88e03cf3d190cf46bc4063a9b7efe87590de5f4 ]
snprintf() returns the number of bytes it would have printed if there were space. But it does not count the NUL terminator. So that means that if "count == copied" then this has already overflowed by one character.
This bug likely isn't super harmful in real life.
--- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
@@ -699,7 +699,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,zram_test_flag (zram, index,ZRAM_WB ) ?'w' :'.' , zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.'); -if (count < copied) { +if (count <= copied) {zram_slot_unlock (zram, index);break ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 227/323 llc: fix out-of-bound array index in llc_sk_dev_hash()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 8ac9dfd58b138f7e82098a4e0a0d46858b12215b ]
Both ifindex and LLC_SK_DEV_HASH_ENTRIES are signed.
This means that (ifindex % LLC_SK_DEV_HASH_ENTRIES) is negative if @ifindex is negative.
We could simply make LLC_SK_DEV_HASH_ENTRIES unsigned.
In this patch I chose to use hash_32() to get more entropy from @ifindex, like llc_sk_laddr_hashfn().
UBSAN: array-index-out-of-bounds in ./include/net/llc.h:75:26 index -43 is out of range for type 'hlist_head [64]' CPU: 1 PID: 20999 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 ubsan_epilogue+0xb/0x5a lib/ubsan.c:151 __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291 llc_sk_dev_hash include/net/llc.h:75 [inline] llc_sap_add_socket+0x49c/0x520 net/llc/llc_conn.c:697 llc_ui_bind+0x680/0xd70 net/llc/af_llc.c:404 __sys_bind+0x1e9/0x250 net/socket.c:1693 __do_sys_bind net/socket.c:1704 [inline] __se_sys_bind net/socket.c:1702 [inline] __x64_sys_bind+0x6f/0xb0 net/socket.c:1702 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fa503407ae9
--- include/net/llc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/net/llc.h +3 -1
@@ -72,7 +72,9 @@ struct llc_sap {static inline struct hlist_head *llc_sk_dev_hash (struct llc_sap *sap,int ifindex) { -return &sap->sk_dev_hash[ifindex %LLC_SK_DEV_HASH_ENTRIES ]; +u32 bucket =hash_32 (ifindex,LLC_SK_DEV_HASH_BITS ); + +return &sap->sk_dev_hash[bucket]; } static inline
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 228/323 nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit 9fec40f850658e00a14a7dd9e06f7fbc7e59cc4a ]
skb is already freed by dev_kfree_skb in pn533_fill_fragment_skbs, but follow error handler branch when pn533_fill_fragment_skbs() fails, skb is freed again, results in double free issue. Fix this by not free skb in error path of pn533_fill_fragment_skbs.
--- drivers/nfc/pn533/pn533.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nfc/pn533/pn533.c +3 -3
@@ -2084,7 +2084,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) frag =pn533_alloc_skb (dev, frag_size);if (!frag) {skb_queue_purge (&dev->fragment_skb); -break ; +return -ENOMEM ; }if (!dev->tgt_mode) {
@@ -2154,7 +2154,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,/* jumbo frame ? */ if (skb->len >PN533_CMD_DATAEXCH_DATA_MAXLEN ) { rc =pn533_fill_fragment_skbs (dev, skb); -if (rc <=0 ) +if (rc <0 ) goto error; skb =skb_dequeue (&dev->fragment_skb);
@@ -2226,7 +2226,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)/* let's split in multiple chunks if size's too big */ if (skb->len >PN533_CMD_DATAEXCH_DATA_MAXLEN ) { rc =pn533_fill_fragment_skbs (dev, skb); -if (rc <=0 ) +if (rc <0 ) goto error;/* get the first skb */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 229/323 arm64: pgtable: make __pte_to_phys/__phys_to_pte_val inline functions
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c7c386fbc20262c1d911c615c65db6a58667d92c ]
gcc warns about undefined behavior the vmalloc code when building with CONFIG_ARM64_PA_BITS_52, when the 'idx++' in the argument to __phys_to_pte_val() is evaluated twice:
mm/vmalloc.c: In function 'vmap_pfn_apply':mm/vmalloc.c:2800:58: error: operation on 'data->idx' may be undefined [-Werror=sequence-point]
2800 | *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
| ~~~~~~~~~^~arch/arm64/include/asm/pgtable-types.h:25:37: note: in definition of macro '__pte'
25 | #define __pte(x) ((pte_t) { (x) } )
| ^arch/arm64/include/asm/pgtable.h:80:15: note: in expansion of macro '__phys_to_pte_val'
80 | __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
| ^~~~~~~~~~~~~~~~~
mm/vmalloc.c:2800:30: note: in expansion of macro 'pfn_pte'
2800 | *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
| ^~~~~~~
I have no idea why this never showed up earlier, but the safest workaround appears to be changing those macros into inline functions so the arguments get evaluated only once.
--- arch/arm64/include/asm/pgtable.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm64/include/asm/pgtable.h +9 -3
@@ -64,9 +64,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];* page table entry, taking care of 52-bit addresses. */ #ifdef CONFIG_ARM64_PA_BITS_52 -#define __pte_to_phys (pte) \ - ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36)) -#define __phys_to_pte_val (phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK) +static inline phys_addr_t __pte_to_phys (pte_t pte) +{ +return (pte_val (pte) &PTE_ADDR_LOW ) | + ((pte_val (pte) &PTE_ADDR_HIGH ) <<36 ); +} +static inline pteval_t __phys_to_pte_val (phys_addr_t phys) +{ +return (phys | (phys >>36 )) &PTE_ADDR_MASK ; +}#else #define __pte_to_phys (pte) (pte_val(pte) & PTE_ADDR_MASK)#define __phys_to_pte_val (phys) (phys)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 230/323 vsock: prevent unnecessary refcnt inc for nonblocking connect
In reply to Greg Kroah-HartmanFrom: Eiichi Tsukata <[email protected]>
[ Upstream commit c7cd82b90599fa10915f41e3dd9098a77d0aa7b6 ]
Currently vosck_connect() increments sock refcount for nonblocking socket each time it's called, which can lead to memory leak if it's called multiple times because connect timeout function decrements sock refcount only once.
Fixes it by making vsock_connect() return -EALREADY immediately when sock state is already SS_CONNECTING.
--- net/vmw_vsock/af_vsock.c | 2 ++ 1 file changed, 2 insertions(+)
net/vmw_vsock/af_vsock.c +2 -0
@@ -1159,6 +1159,8 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,* non-blocking call. */ err = -EALREADY ; +if (flags &O_NONBLOCK ) + goto out;break ;default : if ((sk->sk_state == TCP_LISTEN) ||
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 231/323 cxgb4: fix eeprom len when diagnostics not implemented
In reply to Greg Kroah-HartmanFrom: Rahul Lakkireddy <[email protected]>
[ Upstream commit 4ca110bf8d9b31a60f8f8ff6706ea147d38ad97c ]
Ensure diagnostics monitoring support is implemented for the SFF 8472 compliant port module and set the correct length for ethtool port module eeprom read.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 7 +++++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +5 -2
@@ -1304,12 +1304,15 @@ static int cxgb4_get_module_info(struct net_device *dev,if (ret)return ret; -if (!sff8472_comp || (sff_diag_type &4 )) { +if (!sff8472_comp || (sff_diag_type &SFP_DIAG_ADDRMODE )) { modinfo->type =ETH_MODULE_SFF_8079 ; modinfo->eeprom_len =ETH_MODULE_SFF_8079_LEN ; }else { modinfo->type =ETH_MODULE_SFF_8472 ; - modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN ; +if (sff_diag_type &SFP_DIAG_IMPLEMENTED ) + modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN ; +else + modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN /2 ; }break ;
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +2 -0
@@ -292,6 +292,8 @@ enum {#define I2C_PAGE_SIZE 0x100#define SFP_DIAG_TYPE_ADDR 0x5c#define SFP_DIAG_TYPE_LEN 0x1 +#define SFP_DIAG_ADDRMODE BIT(2) +#define SFP_DIAG_IMPLEMENTED BIT(6)#define SFF_8472_COMP_ADDR 0x5e#define SFF_8472_COMP_LEN 0x1#define SFF_REV_ADDR 0x1
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 232/323 USB: chipidea: fix interrupt deadlock
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9aaa81c3366e8393a62374e3a1c67c69edc07b8a upstream.
Chipidea core was calling the interrupt handler from non-IRQ context with interrupts enabled, something which can lead to a deadlock if there's an actual interrupt trying to take a lock that's already held (e.g. the controller lock in udc_irq()).
Add a wrapper that can be used to fake interrupts instead of calling the handler directly.
--- drivers/usb/chipidea/core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/usb/chipidea/core.c +14 -5
@@ -532,7 +532,7 @@ int hw_device_reset(struct ci_hdrc *ci)return 0 ; } -static irqreturn_t ci_irq (int irq,void *data) +static irqreturn_t ci_irq_handler (int irq,void *data) {struct ci_hdrc *ci = data;irqreturn_t ret =IRQ_NONE ;
@@ -585,6 +585,15 @@ static irqreturn_t ci_irq(int irq, voidreturn ret; } +static void ci_irq (struct ci_hdrc *ci) +{ +unsigned long flags; + +local_irq_save (flags); +ci_irq_handler (ci->irq, ci); +local_irq_restore (flags); +} +static int ci_cable_notifier (struct notifier_block *nb,unsigned long event,void *ptr) {
@@ -594,7 +603,7 @@ static int ci_cable_notifier(struct noti cbl->connected = event; cbl->changed = true; -ci_irq (ci->irq, ci); +ci_irq (ci);return NOTIFY_DONE ; }
@@ -1048,7 +1057,7 @@ static int ci_hdrc_probe(struct platform } } - ret =devm_request_irq (dev, ci->irq, ci_irq,IRQF_SHARED , + ret =devm_request_irq (dev, ci->irq, ci_irq_handler,IRQF_SHARED , ci->platdata->name, ci);if (ret) goto stop;
@@ -1170,11 +1179,11 @@ static void ci_extcon_wakeup_int(structif (!IS_ERR (cable_id->edev) && ci->is_otg && (otgsc &OTGSC_IDIE ) && (otgsc &OTGSC_IDIS )) -ci_irq (ci->irq, ci); +ci_irq (ci);if (!IS_ERR (cable_vbus->edev) && ci->is_otg && (otgsc &OTGSC_BSVIE ) && (otgsc &OTGSC_BSVIS )) -ci_irq (ci->irq, ci); +ci_irq (ci); }static int ci_controller_resume (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 233/323 ARM: 9155/1: fix early early_iounmap()
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit 0d08e7bf0d0d1a29aff7b16ef516f7415eb1aa05 upstream.
Currently __set_fixmap() bails out with a warning when called in early boot from early_iounmap(). Fix it, and while at it, make the comment a bit easier to understand.
--- arch/arm/mm/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mm/mmu.c +2 -2
@@ -416,9 +416,9 @@ void __set_fixmap(enum fixed_addresses i FIXADDR_END);BUG_ON (idx >= __end_of_fixed_addresses); -/* we only support device mappings until pgprot_kernel has been set */ +/* We support only device mappings before pgprot_kernel is set. */ if (WARN_ON (pgprot_val (prot) !=pgprot_val (FIXMAP_PAGE_IO ) && -pgprot_val (pgprot_kernel) ==0 )) +pgprot_val (prot) &&pgprot_val (pgprot_kernel) ==0 ))return ;if (pgprot_val (prot))
Greg Kroah-Hartman
maintainerPATCH 234/323 ARM: 9156/1: drop cc-option fallbacks for architecture selection
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 418ace9992a7647c446ed3186df40cf165b67298 upstream.
Naresh and Antonio ran into a build failure with latest Debian armhf compilers, with lots of output like
tmp/ccY3nOAs.s:2215: Error: selected processor does not support `cpsid i' in ARM mode
As it turns out, $(cc-option) fails early here when the FPU is not selected before CPU architecture is selected, as the compiler option check runs before enabling -msoft-float, which causes a problem when testing a target architecture level without an FPU:
cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
Passing e.g. -march=armv6k+fp in place of -march=armv6k would avoid this issue, but the fallback logic is already broken because all supported compilers (gcc-5 and higher) are much more recent than these options, and building with -march=armv5t as a fallback no longer works.
The best way forward that I see is to just remove all the checks, which also has the nice side-effect of slightly improving the startup time for 'make'.
The -mtune=marvell-f option was apparently never supported by any mainline compiler, and the custom Codesourcery gcc build that did support is now too old to build kernels, so just use -mtune=xscale unconditionally for those.
This should be safe to apply on all stable kernels, and will be required in order to keep building them with gcc-11 and higher.
--- arch/arm/Makefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/arm/Makefile +11 -11
@@ -63,15 +63,15 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes # testing for a specific architecture or later rather impossible. -arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m -arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) -arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) +arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m +arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -march=armv7-a +arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 -march=armv6 # Only override the compiler option if ARMv6. The ARMv6K extensions are # always available in ARMv7 ifeq ($(CONFIG_CPU_32v6),y) -arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k) +arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 -march=armv6k endif -arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) +arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 -march=armv5te arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4 arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3
@@ -85,7 +85,7 @@ tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7t tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi -tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi) +tune-$(CONFIG_CPU_ARM946E) =-mtune=arm9e tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
@@ -93,11 +93,11 @@ tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9t tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110 tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100 -tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale -tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale -tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale) -tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) -tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) +tune-$(CONFIG_CPU_XSCALE) =-mtune=xscale +tune-$(CONFIG_CPU_XSC3) =-mtune=xscale +tune-$(CONFIG_CPU_FEROCEON) =-mtune=xscale +tune-$(CONFIG_CPU_V6) =-mtune=arm1136j-s +tune-$(CONFIG_CPU_V6K) =-mtune=arm1136j-s # Evaluate tune cc-option calls now tune-y := $(tune-y)
Greg Kroah-Hartman
maintainerPATCH 235/323 f2fs: should use GFP_NOFS for directory inodes
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 92d602bc7177325e7453189a22e0c8764ed3453e upstream.
We use inline_dentry which requires to allocate dentry page when adding a link. If we allow to reclaim memory from filesystem, we do down_read(&sbi->cp_rwsem) twice by f2fs_lock_op(). I think this should be okay, but how about stopping the lockdep complaint [1]?
f2fs_create()
- f2fs_lock_op()
- f2fs_do_add_link()
- __f2fs_find_entry
- f2fs_get_read_data_page()
-> kswapd
- shrink_node
- f2fs_evict_inode
- f2fs_lock_op()
[1]
fs_reclaim
){+.+.}-{0:0}
:
kswapd0: lock_acquire+0x114/0x394 kswapd0: __fs_reclaim_acquire+0x40/0x50 kswapd0: prepare_alloc_pages+0x94/0x1ec kswapd0: __alloc_pages_nodemask+0x78/0x1b0 kswapd0: pagecache_get_page+0x2e0/0x57c kswapd0: f2fs_get_read_data_page+0xc0/0x394 kswapd0: f2fs_find_data_page+0xa4/0x23c kswapd0: find_in_level+0x1a8/0x36c kswapd0: __f2fs_find_entry+0x70/0x100 kswapd0: f2fs_do_add_link+0x84/0x1ec kswapd0: f2fs_mkdir+0xe4/0x1e4 kswapd0: vfs_mkdir+0x110/0x1c0 kswapd0: do_mkdirat+0xa4/0x160 kswapd0: __arm64_sys_mkdirat+0x24/0x34 kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 kswapd0: do_el0_svc+0x28/0xa0 kswapd0: el0_svc+0x24/0x38 kswapd0: el0_sync_handler+0x88/0xec kswapd0: el0_sync+0x1c0/0x200
kswapd0:
-> #1
(&sbi->cp_rwsem
){++++}-{3:3}
:
kswapd0: lock_acquire+0x114/0x394 kswapd0: down_read+0x7c/0x98 kswapd0: f2fs_do_truncate_blocks+0x78/0x3dc kswapd0: f2fs_truncate+0xc8/0x128 kswapd0: f2fs_evict_inode+0x2b8/0x8b8 kswapd0: evict+0xd4/0x2f8 kswapd0: iput+0x1c0/0x258 kswapd0: do_unlinkat+0x170/0x2a0 kswapd0: __arm64_sys_unlinkat+0x4c/0x68 kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 kswapd0: do_el0_svc+0x28/0xa0 kswapd0: el0_svc+0x24/0x38 kswapd0: el0_sync_handler+0x88/0xec kswapd0: el0_sync+0x1c0/0x200
--- fs/f2fs/inode.c | 2 +- fs/f2fs/namei.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/inode.c +1 -1
@@ -454,7 +454,7 @@ make_now: inode->i_op = &f2fs_dir_inode_operations; inode->i_fop = &f2fs_dir_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -inode_nohighmem (inode); +mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS ); }else if (S_ISLNK (inode->i_mode)) {if (f2fs_encrypted_inode (inode)) inode->i_op = &f2fs_encrypted_symlink_inode_operations;
fs/f2fs/namei.c +1 -1
@@ -656,7 +656,7 @@ static int f2fs_mkdir(struct inode *dir, inode->i_op = &f2fs_dir_inode_operations; inode->i_fop = &f2fs_dir_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -inode_nohighmem (inode); +mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS );set_inode_flag (inode,FI_INC_LINK );f2fs_lock_op (sbi);
Greg Kroah-Hartman
maintainerPATCH 236/323 9p/net: fix missing error check in p9_check_errors
In reply to Greg Kroah-HartmanFrom: Dominique Martinet <[email protected]>
commit 27eb4c3144f7a5ebef3c9a261d80cb3e1fa784dc upstream.
--- net/9p/client.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/client.c +2 -0
@@ -553,6 +553,8 @@ static int p9_check_errors(struct p9_clikfree (ename); }else { err =p9pdu_readf (&req->rc, c->proto_version,"d" , &ecode); +if (err) + goto out_err; err = -ecode;p9_debug (P9_DEBUG_9P ,"<<< RLERROR (%d)\n" , -ecode);
Greg Kroah-Hartman
maintainerPATCH 237/323 powerpc/lib: Add helper to check if offset is within conditional branch range
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 4549c3ea3160fa8b3f37dfe2f957657bb265eda9
Add a helper to check if a given offset is within the branch range for a powerpc conditional branch instruction, and update some sites to use the new helper.
--- arch/powerpc/include/asm/code-patching.h | 1 + arch/powerpc/lib/code-patching.c | 7 ++++++- arch/powerpc/net/bpf_jit.h | 7 +------ 3 files changed, 8 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/code-patching.h +1 -0
@@ -26,6 +26,7 @@#define BRANCH_ABSOLUTE 0x2bool is_offset_in_branch_range (long offset); +bool is_offset_in_cond_branch_range (long offset);unsigned int create_branch (const unsigned int *addr,unsigned long target,int flags); unsigned int create_cond_branch(const unsigned int *addr,
arch/powerpc/lib/code-patching.c +6 -1
@@ -243,6 +243,11 @@ bool is_offset_in_branch_range(long offsreturn (offset >=-0x2000000 && offset <=0x1fffffc && !(offset &0x3 )); } +bool is_offset_in_cond_branch_range (long offset) +{ +return offset >=-0x8000 && offset <=0x7fff && !(offset &0x3 ); +} +/* * Helper to check if a given instruction is a conditional branch * Derived from the conditional checks in analyse_instr()
@@ -296,7 +301,7 @@ unsigned int create_cond_branch(const un offset = offset - (unsigned long )addr;/* Check we can represent the target in the instruction format */ -if (offset <-0x8000 || offset >0x7FFF || offset &0x3 ) +if (!is_offset_in_cond_branch_range (offset))return 0 ;/* Mask out the flags and target, so they don't step on each other. */
arch/powerpc/net/bpf_jit.h +1 -6
@@ -221,11 +221,6 @@#define PPC_FUNC_ADDR (d,i) do { PPC_LI32(d, i); } while(0)#endif -static inline bool is_nearbranch (int offset) -{ -return (offset <32768 ) && (offset >=-32768 ); -} -/* * The fly in the ointment of code size changing from pass to pass is * avoided by padding the short branch case with a NOP. If code size differs
@@ -234,7 +229,7 @@ static inline bool is_nearbranch(int off* state. */ #define PPC_BCC (cond, dest) do { \ - if (is_nearbranch((dest) - (ctx->idx * 4))) { \ + if (is_offset_in_cond_branch_range((long)(dest) - (ctx->idx * 4))) { \ PPC_BCC_SHORT(cond, dest); \ PPC_NOP(); \ } else { \
Greg Kroah-Hartman
maintainerPATCH 238/323 powerpc/bpf: Validate branch ranges
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 3832ba4e283d7052b783dab8311df7e3590fed93
Add checks to ensure that we never emit branch instructions with truncated branch offsets.
--- arch/powerpc/net/bpf_jit.h | 26 ++++++++++++++++++++------ arch/powerpc/net/bpf_jit_comp64.c | 10 +++++++--- 2 files changed, 27 insertions(+), 9 deletions(-)
arch/powerpc/net/bpf_jit.h +20 -6
@@ -15,6 +15,7 @@#ifndef __ASSEMBLY__#include <asm/types.h> +#include <asm/code-patching.h> #ifdef PPC64_ELF_ABI_v1#define FUNCTION_DESCR_SIZE 24
@@ -176,13 +177,26 @@#define PPC_NEG (d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))/* Long jump; (unconditional 'branch') */ -#define PPC_JMP (dest) EMIT(PPC_INST_BRANCH | \ - (((dest) - (ctx->idx * 4)) & 0x03fffffc)) +#define PPC_JMP (dest) \ + do { \ + long offset = (long)(dest) - (ctx->idx * 4); \ + if (!is_offset_in_branch_range(offset)) { \ + pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ + return -ERANGE; \ + } \ + EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc)); \ + } while (0)/* "cond" here covers BO:BI fields. */ -#define PPC_BCC_SHORT (cond, dest) EMIT(PPC_INST_BRANCH_COND | \ - (((cond) & 0x3ff) << 16) | \ - (((dest) - (ctx->idx * 4)) & \ - 0xfffc)) +#define PPC_BCC_SHORT (cond, dest) \ + do { \ + long offset = (long)(dest) - (ctx->idx * 4); \ + if (!is_offset_in_cond_branch_range(offset)) { \ + pr_err_ratelimited("Conditional branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ + return -ERANGE; \ + } \ + EMIT(PPC_INST_BRANCH_COND | (((cond) & 0x3ff) << 16) | (offset & 0xfffc)); \ + } while (0) +/* Sign-extended 32-bit immediate load */ #define PPC_LI32 (d, i) do { \ if ((int)(uintptr_t)(i) >= -32768 && \
arch/powerpc/net/bpf_jit_comp64.c +7 -3
@@ -202,7 +202,7 @@ static void bpf_jit_emit_func_call(u32 *PPC_BLRL (); } -static void bpf_jit_emit_tail_call (u32 *image,struct codegen_context *ctx,u32 out) +static int bpf_jit_emit_tail_call (u32 *image,struct codegen_context *ctx,u32 out) {/* * By now, the eBPF program has already setup parameters in r3, r4 and r5
@@ -263,7 +263,9 @@ static void bpf_jit_emit_tail_call(u32 *bpf_jit_emit_common_epilogue (image, ctx);PPC_BCTR (); +/* out: */ +return 0 ; }/* Assemble the body code between the prologue & epilogue */
@@ -273,7 +275,7 @@ static int bpf_jit_build_body(struct bpf {const struct bpf_insn *insn = fp->insnsi;int flen = fp->len; -int i; +int i, ret;/* Start of epilogue code - will only be valid 2nd pass onwards */ u32 exit_addr = addrs[flen];
@@ -863,7 +865,9 @@ cond_branch:*/ case BPF_JMP |BPF_TAIL_CALL : ctx->seen |=SEEN_TAILCALL ; -bpf_jit_emit_tail_call (image, ctx, addrs[i +1 ]); + ret =bpf_jit_emit_tail_call (image, ctx, addrs[i +1 ]); +if (ret <0 ) +return ret;break ;default :
Greg Kroah-Hartman
maintainerPATCH 239/323 powerpc/bpf: Fix BPF_SUB when imm == 0x80000000
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 5855c4c1f415ca3ba1046e77c0b3d3dfc96c9025
We aren't handling subtraction involving an immediate value of 0x80000000 properly. Fix the same.
--- arch/powerpc/net/bpf_jit_comp64.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/powerpc/net/bpf_jit_comp64.c +17 -10
@@ -326,18 +326,25 @@ static int bpf_jit_build_body(struct bpfPPC_SUB (dst_reg, dst_reg, src_reg); goto bpf_alu32_trunc;case BPF_ALU |BPF_ADD |BPF_K :/* (u32) dst += (u32) imm */ -case BPF_ALU |BPF_SUB |BPF_K :/* (u32) dst -= (u32) imm */ case BPF_ALU64 |BPF_ADD |BPF_K :/* dst += imm */ +if (!imm) { + goto bpf_alu32_trunc; + }else if (imm >=-32768 && imm <32768 ) { +PPC_ADDI (dst_reg, dst_reg,IMM_L (imm)); + }else { +PPC_LI32 (b2p[TMP_REG_1 ], imm); +PPC_ADD (dst_reg, dst_reg, b2p[TMP_REG_1 ]); + } + goto bpf_alu32_trunc; +case BPF_ALU |BPF_SUB |BPF_K :/* (u32) dst -= (u32) imm */ case BPF_ALU64 |BPF_SUB |BPF_K :/* dst -= imm */ -if (BPF_OP (code) ==BPF_SUB ) - imm = -imm; -if (imm) { -if (imm >=-32768 && imm <32768 ) -PPC_ADDI (dst_reg, dst_reg,IMM_L (imm)); -else { -PPC_LI32 (b2p[TMP_REG_1 ], imm); -PPC_ADD (dst_reg, dst_reg, b2p[TMP_REG_1 ]); - } +if (!imm) { + goto bpf_alu32_trunc; + }else if (imm >-32768 && imm <=32768 ) { +PPC_ADDI (dst_reg, dst_reg,IMM_L (-imm)); + }else { +PPC_LI32 (b2p[TMP_REG_1 ], imm); +PPC_SUB (dst_reg, dst_reg, b2p[TMP_REG_1 ]); } goto bpf_alu32_trunc;case BPF_ALU |BPF_MUL |BPF_X :/* (u32) dst *= (u32) src */
Greg Kroah-Hartman
maintainerPATCH 240/323 powerpc/security: Add a helper to query stf_barrier type
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 030905920f32e91a52794937f67434ac0b3ea41a
Add a helper to return the stf_barrier type for the current processor.
--- arch/powerpc/include/asm/security_features.h | 5 +++++ arch/powerpc/kernel/security.c | 5 +++++ 2 files changed, 10 insertions(+)
arch/powerpc/include/asm/security_features.h +5 -0
@@ -39,6 +39,11 @@ static inline bool security_ftr_enabled(return !!(powerpc_security_features & feature); } +#ifdef CONFIG_PPC_BOOK3S_64 +enum stf_barrier_type stf_barrier_type_get (void ); +#else +static inline enum stf_barrier_type stf_barrier_type_get (void ) {return STF_BARRIER_NONE ; } +#endif // Features indicating support for Spectre/Meltdown mitigations
arch/powerpc/kernel/security.c +5 -0
@@ -248,6 +248,11 @@ static int __init handle_no_stf_barrier(early_param ("no_stf_barrier" , handle_no_stf_barrier); +enum stf_barrier_type stf_barrier_type_get (void ) +{ +return stf_enabled_flush_types; +} +/* This is the generic flag used by other architectures */ static int __init handle_ssbd (char *p) {
Greg Kroah-Hartman
maintainerPATCH 241/323 powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit b7540d62509453263604a155bf2d5f0ed450cba2
Emit similar instruction sequences to commit a048a07d7f4535 ("powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit") when encountering BPF_NOSPEC.
Mitigations are enabled depending on what the firmware advertises. In particular, we do not gate these mitigations based on current settings, just like in x86. Due to this, we don't need to take any action if mitigations are enabled or disabled at runtime.
[adjust macros to account for commits 0654186510a40e, 3a181237916310 and ef909ba954145e. adjust security feature checks to account for commit 84ed26fd00c514]
--- arch/powerpc/net/bpf_jit64.h | 8 ++--- arch/powerpc/net/bpf_jit_comp64.c | 56 +++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-)
arch/powerpc/net/bpf_jit64.h +4 -4
@@ -20,18 +20,18 @@* with our redzone usage. * * [ prev sp ] <------------- -* [ nv gpr save area ] 6*8 | +* [ nv gpr save area ] 5*8 | * [ tail_call_cnt ] 8 | -* [ local_tmp_var ] 8 | +* [ local_tmp_var ] 16 | * fp (r31) --> [ ebpf stack space ] upto 512 | * [ frame header ] 32/112 | * sp (r1) ---> [ stack pointer ] -------------- */ /* for gpr non volatile registers BPG_REG_6 to 10 */ -#define BPF_PPC_STACK_SAVE (6*8) +#define BPF_PPC_STACK_SAVE (5*8)/* for bpf JIT code internal usage */ -#define BPF_PPC_STACK_LOCALS 16 +#define BPF_PPC_STACK_LOCALS 24/* stack frame excluding BPF stack, ensure this is quadword aligned */ #define BPF_PPC_STACKFRAME (STACK_FRAME_MIN_SIZE + \ BPF_PPC_STACK_LOCALS + BPF_PPC_STACK_SAVE)
arch/powerpc/net/bpf_jit_comp64.c +52 -4
96 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 242/323 mm, oom: pagefault_out_of_memory: dont force global OOM for dying tasks
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
commit 0b28179a6138a5edd9d82ad2687c05b3773c387b upstream.
Patch series "memcg: prohibit unconditional exceeding the limit of dying tasks", v3.
Memory cgroup charging allows killed or exiting tasks to exceed the hard limit. It can be misused and allowed to trigger global OOM from inside a memcg-limited container. On the other hand if memcg fails allocation, called from inside #PF handler it triggers global OOM from inside pagefault_out_of_memory().
To prevent these problems this patchset:
(a) removes execution of out_of_memory() from pagefault_out_of_memory(), becasue nobody can explain why it is necessary.
(b) allow memcg to fail allocation of dying/killed tasks.
This patch (of 3):
Any allocation failure during the #PF path will return with VM_FAULT_OOM which in turn results in pagefault_out_of_memory which in turn executes out_out_memory() and can kill a random task.
An allocation might fail when the current task is the oom victim and there are no memory reserves left. The OOM killer is already handled at the page allocator level for the global OOM and at the charging level for the memcg one. Both have much more information about the scope of allocation/charge request. This means that either the OOM killer has been invoked properly and didn't lead to the allocation success or it has been skipped because it couldn't have been invoked. In both cases triggering it from here is pointless and even harmful.
It makes much more sense to let the killed task die rather than to wake up an eternally hungry oom-killer and send him to choose a fatter victim for breakfast.
--- mm/oom_kill.c | 3 +++ 1 file changed, 3 insertions(+)
mm/oom_kill.c +3 -0
@@ -1152,6 +1152,9 @@ void pagefault_out_of_memory(void)if (mem_cgroup_oom_synchronize (true))return ; +if (fatal_signal_pending (current)) +return ; +if (!mutex_trylock (&oom_lock))return ;out_of_memory (&oc);
Greg Kroah-Hartman
maintainerPATCH 243/323 mm, oom: do not trigger out_of_memory from the #PF
In reply to Greg Kroah-HartmanFrom: Michal Hocko <[email protected]>
commit 60e2793d440a3ec95abb5d6d4fc034a4b480472d upstream.
Any allocation failure during the #PF path will return with VM_FAULT_OOM which in turn results in pagefault_out_of_memory. This can happen for 2 different reasons. a) Memcg is out of memory and we rely on mem_cgroup_oom_synchronize to perform the memcg OOM handling or b) normal allocation fails.
The latter is quite problematic because allocation paths already trigger out_of_memory and the page allocator tries really hard to not fail allocations. Anyway, if the OOM killer has been already invoked there is no reason to invoke it again from the #PF path. Especially when the OOM condition might be gone by that time and we have no way to find out other than allocate.
Moreover if the allocation failed and the OOM killer hasn't been invoked then we are unlikely to do the right thing from the #PF context because we have already lost the allocation context and restictions and therefore might oom kill a task from a different NUMA domain.
This all suggests that there is no legitimate reason to trigger out_of_memory from pagefault_out_of_memory so drop it. Just to be sure that no #PF path returns with VM_FAULT_OOM without allocation print a warning that this is happening before we restart the #PF.
[VvS: #PF allocation can hit into limit of cgroup v1 kmem controller. This is a local problem related to memcg, however, it causes unnecessary global OOM kills that are repeated over and over again and escalate into a real disaster. This has been broken since kmem accounting has been introduced for cgroup v1 (3.8). There was no kmem specific reclaim for the separate limit so the only way to handle kmem hard limit was to return with ENOMEM. In upstream the problem will be fixed by removing the outdated kmem limit, however stable and LTS kernels cannot do it and are still affected. This patch fixes the problem and should be backported into stable/LTS.]
--- mm/oom_kill.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
mm/oom_kill.c +8 -14
@@ -1135,19 +1135,15 @@ bool out_of_memory(struct oom_control *o }/* -* The pagefault handler calls here because it is out of memory, so kill a -* memory-hogging task. If oom_lock is held by somebody else, a parallel oom -* killing is already in progress so do nothing. +* The pagefault handler calls here because some allocation has failed. We have +* to take care of the memcg OOM here because this is the only safe context without +* any locks held but let the oom killer triggered from the allocation context care +* about the global OOM. */ void pagefault_out_of_memory (void ) { -struct oom_control oc = { - .zonelist =NULL , - .nodemask =NULL , - .memcg =NULL , - .gfp_mask =0 , - .order =0 , - }; + static DEFINE_RATELIMIT_STATE(pfoom_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST);if (mem_cgroup_oom_synchronize (true))return ;
@@ -1155,8 +1151,6 @@ void pagefault_out_of_memory(void)if (fatal_signal_pending (current))return ; -if (!mutex_trylock (&oom_lock)) -return ; -out_of_memory (&oc); -mutex_unlock (&oom_lock); +if (__ratelimit (&pfoom_rs)) +pr_warn ("Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF\n" ); }
Greg Kroah-Hartman
maintainerPATCH 244/323 backlight: gpio-backlight: Correct initial power state handling
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
commit ec665b756e6f79c60078b00dbdabea3aa8a4b787 upstream.
The default-on property - or the def_value via legacy pdata) should be handled as:
if it is 1, the backlight must be enabled (kept enabled)
if it is 0, the backlight must be disabled (kept disabled)
This only works for the case when default-on is set. If it is not set then the brightness of the backlight is set to 0. Now if the backlight is enabled by external driver (graphics) the backlight will stay disabled since the brightness is configured as 0. The backlight will not turn on.
In order to minimize screen flickering during device boot:
The initial brightness should be set to 1.
If booted in non DT mode or no phandle link to the backlight node:
follow the def_value/default-on to select UNBLANK or POWERDOWN
If in DT boot we have phandle link then leave the GPIO in a state which the bootloader left it and let the user of the backlight to configure it further.
--- drivers/video/backlight/gpio_backlight.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/video/backlight/gpio_backlight.c +20 -4
@@ -62,13 +62,11 @@ static int gpio_backlight_probe_dt(struc {struct device *dev = &pdev->dev;struct device_node *np = dev->of_node; -enum gpiod_flags flags;int ret; gbl->def_value =of_property_read_bool (np,"default-on" ); - flags = gbl->def_value ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ; - gbl->gpiod =devm_gpiod_get (dev,NULL , flags); + gbl->gpiod =devm_gpiod_get (dev,NULL ,GPIOD_ASIS );if (IS_ERR (gbl->gpiod)) { ret =PTR_ERR (gbl->gpiod);
@@ -82,6 +80,22 @@ static int gpio_backlight_probe_dt(strucreturn 0 ; } +static int gpio_backlight_initial_power_state (struct gpio_backlight *gbl) +{ +struct device_node *node = gbl->dev->of_node; + +/* Not booted with device tree or no phandle link to the node */ +if (!node || !node->phandle) +return gbl->def_value ?FB_BLANK_UNBLANK :FB_BLANK_POWERDOWN ; + +/* if the enable GPIO is disabled, do not enable the backlight */ +if (gpiod_get_value_cansleep (gbl->gpiod) ==0 ) +return FB_BLANK_POWERDOWN ; + +return FB_BLANK_UNBLANK ; +} + +static int gpio_backlight_probe (struct platform_device *pdev) { struct gpio_backlight_platform_data *pdata =
@@ -142,7 +156,9 @@ static int gpio_backlight_probe(struct preturn PTR_ERR (bl); } - bl->props.brightness = gbl->def_value; + bl->props.power =gpio_backlight_initial_power_state (gbl); + bl->props.brightness =1 ; +backlight_update_status (bl);platform_set_drvdata (pdev, bl);
Greg Kroah-Hartman
maintainerPATCH 245/323 video: backlight: Drop maximum brightness override for brightness zero
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
commit 33a5471f8da976bf271a1ebbd6b9d163cb0cb6aa upstream.
The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c") says that gpio-backlight uses brightness as power state. This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight:
Correct initial power state handling") and other backlight drivers do not require this workaround. Drop the workaround.
This fixes the case where e.g. pwm-backlight can perfectly well be set to brightness 0 on boot in DT, which without this patch leads to the display brightness to be max instead of off.
--- drivers/video/backlight/backlight.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/video/backlight/backlight.c +0 -6
@@ -610,12 +610,6 @@ struct backlight_device *of_find_backligof_node_put (np);if (!bd)return ERR_PTR (-EPROBE_DEFER ); -/* -* Note: gpio_backlight uses brightness as -* power state during probe -*/ -if (!bd->props.brightness) - bd->props.brightness = bd->props.max_brightness; } }
Greg Kroah-Hartman
maintainerPATCH 246/323 s390/cio: check the subchannel validity for dev_busid
In reply to Greg Kroah-HartmanFrom: Vineeth Vijayan <[email protected]>
commit a4751f157c194431fae9e9c493f456df8272b871 upstream.
Check the validity of subchanel before reading other fields in the schib.
--- drivers/s390/cio/css.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/css.c +2 -2
@@ -371,8 +371,8 @@ static ssize_t dev_busid_show(struct devstruct subchannel *sch =to_subchannel (dev);struct pmcw *pmcw = &sch->schib.pmcw; -if ((pmcw->st ==SUBCHANNEL_TYPE_IO || - pmcw->st ==SUBCHANNEL_TYPE_MSG ) && pmcw->dnv) +if ((pmcw->st ==SUBCHANNEL_TYPE_IO && pmcw->dnv) || + (pmcw->st ==SUBCHANNEL_TYPE_MSG && pmcw->w))return sysfs_emit (buf,"0.%x.%04x\n" , sch->schid.ssid, pmcw->dev);else
Greg Kroah-Hartman
maintainerPATCH 247/323 s390/tape: fix timer initialization in tape_std_assign()
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit 213fca9e23b59581c573d558aa477556f00b8198 upstream.
commit 9c6c273aa424 ("timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()") changed the timer setup from init_timer_on_stack(() to timer_setup(), but missed to change the mod_timer() call. And while at it, use msecs_to_jiffies() instead of the open coded timeout calculation.
--- drivers/s390/char/tape_std.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/char/tape_std.c +1 -2
@@ -53,7 +53,6 @@ int tape_std_assign(struct tape_device *device) {int rc; -struct timer_list timeout;struct tape_request *request; request =tape_alloc_request (2 ,11 );
@@ -70,7 +69,7 @@ tape_std_assign(struct tape_device *devi* So we set up a timeout for this call. */ timer_setup (&request->timer, tape_std_assign_timeout,0 ); -mod_timer (&timeout, jiffies +2 *HZ ); +mod_timer (&request->timer, jiffies +msecs_to_jiffies (2000 )); rc =tape_do_io_interruptible (device, request);
Greg Kroah-Hartman
maintainerPATCH 248/323 PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 460275f124fb072dca218a6b43b6370eebbab20d upstream.
Define a macro PCI_EXP_DEVCTL_PAYLOAD_* for every possible Max Payload Size in linux/pci_regs.h, in the same style as PCI_EXP_DEVCTL_READRQ_*.
--- include/uapi/linux/pci_regs.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +6 -0
@@ -497,6 +497,12 @@#define PCI_EXP_DEVCTL_URRE 0x0008/* Unsupported Request Reporting En. */ #define PCI_EXP_DEVCTL_RELAX_EN 0x0010/* Enable relaxed ordering */ #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0/* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000/* 128 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020/* 256 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040/* 512 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060/* 1024 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080/* 2048 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0/* 4096 Bytes */ #define PCI_EXP_DEVCTL_EXT_TAG 0x0100/* Extended Tag Field Enable */ #define PCI_EXP_DEVCTL_PHANTOM 0x0200/* Phantom Functions Enable */ #define PCI_EXP_DEVCTL_AUX_PME 0x0400/* Auxiliary Power PM Enable */
Greg Kroah-Hartman
maintainerPATCH 249/323 fuse: truncate pagecache on atomic_o_trunc
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 76224355db7570cbe6b6f75c8929a1558828dd55 upstream.
fuse_finish_open() will be called with FUSE_NOWRITE in case of atomic O_TRUNC. This can deadlock with fuse_wait_on_page_writeback() in fuse_launder_page() triggered by invalidate_inode_pages2().
Fix by replacing invalidate_inode_pages2() in fuse_finish_open() with a truncate_pagecache() call. This makes sense regardless of FOPEN_KEEP_CACHE or fc->writeback cache, so do it unconditionally.
--- fs/fuse/file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/fuse/file.c +5 -2
@@ -178,12 +178,11 @@ void fuse_finish_open(struct inode *inodif (ff->open_flags &FOPEN_DIRECT_IO ) file->f_op = &fuse_direct_io_file_operations; -if (!(ff->open_flags &FOPEN_KEEP_CACHE )) -invalidate_inode_pages2 (inode->i_mapping);if (ff->open_flags &FOPEN_STREAM )stream_open (inode, file);else if (ff->open_flags &FOPEN_NONSEEKABLE )nonseekable_open (inode, file); +if (fc->atomic_o_trunc && (file->f_flags &O_TRUNC )) {struct fuse_inode *fi =get_fuse_inode (inode);
@@ -191,10 +190,14 @@ void fuse_finish_open(struct inode *inod fi->attr_version = ++fc->attr_version;i_size_write (inode,0 );spin_unlock (&fc->lock); +truncate_pagecache (inode,0 );fuse_invalidate_attr (inode);if (fc->writeback_cache)file_update_time (file); + }else if (!(ff->open_flags &FOPEN_KEEP_CACHE )) { +invalidate_inode_pages2 (inode->i_mapping); } +if ((file->f_mode &FMODE_WRITE ) && fc->writeback_cache)fuse_link_write_file (file); }
Greg Kroah-Hartman
maintainerPATCH 250/323 x86/cpu: Fix migration safety with X86_BUG_NULL_SEL
In reply to Greg Kroah-HartmanFrom: Jane Malalane <[email protected]>
commit 415de44076640483648d6c0f6d645a9ee61328ad upstream.
Currently, Linux probes for X86_BUG_NULL_SEL unconditionally which makes it unsafe to migrate in a virtualised environment as the properties across the migration pool might differ.
To be specific, the case which goes wrong is:
1. Zen1 (or earlier) and Zen2 (or later) in a migration pool
2. Linux boots on Zen2, probes and finds the absence of X86_BUG_NULL_SEL
3. Linux is then migrated to Zen1
Linux is now running on a X86_BUG_NULL_SEL-impacted CPU while believing that the bug is fixed.
The only way to address the problem is to fully trust the "no longer affected" CPUID bit when virtualised, because in the above case it would be clear deliberately to indicate the fact "you might migrate to somewhere which has this behaviour".
Zen3 adds the NullSelectorClearsBase CPUID bit to indicate that loading a NULL segment selector zeroes the base and limit fields, as well as just attributes. Zen2 also has this behaviour but doesn't have the NSCB bit.
[ bp: Minor touchups. ]
--- arch/x86/kernel/cpu/amd.c | 2 + arch/x86/kernel/cpu/common.c | 44 ++++++++++++++++++++++++++++++++++++------- arch/x86/kernel/cpu/cpu.h | 1 3 files changed, 40 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/amd.c +2 -0
@@ -993,6 +993,8 @@ static void init_amd(struct cpuinfo_x86if (cpu_has (c,X86_FEATURE_IRPERF ) && !cpu_has_amd_erratum (c, amd_erratum_1054))msr_set_bit (MSR_K7_HWCR ,MSR_K7_HWCR_IRPERF_EN_BIT ); + +check_null_seg_clears_base (c); }#ifdef CONFIG_X86_32
arch/x86/kernel/cpu/common.c +37 -7
64 lines not on this page · raw message
arch/x86/kernel/cpu/cpu.h +1 -0
@@ -76,6 +76,7 @@ extern int detect_extended_topology_earlextern int detect_extended_topology (struct cpuinfo_x86 *c);extern int detect_ht_early (struct cpuinfo_x86 *c);extern void detect_ht (struct cpuinfo_x86 *c); +extern void check_null_seg_clears_base (struct cpuinfo_x86 *c);unsigned int aperfmperf_get_khz (int cpu);
Greg Kroah-Hartman
maintainerPATCH 251/323 ext4: fix lazy initialization next schedule time computation in more granular unit
In reply to Greg Kroah-HartmanFrom: Shaoying Xu <[email protected]>
commit 39fec6889d15a658c3a3ebb06fd69d3584ddffd3 upstream.
Ext4 file system has default lazy inode table initialization setup once it is mounted. However, it has issue on computing the next schedule time that makes the timeout same amount in jiffies but different real time in secs if with various HZ values. Therefore, fix by measuring the current time in a more granular unit nanoseconds and make the next schedule time independent of the HZ value.
--- fs/ext4/super.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ext4/super.c +4 -5
@@ -3026,8 +3026,8 @@ static int ext4_run_li_request(struct exstruct ext4_group_desc *gdp =NULL ;ext4_group_t group, ngroups;struct super_block *sb; -unsigned long timeout =0 ;int ret =0 ; +u64 start_time; sb = elr->lr_super; ngroups =EXT4_SB (sb)->s_groups_count;
@@ -3047,13 +3047,12 @@ static int ext4_run_li_request(struct ex ret =1 ;if (!ret) { - timeout = jiffies; + start_time =ktime_get_real_ns (); ret =ext4_init_inode_table (sb, group, elr->lr_timeout ?0 :1 );if (elr->lr_timeout ==0 ) { - timeout = (jiffies - timeout) * - elr->lr_sbi->s_li_wait_mult; - elr->lr_timeout = timeout; + elr->lr_timeout =nsecs_to_jiffies ((ktime_get_real_ns () - start_time) * + elr->lr_sbi->s_li_wait_mult); } elr->lr_next_sched = jiffies + elr->lr_timeout; elr->lr_next_group = group +1 ;
Greg Kroah-Hartman
maintainerPATCH 252/323 fortify: Explicitly disable Clang support
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit a52f8a59aef46b59753e583bf4b28fccb069ce64 upstream.
Clang has never correctly compiled the FORTIFY_SOURCE defenses due to a couple bugs:
Eliding inlines with matching __builtin_* names https://bugs.llvm.org/show_bug.cgi?id=50322 Incorrect __builtin_constant_p() of some globals https://bugs.llvm.org/show_bug.cgi?id=41459
In the process of making improvements to the FORTIFY_SOURCE defenses, the first (silent) bug (coincidentally) becomes worked around, but exposes the latter which breaks the build. As such, Clang must not be used with CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13), and the fortify routines have been rearranged.
Update the Kconfig to reflect the reality of the current situation.
--- security/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
security/Kconfig +3 -0
@@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN config FORTIFY_SOURCE bool "Harden common str/mem functions against buffer overflows" depends on ARCH_HAS_FORTIFY_SOURCE + # https://bugs.llvm.org/show_bug.cgi?id=50322 + # https://bugs.llvm.org/show_bug.cgi?id=41459 + depends on !CC_IS_CLANG help Detect overflows of buffers in common string and memory functions where the compiler can determine and validate the buffer sizes.
Greg Kroah-Hartman
maintainerPATCH 253/323 parisc/entry: fix trace test in syscall exit path
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a upstream.
commit 8779e05ba8aa ("parisc: Fix ptrace check on syscall return") fixed testing of TI_FLAGS. This uncovered a bug in the test mask. syscall_restore_rfi is only used when the kernel needs to exit to usespace with single or block stepping and the recovery counter enabled. The test however used _TIF_SYSCALL_TRACE_MASK, which includes a lot of bits that shouldn't be tested here.
Fix this by using TIF_SINGLESTEP and TIF_BLOCKSTEP directly.
I encountered this bug by enabling syscall tracepoints. Both in qemu and on real hardware. As soon as i enabled the tracepoint (sys_exit_read, but i guess it doesn't really matter which one), i got random page faults in userspace almost immediately.
--- arch/parisc/kernel/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/entry.S +1 -1
@@ -1852,7 +1852,7 @@ syscall_restore: /* Are we being ptraced? */ LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 - ldi _TIF_SYSCALL_TRACE_MASK,%r2 + ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2 and,COND(=) %r19,%r2,%r0 b,n syscall_restore_rfi
Greg Kroah-Hartman
maintainerPATCH 254/323 PCI/MSI: Destroy sysfs before freeing entries
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 3735459037114d31e5acd9894fad9aed104231a0 upstream.
free_msi_irqs() frees the MSI entries before destroying the sysfs entries which are exposing them. Nothing prevents a concurrent free while a sysfs file is read and accesses the possibly freed entry.
Move the sysfs release ahead of freeing the entries.
--- drivers/pci/msi.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/pci/msi.c +12 -12
@@ -372,18 +372,6 @@ static void free_msi_irqs(struct pci_devfor (i =0 ; i < entry->nvec_used; i++)BUG_ON (irq_has_action (entry->irq + i)); -pci_msi_teardown_msi_irqs (dev); - -list_for_each_entry_safe (entry, tmp, msi_list, list) { -if (entry->msi_attrib.is_msix) { -if (list_is_last (&entry->list, msi_list)) -iounmap (entry->mask_base); - } - -list_del (&entry->list); -free_msi_entry (entry); - } -if (dev->msi_irq_groups) {sysfs_remove_groups (&dev->dev.kobj, dev->msi_irq_groups); msi_attrs = dev->msi_irq_groups[0 ]->attrs;
@@ -399,6 +387,18 @@ static void free_msi_irqs(struct pci_devkfree (dev->msi_irq_groups); dev->msi_irq_groups =NULL ; } + +pci_msi_teardown_msi_irqs (dev); + +list_for_each_entry_safe (entry, tmp, msi_list, list) { +if (entry->msi_attrib.is_msix) { +if (list_is_last (&entry->list, msi_list)) +iounmap (entry->mask_base); + } + +list_del (&entry->list); +free_msi_entry (entry); + } }static void pci_intx_for_msi (struct pci_dev *dev,int enable)
Greg Kroah-Hartman
maintainerPATCH 255/323 PCI/MSI: Deal with devices lying about their MSI mask capability
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 2226667a145db2e1f314d7f57fd644fe69863ab9 upstream.
It appears that some devices are lying about their mask capability, pretending that they don't have it, while they actually do. The net result is that now that we don't enable MSIs on such endpoint.
Add a new per-device flag to deal with this. Further patches will make use of it, sadly.
--- drivers/pci/msi.c | 3 +++ include/linux/pci.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/pci/msi.c +3 -0
@@ -569,6 +569,9 @@ msi_setup_entry(struct pci_dev *dev, int goto out;pci_read_config_word (dev, dev->msi_cap +PCI_MSI_FLAGS , &control); +/* Lies, damned lies, and MSIs */ +if (dev->dev_flags &PCI_DEV_FLAGS_HAS_MSI_MASKING ) + control |=PCI_MSI_FLAGS_MASKBIT ; entry->msi_attrib.is_msix =0 ; entry->msi_attrib.is_64 = !!(control &PCI_MSI_FLAGS_64BIT );
include/linux/pci.h +2 -0
@@ -205,6 +205,8 @@ enum pci_dev_flags {PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 <<10 ),/* Don't use Relaxed Ordering for TLPs directed at this device */ PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 <<11 ), +/* Device does honor MSI masking despite saying otherwise */ + PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12), }; enum pci_irq_reroute_variant {
Greg Kroah-Hartman
maintainerPATCH 256/323 PCI: Add MSI masking quirk for Nvidia ION AHCI
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit f21082fb20dbfb3e42b769b59ef21c2a7f2c7c1f upstream.
The ION AHCI device pretends that MSI masking isn't a thing, while it actually implements it and needs MSIs to be unmasked to work. Add a quirk to that effect.
--- drivers/pci/quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/pci/quirks.c +6 -0
@@ -5579,3 +5579,9 @@ static void apex_pci_fixup_class(struct }DECLARE_PCI_FIXUP_CLASS_HEADER (0x1ac1 ,0x089a ,PCI_CLASS_NOT_DEFINED ,8 , apex_pci_fixup_class); + +static void nvidia_ion_ahci_fixup (struct pci_dev *pdev) +{ + pdev->dev_flags |=PCI_DEV_FLAGS_HAS_MSI_MASKING ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_NVIDIA ,0x0ab8 , nvidia_ion_ahci_fixup);
Greg Kroah-Hartman
maintainerPATCH 257/323 erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()
In reply to Greg Kroah-HartmanFrom: Yue Hu <[email protected]>
commit 7dea3de7d384f4c8156e8bd93112ba6db1eb276c upstream.
No any behavior to variable occupied in z_erofs_attach_page() which is only caller to z_erofs_pagevec_enqueue().
--- drivers/staging/erofs/unzip_pagevec.h | 5 +---- drivers/staging/erofs/unzip_vle.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/staging/erofs/unzip_pagevec.h +1 -4
@@ -117,10 +117,8 @@ static inline void z_erofs_pagevec_ctor_static inline bool z_erofs_pagevec_ctor_enqueue (struct z_erofs_pagevec_ctor *ctor,struct page *page, -enum z_erofs_page_type type, -bool *occupied) +enum z_erofs_page_type type) { - *occupied = false;if (unlikely (ctor->next ==NULL && type))if (ctor->index +1 == ctor->nr)return false;
@@ -135,7 +133,6 @@ z_erofs_pagevec_ctor_enqueue(struct z_er/* should remind that collector->next never equal to 1, 2 */ if (type == (uintptr_t )ctor->next) { ctor->next = page; - *occupied = true; } ctor->pages[ctor->index++] =
drivers/staging/erofs/unzip_vle.c +1 -3
@@ -234,7 +234,6 @@ static int z_erofs_vle_work_add_page( enum z_erofs_page_type type) {int ret; -bool occupied;/* give priority for the compressed data storage */ if (builder->role >= Z_EROFS_VLE_WORK_PRIMARY &&
@@ -242,8 +241,7 @@ static int z_erofs_vle_work_add_page( try_to_reuse_as_compressed_page(builder, page))return 0 ; - ret =z_erofs_pagevec_ctor_enqueue (&builder->vector, - page, type, &occupied); + ret =z_erofs_pagevec_ctor_enqueue (&builder->vector, page, type); builder->work->vcnt += (unsigned )ret;return ret ?0 : -EAGAIN ;
Greg Kroah-Hartman
maintainerPATCH 258/323 erofs: fix unsafe pagevec reuse of hooked pclusters
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
commit 86432a6dca9bed79111990851df5756d3eb5f57c upstream.
There are pclusters in runtime marked with Z_EROFS_PCLUSTER_TAIL before actual I/O submission. Thus, the decompression chain can be extended if the following pcluster chain hooks such tail pcluster.
As the related comment mentioned, if some page is made of a hooked pcluster and another followed pcluster, it can be reused for in-place I/O (since I/O should be submitted anyway):
_______________________________________________________________
| tail (partial) page | head (partial) page | |_____PRIMARY_HOOKED___|____________PRIMARY_FOLLOWED____________|
However, it's by no means safe to reuse as pagevec since if such PRIMARY_HOOKED pclusters finally move into bypass chain without I/O submission. It's somewhat hard to reproduce with LZ4 and I just found it (general protection fault) by ro_fsstressing a LZMA image for long time.
I'm going to actively clean up related code together with multi-page folio adaption in the next few months. Let's address it directly for easier backporting for now.
Call trace for reference:
z_erofs_decompress_pcluster+0x10a/0x8a0 [erofs] z_erofs_decompress_queue.isra.36+0x3c/0x60 [erofs] z_erofs_runqueue+0x5f3/0x840 [erofs] z_erofs_readahead+0x1e8/0x320 [erofs] read_pages+0x91/0x270 page_cache_ra_unbounded+0x18b/0x240 filemap_get_pages+0x10a/0x5f0 filemap_read+0xa9/0x330 new_sync_read+0x11b/0x1a0 vfs_read+0xf1/0x190
--- drivers/staging/erofs/unzip_pagevec.h | 13 ++++++++++--- drivers/staging/erofs/unzip_vle.c | 17 +++++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-)
drivers/staging/erofs/unzip_pagevec.h +10 -3
@@ -117,11 +117,18 @@ static inline void z_erofs_pagevec_ctor_static inline bool z_erofs_pagevec_ctor_enqueue (struct z_erofs_pagevec_ctor *ctor,struct page *page, -enum z_erofs_page_type type) +enum z_erofs_page_type type, +bool pvec_safereuse) { -if (unlikely (ctor->next ==NULL && type)) -if (ctor->index +1 == ctor->nr) +if (!ctor->next) { +/* some pages cannot be reused as pvec safely without I/O */ +if (type ==Z_EROFS_PAGE_TYPE_EXCLUSIVE && !pvec_safereuse) + type =Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED ; + +if (type !=Z_EROFS_PAGE_TYPE_EXCLUSIVE && + ctor->index +1 == ctor->nr)return false; + }if (unlikely (ctor->index >= ctor->nr))z_erofs_pagevec_ctor_pagedown (ctor, false);
drivers/staging/erofs/unzip_vle.c +9 -8
@@ -228,10 +228,10 @@ static inline bool try_to_reuse_as_compr }/* callers must be with work->lock held */ -static int z_erofs_vle_work_add_page ( -struct z_erofs_vle_work_builder *builder, -struct page *page, -enum z_erofs_page_type type) +static int z_erofs_vle_work_add_page (struct z_erofs_vle_work_builder *builder, +struct page *page, +enum z_erofs_page_type type, +bool pvec_safereuse) {int ret;
@@ -241,9 +241,9 @@ static int z_erofs_vle_work_add_page( try_to_reuse_as_compressed_page(builder, page))return 0 ; - ret =z_erofs_pagevec_ctor_enqueue (&builder->vector, page, type); + ret =z_erofs_pagevec_ctor_enqueue (&builder->vector, page, type, + pvec_safereuse); builder->work->vcnt += (unsigned )ret; -return ret ?0 : -EAGAIN ; }
@@ -688,14 +688,15 @@ hitted: tight &=builder_is_followed (builder); retry: - err =z_erofs_vle_work_add_page (builder, page, page_type); + err =z_erofs_vle_work_add_page (builder, page, page_type, +builder_is_followed (builder));/* should allocate an additional staging page for pagevec */ if (err == -EAGAIN ) {struct page *const newpage =__stagingpage_alloc (page_pool,GFP_NOFS ); err =z_erofs_vle_work_add_page (builder, - newpage,Z_EROFS_PAGE_TYPE_EXCLUSIVE ); + newpage,Z_EROFS_PAGE_TYPE_EXCLUSIVE , true);if (likely (!err)) goto retry; }
Greg Kroah-Hartman
maintainerPATCH 259/323 arm64: zynqmp: Do not duplicate flash partition label property
In reply to Greg Kroah-HartmanFrom: Amit Kumar Mahapatra <[email protected]>
[ Upstream commit 167721a5909f867f8c18c8e78ea58e705ad9bbd4 ]
In kernel 5.4, support has been added for reading MTD devices via the nvmem API.
For this the mtd devices are registered as read-only NVMEM providers under sysfs with the same name as the flash partition label property.
So if flash partition label property of multiple flash devices are identical then the second mtd device fails to get registered as a NVMEM provider.
This patch fixes the issue by having different label property for different flashes.
--- arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts +2 -2
@@ -130,7 +130,7 @@ reg = <0>; partition@0 { - label = "data"; + label = "spi0-data"; reg = <0x0 0x100000>; }; };
@@ -148,7 +148,7 @@ reg = <0>; partition@0 { - label = "data"; + label = "spi1-data"; reg = <0x0 0x84000>; }; };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 260/323 arm64: zynqmp: Fix serial compatible string
In reply to Greg Kroah-HartmanFrom: Michal Simek <[email protected]>
[ Upstream commit 812fa2f0e9d33564bd0131a69750e0d165f4c82a ]
Based on commit 65a2c14d4f00 ("dt-bindings: serial: convert Cadence UART bindings to YAML") compatible string should look like differently that's why fix it to be aligned with dt binding.
--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +2 -2
@@ -574,7 +574,7 @@ }; uart0: serial@ff000000 { - compatible = "cdns,uart-r1p12", "xlnx,xuartps"; + compatible = "xlnx,zynqmp-uart", "cdns,uart-r1p12"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 21 4>;
@@ -583,7 +583,7 @@ }; uart1: serial@ff010000 { - compatible = "cdns,uart-r1p12", "xlnx,xuartps"; + compatible = "xlnx,zynqmp-uart", "cdns,uart-r1p12"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 22 4>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 261/323 scsi: lpfc: Fix list_add() corruption in lpfc_drain_txq()
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 99154581b05c8fb22607afb7c3d66c1bace6aa5d ]
When parsing the txq list in lpfc_drain_txq(), the driver attempts to pass the requests to the adapter. If such an attempt fails, a local "fail_msg" string is set and a log message output. The job is then added to a completions list for cancellation.
Processing of any further jobs from the txq list continues, but since "fail_msg" remains set, jobs are added to the completions list regardless of whether a wqe was passed to the adapter. If successfully added to txcmplq, jobs are added to both lists resulting in list corruption.
Fix by clearing the fail_msg string after adding a job to the completions list. This stops the subsequent jobs from being added to the completions list unless they had an appropriate failure.
--- drivers/scsi/lpfc/lpfc_sli.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/lpfc/lpfc_sli.c +1 -0
@@ -19171,6 +19171,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) fail_msg, piocbq->iotag, piocbq->sli4_xritag);list_add_tail (&piocbq->list, &completions); + fail_msg =NULL ; }spin_unlock_irqrestore (&pring->ring_lock, iflags); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 262/323 arm64: dts: hisilicon: fix arm,sp805 compatible string
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 894d4f1f77d0e88f1f81af2e1e37333c1c41b631 ]
According to Documentation/devicetree/bindings/watchdog/arm,sp805.yaml the compatible is:
compatible = "arm,sp805", "arm,primecell";
The current compatible string doesn't exist at all. Fix it.
--- arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 4 ++-- arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +2 -2
@@ -1062,7 +1062,7 @@ }; watchdog0: watchdog@e8a06000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xe8a06000 0x0 0x1000>; interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; clocks = <&crg_ctrl HI3660_OSC32K>;
@@ -1070,7 +1070,7 @@ }; watchdog1: watchdog@e8a07000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xe8a07000 0x0 0x1000>; interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; clocks = <&crg_ctrl HI3660_OSC32K>;
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +1 -1
@@ -830,7 +830,7 @@ }; watchdog0: watchdog@f8005000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xf8005000 0x0 0x1000>; interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ao_ctrl HI6220_WDT0_PCLK>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 263/323 usb: musb: tusb6010: check return value after calling platform_get_resource()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 14651496a3de6807a17c310f63c894ea0c5d858e ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/usb/musb/tusb6010.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/musb/tusb6010.c +5 -0
@@ -1103,6 +1103,11 @@ static int tusb_musb_init(struct musb *musb)/* dma address for async dma */ mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!mem) { +pr_debug ("no async dma resource?\n" ); + ret = -ENODEV ; + goto done; + } musb->async = mem->start;/* dma address for sync dma */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 264/323 usb: typec: tipd: Remove WARN_ON in tps6598x_block_read
In reply to Greg Kroah-HartmanFrom: Sven Peter <[email protected]>
[ Upstream commit b7a0a63f3fed57d413bb857de164ea9c3984bc4e ]
Calling tps6598x_block_read with a higher than allowed len can be handled by just returning an error. There's no need to crash systems with panic-on-warn enabled.
--- drivers/usb/typec/tps6598x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tps6598x.c +1 -1
@@ -93,7 +93,7 @@ tps6598x_block_read(struct tps6598x *tps, u8 reg, void *val, size_t len)u8 data[TPS_MAX_LEN +1 ];int ret; -if (WARN_ON (len +1 >sizeof (data))) +if (len +1 >sizeof (data))return -EINVAL ;if (!tps->i2c_protocol)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 265/323 arm64: dts: freescale: fix arm,sp805 compatible string
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 99a7cacc66cae92db40139b57689be2af75fc6b8 ]
According to Documentation/devicetree/bindings/watchdog/arm,sp805.yaml the compatible is:
compatible = "arm,sp805", "arm,primecell";
The current compatible string doesn't exist at all. Fix it.
--- arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 16 ++++++++-------- arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-)
arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +8 -8
@@ -584,56 +584,56 @@ }; cluster1_core0_watchdog: wdt@c000000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc000000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster1_core1_watchdog: wdt@c010000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc010000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster1_core2_watchdog: wdt@c020000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc020000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster1_core3_watchdog: wdt@c030000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc030000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core0_watchdog: wdt@c100000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc100000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core1_watchdog: wdt@c110000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc110000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core2_watchdog: wdt@c120000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc120000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core3_watchdog: wdt@c130000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc130000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk";
arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi +8 -8
@@ -222,56 +222,56 @@ }; cluster1_core0_watchdog: wdt@c000000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc000000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster1_core1_watchdog: wdt@c010000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc010000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core0_watchdog: wdt@c100000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc100000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster2_core1_watchdog: wdt@c110000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc110000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster3_core0_watchdog: wdt@c200000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc200000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster3_core1_watchdog: wdt@c210000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc210000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster4_core0_watchdog: wdt@c300000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc300000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk"; }; cluster4_core1_watchdog: wdt@c310000 { - compatible = "arm,sp805-wdt", "arm,primecell"; + compatible = "arm,sp805", "arm,primecell"; reg = <0x0 0xc310000 0x0 0x1000>; clocks = <&clockgen 4 3>, <&clockgen 4 3>; clock-names = "apb_pclk", "wdog_clk";
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 266/323 ASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 92d3360108f1839ca40451bad20ff67dd24a1964 ]
Add a quirk mechanism to allow specifying that active-high jack-detection should be used on platforms where this info is not available in devicetree.
And add an entry for the Cyberbook T116 tablet to the DMI table, so that jack-detection will work properly on this tablet.
--- sound/soc/codecs/nau8824.c | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
sound/soc/codecs/nau8824.c +40 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/init.h> #include <linux/i2c.h> #include <linux/regmap.h>
@@ -30,6 +31,12 @@#include "nau8824.h" +#define NAU8824_JD_ACTIVE_HIGH BIT(0) + +static int nau8824_quirk; +static int quirk_override =-1 ; +module_param_named (quirk, quirk_override, uint,0444 ); +MODULE_PARM_DESC (quirk,"Board-specific quirk override" );static int nau8824_config_sysclk (struct nau8824 *nau8824,int clk_id,unsigned int freq);
@@ -1878,6 +1885,34 @@ static int nau8824_read_device_properties(struct device *dev,return 0 ; } +/* Please keep this list alphabetically sorted */ +static const struct dmi_system_id nau8824_quirk_table[] = { + { +/* Cyberbook T116 rugged tablet */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Default string" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"Cherry Trail CR" ), +DMI_EXACT_MATCH (DMI_PRODUCT_SKU ,"20170531" ), + }, + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH ), + }, + {} +}; + +static void nau8824_check_quirks (void ) +{ +const struct dmi_system_id *dmi_id; + +if (quirk_override !=-1 ) { + nau8824_quirk = quirk_override; +return ; + } + + dmi_id =dmi_first_match (nau8824_quirk_table); +if (dmi_id) + nau8824_quirk = (unsigned long )dmi_id->driver_data; +} +static int nau8824_i2c_probe (struct i2c_client *i2c,const struct i2c_device_id *id) {
@@ -1902,6 +1937,11 @@ static int nau8824_i2c_probe(struct i2c_client *i2c, nau8824->irq = i2c->irq;sema_init (&nau8824->jd_sem,1 ); +nau8824_check_quirks (); + +if (nau8824_quirk &NAU8824_JD_ACTIVE_HIGH ) + nau8824->jkdet_polarity =0 ; +nau8824_print_device_properties (nau8824); ret =regmap_read (nau8824->regmap,NAU8824_REG_I2C_DEVICE_ID , &value);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 267/323 scsi: advansys: Fix kernel pointer leak
In reply to Greg Kroah-HartmanFrom: Guo Zhi <[email protected]>
[ Upstream commit d4996c6eac4c81b8872043e9391563f67f13e406 ]
Pointers should be printed with %p or %px rather than cast to 'unsigned long' and printed with %lx.
Change %lx to %p to print the hashed pointer.
--- drivers/scsi/advansys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/advansys.c +2 -2
@@ -3370,8 +3370,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost) shost->host_no);seq_printf (m, -" iop_base 0x%lx, cable_detect: %X, err_code %u\n" , - (unsigned long )v->iop_base, +" iop_base 0x%p, cable_detect: %X, err_code %u\n" , + v->iop_base,AdvReadWordRegister (iop_base,IOPW_SCSI_CFG1 ) &CABLE_DETECT , v->err_code);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 268/323 firmware_loader: fix pre-allocated buf built-in firmware use
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
[ Upstream commit f7a07f7b96033df7709042ff38e998720a3f7119 ]
The firmware_loader can be used with a pre-allocated buffer through the use of the API calls:
o request_firmware_into_buf()
o request_partial_firmware_into_buf()
If the firmware was built-in and present, our current check for if the built-in firmware fits into the pre-allocated buffer does not return any errors, and we proceed to tell the caller that everything worked fine. It's a lie and no firmware would end up being copied into the pre-allocated buffer. So if the caller trust the result it may end up writing a bunch of 0's to a device!
Fix this by making the function that checks for the pre-allocated buffer return non-void. Since the typical use case is when no pre-allocated buffer is provided make this return successfully for that case. If the built-in firmware does *not* fit into the pre-allocated buffer size return a failure as we should have been doing before.
I'm not aware of users of the built-in firmware using the API calls with a pre-allocated buffer, as such I doubt this fixes any real life issue. But you never know... perhaps some oddball private tree might use it.
In so far as upstream is concerned this just fixes our code for correctness.
--- drivers/base/firmware_loader/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/base/firmware_loader/main.c +7 -6
@@ -97,12 +97,15 @@ static struct firmware_cache fw_cache;extern struct builtin_fw __start_builtin_fw[];extern struct builtin_fw __end_builtin_fw[]; -static void fw_copy_to_prealloc_buf (struct firmware *fw, +static bool fw_copy_to_prealloc_buf (struct firmware *fw,void *buf,size_t size) { -if (!buf || size < fw->size) -return ; +if (!buf) +return true; +if (size < fw->size) +return false;memcpy (buf, fw->data, fw->size); +return true; } static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
@@ -114,9 +117,7 @@ static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,if (strcmp (name, b_fw->name) ==0 ) { fw->size = b_fw->size; fw->data = b_fw->data; -fw_copy_to_prealloc_buf (fw, buf, size); - -return true; +return fw_copy_to_prealloc_buf (fw, buf, size); } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 269/323 ARM: dts: omap: fix gpmc,mux-add-data type
In reply to Greg Kroah-HartmanFrom: Roger Quadros <[email protected]>
[ Upstream commit 51b9e22ffd3c4c56cbb7caae9750f70e55ffa603 ]
gpmc,mux-add-data is not boolean.
Fixes the below errors flagged by dtbs_check.
"ethernet@4,0:gpmc,mux-add-data: True is not of type 'array'"
--- arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi | 2 +- arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi +1 -1
@@ -29,7 +29,7 @@ compatible = "smsc,lan9221","smsc,lan9115"; bank-width = <2>; - gpmc,mux-add-data; + gpmc,mux-add-data = <0>; gpmc,cs-on-ns = <0>; gpmc,cs-rd-off-ns = <42>; gpmc,cs-wr-off-ns = <36>;
arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi +1 -1
@@ -25,7 +25,7 @@ compatible = "smsc,lan9221","smsc,lan9115"; bank-width = <2>; - gpmc,mux-add-data; + gpmc,mux-add-data = <0>; gpmc,cs-on-ns = <0>; gpmc,cs-rd-off-ns = <42>; gpmc,cs-wr-off-ns = <36>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 270/323 usb: host: ohci-tmio: check return value after calling platform_get_resource()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 9eff2b2e59fda25051ab36cd1cb5014661df657b ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/usb/host/ohci-tmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ohci-tmio.c +1 -1
@@ -196,7 +196,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)if (usb_disabled ())return -ENODEV ; -if (!cell) +if (!cell || !regs || !config || !sram)return -EINVAL ;if (irq <0 )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 271/323 ALSA: ISA: not for M68K
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 3c05f1477e62ea5a0a8797ba6a545b1dc751fb31 ]
On m68k, compiling drivers under SND_ISA causes build errors:
../sound/core/isadma.c: In function 'snd_dma_program':../sound/core/isadma.c:33:17: error: implicit declaration of function 'claim_dma_lock' [-Werror=implicit-function-declaration]
33 | flags = claim_dma_lock();
| ^~~~~~~~~~~~~~
../sound/core/isadma.c:41:9: error: implicit declaration of function 'release_dma_lock' [-Werror=implicit-function-declaration]
41 | release_dma_lock(flags);
| ^~~~~~~~~~~~~~~~../sound/isa/sb/sb16_main.c: In function 'snd_sb16_playback_prepare':../sound/isa/sb/sb16_main.c:253:72: error: 'DMA_AUTOINIT' undeclared (first use in this function)
253 | snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
| ^~~~~~~~~~~~../sound/isa/sb/sb16_main.c:253:72: note: each undeclared identifier is reported only once for each function it appears in ../sound/isa/sb/sb16_main.c: In function 'snd_sb16_capture_prepare':../sound/isa/sb/sb16_main.c:322:71: error: 'DMA_AUTOINIT' undeclared (first use in this function)
322 | snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
| ^~~~~~~~~~~~
and more...
--- sound/core/Makefile | 2 ++ sound/isa/Kconfig | 2 +- sound/pci/Kconfig | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
sound/core/Makefile +2 -0
@@ -9,7 +9,9 @@ ifneq ($(CONFIG_SND_PROC_FS),) snd-y += info.o snd-$(CONFIG_SND_OSSEMUL) += info_oss.o endif +ifneq ($(CONFIG_M68K),y) snd-$(CONFIG_ISA_DMA_API) += isadma.o +endif snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o snd-$(CONFIG_SND_VMASTER) += vmaster.o snd-$(CONFIG_SND_JACK) += ctljack.o jack.o
sound/isa/Kconfig +1 -1
@@ -21,7 +21,7 @@ config SND_SB16_DSP menuconfig SND_ISA bool "ISA sound devices" depends on ISA || COMPILE_TEST - depends on ISA_DMA_API + depends on ISA_DMA_API && !M68K default y help Support for sound devices connected via the ISA bus.
sound/pci/Kconfig +1 -0
@@ -278,6 +278,7 @@ config SND_CS46XX_NEW_DSP config SND_CS5530 tristate "CS5530 Audio" depends on ISA_DMA_API && (X86_32 || COMPILE_TEST) + depends on !M68K select SND_SB16_DSP help Say Y here to include support for audio on Cyrix/NatSemi CS5530 chips.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 272/323 tty: tty_buffer: Fix the softlockup issue in flush_to_ldisc
In reply to Greg Kroah-HartmanFrom: Guanghui Feng <[email protected]>
[ Upstream commit 3968ddcf05fb4b9409cd1859feb06a5b0550a1c1 ]
When running ltp testcase(ltp/testcases/kernel/pty/pty04.c) with arm64, there is a soft lockup, which look like this one:
Workqueue: events_unbound flush_to_ldisc Call trace: dump_backtrace+0x0/0x1ec show_stack+0x24/0x30 dump_stack+0xd0/0x128 panic+0x15c/0x374 watchdog_timer_fn+0x2b8/0x304 __run_hrtimer+0x88/0x2c0 __hrtimer_run_queues+0xa4/0x120 hrtimer_interrupt+0xfc/0x270 arch_timer_handler_phys+0x40/0x50 handle_percpu_devid_irq+0x94/0x220 __handle_domain_irq+0x88/0xf0 gic_handle_irq+0x84/0xfc el1_irq+0xc8/0x180 slip_unesc+0x80/0x214 [slip] tty_ldisc_receive_buf+0x64/0x80 tty_port_default_receive_buf+0x50/0x90 flush_to_ldisc+0xbc/0x110 process_one_work+0x1d4/0x4b0 worker_thread+0x180/0x430 kthread+0x11c/0x120
In the testcase pty04, The first process call the write syscall to send data to the pty master. At the same time, the workqueue will do the flush_to_ldisc to pop data in a loop until there is no more data left. When the sender and workqueue running in different core, the sender sends data fastly in full time which will result in workqueue doing work in loop for a long time and occuring softlockup in flush_to_ldisc with kernel configured without preempt. So I add need_resched check and cond_resched in the flush_to_ldisc loop to avoid it.
--- drivers/tty/tty_buffer.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/tty_buffer.c +3 -0
@@ -529,6 +529,9 @@ static void flush_to_ldisc(struct work_struct *work)if (!count)break ; head->read += count; + +if (need_resched ()) +cond_resched (); }mutex_unlock (&buf->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 273/323 MIPS: sni: Fix the build
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit c91cf42f61dc77b289784ea7b15a8531defa41c0 ]
This patch fixes the following gcc 10 build error:
arch/mips/sni/time.c: In function ‘a20r_set_periodic’:arch/mips/sni/time.c:15:26: error: unsigned conversion from ‘int’ to ‘u8’ {aka ‘volatile unsigned char’} changes value from ‘576’ to ‘64’ [-Werror=overflow]
15 | #define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
| ^arch/mips/sni/time.c:21:45: note: in expansion of macro ‘SNI_COUNTER0_DIV’
21 | *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
| ^~~~~~~~~~~~~~~~--- arch/mips/sni/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/sni/time.c +2 -2
@@ -18,14 +18,14 @@ static int a20r_set_periodic(struct clock_event_device *evt) { *(volatile u8 *)(A20R_PT_CLOCK_BASE +12 ) =0x34 ;wmb (); - *(volatile u8 *)(A20R_PT_CLOCK_BASE +0 ) =SNI_COUNTER0_DIV ; + *(volatile u8 *)(A20R_PT_CLOCK_BASE +0 ) =SNI_COUNTER0_DIV &0xff ;wmb (); *(volatile u8 *)(A20R_PT_CLOCK_BASE +0 ) =SNI_COUNTER0_DIV >>8 ;wmb (); *(volatile u8 *)(A20R_PT_CLOCK_BASE +12 ) =0xb4 ;wmb (); - *(volatile u8 *)(A20R_PT_CLOCK_BASE +8 ) =SNI_COUNTER2_DIV ; + *(volatile u8 *)(A20R_PT_CLOCK_BASE +8 ) =SNI_COUNTER2_DIV &0xff ;wmb (); *(volatile u8 *)(A20R_PT_CLOCK_BASE +8 ) =SNI_COUNTER2_DIV >>8 ;wmb ();
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 274/323 scsi: target: Fix ordered tag handling
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit ed1227e080990ffec5bf39006ec8a57358e6689a ]
This patch fixes the following bugs:
1. If there are multiple ordered cmds queued and multiple simple cmds completing, target_restart_delayed_cmds() could be called on different CPUs and each instance could start a ordered cmd. They could then run in different orders than they were queued.
2. target_restart_delayed_cmds() and target_handle_task_attr() can race where:
1. target_handle_task_attr() has passed the simple_cmds == 0 check.
2. transport_complete_task_attr() then decrements simple_cmds to 0.
3. transport_complete_task_attr() runs target_restart_delayed_cmds() and it does not see any cmds on the delayed_cmd_list.
4. target_handle_task_attr() adds the cmd to the delayed_cmd_list.
The cmd will then end up timing out.
3. If we are sent > 1 ordered cmds and simple_cmds == 0, we can execute them out of order, because target_handle_task_attr() will hit that simple_cmds check first and return false for all ordered cmds sent.
4. We run target_restart_delayed_cmds() after every cmd completion, so if there is more than 1 simple cmd running, we start executing ordered cmds after that first cmd instead of waiting for all of them to complete.
5. Ordered cmds are not supposed to start until HEAD OF QUEUE and all older cmds have completed, and not just simple.
6. It's not a bug but it doesn't make sense to take the delayed_cmd_lock for every cmd completion when ordered cmds are almost never used. Just replacing that lock with an atomic increases IOPs by up to 10% when completions are spread over multiple CPUs and there are multiple sessions/ mqs/thread accessing the same device.
This patch moves the queued delayed handling to a per device work to serialze the cmd executions for each device and adds a new counter to track HEAD_OF_QUEUE and SIMPLE cmds. We can then check the new counter to determine when to run the work on the completion path.
--- drivers/target/target_core_device.c | 2 + drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 76 ++++++++++++++++++-------- include/target/target_core_base.h | 6 +- 4 files changed, 61 insertions(+), 24 deletions(-)
drivers/target/target_core_device.c +2 -0
@@ -790,6 +790,8 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)INIT_LIST_HEAD (&dev->t10_alua.lba_map_list);spin_lock_init (&dev->t10_alua.lba_map_lock); +INIT_WORK (&dev->delayed_cmd_work, target_do_delayed_work); + dev->t10_wwn.t10_dev = dev; dev->t10_alua.t10_dev = dev;
drivers/target/target_core_internal.h +1 -0
@@ -151,6 +151,7 @@ void transport_clear_lun_ref(struct se_lun *);void transport_send_task_abort (struct se_cmd *);sense_reason_t target_cmd_size_check (struct se_cmd *cmd,unsigned int size);void target_qf_do_work (struct work_struct *work); +void target_do_delayed_work (struct work_struct *work);bool target_check_wce (struct se_device *dev);bool target_check_fua (struct se_device *dev);void __target_execute_cmd (struct se_cmd *,bool );
drivers/target/target_core_transport.c +54 -22
142 lines not on this page · raw message
include/target/target_core_base.h +4 -2
@@ -774,8 +774,9 @@ struct se_device {atomic_long_t read_bytes;atomic_long_t write_bytes;/* Active commands on this virtual SE device */ -atomic_t simple_cmds; -atomic_t dev_ordered_sync; +atomic_t non_ordered; +bool ordered_sync_in_progress; +atomic_t delayed_cmd_count;atomic_t dev_qf_count;u32 export_count;spinlock_t delayed_cmd_lock;
@@ -798,6 +799,7 @@ struct se_device {struct list_head dev_tmr_list;struct workqueue_struct *tmr_wq;struct work_struct qf_work_queue; +struct work_struct delayed_cmd_work;struct list_head delayed_cmd_list;struct list_head state_list;struct list_head qf_cmd_list;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 275/323 scsi: target: Fix alua_tg_pt_gps_count tracking
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 1283c0d1a32bb924324481586b5d6e8e76f676ba ]
We can't free the tg_pt_gp in core_alua_set_tg_pt_gp_id() because it's still accessed via configfs. Its release must go through the normal configfs/refcount process.
The max alua_tg_pt_gps_count check should probably have been done in core_alua_allocate_tg_pt_gp(), but with the current code userspace could have created 0x0000ffff + 1 groups, but only set the id for 0x0000ffff. Then it could have deleted a group with an ID set, and then set the ID for that extra group and it would work ok.
It's unlikely, but just in case this patch continues to allow that type of behavior, and just fixes the kfree() while in use bug.
--- drivers/target/target_core_alua.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_alua.c +0 -1
@@ -1716,7 +1716,6 @@ int core_alua_set_tg_pt_gp_id(pr_err ("Maximum ALUA alua_tg_pt_gps_count:" " 0x0000ffff reached\n" );spin_unlock (&dev->t10_alua.tg_pt_gps_lock); -kmem_cache_free (t10_alua_tg_pt_gp_cache, tg_pt_gp);return -ENOSPC ; } again:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 276/323 powerpc/5200: dts: fix memory node unit name
In reply to Greg Kroah-HartmanFrom: Anatolij Gustschin <[email protected]>
[ Upstream commit aed2886a5e9ffc8269a4220bff1e9e030d3d2eb1 ]
Fixes build warnings:
Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
--- arch/powerpc/boot/dts/charon.dts | 2 +- arch/powerpc/boot/dts/digsy_mtc.dts | 2 +- arch/powerpc/boot/dts/lite5200.dts | 2 +- arch/powerpc/boot/dts/lite5200b.dts | 2 +- arch/powerpc/boot/dts/media5200.dts | 2 +- arch/powerpc/boot/dts/mpc5200b.dtsi | 2 +- arch/powerpc/boot/dts/o2d.dts | 2 +- arch/powerpc/boot/dts/o2d.dtsi | 2 +- arch/powerpc/boot/dts/o2dnt2.dts | 2 +- arch/powerpc/boot/dts/o3dnt.dts | 2 +- arch/powerpc/boot/dts/pcm032.dts | 2 +- arch/powerpc/boot/dts/tqm5200.dts | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-)
arch/powerpc/boot/dts/charon.dts +1 -1
@@ -39,7 +39,7 @@ }; }; - memory { + memory@0 { device_type = "memory"; reg = <0x00000000 0x08000000>; // 128MB };
arch/powerpc/boot/dts/digsy_mtc.dts +1 -1
@@ -20,7 +20,7 @@ model = "intercontrol,digsy-mtc"; compatible = "intercontrol,digsy-mtc"; - memory { + memory@0 { reg = <0x00000000 0x02000000>; // 32MB };
arch/powerpc/boot/dts/lite5200.dts +1 -1
@@ -36,7 +36,7 @@ }; }; - memory { + memory@0 { device_type = "memory"; reg = <0x00000000 0x04000000>; // 64MB };
arch/powerpc/boot/dts/lite5200b.dts +1 -1
@@ -35,7 +35,7 @@ led4 { gpios = <&gpio_simple 2 1>; }; }; - memory { + memory@0 { reg = <0x00000000 0x10000000>; // 256MB };
arch/powerpc/boot/dts/media5200.dts +1 -1
@@ -36,7 +36,7 @@ }; }; - memory { + memory@0 { reg = <0x00000000 0x08000000>; // 128MB RAM };
arch/powerpc/boot/dts/mpc5200b.dtsi +1 -1
@@ -37,7 +37,7 @@ }; }; - memory: memory { + memory: memory@0 { device_type = "memory"; reg = <0x00000000 0x04000000>; // 64MB };
arch/powerpc/boot/dts/o2d.dts +1 -1
@@ -16,7 +16,7 @@ model = "ifm,o2d"; compatible = "ifm,o2d"; - memory { + memory@0 { reg = <0x00000000 0x08000000>; // 128MB };
arch/powerpc/boot/dts/o2d.dtsi +1 -1
@@ -23,7 +23,7 @@ model = "ifm,o2d"; compatible = "ifm,o2d"; - memory { + memory@0 { reg = <0x00000000 0x04000000>; // 64MB };
arch/powerpc/boot/dts/o2dnt2.dts +1 -1
@@ -16,7 +16,7 @@ model = "ifm,o2dnt2"; compatible = "ifm,o2d"; - memory { + memory@0 { reg = <0x00000000 0x08000000>; // 128MB };
arch/powerpc/boot/dts/o3dnt.dts +1 -1
@@ -16,7 +16,7 @@ model = "ifm,o3dnt"; compatible = "ifm,o2d"; - memory { + memory@0 { reg = <0x00000000 0x04000000>; // 64MB };
arch/powerpc/boot/dts/pcm032.dts +1 -1
@@ -26,7 +26,7 @@ model = "phytec,pcm032"; compatible = "phytec,pcm032"; - memory { + memory@0 { reg = <0x00000000 0x08000000>; // 128MB };
arch/powerpc/boot/dts/tqm5200.dts +1 -1
@@ -36,7 +36,7 @@ }; }; - memory { + memory@0 { device_type = "memory"; reg = <0x00000000 0x04000000>; // 64MB };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 277/323 ALSA: gus: fix null pointer dereference on pointer block
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit a0d21bb3279476c777434c40d969ea88ca64f9aa ]
The pointer block return from snd_gf1_dma_next_block could be null, so there is a potential null pointer dereference issue. Fix this by adding a null check before dereference.
--- sound/isa/gus/gus_dma.c | 2 ++ 1 file changed, 2 insertions(+)
sound/isa/gus/gus_dma.c +2 -0
@@ -141,6 +141,8 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) } block =snd_gf1_dma_next_block (gus);spin_unlock (&gus->dma_lock); +if (!block) +return ;snd_gf1_dma_program (gus, block->addr, block->buf_addr, block->count, (unsigned short ) block->cmd);kfree (block);#if 0
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 278/323 powerpc/dcr: Use cmplwi instead of 3-argument cmpli
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit fef071be57dc43679a32d5b0e6ee176d6f12e9f2 ]
In dcr-low.S we use cmpli with three arguments, instead of four arguments as defined in the ISA:
cmpli cr0,r3,1024
This appears to be a PPC440-ism, looking at the "PPC440x5 CPU Core User’s Manual" it shows cmpli having no L field, but implied to be 0 due to the core being 32-bit. It mentions that the ISA defines four arguments and recommends using cmplwi.
It also corresponds to the old POWER instruction set, which had no L field there, a reserved bit instead.
dcr-low.S is only built 32-bit, because it is only built when DCR_NATIVE=y, which is only selected by 40x and 44x. Looking at the generated code (with gcc/gas) we see cmplwi as expected.
Although gas is happy with the 3-argument version when building for 32-bit, the LLVM assembler is not and errors out with:
arch/powerpc/sysdev/dcr-low.S:27:10: error: invalid operand for instruction
cmpli 0,%r3,1024; ...
^
Switch to the cmplwi extended opcode, which avoids any confusion when reading the ISA, fixes the issue with the LLVM assembler, and also means the code could be built 64-bit in future (though that's very unlikely).
--- arch/powerpc/sysdev/dcr-low.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/sysdev/dcr-low.S +1 -1
@@ -15,7 +15,7 @@ #include <asm/export.h> #define DCR_ACCESS_PROLOG(table) \ - cmpli cr0,r3,1024; \ + cmplwi cr0,r3,1024; \ rlwinm r3,r3,4,18,27; \ lis r5,table@h; \ ori r5,r5,table@l; \
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 279/323 sh: check return code of request_irq
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 0e38225c92c7964482a8bb6b3e37fde4319e965c ]
request_irq is marked __must_check, but the call in shx3_prepare_cpus has a void return type, so it can't propagate failure to the caller. Follow cues from hexagon and just print an error.
--- arch/sh/kernel/cpu/sh4a/smp-shx3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/sh/kernel/cpu/sh4a/smp-shx3.c +3 -2
@@ -76,8 +76,9 @@ static void shx3_prepare_cpus(unsigned int max_cpus)BUILD_BUG_ON (SMP_MSG_NR >=8 );for (i =0 ; i <SMP_MSG_NR ; i++) -request_irq (104 + i, ipi_interrupt_handler, -IRQF_PERCPU ,"IPI" , (void *)(long )i); +if (request_irq (104 + i, ipi_interrupt_handler, +IRQF_PERCPU ,"IPI" , (void *)(long )i)) +pr_err ("Failed to request irq %d\n" , i);for (i =0 ; i < max_cpus; i++)set_cpu_present (i, true);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 280/323 maple: fix wrong return value of maple_bus_init().
In reply to Greg Kroah-HartmanFrom: Lu Wei <[email protected]>
[ Upstream commit bde82ee391fa6d3ad054313c4aa7b726d32515ce ]
If KMEM_CACHE or maple_alloc_dev failed, the maple_bus_init() will return 0 rather than error, because the retval is not changed after KMEM_CACHE or maple_alloc_dev failed.
--- drivers/sh/maple/maple.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/sh/maple/maple.c +4 -1
@@ -835,8 +835,10 @@ static int __init maple_bus_init(void) maple_queue_cache =KMEM_CACHE (maple_buffer,SLAB_HWCACHE_ALIGN ); -if (!maple_queue_cache) +if (!maple_queue_cache) { + retval = -ENOMEM ; goto cleanup_bothirqs; + }INIT_LIST_HEAD (&maple_waitq);INIT_LIST_HEAD (&maple_sentq);
@@ -849,6 +851,7 @@ static int __init maple_bus_init(void)if (!mdev[i]) {while (i-- >0 )maple_free_dev (mdev[i]); + retval = -ENOMEM ; goto cleanup_cache; } baseunits[i] = mdev[i];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 281/323 f2fs: fix up f2fs_lookup tracepoints
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit 70a9ac36ffd807ac506ed0b849f3e8ce3c6623f2 ]
Fix up a misuse that the filename pointer isn't always valid in the ring buffer, and we should copy the content instead.
--- include/trace/events/f2fs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/trace/events/f2fs.h +6 -6
@@ -751,20 +751,20 @@ TRACE_EVENT(f2fs_lookup_start,TP_STRUCT__entry (__field (dev_t ,dev )__field (ino_t, ino) - __field(const char *, name) + __string(name, dentry->d_name.name) __field(unsigned int, flags) ),TP_fast_assign ( __entry->dev = dir->i_sb->s_dev; __entry->ino = dir->i_ino; - __entry->name = dentry->d_name.name; +__assign_str (name, dentry->d_name.name); __entry->flags = flags; ),TP_printk ("dev = (%d,%d), pino = %lu, name:%s, flags:%u" ,show_dev_ino (__entry), - __entry->name, +__get_str (name), __entry->flags) );
@@ -778,7 +778,7 @@ TRACE_EVENT(f2fs_lookup_end,TP_STRUCT__entry (__field (dev_t ,dev )__field (ino_t, ino) - __field(const char *, name) + __string(name, dentry->d_name.name)__field (nid_t, cino)__field (int, err) ),
@@ -786,14 +786,14 @@ TRACE_EVENT(f2fs_lookup_end,TP_fast_assign ( __entry->dev = dir->i_sb->s_dev; __entry->ino = dir->i_ino; - __entry->name = dentry->d_name.name; +__assign_str (name, dentry->d_name.name); __entry->cino = ino; __entry->err = err; ),TP_printk ("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d" ,show_dev_ino (__entry), - __entry->name, +__get_str (name), __entry->cino, __entry->err) );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 282/323 sh: fix kconfig unmet dependency warning for FRAME_POINTER
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit fda1bc533094a7db68b11e7503d2c6c73993d12a ]
FRAME_POINTER depends on DEBUG_KERNEL so DWARF_UNWINDER should depend on DEBUG_KERNEL before selecting FRAME_POINTER.
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on [n]: DEBUG_KERNEL [=n] && (M68K || UML || SUPERH [=y]) || ARCH_WANT_FRAME_POINTERS [=n] Selected by [y]:
- DWARF_UNWINDER [=y]
--- arch/sh/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
arch/sh/Kconfig.debug +1 -0
@@ -58,6 +58,7 @@ config DUMP_CODE config DWARF_UNWINDER bool "Enable the DWARF unwinder for stacktraces" + depends on DEBUG_KERNEL select FRAME_POINTER depends on SUPERH32 default n
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 283/323 sh: define __BIG_ENDIAN for math-emu
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit b929926f01f2d14635345d22eafcf60feed1085e ]
Fix this by defining both ENDIAN macros in <asm/sfp-machine.h> so that they can be utilized in <math-emu/soft-fp.h> according to the latter's comment:
/* Allow sfp-machine to have its own byte order definitions. */
(This is what is done in arch/nds32/include/asm/sfp-machine.h.)
This placates these build warnings:
In file included from ../arch/sh/math-emu/math.c:23:.../include/math-emu/single.h:50:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef]
50 | #if __BYTE_ORDER == __BIG_ENDIAN
In file included from ../arch/sh/math-emu/math.c:24:.../include/math-emu/double.h:59:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef]
59 | #if __BYTE_ORDER == __BIG_ENDIAN
--- arch/sh/include/asm/sfp-machine.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/sh/include/asm/sfp-machine.h +8 -0
@@ -25,6 +25,14 @@#ifndef _SFP_MACHINE_H#define _SFP_MACHINE_H +#ifdef __BIG_ENDIAN__ +#define __BYTE_ORDER __BIG_ENDIAN +#define __LITTLE_ENDIAN 0 +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#define __BIG_ENDIAN 0 +#endif +#define _FP_W_TYPE_SIZE 32#define _FP_W_TYPE unsigned long#define _FP_WS_TYPE signed long
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 284/323 mips: BCM63XX: ensure that CPU_SUPPORTS_32BIT_KERNEL is set
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 5eeaafc8d69373c095e461bdb39e5c9b62228ac5 ]
Several header files need info on CONFIG_32BIT or CONFIG_64BIT, but kconfig symbol BCM63XX does not provide that info. This leads to many build errors, e.g.:
arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE'
return x - PAGE_OFFSET + PHYS_OFFSET;
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE'
return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT'
return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;
Selecting the SYS_HAS_CPU_BMIPS* symbols causes SYS_HAS_CPU_BMIPS to be set, which then selects CPU_SUPPORT_32BIT_KERNEL, which causes CONFIG_32BIT to be set. (a bit more indirect than v1 [RFC].)
--- arch/mips/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/Kconfig +3 -0
@@ -285,6 +285,9 @@ config BCM63XX select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_BIG_ENDIAN select SYS_HAS_EARLY_PRINTK + select SYS_HAS_CPU_BMIPS32_3300 + select SYS_HAS_CPU_BMIPS4350 + select SYS_HAS_CPU_BMIPS4380 select SWAP_IO_SPACE select GPIOLIB select HAVE_CLK
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 285/323 sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit 42dc938a590c96eeb429e1830123fef2366d9c80 ]
Nothing protects the access to the per_cpu variable sd_llc_id. When testing the same CPU (i.e. this_cpu == that_cpu), a race condition exists with update_top_cache_domain(). One scenario being:
CPU1 CPU2
==================================================================
per_cpu(sd_llc_id, CPUX) => 0
partition_sched_domains_locked()
detach_destroy_domains()
cpus_share_cache(CPUX, CPUX) update_top_cache_domain(CPUX)
per_cpu(sd_llc_id, CPUX) => 0
per_cpu(sd_llc_id, CPUX) = CPUX
per_cpu(sd_llc_id, CPUX) => CPUX
return false
ttwu_queue_cond() wouldn't catch smp_processor_id() == cpu and the result is a warning triggered from ttwu_queue_wakelist().
Avoid a such race in cpus_share_cache() by always returning true when this_cpu == that_cpu.
--- kernel/sched/core.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/sched/core.c +3 -0
@@ -1821,6 +1821,9 @@ out:bool cpus_share_cache (int this_cpu,int that_cpu) { +if (this_cpu == that_cpu) +return true; +return per_cpu (sd_llc_id, this_cpu) ==per_cpu (sd_llc_id, that_cpu); }#endif /* CONFIG_SMP */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 286/323 drm/nouveau: hdmigv100.c: fix corrupted HDMI Vendor InfoFrame
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 3cc1ae1fa70ab369e4645e38ce335a19438093ad ]
gv100_hdmi_ctrl() writes vendor_infoframe.subpack0_high to 0x6f0110, and then overwrites it with 0. Just drop the overwrite with 0, that's clearly a mistake.
Because of this issue the HDMI VIC is 0 instead of 1 in the HDMI Vendor InfoFrame when transmitting 4kp30.
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigv100.c +0 -1
@@ -62,7 +62,6 @@ gv100_hdmi_ctrl(struct nvkm_ior *ior, int head, bool enable, u8 max_ac_packet,nvkm_wr32 (device,0x6f0108 + hdmi, vendor_infoframe.header);nvkm_wr32 (device,0x6f010c + hdmi, vendor_infoframe.subpack0_low);nvkm_wr32 (device,0x6f0110 + hdmi, vendor_infoframe.subpack0_high); -nvkm_wr32 (device,0x6f0110 + hdmi,0x00000000 );nvkm_wr32 (device,0x6f0114 + hdmi,0x00000000 );nvkm_wr32 (device,0x6f0118 + hdmi,0x00000000 );nvkm_wr32 (device,0x6f011c + hdmi,0x00000000 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 287/323 net: bnx2x: fix variable dereferenced before check
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit f8885ac89ce310570e5391fe0bf0ec9c7c9b4fdc ]
Smatch says:
bnx2x_init_ops.h:640 bnx2x_ilt_client_mem_op() warn: variable dereferenced before check 'ilt' (see line 638)
Move ilt_cli variable initialization _after_ ilt validation, because it's unsafe to deref the pointer before validation check.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h +3 -1
@@ -635,11 +635,13 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num, {int i, rc;struct bnx2x_ilt *ilt =BP_ILT (bp); -struct ilt_client_info *ilt_cli = &ilt->clients[cli_num]; +struct ilt_client_info *ilt_cli;if (!ilt || !ilt->lines)return -1 ; + ilt_cli = &ilt->clients[cli_num]; +if (ilt_cli->flags & (ILT_CLIENT_SKIP_INIT |ILT_CLIENT_SKIP_MEM ))return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 288/323 iavf: check for null in iavf_fix_features
In reply to Greg Kroah-HartmanFrom: Nicholas Nunley <[email protected]>
[ Upstream commit 8a4a126f4be88eb8b5f00a165ab58c35edf4ef76 ]
If the driver has lost contact with the PF then it enters a disabled state and frees adapter->vf_res. However, ndo_fix_features can still be called on the interface, so we need to check for this condition first. Since we have no information on the features at this time simply leave them unmodified and return.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -1
@@ -3185,7 +3185,8 @@ static netdev_features_t i40evf_fix_features(struct net_device *netdev, {struct i40evf_adapter *adapter =netdev_priv (netdev); -if (!(adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN )) +if (adapter->vf_res && + !(adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN )) features &= ~(NETIF_F_HW_VLAN_CTAG_TX |NETIF_F_HW_VLAN_CTAG_RX |NETIF_F_HW_VLAN_CTAG_FILTER );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 289/323 iavf: Fix for the false positive ASQ/ARQ errors while issuing VF reset
In reply to Greg Kroah-HartmanFrom: Surabhi Boob <[email protected]>
[ Upstream commit 321421b57a12e933f92b228e0e6d0b2c6541f41d ]
While issuing VF Reset from the guest OS, the VF driver prints logs about critical / Overflow error detection. This is not an actual error since the VF_MBX_ARQLEN register is set to all FF's for a short period of time and the VF would catch the bits set if it was reading the register during that spike of time. This patch introduces an additional check to ignore this condition since the VF is in reset.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
@@ -2058,7 +2058,7 @@ static void i40evf_adminq_task(struct work_struct *work)/* check for error indications */ val =rd32 (hw, hw->aq.arq.len); -if (val ==0xdeadbeef )/* indicates device in reset */ +if (val ==0xdeadbeef || val ==0xffffffff )/* device in reset */ goto freedom; oldval = val;if (val &I40E_VF_ARQLEN1_ARQVFE_MASK ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 290/323 MIPS: generic/yamon-dt: fix uninitialized variable error
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 255e51da15baed47531beefd02f222e4dc01f1c1 ]
In the case where fw_getenv returns an error when fetching values for ememsizea and memsize then variable phys_memsize is not assigned a variable and will be uninitialized on a zero check of phys_memsize. Fix this by initializing phys_memsize to zero.
Cleans up cppcheck error:arch/mips/generic/yamon-dt.c:100:7: error: Uninitialized variable: phys_memsize [uninitvar]
--- arch/mips/generic/yamon-dt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/generic/yamon-dt.c +1 -1
@@ -79,7 +79,7 @@ static unsigned int __init gen_fdt_mem_array(__init int yamon_dt_append_memory (void *fdt,const struct yamon_mem_region *regions) { -unsigned long phys_memsize, memsize; +unsigned long phys_memsize =0 , memsize;__be32 mem_array[2 *MAX_MEM_ARRAY_ENTRIES ];unsigned int mem_entries;int i, err, mem_off;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 291/323 mips: bcm63xx: add support for clk_get_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit e8f67482e5a4bc8d0b65d606d08cb60ee123b468 ]
BCM63XX selects HAVE_LEGACY_CLK but does not provide/support clk_get_parent(), so add a simple implementation of that function so that callers of it will build without errors.
Fixes these build errors:
mips-linux-ld: drivers/iio/adc/ingenic-adc.o: in function `jz4770_adc_init_clk_div':
ingenic-adc.c:(.text+0xe4): undefined reference to `clk_get_parent'
mips-linux-ld: drivers/iio/adc/ingenic-adc.o: in function `jz4725b_adc_init_clk_div':
ingenic-adc.c:(.text+0x1b8): undefined reference to `clk_get_parent'
--- arch/mips/bcm63xx/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/bcm63xx/clk.c +6 -0
@@ -381,6 +381,12 @@ void clk_disable(struct clk *clk)EXPORT_SYMBOL (clk_disable); +struct clk *clk_get_parent (struct clk *clk) +{ +return NULL ; +} +EXPORT_SYMBOL (clk_get_parent); +unsigned long clk_get_rate (struct clk *clk) {if (!clk)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 292/323 mips: lantiq: add support for clk_get_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit fc1aabb088860d6cf9dd03612b7a6f0de91ccac2 ]
Provide a simple implementation of clk_get_parent() in the lantiq subarch so that callers of it will build without errors.
Fixes this build error:
ERROR: modpost: "clk_get_parent" [drivers/iio/adc/ingenic-adc.ko] undefined!
--- arch/mips/lantiq/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/lantiq/clk.c +6 -0
@@ -160,6 +160,12 @@ void clk_deactivate(struct clk *clk) }EXPORT_SYMBOL (clk_deactivate); +struct clk *clk_get_parent (struct clk *clk) +{ +return NULL ; +} +EXPORT_SYMBOL (clk_get_parent); +static inline u32 get_counter_resolution (void ) {u32 res;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 293/323 platform/x86: hp_accel: Fix an error handling path in lis3lv02d_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit c961a7d2aa23ae19e0099fbcdf1040fb760eea83 ]
If 'led_classdev_register()' fails, some additional resources should be released.
Add the missing 'i8042_remove_filter()' and 'lis3lv02d_remove_fs()' calls that are already in the remove function but are missing here.
--- drivers/platform/x86/hp_accel.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/hp_accel.c +2 -0
@@ -383,9 +383,11 @@ static int lis3lv02d_add(struct acpi_device *device)INIT_WORK (&hpled_led.work, delayed_set_status_worker); ret =led_classdev_register (NULL , &hpled_led.led_classdev);if (ret) { +i8042_remove_filter (hp_accel_i8042_filter);lis3lv02d_joystick_disable (&lis3_dev);lis3lv02d_poweroff (&lis3_dev);flush_work (&hpled_led.work); +lis3lv02d_remove_fs (&lis3_dev);return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 294/323 net: virtio_net_hdr_to_skb: count transport header in UFO
In reply to Greg Kroah-HartmanFrom: Jonathan Davies <[email protected]>
[ Upstream commit cf9acc90c80ecbee00334aa85d92f4e74014bcff ]
virtio_net_hdr_to_skb does not set the skb's gso_size and gso_type correctly for UFO packets received via virtio-net that are a little over the GSO size. This can lead to problems elsewhere in the networking stack, e.g. ovs_vport_send dropping over-sized packets if gso_size is not set.
This is due to the comparison
if (skb->len - p_off > gso_size)
not properly accounting for the transport layer header.
p_off includes the size of the transport layer header (thlen), so skb->len - p_off is the size of the TCP/UDP payload.
gso_size is read from the virtio-net header. For UFO, fragmentation happens at the IP level so does not need to include the UDP header.
Hence the calculation could be comparing a TCP/UDP payload length with an IP payload length, causing legitimate virtio-net packets to have lack gso_type/gso_size information.
Example: a UDP packet with payload size 1473 has IP payload size 1481. If the guest used UFO, it is not fragmented and the virtio-net header's flags indicate that it is a GSO frame (VIRTIO_NET_HDR_GSO_UDP), with gso_size = 1480 for an MTU of 1500. skb->len will be 1515 and p_off will be 42, so skb->len - p_off = 1473. Hence the comparison fails, and shinfo->gso_size and gso_type are not set as they should be.
Instead, add the UDP header length before comparing to gso_size when using UFO. In this way, it is the size of the IP payload that is compared to gso_size.
--- include/linux/virtio_net.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/virtio_net.h +6 -1
@@ -120,10 +120,15 @@ retry:if (hdr->gso_type !=VIRTIO_NET_HDR_GSO_NONE ) {u16 gso_size =__virtio16_to_cpu (little_endian, hdr->gso_size); +unsigned int nh_off = p_off;struct skb_shared_info *shinfo =skb_shinfo (skb); +/* UFO may not include transport header in gso_size. */ +if (gso_type &SKB_GSO_UDP ) + nh_off -= thlen; +/* Too small packets are not really GSO ones. */ -if (skb->len - p_off > gso_size) { +if (skb->len - nh_off > gso_size) { shinfo->gso_size = gso_size; shinfo->gso_type = gso_type;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 295/323 i40e: Fix correct max_pkt_size on VF RX queue
In reply to Greg Kroah-HartmanFrom: Eryk Rybak <[email protected]>
[ Upstream commit 6afbd7b3c53cb7417189f476e99d431daccb85b0 ]
Setting VLAN port increasing RX queue max_pkt_size by 4 bytes to take VLAN tag into account. Trigger the VF reset when setting port VLAN for VF to renegotiate its capabilities and reinitialize.
--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 53 ++++--------------- 1 file changed, 9 insertions(+), 44 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +9 -44
@@ -621,14 +621,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,u16 vsi_queue_id, struct virtchnl_rxq_info *info) { + u16 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);struct i40e_pf *pf = vf->pf; +struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];struct i40e_hw *hw = &pf->hw;struct i40e_hmc_obj_rxq rx_ctx; -u16 pf_queue_id;int ret =0 ; - pf_queue_id =i40e_vc_get_pf_queue_id (vf, vsi_id, vsi_queue_id); -/* clear the context structure first */ memset (&rx_ctx,0 ,sizeof (struct i40e_hmc_obj_rxq ));
@@ -666,6 +665,10 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id, } rx_ctx.rxmax = info->max_pkt_size; +/* if port VLAN is configured increase the max packet size */ +if (vsi->info.pvid) + rx_ctx.rxmax +=VLAN_HLEN ; +/* enable 32bytes desc always */ rx_ctx.dsize =1 ;
@@ -3927,34 +3930,6 @@ error_param:return ret; } -/** -* i40e_vsi_has_vlans - True if VSI has configured VLANs -* @vsi: pointer to the vsi -* -* Check if a VSI has configured any VLANs. False if we have a port VLAN or if -* we have no configured VLANs. Do not call while holding the -* mac_filter_hash_lock. -*/ -static bool i40e_vsi_has_vlans (struct i40e_vsi *vsi) -{ -bool have_vlans; - -/* If we have a port VLAN, then the VSI cannot have any VLANs -* configured, as all MAC/VLAN filters will be assigned to the PVID. -*/ -if (vsi->info.pvid) -return false; - -/* Since we don't have a PVID, we know that if the device is in VLAN -* mode it must be because of a VLAN filter configured on this VSI. -*/ -spin_lock_bh (&vsi->mac_filter_hash_lock); - have_vlans =i40e_is_vsi_in_vlan (vsi); -spin_unlock_bh (&vsi->mac_filter_hash_lock); - -return have_vlans; -} -/** * i40e_ndo_set_vf_port_vlan * @netdev: network interface device structure
@@ -4007,19 +3982,9 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,/* duplicate request, so just return success */ goto error_pvid; -if (i40e_vsi_has_vlans (vsi)) { -dev_err (&pf->pdev->dev, -"VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n" , - vf_id); -/* Administrator Error - knock the VF offline until he does -* the right thing by reconfiguring his network correctly -* and then reloading the VF driver. -*/ -i40e_vc_disable_vf (vf); -/* During reset the VF got a new VSI, so refresh the pointer. */ - vsi = pf->vsi[vf->lan_vsi_idx]; - } - +i40e_vc_disable_vf (vf); +/* During reset the VF got a new VSI, so refresh a pointer. */ + vsi = pf->vsi[vf->lan_vsi_idx];/* Locked once because multiple functions below iterate list */ spin_lock_bh (&vsi->mac_filter_hash_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 296/323 i40e: Fix NULL ptr dereference on VSI filter sync
In reply to Greg Kroah-HartmanFrom: Michal Maloszewski <[email protected]>
[ Upstream commit 37d9e304acd903a445df8208b8a13d707902dea6 ]
Remove the reason of null pointer dereference in sync VSI filters. Added new I40E_VSI_RELEASING flag to signalize deleting and releasing of VSI resources to sync this thread with sync filters subtask. Without this patch it is possible to start update the VSI filter list after VSI is removed, that's causing a kernel oops.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -166,6 +166,7 @@ enum i40e_vsi_state_t { __I40E_VSI_OVERFLOW_PROMISC, __I40E_VSI_REINIT_REQUESTED, __I40E_VSI_DOWN_REQUESTED, + __I40E_VSI_RELEASING,/* This must be last as it determines the size of the BITMAP */ __I40E_VSI_STATE_SIZE__, };
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -2
@@ -2584,7 +2584,8 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)for (v =0 ; v < pf->num_alloc_vsi; v++) {if (pf->vsi[v] && - (pf->vsi[v]->flags &I40E_VSI_FLAG_FILTER_CHANGED )) { + (pf->vsi[v]->flags &I40E_VSI_FLAG_FILTER_CHANGED ) && + !test_bit (__I40E_VSI_RELEASING, pf->vsi[v]->state)) {int ret =i40e_sync_vsi_filters (pf->vsi[v]);if (ret) {
@@ -12444,7 +12445,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)dev_info (&pf->pdev->dev,"Can't remove PF VSI\n" );return -ENODEV ; } - +set_bit (__I40E_VSI_RELEASING, vsi->state); uplink_seid = vsi->uplink_seid;if (vsi->type !=I40E_VSI_SRIOV ) {if (vsi->netdev_registered) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 297/323 i40e: Fix changing previously set num_queue_pairs for PFs
In reply to Greg Kroah-HartmanFrom: Eryk Rybak <[email protected]>
[ Upstream commit d2a69fefd75683004ffe87166de5635b3267ee07 ]
Currently, the i40e_vsi_setup_queue_map is basing the count of queues in TCs on a VSI's alloc_queue_pairs member which is not changed throughout any user's action (for example via ethtool's set_channels callback).
This implies that vsi->tc_config.tc_info[n].qcount value that is given to the kernel via netdev_set_tc_queue() that notifies about the count of queues per particular traffic class is constant even if user has changed the total count of queues.
This in turn caused the kernel warning after setting the queue count to the lower value than the initial one:
$ ethtool -l ens801f0 Channel parameters for ens801f0: Pre-set maximums: RX: 0 TX: 0 Other: 1 Combined: 64 Current hardware settings: RX: 0 TX: 0 Other: 1 Combined: 64
$ ethtool -L ens801f0 combined 40
[dmesg]
Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!
Reason was that vsi->alloc_queue_pairs stayed at 64 value which was used to set the qcount on TC0 (by default only TC0 exists so all of the existing queues are assigned to TC0). we update the offset/qcount via netdev_set_tc_queue() back to the old value but then the netif_set_real_num_tx_queues() is using the vsi->num_queue_pairs as a value which got set to 40.
Fix it by using vsi->req_queue_pairs as a queue count that will be distributed across TCs. Do it only for non-zero values, which implies that user actually requested the new count of queues.
For VSIs other than main, stay with the vsi->alloc_queue_pairs as we only allow manipulating the queue count on main VSI.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 35 ++++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +23 -12
@@ -1765,6 +1765,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, bool is_add) {struct i40e_pf *pf = vsi->back; +u16 num_tc_qps =0 ;u16 sections =0 ;u8 netdev_tc =0 ;u16 numtc =1 ;
@@ -1772,13 +1773,29 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,u8 offset;u16 qmap;int i; -u16 num_tc_qps =0 ; sections =I40E_AQ_VSI_PROP_QUEUE_MAP_VALID ; offset =0 ; +if (vsi->type ==I40E_VSI_MAIN ) { +/* This code helps add more queue to the VSI if we have +* more cores than RSS can support, the higher cores will +* be served by ATR or other filters. Furthermore, the +* non-zero req_queue_pairs says that user requested a new +* queue count via ethtool's set_channels, so use this +* value for queues distribution across traffic classes +*/ +if (vsi->req_queue_pairs >0 ) + vsi->num_queue_pairs = vsi->req_queue_pairs; +else if (pf->flags &I40E_FLAG_MSIX_ENABLED ) + vsi->num_queue_pairs = pf->num_lan_msix; + } +/* Number of queues per enabled TC */ - num_tc_qps = vsi->alloc_queue_pairs; +if (vsi->type ==I40E_VSI_MAIN ) + num_tc_qps = vsi->num_queue_pairs; +else + num_tc_qps = vsi->alloc_queue_pairs;if (enabled_tc && (vsi->back->flags &I40E_FLAG_DCB_ENABLED )) {/* Find numtc from enabled TC bitmap */ for (i =0 , numtc =0 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) {
@@ -1856,16 +1873,10 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, } ctxt->info.tc_mapping[i] =cpu_to_le16 (qmap); } - -/* Set actual Tx/Rx queue pairs */ - vsi->num_queue_pairs = offset; -if ((vsi->type ==I40E_VSI_MAIN ) && (numtc ==1 )) { -if (vsi->req_queue_pairs >0 ) - vsi->num_queue_pairs = vsi->req_queue_pairs; -else if (pf->flags &I40E_FLAG_MSIX_ENABLED ) - vsi->num_queue_pairs = pf->num_lan_msix; - } - +/* Do not change previously set num_queue_pairs for PFs */ +if ((vsi->type ==I40E_VSI_MAIN && numtc !=1 ) || + vsi->type !=I40E_VSI_MAIN ) + vsi->num_queue_pairs = offset;/* Scheduler section valid can only be set for ADD VSI */ if (is_add) { sections |=I40E_AQ_VSI_PROP_SCHED_VALID ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 298/323 i40e: Fix display error code in dmesg
In reply to Greg Kroah-HartmanFrom: Grzegorz Szczurek <[email protected]>
[ Upstream commit 5aff430d4e33a0b48a6b3d5beb06f79da23f9916 ]
Fix misleading display error in dmesg if tc filter return fail. Only i40e status error code should be converted to string, not linux error code. Otherwise, we return false information about the error.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -3
@@ -7517,9 +7517,8 @@ static int i40e_configure_clsflower(struct i40e_vsi *vsi, err =i40e_add_del_cloud_filter (vsi, filter, true);if (err) { -dev_err (&pf->pdev->dev, -"Failed to add cloud filter, err %s\n" , -i40e_stat_str (&pf->hw, err)); +dev_err (&pf->pdev->dev,"Failed to add cloud filter, err %d\n" , + err); goto err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 299/323 NFC: reorganize the functions in nci_request
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 86cdf8e38792545161dbe3350a7eced558ba4d15 ]
There is a possible data race as shown below:
thread-A in nci_request() | thread-B in nci_close_device()
| mutex_lock(&ndev->req_lock);
test_bit(NCI_UP, &ndev->flags); |
... | test_and_clear_bit(NCI_UP, &ndev->flags)
mutex_lock(&ndev->req_lock); |
|This race will allow __nci_request() to be awaked while the device is getting removed.
Similar to commit e2cb6b891ad2 ("bluetooth: eliminate the potential race condition when removing the HCI controller"). this patch alters the function sequence in nci_request() to prevent the data races between the nci_close_device().
--- net/nfc/nci/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/nfc/nci/core.c +7 -4
@@ -156,12 +156,15 @@ inline int nci_request(struct nci_dev *ndev, {int rc; -if (!test_bit (NCI_UP , &ndev->flags)) -return -ENETDOWN ; -/* Serialize all requests */ mutex_lock (&ndev->req_lock); - rc =__nci_request (ndev, req, opt, timeout); +/* check the state after obtaing the lock against any races +* from nci_close_device when the device gets removed. +*/ +if (test_bit (NCI_UP , &ndev->flags)) + rc =__nci_request (ndev, req, opt, timeout); +else + rc = -ENETDOWN ;mutex_unlock (&ndev->req_lock);return rc;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 300/323 NFC: reorder the logic in nfc_{un,}register_device
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 3e3b5dfcd16a3e254aab61bd1e8c417dd4503102 ]
There is a potential UAF between the unregistration routine and the NFC netlink operations.
The race that cause that UAF can be shown as below:
(FREE) | (USE)
nfcmrvl_nci_unregister_dev | nfc_genl_dev_up
nci_close_device |
nci_unregister_device | nfc_get_device
nfc_unregister_device | nfc_dev_up
rfkill_destory |
device_del | rfkill_blocked
... | ...The root cause for this race is concluded below:
1. The rfkill_blocked (USE) in nfc_dev_up is supposed to be placed after the device_is_registered check.
2. Since the netlink operations are possible just after the device_add in nfc_register_device, the nfc_dev_up() can happen anywhere during the rfkill creation process, which leads to data race.
This patch reorder these actions to permit
1. Once device_del is finished, the nfc_dev_up cannot dereference the rfkill object.
2. The rfkill_register need to be placed after the device_add of nfc_dev because the parent device need to be created first. So this patch keeps the order but inject device_lock to prevent the data race.
--- net/nfc/core.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
net/nfc/core.c +18 -14
@@ -106,13 +106,13 @@ int nfc_dev_up(struct nfc_dev *dev)device_lock (&dev->dev); -if (dev->rfkill &&rfkill_blocked (dev->rfkill)) { - rc = -ERFKILL ; +if (!device_is_registered (&dev->dev)) { + rc = -ENODEV ; goto error; } -if (!device_is_registered (&dev->dev)) { - rc = -ENODEV ; +if (dev->rfkill &&rfkill_blocked (dev->rfkill)) { + rc = -ERFKILL ; goto error; }
@@ -1130,11 +1130,7 @@ int nfc_register_device(struct nfc_dev *dev)if (rc)pr_err ("Could not register llcp device\n" ); - rc =nfc_genl_device_added (dev); -if (rc) -pr_debug ("The userspace won't be notified that the device %s was added\n" , -dev_name (&dev->dev)); - +device_lock (&dev->dev); dev->rfkill =rfkill_alloc (dev_name (&dev->dev), &dev->dev,RFKILL_TYPE_NFC , &nfc_rfkill_ops, dev);if (dev->rfkill) {
@@ -1143,6 +1139,12 @@ int nfc_register_device(struct nfc_dev *dev) dev->rfkill =NULL ; } } +device_unlock (&dev->dev); + + rc =nfc_genl_device_added (dev); +if (rc) +pr_debug ("The userspace won't be notified that the device %s was added\n" , +dev_name (&dev->dev));return 0 ; }
@@ -1159,10 +1161,17 @@ void nfc_unregister_device(struct nfc_dev *dev)pr_debug ("dev_name=%s\n" ,dev_name (&dev->dev)); + rc =nfc_genl_device_removed (dev); +if (rc) +pr_debug ("The userspace won't be notified that the device %s " +"was removed\n" ,dev_name (&dev->dev)); + +device_lock (&dev->dev);if (dev->rfkill) {rfkill_unregister (dev->rfkill);rfkill_destroy (dev->rfkill); } +device_unlock (&dev->dev);if (dev->ops->check_presence) {device_lock (&dev->dev);
@@ -1172,11 +1181,6 @@ void nfc_unregister_device(struct nfc_dev *dev)cancel_work_sync (&dev->check_pres_work); } - rc =nfc_genl_device_removed (dev); -if (rc) -pr_debug ("The userspace won't be notified that the device %s " -"was removed\n" ,dev_name (&dev->dev)); -nfc_llcp_unregister_device (dev);mutex_lock (&nfc_devlist_mutex);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 301/323 perf bench: Fix two memory leaks detected with ASan
In reply to Greg Kroah-HartmanFrom: Sohaib Mohamed <[email protected]>
[ Upstream commit 92723ea0f11d92496687db8c9725248e9d1e5e1d ]
ASan reports memory leaks while running:
$ perf bench sched all
--- tools/perf/bench/sched-messaging.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/bench/sched-messaging.c +4 -0
@@ -226,6 +226,8 @@ static unsigned int group(pthread_t *pth, snd_ctx->out_fds[i] = fds[1 ];if (!thread_mode)close (fds[0 ]); + +free (ctx); }/* Now we have all the fds, fork the senders */
@@ -242,6 +244,8 @@ static unsigned int group(pthread_t *pth,for (i =0 ; i < num_fds; i++)close (snd_ctx->out_fds[i]); +free (snd_ctx); +/* Return number of children to reap */ return num_fds *2 ; }
Signature · 1 line
2.33.0
A message that is not in the archive (sent off-list or not yet received): CAOz-JA4kZFoOig-aNu0yai+DE81XbNBkWUAaAYgUW4TQSCoY3g@mail.gmail.com
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 301/323] perf bench: Fix two memory leaks detected with ASan
Quoted 5 lines · Sohaib Mohamed
Hello, Greg
On Wed, Nov 24, 2021, 2:45 PM Greg Kroah-Hartman <[email protected]> wrote:
Quoted 7 lines
Quoted 4 lines
From: Sohaib Mohamed <[email protected]>
[ Upstream commit
92723ea0f11d92496687db8c9725248e9d1e5e1d]Please, remove this patch from the queue.
This patch has a problem and should be reverted.
Dropped from all branches now, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 302/323 perf/x86/intel/uncore: Fix filter_tid mask for CHA events on Skylake Server
In reply to Greg Kroah-HartmanFrom: Alexander Antonov <[email protected]>
[ Upstream commit e324234e0aa881b7841c7c713306403e12b069ff ]
According Uncore Reference Manual: any of the CHA events may be filtered by Thread/Core-ID by using tid modifier in CHA Filter 0 Register. Update skx_cha_hw_config() to follow Uncore Guide.
--- arch/x86/events/intel/uncore_snbep.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/events/intel/uncore_snbep.c +3 -0
@@ -3416,6 +3416,9 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *evstruct hw_perf_event_extra *reg1 = &event->hw.extra_reg;struct extra_reg *er;int idx =0 ; +/* Any of the CHA events may be filtered by Thread/Core-ID.*/ +if (event->hw.config &SNBEP_CBO_PMON_CTL_TID_EN ) + idx =SKX_CHA_MSR_PMON_BOX_FILTER_TID ;for (er = skx_uncore_cha_extra_regs; er->msr; er++) {if (er->event != (event->hw.config & er->config_mask))
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 303/323 perf/x86/intel/uncore: Fix IIO event constraints for Skylake Server
In reply to Greg Kroah-HartmanFrom: Alexander Antonov <[email protected]>
[ Upstream commit 3866ae319c846a612109c008f43cba80b8c15e86 ]
According to the latest uncore document, COMP_BUF_OCCUPANCY (0xd5) event can be collected on 2-3 counters. Update uncore IIO event constraints for Skylake Server.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -3486,6 +3486,7 @@ static struct event_constraint skx_uncore_iio_constraints[] = {UNCORE_EVENT_CONSTRAINT (0xc0 ,0xc ),UNCORE_EVENT_CONSTRAINT (0xc5 ,0xc ),UNCORE_EVENT_CONSTRAINT (0xd4 ,0xc ), +UNCORE_EVENT_CONSTRAINT (0xd5 ,0xc ), EVENT_CONSTRAINT_END };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 304/323 tun: fix bonding active backup with arp monitoring
In reply to Greg Kroah-HartmanFrom: Nicolas Dichtel <[email protected]>
commit a31d27fbed5d518734cb60956303eb15089a7634 upstream.
As stated in the bonding doc, trans_start must be set manually for drivers using NETIF_F_LLTX:
Drivers that use NETIF_F_LLTX flag must also update netdev_queue->trans_start. If they do not, then the ARP monitor will immediately fail any slaves using that driver, and those slaves will stay down.
--- drivers/net/tun.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/tun.c +5 -0
@@ -1085,6 +1085,7 @@ static netdev_tx_t tun_net_xmit(struct s {struct tun_struct *tun =netdev_priv (dev);int txq = skb->queue_mapping; +struct netdev_queue *queue;struct tun_file *tfile;int len = skb->len;
@@ -1131,6 +1132,10 @@ static netdev_tx_t tun_net_xmit(struct sif (ptr_ring_produce (&tfile->tx_ring, skb)) goto drop; +/* NETIF_F_LLTX requires to do our own update of trans_start */ + queue =netdev_get_tx_queue (dev, txq); + queue->trans_start = jiffies; +/* Notify and wake up reader process */ if (tfile->flags &TUN_FASYNC )kill_fasync (&tfile->fasync,SIGIO ,POLL_IN );
Greg Kroah-Hartman
maintainerPATCH 305/323 hexagon: export raw I/O routines for modules
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit ffb92ce826fd801acb0f4e15b75e4ddf0d189bde upstream.
Patch series "Fixes for ARCH=hexagon allmodconfig", v2.
This series fixes some issues noticed with ARCH=hexagon allmodconfig.
This patch (of 3):
When building ARCH=hexagon allmodconfig, the following errors occur:
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/svc-i3c-master.ko] undefined!
ERROR: modpost: "__raw_writesl" [drivers/i3c/master/dw-i3c-master.ko] undefined!
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/dw-i3c-master.ko] undefined!
ERROR: modpost: "__raw_writesl" [drivers/i3c/master/i3c-master-cdns.ko] undefined!
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/i3c-master-cdns.ko] undefined!
Export these symbols so that modules can use them without any errors.
--- arch/hexagon/lib/io.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/hexagon/lib/io.c +4 -0
@@ -40,6 +40,7 @@ void __raw_readsw(const void __iomem *ad *dst++ = *src; } +EXPORT_SYMBOL (__raw_readsw);/* * __raw_writesw - read words a short at a time
@@ -60,6 +61,7 @@ void __raw_writesw(void __iomem *addr, c } +EXPORT_SYMBOL (__raw_writesw);/* Pretty sure len is pre-adjusted for the length of the access already */ void __raw_readsl (const void __iomem *addr,void *data,int len)
@@ -75,6 +77,7 @@ void __raw_readsl(const void __iomem *ad } +EXPORT_SYMBOL (__raw_readsl);void __raw_writesl (void __iomem *addr,const void *data,int len) {
@@ -89,3 +92,4 @@ void __raw_writesl(void __iomem *addr, c } +EXPORT_SYMBOL (__raw_writesl);
Greg Kroah-Hartman
maintainerPATCH 306/323 ipc: WARN if trying to remove ipc object which is absent
In reply to Greg Kroah-HartmanFrom: Alexander Mikhalitsyn <[email protected]>
commit 126e8bee943e9926238c891e2df5b5573aee76bc upstream.
Patch series "shm: shm_rmid_forced feature fixes".
Some time ago I met kernel crash after CRIU restore procedure, fortunately, it was CRIU restore, so, I had dump files and could do restore many times and crash reproduced easily. After some investigation I've constructed the minimal reproducer. It was found that it's use-after-free and it happens only if sysctl kernel.shm_rmid_forced = 1.
The key of the problem is that the exit_shm() function not handles shp's object destroy when task->sysvshm.shm_clist contains items from different IPC namespaces. In most cases this list will contain only items from one IPC namespace.
How can this list contain object from different namespaces? The exit_shm() function is designed to clean up this list always when process leaves IPC namespace. But we made a mistake a long time ago and did not add a exit_shm() call into the setns() syscall procedures.
The first idea was just to add this call to setns() syscall but it obviously changes semantics of setns() syscall and that's userspace-visible change. So, I gave up on this idea.
The first real attempt to address the issue was just to omit forced destroy if we meet shp object not from current task IPC namespace [1]. But that was not the best idea because task->sysvshm.shm_clist was protected by rwsem which belongs to current task IPC namespace. It means that list corruption may occur.
Second approach is just extend exit_shm() to properly handle shp's from different IPC namespaces [2]. This is really non-trivial thing, I've put a lot of effort into that but not believed that it's possible to make it fully safe, clean and clear.
Thanks to the efforts of Manfred Spraul working an elegant solution was designed. Thanks a lot, Manfred!
Eric also suggested the way to address the issue in ("[RFC][PATCH] shm:
In shm_exit destroy all created and never attached segments") Eric's idea was to maintain a list of shm_clists one per IPC namespace, use lock-less lists. But there is some extra memory consumption-related concerns.
An alternative solution which was suggested by me was implemented in ("shm: reset shm_clist on setns but omit forced shm destroy"). The idea is pretty simple, we add exit_shm() syscall to setns() but DO NOT destroy shm segments even if sysctl kernel.shm_rmid_forced = 1, we just clean up the task->sysvshm.shm_clist list.
This chages semantics of setns() syscall a little bit but in comparision to the "naive" solution when we just add exit_shm() without any special exclusions this looks like a safer option.
[1] https://lkml.org/lkml/2021/7/6/1108
[2] https://lkml.org/lkml/2021/7/14/736
This patch (of 2):
Let's produce a warning if we trying to remove non-existing IPC object from IPC namespace kht/idr structures.
This allows us to catch possible bugs when the ipc_rmid() function was called with inconsistent struct ipc_ids*, struct kern_ipc_perm* arguments.
--- ipc/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
ipc/util.c +3 -3
@@ -417,8 +417,8 @@ static int ipcget_public(struct ipc_namestatic void ipc_kht_remove (struct ipc_ids *ids,struct kern_ipc_perm *ipcp) {if (ipcp->key !=IPC_PRIVATE ) -rhashtable_remove_fast (&ids->key_ht, &ipcp->khtnode, - ipc_kht_params); +WARN_ON_ONCE (rhashtable_remove_fast (&ids->key_ht, &ipcp->khtnode, + ipc_kht_params)); }/**
@@ -433,7 +433,7 @@ void ipc_rmid(struct ipc_ids *ids, struc {int idx =ipcid_to_idx (ipcp->id); -idr_remove (&ids->ipcs_idr, idx); +WARN_ON_ONCE (idr_remove (&ids->ipcs_idr, idx) != ipcp);ipc_kht_remove (ids, ipcp); ids->in_use--; ipcp->deleted = true;
Greg Kroah-Hartman
maintainerPATCH 307/323 mm: kmemleak: slob: respect SLAB_NOLEAKTRACE flag
In reply to Greg Kroah-HartmanFrom: Rustam Kovhaev <[email protected]>
commit 34dbc3aaf5d9e89ba6cc5e24add9458c21ab1950 upstream.
When kmemleak is enabled for SLOB, system does not boot and does not print anything to the console. At the very early stage in the boot process we hit infinite recursion from kmemleak_init() and eventually kernel crashes.
kmemleak_init() specifies SLAB_NOLEAKTRACE for KMEM_CACHE(), but kmem_cache_create_usercopy() removes it because CACHE_CREATE_MASK is not valid for SLOB.
Let's fix CACHE_CREATE_MASK and make kmemleak work with SLOB
--- mm/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/slab.h +1 -1
@@ -148,7 +148,7 @@ static inline slab_flags_t kmem_cache_fl#define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \ SLAB_TEMPORARY | SLAB_ACCOUNT)#else -#define SLAB_CACHE_FLAGS (0) +#define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE)#endif /* Common flags available with current configuration */
Greg Kroah-Hartman
maintainerPATCH 308/323 x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit daf972118c517b91f74ff1731417feb4270625a4 upstream.
Check for a valid hv_vp_index array prior to derefencing hv_vp_index when setting Hyper-V's TSC change callback. If Hyper-V setup failed in hyperv_init(), the kernel will still report that it's running under Hyper-V, but will have silently disabled nearly all functionality.
BUG: kernel NULL pointer dereference, address: 0000000000000010 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc2+ #75 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:set_hv_tscchange_cb+0x15/0xa0 Code: <8b> 04 82 8b 15 12 17 85 01 48 c1 e0 20 48 0d ee 00 01 00 f6 c6 08 ... Call Trace: kvm_arch_init+0x17c/0x280 kvm_init+0x31/0x330 vmx_init+0xba/0x13a do_one_initcall+0x41/0x1c0 kernel_init_freeable+0x1f2/0x23b kernel_init+0x16/0x120 ret_from_fork+0x22/0x30
--- arch/x86/hyperv/hv_init.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/hyperv/hv_init.c +3 -0
@@ -200,6 +200,9 @@ void set_hv_tscchange_cb(void (*cb)(voidreturn ; } +if (!hv_vp_index) +return ; + hv_reenlightenment_cb = cb;/* Make sure callback is registered before we write to MSRs */
Greg Kroah-Hartman
maintainerPATCH 309/323 udf: Fix crash after seekdir
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit a48fc69fe6588b48d878d69de223b91a386a7cb4 upstream.
udf_readdir() didn't validate the directory position it should start reading from. Thus when user uses lseek(2) on directory file descriptor it can trick udf_readdir() into reading from a position in the middle of directory entry which then upsets directory parsing code resulting in errors or even possible kernel crashes. Similarly when the directory is modified between two readdir calls, the directory position need not be valid anymore.
Add code to validate current offset in the directory. This is actually rather expensive for UDF as we need to read from the beginning of the directory and parse all directory entries. This is because in UDF a directory is just a stream of data containing directory entries and since file names are fully under user's control we cannot depend on detecting magic numbers and checksums in the header of directory entry as a malicious attacker could fake them. We skip this step if we detect that nothing changed since the last readdir call.
--- fs/udf/dir.c | 32 ++++++++++++++++++++++++++++++-- fs/udf/namei.c | 3 +++ fs/udf/super.c | 2 ++ 3 files changed, 35 insertions(+), 2 deletions(-)
fs/udf/dir.c +30 -2
@@ -31,6 +31,7 @@#include <linux/mm.h> #include <linux/slab.h> #include <linux/bio.h> +#include <linux/iversion.h> #include "udf_i.h" #include "udf_sb.h"
@@ -44,7 +45,7 @@ static int udf_readdir(struct file *filestruct fileIdentDesc *fi =NULL ;struct fileIdentDesc cfi;udf_pblk_t block, iblock; -loff_t nf_pos; +loff_t nf_pos, emit_pos =0 ;int flen;unsigned char *fname =NULL , *copy_name =NULL ;unsigned char *nameptr;
@@ -58,6 +59,7 @@ static int udf_readdir(struct file *fileint i, num, ret =0 ;struct extent_position epos = {NULL ,0 , {0 ,0 } };struct super_block *sb = dir->i_sb; +bool pos_valid = false;if (ctx->pos ==0 ) {if (!dir_emit_dot (file, ctx))
@@ -68,6 +70,21 @@ static int udf_readdir(struct file *fileif (nf_pos >= size) goto out; +/* +* Something changed since last readdir (either lseek was called or dir +* changed)? We need to verify the position correctly points at the +* beginning of some dir entry so that the directory parsing code does +* not get confused. Since UDF does not have any reliable way of +* identifying beginning of dir entry (names are under user control), +* we need to scan the directory from the beginning. +*/ +if (!inode_eq_iversion (dir, file->f_version)) { + emit_pos = nf_pos; + nf_pos =0 ; + }else { + pos_valid = true; + } + fname =kmalloc (UDF_NAME_LEN ,GFP_NOFS );if (!fname) { ret = -ENOMEM ;
@@ -123,13 +140,21 @@ static int udf_readdir(struct file *filewhile (nf_pos < size) {struct kernel_lb_addr tloc; +loff_t cur_pos = nf_pos; - ctx->pos = (nf_pos >>2 ) +1 ; +/* Update file position only if we got past the current one */ +if (nf_pos >= emit_pos) { + ctx->pos = (nf_pos >>2 ) +1 ; + pos_valid = true; + } fi =udf_fileident_read (dir, &nf_pos, &fibh, &cfi, &epos, &eloc, &elen, &offset);if (!fi) goto out; +/* Still not at offset where user asked us to read from? */ +if (cur_pos < emit_pos) +continue ; liu =le16_to_cpu (cfi.lengthOfImpUse); lfi = cfi.lengthFileIdent;
@@ -187,8 +212,11 @@ static int udf_readdir(struct file *file }/* end while */ ctx->pos = (nf_pos >>2 ) +1 ; + pos_valid = true; out: +if (pos_valid) + file->f_version =inode_query_iversion (dir);if (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh);
fs/udf/namei.c +3 -0
@@ -30,6 +30,7 @@#include <linux/sched.h> #include <linux/crc-itu-t.h> #include <linux/exportfs.h> +#include <linux/iversion.h> static inline int udf_match (int len1,const unsigned char *name1,int len2,const unsigned char *name2)
@@ -135,6 +136,8 @@ int udf_write_fi(struct inode *inode, stmark_buffer_dirty_inode (fibh->ebh, inode);mark_buffer_dirty_inode (fibh->sbh, inode); } +inode_inc_iversion (inode); +return 0 ; }
fs/udf/super.c +2 -0
@@ -57,6 +57,7 @@#include <linux/crc-itu-t.h> #include <linux/log2.h> #include <asm/byteorder.h> +#include <linux/iversion.h> #include "udf_sb.h" #include "udf_i.h"
@@ -151,6 +152,7 @@ static struct inode *udf_alloc_inode(strinit_rwsem (&ei->i_data_sem); ei->cached_extent.lstart =-1 ;spin_lock_init (&ei->i_extent_cache_lock); +inode_set_iversion (&ei->vfs_inode,1 );return &ei->vfs_inode; }
Greg Kroah-Hartman
maintainerPATCH 310/323 btrfs: fix memory ordering between normal and ordered work functions
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
commit 45da9c1767ac31857df572f0a909fbe88fd5a7e9 upstream.
Ordered work functions aren't guaranteed to be handled by the same thread which executed the normal work functions. The only way execution between normal/ordered functions is synchronized is via the WORK_DONE_BIT, unfortunately the used bitops don't guarantee any ordering whatsoever.
This manifested as seemingly inexplicable crashes on ARM64, where async_chunk::inode is seen as non-null in async_cow_submit which causes submit_compressed_extents to be called and crash occurs because async_chunk::inode suddenly became NULL. The call trace was similar to:
pc : submit_compressed_extents+0x38/0x3d0
lr : async_cow_submit+0x50/0xd0
sp : ffff800015d4bc20 <registers omitted for brevity>
Call trace:
submit_compressed_extents+0x38/0x3d0
async_cow_submit+0x50/0xd0
run_ordered_work+0xc8/0x280
btrfs_work_helper+0x98/0x250
process_one_work+0x1f0/0x4ac
worker_thread+0x188/0x504
kthread+0x110/0x114
ret_from_fork+0x10/0x18Fix this by adding respective barrier calls which ensure that all accesses preceding setting of WORK_DONE_BIT are strictly ordered before setting the flag. At the same time add a read barrier after reading of WORK_DONE_BIT in run_ordered_work which ensures all subsequent loads would be strictly ordered after reading the bit. This in turn ensures are all accesses before WORK_DONE_BIT are going to be strictly ordered before any access that can occur in ordered_func.
--- fs/btrfs/async-thread.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/async-thread.c +14 -0
@@ -270,6 +270,13 @@ static void run_ordered_work(struct __bt ordered_list);if (!test_bit (WORK_DONE_BIT , &work->flags))break ; +/* +* Orders all subsequent loads after reading WORK_DONE_BIT, +* paired with the smp_mb__before_atomic in btrfs_work_helper +* this guarantees that the ordered function will see all +* updates from ordinary work function. +*/ +smp_rmb ();/* * we are going to call the ordered done function, but
@@ -355,6 +362,13 @@ static void normal_work_helper(struct btthresh_exec_hook (wq); work->func (work);if (need_order) { +/* +* Ensures all memory accesses done in the work function are +* ordered before setting the WORK_DONE_BIT. Ensuring the thread +* which is going to executed the ordered work sees them. +* Pairs with the smp_rmb in run_ordered_work. +*/ +smp_mb__before_atomic ();set_bit (WORK_DONE_BIT , &work->flags);run_ordered_work (wq, work); }
Greg Kroah-Hartman
maintainerPATCH 311/323 parisc/sticon: fix reverse colors
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit bec05f33ebc1006899c6d3e59a00c58881fe7626 upstream.
sticon_build_attr() checked the reverse argument and flipped background and foreground color, but returned the non-reverse value afterwards. Fix this and also add two local variables for foreground and background color to make the code easier to read.
--- drivers/video/console/sticon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/console/sticon.c +6 -6
@@ -291,13 +291,13 @@ static unsigned long sticon_getxy(structstatic u8 sticon_build_attr (struct vc_data *conp,u8 color,u8 intens,u8 blink,u8 underline,u8 reverse,u8 italic) { -u8 attr = ((color &0x70 ) >>1 ) | ((color &7 )); +u8 fg = color &7 ; +u8 bg = (color &0x70 ) >>4 ; -if (reverse) { - color = ((color >>3 ) &0x7 ) | ((color &0x7 ) <<3 ); - } - -return attr; +if (reverse) +return (fg <<3 ) | bg; +else +return (bg <<3 ) | fg; }static void sticon_invert_region (struct vc_data *conp,u16 *p,int count)
Greg Kroah-Hartman
maintainerPATCH 312/323 cfg80211: call cfg80211_stop_ap when switch from P2P_GO type
In reply to Greg Kroah-HartmanFrom: Nguyen Dinh Phi <[email protected]>
commit 563fbefed46ae4c1f70cffb8eb54c02df480b2c2 upstream.
If the userspace tools switch from NL80211_IFTYPE_P2P_GO to NL80211_IFTYPE_ADHOC via send_msg(NL80211_CMD_SET_INTERFACE), it does not call the cleanup cfg80211_stop_ap(), this leads to the initialization of in-use data. For example, this path re-init the sdata->assigned_chanctx_list while it is still an element of assigned_vifs list, and makes that linked list corrupt.
--- net/wireless/util.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/util.c +1 -0
@@ -950,6 +950,7 @@ int cfg80211_change_iface(struct cfg8021switch (otype) {case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_P2P_GO :cfg80211_stop_ap (rdev, dev, true);break ;case NL80211_IFTYPE_ADHOC :
Greg Kroah-Hartman
maintainerPATCH 313/323 drm/udl: fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 5591c8f79db1729d9c5ac7f5b4d3a5c26e262d93 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/gpu/drm/udl/udl_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_connector.c +1 -1
@@ -32,7 +32,7 @@ static bool udl_get_edid_block(struct ud ret =usb_control_msg (udl->udev,usb_rcvctrlpipe (udl->udev,0 ), (0x02 ), (0x80 | (0x02 <<5 )), bval, -0xA1 , read_buff,2 ,HZ ); +0xA1 , read_buff,2 ,1000 );if (ret <1 ) {DRM_ERROR ("Read EDID byte %d failed err %x\n" , i, ret);kfree (read_buff);
Greg Kroah-Hartman
maintainerPATCH 314/323 drm/amdgpu: fix set scaling mode Full/Full aspect/Center not works on vga and dvi connectors
In reply to Greg Kroah-HartmanFrom: hongao <[email protected]>
commit bf552083916a7f8800477b5986940d1c9a31b953 upstream.
amdgpu_connector_vga_get_modes missed function amdgpu_get_native_mode which assign amdgpu_encoder->native_mode with *preferred_mode result in amdgpu_encoder->native_mode.clock always be 0. That will cause amdgpu_connector_set_property returned early on:
if ((rmx_type != DRM_MODE_SCALE_NONE) &&
(amdgpu_encoder->native_mode.clock == 0))
when we try to set scaling mode Full/Full aspect/Center.
Add the missing function to amdgpu_connector_vga_get_mode can fix this. It also works on dvi connectors because amdgpu_connector_dvi_helper_funcs.get_mode use the same method.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -0
@@ -828,6 +828,7 @@ static int amdgpu_connector_vga_get_modeamdgpu_connector_get_edid (connector); ret =amdgpu_connector_ddc_get_modes (connector); +amdgpu_get_native_mode (connector);return ret; }
Greg Kroah-Hartman
maintainerPATCH 315/323 perf/core: Avoid put_page() when GUP fails
In reply to Greg Kroah-HartmanFrom: Greg Thelen <[email protected]>
commit 4716023a8f6a0f4a28047f14dd7ebdc319606b84 upstream.
PEBS PERF_SAMPLE_PHYS_ADDR events use perf_virt_to_phys() to convert PMU sampled virtual addresses to physical using get_user_page_fast_only() and page_to_phys().
Some get_user_page_fast_only() error cases return false, indicating no page reference, but still initialize the output page pointer with an unreferenced page. In these error cases perf_virt_to_phys() calls put_page(). This causes page reference count underflow, which can lead to unintentional page sharing.
Fix perf_virt_to_phys() to only put_page() if get_user_page_fast_only() returns a referenced page.
--- kernel/events/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/events/core.c +5 -5
@@ -6424,7 +6424,6 @@ void perf_output_sample(struct perf_outpstatic u64 perf_virt_to_phys (u64 virt) {u64 phys_addr =0 ; -struct page *p =NULL ;if (!virt)return 0 ;
@@ -6443,14 +6442,15 @@ static u64 perf_virt_to_phys(u64 virt)* If failed, leave phys_addr as 0. */ if (current->mm !=NULL ) { +struct page *p; +pagefault_disable (); -if (__get_user_pages_fast (virt,1 ,0 , &p) ==1 ) +if (__get_user_pages_fast (virt,1 ,0 , &p) ==1 ) { phys_addr =page_to_phys (p) + virt %PAGE_SIZE ; +put_page (p); + }pagefault_enable (); } - -if (p) -put_page (p); }return phys_addr;
Greg Kroah-Hartman
maintainerPATCH 316/323 batman-adv: mcast: fix duplicate mcast packets in BLA backbone from LAN
In reply to Greg Kroah-HartmanFrom: Linus L�ssing <[email protected]>
commit 3236d215ad38a3f5372e65cd1e0a52cf93d3c6a2 upstream.
Scenario:
* Multicast frame send from a BLA backbone (multiple nodes with their bat0 bridged together, with BLA enabled)
Issue:
* BLA backbone nodes receive the frame multiple times on bat0
For multicast frames received via batman-adv broadcast packets the originator of the broadcast packet is checked before decapsulating and forwarding the frame to bat0 (batadv_bla_is_backbone_gw()-> batadv_recv_bcast_packet()). If it came from a node which shares the same BLA backbone with us then it is not forwarded to bat0 to avoid a loop.
When sending a multicast frame in a non-4-address batman-adv unicast packet we are currently missing this check - and cannot do so because the batman-adv unicast packet has no originator address field.
However, we can simply fix this on the sender side by only sending the multicast frame via unicasts to interested nodes which do not share the same BLA backbone with us. This also nicely avoids some unnecessary transmissions on mesh side.
Note that no infinite loop was observed, probably because of dropping via batadv_interface_tx()->batadv_bla_tx(). However the duplicates still utterly confuse switches/bridges, ICMPv6 duplicate address detection and neighbor discovery and therefore leads to long delays before being able to establish TCP connections, for instance. And it also leads to the Linux bridge printing messages like:
"br-lan: received packet on eth1 with own address as source address ..."
[ bp: 4.19 backport: drop usage in non-existing batadv_mcast_forw*, correct
fixes line ]
--- net/batman-adv/multicast.c | 31 +++++++++++++++++++++++++++++++ net/batman-adv/multicast.h | 15 +++++++++++++++ net/batman-adv/soft-interface.c | 5 ++--- 3 files changed, 48 insertions(+), 3 deletions(-)
net/batman-adv/multicast.c +31 -0
@@ -62,10 +62,12 @@#include <uapi/linux/batadv_packet.h> #include <uapi/linux/batman_adv.h> +#include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "hash.h" #include "log.h" #include "netlink.h" +#include "send.h" #include "soft-interface.h" #include "translation-table.h" #include "tvlv.h"
@@ -1025,6 +1027,35 @@ batadv_mcast_forw_mode(struct batadv_pri }/** +* batadv_mcast_forw_send_orig() - send a multicast packet to an originator +* @bat_priv: the bat priv with all the soft interface information +* @skb: the multicast packet to send +* @vid: the vlan identifier +* @orig_node: the originator to send the packet to +* +* Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. +*/ +int batadv_mcast_forw_send_orig (struct batadv_priv *bat_priv, +struct sk_buff *skb, +unsigned short vid, +struct batadv_orig_node *orig_node) +{ +/* Avoid sending multicast-in-unicast packets to other BLA +* gateways - they already got the frame from the LAN side +* we share with them. +* TODO: Refactor to take BLA into account earlier, to avoid +* reducing the mcast_fanout count. +*/ +if (batadv_bla_is_backbone_gw_orig (bat_priv, orig_node->orig, vid)) { +dev_kfree_skb (skb); +return NET_XMIT_SUCCESS ; + } + +return batadv_send_skb_unicast (bat_priv, skb,BATADV_UNICAST ,0 , + orig_node, vid); +} + +/** * batadv_mcast_want_unsnoop_update() - update unsnoop counter and list * @bat_priv: the bat priv with all the soft interface information * @orig: the orig_node which multicast state might have changed of
net/batman-adv/multicast.h +15 -0
@@ -51,6 +51,11 @@ enum batadv_forw_mode batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, struct batadv_orig_node **mcast_single_orig); +int batadv_mcast_forw_send_orig (struct batadv_priv *bat_priv, +struct sk_buff *skb, +unsigned short vid, +struct batadv_orig_node *orig_node); +void batadv_mcast_init (struct batadv_priv *bat_priv);int batadv_mcast_flags_seq_print_text (struct seq_file *seq,void *offset);
@@ -79,6 +84,16 @@ static inline int batadv_mcast_init(stru }static inline int +batadv_mcast_forw_send_orig (struct batadv_priv *bat_priv, +struct sk_buff *skb, +unsigned short vid, +struct batadv_orig_node *orig_node) +{ +kfree_skb (skb); +return NET_XMIT_DROP ; +} + +static inline int batadv_mcast_mesh_info_put (struct sk_buff *msg,struct batadv_priv *bat_priv) {return 0 ;
net/batman-adv/soft-interface.c +2 -3
@@ -367,9 +367,8 @@ send: goto dropped; ret =batadv_send_skb_via_gw (bat_priv, skb, vid); }else if (mcast_single_orig) { - ret =batadv_send_skb_unicast (bat_priv, skb, -BATADV_UNICAST ,0 , - mcast_single_orig, vid); + ret =batadv_mcast_forw_send_orig (bat_priv, skb, vid, + mcast_single_orig); }else {if (batadv_dat_snoop_outgoing_arp_request (bat_priv, skb))
Greg Kroah-Hartman
maintainerPATCH 317/323 batman-adv: Consider fragmentation for needed_headroom
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit 4ca23e2c2074465bff55ea14221175fecdf63c5f upstream.
If a batman-adv packets has to be fragmented, then the original batman-adv packet header is not stripped away. Instead, only a new header is added in front of the packet after it was split.
This size must be considered to avoid cost intensive reallocations during the transmission through the various device layers.
--- net/batman-adv/hard-interface.c | 3 +++ 1 file changed, 3 insertions(+)
net/batman-adv/hard-interface.c +3 -0
@@ -565,6 +565,9 @@ static void batadv_hardif_recalc_extra_s needed_headroom = lower_headroom + (lower_header_len -ETH_HLEN ); needed_headroom +=batadv_max_header_len (); +/* fragmentation headers don't strip the unicast/... header */ + needed_headroom +=sizeof (struct batadv_frag_packet ); + soft_iface->needed_headroom = needed_headroom; soft_iface->needed_tailroom = lower_tailroom; }
Greg Kroah-Hartman
maintainerPATCH 318/323 batman-adv: Reserve needed_*room for fragments
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit c5cbfc87558168ef4c3c27ce36eba6b83391db19 upstream.
The batadv net_device is trying to propagate the needed_headroom and needed_tailroom from the lower devices. This is needed to avoid cost intensive reallocations using pskb_expand_head during the transmission.
But the fragmentation code split the skb's without adding extra room at the end/beginning of the various fragments. This reduced the performance of transmissions over complex scenarios (batadv on vxlan on wireguard) because the lower devices had to perform the reallocations at least once.
--- net/batman-adv/fragmentation.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/batman-adv/fragmentation.c +10 -5
@@ -403,6 +403,7 @@ out:/** * batadv_frag_create() - create a fragment from skb +* @net_dev: outgoing device for fragment * @skb: skb to create fragment from * @frag_head: header to use in new fragment * @fragment_size: size of new fragment
@@ -413,22 +414,25 @@ out:* * Return: the new fragment, NULL on error. */ -static struct sk_buff *batadv_frag_create (struct sk_buff *skb, +static struct sk_buff *batadv_frag_create (struct net_device *net_dev, +struct sk_buff *skb,struct batadv_frag_packet *frag_head,unsigned int fragment_size) { +unsigned int ll_reserved =LL_RESERVED_SPACE (net_dev); +unsigned int tailroom = net_dev->needed_tailroom;struct sk_buff *skb_fragment;unsigned int header_size =sizeof (*frag_head);unsigned int mtu = fragment_size + header_size; - skb_fragment =netdev_alloc_skb (NULL , mtu +ETH_HLEN ); + skb_fragment =dev_alloc_skb (ll_reserved + mtu + tailroom);if (!skb_fragment) goto err; skb_fragment->priority = skb->priority;/* Eat the last mtu-bytes of the skb */ -skb_reserve (skb_fragment, header_size +ETH_HLEN ); +skb_reserve (skb_fragment, ll_reserved + header_size);skb_split (skb, skb_fragment, skb->len - fragment_size);/* Add the header */
@@ -451,11 +455,12 @@ int batadv_frag_send_packet(struct sk_bustruct batadv_orig_node *orig_node, struct batadv_neigh_node *neigh_node) { + struct net_device *net_dev = neigh_node->if_incoming->net_dev;struct batadv_priv *bat_priv;struct batadv_hard_iface *primary_if =NULL ;struct batadv_frag_packet frag_header;struct sk_buff *skb_fragment; -unsigned int mtu = neigh_node->if_incoming->net_dev->mtu; +unsigned int mtu = net_dev->mtu;unsigned int header_size =sizeof (frag_header);unsigned int max_fragment_size, num_fragments;int ret;
@@ -515,7 +520,7 @@ int batadv_frag_send_packet(struct sk_bu goto put_primary_if; } - skb_fragment =batadv_frag_create (skb, &frag_header, + skb_fragment =batadv_frag_create (net_dev, skb, &frag_header, max_fragment_size);if (!skb_fragment) { ret = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 319/323 batman-adv: Dont always reallocate the fragmentation skb head
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit 992b03b88e36254e26e9a4977ab948683e21bd9f upstream.
When a packet is fragmented by batman-adv, the original batman-adv header is not modified. Only a new fragmentation is inserted between the original one and the ethernet header. The code must therefore make sure that it has a writable region of this size in the skbuff head.
But it is not useful to always reallocate the skbuff by this size even when there would be more than enough headroom still in the skb. The reallocation is just to costly during in this codepath.
--- net/batman-adv/fragmentation.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/batman-adv/fragmentation.c +6 -5
@@ -539,13 +539,14 @@ int batadv_frag_send_packet(struct sk_bu frag_header.no++; } -/* Make room for the fragment header. */ -if (batadv_skb_head_push (skb, header_size) <0 || -pskb_expand_head (skb, header_size +ETH_HLEN ,0 ,GFP_ATOMIC ) <0 ) { - ret = -ENOMEM ; +/* make sure that there is at least enough head for the fragmentation +* and ethernet headers +*/ + ret =skb_cow_head (skb,ETH_HLEN + header_size); +if (ret <0 ) goto put_primary_if; - } +skb_push (skb, header_size);memcpy (skb->data, &frag_header, header_size);/* Send the last fragment */
Greg Kroah-Hartman
maintainerPATCH 320/323 RDMA/netlink: Add __maybe_unused to static inline in C file
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
commit 83dde7498fefeb920b1def317421262317d178e5 upstream.
Like other commits in the tree add __maybe_unused to a static inline in a C file because some clang compilers will complain about unused code:
Quoted 1 line
Quoted 1 line
drivers/infiniband/core/nldev.c:2543:1: warning: unused function '__chk_RDMA_NL_NLDEV'
MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_NLDEV, 5); ^
--- include/rdma/rdma_netlink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/rdma/rdma_netlink.h +1 -1
@@ -24,7 +24,7 @@ enum rdma_nl_flags {* constant as well and the compiler checks they are the same. */ #define MODULE_ALIAS_RDMA_NETLINK (_index, _val) \ - static inline void __chk_##_index(void) \ + static inline void __maybe_unused __chk_##_index(void) \ { \ BUILD_BUG_ON(_index != _val); \ } \
Greg Kroah-Hartman
maintainerPATCH 321/323 ASoC: DAPM: Cover regression by kctl change notification fix
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 827b0913a9d9d07a0c3e559dbb20ca4d6d285a54 upstream.
The recent fix for DAPM to correct the kctl change notification by the commit 5af82c81b2c4 ("ASoC: DAPM: Fix missing kctl change notifications") caused other regressions since it changed the behavior of snd_soc_dapm_set_pin() that is called from several API functions. Formerly it returned always 0 for success, but now it returns 0 or 1.
This patch addresses it, restoring the old behavior of snd_soc_dapm_set_pin() while keeping the fix in snd_soc_dapm_put_pin_switch().
--- sound/soc/soc-dapm.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
sound/soc/soc-dapm.c +23 -6
@@ -2511,8 +2511,13 @@ static struct snd_soc_dapm_widget *dapm_return NULL ; } -static int snd_soc_dapm_set_pin (struct snd_soc_dapm_context *dapm, -const char *pin,int status) +/* +* set the DAPM pin status: +* returns 1 when the value has been updated, 0 when unchanged, or a negative +* error code; called from kcontrol put callback +*/ +static int __snd_soc_dapm_set_pin (struct snd_soc_dapm_context *dapm, +const char *pin,int status) {struct snd_soc_dapm_widget *w =dapm_find_widget (dapm, pin, true);int ret =0 ;
@@ -2538,6 +2543,18 @@ static int snd_soc_dapm_set_pin(struct sreturn ret; } +/* +* similar as __snd_soc_dapm_set_pin(), but returns 0 when successful; +* called from several API functions below +*/ +static int snd_soc_dapm_set_pin (struct snd_soc_dapm_context *dapm, +const char *pin,int status) +{ +int ret =__snd_soc_dapm_set_pin (dapm, pin, status); + +return ret <0 ? ret :0 ; +} +/** * snd_soc_dapm_sync_unlocked - scan and power dapm paths * @dapm: DAPM context
@@ -3465,10 +3482,10 @@ int snd_soc_dapm_put_pin_switch(struct sconst char *pin = (const char *)kcontrol->private_value;int ret; -if (ucontrol->value.integer.value[0 ]) - ret =snd_soc_dapm_enable_pin (&card->dapm, pin); -else - ret =snd_soc_dapm_disable_pin (&card->dapm, pin); +mutex_lock_nested (&card->dapm_mutex,SND_SOC_DAPM_CLASS_RUNTIME ); + ret =__snd_soc_dapm_set_pin (&card->dapm, pin, + !!ucontrol->value.integer.value[0 ]); +mutex_unlock (&card->dapm_mutex);snd_soc_dapm_sync (&card->dapm);return ret;
Greg Kroah-Hartman
maintainerPATCH 322/323 usb: max-3421: Use driver data instead of maintaining a list of bound devices
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
commit fc153aba3ef371d0d76eb88230ed4e0dee5b38f2 upstream.
Instead of maintaining a single-linked list of devices that must be searched linearly in .remove() just use spi_set_drvdata() to remember the link between the spi device and the driver struct. Then the global list and the next member can be dropped.
This simplifies the driver, reduces the memory footprint and the time to search the list. Also it makes obvious that there is always a corresponding driver struct for a given device in .remove(), so the error path for !max3421_hcd can be dropped, too.
As a side effect this fixes a data inconsistency when .probe() races with itself for a second max3421 device in manipulating max3421_hcd_list. A similar race is fixed in .remove(), too.
--- drivers/usb/host/max3421-hcd.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)
drivers/usb/host/max3421-hcd.c +5 -20
@@ -125,8 +125,6 @@ struct max3421_hcd {struct task_struct *spi_thread; -struct max3421_hcd *next; -enum max3421_rh_state rh_state;/* lower 16 bits contain port status, upper 16 bits the change mask: */ u32 port_status;
@@ -174,8 +172,6 @@ struct max3421_ep {u8 retransmit;/* packet needs retransmission */ }; -static struct max3421_hcd *max3421_hcd_list; -#define MAX3421_FIFO_SIZE 64#define MAX3421_SPI_DIR_RD 0/* read register from MAX3421 */
@@ -1899,9 +1895,8 @@ max3421_probe(struct spi_device *spi) }set_bit (HCD_FLAG_POLL_RH , &hcd->flags); max3421_hcd =hcd_to_max3421 (hcd); - max3421_hcd->next = max3421_hcd_list; - max3421_hcd_list = max3421_hcd;INIT_LIST_HEAD (&max3421_hcd->ep_list); +spi_set_drvdata (spi, max3421_hcd); max3421_hcd->tx =kmalloc (sizeof (*max3421_hcd->tx),GFP_KERNEL );if (!max3421_hcd->tx)
@@ -1951,28 +1946,18 @@ error:static int max3421_remove (struct spi_device *spi) { -struct max3421_hcd *max3421_hcd =NULL , **prev; -struct usb_hcd *hcd =NULL ; +struct max3421_hcd *max3421_hcd; +struct usb_hcd *hcd;unsigned long flags; -for (prev = &max3421_hcd_list; *prev; prev = &(*prev)->next) { - max3421_hcd = *prev; - hcd =max3421_to_hcd (max3421_hcd); -if (hcd->self.controller == &spi->dev) -break ; - } -if (!max3421_hcd) { -dev_err (&spi->dev,"no MAX3421 HCD found for SPI device %p\n" , - spi); -return -ENODEV ; - } + max3421_hcd =spi_get_drvdata (spi); + hcd =max3421_to_hcd (max3421_hcd);usb_remove_hcd (hcd);spin_lock_irqsave (&max3421_hcd->lock, flags);kthread_stop (max3421_hcd->spi_thread); - *prev = max3421_hcd->next;spin_unlock_irqrestore (&max3421_hcd->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 323/323 hugetlbfs: flush TLBs correctly after huge_pmd_unshare
In reply to Greg Kroah-HartmanFrom: Nadav Amit <[email protected]>
commit a4a118f2eead1d6c49e00765de89878288d4b890 upstream.
When __unmap_hugepage_range() calls to huge_pmd_unshare() succeed, a TLB flush is missing. This TLB flush must be performed before releasing the i_mmap_rwsem, in order to prevent an unshared PMDs page from being released and reused before the TLB flush took place.
Arguably, a comprehensive solution would use mmu_gather interface to batch the TLB flushes and the PMDs page release, however it is not an easy solution: (1) try_to_unmap_one() and try_to_migrate_one() also call huge_pmd_unshare() and they cannot use the mmu_gather interface; and (2) deferring the release of the page reference for the PMDs page until after i_mmap_rwsem is dropeed can confuse huge_pmd_unshare() into thinking PMDs are shared when they are not.
Fix __unmap_hugepage_range() by adding the missing TLB flush, and forcing a flush when unshare is successful.
--- include/asm-generic/tlb.h | 6 ++++++ mm/hugetlb.c | 23 +++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-)
include/asm-generic/tlb.h +6 -0
@@ -205,6 +205,12 @@ static inline void tlb_remove_check_page#define tlb_end_vma __tlb_end_vma#endif +static inline void tlb_flush_pmd_range (struct mmu_gather *tlb, +unsigned long address,unsigned long size) +{ +__tlb_adjust_range (tlb, address, size); +} +#ifndef __tlb_remove_tlb_entry#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0)#endif
mm/hugetlb.c +19 -4
@@ -3425,6 +3425,7 @@ void __unmap_hugepage_range(struct mmu_gunsigned long sz =huge_page_size (h);unsigned long mmun_start = start;/* For mmu_notifiers */ unsigned long mmun_end = end;/* For mmu_notifiers */ +bool force_flush = false;WARN_ON (!is_vm_hugetlb_page (vma));BUG_ON (start & ~huge_page_mask (h));
@@ -3451,10 +3452,8 @@ void __unmap_hugepage_range(struct mmu_g ptl =huge_pte_lock (h, mm, ptep);if (huge_pmd_unshare (mm, &address, ptep)) {spin_unlock (ptl); -/* -* We just unmapped a page of PMDs by clearing a PUD. -* The caller's TLB flush range should cover this area. -*/ +tlb_flush_pmd_range (tlb, address &PUD_MASK ,PUD_SIZE ); + force_flush = true;continue ; }
@@ -3511,6 +3510,22 @@ void __unmap_hugepage_range(struct mmu_g }mmu_notifier_invalidate_range_end (mm, mmun_start, mmun_end);tlb_end_vma (tlb, vma); + +/* +* If we unshared PMDs, the TLB flush was not recorded in mmu_gather. We +* could defer the flush until now, since by holding i_mmap_rwsem we +* guaranteed that the last refernece would not be dropped. But we must +* do the flushing before we return, as otherwise i_mmap_rwsem will be +* dropped and the last reference to the shared PMDs page might be +* dropped as well. +* +* In theory we could defer the freeing of the PMD pages as well, but +* huge_pmd_unshare() relies on the exact page_count for the PMD page to +* detect sharing, so we cannot defer the release of the page either. +* Instead, do flush now. +*/ +if (force_flush) +tlb_flush_mmu_tlbonly (tlb); } void __unmap_hugepage_range_final(struct mmu_gather *tlb,
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.218-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Regression found on s390 gcc-11 builds with defconfig
Here it is reported,
https://lore.kernel.org/stable/CA+G9fYv+SjDwfvP=Zgf-gr2RngkrzHO_w6OQzH7wqzU-dOW9+g@mail.gmail.com/
mm/hugetlb.c: In function '__unmap_hugepage_range':mm/hugetlb.c:3455:25: error: implicit declaration of function 'tlb_flush_pmd_range'; did you mean 'tlb_flush_mmu_free'? [-Werror=implicit-function-declaration]
3455 | tlb_flush_pmd_range(tlb, address &
PUD_MASK, PUD_SIZE);
| ^~~~~~~~~~~~~~~~~~~
| tlb_flush_mmu_freecc1: some warnings being treated as errors
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 31 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.218-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Regression found on s390 gcc-11 builds with defconfig
Here it is reported,
https://lore.kernel.org/stable/CA+G9fYv+SjDwfvP=Zgf-gr2RngkrzHO_w6OQzH7wqzU-dOW9+g@mail.gmail.com/
mm/hugetlb.c: In function '__unmap_hugepage_range':mm/hugetlb.c:3455:25: error: implicit declaration of function 'tlb_flush_pmd_range'; did you mean 'tlb_flush_mmu_free'? [-Werror=implicit-function-declaration]
3455 | tlb_flush_pmd_range(tlb, address &
Quoted 8 lines
PUD_MASK, PUD_SIZE); | ^~~~~~~~~~~~~~~~~~~ | tlb_flush_mmu_freecc1: some warnings being treated as errors
Should now be fixed, thanks.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.218-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Tested on arm64 and x86 for 4.19.218-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-4.19.y
Version: 4.19.218-rc1
Commit: 451ddd7eb93b3648ea9e23132bd24faedb11279b
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8938
passed: 8938
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8938
passed: 8938
failed: 0
timeout: 0
--------------------------------------------------------------------
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 147 fail: 8 Failed builds: ia64:defconfig s390:defconfig s390:allmodconfig s390:performance_defconfig sh:defconfig sh:dreamcast_defconfig sh:microdev_defconfig sh:shx3_defconfig Qemu test results: total: 441 pass: 436 fail: 5
Failed tests:
s390:defconfig:nolocktests:smp2:net,default:initrd s390:defconfig:nolocktests:smp2:virtio-blk-ccw:net,virtio-net-pci:rootfs s390:defconfig:nolocktests:smp2:scsi[virtio-ccw]:net,default:rootfs s390:defconfig:nolocktests:virtio-pci:net,virtio-net-pci:rootfs s390:defconfig:nolocktests:scsi[virtio-pci]:net,default:rootfs
Again:
mm/hugetlb.c: In function '__unmap_hugepage_range':mm/hugetlb.c:3455:25: error: implicit declaration of function 'tlb_flush_pmd_range'
Guenter
Greg Kroah-Hartman
maintainerQuoted 30 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 147 fail: 8 Failed builds: ia64:defconfig s390:defconfig s390:allmodconfig s390:performance_defconfig sh:defconfig sh:dreamcast_defconfig sh:microdev_defconfig sh:shx3_defconfig Qemu test results: total: 441 pass: 436 fail: 5Failed tests:
s390:defconfig:nolocktests:smp2:net,default:initrd s390:defconfig:nolocktests:smp2:virtio-blk-ccw:net,virtio-net-pci:rootfs s390:defconfig:nolocktests:smp2:scsi[virtio-ccw]:net,default:rootfs s390:defconfig:nolocktests:virtio-pci:net,virtio-net-pci:rootfs s390:defconfig:nolocktests:scsi[virtio-pci]:net,default:rootfs
Quoted 4 lines
Again:
mm/hugetlb.c: In function '__unmap_hugepage_range':mm/hugetlb.c:3455:25: error: implicit declaration of function 'tlb_flush_pmd_range'
Should now be fixed, will push out a -rc2 now.
thanks,
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.218-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
FYI,
New warnings on Linux 4.19.218-rc1 arm and arm64 (defconfig+7) with gcc-11.
drivers/soc/tegra/pmc.c: In function 'tegra_powergate_power_up':drivers/soc/tegra/pmc.c:429:1: warning: label 'powergate_off' defined but not used [-Wunused-label]
429 | powergate_off:
| ^~~~~~
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 25 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.218 release. There are 323 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 Fri, 26 Nov 2021 11:56:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.218-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
FYI,
New warnings on Linux 4.19.218-rc1 arm and arm64 (defconfig+7) with gcc-11.
Quoted 8 lines
drivers/soc/tegra/pmc.c: In function 'tegra_powergate_power_up':drivers/soc/tegra/pmc.c:429:1: warning: label 'powergate_off' defined but not used [-Wunused-label]
429 |powergate_off:| ^~~~~~
Should now be fixed up, thanks.
greg k-h