7.2.6-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 1720/1815 Bluetooth: btmtk: Do not discard the subsystem reset timeout
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ismail Tarim <[email protected]>
[ Upstream commit 21b50c24843b51f88ac4316dd470d2803da0c42f ]
When the MTK_BT_RST_DONE poll times out, btmtk_usb_subsys_reset() logs "Reset timeout" and keeps the error in err, but err is then overwritten by the return value of the following btmtk_usb_id_get() call, so the timeout is never reported to the caller.
Commit 25b6d7593a3a ("Bluetooth: btmtk: introduce btmtk reset work") discarded the return value of the chip id read, so the function returned the timeout error as intended. Commit 3dcb122b3064 ("Bluetooth: btusb:
mediatek: return error for failed reg access") started assigning err at that call and silently dropped it.
Keep the timeout in a separate variable and return it, restoring the original behaviour without changing the control flow.
--- drivers/bluetooth/btmtk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/bluetooth/btmtk.c +5 -2
@@ -860,6 +860,7 @@ static u32 btmtk_usb_reset_done(struct hci_dev *hdev)int btmtk_usb_subsys_reset (struct hci_dev *hdev,u32 dev_id) { +int reset_err =0 ;u32 val;int err;
@@ -958,8 +959,10 @@ int btmtk_usb_subsys_reset(struct hci_dev *hdev, u32 dev_id) err =readx_poll_timeout (btmtk_usb_reset_done, hdev, val, val &MTK_BT_RST_DONE ,20000 ,1000000 ); -if (err <0 ) +if (err <0 ) {bt_dev_err (hdev,"Reset timeout" ); + reset_err = err; + }if (dev_id ==0x7922 ) { err =btmtk_usb_uhw_reg_write (hdev,MTK_UDMA_INT_STA_BT ,0x000000FF );
@@ -973,7 +976,7 @@ int btmtk_usb_subsys_reset(struct hci_dev *hdev, u32 dev_id)return err ? err : -ENODEV ; } -return err; +return reset_err; }EXPORT_SYMBOL_GPL (btmtk_usb_subsys_reset);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1721/1815 Bluetooth: btmtksdio: Take exclusive ownership of the SKB before TX
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <[email protected]>
[ Upstream commit 155e3003d1e614f85566b636973df7118e1b4851 ]
btmtksdio_tx_packet() prepends the MediaTek SDIO header with skb_push() and writes into that space after only checking the headroom size. On a cloned SKB that headroom belongs to a buffer shared with the other owner, which the driver has no right to write to.
Cloned SKBs do reach this path: hci_send_cmd_sync() keeps a clone of every HCI command in hdev->sent_cmd before handing the SKB to the driver, and l2cap_ertm_send() clones SKBs for retransmission.
Replace the open-coded headroom check with skb_cow_head(), which both guarantees the headroom and reallocates a private buffer when the SKB is cloned. The cost is one reallocation and copy per cloned packet, the usual price of this pattern in network drivers.
This has no observable effect on its own, as the driver only writes in front of skb->data where no other owner looks. It is a prerequisite for "Bluetooth: btmtksdio: Fix out-of-bounds DMA read in the TX path", which writes padding behind skb->tail, and carries the same Fixes: tag so that both are backported together.
--- drivers/bluetooth/btmtksdio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/bluetooth/btmtksdio.c +6 -7
@@ -274,13 +274,12 @@ static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev,struct mtkbtsdio_hdr *sdio_hdr;int err; -/* Make sure that there are enough rooms for SDIO header */ -if (unlikely (skb_headroom (skb) <sizeof (*sdio_hdr))) { - err =pskb_expand_head (skb,sizeof (*sdio_hdr),0 , -GFP_ATOMIC ); -if (err <0 ) -return err; - } +/* Make sure that the data buffer is not shared with anyone else and +* that there is enough room for the SDIO header +*/ + err =skb_cow_head (skb,sizeof (*sdio_hdr)); +if (err <0 ) +return err;/* Prepend MediaTek SDIO Specific Header */ skb_push (skb,sizeof (*sdio_hdr));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1722/1815 Bluetooth: btmtksdio: Fix out-of-bounds DMA read in the TX path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <[email protected]>
[ Upstream commit fa0ad2d277c7adead61d1c22411c55cea6990c2a ]
btmtksdio_tx_packet() rounds the transfer size up to the SDIO block size of 256 bytes, but hands the host controller the SKB buffer as is:
err = sdio_writesb(bdev->func, MTK_REG_CTDR, skb->data, round_up(skb->len, MTK_SDIO_BLOCK_SIZE));
Only skb->len bytes hold packet data, so the controller reads up to 255 bytes of uninitialised memory and sends it to the device over the SDIO bus. Depending on how much tailroom slack the SKB allocation happens to carry, that read can also extend past the end of the buffer.
Compute the padded length up front, ensure the SKB has tailroom for it, and zero-fill the padding with skb_put_zero(). skb->len then covers the padding, so sdio_writesb() no longer needs to round up. byte_tx keeps counting the header and the payload only, and the error path restores the SKB so that the caller can requeue it.
Writing behind skb->tail is only safe because the driver owns the buffer, which "Bluetooth: btmtksdio: Take exclusive ownership of the SKB before TX" ensures.
--- drivers/bluetooth/btmtksdio.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/bluetooth/btmtksdio.c +21 -5
@@ -272,6 +272,7 @@ static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev, struct sk_buff *skb) {struct mtkbtsdio_hdr *sdio_hdr; +unsigned int len, pad_len;int err;/* Make sure that the data buffer is not shared with anyone else and
@@ -281,6 +282,18 @@ static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev,if (err <0 )return err; +/* The transfer is rounded up to the SDIO block size, so the buffer +* has to provide tailroom for the padding as well +*/ + len = skb->len +sizeof (*sdio_hdr); + pad_len =round_up (len,MTK_SDIO_BLOCK_SIZE ) - len; + +if (unlikely (skb_tailroom (skb) < pad_len)) { + err =pskb_expand_head (skb,0 , pad_len,GFP_ATOMIC ); +if (err <0 ) +return err; + } +/* Prepend MediaTek SDIO Specific Header */ skb_push (skb,sizeof (*sdio_hdr));
@@ -289,19 +302,22 @@ static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev, sdio_hdr->reserved =cpu_to_le16 (0 ); sdio_hdr->bt_type =hci_skb_pkt_type (skb); +/* Zero the padding so that no uninitialised memory is sent out */ +skb_put_zero (skb, pad_len); +clear_bit (BTMTKSDIO_HW_TX_READY , &bdev->tx_state); - err =sdio_writesb (bdev->func,MTK_REG_CTDR , skb->data, -round_up (skb->len,MTK_SDIO_BLOCK_SIZE )); + err =sdio_writesb (bdev->func,MTK_REG_CTDR , skb->data, skb->len);if (err <0 ) - goto err_skb_pull; + goto err_skb_restore; - bdev->hdev->stat.byte_tx += skb->len; + bdev->hdev->stat.byte_tx += len;kfree_skb (skb);return 0 ; -err_skb_pull: +err_skb_restore: +skb_trim (skb, len);skb_pull (skb,sizeof (*sdio_hdr));return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1723/1815 Bluetooth: hci_sync: add conditional locking annotations
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 5b9b68abb5fa548478e20ee38a0ef5c18e9cf4b7 ]
Add context analysis annotations to functions doing conditional locking, to suppress analysis warnings.
--- net/bluetooth/hci_sync.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/hci_sync.c +5 -0
@@ -1287,6 +1287,7 @@ hci_set_ext_adv_params_sync(struct hci_dev *hdev, u8 instance, }static int hci_set_ext_adv_data_sync (struct hci_dev *hdev,u8 instance) +__context_unsafe (/* conditional locking */ ) { DEFINE_FLEX(struct hci_cp_le_set_ext_adv_data, pdu, data, length, HCI_MAX_EXT_AD_LENGTH);
@@ -1375,6 +1376,7 @@ int hci_update_adv_data_sync(struct hci_dev *hdev, u8 instance) }int hci_setup_ext_adv_instance_sync (struct hci_dev *hdev,u8 instance) +__context_unsafe (/* conditional locking */ ) {struct hci_cp_le_set_ext_adv_params cp;struct hci_rp_le_set_ext_adv_params rp;
@@ -1531,6 +1533,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance) }static int hci_set_ext_scan_rsp_data_sync (struct hci_dev *hdev,u8 instance) +__context_unsafe (/* conditional locking */ ) { DEFINE_FLEX(struct hci_cp_le_set_ext_scan_rsp_data, pdu, data, length, HCI_MAX_EXT_AD_LENGTH);
@@ -1584,6 +1587,7 @@ static int hci_set_ext_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance) }static int __hci_set_scan_rsp_data_sync (struct hci_dev *hdev,u8 instance) +__context_unsafe (/* conditional locking */ ) {struct hci_cp_le_set_scan_rsp_data cp;u8 len;
@@ -1725,6 +1729,7 @@ static int hci_set_per_adv_params_sync(struct hci_dev *hdev, u8 instance, }static int hci_set_per_adv_data_sync (struct hci_dev *hdev,u8 instance) +__context_unsafe (/* conditional locking */ ) { DEFINE_FLEX(struct hci_cp_le_set_per_adv_data, pdu, data, length, HCI_MAX_PER_AD_LENGTH);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1724/1815 Bluetooth: btnxpuart: Validate the FW dump header length
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ali Ahmet Memis <[email protected]>
[ Upstream commit 060fa7592bdc043a93b6b7870f5b8551206d315d ]
nxp_process_fw_dump() pulls the ACL header off the frame and then reads seq_num and buf_len from a struct nxp_fw_dump_hdr placed at skb->data, without checking that the ACL payload is long enough to contain it.
h4_recv_buf() collects HCI_ACL_HDR_SIZE bytes of header followed by the number of payload bytes named in that header, so skb->len is 4 + dlen with dlen supplied by the controller and possibly smaller than the 8 byte dump header, or zero. A short frame with connection handle 0xfff therefore reads both fields from beyond the received data.
Beyond the read itself, buf_len is what terminates a dump: a value of zero makes the driver call hci_devcd_complete() and reset the controller, so a truncated frame can end a dump early.
Use skb_pull_data() to validate and pull the FW dump header before accessing its fields. Warn and reject the chunk if the header is truncated.
--- drivers/bluetooth/btnxpuart.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/bluetooth/btnxpuart.c +12 -3
@@ -1368,12 +1368,21 @@ static int nxp_process_fw_dump(struct hci_dev *hdev, struct sk_buff *skb) {struct hci_acl_hdr *acl_hdr = (struct hci_acl_hdr *)skb_pull_data (skb,sizeof (*acl_hdr)); -struct nxp_fw_dump_hdr *fw_dump_hdr = (struct nxp_fw_dump_hdr *)skb->data; +struct nxp_fw_dump_hdr *fw_dump_hdr;struct btnxpuart_dev *nxpdev =hci_get_drvdata (hdev); -__u16 seq_num =__le16_to_cpu (fw_dump_hdr->seq_num); -__u16 buf_len =__le16_to_cpu (fw_dump_hdr->buf_len); +__u16 seq_num; +__u16 buf_len;int err; + fw_dump_hdr =skb_pull_data (skb,sizeof (*fw_dump_hdr)); +if (!fw_dump_hdr) { +bt_dev_warn (hdev,"FW dump: invalid or corrupt fw dump chunk" ); + goto free_skb; + } + + seq_num =__le16_to_cpu (fw_dump_hdr->seq_num); + buf_len =__le16_to_cpu (fw_dump_hdr->buf_len); +if (seq_num ==0x0001 ) {if (test_and_set_bit (BTNXPUART_FW_DUMP_IN_PROGRESS , &nxpdev->tx_state)) {bt_dev_err (hdev,"FW dump already in progress" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1725/1815 Bluetooth: RFCOMM: Validate MTU in rfcomm_apply_pn() to prevent infinite loop
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
[ Upstream commit 44c98fd082eafd49d55a8a4077ff488175b2fe24 ]
rfcomm_apply_pn() accepts the MTU value from a remote PN (Parameter Negotiation) frame without checking for zero. When the remote peer sends an MTU of zero, d->mtu is set to 0. This causes the sendmsg path to enter an infinite loop when fragmenting data, as each fragment has size == min_t(size_t, len, 0) == 0, so the remaining length never decreases. The infinite allocation of zero-length skbs exhausts all system memory.
Fix by clamping d->mtu to RFCOMM_DEFAULT_MTU when the negotiated value is zero, consistent with the initial value assigned in rfcomm_dlc_alloc().
--- net/bluetooth/rfcomm/core.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/rfcomm/core.c +4 -0
@@ -1455,6 +1455,10 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn) d->mtu =__le16_to_cpu (pn->mtu); +/* MTU 0 causes an infinite loop when fragmenting in sendmsg */ +if (!d->mtu) + d->mtu =RFCOMM_DEFAULT_MTU ; +if (cr && d->mtu > s->mtu) d->mtu = s->mtu;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1726/1815 Bluetooth: do not leak an hci_conn when a second LE connect is rejected
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radek Podgorny <[email protected]>
[ Upstream commit 7e1e4047200fd7519f9bdfe8a001437715e618b4 ]
create_le_conn_complete() decides whether the failed connection is still pending by comparing it against hci_lookup_le_connect(), which returns the first LE connection in BT_CONNECT. That is the same connection only while at most one is pending.
Two can be pending. Connections created on the passive scan path sit in BT_CONNECT with HCI_CONN_SCANNING set and are invisible to hci_lookup_le_connect() until hci_le_create_conn_sync() clears the flag when their command is issued, so the -EBUSY guard in hci_connect_le() does not prevent a second connection from being queued while the first is still on the scan path. Whenever two connections are in BT_CONNECT at once, the lookup may return one connection while create_le_conn_complete() is reporting the failure of the other; the early exit then drops the error and hci_conn_failed() never runs on the connection that failed.
The controller also rejects a second HCI_OP_LE_CREATE_CONN issued while another connection creation is still outstanding, per Core Spec Vol 4, Part E. The spec calls for Command Disallowed there; the bcm43438 observed here answers with an LMP/LL error code instead, which bt_to_errno() maps to the -EPROTO (-71) in the log below.
The leaked connection stays in BT_CONNECT forever, and because hci_connect_le() refuses to dial while hci_lookup_le_connect() finds anything, every subsequent attempt to reach any peer fails with -EBUSY and no command reaches the controller at all.
Seen on a bcm43438 with two BLE peers polled on the same interval (state 5 is BT_CONNECT; both handles are UNSET ones, allocated from the ida above HCI_CONN_HANDLE_MAX):
Bluetooth: hci1: Opcode 0x2013 failed: -71
# hcitool con
< LE 14:9C:EF:03:68:81 handle 3840 state 5 lm CENTRAL
< LE C4:D3:6A:8C:B5:38 handle 3841 state 5 lm CENTRALA btmon capture across the next ten minutes of connect attempts contains no HCI_OP_LE_CREATE_CONN at all; outgoing LE connections do not recover until the adapter is reset. With this change the same scenario fails the rejected connection cleanly and further connects to both peers go through.
Ask about the connection itself instead of about the device.
--- net/bluetooth/hci_sync.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/bluetooth/hci_sync.c +7 -2
@@ -7221,8 +7221,13 @@ static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err) goto unlock; } -/* Check if connection is still pending */ -if (conn !=hci_lookup_le_connect (hdev)) +/* Check if this connection is still pending. +* +* hci_lookup_le_connect() returns only the first LE connection +* in BT_CONNECT, which is not necessarily this one when two are +* pending at once, so ask the connection itself. +*/ +if (conn->state !=BT_CONNECT ) goto unlock;/* Flush to make sure we send create conn cancel command if needed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1727/1815 xsk: align TX metadata layout across ABIs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit bd7d30bd1d3856d8354b5acef947d68ad1faf886 ]
Add explicit padding before launch_time so xsk_tx_metadata has the same layout on 32-bit and 64-bit systems.
On several architectures (csky, i386, nios2, m65k, openrisc, sh), the old native 32-bit layout put launch_time at offset 12 and had a natural size of 20 bytes. Using sizeof(struct xsk_tx_metadata) as tx_metadata_len was already rejected because the length must be a multiple of eight, so the straightforward use of the interface was broken on those ABIs. Userspace could still register a padded length of 24 bytes, though; mixing the old and new layouts then silently reads launch_time from the wrong offset and misprograms packet launch times. This intentionally replaces that incompatible layout because the affected architectures are unlikely to have any notable users. (x86_64 and arm64 have the most users and are _not_ affected)
--- include/uapi/linux/if_xdp.h | 1 + tools/include/uapi/linux/if_xdp.h | 1 + 2 files changed, 2 insertions(+)
include/uapi/linux/if_xdp.h +1 -0
@@ -149,6 +149,7 @@ struct xsk_tx_metadata {__u16 csum_start;/* Offset from csum_start where checksum should be stored. */ __u16 csum_offset; +__u32 reserved;/* XDP_TXMD_FLAGS_LAUNCH_TIME */ /* Launch time in nanosecond against the PTP HW Clock */
tools/include/uapi/linux/if_xdp.h +1 -0
@@ -149,6 +149,7 @@ struct xsk_tx_metadata {__u16 csum_start;/* Offset from csum_start where checksum should be stored. */ __u16 csum_offset; +__u32 reserved;/* XDP_TXMD_FLAGS_LAUNCH_TIME */ /* Launch time in nanosecond against the PTP HW Clock */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1728/1815 xsk: honor XDP_TX_METADATA in zero-copy path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit a6e4b9a6deb9362ef7a0706c70d674e92fe1411a ]
The zero-copy path reads TX metadata whenever the UMEM has metadata space, even if the descriptor does not set XDP_TX_METADATA. Pass descriptor options through the metadata helpers and ignore metadata unless the option is set.
This does not fix the existing per-WQE metadata handling for mlx5 MPWQEs. Only the descriptor that starts a session passes through xsk_tx_metadata_request() and configures offload state shared by the batch. Metadata on descriptors joining an open session is therefore not validated and does not configure its requested offloads. In addition, a non-NULL metadata pointer from such a descriptor is treated as a timestamp completion request even when XDP_TXMD_FLAGS_TIMESTAMP is not set, so its metadata union can be overwritten with an unrequested timestamp. Fixing mixed metadata states within one MPWQE requires a separate change.
--- drivers/net/ethernet/intel/igc/igc_main.c | 3 ++- .../ethernet/mellanox/mlx5/core/en/xsk/tx.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- include/net/libeth/xsk.h | 2 +- include/net/xdp_sock_drv.h | 22 +++++++++++-------- include/net/xsk_buff_pool.h | 3 ++- net/xdp/xsk_buff_pool.c | 7 ++++-- 7 files changed, 26 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +2 -1
@@ -3074,7 +3074,8 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring) olinfo_status = xdp_desc.len <<IGC_ADVTXD_PAYLEN_SHIFT ; dma =xsk_buff_raw_get_dma (pool, xdp_desc.addr); - meta =xsk_buff_get_metadata (pool, xdp_desc.addr); + meta =xsk_buff_get_metadata (pool, xdp_desc.addr, + xdp_desc.options);xsk_buff_raw_dma_sync_for_device (pool, dma, xdp_desc.len); bi = &ring->tx_buffer_info[ntu];
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c +1 -1
@@ -99,7 +99,7 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq, unsigned int budget) xdptxd.dma_addr =xsk_buff_raw_get_dma (pool, desc.addr); xdptxd.data =xsk_buff_raw_get_data (pool, desc.addr); xdptxd.len = desc.len; - meta =xsk_buff_get_metadata (pool, desc.addr); + meta =xsk_buff_get_metadata (pool, desc.addr, desc.options);xsk_buff_raw_dma_sync_for_device (pool, xdptxd.dma_addr, xdptxd.len);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -1
@@ -2723,7 +2723,8 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) tx_desc =stmmac_get_tx_desc (priv, tx_q, entry); dma_addr =xsk_buff_raw_get_dma (pool, xdp_desc.addr); - meta =xsk_buff_get_metadata (pool, xdp_desc.addr); + meta =xsk_buff_get_metadata (pool, xdp_desc.addr, + xdp_desc.options);xsk_buff_raw_dma_sync_for_device (pool, dma_addr, xdp_desc.len);/* To return XDP buffer to XSK pool, we simple call
include/net/libeth/xsk.h +1 -1
@@ -196,7 +196,7 @@ __libeth_xsk_xmit_fill_buf_md(const struct xdp_desc *xdesc,struct libeth_xdp_tx_desc desc;struct xdp_desc_ctx ctx; - ctx =xsk_buff_raw_get_ctx (sq->pool, xdesc->addr); + ctx =xsk_buff_raw_get_ctx (sq->pool, xdesc->addr, xdesc->options); desc = (typeof (desc )){ .addr = ctx.dma,__libeth_xdp_tx_len (xdesc->len),
include/net/xdp_sock_drv.h +13 -9
@@ -240,6 +240,7 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)* xsk_buff_raw_get_ctx - get &xdp_desc context * @pool: XSk buff pool desc address belongs to * @addr: desc address (from userspace) +* @options: desc options (from userspace) * * Wrapper for xp_raw_get_ctx() to be used in drivers, see its kdoc for * details.
@@ -248,9 +249,9 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)* pointer, if it is present (initialized to %NULL otherwise). */ static inline struct xdp_desc_ctx -xsk_buff_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr) +xsk_buff_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr,u32 options) { -return xp_raw_get_ctx (pool, addr); +return xp_raw_get_ctx (pool, addr, options); }#define XDP_TXMD_FLAGS_VALID ( \
@@ -318,18 +319,20 @@ xsk_tx_metadata_request(const struct xsk_buff_pool *pool, }static inline struct xsk_tx_metadata * -__xsk_buff_get_metadata (const struct xsk_buff_pool *pool,void *data) +__xsk_buff_get_metadata (const struct xsk_buff_pool *pool,void *data, +unsigned int options) { -if (!pool->tx_metadata_len) +if (!pool->tx_metadata_len || !(options &XDP_TX_METADATA ))return NULL ;return data - pool->tx_metadata_len; }static inline struct xsk_tx_metadata * -xsk_buff_get_metadata (struct xsk_buff_pool *pool,u64 addr) +xsk_buff_get_metadata (struct xsk_buff_pool *pool,u64 addr,u32 options) { -return __xsk_buff_get_metadata (pool,xp_raw_get_data (pool, addr)); +return __xsk_buff_get_metadata (pool,xp_raw_get_data (pool, addr), + options); }static inline void xsk_buff_dma_sync_for_cpu (struct xdp_buff *xdp)
@@ -510,7 +513,7 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr) }static inline struct xdp_desc_ctx -xsk_buff_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr) +xsk_buff_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr,u32 options) {return (struct xdp_desc_ctx ){ }; }
@@ -530,13 +533,14 @@ xsk_tx_metadata_request(const struct xsk_buff_pool *pool, }static inline struct xsk_tx_metadata * -__xsk_buff_get_metadata (const struct xsk_buff_pool *pool,void *data) +__xsk_buff_get_metadata (const struct xsk_buff_pool *pool,void *data, +unsigned int options) {return NULL ; }static inline struct xsk_tx_metadata * -xsk_buff_get_metadata (struct xsk_buff_pool *pool,u64 addr) +xsk_buff_get_metadata (struct xsk_buff_pool *pool,u64 addr,u32 options) {return NULL ; }
include/net/xsk_buff_pool.h +2 -1
@@ -154,7 +154,8 @@ struct xdp_desc_ctx {struct xsk_tx_metadata *meta; }; -struct xdp_desc_ctx xp_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr); +struct xdp_desc_ctx xp_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr, +u32 options);static inline dma_addr_t xp_get_dma (struct xdp_buff_xsk *xskb) {
net/xdp/xsk_buff_pool.c +5 -2
@@ -763,6 +763,7 @@ EXPORT_SYMBOL(xp_raw_get_dma);* xp_raw_get_ctx - get &xdp_desc context * @pool: XSk buff pool desc address belongs to * @addr: desc address (from userspace) +* @options: desc options (from userspace) * * Helper for getting desc's DMA address and metadata pointer, if present. * Saves one call on hotpath and double calculation of the actual address.
@@ -771,14 +772,16 @@ EXPORT_SYMBOL(xp_raw_get_dma);* Return: new &xdp_desc_ctx struct containing desc's DMA address and metadata * pointer, if it is present (initialized to %NULL otherwise). */ -struct xdp_desc_ctx xp_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr) +struct xdp_desc_ctx xp_raw_get_ctx (const struct xsk_buff_pool *pool,u64 addr, +u32 options) {struct xdp_desc_ctx ret; addr =__xp_raw_get_addr (pool, addr); ret.dma =__xp_raw_get_dma (pool, addr); - ret.meta =__xsk_buff_get_metadata (pool,__xp_raw_get_data (pool, addr)); + ret.meta =__xsk_buff_get_metadata (pool,__xp_raw_get_data (pool, addr), + options);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1729/1815 gtp: add synchronize_net() in gtp_newlink() error path to prevent use-after-free
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang (Microsoft) <[email protected]>
[ Upstream commit d989e22ae9802c52c56ad4284d0caf26696cf6ae ]
gtp_newlink()'s error path frees tid_hash and addr_hash without waiting for an RCU grace period after clearing sk_user_data. A concurrent gtp_encap_recv() in softirq may still hold the gtp_dev pointer obtained via rcu_dereference_sk_user_data() and access the freed memory.
BUG: KASAN: slab-use-after-free in gtp0_pdp_find+0x1f6/0x200 (gtp.c:152) Call Trace: <IRQ> gtp0_pdp_find+0x1f6/0x200 gtp_encap_recv+0x527/0x24b0 udp_queue_rcv_one_skb+0x75f/0xc10
Add synchronize_net() before the kfree calls in out_hashtable, which covers all error paths from both gtp_encap_enable() and gtp_create_sockets().
--- drivers/net/gtp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/gtp.c +2 -0
@@ -1549,6 +1549,8 @@ static int gtp_newlink(struct net_device *dev, out_encap:gtp_encap_disable (gtp); out_hashtable: +/* Wait for RCU readers that may still reference this gtp_dev. */ +synchronize_net ();kfree (gtp->addr_hash);kfree (gtp->tid_hash);return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1730/1815 octeontx2-af: fix NULL deref in NIX TM tree debugfs read path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshumali Gaur <[email protected]>
[ Upstream commit ec65631bd5ec251cdf67a4919fac7a3149a6e235 ]
rvu_dbg_nix_tm_tree_display() dereferences pfvf->sq_ctx without checking whether the SQ context has been allocated. Reading /sys/kernel/debug/octeontx2/nix/tm_tree for a NIX LF whose transmit queues are not set up triggers a kernel oops.
Guard the read path the same way rvu_dbg_nix_tm_tree_write() already does and return -EINVAL with a seq_file message when sq_ctx is NULL.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +6 -0
@@ -1697,6 +1697,12 @@ static int rvu_dbg_nix_tm_tree_display(struct seq_file *m, void *unused)return -EINVAL ; pfvf =rvu_get_pfvf (rvu, pcifunc); + +if (!pfvf->sq_ctx) { +seq_printf (m,"SQ context is not initialized for pcifunc 0x%x\n" , pcifunc); +return -EINVAL ; + } + max_id = pfvf->sq_ctx->qsize;memset (&aq_req,0 ,sizeof (struct nix_aq_enq_req ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1731/1815 octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshumali Gaur <[email protected]>
[ Upstream commit 4d5df98369c5f45710b786499f8bd7ffc3196433 ]
rvu_register_interrupts() walks every MSI-X vector and uses strstr() to match "Mbox" or "FLR" in irq_name before pinning those interrupts to CPU 0. irq_name is a per-vector NAME_SIZE buffer, but not every slot is populated before this loop runs. strstr() keeps scanning until it finds a NUL terminator, so an uninitialized slot can trigger a KASAN slab-out-of-bounds read at boot when debug options are enabled.
Use strnstr() with NAME_SIZE to bound the search within each vector's name buffer.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +2 -2
@@ -3331,8 +3331,8 @@ static int rvu_register_interrupts(struct rvu *rvu) goto fail;for (i =0 ; i < rvu->num_vec; i++) { -if (strstr (&rvu->irq_name[i *NAME_SIZE ],"Mbox" ) || -strstr (&rvu->irq_name[i *NAME_SIZE ],"FLR" )) +if (strnstr (&rvu->irq_name[i *NAME_SIZE ],"Mbox" ,NAME_SIZE ) || +strnstr (&rvu->irq_name[i *NAME_SIZE ],"FLR" ,NAME_SIZE ))irq_set_affinity (pci_irq_vector (rvu->pdev, i),cpumask_of (0 )); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1732/1815 octeontx2-vf: fix workqueue and netdev race in probe/remove
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshumali Gaur <[email protected]>
[ Upstream commit 3ba97ff4f873481d370bee7f7dfb87f8296af9be ]
Initialize the VF workqueue before register_netdev() so ndo_set_rx_mode does not queue work on a NULL workqueue. Unregister the netdev before destroying the workqueue, and add proper probe error cleanup.
--- .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +13 -7
@@ -737,16 +737,16 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (err) goto err_ptp_destroy; + err =otx2_vf_wq_init (vf); +if (err) + goto err_ipsec_clean; + err =register_netdev (netdev);if (err) {dev_err (dev,"Failed to register netdevice\n" ); - goto err_ipsec_clean; + goto err_wq_destroy; } - err =otx2_vf_wq_init (vf); -if (err) - goto err_unreg_netdev; -otx2vf_set_ethtool_ops (netdev); err =otx2vf_mcam_flow_init (vf);
@@ -789,6 +789,10 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)otx2_shutdown_tc (vf); err_unreg_netdev:unregister_netdev (netdev); +err_wq_destroy: +cancel_work_sync (&vf->reset_task); +cancel_work_sync (&vf->rx_mode_work); +destroy_workqueue (vf->otx2_wq); err_ipsec_clean:cn10k_ipsec_clean (vf); err_ptp_destroy:
@@ -836,11 +840,13 @@ static void otx2vf_remove(struct pci_dev *pdev) }#endif -cancel_work_sync (&vf->reset_task);otx2_unregister_dl (vf);unregister_netdev (netdev); -if (vf->otx2_wq) +if (vf->otx2_wq) { +cancel_work_sync (&vf->reset_task); +cancel_work_sync (&vf->rx_mode_work);destroy_workqueue (vf->otx2_wq); + }cn10k_ipsec_clean (vf);otx2_ptp_destroy (vf);otx2_mcam_flow_del (vf);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1733/1815 net: qualcomm: rmnet: restore skb->dev on deaggregated frames
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit a66734a1c5e36525ea07e9f4547fddc51e916de3 ]
rmnet_map_deaggregate() allocates each sub-frame with alloc_skb() and leaves skb->dev NULL. __rmnet_map_ingress_handler() assigns skb->dev = ep->egress_dev only on the data path, but a MAP command frame is dispatched to rmnet_map_command() before that, so rmnet_map_send_ack() runs netif_tx_lock(skb->dev) on a NULL device. An unprivileged user reaches this by unsharing a user+net namespace, creating an rmnet link over a tap device with INGRESS_DEAGGREGATION and INGRESS_MAP_COMMANDS, and writing an aggregated frame carrying a flow-control command to the tap fd.
Restore the assignment dropped by 378e25357ac7, so every skb leaving rmnet_map_deaggregate() has a valid device.
BUG: KASAN: null-ptr-deref in _raw_spin_lock (kernel/locking/spinlock.c:158) Write of size 4 at addr 00000000000004b4 by task exploit/144 Call Trace: _raw_spin_lock (kernel/locking/spinlock.c:158) netif_tx_lock (net/sched/sch_generic.c:497) rmnet_map_command (drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c:67) rmnet_rx_handler (drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:125) __netif_receive_skb_core.constprop.0 (net/core/dev.c:6103) ... __netif_receive_skb_one_core (net/core/dev.c:6214) netif_receive_skb (net/core/dev.c:6474) tun_get_user (drivers/net/tun.c:1966) tun_chr_write_iter (drivers/net/tun.c:2012) vfs_write (fs/read_write.c:687) ksys_write (fs/read_write.c:739) do_syscall_64 (arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Kernel panic - not syncing: Fatal exception in interrupt
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +1 -0
@@ -394,6 +394,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,if (!skbn)return NULL ; + skbn->dev = skb->dev;skb_reserve (skbn,RMNET_MAP_DEAGGR_HEADROOM );skb_put (skbn, packet_len);memcpy (skbn->data, skb->data, packet_len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1734/1815 octeontx2-af: Fix TL3/TL2 link config ENA clearing
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naveen Mamindlapalli <[email protected]>
[ Upstream commit 9edf8d4876e8a2471e66f54d36208eaff2858392 ]
Clear and restore the ENA bit for each TL3/TL2 link entry during SMQ flush instead of repeatedly using the same link index.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +5 -6
@@ -2483,8 +2483,8 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,int pf =rvu_get_pf (rvu->pdev, pcifunc);u8 cgx_id =0 , lmac_id =0 ;u16 tl2_tl3_link_schq; -u8 link, link_level;u64 cfg, bmap =0 ; +u8 link_level;if (!is_rvu_otx2 (rvu)) {/* Skip SMQ flush if pkt count is zero */
@@ -2516,7 +2516,6 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr, link_level =rvu_read64 (rvu, blkaddr,NIX_AF_PSE_CHANNEL_LEVEL ) &0x01 ?NIX_TXSCH_LVL_TL3 :NIX_TXSCH_LVL_TL2 ; tl2_tl3_link_schq = smq_flush_ctx->smq_tree_ctx[link_level].schq; - link = smq_flush_ctx->smq_tree_ctx[NIX_TXSCH_LVL_TL1 ].schq;/* SMQ set enqueue xoff */ cfg =rvu_read64 (rvu, blkaddr,NIX_AF_SMQX_CFG (smq));
@@ -2526,13 +2525,13 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,/* Clear all NIX_AF_TL3_TL2_LINK_CFG[ENA] for the TL3/TL2 queue */ for (i =0 ; i < (rvu->hw->cgx_links + rvu->hw->lbk_links); i++) { cfg =rvu_read64 (rvu, blkaddr, -NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, link)); +NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, i));if (!(cfg &BIT_ULL (12 )))continue ; bmap |=BIT_ULL (i); cfg &= ~BIT_ULL (12 );rvu_write64 (rvu, blkaddr, -NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, link), cfg); +NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, i), cfg); }/* Do SMQ flush and set enqueue xoff */
@@ -2553,10 +2552,10 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,if (!(bmap &BIT_ULL (i)))continue ; cfg =rvu_read64 (rvu, blkaddr, -NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, link)); +NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, i)); cfg |=BIT_ULL (12 );rvu_write64 (rvu, blkaddr, -NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, link), cfg); +NIX_AF_TL3_TL2X_LINKX_CFG (tl2_tl3_link_schq, i), cfg); }/* clear XOFF on TL2s */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1735/1815 net: enetc: restore RX ring congestion mode after ring reconfiguration
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 9e94d8e14ae45e3fda8c0919f745db3ed3715433 ]
The RX ring congestion mode (CM) is only configured in the phylink .mac_link_up() callback enetc_pl_mac_link_up(), which sets the ENETC_RBMR_CM bit when tx_pause is enabled. This callback runs only when the link status changes.
However, enetc_reconfigure() tears down and re-creates the RX BD rings at runtime without any link status change, for example when attaching or detaching an XDP program, or when enabling/disabling PTP RX hardware timestamping. The rings are rebuilt from a cleared RBMR, so the CM bit is lost. Since the link status does not change, enetc_pl_mac_link_up() is not called again and the CM bit is never restored.
As a result, the ENETC MAC can no longer generate PAUSE frames on ingress congestion, and flow control stops working after such a reconfiguration.
Track the desired CM state in a software flag ENETC_RXBDR_CM. Set or clear this flag in enetc_pl_mac_link_up() according to tx_pause. When the RX BD rings are (re)enabled, enetc_enable_rxbdr() consults this flag and restores the ENETC_RBMR_CM bit accordingly, so flow control survives ring reconfiguration even when the link status does not change.
RBMR is now written as a whole word from enetc_enable_rxbdr() rather than by read-modify-write from several call sites. Serialize the remaining RBMR read-modify-write paths, the congestion mode update and the RX VLAN offload update, with the new si->gen_lock so they cannot race each other.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 72 +++++++++++++++---- drivers/net/ethernet/freescale/enetc/enetc.h | 9 +++ .../net/ethernet/freescale/enetc/enetc_pf.c | 14 +--- 3 files changed, 68 insertions(+), 27 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +57 -15
@@ -81,6 +81,33 @@ void enetc_reset_mac_addr_filter(struct enetc_mac_filter *filter) }EXPORT_SYMBOL_GPL (enetc_reset_mac_addr_filter); +void enetc_set_congestion_mode (struct enetc_ndev_priv *priv,bool enable) +{ +struct enetc_si *si = priv->si; +struct enetc_hw *hw = &si->hw; + +spin_lock (&si->gen_lock); + +if (enable) +set_bit (ENETC_RXBDR_CM , &priv->flags); +else +clear_bit (ENETC_RXBDR_CM , &priv->flags); + +for (int i =0 ; i < priv->num_rx_rings; i++) { +u32 old_rbmr =enetc_rxbdr_rd (hw, i,ENETC_RBMR ); +u32 rbmr; + + rbmr =u32_replace_bits (old_rbmr, enable,ENETC_RBMR_CM ); +if (rbmr == old_rbmr) +continue ; + +enetc_rxbdr_wr (hw, i,ENETC_RBMR , rbmr); + } + +spin_unlock (&si->gen_lock); +} +EXPORT_SYMBOL_GPL (enetc_set_congestion_mode); +static int enetc_num_stack_tx_queues (struct enetc_ndev_priv *priv) {int num_tx_rings = priv->num_tx_rings;
@@ -2632,7 +2659,6 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring, bool extended) {int idx = rx_ring->index; -u32 rbmr =0 ;enetc_rxbdr_wr (hw, idx,ENETC_RBBAR0 ,lower_32_bits (rx_ring->bd_dma_base));
@@ -2660,12 +2686,6 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring,enetc_rxbdr_wr (hw, idx,ENETC_RBICR0 ,ENETC_RBICR0_ICEN |0x1 ); rx_ring->ext_en = extended; -if (rx_ring->ext_en) - rbmr |=ENETC_RBMR_BDS ; - -if (rx_ring->ndev->features &NETIF_F_HW_VLAN_CTAG_RX ) - rbmr |=ENETC_RBMR_VTE ; - rx_ring->rcir = hw->reg +ENETC_BDR (RX , idx,ENETC_RBCIR ); rx_ring->idr = hw->reg +ENETC_SIRXIDR ;
@@ -2676,8 +2696,6 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring,enetc_lock_mdio ();enetc_refill_rx_ring (rx_ring,enetc_bd_unused (rx_ring));enetc_unlock_mdio (); - -enetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr); }static void enetc_setup_bdrs (struct enetc_ndev_priv *priv,bool extended)
@@ -2704,21 +2722,34 @@ static void enetc_enable_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)static void enetc_enable_rxbdr (struct enetc_hw *hw,struct enetc_bdr *rx_ring) { +struct enetc_ndev_priv *priv =netdev_priv (rx_ring->ndev);int idx = rx_ring->index; -u32 rbmr; +u32 rbmr =ENETC_RBMR_EN ; + +if (rx_ring->ext_en) + rbmr |=ENETC_RBMR_BDS ; + +if (rx_ring->ndev->features &NETIF_F_HW_VLAN_CTAG_RX ) + rbmr |=ENETC_RBMR_VTE ; + +if (test_bit (ENETC_RXBDR_CM , &priv->flags)) + rbmr |=ENETC_RBMR_CM ; - rbmr =enetc_rxbdr_rd (hw, idx,ENETC_RBMR ); - rbmr |=ENETC_RBMR_EN ;enetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr); }static void enetc_enable_rx_bdrs (struct enetc_ndev_priv *priv) { -struct enetc_hw *hw = &priv->si->hw; +struct enetc_si *si = priv->si; +struct enetc_hw *hw = &si->hw;int i; +spin_lock (&si->gen_lock); +for (i =0 ; i < priv->num_rx_rings; i++)enetc_enable_rxbdr (hw, priv->rx_ring[i]); + +spin_unlock (&si->gen_lock); }static void enetc_enable_tx_bdrs (struct enetc_ndev_priv *priv)
@@ -2748,11 +2779,16 @@ static void enetc_disable_txbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring)static void enetc_disable_rx_bdrs (struct enetc_ndev_priv *priv) { -struct enetc_hw *hw = &priv->si->hw; +struct enetc_si *si = priv->si; +struct enetc_hw *hw = &si->hw;int i; +spin_lock (&si->gen_lock); +for (i =0 ; i < priv->num_rx_rings; i++)enetc_disable_rxbdr (hw, priv->rx_ring[i]); + +spin_unlock (&si->gen_lock); }static void enetc_disable_tx_bdrs (struct enetc_ndev_priv *priv)
@@ -3344,11 +3380,16 @@ EXPORT_SYMBOL_GPL(enetc_get_stats);static void enetc_enable_rxvlan (struct net_device *ndev,bool en) {struct enetc_ndev_priv *priv =netdev_priv (ndev); -struct enetc_hw *hw = &priv->si->hw; +struct enetc_si *si = priv->si; +struct enetc_hw *hw = &si->hw;int i; +spin_lock (&si->gen_lock); +for (i =0 ; i < priv->num_rx_rings; i++)enetc_bdr_enable_rxvlan (hw, i, en); + +spin_unlock (&si->gen_lock); }static void enetc_enable_txvlan (struct net_device *ndev,bool en)
@@ -3679,6 +3720,7 @@ int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv) si =PTR_ALIGN (p,ENETC_SI_ALIGN ); si->pad = (char *)si - (char *)p; +spin_lock_init (&si->gen_lock);pci_set_drvdata (pdev, si); si->pdev = pdev;
drivers/net/ethernet/freescale/enetc/enetc.h +9 -0
@@ -309,6 +309,13 @@ struct enetc_si {struct net_device *ndev;/* back ref. */ +/* General-purpose lock serializing updates that must not race, +* e.g. read-modify-write of shared hardware registers and of +* selected priv->flags bits between the phylink link callbacks +* and the ring (re)configuration path. +*/ +spinlock_t gen_lock; +union {struct enetc_cbdr cbd_ring;/* Only ENETC 1.0 */ struct ntmp_user ntmp_user;/* ENETC 4.1 and later */
@@ -419,6 +426,7 @@ enum enetc_active_offloads {enum enetc_flags_bit {ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS =0 ,ENETC_TX_DOWN , +ENETC_RXBDR_CM , };/* interrupt coalescing modes */
@@ -507,6 +515,7 @@ int enetc_get_driver_data(struct enetc_si *si);void enetc_add_mac_addr_ht_filter (struct enetc_mac_filter *filter,const unsigned char *addr);void enetc_reset_mac_addr_filter (struct enetc_mac_filter *filter); +void enetc_set_congestion_mode (struct enetc_ndev_priv *priv,bool enable);int enetc_open (struct net_device *ndev);int enetc_close (struct net_device *ndev);
drivers/net/ethernet/freescale/enetc/enetc_pf.c +2 -12
@@ -608,8 +608,7 @@ static void enetc_pl_mac_link_up(struct phylink_config *config,struct enetc_hw *hw = &pf->si->hw;struct enetc_si *si = pf->si;struct enetc_ndev_priv *priv; -u32 rbmr, cmd_cfg; -int idx; +u32 cmd_cfg; priv =netdev_priv (pf->si->ndev);
@@ -621,16 +620,7 @@ static void enetc_pl_mac_link_up(struct phylink_config *config,enetc_force_rgmii_mac (si, speed, duplex);/* Flow control */ -for (idx =0 ; idx < priv->num_rx_rings; idx++) { - rbmr =enetc_rxbdr_rd (hw, idx,ENETC_RBMR ); - -if (tx_pause) - rbmr |=ENETC_RBMR_CM ; -else - rbmr &= ~ENETC_RBMR_CM ; - -enetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr); - } +enetc_set_congestion_mode (priv, tx_pause);if (tx_pause) {/* When the port first enters congestion, send a PAUSE request
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1736/1815 net: enetc: extract common helpers for MAC promiscuous mode setting
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 2557834ad0ff36fe3ec220bf1d7e6098265a326d ]
The PSIPMMR (Port Station Interface Promiscuous MAC Mode Register) in ENETC v4 has the same bit layout as the PSIPMR register in ENETC v1: bit n controls unicast promiscuous mode for SI n, and bit (n + 16) controls multicast promiscuous mode for SI n. The only difference between the two hardware generations is the register address offset.
Since the register functionality is identical, the MAC promiscuous mode setting code can be shared between ENETC v1 and v4 drivers.
Rename ENETC_PSIPMR to ENETC_PSIPMMR in enetc_hw.h to match the actual register name used in the reference manual, and extract two new common helper functions, enetc_set_si_uc_promisc() and enetc_set_si_mc_promisc(), into enetc_pf_common.c. These helpers select the correct register offset based on the hardware revision via is_enetc_rev1().
Remove the v4-specific enetc4_pf_set_si_mac_promisc() function from enetc4_pf.c and the duplicate PSIPMMR_SI_MAC_UP/MP macro definitions from enetc4_hw.h, as they are now superseded by the shared code.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../net/ethernet/freescale/enetc/enetc4_hw.h | 2 - .../net/ethernet/freescale/enetc/enetc4_pf.c | 21 +-------- .../ethernet/freescale/enetc/enetc_ethtool.c | 2 +- .../net/ethernet/freescale/enetc/enetc_hw.h | 7 +-- .../net/ethernet/freescale/enetc/enetc_pf.c | 11 ++--- .../freescale/enetc/enetc_pf_common.c | 44 +++++++++++++++++++ .../freescale/enetc/enetc_pf_common.h | 2 + 7 files changed, 56 insertions(+), 33 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_hw.h +0 -2
@@ -69,8 +69,6 @@/* Port Station interface promiscuous MAC mode register */ #define ENETC4_PSIPMMR 0x200 -#define PSIPMMR_SI_MAC_UP (a) BIT(a)/* a = SI index */ -#define PSIPMMR_SI_MAC_MP (a) BIT((a) + 16)/* Port Station interface promiscuous VLAN mode register */ #define ENETC4_PSIPVMR 0x204
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +2 -19
@@ -75,24 +75,6 @@ static void enetc4_pf_get_si_primary_mac(struct enetc_hw *hw, int si,put_unaligned_le16 (lower, addr +4 ); } -static void enetc4_pf_set_si_mac_promisc (struct enetc_hw *hw,int si, -bool uc_promisc,bool mc_promisc) -{ -u32 val =enetc_port_rd (hw,ENETC4_PSIPMMR ); - -if (uc_promisc) - val |=PSIPMMR_SI_MAC_UP (si); -else - val &= ~PSIPMMR_SI_MAC_UP (si); - -if (mc_promisc) - val |=PSIPMMR_SI_MAC_MP (si); -else - val &= ~PSIPMMR_SI_MAC_MP (si); - -enetc_port_wr (hw,ENETC4_PSIPMMR , val); -} -static void enetc4_pf_set_si_uc_hash_filter (struct enetc_hw *hw,int si,u64 hash) {
@@ -515,7 +497,8 @@ static void enetc4_psi_do_set_rx_mode(struct work_struct *work) type =ENETC_MAC_FILTER_TYPE_ALL ; } -enetc4_pf_set_si_mac_promisc (hw,0 , uc_promisc, mc_promisc); +enetc_set_si_uc_promisc (si,0 , uc_promisc); +enetc_set_si_mc_promisc (si,0 , mc_promisc);if (uc_promisc) {enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 );
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +1 -1
@@ -29,7 +29,7 @@ static const u32 enetc_rxbdr_regs[] = { };static const u32 enetc_port_regs[] = { -ENETC_PMR ,ENETC_PSR ,ENETC_PSIPMR ,ENETC_PSIPMAR0 (0 ), +ENETC_PMR ,ENETC_PSR ,ENETC_PSIPMMR ,ENETC_PSIPMAR0 (0 ),ENETC_PSIPMAR1 (0 ),ENETC_PTXMBAR ,ENETC_PCAPR0 ,ENETC_PCAPR1 ,ENETC_PSICFGR0 (0 ),ENETC_PRFSCAPR ,ENETC_PTCMSDUR (0 ),ENETC_PM0_CMD_CFG ,ENETC_PM0_MAXFRM ,ENETC_PM0_IF_MODE
drivers/net/ethernet/freescale/enetc/enetc_hw.h +4 -3
@@ -180,9 +180,10 @@ enum enetc_bdr_type {TX, RX};#define ENETC_PMR_PSPEED_1000M BIT(9)#define ENETC_PMR_PSPEED_2500M BIT(10)#define ENETC_PSR 0x0004/* RO */ -#define ENETC_PSIPMR 0x0018 -#define ENETC_PSIPMR_SET_UP (n) BIT(n)/* n = SI index */ -#define ENETC_PSIPMR_SET_MP (n) BIT((n) + 16) +#define ENETC_PSIPMMR 0x0018 +#define PSIPMMR_SI_MAC_UP (n) BIT(n)/* n = SI index */ +#define PSIPMMR_SI_MAC_MP (n) BIT((n) + 16) +#define ENETC_PSIPVMR 0x001c#define ENETC_VLAN_PROMISC_MAP_ALL 0x7#define ENETC_PSIPVMR_SET_VP (simap) ((simap) & 0x7)
drivers/net/ethernet/freescale/enetc/enetc_pf.c +3 -8
@@ -159,21 +159,17 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev) {struct enetc_ndev_priv *priv =netdev_priv (ndev);struct enetc_pf *pf =enetc_si_priv (priv->si); -struct enetc_hw *hw = &priv->si->hw;bool uprom = false, mprom = false;struct enetc_mac_filter *filter;struct netdev_hw_addr *ha; -u32 psipmr =0 ;bool em;if (ndev->flags &IFF_PROMISC ) {/* enable promisc mode for SI0 (PF) */ - psipmr =ENETC_PSIPMR_SET_UP (0 ) |ENETC_PSIPMR_SET_MP (0 ); uprom = true; mprom = true; }else if (ndev->flags &IFF_ALLMULTI ) {/* enable multi cast promisc mode for SI0 (PF) */ - psipmr =ENETC_PSIPMR_SET_MP (0 ); mprom = true; }
@@ -211,9 +207,8 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev)/* update PF entries */ enetc_sync_mac_filters (pf); - psipmr |=enetc_port_rd (hw,ENETC_PSIPMR ) & - ~(ENETC_PSIPMR_SET_UP (0 ) |ENETC_PSIPMR_SET_MP (0 )); -enetc_port_wr (hw,ENETC_PSIPMR , psipmr); +enetc_set_si_uc_promisc (priv->si,0 , uprom); +enetc_set_si_mc_promisc (priv->si,0 , mprom); }static void enetc_set_loopback (struct net_device *ndev,bool en)
@@ -474,7 +469,7 @@ static void enetc_configure_port(struct enetc_pf *pf) pf->vlan_promisc_simap =ENETC_VLAN_PROMISC_MAP_ALL ;enetc_set_vlan_promisc (hw, pf->vlan_promisc_simap); -enetc_port_wr (hw,ENETC_PSIPMR ,0 ); +enetc_port_wr (hw,ENETC_PSIPMMR ,0 );/* enable port */ enetc_port_wr (hw,ENETC_PMR ,ENETC_PMR_EN );
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +44 -0
50 lines not on this page · raw message
drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +2 -0
@@ -17,6 +17,8 @@ void enetc_set_default_rss_key(struct enetc_pf *pf);int enetc_vlan_rx_add_vid (struct net_device *ndev,__be16 prot,u16 vid);int enetc_vlan_rx_del_vid (struct net_device *ndev,__be16 prot,u16 vid);int enetc_init_sriov_resources (struct enetc_pf *pf); +void enetc_set_si_uc_promisc (struct enetc_si *si,int si_id,bool promisc); +void enetc_set_si_mc_promisc (struct enetc_si *si,int si_id,bool promisc);static inline u16 enetc_get_ip_revision (struct enetc_hw *hw) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1737/1815 net: enetc: extract common helpers for MAC hash filter configuration
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 0ce10770963e7b4bf252fe0f0283326504bcbb36 ]
The PSIUMHFR and PSIMMHFR registers in ENETC v4 have the same bit layout as in ENETC v1. The only difference between the two hardware generations is the register address offsets.
Since the register functionality is identical, the MAC hash filter configuration code can be shared between the ENETC v1 and v4 drivers. Extract two new common helper functions, enetc_set_si_uc_hash_filter() and enetc_set_si_mc_hash_filter(), into enetc_pf_common.c. These helpers select the correct register offset based on the hardware revision via is_enetc_rev1().
Remove v1-specific enetc_clear_mac_ht_flt() and enetc_set_mac_ht_flt() from enetc_pf.c, and v4-specific enetc4_pf_set_si_uc_hash_filter() and enetc4_pf_set_si_mc_hash_filter() from enetc4_pf.c, as they are now superseded by the shared implementations.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../net/ethernet/freescale/enetc/enetc4_pf.c | 43 +++++++--------- .../net/ethernet/freescale/enetc/enetc_pf.c | 51 +++++-------------- .../freescale/enetc/enetc_pf_common.c | 40 +++++++++++++++ .../freescale/enetc/enetc_pf_common.h | 2 + 4 files changed, 73 insertions(+), 63 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +17 -26
@@ -75,20 +75,6 @@ static void enetc4_pf_get_si_primary_mac(struct enetc_hw *hw, int si,put_unaligned_le16 (lower, addr +4 ); } -static void enetc4_pf_set_si_uc_hash_filter (struct enetc_hw *hw,int si, -u64 hash) -{ -enetc_port_wr (hw,ENETC4_PSIUMHFR0 (si),lower_32_bits (hash)); -enetc_port_wr (hw,ENETC4_PSIUMHFR1 (si),upper_32_bits (hash)); -} - -static void enetc4_pf_set_si_mc_hash_filter (struct enetc_hw *hw,int si, -u64 hash) -{ -enetc_port_wr (hw,ENETC4_PSIMMHFR0 (si),lower_32_bits (hash)); -enetc_port_wr (hw,ENETC4_PSIMMHFR1 (si),upper_32_bits (hash)); -} -static void enetc4_pf_set_loopback (struct net_device *ndev,bool en) {struct enetc_ndev_priv *priv =netdev_priv (ndev);
@@ -147,11 +133,12 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)int max_num_mfe = pf->caps.mac_filter_num;struct enetc_mac_filter mac_filter = {};struct net_device *ndev = pf->si->ndev; -struct enetc_hw *hw = &pf->si->hw;struct enetc_mac_addr *mac_tbl; +struct enetc_si *si = pf->si;struct netdev_hw_addr *ha;int i =0 , err;int mac_cnt; +u64 hash;netif_addr_lock_bh (ndev);
@@ -159,7 +146,7 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)if (!mac_cnt) {netif_addr_unlock_bh (ndev);/* clear both MAC hash and exact filters */ -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );enetc4_pf_clear_maft_entries (pf);return 0 ;
@@ -186,11 +173,13 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)/* Set temporary unicast hash filters in case of Rx loss when * updating MAC address filter table */ -enetc4_pf_set_si_uc_hash_filter (hw,0 , *mac_filter.mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter.mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_uc_hash_filter (si,0 , hash);enetc4_pf_clear_maft_entries (pf);if (!enetc4_pf_add_maft_entries (pf, mac_tbl, i)) -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );kfree (mac_tbl);
@@ -206,8 +195,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type) {struct net_device *ndev = pf->si->ndev;struct enetc_mac_filter *mac_filter; -struct enetc_hw *hw = &pf->si->hw; +struct enetc_si *si = pf->si;struct netdev_hw_addr *ha; +u64 hash;netif_addr_lock_bh (ndev);if (type &ENETC_MAC_FILTER_TYPE_UC ) {
@@ -216,8 +206,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type)netdev_for_each_uc_addr (ha, ndev)enetc_add_mac_addr_ht_filter (mac_filter, ha->addr); -enetc4_pf_set_si_uc_hash_filter (hw,0 , - *mac_filter->mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter->mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_uc_hash_filter (si,0 , hash); }if (type &ENETC_MAC_FILTER_TYPE_MC ) {
@@ -226,8 +217,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type)netdev_for_each_mc_addr (ha, ndev)enetc_add_mac_addr_ht_filter (mac_filter, ha->addr); -enetc4_pf_set_si_mc_hash_filter (hw,0 , - *mac_filter->mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter->mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_mc_hash_filter (si,0 , hash); }netif_addr_unlock_bh (ndev); }
@@ -480,7 +472,6 @@ static void enetc4_psi_do_set_rx_mode(struct work_struct *work) struct enetc_si *si = container_of(work, struct enetc_si, rx_mode_task);struct enetc_pf *pf =enetc_si_priv (si);struct net_device *ndev = si->ndev; -struct enetc_hw *hw = &si->hw;bool uc_promisc = false;bool mc_promisc = false;int type =0 ;
@@ -501,12 +492,12 @@ static void enetc4_psi_do_set_rx_mode(struct work_struct *work)enetc_set_si_mc_promisc (si,0 , mc_promisc);if (uc_promisc) { -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );enetc4_pf_clear_maft_entries (pf); }if (mc_promisc) -enetc4_pf_set_si_mc_hash_filter (hw,0 ,0 ); +enetc_set_si_mc_hash_filter (si,0 ,0 );/* Set new MAC filter */ enetc4_pf_set_mac_filter (pf, type);
drivers/net/ethernet/freescale/enetc/enetc_pf.c +14 -37
81 lines not on this page · raw message
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +40 -0
@@ -131,6 +131,46 @@ void enetc_set_si_mc_promisc(struct enetc_si *si, int si_id, bool promisc) }EXPORT_SYMBOL_GPL (enetc_set_si_mc_promisc); +void enetc_set_si_uc_hash_filter (struct enetc_si *si,int si_id,u64 hash) +{ +int psiumhfr0_off, psiumhfr1_off; +struct enetc_hw *hw = &si->hw; + +if (is_enetc_rev1 (si)) { +bool err = si->errata &ENETC_ERR_UCMCSWP ; + + psiumhfr0_off =ENETC_PSIUMHFR0 (si_id, err); + psiumhfr1_off =ENETC_PSIUMHFR1 (si_id); + }else { + psiumhfr0_off =ENETC4_PSIUMHFR0 (si_id); + psiumhfr1_off =ENETC4_PSIUMHFR1 (si_id); + } + +enetc_port_wr (hw, psiumhfr0_off,lower_32_bits (hash)); +enetc_port_wr (hw, psiumhfr1_off,upper_32_bits (hash)); +} +EXPORT_SYMBOL_GPL (enetc_set_si_uc_hash_filter); + +void enetc_set_si_mc_hash_filter (struct enetc_si *si,int si_id,u64 hash) +{ +int psimmhfr0_off, psimmhfr1_off; +struct enetc_hw *hw = &si->hw; + +if (is_enetc_rev1 (si)) { +bool err = si->errata &ENETC_ERR_UCMCSWP ; + + psimmhfr0_off =ENETC_PSIMMHFR0 (si_id, err); + psimmhfr1_off =ENETC_PSIMMHFR1 (si_id); + }else { + psimmhfr0_off =ENETC4_PSIMMHFR0 (si_id); + psimmhfr1_off =ENETC4_PSIMMHFR1 (si_id); + } + +enetc_port_wr (hw, psimmhfr0_off,lower_32_bits (hash)); +enetc_port_wr (hw, psimmhfr1_off,upper_32_bits (hash)); +} +EXPORT_SYMBOL_GPL (enetc_set_si_mc_hash_filter); +void enetc_pf_netdev_setup (struct enetc_si *si,struct net_device *ndev,const struct net_device_ops *ndev_ops) {
drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +2 -0
@@ -19,6 +19,8 @@ int enetc_vlan_rx_del_vid(struct net_device *ndev, __be16 prot, u16 vid);int enetc_init_sriov_resources (struct enetc_pf *pf);void enetc_set_si_uc_promisc (struct enetc_si *si,int si_id,bool promisc);void enetc_set_si_mc_promisc (struct enetc_si *si,int si_id,bool promisc); +void enetc_set_si_uc_hash_filter (struct enetc_si *si,int si_id,u64 hash); +void enetc_set_si_mc_hash_filter (struct enetc_si *si,int si_id,u64 hash);static inline u16 enetc_get_ip_revision (struct enetc_hw *hw) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1738/1815 net: enetc: convert ndo_set_rx_mode() to ndo_set_rx_mode_async()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit debf0c7a34fab2c4c47fc257a97a145543b6d3aa ]
The current ndo_set_rx_mode() is called under netif_addr_lock spinlock with BHs disabled, which prevents drivers from sleeping. To work around this limitation, the enetc driver uses a dedicated workqueue to defer MAC address list updates to a sleepable context.
Since commit 3554b4345d85 ("net: introduce ndo_set_rx_mode_async and netdev_rx_mode_work") introduced the ndo_set_rx_mode_async() callback, drivers can now handle address list updates directly in a sleepable context.
Therefore, convert the enetc driver to use ndo_set_rx_mode_async() and remove the dedicated workqueue and the deferred work item accordingly.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- drivers/net/ethernet/freescale/enetc/enetc.h | 2 - .../net/ethernet/freescale/enetc/enetc4_pf.c | 178 ++++++------------ 2 files changed, 58 insertions(+), 122 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.h +0 -2
@@ -331,8 +331,6 @@ struct enetc_si {const struct enetc_drvdata *drvdata;const struct enetc_si_ops *ops; -struct workqueue_struct *workqueue; -struct work_struct rx_mode_task;struct dentry *debugfs_root;struct enetc_msg_swbd msg;/* Only valid for VSI */ };
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +58 -120
287 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1739/1815 net: enetc: improve MAFT entry management with bitmap tracking
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 6228fc9c2bbe224a376c77e309bcf90158e0595c ]
Replace the counter-based MAFT entry tracking (num_mfe/mac_filter_num) with a bitmap (maft_eid_bitmap) stored in struct ntmp_user, which is a more appropriate place for NTMP resource management.
The bitmap approach brings two improvements. First, the entry deletion in enetc4_pf_clear_maft_entries() now checks the return value of ntmp_maft_delete_entry() and only clears the corresponding bit on success, keeping hardware and software state in sync. Previously, the counter was reset unconditionally regardless of whether the hardware deletion actually succeeded.
Second, entry allocation in enetc4_pf_add_maft_entries() uses ntmp_lookup_free_eid() to find available IDs dynamically, with an upfront capacity check via bitmap_weight() to avoid partial failures.
The MAFT entry count is moved into ntmp_user.maft_num_entries and initialized once during enetc4_init_ntmp_user(). Helper functions enetc4_ntmp_bitmap_init() and enetc4_ntmp_bitmap_free() manage the bitmap lifetime. The debugfs show function is updated accordingly to iterate over set bits under rtnl_lock().
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../ethernet/freescale/enetc/enetc4_debugfs.c | 30 ++++-- .../net/ethernet/freescale/enetc/enetc4_pf.c | 97 ++++++++++++++----- .../net/ethernet/freescale/enetc/enetc_pf.h | 3 - include/linux/fsl/ntmp.h | 2 + 4 files changed, 96 insertions(+), 36 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_debugfs.c +20 -10
@@ -31,9 +31,11 @@ static int enetc_mac_filter_show(struct seq_file *s, void *data)struct enetc_si *si = s->private;struct enetc_hw *hw = &si->hw;struct maft_entry_data maft; +struct ntmp_user *user;struct enetc_pf *pf; -int i, err, num_si; -u32 val; +u32 val, entry_id; +int i, num_si; +int err =0 ; pf =enetc_si_priv (si); num_si = pf->caps.num_vsi +1 ;
@@ -50,22 +52,30 @@ static int enetc_mac_filter_show(struct seq_file *s, void *data)for (i =0 ; i < num_si; i++)enetc_show_si_mac_hash_filter (s, i); -if (!pf->num_mfe) -return 0 ; + user = &si->ntmp_user; +rtnl_lock (); + +if (bitmap_empty (user->maft_eid_bitmap, user->maft_num_entries)) + goto unlock_rtnl;/* MAC address filter table */ seq_puts (s,"MAC address filter table\n" ); -for (i =0 ; i < pf->num_mfe; i++) { +for_each_set_bit (entry_id, user->maft_eid_bitmap, + user->maft_num_entries) {memset (&maft,0 ,sizeof (maft)); - err =ntmp_maft_query_entry (&si->ntmp_user, i, &maft); + err =ntmp_maft_query_entry (user, entry_id, &maft);if (err) -return err; + goto unlock_rtnl; -seq_printf (s,"Entry %d, MAC: %pM, SI bitmap: 0x%04x\n" , i, - maft.keye.mac_addr,le16_to_cpu (maft.cfge.si_bitmap)); +seq_printf (s,"Entry %d, MAC: %pM, SI bitmap: 0x%04x\n" , + entry_id, maft.keye.mac_addr, +le16_to_cpu (maft.cfge.si_bitmap)); } -return 0 ; +unlock_rtnl: +rtnl_unlock (); + +return err; }DEFINE_SHOW_ATTRIBUTE (enetc_mac_filter);
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +74 -23
170 lines not on this page · raw message
drivers/net/ethernet/freescale/enetc/enetc_pf.h +0 -3
@@ -22,7 +22,6 @@ struct enetc_port_caps {int num_msix;int num_rx_bdr;int num_tx_bdr; -int mac_filter_num; };struct enetc_pf ;
@@ -60,8 +59,6 @@ struct enetc_pf {struct enetc_port_caps caps;const struct enetc_pf_ops *ops; - -int num_mfe;/* number of mac address filter table entries */ };#define phylink_to_enetc_pf (config) \
include/linux/fsl/ntmp.h +2 -0
@@ -75,8 +75,10 @@ struct ntmp_user {/* NTMP table bitmaps for resource management */ u32 ett_bitmap_size;u32 ect_bitmap_size; +u16 maft_num_entries;unsigned long *ett_gid_bitmap;/* only valid for switch */ unsigned long *ect_gid_bitmap;/* only valid for switch */ +unsigned long *maft_eid_bitmap;/* only valid for ENETC */ };struct maft_entry_data {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1740/1815 net: enetc: remove invalid code from enetc4_pl_mac_link_up()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 59bb3d62489ce08d45dac2b7ec7b8f99a7b2040b ]
When adding phylink MAC operations support to the NETC switch driver, Russell King pointed out several pieces of invalid logic in the .mac_link_up() implementation (see [1] and [2]):
1) Half-duplex backpressure is not supported by the kernel, Ethernet relies on packet dropping for congestion management.
2) phylink_autoneg_inband() is unnecessary, as RGMII in-band status is not supported.
3) TX and RX pause are disabled in half-duplex mode, so there is no need to override them in .mac_link_up().
The same invalid logic is also present in enetc4_pl_mac_link_up(), so remove the invalid code from it.
Given enetc4_set_hd_flow_control() is removed, pf->caps.half_duplex has also become useless and should therefore be removed as well.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../net/ethernet/freescale/enetc/enetc4_hw.h | 2 - .../net/ethernet/freescale/enetc/enetc4_pf.c | 38 +------------------ .../net/ethernet/freescale/enetc/enetc_pf.h | 1 - 3 files changed, 1 insertion(+), 40 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_hw.h +0 -2
@@ -135,7 +135,6 @@#define ENETC4_PSIVHFR1 (a) ((a) * 0x80 + 0x2064)#define ENETC4_PMCAPR 0x4004 -#define PMCAPR_HD BIT(8)#define PMCAPR_FP GENMASK(10, 9)/* Port capability register */
@@ -198,7 +197,6 @@#define PM_CMD_CFG_CNT_FRM_EN BIT(13)#define PM_CMD_CFG_TXP BIT(15)#define PM_CMD_CFG_SEND_IDLE BIT(16) -#define PM_CMD_CFG_HD_FCEN BIT(18)#define PM_CMD_CFG_SFD BIT(21)#define PM_CMD_CFG_TX_FLUSH BIT(22)#define PM_CMD_CFG_TX_LOWP_EN BIT(23)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +1 -37
@@ -29,9 +29,6 @@ static void enetc4_get_port_caps(struct enetc_pf *pf) val =enetc_port_rd (hw,ENETC4_ECAPR2 ); pf->caps.num_rx_bdr = (val &ECAPR2_NUM_RX_BDR ) >>16 ; pf->caps.num_tx_bdr = val &ECAPR2_NUM_TX_BDR ; - - val =enetc_port_rd (hw,ENETC4_PMCAPR ); - pf->caps.half_duplex = (val &PMCAPR_HD ) ?1 :0 ; }static void enetc4_get_psi_hw_features (struct enetc_si *si)
@@ -588,11 +585,6 @@ static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode,case PHY_INTERFACE_MODE_RGMII_RXID :case PHY_INTERFACE_MODE_RGMII_TXID : val |=IFMODE_RGMII ; -/* We need to enable auto-negotiation for the MAC -* if its RGMII interface support In-Band status. -*/ -if (phylink_autoneg_inband (mode)) - val |=PM_IF_MODE_ENA ;break ;case PHY_INTERFACE_MODE_RMII : val |=IFMODE_RMII ;
@@ -703,22 +695,6 @@ static void enetc4_set_rmii_mac(struct enetc_pf *pf, int speed, int duplex)enetc_port_mac_wr (si,ENETC4_PM_IF_MODE (0 ), val); } -static void enetc4_set_hd_flow_control (struct enetc_pf *pf,bool enable) -{ -struct enetc_si *si = pf->si; -u32 old_val, val; - -if (!pf->caps.half_duplex) -return ; - - old_val =enetc_port_mac_rd (si,ENETC4_PM_CMD_CFG (0 )); - val =u32_replace_bits (old_val, enable ?1 :0 ,PM_CMD_CFG_HD_FCEN ); -if (val == old_val) -return ; - -enetc_port_mac_wr (si,ENETC4_PM_CMD_CFG (0 ), val); -} -static void enetc4_set_rx_pause (struct enetc_pf *pf,bool rx_pause) {struct enetc_si *si = pf->si;
@@ -894,13 +870,11 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config,struct enetc_pf *pf =phylink_to_enetc_pf (config);struct enetc_si *si = pf->si;struct enetc_ndev_priv *priv; -bool hd_fc = false; priv =netdev_priv (si->ndev);enetc4_set_port_speed (priv, speed); -if (!phylink_autoneg_inband (mode) && -phy_interface_mode_is_rgmii (interface)) +if (phy_interface_mode_is_rgmii (interface))enetc4_set_rgmii_mac (pf, speed, duplex);if (interface ==PHY_INTERFACE_MODE_RMII )
@@ -912,18 +886,8 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config,*/ if (priv->active_offloads &ENETC_F_QBU ) tx_pause = false; - }else {/* DUPLEX_HALF */ -if (tx_pause || rx_pause) - hd_fc = true; - -/* As per 802.3 annex 31B, PAUSE frames are only supported -* when the link is configured for full duplex operation. -*/ - tx_pause = false; - rx_pause = false; } -enetc4_set_hd_flow_control (pf, hd_fc);enetc4_set_tx_pause (pf, priv->num_rx_rings, tx_pause);enetc4_set_rx_pause (pf, rx_pause);enetc4_mac_tx_enable (pf);
drivers/net/ethernet/freescale/enetc/enetc_pf.h +0 -1
@@ -17,7 +17,6 @@ struct enetc_vf_state { };struct enetc_port_caps { -u32 half_duplex:1 ;int num_vsi;int num_msix;int num_rx_bdr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1741/1815 net: enetc: restore RX ring congestion mode for ENETC v4
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit fa1a8457b8581725ae237efefb2358eddd7e05c9 ]
ENETC v4 has the same problem as ENETC v1: the RX BD ring congestion mode (CM) is only configured in the phylink .mac_link_up() callback, so it is cleared when enetc_reconfigure() rebuilds the RX BD rings at runtime (for example when enabling or disabling PTP RX hardware timestamping) without a link status change, and it is never restored. As a result, the MAC can no longer generate PAUSE frames on ingress congestion and flow control stops working.
Fix it in the same way as ENETC v1. Track the desired CM state in the software flag ENETC_RXBDR_CM. Route enetc4_set_tx_pause() through the shared helper enetc_set_congestion_mode(), which sets or clears the flag according to tx_pause and updates the ENETC_RBMR_CM bit under si->gen_lock. When the RX BD rings are (re)enabled, enetc_enable_rxbdr() consults this flag and restores the CM bit accordingly, so flow control survives ring reconfiguration even when the link status does not change.
--- drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +4 -12
@@ -708,22 +708,14 @@ static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause)enetc_port_mac_wr (si,ENETC4_PM_CMD_CFG (0 ), val); } -static void enetc4_set_tx_pause (struct enetc_pf *pf,int num_rxbdr,bool tx_pause) +static void enetc4_set_tx_pause (struct enetc_pf *pf,bool tx_pause) { +struct enetc_ndev_priv *priv =netdev_priv (pf->si->ndev);u32 pause_off_thresh =0 , pause_on_thresh =0 ;u32 init_quanta =0 , refresh_quanta =0 ;struct enetc_hw *hw = &pf->si->hw; -u32 rbmr, old_rbmr; -int i; -for (i =0 ; i < num_rxbdr; i++) { - old_rbmr =enetc_rxbdr_rd (hw, i,ENETC_RBMR ); - rbmr =u32_replace_bits (old_rbmr, tx_pause ?1 :0 ,ENETC_RBMR_CM ); -if (rbmr == old_rbmr) -continue ; - -enetc_rxbdr_wr (hw, i,ENETC_RBMR , rbmr); - } +enetc_set_congestion_mode (priv, tx_pause);if (tx_pause) {/* When the port first enters congestion, send a PAUSE request
@@ -888,7 +880,7 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config, tx_pause = false; } -enetc4_set_tx_pause (pf, priv->num_rx_rings, tx_pause); +enetc4_set_tx_pause (pf, tx_pause);enetc4_set_rx_pause (pf, rx_pause);enetc4_mac_tx_enable (pf);enetc4_mac_rx_enable (pf);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1742/1815 net/sched: act_ife: Only operate on Ethernet frames
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 5b483f7791b079bb97d411f1066652ff659207ff ]
act_ife encapsulates/decapsulates the original Ethernet header and uses skb->dev->hard_header_len as the length of that header. That is only correct for Ethernet devices: on a device where hard_header_len does not match the L2 header that was actually pulled (PPP reports PPP_HDRLEN while nothing is stripped on ingress), the ingress skb_push()/skb_pull() use the wrong length and can hit skb_under_panic when headroom is tight.
IFE is Ethernet-only by design - it builds an outer ethhdr, rewrites h_source/h_dest/h_proto, and calls eth_type_trans() on decode - so instead of trying to make the offsets work for arbitrary link types, simply drop packets that do not carry an Ethernet header.
Checking skb->dev->type alone is not enough. We have to cater for a corner case where mirred can redirect an skb from a non-Ethernet device to an Ethernet one, and skb->dev then says nothing about the framing the skb actually has: an skb redirected from ppp0 reaches the target's ingress hook with mac_len 0 and no Ethernet header at all. So at ingress also require mac_len to be ETH_HLEN. On egress mac_len is not maintained, so the device type is all we have; a bogus redirect there yields a malformed frame rather than an out-of-bounds push, and it would be malformed with or without IFE.
That corner case is not theoretical - redirecting from ppp0 into a veth that has an ife encode action on its ingress hook panics without this patch:
skbuff: skb_under_panic: len:98 put:14 head:ffff88800e410000
data:ffff88800e40fff5 tail:0x57 end:0x640 dev:veth3 kernel BUG at net/core/skbuff.c:214! Call Trace: skb_push (net/core/skbuff.c:224 net/core/skbuff.c:2657) tcf_ife_act (net/sched/act_ife.c:829 net/sched/act_ife.c:874) tc_run (net/core/dev.c:4463) netif_receive_skb (net/core/dev.c:6463 net/core/dev.c:6522) tcf_mirred_to_dev (net/sched/act_mirred.c:248 net/sched/act_mirred.c:328) tcf_mirred_act (net/sched/act_mirred.c:489) tc_run (net/core/dev.c:4463) process_backlog (net/core/dev.c:6728)
With Ethernet framing guaranteed, use ETH_HLEN instead of hard_header_len.
--- net/ife/ife.c | 14 +++++++------- net/sched/act_ife.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 11 deletions(-)
net/ife/ife.c +7 -7
@@ -37,7 +37,7 @@ void *ife_encode(struct sk_buff *skb, u16 metalen)* where ORIGDATA = original ethernet header ... */ int hdrm = metalen +IFE_METAHDRLEN ; -int total_push = hdrm + skb->dev->hard_header_len; +int total_push = hdrm +ETH_HLEN ;struct ifeheadr *ifehdr;struct ethhdr *iethh;/* inner ether header */ int skboff =0 ;
@@ -50,9 +50,9 @@ void *ife_encode(struct sk_buff *skb, u16 metalen) iethh = (struct ethhdr *) skb->data;__skb_push (skb, total_push); -memcpy (skb->data, iethh, skb->dev->hard_header_len); +memcpy (skb->data, iethh,ETH_HLEN );skb_reset_mac_header (skb); - skboff += skb->dev->hard_header_len; + skboff +=ETH_HLEN ;/* total metadata length */ ifehdr = (struct ifeheadr *) (skb->data + skboff);
@@ -69,12 +69,12 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen)int total_pull;u16 ifehdrln; -if (!pskb_may_pull (skb, skb->dev->hard_header_len +IFE_METAHDRLEN )) +if (!pskb_may_pull (skb,ETH_HLEN +IFE_METAHDRLEN ))return NULL ; - ifehdr = (struct ifeheadr *) (skb->data + skb->dev->hard_header_len); + ifehdr = (struct ifeheadr *)(skb->data +ETH_HLEN ); ifehdrln =ntohs (ifehdr->metalen); - total_pull = skb->dev->hard_header_len + ifehdrln; + total_pull =ETH_HLEN + ifehdrln;if (unlikely (ifehdrln <2 ))return NULL ;
@@ -82,7 +82,7 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen)if (unlikely (!pskb_may_pull (skb, total_pull +ETH_HLEN )))return NULL ; - ifehdr = (struct ifeheadr *)(skb->data + skb->dev->hard_header_len); + ifehdr = (struct ifeheadr *)(skb->data +ETH_HLEN );skb_set_mac_header (skb, total_pull);__skb_pull (skb, total_pull); *metalen = ifehdrln -IFE_METAHDRLEN ;
net/sched/act_ife.c +28 -4
@@ -28,6 +28,7 @@#include <uapi/linux/tc_act/tc_ife.h> #include <net/tc_act/tc_ife.h> #include <linux/etherdevice.h> +#include <linux/if_arp.h> #include <net/ife.h> #include <net/tc_wrapper.h>
@@ -723,7 +724,7 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a,tcf_lastuse_update (&ife->tcf_tm);if (skb_at_tc_ingress (skb)) -skb_push (skb, skb->dev->hard_header_len); +skb_push (skb,ETH_HLEN ); tlv_data =ife_decode (skb, &metalen);if (unlikely (!tlv_data)) {
@@ -795,7 +796,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,where ORIGDATA = original ethernet header ... */ u16 metalen =ife_get_sz (skb, p); -int hdrm = metalen + skb->dev->hard_header_len +IFE_METAHDRLEN ; +int hdrm = metalen +ETH_HLEN +IFE_METAHDRLEN ;unsigned int skboff =0 ;int new_len = skb->len + hdrm;bool exceed_mtu = false;
@@ -826,7 +827,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, }if (skb_at_tc_ingress (skb)) -skb_push (skb, skb->dev->hard_header_len); +skb_push (skb,ETH_HLEN ); ife_meta =ife_encode (skb, metalen);if (!ife_meta)
@@ -856,11 +857,27 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, oethh->h_proto =htons (p->eth_type);if (skb_at_tc_ingress (skb)) -skb_pull (skb, skb->dev->hard_header_len); +skb_pull (skb,ETH_HLEN );return action; } +/* IFE encapsulates the original Ethernet header and, on decode, expects to +* find one, so it can only ever work on skbs that carry one. Loopback carries +* Ethernet header as well, so it qualifies here. +* At ingress, also verify that the L2 header about to be pushed back really +* is an Ethernet header because the skb could've been redirected with mirred +* from a non-Ethernet device. +*/ +static bool tcf_ife_is_eth_skb (const struct sk_buff *skb) +{ +if (skb->dev->type !=ARPHRD_ETHER && + skb->dev->type !=ARPHRD_LOOPBACK ) +return false; + +return !skb_at_tc_ingress (skb) || skb->mac_len ==ETH_HLEN ; +} + TC_INDIRECT_SCOPE int tcf_ife_act(struct sk_buff *skb,const struct tc_action *a,struct tcf_result *res)
@@ -869,6 +886,13 @@ TC_INDIRECT_SCOPE int tcf_ife_act(struct sk_buff *skb,struct tcf_ife_params *p;int ret; +if (unlikely (!tcf_ife_is_eth_skb (skb))) { +bstats_update (this_cpu_ptr (ife->common.cpu_bstats), skb); +tcf_lastuse_update (&ife->tcf_tm); +qstats_cpu_drop_inc (ife->common.cpu_qstats); +return TC_ACT_SHOT ; + } + p =rcu_dereference_bh (ife->params);if (p->flags &IFE_ENCODE ) { ret =tcf_ife_encode (skb, a, res, p);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1743/1815 net: mana: Cap MSI-X vectors to the device MSI-X table size
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 2c7493f980140a5c40eb4f98f97c557193a2c330 ]
mana_gd_query_max_resources() sizes gc->num_msix_usable from resp.max_msix and the CPU count, but never from the device MSI-X table. On a 1792 vCPU M-series VM that yields 1793 while the table has 1024 entries, and mana_gd_setup_remaining_irqs() then walks indices 1..1792, running off the end of the region mapped by msix_map_region():
BUG: unable to handle page fault for address: ff8e347f8b99800c RIP: 0010:msix_prepare_msi_desc+0x7a/0x90 RAX: 0000000000004000 RBX: ff4330cb164ea780 RCX: ff8e347f8b998000 Call Trace: <TASK> __msi_domain_alloc_irqs+0x13a/0x440 msi_domain_alloc_irq_at+0x149/0x1b0 mana_gd_setup+0x351/0x890 mana_gd_probe+0x274/0x390 </TASK>
RAX is index 1024 * PCI_MSIX_ENTRY_SIZE, one entry past the table.
msi_insert_desc() does range check the index, but only against the MSI domain hwsize, which matches the table only for devices on an MSI parent domain. With a global PCI/MSI domain hwsize is MSI_XA_DOMAIN_SIZE, so nothing bounds the request.
Cap num_msix_usable with pci_msix_vec_count().
--- .../net/ethernet/microsoft/mana/gdma_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/microsoft/mana/gdma_main.c +19 -0
@@ -180,6 +180,7 @@ static int mana_gd_query_max_resources(struct pci_dev *pdev)struct gdma_query_max_resources_resp resp = {};struct gdma_general_req req = {};unsigned int max_num_queues; +unsigned int msix_vec_count;u8 bm_hostmode;u16 num_ports;int err;
@@ -216,6 +217,24 @@ static int mana_gd_query_max_resources(struct pci_dev *pdev) gc->num_msix_usable =min (resp.max_msix,num_online_cpus () +1 ); } +/* MSI-X vectors are allocated by index into the device MSI-X table, so +* never ask for more than the table holds. It can be smaller than both +* resp.max_msix and the CPU count. +*/ + err =pci_msix_vec_count (pdev); +if (err <=0 ) { +dev_err (gc->dev,"Failed to query MSI-X table size: %d\n" , err); +return err <0 ? err : -ENOSPC ; + } + msix_vec_count = err; + +if (gc->num_msix_usable > msix_vec_count) { +dev_info (gc->dev, +"Limiting MSI-X vectors from %u to table size %u\n" , + gc->num_msix_usable, msix_vec_count); + gc->num_msix_usable = msix_vec_count; + } +if (gc->num_msix_usable <=1 )return -ENOSPC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1744/1815 net/rds: use wq_has_sleeper() in rds_cong_map_updated()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
[ Upstream commit d4f484661961636eb90d287050959e613795f73a ]
rds_cong_map_updated() runs after a peer's congestion map has been rewritten (by rds_tcp_cong_recv() and rds_ib_cong_recv(), or the clear-all in the loopback and IB send-completion paths). It bumps rds_cong_generation and then checks waitqueue_active() on map->m_waitq and on rds_poll_waitq to decide whether anyone needs waking. atomic_inc() carries no ordering and waitqueue_active() is a plain load, so nothing orders the map and generation stores before the wait queue reads. The waiters do the mirror image: rds_cong_wait() adds itself to m_waitq and then tests the port bit, and rds_poll() registers on rds_poll_waitq and then reads the generation. That is the store-buffering pattern described above waitqueue_active() in include/linux/wait.h - the updater can observe an empty wait queue while the waiter still observes the port as congested, and no wake-up is issued.
rds_cong_wait() is an interruptible sleep with no timeout, so a sender blocked on a congested port stays blocked until the next congestion update from that peer arrives or a signal is delivered. A poll() waiter misses the map-updated notification the same way.
Use wq_has_sleeper(), which is waitqueue_active() preceded by the required full barrier, as rds_tcp_state_change() already does for the same pattern.
--- net/rds/cong.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rds/cong.c +2 -2
@@ -256,9 +256,9 @@ void rds_cong_map_updated(struct rds_cong_map *map, uint64_t portmask) map, &map->m_addr);rds_stats_inc (s_cong_update_received);atomic_inc (&rds_cong_generation); -if (waitqueue_active (&map->m_waitq)) +if (wq_has_sleeper (&map->m_waitq))wake_up (&map->m_waitq); -if (waitqueue_active (&rds_poll_waitq)) +if (wq_has_sleeper (&rds_poll_waitq))wake_up_all (&rds_poll_waitq);if (portmask && !list_empty (&rds_cong_monitor)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1745/1815 octeontx2-pf: fix NULL deref of af_xdp_zc_qidx on rep setup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit b09a0503c755b6609fad59a84cc7f05b6843a03c ]
af_xdp_zc_qidx tracks receive queues using AF_XDP zero-copy and is allocated during PF/VF probe. Representors and other non-AF_XDP paths leave the pointer NULL, but several call sites used test_bit() on it unconditionally.
Switching to devlink eswitch mode creates representors and runs otx2_init_hw_resources(), which reaches otx2_pool_aq_init() and oopses when dereferencing the NULL bitmap. Add NULL checks before every af_xdp_zc_qidx test_bit() use in the RSS, ethtool, XSK, and pool init paths.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 6 ++++-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 3 ++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4 -2
@@ -333,7 +333,8 @@ int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32 *ind_tbl)/* Get memory to put this msg */ for (idx =0 ; idx < rss->rss_size; idx++) {/* Ignore the queue if AF_XDP zero copy is enabled */ -if (test_bit (ind_tbl[idx], pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (ind_tbl[idx], pfvf->af_xdp_zc_qidx))continue ; aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox);
@@ -1510,7 +1511,8 @@ int otx2_pool_aq_init(struct otx2_nic *pfvf, u16 pool_id,if (type !=AURA_NIX_RQ )return 0 ; -if (!test_bit (pool_id, pfvf->af_xdp_zc_qidx)) { +if (!pfvf->af_xdp_zc_qidx || + !test_bit (pool_id, pfvf->af_xdp_zc_qidx)) { pp_params.order =get_order (buf_size); pp_params.flags =PP_FLAG_DMA_MAP ; pp_params.pool_size =min (OTX2_PAGE_POOL_SZ , numptrs);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +2 -1
@@ -939,7 +939,8 @@ static int otx2_get_rxfh(struct net_device *dev,for (idx =0 ; idx < rss->rss_size; idx++) {/* Ignore if the rx queue is AF_XDP zero copy enabled */ -if (test_bit (rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx))continue ; indir[idx] = rss->ind_tbl[idx]; }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c +2 -1
@@ -193,7 +193,8 @@ int otx2_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)void otx2_attach_xsk_buff (struct otx2_nic *pfvf,struct otx2_snd_queue *sq,int qidx) { -if (test_bit (qidx, pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (qidx, pfvf->af_xdp_zc_qidx)) sq->xsk_pool =xsk_get_pool_from_qid (pfvf->netdev, qidx); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1746/1815 octeontx2-af: fix cn20k mailbox lifetime on repeated rvu_mbox_init()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sai Krishna <[email protected]>
[ Upstream commit 3b11a77f69980932c3924054d66e565c9a135747 ]
rvu_mbox_init() is called separately for AF-PF mailboxes during probe and for AF-VF mailboxes when SR-IOV is enabled. Each call used to allocate a new ng_rvu object, leaking the first allocation when the pointer was overwritten on the second call.
Sharing one ng_rvu across both paths exposed several teardown bugs:
the error path freed all cn20k mailbox DMA and kfree()d ng_rvu even when only the failing init type should be unwound, leaving live AF-PF mailbox memory in use after an AF-VF init failure. mutex_init() was also re-run on the AF-VF path while AF-PF mailbox handlers could still hold rvu->mbox_lock. Probe and SR-IOV failure paths did not release cn20k mailbox DMA either, since cleanup only happened in rvu_remove().
Allocate ng_rvu once with devm_kzalloc(), initialize mbox_lock in the same block, unwind only the mailbox memory for the failing init type, and free cn20k mailbox DMA from the probe and pci_enable_sriov() error paths.
--- .../ethernet/marvell/octeontx2/af/cn20k/api.h | 1 + .../marvell/octeontx2/af/cn20k/mbox_init.c | 21 +++++++++- .../net/ethernet/marvell/octeontx2/af/rvu.c | 39 +++++++++++-------- 3 files changed, 42 insertions(+), 19 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h +1 -0
@@ -21,6 +21,7 @@ int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int num);int cn20k_rvu_get_mbox_regions (struct rvu *rvu,void **mbox_addr,int num,int type,unsigned long *pf_bmap);void cn20k_free_mbox_memory (struct rvu *rvu); +void cn20k_free_mbox_memory_type (struct rvu *rvu,int type);int cn20k_register_afpf_mbox_intr (struct rvu *rvu);int cn20k_register_afvf_mbox_intr (struct rvu *rvu,int pf_vec_start);void cn20k_rvu_enable_mbox_intr (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c +19 -2
@@ -335,13 +335,30 @@ int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int ndevs)return rvu_alloc_mbox_memory (rvu, type, ndevs,MBOX_SIZE ); } +void cn20k_free_mbox_memory_type (struct rvu *rvu,int type) +{ +if (!is_cn20k (rvu->pdev) || !rvu->ng_rvu) +return ; + +switch (type) { +case TYPE_AFPF : +qmem_free (rvu->dev, rvu->ng_rvu->pf_mbox_addr); + rvu->ng_rvu->pf_mbox_addr =NULL ; +break ; +case TYPE_AFVF : +qmem_free (rvu->dev, rvu->ng_rvu->vf_mbox_addr); + rvu->ng_rvu->vf_mbox_addr =NULL ; +break ; + } +} +void cn20k_free_mbox_memory (struct rvu *rvu) {if (!is_cn20k (rvu->pdev))return ; -qmem_free (rvu->dev, rvu->ng_rvu->pf_mbox_addr); -qmem_free (rvu->dev, rvu->ng_rvu->vf_mbox_addr); +cn20k_free_mbox_memory_type (rvu,TYPE_AFPF ); +cn20k_free_mbox_memory_type (rvu,TYPE_AFVF ); }void cn20k_rvu_disable_afvf_intr (struct rvu *rvu,int vfs)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +22 -17
@@ -2585,12 +2585,6 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,if (!pf_bmap)return -ENOMEM ; - ng_rvu_mbox =kzalloc_obj (*ng_rvu_mbox); -if (!ng_rvu_mbox) { - err = -ENOMEM ; - goto free_bitmap; - } -/* RVU VFs */ if (type ==TYPE_AFVF )bitmap_set (pf_bmap,0 , num);
@@ -2604,15 +2598,22 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, } } - rvu->ng_rvu = ng_rvu_mbox; +if (!rvu->ng_rvu) { + ng_rvu_mbox =devm_kzalloc (rvu->dev,sizeof (*ng_rvu_mbox),GFP_KERNEL ); +if (!ng_rvu_mbox) { + err = -ENOMEM ; + goto free_bitmap; + } + + rvu->ng_rvu = ng_rvu_mbox; - rvu->ng_rvu->rvu_mbox_ops = &rvu_mbox_ops; + rvu->ng_rvu->rvu_mbox_ops = &rvu_mbox_ops; +mutex_init (&rvu->mbox_lock); + } err =cn20k_rvu_mbox_init (rvu, type, num);if (err) - goto free_mem; - -mutex_init (&rvu->mbox_lock); + goto free_bitmap; mbox_regions =kcalloc (num,sizeof (void __iomem *),GFP_KERNEL );if (!mbox_regions) {
@@ -2702,14 +2703,18 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, free_regions:kfree (mbox_regions); free_qmem: -cn20k_free_mbox_memory (rvu); -free_mem: -kfree (rvu->ng_rvu); +cn20k_free_mbox_memory_type (rvu, type); free_bitmap:bitmap_free (pf_bmap);return err; } +static void rvu_free_cn20k_mbox_memory (struct rvu *rvu) +{ +if (is_cn20k (rvu->pdev)) +cn20k_free_mbox_memory (rvu); +} +static void rvu_mbox_destroy (struct mbox_wq_info *mw) {struct otx2_mbox *mbox = &mw->mbox;
@@ -3519,6 +3524,7 @@ static int rvu_enable_sriov(struct rvu *rvu)if (err) {rvu_disable_afvf_intr (rvu);rvu_mbox_destroy (&rvu->afvf_wq_info); +cn20k_free_mbox_memory_type (rvu,TYPE_AFVF );return err; }
@@ -3681,6 +3687,7 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_mbox:rvu_mbox_destroy (&rvu->afpf_wq_info); err_hwsetup: +rvu_free_cn20k_mbox_memory (rvu);rvu_cgx_exit (rvu);rvu_fwdata_exit (rvu);rvu_mcs_exit (rvu);
@@ -3723,9 +3730,7 @@ static void rvu_remove(struct pci_dev *pdev)pci_set_drvdata (pdev,NULL );devm_kfree (&pdev->dev, rvu->hw); -if (is_cn20k (rvu->pdev)) -cn20k_free_mbox_memory (rvu); -kfree (rvu->ng_rvu); +rvu_free_cn20k_mbox_memory (rvu);devm_kfree (&pdev->dev, rvu);atomic_set (&device_bound,0 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1747/1815 cifs: fix clearing stats for fastest execution of each smb2 command
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 48cab1fd5720508148673f59d8ed52c7c7fffca2 ]
The code to clear the 'fastest_cmd' statistics has a typo that repeatedly clears the stat for cmd 0, rather than iterating through each cmd. Fix the typo (0->i).
--- fs/smb/client/cifs_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifs_debug.c +1 -1
@@ -754,7 +754,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,atomic_set (&server->smb2slowcmd[i],0 ); server->time_per_cmd[i] =0 ; server->slowest_cmd[i] =0 ; - server->fastest_cmd[0] = 0; + server->fastest_cmd[i] = 0; }#endif /* CONFIG_CIFS_STATS2 */ list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1748/1815 smb/client: preserve open info type across compound queries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ze Tan <[email protected]>
[ Upstream commit 9437f2113b60a5a8593aa4b41b6f6632f5cabcfd ]
contains_posix_file_info describes the metadata stored in the fi/posix_fi union. GET_REPARSE and QUERY_WSL_EA do not update that union, so clearing the flag while processing those responses can make POSIX metadata look like FILE_ALL_INFORMATION.
Set the flag when CREATE or a validated query response actually populates the union, and leave it unchanged for auxiliary compound operations. This also avoids changing the type when a query fails before copying any metadata.
The issue can be reproduced against a Samba server with SMB3 UNIX extensions enabled:
mount -t cifs //<server>/<share> /mnt/cifs \
-o vers=3.1.1,posix,reparse=nfs,actimeo=0
mkfifo /mnt/cifs/test-fifo
umount /mnt/cifs
mount -t cifs //<server>/<share> /mnt/cifs \
-o vers=3.1.1,posix,reparse=nfs,actimeo=0
stat -c '%F %s' /mnt/cifs/test-fifoBefore this change, stat reports "fifo 1024" although the server-side EOF is zero. After this change, it reports "fifo 0".
--- fs/smb/client/smb2inode.c | 9 +++++---- fs/smb/client/smb2pdu.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)
fs/smb/client/smb2inode.c +5 -4
@@ -576,6 +576,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, idata->fi.Attributes = create_rsp->FileAttributes; idata->fi.AllocationSize = create_rsp->AllocationSize; idata->fi.EndOfFile = create_rsp->EndofFile; + idata->contains_posix_file_info = false;if (le32_to_cpu (idata->fi.NumberOfLinks) ==0 ) idata->fi.NumberOfLinks =cpu_to_le32 (1 );/* dummy value */ idata->fi.DeletePending =0 ;/* successful open = not delete pending */
@@ -598,7 +599,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,switch (cmds[i]) {case SMB2_OP_QUERY_INFO : idata = in_iov[i].iov_base; - idata->contains_posix_file_info = false;if (rc ==0 && cfile && cfile->symlink_target) { idata->symlink_target =kstrdup (cfile->symlink_target,GFP_KERNEL );if (!idata->symlink_target)
@@ -611,6 +611,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,le16_to_cpu (qi_rsp->OutputBufferOffset),le32_to_cpu (qi_rsp->OutputBufferLength), &rsp_iov[i + 1], sizeof(idata->fi), (char *)&idata->fi); +if (!rc) + idata->contains_posix_file_info = false; }SMB2_query_info_free (&rqst[num_rqst++]);if (rc)
@@ -622,7 +624,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,break ;case SMB2_OP_POSIX_QUERY_INFO : idata = in_iov[i].iov_base; - idata->contains_posix_file_info = true;if (rc ==0 && cfile && cfile->symlink_target) { idata->symlink_target =kstrdup (cfile->symlink_target,GFP_KERNEL );if (!idata->symlink_target)
@@ -636,6 +637,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,le32_to_cpu (qi_rsp->OutputBufferLength), &rsp_iov[i +1 ],sizeof (idata->posix_fi)/* add SIDs */ , (char *)&idata->posix_fi); +if (!rc) + idata->contains_posix_file_info = true; }if (rc ==0 ) rc =parse_posix_sids (idata, &rsp_iov[i +1 ]);
@@ -707,7 +710,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, idata = in_iov[i].iov_base; idata->reparse.io.iov = *iov; idata->reparse.io.buftype = resp_buftype[i +1 ]; - idata->contains_posix_file_info = false;/* BB VERIFY */ rbuf =reparse_buf_ptr (iov);if (IS_ERR (rbuf)) { rc =PTR_ERR (rbuf);
@@ -729,7 +731,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,case SMB2_OP_QUERY_WSL_EA :if (!rc) { idata = in_iov[i].iov_base; - idata->contains_posix_file_info = false; qi_rsp = rsp_iov[i +1 ].iov_base; data[0 ] = (u8 *)qi_rsp +le16_to_cpu (qi_rsp->OutputBufferOffset); size[0 ] =le32_to_cpu (qi_rsp->OutputBufferLength);
fs/smb/client/smb2pdu.c +1 -0
@@ -3372,6 +3372,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,#endif /* CIFS_DEBUG2 */ if (file_info) { + buf->contains_posix_file_info = false; file_info->CreationTime = rsp->CreationTime; file_info->LastAccessTime = rsp->LastAccessTime; file_info->LastWriteTime = rsp->LastWriteTime;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1749/1815 selftests/mm: skip COW tmpfile cases when fallocate() is unsupported
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 4004c130c358b1561a55323b0e747f20f5133f7b ]
Patch series "selftests/mm: Handle unsupported and transient test conditions", v3.
Several MM selftests report failures when the test environment lacks an underlying prerequisite, such as fallocate() support, MADV_REMOVE, local page-cache semantics, or swap.
This series converts those unsupported cases to SKIP while preserving failures for unexpected errors. It also allows migration tests to retry transient move_pages() failures.
This patch (of 4):
The tmpfile-backed COW cases allocate a one-page file with fallocate() before exercising private and shared mappings. When the filesystem backing tmpfile() does not implement fallocate(), setup fails with EOPNOTSUPP and no COW behavior is exercised.
This occurs when the temporary directory resides on a filesystem with limited allocation support, such as NFSv3. Reporting a failure adds noise because the test prerequisite is absent rather than the COW implementation being broken.
Report EOPNOTSUPP as a skip. Continue treating every other fallocate() error as a failure so unexpected setup regressions remain visible.
--- tools/testing/selftests/mm/cow.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/mm/cow.c +7 -2
@@ -1718,8 +1718,13 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)/* File consists of a single page filled with zeroes. */ if (fallocate (fd,0 ,0 , pagesize)) { -ksft_perror ("fallocate() failed" ); -log_test_result (KSFT_FAIL ); +if (errno ==EOPNOTSUPP ) { +ksft_print_msg ("fallocate() not supported by filesystem\n" ); +log_test_result (KSFT_SKIP ); + }else { +ksft_perror ("fallocate() failed" ); +log_test_result (KSFT_FAIL ); + } goto close; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1750/1815 selftests/mm: fix read_file() return value check
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongfu Li <[email protected]>
[ Upstream commit 4050b5b0b60c93160a816d68ea1eb9ae92739a73 ]
read_file() returns 0 on open/read failures and never returns negative values. Existing < 0 error checks never trigger, so read failures are silently ignored. Check for zero return to detect read_file() failures.
Also fix misleading error message in get_finfo(). The error string incorrectly references read_num when reading uevent files.
--- tools/testing/selftests/mm/khugepaged.c | 4 ++-- tools/testing/selftests/mm/vm_util.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/mm/khugepaged.c +2 -2
@@ -138,8 +138,8 @@ static void get_finfo(const char *dir) major(path_stat.st_dev), minor(path_stat.st_dev)) >= sizeof(path))ksft_exit_fail_msg ("%s: Pathname is too long\n" , __func__); -if (read_file (path, buf,sizeof (buf)) <0 ) -ksft_exit_fail_perror ("read_file(read_num)" ); +if (!read_file (path, buf,sizeof (buf))) +ksft_exit_fail_perror ("read_file(uevent)" );if (strstr (buf,"DEVTYPE=disk" )) {/* Found it */ if (snprintf(finfo.dev_queue_read_ahead_path,
tools/testing/selftests/mm/vm_util.c +1 -1
@@ -755,7 +755,7 @@ unsigned long read_num(const char *path) {char buf[21 ]; -if (read_file (path, buf,sizeof (buf)) <0 ) +if (!read_file (path, buf,sizeof (buf)))ksft_exit_fail_perror ("read_file()" );return strtoul (buf,NULL ,10 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1751/1815 mm/memcontrol: avoid false sharing between vmstats and events
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit c1afbd5de131f5e3c4fc7559acf055f8d9d86868 ]
Moving v1 userspace eventfd handling into memcontrol-v1.c shrank struct vmpressure from 112 to 24 bytes when CONFIG_MEMCG_V1 is disabled. This moved memory_events_local[MEMCG_SWAP_FAIL] and the hot vmstats_percpu pointer onto the same cacheline.
The stress-ng mremap stressor exercises MADV_PAGEOUT with swap disabled, generating about 20 million MEMCG_SWAP_FAIL updates per 60-second run on a 176-CPU test system. Those writes bounce the line while memcg statistics paths load vmstats_percpu.
Move cgwb_list into the existing alignment gap and cacheline-align vmstats_percpu. This separates the pointer from the event counters without increasing the size of struct mem_cgroup in the tested configuration.
The blamed commit reduced median mremap throughput by 4.38% on the test system with one socket. The patched kernel brings the performance to within 0.5% of the parent which is within the observed boot-to-boot spread (up to 1.2%).
--- include/linux/memcontrol.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/linux/memcontrol.h +7 -2
@@ -270,10 +270,15 @@ struct mem_cgroup {#endif int kmemcg_id; -struct memcg_vmstats_percpu __percpu *vmstats_percpu; -#ifdef CONFIG_CGROUP_WRITEBACK struct list_head cgwb_list; +#endif + +/* Keep the hot per-CPU stats pointer away from memory event counters. */ +struct memcg_vmstats_percpu __percpu *vmstats_percpu +____cacheline_aligned_in_smp ; + +#ifdef CONFIG_CGROUP_WRITEBACK struct wb_domain cgwb_domain;struct memcg_cgwb_frn cgwb_frn[MEMCG_CGWB_FRN_CNT ];#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1752/1815 maple_tree: catch race in mas_alloc_cyclic()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett (Oracle) <[email protected]>
[ Upstream commit 35f1342e5b893a740eff2ef9ab337bfaa63ab76d ]
If mas_alloc_cyclic() is called during a low memory situation, it is possible the lock may be dropped so reclaim can occur. There is a window where some other task may allocate the same id and cause the mas_insert() to fail with -EEXIST. In this scenario the function will return -EEXIST, which is not expected.
Modifying the retry on mas_nomem() to re-search for a slot means that any race with other writes will not matter as the lock will be held between finding the index and writing the index.
Moving the flag logic avoids cases where the flag is modified on drop lock/reacquire or when the write fails after clearing the flag.
No existing users are exposed to this issue.
--- lib/maple_tree.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-)
lib/maple_tree.c +24 -19
@@ -3793,35 +3793,40 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp, void *entry, unsigned long range_lo, unsigned long range_hi, unsigned long *next, gfp_t gfp) { - unsigned long min = range_lo; -int ret =0 ; - - range_lo =max (min, *next); - ret =mas_empty_area (mas, range_lo, range_hi,1 ); -if ((mas->tree->ma_flags &MT_FLAGS_ALLOC_WRAPPED ) && ret ==0 ) { - mas->tree->ma_flags &= ~MT_FLAGS_ALLOC_WRAPPED ; - ret =1 ; - } -if (ret <0 && range_lo > min) { -mas_reset (mas); - ret =mas_empty_area (mas, min, range_hi,1 ); -if (ret ==0 ) - ret =1 ; - } -if (ret <0 ) -return ret; + int ret; +unsigned long min; + min = range_lo;do { + range_lo =max (min, *next); + ret =mas_empty_area (mas, range_lo, range_hi,1 ); +if (ret <0 && range_lo > min) { +mas_reset (mas); + ret =mas_empty_area (mas, min, range_hi,1 ); +if (ret ==0 ) + ret =1 ; + } +if (ret <0 ) + goto out; +mas_insert (mas, entry); }while (mas_nomem (mas, gfp)); -if (mas_is_err (mas)) -return xa_err (mas->node); +if (mas_is_err (mas)) { + ret =xa_err (mas->node); + goto out; + } + +if ((mas->tree->ma_flags &MT_FLAGS_ALLOC_WRAPPED ) && ret ==0 ) { + mas->tree->ma_flags &= ~MT_FLAGS_ALLOC_WRAPPED ; + ret =1 ; + } *startp = mas->index; *next = *startp +1 ;if (*next ==0 ) mas->tree->ma_flags |=MT_FLAGS_ALLOC_WRAPPED ; +out:mas_destroy (mas);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1753/1815 maple_tree: fix argument name in header
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett (Oracle) <[email protected]>
[ Upstream commit 00f67814a14e614b749ebe54076ef1e3e6454f2b ]
The mas_prev_range() function takes a min and not a max.
--- include/linux/maple_tree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/maple_tree.h +1 -1
@@ -572,7 +572,7 @@ void maple_tree_init(void);void mas_destroy (struct ma_state *mas);void *mas_prev (struct ma_state *mas,unsigned long min); -void *mas_prev_range (struct ma_state *mas,unsigned long max); +void *mas_prev_range (struct ma_state *mas,unsigned long min);void *mas_next (struct ma_state *mas,unsigned long max);void *mas_next_range (struct ma_state *mas,unsigned long max);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1754/1815 selftests/proc: make proc-maps-race work with READ_IMPLIES_EXEC
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 0685630fdccb62dcb0e3f44525a40578da5f6dc8 ]
test_maps_tearing_from_split times out when READ_IMPLIES_EXEC is set. This happens by default on pre-ARMv6 CPUs, which lack no-execute support.
split_vma() re-maps the first page with mod_info->prot | PROT_EXEC to make it differ from its neighbours. With READ_IMPLIES_EXEC the original mapping is already executable, so no split occurs and the test hangs waiting for the modifier child.
Use PROT_NONE for the split mapping, which always differs from its readable neighbours.
--- tools/testing/selftests/proc/proc-maps-race.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/proc-maps-race.c +2 -1
@@ -490,7 +490,8 @@ static bool query_addr_at(int maps_fd, void *addr,static inline bool split_vma (FIXTURE_DATA (proc_maps_race) *self) { -return mmap (self->mod_info->addr, self->page_size, self->mod_info->prot |PROT_EXEC , +/* PROT_NONE differs from both readable neighbors. */ +return mmap (self->mod_info->addr, self->page_size,PROT_NONE ,MAP_PRIVATE |MAP_ANONYMOUS |MAP_FIXED ,-1 ,0 ) !=MAP_FAILED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1755/1815 net/sched: act_skbmod: fix length calculations and avoid invalid header warnings
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 81d0d1e64f30d9989c829c0953cd6e6c68d9c5fb ]
syzbot reported a warning in skb_network_header_len() triggered by tcf_skbmod_act():
!skb_transport_header_was_set(skb)
WARNING: CPU: 0 PID: 14949 at include/linux/skbuff.h:3243 skb_network_header_len include/linux/skbuff.h:3243 [inline] WARNING: CPU: 0 PID: 14949 at net/sched/act_skbmod.c:55 tcf_skbmod_act+0xfe8/0x1810 net/sched/act_skbmod.c:55
There are a few issues in tcf_skbmod_act():
1. Calling skb_network_header_len() assumes skb->transport_header is set, which is not guaranteed when tcf_skbmod_act() runs at TC ingress.
2. Unconditionally calling skb_mac_header_len() at the beginning of tcf_skbmod_act() triggers a warning on L3 devices (e.g. TUN) where the MAC header is unset, evaluating to an underflowed garbage length.
3. On TC ingress, skb->data points to the network header. Adding the MAC header length to the IP header length causes skb_ensure_writable() to request more bytes than the actual IP packet length, dropping valid short packets (e.g. 28-byte UDP/IPv4 packets).
Fix these by:
- Using skb_network_offset(skb) + sizeof(struct iphdr/ipv6hdr) for SKBMOD_F_ECN so that the required length is correctly calculated on both ingress (offset == 0) and egress (offset == mac_len).
- Setting max_edit_len to ETH_HLEN for Ethernet header modifications after validating ARPHRD_ETHER.
--- net/sched/act_skbmod.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/sched/act_skbmod.c +8 -4
@@ -38,7 +38,6 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,if (unlikely (p->action ==TC_ACT_SHOT )) goto drop; - max_edit_len =skb_mac_header_len (skb); flags = p->flags;/* tcf_skbmod_init() guarantees "flags" to be one of the following:
@@ -51,14 +50,19 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,if (flags ==SKBMOD_F_ECN ) {switch (skb_protocol (skb, true)) {case cpu_to_be16 (ETH_P_IP ): + max_edit_len =sizeof (struct iphdr ); +break ;case cpu_to_be16 (ETH_P_IPV6 ): - max_edit_len +=skb_network_header_len (skb); + max_edit_len =sizeof (struct ipv6hdr );break ;default : goto out; } - }else if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) { - goto out; + max_edit_len +=skb_network_offset (skb); + }else { +if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) + goto out; + max_edit_len =ETH_HLEN ; } err =skb_ensure_writable (skb, max_edit_len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1756/1815 net: core: check skb_frags_readable before uncloning in skb_copy_ubufs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mina Almasry <[email protected]>
[ Upstream commit 00e11ee9831b3439264e0ae6762a0470126515af ]
skb_copy_ubufs drops clones and modifies the SKB via pskb_expand_head() before checking for !skb_frags_readable(skb). This alters the SKB geometry prior to throwing an -EFAULT on an invalid SKB. Check readability first.
--- net/core/skbuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/skbuff.c +3 -3
@@ -2004,12 +2004,12 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)int i, order, psize, new_frags;u32 d_off; -if (skb_shared (skb) ||skb_unclone (skb, gfp_mask)) -return -EINVAL ; -if (!skb_frags_readable (skb))return -EFAULT ; +if (skb_shared (skb) ||skb_unclone (skb, gfp_mask)) +return -EINVAL ; +if (!num_frags) goto release;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1757/1815 net: fix a resource leak in copy_net_ns() error handling path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 3220b62fbb8a55feebd2a826d5ead0f49f09ed5a ]
Currently, preinit_net() does two things:
(1) call ns_common_init() which might fail
(2) initialize resources which does not fail
However, preinit_net() is returning early when (1) fails, and copy_net_ns() is jumping to the dec_ucounts: label. As a result, resources allocated by net_alloc() are leaking. We need to call key_remove_domain() and net_passive_dec() in order to release resources allocated by net_alloc().
We cannot simply jump to the put_userns: label when preinit_net() failed, for (2) is not yet done. But we can reorder (1) and (2), for there is no dependency between (1) and (2). Therefore, this patch decouples (1) from preinit_net() and changes preinit_net() back to a void function, and calls ns_common_init() after preinit_net() succeeded. Then, we can jump to immediately after ns_common_free() of the put_userns: label.
--- net/core/net_namespace.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
net/core/net_namespace.c +9 -12
@@ -399,14 +399,8 @@ static __net_init void preinit_net_sysctl(struct net *net) }/* init code that must occur even if setup_net() is not called. */ -static __net_init int preinit_net (struct net *net,struct user_namespace *user_ns) +static __net_init void preinit_net (struct net *net,struct user_namespace *user_ns) { -int ret; - - ret =ns_common_init (net); -if (ret) -return ret; -refcount_set (&net->passive,1 );ref_tracker_dir_init (&net->refcnt_tracker,128 ,"net_refcnt" );ref_tracker_dir_init (&net->notrefcnt_tracker,128 ,"net_notrefcnt" );
@@ -427,7 +421,6 @@ static __net_init int preinit_net(struct net *net, struct user_namespace *user_nINIT_LIST_HEAD (&net->ptype_all);INIT_LIST_HEAD (&net->ptype_specific);preinit_net_sysctl (net); -return 0 ; }/*
@@ -570,12 +563,14 @@ struct net *copy_net_ns(u64 flags, goto dec_ucounts; } - rv =preinit_net (net, user_ns); -if (rv <0 ) - goto dec_ucounts; +preinit_net (net, user_ns); net->ucounts = ucounts;get_user_ns (user_ns); + rv =ns_common_init (net); +if (rv) + goto put_userns_no_common; + rv =down_read_killable (&pernet_ops_rwsem);if (rv <0 ) goto put_userns;
@@ -587,6 +582,7 @@ struct net *copy_net_ns(u64 flags,if (rv <0 ) { put_userns:ns_common_free (net); +put_userns_no_common:#ifdef CONFIG_KEYS key_remove_domain (net->key_domain);#endif
@@ -1289,7 +1285,8 @@ void __init net_ns_init(void)* This currently cannot fail as the initial network namespace * has a static inode number. */ -if (preinit_net (&init_net, &init_user_ns)) +preinit_net (&init_net, &init_user_ns); +if (ns_common_init (&init_net))panic ("Could not preinitialize the initial network namespace" );down_write (&pernet_ops_rwsem);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1758/1815 net/sched: fq: add overflow bounds to quantum and initial quantum
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 709f34f7c28dc4dd6c40343d101850f11e172312 ]
fq_init() computes quantum = 2 * psched_mtu() and initial_quantum = 10 * psched_mtu() with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000; the 2 * and 10 * multiplications wrap to 0 in 32-bit arithmetic, so q->quantum == 0. Then in fq_dequeue() the credit-refill loop adds 0 to f->credit (which stays <= 0) and goto begin loops forever under the qdisc lock, creating a soft lockup.
Clamp psched_mtu() to [1, 1 << 20] before multiplying so the product cannot wrap, then cap the result at 1 << 20, matching the bound already enforced on TCA_FQ_QUANTUM in fq_change().
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) is large enough that 2 * psched_mtu() wraps (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_fq.c +4 -2
@@ -1226,12 +1226,14 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) {struct fq_sched_data *q =qdisc_priv (sch); +u32 mtu;int i, err; sch->limit =10000 ; q->flow_plimit =100 ; - q->quantum =2 *psched_mtu (qdisc_dev (sch)); - q->initial_quantum =10 *psched_mtu (qdisc_dev (sch)); + mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),1 ,1 <<20 ); + q->quantum =min_t (u32,2 * mtu,1 <<20 ); + q->initial_quantum =min_t (u32,10 * mtu,1 <<20 ); q->flow_refill_delay =msecs_to_jiffies (40 ); q->flow_max_rate = ~0UL ; q->time_next_delayed_flow = ~0ULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1759/1815 net/sched: fq_codel: clamp default quantum and mtu
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit d9ebd8f9aa8b2773235889cb903fafd61f2d8585 ]
fq_codel_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, which overflows the signed flow->deficit to INT_MIN in fq_codel_dequeue(), causing an infinite loop and soft lockup. Emulate fq_codel_change() and constrain to [256, FQ_CODEL_QUANTUM_MAX].
The same unclamped psched_mtu() is assigned to q->cparams.mtu a bit below, and fq_codel_change() never updates it. codel_should_drop() tests "*backlog <= params->mtu"; with mtu == 0x80000000 (~2 GiB) and the default 32 MiB memory_limit, the test is always true, so CoDel is silently and completely disabled (no drops, no ECN). Declare a single clamped mtu and assign both q->quantum and q->cparams.mtu from it, which also removes the double psched_mtu() call.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq_codel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_fq_codel.c +4 -2
@@ -509,6 +509,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) {struct fq_codel_sched_data *q =qdisc_priv (sch); +u32 mtu;int i;int err;
@@ -516,13 +517,14 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, q->flows_cnt =1024 ; q->memory_limit =32 <<20 ;/* 32 MBytes */ q->drop_batch_size =64 ; - q->quantum =psched_mtu (qdisc_dev (sch)); + mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),256 ,FQ_CODEL_QUANTUM_MAX ); + q->quantum = mtu;INIT_LIST_HEAD (&q->new_flows);INIT_LIST_HEAD (&q->old_flows);codel_params_init (&q->cparams);codel_stats_init (&q->cstats); q->cparams.ecn = true; - q->cparams.mtu =psched_mtu (qdisc_dev (sch)); + q->cparams.mtu = mtu;if (opt) { err =fq_codel_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1760/1815 net/sched: sch_codel: clamp default mtu to avoid disabling CoDel
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 6439461f1618ae176c048673ad28bdb6c68efbfc ]
codel_init() sets q->params.mtu = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000. In codel_should_drop() the test "*backlog <= params->mtu" then compares the backlog against ~2 GiB; with the default sch->limit of DEFAULT_CODEL_LIMIT (1000) packets the backlog can never reach it, so the test is always true and CoDel is silently and completely disabled i.e no drops, no ECN marking, codel degrades to a tail-drop FIFO. codel_change() never updates params.mtu, so the init path is the only place to clamp it. Constrain to [256, 1 << 20], matching the fq_codel bound; 256 is a sane floor that only makes CoDel slightly more willing to act on very small queues, which is the safe direction.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_codel.c +1 -1
@@ -205,7 +205,7 @@ static int codel_init(struct Qdisc *sch, struct nlattr *opt,codel_params_init (&q->params);codel_vars_init (&q->vars);codel_stats_init (&q->stats); - q->params.mtu =psched_mtu (qdisc_dev (sch)); + q->params.mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),256 ,1 <<20 );if (opt) {int err =codel_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1761/1815 net/sched: fq_pie: clamp default quantum to avoid signed overflow
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit c86cd7ed0b0e44779a3d1683f03e4353baf4bdc9 ]
fq_pie_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, which overflows the signed flow->deficit to INT_MIN in fq_pie_qdisc_dequeue(), causing an infinite loop and soft lockup. Emulate fq_pie_policy which is already bounded to [1, 1 << 20]; clamp the default to [256, 1 << 20]. 256 matches fq_codel's floor and is a sane minimum for a DRR quantum.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq_pie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/sch_fq_pie.c +2 -1
@@ -427,7 +427,8 @@ static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt,pie_params_init (&q->p_params); sch->limit =10 *1024 ; q->p_params.limit = sch->limit; - q->quantum =psched_mtu (qdisc_dev (sch)); + q->quantum =clamp_t (u32,psched_mtu (qdisc_dev (sch)), +256 ,1 <<20 ); q->sch = sch; q->ecn_prob =10 ; q->flows_cnt =1024 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1762/1815 net/sched: hhf: clamp quantum before hhf_change() to avoid overflow
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 2164b512b97bb053e8ce4d6e95576f11bed6a005 ]
hhf_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes weight * quantum overflow the signed deficit in hhf_dequeue(), spinning forever.
Clamp q->quantum before hhf_change() so both the opt and !opt paths see a sane quantum. Without this, bare "tc qdisc add ... hhf" succeeds with a clamped quantum but "tc qdisc add ... hhf limit 1000" (any option present) fails with -EINVAL because hhf_change() re-validates the unclamped default (sch_hhf.c:559). 256 matches fq_codel's floor and is a sane minimum for a DRR quantum.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_hhf.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_hhf.c +4 -0
@@ -624,6 +624,10 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt, q->hhf_evict_timeout =HZ ;/* 1 sec */ q->hhf_non_hh_weight =2 ; +if ((int )q->quantum <=0 || + (u64 )q->quantum * q->hhf_non_hh_weight >INT_MAX ) + q->quantum =256 ; +if (opt) {int err =hhf_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1763/1815 net/sched: sfq: clamp quantum to avoid signed overflow soft lockup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 816e90057ab1879562a5b7cc688e35bb9027ae97 ]
sfq_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) (unsigned). A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, so slot->allot = INT_MIN and INT_MIN + INT_MIN toggles between INT_MIN and 0 forever, spinning sfq_dequeue() under the qdisc lock.
Clamp the quantum to [256, 1 << 20] so the refill loop terminates. The lower bound also covers q->quantum == 0 (psched_mtu() returning 0), which spins sfq_dequeue() identically. sfq_change() already rejects a negative quantum, so only the init path was exposed.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_sfq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/sch_sfq.c +2 -1
@@ -799,7 +799,8 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt, q->tail =NULL ; q->divisor =SFQ_DEFAULT_HASH_DIVISOR ; q->maxflows =SFQ_DEFAULT_FLOWS ; - q->quantum =psched_mtu (qdisc_dev (sch)); + q->quantum =clamp_t (u32,psched_mtu (qdisc_dev (sch)), +256 ,1 <<20 ); q->perturb_period =0 ;get_random_bytes (&q->perturbation,sizeof (q->perturbation));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1764/1815 net/sched: sch_teql: restore skb->dev on the slave failure path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit dc4b95b8fee95113587e93ca116356032d271371 ]
teql_master_xmit() sets skb->dev = slave before calling the slave's ndo_start_xmit(), but never restores it when that transmit fails. The skb then walks on to the next slave still pointing at the previous one.
If a later slave has no resolved neighbour, teql_resolve() hands the skb to neigh_event_send(), which queues it on that neighbour's arp_queue with the stale skb->dev. skb->dev holds no reference, so deleting the previous slave frees the net_device while the skb is still queued. Whatever runs next on that skb - arp_error_report() on timeout, or neigh_direct_output() -> dev_queue_xmit() once the neighbour resolves - causes a UAF like the one below:
BUG: KASAN: slab-use-after-free in __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) Read of size 4 at addr ffff888106e100b0 by task flood_packet/527 CPU: 0 UID: 0 PID: 527 Comm: flood_packet Not tainted 7.2.0-rc6-g594d90519502 #1 PREEMPT(lazy) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <IRQ> dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120) print_report (mm/kasan/report.c:378 mm/kasan/report.c:482) ? __pfx__raw_spin_lock_irqsave (./include/asm-generic/qrwlock.h:122 (discriminator 4)) ? __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) kasan_report (mm/kasan/report.c:595) ? __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) __icmp_send (net/ipv4/icmp.c:914 (discriminator 2))
[...]ipv4_link_failure (net/ipv4/route.c:1251 net/ipv4/route.c:1258)
? __pfx_ipv4_link_failure (./include/linux/skbuff.h:4327)
? _raw_write_lock (./include/linux/instrumented.h:55 ./include/linux/atomic/atomic-instrumented.h:1301 ./include/asm-generic/qrwlock.h:98 ./include/linux/rwlock_api_smp.h:230 kernel/locking/spinlock.c:304) ? __pfx__raw_write_lock (kernel/locking/spinlock.c:175)arp_error_report (./include/net/dst.h:438 net/ipv4/arp.c:296)neigh_invalidate (net/core/neighbour.c:1077)neigh_timer_handler (net/core/neighbour.c:1169)
[...]
Allocated by task 505: kasan_save_stack (mm/kasan/common.c:57) kasan_save_track (mm/kasan/common.c:78) __kasan_kmalloc (mm/kasan/common.c:398 mm/kasan/common.c:415) __kvmalloc_node_noprof (./include/linux/kasan.h:263 mm/slub.c:5334 mm/slub.c:6905) alloc_netdev_mqs (net/core/dev.c:12055 (discriminator 2))
rtnl_create_link (net/core/rtnetlink.c:3721)rtnl_newlink (net/core/rtnetlink.c:3903 net/core/rtnetlink.c:4044 net/core/rtnetlink.c:4159) rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
[...]
Freed by task 536: kasan_save_stack (mm/kasan/common.c:57) kasan_save_track (mm/kasan/common.c:78) kasan_save_free_info (mm/kasan/generic.c:584) __kasan_slab_free (mm/kasan/common.c:253 mm/kasan/common.c:285) kfree (./include/linux/kasan.h:235 mm/slub.c:2677 mm/slub.c:6377 mm/slub.c:6692)
device_release (drivers/base/core.c:2636)kobject_put (lib/kobject.c:689 lib/kobject.c:720 ./include/linux/kref.h:65 lib/kobject.c:737) netdev_run_todo (net/core/dev.c:11756)rtnl_dellink (net/core/rtnetlink.c:157 ./include/linux/rtnetlink.h:135 net/core/rtnetlink.c:3651) rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
[...]
Fix this by restoring skb->dev to the master at the end of each slave's iteration.
--- net/sched/sch_teql.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_teql.c +1 -0
@@ -377,6 +377,7 @@ static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) nores =1 ;break ; } + skb->dev = dev;__skb_pull (skb,skb_network_offset (skb)); }while ((q =rcu_dereference (NEXT_SLAVE (q))) != start);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1765/1815 tpm: st33zp24: Return zero on status read failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 8b92687708f5ef980de01c2042dbd76d11f78547 ]
st33zp24_status() ignores the result of the transport read and returns data even when no byte was received. The I2C transport, for example, skips i2c_master_recv() when the register-select write is short or fails, leaving data uninitialized. The resulting stack value can be interpreted as TPM_STS flags and let status checks complete spuriously.
The status callback cannot propagate a transport error. Return zero unless recv() reports exactly one byte. With no status bits set, callers retry or take their existing timeout or error path instead of acting on an invalid status value.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/char/tpm/st33zp24/st33zp24.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/tpm/st33zp24/st33zp24.c +3 -1
@@ -93,7 +93,9 @@ static u8 st33zp24_status(struct tpm_chip *chip)struct st33zp24_dev *tpm_dev =dev_get_drvdata (&chip->dev);u8 data; - tpm_dev->ops->recv (tpm_dev->phy_id,TPM_STS , &data,1 ); +if (tpm_dev->ops->recv (tpm_dev->phy_id,TPM_STS , &data,1 ) !=1 ) +return 0 ; +return data; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1766/1815 tpm: st33zp24: Validate locality read result
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 264216889d39df509b9c8045df53529480b0b718 ]
check_locality() treats every nonzero transport return as success. SPI errors remain negative, while the I2C path can convert a negative write error through its byte-sized status variable. Either result is nonzero even though the TPM_ACCESS byte can remain unwritten, so indeterminate ACTIVE_LOCALITY and VALID bits can falsely report an active locality.
Require recv() to return exactly the requested byte before examining TPM_ACCESS. Transport errors and short reads now report an inactive locality, while successful reads retain the existing behavior.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/char/tpm/st33zp24/st33zp24.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/st33zp24/st33zp24.c +2 -2
@@ -106,10 +106,10 @@ static bool check_locality(struct tpm_chip *chip) {struct st33zp24_dev *tpm_dev =dev_get_drvdata (&chip->dev);u8 data; -u8 status; +int status; status = tpm_dev->ops->recv (tpm_dev->phy_id,TPM_ACCESS , &data,1 ); -if (status && (data & +if (status ==1 && (data & (TPM_ACCESS_ACTIVE_LOCALITY |TPM_ACCESS_VALID )) == (TPM_ACCESS_ACTIVE_LOCALITY |TPM_ACCESS_VALID ))return true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1767/1815 crypto: acomp - allocate async request context when cloning
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <[email protected]>
[ Upstream commit ee440d4fc0d2f15894ab1f64c474a3adbc858880 ]
ACOMP_REQUEST_ON_STACK() reserves only enough storage for the synchronous fallback. When an async implementation is selected, callers clone that stack request before retrying, but acomp_request_clone() currently copies only the stack-sized object. The clone therefore has no storage for the async provider request context, and providers such as QAT write past the allocation through acomp_request_ctx(). KASAN does report a slab OOB write.
Allocate a zeroed clone large enough for the runtime acomp request size, copy only the bytes present in the source object, and preserve the existing fallback-on-allocation-failure behavior. Use the runtime reqsize because an implementation may adjust it during tfm initialization.
--- crypto/acompress.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
crypto/acompress.c +13 -3
@@ -559,12 +559,22 @@ EXPORT_SYMBOL_GPL(acomp_walk_virt);struct acomp_req *acomp_request_clone (struct acomp_req *req,size_t total,gfp_t gfp) { +struct crypto_tfm *tfm = req->base.tfm;struct acomp_req *nreq; +size_t len; - nreq =container_of (crypto_request_clone (&req->base, total, gfp), - struct acomp_req, base); -if (nreq == req) + len =sizeof (*req) + +crypto_acomp_reqsize (crypto_acomp_reqtfm (req)); + len =ALIGN (len,CRYPTO_MINALIGN ); + + nreq =kzalloc (len, gfp); +if (!nreq) { + req->base.tfm = tfm->fb;return req; + } + +memcpy (nreq, req,sizeof (*req)); + nreq->base.flags &= ~CRYPTO_TFM_REQ_ON_STACK ;if (req->src == &req->chain.ssg) nreq->src = &nreq->chain.ssg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1768/1815 apparmor: policy_int make sure list heads are initialized before fail path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit 3daad923a8685adb66087e0d819559b7eb6ba975 ]
If profile create fails before policy_init is complete the list heads are not properly initialized causing profile_free() sanity checks to trigger the following splat.
AppArmor WARN aa_policy_destroy: (((!list_empty(&policy->profiles) && (&policy->profiles)->prev != ((void *) 0x122 + (0xdead000000000000UL))))):
WARNING: security/apparmor/lib.c:509 at aa_policy_destroy+0x164/0x1b0 security/apparmor/lib.c:509, CPU#0: syz.0.17/5541 Modules linked in: CPU: 0 UID: 0 PID: 5541 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:aa_policy_destroy+0x16b/0x1b0 security/apparmor/lib.c:509 Code: 85 ed 7e 4d e8 96 bc 37 fd 5b 41 5c 41 5e 41 5f 5d e9 19 27 4e 07 cc e8 83 bc 37 fd 48 8d 3d 0c f0 d3 0b 48 c7 c6 a4 eb 38 8e <67> 48 0f b9 3a e9 04 ff ff ff e8 66 bc 37 fd 48 8d 3d ff ef d3 0b RSP: 0018:ffffc9000345eaa0 EFLAGS: 00010293 RAX: ffffffff848f530d RBX: ffff88803f734800 RCX: ffff88801af2a580 RDX: 0000000000000000 RSI: ffffffff8e38eba4 RDI: ffffffff90634320 RBP: 0000000000000000 R08: 0000000000000cc0 R09: 00000000ffffffff R10: dffffc0000000000 R11: fffffbfff1d95913 R12: dead000000000122 R13: ffff88803f734800 R14: ffff88803f734828 R15: dffffc0000000000 FS: 00007f5f6a1836c0(0000) GS:ffff88808c519000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055d02407b048 CR3: 0000000012aa9000 CR4: 0000000000352ef0 Call Trace: <TASK> aa_free_profile+0x9d/0x9f0 security/apparmor/policy.c:334 aa_alloc_profile+0x1e4/0x3e0 security/apparmor/policy.c:416 unpack_profile security/apparmor/policy_unpack.c:1153 [inline] aa_unpack+0x17db/0x7430 security/apparmor/policy_unpack.c:1748 aa_replace_profiles+0x226/0x2a20 security/apparmor/policy.c:1183 policy_update+0x234/0x4a0 security/apparmor/apparmorfs.c:505 profile_load+0x1cb/0x320 security/apparmor/apparmorfs.c:522 vfs_write+0x296/0xba0 fs/read_write.c:685 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5f6939e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5f6a183028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f5f69625fa0 RCX: 00007f5f6939e0d9 RDX: 0000000000000041 RSI: 0000200000000400 RDI: 0000000000000003 RBP: 00007f5f6a183090 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007f5f69626038 R14: 00007f5f69625fa0 R15: 00007ffe23725c18
--- security/apparmor/lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/lib.c +2 -2
@@ -482,6 +482,8 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix,char *hname;size_t hname_sz; +INIT_LIST_HEAD (&policy->list); +INIT_LIST_HEAD (&policy->profiles); hname_sz = (prefix ?strlen (prefix) +2 :0 ) +strlen (name) +1 ;/* freed by policy_free */ hname =aa_str_alloc (hname_sz, gfp);
@@ -494,8 +496,6 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix, policy->hname = hname;/* base.name is a substring of fqname */ policy->name =basename (policy->hname); -INIT_LIST_HEAD (&policy->list); -INIT_LIST_HEAD (&policy->profiles);return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1769/1815 of/irq: Fix device node refcount leak in of_irq_get_affinity()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <[email protected]>
[ Upstream commit fe66c3ff85e85d492673c6dc95c3d624a63e0282 ]
of_irq_parse_one() raises the refcount of the interrupt controller node on success, and of_irq_get_affinity() returns without putting it, so every call past the parse leaks one reference. It is reached from platform_get_irq_affinity(), used by arm_pmu, arm_spe_pmu and coresight-trbe.
Put it once irq_populate_fwspec_info() has run: no in-tree ->get_fwspec_info() returns a mask that lives in the node.
--- drivers/of/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/irq.c +3 -1
@@ -563,7 +563,9 @@ const struct cpumask *of_irq_get_affinity(struct device_node *dev, int index)of_phandle_args_to_fwspec (oirq.np, oirq.args, oirq.args_count, &fwspec); -if (irq_populate_fwspec_info (&fwspec, &info)) + rc =irq_populate_fwspec_info (&fwspec, &info); +of_node_put (oirq.np); +if (rc)return NULL ;return info.affinity;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1770/1815 ASoC: dapm: Fix off-by-one check on the second enum channel
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 14511c9b54ceeeef487409d73947c89ee8563590 ]
The snd_soc_dapm_put_enum_double() rejects item[0] once it reaches e->items, but it lets item[1] be equal to it. Both go on to snd_soc_enum_item_to_val(), which indexes e->values with no bound of its own, so an enum with a value table reads one element past the end.
The indexing arrived with the MUX consolidation, which relaxed the item[1] check in the same hunk. The value MUX handler it deleted used
Quoted 1 line
= there, and the
snd_soc_put_enum_double()insoc-ops.cstill does.
Only adav80x pairs a value table with two shifts, and its second channel looks accidental, but the control does report two values. Writing three into it reads off the end of adav80x_mux_values. The core catches that only under CONFIG_SND_CTL_INPUT_VALIDATION, which defaults off.
--- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-dapm.c +1 -1
@@ -3608,7 +3608,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, val =snd_soc_enum_item_to_val (e, item[0 ]) << e->shift_l; mask = e->mask << e->shift_l;if (e->shift_l != e->shift_r) { -if (item[1 ] > e->items) +if (item[1 ] >= e->items)return -EINVAL ; val |=snd_soc_enum_item_to_val (e, item[1 ]) << e->shift_r; mask |= e->mask << e->shift_r;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1771/1815 ceph: Fix ERR_PTR(0) in ceph_mkdir()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <[email protected]>
[ Upstream commit 4f49c3f8a5a86d237bb202ecb17c2802ddc8fd2f ]
When mkdir succeeds, ceph_mkdir() sets ret to ERR_PTR(0) which is incorrect. It should return NULL instead for success.
--- fs/ceph/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/dir.c +1 -1
@@ -1174,7 +1174,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, !req->r_reply_info.head->is_target && !req->r_reply_info.head->is_dentry) err =ceph_handle_notrace_create (dir, dentry); - ret =ERR_PTR (err); + ret = err ?ERR_PTR (err) :NULL ; out_req:if (!IS_ERR (ret) && req->r_dentry != dentry)/* Some other dentry was spliced in */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1772/1815 ceph: revalidate ki_pos for O_APPEND writes after cap acquisition
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit d2a8d446a09c74c8ddfe108b50dd791c889983fc ]
For O_APPEND writes, ki_pos is set to the current EOF via generic_write_checks() after fetching i_size from the MDS. However, ceph_get_caps() may need to wait for Fwx exclusive caps if the write extends the file (endoff > i_max_size). While waiting for Fwx, the previous Fwx holder (another client) may have already extended the file. When the MDS grants us Fwx, the cap grant message updates the local i_size, but ki_pos remains at the old EOF, causing the append write to land at a stale offset and overwrite data from the other client.
Fix by re-reading i_size_read(inode) after ceph_get_caps() returns. At this point we hold Fwx exclusive caps, no other client can modify the file, and i_size reflects the true EOF from the MDS cap grant. No extra MDS round-trip is needed. Only adjust ki_pos when the EOF has actually changed.
After adjusting ki_pos forward, the write range [pos, pos+count) may now exceed the i_max_size that was validated by ceph_get_caps() for the old range. Re-check against i_max_size and truncate the write if necessary to stay within the MDS-granted limit.
--- fs/ceph/file.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
fs/ceph/file.c +48 -0
@@ -2477,6 +2477,54 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)if (err <0 ) goto out; +/* +* For O_APPEND writes we may have waited for Fwx exclusive caps +* while the previous Fwx holder (another client) extended the +* file. i_size has been updated via the cap grant message from +* the MDS, but ki_pos is still the old EOF. Re-read i_size here +* (no extra MDS round-trip needed) and adjust ki_pos to the true +* EOF. Since we hold Fwx, no other client can change the file. +*/ +if (iocb->ki_flags &IOCB_APPEND ) { +loff_t cur_eof =i_size_read (inode); + +if (cur_eof != pos) { +doutc (cl, +"%p %llx.%llx O_APPEND: pos adjusted %lld -> %lld\n" , + inode,ceph_vinop (inode), pos, cur_eof); + iocb->ki_pos = cur_eof; + pos = cur_eof; +if (pos >= limit) { + err = -EFBIG ; + goto out_caps; + } +iov_iter_truncate (from, limit - pos); + count =iov_iter_count (from); + +/* +* ceph_get_caps() validated the old endoff +* against i_max_size; adjusting ki_pos forward +* may have shifted the write range beyond the +* granted max_size. Re-check and truncate if +* necessary. +*/ +spin_lock (&ci->i_ceph_lock); +if (pos + count > (loff_t )ci->i_max_size) { +loff_t max_size = ci->i_max_size; + +spin_unlock (&ci->i_ceph_lock); +if (pos >= max_size) { + err = -EFBIG ; + goto out_caps; + } +iov_iter_truncate (from, max_size - pos); + count =iov_iter_count (from); + }else { +spin_unlock (&ci->i_ceph_lock); + } + } + } + err =file_update_time (file);if (err) goto out_caps;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1773/1815 libceph: validate banner payload length
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Nogikh <[email protected]>
[ Upstream commit f374967fcdf04001c9b66df1c19106fa83cd91f7 ]
When parsing the Ceph messenger v2 protocol banner, the payload_len field is decoded from the banner prefix. If a client sends a banner with a payload_len of 0, the kernel sets up a 0-length socket read. This violates an invariant in the state machine, triggering a warning in populate_in_iter():
------------[ cut here ]------------ !iov_iter_count(&con->v2.in_iter) WARNING: net/ceph/messenger_v2.c:3129 at populate_in_iter net/ceph/messenger_v2.c:3129 [inline], CPU#1: kworker/1:3/5070 WARNING: net/ceph/messenger_v2.c:3129 at ceph_con_v2_try_read+0x6634/0x6810 net/ceph/messenger_v2.c:3159, CPU#1: kworker/1:3/5070 ... Call Trace: <TASK> ceph_con_workfn+0x1f5/0x14a0 net/ceph/messenger.c:1575 process_one_work kernel/workqueue.c:3322 [inline] process_scheduled_works+0xa8e/0x14e0 kernel/workqueue.c:3405 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3486 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK>
According to the msgr2 protocol specification, the banner payload is expected to contain at least two 64-bit integers (server_feat and server_req_feat). Therefore, payload_len must be at least 16 bytes.
Fix this by adding a check in process_banner_prefix() to reject a payload_len smaller than 16 bytes. This prevents the 0-length read and correctly aborts the connection with a protocol error.
--- net/ceph/messenger_v2.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ceph/messenger_v2.c +5 -0
@@ -2142,6 +2142,11 @@ static int process_banner_prefix(struct ceph_connection *con) payload_len =ceph_decode_16 (&p);dout ("%s con %p payload_len %d\n" , __func__, con, payload_len); +if (payload_len <sizeof (u64) +sizeof (u64)) { + con->error_msg ="protocol error, bad banner payload len" ; +return -EINVAL ; + } +return prepare_read_banner_payload (con, payload_len); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1774/1815 samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-modify
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit d79fb758e7e2e7a181eab630c0545a56041c473d ]
ftrace_direct_init() assigns kthread_run()'s return value to simple_tsk without an IS_ERR() check. When kthread_run() fails it returns ERR_PTR(-ENOMEM), but init still returns 0, so the module loads with simple_tsk holding an error pointer. On unload, ftrace_direct_exit() then passes that ERR_PTR to kthread_stop(), leading to a null-pointer-dereference.
Check the return value of kthread_run() with IS_ERR(); on failure, unregister the ftrace direct call and propagate the error code.
--- samples/ftrace/ftrace-direct-modify.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
samples/ftrace/ftrace-direct-modify.c +9 -3
@@ -320,9 +320,15 @@ static int __init ftrace_direct_init(void)ftrace_set_filter_ip (&direct, (unsigned long ) my_ip,0 ,0 ); ret =register_ftrace_direct (&direct, my_tramp); -if (!ret) - simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); -return ret; +if (ret) +return ret; + simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); +if (IS_ERR (simple_tsk)) { +unregister_ftrace_direct (&direct, my_tramp, true); +return PTR_ERR (simple_tsk); + } + +return 0 ; } static void __exit ftrace_direct_exit(void)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1775/1815 samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-multi-modify
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 6727b7618f49401acf373fa3ec5712e2ec52e5cf ]
ftrace_direct_multi_init() assigns kthread_run()'s return value to simple_tsk without an IS_ERR() check. When kthread_run() fails it returns ERR_PTR(-ENOMEM), but init still returns 0, so the module loads with simple_tsk holding an error pointer. On unload, ftrace_direct_multi_exit() then passes that ERR_PTR to kthread_stop(), leading to a null-pointer-dereference.
Check the return value of kthread_run() with IS_ERR(); on failure, unregister the ftrace direct call and propagate the error code.
--- samples/ftrace/ftrace-direct-multi-modify.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
samples/ftrace/ftrace-direct-multi-modify.c +9 -3
@@ -364,9 +364,15 @@ static int __init ftrace_direct_multi_init(void) ret =register_ftrace_direct (&direct, my_tramp); -if (!ret) - simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); -return ret; +if (ret) +return ret; + simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); +if (IS_ERR (simple_tsk)) { +unregister_ftrace_direct (&direct, my_tramp, true); +return PTR_ERR (simple_tsk); + } + +return 0 ; } static void __exit ftrace_direct_multi_exit(void)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1776/1815 ASoC: amd: acp-config: change quirks to cover all ASUS FA401EA variants
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengyu Qu <[email protected]>
[ Upstream commit 15596a87fcc6fa07a162858e5fd00ba31752096b ]
Existing quirk doesn't cover all known existing FA401EA devices, so use "FA401EA" to cover all of them.
--- sound/soc/amd/acp-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp-config.c +1 -1
@@ -54,7 +54,7 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { { .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC" ), - DMI_MATCH(DMI_PRODUCT_NAME, "TUF Gaming A14 FA401EA"), + DMI_MATCH(DMI_PRODUCT_NAME, "FA401EA"), }, }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1777/1815 net: ethernet: sun4i-emac: Fix IRQ error handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 991c2be78257cba5bf53cf935fe70f8836964288 ]
irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails. The current code checks for -ENXIO and therefore does not detect the failure.
Check for a zero return value and convert it to -ENXIO.
--- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/allwinner/sun4i-emac.c +2 -2
@@ -996,9 +996,9 @@ static int emac_probe(struct platform_device *pdev)/* fill in parameters for net-dev structure */ ndev->base_addr = (unsigned long )db->membase; ndev->irq =irq_of_parse_and_map (np,0 ); -if (ndev->irq == -ENXIO ) { +if (!ndev->irq) {netdev_err (ndev,"No irq resource\n" ); - ret = ndev->irq; + ret = -ENXIO ; goto out_iounmap; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1778/1815 net/smc: release the internal TCP sock on IPPROTO_SMC socket creation failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifei Chu <[email protected]>
[ Upstream commit cec261b0b4c5c0b044165303198d10ffcdf3414c ]
IPPROTO_SMC sockets create an internal TCP sock ("clcsock") from the proto->init hook. When socket creation fails after proto->init has run - e.g. a cgroup BPF program attached to BPF_CGROUP_INET_SOCK_CREATE denies the socket - sk_common_release() only invokes sk_prot->destroy if it is set, but neither smc_inet_prot nor smc_inet6_prot defines it, and smc_destruct() returns early unless sk_state is SMC_CLOSED. As a result, every failing socket(AF_INET, SOCK_STREAM, IPPROTO_SMC) call leaks one tcp_sock, so an unprivileged task able to attach a deny-all BPF_CGROUP_INET_SOCK_CREATE program to its own cgroup can grow kernel memory unboundedly.
Add a .destroy hook to both protos that releases the clcsock via smc_clcsock_release(). smc_sk_init() hashes the sock into the smc hashinfo before the clcsock is created, and smc_diag dumps walk that hash dereferencing smc->clcsock without taking clcsock_release_lock, while sk_common_release() calls .destroy before .unhash. Unhash the sock before releasing the clcsock, as __smc_release() does, so a concurrent dump cannot observe the release; the second unhash in sk_common_release() is a no-op.
--- net/smc/smc_inet.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/smc/smc_inet.c +16 -0
@@ -15,13 +15,16 @@#include "smc_inet.h" #include "smc.h" +#include "smc_close.h" static int smc_inet_init_sock (struct sock *sk); +static void smc_inet_destroy_sock (struct sock *sk);static struct proto smc_inet_prot = { .name ="INET_SMC" , .owner =THIS_MODULE , .init = smc_inet_init_sock, + .destroy = smc_inet_destroy_sock, .hash = smc_hash_sk, .unhash = smc_unhash_sk, .release_cb = smc_release_cb,
@@ -68,6 +71,7 @@ static struct proto smc_inet6_prot = { .name = "INET6_SMC", .owner = THIS_MODULE, .init = smc_inet_init_sock, + .destroy = smc_inet_destroy_sock, .hash = smc_hash_sk, .unhash = smc_unhash_sk, .release_cb = smc_release_cb,
@@ -116,6 +120,18 @@ static int smc_inet_init_sock(struct sock *sk)return smc_create_clcsk (net, sk, sk->sk_family); } +static void smc_inet_destroy_sock (struct sock *sk) +{ +/* The sock is hashed and smc_diag dumps dereference smc->clcsock +* without clcsock_release_lock, while sk_common_release() calls +* .destroy before .unhash. Unhash first, as __smc_release() does, +* so no dump can observe the clcsock being released; the second +* unhash is a no-op. +*/ + sk->sk_prot->unhash (sk); +smc_clcsock_release (smc_sk (sk)); +} +int __init smc_inet_init (void ) {int rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1779/1815 net: phy: air_en8811h: move LED GPIO configuration to config_init
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaliy Sochnev <[email protected]>
[ Upstream commit 03b4702fc5e311cbac9ba8654021a88f0dac914c ]
The LED GPIO pins (GPIO3/4/5, mapped to LED2/LED1/LED0) are only ever configured as outputs once, in .probe(). But .config_init() restarts the MD32 MCU via en8811h_restart_mcu() on every call after the first (priv->mcu_needs_restart), and that restart resets buckpbus-mapped MCU state, including EN8811H_GPIO_OUTPUT. As a result the LED GPIOs fall back to inputs after the first event that re-triggers .config_init() (link renegotiation, ifdown/ifup, resume), and the PHY's LEDs stop reflecting link/activity state even though they worked right after probe.
Move the GPIO-as-output configuration from .probe() to the end of .config_init(), so it is reapplied every time the MCU may have been restarted.
--- drivers/net/phy/air_en8811h.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/phy/air_en8811h.c +11 -7
@@ -1173,13 +1173,6 @@ static int en8811h_probe(struct phy_device *phydev)if (ret)return ret; -/* Configure led gpio pins as output */ - ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , -EN8811H_GPIO_OUTPUT_345 , -EN8811H_GPIO_OUTPUT_345 ); -if (ret <0 ) -return ret; -return 0 ; }
@@ -1324,6 +1317,17 @@ static int en8811h_config_init(struct phy_device *phydev)return ret; } +/* Configure led gpio pins as output. Must be redone on every +* .config_init(), not just once in .probe(): en8811h_restart_mcu() +* resets buckpbus-mapped MCU state (incl. this register) on every +* call after the first, e.g. on link renegotiation or ifup/ifdown. +*/ + ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , +EN8811H_GPIO_OUTPUT_345 , +EN8811H_GPIO_OUTPUT_345 ); +if (ret <0 ) +return ret; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1780/1815 net: wangxun: use BIT_ULL() to prevent shift overflow on 32-bit archs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 63c885688f38a757947d7050b1ee4171215269ce ]
The macros TXGBE_INTR_MISC() and WX_INTR_Q() rely on the standard BIT() macro to generate interrupt masks based on the queue vector index.
On 32-bit architectures, BIT() evaluates to a 32-bit unsigned long. Since the number of queue vectors can be up to 63 on txgbe devices, performing a left shift of 32 or more results in an integer overflow and undefined behavior. This causes incorrect interrupt masking and unmasking logic for both the queue and miscellaneous interrupts on 32-bit systems.
Fix this by replacing BIT() with BIT_ULL() in these macros. This ensures that the bitwise shift is always performed safely on a 64-bit unsigned long long type, regardless of the underlying architecture.
--- drivers/net/ethernet/wangxun/libwx/wx_type.h | 2 +- drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/wangxun/libwx/wx_type.h +1 -1
@@ -1427,7 +1427,7 @@ struct wx { };#define WX_INTR_ALL (~0ULL) -#define WX_INTR_Q (i) BIT((i)) +#define WX_INTR_Q (i) BIT_ULL((i))/* register operations */ #define wr32 (a, reg, value) writel((value), ((a)->hw_addr + (reg)))
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h +1 -1
@@ -303,7 +303,7 @@ struct txgbe_fdir_filter {#define TXGBE_DEFAULT_RX_WORK 128#endif -#define TXGBE_INTR_MISC (A ) BIT((A)->num_q_vectors) +#define TXGBE_INTR_MISC (A ) BIT_ULL((A)->num_q_vectors)#define TXGBE_INTR_QALL (A ) (TXGBE_INTR_MISC(A) - 1)#define TXGBE_MAX_EITR GENMASK(11, 3)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1781/1815 net: stmmac: selftests: Pass the IP proto mask in the TC selftest
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 9a56a27e6002e29a6707dc4238d469ec84c3a68e ]
The stmmac TC filtering rules have recently gained sanity checks to make sure the passed keys and their respective masks are aligned with the HW filtering abilities.
The stmmac selftests failed to pass the mask in the match data for L4 filtering tests, and are now failing consistently with -EINVAL :
$ ethtool -t eth1 [...] 23. L4 DA TCP Filtering -22 24. L4 SA TCP Filtering -22 25. L4 DA UDP Filtering -22 26. L4 SA UDP Filtering -22
Let's pass the ip_proto mask in the l4 filtering tests match data. Found on imx8mp, which now have passing L4 tests :
$ ethtool -t eth1 [...] 23. L4 DA TCP Filtering 0 24. L4 SA TCP Filtering 0 25. L4 DA UDP Filtering 0 26. L4 SA UDP Filtering 0
While at it, initialize the masks and keys to avoid re-using whatever was on the stack.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +4 -2
@@ -1452,11 +1452,11 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,struct {struct flow_dissector_key_basic bkey;struct flow_dissector_key_ports key; - }__aligned(BITS_PER_LONG / 8) keys; + }__aligned(BITS_PER_LONG / 8) keys = { };struct {struct flow_dissector_key_basic bmask;struct flow_dissector_key_ports mask; - }__aligned(BITS_PER_LONG / 8) masks; + }__aligned(BITS_PER_LONG / 8) masks = { };unsigned long dummy_cookie =0xdeadbeef ;struct stmmac_packet_attrs attr = { };struct flow_dissector *dissector;
@@ -1509,6 +1509,8 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, keys.bkey.ip_proto = udp ?IPPROTO_UDP :IPPROTO_TCP ; keys.key.src =htons (src); keys.key.dst =htons (dst); +/* Match the full IP proto field */ + masks.bmask.ip_proto =0xff ; masks.mask.src = src_mask; masks.mask.dst = dst_mask;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1782/1815 drm/xe: Do not apply WA 14025883347 to media 3503
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Ceraolo Spurio <[email protected]>
[ Upstream commit f0feab6e9e008faa406d189fb40cb7ab1bed420a ]
The database was updated and the WA is no longer listed as applicable to media 3503, so don't enable it there.
--- drivers/gpu/drm/xe/xe_wa_oob.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_wa_oob.rules +1 -1
@@ -63,5 +63,5 @@ 16026007364 MEDIA_VERSION(3000) 14020316580 MEDIA_VERSION(1301) -14025883347 MEDIA_VERSION_RANGE(1301, 3503) +14025883347 MEDIA_VERSION_RANGE(1301, 3500) GRAPHICS_VERSION_RANGE(2004, 3005)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1783/1815 drm/xe/xe_gt_idle: Add CCS to the powergating info print
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Balasubramani Vivekanandan <[email protected]>
[ Upstream commit 369ba0d1efe91cccabe98ae53c53b7425f327edf ]
While reading the main GT powergating info from debugfs, include both RCS and CCS engine masks.
--- drivers/gpu/drm/xe/xe_gt_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_idle.c +2 -1
@@ -248,7 +248,8 @@ int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p) pg_status =xe_mmio_read32 (>->mmio,POWERGATE_DOMAIN_STATUS ); } -if (gt->info.engine_mask &XE_HW_ENGINE_RCS_MASK ) { +if (gt->info.engine_mask & + (XE_HW_ENGINE_RCS_MASK |XE_HW_ENGINE_CCS_MASK )) {drm_printf (p,"Render Power Gating Enabled: %s\n" ,str_yes_no (pg_enabled &RENDER_POWERGATE_ENABLE ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1784/1815 drm/xe: Reject page faults from non-fault-mode scratch VMs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 5e977521d21717edb8e91d004434697d6e3f248c ]
Having scratch enabled does not make a VM capable of handling recoverable page faults. Allowing scratch VMs through the ASID lookup also admits dma-fence mode VMs.
If such a VM faults on an already valid VMA, the handler reports success without fixing the fault, causing the GPU to retry indefinitely.
Only allow fault-mode VMs through the ASID lookup. Fault-mode VMs using scratch remain supported, while faults from 3D VMs are rejected.
--- drivers/gpu/drm/xe/xe_pagefault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pagefault.c +1 -1
@@ -158,7 +158,7 @@ static struct xe_vm *xe_pagefault_asid_to_vm(struct xe_device *xe, u32 asid)down_read (&xe->usm.lock); vm =xa_load (&xe->usm.asid_to_vm, asid); -if (vm && (xe_vm_in_fault_mode (vm) ||xe_vm_has_scratch (vm))) +if (vm &&xe_vm_in_fault_mode (vm))xe_vm_get (vm);else vm =ERR_PTR (-EINVAL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1785/1815 virtio-net: Ensure that TCP packets dont overflow gso_segs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit c27c449d455aafd9018a3cbab150f1c42c87923f ]
The user can specify any gso_size in a packet crafted with an AF_PACKET PACKET_VNET_HDR socket, even smaller than TCP_MIN_GSO_SIZE = 8. At the same time, GSO_MAX_SIZE = 8 * GSO_MAX_SEGS = 8 * 65535. When the user crafts a packet with gso_size < 8, there is a risk for partial GSO to overflow the 16-bit gso_segs field when dividing the SKB length by gso_size.
Adjust gso_size of TCP packets to be at least TCP_MIN_GSO_SIZE = 8. Keep gso_size of UDP GSO packets, as gso_size=1 is valid and explicitly tested at tools/testing/selftests/net/tun.c:649.
--- include/linux/virtio_net.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/virtio_net.h +4 -0
@@ -6,6 +6,7 @@#include <linux/ip.h> #include <linux/ipv6.h> #include <linux/udp.h> +#include <net/tcp.h> #include <uapi/linux/tcp.h> #include <uapi/linux/virtio_net.h>
@@ -179,6 +180,9 @@ static inline int __virtio_net_hdr_to_skb(struct sk_buff *skb,if (skb->ip_summed ==CHECKSUM_PARTIAL && skb->csum_offset != offsetof(struct tcphdr , check))return -EINVAL ; + +BUILD_BUG_ON (TCP_MIN_GSO_SIZE *GSO_MAX_SEGS <GSO_MAX_SIZE ); + gso_size =max (gso_size,TCP_MIN_GSO_SIZE );break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1786/1815 netfilter: nf_tables: move hardware offload step after building the chain blob
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b1881d362e1924b66f6016c3efd28807032b41bf ]
Allocate the chain blob before the ruleset offload to reduce chances of entering an inconsistent state where the offloaded ruleset in the nic and the software ruleset differ.
--- net/netfilter/nf_tables_api.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +10 -4
@@ -10941,10 +10941,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)return -EAGAIN ; } - err =nft_flow_rule_offload_commit (net); -if (err <0 ) -return err; -/* 1. Allocate space for next generation rules_gen_X[] */ list_for_each_entry_safe (trans, next, &nft_net->commit_list, list) {struct nft_table *table = trans->table;
@@ -10969,6 +10965,16 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) } } +/* must be last, so audit and chain blob set up does not leave hardware +* in consistent state. +*/ + err =nft_flow_rule_offload_commit (net); +if (err <0 ) { +nf_tables_commit_chain_prepare_cancel (net); +nf_tables_commit_audit_free (&adl); +return err; + } +/* step 2. Make rules_gen_X visible to packet path */ list_for_each_entry (table, &nft_net->tables, list) {list_for_each_entry (chain, &table->chains, list)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1787/1815 netfilter: x_tables: replace pr_{info,err}() by pr_info_ratelimited()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 793d9eda4821f75b5f7cc9e6a870b72a58b44c2b ]
Several xtables extension still use pr_err() or pr_info() without ratelimit.
For xt_cgroup, while at this, remove redundant "xt_cgroup:" prefix since pr_fmt is already set on.
--- net/netfilter/xt_cgroup.c | 12 ++++++------ net/netfilter/xt_hl.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
net/netfilter/xt_cgroup.c +6 -6
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("Xtables: process control group matching");MODULE_ALIAS ("ipt_cgroup" );MODULE_ALIAS ("ip6t_cgroup" ); -#define NET_CLS_CLASSID_INVALID_MSG "xt_cgroup: classid invalid without net_cls cgroups\n" +#define NET_CLS_CLASSID_INVALID_MSG "classid invalid without net_cls cgroups\n"static int cgroup_mt_check_v0 (const struct xt_mtchk_param *par) {
@@ -33,7 +33,7 @@ static int cgroup_mt_check_v0(const struct xt_mtchk_param *par)return -EINVAL ;if (!IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
@@ -49,7 +49,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par)return -EINVAL ;if (!info->has_path && !info->has_classid) { -pr_info ("xt_cgroup: no path or classid specified\n" ); +pr_info_ratelimited ("no path or classid specified\n" );return -EINVAL ; }
@@ -59,7 +59,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par) }if (info->has_classid && !IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
@@ -89,7 +89,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par)return -EINVAL ;if (!info->has_path && !info->has_classid) { -pr_info ("xt_cgroup: no path or classid specified\n" ); +pr_info_ratelimited ("no path or classid specified\n" );return -EINVAL ; }
@@ -99,7 +99,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par) }if (info->has_classid && !IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
net/netfilter/xt_hl.c +2 -2
@@ -28,7 +28,7 @@ static int ttl_mt_check(const struct xt_mtchk_param *par)const struct ipt_ttl_info *info = par->matchinfo;if (info->mode >IPT_TTL_GT ) { -pr_err ("Unknown TTL match mode: %d\n" , info->mode); +pr_info_ratelimited ("Unknown TTL match mode: %d\n" , info->mode);return -EINVAL ; }
@@ -59,7 +59,7 @@ static int hl_mt6_check(const struct xt_mtchk_param *par)const struct ip6t_hl_info *info = par->matchinfo;if (info->mode >IP6T_HL_GT ) { -pr_err ("Unknown Hop Limit match mode: %d\n" , info->mode); +pr_info_ratelimited ("Unknown Hop Limit match mode: %d\n" , info->mode);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1788/1815 netfilter: nf_tables: skip double clone set expressions on element insert
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 43559058d21e0493aa220ac167e0279334dea5f9 ]
Both the dynset and newsetelem path clone the existing set expressions when setting set element expressions if no override expressions are provided. This results in a double clone, once to clone the template set expressions then another clone on the new element. Add a flag to annotate if userspace provides a override expression (ie. expression of the same type of the set but different configuration), otherwise borrow the existing expression from the set. Add conditionals to release expression iif they represent an override. Use this new override_exprs flag to dump the dynset expression override to userspace.
This simplifies the existing logic and it also fixes a bug with the connlimit expression which results in a module refcount imbalance WARNING splat when resorting on the default set expressions.
--- include/net/netfilter/nf_tables.h | 2 -- net/netfilter/nf_tables_api.c | 56 ++++++++++--------------------- net/netfilter/nft_dynset.c | 25 ++++++++------ 3 files changed, 33 insertions(+), 50 deletions(-)
include/net/netfilter/nf_tables.h +0 -2
@@ -870,8 +870,6 @@ struct nft_elem_priv *nft_set_elem_init(const struct nft_set *set, const u32 *key, const u32 *key_end, const u32 *data, u64 timeout, u64 expiration, gfp_t gfp); -int nft_set_elem_expr_clone (const struct nft_ctx *ctx,struct nft_set *set, -struct nft_expr *expr_array[]);void nft_set_elem_expr_destroy (const struct nft_ctx *ctx,struct nft_set_elem_expr *elem_expr); void nft_set_elem_destroy(const struct nft_set *set,
net/netfilter/nf_tables_api.c +18 -38
114 lines not on this page · raw message
net/netfilter/nft_dynset.c +15 -10
@@ -19,7 +19,8 @@ struct nft_dynset {u8 sreg_key;u8 sreg_data;bool invert; -bool expr; + bool expr:1, + override_exprs:1;u8 num_exprs;u64 timeout;struct nft_expr *expr_array[NFT_SET_EXPR_MAX ];
@@ -257,6 +258,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx, priv->num_exprs++; priv->expr_array[0 ] = dynset_expr; + priv->override_exprs = true; if (set->num_exprs > 1 || (set->num_exprs == 1 &&
@@ -289,6 +291,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx, } priv->expr_array[i] = dynset_expr; priv->num_exprs++; + priv->override_exprs = true;if (set->num_exprs) {if (i >= set->num_exprs) {
@@ -307,9 +310,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx, goto err_expr_free; } }else if (set->num_exprs >0 ) { - err =nft_set_elem_expr_clone (ctx, set, priv->expr_array); -if (err <0 ) -return err; +for (i =0 ; i < set->num_exprs; i++) + priv->expr_array[i] = set->exprs[i]; priv->num_exprs = set->num_exprs; }
@@ -339,8 +341,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx,return 0 ; err_expr_free: -for (i =0 ; i < priv->num_exprs; i++) -nft_expr_destroy (ctx, priv->expr_array[i]); +if (priv->override_exprs) { +for (i =0 ; i < priv->num_exprs; i++) +nft_expr_destroy (ctx, priv->expr_array[i]); + }return err; }
@@ -367,9 +371,10 @@ static void nft_dynset_destroy(const struct nft_ctx *ctx,struct nft_dynset *priv =nft_expr_priv (expr);int i; -for (i =0 ; i < priv->num_exprs; i++) -nft_expr_destroy (ctx, priv->expr_array[i]); - +if (priv->override_exprs) { +for (i =0 ; i < priv->num_exprs; i++) +nft_expr_destroy (ctx, priv->expr_array[i]); + }nf_tables_destroy_set (ctx, priv->set); }
@@ -393,7 +398,7 @@ static int nft_dynset_dump(struct sk_buff *skb, nf_jiffies64_to_msecs(priv->timeout), NFTA_DYNSET_PAD)) goto nla_put_failure; -if (priv->set->num_exprs ==0 ) { +if (priv->set->num_exprs ==0 || priv->override_exprs) {if (priv->num_exprs ==1 ) {if (nft_expr_dump (skb,NFTA_DYNSET_EXPR , priv->expr_array[0 ], reset))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1789/1815 ALSA: control: Dont add invalid kcontrols to LED layer
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 74e3b979ce8b78a690f8b94ccf2e2c965f7f5c11 ]
The kcontrol LED state layer tries to track the all associated kcontrol elements with naive assumptions that they are readable. But one can create a write-only element that has no get callback (even a user element can do it), and this may lead to a NULL dereference at the call chain of snd_ctl_led_notify(), as found by syzkaller.
For avoiding the Oops, add a sanity check of the kcontrol's info and get callbacks, and just skip the invalid kcontrols before assigning the kctl to the LED layer.
--- sound/core/control_led.c | 2 ++ 1 file changed, 2 insertions(+)
sound/core/control_led.c +2 -0
@@ -255,6 +255,8 @@ static int snd_ctl_led_set_id(int card_number, struct snd_ctl_elem_id *id, kctl =snd_ctl_find_id (card, id);if (!kctl)return -ENOENT ; +if (!kctl->info || !kctl->get) +return -EINVAL ; ioff =snd_ctl_get_ioff (kctl, id); vd = &kctl->vd[ioff]; access = vd->access &SNDRV_CTL_ELEM_ACCESS_LED_MASK ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1790/1815 selftests/arm64: Print missing MTE TAP headers
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 8d2237e9d6902e234bb89aabb9cd6a9e91357223 ]
Most MTE tests set a TAP plan and emit results without first printing the TAP version header. Direct execution therefore starts with a plan such as "1..20" instead of "TAP version 13".
The problem is particularly visible in the GCR_EL1 context-switch test. It prints its plan before forking 1,024 child processes. When stdout is fully buffered, the plan remains in the stdio buffer. Each child inherits the pending "1..1" line and flushes its copy from exit(), producing repeated plan lines.
ksft_print_header() prints the TAP header and enables line buffering. Call it in every MTE test that is missing it. In the GCR_EL1 test, call it before the plan so the plan is flushed before the children are forked. In the remaining tests, call it before setup and prerequisite checks so early failures and whole-test skips also retain the header.
--- tools/testing/selftests/arm64/mte/check_buffer_fill.c | 2 ++ tools/testing/selftests/arm64/mte/check_child_memory.c | 2 ++ tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 1 + tools/testing/selftests/arm64/mte/check_hugetlb_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_ksm_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_mmap_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_tags_inclusion.c | 2 ++ tools/testing/selftests/arm64/mte/check_user_mem.c | 2 ++ 8 files changed, 15 insertions(+)
tools/testing/selftests/arm64/mte/check_buffer_fill.c +2 -0
@@ -406,6 +406,8 @@ int main(int argc, char *argv[])size_t page_size =getpagesize ();int item =ARRAY_SIZE (sizes); +ksft_print_header (); + sizes[item -3 ] = page_size -1 ; sizes[item -2 ] = page_size; sizes[item -1 ] = page_size +1 ;
tools/testing/selftests/arm64/mte/check_child_memory.c +2 -0
@@ -146,6 +146,8 @@ int main(int argc, char *argv[])int err;int item =ARRAY_SIZE (sizes); +ksft_print_header (); + page_size =getpagesize ();if (!page_size) {ksft_print_msg ("ERR: Unable to get page size\n" );
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c +1 -0
@@ -131,6 +131,7 @@ int main(int argc, char *argv[])if (err)return err; +ksft_print_header ();ksft_set_plan (1 ); evaluate_test(mte_gcr_fork_test(),
tools/testing/selftests/arm64/mte/check_hugetlb_options.c +2 -0
@@ -230,6 +230,8 @@ int main(int argc, char *argv[])void *map_ptr;unsigned long map_size; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_ksm_options.c +2 -0
@@ -132,6 +132,8 @@ int main(int argc, char *argv[]) {int err; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_mmap_options.c +2 -0
@@ -945,6 +945,8 @@ int main(int argc, char *argv[]) }, }; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_tags_inclusion.c +2 -0
@@ -175,6 +175,8 @@ int main(int argc, char *argv[]) {int err; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_user_mem.c +2 -0
@@ -201,6 +201,8 @@ int main(int argc, char *argv[])int tag_offsets[] = {page_sz,MT_GRANULE_SIZE };char test_name[TEST_NAME_MAX ]; +ksft_print_header (); + page_sz =getpagesize ();if (!page_sz) {ksft_print_msg ("ERR: Unable to get page size\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1791/1815 selftests/arm64: Treat KSM merge_across_nodes as optional
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 1a0dba077f34a2f8faa98308d30d4b546d073145 ]
The MTE KSM test requires write access to KSM sysfs but does not check that it is running as root. It also unconditionally saves, enables and restores the merge_across_nodes attribute. The kernel only creates this attribute when CONFIG_NUMA=y, so a non-NUMA kernel prints the following message three times even though every KSM subtest passes:
# ERR: missing /sys/kernel/mm/ksm/merge_across_nodes
Skip the test when it is not running as root. Check that the optional attribute is readable and writable, treating ENOENT as its expected absence on non-NUMA kernels and skipping the test for other access failures. Only save, enable and restore the attribute when it is available.
Check MTE availability before the privilege and sysfs checks so systems without MTE retain the existing feature-unavailable skip result.
This preserves the existing behavior on NUMA kernels without requiring NUMA or reducing KSM coverage on single-node systems.
--- .../selftests/arm64/mte/check_ksm_options.c | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-)
tools/testing/selftests/arm64/mte/check_ksm_options.c +26 -3
@@ -6,6 +6,7 @@#include <errno.h> #include <fcntl.h> #include <signal.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
@@ -22,6 +23,20 @@static size_t page_sz;static unsigned long ksm_sysfs[5 ]; +static bool has_merge_across_nodes; + +static bool merge_across_nodes_available (void ) +{ +const char *path =PATH_KSM "merge_across_nodes" ; + +if (!access (path,R_OK |W_OK )) +return true; +if (errno ==ENOENT ) +return false; + +ksft_exit_skip ("Unable to read and write %s: %s\n" , path, +strerror (errno)); +}static unsigned long read_sysfs (char *str) {
@@ -56,8 +71,10 @@ static void write_sysfs(char *str, unsigned long val)static void mte_ksm_setup (void ) { - ksm_sysfs[0 ] =read_sysfs (PATH_KSM "merge_across_nodes" ); -write_sysfs (PATH_KSM "merge_across_nodes" ,1 ); +if (has_merge_across_nodes) { + ksm_sysfs[0 ] =read_sysfs (PATH_KSM "merge_across_nodes" ); +write_sysfs (PATH_KSM "merge_across_nodes" ,1 ); + } ksm_sysfs[1 ] =read_sysfs (PATH_KSM "sleep_millisecs" );write_sysfs (PATH_KSM "sleep_millisecs" ,0 ); ksm_sysfs[2 ] =read_sysfs (PATH_KSM "run" );
@@ -70,7 +87,8 @@ static void mte_ksm_setup(void)static void mte_ksm_restore (void ) { -write_sysfs (PATH_KSM "merge_across_nodes" , ksm_sysfs[0 ]); +if (has_merge_across_nodes) +write_sysfs (PATH_KSM "merge_across_nodes" , ksm_sysfs[0 ]);write_sysfs (PATH_KSM "sleep_millisecs" , ksm_sysfs[1 ]);write_sysfs (PATH_KSM "run" , ksm_sysfs[2 ]);write_sysfs (PATH_KSM "max_page_sharing" , ksm_sysfs[3 ]);
@@ -137,6 +155,11 @@ int main(int argc, char *argv[]) err =mte_default_setup ();if (err)return err; + +if (geteuid () !=0 ) +ksft_exit_skip ("Please run the test as root\n" ); + + has_merge_across_nodes =merge_across_nodes_available (); page_sz =getpagesize ();if (!page_sz) {ksft_print_msg ("ERR: Unable to get page size\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1792/1815 selftests/arm64: Fix MTE prctl TAP plan
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit bb52892f9234e4ecd982fa51222aab33ce282f79 ]
The MTE prctl test emits one result from check_basic_read() followed by one result for each of the seven entries in mte_modes[]. However, the TAP plan only accounts for the array entries, producing:
# Planned tests != run tests (7 != 8)
Include the basic read check in the plan so that all eight emitted results are declared.
--- tools/testing/selftests/arm64/mte/check_prctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/mte/check_prctl.c +1 -1
@@ -119,7 +119,7 @@ int main(void)int i;ksft_print_header (); -ksft_set_plan (ARRAY_SIZE (mte_modes)); +ksft_set_plan (ARRAY_SIZE (mte_modes) +1 );check_basic_read ();for (i =0 ; i <ARRAY_SIZE (mte_modes); i++)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1793/1815 net: airoha: npu: fix missing streaming DMA mask
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Pawlik <[email protected]>
[ Upstream commit 6fe7e31a45e3418a39e6343a85126124feec1c2f ]
The driver calls dma_set_coherent_mask() but never dma_set_mask(), leaving the streaming DMA mask at the bus default. On the non-coherent EN7581 platform (Cortex-A53), this causes the NPU mailbox to hang after approximately 41 calls when using streaming DMA mappings.
Replace dma_set_coherent_mask() with dma_set_mask_and_coherent() to set both the streaming and coherent DMA masks, matching standard driver practice.
--- drivers/net/ethernet/airoha/airoha_npu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_npu.c +1 -1
@@ -766,7 +766,7 @@ static int airoha_npu_probe(struct platform_device *pdev) npu->irqs[i] = irq; } - err =dma_set_coherent_mask (dev,DMA_BIT_MASK (32 )); + err =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ));if (err)return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1794/1815 drm/xe/uapi: Add additional error components to xe drm_ras
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riana Tauro <[email protected]>
[ Upstream commit cdeb5e248de11537cf23cd5174f6c55bab2e850b ]
Add additional Error components supported by XE drm_ras (Reliability, Availability and Serviceability).
Stable-dep-of: a62212b35a21 ("drm/xe/sysctrl: Read mailbox phase bit from hardware")
--- include/uapi/drm/xe_drm.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
include/uapi/drm/xe_drm.h +10 -1
@@ -2589,6 +2589,12 @@ enum drm_xe_ras_error_component {DRM_XE_RAS_ERR_COMP_CORE_COMPUTE =1 ,/** @DRM_XE_RAS_ERR_COMP_SOC_INTERNAL: SoC Internal Error */ DRM_XE_RAS_ERR_COMP_SOC_INTERNAL , +/** @DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY: Device Memory Error */ +DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY , +/** @DRM_XE_RAS_ERR_COMP_PCIE: PCIe Subsystem Error */ +DRM_XE_RAS_ERR_COMP_PCIE , +/** @DRM_XE_RAS_ERR_COMP_FABRIC: Fabric Subsystem Error */ +DRM_XE_RAS_ERR_COMP_FABRIC ,/** @DRM_XE_RAS_ERR_COMP_MAX: Max Error */ DRM_XE_RAS_ERR_COMP_MAX /* non-ABI */ };
@@ -2606,7 +2612,10 @@ enum drm_xe_ras_error_component {*/ #define DRM_XE_RAS_ERROR_COMPONENT_NAMES { \ [DRM_XE_RAS_ERR_COMP_CORE_COMPUTE] = "core-compute", \ - [DRM_XE_RAS_ERR_COMP_SOC_INTERNAL] = "soc-internal" \ + [DRM_XE_RAS_ERR_COMP_SOC_INTERNAL] = "soc-internal", \ + [DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY] = "device-memory", \ + [DRM_XE_RAS_ERR_COMP_PCIE] = "pcie", \ + [DRM_XE_RAS_ERR_COMP_FABRIC] = "fabric", \ }#if defined(__cplusplus)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1795/1815 drm/xe/xe_ras: Add support to get error counter value
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riana Tauro <[email protected]>
[ Upstream commit fe48a86980798ffc78c8713ec964877c8594610d ]
Add request/response structures and helper functions to query system controller to get error counter value.
Stable-dep-of: a62212b35a21 ("drm/xe/sysctrl: Read mailbox phase bit from hardware")
--- drivers/gpu/drm/xe/xe_ras.c | 91 +++++++++++++++++++ drivers/gpu/drm/xe/xe_ras.h | 3 + drivers/gpu/drm/xe/xe_ras_types.h | 26 ++++++ drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 28 ++++++ drivers/gpu/drm/xe/xe_sysctrl_mailbox.h | 3 + drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + 6 files changed, 153 insertions(+)
drivers/gpu/drm/xe/xe_ras.c +91 -0
@@ -4,11 +4,14 @@*/ #include "xe_device.h" +#include "xe_pm.h" #include "xe_printk.h" #include "xe_ras.h" #include "xe_ras_types.h" #include "xe_sysctrl.h" #include "xe_sysctrl_event_types.h" +#include "xe_sysctrl_mailbox.h" +#include "xe_sysctrl_mailbox_types.h" /* Severity of detected errors */ enum xe_ras_severity {
@@ -50,6 +53,36 @@ static const char *const xe_ras_components[] = { };static_assert (ARRAY_SIZE (xe_ras_components) ==XE_RAS_COMP_MAX ); +static u8 drm_to_xe_ras_severity (u8 severity) +{ +switch (severity) { +case DRM_XE_RAS_ERR_SEV_CORRECTABLE : +return XE_RAS_SEV_CORRECTABLE ; +case DRM_XE_RAS_ERR_SEV_UNCORRECTABLE : +return XE_RAS_SEV_UNCORRECTABLE ; +default : +return XE_RAS_SEV_NOT_SUPPORTED ; + } +} + +static u8 drm_to_xe_ras_component (u8 component) +{ +switch (component) { +case DRM_XE_RAS_ERR_COMP_CORE_COMPUTE : +return XE_RAS_COMP_CORE_COMPUTE ; +case DRM_XE_RAS_ERR_COMP_SOC_INTERNAL : +return XE_RAS_COMP_SOC_INTERNAL ; +case DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY : +return XE_RAS_COMP_DEVICE_MEMORY ; +case DRM_XE_RAS_ERR_COMP_PCIE : +return XE_RAS_COMP_PCIE ; +case DRM_XE_RAS_ERR_COMP_FABRIC : +return XE_RAS_COMP_FABRIC ; +default : +return XE_RAS_COMP_NOT_SUPPORTED ; + } +} +static inline const char *sev_to_str (u8 severity) {if (severity >=XE_RAS_SEV_MAX )
@@ -91,3 +124,61 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, comp_to_str(component), sev_to_str(severity)); } } + +static int get_counter (struct xe_device *xe,struct xe_ras_error_class *counter,u32 *value) +{ +struct xe_ras_get_counter_response response = {0 }; +struct xe_ras_get_counter_request request = {0 }; +struct xe_sysctrl_mailbox_command command = {0 }; +struct xe_ras_error_common *common; +size_t rlen; +int ret; + + request.counter = *counter; + +xe_sysctrl_create_command (&command,XE_SYSCTRL_GROUP_GFSP ,XE_SYSCTRL_CMD_GET_COUNTER , + &request,sizeof (request), &response,sizeof (response)); + + ret =xe_sysctrl_send_command (&xe->sc, &command, &rlen); +if (ret) { +xe_err (xe,"sysctrl: failed to get counter %d\n" , ret); +return ret; + } + +if (rlen !=sizeof (response)) { +xe_err (xe,"sysctrl: unexpected get counter response length %zu (expected %zu)\n" , + rlen,sizeof (response)); +return -EIO ; + } + + common = &response.counter.common; + *value = response.value; + +xe_dbg (xe,"[RAS]: get counter %u for %s %s\n" , *value,comp_to_str (common->component), +sev_to_str (common->severity)); + +return 0 ; +} + +/** +* xe_ras_get_counter() - Get error counter value +* @xe: Xe device instance +* @severity: Error severity to be queried (&enum drm_xe_ras_error_severity) +* @component: Error component to be queried (&enum drm_xe_ras_error_component) +* @value: Counter value +* +* This function retrieves the value of a specific error counter based on +* the error severity and component. +* +* Return: 0 on success, negative error code on failure. +*/ +int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value) +{ +struct xe_ras_error_class counter = {0 }; + + counter.common.severity =drm_to_xe_ras_severity (severity); + counter.common.component =drm_to_xe_ras_component (component); + +guard (xe_pm_runtime)(xe); +return get_counter (xe, &counter, value); +}
drivers/gpu/drm/xe/xe_ras.h +3 -0
@@ -6,10 +6,13 @@#ifndef _XE_RAS_H_#define _XE_RAS_H_ +#include <linux/types.h> +struct xe_device ;struct xe_sysctrl_event_response ;void xe_ras_counter_threshold_crossed (struct xe_device *xe,struct xe_sysctrl_event_response *response); +int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value);#endif
drivers/gpu/drm/xe/xe_ras_types.h +26 -0
@@ -70,4 +70,30 @@ struct xe_ras_threshold_crossed { struct xe_ras_error_class counters[XE_RAS_NUM_COUNTERS]; } __packed; +/** +* struct xe_ras_get_counter_request - Request structure for get counter +*/ +struct xe_ras_get_counter_request { +/** @counter: Error counter to be queried */ +struct xe_ras_error_class counter; +/** @reserved: Reserved for future use */ +u32 reserved; +} __packed; + +/** +* struct xe_ras_get_counter_response - Response structure for get counter +*/ +struct xe_ras_get_counter_response { +/** @counter: Error counter that was queried */ +struct xe_ras_error_class counter; +/** @value: Current counter value */ +u32 value; +/** @timestamp: Timestamp when counter was last updated */ +u64 timestamp; +/** @threshold: Threshold value for the counter */ +u32 threshold; +/** @reserved: Reserved */ +u32 reserved[57 ]; +} __packed; +#endif
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c +28 -0
@@ -293,6 +293,34 @@ static int sysctrl_send_command(struct xe_sysctrl *sc,return 0 ; } +/** +* xe_sysctrl_create_command() - Create system controller command +* @command: Sysctrl command structure +* @group_id: Command group ID +* @cmd_id: Command ID +* @request: Pointer to request buffer (can be NULL) +* @request_len: Size of request buffer +* @response: Pointer to response buffer +* @response_len: Size of response buffer +* +* Helper function to create sysctrl command to be sent via %xe_sysctrl_send_command() +*/ +void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id, +void *request,size_t request_len,void *response, +size_t response_len) +{ +struct xe_sysctrl_app_msg_hdr header = {0 }; + + header.data =FIELD_PREP (APP_HDR_GROUP_ID_MASK , group_id) | +FIELD_PREP (APP_HDR_COMMAND_MASK , cmd_id); + + command->header = header; + command->data_in = request; + command->data_in_len = request_len; + command->data_out = response; + command->data_out_len = response_len; +} +/** * xe_sysctrl_mailbox_init - Initialize System Controller mailbox interface * @sc: System controller structure
drivers/gpu/drm/xe/xe_sysctrl_mailbox.h +3 -0
@@ -23,6 +23,9 @@ struct xe_sysctrl_mailbox_command;#define XE_SYSCTRL_APP_HDR_VERSION (hdr) \ FIELD_GET(APP_HDR_VERSION_MASK, (hdr)->data) +void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id, +void *request,size_t request_len,void *response, +size_t response_len);void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc); int xe_sysctrl_send_command(struct xe_sysctrl *sc, struct xe_sysctrl_mailbox_command *cmd,
drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +2 -0
@@ -22,9 +22,11 @@ enum xe_sysctrl_group {/** * enum xe_sysctrl_gfsp_cmd - Commands supported by GFSP group * +* @XE_SYSCTRL_CMD_GET_COUNTER: Get error counter value * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event */ enum xe_sysctrl_gfsp_cmd { +XE_SYSCTRL_CMD_GET_COUNTER =0x03 ,XE_SYSCTRL_CMD_GET_PENDING_EVENT =0x07 , };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1796/1815 drm/xe/sysctrl: Read mailbox phase bit from hardware
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anoop Vijay <[email protected]>
[ Upstream commit a62212b35a214c2ff3bd1c785a440d7ad8205ec9 ]
The mailbox PHASE bit in SYSCTRL_MB_CTRL is toggled per-message and was tracked in software as sc->phase_bit, reset to 0 on error paths. If the cached value ever drifts from what the hardware last saw, all following messages carry the wrong phase and get silently misread by firmware.
Drop the cache and read PHASE directly from SYSCTRL_MB_CTRL before each frame instead, removing xe_sysctrl_mailbox_init() and its call sites along with it.
--- drivers/gpu/drm/xe/xe_sysctrl.c | 7 +------ drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 22 ++++------------------ drivers/gpu/drm/xe/xe_sysctrl_mailbox.h | 1 - drivers/gpu/drm/xe/xe_sysctrl_types.h | 3 --- 4 files changed, 5 insertions(+), 28 deletions(-)
drivers/gpu/drm/xe/xe_sysctrl.c +1 -6
@@ -85,7 +85,6 @@ int xe_sysctrl_init(struct xe_device *xe)return ret; xe->soc_remapper.set_sysctrl_region (xe,SYSCTRL_MAILBOX_INDEX ); -xe_sysctrl_mailbox_init (sc);INIT_WORK (&sc->work, xe_sysctrl_work);return devm_add_action_or_reset (xe->drm.dev, sysctrl_fini, xe);
@@ -114,12 +113,10 @@ void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl)* @xe: xe device instance * * Invoked during system resume (S3/S4 to S0) and runtime resume from D3cold. -* Restores SoC remapper configuration and reinitializes mailbox interface. +* Restores SoC remapper configuration. */ void xe_sysctrl_pm_resume (struct xe_device *xe) { -struct xe_sysctrl *sc = &xe->sc; -if (!xe->info.has_soc_remapper_sysctrl)return ;
@@ -127,6 +124,4 @@ void xe_sysctrl_pm_resume(struct xe_device *xe)return ; xe->soc_remapper.set_sysctrl_region (xe,SYSCTRL_MAILBOX_INDEX ); - -xe_sysctrl_mailbox_init (sc); }
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c +4 -18
@@ -145,6 +145,7 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,struct xe_device *xe =sc_to_xe (sc);u32 ctrl_reg, total_frames, frame;size_t bytes_sent, frame_size; +bool phase; total_frames =DIV_ROUND_UP (cmd_size,XE_SYSCTRL_MB_FRAME_SIZE );
@@ -153,7 +154,8 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,return -EBUSY ; } - sc->phase_bit ^=1 ; + ctrl_reg =xe_mmio_read32 (sc->mmio,SYSCTRL_MB_CTRL ); + phase = !(ctrl_reg &SYSCTRL_FRAME_PHASE ); bytes_sent =0 ;for (frame =0 ; frame < total_frames; frame++) {
@@ -161,7 +163,6 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,if (sysctrl_write_frame (sc, mbox_cmd + bytes_sent, frame_size)) {xe_err (xe,"sysctrl: Failed to write frame %u\n" , frame); - sc->phase_bit =0 ;return -EIO ; }
@@ -169,13 +170,12 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,REG_FIELD_PREP (SYSCTRL_FRAME_CURRENT_MASK , frame) |REG_FIELD_PREP (SYSCTRL_FRAME_TOTAL_MASK , total_frames -1 ) |SYSCTRL_MB_CTRL_CMD | - (sc->phase_bit ?SYSCTRL_FRAME_PHASE :0 ); + (phase ?SYSCTRL_FRAME_PHASE :0 );xe_mmio_write32 (sc->mmio,SYSCTRL_MB_CTRL , ctrl_reg);if (!sysctrl_wait_bit_clear (sc,SYSCTRL_MB_CTRL_RUN_BUSY , timeout_ms)) {xe_err (xe,"sysctrl: Frame %u acknowledgment timeout\n" , frame); - sc->phase_bit =0 ;return -ETIMEDOUT ; }
@@ -321,20 +321,6 @@ void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 gr command->data_out_len = response_len; } -/** -* xe_sysctrl_mailbox_init - Initialize System Controller mailbox interface -* @sc: System controller structure -* -* Initialize system controller mailbox interface for communication. -*/ -void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc) -{ -u32 ctrl_reg; - - ctrl_reg =xe_mmio_read32 (sc->mmio,SYSCTRL_MB_CTRL ); - sc->phase_bit = (ctrl_reg &SYSCTRL_FRAME_PHASE ) ?1 :0 ; -} -/** * xe_sysctrl_send_command() - Send mailbox command to System Controller * @sc: System Controller instance
drivers/gpu/drm/xe/xe_sysctrl_mailbox.h +0 -1
@@ -26,7 +26,6 @@ struct xe_sysctrl_mailbox_command;void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id,void *request,size_t request_len,void *response,size_t response_len); -void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc);int xe_sysctrl_send_command (struct xe_sysctrl *sc,struct xe_sysctrl_mailbox_command *cmd,size_t *rdata_len);
drivers/gpu/drm/xe/xe_sysctrl_types.h +0 -3
@@ -26,9 +26,6 @@ struct xe_sysctrl {/** @cmd_lock: Mutex protecting mailbox command operations */ struct mutex cmd_lock; -/** @phase_bit: Message boundary phase toggle bit (0 or 1) */ -bool phase_bit; -/** @work: Pending events worker */ struct work_struct work;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1797/1815 net: stmmac: selftests: Check multiple MMC counters
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit d29b399150b07796dfa81d8778d4804c08c2a41d ]
The MMC counters report MAC statistics. Multiple counters can be enabled when the IP is integrated, however there's no way to know exactly which ones. Un-implemented counters seem to report 0.
It was found that on StarFive JH7110 and Amlogic SM1, the counter that's used by the selftest (mmc_tx_framecount_g) isn't implemented, triggering an MMC selftest failure.
Both the above SoCs seem to implement mmc_rx_framecount_gb, let's use this counter as well for MMC counter validation.
Note that this doesn't guarantee that we won't encounter the same issue again if another IP implements yet another set of counters that don't include that new one.
If the game of whack-a-mole with implemented counters becomes too hard to maintain, we may simply consider removing the MMC selftest entirely.
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +10 -4
@@ -415,11 +415,17 @@ static int stmmac_test_mmc(struct stmmac_priv *priv)stmmac_mmc_read (priv, priv->mmcaddr, &final);/* -* The number of MMC counters available depends on HW configuration -* so we just use this one to validate the feature. I hope there is -* not a version without this counter. +* The number of MMC counters available depends on HW configuration, +* and there doesn't seem to be a way to enumerate the implemented +* counters. +* +* Let's check a hand-picked set of counters, knowing that : +* - Starfive JH7110 doesn't implement mmc_tx_framecount_g +* - Amlogic SM1 doesn't implement any mmc_tx_* +* */ -if (final.mmc_tx_framecount_g <= initial.mmc_tx_framecount_g) +if (final.mmc_tx_framecount_g <= initial.mmc_tx_framecount_g && + final.mmc_rx_framecount_gb <= initial.mmc_rx_framecount_gb)return -EINVAL ;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1798/1815 net: stmmac: dwmac1000: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 9698b6da3714fd2ef47846cb63098d2b2d252e25 ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +1 -1
@@ -194,7 +194,7 @@ static void dwmac1000_set_filter(struct mac_device_info *hw,dwmac1000_set_mchash (ioaddr, mc_filter, mcbitslog2);/* Handle multiple unicast addresses (perfect filtering) */ -if (netdev_uc_count (dev) > perfect_addr_number) +if (netdev_uc_count (dev) +1 > perfect_addr_number)/* Switch to promiscuous mode if more than unicast * addresses are requested than supported by hardware. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1799/1815 net: stmmac: dwmac4: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 82187f42c014d22520b9c3c4e2cfb519223fb29b ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -521,7 +521,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, value |=GMAC_PACKET_FILTER_HPF ;/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) > hw->unicast_filter_entries) { +if (netdev_uc_count (dev) +1 > hw->unicast_filter_entries) {/* Switch to promiscuous mode if more than 128 addrs * are required */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1800/1815 net: stmmac: dwxgmac: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 2739d6f9a2b8729b0d85cbe0dc93e1d68670b6f2 ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +1 -1
@@ -532,7 +532,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw,dwxgmac2_set_mchash (ioaddr, mc_filter, mcbitslog2);/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) > hw->unicast_filter_entries) { +if (netdev_uc_count (dev) +1 > hw->unicast_filter_entries) { value |=XGMAC_FILTER_PR ; }else {struct netdev_hw_addr *ha;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1801/1815 net: stmmac: selftests: Account for the UC filter list for filtering tests
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit cd8c3b2752c684141eab2282e294cae2971a9759 ]
On dwmac, one of the Unicast filter entries is used to store the local HW addr. This means that we have to use promisc mode for any kind of unicast filtering if we only have one slot in our unicast filter.
The number of slots available depends on how the IP is integrated, and we can't autodiscover how many of these slots we have available, so the DT property snps,perfect-filter-entries can be used to specify how many are available.
Most IP variants default to 1 if this isn't specified, which is the case for the amlogic variants (in this case, S905X3).
The stmmac selftests for UC filtering look if we have enough slots in the filter to store the dev->uc list, but doesn't account for the device's own MAC address. The dev->uc list's size we get with netdev_uc_count() also doesn't account for the HW addr.
As the selftest only requires one available slot, in the case of single-slot platforms, that means we erroneously consider we have enough room for the test, when we actually don't, and the filtering test fails.
--- .../stmicro/stmmac/stmmac_selftests.c | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +18 -3
@@ -499,6 +499,21 @@ static int stmmac_filter_check(struct stmmac_priv *priv)return -EOPNOTSUPP ; } +static int stmmac_uc_filter_check (struct stmmac_priv *priv) +{ +/* For tests involving the UC filter, we need at least one empty +* slot in the UC filter. The UC filters contains netdev_uc_count() + 1 +* entries: The dev->uc list + one entry for the HW address. +* +* Having an empty slot therefore means netdev_uc_count() + 2 entries +* can fit in the filter +*/ +if (netdev_uc_count (priv->dev) +2 > priv->hw->unicast_filter_entries) +return -EOPNOTSUPP ; + +return 0 ; +} +static bool stmmac_hash_check (struct stmmac_priv *priv,unsigned char *addr) {int mc_offset =32 - priv->hw->mcast_bits_log2;
@@ -590,7 +605,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;while (--tries) {
@@ -634,7 +649,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ;
@@ -680,7 +695,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1802/1815 net: stmmac: selftests: Dont test flow control for small rx fifos
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 96e8cb5527ce50c024a8e2d22d2bfedeccaf97d0 ]
On dwmac1000, dwmac4 and dwxgmac, we only emit pause frames if there's at least 4096 bytes in each queue's fifo.
The phylink mac capabilities are still MAC_ASYM_PAUSE | MAC_SYM_PAUSE as otherwise we won't be able to negotiate 'rx on' pause. ASYM only will prevent negotiating 'rx off tx on', while SYM only doesn't really matche the reality (not symmetric if we can only do RX pause).
--- .../ethernet/stmicro/stmmac/stmmac_selftests.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +13 -3
@@ -759,12 +759,24 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)struct phy_device *phydev = priv->dev->phydev;u32 rx_cnt = priv->plat->rx_queues_to_use;struct stmmac_test_priv *tpriv; +unsigned int rx_fifo_size;unsigned int pkt_count;int i, ret =0 ;if (!phydev || (!phydev->pause && !phydev->asym_pause))return -EOPNOTSUPP ; + rx_fifo_size = priv->plat->rx_fifo_size; +if (!rx_fifo_size) + rx_fifo_size = priv->dma_cap.rx_fifo_size; + +/* No pause frame is emitted if we don't have at least 4096 bytes per +* queue, except on dwmac100. +*/ +if (priv->plat->core_type !=DWMAC_CORE_MAC100 && + rx_fifo_size / priv->plat->rx_queues_to_use <4096 ) +return -EOPNOTSUPP ; + tpriv =kzalloc_obj (*tpriv);if (!tpriv)return -ENOMEM ;
@@ -778,9 +790,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)dev_add_pack (&tpriv->pt);/* Compute minimum number of packets to make FIFO full */ - pkt_count = priv->plat->rx_fifo_size; -if (!pkt_count) - pkt_count = priv->dma_cap.rx_fifo_size; + pkt_count = rx_fifo_size; pkt_count /=1400 ; pkt_count *=2 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1803/1815 net: stmmac: drop gso_enabled_types and rely on netdev features
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 9c24a504a3af1acb96da8d6a45a373fda8a9c687 ]
The gso_enabled_types field is used by stmmac_xmit() to decide whether a GSO skb should be passed to stmmac_tso_xmit(). It is updated in stmmac_set_features() based solely on NETIF_F_TSO, so disabling IPv4 TSO while keeping IPv6 TSO (NETIF_F_TSO6) enabled zeroes the mask. As a result IPv6 GSO frames, which the networking stack still generates since NETIF_F_TSO6 is enabled, fall through to the non-TSO xmit path where they are not handled.
The networking stack already manages the GSO logic: a GSO skb is only delivered to the driver when the matching offload feature (NETIF_F_TSO, NETIF_F_TSO6 or NETIF_F_GSO_UDP_L4) is enabled, otherwise the frame is segmented in software before reaching ndo_start_xmit(). stmmac_features_check() also validates each GSO frame against the TSO hardware constraints and falls back to software GSO when they are not met.
Drop the gso_enabled_types field and rely on skb_is_gso() in stmmac_xmit() instead, which correctly routes IPv6 GSO frames to the TSO path when NETIF_F_TSO is disabled. This also removes the data race between stmmac_set_gso_types(), called from the feature-set path, and the lockless read of gso_enabled_types in stmmac_xmit().
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +------------------ 2 files changed, 1 insertion(+), 20 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +0 -2
@@ -265,8 +265,6 @@ struct stmmac_priv {u32 rx_coal_frames[MTL_MAX_RX_QUEUES ];int hwts_tx_en; -/* skb_shinfo(skb)->gso_type types that we handle */ -unsigned int gso_enabled_types;bool tx_path_in_lpi_mode;bool sph_active;bool sph_capable;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -18
@@ -4376,18 +4376,6 @@ static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue)stmmac_set_queue_tx_tail_ptr (priv, tx_q, queue, tx_q->cur_tx); } -static void stmmac_set_gso_types (struct stmmac_priv *priv,bool tso) -{ -if (!tso) { - priv->gso_enabled_types =0 ; - }else { -/* Manage oversized TCP frames for GMAC4 device */ - priv->gso_enabled_types =SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ; -if (priv->plat->core_type ==DWMAC_CORE_GMAC4 ) - priv->gso_enabled_types |=SKB_GSO_UDP_L4 ; - } -} -static void stmmac_set_gso_features (struct net_device *ndev) {struct stmmac_priv *priv =netdev_priv (ndev);
@@ -4421,8 +4409,6 @@ static void stmmac_set_gso_features(struct net_device *ndev)if (priv->plat->core_type ==DWMAC_CORE_GMAC4 ) ndev->hw_features |=NETIF_F_GSO_UDP_L4 ; -stmmac_set_gso_types (priv, true); -dev_info (priv->device,"TSO feature enabled\n" ); }
@@ -4770,8 +4756,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)stmmac_stop_sw_lpi (priv); -if (skb_is_gso (skb) && -skb_shinfo (skb)->gso_type & priv->gso_enabled_types) +if (skb_is_gso (skb))return stmmac_tso_xmit (skb, dev); if (priv->est && priv->est->enable &&
@@ -6203,8 +6188,6 @@ static int stmmac_set_features(struct net_device *netdev,stmmac_enable_sph (priv, priv->ioaddr, sph_en, chan); } -stmmac_set_gso_types (priv, features &NETIF_F_TSO ); -if (features &NETIF_F_HW_VLAN_CTAG_RX ) priv->hw->hw_vlan_en = true;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1804/1815 net: stmmac: restore NET_IP_ALIGN in the RX DMA offset
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pascal Kneuper <[email protected]>
[ Upstream commit 23680bf5f8c69c923546b84a8e6c401bef8b88fe ]
Since the RX path was converted to zero-copy, the page pool page is handed to the stack directly as the skb head, and the offset the DMA engine writes at is what determines the alignment of the packet headers.
Before the conversion the payload was copied into an skb obtained from napi_alloc_skb(), which reserves NET_SKB_PAD + NET_IP_ALIGN. The conversion moved the headroom into stmmac_rx_offset() but did not carry over NET_IP_ALIGN, so on architectures where NET_IP_ALIGN is 2 the IP header now lands misaligned:
64 (NET_SKB_PAD) + 14 (ethernet) + 20 (IP) = 98
Same for the XDP branch:
256 (XDP_PACKET_HEADROOM) + 14 (ethernet) + 20 (IP) = 290
On ARM32 this is fatal, because ldm and ldrd trap on unaligned addresses even when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set.
Any received echo request panics the machine, e.g:
Unhandled fault: alignment exception (0x001) at 0x81873062
Internal error: : 1 [#1] SMP ARM Hardware name: Altera SOCFPGA Arria10 PC is at icmp_echo+0x38/0xa8 LR is at icmp_rcv+0x22c/0x370 Call trace: icmp_echo from icmp_rcv+0x22c/0x370 icmp_rcv from ip_protocol_deliver_rcu+0x2c/0x224 ip_protocol_deliver_rcu from ip_local_deliver+0xc8/0x1a0 ip_local_deliver from ip_sublist_rcv_finish+0x3c/0x50 ip_sublist_rcv_finish from ip_list_rcv_finish+0x110/0x118 ip_list_rcv_finish from ip_list_rcv+0xc8/0xdc ip_list_rcv from __netif_receive_skb_list_core+0x170/0x1c0 ... napi_complete_done from stmmac_napi_poll_rx+0xcb0/0x1030 Code: e24dd068 e59020a0 e28dc010 e0822001 (e8920003) Kernel panic - not syncing: Fatal exception in interrupt
The faulting instruction is the ldm of *icmp_hdr(skb) in icmp_echo().
Fix by adding NET_IP_ALIGN back to the RX offset, which restores the alignment the stack used to get.
Note that commit a955318fe67e ("stmmac: align RX buffers") made a similar change in 2021 and was reverted by commit 12d125b4574b ("stmmac: Revert "stmmac: align RX buffers"") because it caused packet corruption. That patch raised the offset from 0 without adjusting the buffer size accounting, so the DMA engine could arguably write past the end of the RX buffers, though this was never root caused.
Commit df542f669307 ("net: stmmac: Switch to zero-copy in non-XDP RX path") since derives the page pool allocation from stmmac_rx_offset(), so the extra bytes are accounted for.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -1531,9 +1531,9 @@ static void stmmac_display_rings(struct stmmac_priv *priv,static unsigned int stmmac_rx_offset (struct stmmac_priv *priv) {if (stmmac_xdp_is_enabled (priv)) -return XDP_PACKET_HEADROOM ; +return XDP_PACKET_HEADROOM +NET_IP_ALIGN ; -return NET_SKB_PAD ; +return NET_SKB_PAD +NET_IP_ALIGN ; }static int stmmac_set_bfsize (int mtu)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1805/1815 net: dsa: mxl862xx: enable assisted learning on CPU port
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edoardo Pinci <[email protected]>
[ Upstream commit 88c71cc0ad9800d8814bd3627b21a0da9028e057 ]
The MxL862xx driver enables FDB isolation but does not enable assisted learning on the CPU port. Consequently, MAC addresses learned through a physical switch port are not updated in hardware when the corresponding station moves to a foreign bridge port, such as a Wi-Fi interface.
The stale hardware FDB entry continues directing return traffic toward the original physical port. Traffic entering that same port is then filtered instead of being forwarded to the CPU and software bridge. This causes downstream unicast traffic, including DHCP OFFER and ACK packets, to disappear after a client roams to a local wireless interface. The client eventually considers the connection unusable and disconnects.
Enable assisted CPU-port learning so DSA installs foreign bridge FDB entries on the CPU port. This keeps the hardware FDB synchronized with the software bridge and allows return traffic to reach locally attached Wi-Fi clients after roaming.
Tested on a BPI R4 PRO with a MxL862xx switch and a BE14000 WiFi interface.
- Without patch, wired uplink on lan6 port (mxl path)
Wifi clients connect but roam away not getting DHCP offers
- Without patch, wired uplink on wan port (no mxl path)
Wifi clients connect and roam successfully
- With this patch, uplink on lan6 (mxl path)
Wifi clients connect and roam successfully
--- drivers/net/dsa/mxl862xx/mxl862xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mxl862xx/mxl862xx.c +1 -0
@@ -2111,6 +2111,7 @@ static int mxl862xx_probe(struct mdio_device *mdiodev) ds->ops = &mxl862xx_switch_ops; ds->phylink_mac_ops = &mxl862xx_phylink_mac_ops; ds->num_ports =MXL862XX_MAX_PORTS ; + ds->assisted_learning_on_cpu_port = true; ds->fdb_isolation = true; ds->max_num_bridges =MXL862XX_MAX_BRIDGES ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1806/1815 net/sched: bound qdisc_pkt_len to prevent qdisc soft lockup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 8f735d64382dcf162f4276d6699d03ad2f859c0b ]
qdisc_get_stab() accepts a user-supplied size table, and __qdisc_calculate_pkt_len() amplifies qdisc_pkt_len() through the overhead, the size-table data (u16), and size_log (up to STAB_SIZE_LOG_MAX). A crafted stab can therefore set qdisc_pkt_len() to ~1 GiB for an ordinary skb. Per-flow deficit schedulers such as DRR and ETS replenish one quantum per loop iteration; with a tiny quantum (1) they spin billions of times under the qdisc lock, producing a soft lockup / RCU stall as illustrated by [email protected].
Cap the final qdisc_pkt_len() to QDISC_PKT_LEN_MAX so the size-table amplification cannot drive deficit schedulers into an unbounded loop. A legitimate size table (e.g. qfq's overhead 999999999, which is handled by dropping) is still accepted.
Introduce cap QDISC_PKT_LEN_MAX (1 << 20) = 1 MiB which is well above any legitimate single-skb wire length: the largest current skb->len is GSO_MAX_SIZE (524280), and an ATM-style size table (53/48 cell tax) amplifies that to ~578 KB, both comfortably below 1 MiB. At the same time, 1 MiB bounds the deficit refill loop to ~1M iterations per packet with quantum=1, which completes in a few milliseconds well under the demonstrated softlockup threshold (~10^9 iterations).
Conditions to recreate the bug:
- CONFIG_NET_SCHED=y, CONFIG_NET_SCH_DRR=y (or CONFIG_NET_SCH_ETS=y).
- Attach a DRR (or ETS) root qdisc with a crafted TCA_STAB that amplifies qdisc_pkt_len to ~1 GiB (e.g. size_log=15, data=[32768]).
- Add a class with a tiny quantum of 1 and send one small packet; the deficit loop spins billions of times under the qdisc lock and trips the softlockup detector (panic with kernel.softlockup_panic=1).
- Reachable as root or from an unprivileged user in a fresh user+net namespace (unshare -Urn) with namespace-local CAP_NET_ADMIN.
--- include/net/pkt_sched.h | 1 + net/sched/sch_api.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/pkt_sched.h +1 -0
@@ -12,6 +12,7 @@#define DEFAULT_TX_QUEUE_LEN 1000#define STAB_SIZE_LOG_MAX 30 +#define QDISC_PKT_LEN_MAX (1 << 20)/* 1 MiB */ struct qdisc_walker {int stop;
net/sched/sch_api.c +5 -2
@@ -610,8 +610,11 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb, pkt_len <<= stab->szopts.size_log; out: -if (unlikely (pkt_len <1 )) - pkt_len =1 ; +/* A size table can inflate qdisc_pkt_len() beyond any real packet +* (via overhead, the data table, or size_log); cap it so deficit +* schedulers such as DRR/ETS terminate their refill loops. +*/ + pkt_len =clamp_t (int, pkt_len,1 ,QDISC_PKT_LEN_MAX );qdisc_skb_cb (skb)->pkt_len = pkt_len; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1807/1815 slip: remove slip_hangup() to fix use-after-free in slip_receive_buf()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 23c53269f2baaedf2d92784290cb9ef6db2a3bce ]
Jaeyoung Chung and Eulgyu Kim reported a slab-use-after-free read in slip_receive_buf() when racing against tty hangup.
tty_ldisc_hangup() calls ld->ops->hangup() while holding only a read lock on tty->ldisc_sem (via tty_ldisc_ref()). Because slip_hangup() simply called slip_close(), it ran concurrently with reader functions such as slip_receive_buf().
slip_close() unregisters and frees the net device and its private struct slip, causing concurrent reader threads in slip_receive_buf() to dereference freed memory.
Line discipline close() is already guaranteed to be called under the write lock of tty->ldisc_sem during hangup processing (in tty_ldisc_reinit() or tty_ldisc_kill()).
Remove slip_hangup() so teardown is serialized cleanly by slip_close().
--- drivers/net/slip/slip.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/net/slip/slip.c +0 -8
@@ -886,8 +886,6 @@ static int slip_open(struct tty_struct *tty)* Close down a SLIP channel. * This means flushing out any pending queues, and then returning. This * call is serialized against other ldisc functions. -* -* We also use this method fo a hangup event */ static void slip_close (struct tty_struct *tty)
@@ -915,11 +913,6 @@ static void slip_close(struct tty_struct *tty)unregister_netdev (sl->dev);/* sl_uninit() has dropped the slip_devs[] entry by now */ } - -static void slip_hangup (struct tty_struct *tty) -{ -slip_close (tty); -}/************************************************************************ * STANDARD SLIP ENCAPSULATION * ************************************************************************/
@@ -1280,7 +1273,6 @@ static struct tty_ldisc_ops sl_ldisc = { .name = "slip", .open = slip_open, .close = slip_close, - .hangup = slip_hangup, .ioctl = slip_ioctl, .receive_buf = slip_receive_buf, .write_wakeup = slip_write_wakeup,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1808/1815 net: fec: only stop PTP if it was initialized
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit dd890ae29299636fb037276fc1b5238698d08b03 ]
fec_ptp_init() is only called when fep->bufdesc_ex is available. However, fec_probe() unconditionally calls fec_ptp_stop() on the failed_init path, and fec_drv_remove() unconditionally calls fec_ptp_stop() during device removal.
Check fep->bufdesc_ex before calling fec_ptp_stop() in both paths to avoid stopping PTP when it was not initialized.
--- drivers/net/ethernet/freescale/fec_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +4 -2
@@ -5457,7 +5457,8 @@ fec_probe(struct platform_device *pdev) failed_irq:fec_enet_deinit (ndev); failed_init: -fec_ptp_stop (pdev); +if (fep->bufdesc_ex) +fec_ptp_stop (pdev); failed_reset:pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -5499,7 +5500,8 @@ fec_drv_remove(struct platform_device *pdev) ERR_PTR(ret));cancel_work_sync (&fep->tx_timeout_work); -fec_ptp_stop (pdev); +if (fep->bufdesc_ex) +fec_ptp_stop (pdev);unregister_netdev (ndev);fec_enet_mii_remove (fep);if (fep->reg_phy)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1809/1815 usb: atm: usbatm: fix invalid ci_range initialization
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit a60fd8c6dbaa76da4163cf225ed2b9e982540f39 ]
syzbot reported a shift-out-of-bounds in __vcc_connect():
UBSAN: shift-out-of-bounds in net/atm/common.c:382:32 shift exponent -1 is negative CPU: 0 UID: 0 PID: 5987 Comm: syz.0.18 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026 Call Trace: <TASK> dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233 __ubsan_handle_shift_out_of_bounds+0x36d/0x400 lib/ubsan.c:494 __vcc_connect+0x14b4/0x19c0 net/atm/common.c:382 vcc_connect+0x328/0x8f0 net/atm/common.c:498 pvc_bind+0x272/0x380 net/atm/pvc.c:52 __sys_bind+0x2e3/0x410 net/socket.c:1976 __x64_sys_bind+0x7a/0x90 net/socket.c:1979 ...
ATM device ci_range fields (vpi_bits and vci_bits) represent the number of bits supported for VPI and VCI addressing on the device. net/atm/common.c directly uses these fields as bit shift counts:
vpi >> dev->ci_range.vpi_bits
vci >> dev->ci_range.vci_bits
1 << vcc->dev->ci_range.vpi_bits
1 << vcc->dev->ci_range.vci_bits
usbatm_atm_init() sets ci_range.vpi_bits and ci_range.vci_bits to ATM_CI_MAX (-1), which is defined in <uapi/linux/atmdev.h> as a sentinel value for userspace ATM_SETCIRANGE requests, not a valid bit count. Shifting by -1 is undefined behavior and triggers UBSAN warnings.
ATM UNI cell headers allow up to 8 bits for VPI (0..255) and 16 bits for VCI (0..65535). Initialize vpi_bits to 8 and vci_bits to 16, as done by solos-pci.
--- drivers/usb/atm/usbatm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/atm/usbatm.c +2 -2
@@ -917,8 +917,8 @@ static int usbatm_atm_init(struct usbatm_data *instance) instance->atm_dev = atm_dev; - atm_dev->ci_range.vpi_bits =ATM_CI_MAX ; - atm_dev->ci_range.vci_bits =ATM_CI_MAX ; + atm_dev->ci_range.vpi_bits =8 ; + atm_dev->ci_range.vci_bits =16 ; atm_dev->signal =ATM_PHY_SIG_UNKNOWN ;/* temp init ATM device, set to 128kbit */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1810/1815 tcp: fix corruption of urgent data on multi-segment retransmit
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit ce2b807f42ed5e55567b8864ab72963f90779270 ]
On the normal xmit path, while in urgent mode we refuse to build a multi-segment TSO packet, so every segment gets its own urg_ptr:
/* tcp_write_xmit() */ limit = mss_now; if (tso_segs > 1 && !tcp_urg_mode(tp)) limit = tcp_mss_split_point(...);
The retransmit path has no such guard. __tcp_retransmit_skb() builds a segs > 1 skb and hands it to the GSO layer, which only advances th->seq per segment and copies urg_ptr verbatim:
/* __tcp_retransmit_skb() */ len = cur_mss * segs; /* segs > 1, no urg_mode check */ ... /* tcp_gso_segment(): bumps seq only, urg_ptr is copied */
urg_ptr is an offset from the segment's own seq, so a copied value points at a different place on each segment. The receiver rebuilds the absolute urgent seq as seg.seq + urg_ptr, so it walks a moving urgent point instead of the one OOB byte:
seg1 seq 1 urg_ptr 5001 -> urgent @ 5001 (ok) seg2 seq 1001 urg_ptr 5001 -> urgent @ 6001 (wrong, +MSS) seg3 seq 2001 urg_ptr 5001 -> urgent @ 7001 (wrong, +2*MSS)
The real OOB byte is never pointed at, so the receiver stops splicing it out and delivers it as normal in-band data, corrupting the stream.
Guard the retransmit length like the xmit path: keep segs = 1 while in urgent mode.
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -3603,7 +3603,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) avail_wnd = cur_mss; } - len = cur_mss * segs; + len = cur_mss * (tcp_urg_mode (tp) ?1 : segs);if (len > avail_wnd) { len =rounddown (avail_wnd, cur_mss);if (!len)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1811/1815 net/sched: sch_htb: limit htb_classify inner-class filter hops
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 729c4896ab829169f95915d65edd530325910b37 ]
htb_classify() follows each filter-selected inner class by switching to cl->filter_list, but never bounds the number of hops. A filter on an inner class can point back to itself or to another inner class that points back, creating an infinite loop in the packet classification path with the qdisc lock held and BH disabled — a soft lockup / panic from a single packet.
Bound the traversal with a hop counter and drop the packet with a rate-limited warning once the bound is exceeded. The counter is incremented at the point the inner filter chain is picked up, after the TC_ACT_* switch has consumed the classifier verdict, so a terminal TC_ACT_QUEUED/STOLEN/TRAP on the last permitted chain still sets *qerr to __NET_XMIT_STOLEN and the packet is not charged as a drop by this qdisc or its parent.
The bound is TC_HTB_MAXDEPTH, taken from HTB's own parameters rather than from the qdisc hierarchy depth limit. Class levels run from 0 to TC_HTB_MAXDEPTH - 1, so a traversal that strictly descends in level can take at most TC_HTB_MAXDEPTH hops. That descent is what a sane configuration does, but it is assumed here rather than enforced:htb_find() resolves a classid against every class in the qdisc, so a filter may equally select a sibling or an ancestor. The normal root -> inner -> leaf path takes a single hop, so the bound does not affect legitimate classification.
htb_classify() can now return NULL irrespective of CONFIG_NET_CLS_ACT, whereas previously every NULL return sat inside that ifdef. The NULL handler in htb_enqueue() therefore cannot stay conditional either, so drop the ifdef around it. This matches hfsc_enqueue(), which has always handled a NULL class unconditionally. Without it, a kernel built without actions would dereference a NULL class instead of dropping.
Conditions to recreate the bug:
- CONFIG_NET_SCHED, CONFIG_NET_SCH_HTB, CONFIG_NET_CLS_U32, CONFIG_LOCKUP_DETECTOR.
- Create an HTB qdisc on a device (e.g. lo), add an inner class 1:1 with a leaf child 1:10, install a root u32 filter selecting 1:1, and an inner-class u32 filter on 1:1 also selecting 1:1.
- Send one packet (ping). On the unfixed kernel the classify loop spins with the qdisc lock held; with softlockup_panic=1 it panics.
- Reachable from unprivileged user via unshare -Urn (CAP_NET_ADMIN).
--- net/sched/sch_htb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/sched/sch_htb.c +5 -2
@@ -224,6 +224,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,struct htb_class *cl;struct tcf_result res;struct tcf_proto *tcf; +unsigned int hops =0 ;int result;/* allow to select class by setting skb->priority to valid classid;
@@ -266,6 +267,10 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,if (!cl->level)return cl;/* we hit leaf; return it */ +if (++hops >TC_HTB_MAXDEPTH ) { +pr_warn_ratelimited ("htb: classify loop detected, dropping packet\n" ); +return NULL ; + }/* we have got inner class; apply inner filter chain */ tcf =rcu_dereference_bh (cl->filter_list); }
@@ -633,13 +638,11 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, }else {return qdisc_drop (skb, sch, to_free); } -#ifdef CONFIG_NET_CLS_ACT }else if (!cl) {if (ret & __NET_XMIT_BYPASS)qdisc_qstats_drop (sch);__qdisc_drop (skb, to_free);return ret; -#endif }else if ((ret =qdisc_enqueue (skb, cl->leaf.q, to_free)) !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (ret)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1812/1815 dm-integrity: fix buffer overflow with keyed discard
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Cressey <[email protected]>
commit 59e6f919d77d72ec79cbf171256f2f7819737580 upstream.
Since commit 68c5c42567bc ("dm-integrity: replace forgeable discard filler with a keyed sector marker"), integrity_metadata computes a checksum for every discarded block into the "checksums" buffer. integrity_sector_checksum always writes the whole digest. So if the tag size is smaller than the digest size, the checksum of the last block that fits into the buffer is written past the end of it. For example, with hmac(sha256) and tag size 16, a 4MiB discard writes 16 bytes past the kmalloc'ed page.
Fix this by subtracting extra_space from the buffer size when computing max_blocks, like we do for writes.
--- drivers/md/dm-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-integrity.c +1 -1
@@ -1980,7 +1980,7 @@ static void integrity_metadata(struct woif (unlikely (dio->op ==REQ_OP_DISCARD )) {unsigned int bi_size = dio->bio_details.bi_iter.bi_size;unsigned int max_size =likely (checksums != checksums_onstack) ?PAGE_SIZE :HASH_MAX_DIGESTSIZE ; -unsigned int max_blocks = max_size / ic->tag_size; +unsigned int max_blocks = (max_size - extra_space) / ic->tag_size;sector_t sector = dio->range.logical_sector;if (!ic->discard_keyed)
Greg Kroah-Hartman
maintainerPATCH 1813/1815 Revert "esp: do not unref managed frag pages in esp_ssg_unref()"
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit 0fda52de8bbd4ca9a852c8a7ef6536cf82bd71fd ]
This reverts commit 21697720ff43b8dfa25b8e8d9ca7f56f4597fc80.
The patch does not fix the issue completely, so revert for now and wait for an updated version.
--- net/ipv4/esp4.c | 7 ------- net/ipv6/esp6.c | 7 ------- 2 files changed, 14 deletions(-)
net/ipv4/esp4.c +0 -7
@@ -104,13 +104,6 @@ static void esp_ssg_unref(struct xfrm_state *x, void *tmp, struct sk_buff *skb,struct aead_request *req;struct scatterlist *sg; -/* Managed frags are owned by the zerocopy ubuf; the skb holds no -* per-frag page reference, so we must not drop one here. Mirrors -* the SKBFL_MANAGED_FRAG_REFS handling in skb_release_data(). -*/ -if (skb_zcopy_managed (skb)) -return ; -if (x->props.flags &XFRM_STATE_ESN ) extralen +=sizeof (struct esp_output_extra );
net/ipv6/esp6.c +0 -7
@@ -121,13 +121,6 @@ static void esp_ssg_unref(struct xfrm_state *x, void *tmp, struct sk_buff *skb,struct aead_request *req;struct scatterlist *sg; -/* Managed frags are owned by the zerocopy ubuf; the skb holds no -* per-frag page reference, so we must not drop one here. Mirrors -* the SKBFL_MANAGED_FRAG_REFS handling in skb_release_data(). -*/ -if (skb_zcopy_managed (skb)) -return ; -if (x->props.flags &XFRM_STATE_ESN ) extralen +=sizeof (struct esp_output_extra );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1814/1815 tcp: reject non zerocopy devmem tx
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 125755776bc6d4dd53eaf551c87e3d460625d638 ]
Devmem tcp tx doesn't work without zero-copy, however it's not currently enforced if NETIF_F_SG isn't present. In this case, tcp_sendmsg_locked() will try the copy path and try to copy data from an iovec which consists of offsets into the dma-buf and would normally fail. Moreover, d9c56501c72fd ("net: tcp: block mixing readable and unreadable frags") relies on that and assumes that the devmem binding is present IFF we're using the zero-copy path, which can be used to mix net-iov and pages in a single skb, and break invariants. Let's reject devmem tx without zero-copy.
Note, the parameter check the patch is modifying is too loose, we can create an io_uring request with dmabuf_id and all ZC flags, but which won't have the binding. We replace it with stricter validation.
--- net/ipv4/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp.c +1 -2
@@ -1169,8 +1169,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) zc =MSG_SPLICE_PAGES ; } -if (!sockc_err && sockc.dmabuf_id && - (!(flags &MSG_ZEROCOPY ) || !sock_flag (sk,SOCK_ZEROCOPY ))) { +if (!sockc_err && sockc.dmabuf_id && (zc !=MSG_ZEROCOPY || !binding)) { err = -EINVAL ; goto out_err; }
Signature · 1 line
2.53.0
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 7.2.6-rc1-g048ea6124e84 #2 SMP PREEMPT_DYNAMIC Sat Sep 12 09:31:29 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Thorsten Leemhuis
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]
My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears in
Reverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including bd86119c3ee6ed ("perf ui hists: Fix dso_filter reference leak and exit zoom cleanup") will fix this, too.
That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
Quoted 30 lines · Thorsten Leemhuis
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears inReverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including
bd86119c3ee6ed("perf ui hists: Fixdso_filterreference leak and exit zoom cleanup") will fix this, too.That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
build-tested and reproduced the 2 issues on x86_64 with:
make -j$(nproc) -C ./tools/perf O=/tmp/perf-build
observed errors:
1) tools/perf/ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared
2ec3b9858725 — "perf hists browser: Increase MAX_OPTIONS to prevent stack buffer overflow"
prerequisite: bd86119c3ee6 expects MAX_OPTIONS=32; stable-rc still has 16
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2ec3b985872594031cc1000b830344de5c26633dbd86119c3ee6 — declares hotkey_act, fixes dso_filter reference leak
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bd86119c3ee6ed7b8fc9be8298fe49f1a5355a46
2) tools/perf/util/python.c:1104:9: error: implicit declaration of function 'CHECK_INITIALIZED'
01fa2d416ace — defines CHECK_INITIALIZED
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01fa2d416aceab51f97ec2769e8da9971a605eeb
With the 3 patches applied, perf build successful.
Benni
Greg Kroah-Hartman
maintainerQuoted 54 lines · Benjamin Boortz
Quoted 30 lines · Thorsten Leemhuis
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears inReverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including
bd86119c3ee6ed("perf ui hists: Fixdso_filterreference leak and exit zoom cleanup") will fix this, too.That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
build-tested and reproduced the 2 issues on
x86_64with:make -j$(nproc) -C ./tools/perf O=/tmp/perf-buildobserved errors:
1)
tools/perf/ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared
2ec3b9858725— "perf hists browser: IncreaseMAX_OPTIONSto prevent stack buffer overflow"
prerequisite:bd86119c3ee6expects MAX_OPTIONS=32; stable-rc still has 16
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2ec3b985872594031cc1000b830344de5c26633dbd86119c3ee6— declareshotkey_act, fixesdso_filterreference leak
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bd86119c3ee6ed7b8fc9be8298fe49f1a5355a46
Quoted 7 lines
2)
tools/perf/util/python.c:1104:9: error: implicit declaration of function 'CHECK_INITIALIZED'
01fa2d416ace— definesCHECK_INITIALIZED
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01fa2d416aceab51f97ec2769e8da9971a605eebWith the 3 patches applied, perf build successful.
Thanks for that, it fixes it for me too, I'll go queue these up now.
greg k-h
Hi
kernel build / boot test on x86_64 (Intel).
No regressions here.
Thanks
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
Linux version 7.2.6-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
[ 0.000000] Linux version 7.2.6-rc1rv-g048ea6124e84
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 16.2.1 20260810, GNU ld (GNU Binutils) 2.47) #1 SMP PREEMPT_DYNAMIC Sun Sep 13 05:45:30 JST 2026
Greg Kroah-Hartman
maintainerPATCH 1815/1815 net/sched: fq: clamp quantum and initial_quantum in change path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 094cc07f98dfe70a34e2a1923af17fd29b8cf622 ]
The fq change path accepts TCA_FQ_QUANTUM in [1, INT_MAX] and TCA_FQ_INITIAL_QUANTUM up to INT_MAX, while fq_init() already clamps to [1, 1<<20]. A user can override the init clamp via tc qdisc change, restoring the small-quantum deficit spin that the init clamp prevents.
Narrow iq_range.max to 1<<20 so TCA_FQ_INITIAL_QUANTUM is rejected at parse time. Clamp TCA_FQ_QUANTUM to [256, 1<<20] in fq_change() and fq_init() quantum to [256, 1<<20] for tiny-MTU devices.
Conditions to recreate the bug:
CONFIG_NET_SCH_FQ=y. Requires CAP_NET_ADMIN (namespace-local via unshare -Urn suffices).
tc qdisc add dev dummy0 root fq
tc qdisc change dev dummy0 root fq quantum 1 stab data 32768 size_log 15 cell_log 0
--- net/sched/sch_fq.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
net/sched/sch_fq.c +5 -9
@@ -980,7 +980,7 @@ static int fq_resize(struct Qdisc *sch, u32 log) }static const struct netlink_range_validation iq_range = { - .max =INT_MAX , + .max =1 <<20 , };static const struct nla_policy fq_policy[TCA_FQ_MAX +1 ] = {
@@ -1106,14 +1106,10 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]));if (tb[TCA_FQ_QUANTUM ]) { -u32 quantum =nla_get_u32 (tb[TCA_FQ_QUANTUM ]); +u32 quantum =clamp_t (u32,nla_get_u32 (tb[TCA_FQ_QUANTUM ]), +256 ,1 <<20 ); -if (quantum >0 && quantum <= (1 <<20 )) { -WRITE_ONCE (q->quantum, quantum); - }else { -NL_SET_ERR_MSG_MOD (extack,"invalid quantum" ); - err = -EINVAL ; - } +WRITE_ONCE (q->quantum, quantum); }if (tb[TCA_FQ_INITIAL_QUANTUM ])
@@ -1232,7 +1228,7 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt, sch->limit =10000 ; q->flow_plimit =100 ; mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),1 ,1 <<20 ); - q->quantum =min_t (u32,2 * mtu,1 <<20 ); + q->quantum =clamp_t (u32,2 * mtu,256 ,1 <<20 ); q->initial_quantum =min_t (u32,10 * mtu,1 <<20 ); q->flow_refill_delay =msecs_to_jiffies (40 ); q->flow_max_rate = ~0UL ;
Signature · 1 line
2.53.0
Am 12.09.2026 um 08:29 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Build and boot tested with QEMU for x86_64, i386, arm64, and riscv across multiple configurations, and boots on AMD Ryzen 7 5800H. No regressions observed.
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
7.2.6-rc1 compiles on x86_64 (Xeon E5-1620 v2, Slackware64-15.0), and boots & runs on x86_64 (AMD Ryzen 5 7520U, Slackware64-current). No regressions observed during boot & my custom tests.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
I tested 7.2.5 + stable-queue as of commit 5bd01cb1b5d8bdc0b5480752350d2b0f2d487986
("drop 3 orphaned perf prerequisite patches from 6.18")
on my Lenovo ThinkPad T14 Gen 1. Working well, no regressions observed.
Signature · 1 line
-Barry K. Nathan <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · On Sat, 12 Sep 2026 08:29:10 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64 and arm32:
Thanks!
Cheers,
Miguel
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
perf fails to build with arm/arm64/mips:
ui/browsers/hists.c: In function 'evsel__hists_browse':ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared (first use in this function)
3191 | memset(&hotkey_act, 0,sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears in
CC
/local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/perf/trace/beauty/clone.o
make[7]: *** [/local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/build/Makefile.build:95: /local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/perf/ui/browsers/hists.o] Error 1 make[7]: *** Waiting for unfinished jobs....
this is caused by b8ad2bfb11e0868b595b4cd9dfcb9e80f174b2d5 ("perf ui hists: In report UI ensure thread is set with reference counting")
Signature · 1 line
Florian