6.1.2-rc1 review
Subsystems (14)
Greg Kroah-Hartman
maintainerPATCH 535/1146 ethernet: s2io: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6cee96e09df54ae17784c0f38a49e0ed8229b825 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In this case, dev_kfree_skb() is called in free_tx_buffers() to drop the SKBs in tx buffers, when the card is down, so replace it with dev_kfree_skb_irq() here.
--- drivers/net/ethernet/neterion/s2io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/neterion/s2io.c +1 -1
@@ -2386,7 +2386,7 @@ static void free_tx_buffers(struct s2io_nic *nic) skb =s2io_txdl_getskb (&mac_control->fifos[i], txdp, j);if (skb) { swstats->mem_freed += skb->truesize; -dev_kfree_skb (skb); +dev_kfree_skb_irq (skb); cnt++; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 536/1146 net: farsync: Fix kmemleak when rmmods farsync
In reply to Greg Kroah-HartmanFrom: Li Zetao <[email protected]>
[ Upstream commit 2f623aaf9f31de968dea6169849706a2f9be444c ]
There are two memory leaks reported by kmemleak:
unreferenced object 0xffff888114b20200 (size 128):
comm "modprobe", pid 4846, jiffies 4295146524 (age 401.345s)
hex dump (first 32 bytes):
e0 62 57 09 81 88 ff ff e0 62 57 09 81 88 ff ff .bW......bW.....
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff815bcd82>] kmalloc_trace+0x22/0x60
[<ffffffff83d35c78>] __hw_addr_add_ex+0x198/0x6c0
[<ffffffff83d3989d>] dev_addr_init+0x13d/0x230
[<ffffffff83d1063d>] alloc_netdev_mqs+0x10d/0xe50
[<ffffffff82b4a06e>] alloc_hdlcdev+0x2e/0x80
[<ffffffffa016a741>] fst_add_one+0x601/0x10e0 [farsync]
... unreferenced object 0xffff88810b85b000 (size 1024):
comm "modprobe", pid 4846, jiffies 4295146523 (age 401.346s)
hex dump (first 32 bytes):
00 00 b0 02 00 c9 ff ff 00 70 0a 00 00 c9 ff ff .........p......
00 00 00 f2 00 00 00 f3 0a 00 00 00 02 00 00 00 ................
backtrace:
[<ffffffff815bcd82>] kmalloc_trace+0x22/0x60
[<ffffffffa016a294>] fst_add_one+0x154/0x10e0 [farsync]
[<ffffffff82060e83>] local_pci_probe+0xd3/0x170
...The root cause is traced to the netdev and fst_card_info are not freed when removes one fst in fst_remove_one(), which may trigger oom if repeated insmod and rmmod module.
Fix it by adding free_netdev() and kfree() in fst_remove_one(), just as the operations on the error handling path in fst_add_one().
--- drivers/net/wan/farsync.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wan/farsync.c +2 -0
@@ -2545,6 +2545,7 @@ fst_remove_one(struct pci_dev *pdev)struct net_device *dev =port_to_dev (&card->ports[i]);unregister_hdlc_device (dev); +free_netdev (dev); }fst_disable_intr (card);
@@ -2564,6 +2565,7 @@ fst_remove_one(struct pci_dev *pdev) card->tx_dma_handle_card); } fst_card_array[card->card_no] =NULL ; +kfree (card); }static struct pci_driver fst_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 537/1146 net/tunnel: wait until all sk_user_data reader finish before releasing the sock
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit 3cf7203ca620682165706f70a1b12b5194607dce ]
There is a race condition in vxlan that when deleting a vxlan device during receiving packets, there is a possibility that the sock is released after getting vxlan_sock vs from sk_user_data. Then in later vxlan_ecn_decapsulate(), vxlan_get_sk_family() we will got NULL pointer dereference. e.g.
#0 [ffffa25ec6978a38] machine_kexec at ffffffff8c669757 #1 [ffffa25ec6978a90] __crash_kexec at ffffffff8c7c0a4d #2 [ffffa25ec6978b58] crash_kexec at ffffffff8c7c1c48 #3 [ffffa25ec6978b60] oops_end at ffffffff8c627f2b #4 [ffffa25ec6978b80] page_fault_oops at ffffffff8c678fcb #5 [ffffa25ec6978bd8] exc_page_fault at ffffffff8d109542 #6 [ffffa25ec6978c00] asm_exc_page_fault at ffffffff8d200b62
[exception RIP: vxlan_ecn_decapsulate+0x3b]
RIP: ffffffffc1014e7b RSP: ffffa25ec6978cb0 RFLAGS: 00010246
RAX: 0000000000000008 RBX: ffff8aa000888000 RCX: 0000000000000000
RDX: 000000000000000e RSI: ffff8a9fc7ab803e RDI: ffff8a9fd1168700
RBP: ffff8a9fc7ab803e R8: 0000000000700000 R9: 00000000000010ae
R10: ffff8a9fcb748980 R11: 0000000000000000 R12: ffff8a9fd1168700
R13: ffff8aa000888000 R14: 00000000002a0000 R15: 00000000000010ae
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffffa25ec6978ce8] vxlan_rcv at ffffffffc10189cd [vxlan] #8 [ffffa25ec6978d90] udp_queue_rcv_one_skb at ffffffff8cfb6507 #9 [ffffa25ec6978dc0] udp_unicast_rcv_skb at ffffffff8cfb6e45
#10 [ffffa25ec6978dc8] __udp4_lib_rcv at ffffffff8cfb8807 #11 [ffffa25ec6978e20] ip_protocol_deliver_rcu at ffffffff8cf76951 #12 [ffffa25ec6978e48] ip_local_deliver at ffffffff8cf76bde #13 [ffffa25ec6978ea0] __netif_receive_skb_one_core at ffffffff8cecde9b #14 [ffffa25ec6978ec8] process_backlog at ffffffff8cece139 #15 [ffffa25ec6978f00] __napi_poll at ffffffff8ceced1a
#16 [ffffa25ec6978f28] net_rx_action at ffffffff8cecf1f3 #17 [ffffa25ec6978fa0] __softirqentry_text_start at ffffffff8d4000ca #18 [ffffa25ec6978ff0] do_softirq at ffffffff8c6fbdc3
Reproducer: https://github.com/Mellanox/ovs-tests/blob/master/test-ovs-vxlan-remove-tunnel-during-traffic.sh
Fix this by waiting for all sk_user_data reader to finish before releasing the sock.
--- net/ipv4/udp_tunnel_core.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/udp_tunnel_core.c +1 -0
@@ -176,6 +176,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel_xmit_skb);void udp_tunnel_sock_release (struct socket *sock) {rcu_assign_sk_user_data (sock->sk,NULL ); +synchronize_rcu ();kernel_sock_shutdown (sock,SHUT_RDWR );sock_release (sock); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 538/1146 net: apple: mace: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3dfe3486c1cd4f82b466b7d307f23777137b8acc ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In this case, dev_kfree_skb() is called in mace_tx_timeout() to drop the SKB, when tx timeout, so replace it with dev_kfree_skb_irq().
--- drivers/net/ethernet/apple/mace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/apple/mace.c +1 -1
@@ -846,7 +846,7 @@ static void mace_tx_timeout(struct timer_list *t)if (mp->tx_bad_runt) { mp->tx_bad_runt =0 ; }else if (i != mp->tx_fill) { -dev_kfree_skb (mp->tx_bufs[i]); +dev_kfree_skb_irq (mp->tx_bufs[i]);if (++i >=N_TX_RING ) i =0 ; mp->tx_empty = i;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 539/1146 net: apple: bmac: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 5fe02e046e6422c4adfdbc50206ec7186077da24 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In this case, dev_kfree_skb() is called in bmac_tx_timeout() to drop the SKB, when tx timeout, so replace it with dev_kfree_skb_irq().
--- drivers/net/ethernet/apple/bmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/apple/bmac.c +1 -1
@@ -1510,7 +1510,7 @@ static void bmac_tx_timeout(struct timer_list *t) i = bp->tx_empty; ++dev->stats.tx_errors;if (i != bp->tx_fill) { -dev_kfree_skb (bp->tx_bufs[i]); +dev_kfree_skb_irq (bp->tx_bufs[i]); bp->tx_bufs[i] =NULL ;if (++i >=N_TX_RING ) i =0 ; bp->tx_empty = i;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 540/1146 net: emaclite: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit d1678bf45f21fa5ae4a456f821858679556ea5f8 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In this case, dev_kfree_skb() is called in xemaclite_tx_timeout() to drop the SKB, when tx timeout, so replace it with dev_kfree_skb_irq().
--- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_emaclite.c +1 -1
@@ -536,7 +536,7 @@ static void xemaclite_tx_timeout(struct net_device *dev, unsigned int txqueue)xemaclite_enable_interrupts (lp);if (lp->deferred_skb) { -dev_kfree_skb (lp->deferred_skb); +dev_kfree_skb_irq (lp->deferred_skb); lp->deferred_skb =NULL ; dev->stats.tx_errors++; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 541/1146 net: ethernet: dnet: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f07fadcbee2a5e84caa67c7c445424200bffb60b ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
In this case, the lock is used to protected 'bp', so we can move dev_kfree_skb() after the spin_unlock_irqrestore().
--- drivers/net/ethernet/dnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/dnet.c +2 -2
@@ -550,11 +550,11 @@ static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)skb_tx_timestamp (skb); +spin_unlock_irqrestore (&bp->lock, flags); +/* free the buffer */ dev_kfree_skb (skb); -spin_unlock_irqrestore (&bp->lock, flags); -return NETDEV_TX_OK ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 542/1146 hamradio: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3727f742915f04f6fc550b80cf406999bd4e90d0 ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In scc_discard_buffers(), dev_kfree_skb() is called to discard the SKBs, so replace it with dev_kfree_skb_irq().
In scc_net_tx(), dev_kfree_skb() is called to drop the SKB that exceed queue length, so replace it with dev_kfree_skb_irq().
--- drivers/net/hamradio/scc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/hamradio/scc.c +3 -3
@@ -302,12 +302,12 @@ static inline void scc_discard_buffers(struct scc_channel *scc)spin_lock_irqsave (&scc->lock, flags);if (scc->tx_buff !=NULL ) { -dev_kfree_skb (scc->tx_buff); +dev_kfree_skb_irq (scc->tx_buff); scc->tx_buff =NULL ; }while (!skb_queue_empty (&scc->tx_queue)) -dev_kfree_skb (skb_dequeue (&scc->tx_queue)); +dev_kfree_skb_irq (skb_dequeue (&scc->tx_queue));spin_unlock_irqrestore (&scc->lock, flags); }
@@ -1668,7 +1668,7 @@ static netdev_tx_t scc_net_tx(struct sk_buff *skb, struct net_device *dev)if (skb_queue_len (&scc->tx_queue) > scc->dev->tx_queue_len) {struct sk_buff *skb_del; skb_del =skb_dequeue (&scc->tx_queue); -dev_kfree_skb (skb_del); +dev_kfree_skb_irq (skb_del); }skb_queue_tail (&scc->tx_queue, skb);netif_trans_update (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 543/1146 net: amd: lance: dont call dev_kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6151d105dfce8c23edf30eed35e97f3d9b96a35c ]
It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.
It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.
In these two cases, dev_kfree_skb() is called consume the xmited SKB, so replace it with dev_consume_skb_irq().
--- drivers/net/ethernet/amd/atarilance.c | 2 +- drivers/net/ethernet/amd/lance.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/atarilance.c +1 -1
@@ -824,7 +824,7 @@ lance_start_xmit(struct sk_buff *skb, struct net_device *dev) lp->memcpy_f (PKTBUF_ADDR (head), (void *)skb->data, skb->len ); head->flag =TMD1_OWN_CHIP |TMD1_ENP |TMD1_STP ; dev->stats.tx_bytes += skb->len; -dev_kfree_skb ( skb ); +dev_consume_skb_irq (skb); lp->cur_tx++;while ( lp->cur_tx >=TX_RING_SIZE && lp->dirty_tx >=TX_RING_SIZE ) { lp->cur_tx -=TX_RING_SIZE ;
drivers/net/ethernet/amd/lance.c +1 -1
@@ -1001,7 +1001,7 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,skb_copy_from_linear_data (skb, &lp->tx_bounce_buffs[entry], skb->len); lp->tx_ring[entry].base = ((u32 )isa_virt_to_bus ((lp->tx_bounce_buffs + entry)) &0xffffff ) |0x83000000 ; -dev_kfree_skb (skb); +dev_consume_skb_irq (skb); }else { lp->tx_skbuff[entry] = skb; lp->tx_ring[entry].base = ((u32 )isa_virt_to_bus (skb->data) &0xffffff ) |0x83000000 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 544/1146 net: setsockopt: fix IPV6_UNICAST_IF option for connected sockets
In reply to Greg Kroah-HartmanFrom: Richard Gobert <[email protected]>
[ Upstream commit 526682b458b1b56d2e0db027df535cb5cdcfde59 ]
Change the behaviour of ip6_datagram_connect to consider the interface set by the IPV6_UNICAST_IF socket option, similarly to udpv6_sendmsg.
This change is the IPv6 counterpart of the fix for IP_UNICAST_IF. The tests introduced by that patch showed that the incorrect behavior is present in IPv6 as well.
This patch fixes the broken test.
--- net/ipv6/datagram.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/ipv6/datagram.c +10 -5
@@ -42,24 +42,29 @@ static void ip6_datagram_flow_key_init(struct flowi6 *fl6, struct sock *sk) {struct inet_sock *inet =inet_sk (sk);struct ipv6_pinfo *np =inet6_sk (sk); +int oif = sk->sk_bound_dev_if;memset (fl6,0 ,sizeof (*fl6)); fl6->flowi6_proto = sk->sk_protocol; fl6->daddr = sk->sk_v6_daddr; fl6->saddr = np->saddr; - fl6->flowi6_oif = sk->sk_bound_dev_if; fl6->flowi6_mark = sk->sk_mark; fl6->fl6_dport = inet->inet_dport; fl6->fl6_sport = inet->inet_sport; fl6->flowlabel = np->flow_label; fl6->flowi6_uid = sk->sk_uid; -if (!fl6->flowi6_oif) - fl6->flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; +if (!oif) + oif = np->sticky_pktinfo.ipi6_ifindex; -if (!fl6->flowi6_oif &&ipv6_addr_is_multicast (&fl6->daddr)) - fl6->flowi6_oif = np->mcast_oif; +if (!oif) { +if (ipv6_addr_is_multicast (&fl6->daddr)) + oif = np->mcast_oif; +else + oif = np->ucast_oif; + } + fl6->flowi6_oif = oif;security_sk_classify_flow (sk,flowi6_to_flowi_common (fl6)); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 545/1146 af_unix: call proto_unregister() in the error path in af_unix_init()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 73e341e0281a35274629e9be27eae2f9b1b492bf ]
If register unix_stream_proto returns error, unix_dgram_proto needs be unregistered.
--- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)
net/unix/af_unix.c +1 -0
@@ -3738,6 +3738,7 @@ static int __init af_unix_init(void) rc =proto_register (&unix_stream_proto,1 );if (rc !=0 ) {pr_crit ("%s: Cannot create unix_sock SLAB cache!\n" , __func__); +proto_unregister (&unix_dgram_proto); goto out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 546/1146 net: amd-xgbe: Fix logic around active and passive cables
In reply to Greg Kroah-HartmanFrom: Tom Lendacky <[email protected]>
[ Upstream commit 4998006c73afe44e2f639d55bd331c6c26eb039f ]
SFP+ active and passive cables are copper cables with fixed SFP+ end connectors. Due to a misinterpretation of this, SFP+ active cables could end up not being recognized, causing the driver to fail to establish a connection.
Introduce a new enum in SFP+ cable types, XGBE_SFP_CABLE_FIBER, that is the default cable type, and handle active and passive cables when they are specifically detected.
--- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +6 -3
@@ -189,6 +189,7 @@ enum xgbe_sfp_cable {XGBE_SFP_CABLE_UNKNOWN =0 ,XGBE_SFP_CABLE_ACTIVE ,XGBE_SFP_CABLE_PASSIVE , + XGBE_SFP_CABLE_FIBER, }; enum xgbe_sfp_base {
@@ -1149,16 +1150,18 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) phy_data->sfp_tx_fault =xgbe_phy_check_sfp_tx_fault (phy_data); phy_data->sfp_rx_los =xgbe_phy_check_sfp_rx_los (phy_data); -/* Assume ACTIVE cable unless told it is PASSIVE */ +/* Assume FIBER cable unless told otherwise */ if (sfp_base[XGBE_SFP_BASE_CABLE ] &XGBE_SFP_BASE_CABLE_PASSIVE ) { phy_data->sfp_cable =XGBE_SFP_CABLE_PASSIVE ; phy_data->sfp_cable_len = sfp_base[XGBE_SFP_BASE_CU_CABLE_LEN ]; - }else { + }else if (sfp_base[XGBE_SFP_BASE_CABLE ] &XGBE_SFP_BASE_CABLE_ACTIVE ) { phy_data->sfp_cable =XGBE_SFP_CABLE_ACTIVE ; + }else { + phy_data->sfp_cable =XGBE_SFP_CABLE_FIBER ; }/* Determine the type of SFP */ -if (phy_data->sfp_cable ==XGBE_SFP_CABLE_PASSIVE && +if (phy_data->sfp_cable !=XGBE_SFP_CABLE_FIBER &&xgbe_phy_sfp_bit_rate (sfp_eeprom,XGBE_SFP_SPEED_10000 )) phy_data->sfp_base =XGBE_SFP_BASE_10000_CR ;else if (sfp_base[XGBE_SFP_BASE_10GBE_CC ] &XGBE_SFP_BASE_10GBE_CC_SR )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 547/1146 net: amd-xgbe: Check only the minimum speed for active/passive cables
In reply to Greg Kroah-HartmanFrom: Tom Lendacky <[email protected]>
[ Upstream commit f8ab263d4d48e6dab752029bf562f20a2ee630ed ]
There are cables that exist that can support speeds in excess of 10GbE. The driver, however, restricts the EEPROM advertised nominal bitrate to a specific range, which can prevent usage of cables that can support, for example, up to 25GbE.
Rather than checking that an active or passive cable supports a specific range, only check for a minimum supported speed.
--- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -12
@@ -237,10 +237,7 @@ enum xgbe_sfp_speed {#define XGBE_SFP_BASE_BR 12#define XGBE_SFP_BASE_BR_1GBE_MIN 0x0a -#define XGBE_SFP_BASE_BR_1GBE_MAX 0x0d#define XGBE_SFP_BASE_BR_10GBE_MIN 0x64 -#define XGBE_SFP_BASE_BR_10GBE_MAX 0x68 -#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX 0x78#define XGBE_SFP_BASE_CU_CABLE_LEN 18
@@ -827,29 +824,22 @@ static void xgbe_phy_sfp_phy_settings(struct xgbe_prv_data *pdata)static bool xgbe_phy_sfp_bit_rate (struct xgbe_sfp_eeprom *sfp_eeprom,enum xgbe_sfp_speed sfp_speed) { -u8 *sfp_base, min, max; +u8 *sfp_base, min; sfp_base = sfp_eeprom->base;switch (sfp_speed) {case XGBE_SFP_SPEED_1000 : min =XGBE_SFP_BASE_BR_1GBE_MIN ; - max =XGBE_SFP_BASE_BR_1GBE_MAX ;break ;case XGBE_SFP_SPEED_10000 : min =XGBE_SFP_BASE_BR_10GBE_MIN ; -if (memcmp (&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME ], -XGBE_MOLEX_VENDOR ,XGBE_SFP_BASE_VENDOR_NAME_LEN ) ==0 ) - max =XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX ; -else - max =XGBE_SFP_BASE_BR_10GBE_MAX ;break ;default :return false; } -return ((sfp_base[XGBE_SFP_BASE_BR ] >= min) && - (sfp_base[XGBE_SFP_BASE_BR ] <= max)); +return sfp_base[XGBE_SFP_BASE_BR ] >= min; }static void xgbe_phy_free_phy_device (struct xgbe_prv_data *pdata)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 548/1146 can: tcan4x5x: Remove invalid write in clear_interrupts
In reply to Greg Kroah-HartmanFrom: Markus Schneider-Pargmann <[email protected]>
[ Upstream commit 40c9e4f676abbe194541d88e796341c92d5a13c0 ]
Register 0x824 TCAN4X5X_MCAN_INT_REG is a read-only register. Any writes to this register do not have any effect.
Remove this write. The m_can driver aldready clears the interrupts in m_can_isr() by writing to M_CAN_IR which is translated to register 0x1050 which is a writable version of this register.
--- drivers/net/can/m_can/tcan4x5x-core.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/can/m_can/tcan4x5x-core.c +0 -5
@@ -204,11 +204,6 @@ static int tcan4x5x_clear_interrupts(struct m_can_classdev *cdev)if (ret)return ret; - ret =tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_MCAN_INT_REG , -TCAN4X5X_ENABLE_MCAN_INT ); -if (ret) -return ret; - ret =tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_INT_FLAGS ,TCAN4X5X_CLEAR_ALL_INT );if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 549/1146 can: m_can: Call the RAM init directly from m_can_chip_config
In reply to Greg Kroah-HartmanFrom: Vivek Yadav <[email protected]>
[ Upstream commit eaacfeaca7ad0804b9a6eff7afeba93a87db7638 ]
When we try to access the mcan message ram addresses during the probe, hclk is gated by any other drivers or disabled, because of that probe gets failed.
Move the mram init functionality to mcan chip config called by m_can_start from mcan open function, by that time clocks are enabled.
Stable-dep-of: 67727a17a6b3 ("can: tcan4x5x: Fix use of register error status mask")
--- drivers/net/can/m_can/m_can.c | 32 +++++++++++++++++++++----- drivers/net/can/m_can/m_can_platform.c | 4 ---- drivers/net/can/m_can/tcan4x5x-core.c | 5 ---- 3 files changed, 26 insertions(+), 15 deletions(-)
drivers/net/can/m_can/m_can.c +26 -6
@@ -1233,10 +1233,17 @@ static int m_can_set_bittiming(struct net_device *dev)* - setup bittiming * - configure timestamp generation */ -static void m_can_chip_config (struct net_device *dev) +static int m_can_chip_config (struct net_device *dev) {struct m_can_classdev *cdev =netdev_priv (dev);u32 cccr, test; +int err; + + err =m_can_init_ram (cdev); +if (err) { +dev_err (cdev->dev,"Message RAM configuration failed\n" ); +return err; + }m_can_config_endisable (cdev, true);
@@ -1360,18 +1367,25 @@ static void m_can_chip_config(struct net_device *dev)if (cdev->ops->init) cdev->ops->init (cdev); + +return 0 ; } -static void m_can_start (struct net_device *dev) +static int m_can_start (struct net_device *dev) {struct m_can_classdev *cdev =netdev_priv (dev); +int ret;/* basic m_can configuration */ -m_can_chip_config (dev); + ret =m_can_chip_config (dev); +if (ret) +return ret; cdev->can.state =CAN_STATE_ERROR_ACTIVE ;m_can_enable_all_interrupts (cdev); + +return 0 ; }static int m_can_set_mode (struct net_device *dev,enum can_mode mode)
@@ -1799,7 +1813,9 @@ static int m_can_open(struct net_device *dev) }/* start the m_can controller */ -m_can_start (dev); + err =m_can_start (dev); +if (err) + goto exit_irq_fail;if (!cdev->is_peripheral)napi_enable (&cdev->napi);
@@ -2058,9 +2074,13 @@ int m_can_class_resume(struct device *dev) ret =m_can_clk_start (cdev);if (ret)return ret; + ret =m_can_start (ndev); +if (ret) { +m_can_clk_stop (cdev); + +return ret; + } -m_can_init_ram (cdev); -m_can_start (ndev);netif_device_attach (ndev);netif_start_queue (ndev); }
drivers/net/can/m_can/m_can_platform.c +0 -4
@@ -140,10 +140,6 @@ static int m_can_plat_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mcan_class); - ret =m_can_init_ram (mcan_class); -if (ret) - goto probe_fail; -pm_runtime_enable (mcan_class->dev); ret =m_can_class_register (mcan_class);if (ret)
drivers/net/can/m_can/tcan4x5x-core.c +0 -5
@@ -229,11 +229,6 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)if (ret)return ret; -/* Zero out the MCAN buffers */ - ret =m_can_init_ram (cdev); -if (ret) -return ret; - ret =regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG ,TCAN4X5X_MODE_SEL_MASK ,TCAN4X5X_MODE_NORMAL );if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 550/1146 can: tcan4x5x: Fix use of register error status mask
In reply to Greg Kroah-HartmanFrom: Markus Schneider-Pargmann <[email protected]>
[ Upstream commit 67727a17a6b375d68fe569b77e6516b034b834c0 ]
TCAN4X5X_ERROR_STATUS is not a status register that needs clearing during interrupt handling. Instead this is a masking register that masks error interrupts. Writing TCAN4X5X_CLEAR_ALL_INT to this register effectively masks everything.
Rename the register and mask all error interrupts only once by writing to the register in tcan4x5x_init.
--- drivers/net/can/m_can/tcan4x5x-core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/can/m_can/tcan4x5x-core.c +7 -7
@@ -10,7 +10,7 @@#define TCAN4X5X_DEV_ID1 0x04#define TCAN4X5X_REV 0x08#define TCAN4X5X_STATUS 0x0C -#define TCAN4X5X_ERROR_STATUS 0x10 +#define TCAN4X5X_ERROR_STATUS_MASK 0x10#define TCAN4X5X_CONTROL 0x14#define TCAN4X5X_CONFIG 0x800
@@ -204,12 +204,7 @@ static int tcan4x5x_clear_interrupts(struct m_can_classdev *cdev)if (ret)return ret; - ret =tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_INT_FLAGS , -TCAN4X5X_CLEAR_ALL_INT ); -if (ret) -return ret; - -return tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_ERROR_STATUS , +return tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_INT_FLAGS ,TCAN4X5X_CLEAR_ALL_INT ); }
@@ -229,6 +224,11 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)if (ret)return ret; + ret =tcan4x5x_write_tcan_reg (cdev,TCAN4X5X_ERROR_STATUS_MASK , +TCAN4X5X_CLEAR_ALL_INT ); +if (ret) +return ret; + ret =regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG ,TCAN4X5X_MODE_SEL_MASK ,TCAN4X5X_MODE_NORMAL );if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 551/1146 net: ethernet: ti: am65-cpsw: Fix PM runtime leakage in am65_cpsw_nuss_ndo_slave_open()
In reply to Greg Kroah-HartmanFrom: Roger Quadros <[email protected]>
[ Upstream commit 5821504f5073983733465b8bc430049c4343bbd7 ]
Ensure pm_runtime_put() is issued in error path.
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +7 -3
@@ -564,13 +564,13 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) ret =netif_set_real_num_tx_queues (ndev, common->tx_ch_num);if (ret) {dev_err (common->dev,"cannot set real number of tx queues\n" ); -return ret; + goto runtime_put; } ret =netif_set_real_num_rx_queues (ndev,AM65_CPSW_MAX_RX_QUEUES );if (ret) {dev_err (common->dev,"cannot set real number of rx queues\n" ); -return ret; + goto runtime_put; }for (i =0 ; i < common->tx_ch_num; i++)
@@ -578,7 +578,7 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) ret =am65_cpsw_nuss_common_open (common);if (ret) -return ret; + goto runtime_put; common->usage_count++;
@@ -606,6 +606,10 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) error_cleanup:am65_cpsw_nuss_ndo_slave_stop (ndev);return ret; + +runtime_put: +pm_runtime_put (common->dev); +return ret; }static void am65_cpsw_nuss_rx_cleanup (void *data,dma_addr_t desc_dma)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 552/1146 net: lan9303: Fix read error execution path
In reply to Greg Kroah-HartmanFrom: Jerry Ray <[email protected]>
[ Upstream commit 8964916d206071b058c6351f88b1966bd58cbde0 ]
This patch fixes an issue where a read failure of a port statistic counter will return unknown results. While it is highly unlikely the read will ever fail, it is much cleaner to return a zero for the stat count.
--- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/dsa/lan9303-core.c +3 -1
@@ -1005,9 +1005,11 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port, ret =lan9303_read_switch_port ( chip, port, lan9303_mib[u].offset, ®); -if (ret) +if (ret) {dev_warn (chip->dev,"Reading status port %d reg %u failed\n" , port, lan9303_mib[u].offset); + reg =0 ; + } data[u] = reg; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 553/1146 ntb_netdev: Use dev_kfree_skb_any() in interrupt context
In reply to Greg Kroah-HartmanFrom: Eric Pilmore <[email protected]>
[ Upstream commit 5f7d78b2b12a9d561f48fa00bab29b40f4616dad ]
TX/RX callback handlers (ntb_netdev_tx_handler(), ntb_netdev_rx_handler()) can be called in interrupt context via the DMA framework when the respective DMA operations have completed. As such, any calls by these routines to free skb's, should use the interrupt context safe dev_kfree_skb_any() function.
Previously, these callback handlers would call the interrupt unsafe version of dev_kfree_skb(). This has not presented an issue on Intel IOAT DMA engines as that driver utilizes tasklets rather than a hard interrupt handler, like the AMD PTDMA DMA driver. On AMD systems, a kernel WARNING message is encountered, which is being issued from skb_release_head_state() due to in_hardirq() being true.
Besides the user visible WARNING from the kernel, the other symptom of this bug was that TCP/IP performance across the ntb_netdev interface was very poor, i.e. approximately an order of magnitude below what was expected. With the repair to use dev_kfree_skb_any(), kernel WARNINGs from skb_release_head_state() ceased and TCP/IP performance, as measured by iperf, was on par with expected results, approximately 20 Gb/s on AMD Milan based server. Note that this performance is comparable with Intel based servers.
--- drivers/net/ntb_netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ntb_netdev.c +2 -2
@@ -137,7 +137,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, enqueue_again: rc =ntb_transport_rx_enqueue (qp, skb, skb->data, ndev->mtu +ETH_HLEN );if (rc) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); ndev->stats.rx_errors++; ndev->stats.rx_fifo_errors++; }
@@ -192,7 +192,7 @@ static void ntb_netdev_tx_handler(struct ntb_transport_qp *qp, void *qp_data, ndev->stats.tx_aborted_errors++; } -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);if (ntb_transport_tx_free_entry (dev->qp) >= tx_start) {/* Make sure anybody stopping the queue after this sees the new
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 554/1146 sctp: sysctl: make extra pointers netns aware
In reply to Greg Kroah-HartmanFrom: Firo Yang <[email protected]>
[ Upstream commit da05cecc4939c0410d56c29e252998b192756318 ]
Recently, a customer reported that from their container whose net namespace is different to the host's init_net, they can't set the container's net.sctp.rto_max to any value smaller than init_net.sctp.rto_min.
For instance,
Host:
sudo sysctl net.sctp.rto_min
net.sctp.rto_min = 1000
Container:
echo 100 > /mnt/proc-net/sctp/rto_min
echo 400 > /mnt/proc-net/sctp/rto_max
echo: write error: Invalid argument
This is caused by the check made from this'commit 4f3fdf3bc59c ("sctp: add check rto_min and rto_max in sysctl")'
When validating the input value, it's always referring the boundary value set for the init_net namespace.
Having container's rto_max smaller than host's init_net.sctp.rto_min does make sense. Consider that the rto between two containers on the same host is very likely smaller than it for two hosts.
So to fix this problem, as suggested by Marcelo, this patch makes the extra pointers of rto_min, rto_max, pf_retrans, and ps_retrans point to the corresponding variables from the newly created net namespace while the new net namespace is being registered in sctp_sysctl_net_register.
--- net/sctp/sysctl.c | 73 ++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 29 deletions(-)
net/sctp/sysctl.c +44 -29
@@ -84,17 +84,18 @@ static struct ctl_table sctp_table[] = { {/* sentinel */ } }; +/* The following index defines are used in sctp_sysctl_net_register(). +* If you add new items to the sctp_net_table, please ensure that +* the index values of these defines hold the same meaning indicated by +* their macro names when they appear in sctp_net_table. +*/ +#define SCTP_RTO_MIN_IDX 0 +#define SCTP_RTO_MAX_IDX 1 +#define SCTP_PF_RETRANS_IDX 2 +#define SCTP_PS_RETRANS_IDX 3 +static struct ctl_table sctp_net_table[] = { - { - .procname ="rto_initial" , - .data = &init_net.sctp.rto_initial, - .maxlen =sizeof (unsigned int ), - .mode =0644 , - .proc_handler = proc_dointvec_minmax, - .extra1 =SYSCTL_ONE , - .extra2 = &timer_max - }, - { + [SCTP_RTO_MIN_IDX ] = { .procname ="rto_min" , .data = &init_net.sctp.rto_min, .maxlen =sizeof (unsigned int ),
@@ -103,7 +104,7 @@ static struct ctl_table sctp_net_table[] = { .extra1 = SYSCTL_ONE, .extra2 = &init_net.sctp.rto_max }, - { + [SCTP_RTO_MAX_IDX] = { .procname = "rto_max", .data = &init_net.sctp.rto_max, .maxlen = sizeof(unsigned int),
@@ -112,6 +113,33 @@ static struct ctl_table sctp_net_table[] = { .extra1 = &init_net.sctp.rto_min, .extra2 = &timer_max }, + [SCTP_PF_RETRANS_IDX] = { + .procname = "pf_retrans", + .data = &init_net.sctp.pf_retrans, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = &init_net.sctp.ps_retrans, + }, + [SCTP_PS_RETRANS_IDX] = { + .procname = "ps_retrans", + .data = &init_net.sctp.ps_retrans, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &init_net.sctp.pf_retrans, + .extra2 = &ps_retrans_max, + }, + { + .procname = "rto_initial", + .data = &init_net.sctp.rto_initial, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE, + .extra2 = &timer_max + }, { .procname = "rto_alpha_exp_divisor", .data = &init_net.sctp.rto_alpha,
@@ -207,24 +235,6 @@ static struct ctl_table sctp_net_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_INT_MAX, }, - { - .procname = "pf_retrans", - .data = &init_net.sctp.pf_retrans, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = &init_net.sctp.ps_retrans, - }, - { - .procname = "ps_retrans", - .data = &init_net.sctp.ps_retrans, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = &init_net.sctp.pf_retrans, - .extra2 = &ps_retrans_max, - }, { .procname = "sndbuf_policy", .data = &init_net.sctp.sndbuf_policy,
@@ -586,6 +596,11 @@ int sctp_sysctl_net_register(struct net *net)for (i =0 ; table[i].data; i++) table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp; + table[SCTP_RTO_MIN_IDX ].extra2 = &net->sctp.rto_max; + table[SCTP_RTO_MAX_IDX ].extra1 = &net->sctp.rto_min; + table[SCTP_PF_RETRANS_IDX ].extra2 = &net->sctp.ps_retrans; + table[SCTP_PS_RETRANS_IDX ].extra1 = &net->sctp.pf_retrans; + net->sctp.sysctl_header =register_net_sysctl (net,"net/sctp" , table);if (net->sctp.sysctl_header ==NULL ) {kfree (table);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 555/1146 Bluetooth: hci_core: fix error handling in hci_register_dev()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 0d75da38e060d21f948b3df5f5e349c962cf1ed2 ]
If hci_register_suspend_notifier() returns error, the hdev and rfkill are leaked. We could disregard the error and print a warning message instead to avoid leaks, as it just means we won't be handing suspend requests.
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -2660,7 +2660,7 @@ int hci_register_dev(struct hci_dev *hdev) error =hci_register_suspend_notifier (hdev);if (error) - goto err_wqueue; +BT_WARN ("register suspend notifier failed error:%d\n" , error);queue_work (hdev->req_workqueue, &hdev->power_on);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 556/1146 Bluetooth: MGMT: Fix error report for ADD_EXT_ADV_PARAMS
In reply to Greg Kroah-HartmanFrom: Inga Stotland <[email protected]>
[ Upstream commit 3b1c7c00b8c22b3cb79532252c59eb0b287bb86d ]
When validating the parameter length for MGMT_OP_ADD_EXT_ADV_PARAMS command, use the correct op code in error status report:
was MGMT_OP_ADD_ADVERTISING, changed to MGMT_OP_ADD_EXT_ADV_PARAMS.
--- net/bluetooth/mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -1
@@ -8859,7 +8859,7 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,* extra parameters we don't know about will be ignored in this request. */ if (data_len <MGMT_ADD_EXT_ADV_PARAMS_MIN_SIZE ) -return mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_ADVERTISING , +return mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_EXT_ADV_PARAMS ,MGMT_STATUS_INVALID_PARAMS ); flags =__le32_to_cpu (cp->flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 557/1146 Bluetooth: Fix EALREADY and ELOOP cases in bt_status()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 63db780a93eb802ece1bbf61ab5894ad8827b56e ]
'err' is known to be <0 at this point.
So, some cases can not be reached because of a missing "-". Add it.
--- net/bluetooth/lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/lib.c +2 -2
@@ -170,7 +170,7 @@ __u8 bt_status(int err)case -EMLINK :return 0x09 ; -case EALREADY : +case -EALREADY :return 0x0b ;case -EBUSY :
@@ -191,7 +191,7 @@ __u8 bt_status(int err)case -ECONNABORTED :return 0x16 ; -case ELOOP : +case -ELOOP :return 0x17 ;case -EPROTONOSUPPORT :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 558/1146 Bluetooth: hci_conn: Fix crash on hci_create_cis_sync
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 50757a259ba78c4e938b5735e76ffec6cd0c942e ]
When attempting to connect multiple ISO sockets without using DEFER_SETUP may result in the following crash:
BUG: KASAN: null-ptr-deref in hci_create_cis_sync+0x18b/0x2b0 Read of size 2 at addr 0000000000000036 by task kworker/u3:1/50 CPU: 0 PID: 50 Comm: kworker/u3:1 Not tainted 6.0.0-rc7-02243-gb84a13ff4eda #4373 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-1.fc36 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: <TASK> dump_stack_lvl+0x19/0x27 kasan_report+0xbc/0xf0 ? hci_create_cis_sync+0x18b/0x2b0 hci_create_cis_sync+0x18b/0x2b0 ? get_link_mode+0xd0/0xd0 ? __ww_mutex_lock_slowpath+0x10/0x10 ? mutex_lock+0xe0/0xe0 ? get_link_mode+0xd0/0xd0 hci_cmd_sync_work+0x111/0x190 process_one_work+0x427/0x650 worker_thread+0x87/0x750 ? process_one_work+0x650/0x650 kthread+0x14e/0x180 ? kthread_exit+0x50/0x50 ret_from_fork+0x22/0x30 </TASK>
--- net/bluetooth/hci_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_conn.c +1 -1
@@ -1881,7 +1881,7 @@ static int hci_create_cis_sync(struct hci_dev *hdev, void *data)continue ;/* Check if all CIS(s) belonging to a CIG are ready */ -if (conn->link->state !=BT_CONNECTED || +if (!conn->link || conn->link->state !=BT_CONNECTED || conn->state !=BT_CONNECT ) { cmd.cp.num_cis =0 ;break ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 559/1146 Bluetooth: btintel: Fix missing free skb in btintel_setup_combined()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit cee50ce899de415baf4da3ed38b7d4f13c3170d1 ]
skb allocated by __hci_cmd_sync would not be used whether in checking for supported iBT hardware variants or after, we should free it in all error branches, this patch makes the case read version failed or default error case free skb before return.
--- drivers/bluetooth/btintel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/bluetooth/btintel.c +3 -2
@@ -2524,7 +2524,7 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ err =btintel_read_version (hdev, &ver);if (err) -return err; +break ;/* Apply the device specific HCI quirks *
@@ -2566,7 +2566,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)default :bt_dev_err (hdev,"Unsupported Intel hw variant (%u)" ,INTEL_HW_VARIANT (ver_tlv.cnvi_bt)); -return -EINVAL ; + err = -EINVAL ; +break ; } exit_error:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 560/1146 Bluetooth: btusb: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit b15a6bd3c80c77faec8317319b97f976b1a08332 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- drivers/bluetooth/btusb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/btusb.c +3 -3
@@ -802,13 +802,13 @@ static inline void btusb_free_frags(struct btusb_data *data)spin_lock_irqsave (&data->rxlock, flags); -kfree_skb (data->evt_skb); +dev_kfree_skb_irq (data->evt_skb); data->evt_skb =NULL ; -kfree_skb (data->acl_skb); +dev_kfree_skb_irq (data->acl_skb); data->acl_skb =NULL ; -kfree_skb (data->sco_skb); +dev_kfree_skb_irq (data->sco_skb); data->sco_skb =NULL ;spin_unlock_irqrestore (&data->rxlock, flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 561/1146 Bluetooth: hci_qca: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit df4cfc91208e0a98f078223793f5871b1a82cc54 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +1 -1
@@ -912,7 +912,7 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb)default :BT_ERR ("Illegal tx state: %d (losing packet)" , qca->tx_ibs_state); -kfree_skb (skb); +dev_kfree_skb_irq (skb);break ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 562/1146 Bluetooth: hci_ll: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 8f458f783dfbb19c1f1cb58ed06eeb701f52091b ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- drivers/bluetooth/hci_ll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_ll.c +1 -1
@@ -345,7 +345,7 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb)default :BT_ERR ("illegal hcill state: %ld (losing packet)" , ll->hcill_state); -kfree_skb (skb); +dev_kfree_skb_irq (skb);break ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 563/1146 Bluetooth: hci_h5: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 383630cc6758d619874c2e8bb2f68a61f3f9ef6e ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- drivers/bluetooth/hci_h5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_h5.c +1 -1
@@ -313,7 +313,7 @@ static void h5_pkt_cull(struct h5 *h5)break ;__skb_unlink (skb, &h5->unack); -kfree_skb (skb); +dev_kfree_skb_irq (skb); }if (skb_queue_empty (&h5->unack))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 564/1146 Bluetooth: hci_bcsp: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7b503e339c1a80bf0051ec2d19c3bc777014ac61 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- drivers/bluetooth/hci_bcsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_bcsp.c +1 -1
@@ -378,7 +378,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp) i++;__skb_unlink (skb, &bcsp->unack); -kfree_skb (skb); +dev_kfree_skb_irq (skb); }if (skb_queue_empty (&bcsp->unack))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 565/1146 Bluetooth: hci_core: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 39c1eb6fcbae8ce9bb71b2ac5cb609355a2b181b ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -3985,7 +3985,7 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status, *req_complete_skb =bt_cb (skb)->hci.req_complete_skb; else *req_complete =bt_cb (skb)->hci.req_complete; -kfree_skb (skb); +dev_kfree_skb_irq (skb); }spin_unlock_irqrestore (&hdev->cmd_q.lock, flags); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 566/1146 Bluetooth: RFCOMM: dont call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 0ba18967d4544955b2eff2fbc4f2a8750c4df90a ]
It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave().
--- net/bluetooth/rfcomm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/rfcomm/core.c +1 -1
@@ -590,7 +590,7 @@ int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb) ret =rfcomm_dlc_send_frag (d, frag);if (ret <0 ) { -kfree_skb (frag); +dev_kfree_skb_irq (frag); goto unlock; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 567/1146 octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 87c978123ef1f346d7385eaccc141022d368166f ]
In mcs_register_interrupts(), a call to request_irq() is not balanced by a corresponding free_irq(), neither in the error handling path, nor in the remove function.
Add the missing calls.
--- drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mcs.c +5 -1
@@ -1184,10 +1184,13 @@ static int mcs_register_interrupts(struct mcs *mcs) mcs->tx_sa_active =alloc_mem (mcs, mcs->hw->sc_entries);if (!mcs->tx_sa_active) { ret = -ENOMEM ; - goto exit; + goto free_irq; }return ret; + +free_irq: +free_irq (pci_irq_vector (mcs->pdev,MCS_INT_VEC_IP ), mcs); exit:pci_free_irq_vectors (mcs->pdev); mcs->num_vec =0 ;
@@ -1589,6 +1592,7 @@ static void mcs_remove(struct pci_dev *pdev)/* Set MCS to external bypass */ mcs_set_external_bypass (mcs, true); +free_irq (pci_irq_vector (pdev,MCS_INT_VEC_IP ), mcs);pci_free_irq_vectors (pdev);pci_release_regions (pdev);pci_disable_device (pdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 568/1146 stmmac: fix potential division by 0
In reply to Greg Kroah-HartmanFrom: Piergiorgio Beruto <[email protected]>
[ Upstream commit ede5a389852d3640a28e7187fb32b7f204380901 ]
When the MAC is connected to a 10 Mb/s PHY and the PTP clock is derived from the MAC reference clock (default), the clk_ptp_rate becomes too small and the calculated sub second increment becomes 0 when computed by the stmmac_config_sub_second_increment() function within stmmac_init_tstamp_counter().
Therefore, the subsequent div_u64 in stmmac_init_tstamp_counter() operation triggers a divide by 0 exception as shown below.
[ 95.062067] socfpga-dwmac ff700000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 [ 95.076440] socfpga-dwmac ff700000.ethernet eth0: PHY [stmmac-0:08] driver [NCN26000] (irq=49) [ 95.095964] dwmac1000: Master AXI performs any burst length [ 95.101588] socfpga-dwmac ff700000.ethernet eth0: No Safety Features support found [ 95.109428] Division by zero in kernel. [ 95.113447] CPU: 0 PID: 239 Comm: ifconfig Not tainted 6.1.0-rc7-centurion3-1.0.3.0-01574-gb624218205b7-dirty #77 [ 95.123686] Hardware name: Altera SOCFPGA [ 95.127695] unwind_backtrace from show_stack+0x10/0x14 [ 95.132938] show_stack from dump_stack_lvl+0x40/0x4c [ 95.137992] dump_stack_lvl from Ldiv0+0x8/0x10 [ 95.142527] Ldiv0 from __aeabi_uidivmod+0x8/0x18 [ 95.147232] __aeabi_uidivmod from div_u64_rem+0x1c/0x40 [ 95.152552] div_u64_rem from stmmac_init_tstamp_counter+0xd0/0x164 [ 95.158826] stmmac_init_tstamp_counter from stmmac_hw_setup+0x430/0xf00 [ 95.165533] stmmac_hw_setup from __stmmac_open+0x214/0x2d4 [ 95.171117] __stmmac_open from stmmac_open+0x30/0x44 [ 95.176182] stmmac_open from __dev_open+0x11c/0x134 [ 95.181172] __dev_open from __dev_change_flags+0x168/0x17c [ 95.186750] __dev_change_flags from dev_change_flags+0x14/0x50 [ 95.192662] dev_change_flags from devinet_ioctl+0x2b4/0x604 [ 95.198321] devinet_ioctl from inet_ioctl+0x1ec/0x214 [ 95.203462] inet_ioctl from sock_ioctl+0x14c/0x3c4 [ 95.208354] sock_ioctl from vfs_ioctl+0x20/0x38 [ 95.212984] vfs_ioctl from sys_ioctl+0x250/0x844 [ 95.217691] sys_ioctl from ret_fast_syscall+0x0/0x4c [ 95.222743] Exception stack(0xd0ee1fa8 to 0xd0ee1ff0) [ 95.227790] 1fa0: 00574c4f be9aeca4 00000003 00008914 be9aeca4 be9aec50 [ 95.235945] 1fc0: 00574c4f be9aeca4 0059f078 00000036 be9aee8c be9aef7a 00000015 00000000 [ 95.244096] 1fe0: 005a01f0 be9aec38 004d7484 b6e67d74
--- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 3 ++- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +2 -1
@@ -47,7 +47,8 @@ static void config_sub_second_increment(void __iomem *ioaddr,if (!(value &PTP_TCR_TSCTRLSSR )) data = (data *1000 ) /465 ; - data &=PTP_SSIR_SSINC_MASK ; +if (data >PTP_SSIR_SSINC_MAX ) + data =PTP_SSIR_SSINC_MAX ; reg_value = data;if (gmac4)
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +1 -1
@@ -64,7 +64,7 @@#define PTP_TCR_TSENMACADDR BIT(18)/* SSIR defines */ -#define PTP_SSIR_SSINC_MASK 0xff +#define PTP_SSIR_SSINC_MAX 0xff#define GMAC4_PTP_SSIR_SSINC_SHIFT 16/* Auxiliary Control defines */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 569/1146 i40e: Fix the inability to attach XDP program on downed interface
In reply to Greg Kroah-HartmanFrom: Bartosz Staszewski <[email protected]>
[ Upstream commit 0c87b545a2ed5cd8a6318011f1c92b188c2d74bc ]
Whenever trying to load XDP prog on downed interface, function i40e_xdp was passing vsi->rx_buf_len field to i40e_xdp_setup() which was equal 0. i40e_open() calls i40e_vsi_configure_rx() which configures that field, but that only happens when interface is up. When it is down, i40e_open() is not being called, thus vsi->rx_buf_len is not set.
Solution for this is calculate buffer length in newly created function - i40e_calculate_vsi_rx_buf_len() that return actual buffer length. Buffer length is being calculated based on the same rules applied previously in i40e_vsi_configure_rx() function.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 36 ++++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +24 -12
@@ -3693,6 +3693,24 @@ static int i40e_vsi_configure_tx(struct i40e_vsi *vsi)return err; } +/** +* i40e_calculate_vsi_rx_buf_len - Calculates buffer length +* +* @vsi: VSI to calculate rx_buf_len from +*/ +static u16 i40e_calculate_vsi_rx_buf_len (struct i40e_vsi *vsi) +{ +if (!vsi->netdev || (vsi->back->flags &I40E_FLAG_LEGACY_RX )) +return I40E_RXBUFFER_2048 ; + +#if (PAGE_SIZE <8192 ) +if (!I40E_2K_TOO_SMALL_WITH_PADDING && vsi->netdev->mtu <=ETH_DATA_LEN ) +return I40E_RXBUFFER_1536 -NET_IP_ALIGN ; +#endif + +return PAGE_SIZE <8192 ?I40E_RXBUFFER_3072 :I40E_RXBUFFER_2048 ; +} +/** * i40e_vsi_configure_rx - Configure the VSI for Rx * @vsi: the VSI being configured
@@ -3704,20 +3722,14 @@ static int i40e_vsi_configure_rx(struct i40e_vsi *vsi)int err =0 ;u16 i; -if (!vsi->netdev || (vsi->back->flags &I40E_FLAG_LEGACY_RX )) { - vsi->max_frame =I40E_MAX_RXBUFFER ; - vsi->rx_buf_len =I40E_RXBUFFER_2048 ; + vsi->max_frame =I40E_MAX_RXBUFFER ; + vsi->rx_buf_len =i40e_calculate_vsi_rx_buf_len (vsi); +#if (PAGE_SIZE <8192 ) - } else if (!I40E_2K_TOO_SMALL_WITH_PADDING && - (vsi->netdev->mtu <=ETH_DATA_LEN )) { +if (vsi->netdev && !I40E_2K_TOO_SMALL_WITH_PADDING && + vsi->netdev->mtu <=ETH_DATA_LEN ) vsi->max_frame =I40E_RXBUFFER_1536 -NET_IP_ALIGN ; - vsi->rx_buf_len =I40E_RXBUFFER_1536 -NET_IP_ALIGN ;#endif - }else { - vsi->max_frame =I40E_MAX_RXBUFFER ; - vsi->rx_buf_len = (PAGE_SIZE <8192 ) ?I40E_RXBUFFER_3072 : -I40E_RXBUFFER_2048 ; - }/* set up individual rings */ for (i =0 ; i < vsi->num_queue_pairs && !err; i++)
@@ -13282,7 +13294,7 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog,int i;/* Don't allow frames that span over multiple buffers */ -if (frame_size > vsi->rx_buf_len) { +if (frame_size >i40e_calculate_vsi_rx_buf_len (vsi)) {NL_SET_ERR_MSG_MOD (extack,"MTU too large to enable XDP" );return -EINVAL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 570/1146 net: dsa: tag_8021q: avoid leaking ctx on dsa_tag_8021q_register() error path
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit e095493091e850d5292ad01d8fbf5cde1d89ac53 ]
If dsa_tag_8021q_setup() fails, for example due to the inability of the device to install a VLAN, the tag_8021q context of the switch will leak. Make sure it is freed on the error path.
--- net/dsa/tag_8021q.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/dsa/tag_8021q.c +10 -1
@@ -398,6 +398,7 @@ static void dsa_tag_8021q_teardown(struct dsa_switch *ds)int dsa_tag_8021q_register (struct dsa_switch *ds,__be16 proto) {struct dsa_8021q_context *ctx; +int err; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)
@@ -410,7 +411,15 @@ int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto) ds->tag_8021q_ctx = ctx; -return dsa_tag_8021q_setup (ds); + err =dsa_tag_8021q_setup (ds); +if (err) + goto err_free; + +return 0 ; + +err_free: +kfree (ctx); +return err; }EXPORT_SYMBOL_GPL (dsa_tag_8021q_register);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 571/1146 apparmor: fix a memleak in multi_transaction_new()
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit c73275cf6834787ca090317f1d20dbfa3b7f05aa ]
In multi_transaction_new(), the variable t is not freed or passed out on the failure of copy_from_user(t->data, buf, size), which could lead to a memleak.
Fix this bug by adding a put_multi_transaction(t) in the error path.
--- security/apparmor/apparmorfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
security/apparmor/apparmorfs.c +3 -1
@@ -868,8 +868,10 @@ static struct multi_transaction *multi_transaction_new(struct file *file,if (!t)return ERR_PTR (-ENOMEM );kref_init (&t->count); -if (copy_from_user (t->data, buf, size)) +if (copy_from_user (t->data, buf, size)) { +put_multi_transaction (t);return ERR_PTR (-EFAULT ); + }return t; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 572/1146 apparmor: fix lockdep warning when removing a namespace
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
[ Upstream commit 9c4557efc558a68e4cd973490fd936d6e3414db8 ]
Fix the following lockdep warning
[ 1119.158984] ============================================
[ 1119.158988] WARNING: possible recursive locking detected
[ 1119.158996] 6.0.0-rc1+ #257 Tainted: G E N
[ 1119.158999] --------------------------------------------
[ 1119.159001] bash/80100 is trying to acquire lock:
[ 1119.159007] ffff88803e79b4a0 (&ns->lock/1){+.+.}-{4:4}, at: destroy_ns.part.0+0x43/0x140
[ 1119.159028]
but task is already holding lock:
[ 1119.159030] ffff8881009764a0 (&ns->lock/1){+.+.}-{4:4}, at: aa_remove_profiles+0x3f0/0x640
[ 1119.159040]
other info that might help us debug this:
[ 1119.159042] Possible unsafe locking scenario:[ 1119.159043] CPU0
[ 1119.159045] ----
[ 1119.159047] lock(&ns->lock/1);
[ 1119.159051] lock(&ns->lock/1);
[ 1119.159055]
*** DEADLOCK ***Which is caused by an incorrect lockdep nesting notation
--- security/apparmor/policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/policy.c +1 -1
@@ -1170,7 +1170,7 @@ ssize_t aa_remove_profiles(struct aa_ns *policy_ns, struct aa_label *subj,if (!name) {/* remove namespace - can only happen if fqname[0] == ':' */ -mutex_lock_nested (&ns->parent->lock, ns->level); +mutex_lock_nested (&ns->parent->lock, ns->parent->level);__aa_bump_ns_revision (ns);__aa_remove_ns (ns);mutex_unlock (&ns->parent->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 573/1146 apparmor: Fix abi check to include v8 abi
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
[ Upstream commit 1b5a6198f5a9d0aa5497da0dc4bcd4fc166ee516 ]
The v8 abi is supported by the kernel but the userspace supported version check does not allow for it. This was missed when v8 was added due to a bug in the userspace compiler which was setting an older abi version for v8 encoding (which is forward compatible except on the network encoding). However it is possible to detect the network encoding by checking the policydb network support which the code does. The end result was that missing the abi flag worked until userspace was fixed and began correctly checking for the v8 abi version.
--- security/apparmor/policy_unpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/policy_unpack.c +1 -1
@@ -972,7 +972,7 @@ static int verify_header(struct aa_ext *e, int required, const char **ns)* if not specified use previous version * Mask off everything that is not kernel abi version */ -if (VERSION_LT (e->version, v5) ||VERSION_GT (e->version, v7)) { +if (VERSION_LT (e->version, v5) ||VERSION_GT (e->version, v8)) {audit_iface (NULL ,NULL ,NULL ,"unsupported interface version" , e, error);return error;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 574/1146 apparmor: Fix regression in stacking due to label flags
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
[ Upstream commit 1f939c6bd1512d0b39b470396740added3cb403f ]
The unconfined label flag is not being computed correctly. It should only be set if all the profiles in the vector are set, which is different than what is required for the debug and stale flag that are set if any on the profile flags are set.
--- security/apparmor/label.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
security/apparmor/label.c +7 -5
@@ -197,15 +197,18 @@ static bool vec_is_stale(struct aa_profile **vec, int n)return false; } -static long union_vec_flags (struct aa_profile **vec,int n,long mask) +static long accum_vec_flags (struct aa_profile **vec,int n) { -long u =0 ; +long u =FLAG_UNCONFINED ;int i;AA_BUG (!vec);for (i =0 ; i < n; i++) { - u |= vec[i]->label.flags & mask; + u |= vec[i]->label.flags & (FLAG_DEBUG1 |FLAG_DEBUG2 | +FLAG_STALE ); +if (!(u & vec[i]->label.flags &FLAG_UNCONFINED )) + u &= ~FLAG_UNCONFINED ; }return u;
@@ -1097,8 +1100,7 @@ static struct aa_label *label_merge_insert(struct aa_label *new,else if (k == b->size)return aa_get_label (b); } - new->flags |=union_vec_flags (new->vec, new->size,FLAG_UNCONFINED | -FLAG_DEBUG1 |FLAG_DEBUG2 ); + new->flags |=accum_vec_flags (new->vec, new->size); ls =labels_set (new);write_lock_irqsave (&ls->lock, flags); label =__label_insert (labels_set (new), new, false);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 575/1146 crypto: hisilicon/qm - fix incorrect parameters usage
In reply to Greg Kroah-HartmanFrom: Weili Qian <[email protected]>
[ Upstream commit f57e292897cac13b6ddee078aea21173b234ecb7 ]
In qm_get_xqc_depth(), parameters low_bits and high_bits save the values of the corresponding bits. However, the values saved by the two parameters are opposite. As a result, the values returned to the callers are incorrect.
--- drivers/crypto/hisilicon/qm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/qm.c +2 -2
@@ -909,8 +909,8 @@ static void qm_get_xqc_depth(struct hisi_qm *qm, u16 *low_bits,u32 depth; depth =hisi_qm_get_hw_info (qm, qm_basic_info, type, qm->cap_ver); - *high_bits = depth &QM_XQ_DEPTH_MASK ; - *low_bits = (depth >>QM_XQ_DEPTH_SHIFT ) &QM_XQ_DEPTH_MASK ; + *low_bits = depth &QM_XQ_DEPTH_MASK ; + *high_bits = (depth >>QM_XQ_DEPTH_SHIFT ) &QM_XQ_DEPTH_MASK ; }static u32 qm_get_irq_num (struct hisi_qm *qm)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 576/1146 crypto: hisilicon/qm - re-enable communicate interrupt before notifying PF
In reply to Greg Kroah-HartmanFrom: Weili Qian <[email protected]>
[ Upstream commit ee1537fe3dd89860d0336563891f6cac707d0cb5 ]
After the device is reset, the VF needs to re-enable communication interrupt before the VF sends restart complete message to the PF. If the interrupt is re-enabled after the VF notifies the PF, the PF may fail to send messages to the VF after receiving VF's restart complete message.
--- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/qm.c +1 -1
@@ -5725,6 +5725,7 @@ static void qm_pf_reset_vf_done(struct hisi_qm *qm) cmd =QM_VF_START_FAIL ; } +qm_cmd_init (qm); ret =qm_ping_pf (qm, cmd);if (ret)dev_warn (&pdev->dev,"PF responds timeout in reset done!\n" );
@@ -5786,7 +5787,6 @@ static void qm_pf_reset_vf_process(struct hisi_qm *qm, goto err_get_status;qm_pf_reset_vf_done (qm); -qm_cmd_init (qm);dev_info (dev,"device reset done.\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 577/1146 crypto: sun8i-ss - use dma_addr instead u32
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 839b8ae2fc10f205317bcc32c9de18456756e1f5 ]
The DMA address need to be stored in a dma_addr_t
--- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +1 -1
@@ -124,7 +124,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *areq)unsigned int ivsize =crypto_skcipher_ivsize (tfm);struct sun8i_ss_flow *sf = &ss->flows[rctx->flow];int i =0 ; -u32 a; +dma_addr_t a;int err; rctx->ivlen = ivsize;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 578/1146 crypto: nitrox - avoid double free on error path in nitrox_sriov_init()
In reply to Greg Kroah-HartmanFrom: Natalia Petrova <[email protected]>
[ Upstream commit 094528b6a5a755b1195a01e10b13597d67d1a0e6 ]
If alloc_workqueue() fails in nitrox_mbox_init() it deallocates ndev->iov.vfdev and returns error code, but then nitrox_sriov_init() calls nitrox_sriov_cleanup() where ndev->iov.vfdev is deallocated again.
Fix this by nulling ndev->iov.vfdev after the first deallocation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/crypto/cavium/nitrox/nitrox_mbx.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/cavium/nitrox/nitrox_mbx.c +1 -0
@@ -195,6 +195,7 @@ int nitrox_mbox_init(struct nitrox_device *ndev) ndev->iov.pf2vf_wq =alloc_workqueue ("nitrox_pf2vf" ,0 ,0 );if (!ndev->iov.pf2vf_wq) {kfree (ndev->iov.vfdev); + ndev->iov.vfdev =NULL ;return -ENOMEM ; }/* enable pf2vf mailbox interrupts */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 579/1146 crypto: tcrypt - fix return value for multiple subtests
In reply to Greg Kroah-HartmanFrom: Robert Elliott <[email protected]>
[ Upstream commit 65c92cbb3f2365627a10cf97560d51e88fb4e588 ]
When a test mode invokes multiple tests (e.g., mode 0 invokes modes 1 through 199, and mode 3 tests three block cipher modes with des), don't keep accumulating the return values with ret += tcrypt_test(), which results in a bogus value if more than one report a nonzero value (e.g., two reporting -2 (-ENOENT) end up reporting -4 (-EINTR)). Instead, keep track of the minimum return value reported by any subtest.
--- crypto/tcrypt.c | 256 ++++++++++++++++++++++++------------------------ 1 file changed, 128 insertions(+), 128 deletions(-)
crypto/tcrypt.c +128 -128
@@ -1471,387 +1471,387 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) }for (i =1 ; i <200 ; i++) - ret +=do_test (NULL ,0 ,0 , i, num_mb); + ret =min (ret,do_test (NULL ,0 ,0 , i, num_mb));break ;case 1 : - ret +=tcrypt_test ("md5" ); + ret =min (ret,tcrypt_test ("md5" ));break ;case 2 : - ret +=tcrypt_test ("sha1" ); + ret =min (ret,tcrypt_test ("sha1" ));break ;case 3 : - ret +=tcrypt_test ("ecb(des)" ); - ret +=tcrypt_test ("cbc(des)" ); - ret +=tcrypt_test ("ctr(des)" ); + ret =min (ret,tcrypt_test ("ecb(des)" )); + ret =min (ret,tcrypt_test ("cbc(des)" )); + ret =min (ret,tcrypt_test ("ctr(des)" ));break ;case 4 : - ret +=tcrypt_test ("ecb(des3_ede)" ); - ret +=tcrypt_test ("cbc(des3_ede)" ); - ret +=tcrypt_test ("ctr(des3_ede)" ); + ret =min (ret,tcrypt_test ("ecb(des3_ede)" )); + ret =min (ret,tcrypt_test ("cbc(des3_ede)" )); + ret =min (ret,tcrypt_test ("ctr(des3_ede)" ));break ;case 5 : - ret +=tcrypt_test ("md4" ); + ret =min (ret,tcrypt_test ("md4" ));break ;case 6 : - ret +=tcrypt_test ("sha256" ); + ret =min (ret,tcrypt_test ("sha256" ));break ;case 7 : - ret +=tcrypt_test ("ecb(blowfish)" ); - ret +=tcrypt_test ("cbc(blowfish)" ); - ret +=tcrypt_test ("ctr(blowfish)" ); + ret =min (ret,tcrypt_test ("ecb(blowfish)" )); + ret =min (ret,tcrypt_test ("cbc(blowfish)" )); + ret =min (ret,tcrypt_test ("ctr(blowfish)" ));break ;case 8 : - ret +=tcrypt_test ("ecb(twofish)" ); - ret +=tcrypt_test ("cbc(twofish)" ); - ret +=tcrypt_test ("ctr(twofish)" ); - ret +=tcrypt_test ("lrw(twofish)" ); - ret +=tcrypt_test ("xts(twofish)" ); + ret =min (ret,tcrypt_test ("ecb(twofish)" )); + ret =min (ret,tcrypt_test ("cbc(twofish)" )); + ret =min (ret,tcrypt_test ("ctr(twofish)" )); + ret =min (ret,tcrypt_test ("lrw(twofish)" )); + ret =min (ret,tcrypt_test ("xts(twofish)" ));break ;case 9 : - ret +=tcrypt_test ("ecb(serpent)" ); - ret +=tcrypt_test ("cbc(serpent)" ); - ret +=tcrypt_test ("ctr(serpent)" ); - ret +=tcrypt_test ("lrw(serpent)" ); - ret +=tcrypt_test ("xts(serpent)" ); + ret =min (ret,tcrypt_test ("ecb(serpent)" )); + ret =min (ret,tcrypt_test ("cbc(serpent)" )); + ret =min (ret,tcrypt_test ("ctr(serpent)" )); + ret =min (ret,tcrypt_test ("lrw(serpent)" )); + ret =min (ret,tcrypt_test ("xts(serpent)" ));break ;case 10 : - ret +=tcrypt_test ("ecb(aes)" ); - ret +=tcrypt_test ("cbc(aes)" ); - ret +=tcrypt_test ("lrw(aes)" ); - ret +=tcrypt_test ("xts(aes)" ); - ret +=tcrypt_test ("ctr(aes)" ); - ret +=tcrypt_test ("rfc3686(ctr(aes))" ); - ret +=tcrypt_test ("ofb(aes)" ); - ret +=tcrypt_test ("cfb(aes)" ); - ret +=tcrypt_test ("xctr(aes)" ); + ret =min (ret,tcrypt_test ("ecb(aes)" )); + ret =min (ret,tcrypt_test ("cbc(aes)" )); + ret =min (ret,tcrypt_test ("lrw(aes)" )); + ret =min (ret,tcrypt_test ("xts(aes)" )); + ret =min (ret,tcrypt_test ("ctr(aes)" )); + ret =min (ret,tcrypt_test ("rfc3686(ctr(aes))" )); + ret =min (ret,tcrypt_test ("ofb(aes)" )); + ret =min (ret,tcrypt_test ("cfb(aes)" )); + ret =min (ret,tcrypt_test ("xctr(aes)" ));break ;case 11 : - ret +=tcrypt_test ("sha384" ); + ret =min (ret,tcrypt_test ("sha384" ));break ;case 12 : - ret +=tcrypt_test ("sha512" ); + ret =min (ret,tcrypt_test ("sha512" ));break ;case 13 : - ret +=tcrypt_test ("deflate" ); + ret =min (ret,tcrypt_test ("deflate" ));break ;case 14 : - ret +=tcrypt_test ("ecb(cast5)" ); - ret +=tcrypt_test ("cbc(cast5)" ); - ret +=tcrypt_test ("ctr(cast5)" ); + ret =min (ret,tcrypt_test ("ecb(cast5)" )); + ret =min (ret,tcrypt_test ("cbc(cast5)" )); + ret =min (ret,tcrypt_test ("ctr(cast5)" ));break ;case 15 : - ret +=tcrypt_test ("ecb(cast6)" ); - ret +=tcrypt_test ("cbc(cast6)" ); - ret +=tcrypt_test ("ctr(cast6)" ); - ret +=tcrypt_test ("lrw(cast6)" ); - ret +=tcrypt_test ("xts(cast6)" ); + ret =min (ret,tcrypt_test ("ecb(cast6)" )); + ret =min (ret,tcrypt_test ("cbc(cast6)" )); + ret =min (ret,tcrypt_test ("ctr(cast6)" )); + ret =min (ret,tcrypt_test ("lrw(cast6)" )); + ret =min (ret,tcrypt_test ("xts(cast6)" ));break ;case 16 : - ret +=tcrypt_test ("ecb(arc4)" ); + ret =min (ret,tcrypt_test ("ecb(arc4)" ));break ;case 17 : - ret +=tcrypt_test ("michael_mic" ); + ret =min (ret,tcrypt_test ("michael_mic" ));break ;case 18 : - ret +=tcrypt_test ("crc32c" ); + ret =min (ret,tcrypt_test ("crc32c" ));break ;case 19 : - ret +=tcrypt_test ("ecb(tea)" ); + ret =min (ret,tcrypt_test ("ecb(tea)" ));break ;case 20 : - ret +=tcrypt_test ("ecb(xtea)" ); + ret =min (ret,tcrypt_test ("ecb(xtea)" ));break ;case 21 : - ret +=tcrypt_test ("ecb(khazad)" ); + ret =min (ret,tcrypt_test ("ecb(khazad)" ));break ;case 22 : - ret +=tcrypt_test ("wp512" ); + ret =min (ret,tcrypt_test ("wp512" ));break ;case 23 : - ret +=tcrypt_test ("wp384" ); + ret =min (ret,tcrypt_test ("wp384" ));break ;case 24 : - ret +=tcrypt_test ("wp256" ); + ret =min (ret,tcrypt_test ("wp256" ));break ;case 26 : - ret +=tcrypt_test ("ecb(anubis)" ); - ret +=tcrypt_test ("cbc(anubis)" ); + ret =min (ret,tcrypt_test ("ecb(anubis)" )); + ret =min (ret,tcrypt_test ("cbc(anubis)" ));break ;case 30 : - ret +=tcrypt_test ("ecb(xeta)" ); + ret =min (ret,tcrypt_test ("ecb(xeta)" ));break ;case 31 : - ret +=tcrypt_test ("pcbc(fcrypt)" ); + ret =min (ret,tcrypt_test ("pcbc(fcrypt)" ));break ;case 32 : - ret +=tcrypt_test ("ecb(camellia)" ); - ret +=tcrypt_test ("cbc(camellia)" ); - ret +=tcrypt_test ("ctr(camellia)" ); - ret +=tcrypt_test ("lrw(camellia)" ); - ret +=tcrypt_test ("xts(camellia)" ); + ret =min (ret,tcrypt_test ("ecb(camellia)" )); + ret =min (ret,tcrypt_test ("cbc(camellia)" )); + ret =min (ret,tcrypt_test ("ctr(camellia)" )); + ret =min (ret,tcrypt_test ("lrw(camellia)" )); + ret =min (ret,tcrypt_test ("xts(camellia)" ));break ;case 33 : - ret +=tcrypt_test ("sha224" ); + ret =min (ret,tcrypt_test ("sha224" ));break ;case 35 : - ret +=tcrypt_test ("gcm(aes)" ); + ret =min (ret,tcrypt_test ("gcm(aes)" ));break ;case 36 : - ret +=tcrypt_test ("lzo" ); + ret =min (ret,tcrypt_test ("lzo" ));break ;case 37 : - ret +=tcrypt_test ("ccm(aes)" ); + ret =min (ret,tcrypt_test ("ccm(aes)" ));break ;case 38 : - ret +=tcrypt_test ("cts(cbc(aes))" ); + ret =min (ret,tcrypt_test ("cts(cbc(aes))" ));break ;case 39 : - ret +=tcrypt_test ("xxhash64" ); + ret =min (ret,tcrypt_test ("xxhash64" ));break ;case 40 : - ret +=tcrypt_test ("rmd160" ); + ret =min (ret,tcrypt_test ("rmd160" ));break ;case 42 : - ret +=tcrypt_test ("blake2b-512" ); + ret =min (ret,tcrypt_test ("blake2b-512" ));break ;case 43 : - ret +=tcrypt_test ("ecb(seed)" ); + ret =min (ret,tcrypt_test ("ecb(seed)" ));break ;case 45 : - ret +=tcrypt_test ("rfc4309(ccm(aes))" ); + ret =min (ret,tcrypt_test ("rfc4309(ccm(aes))" ));break ;case 46 : - ret +=tcrypt_test ("ghash" ); + ret =min (ret,tcrypt_test ("ghash" ));break ;case 47 : - ret +=tcrypt_test ("crct10dif" ); + ret =min (ret,tcrypt_test ("crct10dif" ));break ;case 48 : - ret +=tcrypt_test ("sha3-224" ); + ret =min (ret,tcrypt_test ("sha3-224" ));break ;case 49 : - ret +=tcrypt_test ("sha3-256" ); + ret =min (ret,tcrypt_test ("sha3-256" ));break ;case 50 : - ret +=tcrypt_test ("sha3-384" ); + ret =min (ret,tcrypt_test ("sha3-384" ));break ;case 51 : - ret +=tcrypt_test ("sha3-512" ); + ret =min (ret,tcrypt_test ("sha3-512" ));break ;case 52 : - ret +=tcrypt_test ("sm3" ); + ret =min (ret,tcrypt_test ("sm3" ));break ;case 53 : - ret +=tcrypt_test ("streebog256" ); + ret =min (ret,tcrypt_test ("streebog256" ));break ;case 54 : - ret +=tcrypt_test ("streebog512" ); + ret =min (ret,tcrypt_test ("streebog512" ));break ;case 55 : - ret +=tcrypt_test ("gcm(sm4)" ); + ret =min (ret,tcrypt_test ("gcm(sm4)" ));break ;case 56 : - ret +=tcrypt_test ("ccm(sm4)" ); + ret =min (ret,tcrypt_test ("ccm(sm4)" ));break ;case 57 : - ret +=tcrypt_test ("polyval" ); + ret =min (ret,tcrypt_test ("polyval" ));break ;case 58 : - ret +=tcrypt_test ("gcm(aria)" ); + ret =min (ret,tcrypt_test ("gcm(aria)" ));break ;case 100 : - ret +=tcrypt_test ("hmac(md5)" ); + ret =min (ret,tcrypt_test ("hmac(md5)" ));break ;case 101 : - ret +=tcrypt_test ("hmac(sha1)" ); + ret =min (ret,tcrypt_test ("hmac(sha1)" ));break ;case 102 : - ret +=tcrypt_test ("hmac(sha256)" ); + ret =min (ret,tcrypt_test ("hmac(sha256)" ));break ;case 103 : - ret +=tcrypt_test ("hmac(sha384)" ); + ret =min (ret,tcrypt_test ("hmac(sha384)" ));break ;case 104 : - ret +=tcrypt_test ("hmac(sha512)" ); + ret =min (ret,tcrypt_test ("hmac(sha512)" ));break ;case 105 : - ret +=tcrypt_test ("hmac(sha224)" ); + ret =min (ret,tcrypt_test ("hmac(sha224)" ));break ;case 106 : - ret +=tcrypt_test ("xcbc(aes)" ); + ret =min (ret,tcrypt_test ("xcbc(aes)" ));break ;case 108 : - ret +=tcrypt_test ("hmac(rmd160)" ); + ret =min (ret,tcrypt_test ("hmac(rmd160)" ));break ;case 109 : - ret +=tcrypt_test ("vmac64(aes)" ); + ret =min (ret,tcrypt_test ("vmac64(aes)" ));break ;case 111 : - ret +=tcrypt_test ("hmac(sha3-224)" ); + ret =min (ret,tcrypt_test ("hmac(sha3-224)" ));break ;case 112 : - ret +=tcrypt_test ("hmac(sha3-256)" ); + ret =min (ret,tcrypt_test ("hmac(sha3-256)" ));break ;case 113 : - ret +=tcrypt_test ("hmac(sha3-384)" ); + ret =min (ret,tcrypt_test ("hmac(sha3-384)" ));break ;case 114 : - ret +=tcrypt_test ("hmac(sha3-512)" ); + ret =min (ret,tcrypt_test ("hmac(sha3-512)" ));break ;case 115 : - ret +=tcrypt_test ("hmac(streebog256)" ); + ret =min (ret,tcrypt_test ("hmac(streebog256)" ));break ;case 116 : - ret +=tcrypt_test ("hmac(streebog512)" ); + ret =min (ret,tcrypt_test ("hmac(streebog512)" ));break ;case 150 : - ret +=tcrypt_test ("ansi_cprng" ); + ret =min (ret,tcrypt_test ("ansi_cprng" ));break ;case 151 : - ret +=tcrypt_test ("rfc4106(gcm(aes))" ); + ret =min (ret,tcrypt_test ("rfc4106(gcm(aes))" ));break ;case 152 : - ret +=tcrypt_test ("rfc4543(gcm(aes))" ); + ret =min (ret,tcrypt_test ("rfc4543(gcm(aes))" ));break ;case 153 : - ret +=tcrypt_test ("cmac(aes)" ); + ret =min (ret,tcrypt_test ("cmac(aes)" ));break ;case 154 : - ret +=tcrypt_test ("cmac(des3_ede)" ); + ret =min (ret,tcrypt_test ("cmac(des3_ede)" ));break ;case 155 : - ret +=tcrypt_test ("authenc(hmac(sha1),cbc(aes))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha1),cbc(aes))" ));break ;case 156 : - ret +=tcrypt_test ("authenc(hmac(md5),ecb(cipher_null))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(md5),ecb(cipher_null))" ));break ;case 157 : - ret +=tcrypt_test ("authenc(hmac(sha1),ecb(cipher_null))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha1),ecb(cipher_null))" ));break ;case 158 : - ret +=tcrypt_test ("cbcmac(sm4)" ); + ret =min (ret,tcrypt_test ("cbcmac(sm4)" ));break ;case 159 : - ret +=tcrypt_test ("cmac(sm4)" ); + ret =min (ret,tcrypt_test ("cmac(sm4)" ));break ;case 181 : - ret +=tcrypt_test ("authenc(hmac(sha1),cbc(des))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha1),cbc(des))" ));break ;case 182 : - ret +=tcrypt_test ("authenc(hmac(sha1),cbc(des3_ede))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha1),cbc(des3_ede))" ));break ;case 183 : - ret +=tcrypt_test ("authenc(hmac(sha224),cbc(des))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha224),cbc(des))" ));break ;case 184 : - ret +=tcrypt_test ("authenc(hmac(sha224),cbc(des3_ede))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha224),cbc(des3_ede))" ));break ;case 185 : - ret +=tcrypt_test ("authenc(hmac(sha256),cbc(des))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha256),cbc(des))" ));break ;case 186 : - ret +=tcrypt_test ("authenc(hmac(sha256),cbc(des3_ede))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha256),cbc(des3_ede))" ));break ;case 187 : - ret +=tcrypt_test ("authenc(hmac(sha384),cbc(des))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha384),cbc(des))" ));break ;case 188 : - ret +=tcrypt_test ("authenc(hmac(sha384),cbc(des3_ede))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha384),cbc(des3_ede))" ));break ;case 189 : - ret +=tcrypt_test ("authenc(hmac(sha512),cbc(des))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha512),cbc(des))" ));break ;case 190 : - ret +=tcrypt_test ("authenc(hmac(sha512),cbc(des3_ede))" ); + ret =min (ret,tcrypt_test ("authenc(hmac(sha512),cbc(des3_ede))" ));break ;case 191 : - ret +=tcrypt_test ("ecb(sm4)" ); - ret +=tcrypt_test ("cbc(sm4)" ); - ret +=tcrypt_test ("cfb(sm4)" ); - ret +=tcrypt_test ("ctr(sm4)" ); + ret =min (ret,tcrypt_test ("ecb(sm4)" )); + ret =min (ret,tcrypt_test ("cbc(sm4)" )); + ret =min (ret,tcrypt_test ("cfb(sm4)" )); + ret =min (ret,tcrypt_test ("ctr(sm4)" ));break ;case 192 : - ret +=tcrypt_test ("ecb(aria)" ); - ret +=tcrypt_test ("cbc(aria)" ); - ret +=tcrypt_test ("cfb(aria)" ); - ret +=tcrypt_test ("ctr(aria)" ); + ret =min (ret,tcrypt_test ("ecb(aria)" )); + ret =min (ret,tcrypt_test ("cbc(aria)" )); + ret =min (ret,tcrypt_test ("cfb(aria)" )); + ret =min (ret,tcrypt_test ("ctr(aria)" ));break ;case 200 : test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 580/1146 scsi: core: Fix a race between scsi_done() and scsi_timeout()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 978b7922d3dca672b41bb4b8ce6c06ab77112741 ]
If there is a race between scsi_done() and scsi_timeout() and if scsi_timeout() loses the race, scsi_timeout() should not reset the request timer. Hence change the return value for this case from BLK_EH_RESET_TIMER into BLK_EH_DONE.
Although the block layer holds a reference on a request (req->ref) while calling a timeout handler, restarting the timer (blk_add_timer()) while a request is being completed is racy.
--- drivers/scsi/scsi_error.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/scsi/scsi_error.c +3 -11
@@ -343,19 +343,11 @@ enum blk_eh_timer_return scsi_timeout(struct request *req)if (rtn ==BLK_EH_DONE ) {/* -* Set the command to complete first in order to prevent a real -* completion from releasing the command while error handling -* is using it. If the command was already completed, then the -* lower level driver beat the timeout handler, and it is safe -* to return without escalating error recovery. -* -* If timeout handling lost the race to a real completion, the -* block layer may ignore that due to a fake timeout injection, -* so return RESET_TIMER to allow error handling another shot -* at this command. +* If scsi_done() has already set SCMD_STATE_COMPLETE, do not +* modify *scmd. */ if (test_and_set_bit (SCMD_STATE_COMPLETE , &scmd->state)) -return BLK_EH_RESET_TIMER ; +return BLK_EH_DONE ;if (scsi_abort_command (scmd) !=SUCCESS ) {set_host_byte (scmd,DID_TIME_OUT );scsi_eh_scmd_add (scmd);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 581/1146 apparmor: Use pointer to struct aa_label for lbs_cred
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 37923d4321b1e38170086da2c117f78f2b0f49c6 ]
According to the implementations of cred_label() and set_cred_label(), we should use pointer to struct aa_label for lbs_cred instead of struct aa_task_ctx, this patch fixes it.
--- security/apparmor/lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/lsm.c +2 -2
@@ -1194,10 +1194,10 @@ static int apparmor_inet_conn_request(const struct sock *sk, struct sk_buff *skb#endif /* -* The cred blob is a pointer to, not an instance of, an aa_task_ctx. +* The cred blob is a pointer to, not an instance of, an aa_label. */ struct lsm_blob_sizes apparmor_blob_sizes __lsm_ro_after_init = { - .lbs_cred =sizeof (struct aa_task_ctx *), + .lbs_cred =sizeof (struct aa_label *), .lbs_file =sizeof (struct aa_file_ctx ), .lbs_task =sizeof (struct aa_task_ctx ), };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 582/1146 PCI: dwc: Fix n_fts[] array overrun
In reply to Greg Kroah-HartmanFrom: Vidya Sagar <[email protected]>
[ Upstream commit 66110361281b2f7da0c8bd51eaf1f152f4236035 ]
commit aeaa0bfe89654 ("PCI: dwc: Move N_FTS setup to common setup") incorrectly uses pci->link_gen in deriving the index to the n_fts[] array also introducing the issue of accessing beyond the boundaries of array for greater than Gen-2 speeds. This change fixes that issue.
--- drivers/pci/controller/dwc/pcie-designware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware.c +1 -1
@@ -641,7 +641,7 @@ void dw_pcie_setup(struct dw_pcie *pci)if (pci->n_fts[1 ]) { val =dw_pcie_readl_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL ); val &= ~PORT_LOGIC_N_FTS_MASK ; - val |= pci->n_fts[pci->link_gen -1 ]; + val |= pci->n_fts[1 ];dw_pcie_writel_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL , val); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 583/1146 RDMA/core: Fix order of nldev_exit call
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4508d32ccced24c972bc4592104513e1ff8439b5 ]
Create symmetrical exit flow by calling to nldev_exit() after call to rdma_nl_unregister(RDMA_NL_LS).
--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/device.c +1 -1
@@ -2851,8 +2851,8 @@ static int __init ib_core_init(void) static void __exit ib_core_cleanup(void) {roce_gid_mgmt_cleanup (); -nldev_exit ();rdma_nl_unregister (RDMA_NL_LS ); +nldev_exit ();unregister_pernet_device (&rdma_dev_net_ops);unregister_blocking_lsm_notifier (&ibdev_lsm_nb);ib_sa_cleanup ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 584/1146 PCI: pci-epf-test: Register notifier if only core_init_notifier is enabled
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 6acd25cc98ce0c9ee4fefdaf44fc8bca534b26e5 ]
The pci_epf_test_notifier function should be installed also if only core_init_notifier is enabled. Fix the current logic.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-test.c +1 -1
@@ -979,7 +979,7 @@ static int pci_epf_test_bind(struct pci_epf *epf)if (ret) epf_test->dma_supported = false; -if (linkup_notifier) { +if (linkup_notifier || core_init_notifier) { epf->nb.notifier_call = pci_epf_test_notifier;pci_epc_register_notifier (epc, &epf->nb); }else {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 585/1146 f2fs: Fix the race condition of resize flag between resizefs
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 28fc4e9077ce59ab28c89c20dc6be5154473218f ]
Because the set/clear SBI_IS_RESIZEFS flag not between any locks, In the following case:
thread1 thread2
->ioctl(resizefs)
->set RESIZEFS flag ->ioctl(resizefs)
... ->set RESIZEFS flag
->clear RESIZEFS flag
->resizefs stream
# No RESIZEFS flag in the streamAlso before freeze_super, the resizefs not started, we should not set the SBI_IS_RESIZEFS flag.
So move the set/clear SBI_IS_RESIZEFS flag between the cp_mutex and gc_lock.
--- fs/f2fs/gc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/f2fs/gc.c +2 -3
@@ -2133,8 +2133,6 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count)if (err)return err; -set_sbi_flag (sbi,SBI_IS_RESIZEFS ); -freeze_super (sbi->sb);f2fs_down_write (&sbi->gc_lock);f2fs_down_write (&sbi->cp_global_sem);
@@ -2150,6 +2148,7 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count)if (err) goto out_err; +set_sbi_flag (sbi,SBI_IS_RESIZEFS ); err =free_segment_range (sbi, secs, false);if (err) goto recover_out;
@@ -2173,6 +2172,7 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count)f2fs_commit_super (sbi, false); } recover_out: +clear_sbi_flag (sbi,SBI_IS_RESIZEFS );if (err) {set_sbi_flag (sbi,SBI_NEED_FSCK );f2fs_err (sbi,"resize_fs failed, should run fsck to repair!" );
@@ -2185,6 +2185,5 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count)f2fs_up_write (&sbi->cp_global_sem);f2fs_up_write (&sbi->gc_lock);thaw_super (sbi->sb); -clear_sbi_flag (sbi,SBI_IS_RESIZEFS );return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 586/1146 crypto: rockchip - do not do custom power management
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit c50ef1411c8cbad0c7db100c477126076b6e3348 ]
The clock enable/disable at tfm init/exit is fragile, if 2 tfm are init in the same time and one is removed just after, it will leave the hardware uncloked even if a user remains.
Instead simply enable clocks at probe time.
We will do PM later.
--- drivers/crypto/rockchip/rk3288_crypto.c | 4 ++-- drivers/crypto/rockchip/rk3288_crypto.h | 2 -- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 3 +-- drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 5 +++-- 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +2 -2
@@ -395,8 +395,7 @@ static int rk_crypto_probe(struct platform_device *pdev) rk_crypto_done_task_cb, (unsigned long)crypto_info);crypto_init_queue (&crypto_info->queue,50 ); - crypto_info->enable_clk = rk_crypto_enable_clk; - crypto_info->disable_clk = rk_crypto_disable_clk; +rk_crypto_enable_clk (crypto_info); crypto_info->load_data = rk_load_data; crypto_info->unload_data = rk_unload_data; crypto_info->enqueue = rk_crypto_enqueue;
@@ -423,6 +422,7 @@ static int rk_crypto_remove(struct platform_device *pdev)struct rk_crypto_info *crypto_tmp =platform_get_drvdata (pdev);rk_crypto_unregister (); +rk_crypto_disable_clk (crypto_tmp);tasklet_kill (&crypto_tmp->done_task);tasklet_kill (&crypto_tmp->queue_task);return 0 ;
drivers/crypto/rockchip/rk3288_crypto.h +0 -2
@@ -220,8 +220,6 @@ struct rk_crypto_info {int (*start)(struct rk_crypto_info *dev);int (*update)(struct rk_crypto_info *dev);void (*complete)(struct crypto_async_request *base,int err); -int (*enable_clk)(struct rk_crypto_info *dev); -void (*disable_clk)(struct rk_crypto_info *dev);int (*load_data)(struct rk_crypto_info *dev,struct scatterlist *sg_src,struct scatterlist *sg_dst);
drivers/crypto/rockchip/rk3288_crypto_ahash.c +1 -2
@@ -301,7 +301,7 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)sizeof (struct rk_ahash_rctx ) + crypto_ahash_reqsize(tctx->fallback_tfm)); -return tctx->dev->enable_clk (tctx->dev); +return 0 ; }static void rk_cra_hash_exit (struct crypto_tfm *tfm)
@@ -309,7 +309,6 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);free_page ((unsigned long )tctx->dev->addr_vir); -return tctx->dev->disable_clk (tctx->dev); }struct rk_crypto_tmp rk_ahash_sha1 = {
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +3 -2
@@ -388,8 +388,10 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) ctx->dev->update = rk_ablk_rx; ctx->dev->complete = rk_crypto_complete; ctx->dev->addr_vir = (char *)__get_free_page (GFP_KERNEL ); +if (!ctx->dev->addr_vir) +return -ENOMEM ; -return ctx->dev->addr_vir ? ctx->dev->enable_clk (ctx->dev) : -ENOMEM ; +return 0 ; }static void rk_ablk_exit_tfm (struct crypto_skcipher *tfm)
@@ -397,7 +399,6 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm);free_page ((unsigned long )ctx->dev->addr_vir); - ctx->dev->disable_clk (ctx->dev); }struct rk_crypto_tmp rk_ecb_aes_alg = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 587/1146 crypto: rockchip - do not store mode globally
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 87e356c4966444866186f68f05832fdcc0f351a3 ]
Storing the mode globally does not work if 2 requests are handled in the same time.
We should store it in a request context.
--- drivers/crypto/rockchip/rk3288_crypto.h | 5 +- .../crypto/rockchip/rk3288_crypto_skcipher.c | 58 ++++++++++++------- 2 files changed, 41 insertions(+), 22 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.h +4 -1
@@ -245,10 +245,13 @@ struct rk_ahash_rctx {struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen; -u32 mode;u8 iv[AES_BLOCK_SIZE ]; }; +struct rk_cipher_rctx { +u32 mode; +}; +enum alg_type {ALG_TYPE_HASH ,ALG_TYPE_CIPHER ,
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +37 -21
208 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 588/1146 crypto: rockchip - add fallback for cipher
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 68ef8af09a1a912a5ed2cfaa4cca7606f52cef90 ]
The hardware does not handle 0 size length request, let's add a fallback.
Furthermore fallback will be used for all unaligned case the hardware cannot handle.
--- drivers/crypto/Kconfig | 4 + drivers/crypto/rockchip/rk3288_crypto.h | 2 + .../crypto/rockchip/rk3288_crypto_skcipher.c | 97 ++++++++++++++++--- 3 files changed, 90 insertions(+), 13 deletions(-)
drivers/crypto/Kconfig +4 -0
@@ -669,6 +669,10 @@ config CRYPTO_DEV_IMGTEC_HASH config CRYPTO_DEV_ROCKCHIP tristate "Rockchip's Cryptographic Engine driver" depends on OF && ARCH_ROCKCHIP + depends on PM + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_DES select CRYPTO_AES select CRYPTO_LIB_DES select CRYPTO_MD5
drivers/crypto/rockchip/rk3288_crypto.h +2 -0
@@ -246,10 +246,12 @@ struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen;u8 iv[AES_BLOCK_SIZE ]; +struct crypto_skcipher *fallback_tfm; };struct rk_cipher_rctx {u32 mode; +struct skcipher_request fallback_req;// keep at the end };enum alg_type {
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +84 -13
181 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 589/1146 crypto: rockchip - add fallback for ahash
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 816600485cb597b3ff7d6806a95a78512839f775 ]
Adds a fallback for all case hardware cannot handle.
--- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/crypto/rockchip/rk3288_crypto_ahash.c +38 -0
@@ -16,6 +16,40 @@* so we put the fixed hash out when met zero message. */ +static bool rk_ahash_need_fallback (struct ahash_request *req) +{ +struct scatterlist *sg; + + sg = req->src; +while (sg) { +if (!IS_ALIGNED (sg->offset,sizeof (u32))) { +return true; + } +if (sg->length %4 ) { +return true; + } + sg =sg_next (sg); + } +return false; +} + +static int rk_ahash_digest_fb (struct ahash_request *areq) +{ +struct rk_ahash_rctx *rctx =ahash_request_ctx (areq); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (areq); +struct rk_ahash_ctx *tfmctx =crypto_ahash_ctx (tfm); + +ahash_request_set_tfm (&rctx->fallback_req, tfmctx->fallback_tfm); + rctx->fallback_req.base.flags = areq->base.flags & +CRYPTO_TFM_REQ_MAY_SLEEP ; + + rctx->fallback_req.nbytes = areq->nbytes; + rctx->fallback_req.src = areq->src; + rctx->fallback_req.result = areq->result; + +return crypto_ahash_digest (&rctx->fallback_req); +} +static int zero_message_process (struct ahash_request *req) {struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);
@@ -167,6 +201,9 @@ static int rk_ahash_digest(struct ahash_request *req)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (req->base.tfm);struct rk_crypto_info *dev = tctx->dev; +if (rk_ahash_need_fallback (req)) +return rk_ahash_digest_fb (req); +if (!req->nbytes)return zero_message_process (req);else
@@ -309,6 +346,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm);free_page ((unsigned long )tctx->dev->addr_vir); +crypto_free_ahash (tctx->fallback_tfm); }struct rk_crypto_tmp rk_ahash_sha1 = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 590/1146 crypto: rockchip - better handle cipher key
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit d6b23ccef82816050c2fd458c9dabfa0e0af09b9 ]
The key should not be set in hardware too much in advance, this will fail it 2 TFM with different keys generate alternative requests. The key should be stored and used just before doing cipher operations.
--- drivers/crypto/rockchip/rk3288_crypto.h | 1 + drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.h +1 -0
@@ -245,6 +245,7 @@ struct rk_ahash_rctx {struct rk_cipher_ctx {struct rk_crypto_info *dev;unsigned int keylen; +u8 key[AES_MAX_KEY_SIZE ];u8 iv[AES_BLOCK_SIZE ];struct crypto_skcipher *fallback_tfm; };
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +7 -3
@@ -95,7 +95,7 @@ static int rk_aes_setkey(struct crypto_skcipher *cipher, keylen != AES_KEYSIZE_256)return -EINVAL ; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_AES_KEY_0 , key, keylen); +memcpy (ctx->key, key, keylen);return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -111,7 +111,7 @@ static int rk_des_setkey(struct crypto_skcipher *cipher,return err; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , key, keylen); +memcpy (ctx->key, key, keylen);return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -127,7 +127,8 @@ static int rk_tdes_setkey(struct crypto_skcipher *cipher,return err; ctx->keylen = keylen; -memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , key, keylen); +memcpy (ctx->key, key, keylen); +return crypto_skcipher_setkey (ctx->fallback_tfm, key, keylen); }
@@ -283,6 +284,7 @@ static void rk_ablk_hw_init(struct rk_crypto_info *dev)RK_CRYPTO_TDES_BYTESWAP_IV ;CRYPTO_WRITE (dev,RK_CRYPTO_TDES_CTRL , rctx->mode);memcpy_toio (dev->reg +RK_CRYPTO_TDES_IV_0 , req->iv, ivsize); +memcpy_toio (ctx->dev->reg +RK_CRYPTO_TDES_KEY1_0 , ctx->key, ctx->keylen); conf_reg =RK_CRYPTO_DESSEL ; }else { rctx->mode |= RK_CRYPTO_AES_FIFO_MODE |
@@ -295,6 +297,7 @@ static void rk_ablk_hw_init(struct rk_crypto_info *dev) rctx->mode |= RK_CRYPTO_AES_256BIT_key;CRYPTO_WRITE (dev,RK_CRYPTO_AES_CTRL , rctx->mode);memcpy_toio (dev->reg +RK_CRYPTO_AES_IV_0 , req->iv, ivsize); +memcpy_toio (ctx->dev->reg +RK_CRYPTO_AES_KEY_0 , ctx->key, ctx->keylen); } conf_reg |=RK_CRYPTO_BYTESWAP_BTFIFO |RK_CRYPTO_BYTESWAP_BRFIFO ;
@@ -484,6 +487,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm) {struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm); +memzero_explicit (ctx->key, ctx->keylen);free_page ((unsigned long )ctx->dev->addr_vir);crypto_free_skcipher (ctx->fallback_tfm); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 591/1146 crypto: rockchip - remove non-aligned handling
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit bb3c7b73363c9a149b12b74c44ae94b73a8fddf8 ]
Now driver have fallback for un-aligned cases, remove all code handling those cases.
--- drivers/crypto/rockchip/rk3288_crypto.c | 69 +++++-------------- drivers/crypto/rockchip/rk3288_crypto.h | 4 -- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 22 ++---- .../crypto/rockchip/rk3288_crypto_skcipher.c | 39 +++-------- 4 files changed, 31 insertions(+), 103 deletions(-)
drivers/crypto/rockchip/rk3288_crypto.c +16 -53
@@ -88,63 +88,26 @@ static int rk_load_data(struct rk_crypto_info *dev, {unsigned int count; - dev->aligned = dev->aligned ? -check_alignment (sg_src, sg_dst, dev->align_size) : - dev->aligned; -if (dev->aligned) { - count =min (dev->left_bytes, sg_src->length); - dev->left_bytes -= count; - -if (!dma_map_sg (dev->dev, sg_src,1 ,DMA_TO_DEVICE )) { -dev_err (dev->dev,"[%s:%d] dma_map_sg(src) error\n" , + count =min (dev->left_bytes, sg_src->length); + dev->left_bytes -= count; + +if (!dma_map_sg (dev->dev, sg_src,1 ,DMA_TO_DEVICE )) { +dev_err (dev->dev,"[%s:%d] dma_map_sg(src) error\n" , __func__, __LINE__); -return -EINVAL ; - } - dev->addr_in =sg_dma_address (sg_src); +return -EINVAL ; + } + dev->addr_in =sg_dma_address (sg_src); -if (sg_dst) { -if (!dma_map_sg (dev->dev, sg_dst,1 ,DMA_FROM_DEVICE )) { -dev_err (dev->dev, +if (sg_dst) { +if (!dma_map_sg (dev->dev, sg_dst,1 ,DMA_FROM_DEVICE )) { +dev_err (dev->dev,"[%s:%d] dma_map_sg(dst) error\n" , __func__, __LINE__); -dma_unmap_sg (dev->dev, sg_src,1 , -DMA_TO_DEVICE ); -return -EINVAL ; - } - dev->addr_out =sg_dma_address (sg_dst); - } - }else { - count = (dev->left_bytes >PAGE_SIZE ) ? -PAGE_SIZE : dev->left_bytes; - -if (!sg_pcopy_to_buffer (dev->first, dev->src_nents, - dev->addr_vir, count, - dev->total - dev->left_bytes)) { -dev_err (dev->dev,"[%s:%d] pcopy err\n" , - __func__, __LINE__); +dma_unmap_sg (dev->dev, sg_src,1 , +DMA_TO_DEVICE );return -EINVAL ; } - dev->left_bytes -= count; -sg_init_one (&dev->sg_tmp, dev->addr_vir, count); -if (!dma_map_sg (dev->dev, &dev->sg_tmp,1 ,DMA_TO_DEVICE )) { -dev_err (dev->dev,"[%s:%d] dma_map_sg(sg_tmp) error\n" , - __func__, __LINE__); -return -ENOMEM ; - } - dev->addr_in =sg_dma_address (&dev->sg_tmp); - -if (sg_dst) { -if (!dma_map_sg (dev->dev, &dev->sg_tmp,1 , -DMA_FROM_DEVICE )) { -dev_err (dev->dev, -"[%s:%d] dma_map_sg(sg_tmp) error\n" , - __func__, __LINE__); -dma_unmap_sg (dev->dev, &dev->sg_tmp,1 , -DMA_TO_DEVICE ); -return -ENOMEM ; - } - dev->addr_out =sg_dma_address (&dev->sg_tmp); - } + dev->addr_out =sg_dma_address (sg_dst); } dev->count = count;return 0 ;
@@ -154,11 +117,11 @@ static void rk_unload_data(struct rk_crypto_info *dev) {struct scatterlist *sg_in, *sg_out; - sg_in = dev->aligned ? dev->sg_src : &dev->sg_tmp; + sg_in = dev->sg_src;dma_unmap_sg (dev->dev, sg_in,1 ,DMA_TO_DEVICE );if (dev->sg_dst) { - sg_out = dev->aligned ? dev->sg_dst : &dev->sg_tmp; + sg_out = dev->sg_dst;dma_unmap_sg (dev->dev, sg_out,1 ,DMA_FROM_DEVICE ); } }
drivers/crypto/rockchip/rk3288_crypto.h +0 -4
@@ -204,12 +204,8 @@ struct rk_crypto_info {/* the public variable */ struct scatterlist *sg_src;struct scatterlist *sg_dst; -struct scatterlist sg_tmp;struct scatterlist *first;unsigned int left_bytes; -void *addr_vir; -int aligned; -int align_size;size_t src_nents;size_t dst_nents;unsigned int total;
drivers/crypto/rockchip/rk3288_crypto_ahash.c +6 -16
@@ -236,8 +236,6 @@ static int rk_ahash_start(struct rk_crypto_info *dev) dev->total = req->nbytes; dev->left_bytes = req->nbytes; - dev->aligned =0 ; - dev->align_size =4 ; dev->sg_dst =NULL ; dev->sg_src = req->src; dev->first = req->src;
@@ -272,15 +270,13 @@ static int rk_ahash_crypto_rx(struct rk_crypto_info *dev) dev->unload_data (dev);if (dev->left_bytes) { -if (dev->aligned) { -if (sg_is_last (dev->sg_src)) { -dev_warn (dev->dev,"[%s:%d], Lack of data\n" , - __func__, __LINE__); - err = -ENOMEM ; - goto out_rx; - } - dev->sg_src =sg_next (dev->sg_src); +if (sg_is_last (dev->sg_src)) { +dev_warn (dev->dev,"[%s:%d], Lack of data\n" , + __func__, __LINE__); + err = -ENOMEM ; + goto out_rx; } + dev->sg_src =sg_next (dev->sg_src); err =rk_ahash_set_data_start (dev); }else {/*
@@ -318,11 +314,6 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm) algt = container_of(alg, struct rk_crypto_tmp, alg.hash); tctx->dev = algt->dev; - tctx->dev->addr_vir = (void *)__get_free_page (GFP_KERNEL ); -if (!tctx->dev->addr_vir) { -dev_err (tctx->dev->dev,"failed to kmalloc for addr_vir\n" ); -return -ENOMEM ; - } tctx->dev->start = rk_ahash_start; tctx->dev->update = rk_ahash_crypto_rx; tctx->dev->complete = rk_ahash_crypto_complete;
@@ -345,7 +336,6 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm) {struct rk_ahash_ctx *tctx =crypto_tfm_ctx (tfm); -free_page ((unsigned long )tctx->dev->addr_vir);crypto_free_ahash (tctx->fallback_tfm); }
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +9 -30
@@ -356,7 +356,6 @@ static int rk_ablk_start(struct rk_crypto_info *dev) dev->src_nents =sg_nents (req->src); dev->sg_dst = req->dst; dev->dst_nents =sg_nents (req->dst); - dev->aligned =1 ;spin_lock_irqsave (&dev->lock, flags);rk_ablk_hw_init (dev);
@@ -376,13 +375,9 @@ static void rk_iv_copyback(struct rk_crypto_info *dev)/* Update the IV buffer to contain the next IV for encryption mode. */ if (!(rctx->mode &RK_CRYPTO_DEC )) { -if (dev->aligned) { -memcpy (req->iv,sg_virt (dev->sg_dst) + - dev->sg_dst->length - ivsize, ivsize); - }else { -memcpy (req->iv, dev->addr_vir + - dev->count - ivsize, ivsize); - } +memcpy (req->iv, +sg_virt (dev->sg_dst) + dev->sg_dst->length - ivsize, + ivsize); } }
@@ -420,27 +415,16 @@ static int rk_ablk_rx(struct rk_crypto_info *dev)skcipher_request_cast (dev->async_req); dev->unload_data (dev); -if (!dev->aligned) { -if (!sg_pcopy_from_buffer (req->dst, dev->dst_nents, - dev->addr_vir, dev->count, - dev->total - dev->left_bytes - - dev->count)) { - err = -EINVAL ; - goto out_rx; - } - }if (dev->left_bytes) {rk_update_iv (dev); -if (dev->aligned) { -if (sg_is_last (dev->sg_src)) { -dev_err (dev->dev,"[%s:%d] Lack of data\n" , +if (sg_is_last (dev->sg_src)) { +dev_err (dev->dev,"[%s:%d] Lack of data\n" , __func__, __LINE__); - err = -ENOMEM ; - goto out_rx; - } - dev->sg_src =sg_next (dev->sg_src); - dev->sg_dst =sg_next (dev->sg_dst); + err = -ENOMEM ; + goto out_rx; } + dev->sg_src =sg_next (dev->sg_src); + dev->sg_dst =sg_next (dev->sg_dst); err =rk_set_data_start (dev); }else {rk_iv_copyback (dev);
@@ -462,13 +446,9 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm) algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher); ctx->dev = algt->dev; - ctx->dev->align_size =crypto_tfm_alg_alignmask (crypto_skcipher_tfm (tfm)) +1 ; ctx->dev->start = rk_ablk_start; ctx->dev->update = rk_ablk_rx; ctx->dev->complete = rk_crypto_complete; - ctx->dev->addr_vir = (char *)__get_free_page (GFP_KERNEL ); -if (!ctx->dev->addr_vir) -return -ENOMEM ; ctx->fallback_tfm =crypto_alloc_skcipher (name,0 ,CRYPTO_ALG_NEED_FALLBACK );if (IS_ERR (ctx->fallback_tfm)) {
@@ -488,7 +468,6 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)struct rk_cipher_ctx *ctx =crypto_skcipher_ctx (tfm);memzero_explicit (ctx->key, ctx->keylen); -free_page ((unsigned long )ctx->dev->addr_vir);crypto_free_skcipher (ctx->fallback_tfm); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 592/1146 crypto: rockchip - rework by using crypto_engine
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 57d67c6e8219b2a034c16d6149e30fb40fd39935 ]
Instead of doing manual queue management, let's use the crypto/engine for that.
In the same time, rework the requests handling to be easier to understand (and fix all bugs related to them).
--- drivers/crypto/Kconfig | 1 + drivers/crypto/rockchip/rk3288_crypto.c | 152 +---------- drivers/crypto/rockchip/rk3288_crypto.h | 39 +-- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 144 +++++----- .../crypto/rockchip/rk3288_crypto_skcipher.c | 250 +++++++++--------- 5 files changed, 221 insertions(+), 365 deletions(-)
drivers/crypto/Kconfig +1 -0
@@ -674,6 +674,7 @@ config CRYPTO_DEV_ROCKCHIP select CRYPTO_CBC select CRYPTO_DES select CRYPTO_AES + select CRYPTO_ENGINE select CRYPTO_LIB_DES select CRYPTO_MD5 select CRYPTO_SHA1
drivers/crypto/rockchip/rk3288_crypto.c +9 -143
200 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto.h +10 -29
@@ -5,9 +5,11 @@#include <crypto/aes.h> #include <crypto/internal/des.h> #include <crypto/algapi.h> +#include <linux/dma-mapping.h> #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/scatterlist.h> +#include <crypto/engine.h> #include <crypto/internal/hash.h> #include <crypto/internal/skcipher.h>
@@ -193,39 +195,15 @@ struct rk_crypto_info {struct reset_control *rst;void __iomem *reg;int irq; -struct crypto_queue queue; -struct tasklet_struct queue_task; -struct tasklet_struct done_task; -struct crypto_async_request *async_req; -int err; -/* device lock */ -spinlock_t lock; - -/* the public variable */ -struct scatterlist *sg_src; -struct scatterlist *sg_dst; -struct scatterlist *first; -unsigned int left_bytes; -size_t src_nents; -size_t dst_nents; -unsigned int total; -unsigned int count; -dma_addr_t addr_in; -dma_addr_t addr_out; -bool busy; -int (*start)(struct rk_crypto_info *dev); -int (*update)(struct rk_crypto_info *dev); -void (*complete)(struct crypto_async_request *base,int err); -int (*load_data)(struct rk_crypto_info *dev, -struct scatterlist *sg_src, -struct scatterlist *sg_dst); -void (*unload_data)(struct rk_crypto_info *dev); -int (*enqueue)(struct rk_crypto_info *dev, -struct crypto_async_request *async_req); + +struct crypto_engine *engine; +struct completion complete; +int status; };/* the private variable of hash */ struct rk_ahash_ctx { +struct crypto_engine_ctx enginectx;struct rk_crypto_info *dev;/* for fallback */ struct crypto_ahash *fallback_tfm;
@@ -235,10 +213,12 @@ struct rk_ahash_ctx {struct rk_ahash_rctx {struct ahash_request fallback_req;u32 mode; +int nrsg; };/* the private variable of cipher */ struct rk_cipher_ctx { +struct crypto_engine_ctx enginectx;struct rk_crypto_info *dev;unsigned int keylen;u8 key[AES_MAX_KEY_SIZE ];
@@ -247,6 +227,7 @@ struct rk_cipher_ctx { };struct rk_cipher_rctx { +u8 backup_iv[AES_BLOCK_SIZE ];u32 mode;struct skcipher_request fallback_req;// keep at the end };
drivers/crypto/rockchip/rk3288_crypto_ahash.c +78 -66
218 lines not on this page · raw message
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +123 -127
328 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 593/1146 apparmor: Fix memleak in alloc_ns()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit e9e6fa49dbab6d84c676666f3fe7d360497fd65b ]
After changes in commit a1bd627b46d1 ("apparmor: share profile name on replacement"), the hname member of struct aa_policy is not valid slab object, but a subset of that, it can not be freed by kfree_sensitive(), use aa_policy_destroy() to fix it.
--- security/apparmor/policy_ns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/policy_ns.c +1 -1
@@ -134,7 +134,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)return ns; fail_unconfined: -kfree_sensitive (ns->base.hname); +aa_policy_destroy (&ns->base); fail_ns:kfree_sensitive (ns);return NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 594/1146 fortify: Do not cast to "unsigned char"
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit e9a40e1585d792751d3a122392695e5a53032809 ]
Do not cast to "unsigned char", as this needlessly creates type problems when attempting builds without -Wno-pointer-sign[1]. The intent of the cast is to drop possible "const" types.
[1] https://lore.kernel.org/lkml/CAHk-=wgz3Uba8w7kdXhsqR1qvfemYL+OFQdefJnkeqXG8qZ_pA@mail.gmail.com/
--- include/linux/fortify-string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fortify-string.h +1 -1
@@ -18,7 +18,7 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning("#define __compiletime_strlen (p) \ ({ \ - unsigned char *__p = (unsigned char *)(p); \ + char *__p = (char *)(p); \ size_t __ret = SIZE_MAX; \ size_t __p_size = __member_size(p); \ if (__p_size != SIZE_MAX && \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 595/1146 f2fs: fix to invalidate dcc->f2fs_issue_discard in error path
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 91586ce0d39a05f88795aa8814fb99b1387236b3 ]
Syzbot reports a NULL pointer dereference issue as below:
__refcount_add include/linux/refcount.h:193 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] get_task_struct include/linux/sched/task.h:110 [inline] kthread_stop+0x34/0x1c0 kernel/kthread.c:703 f2fs_stop_discard_thread+0x3c/0x5c fs/f2fs/segment.c:1638 kill_f2fs_super+0x5c/0x194 fs/f2fs/super.c:4522 deactivate_locked_super+0x70/0xe8 fs/super.c:332 deactivate_super+0xd0/0xd4 fs/super.c:363 cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186 __cleanup_mnt+0x20/0x30 fs/namespace.c:1193 task_work_run+0xc4/0x14c kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x26c/0xbe0 kernel/exit.c:795 do_group_exit+0x60/0xe8 kernel/exit.c:925 __do_sys_exit_group kernel/exit.c:936 [inline] __se_sys_exit_group kernel/exit.c:934 [inline] __wake_up_parent+0x0/0x40 kernel/exit.c:934 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
The root cause of this issue is in error path of f2fs_start_discard_thread(), it missed to invalidate dcc->f2fs_issue_discard, later kthread_stop() may access invalid pointer.
--- fs/f2fs/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/segment.c +3 -1
@@ -2025,8 +2025,10 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi) dcc->f2fs_issue_discard =kthread_run (issue_discard_thread, sbi,"f2fs_discard-%u:%u" ,MAJOR (dev),MINOR (dev)); -if (IS_ERR (dcc->f2fs_issue_discard)) +if (IS_ERR (dcc->f2fs_issue_discard)) { err =PTR_ERR (dcc->f2fs_issue_discard); + dcc->f2fs_issue_discard =NULL ; + }return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 596/1146 f2fs: fix gc mode when gc_urgent_high_remaining is 1
In reply to Greg Kroah-HartmanFrom: Yangtao Li <[email protected]>
[ Upstream commit 6359a1aaca527311b7145ec6eb16890a5ddf5214 ]
Under the current logic, when gc_urgent_high_remaining is set to 1, the mode will be switched to normal at the beginning, instead of running in gc_urgent mode.
Let's switch the gc mode back to normal when the gc ends.
--- fs/f2fs/gc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
fs/f2fs/gc.c +9 -10
@@ -96,16 +96,6 @@ static int gc_thread_func(void *data)* invalidated soon after by user update or deletion. * So, I'd like to wait some time to collect dirty segments. */ -if (sbi->gc_mode ==GC_URGENT_HIGH ) { -spin_lock (&sbi->gc_urgent_high_lock); -if (sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_remaining--; -if (!sbi->gc_urgent_high_remaining) - sbi->gc_mode =GC_NORMAL ; - } -spin_unlock (&sbi->gc_urgent_high_lock); - } -if (sbi->gc_mode ==GC_URGENT_HIGH || sbi->gc_mode ==GC_URGENT_MID ) { wait_ms = gc_th->urgent_sleep_time;
@@ -162,6 +152,15 @@ static int gc_thread_func(void *data)/* balancing f2fs's metadata periodically */ f2fs_balance_fs_bg (sbi, true); next: +if (sbi->gc_mode ==GC_URGENT_HIGH ) { +spin_lock (&sbi->gc_urgent_high_lock); +if (sbi->gc_urgent_high_remaining) { + sbi->gc_urgent_high_remaining--; +if (!sbi->gc_urgent_high_remaining) + sbi->gc_mode =GC_NORMAL ; + } +spin_unlock (&sbi->gc_urgent_high_lock); + }sb_end_write (sbi->sb); }while (!kthread_should_stop ());
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 597/1146 f2fs: fix normal discard process
In reply to Greg Kroah-HartmanFrom: Dongdong Zhang <[email protected]>
[ Upstream commit b5f1a218ae5e4339130d6e733f0e63d623e09a2c ]
In the DPOLICY_BG mode, there is a conflict between the two conditions "i + 1 < dpolicy->granularity" and "i < DEFAULT_DISCARD_GRANULARITY". If i = 15, the first condition is false, it will enter the second condition and dispatch all small granularity discards in function
__issue_discard_cmd_orderly. The restrictive effect
of the first condition to small discards will be invalidated. These two conditions should align.
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -1448,7 +1448,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,if (i +1 < dpolicy->granularity)break ; -if (i <DEFAULT_DISCARD_GRANULARITY && dpolicy->ordered) +if (i +1 <DEFAULT_DISCARD_GRANULARITY && dpolicy->ordered)return __issue_discard_cmd_orderly (sbi, dpolicy); pend_list = &dcc->pend_list[i];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 598/1146 f2fs: allow to set compression for inlined file
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit a995627e6dd81d4485d40ce64880017a080d71e6 ]
The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.
--- fs/f2fs/file.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/file.c +4 -0
@@ -1915,6 +1915,10 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)if (!f2fs_disable_compressed_file (inode))return -EINVAL ; }else { +/* try to convert inline_data to support compression */ +int err =f2fs_convert_inline_inode (inode); +if (err) +return err;if (!f2fs_may_compress (inode))return -EINVAL ;if (S_ISREG (inode->i_mode) &&F2FS_HAS_BLOCKS (inode))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 599/1146 f2fs: fix the assign logic of iocb
In reply to Greg Kroah-HartmanFrom: Mukesh Ojha <[email protected]>
[ Upstream commit 0db18eec0d9a7ee525209e31e3ac2f673545b12f ]
commit 18ae8d12991b ("f2fs: show more DIO information in tracepoint") introduces iocb field in 'f2fs_direct_IO_enter' trace event And it only assigns the pointer and later it accesses its field in trace print log.
Unable to handle kernel paging request at virtual address ffffffc04cef3d30
Mem abort info:
ESR = 0x96000007
EC = 0x25: DABT (current EL), IL = 32 bits
pc : trace_raw_output_f2fs_direct_IO_enter+0x54/0xa4 lr : trace_raw_output_f2fs_direct_IO_enter+0x2c/0xa4 sp : ffffffc0443cbbd0 x29: ffffffc0443cbbf0 x28: ffffff8935b120d0 x27: ffffff8935b12108 x26: ffffff8935b120f0 x25: ffffff8935b12100 x24: ffffff8935b110c0 x23: ffffff8935b10000 x22: ffffff88859a936c x21: ffffff88859a936c x20: ffffff8935b110c0 x19: ffffff8935b10000 x18: ffffffc03b195060 x17: ffffff8935b11e76 x16: 00000000000000cc x15: ffffffef855c4f2c x14: 0000000000000001 x13: 000000000000004e x12: ffff0000ffffff00 x11: ffffffef86c350d0 x10: 00000000000010c0 x9 : 000000000fe0002c x8 : ffffffc04cef3d28 x7 : 7f7f7f7f7f7f7f7f x6 : 0000000002000000 x5 : ffffff8935b11e9a x4 : 0000000000006250 x3 : ffff0a00ffffff04 x2 : 0000000000000002 x1 : ffffffef86a0a31f x0 : ffffff8935b10000 Call trace: trace_raw_output_f2fs_direct_IO_enter+0x54/0xa4 print_trace_fmt+0x9c/0x138 print_trace_line+0x154/0x254 tracing_read_pipe+0x21c/0x380 vfs_read+0x108/0x3ac ksys_read+0x7c/0xec __arm64_sys_read+0x20/0x30 invoke_syscall+0x60/0x150 el0_svc_common.llvm.1237943816091755067+0xb8/0xf8 do_el0_svc+0x28/0xa0
Fix it by copying the required variables for printing and while at it fix the similar issue at some other places in the same file.
--- include/trace/events/f2fs.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
include/trace/events/f2fs.h +19 -15
@@ -322,7 +322,7 @@ TRACE_EVENT(f2fs_unlink_enter, __field(ino_t, ino) __field(loff_t, size) __field(blkcnt_t, blocks) - __field(const char *, name) +__string (name, dentry->d_name.name) ), TP_fast_assign(
@@ -330,7 +330,7 @@ TRACE_EVENT(f2fs_unlink_enter, __entry->ino = dir->i_ino; __entry->size = dir->i_size; __entry->blocks = dir->i_blocks; - __entry->name = dentry->d_name.name; +__assign_str (name, dentry->d_name.name); ), TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
@@ -338,7 +338,7 @@ TRACE_EVENT(f2fs_unlink_enter,show_dev_ino (__entry), __entry->size, (unsigned long long )__entry->blocks, - __entry->name) + __get_str(name)) ); DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
@@ -940,25 +940,29 @@ TRACE_EVENT(f2fs_direct_IO_enter,TP_STRUCT__entry (__field (dev_t ,dev )__field (ino_t, ino) - __field(struct kiocb *, iocb) +__field (loff_t, ki_pos) +__field (int, ki_flags) +__field (u16, ki_ioprio) __field(unsigned long, len)__field (int, rw) ),TP_fast_assign ( - __entry->dev = inode->i_sb->s_dev; - __entry->ino = inode->i_ino; - __entry->iocb = iocb; - __entry->len = len; - __entry->rw = rw; + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->ki_pos = iocb->ki_pos; + __entry->ki_flags = iocb->ki_flags; + __entry->ki_ioprio = iocb->ki_ioprio; + __entry->len = len; + __entry->rw = rw; ),TP_printk ("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d" ,show_dev_ino (__entry), - __entry->iocb->ki_pos, + __entry->ki_pos, __entry->len, - __entry->iocb->ki_flags, - __entry->iocb->ki_ioprio, + __entry->ki_flags, + __entry->ki_ioprio, __entry->rw) );
@@ -1407,19 +1411,19 @@ TRACE_EVENT(f2fs_write_checkpoint,TP_STRUCT__entry (__field (dev_t ,dev )__field (int, reason) - __field(char *, msg) +__string (dest_msg, msg) ),TP_fast_assign ( __entry->dev = sb->s_dev; __entry->reason = reason; - __entry->msg = msg; +__assign_str (dest_msg, msg); ),TP_printk ("dev = (%d,%d), checkpoint for %s, state = %s" ,show_dev (__entry->dev),show_cpreason (__entry->reason), - __entry->msg) +__get_str (dest_msg)) ); DECLARE_EVENT_CLASS(f2fs_discard,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 600/1146 f2fs: fix to destroy sbi->post_read_wq in error path of f2fs_fill_super()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 7b02b2201893a71b881026cf574902019ab00db5 ]
In error path of f2fs_fill_super(), this patch fixes to call f2fs_destroy_post_read_wq() once if we fail in f2fs_start_ckpt_thread().
--- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
@@ -4523,9 +4523,9 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)f2fs_destroy_node_manager (sbi); free_sm:f2fs_destroy_segment_manager (sbi); -f2fs_destroy_post_read_wq (sbi); stop_ckpt_thread:f2fs_stop_ckpt_thread (sbi); +f2fs_destroy_post_read_wq (sbi); free_devices:destroy_device_list (sbi);kvfree (sbi->ckpt);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 601/1146 RDMA/irdma: Report the correct link speed
In reply to Greg Kroah-HartmanFrom: Shiraz Saleem <[email protected]>
[ Upstream commit 4eace75e0853273755b878ffa9cce6de84df975a ]
The active link speed is currently hard-coded in irdma_query_port due to which the port rate in ibstatus does reflect the active link speed.
Call ib_get_eth_speed in irdma_query_port to get the active link speed.
--- drivers/infiniband/hw/irdma/verbs.c | 35 +++-------------------------- 1 file changed, 3 insertions(+), 32 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +3 -32
@@ -63,36 +63,6 @@ static int irdma_query_device(struct ib_device *ibdev,return 0 ; } -/** -* irdma_get_eth_speed_and_width - Get IB port speed and width from netdev speed -* @link_speed: netdev phy link speed -* @active_speed: IB port speed -* @active_width: IB port width -*/ -static void irdma_get_eth_speed_and_width (u32 link_speed,u16 *active_speed, -u8 *active_width) -{ -if (link_speed <=SPEED_1000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_SDR ; - }else if (link_speed <=SPEED_10000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_FDR10 ; - }else if (link_speed <=SPEED_20000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_DDR ; - }else if (link_speed <=SPEED_25000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_EDR ; - }else if (link_speed <=SPEED_40000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_FDR10 ; - }else { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_EDR ; - } -} -/** * irdma_query_port - get port attributes * @ibdev: device pointer from stack
@@ -120,8 +90,9 @@ static int irdma_query_port(struct ib_device *ibdev, u32 port, props->state =IB_PORT_DOWN ; props->phys_state =IB_PORT_PHYS_STATE_DISABLED ; } -irdma_get_eth_speed_and_width (SPEED_100000 , &props->active_speed, - &props->active_width); + +ib_get_eth_speed (ibdev, port, &props->active_speed, + &props->active_width);if (rdma_protocol_roce (ibdev,1 )) { props->gid_tbl_len =32 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 602/1146 scsi: qla2xxx: Fix set-but-not-used variable warnings
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 4fb2169d66b837a2986f569f5d5b81f79e6e4a4c ]
Fix the following two compiler warnings:
drivers/scsi/qla2xxx/qla_init.c: In function ‘qla24xx_async_abort_cmd’:drivers/scsi/qla2xxx/qla_init.c:171:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
171 | uint8_t bail;
| ^~~~drivers/scsi/qla2xxx/qla_init.c: In function ‘qla2x00_async_tm_cmd’:drivers/scsi/qla2xxx/qla_init.c:2023:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
2023 | uint8_t bail;
| ^~~~
--- drivers/scsi/qla2xxx/qla_def.h | 22 +++++++++++----------- drivers/scsi/qla2xxx/qla_init.c | 6 ++---- drivers/scsi/qla2xxx/qla_inline.h | 4 +--- drivers/scsi/qla2xxx/qla_os.c | 4 +--- 4 files changed, 15 insertions(+), 21 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +11 -11
@@ -5136,17 +5136,17 @@ struct secure_flash_update_block_pk { (test_bit (ISP_ABORT_NEEDED , &ha->dpc_flags) || \ test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) -#define QLA_VHA_MARK_BUSY (__vha, __bail) do { \ - atomic_inc(&__vha->vref_count); \ - mb(); \ - if (__vha->flags.delete_progress) { \ - atomic_dec(&__vha->vref_count); \ - wake_up(&__vha->vref_waitq); \ - __bail = 1; \ - } else { \ - __bail = 0; \ - } \ -} while (0) +static inline bool qla_vha_mark_busy (scsi_qla_host_t *vha) +{ +atomic_inc (&vha->vref_count); +mb (); +if (vha->flags.delete_progress) { +atomic_dec (&vha->vref_count); +wake_up (&vha->vref_waitq); +return true; + } +return false; +}#define QLA_VHA_MARK_NOT_BUSY (__vha) do { \ atomic_dec(&__vha->vref_count); \
drivers/scsi/qla2xxx/qla_init.c +2 -4
@@ -168,7 +168,6 @@ int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)struct srb_iocb *abt_iocb;srb_t *sp;int rval =QLA_FUNCTION_FAILED ; -uint8_t bail;/* ref: INIT for ABTS command */ sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport,
@@ -176,7 +175,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)if (!sp)return QLA_MEMORY_ALLOC_FAILED ; -QLA_VHA_MARK_BUSY (vha, bail); +qla_vha_mark_busy (vha); abt_iocb = &sp->u.iocb_cmd; sp->type =SRB_ABT_CMD ; sp->name ="abort" ;
@@ -2020,14 +2019,13 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,struct srb_iocb *tm_iocb;srb_t *sp;int rval =QLA_FUNCTION_FAILED ; -uint8_t bail;/* ref: INIT */ sp =qla2x00_get_sp (vha, fcport,GFP_KERNEL );if (!sp) goto done; -QLA_VHA_MARK_BUSY (vha, bail); +qla_vha_mark_busy (vha); sp->type =SRB_TM_CMD ; sp->name ="tmf" ; qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha),
drivers/scsi/qla2xxx/qla_inline.h +1 -3
@@ -225,11 +225,9 @@ static inline srb_t * qla2x00_get_sp(scsi_qla_host_t *vha, fc_port_t *fcport, gfp_t flag) {srb_t *sp =NULL ; -uint8_t bail;struct qla_qpair *qpair; -QLA_VHA_MARK_BUSY (vha, bail); -if (unlikely (bail)) +if (unlikely (qla_vha_mark_busy (vha)))return NULL ; qpair = vha->hw->base_qpair;
drivers/scsi/qla2xxx/qla_os.c +1 -3
@@ -5069,13 +5069,11 @@ struct qla_work_evt * qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) {struct qla_work_evt *e; -uint8_t bail;if (test_bit (UNLOADING , &vha->dpc_flags))return NULL ; -QLA_VHA_MARK_BUSY (vha, bail); -if (bail) +if (qla_vha_mark_busy (vha))return NULL ; e =kzalloc (sizeof (struct qla_work_evt ),GFP_ATOMIC );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 603/1146 RDMA/siw: Fix immediate work request flush to completion queue
In reply to Greg Kroah-HartmanFrom: Bernard Metzler <[email protected]>
[ Upstream commit bdf1da5df9da680589a7f74448dd0a94dd3e1446 ]
Correctly set send queue element opcode during immediate work request flushing in post sendqueue operation, if the QP is in ERROR state. An undefined ocode value results in out-of-bounds access to an array for mapping the opcode between siw internal and RDMA core representation in work completion generation. It resulted in a KASAN BUG report of type 'global-out-of-bounds' during NFSoRDMA testing.
This patch further fixes a potential case of a malicious user which may write undefined values for completion queue elements status or opcode, if the CQ is memory mapped to user land. It avoids the same out-of-bounds access to arrays for status and opcode mapping as described above.
--- drivers/infiniband/sw/siw/siw_cq.c | 24 ++++++++++++++-- drivers/infiniband/sw/siw/siw_verbs.c | 40 ++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 6 deletions(-)
drivers/infiniband/sw/siw/siw_cq.c +22 -2
@@ -56,8 +56,6 @@ int siw_reap_cqe(struct siw_cq *cq, struct ib_wc *wc)if (READ_ONCE (cqe->flags) &SIW_WQE_VALID ) {memset (wc,0 ,sizeof (*wc)); wc->wr_id = cqe->id; - wc->status = map_cqe_status[cqe->status].ib; - wc->opcode = map_wc_opcode[cqe->opcode]; wc->byte_len = cqe->bytes;/*
@@ -71,10 +69,32 @@ int siw_reap_cqe(struct siw_cq *cq, struct ib_wc *wc) wc->wc_flags =IB_WC_WITH_INVALIDATE ; } wc->qp = cqe->base_qp; + wc->opcode = map_wc_opcode[cqe->opcode]; + wc->status = map_cqe_status[cqe->status].ib;siw_dbg_cq (cq,"idx %u, type %d, flags %2x, id 0x%pK\n" , cq->cq_get % cq->num_cqe, cqe->opcode, cqe->flags, (void *)(uintptr_t )cqe->id); + }else { +/* +* A malicious user may set invalid opcode or +* status in the user mmapped CQE array. +* Sanity check and correct values in that case +* to avoid out-of-bounds access to global arrays +* for opcode and status mapping. +*/ +u8 opcode = cqe->opcode; +u16 status = cqe->status; + +if (opcode >=SIW_NUM_OPCODES ) { + opcode =0 ; + status =IB_WC_GENERAL_ERR ; + }else if (status >=SIW_NUM_WC_STATUS ) { + status =IB_WC_GENERAL_ERR ; + } + wc->opcode = map_wc_opcode[opcode]; + wc->status = map_cqe_status[status].ib; + }WRITE_ONCE (cqe->flags,0 ); cq->cq_get++;
drivers/infiniband/sw/siw/siw_verbs.c +36 -4
@@ -676,13 +676,45 @@ static int siw_copy_inline_sgl(const struct ib_send_wr *core_wr,static int siw_sq_flush_wr (struct siw_qp *qp,const struct ib_send_wr *wr,const struct ib_send_wr **bad_wr) { -struct siw_sqe sqe = {};int rv =0 ;while (wr) { - sqe.id = wr->wr_id; - sqe.opcode = wr->opcode; - rv =siw_sqe_complete (qp, &sqe,0 ,SIW_WC_WR_FLUSH_ERR ); +struct siw_sqe sqe = {}; + +switch (wr->opcode) { +case IB_WR_RDMA_WRITE : + sqe.opcode =SIW_OP_WRITE ; +break ; +case IB_WR_RDMA_READ : + sqe.opcode =SIW_OP_READ ; +break ; +case IB_WR_RDMA_READ_WITH_INV : + sqe.opcode =SIW_OP_READ_LOCAL_INV ; +break ; +case IB_WR_SEND : + sqe.opcode =SIW_OP_SEND ; +break ; +case IB_WR_SEND_WITH_IMM : + sqe.opcode =SIW_OP_SEND_WITH_IMM ; +break ; +case IB_WR_SEND_WITH_INV : + sqe.opcode =SIW_OP_SEND_REMOTE_INV ; +break ; +case IB_WR_LOCAL_INV : + sqe.opcode =SIW_OP_INVAL_STAG ; +break ; +case IB_WR_REG_MR : + sqe.opcode =SIW_OP_REG_MR ; +break ; +default : + rv = -EINVAL ; +break ; + } +if (!rv) { + sqe.id = wr->wr_id; + rv =siw_sqe_complete (qp, &sqe,0 , +SIW_WC_WR_FLUSH_ERR ); + }if (rv) {if (bad_wr) *bad_wr = wr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 604/1146 IB/mad: Dont call to function that might sleep while in atomic context
In reply to Greg Kroah-HartmanFrom: Leonid Ravich <[email protected]>
[ Upstream commit 5c20311d76cbaeb7ed2ecf9c8b8322f8fc4a7ae3 ]
Tracepoints are not allowed to sleep, as such the following splat is generated due to call to ib_query_pkey() in atomic context.
WARNING: CPU: 0 PID: 1888000 at kernel/trace/ring_buffer.c:2492 rb_commit+0xc1/0x220 CPU: 0 PID: 1888000 Comm: kworker/u9:0 Kdump: loaded Tainted: G OE --------- - - 4.18.0-305.3.1.el8.x86_64 #1 Hardware name: Red Hat KVM, BIOS 1.13.0-2.module_el8.3.0+555+a55c8938 04/01/2014 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] RIP: 0010:rb_commit+0xc1/0x220 RSP: 0000:ffffa8ac80f9bca0 EFLAGS: 00010202 RAX: ffff8951c7c01300 RBX: ffff8951c7c14a00 RCX: 0000000000000246 RDX: ffff8951c707c000 RSI: ffff8951c707c57c RDI: ffff8951c7c14a00 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8951c7c01300 R11: 0000000000000001 R12: 0000000000000246 R13: 0000000000000000 R14: ffffffff964c70c0 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8951fbc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f20e8f39010 CR3: 000000002ca10005 CR4: 0000000000170ef0 Call Trace: ring_buffer_unlock_commit+0x1d/0xa0 trace_buffer_unlock_commit_regs+0x3b/0x1b0 trace_event_buffer_commit+0x67/0x1d0 trace_event_raw_event_ib_mad_recv_done_handler+0x11c/0x160 [ib_core] ib_mad_recv_done+0x48b/0xc10 [ib_core] ? trace_event_raw_event_cq_poll+0x6f/0xb0 [ib_core] __ib_process_cq+0x91/0x1c0 [ib_core] ib_cq_poll_work+0x26/0x80 [ib_core] process_one_work+0x1a7/0x360 ? create_worker+0x1a0/0x1a0 worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 kthread+0x116/0x130 ? kthread_flush_work_fn+0x10/0x10 ret_from_fork+0x35/0x40 ---[ end trace 78ba8509d3830a16 ]---
--- drivers/infiniband/core/mad.c | 5 ----- include/trace/events/ib_mad.h | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-)
drivers/infiniband/core/mad.c +0 -5
@@ -59,9 +59,6 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,struct ib_mad_qp_info *qp_info, struct trace_event_raw_ib_mad_send_template *entry) { - u16 pkey; -struct ib_device *dev = qp_info->port_priv->device; -u32 pnum = qp_info->port_priv->port_num; struct ib_ud_wr *wr = &mad_send_wr->send_wr;struct rdma_ah_attr attr = {};
@@ -69,8 +66,6 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,/* These are common */ entry->sl = attr.sl; -ib_query_pkey (dev, pnum, wr->pkey_index, &pkey); - entry->pkey = pkey; entry->rqpn = wr->remote_qpn; entry->rqkey = wr->remote_qkey; entry->dlid =rdma_ah_get_dlid (&attr);
include/trace/events/ib_mad.h +4 -9
@@ -49,7 +49,6 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, __field(int, retries_left) __field(int, max_retries)__field (int, retry) -__field (u16, pkey) ), TP_fast_assign(
@@ -89,7 +88,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template,"hdr : base_ver 0x%x class 0x%x class_ver 0x%x " \"method 0x%x status 0x%x class_specific 0x%x tid 0x%llx " \"attr_id 0x%x attr_mod 0x%x => dlid 0x%08x sl %d " \ -"pkey 0x%x rpqn 0x%x rqpkey 0x%x" , +"rpqn 0x%x rqpkey 0x%x" , __entry->dev_index, __entry->port_num, __entry->qp_num, __entry->agent_priv,be64_to_cpu (__entry->wrtid), __entry->retries_left, __entry->max_retries,
@@ -100,7 +99,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template,be16_to_cpu (__entry->class_specific),be64_to_cpu (__entry->tid),be16_to_cpu (__entry->attr_id),be32_to_cpu (__entry->attr_mod), -be32_to_cpu (__entry->dlid), __entry->sl, __entry->pkey, +be32_to_cpu (__entry->dlid), __entry->sl, __entry->rqpn, __entry->rqkey ) );
@@ -204,7 +203,6 @@ TRACE_EVENT(ib_mad_recv_done_handler, __field(u16, wc_status) __field(u32, slid)__field (u32, dev_index) -__field (u16, pkey) ), TP_fast_assign(
@@ -224,9 +222,6 @@ TRACE_EVENT(ib_mad_recv_done_handler, __entry->slid = wc->slid; __entry->src_qp = wc->src_qp; __entry->sl = wc->sl; -ib_query_pkey (qp_info->port_priv->device, - qp_info->port_priv->port_num, - wc->pkey_index, &__entry->pkey); __entry->wc_status = wc->status; ),
@@ -234,7 +229,7 @@ TRACE_EVENT(ib_mad_recv_done_handler,"base_ver 0x%02x class 0x%02x class_ver 0x%02x " \"method 0x%02x status 0x%04x class_specific 0x%04x " \"tid 0x%016llx attr_id 0x%04x attr_mod 0x%08x " \ -"slid 0x%08x src QP%d, sl %d pkey 0x%04x" , +"slid 0x%08x src QP%d, sl %d" , __entry->dev_index, __entry->port_num, __entry->qp_num, __entry->wc_status, __entry->length,
@@ -244,7 +239,7 @@ TRACE_EVENT(ib_mad_recv_done_handler,be16_to_cpu (__entry->class_specific),be64_to_cpu (__entry->tid),be16_to_cpu (__entry->attr_id),be32_to_cpu (__entry->attr_mod), - __entry->slid, __entry->src_qp, __entry->sl, __entry->pkey + __entry->slid, __entry->src_qp, __entry->sl ) );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 605/1146 PCI: vmd: Disable MSI remapping after suspend
In reply to Greg Kroah-HartmanFrom: Nirmal Patel <[email protected]>
[ Upstream commit d899aa668498c07ff217b666ae9712990306e682 ]
MSI remapping is disabled by VMD driver for Intel's Icelake and newer systems in order to improve performance by setting VMCONFIG_MSI_REMAP. By design VMCONFIG_MSI_REMAP register is cleared by firmware during boot. The same register gets cleared when system is put in S3 power state. VMD driver needs to set this register again in order to avoid interrupt issues with devices behind VMD if MSI remapping was disabled before.
--- drivers/pci/controller/vmd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/controller/vmd.c +5 -0
@@ -980,6 +980,11 @@ static int vmd_resume(struct device *dev)struct vmd_dev *vmd =pci_get_drvdata (pdev);int err, i; +if (vmd->irq_domain) +vmd_set_msi_remapping (vmd, true); +else +vmd_set_msi_remapping (vmd, false); +for (i =0 ; i < vmd->msix_count; i++) { err = devm_request_irq(dev, vmd->irqs[i].virq, vmd_irq, IRQF_NO_THREAD,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 606/1146 PCI: imx6: Initialize PHY before deasserting core reset
In reply to Greg Kroah-HartmanFrom: Sascha Hauer <[email protected]>
[ Upstream commit ae6b9a65af480144da323436d90e149501ea8937 ]
When the PHY is the reference clock provider then it must be initialized and powered on before the reset on the client is deasserted, otherwise the link will never come up. The order was changed in cf236e0c0d59. Restore the correct order to make the driver work again on boards where the PHY provides the reference clock. This also changes the order for boards where the Soc is the PHY reference clock divider, but this shouldn't do any harm.
--- drivers/pci/controller/dwc/pci-imx6.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +7 -6
@@ -952,12 +952,6 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } } - ret =imx6_pcie_deassert_core_reset (imx6_pcie); -if (ret <0 ) { -dev_err (dev,"pcie deassert core reset failed: %d\n" , ret); - goto err_phy_off; - } -if (imx6_pcie->phy) { ret =phy_power_on (imx6_pcie->phy);if (ret) {
@@ -965,6 +959,13 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) goto err_phy_off; } } + + ret =imx6_pcie_deassert_core_reset (imx6_pcie); +if (ret <0 ) { +dev_err (dev,"pcie deassert core reset failed: %d\n" , ret); + goto err_phy_off; + } +imx6_setup_phy_mpll (imx6_pcie);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 607/1146 f2fs: fix to avoid accessing uninitialized spinlock
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit cc249e4cba9a6002c9d9e1438daf8440a160bc9e ]
syzbot reports a kernel bug:
__dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 assign_lock_key+0x22a/0x240 kernel/locking/lockdep.c:981 register_lock_class+0x287/0x9b0 kernel/locking/lockdep.c:1294 __lock_acquire+0xe4/0x1f60 kernel/locking/lockdep.c:4934 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] f2fs_save_errors fs/f2fs/super.c:3868 [inline] f2fs_handle_error+0x29/0x230 fs/f2fs/super.c:3896 f2fs_iget+0x215/0x4bb0 fs/f2fs/inode.c:516 f2fs_fill_super+0x47d3/0x7b50 fs/f2fs/super.c:4222 mount_bdev+0x26c/0x3a0 fs/super.c:1401 legacy_get_tree+0xea/0x180 fs/fs_context.c:610 vfs_get_tree+0x88/0x270 fs/super.c:1531 do_new_mount+0x289/0xad0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
F2FS-fs (loop1): Failed to read F2FS meta data inode
The root cause is if sbi->error_lock may be accessed before its initialization, fix it.
--- fs/f2fs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/super.c +3 -3
@@ -4188,6 +4188,9 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)if (err) goto free_bio_info; +spin_lock_init (&sbi->error_lock); +memcpy (sbi->errors, raw_super->s_errors,MAX_F2FS_ERRORS ); +init_f2fs_rwsem (&sbi->cp_rwsem);init_f2fs_rwsem (&sbi->quota_sem);init_waitqueue_head (&sbi->cp_wait);
@@ -4255,9 +4258,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_devices; } -spin_lock_init (&sbi->error_lock); -memcpy (sbi->errors, raw_super->s_errors,MAX_F2FS_ERRORS ); - sbi->total_valid_node_count =le32_to_cpu (sbi->ckpt->valid_node_count); percpu_counter_set(&sbi->total_valid_inode_count,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 608/1146 RDMA/restrack: Release MR restrack when delete
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit dac153f2802db1ad46207283cb9b2aae3d707a45 ]
The MR restrack also needs to be released when delete it, otherwise it cause memory leak as the task struct won't be released.
--- drivers/infiniband/core/restrack.c | 2 -- 1 file changed, 2 deletions(-)
drivers/infiniband/core/restrack.c +0 -2
@@ -343,8 +343,6 @@ void rdma_restrack_del(struct rdma_restrack_entry *res) rt = &dev->res[res->type]; old =xa_erase (&rt->xa, res->id); -if (res->type ==RDMA_RESTRACK_MR ) -return ;WARN_ON (old != res); out:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/1146 RDMA/core: Make sure "ib_port" is valid when access sysfs node
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit 5e15ff29b156bbbdeadae230c8ecd5ecd8ca2477 ]
The "ib_port" structure must be set before adding the sysfs kobject, and reset after removing it, otherwise it may crash when accessing the sysfs node:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050
Mem abort info:
ESR = 0x96000006
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e85f5ba5
[0000000000000050] pgd=0000000848fd9003, pud=000000085b387003, pmd=0000000000000000
Internal error: Oops: 96000006 [#2] PREEMPT SMP
Modules linked in: ib_umad(O) mlx5_ib(O) nfnetlink_cttimeout(E) nfnetlink(E) act_gact(E) cls_flower(E) sch_ingress(E) openvswitch(E) nsh(E) nf_nat_ipv6(E) nf_nat_ipv4(E) nf_conncount(E) nf_nat(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) mst_pciconf(O) ipmi_devintf(E) ipmi_msghandler(E) ipmb_dev_int(OE) mlx5_core(O) mlxfw(O) mlxdevm(O) auxiliary(O) ib_uverbs(O) ib_core(O) mlx_compat(O) psample(E) sbsa_gwdt(E) uio_pdrv_genirq(E) uio(E) mlxbf_pmc(OE) mlxbf_gige(OE) mlxbf_tmfifo(OE) gpio_mlxbf2(OE) pwr_mlxbf(OE) mlx_trio(OE) i2c_mlxbf(OE) mlx_bootctl(OE) bluefield_edac(OE) knem(O) ip_tables(E) ipv6(E) crc_ccitt(E) [last unloaded: mst_pci]
Process grep (pid: 3372, stack limit = 0x0000000022055c92)
CPU: 5 PID: 3372 Comm: grep Tainted: G D OE 4.19.161-mlnx.47.gadcd9e3 #1
Hardware name: https://www.mellanox.com BlueField SoC/BlueField SoC, BIOS BlueField:3.9.2-15-ga2403ab Sep 8 2022
pstate: 40000005 (nZcv daif -PAN -UAO)
pc : hw_stat_port_show+0x4c/0x80 [ib_core]
lr : port_attr_show+0x40/0x58 [ib_core]
sp : ffff000029f43b50
x29: ffff000029f43b50 x28: 0000000019375000
x27: ffff8007b821a540 x26: ffff000029f43e30
x25: 0000000000008000 x24: ffff000000eaa958
x23: 0000000000001000 x22: ffff8007a4ce3000
x21: ffff8007baff8000 x20: ffff8007b9066ac0
x19: ffff8007bae97578 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000
x9 : 0000000000000000 x8 : ffff8007a4ce4000
x7 : 0000000000000000 x6 : 000000000000003f
x5 : ffff000000e6a280 x4 : ffff8007a4ce3000
x3 : 0000000000000000 x2 : aaaaaaaaaaaaaaab
x1 : ffff8007b9066a10 x0 : ffff8007baff8000
Call trace:
hw_stat_port_show+0x4c/0x80 [ib_core]
port_attr_show+0x40/0x58 [ib_core]
sysfs_kf_seq_show+0x8c/0x150
kernfs_seq_show+0x44/0x50
seq_read+0x1b4/0x45c
kernfs_fop_read+0x148/0x1d8
__vfs_read+0x58/0x180
vfs_read+0x94/0x154
ksys_read+0x68/0xd8
__arm64_sys_read+0x28/0x34
el0_svc_common+0x88/0x18c
el0_svc_handler+0x78/0x94
el0_svc+0x8/0xe8
Code: f2955562 aa1603e4 aa1503e0 f9405683 (f9402861)--- drivers/infiniband/core/sysfs.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/infiniband/core/sysfs.c +11 -6
@@ -1213,6 +1213,9 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num, p->port_num = port_num;kobject_init (&p->kobj, &port_type); +if (device->port_data && is_full_dev) + device->port_data[port_num].sysfs = p; + cur_group = p->groups_list; ret =alloc_port_table_group ("gids" , &p->groups[0 ], p->attrs_list, attr->gid_tbl_len, show_port_gid);
@@ -1258,9 +1261,6 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num, }list_add_tail (&p->kobj.entry, &coredev->port_list); -if (device->port_data && is_full_dev) - device->port_data[port_num].sysfs = p; -return p; err_groups:
@@ -1268,6 +1268,8 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num, err_del:kobject_del (&p->kobj); err_put: +if (device->port_data && is_full_dev) + device->port_data[port_num].sysfs =NULL ;kobject_put (&p->kobj);return ERR_PTR (ret); }
@@ -1276,14 +1278,17 @@ static void destroy_port(struct ib_core_device *coredev, struct ib_port *port) {bool is_full_dev = &port->ibdev->coredev == coredev; -if (port->ibdev->port_data && - port->ibdev->port_data[port->port_num].sysfs == port) - port->ibdev->port_data[port->port_num].sysfs =NULL ;list_del (&port->kobj.entry);if (is_full_dev)sysfs_remove_groups (&port->kobj, port->ibdev->ops.port_groups); +sysfs_remove_groups (&port->kobj, port->groups_list);kobject_del (&port->kobj); + +if (port->ibdev->port_data && + port->ibdev->port_data[port->port_num].sysfs == port) + port->ibdev->port_data[port->port_num].sysfs =NULL ; +kobject_put (&port->kobj); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 610/1146 RDMA/nldev: Return "-EAGAIN" if the cm_id isnt from expected port
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit ecacb3751f254572af0009b9501e2cdc83a30b6a ]
When filling a cm_id entry, return "-EAGAIN" instead of 0 if the cm_id doesn'the have the same port as requested, otherwise an incomplete entry may be returned, which causes "rdam res show cm_id" to return an error.
For example on a machine with two rdma devices with "rping -C 1 -v -s" running background, the "rdma" command fails:
$ rdma -V rdma utility, iproute2-5.19.0 $ rdma res show cm_id link mlx5_0/- cm-idn 0 state LISTEN ps TCP pid 28056 comm rping src-addr 0.0.0.0:7174 error: Protocol not available
While with this fix it succeeds:
$ rdma res show cm_id link mlx5_0/- cm-idn 0 state LISTEN ps TCP pid 26395 comm rping src-addr 0.0.0.0:7174 link mlx5_1/- cm-idn 0 state LISTEN ps TCP pid 26395 comm rping src-addr 0.0.0.0:7174
--- drivers/infiniband/core/nldev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -1
@@ -552,7 +552,7 @@ static int fill_res_cm_id_entry(struct sk_buff *msg, bool has_cap_net_admin,struct rdma_cm_id *cm_id = &id_priv->id;if (port && port != cm_id->port_num) -return 0 ; +return -EAGAIN ;if (cm_id->port_num &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_PORT_INDEX , cm_id->port_num))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 611/1146 RDMA/siw: Set defined status for work completion with undefined status
In reply to Greg Kroah-HartmanFrom: Bernard Metzler <[email protected]>
[ Upstream commit 60da2d11fcbc043304910e4d2ca82f9bab953e63 ]
A malicious user may write undefined values into memory mapped completion queue elements status or opcode. Undefined status or opcode values will result in out-of-bounds access to an array mapping siw internal representation of opcode and status to RDMA core representation when reaping CQ elements. While siw detects those undefined values, it did not correctly set completion status to a defined value, thus defeating the whole purpose of the check.
This bug leads to the following Smatch static checker warning:
drivers/infiniband/sw/siw/siw_cq.c:96 siw_reap_cqe()
error: buffer overflow 'map_cqe_status' 10 <= 21
--- drivers/infiniband/sw/siw/siw_cq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/siw/siw_cq.c +2 -2
@@ -88,9 +88,9 @@ int siw_reap_cqe(struct siw_cq *cq, struct ib_wc *wc)if (opcode >=SIW_NUM_OPCODES ) { opcode =0 ; - status =IB_WC_GENERAL_ERR ; + status =SIW_WC_GENERAL_ERR ; }else if (status >=SIW_NUM_WC_STATUS ) { - status =IB_WC_GENERAL_ERR ; + status =SIW_WC_GENERAL_ERR ; } wc->opcode = map_wc_opcode[opcode]; wc->status = map_cqe_status[status].ib;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 612/1146 RDMA/irdma: Fix inline for multiple SGEs
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 4f44e519b6a945068755708119cca5b74d01d1f6 ]
Currently, inline send and inline write assume a single SGE and only copy data from the first one. Add support for multiple SGE's.
--- drivers/infiniband/hw/irdma/uk.c | 149 ++++++++++++++++++---------- drivers/infiniband/hw/irdma/user.h | 19 +--- drivers/infiniband/hw/irdma/verbs.c | 55 ++++------ 3 files changed, 119 insertions(+), 104 deletions(-)
drivers/infiniband/hw/irdma/uk.c +98 -51
@@ -566,21 +566,37 @@ static void irdma_set_mw_bind_wqe_gen_1(__le64 *wqe,/** * irdma_copy_inline_data_gen_1 - Copy inline data to wqe -* @dest: pointer to wqe -* @src: pointer to inline data -* @len: length of inline data to copy +* @wqe: pointer to wqe +* @sge_list: table of pointers to inline data +* @num_sges: Total inline data length * @polarity: compatibility parameter */ -static void irdma_copy_inline_data_gen_1 (u8 *dest,u8 *src,u32 len, -u8 polarity) +static void irdma_copy_inline_data_gen_1 (u8 *wqe,struct ib_sge *sge_list, +u32 num_sges,u8 polarity) { -if (len <=16 ) { -memcpy (dest, src, len); - }else { -memcpy (dest, src,16 ); - src +=16 ; - dest = dest +32 ; -memcpy (dest, src, len -16 ); +u32 quanta_bytes_remaining =16 ; +int i; + +for (i =0 ; i < num_sges; i++) { +u8 *cur_sge = (u8 *)(uintptr_t )sge_list[i].addr; +u32 sge_len = sge_list[i].length; + +while (sge_len) { +u32 bytes_copied; + + bytes_copied =min (sge_len, quanta_bytes_remaining); +memcpy (wqe, cur_sge, bytes_copied); + wqe += bytes_copied; + cur_sge += bytes_copied; + quanta_bytes_remaining -= bytes_copied; + sge_len -= bytes_copied; + +if (!quanta_bytes_remaining) { +/* Remaining inline bytes reside after hdr */ + wqe +=16 ; + quanta_bytes_remaining =32 ; + } + } } }
@@ -612,35 +628,51 @@ static void irdma_set_mw_bind_wqe(__le64 *wqe,/** * irdma_copy_inline_data - Copy inline data to wqe -* @dest: pointer to wqe -* @src: pointer to inline data -* @len: length of inline data to copy +* @wqe: pointer to wqe +* @sge_list: table of pointers to inline data +* @num_sges: number of SGE's * @polarity: polarity of wqe valid bit */ -static void irdma_copy_inline_data (u8 *dest,u8 *src,u32 len,u8 polarity) +static void irdma_copy_inline_data (u8 *wqe,struct ib_sge *sge_list, +u32 num_sges,u8 polarity) {u8 inline_valid = polarity <<IRDMA_INLINE_VALID_S ; -u32 copy_size; - - dest +=8 ; -if (len <=8 ) { -memcpy (dest, src, len); -return ; - } - - *((u64 *)dest) = *((u64 *)src); - len -=8 ; - src +=8 ; - dest +=24 ;/* point to additional 32 byte quanta */ - -while (len) { - copy_size = len <31 ? len :31 ; -memcpy (dest, src, copy_size); - *(dest +31 ) = inline_valid; - len -= copy_size; - dest +=32 ; - src += copy_size; +u32 quanta_bytes_remaining =8 ; +bool first_quanta = true; +int i; + + wqe +=8 ; + +for (i =0 ; i < num_sges; i++) { +u8 *cur_sge = (u8 *)(uintptr_t )sge_list[i].addr; +u32 sge_len = sge_list[i].length; + +while (sge_len) { +u32 bytes_copied; + + bytes_copied =min (sge_len, quanta_bytes_remaining); +memcpy (wqe, cur_sge, bytes_copied); + wqe += bytes_copied; + cur_sge += bytes_copied; + quanta_bytes_remaining -= bytes_copied; + sge_len -= bytes_copied; + +if (!quanta_bytes_remaining) { + quanta_bytes_remaining =31 ; + +/* Remaining inline bytes reside after hdr */ +if (first_quanta) { + first_quanta = false; + wqe +=16 ; + }else { + *wqe = inline_valid; + wqe++; + } + } + } } +if (!first_quanta && quanta_bytes_remaining <31 ) + *(wqe + quanta_bytes_remaining) = inline_valid; }/**
@@ -679,20 +711,27 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info, bool post_sq) {__le64 *wqe; -struct irdma_inline_rdma_write *op_info; +struct irdma_rdma_write *op_info;u64 hdr =0 ;u32 wqe_idx;bool read_fence = false; +u32 i, total_size =0 ;u16 quanta; info->push_wqe = qp->push_db ? true : false; - op_info = &info->op.inline_rdma_write; + op_info = &info->op.rdma_write; + +if (unlikely (qp->max_sq_frag_cnt < op_info->num_lo_sges)) +return -EINVAL ; -if (op_info->len > qp->max_inline_data) +for (i =0 ; i < op_info->num_lo_sges; i++) + total_size += op_info->lo_sg_list[i].length; + +if (unlikely (total_size > qp->max_inline_data))return -EINVAL ; - quanta = qp->wqe_ops.iw_inline_data_size_to_quanta (op_info->len); - wqe =irdma_qp_get_next_send_wqe (qp, &wqe_idx, quanta, op_info->len, + quanta = qp->wqe_ops.iw_inline_data_size_to_quanta (total_size); + wqe =irdma_qp_get_next_send_wqe (qp, &wqe_idx, quanta, total_size, info);if (!wqe)return -ENOMEM ;
@@ -705,7 +744,7 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp, hdr =FIELD_PREP (IRDMAQPSQ_REMSTAG , op_info->rem_addr.lkey) |FIELD_PREP (IRDMAQPSQ_OPCODE , info->op_type) | -FIELD_PREP (IRDMAQPSQ_INLINEDATALEN , op_info->len) | +FIELD_PREP (IRDMAQPSQ_INLINEDATALEN , total_size) |FIELD_PREP (IRDMAQPSQ_REPORTRTT , info->report_rtt ?1 :0 ) |FIELD_PREP (IRDMAQPSQ_INLINEDATAFLAG ,1 ) | FIELD_PREP(IRDMAQPSQ_IMMDATAFLAG, info->imm_data_valid ? 1 : 0) |
@@ -719,7 +758,8 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp,set_64bit_val (wqe,0 ,FIELD_PREP (IRDMAQPSQ_IMMDATA , info->imm_data)); - qp->wqe_ops.iw_copy_inline_data ((u8 *)wqe, op_info->data, op_info->len, + qp->wqe_ops.iw_copy_inline_data ((u8 *)wqe, op_info->lo_sg_list, + op_info->num_lo_sges, qp->swqe_polarity);dma_wmb ();/* make sure WQE is populated before valid bit is set */
@@ -745,20 +785,27 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info, bool post_sq) {__le64 *wqe; -struct irdma_post_inline_send *op_info; +struct irdma_post_send *op_info;u64 hdr;u32 wqe_idx;bool read_fence = false; +u32 i, total_size =0 ;u16 quanta; info->push_wqe = qp->push_db ? true : false; - op_info = &info->op.inline_send; + op_info = &info->op.send; -if (op_info->len > qp->max_inline_data) +if (unlikely (qp->max_sq_frag_cnt < op_info->num_sges))return -EINVAL ; - quanta = qp->wqe_ops.iw_inline_data_size_to_quanta (op_info->len); - wqe =irdma_qp_get_next_send_wqe (qp, &wqe_idx, quanta, op_info->len, +for (i =0 ; i < op_info->num_sges; i++) + total_size += op_info->sg_list[i].length; + +if (unlikely (total_size > qp->max_inline_data)) +return -EINVAL ; + + quanta = qp->wqe_ops.iw_inline_data_size_to_quanta (total_size); + wqe =irdma_qp_get_next_send_wqe (qp, &wqe_idx, quanta, total_size, info);if (!wqe)return -ENOMEM ;
@@ -773,7 +820,7 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp, hdr =FIELD_PREP (IRDMAQPSQ_REMSTAG , info->stag_to_inv) |FIELD_PREP (IRDMAQPSQ_AHID , op_info->ah_id) |FIELD_PREP (IRDMAQPSQ_OPCODE , info->op_type) | -FIELD_PREP (IRDMAQPSQ_INLINEDATALEN , op_info->len) | +FIELD_PREP (IRDMAQPSQ_INLINEDATALEN , total_size) |FIELD_PREP (IRDMAQPSQ_IMMDATAFLAG , (info->imm_data_valid ?1 :0 )) | FIELD_PREP(IRDMAQPSQ_REPORTRTT, (info->report_rtt ? 1 : 0)) |
@@ -789,8 +836,8 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp,if (info->imm_data_valid)set_64bit_val (wqe,0 ,FIELD_PREP (IRDMAQPSQ_IMMDATA , info->imm_data)); - qp->wqe_ops.iw_copy_inline_data ((u8 *)wqe, op_info->data, op_info->len, - qp->swqe_polarity); + qp->wqe_ops.iw_copy_inline_data ((u8 *)wqe, op_info->sg_list, + op_info->num_sges, qp->swqe_polarity);dma_wmb ();/* make sure WQE is populated before valid bit is set */
drivers/infiniband/hw/irdma/user.h +2 -17
@@ -173,14 +173,6 @@ struct irdma_post_send {u32 ah_id; }; -struct irdma_post_inline_send { -void *data; -u32 len; -u32 qkey; -u32 dest_qp; -u32 ah_id; -}; -struct irdma_post_rq_info {u64 wr_id;struct ib_sge *sg_list;
@@ -193,12 +185,6 @@ struct irdma_rdma_write {struct ib_sge rem_addr; }; -struct irdma_inline_rdma_write { -void *data; -u32 len; -struct ib_sge rem_addr; -}; -struct irdma_rdma_read {struct ib_sge *lo_sg_list;u32 num_lo_sges;
@@ -241,8 +227,6 @@ struct irdma_post_sq_info {struct irdma_rdma_read rdma_read;struct irdma_bind_window bind_window;struct irdma_inv_local_stag inv_local_stag; -struct irdma_inline_rdma_write inline_rdma_write; -struct irdma_post_inline_send inline_send; } op; };
@@ -291,7 +275,8 @@ int irdma_uk_stag_local_invalidate(struct irdma_qp_uk *qp, bool post_sq);struct irdma_wqe_uk_ops { -void (*iw_copy_inline_data)(u8 *dest,u8 *src,u32 len,u8 polarity); +void (*iw_copy_inline_data)(u8 *dest,struct ib_sge *sge_list, +u32 num_sges,u8 polarity);u16 (*iw_inline_data_size_to_quanta)(u32 data_size);void (*iw_set_fragment)(__le64 *wqe,u32 offset,struct ib_sge *sge,u8 valid);
drivers/infiniband/hw/irdma/verbs.c +19 -36
71 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 613/1146 RDMA/irdma: Fix RQ completion opcode
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 24419777e9431137d5923a747f546facb1e49b1f ]
The opcode written by HW, in the RQ CQE, is the RoCEv2/iWARP protocol opcode from the received packet and not the SW opcode as currently assumed. Fix this by returning the raw operation type and queue type in the CQE to irdma_process_cqe and add 2 helpers set_ib_wc_op_sq set_ib_wc_op_rq to map IRDMA HW op types to IB op types.
Note that for iWARP, only Write with Immediate is supported so the opcode can only be IB_WC_RECV_RDMA_WITH_IMM when there is immediate data present.
--- drivers/infiniband/hw/irdma/uk.c | 21 +++++------- drivers/infiniband/hw/irdma/user.h | 1 + drivers/infiniband/hw/irdma/utils.c | 2 ++ drivers/infiniband/hw/irdma/verbs.c | 39 ++++----------------- drivers/infiniband/hw/irdma/verbs.h | 53 +++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 45 deletions(-)
drivers/infiniband/hw/irdma/uk.c +9 -12
@@ -1049,11 +1049,10 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq,__le64 *cqe;struct irdma_qp_uk *qp;struct irdma_ring *pring =NULL ; -u32 wqe_idx, q_type; +u32 wqe_idx;int ret_code;bool move_cq_head = true;u8 polarity; -u8 op_type;bool ext_valid;__le64 *ext_cqe;
@@ -1121,7 +1120,7 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq, info->ud_vlan_valid = false; } - q_type = (u8 )FIELD_GET (IRDMA_CQ_SQ , qword3); + info->q_type = (u8 )FIELD_GET (IRDMA_CQ_SQ , qword3); info->error = (bool )FIELD_GET (IRDMA_CQ_ERROR , qword3); info->push_dropped = (bool )FIELD_GET (IRDMACQ_PSHDROP , qword3); info->ipv4 = (bool )FIELD_GET (IRDMACQ_IPV4 , qword3);
@@ -1160,8 +1159,9 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq, } wqe_idx = (u32 )FIELD_GET (IRDMA_CQ_WQEIDX , qword3); info->qp_handle = (irdma_qp_handle )(unsigned long )qp; + info->op_type = (u8 )FIELD_GET (IRDMA_CQ_SQ , qword3); -if (q_type ==IRDMA_CQE_QTYPE_RQ ) { +if (info->q_type ==IRDMA_CQE_QTYPE_RQ ) {u32 array_idx; array_idx = wqe_idx / qp->rq_wqe_size_multiplier;
@@ -1181,10 +1181,6 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq, info->bytes_xfered = (u32 )FIELD_GET (IRDMACQ_PAYLDLEN , qword0); -if (info->imm_valid) - info->op_type =IRDMA_OP_TYPE_REC_IMM ; -else - info->op_type =IRDMA_OP_TYPE_REC ;if (qword3 &IRDMACQ_STAG ) { info->stag_invalid_set = true; info->inv_stag = (u32 )FIELD_GET (IRDMACQ_INVSTAG , qword2);
@@ -1242,17 +1238,18 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq, sw_wqe = qp->sq_base[tail].elem;get_64bit_val (sw_wqe,24 , &wqe_qword); - op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE , wqe_qword); - info->op_type = op_type; + info->op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE , + wqe_qword);IRDMA_RING_SET_TAIL (qp->sq_ring, tail + qp->sq_wrtrk_array[tail].quanta); -if (op_type !=IRDMAQP_OP_NOP ) { +if (info->op_type !=IRDMAQP_OP_NOP ) { info->wr_id = qp->sq_wrtrk_array[tail].wrid; info->bytes_xfered = qp->sq_wrtrk_array[tail].wr_len;break ; } }while (1 ); -if (op_type ==IRDMA_OP_TYPE_BIND_MW && info->minor_err ==FLUSH_PROT_ERR ) +if (info->op_type ==IRDMA_OP_TYPE_BIND_MW && + info->minor_err ==FLUSH_PROT_ERR ) info->minor_err =FLUSH_MW_BIND_ERR ; qp->sq_flush_seen = true;if (!IRDMA_RING_MORE_WORK (qp->sq_ring))
drivers/infiniband/hw/irdma/user.h +1 -0
@@ -245,6 +245,7 @@ struct irdma_cq_poll_info {u16 ud_vlan;u8 ud_smac[6 ];u8 op_type; +u8 q_type; bool stag_invalid_set:1; /* or L_R_Key set */ bool push_dropped:1; bool error:1;
drivers/infiniband/hw/irdma/utils.c +2 -0
@@ -2591,6 +2591,7 @@ void irdma_generate_flush_completions(struct irdma_qp *iwqp) sw_wqe = qp->sq_base[wqe_idx].elem;get_64bit_val (sw_wqe,24 , &wqe_qword); cmpl->cpi.op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE ,IRDMAQPSQ_OPCODE ); + cmpl->cpi.q_type =IRDMA_CQE_QTYPE_SQ ;/* remove the SQ WR by moving SQ tail*/ IRDMA_RING_SET_TAIL (*sq_ring, sq_ring->tail + qp->sq_wrtrk_array[sq_ring->tail].quanta);
@@ -2629,6 +2630,7 @@ void irdma_generate_flush_completions(struct irdma_qp *iwqp) cmpl->cpi.wr_id = qp->rq_wrid_array[wqe_idx]; cmpl->cpi.op_type =IRDMA_OP_TYPE_REC ; + cmpl->cpi.q_type =IRDMA_CQE_QTYPE_RQ ;/* remove the RQ WR by moving RQ tail */ IRDMA_RING_SET_TAIL (*rq_ring, rq_ring->tail +1 ); ibdev_dbg(iwqp->iwrcq->ibcq.device,
drivers/infiniband/hw/irdma/verbs.c +6 -33
@@ -3334,7 +3334,6 @@ static enum ib_wc_status irdma_flush_err_to_ib_wc_status(enum irdma_flush_opcodestatic void irdma_process_cqe (struct ib_wc *entry,struct irdma_cq_poll_info *cq_poll_info) { -struct irdma_qp *iwqp;struct irdma_sc_qp *qp; entry->wc_flags =0 ;
@@ -3342,7 +3341,6 @@ static void irdma_process_cqe(struct ib_wc *entry, entry->wr_id = cq_poll_info->wr_id; qp = cq_poll_info->qp_handle; - iwqp = qp->qp_uk.back_qp; entry->qp = qp->qp_uk.back_qp;if (cq_poll_info->error) {
@@ -3375,42 +3373,17 @@ static void irdma_process_cqe(struct ib_wc *entry, } } -switch (cq_poll_info->op_type) { -case IRDMA_OP_TYPE_RDMA_WRITE : -case IRDMA_OP_TYPE_RDMA_WRITE_SOL : - entry->opcode =IB_WC_RDMA_WRITE ; -break ; -case IRDMA_OP_TYPE_RDMA_READ_INV_STAG : -case IRDMA_OP_TYPE_RDMA_READ : - entry->opcode =IB_WC_RDMA_READ ; -break ; -case IRDMA_OP_TYPE_SEND_INV : -case IRDMA_OP_TYPE_SEND_SOL : -case IRDMA_OP_TYPE_SEND_SOL_INV : -case IRDMA_OP_TYPE_SEND : - entry->opcode =IB_WC_SEND ; -break ; -case IRDMA_OP_TYPE_FAST_REG_NSMR : - entry->opcode =IB_WC_REG_MR ; -break ; -case IRDMA_OP_TYPE_INV_STAG : - entry->opcode =IB_WC_LOCAL_INV ; -break ; -case IRDMA_OP_TYPE_REC_IMM : -case IRDMA_OP_TYPE_REC : - entry->opcode = cq_poll_info->op_type ==IRDMA_OP_TYPE_REC_IMM ? -IB_WC_RECV_RDMA_WITH_IMM :IB_WC_RECV ; +if (cq_poll_info->q_type ==IRDMA_CQE_QTYPE_SQ ) { +set_ib_wc_op_sq (cq_poll_info, entry); + }else { +set_ib_wc_op_rq (cq_poll_info, entry, + qp->qp_uk.qp_caps &IRDMA_SEND_WITH_IMM ? + true : false);if (qp->qp_uk.qp_type !=IRDMA_QP_TYPE_ROCE_UD && cq_poll_info->stag_invalid_set) { entry->ex.invalidate_rkey = cq_poll_info->inv_stag; entry->wc_flags |=IB_WC_WITH_INVALIDATE ; } -break ; -default : -ibdev_err (&iwqp->iwdev->ibdev, -"Invalid opcode = %d in CQE\n" , cq_poll_info->op_type); - entry->status =IB_WC_GENERAL_ERR ; -return ; }if (qp->qp_uk.qp_type ==IRDMA_QP_TYPE_ROCE_UD ) {
drivers/infiniband/hw/irdma/verbs.h +53 -0
59 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 614/1146 RDMA/irdma: Do not request 2-level PBLEs for CQ alloc
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 8f7e2daa6336f9f4b6f8a4715a809674606df16b ]
When allocating PBLE's for a large CQ, it is possible that a 2-level PBLE is returned which would cause the CQ allocation to fail since 1-level is assumed and checked for. Fix this by requesting a level one PBLE only.
--- drivers/infiniband/hw/irdma/verbs.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +5 -10
@@ -2329,9 +2329,10 @@ static bool irdma_check_mr_contiguous(struct irdma_pble_alloc *palloc,* @rf: RDMA PCI function * @iwmr: mr pointer for this memory registration * @use_pbles: flag if to use pble's +* @lvl_1_only: request only level 1 pble if true */ static int irdma_setup_pbles (struct irdma_pci_f *rf,struct irdma_mr *iwmr, -bool use_pbles) +bool use_pbles,bool lvl_1_only) {struct irdma_pbl *iwpbl = &iwmr->iwpbl;struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc;
@@ -2342,7 +2343,7 @@ static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr,if (use_pbles) { status =irdma_get_pble (rf->pble_rsrc, palloc, iwmr->page_cnt, - false); + lvl_1_only);if (status)return status;
@@ -2385,16 +2386,10 @@ static int irdma_handle_q_mem(struct irdma_device *iwdev,bool ret = true; pg_size = iwmr->page_size; - err =irdma_setup_pbles (iwdev->rf, iwmr, use_pbles); + err =irdma_setup_pbles (iwdev->rf, iwmr, use_pbles, true);if (err)return err; -if (use_pbles && palloc->level !=PBLE_LEVEL_1 ) { -irdma_free_pble (iwdev->rf->pble_rsrc, palloc); - iwpbl->pbl_allocated = false; -return -ENOMEM ; - } -if (use_pbles) arr = palloc->level1.addr;
@@ -2870,7 +2865,7 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,case IRDMA_MEMREG_TYPE_MEM : use_pbles = (iwmr->page_cnt !=1 ); - err =irdma_setup_pbles (iwdev->rf, iwmr, use_pbles); + err =irdma_setup_pbles (iwdev->rf, iwmr, use_pbles, false);if (err) goto error;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 615/1146 scsi: scsi_debug: Fix a warning in resp_write_scat()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit 216e179724c1d9f57a8ababf8bd7aaabef67f01b ]
As 'lbdof_blen' is coming from user, if the size in kzalloc() is >= MAX_ORDER then we hit a warning.
Call trace:
sg_ioctl
sg_ioctl_common
scsi_ioctl
sg_scsi_ioctl
blk_execute_rq
blk_mq_sched_insert_request
blk_mq_run_hw_queue
__blk_mq_delay_run_hw_queue
__blk_mq_run_hw_queue
blk_mq_sched_dispatch_requests
__blk_mq_sched_dispatch_requests
blk_mq_dispatch_rq_list
scsi_queue_rq
scsi_dispatch_cmd
scsi_debug_queuecommand
schedule_resp
resp_write_scatIf you try to allocate a memory larger than(>=) MAX_ORDER, then kmalloc() will definitely fail. It creates a stack trace and messes up dmesg. The user controls the size here so if they specify a too large size it will fail.
Add __GFP_NOWARN in order to avoid too large allocation warning. This is detected by static analysis using smatch.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -3785,7 +3785,7 @@ static int resp_write_scat(struct scsi_cmnd *scp,mk_sense_buffer (scp,ILLEGAL_REQUEST ,INVALID_FIELD_IN_CDB ,0 );return illegal_condition_result; } - lrdp =kzalloc (lbdof_blen,GFP_ATOMIC ); + lrdp =kzalloc (lbdof_blen,GFP_ATOMIC | __GFP_NOWARN);if (lrdp ==NULL )return SCSI_MLQUEUE_HOST_BUSY ;if (sdebug_verbose)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/1146 crypto: ccree - Remove debugfs when platform_driver_register failed
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 4f1c596df706c9aca662b6c214fad84047ae2a97 ]
When platform_driver_register failed, we need to remove debugfs, which will caused a resource leak, fix it.
Failed logs as follows:
[ 32.606488] debugfs: Directory 'ccree' with parent '/' already present!
--- drivers/crypto/ccree/cc_driver.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/crypto/ccree/cc_driver.c +9 -1
@@ -651,9 +651,17 @@ static struct platform_driver ccree_driver = {static int __init ccree_init (void ) { +int rc; +cc_debugfs_global_init (); -return platform_driver_register (&ccree_driver); + rc =platform_driver_register (&ccree_driver); +if (rc) { +cc_debugfs_global_fini (); +return rc; + } + +return 0 ; }module_init (ccree_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 617/1146 crypto: cryptd - Use request context instead of stack for sub-request
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 3a58c231172537f7b0e19d93ed33decd04f80eab ]
cryptd is buggy as it tries to use sync_skcipher without going through the proper sync_skcipher interface. In fact it doesn't even need sync_skcipher since it's already a proper skcipher and can easily access the request context instead of using something off the stack.
--- crypto/cryptd.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
crypto/cryptd.c +19 -17
@@ -68,11 +68,12 @@ struct aead_instance_ctx {struct cryptd_skcipher_ctx {refcount_t refcnt; -struct crypto_sync_skcipher *child; +struct crypto_skcipher *child; };struct cryptd_skcipher_request_ctx {crypto_completion_t complete; +struct skcipher_request req; };struct cryptd_hash_ctx {
@@ -227,13 +228,13 @@ static int cryptd_skcipher_setkey(struct crypto_skcipher *parent, const u8 *key, unsigned int keylen) {struct cryptd_skcipher_ctx *ctx =crypto_skcipher_ctx (parent); -struct crypto_sync_skcipher *child = ctx->child; +struct crypto_skcipher *child = ctx->child; -crypto_sync_skcipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); -crypto_sync_skcipher_set_flags (child, -crypto_skcipher_get_flags (parent) & -CRYPTO_TFM_REQ_MASK ); -return crypto_sync_skcipher_setkey (child, key, keylen); +crypto_skcipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); +crypto_skcipher_set_flags (child, +crypto_skcipher_get_flags (parent) & +CRYPTO_TFM_REQ_MASK ); +return crypto_skcipher_setkey (child, key, keylen); }static void cryptd_skcipher_complete (struct skcipher_request *req,int err)
@@ -258,13 +259,13 @@ static void cryptd_skcipher_encrypt(struct crypto_async_request *base,struct cryptd_skcipher_request_ctx *rctx =skcipher_request_ctx (req);struct crypto_skcipher *tfm =crypto_skcipher_reqtfm (req);struct cryptd_skcipher_ctx *ctx =crypto_skcipher_ctx (tfm); -struct crypto_sync_skcipher *child = ctx->child; -SYNC_SKCIPHER_REQUEST_ON_STACK (subreq, child); +struct skcipher_request *subreq = &rctx->req; +struct crypto_skcipher *child = ctx->child;if (unlikely (err == -EINPROGRESS )) goto out; -skcipher_request_set_sync_tfm (subreq, child); +skcipher_request_set_tfm (subreq, child);skcipher_request_set_callback (subreq,CRYPTO_TFM_REQ_MAY_SLEEP ,NULL ,NULL ); skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen,
@@ -286,13 +287,13 @@ static void cryptd_skcipher_decrypt(struct crypto_async_request *base,struct cryptd_skcipher_request_ctx *rctx =skcipher_request_ctx (req);struct crypto_skcipher *tfm =crypto_skcipher_reqtfm (req);struct cryptd_skcipher_ctx *ctx =crypto_skcipher_ctx (tfm); -struct crypto_sync_skcipher *child = ctx->child; -SYNC_SKCIPHER_REQUEST_ON_STACK (subreq, child); +struct skcipher_request *subreq = &rctx->req; +struct crypto_skcipher *child = ctx->child;if (unlikely (err == -EINPROGRESS )) goto out; -skcipher_request_set_sync_tfm (subreq, child); +skcipher_request_set_tfm (subreq, child);skcipher_request_set_callback (subreq,CRYPTO_TFM_REQ_MAY_SLEEP ,NULL ,NULL ); skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen,
@@ -343,9 +344,10 @@ static int cryptd_skcipher_init_tfm(struct crypto_skcipher *tfm)if (IS_ERR (cipher))return PTR_ERR (cipher); - ctx->child = (struct crypto_sync_skcipher *)cipher; + ctx->child = cipher;crypto_skcipher_set_reqsize ( - tfm,sizeof (struct cryptd_skcipher_request_ctx )); + tfm,sizeof (struct cryptd_skcipher_request_ctx ) + +crypto_skcipher_reqsize (cipher));return 0 ; }
@@ -353,7 +355,7 @@ static void cryptd_skcipher_exit_tfm(struct crypto_skcipher *tfm) {struct cryptd_skcipher_ctx *ctx =crypto_skcipher_ctx (tfm); -crypto_free_sync_skcipher (ctx->child); +crypto_free_skcipher (ctx->child); }static void cryptd_skcipher_free (struct skcipher_instance *inst)
@@ -931,7 +933,7 @@ struct crypto_skcipher *cryptd_skcipher_child(struct cryptd_skcipher *tfm) {struct cryptd_skcipher_ctx *ctx =crypto_skcipher_ctx (&tfm->base); -return &ctx->child->base; +return ctx->child; }EXPORT_SYMBOL_GPL (cryptd_skcipher_child);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 618/1146 crypto: hisilicon/qm - add missing pci_dev_put() in q_num_set()
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit cc7710d0d4ebc6998f04035cde4f32c5ddbe9d7f ]
pci_get_device() will increase the reference count for the returned pci_dev. We need to use pci_dev_put() to decrease the reference count before q_num_set() returns.
--- include/linux/hisi_acc_qm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/hisi_acc_qm.h +4 -2
@@ -384,14 +384,14 @@ struct hisi_qp {static inline int q_num_set (const char *val,const struct kernel_param *kp,unsigned int device) { -struct pci_dev *pdev =pci_get_device (PCI_VENDOR_ID_HUAWEI , - device,NULL ); +struct pci_dev *pdev;u32 n, q_num;int ret;if (!val)return -EINVAL ; + pdev =pci_get_device (PCI_VENDOR_ID_HUAWEI , device,NULL );if (!pdev) { q_num =min_t (u32,QM_QNUM_V1 ,QM_QNUM_V2 ); pr_info("No device found currently, suppose queue number is %u\n",
@@ -401,6 +401,8 @@ static inline int q_num_set(const char *val, const struct kernel_param *kp, q_num =QM_QNUM_V1 ; else q_num =QM_QNUM_V2 ; + +pci_dev_put (pdev); } ret =kstrtou32 (val,10 , &n);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 619/1146 RDMA/rxe: Fix mr->map double free
In reply to Greg Kroah-HartmanFrom: Li Zhijian <[email protected]>
[ Upstream commit 7d984dac8f6bf4ebd3398af82b357e1d181ecaac ]
rxe_mr_cleanup() which tries to free mr->map again will be called when rxe_mr_init_user() fails:
CPU: 0 PID: 4917 Comm: rdma_flush_serv Kdump: loaded Not tainted 6.1.0-rc1-roce-flush+ #25
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x45/0x5d
panic+0x19e/0x349
end_report.part.0+0x54/0x7c
kasan_report.cold+0xa/0xf
rxe_mr_cleanup+0x9d/0xf0 [rdma_rxe]
__rxe_cleanup+0x10a/0x1e0 [rdma_rxe]
rxe_reg_user_mr+0xb7/0xd0 [rdma_rxe]
ib_uverbs_reg_mr+0x26a/0x480 [ib_uverbs]
ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x1a2/0x250 [ib_uverbs]
ib_uverbs_cmd_verbs+0x1397/0x15a0 [ib_uverbs]This issue was firstly exposed since commit b18c7da63fcb ("RDMA/rxe: Fix memory leak in error path code") and then we fixed it in commit 8ff5f5d9d8cf ("RDMA/rxe: Prevent double freeing rxe_map_set()") but this fix was reverted together at last by commit 1e75550648da (Revert "RDMA/rxe: Create duplicate mapping tables for FMRs")
Simply let rxe_mr_cleanup() always handle freeing the mr->map once it is successfully allocated.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/infiniband/sw/rxe/rxe_mr.c +2 -7
@@ -99,6 +99,7 @@ static int rxe_mr_alloc(struct rxe_mr *mr, int num_buf)kfree (mr->map[i]);kfree (mr->map); + mr->map =NULL ; err1:return -ENOMEM ; }
@@ -122,7 +123,6 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,int num_buf;void *vaddr;int err; -int i; umem =ib_umem_get (&rxe->ib_dev, start, length, access);if (IS_ERR (umem)) {
@@ -163,9 +163,8 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,pr_warn ("%s: Unable to get virtual address\n" , __func__); err = -ENOMEM ; - goto err_cleanup_map; + goto err_release_umem; } - buf->addr = (uintptr_t )vaddr; buf->size =PAGE_SIZE ; num_buf++;
@@ -182,10 +181,6 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,return 0 ; -err_cleanup_map: -for (i =0 ; i < mr->num_map; i++) -kfree (mr->map[i]); -kfree (mr->map); err_release_umem:ib_umem_release (umem); err_out:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 620/1146 RDMA/hns: Fix ext_sge num error when post send
In reply to Greg Kroah-HartmanFrom: Luoyouming <[email protected]>
[ Upstream commit 8eaa6f7d569b4a22bfc1b0a3fdfeeb401feb65a4 ]
In the HNS ROCE driver, The sge is divided into standard sge and extended sge. There are 2 standard sge in RC/XRC, and the UD standard sge is 0. In the scenario of RC SQ inline, if the data does not exceed 32bytes, the standard sge will be used. If it exceeds, only the extended sge will be used to fill the data.
Currently, when filling the extended sge, max_gs is directly used as the number of the extended sge, which did not subtract the number of standard sge. There is a logical error. The new algorithm subtracts the number of standard sge from max_gs to get the actual number of extended sge.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +11 -2
@@ -187,20 +187,29 @@ static void set_atomic_seg(const struct ib_send_wr *wr,hr_reg_write (rc_sq_wqe,RC_SEND_WQE_SGE_NUM , valid_num_sge); } +static unsigned int get_std_sge_num (struct hns_roce_qp *qp) +{ +if (qp->ibqp.qp_type ==IB_QPT_GSI || qp->ibqp.qp_type ==IB_QPT_UD ) +return 0 ; + +return HNS_ROCE_SGE_IN_WQE ; +} +static int fill_ext_sge_inl_data (struct hns_roce_qp *qp,const struct ib_send_wr *wr,unsigned int *sge_idx,u32 msg_len) {struct ib_device *ibdev = &(to_hr_dev (qp->ibqp.device))->ib_dev; -unsigned int ext_sge_sz = qp->sq.max_gs *HNS_ROCE_SGE_SIZE ;unsigned int left_len_in_pg;unsigned int idx = *sge_idx; +unsigned int std_sge_num;unsigned int i =0 ;unsigned int len;void *addr;void *dseg; -if (msg_len > ext_sge_sz) { + std_sge_num =get_std_sge_num (qp); +if (msg_len > (qp->sq.max_gs - std_sge_num) *HNS_ROCE_SGE_SIZE ) {ibdev_err (ibdev,"no enough extended sge space for inline data.\n" );return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 621/1146 RDMA/hns: Fix incorrect sge nums calculation
In reply to Greg Kroah-HartmanFrom: Luoyouming <[email protected]>
[ Upstream commit 0c5e259b06a8efc69f929ad777ea49281bb58e37 ]
The user usually configures the number of sge through the max_send_sge parameter when creating qp, and configures the maximum size of inline data that can be sent through max_inline_data. Inline uses sge to fill data to send. Expect the following:
1) When the sge space cannot hold inline data, the sge space needs to be expanded to accommodate all inline data
2) When the sge space is enough to accommodate inline data, the upper limit of inline data can be increased so that users can send larger inline data
Currently case one is not implemented. When the inline data is larger than the sge space, an error of insufficient sge space occurs. This part of the code needs to be reimplemented according to the expected rules. The calculation method of sge num is modified to take the maximum value of max_send_sge and the sge for max_inline_data to solve this problem.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 3 + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 12 +-- drivers/infiniband/hw/hns/hns_roce_main.c | 18 +++- drivers/infiniband/hw/hns/hns_roce_qp.c | 107 ++++++++++++++++---- include/uapi/rdma/hns-abi.h | 15 +++ 5 files changed, 125 insertions(+), 30 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +3 -0
@@ -202,6 +202,7 @@ struct hns_roce_ucontext {struct list_head page_list;struct mutex page_mutex;struct hns_user_mmap_entry *db_mmap_entry; +u32 config; };struct hns_roce_pd {
@@ -334,6 +335,7 @@ struct hns_roce_wq {u32 head;u32 tail;void __iomem *db_reg; +u32 ext_sge_cnt; };struct hns_roce_sge {
@@ -635,6 +637,7 @@ struct hns_roce_qp {struct list_head rq_node;/* all recv qps are on a list */ struct list_head sq_node;/* all send qps are on a list */ struct hns_user_mmap_entry *dwqe_mmap_entry; +u32 config; };struct hns_roce_ib_iboe {
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -11
@@ -187,14 +187,6 @@ static void set_atomic_seg(const struct ib_send_wr *wr,hr_reg_write (rc_sq_wqe,RC_SEND_WQE_SGE_NUM , valid_num_sge); } -static unsigned int get_std_sge_num (struct hns_roce_qp *qp) -{ -if (qp->ibqp.qp_type ==IB_QPT_GSI || qp->ibqp.qp_type ==IB_QPT_UD ) -return 0 ; - -return HNS_ROCE_SGE_IN_WQE ; -} -static int fill_ext_sge_inl_data (struct hns_roce_qp *qp,const struct ib_send_wr *wr,unsigned int *sge_idx,u32 msg_len)
@@ -202,14 +194,12 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,struct ib_device *ibdev = &(to_hr_dev (qp->ibqp.device))->ib_dev;unsigned int left_len_in_pg;unsigned int idx = *sge_idx; -unsigned int std_sge_num;unsigned int i =0 ;unsigned int len;void *addr;void *dseg; - std_sge_num =get_std_sge_num (qp); -if (msg_len > (qp->sq.max_gs - std_sge_num) *HNS_ROCE_SGE_SIZE ) { +if (msg_len > qp->sq.ext_sge_cnt *HNS_ROCE_SGE_SIZE ) {ibdev_err (ibdev,"no enough extended sge space for inline data.\n" );return -EINVAL ;
drivers/infiniband/hw/hns/hns_roce_main.c +16 -2
@@ -354,10 +354,11 @@ static int hns_roce_alloc_uar_entry(struct ib_ucontext *uctx)static int hns_roce_alloc_ucontext (struct ib_ucontext *uctx,struct ib_udata *udata) { -int ret;struct hns_roce_ucontext *context =to_hr_ucontext (uctx); -struct hns_roce_ib_alloc_ucontext_resp resp = {};struct hns_roce_dev *hr_dev =to_hr_dev (uctx->device); +struct hns_roce_ib_alloc_ucontext_resp resp = {}; +struct hns_roce_ib_alloc_ucontext ucmd = {}; +int ret;if (!hr_dev->active)return -EAGAIN ;
@@ -365,6 +366,19 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, resp.qp_tab_size = hr_dev->caps.num_qps; resp.srq_tab_size = hr_dev->caps.num_srqs; + ret =ib_copy_from_udata (&ucmd, udata, +min (udata->inlen,sizeof (ucmd))); +if (ret) +return ret; + +if (hr_dev->pci_dev->revision >=PCI_REVISION_ID_HIP09 ) + context->config = ucmd.config &HNS_ROCE_EXSGE_FLAGS ; + +if (context->config &HNS_ROCE_EXSGE_FLAGS ) { + resp.config |=HNS_ROCE_RSP_EXSGE_FLAGS ; + resp.max_inline_data = hr_dev->caps.max_sq_inline; + } + ret =hns_roce_uar_alloc (hr_dev, &context->uar);if (ret) goto error_fail_uar_alloc;
drivers/infiniband/hw/hns/hns_roce_qp.c +90 -17
159 lines not on this page · raw message
include/uapi/rdma/hns-abi.h +15 -0
@@ -85,11 +85,26 @@ struct hns_roce_ib_create_qp_resp {__aligned_u64 dwqe_mmap_key; }; +enum { +HNS_ROCE_EXSGE_FLAGS =1 <<0 , +}; + +enum { +HNS_ROCE_RSP_EXSGE_FLAGS =1 <<0 , +}; +struct hns_roce_ib_alloc_ucontext_resp {__u32 qp_tab_size;__u32 cqe_size;__u32 srq_tab_size;__u32 reserved; +__u32 config; +__u32 max_inline_data; +}; + +struct hns_roce_ib_alloc_ucontext { +__u32 config; +__u32 reserved; };struct hns_roce_ib_alloc_pd_resp {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 622/1146 PCI: Check for alloc failure in pci_request_irq()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
[ Upstream commit 2d9cd957d40c3ac491b358e7cff0515bb07a3a9c ]
When kvasprintf() fails to allocate memory, it returns a NULL pointer. Return error from pci_request_irq() so we don't dereference it.
--- drivers/pci/irq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/irq.c +2 -0
@@ -44,6 +44,8 @@ int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler,va_start (ap, fmt); devname =kvasprintf (GFP_KERNEL , fmt, ap);va_end (ap); +if (!devname) +return -ENOMEM ; ret =request_threaded_irq (pci_irq_vector (dev, nr), handler, thread_fn, irqflags, devname, dev_id);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 623/1146 RDMA/hfi: Decrease PCI device reference count in error path
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 9b51d072da1d27e1193e84708201c48e385ad912 ]
pci_get_device() will increase the reference count for the returned pci_dev, and also decrease the reference count for the input parameter *from* if it is not NULL.
If we break out the loop in node_affinity_init() with 'dev' not NULL, we need to call pci_dev_put() to decrease the reference count. Add missing pci_dev_put() in error path.
--- drivers/infiniband/hw/hfi1/affinity.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hfi1/affinity.c +2 -0
@@ -177,6 +177,8 @@ int node_affinity_init(void)for (node =0 ; node < node_affinity.num_possible_nodes; node++) hfi1_per_node_cntr[node] =1 ; +pci_dev_put (dev); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 624/1146 crypto: ccree - Make cc_debugfs_global_fini() available for module init function
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 8e96729fc26c8967db45a3fb7a60387619f77a22 ]
ccree_init() calls cc_debugfs_global_fini(), the former is an init function and the latter an exit function though.
A modular build emits:
WARNING: modpost: drivers/crypto/ccree/ccree.o: section mismatch in reference: init_module (section: .init.text) -> cc_debugfs_global_fini (section: .exit.text)
(with CONFIG_DEBUG_SECTION_MISMATCH=y).
--- drivers/crypto/ccree/cc_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccree/cc_debugfs.c +1 -1
@@ -55,7 +55,7 @@ void __init cc_debugfs_global_init(void) cc_debugfs_dir =debugfs_create_dir ("ccree" ,NULL ); } -void __exit cc_debugfs_global_fini(void) +void cc_debugfs_global_fini (void ) {debugfs_remove (cc_debugfs_dir); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 625/1146 RDMA/irdma: Initialize net_type before checking it
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 9907526d25c4ad8a6e3006487a544140776ba005 ]
The av->net_type is not initialized before it is checked in irdma_modify_qp_roce. This leads to an incorrect update to the ARP cache and QP context. RoCEv2 connections might fail as result.
Set the net_type using rdma_gid_attr_network_type.
--- drivers/infiniband/hw/irdma/verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/irdma/verbs.c +1 -0
@@ -1213,6 +1213,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, av->attrs = attr->ah_attr;rdma_gid2ip ((struct sockaddr *)&av->sgid_addr, &sgid_attr->gid);rdma_gid2ip ((struct sockaddr *)&av->dgid_addr, &attr->ah_attr.grh.dgid); + av->net_type =rdma_gid_attr_network_type (sgid_attr);if (av->net_type ==RDMA_NETWORK_IPV6 ) {__be32 *daddr = av->dgid_addr.saddr_in6.sin6_addr.in6_u.u6_addr32;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 626/1146 RDMA/hns: fix memory leak in hns_roce_alloc_mr()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit a115aa00b18f7b8982b8f458149632caf64a862a ]
When hns_roce_mr_enable() failed in hns_roce_alloc_mr(), mr_key is not released. Compiled test only.
--- drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_mr.c +2 -2
@@ -392,10 +392,10 @@ struct ib_mr *hns_roce_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,return &mr->ibmr; -err_key: -free_mr_key (hr_dev, mr); err_pbl:free_mr_pbl (hr_dev, mr); +err_key: +free_mr_key (hr_dev, mr); err_free:kfree (mr);return ERR_PTR (ret);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 627/1146 RDMA/rxe: Fix NULL-ptr-deref in rxe_qp_do_cleanup() when socket create failed
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit f67376d801499f4fa0838c18c1efcad8840e550d ]
There is a null-ptr-deref when mount.cifs over rdma:
BUG: KASAN: null-ptr-deref in rxe_qp_do_cleanup+0x2f3/0x360 [rdma_rxe] Read of size 8 at addr 0000000000000018 by task mount.cifs/3046 CPU: 2 PID: 3046 Comm: mount.cifs Not tainted 6.1.0-rc5+ #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc3 Call Trace: <TASK> dump_stack_lvl+0x34/0x44 kasan_report+0xad/0x130 rxe_qp_do_cleanup+0x2f3/0x360 [rdma_rxe] execute_in_process_context+0x25/0x90 __rxe_cleanup+0x101/0x1d0 [rdma_rxe] rxe_create_qp+0x16a/0x180 [rdma_rxe] create_qp.part.0+0x27d/0x340 ib_create_qp_kernel+0x73/0x160 rdma_create_qp+0x100/0x230 _smbd_get_connection+0x752/0x20f0 smbd_get_connection+0x21/0x40 cifs_get_tcp_session+0x8ef/0xda0 mount_get_conns+0x60/0x750 cifs_mount+0x103/0xd00 cifs_smb3_do_mount+0x1dd/0xcb0 smb3_get_tree+0x1d5/0x300 vfs_get_tree+0x41/0xf0 path_mount+0x9b3/0xdd0 __x64_sys_mount+0x190/0x1d0 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0
The root cause of the issue is the socket create failed in rxe_qp_init_req().
So move the reset rxe_qp_do_cleanup() after the NULL ptr check.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +3 -3
@@ -829,12 +829,12 @@ static void rxe_qp_do_cleanup(struct work_struct *work)if (qp->resp.mr)rxe_put (qp->resp.mr); -if (qp_type (qp) ==IB_QPT_RC ) -sk_dst_reset (qp->sk->sk); -free_rd_atomic_resources (qp);if (qp->sk) { +if (qp_type (qp) ==IB_QPT_RC ) +sk_dst_reset (qp->sk->sk); +kernel_sock_shutdown (qp->sk,SHUT_RDWR );sock_release (qp->sk); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 628/1146 dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit b8a83e600bdde93e7da41ea3204b2b3832a3c99b ]
Originally as it was defined the legacy bindings the pcie_inbound_axi and pcie_aux clock names were supposed to be used in the fsl,imx6sx-pcie and fsl,imx8mq-pcie devices respectively. But the bindings conversion has been incorrectly so now the fourth clock name is defined as "pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcie", which is completely wrong. Let's fix that by conditionally apply the clock-names constraints based on the compatible string content.
--- .../bindings/pci/fsl,imx6q-pcie.yaml | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +42 -4
@@ -14,9 +14,6 @@ description: |+ This PCIe host controller is based on the Synopsys DesignWare PCIe IP and thus inherits all the common properties defined in snps,dw-pcie.yaml. -allOf: - - $ref: /schemas/pci/snps,dw-pcie.yaml# - properties: compatible: enum:
@@ -61,7 +58,7 @@ properties: - const: pcie - const: pcie_bus - const: pcie_phy - - const: pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcie + - enum: [ pcie_inbound_axi, pcie_aux ] num-lanes: const: 1
@@ -175,6 +172,47 @@ required: - clocks - clock-names +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + - if: + properties: + compatible: + contains: + const: fsl,imx6sx-pcie + then: + properties: + clock-names: + items: + - {} + - {} + - {} + - const: pcie_inbound_axi + - if: + properties: + compatible: + contains: + const: fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - {} + - {} + - {} + - const: pcie_aux + - if: + properties: + compatible: + not: + contains: + enum: + - fsl,imx6sx-pcie + - fsl,imx8mq-pcie + then: + properties: + clock-names: + maxItems: 3 + unevaluatedProperties: false examples:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/1146 dt-bindings: visconti-pcie: Fix interrupts array max constraints
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 4cf4b9b70ab2785461190c08a3542d2d74c28b46 ]
In accordance with the way the device DT-node is actually defined in arch/arm64/boot/dts/toshiba/tmpv7708.dtsi and the way the device is probed by the DW PCIe driver there are two IRQs it actually has. It's MSI IRQ the DT-bindings lack. Let's extend the interrupts property constraints then and fix the schema example so one would be acceptable by the actual device DT-bindings.
--- .../devicetree/bindings/pci/toshiba,visconti-pcie.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml +4 -3
@@ -36,7 +36,7 @@ properties: - const: mpu interrupts: - maxItems: 1 + maxItems: 2 clocks: items:
@@ -94,8 +94,9 @@ examples: #interrupt-cells = <1>; ranges = <0x81000000 0 0x40000000 0 0x40000000 0 0x00010000>, <0x82000000 0 0x50000000 0 0x50000000 0 0x20000000>; - interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "intr"; + interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi", "intr"; interrupt-map-mask = <0 0 0 7>; interrupt-map = <0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 630/1146 PCI: endpoint: pci-epf-vntb: Fix call pci_epc_mem_free_addr() in error path
In reply to Greg Kroah-HartmanFrom: Frank Li <[email protected]>
[ Upstream commit 0c031262d2ddfb938f9668d620d7ed674771646c ]
Replace pci_epc_mem_free_addr() with pci_epf_free_space() in the error handle path to match pci_epf_alloc_space().
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
@@ -557,7 +557,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)return ret; err_alloc_peer_mem: -pci_epc_mem_free_addr (ntb->epf->epc, epf_bar->phys_addr, mw_addr, epf_bar->size); +pci_epf_free_space (ntb->epf, mw_addr, barno,0 );return -1 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 631/1146 scsi: hpsa: Fix possible memory leak in hpsa_init_one()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 9c9ff300e0de07475796495d86f449340d454a0c ]
The hpda_alloc_ctlr_info() allocates h and its field reply_map. However, in hpsa_init_one(), if alloc_percpu() failed, the hpsa_init_one() jumps to clean1 directly, which frees h and leaks the h->reply_map.
Fix by calling hpda_free_ctlr_info() to release h->replay_map and h instead free h directly.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -8925,7 +8925,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)destroy_workqueue (h->monitor_ctlr_wq); h->monitor_ctlr_wq =NULL ; } -kfree (h); +hpda_free_ctlr_info (h);return rc; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 632/1146 crypto: tcrypt - Fix multibuffer skcipher speed test mem leak
In reply to Greg Kroah-HartmanFrom: Zhang Yiqun <[email protected]>
[ Upstream commit 1aa33fc8d4032227253ceb736f47c52b859d9683 ]
In the past, the data for mb-skcipher test has been allocated twice, that means the first allcated memory area is without free, which may cause a potential memory leakage. So this patch is to remove one allocation to fix this error.
--- crypto/tcrypt.c | 9 --------- 1 file changed, 9 deletions(-)
crypto/tcrypt.c +0 -9
@@ -1090,15 +1090,6 @@ static void test_mb_skcipher_speed(const char *algo, int enc, int secs, goto out_free_tfm; } - -for (i =0 ; i < num_mb; ++i) -if (testmgr_alloc_buf (data[i].xbuf)) { -while (i--) -testmgr_free_buf (data[i].xbuf); - goto out_free_tfm; - } - -for (i =0 ; i < num_mb; ++i) { data[i].req =skcipher_request_alloc (tfm,GFP_KERNEL );if (!data[i].req) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 633/1146 padata: Always leave BHs disabled when running ->parallel()
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 34c3a47d20ae55b3600fed733bf96eafe9c500d5 ]
A deadlock can happen when an overloaded system runs ->parallel() in the context of the current task:
padata_do_parallel
->parallel()
pcrypt_aead_enc/dec
padata_do_serial
spin_lock(&reorder->lock) // BHs still enabled
<interrupt>
...
__do_softirq
...
padata_do_serial
spin_lock(&reorder->lock)It's a bug for BHs to be on in _do_serial as Steffen points out, so ensure they're off in the "current task" case like they are in padata_parallel_worker to avoid this situation.
--- kernel/padata.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/padata.c +5 -3
@@ -207,14 +207,16 @@ int padata_do_parallel(struct padata_shell *ps, pw =padata_work_alloc ();spin_unlock (&padata_works_lock); +if (!pw) { +/* Maximum works limit exceeded, run in the current task. */ + padata->parallel (padata); + } +rcu_read_unlock_bh ();if (pw) {padata_work_init (pw, padata_parallel_worker, padata,0 );queue_work (pinst->parallel_wq, &pw->pw_work); - }else { -/* Maximum works limit exceeded, run in the current task. */ - padata->parallel (padata); }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 634/1146 padata: Fix list iterator in padata_do_serial()
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 57ddfecc72a6c9941d159543e1c0c0a74fe9afdd ]
list_for_each_entry_reverse() assumes that the iterated list is nonempty and that every list_head is embedded in the same type, but its use in padata_do_serial() breaks both rules.
This doesn't cause any issues now because padata_priv and padata_list happen to have their list fields at the same offset, but we really shouldn't be relying on that.
--- kernel/padata.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/padata.c +5 -2
@@ -390,13 +390,16 @@ void padata_do_serial(struct padata_priv *padata)int hashed_cpu =padata_cpu_hash (pd, padata->seq_nr);struct padata_list *reorder =per_cpu_ptr (pd->reorder_list, hashed_cpu);struct padata_priv *cur; +struct list_head *pos;spin_lock (&reorder->lock);/* Sort in ascending order of sequence number. */ -list_for_each_entry_reverse (cur, &reorder->list, list) +list_for_each_prev (pos, &reorder->list) { + cur = list_entry(pos, struct padata_priv, list);if (cur->seq_nr < padata->seq_nr)break ; -list_add (&padata->list, &cur->list); + } +list_add (&padata->list, pos);spin_unlock (&reorder->lock);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 635/1146 crypto: x86/aegis128 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 8bd9974b6bfcd1e14a001deeca051aed7295559a ]
crypto_aegis128_aesni_enc(), crypto_aegis128_aesni_enc_tail(), crypto_aegis128_aesni_dec(), and crypto_aegis128_aesni_dec_tail() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect calls).
--- arch/x86/crypto/aegis128-aesni-asm.S | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/crypto/aegis128-aesni-asm.S +5 -4
@@ -7,6 +7,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/frame.h> #define STATE0 %xmm0
@@ -402,7 +403,7 @@ SYM_FUNC_END(crypto_aegis128_aesni_ad) * void crypto_aegis128_aesni_enc(void *state, unsigned int length, * const void *src, void *dst); */ -SYM_FUNC_START(crypto_aegis128_aesni_enc) +SYM_TYPED_FUNC_START(crypto_aegis128_aesni_enc) FRAME_BEGIN cmp $0x10, LEN
@@ -499,7 +500,7 @@ SYM_FUNC_END(crypto_aegis128_aesni_enc) * void crypto_aegis128_aesni_enc_tail(void *state, unsigned int length, * const void *src, void *dst); */ -SYM_FUNC_START(crypto_aegis128_aesni_enc_tail) +SYM_TYPED_FUNC_START(crypto_aegis128_aesni_enc_tail) FRAME_BEGIN /* load the state: */
@@ -556,7 +557,7 @@ SYM_FUNC_END(crypto_aegis128_aesni_enc_tail) * void crypto_aegis128_aesni_dec(void *state, unsigned int length, * const void *src, void *dst); */ -SYM_FUNC_START(crypto_aegis128_aesni_dec) +SYM_TYPED_FUNC_START(crypto_aegis128_aesni_dec) FRAME_BEGIN cmp $0x10, LEN
@@ -653,7 +654,7 @@ SYM_FUNC_END(crypto_aegis128_aesni_dec) * void crypto_aegis128_aesni_dec_tail(void *state, unsigned int length, * const void *src, void *dst); */ -SYM_FUNC_START(crypto_aegis128_aesni_dec_tail) +SYM_TYPED_FUNC_START(crypto_aegis128_aesni_dec_tail) FRAME_BEGIN /* load the state: */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 636/1146 crypto: x86/aria - fix crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit c67b553a4f4a8bd921e4c9ceae00e111be09c488 ]
aria_aesni_avx_encrypt_16way(), aria_aesni_avx_decrypt_16way(), aria_aesni_avx_ctr_crypt_16way(), aria_aesni_avx_gfni_encrypt_16way(), aria_aesni_avx_gfni_decrypt_16way(), and aria_aesni_avx_gfni_ctr_crypt_16way() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure.
--- arch/x86/crypto/aria-aesni-avx-asm_64.S | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/crypto/aria-aesni-avx-asm_64.S +7 -6
@@ -7,6 +7,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/frame.h> /* struct aria_ctx: */
@@ -913,7 +914,7 @@ SYM_FUNC_START_LOCAL(__aria_aesni_avx_crypt_16way) RET; SYM_FUNC_END(__aria_aesni_avx_crypt_16way) -SYM_FUNC_START(aria_aesni_avx_encrypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_encrypt_16way) /* input: * %rdi: ctx, CTX * %rsi: dst
@@ -938,7 +939,7 @@ SYM_FUNC_START(aria_aesni_avx_encrypt_16way) RET; SYM_FUNC_END(aria_aesni_avx_encrypt_16way) -SYM_FUNC_START(aria_aesni_avx_decrypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_decrypt_16way) /* input: * %rdi: ctx, CTX * %rsi: dst
@@ -1039,7 +1040,7 @@ SYM_FUNC_START_LOCAL(__aria_aesni_avx_ctr_gen_keystream_16way) RET; SYM_FUNC_END(__aria_aesni_avx_ctr_gen_keystream_16way) -SYM_FUNC_START(aria_aesni_avx_ctr_crypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_ctr_crypt_16way) /* input: * %rdi: ctx * %rsi: dst
@@ -1208,7 +1209,7 @@ SYM_FUNC_START_LOCAL(__aria_aesni_avx_gfni_crypt_16way) RET; SYM_FUNC_END(__aria_aesni_avx_gfni_crypt_16way) -SYM_FUNC_START(aria_aesni_avx_gfni_encrypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_gfni_encrypt_16way) /* input: * %rdi: ctx, CTX * %rsi: dst
@@ -1233,7 +1234,7 @@ SYM_FUNC_START(aria_aesni_avx_gfni_encrypt_16way) RET; SYM_FUNC_END(aria_aesni_avx_gfni_encrypt_16way) -SYM_FUNC_START(aria_aesni_avx_gfni_decrypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_gfni_decrypt_16way) /* input: * %rdi: ctx, CTX * %rsi: dst
@@ -1258,7 +1259,7 @@ SYM_FUNC_START(aria_aesni_avx_gfni_decrypt_16way) RET; SYM_FUNC_END(aria_aesni_avx_gfni_decrypt_16way) -SYM_FUNC_START(aria_aesni_avx_gfni_ctr_crypt_16way) +SYM_TYPED_FUNC_START(aria_aesni_avx_gfni_ctr_crypt_16way) /* input: * %rdi: ctx * %rsi: dst
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 637/1146 crypto: x86/sha1 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 32f34bf7e44eeaa241fb845d6f52af5104bc30fd ]
sha1_transform_ssse3(), sha1_transform_avx(), and sha1_ni_transform() (but not sha1_transform_avx2()) are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect calls).
--- arch/x86/crypto/sha1_ni_asm.S | 3 ++- arch/x86/crypto/sha1_ssse3_asm.S | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/crypto/sha1_ni_asm.S +2 -1
@@ -54,6 +54,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #define DIGEST_PTR %rdi /* 1st arg */ #define DATA_PTR %rsi /* 2nd arg */
@@ -93,7 +94,7 @@ */ .text .align 32 -SYM_FUNC_START(sha1_ni_transform) +SYM_TYPED_FUNC_START(sha1_ni_transform) push %rbp mov %rsp, %rbp sub $FRAME_SIZE, %rsp
arch/x86/crypto/sha1_ssse3_asm.S +2 -1
@@ -25,6 +25,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #define CTX %rdi // arg1 #define BUF %rsi // arg2
@@ -67,7 +68,7 @@ * param: function's name */ .macro SHA1_VECTOR_ASM name - SYM_FUNC_START(\name) + SYM_TYPED_FUNC_START(\name) push %rbx push %r12
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 638/1146 crypto: x86/sha256 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 19940ebbb59c12146d05c5f8acd873197b290648 ]
sha256_transform_ssse3(), sha256_transform_avx(), sha256_transform_rorx(), and sha256_ni_transform() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect calls).
--- arch/x86/crypto/sha256-avx-asm.S | 3 ++- arch/x86/crypto/sha256-avx2-asm.S | 3 ++- arch/x86/crypto/sha256-ssse3-asm.S | 3 ++- arch/x86/crypto/sha256_ni_asm.S | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)
arch/x86/crypto/sha256-avx-asm.S +2 -1
@@ -48,6 +48,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> ## assume buffers not aligned #define VMOVDQ vmovdqu
@@ -346,7 +347,7 @@ a = TMP_ ## arg 3 : Num blocks ######################################################################## .text -SYM_FUNC_START(sha256_transform_avx) +SYM_TYPED_FUNC_START(sha256_transform_avx) .align 32 pushq %rbx pushq %r12
arch/x86/crypto/sha256-avx2-asm.S +2 -1
@@ -49,6 +49,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> ## assume buffers not aligned #define VMOVDQ vmovdqu
@@ -523,7 +524,7 @@ STACK_SIZE = _CTX + _CTX_SIZE ## arg 3 : Num blocks ######################################################################## .text -SYM_FUNC_START(sha256_transform_rorx) +SYM_TYPED_FUNC_START(sha256_transform_rorx) .align 32 pushq %rbx pushq %r12
arch/x86/crypto/sha256-ssse3-asm.S +2 -1
@@ -47,6 +47,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> ## assume buffers not aligned #define MOVDQ movdqu
@@ -355,7 +356,7 @@ a = TMP_ ## arg 3 : Num blocks ######################################################################## .text -SYM_FUNC_START(sha256_transform_ssse3) +SYM_TYPED_FUNC_START(sha256_transform_ssse3) .align 32 pushq %rbx pushq %r12
arch/x86/crypto/sha256_ni_asm.S +2 -1
@@ -54,6 +54,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #define DIGEST_PTR %rdi /* 1st arg */ #define DATA_PTR %rsi /* 2nd arg */
@@ -97,7 +98,7 @@ .text .align 32 -SYM_FUNC_START(sha256_ni_transform) +SYM_TYPED_FUNC_START(sha256_ni_transform) shl $6, NUM_BLKS /* convert to bytes */ jz .Ldone_hash
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 639/1146 crypto: x86/sha512 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit a1d72fa33186ac69c7d8120c71f41ea4fc23dcc9 ]
sha512_transform_ssse3(), sha512_transform_avx(), and sha512_transform_rorx() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect calls).
--- arch/x86/crypto/sha512-avx-asm.S | 3 ++- arch/x86/crypto/sha512-avx2-asm.S | 3 ++- arch/x86/crypto/sha512-ssse3-asm.S | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/crypto/sha512-avx-asm.S +2 -1
@@ -48,6 +48,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> .text
@@ -273,7 +274,7 @@ frame_size = frame_WK + WK_SIZE # of SHA512 message blocks. # "blocks" is the message length in SHA512 blocks ######################################################################## -SYM_FUNC_START(sha512_transform_avx) +SYM_TYPED_FUNC_START(sha512_transform_avx) test msglen, msglen je nowork
arch/x86/crypto/sha512-avx2-asm.S +2 -1
@@ -50,6 +50,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> .text
@@ -565,7 +566,7 @@ frame_size = frame_CTX + CTX_SIZE # of SHA512 message blocks. # "blocks" is the message length in SHA512 blocks ######################################################################## -SYM_FUNC_START(sha512_transform_rorx) +SYM_TYPED_FUNC_START(sha512_transform_rorx) # Save GPRs push %rbx push %r12
arch/x86/crypto/sha512-ssse3-asm.S +2 -1
@@ -48,6 +48,7 @@ ######################################################################## #include <linux/linkage.h> +#include <linux/cfi_types.h> .text
@@ -274,7 +275,7 @@ frame_size = frame_WK + WK_SIZE # of SHA512 message blocks. # "blocks" is the message length in SHA512 blocks. ######################################################################## -SYM_FUNC_START(sha512_transform_ssse3) +SYM_TYPED_FUNC_START(sha512_transform_ssse3) test msglen, msglen je nowork
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 640/1146 crypto: x86/sm3 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 8ba490d9f5a56f52091644325a32d3f71a982776 ]
sm3_transform_avx() is called via indirect function calls. Therefore it needs to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause its type hash to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect call).
--- arch/x86/crypto/sm3-avx-asm_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/crypto/sm3-avx-asm_64.S +2 -1
@@ -12,6 +12,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/frame.h> /* Context structure */
@@ -328,7 +329,7 @@ * const u8 *data, int nblocks); */ .align 16 -SYM_FUNC_START(sm3_transform_avx) +SYM_TYPED_FUNC_START(sm3_transform_avx) /* input: * %rdi: ctx, CTX * %rsi: data (64*nblks bytes)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 641/1146 crypto: x86/sm4 - fix crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 2d203c46a0fa5df0785383b13b722483e1fd27a8 ]
sm4_aesni_avx_ctr_enc_blk8(), sm4_aesni_avx_cbc_dec_blk8(), sm4_aesni_avx_cfb_dec_blk8(), sm4_aesni_avx2_ctr_enc_blk16(), sm4_aesni_avx2_cbc_dec_blk16(), and sm4_aesni_avx2_cfb_dec_blk16() are called via indirect function calls. Therefore they need to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause their type hashes to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure.
(Or at least that should be the case. For some reason the CFI checks in sm4_avx_cbc_decrypt(), sm4_avx_cfb_decrypt(), and sm4_avx_ctr_crypt() are not always being generated, using current tip-of-tree clang. Anyway, this patch is a good idea anyway.)
--- arch/x86/crypto/sm4-aesni-avx-asm_64.S | 7 ++++--- arch/x86/crypto/sm4-aesni-avx2-asm_64.S | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/crypto/sm4-aesni-avx-asm_64.S +4 -3
@@ -14,6 +14,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/frame.h> #define rRIP (%rip)
@@ -420,7 +421,7 @@ SYM_FUNC_END(sm4_aesni_avx_crypt8) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx_ctr_enc_blk8) +SYM_TYPED_FUNC_START(sm4_aesni_avx_ctr_enc_blk8) /* input: * %rdi: round key array, CTX * %rsi: dst (8 blocks)
@@ -495,7 +496,7 @@ SYM_FUNC_END(sm4_aesni_avx_ctr_enc_blk8) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx_cbc_dec_blk8) +SYM_TYPED_FUNC_START(sm4_aesni_avx_cbc_dec_blk8) /* input: * %rdi: round key array, CTX * %rsi: dst (8 blocks)
@@ -545,7 +546,7 @@ SYM_FUNC_END(sm4_aesni_avx_cbc_dec_blk8) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx_cfb_dec_blk8) +SYM_TYPED_FUNC_START(sm4_aesni_avx_cfb_dec_blk8) /* input: * %rdi: round key array, CTX * %rsi: dst (8 blocks)
arch/x86/crypto/sm4-aesni-avx2-asm_64.S +4 -3
@@ -14,6 +14,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/frame.h> #define rRIP (%rip)
@@ -282,7 +283,7 @@ SYM_FUNC_END(__sm4_crypt_blk16) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx2_ctr_enc_blk16) +SYM_TYPED_FUNC_START(sm4_aesni_avx2_ctr_enc_blk16) /* input: * %rdi: round key array, CTX * %rsi: dst (16 blocks)
@@ -395,7 +396,7 @@ SYM_FUNC_END(sm4_aesni_avx2_ctr_enc_blk16) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx2_cbc_dec_blk16) +SYM_TYPED_FUNC_START(sm4_aesni_avx2_cbc_dec_blk16) /* input: * %rdi: round key array, CTX * %rsi: dst (16 blocks)
@@ -449,7 +450,7 @@ SYM_FUNC_END(sm4_aesni_avx2_cbc_dec_blk16) * const u8 *src, u8 *iv) */ .align 8 -SYM_FUNC_START(sm4_aesni_avx2_cfb_dec_blk16) +SYM_TYPED_FUNC_START(sm4_aesni_avx2_cfb_dec_blk16) /* input: * %rdi: round key array, CTX * %rsi: dst (16 blocks)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 642/1146 crypto: arm64/sm3 - add NEON assembly implementation
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit a41b2129461f6c88e087ca9a6e2fde34cb6deb48 ]
This patch adds the NEON acceleration implementation of the SM3 hash algorithm. The main algorithm is based on SM3 NEON accelerated work of the libgcrypt project.
Benchmark on T-Head Yitian-710 2.75 GHz, the data comes from the 326 mode of tcrypt, and compares the performance data of sm3-generic and sm3-ce. The abscissas are blocks of different lengths. The data is tabulated and the unit is Mb/s:
update-size | 16 64 256 1024 2048 4096 8192
---------------+--------------------------------------------------------
sm3-generic | 185.24 221.28 301.26 307.43 300.83 308.82 308.91 sm3-neon | 171.81 220.20 322.94 339.28 334.09 343.61 343.87 sm3-ce | 227.48 333.48 502.62 527.87 520.45 534.91 535.40
Stable-dep-of: be8f6b649607 ("crypto: arm64/sm3 - fix possible crash with CFI enabled")
--- arch/arm64/crypto/Kconfig | 11 + arch/arm64/crypto/Makefile | 3 + arch/arm64/crypto/sm3-neon-core.S | 600 ++++++++++++++++++++++++++++++ arch/arm64/crypto/sm3-neon-glue.c | 103 +++++ 4 files changed, 717 insertions(+) create mode 100644 arch/arm64/crypto/sm3-neon-core.S create mode 100644 arch/arm64/crypto/sm3-neon-glue.c
arch/arm64/crypto/Kconfig +11 -0
@@ -96,6 +96,17 @@ config CRYPTO_SHA3_ARM64 Architecture: arm64 using: - ARMv8.2 Crypto Extensions +config CRYPTO_SM3_NEON + tristate "Hash functions: SM3 (NEON)" + depends on KERNEL_MODE_NEON + select CRYPTO_HASH + select CRYPTO_SM3 + help + SM3 (ShangMi 3) secure hash function (OSCCA GM/T 0004-2012) + + Architecture: arm64 using: + - NEON (Advanced SIMD) extensions + config CRYPTO_SM3_ARM64_CE tristate "Hash functions: SM3 (ARMv8.2 Crypto Extensions)" depends on KERNEL_MODE_NEON
arch/arm64/crypto/Makefile +3 -0
@@ -17,6 +17,9 @@ sha512-ce-y := sha512-ce-glue.o sha512-ce-core.o obj-$(CONFIG_CRYPTO_SHA3_ARM64) += sha3-ce.o sha3-ce-y := sha3-ce-glue.o sha3-ce-core.o +obj-$(CONFIG_CRYPTO_SM3_NEON) += sm3-neon.o +sm3-neon-y := sm3-neon-glue.o sm3-neon-core.o + obj-$(CONFIG_CRYPTO_SM3_ARM64_CE) += sm3-ce.o sm3-ce-y := sm3-ce-glue.o sm3-ce-core.o
arch/arm64/crypto/sm3-neon-core.S new file +600 -0
600 lines not on this page · raw message
arch/arm64/crypto/sm3-neon-glue.c new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 643/1146 crypto: arm64/sm3 - fix possible crash with CFI enabled
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit be8f6b6496076588fd49cbe5bfaaf3ab883eb779 ]
sm3_neon_transform() is called via indirect function calls. Therefore it needs to use SYM_TYPED_FUNC_START instead of SYM_FUNC_START to cause its type hash to be emitted when the kernel is built with CONFIG_CFI_CLANG=y. Otherwise, the code crashes with a CFI failure (if the compiler didn't happen to optimize out the indirect call).
--- arch/arm64/crypto/sm3-neon-core.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/crypto/sm3-neon-core.S +2 -1
@@ -9,6 +9,7 @@ */ #include <linux/linkage.h> +#include <linux/cfi_types.h> #include <asm/assembler.h> /* Context structure */
@@ -351,7 +352,7 @@ */ .text .align 3 -SYM_FUNC_START(sm3_neon_transform) +SYM_TYPED_FUNC_START(sm3_neon_transform) ldp ra, rb, [RSTATE, #0] ldp rc, rd, [RSTATE, #8] ldp re, rf, [RSTATE, #16]
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 644/1146 crypto: hisilicon/qm - fix QM_XEQ_DEPTH_CAP mask value
In reply to Greg Kroah-HartmanFrom: Weili Qian <[email protected]>
[ Upstream commit 3901355624d14afe3230252cb36bc3da8ff6890e ]
'QM_XEQ_DEPTH_CAP' mask value is GENMASK(31, 0) instead of GENMASK(15, 0). If the mask value is incorrect, will cause abnormal events cannot be handled. So fix it.
--- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/qm.c +1 -1
@@ -359,7 +359,7 @@ static const struct hisi_qm_cap_info qm_cap_info_vf[] = {static const struct hisi_qm_cap_info qm_basic_info[] = { {QM_TOTAL_QP_NUM_CAP ,0x100158 ,0 ,GENMASK (10 ,0 ),0x1000 ,0x400 ,0x400 }, {QM_FUNC_MAX_QP_CAP ,0x100158 ,11 ,GENMASK (10 ,0 ),0x1000 ,0x400 ,0x400 }, - {QM_XEQ_DEPTH_CAP ,0x3104 ,0 ,GENMASK (15 ,0 ),0x800 ,0x4000800 ,0x4000800 }, + {QM_XEQ_DEPTH_CAP ,0x3104 ,0 ,GENMASK (31 ,0 ),0x800 ,0x4000800 ,0x4000800 }, {QM_QP_DEPTH_CAP ,0x3108 ,0 ,GENMASK (31 ,0 ),0x4000400 ,0x4000400 ,0x4000400 }, {QM_EQ_IRQ_TYPE_CAP ,0x310c ,0 ,GENMASK (31 ,0 ),0x10000 ,0x10000 ,0x10000 }, {QM_AEQ_IRQ_TYPE_CAP ,0x3110 ,0 ,GENMASK (31 ,0 ),0x0 ,0x10001 ,0x10001 },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 645/1146 scsi: mpt3sas: Fix possible resource leaks in mpt3sas_transport_port_add()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 78316e9dfc24906dd474630928ed1d3c562b568e ]
In mpt3sas_transport_port_add(), if sas_rphy_add() returns error, sas_rphy_free() needs be called to free the resource allocated in sas_end_device_alloc(). Otherwise a kernel crash will happen:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000108 CPU: 45 PID: 37020 Comm: bash Kdump: loaded Tainted: G W 6.1.0-rc1+ #189 pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : device_del+0x54/0x3d0 lr : device_del+0x37c/0x3d0 Call trace: device_del+0x54/0x3d0 attribute_container_class_device_del+0x28/0x38 transport_remove_classdev+0x6c/0x80 attribute_container_device_trigger+0x108/0x110 transport_remove_device+0x28/0x38 sas_rphy_remove+0x50/0x78 [scsi_transport_sas] sas_port_delete+0x30/0x148 [scsi_transport_sas] do_sas_phy_delete+0x78/0x80 [scsi_transport_sas] device_for_each_child+0x68/0xb0 sas_remove_children+0x30/0x50 [scsi_transport_sas] sas_rphy_remove+0x38/0x78 [scsi_transport_sas] sas_port_delete+0x30/0x148 [scsi_transport_sas] do_sas_phy_delete+0x78/0x80 [scsi_transport_sas] device_for_each_child+0x68/0xb0 sas_remove_children+0x30/0x50 [scsi_transport_sas] sas_remove_host+0x20/0x38 [scsi_transport_sas] scsih_remove+0xd8/0x420 [mpt3sas]
Because transport_add_device() is not called when sas_rphy_add() fails, the device is not added. When sas_rphy_remove() is subsequently called to remove the device in the remove() path, a NULL pointer dereference happens.
--- drivers/scsi/mpt3sas/mpt3sas_transport.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_transport.c +2 -0
@@ -829,6 +829,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,if ((sas_rphy_add (rphy))) {ioc_err (ioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +sas_rphy_free (rphy); + rphy =NULL ; }if (mpt3sas_port->remote_identify.device_type ==SAS_END_DEVICE ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 646/1146 scsi: hpsa: Fix error handling in hpsa_add_sas_host()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 4ef174a3ad9b5d73c1b6573e244ebba2b0d86eac ]
hpsa_sas_port_add_phy() does:
...
sas_phy_add() -> may return error here
sas_port_add_phy()
...
Whereas hpsa_free_sas_phy() does:
...
sas_port_delete_phy()
sas_phy_delete()
...
If hpsa_sas_port_add_phy() returns an error, hpsa_free_sas_phy() can not be called to free the memory because the port and the phy have not been added yet.
Replace hpsa_free_sas_phy() with sas_phy_free() and kfree() to avoid kernel crash in this case.
--- drivers/scsi/hpsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hpsa.c +2 -1
@@ -9786,7 +9786,8 @@ static int hpsa_add_sas_host(struct ctlr_info *h)return 0 ; free_sas_phy: -hpsa_free_sas_phy (hpsa_sas_phy); +sas_phy_free (hpsa_sas_phy->phy); +kfree (hpsa_sas_phy); free_sas_port:hpsa_free_sas_port (hpsa_sas_port); free_sas_node:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 647/1146 scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit fda34a5d304d0b98cc967e8763b52221b66dc202 ]
If hpsa_sas_port_add_rphy() returns an error, the 'rphy' allocated in sas_end_device_alloc() needs to be freed. Address this by calling sas_rphy_free() in the error path.
--- drivers/scsi/hpsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/hpsa.c +3 -1
@@ -9823,10 +9823,12 @@ static int hpsa_add_sas_device(struct hpsa_sas_node *hpsa_sas_node, rc =hpsa_sas_port_add_rphy (hpsa_sas_port, rphy);if (rc) - goto free_sas_port; + goto free_sas_rphy;return 0 ; +free_sas_rphy: +sas_rphy_free (rphy); free_sas_port:hpsa_free_sas_port (hpsa_sas_port); device->sas_port =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 648/1146 scsi: efct: Fix possible memleak in efct_device_init()
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit bb0cd225dd37df1f4a22e36dad59ff33178ecdfc ]
In efct_device_init(), when efct_scsi_reg_fc_transport() fails, efct_scsi_tgt_driver_exit() is not called to release memory for efct_scsi_tgt_driver_init() and causes memleak:
unreferenced object 0xffff8881020ce000 (size 2048):
comm "modprobe", pid 465, jiffies 4294928222 (age 55.872s) backtrace:
[<0000000021a1ef1b>] kmalloc_trace+0x27/0x110
[<000000004c3ed51c>] target_register_template+0x4fd/0x7b0 [target_core_mod]
[<00000000f3393296>] efct_scsi_tgt_driver_init+0x18/0x50 [efct]
[<00000000115de533>] 0xffffffffc0d90011
[<00000000d608f646>] do_one_initcall+0xd0/0x4e0
[<0000000067828cf1>] do_init_module+0x1cc/0x6a0
...--- drivers/scsi/elx/efct/efct_driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/elx/efct/efct_driver.c +1 -0
@@ -42,6 +42,7 @@ efct_device_init(void) rc =efct_scsi_reg_fc_transport ();if (rc) { +efct_scsi_tgt_driver_exit ();pr_err ("failed to register to FC host\n" );return rc; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 649/1146 scsi: scsi_debug: Fix a warning in resp_verify()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit ed0f17b748b20271cb568c7ca0b23b120316a47d ]
As 'vnum' is controlled by user, so if user tries to allocate memory larger than(>=) MAX_ORDER, then kcalloc() will fail, it creates a stack trace and messes up dmesg with a warning.
Add __GFP_NOWARN in order to avoid too large allocation warning. This is detected by static analysis using smatch.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -4436,7 +4436,7 @@ static int resp_verify(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)if (ret)return ret; - arr =kcalloc (lb_size, vnum,GFP_ATOMIC ); + arr =kcalloc (lb_size, vnum,GFP_ATOMIC | __GFP_NOWARN);if (!arr) {mk_sense_buffer (scp,ILLEGAL_REQUEST ,INSUFF_RES_ASC ,INSUFF_RES_ASCQ );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 650/1146 scsi: scsi_debug: Fix a warning in resp_report_zones()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit 07f2ca139d9a7a1ba71c4c03997c8de161db2346 ]
As 'alloc_len' is user controlled data, if user tries to allocate memory larger than(>=) MAX_ORDER, then kcalloc() will fail, it creates a stack trace and messes up dmesg with a warning.
Add __GFP_NOWARN in order to avoid too large allocation warning. This is detected by static analysis using smatch.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -4504,7 +4504,7 @@ static int resp_report_zones(struct scsi_cmnd *scp, rep_max_zones = (alloc_len -64 ) >>ilog2 (RZONES_DESC_HD ); - arr =kzalloc (alloc_len,GFP_ATOMIC ); + arr =kzalloc (alloc_len,GFP_ATOMIC | __GFP_NOWARN);if (!arr) {mk_sense_buffer (scp,ILLEGAL_REQUEST ,INSUFF_RES_ASC ,INSUFF_RES_ASCQ );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 651/1146 scsi: fcoe: Fix possible name leak when device_register() fails
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 47b6a122c7b69a876c7ee2fc064a26b09627de9d ]
If device_register() returns an error, the name allocated by dev_set_name() needs to be freed. As the comment of device_register() says, one should use put_device() to give up the reference in the error path. Fix this by calling put_device(), then the name can be freed in kobject_cleanup().
The 'fcf' is freed in fcoe_fcf_device_release(), so the kfree() in the error path can be removed.
The 'ctlr' is freed in fcoe_ctlr_device_release(), so don't use the error label, just return NULL after calling put_device().
--- drivers/scsi/fcoe/fcoe_sysfs.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/scsi/fcoe/fcoe_sysfs.c +10 -9
@@ -830,14 +830,15 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,dev_set_name (&ctlr->dev,"ctlr_%d" , ctlr->id); error =device_register (&ctlr->dev); -if (error) - goto out_del_q2; +if (error) { +destroy_workqueue (ctlr->devloss_work_q); +destroy_workqueue (ctlr->work_q); +put_device (&ctlr->dev); +return NULL ; + }return ctlr; -out_del_q2: -destroy_workqueue (ctlr->devloss_work_q); - ctlr->devloss_work_q =NULL ; out_del_q:destroy_workqueue (ctlr->work_q); ctlr->work_q =NULL ;
@@ -1036,16 +1037,16 @@ struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr, fcf->selected = new_fcf->selected; error =device_register (&fcf->dev); -if (error) - goto out_del; +if (error) { +put_device (&fcf->dev); + goto out; + } fcf->state =FCOE_FCF_STATE_CONNECTED ;list_add_tail (&fcf->peers, &ctlr->fcfs);return fcf; -out_del: -kfree (fcf); out:return NULL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 652/1146 scsi: scsi_debug: Fix possible name leak in sdebug_add_host_helper()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit e6d773f93a49e0eda88a903a2a6542ca83380eb1 ]
Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array"), the name of device is allocated dynamically, it needs be freed when device_register() returns error.
As comment of device_register() says, one should use put_device() to give up the reference in the error path. Fix this by calling put_device(), then the name can be freed in kobject_cleanup(), and sdbg_host is freed in sdebug_release_adapter().
When the device release is not set, it means the device is not initialized. We can not call put_device() in this case. Use kfree() to free memory.
--- drivers/scsi/scsi_debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +4 -1
@@ -7340,7 +7340,10 @@ static int sdebug_add_host_helper(int per_host_idx)kfree (sdbg_devinfo->zstate);kfree (sdbg_devinfo); } -kfree (sdbg_host); +if (sdbg_host->dev.release) +put_device (&sdbg_host->dev); +else +kfree (sdbg_host);pr_warn ("%s: failed, errno=%d\n" , __func__, -error);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 653/1146 scsi: ipr: Fix WARNING in ipr_init()
In reply to Greg Kroah-HartmanFrom: Shang XiaoJing <[email protected]>
[ Upstream commit e6f108bffc3708ddcff72324f7d40dfcd0204894 ]
ipr_init() will not call unregister_reboot_notifier() when pci_register_driver() fails, which causes a WARNING. Call unregister_reboot_notifier() when pci_register_driver() fails.
notifier callback ipr_halt [ipr] already registered
WARNING: CPU: 3 PID: 299 at kernel/notifier.c:29 notifier_chain_register+0x16d/0x230 Modules linked in: ipr(+) xhci_pci_renesas xhci_hcd ehci_hcd usbcore led_class gpu_sched drm_buddy video wmi drm_ttm_helper ttm drm_display_helper drm_kms_helper drm drm_panel_orientation_quirks agpgart cfbft CPU: 3 PID: 299 Comm: modprobe Tainted: G W 6.1.0-rc1-00190-g39508d23b672-dirty #332 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 RIP: 0010:notifier_chain_register+0x16d/0x230 Call Trace: <TASK> __blocking_notifier_chain_register+0x73/0xb0 ipr_init+0x30/0x1000 [ipr] do_one_initcall+0xdb/0x480 do_init_module+0x1cf/0x680 load_module+0x6a50/0x70a0 __do_sys_finit_module+0x12f/0x1c0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
--- drivers/scsi/ipr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/ipr.c +9 -1
@@ -10872,11 +10872,19 @@ static struct notifier_block ipr_notifier = {**/ static int __init ipr_init (void ) { +int rc; +ipr_info ("IBM Power RAID SCSI Device Driver version: %s %s\n" ,IPR_DRIVER_VERSION ,IPR_DRIVER_DATE );register_reboot_notifier (&ipr_notifier); -return pci_register_driver (&ipr_driver); + rc =pci_register_driver (&ipr_driver); +if (rc) { +unregister_reboot_notifier (&ipr_notifier); +return rc; + } + +return 0 ; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 654/1146 scsi: fcoe: Fix transport not deattached when fcoe_if_init() fails
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit 4155658cee394b22b24c6d64e49247bf26d95b92 ]
fcoe_init() calls fcoe_transport_attach(&fcoe_sw_transport), but when fcoe_if_init() fails, &fcoe_sw_transport is not detached and leaves freed &fcoe_sw_transport on fcoe_transports list. This causes panic when reinserting module.
BUG: unable to handle page fault for address: fffffbfff82e2213 RIP: 0010:fcoe_transport_attach+0xe1/0x230 [libfcoe] Call Trace: <TASK> do_one_initcall+0xd0/0x4e0 load_module+0x5eee/0x7210 ...
--- drivers/scsi/fcoe/fcoe.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/fcoe/fcoe.c +1 -0
@@ -2491,6 +2491,7 @@ static int __init fcoe_init(void) out_free:mutex_unlock (&fcoe_config_mutex); +fcoe_transport_detach (&fcoe_sw_transport); out_destroy:destroy_workqueue (fcoe_wq);return rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 655/1146 scsi: snic: Fix possible UAF in snic_tgt_create()
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit e118df492320176af94deec000ae034cc92be754 ]
Smatch reports a warning as follows:
drivers/scsi/snic/snic_disc.c:307 snic_tgt_create() warn:
'&tgt->list' not removed from list
If device_add() fails in snic_tgt_create(), tgt will be freed, but tgt->list will not be removed from snic->disc.tgt_list, then list traversal may cause UAF.
Remove from snic->disc.tgt_list before free().
--- drivers/scsi/snic/snic_disc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/snic/snic_disc.c +3 -0
@@ -304,6 +304,9 @@ snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid) ret);put_device (&snic->shost->shost_gendev); +spin_lock_irqsave (snic->shost->host_lock, flags); +list_del (&tgt->list); +spin_unlock_irqrestore (snic->shost->host_lock, flags);kfree (tgt); tgt =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 656/1146 scsi: ufs: core: Fix the polling implementation
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit ee8c88cab4afbd5ee10a127d6cbecd6b200185a5 ]
Fix the following issues in ufshcd_poll():
- If polling succeeds, return a positive value.
- Do not complete polling requests from interrupt context because the block layer expects these requests to be completed from thread context. From block/bio.c:
If REQ_ALLOC_CACHE is set, the final put of the bio MUST be done from process context, not hard/soft IRQ.
--- drivers/ufs/core/ufshcd.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/ufs/core/ufshcd.c +26 -2
@@ -5382,6 +5382,26 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, } } +/* Any value that is not an existing queue number is fine for this constant. */ +enum { +UFSHCD_POLL_FROM_INTERRUPT_CONTEXT =-1 +}; + +static void ufshcd_clear_polled (struct ufs_hba *hba, +unsigned long *completed_reqs) +{ +int tag; + +for_each_set_bit (tag, completed_reqs, hba->nutrs) { +struct scsi_cmnd *cmd = hba->lrb[tag].cmd; + +if (!cmd) +continue ; +if (scsi_cmd_to_rq (cmd)->cmd_flags &REQ_POLLED ) +__clear_bit (tag, completed_reqs); + } +} +/* * Returns > 0 if one or more commands have been completed or 0 if no * requests have been completed.
@@ -5398,13 +5418,17 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)WARN_ONCE (completed_reqs & ~hba->outstanding_reqs,"completed: %#lx; outstanding: %#lx\n" , completed_reqs, hba->outstanding_reqs); +if (queue_num ==UFSHCD_POLL_FROM_INTERRUPT_CONTEXT ) { +/* Do not complete polled requests from interrupt context. */ +ufshcd_clear_polled (hba, &completed_reqs); + } hba->outstanding_reqs &= ~completed_reqs;spin_unlock_irqrestore (&hba->outstanding_lock, flags);if (completed_reqs)__ufshcd_transfer_req_compl (hba, completed_reqs); -return completed_reqs; +return completed_reqs !=0 ; }/**
@@ -5435,7 +5459,7 @@ static irqreturn_t ufshcd_transfer_req_compl(struct ufs_hba *hba)* Ignore the ufshcd_poll() return value and return IRQ_HANDLED since we * do not want polling to trigger spurious interrupt complaints. */ -ufshcd_poll (hba->host,0 ); +ufshcd_poll (hba->host,UFSHCD_POLL_FROM_INTERRUPT_CONTEXT );return IRQ_HANDLED ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 657/1146 RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit ea5ef136e215fdef35f14010bc51fcd6686e6922 ]
As the nla_nest_start() may fail with NULL returned, the return value needs to be checked.
--- drivers/infiniband/core/nldev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/nldev.c +2 -0
@@ -894,6 +894,8 @@ static int fill_stat_counter_qps(struct sk_buff *msg,int ret =0 ; table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_RES_QP ); +if (!table_attr) +return -EMSGSIZE ; rt = &counter->device->res[RDMA_RESTRACK_QP ];xa_lock (&rt->xa);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 658/1146 f2fs: set zstd compress level correctly
In reply to Greg Kroah-HartmanFrom: Sheng Yong <[email protected]>
[ Upstream commit 4ff23a6547b81ca22adb852dfe93ee5fc45328ac ]
--- fs/f2fs/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/compress.c +1 -1
@@ -346,7 +346,7 @@ static int zstd_init_compress_ctx(struct compress_ctx *cc)if (!level) level =F2FS_ZSTD_DEFAULT_CLEVEL ; - params =zstd_get_params (F2FS_ZSTD_DEFAULT_CLEVEL , cc->rlen); + params =zstd_get_params (level, cc->rlen); workspace_size =zstd_cstream_workspace_bound (¶ms.cParams); workspace = f2fs_kvmalloc(F2FS_I_SB(cc->inode),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 659/1146 f2fs: fix to enable compress for newly created file if extension matches
In reply to Greg Kroah-HartmanFrom: Sheng Yong <[email protected]>
[ Upstream commit 787caf1bdcd9f04058e4e8d8ed56db1dbafea0b7 ]
If compress_extension is set, and a newly created file matches the extension, the file could be marked as compression file. However, if inline_data is also enabled, there is no chance to check its extension since f2fs_should_compress() always returns false.
This patch moves set_compress_inode(), which do extension check, in f2fs_should_compress() to check extensions before setting inline data flag.
--- fs/f2fs/f2fs.h | 2 +- fs/f2fs/namei.c | 329 ++++++++++++++++++++++++------------------------ 2 files changed, 164 insertions(+), 167 deletions(-)
fs/f2fs/f2fs.h +1 -1
@@ -2974,7 +2974,7 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)/* Flags that should be inherited by new inodes from their parent. */ #define F2FS_FL_INHERITED (F2FS_SYNC_FL | F2FS_NODUMP_FL | F2FS_NOATIME_FL | \ F2FS_DIRSYNC_FL | F2FS_PROJINHERIT_FL | \ - F2FS_CASEFOLD_FL | F2FS_COMPR_FL | F2FS_NOCOMP_FL) + F2FS_CASEFOLD_FL)/* Flags that are appropriate for regular files (all but dir-specific ones). */ #define F2FS_REG_FLMASK (~(F2FS_DIRSYNC_FL | F2FS_PROJINHERIT_FL | \
fs/f2fs/namei.c +163 -166
390 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 660/1146 f2fs: avoid victim selection from previous victim section
In reply to Greg Kroah-HartmanFrom: Yonggil Song <[email protected]>
[ Upstream commit e219aecfd4b766c4e878a3769057e9809f7fcadc ]
When f2fs chooses GC victim in large section & LFS mode, next_victim_seg[gc_type] is referenced first. After segment is freed, next_victim_seg[gc_type] has the next segment number.
However, next_victim_seg[gc_type] still has the last segment number even after the last segment of section is freed. In this case, when f2fs chooses a victim for the next GC round, the last segment of previous victim section is chosen as a victim.
Initialize next_victim_seg[gc_type] to NULL_SEGNO for the last segment in large section.
--- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +3 -2
@@ -1743,8 +1743,9 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, get_valid_blocks(sbi, segno, false) == 0) seg_freed++; -if (__is_large_section (sbi) && segno +1 < end_segno) - sbi->next_victim_seg[gc_type] = segno +1 ; +if (__is_large_section (sbi)) + sbi->next_victim_seg[gc_type] = + (segno +1 < end_segno) ? segno +1 :NULL_SEGNO ; skip:f2fs_put_page (sum_page,0 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 661/1146 RDMA/nldev: Fix failure to send large messages
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit fc8f93ad3e5485d45c992233c96acd902992dfc4 ]
Return "-EMSGSIZE" instead of "-EINVAL" when filling a QP entry, so that new SKBs will be allocated if there's not enough room in current SKB.
--- drivers/infiniband/core/nldev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -1
@@ -513,7 +513,7 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,/* In create_qp() port is not set yet */ if (qp->port &&nla_put_u32 (msg,RDMA_NLDEV_ATTR_PORT_INDEX , qp->port)) -return -EINVAL ; +return -EMSGSIZE ; ret =nla_put_u32 (msg,RDMA_NLDEV_ATTR_RES_LQPN , qp->qp_num);if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 662/1146 crypto: qat - fix error return code in adf_probe
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 31f81401e23fb88cc030cd586abd28740e6c8136 ]
Fix to return a negative error code -EINVAL instead of 0.
--- drivers/crypto/qat/qat_4xxx/adf_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/qat/qat_4xxx/adf_drv.c +1 -0
@@ -261,6 +261,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) hw_data->accel_capabilities_mask = hw_data->get_accel_cap (accel_dev);if (!hw_data->accel_capabilities_mask) {dev_err (&pdev->dev,"Failed to get capabilities mask.\n" ); + ret = -EINVAL ; goto out_err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 663/1146 crypto: amlogic - Remove kcalloc without check
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3d780c8a9850ad60dee47a8d971ba7888f3d1bd3 ]
There is no real point in allocating dedicated memory for the irqs array. MAXFLOW is only 2, so it is easier to allocated the needed space directly within the 'meson_dev' structure.
This saves some memory allocation and avoids an indirection when using the irqs array.
--- drivers/crypto/amlogic/amlogic-gxl-core.c | 1 - drivers/crypto/amlogic/amlogic-gxl.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/amlogic/amlogic-gxl-core.c +0 -1
@@ -237,7 +237,6 @@ static int meson_crypto_probe(struct platform_device *pdev)return err; } - mc->irqs =devm_kcalloc (mc->dev,MAXFLOW ,sizeof (int ),GFP_KERNEL );for (i =0 ; i <MAXFLOW ; i++) { mc->irqs[i] =platform_get_irq (pdev, i);if (mc->irqs[i] <0 )
drivers/crypto/amlogic/amlogic-gxl.h +1 -1
@@ -95,7 +95,7 @@ struct meson_dev {struct device *dev;struct meson_flow *chanlist;atomic_t flow; -int *irqs; +int irqs[MAXFLOW ];#ifdef CONFIG_CRYPTO_DEV_AMLOGIC_GXL_DEBUG struct dentry *dbgfs_dir;#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 664/1146 crypto: omap-sham - Use pm_runtime_resume_and_get() in omap_sham_probe()
In reply to Greg Kroah-HartmanFrom: Shang XiaoJing <[email protected]>
[ Upstream commit 7bcceb4c9896b1b672b636ae70fe75110d6bf1ad ]
omap_sham_probe() calls pm_runtime_get_sync() and calls pm_runtime_put_sync() latter to put usage_counter. However, pm_runtime_get_sync() will increment usage_counter even it failed. Fix it by replacing it with pm_runtime_resume_and_get() to keep usage counter balanced.
--- drivers/crypto/omap-sham.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/omap-sham.c +1 -1
@@ -2114,7 +2114,7 @@ static int omap_sham_probe(struct platform_device *pdev)pm_runtime_enable (dev); - err =pm_runtime_get_sync (dev); + err =pm_runtime_resume_and_get (dev);if (err <0 ) {dev_err (dev,"failed to get sync: %d\n" , err); goto err_pm;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 665/1146 riscv/mm: add arch hook arch_clear_hugepage_flags
In reply to Greg Kroah-HartmanFrom: Tong Tiangen <[email protected]>
[ Upstream commit d8bf77a1dc3079692f54be3087a5fd16d90027b0 ]
With the PG_arch_1 we keep track if the page's data cache is clean, architecture rely on this property to treat new pages as dirty with respect to the data cache and perform the flushing before mapping the pages into userspace.
This patch adds a new architecture hook, arch_clear_hugepage_flags,so that architectures which rely on the page flags being in a particular state for fresh allocations can adjust the flags accordingly when a page is freed into the pool.
--- arch/riscv/include/asm/hugetlb.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/riscv/include/asm/hugetlb.h +6 -0
@@ -5,4 +5,10 @@#include <asm-generic/hugetlb.h> #include <asm/page.h> +static inline void arch_clear_hugepage_flags (struct page *page) +{ +clear_bit (PG_dcache_clean, &page->flags); +} +#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#endif /* _ASM_RISCV_HUGETLB_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 666/1146 RDMA: Disable IB HW for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 323a74fc20f53c0d0e13a16aee703a30d9751235 ]
Disable all of drivers/infiniband/hw/ and rdmavt for UML builds until someone needs it and provides patches to support it.
This prevents build errors in hw/qib/qib_wc_x86_64.c.
--- drivers/infiniband/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/Kconfig +2 -0
@@ -78,6 +78,7 @@ config INFINIBAND_VIRT_DMA def_bool !HIGHMEM if INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS +if !UML source "drivers/infiniband/hw/bnxt_re/Kconfig" source "drivers/infiniband/hw/cxgb4/Kconfig" source "drivers/infiniband/hw/efa/Kconfig"
@@ -94,6 +95,7 @@ source "drivers/infiniband/hw/qib/Kconfig" source "drivers/infiniband/hw/usnic/Kconfig" source "drivers/infiniband/hw/vmw_pvrdma/Kconfig" source "drivers/infiniband/sw/rdmavt/Kconfig" +endif # !UML source "drivers/infiniband/sw/rxe/Kconfig" source "drivers/infiniband/sw/siw/Kconfig" endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 667/1146 RDMA/hfi1: Fix error return code in parse_platform_config()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 725349f8ba1e78a146c6ff8f3ee5e2712e517106 ]
In the previous iteration of the while loop, the "ret" may have been assigned a value of 0, so the error return code -EINVAL may have been incorrectly set to 0. To fix set valid return code before calling to goto.
--- drivers/infiniband/hw/hfi1/firmware.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/hw/hfi1/firmware.c +6 -0
@@ -1743,6 +1743,7 @@ int parse_platform_config(struct hfi1_devdata *dd)if (!dd->platform_config.data) {dd_dev_err (dd,"%s: Missing config file\n" , __func__); + ret = -EINVAL ; goto bail; } ptr = (u32 *)dd->platform_config.data;
@@ -1751,6 +1752,7 @@ int parse_platform_config(struct hfi1_devdata *dd) ptr++;if (magic_num !=PLATFORM_CONFIG_MAGIC_NUM ) {dd_dev_err (dd,"%s: Bad config file\n" , __func__); + ret = -EINVAL ; goto bail; }
@@ -1774,6 +1776,7 @@ int parse_platform_config(struct hfi1_devdata *dd)if (file_length > dd->platform_config.size) {dd_dev_info (dd,"%s:File claims to be larger than read size\n" , __func__); + ret = -EINVAL ; goto bail; }else if (file_length < dd->platform_config.size) { dd_dev_info(dd,
@@ -1794,6 +1797,7 @@ int parse_platform_config(struct hfi1_devdata *dd)dd_dev_err (dd,"%s: Failed validation at offset %ld\n" , __func__, (ptr - (u32 *) dd->platform_config.data)); + ret = -EINVAL ; goto bail; }
@@ -1837,6 +1841,7 @@ int parse_platform_config(struct hfi1_devdata *dd) __func__, table_type, (ptr - (u32 *) dd->platform_config.data)); + ret = -EINVAL ; goto bail;/* We don't trust this file now */ } pcfgcache->config_tables[table_type].table = ptr;
@@ -1856,6 +1861,7 @@ int parse_platform_config(struct hfi1_devdata *dd) __func__, table_type, (ptr - (u32 *)dd->platform_config.data)); + ret = -EINVAL ; goto bail;/* We don't trust this file now */ } pcfgcache->config_tables[table_type].table_metadata =
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 668/1146 RDMA/srp: Fix error return code in srp_parse_options()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit ed461b30b22c8fa85c25189c14cb89f29595cd14 ]
In the previous iteration of the while loop, the "ret" may have been assigned a value of 0, so the error return code -EINVAL may have been incorrectly set to 0. To fix set valid return code before calling to goto. Also investigate each case separately as Andy suggessted.
--- drivers/infiniband/ulp/srp/ib_srp.c | 96 ++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 14 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +82 -14
@@ -3410,7 +3410,8 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_PKEY : -if (match_hex (args, &token)) { + ret =match_hex (args, &token); +if (ret) {pr_warn ("bad P_Key parameter '%s'\n" , p); goto out; }
@@ -3470,7 +3471,8 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_MAX_SECT : -if (match_int (args, &token)) { + ret =match_int (args, &token); +if (ret) {pr_warn ("bad max sect parameter '%s'\n" , p); goto out; }
@@ -3478,8 +3480,15 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_QUEUE_SIZE : -if (match_int (args, &token) || token <1 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for queue_size parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 ) {pr_warn ("bad queue_size parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->scsi_host->can_queue = token;
@@ -3490,25 +3499,40 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_MAX_CMD_PER_LUN : -if (match_int (args, &token) || token <1 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for max cmd_per_lun parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 ) {pr_warn ("bad max cmd_per_lun parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->scsi_host->cmd_per_lun = token;break ;case SRP_OPT_TARGET_CAN_QUEUE : -if (match_int (args, &token) || token <1 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for max target_can_queue parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 ) {pr_warn ("bad max target_can_queue parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->target_can_queue = token;break ;case SRP_OPT_IO_CLASS : -if (match_hex (args, &token)) { + ret =match_hex (args, &token); +if (ret) {pr_warn ("bad IO class parameter '%s'\n" , p); goto out; }
@@ -3517,6 +3541,7 @@ static int srp_parse_options(struct net *net, const char *buf,pr_warn ("unknown IO class parameter value %x specified (use %x or %x).\n" , token,SRP_REV10_IB_IO_CLASS ,SRP_REV16A_IB_IO_CLASS ); + ret = -EINVAL ; goto out; } target->io_class = token;
@@ -3539,16 +3564,24 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_CMD_SG_ENTRIES : -if (match_int (args, &token) || token <1 || token >255 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for max cmd_sg_entries parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 || token >255 ) {pr_warn ("bad max cmd_sg_entries parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->cmd_sg_cnt = token;break ;case SRP_OPT_ALLOW_EXT_SG : -if (match_int (args, &token)) { + ret =match_int (args, &token); +if (ret) {pr_warn ("bad allow_ext_sg parameter '%s'\n" , p); goto out; }
@@ -3556,43 +3589,77 @@ static int srp_parse_options(struct net *net, const char *buf,break ;case SRP_OPT_SG_TABLESIZE : -if (match_int (args, &token) || token <1 || - token >SG_MAX_SEGMENTS ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for max sg_tablesize parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 || token >SG_MAX_SEGMENTS ) {pr_warn ("bad max sg_tablesize parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->sg_tablesize = token;break ;case SRP_OPT_COMP_VECTOR : -if (match_int (args, &token) || token <0 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for comp_vector parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <0 ) {pr_warn ("bad comp_vector parameter '%s'\n" , p); + ret = -EINVAL ; goto out; } target->comp_vector = token;break ;case SRP_OPT_TL_RETRY_COUNT : -if (match_int (args, &token) || token <2 || token >7 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for tl_retry_count parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <2 || token >7 ) {pr_warn ("bad tl_retry_count parameter '%s' (must be a number between 2 and 7)\n" , p); + ret = -EINVAL ; goto out; } target->tl_retry_count = token;break ;case SRP_OPT_MAX_IT_IU_SIZE : -if (match_int (args, &token) || token <0 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for max it_iu_size parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <0 ) {pr_warn ("bad maximum initiator to target IU size '%s'\n" , p); + ret = -EINVAL ; goto out; } target->max_it_iu_size = token;break ;case SRP_OPT_CH_COUNT : -if (match_int (args, &token) || token <1 ) { + ret =match_int (args, &token); +if (ret) { +pr_warn ("match_int() failed for channel count parameter '%s', Error %d\n" , + p, ret); + goto out; + } +if (token <1 ) {pr_warn ("bad channel count %s\n" , p); + ret = -EINVAL ; goto out; } target->ch_count = token;
@@ -3601,6 +3668,7 @@ static int srp_parse_options(struct net *net, const char *buf,default :pr_warn ("unknown parameter or missing value '%s' in target creation request\n" , p); + ret = -EINVAL ; goto out; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 669/1146 PCI: vmd: Fix secondary bus reset for Intel bridges
In reply to Greg Kroah-HartmanFrom: Francisco Munoz <[email protected]>
[ Upstream commit 0a584655ef89541dae4d48d2c523b1480ae80284 ]
The reset was never applied in the current implementation because Intel Bridges owned by VMD are parentless. Internally, pci_reset_bus() applies a reset to the parent of the PCI device supplied as argument, but in this case it failed because there wasn't a parent.
In more detail, this change allows the VMD driver to enumerate NVMe devices in pass-through configurations when guest reboots are performed. There was an attempted to fix this, but later we discovered that the code inside pci_reset_bus() wasn’t triggering secondary bus resets. Therefore, we updated the parameters passed to it, and now NVMe SSDs attached to VMD bridges are properly enumerated in VT-d pass-through scenarios.
--- drivers/pci/controller/vmd.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/pci/controller/vmd.c +20 -2
@@ -719,6 +719,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)resource_size_t offset[2 ] = {0 };resource_size_t membar2_offset =0x2000 ;struct pci_bus *child; +struct pci_dev *dev;int ret;/*
@@ -859,8 +860,25 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)pci_scan_child_bus (vmd->bus);vmd_domain_reset (vmd); -list_for_each_entry (child, &vmd->bus->children, node) -pci_reset_bus (child->self); + +/* When Intel VMD is enabled, the OS does not discover the Root Ports +* owned by Intel VMD within the MMCFG space. pci_reset_bus() applies +* a reset to the parent of the PCI device supplied as argument. This +* is why we pass a child device, so the reset can be triggered at +* the Intel bridge level and propagated to all the children in the +* hierarchy. +*/ +list_for_each_entry (child, &vmd->bus->children, node) { +if (!list_empty (&child->devices)) { + dev =list_first_entry (&child->devices, + struct pci_dev, bus_list); +if (pci_reset_bus (dev)) +pci_warn (dev,"can't reset device: %d\n" , ret); + +break ; + } + } +pci_assign_unassigned_bus_resources (vmd->bus);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 670/1146 orangefs: Fix sysfs not cleanup when dev init failed
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit ea60a4ad0cf88b411cde6888b8c890935686ecd7 ]
When the dev init failed, should cleanup the sysfs, otherwise, the module will never be loaded since can not create duplicate sysfs directory:
sysfs: cannot create duplicate filename '/fs/orangefs'
CPU: 1 PID: 6549 Comm: insmod Tainted: G W 6.0.0+ #44 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x34/0x44 sysfs_warn_dup.cold+0x17/0x24 sysfs_create_dir_ns+0x16d/0x180 kobject_add_internal+0x156/0x3a0 kobject_init_and_add+0xcf/0x120 orangefs_sysfs_init+0x7e/0x3a0 [orangefs] orangefs_init+0xfe/0x1000 [orangefs] do_one_initcall+0x87/0x2a0 do_init_module+0xdf/0x320 load_module+0x2f98/0x3330 __do_sys_finit_module+0x113/0x1b0 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0
kobject_add_internal failed for orangefs with -EEXIST, don't try to register things with the same name in the same directory.
--- fs/orangefs/orangefs-mod.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/orangefs/orangefs-mod.c +4 -4
@@ -141,7 +141,7 @@ static int __init orangefs_init(void)gossip_err ("%s: could not initialize device subsystem %d!\n" , __func__, ret); - goto cleanup_device; + goto cleanup_sysfs; } ret =register_filesystem (&orangefs_fs_type);
@@ -152,11 +152,11 @@ static int __init orangefs_init(void) goto out; } -orangefs_sysfs_exit (); - -cleanup_device:orangefs_dev_cleanup (); +cleanup_sysfs: +orangefs_sysfs_exit (); + sysfs_init_failed:orangefs_debugfs_cleanup ();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 671/1146 RDMA/hns: Fix the gid problem caused by free mr
In reply to Greg Kroah-HartmanFrom: Yixing Liu <[email protected]>
[ Upstream commit 487d65090a3dce1ae54946aded55d0f8ac87cbab ]
After the hns roce driver is loaded, if you modify the mac address of the network port, the following error will appear:
__ib_cache_gid_add: unable to add gid fe80:0000:0000:0000:4600:4dff:fe22:abb5 error=-28
hns3 0000:7d:00.0 hns_0: attr path_mtu(1) invalid while modify qp
The reason for the error is that the gid being occupied will cause the failure to modify the gid. The gid is occupied by the loopback QP used by free mr. When the mac address is modified, the gid will change. If there is a busy QP at this time, the gid will not be released and the modification will fail. The QP of free mr is created using the ib interface. The ib interface will add a reference count to the gid, resulting in this error scenario.
Considering that free mr is solving a bug in HIP08, not an actual business, it is not necessary to use ib interfaces.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 175 ++++++++++++++++----- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 8 +- 2 files changed, 137 insertions(+), 46 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +132 -43
@@ -2630,31 +2630,124 @@ static void free_dip_list(struct hns_roce_dev *hr_dev)spin_unlock_irqrestore (&hr_dev->dip_list_lock, flags); } -static void free_mr_exit (struct hns_roce_dev *hr_dev) +static struct ib_pd *free_mr_init_pd (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_v2_priv *priv = hr_dev->priv; +struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; +struct ib_device *ibdev = &hr_dev->ib_dev; +struct hns_roce_pd *hr_pd; +struct ib_pd *pd; + + hr_pd =kzalloc (sizeof (*hr_pd),GFP_KERNEL ); +if (ZERO_OR_NULL_PTR (hr_pd)) +return NULL ; + pd = &hr_pd->ibpd; + pd->device = ibdev; + +if (hns_roce_alloc_pd (pd,NULL )) { +ibdev_err (ibdev,"failed to create pd for free mr.\n" ); +kfree (hr_pd); +return NULL ; + } + free_mr->rsv_pd =to_hr_pd (pd); + free_mr->rsv_pd->ibpd.device = &hr_dev->ib_dev; + free_mr->rsv_pd->ibpd.uobject =NULL ; + free_mr->rsv_pd->ibpd.__internal_mr =NULL ; +atomic_set (&free_mr->rsv_pd->ibpd.usecnt,0 ); + +return pd; +} + +static struct ib_cq *free_mr_init_cq (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_v2_priv *priv = hr_dev->priv; +struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; +struct ib_device *ibdev = &hr_dev->ib_dev; +struct ib_cq_init_attr cq_init_attr = {}; +struct hns_roce_cq *hr_cq; +struct ib_cq *cq; + + cq_init_attr.cqe =HNS_ROCE_FREE_MR_USED_CQE_NUM ; + + hr_cq =kzalloc (sizeof (*hr_cq),GFP_KERNEL ); +if (ZERO_OR_NULL_PTR (hr_cq)) +return NULL ; + + cq = &hr_cq->ib_cq; + cq->device = ibdev; + +if (hns_roce_create_cq (cq, &cq_init_attr,NULL )) { +ibdev_err (ibdev,"failed to create cq for free mr.\n" ); +kfree (hr_cq); +return NULL ; + } + free_mr->rsv_cq =to_hr_cq (cq); + free_mr->rsv_cq->ib_cq.device = &hr_dev->ib_dev; + free_mr->rsv_cq->ib_cq.uobject =NULL ; + free_mr->rsv_cq->ib_cq.comp_handler =NULL ; + free_mr->rsv_cq->ib_cq.event_handler =NULL ; + free_mr->rsv_cq->ib_cq.cq_context =NULL ; +atomic_set (&free_mr->rsv_cq->ib_cq.usecnt,0 ); + +return cq; +} + +static int free_mr_init_qp (struct hns_roce_dev *hr_dev,struct ib_cq *cq, +struct ib_qp_init_attr *init_attr,int i) {struct hns_roce_v2_priv *priv = hr_dev->priv;struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; +struct ib_device *ibdev = &hr_dev->ib_dev; +struct hns_roce_qp *hr_qp; +struct ib_qp *qp;int ret; + + hr_qp =kzalloc (sizeof (*hr_qp),GFP_KERNEL ); +if (ZERO_OR_NULL_PTR (hr_qp)) +return -ENOMEM ; + + qp = &hr_qp->ibqp; + qp->device = ibdev; + + ret =hns_roce_create_qp (qp, init_attr,NULL ); +if (ret) { +ibdev_err (ibdev,"failed to create qp for free mr.\n" ); +kfree (hr_qp); +return ret; + } + + free_mr->rsv_qp[i] = hr_qp; + free_mr->rsv_qp[i]->ibqp.recv_cq = cq; + free_mr->rsv_qp[i]->ibqp.send_cq = cq; + +return 0 ; +} + +static void free_mr_exit (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_v2_priv *priv = hr_dev->priv; +struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; +struct ib_qp *qp;int i;for (i =0 ; i <ARRAY_SIZE (free_mr->rsv_qp); i++) {if (free_mr->rsv_qp[i]) { - ret =ib_destroy_qp (free_mr->rsv_qp[i]); -if (ret) -ibdev_err (&hr_dev->ib_dev, -"failed to destroy qp in free mr.\n" ); - + qp = &free_mr->rsv_qp[i]->ibqp; +hns_roce_v2_destroy_qp (qp,NULL ); +kfree (free_mr->rsv_qp[i]); free_mr->rsv_qp[i] =NULL ; } }if (free_mr->rsv_cq) { -ib_destroy_cq (free_mr->rsv_cq); +hns_roce_destroy_cq (&free_mr->rsv_cq->ib_cq,NULL ); +kfree (free_mr->rsv_cq); free_mr->rsv_cq =NULL ; }if (free_mr->rsv_pd) { -ib_dealloc_pd (free_mr->rsv_pd); +hns_roce_dealloc_pd (&free_mr->rsv_pd->ibpd,NULL ); +kfree (free_mr->rsv_pd); free_mr->rsv_pd =NULL ; } }
@@ -2663,55 +2756,46 @@ static int free_mr_alloc_res(struct hns_roce_dev *hr_dev) {struct hns_roce_v2_priv *priv = hr_dev->priv;struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; -struct ib_device *ibdev = &hr_dev->ib_dev; -struct ib_cq_init_attr cq_init_attr = {};struct ib_qp_init_attr qp_init_attr = {};struct ib_pd *pd;struct ib_cq *cq; -struct ib_qp *qp;int ret;int i; - pd =ib_alloc_pd (ibdev,0 ); -if (IS_ERR (pd)) { -ibdev_err (ibdev,"failed to create pd for free mr.\n" ); -return PTR_ERR (pd); - } - free_mr->rsv_pd = pd; + pd =free_mr_init_pd (hr_dev); +if (!pd) +return -ENOMEM ; - cq_init_attr.cqe =HNS_ROCE_FREE_MR_USED_CQE_NUM ; - cq =ib_create_cq (ibdev,NULL ,NULL ,NULL , &cq_init_attr); -if (IS_ERR (cq)) { -ibdev_err (ibdev,"failed to create cq for free mr.\n" ); - ret =PTR_ERR (cq); - goto create_failed; + cq =free_mr_init_cq (hr_dev); +if (!cq) { + ret = -ENOMEM ; + goto create_failed_cq; } - free_mr->rsv_cq = cq; qp_init_attr.qp_type =IB_QPT_RC ; qp_init_attr.sq_sig_type =IB_SIGNAL_ALL_WR ; - qp_init_attr.send_cq = free_mr->rsv_cq; - qp_init_attr.recv_cq = free_mr->rsv_cq; + qp_init_attr.send_cq = cq; + qp_init_attr.recv_cq = cq;for (i =0 ; i <ARRAY_SIZE (free_mr->rsv_qp); i++) { qp_init_attr.cap.max_send_wr =HNS_ROCE_FREE_MR_USED_SQWQE_NUM ; qp_init_attr.cap.max_send_sge =HNS_ROCE_FREE_MR_USED_SQSGE_NUM ; qp_init_attr.cap.max_recv_wr =HNS_ROCE_FREE_MR_USED_RQWQE_NUM ; qp_init_attr.cap.max_recv_sge =HNS_ROCE_FREE_MR_USED_RQSGE_NUM ; - qp =ib_create_qp (free_mr->rsv_pd, &qp_init_attr); -if (IS_ERR (qp)) { -ibdev_err (ibdev,"failed to create qp for free mr.\n" ); - ret =PTR_ERR (qp); - goto create_failed; - } - - free_mr->rsv_qp[i] = qp; + ret =free_mr_init_qp (hr_dev, cq, &qp_init_attr, i); +if (ret) + goto create_failed_qp; }return 0 ; -create_failed: -free_mr_exit (hr_dev); +create_failed_qp: +hns_roce_destroy_cq (cq,NULL ); +kfree (cq); + +create_failed_cq: +hns_roce_dealloc_pd (pd,NULL ); +kfree (pd);return ret; }
@@ -2727,14 +2811,17 @@ static int free_mr_modify_rsv_qp(struct hns_roce_dev *hr_dev,int mask;int ret; - hr_qp =to_hr_qp (free_mr->rsv_qp[sl_num]); + hr_qp =to_hr_qp (&free_mr->rsv_qp[sl_num]->ibqp); hr_qp->free_mr_en =1 ; + hr_qp->ibqp.device = ibdev; + hr_qp->ibqp.qp_type =IB_QPT_RC ; mask =IB_QP_STATE |IB_QP_PKEY_INDEX |IB_QP_PORT |IB_QP_ACCESS_FLAGS ; attr->qp_state =IB_QPS_INIT ; attr->port_num =1 ; attr->qp_access_flags =IB_ACCESS_REMOTE_WRITE ; - ret =ib_modify_qp (&hr_qp->ibqp, attr, mask); + ret = hr_dev->hw->modify_qp (&hr_qp->ibqp, attr, mask,IB_QPS_INIT , +IB_QPS_INIT );if (ret) {ibdev_err (ibdev,"failed to modify qp to init, ret = %d.\n" , ret);
@@ -2755,7 +2842,8 @@ static int free_mr_modify_rsv_qp(struct hns_roce_dev *hr_dev,rdma_ah_set_sl (&attr->ah_attr, (u8 )sl_num); - ret =ib_modify_qp (&hr_qp->ibqp, attr, mask); + ret = hr_dev->hw->modify_qp (&hr_qp->ibqp, attr, mask,IB_QPS_INIT , +IB_QPS_RTR ); hr_dev->loop_idc = loopback;if (ret) { ibdev_err(ibdev, "failed to modify qp to rtr, ret = %d.\n",
@@ -2769,7 +2857,8 @@ static int free_mr_modify_rsv_qp(struct hns_roce_dev *hr_dev, attr->sq_psn =HNS_ROCE_FREE_MR_USED_PSN ; attr->retry_cnt =HNS_ROCE_FREE_MR_USED_QP_RETRY_CNT ; attr->timeout =HNS_ROCE_FREE_MR_USED_QP_TIMEOUT ; - ret =ib_modify_qp (&hr_qp->ibqp, attr, mask); + ret = hr_dev->hw->modify_qp (&hr_qp->ibqp, attr, mask,IB_QPS_RTR , +IB_QPS_RTS );if (ret)ibdev_err (ibdev,"failed to modify qp to rts, ret = %d.\n" , ret);
@@ -3413,7 +3502,7 @@ static void free_mr_send_cmd_to_hw(struct hns_roce_dev *hr_dev)mutex_lock (&free_mr->mutex);for (i =0 ; i <ARRAY_SIZE (free_mr->rsv_qp); i++) { - hr_qp =to_hr_qp (free_mr->rsv_qp[i]); + hr_qp = free_mr->rsv_qp[i]; ret =free_mr_post_send_lp_wqe (hr_qp);if (ret) {
@@ -3428,7 +3517,7 @@ static void free_mr_send_cmd_to_hw(struct hns_roce_dev *hr_dev) end =msecs_to_jiffies (HNS_ROCE_V2_FREE_MR_TIMEOUT ) + jiffies;while (cqe_cnt) { - npolled =hns_roce_v2_poll_cq (free_mr->rsv_cq, cqe_cnt, wc); + npolled =hns_roce_v2_poll_cq (&free_mr->rsv_cq->ib_cq, cqe_cnt, wc);if (npolled <0 ) { ibdev_err(ibdev, "failed to poll cqe for free mr, remain %d cqe.\n",
@@ -5467,7 +5556,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev,return ret; } -static int hns_roce_v2_destroy_qp (struct ib_qp *ibqp,struct ib_udata *udata) +int hns_roce_v2_destroy_qp (struct ib_qp *ibqp,struct ib_udata *udata) {struct hns_roce_dev *hr_dev =to_hr_dev (ibqp->device);struct hns_roce_qp *hr_qp =to_hr_qp (ibqp);
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +5 -3
@@ -1327,9 +1327,9 @@ struct hns_roce_link_table {#define HNS_ROCE_EXT_LLM_MIN_PAGES (que_num) ((que_num) * 4 + 2)struct hns_roce_v2_free_mr { -struct ib_qp *rsv_qp[HNS_ROCE_FREE_MR_USED_QP_NUM ]; -struct ib_cq *rsv_cq; -struct ib_pd *rsv_pd; +struct hns_roce_qp *rsv_qp[HNS_ROCE_FREE_MR_USED_QP_NUM ]; +struct hns_roce_cq *rsv_cq; +struct hns_roce_pd *rsv_pd;struct mutex mutex; };
@@ -1459,6 +1459,8 @@ struct hns_roce_sccc_clr_done {__le32 rsv[5 ]; }; +int hns_roce_v2_destroy_qp (struct ib_qp *ibqp,struct ib_udata *udata); +static inline void hns_roce_write64 (struct hns_roce_dev *hr_dev,__le32 val[2 ],void __iomem *dest) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 672/1146 RDMA/hns: Fix AH attr queried by query_qp
In reply to Greg Kroah-HartmanFrom: Chengchang Tang <[email protected]>
[ Upstream commit bc34c04f7b97c3794dec5a6d6d27ffd5f0e4f5c8 ]
The queried AH attr is invalid. This patch fix it.
This problem is found by rdma-core test test_mr_rereg_pd
ERROR: test_mr_rereg_pd (tests.test_mr.MRTest)
Test that cover rereg MR's PD with this flow:
----------------------------------------------------------------------
Traceback (most recent call last):
File "./tests/test_mr.py", line 157, in test_mr_rereg_pd
self.restate_qps()
File "./tests/test_mr.py", line 113, in restate_qps
self.server.qp.to_rts(self.server_qp_attr)
File "qp.pyx", line 1137, in pyverbs.qp.QP.to_rts
File "qp.pyx", line 1123, in pyverbs.qp.QP.to_rtr
pyverbs.pyverbs_error.PyverbsRDMAError: Failed to modify QP state to RTR.
Errno: 22, Invalid argument
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -0
@@ -5463,6 +5463,8 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,rdma_ah_set_sl (&qp_attr->ah_attr,hr_reg_read (&context,QPC_SL )); +rdma_ah_set_port_num (&qp_attr->ah_attr, hr_qp->port +1 ); +rdma_ah_set_ah_flags (&qp_attr->ah_attr,IB_AH_GRH ); grh->flow_label =hr_reg_read (&context,QPC_FL ); grh->sgid_index =hr_reg_read (&context,QPC_GMV_IDX ); grh->hop_limit =hr_reg_read (&context,QPC_HOPLIMIT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 673/1146 RDMA/hns: Fix PBL page MTR find
In reply to Greg Kroah-HartmanFrom: Chengchang Tang <[email protected]>
[ Upstream commit 9fb39ef2ff3e18f1740625ba04093dfbef086d2b ]
Now, The address of the first two pages in the MR will be searched, which use to speed up the lookup of the pbl table for hardware. An exception will occur when there is only one page in this MR. This patch fix the number of page to search.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -1
@@ -3274,7 +3274,8 @@ static int set_mtpt_pbl(struct hns_roce_dev *hr_dev,int i, count; count =hns_roce_mtr_find (hr_dev, &mr->pbl_mtr,0 , pages, -ARRAY_SIZE (pages), &pbl_ba); +min_t (int,ARRAY_SIZE (pages), mr->npages), + &pbl_ba);if (count <1 ) {ibdev_err (ibdev,"failed to find PBL mtr, count = %d.\n" , count);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 674/1146 RDMA/hns: Fix page size cap from firmware
In reply to Greg Kroah-HartmanFrom: Chengchang Tang <[email protected]>
[ Upstream commit 99dc5a0712883d5d13b620d25b3759d429577bc8 ]
Add verification to make sure the roce page size cap is supported by the system page size.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -0
@@ -2341,6 +2341,9 @@ static int hns_roce_query_pf_caps(struct hns_roce_dev *hr_dev) caps->wqe_sge_hop_num =hr_reg_read (resp_d,PF_CAPS_D_EX_SGE_HOP_NUM ); caps->wqe_rq_hop_num =hr_reg_read (resp_d,PF_CAPS_D_RQWQE_HOP_NUM ); +if (!(caps->page_size_cap &PAGE_SIZE )) + caps->page_size_cap =HNS_ROCE_V2_PAGE_SIZE_SUPPORTED ; +return 0 ; }
Signature · 1 line
2.35.1