| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/08 18:50 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies the Mellanox mlx5 network driver (specifically IPsec offload and eswitch mode locking logic). Mellanox ConnectX/BlueField devices are vendor-specific PCIe SmartNICs/adapters that require physical hardware and are not emulated in standard QEMU or GCE virtualized environments used by syzkaller. Because the code is structurally unreachable during fuzzing, it does not warrant fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/11/08 18:50 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 1ed89e91f03721b53b7a7c314042f3a1009815cc\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Nov 8 18:50:46 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c\nindex 7e991a09b3ff58..fa6cb51fdb939f 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c\n@@ -771,53 +771,72 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,\n \t\t\t\tstruct xfrm_state *x,\n \t\t\t\tstruct netlink_ext_ack *extack)\n {\n+\tbool is_acq = x-\u003exso.flags \u0026 XFRM_DEV_OFFLOAD_FLAG_ACQ;\n \tstruct mlx5e_ipsec_sa_entry *sa_entry = NULL;\n \tbool allow_tunnel_mode = false;\n+\tstruct mlx5_core_dev *mdev;\n \tstruct mlx5e_ipsec *ipsec;\n \tstruct mlx5e_priv *priv;\n \tgfp_t gfp;\n \tint err;\n \n \tpriv = netdev_priv(dev);\n-\tif (!priv-\u003eipsec)\n-\t\treturn -EOPNOTSUPP;\n+\t/* Profile cleanup can memset an already NULL mdev. */\n+\tmdev = data_race(READ_ONCE(priv-\u003emdev));\n+\t/* NULL only during a profile change, which is an eswitch operation. */\n+\tif (!mdev) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Eswitch busy, can't add state\");\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tif (!is_acq) {\n+\t\terr = mlx5_eswitch_block_mode(mdev, false);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n \n \tipsec = priv-\u003eipsec;\n-\tgfp = (x-\u003exso.flags \u0026 XFRM_DEV_OFFLOAD_FLAG_ACQ) ? GFP_ATOMIC : GFP_KERNEL;\n+\tif (!ipsec) {\n+\t\terr = -EOPNOTSUPP;\n+\t\tgoto unblock_mode;\n+\t}\n+\n+\tgfp = is_acq ? GFP_ATOMIC : GFP_KERNEL;\n \tsa_entry = kzalloc_obj(*sa_entry, gfp);\n-\tif (!sa_entry)\n-\t\treturn -ENOMEM;\n+\tif (!sa_entry) {\n+\t\terr = -ENOMEM;\n+\t\tgoto unblock_mode;\n+\t}\n \n \tsa_entry-\u003ex = x;\n \tsa_entry-\u003edev = dev;\n \tsa_entry-\u003eipsec = ipsec;\n \t/* Check if this SA is originated from acquire flow temporary SA */\n-\tif (x-\u003exso.flags \u0026 XFRM_DEV_OFFLOAD_FLAG_ACQ) {\n+\tif (is_acq) {\n \t\tx-\u003exso.offload_handle = (unsigned long)sa_entry;\n \t\treturn 0;\n \t}\n \n-\terr = mlx5e_xfrm_validate_state(priv-\u003emdev, x, extack);\n+\terr = mlx5e_xfrm_validate_state(mdev, x, extack);\n \tif (err)\n \t\tgoto err_xfrm;\n \n-\tif (!mlx5_eswitch_block_ipsec(priv-\u003emdev)) {\n+\tif (!mlx5_eswitch_block_ipsec(mdev)) {\n \t\terr = -EBUSY;\n \t\tgoto err_xfrm;\n \t}\n \n-\terr = mlx5_eswitch_block_mode(priv-\u003emdev);\n-\tif (err)\n-\t\tgoto unblock_ipsec;\n-\n \tif (x-\u003eprops.mode == XFRM_MODE_TUNNEL \u0026\u0026\n \t x-\u003exso.type == XFRM_DEV_OFFLOAD_PACKET) {\n-\t\tallow_tunnel_mode = mlx5e_ipsec_fs_tunnel_allowed(sa_entry);\n+\t\terr = mlx5e_ipsec_fs_tunnel_allowed(sa_entry);\n+\t\tif (err \u003c 0)\n+\t\t\tgoto unblock_ipsec;\n+\t\tallow_tunnel_mode = err;\n \t\tif (!allow_tunnel_mode) {\n \t\t\tNL_SET_ERR_MSG_MOD(extack,\n \t\t\t\t\t \"Packet offload tunnel mode is disabled due to encap settings\");\n \t\t\terr = -EINVAL;\n-\t\t\tgoto unblock_mode;\n+\t\t\tgoto unblock_ipsec;\n \t\t}\n \t}\n \n@@ -874,9 +893,9 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,\n \n \tx-\u003exso.offload_handle = (unsigned long)sa_entry;\n \tif (allow_tunnel_mode)\n-\t\tmlx5_eswitch_unblock_encap(priv-\u003emdev);\n+\t\tmlx5_eswitch_unblock_encap(mdev);\n \n-\tmlx5_eswitch_unblock_mode(priv-\u003emdev);\n+\tmlx5_eswitch_unblock_mode(mdev);\n \n \treturn 0;\n \n@@ -892,14 +911,15 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,\n \tkfree(sa_entry-\u003ework);\n unblock_encap:\n \tif (allow_tunnel_mode)\n-\t\tmlx5_eswitch_unblock_encap(priv-\u003emdev);\n-unblock_mode:\n-\tmlx5_eswitch_unblock_mode(priv-\u003emdev);\n+\t\tmlx5_eswitch_unblock_encap(mdev);\n unblock_ipsec:\n-\tmlx5_eswitch_unblock_ipsec(priv-\u003emdev);\n+\tmlx5_eswitch_unblock_ipsec(mdev);\n err_xfrm:\n \tkfree(sa_entry);\n \tNL_SET_ERR_MSG_WEAK_MOD(extack, \"Device failed to offload this state\");\n+unblock_mode:\n+\tif (!is_acq)\n+\t\tmlx5_eswitch_unblock_mode(mdev);\n \treturn err;\n }\n \n@@ -1265,27 +1285,45 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,\n {\n \tstruct net_device *netdev = x-\u003exdo.dev;\n \tstruct mlx5e_ipsec_pol_entry *pol_entry;\n+\tstruct mlx5_core_dev *mdev;\n \tstruct mlx5e_priv *priv;\n \tint err;\n \n \tpriv = netdev_priv(netdev);\n+\t/* Profile cleanup can memset an already NULL mdev. */\n+\tmdev = data_race(READ_ONCE(priv-\u003emdev));\n+\tif (!mdev) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Eswitch busy, can't add policy\");\n+\t\treturn -EBUSY;\n+\t}\n+\n+\t/* Block esw mode changes until the policy holds its own block. */\n+\terr = mlx5_eswitch_block_mode(mdev, false);\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Eswitch busy, can't add policy\");\n+\t\treturn err;\n+\t}\n+\n \tif (!priv-\u003eipsec) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"Device doesn't support IPsec packet offload\");\n-\t\treturn -EOPNOTSUPP;\n+\t\terr = -EOPNOTSUPP;\n+\t\tgoto unblock_mode;\n \t}\n \n-\terr = mlx5e_xfrm_validate_policy(priv-\u003emdev, x, extack);\n+\terr = mlx5e_xfrm_validate_policy(mdev, x, extack);\n \tif (err)\n-\t\treturn err;\n+\t\tgoto unblock_mode;\n \n \tpol_entry = kzalloc_obj(*pol_entry);\n-\tif (!pol_entry)\n-\t\treturn -ENOMEM;\n+\tif (!pol_entry) {\n+\t\terr = -ENOMEM;\n+\t\tgoto unblock_mode;\n+\t}\n \n \tpol_entry-\u003ex = x;\n \tpol_entry-\u003eipsec = priv-\u003eipsec;\n \n-\tif (!mlx5_eswitch_block_ipsec(priv-\u003emdev)) {\n+\tif (!mlx5_eswitch_block_ipsec(mdev)) {\n \t\terr = -EBUSY;\n \t\tgoto ipsec_busy;\n \t}\n@@ -1296,13 +1334,16 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,\n \t\tgoto err_fs;\n \n \tx-\u003exdo.offload_handle = (unsigned long)pol_entry;\n+\tmlx5_eswitch_unblock_mode(mdev);\n \treturn 0;\n \n err_fs:\n-\tmlx5_eswitch_unblock_ipsec(priv-\u003emdev);\n+\tmlx5_eswitch_unblock_ipsec(mdev);\n ipsec_busy:\n \tkfree(pol_entry);\n \tNL_SET_ERR_MSG_MOD(extack, \"Device failed to offload this policy\");\n+unblock_mode:\n+\tmlx5_eswitch_unblock_mode(mdev);\n \treturn err;\n }\n \ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h\nindex abcbd38db9dbbe..f4b2d7b950c009 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h\n@@ -320,7 +320,7 @@ void mlx5e_accel_ipsec_fs_del_rule(struct mlx5e_ipsec_sa_entry *sa_entry);\n int mlx5e_accel_ipsec_fs_add_pol(struct mlx5e_ipsec_pol_entry *pol_entry);\n void mlx5e_accel_ipsec_fs_del_pol(struct mlx5e_ipsec_pol_entry *pol_entry);\n void mlx5e_accel_ipsec_fs_modify(struct mlx5e_ipsec_sa_entry *sa_entry);\n-bool mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry);\n+int mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry);\n \n int mlx5_ipsec_create_sa_ctx(struct mlx5e_ipsec_sa_entry *sa_entry);\n void mlx5_ipsec_free_sa_ctx(struct mlx5e_ipsec_sa_entry *sa_entry);\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c\nindex 8ffa8068e90ac9..55de9abbd72bea 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c\n@@ -720,6 +720,16 @@ static void ipsec_rx_sa_selector_destroy(struct mlx5_core_dev *mdev,\n \tmlx5_destroy_flow_table(rx-\u003eft.sa_sel);\n }\n \n+static void\n+ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec,\n+\t\t\t struct mlx5e_ipsec_rx *rx,\n+\t\t\t u32 family)\n+{\n+\tmlx5_ipsec_fs_roce_rx_destroy(ipsec-\u003eroce, family, ipsec-\u003emdev);\n+\tif (rx == ipsec-\u003erx_esw)\n+\t\tmlx5_esw_ipsec_rx_status_pass_dest_put(ipsec);\n+}\n+\n static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n \t\t struct mlx5e_ipsec_rx *rx, u32 family)\n {\n@@ -739,13 +749,7 @@ static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n \n \tipsec_rx_policy_destroy(rx);\n \n-\tmlx5_ipsec_fs_roce_rx_destroy(ipsec-\u003eroce, family, mdev);\n-\n-#ifdef CONFIG_MLX5_ESWITCH\n-\tif (rx == ipsec-\u003erx_esw)\n-\t\tmlx5_chains_put_table(esw_chains(ipsec-\u003emdev-\u003epriv.eswitch),\n-\t\t\t\t 0, 1, 0);\n-#endif\n+\tipsec_rx_status_pass_dest_put(ipsec, rx, family);\n }\n \n static void ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,\n@@ -1068,9 +1072,12 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n \t\tgoto err_fs_ft_sa_sel;\n \n \t/* Create FT */\n-\tif (mlx5_ipsec_device_caps(mdev) \u0026 MLX5_IPSEC_CAP_TUNNEL)\n-\t\trx-\u003eallow_tunnel_mode =\n-\t\t\tmlx5_eswitch_block_encap(mdev, rx == ipsec-\u003erx_esw);\n+\tif (mlx5_ipsec_device_caps(mdev) \u0026 MLX5_IPSEC_CAP_TUNNEL) {\n+\t\terr = mlx5_eswitch_block_encap(mdev, rx == ipsec-\u003erx_esw);\n+\t\tif (err \u003c 0)\n+\t\t\tgoto err_fs_ft;\n+\t\trx-\u003eallow_tunnel_mode = err;\n+\t}\n \n \tif (rx-\u003eallow_tunnel_mode)\n \t\tflags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;\n@@ -1115,7 +1122,7 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n err_fs_ft_sa_sel:\n \tmlx5_destroy_flow_table(rx-\u003eft.status);\n err_fs_ft_status:\n-\tmlx5_ipsec_fs_roce_rx_destroy(ipsec-\u003eroce, family, mdev);\n+\tipsec_rx_status_pass_dest_put(ipsec, rx, family);\n \treturn err;\n }\n \n@@ -1127,7 +1134,7 @@ static int rx_get(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n \tif (rx-\u003eft.refcnt)\n \t\tgoto skip;\n \n-\terr = mlx5_eswitch_block_mode(mdev);\n+\terr = mlx5_eswitch_block_mode(mdev, true);\n \tif (err)\n \t\treturn err;\n \n@@ -1311,9 +1318,12 @@ static int tx_create(struct mlx5e_ipsec *ipsec, struct mlx5e_ipsec_tx *tx,\n \tif (err)\n \t\tgoto err_status_rule;\n \n-\tif (mlx5_ipsec_device_caps(mdev) \u0026 MLX5_IPSEC_CAP_TUNNEL)\n-\t\ttx-\u003eallow_tunnel_mode =\n-\t\t\tmlx5_eswitch_block_encap(mdev, tx == ipsec-\u003etx_esw);\n+\tif (mlx5_ipsec_device_caps(mdev) \u0026 MLX5_IPSEC_CAP_TUNNEL) {\n+\t\terr = mlx5_eswitch_block_encap(mdev, tx == ipsec-\u003etx_esw);\n+\t\tif (err \u003c 0)\n+\t\t\tgoto err_encap;\n+\t\ttx-\u003eallow_tunnel_mode = err;\n+\t}\n \n \tif (tx-\u003eallow_tunnel_mode)\n \t\tflags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;\n@@ -1383,6 +1393,7 @@ static int tx_create(struct mlx5e_ipsec *ipsec, struct mlx5e_ipsec_tx *tx,\n err_sa_ft:\n \tif (tx-\u003eallow_tunnel_mode)\n \t\tmlx5_eswitch_unblock_encap(mdev);\n+err_encap:\n \tmlx5_del_flow_rules(tx-\u003estatus.rule);\n err_status_rule:\n \tmlx5_destroy_flow_table(tx-\u003eft.status);\n@@ -1416,7 +1427,7 @@ static int tx_get(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,\n \tif (tx-\u003eft.refcnt)\n \t\tgoto skip;\n \n-\terr = mlx5_eswitch_block_mode(mdev);\n+\terr = mlx5_eswitch_block_mode(mdev, true);\n \tif (err)\n \t\treturn err;\n \n@@ -2574,45 +2585,26 @@ void mlx5e_accel_ipsec_fs_read_stats(struct mlx5e_priv *priv, void *ipsec_stats)\n \t}\n }\n \n-#ifdef CONFIG_MLX5_ESWITCH\n static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)\n {\n-\tstruct mlx5_eswitch *esw = mdev-\u003epriv.eswitch;\n-\tint err = 0;\n+\tint ret = 0;\n \n-\tif (esw) {\n-\t\terr = mlx5_esw_lock(esw);\n-\t\tif (err)\n-\t\t\treturn err;\n-\t}\n-\n-\tif (mdev-\u003enum_block_ipsec) {\n-\t\terr = -EBUSY;\n-\t\tgoto unlock;\n-\t}\n-\n-\tmdev-\u003enum_block_tc++;\n-\n-unlock:\n-\tif (esw)\n-\t\tmlx5_esw_unlock(esw);\n-\n-\treturn err;\n-}\n-#else\n-static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)\n-{\n-\tif (mdev-\u003enum_block_ipsec)\n-\t\treturn -EBUSY;\n+\tspin_lock_bh(\u0026mdev-\u003eoffload_block.lock);\n+\tif (mdev-\u003eoffload_block.num_block_ipsec)\n+\t\tret = -EBUSY;\n+\telse\n+\t\tmdev-\u003eoffload_block.num_block_tc++;\n+\tspin_unlock_bh(\u0026mdev-\u003eoffload_block.lock);\n \n-\tmdev-\u003enum_block_tc++;\n-\treturn 0;\n+\treturn ret;\n }\n-#endif\n \n static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev)\n {\n-\tmdev-\u003enum_block_tc--;\n+\tspin_lock_bh(\u0026mdev-\u003eoffload_block.lock);\n+\tif (!WARN_ON_ONCE(!mdev-\u003eoffload_block.num_block_tc))\n+\t\tmdev-\u003eoffload_block.num_block_tc--;\n+\tspin_unlock_bh(\u0026mdev-\u003eoffload_block.lock);\n }\n \n int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)\n@@ -2850,7 +2842,7 @@ void mlx5e_accel_ipsec_fs_modify(struct mlx5e_ipsec_sa_entry *sa_entry)\n \tmemcpy(sa_entry, \u0026sa_entry_shadow, sizeof(*sa_entry));\n }\n \n-bool mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry)\n+int mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry)\n {\n \tstruct mlx5e_ipsec *ipsec = sa_entry-\u003eipsec;\n \tstruct xfrm_state *x = sa_entry-\u003ex;\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\nindex c3c2c5720c6f32..5cf3362259fc37 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c\n@@ -6382,7 +6382,7 @@ int mlx5e_priv_init(struct mlx5e_priv *priv,\n \tnode = dev_to_node(mlx5_core_dma_dev(mdev));\n \n \t/* priv init */\n-\tpriv-\u003emdev = mdev;\n+\tWRITE_ONCE(priv-\u003emdev, mdev);\n \tpriv-\u003enetdev = netdev;\n \tpriv-\u003emax_nch = nch;\n \tpriv-\u003emax_opened_tc = 1;\n@@ -6467,6 +6467,8 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv)\n \t\tmlx5e_mqprio_rl_free(priv-\u003emqprio_rl);\n \t}\n \n+\t/* Clear atomically before memset() for lockless XFRM readers. */\n+\tWRITE_ONCE(priv-\u003emdev, NULL);\n \tmemset(priv, 0, sizeof(*priv));\n \tif (destroying) /* restore destroying bit, to allow unload */\n \t\tset_bit(MLX5E_STATE_DESTROYING, \u0026priv-\u003estate);\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\nindex 708b7987ea4cd6..9f97c9d680bb7b 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c\n@@ -4836,16 +4836,19 @@ static bool is_tc_ipsec_order_check_needed(struct net_device *filter, struct mlx\n static int mlx5e_tc_block_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)\n {\n \tstruct mlx5_core_dev *mdev = priv-\u003emdev;\n+\tint ret = 0;\n \n \tif (!is_tc_ipsec_order_check_needed(filter, priv))\n \t\treturn 0;\n \n-\tif (mdev-\u003enum_block_tc)\n-\t\treturn -EBUSY;\n-\n-\tmdev-\u003enum_block_ipsec++;\n+\tspin_lock_bh(\u0026mdev-\u003eoffload_block.lock);\n+\tif (mdev-\u003eoffload_block.num_block_tc)\n+\t\tret = -EBUSY;\n+\telse\n+\t\tmdev-\u003eoffload_block.num_block_ipsec++;\n+\tspin_unlock_bh(\u0026mdev-\u003eoffload_block.lock);\n \n-\treturn 0;\n+\treturn ret;\n }\n \n static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)\n@@ -4853,7 +4856,10 @@ static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx\n \tif (!is_tc_ipsec_order_check_needed(filter, priv))\n \t\treturn;\n \n-\tpriv-\u003emdev-\u003enum_block_ipsec--;\n+\tspin_lock_bh(\u0026priv-\u003emdev-\u003eoffload_block.lock);\n+\tif (!WARN_ON_ONCE(!priv-\u003emdev-\u003eoffload_block.num_block_ipsec))\n+\t\tpriv-\u003emdev-\u003eoffload_block.num_block_ipsec--;\n+\tspin_unlock_bh(\u0026priv-\u003emdev-\u003eoffload_block.lock);\n }\n \n int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c\nindex ab50d2c734ede0..f8c97954b6eafd 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c\n@@ -34,12 +34,23 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,\n int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,\n \t\t\t\t\t struct mlx5_flow_destination *dest)\n {\n-\tdest-\u003etype = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;\n-\tdest-\u003eft = mlx5_chains_get_table(esw_chains(ipsec-\u003emdev-\u003epriv.eswitch), 0, 1, 0);\n+\tstruct mlx5_flow_table *ft;\n+\n+\tft = mlx5_chains_get_table(esw_chains(ipsec-\u003emdev-\u003epriv.eswitch),\n+\t\t\t\t 0, 1, 0);\n+\tif (IS_ERR(ft))\n+\t\treturn PTR_ERR(ft);\n \n+\tdest-\u003etype = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;\n+\tdest-\u003eft = ft;\n \treturn 0;\n }\n \n+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)\n+{\n+\tmlx5_chains_put_table(esw_chains(ipsec-\u003emdev-\u003epriv.eswitch), 0, 1, 0);\n+}\n+\n int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,\n \t\t\t\t\t struct mlx5_flow_act *flow_act)\n {\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h\nindex 514c15258b1d13..bb6f2423078bd0 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h\n@@ -12,6 +12,7 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,\n \t\t\t\t struct mlx5e_ipsec_rx_create_attr *attr);\n int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,\n \t\t\t\t\t struct mlx5_flow_destination *dest);\n+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec);\n int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,\n \t\t\t\t\t struct mlx5_flow_act *flow_act);\n void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry);\n@@ -32,6 +33,11 @@ static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ips\n \treturn -EINVAL;\n }\n \n+static inline\n+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)\n+{\n+}\n+\n static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,\n \t\t\t\t\t\t\tstruct mlx5_flow_act *flow_act)\n {\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\nindex 2d289fb1353b0f..f50993cfcf7a33 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\n@@ -3051,12 +3051,36 @@ int mlx5_esw_lock(struct mlx5_eswitch *esw)\n \treturn 0;\n }\n \n+static void esw_mode_lock(struct mlx5_eswitch *esw)\n+{\n+\tdown_write(\u0026esw-\u003emode_lock);\n+}\n+\n+static void esw_mode_unlock(struct mlx5_eswitch *esw)\n+{\n+\tup_write(\u0026esw-\u003emode_lock);\n+}\n+\n+/* Lock the eswitch and wait for an operation in progress to finish. */\n+void mlx5_esw_lock_wait(struct mlx5_eswitch *esw)\n+{\n+\tdown_write(\u0026esw-\u003emode_lock);\n+\twait_var_event_any_lock(\u0026esw-\u003eeswitch_operation_in_progress,\n+\t\t\t\t!esw-\u003eeswitch_operation_in_progress,\n+\t\t\t\tesw, esw_mode, TASK_UNINTERRUPTIBLE);\n+}\n+\n /**\n * mlx5_esw_unlock() - Release write lock on esw mode lock\n * @esw: eswitch device.\n+ *\n+ * Also wakes up mlx5_esw_lock_wait() waiters, so it must be used to release\n+ * mode_lock after clearing eswitch_operation_in_progress.\n */\n void mlx5_esw_unlock(struct mlx5_eswitch *esw)\n {\n+\twake_up_var_locked(\u0026esw-\u003eeswitch_operation_in_progress,\n+\t\t\t \u0026esw-\u003emode_lock);\n \tup_write(\u0026esw-\u003emode_lock);\n }\n \ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h\nindex e9cbcd73b23ffa..48eb6acc1e8715 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h\n@@ -948,6 +948,7 @@ void mlx5_esw_get(struct mlx5_core_dev *dev);\n void mlx5_esw_put(struct mlx5_core_dev *dev);\n int mlx5_esw_try_lock(struct mlx5_eswitch *esw);\n int mlx5_esw_lock(struct mlx5_eswitch *esw);\n+void mlx5_esw_lock_wait(struct mlx5_eswitch *esw);\n void mlx5_esw_unlock(struct mlx5_eswitch *esw);\n \n void esw_vport_change_handle_locked(struct mlx5_vport *vport);\n@@ -967,10 +968,10 @@ void mlx5_eswitch_unload_reps(struct mlx5_eswitch *esw);\n bool mlx5_eswitch_is_peer(struct mlx5_eswitch *esw,\n \t\t\t struct mlx5_eswitch *peer_esw);\n \n-bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb);\n+int mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb);\n void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev);\n \n-int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev);\n+int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev, bool check_users);\n void mlx5_eswitch_unblock_mode(struct mlx5_core_dev *dev);\n \n static inline int mlx5_eswitch_num_vfs(struct mlx5_eswitch *esw)\n@@ -1071,17 +1072,21 @@ mlx5_eswitch_reload_ib_reps(struct mlx5_eswitch *esw)\n static inline void\n mlx5_eswitch_unload_reps(struct mlx5_eswitch *esw) {}\n \n-static inline bool\n+static inline int\n mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)\n {\n-\treturn true;\n+\treturn 1;\n }\n \n static inline void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev)\n {\n }\n \n-static inline int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev) { return 0; }\n+static inline int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev,\n+\t\t\t\t\t bool check_users)\n+{\n+\treturn 0;\n+}\n static inline void mlx5_eswitch_unblock_mode(struct mlx5_core_dev *dev) {}\n static inline bool mlx5_eswitch_block_ipsec(struct mlx5_core_dev *dev)\n {\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c\nindex c712848b202db4..4747841310914b 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c\n@@ -2457,8 +2457,8 @@ void mlx5_esw_reps_unblock(struct mlx5_eswitch *esw)\n \n static void esw_mode_change(struct mlx5_eswitch *esw, u16 mode)\n {\n+\tmlx5_devcom_comp_assert_locked(esw-\u003edev-\u003epriv.hca_devcom_comp);\n \tmlx5_esw_reps_unblock(esw);\n-\tmlx5_devcom_comp_lock(esw-\u003edev-\u003epriv.hca_devcom_comp);\n \tif (esw-\u003edev-\u003epriv.flags \u0026 MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ||\n \t mlx5_core_mp_enabled(esw-\u003edev)) {\n \t\tesw-\u003emode = mode;\n@@ -2471,7 +2471,6 @@ static void esw_mode_change(struct mlx5_eswitch *esw, u16 mode)\n \tesw-\u003edev-\u003epriv.flags \u0026= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;\n out:\n \tmlx5_rescan_drivers_locked(esw-\u003edev);\n-\tmlx5_devcom_comp_unlock(esw-\u003edev-\u003epriv.hca_devcom_comp);\n \tmlx5_esw_reps_block(esw);\n }\n \n@@ -4366,7 +4365,7 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode)\n \treturn 0;\n }\n \n-int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev)\n+int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev, bool check_users)\n {\n \tstruct mlx5_eswitch *esw = dev-\u003epriv.eswitch;\n \tint err;\n@@ -4374,8 +4373,11 @@ int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev)\n \tif (!mlx5_esw_allowed(esw))\n \t\treturn 0;\n \n-\t/* Take TC into account */\n-\terr = mlx5_esw_try_lock(esw);\n+\t/* Temporary reservations may reuse tables while TC users exist. */\n+\tif (check_users)\n+\t\terr = mlx5_esw_try_lock(esw);\n+\telse\n+\t\terr = mlx5_esw_lock(esw);\n \tif (err \u003c 0)\n \t\treturn err;\n \n@@ -4442,7 +4444,7 @@ static bool mlx5_devlink_switchdev_active_mode_change(struct mlx5_eswitch *esw,\n \t !esw-\u003eoffloads_inactive)\n \t\treturn false;\n \n-\tdown_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_lock_wait(esw);\n \tesw-\u003eoffloads_inactive = !esw-\u003eoffloads_inactive;\n \tesw-\u003eeswitch_operation_in_progress = true;\n \tup_write(\u0026esw-\u003emode_lock);\n@@ -4454,34 +4456,30 @@ static bool mlx5_devlink_switchdev_active_mode_change(struct mlx5_eswitch *esw,\n \n \tdown_write(\u0026esw-\u003emode_lock);\n \tesw-\u003eeswitch_operation_in_progress = false;\n-\tup_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_unlock(esw);\n \treturn true;\n }\n \n-#define MLX5_ESW_HOLD_TIMEOUT_MS 7000\n-#define MLX5_ESW_HOLD_RETRY_DELAY_MS 500\n-\n void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev)\n {\n-\tunsigned long timeout;\n-\tbool hold_esw = true;\n+\tstruct mlx5_eswitch *esw = dev-\u003epriv.eswitch;\n \n-\t/* Wait for any concurrent eswitch mode transition to complete. */\n-\tif (!mlx5_esw_hold(dev)) {\n-\t\ttimeout = jiffies + msecs_to_jiffies(MLX5_ESW_HOLD_TIMEOUT_MS);\n-\t\twhile (!mlx5_esw_hold(dev)) {\n-\t\t\tif (!time_before(jiffies, timeout)) {\n-\t\t\t\thold_esw = false;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tmsleep(MLX5_ESW_HOLD_RETRY_DELAY_MS);\n-\t\t}\n-\t}\n-\tif (hold_esw) {\n-\t\tif (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS)\n-\t\t\tmlx5_core_reps_aux_devs_remove(dev);\n-\t\tmlx5_esw_release(dev);\n-\t}\n+\tif (!mlx5_esw_allowed(esw))\n+\t\treturn;\n+\n+\t/* Wait for any concurrent eswitch mode transition to complete.\n+\t * Deadlock risk if ever called from within an operation in progress.\n+\t */\n+\tmlx5_esw_lock_wait(esw);\n+\tesw-\u003eeswitch_operation_in_progress = true;\n+\tup_write(\u0026esw-\u003emode_lock);\n+\n+\tif (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS)\n+\t\tmlx5_core_reps_aux_devs_remove(dev);\n+\n+\tdown_write(\u0026esw-\u003emode_lock);\n+\tesw-\u003eeswitch_operation_in_progress = false;\n+\tmlx5_esw_unlock(esw);\n }\n \n int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,\n@@ -4508,10 +4506,11 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,\n \t\treturn 0;\n \n \tmlx5_lag_disable_change(esw-\u003edev);\n+\tmlx5_devcom_comp_lock(esw-\u003edev-\u003epriv.hca_devcom_comp);\n \terr = mlx5_esw_try_lock(esw);\n \tif (err \u003c 0) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"Can't change mode, E-Switch is busy\");\n-\t\tgoto enable_lag;\n+\t\tgoto unlock_hca;\n \t}\n \tcur_mlx5_mode = err;\n \terr = 0;\n@@ -4574,7 +4573,8 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,\n \tesw-\u003eeswitch_operation_in_progress = false;\n unlock:\n \tmlx5_esw_unlock(esw);\n-enable_lag:\n+unlock_hca:\n+\tmlx5_devcom_comp_unlock(esw-\u003edev-\u003epriv.hca_devcom_comp);\n \tmlx5_lag_enable_change(esw-\u003edev);\n \t/* Shared FDB activation is creating LAG which is changing reps. */\n \tif (!err)\n@@ -4655,7 +4655,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,\n \tif (IS_ERR(esw))\n \t\treturn PTR_ERR(esw);\n \n-\tdown_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_lock_wait(esw);\n \n \tswitch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {\n \tcase MLX5_CAP_INLINE_MODE_NOT_REQUIRED:\n@@ -4693,7 +4693,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,\n \n \tdown_write(\u0026esw-\u003emode_lock);\n \tesw-\u003eeswitch_operation_in_progress = false;\n-\tup_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_unlock(esw);\n \treturn 0;\n \n out:\n@@ -4712,25 +4712,31 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode)\n \treturn esw_inline_mode_to_devlink(esw-\u003eoffloads.inline_mode, mode);\n }\n \n-bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)\n+/* Return 1 if allowed, 0 if disallowed by the configuration, or -EBUSY\n+ * if an eswitch operation is in progress.\n+ */\n+int mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)\n {\n \tstruct mlx5_eswitch *esw = dev-\u003epriv.eswitch;\n \tenum devlink_eswitch_encap_mode encap;\n-\tbool allow_tunnel = false;\n+\tint ret;\n \n \tif (!mlx5_esw_allowed(esw))\n-\t\treturn true;\n+\t\treturn 1;\n+\n+\tret = mlx5_esw_lock(esw);\n+\tif (ret)\n+\t\treturn ret;\n \n-\tdown_write(\u0026esw-\u003emode_lock);\n \tencap = esw-\u003eoffloads.encap;\n \tif (esw-\u003emode == MLX5_ESWITCH_LEGACY ||\n \t (encap == DEVLINK_ESWITCH_ENCAP_MODE_NONE \u0026\u0026 !from_fdb)) {\n-\t\tallow_tunnel = true;\n+\t\tret = 1;\n \t\tesw-\u003eoffloads.num_block_encap++;\n \t}\n-\tup_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_unlock(esw);\n \n-\treturn allow_tunnel;\n+\treturn ret;\n }\n \n void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev)\n@@ -4757,7 +4763,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,\n \tif (IS_ERR(esw))\n \t\treturn PTR_ERR(esw);\n \n-\tdown_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_lock_wait(esw);\n \n \tif (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE \u0026\u0026\n \t (!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) ||\n@@ -4813,7 +4819,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,\n \tesw-\u003eeswitch_operation_in_progress = false;\n \n unlock:\n-\tup_write(\u0026esw-\u003emode_lock);\n+\tmlx5_esw_unlock(esw);\n \treturn err;\n }\n \ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c\nindex 1a45474ce03db5..0439fcfb9ce571 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c\n@@ -1814,6 +1814,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)\n \tlockdep_register_key(\u0026dev-\u003elock_key);\n \tmutex_init(\u0026dev-\u003eintf_state_mutex);\n \tlockdep_set_class(\u0026dev-\u003eintf_state_mutex, \u0026dev-\u003elock_key);\n+\tspin_lock_init(\u0026dev-\u003eoffload_block.lock);\n \tmutex_init(\u0026dev-\u003emlx5e_res.uplink_netdev_lock);\n \tmutex_init(\u0026dev-\u003ewc_state_lock);\n \ndiff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h\nindex abb99371ff1344..84e9f6bdb7c140 100644\n--- a/include/linux/mlx5/driver.h\n+++ b/include/linux/mlx5/driver.h\n@@ -789,8 +789,12 @@ struct mlx5_core_dev {\n \tu32 vsc_addr;\n \tstruct mlx5_hv_vhca\t*hv_vhca;\n \tstruct mlx5_hwmon\t*hwmon;\n-\tu64\t\t\tnum_block_tc;\n-\tu64\t\t\tnum_block_ipsec;\n+\tstruct {\n+\t\t/* Protects the fields below. */\n+\t\tspinlock_t lock;\n+\t\tu64 num_block_tc;\n+\t\tu64 num_block_ipsec;\n+\t} offload_block;\n #ifdef CONFIG_MLX5_MACSEC\n \tstruct mlx5_macsec_fs *macsec_fs;\n \t/* MACsec notifier chain to sync MACsec core and IB database */\n"
} |
| 2/1 | 2026/11/08 18:50 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch modifies the Mellanox mlx5 network driver (specifically IPsec offload and eswitch mode locking logic). Mellanox ConnectX/BlueField devices are vendor-specific PCIe SmartNICs/adapters that require physical hardware and are not emulated in standard QEMU or GCE virtualized environments used by syzkaller. Because the code is structurally unreachable during fuzzing, it does not warrant fuzzing.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 1ed89e91f03721b53b7a7c314042f3a1009815cc
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Nov 8 18:50:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index 7e991a09b3ff58..fa6cb51fdb939f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -771,53 +771,72 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
struct xfrm_state *x,
struct netlink_ext_ack *extack)
{
+ bool is_acq = x->xso.flags & XFRM_DEV_OFFLOAD_FLAG_ACQ;
struct mlx5e_ipsec_sa_entry *sa_entry = NULL;
bool allow_tunnel_mode = false;
+ struct mlx5_core_dev *mdev;
struct mlx5e_ipsec *ipsec;
struct mlx5e_priv *priv;
gfp_t gfp;
int err;
priv = netdev_priv(dev);
- if (!priv->ipsec)
- return -EOPNOTSUPP;
+ /* Profile cleanup can memset an already NULL mdev. */
+ mdev = data_race(READ_ONCE(priv->mdev));
+ /* NULL only during a profile change, which is an eswitch operation. */
+ if (!mdev) {
+ NL_SET_ERR_MSG_MOD(extack, "Eswitch busy, can't add state");
+ return -EBUSY;
+ }
+
+ if (!is_acq) {
+ err = mlx5_eswitch_block_mode(mdev, false);
+ if (err)
+ return err;
+ }
ipsec = priv->ipsec;
- gfp = (x->xso.flags & XFRM_DEV_OFFLOAD_FLAG_ACQ) ? GFP_ATOMIC : GFP_KERNEL;
+ if (!ipsec) {
+ err = -EOPNOTSUPP;
+ goto unblock_mode;
+ }
+
+ gfp = is_acq ? GFP_ATOMIC : GFP_KERNEL;
sa_entry = kzalloc_obj(*sa_entry, gfp);
- if (!sa_entry)
- return -ENOMEM;
+ if (!sa_entry) {
+ err = -ENOMEM;
+ goto unblock_mode;
+ }
sa_entry->x = x;
sa_entry->dev = dev;
sa_entry->ipsec = ipsec;
/* Check if this SA is originated from acquire flow temporary SA */
- if (x->xso.flags & XFRM_DEV_OFFLOAD_FLAG_ACQ) {
+ if (is_acq) {
x->xso.offload_handle = (unsigned long)sa_entry;
return 0;
}
- err = mlx5e_xfrm_validate_state(priv->mdev, x, extack);
+ err = mlx5e_xfrm_validate_state(mdev, x, extack);
if (err)
goto err_xfrm;
- if (!mlx5_eswitch_block_ipsec(priv->mdev)) {
+ if (!mlx5_eswitch_block_ipsec(mdev)) {
err = -EBUSY;
goto err_xfrm;
}
- err = mlx5_eswitch_block_mode(priv->mdev);
- if (err)
- goto unblock_ipsec;
-
if (x->props.mode == XFRM_MODE_TUNNEL &&
x->xso.type == XFRM_DEV_OFFLOAD_PACKET) {
- allow_tunnel_mode = mlx5e_ipsec_fs_tunnel_allowed(sa_entry);
+ err = mlx5e_ipsec_fs_tunnel_allowed(sa_entry);
+ if (err < 0)
+ goto unblock_ipsec;
+ allow_tunnel_mode = err;
if (!allow_tunnel_mode) {
NL_SET_ERR_MSG_MOD(extack,
"Packet offload tunnel mode is disabled due to encap settings");
err = -EINVAL;
- goto unblock_mode;
+ goto unblock_ipsec;
}
}
@@ -874,9 +893,9 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
x->xso.offload_handle = (unsigned long)sa_entry;
if (allow_tunnel_mode)
- mlx5_eswitch_unblock_encap(priv->mdev);
+ mlx5_eswitch_unblock_encap(mdev);
- mlx5_eswitch_unblock_mode(priv->mdev);
+ mlx5_eswitch_unblock_mode(mdev);
return 0;
@@ -892,14 +911,15 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
kfree(sa_entry->work);
unblock_encap:
if (allow_tunnel_mode)
- mlx5_eswitch_unblock_encap(priv->mdev);
-unblock_mode:
- mlx5_eswitch_unblock_mode(priv->mdev);
+ mlx5_eswitch_unblock_encap(mdev);
unblock_ipsec:
- mlx5_eswitch_unblock_ipsec(priv->mdev);
+ mlx5_eswitch_unblock_ipsec(mdev);
err_xfrm:
kfree(sa_entry);
NL_SET_ERR_MSG_WEAK_MOD(extack, "Device failed to offload this state");
+unblock_mode:
+ if (!is_acq)
+ mlx5_eswitch_unblock_mode(mdev);
return err;
}
@@ -1265,27 +1285,45 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
{
struct net_device *netdev = x->xdo.dev;
struct mlx5e_ipsec_pol_entry *pol_entry;
+ struct mlx5_core_dev *mdev;
struct mlx5e_priv *priv;
int err;
priv = netdev_priv(netdev);
+ /* Profile cleanup can memset an already NULL mdev. */
+ mdev = data_race(READ_ONCE(priv->mdev));
+ if (!mdev) {
+ NL_SET_ERR_MSG_MOD(extack, "Eswitch busy, can't add policy");
+ return -EBUSY;
+ }
+
+ /* Block esw mode changes until the policy holds its own block. */
+ err = mlx5_eswitch_block_mode(mdev, false);
+ if (err) {
+ NL_SET_ERR_MSG_MOD(extack, "Eswitch busy, can't add policy");
+ return err;
+ }
+
if (!priv->ipsec) {
NL_SET_ERR_MSG_MOD(extack, "Device doesn't support IPsec packet offload");
- return -EOPNOTSUPP;
+ err = -EOPNOTSUPP;
+ goto unblock_mode;
}
- err = mlx5e_xfrm_validate_policy(priv->mdev, x, extack);
+ err = mlx5e_xfrm_validate_policy(mdev, x, extack);
if (err)
- return err;
+ goto unblock_mode;
pol_entry = kzalloc_obj(*pol_entry);
- if (!pol_entry)
- return -ENOMEM;
+ if (!pol_entry) {
+ err = -ENOMEM;
+ goto unblock_mode;
+ }
pol_entry->x = x;
pol_entry->ipsec = priv->ipsec;
- if (!mlx5_eswitch_block_ipsec(priv->mdev)) {
+ if (!mlx5_eswitch_block_ipsec(mdev)) {
err = -EBUSY;
goto ipsec_busy;
}
@@ -1296,13 +1334,16 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
goto err_fs;
x->xdo.offload_handle = (unsigned long)pol_entry;
+ mlx5_eswitch_unblock_mode(mdev);
return 0;
err_fs:
- mlx5_eswitch_unblock_ipsec(priv->mdev);
+ mlx5_eswitch_unblock_ipsec(mdev);
ipsec_busy:
kfree(pol_entry);
NL_SET_ERR_MSG_MOD(extack, "Device failed to offload this policy");
+unblock_mode:
+ mlx5_eswitch_unblock_mode(mdev);
return err;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
index abcbd38db9dbbe..f4b2d7b950c009 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
@@ -320,7 +320,7 @@ void mlx5e_accel_ipsec_fs_del_rule(struct mlx5e_ipsec_sa_entry *sa_entry);
int mlx5e_accel_ipsec_fs_add_pol(struct mlx5e_ipsec_pol_entry *pol_entry);
void mlx5e_accel_ipsec_fs_del_pol(struct mlx5e_ipsec_pol_entry *pol_entry);
void mlx5e_accel_ipsec_fs_modify(struct mlx5e_ipsec_sa_entry *sa_entry);
-bool mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry);
+int mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry);
int mlx5_ipsec_create_sa_ctx(struct mlx5e_ipsec_sa_entry *sa_entry);
void mlx5_ipsec_free_sa_ctx(struct mlx5e_ipsec_sa_entry *sa_entry);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
index 8ffa8068e90ac9..55de9abbd72bea 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
@@ -720,6 +720,16 @@ static void ipsec_rx_sa_selector_destroy(struct mlx5_core_dev *mdev,
mlx5_destroy_flow_table(rx->ft.sa_sel);
}
+static void
+ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec,
+ struct mlx5e_ipsec_rx *rx,
+ u32 family)
+{
+ mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, ipsec->mdev);
+ if (rx == ipsec->rx_esw)
+ mlx5_esw_ipsec_rx_status_pass_dest_put(ipsec);
+}
+
static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
struct mlx5e_ipsec_rx *rx, u32 family)
{
@@ -739,13 +749,7 @@ static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
ipsec_rx_policy_destroy(rx);
- mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, mdev);
-
-#ifdef CONFIG_MLX5_ESWITCH
- if (rx == ipsec->rx_esw)
- mlx5_chains_put_table(esw_chains(ipsec->mdev->priv.eswitch),
- 0, 1, 0);
-#endif
+ ipsec_rx_status_pass_dest_put(ipsec, rx, family);
}
static void ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
@@ -1068,9 +1072,12 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
goto err_fs_ft_sa_sel;
/* Create FT */
- if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_TUNNEL)
- rx->allow_tunnel_mode =
- mlx5_eswitch_block_encap(mdev, rx == ipsec->rx_esw);
+ if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_TUNNEL) {
+ err = mlx5_eswitch_block_encap(mdev, rx == ipsec->rx_esw);
+ if (err < 0)
+ goto err_fs_ft;
+ rx->allow_tunnel_mode = err;
+ }
if (rx->allow_tunnel_mode)
flags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;
@@ -1115,7 +1122,7 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
err_fs_ft_sa_sel:
mlx5_destroy_flow_table(rx->ft.status);
err_fs_ft_status:
- mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, mdev);
+ ipsec_rx_status_pass_dest_put(ipsec, rx, family);
return err;
}
@@ -1127,7 +1134,7 @@ static int rx_get(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
if (rx->ft.refcnt)
goto skip;
- err = mlx5_eswitch_block_mode(mdev);
+ err = mlx5_eswitch_block_mode(mdev, true);
if (err)
return err;
@@ -1311,9 +1318,12 @@ static int tx_create(struct mlx5e_ipsec *ipsec, struct mlx5e_ipsec_tx *tx,
if (err)
goto err_status_rule;
- if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_TUNNEL)
- tx->allow_tunnel_mode =
- mlx5_eswitch_block_encap(mdev, tx == ipsec->tx_esw);
+ if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_TUNNEL) {
+ err = mlx5_eswitch_block_encap(mdev, tx == ipsec->tx_esw);
+ if (err < 0)
+ goto err_encap;
+ tx->allow_tunnel_mode = err;
+ }
if (tx->allow_tunnel_mode)
flags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;
@@ -1383,6 +1393,7 @@ static int tx_create(struct mlx5e_ipsec *ipsec, struct mlx5e_ipsec_tx *tx,
err_sa_ft:
if (tx->allow_tunnel_mode)
mlx5_eswitch_unblock_encap(mdev);
+err_encap:
mlx5_del_flow_rules(tx->status.rule);
err_status_rule:
mlx5_destroy_flow_table(tx->ft.status);
@@ -1416,7 +1427,7 @@ static int tx_get(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
if (tx->ft.refcnt)
goto skip;
- err = mlx5_eswitch_block_mode(mdev);
+ err = mlx5_eswitch_block_mode(mdev, true);
if (err)
return err;
@@ -2574,45 +2585,26 @@ void mlx5e_accel_ipsec_fs_read_stats(struct mlx5e_priv *priv, void *ipsec_stats)
}
}
-#ifdef CONFIG_MLX5_ESWITCH
static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)
{
- struct mlx5_eswitch *esw = mdev->priv.eswitch;
- int err = 0;
+ int ret = 0;
- if (esw) {
- err = mlx5_esw_lock(esw);
- if (err)
- return err;
- }
-
- if (mdev->num_block_ipsec) {
- err = -EBUSY;
- goto unlock;
- }
-
- mdev->num_block_tc++;
-
-unlock:
- if (esw)
- mlx5_esw_unlock(esw);
-
- return err;
-}
-#else
-static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)
-{
- if (mdev->num_block_ipsec)
- return -EBUSY;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (mdev->offload_block.num_block_ipsec)
+ ret = -EBUSY;
+ else
+ mdev->offload_block.num_block_tc++;
+ spin_unlock_bh(&mdev->offload_block.lock);
- mdev->num_block_tc++;
- return 0;
+ return ret;
}
-#endif
static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev)
{
- mdev->num_block_tc--;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (!WARN_ON_ONCE(!mdev->offload_block.num_block_tc))
+ mdev->offload_block.num_block_tc--;
+ spin_unlock_bh(&mdev->offload_block.lock);
}
int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
@@ -2850,7 +2842,7 @@ void mlx5e_accel_ipsec_fs_modify(struct mlx5e_ipsec_sa_entry *sa_entry)
memcpy(sa_entry, &sa_entry_shadow, sizeof(*sa_entry));
}
-bool mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry)
+int mlx5e_ipsec_fs_tunnel_allowed(struct mlx5e_ipsec_sa_entry *sa_entry)
{
struct mlx5e_ipsec *ipsec = sa_entry->ipsec;
struct xfrm_state *x = sa_entry->x;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index c3c2c5720c6f32..5cf3362259fc37 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -6382,7 +6382,7 @@ int mlx5e_priv_init(struct mlx5e_priv *priv,
node = dev_to_node(mlx5_core_dma_dev(mdev));
/* priv init */
- priv->mdev = mdev;
+ WRITE_ONCE(priv->mdev, mdev);
priv->netdev = netdev;
priv->max_nch = nch;
priv->max_opened_tc = 1;
@@ -6467,6 +6467,8 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv)
mlx5e_mqprio_rl_free(priv->mqprio_rl);
}
+ /* Clear atomically before memset() for lockless XFRM readers. */
+ WRITE_ONCE(priv->mdev, NULL);
memset(priv, 0, sizeof(*priv));
if (destroying) /* restore destroying bit, to allow unload */
set_bit(MLX5E_STATE_DESTROYING, &priv->state);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 708b7987ea4cd6..9f97c9d680bb7b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4836,16 +4836,19 @@ static bool is_tc_ipsec_order_check_needed(struct net_device *filter, struct mlx
static int mlx5e_tc_block_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)
{
struct mlx5_core_dev *mdev = priv->mdev;
+ int ret = 0;
if (!is_tc_ipsec_order_check_needed(filter, priv))
return 0;
- if (mdev->num_block_tc)
- return -EBUSY;
-
- mdev->num_block_ipsec++;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (mdev->offload_block.num_block_tc)
+ ret = -EBUSY;
+ else
+ mdev->offload_block.num_block_ipsec++;
+ spin_unlock_bh(&mdev->offload_block.lock);
- return 0;
+ return ret;
}
static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)
@@ -4853,7 +4856,10 @@ static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx
if (!is_tc_ipsec_order_check_needed(filter, priv))
return;
- priv->mdev->num_block_ipsec--;
+ spin_lock_bh(&priv->mdev->offload_block.lock);
+ if (!WARN_ON_ONCE(!priv->mdev->offload_block.num_block_ipsec))
+ priv->mdev->offload_block.num_block_ipsec--;
+ spin_unlock_bh(&priv->mdev->offload_block.lock);
}
int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
index ab50d2c734ede0..f8c97954b6eafd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
@@ -34,12 +34,23 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
struct mlx5_flow_destination *dest)
{
- dest->type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
- dest->ft = mlx5_chains_get_table(esw_chains(ipsec->mdev->priv.eswitch), 0, 1, 0);
+ struct mlx5_flow_table *ft;
+
+ ft = mlx5_chains_get_table(esw_chains(ipsec->mdev->priv.eswitch),
+ 0, 1, 0);
+ if (IS_ERR(ft))
+ return PTR_ERR(ft);
+ dest->type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
+ dest->ft = ft;
return 0;
}
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)
+{
+ mlx5_chains_put_table(esw_chains(ipsec->mdev->priv.eswitch), 0, 1, 0);
+}
+
int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act)
{
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
index 514c15258b1d13..bb6f2423078bd0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
@@ -12,6 +12,7 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
struct mlx5e_ipsec_rx_create_attr *attr);
int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
struct mlx5_flow_destination *dest);
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec);
int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act);
void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry);
@@ -32,6 +33,11 @@ static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ips
return -EINVAL;
}
+static inline
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)
+{
+}
+
static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act)
{
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 2d289fb1353b0f..f50993cfcf7a33 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -3051,12 +3051,36 @@ int mlx5_esw_lock(struct mlx5_eswitch *esw)
return 0;
}
+static void esw_mode_lock(struct mlx5_eswitch *esw)
+{
+ down_write(&esw->mode_lock);
+}
+
+static void esw_mode_unlock(struct mlx5_eswitch *esw)
+{
+ up_write(&esw->mode_lock);
+}
+
+/* Lock the eswitch and wait for an operation in progress to finish. */
+void mlx5_esw_lock_wait(struct mlx5_eswitch *esw)
+{
+ down_write(&esw->mode_lock);
+ wait_var_event_any_lock(&esw->eswitch_operation_in_progress,
+ !esw->eswitch_operation_in_progress,
+ esw, esw_mode, TASK_UNINTERRUPTIBLE);
+}
+
/**
* mlx5_esw_unlock() - Release write lock on esw mode lock
* @esw: eswitch device.
+ *
+ * Also wakes up mlx5_esw_lock_wait() waiters, so it must be used to release
+ * mode_lock after clearing eswitch_operation_in_progress.
*/
void mlx5_esw_unlock(struct mlx5_eswitch *esw)
{
+ wake_up_var_locked(&esw->eswitch_operation_in_progress,
+ &esw->mode_lock);
up_write(&esw->mode_lock);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index e9cbcd73b23ffa..48eb6acc1e8715 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -948,6 +948,7 @@ void mlx5_esw_get(struct mlx5_core_dev *dev);
void mlx5_esw_put(struct mlx5_core_dev *dev);
int mlx5_esw_try_lock(struct mlx5_eswitch *esw);
int mlx5_esw_lock(struct mlx5_eswitch *esw);
+void mlx5_esw_lock_wait(struct mlx5_eswitch *esw);
void mlx5_esw_unlock(struct mlx5_eswitch *esw);
void esw_vport_change_handle_locked(struct mlx5_vport *vport);
@@ -967,10 +968,10 @@ void mlx5_eswitch_unload_reps(struct mlx5_eswitch *esw);
bool mlx5_eswitch_is_peer(struct mlx5_eswitch *esw,
struct mlx5_eswitch *peer_esw);
-bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb);
+int mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb);
void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev);
-int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev);
+int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev, bool check_users);
void mlx5_eswitch_unblock_mode(struct mlx5_core_dev *dev);
static inline int mlx5_eswitch_num_vfs(struct mlx5_eswitch *esw)
@@ -1071,17 +1072,21 @@ mlx5_eswitch_reload_ib_reps(struct mlx5_eswitch *esw)
static inline void
mlx5_eswitch_unload_reps(struct mlx5_eswitch *esw) {}
-static inline bool
+static inline int
mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)
{
- return true;
+ return 1;
}
static inline void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev)
{
}
-static inline int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev) { return 0; }
+static inline int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev,
+ bool check_users)
+{
+ return 0;
+}
static inline void mlx5_eswitch_unblock_mode(struct mlx5_core_dev *dev) {}
static inline bool mlx5_eswitch_block_ipsec(struct mlx5_core_dev *dev)
{
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index c712848b202db4..4747841310914b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2457,8 +2457,8 @@ void mlx5_esw_reps_unblock(struct mlx5_eswitch *esw)
static void esw_mode_change(struct mlx5_eswitch *esw, u16 mode)
{
+ mlx5_devcom_comp_assert_locked(esw->dev->priv.hca_devcom_comp);
mlx5_esw_reps_unblock(esw);
- mlx5_devcom_comp_lock(esw->dev->priv.hca_devcom_comp);
if (esw->dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ||
mlx5_core_mp_enabled(esw->dev)) {
esw->mode = mode;
@@ -2471,7 +2471,6 @@ static void esw_mode_change(struct mlx5_eswitch *esw, u16 mode)
esw->dev->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
out:
mlx5_rescan_drivers_locked(esw->dev);
- mlx5_devcom_comp_unlock(esw->dev->priv.hca_devcom_comp);
mlx5_esw_reps_block(esw);
}
@@ -4366,7 +4365,7 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode)
return 0;
}
-int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev)
+int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev, bool check_users)
{
struct mlx5_eswitch *esw = dev->priv.eswitch;
int err;
@@ -4374,8 +4373,11 @@ int mlx5_eswitch_block_mode(struct mlx5_core_dev *dev)
if (!mlx5_esw_allowed(esw))
return 0;
- /* Take TC into account */
- err = mlx5_esw_try_lock(esw);
+ /* Temporary reservations may reuse tables while TC users exist. */
+ if (check_users)
+ err = mlx5_esw_try_lock(esw);
+ else
+ err = mlx5_esw_lock(esw);
if (err < 0)
return err;
@@ -4442,7 +4444,7 @@ static bool mlx5_devlink_switchdev_active_mode_change(struct mlx5_eswitch *esw,
!esw->offloads_inactive)
return false;
- down_write(&esw->mode_lock);
+ mlx5_esw_lock_wait(esw);
esw->offloads_inactive = !esw->offloads_inactive;
esw->eswitch_operation_in_progress = true;
up_write(&esw->mode_lock);
@@ -4454,34 +4456,30 @@ static bool mlx5_devlink_switchdev_active_mode_change(struct mlx5_eswitch *esw,
down_write(&esw->mode_lock);
esw->eswitch_operation_in_progress = false;
- up_write(&esw->mode_lock);
+ mlx5_esw_unlock(esw);
return true;
}
-#define MLX5_ESW_HOLD_TIMEOUT_MS 7000
-#define MLX5_ESW_HOLD_RETRY_DELAY_MS 500
-
void mlx5_eswitch_safe_aux_devs_remove(struct mlx5_core_dev *dev)
{
- unsigned long timeout;
- bool hold_esw = true;
+ struct mlx5_eswitch *esw = dev->priv.eswitch;
- /* Wait for any concurrent eswitch mode transition to complete. */
- if (!mlx5_esw_hold(dev)) {
- timeout = jiffies + msecs_to_jiffies(MLX5_ESW_HOLD_TIMEOUT_MS);
- while (!mlx5_esw_hold(dev)) {
- if (!time_before(jiffies, timeout)) {
- hold_esw = false;
- break;
- }
- msleep(MLX5_ESW_HOLD_RETRY_DELAY_MS);
- }
- }
- if (hold_esw) {
- if (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS)
- mlx5_core_reps_aux_devs_remove(dev);
- mlx5_esw_release(dev);
- }
+ if (!mlx5_esw_allowed(esw))
+ return;
+
+ /* Wait for any concurrent eswitch mode transition to complete.
+ * Deadlock risk if ever called from within an operation in progress.
+ */
+ mlx5_esw_lock_wait(esw);
+ esw->eswitch_operation_in_progress = true;
+ up_write(&esw->mode_lock);
+
+ if (mlx5_eswitch_mode(dev) == MLX5_ESWITCH_OFFLOADS)
+ mlx5_core_reps_aux_devs_remove(dev);
+
+ down_write(&esw->mode_lock);
+ esw->eswitch_operation_in_progress = false;
+ mlx5_esw_unlock(esw);
}
int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
@@ -4508,10 +4506,11 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
return 0;
mlx5_lag_disable_change(esw->dev);
+ mlx5_devcom_comp_lock(esw->dev->priv.hca_devcom_comp);
err = mlx5_esw_try_lock(esw);
if (err < 0) {
NL_SET_ERR_MSG_MOD(extack, "Can't change mode, E-Switch is busy");
- goto enable_lag;
+ goto unlock_hca;
}
cur_mlx5_mode = err;
err = 0;
@@ -4574,7 +4573,8 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
esw->eswitch_operation_in_progress = false;
unlock:
mlx5_esw_unlock(esw);
-enable_lag:
+unlock_hca:
+ mlx5_devcom_comp_unlock(esw->dev->priv.hca_devcom_comp);
mlx5_lag_enable_change(esw->dev);
/* Shared FDB activation is creating LAG which is changing reps. */
if (!err)
@@ -4655,7 +4655,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
if (IS_ERR(esw))
return PTR_ERR(esw);
- down_write(&esw->mode_lock);
+ mlx5_esw_lock_wait(esw);
switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
@@ -4693,7 +4693,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
down_write(&esw->mode_lock);
esw->eswitch_operation_in_progress = false;
- up_write(&esw->mode_lock);
+ mlx5_esw_unlock(esw);
return 0;
out:
@@ -4712,25 +4712,31 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode)
return esw_inline_mode_to_devlink(esw->offloads.inline_mode, mode);
}
-bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)
+/* Return 1 if allowed, 0 if disallowed by the configuration, or -EBUSY
+ * if an eswitch operation is in progress.
+ */
+int mlx5_eswitch_block_encap(struct mlx5_core_dev *dev, bool from_fdb)
{
struct mlx5_eswitch *esw = dev->priv.eswitch;
enum devlink_eswitch_encap_mode encap;
- bool allow_tunnel = false;
+ int ret;
if (!mlx5_esw_allowed(esw))
- return true;
+ return 1;
+
+ ret = mlx5_esw_lock(esw);
+ if (ret)
+ return ret;
- down_write(&esw->mode_lock);
encap = esw->offloads.encap;
if (esw->mode == MLX5_ESWITCH_LEGACY ||
(encap == DEVLINK_ESWITCH_ENCAP_MODE_NONE && !from_fdb)) {
- allow_tunnel = true;
+ ret = 1;
esw->offloads.num_block_encap++;
}
- up_write(&esw->mode_lock);
+ mlx5_esw_unlock(esw);
- return allow_tunnel;
+ return ret;
}
void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev)
@@ -4757,7 +4763,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
if (IS_ERR(esw))
return PTR_ERR(esw);
- down_write(&esw->mode_lock);
+ mlx5_esw_lock_wait(esw);
if (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE &&
(!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) ||
@@ -4813,7 +4819,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
esw->eswitch_operation_in_progress = false;
unlock:
- up_write(&esw->mode_lock);
+ mlx5_esw_unlock(esw);
return err;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 1a45474ce03db5..0439fcfb9ce571 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1814,6 +1814,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
lockdep_register_key(&dev->lock_key);
mutex_init(&dev->intf_state_mutex);
lockdep_set_class(&dev->intf_state_mutex, &dev->lock_key);
+ spin_lock_init(&dev->offload_block.lock);
mutex_init(&dev->mlx5e_res.uplink_netdev_lock);
mutex_init(&dev->wc_state_lock);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index abb99371ff1344..84e9f6bdb7c140 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -789,8 +789,12 @@ struct mlx5_core_dev {
u32 vsc_addr;
struct mlx5_hv_vhca *hv_vhca;
struct mlx5_hwmon *hwmon;
- u64 num_block_tc;
- u64 num_block_ipsec;
+ struct {
+ /* Protects the fields below. */
+ spinlock_t lock;
+ u64 num_block_tc;
+ u64 num_block_ipsec;
+ } offload_block;
#ifdef CONFIG_MLX5_MACSEC
struct mlx5_macsec_fs *macsec_fs;
/* MACsec notifier chain to sync MACsec core and IB database */
|
| 3/2 | 2026/11/08 18:50 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15478 output: 41 thoughts: 387 Thoughts: **My Assessment of the `mlx5` Driver Patch** Okay, here's what's running through my head as I look at this patch touching `drivers/net/ethernet/mellanox/mlx5/...`. I need to be absolutely meticulous about this assessment, so let's get down to the brass tacks of determining if this is a good candidate for fuzzing or not. First, I need to make sure I am following the instructions and criteria *precisely*. The key question here is whether or not this `mlx5` driver should return `WorthFuzzing=false`. The negative criteria in Section 2 regarding "Structurally unreachable hardware" is my immediate concern. Wait, is `mlx5` reachable in a standard QEMU or GCE environment, or does it require dedicated physical hardware? A quick mental jog confirms `mlx5` is the driver for Mellanox ConnectX-4, -5, and -6 network adapters. Okay, so now I need to figure out if that hardware is emulated in QEMU. My initial instinct tells me that QEMU *doesn't* emulate the specific features of Mellanox ConnectX PCIe devices, right? It's a specialized hardware, after all. Ah, yes, Section 2 is very clear: "Vendor-specific PCIe switches, SmartNICs..." - and that's exactly what this is! And it's stating those requiring physical ASIC/PCIe cards are *not* emulated in standard QEMU. That's a good sign, this seems like it might be a no-go for fuzzing. But hold on, let's not jump to conclusions. Does `mlx5` have *any* virtual or mock devices, or is it *purely* dependent on physical PCIe hardware? Let me double-check the description. Okay, let's revisit Section 2, the crucial point in the assessment: *"- Structurally unreachable hardware: * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU."* - Yep, that's exactly where this falls. Now, wait a moment. Section 3 covers drivers accessible via virtual buses, specifically, drivers such as `virtio, USB gadget, loopback, netlink, binder, sockets, etc.`. I need to ensure this isn't accessed that way. So, the next step is to definitively determine if `mlx5` can be instantiated or reached without physical hardware. Does it have some form of simulated device, or is it exclusively tied to the PCIe bus? That's what I have to confirm before I can give this a green light. Given my initial knowledge of the technology, I have a feeling it's not looking good, but I need to be 100% sure. |
| 4/2 | 2026/11/08 18:50 | tool | grepper |
0mArgs:{
"Expression": "mlx5_pci_driver",
"PathPrefixes": [
"drivers/net/ethernet/mellanox/mlx5"
]
}Results: {
"Output": "no matches"
} |
| 5/2 | 2026/11/08 18:50 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16544 output: 40 thoughts: 28 Thoughts: Here's my thought process, as if I were considering this myself: **Investigating Mellanox Driver Registration** Okay, so I need to understand how the Mellanox Ethernet drivers are registered within the Linux kernel. My first instinct is to zero in on the function responsible for that initial setup, the function that tells the kernel "Hey, I'm here, I handle this hardware!" The most common way to register a PCI device driver is with `pci_register_driver`. However, since Mellanox drivers can be pretty sophisticated, I should probably broaden my search to include similar function calls, maybe something like a more specific registration function name specific to their devices. I'm going to head directly into the source code directory, `drivers/net/ethernet/mellanox/mlx5`, and see what the code does to know if a similar registration or initialization approach is taken. This should give me a solid starting point. This initial search should quickly reveal the primary entry points and registration methods. |
| 6/2 | 2026/11/08 18:50 | tool | grepper |
0mArgs:{
"Expression": "pci_register_driver",
"PathPrefixes": [
"drivers/net/ethernet/mellanox/mlx5"
]
}Results: {
"Output": "drivers/net/ethernet/mellanox/mlx5/core/data_direct.c=392=int mlx5_data_direct_driver_register(void)\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-393-{\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c:394:\treturn pci_register_driver(\u0026mlx5_data_direct_driver);\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-395-}\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=2351=static int __init mlx5_init(void)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2374-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2375:\terr = pci_register_driver(\u0026mlx5_core_driver);\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2376-\tif (err)\n"
} |
| 7/2 | 2026/11/08 18:50 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17117 output: 40 thoughts: 731 Thoughts: **Analyzing the Reachability of mlx5 Code for Fuzzing** Okay, so `mlx5` is registered as a PCI driver via `pci_register_driver(&mlx5_core_driver)`. The first thing I wonder is if there are any virtual or emulated versions of mlx5, like netdevsim, mlxsw_minimal, or something similar to simulate its presence for testing. Ah, right, I need to remind myself that `mlxsw` is a separate entity entirely, explicitly mentioned in Section 2 as being vendor-specific PCIe switch code requiring real hardware. So, `mlx5` is the Mellanox ConnectX driver. That's ConnectX-4, 5, 6, and 7 SmartNICs and HCAs. Now, does QEMU emulate the mlx5 device? No, QEMU has its own suite of virtual NICs – e1000, igb, virtio-net, etc., but nothing for mlx5. That makes sense. The second key question then is, can syzkaller reach it? Syzkaller typically runs in standard QEMU or GCE instances. No, within those standard environments, there aren't Mellanox ConnectX PCI devices attached without PCI passthrough. And we know that syzkaller standard environments don't employ passthrough; that's the whole point of Section 2: fuzzing is limited to reachable code, and PCI passthrough is expressly out of bounds. Alright, so the next thing I need to investigate is whether I can reach the `mlx5` code via a "dummy" mechanism, like devlink or netlink, something that might simulate a virtual device in a way that allows us to trigger the relevant functions. Let's see what the affected code is. I see a list of functions: `mlx5e_xfrm_add_state`, `mlx5e_xfrm_add_policy`, various `mlx5e_ipsec_...`, `mlx5e_tc_...`, `mlx5_eswitch_...`, `mlx5_devlink_...` calls. All these functions operate on `mlx5_core_dev`, `mlx5e_priv`, or `mlx5_eswitch`, all of which depend on a probed and instantiated `mlx5` device. So that takes me back to the key question: can `mlx5_core_dev` be instantiated without a *real* mlx5 PCI hardware device? Is there a virtual driver, a platform device emulation, or some software mock for mlx5 that could be used for testing? That's what I need to find out to determine whether this code is even reachable for fuzzing, and if not, why not. |
| 8/2 | 2026/11/08 18:51 | tool | grepper |
0mArgs:{
"Expression": "mlx5_core_driver",
"PathPrefixes": [
"drivers/net/ethernet/mellanox/mlx5"
]
}Results: {
"Output": "drivers/net/ethernet/mellanox/mlx5/core/main.c=2273=int mlx5_recover_device(struct mlx5_core_dev *dev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2283-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2284:static struct pci_driver mlx5_core_driver = {\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2285-\t.name = KBUILD_MODNAME,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=2309=struct mlx5_core_dev *mlx5_vf_get_core_dev(struct pci_dev *pdev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2312-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2313:\tmdev = pci_iov_get_pf_drvdata(pdev, \u0026mlx5_core_driver);\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2314-\tif (IS_ERR(mdev))\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=2351=static int __init mlx5_init(void)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2374-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2375:\terr = pci_register_driver(\u0026mlx5_core_driver);\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2376-\tif (err)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=2392=static void __exit mlx5_cleanup(void)\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2393-{\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2394:\tpci_unregister_driver(\u0026mlx5_core_driver);\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2395-\tmlx5_data_direct_driver_unregister();\n"
} |
| 9/2 | 2026/11/08 18:51 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19098 output: 40 thoughts: 57 Thoughts: Here's my summary, as though I were thinking through the process: **Diving into the mlx5 Core Driver** Okay, so I'm looking at the `mlx5_core_driver`, which is defined as a `pci_driver`. Right, that's expected. My next thought is to figure out which PCI devices this thing actually handles. I need to see the device IDs it's associated with. The most logical place to find that should be the `mlx5_pci_table`. Let's confirm that by digging around in `drivers/net/ethernet/mellanox/mlx5/core/main.c`. That's where I would expect to find the relevant PCI device ID table definitions. Time to go spelunking in the source code! |
| 10/2 | 2026/11/08 18:51 | tool | grepper |
0mArgs:{
"Expression": "pci_device_id",
"PathPrefixes": [
"drivers/net/ethernet/mellanox/mlx5"
]
}Results: {
"Output": "drivers/net/ethernet/mellanox/mlx5/core/data_direct.c=30=static int mlx5_data_direct_query_vuid(struct mlx5_core_dev *dev,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-50-\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c:51:static const struct pci_device_id mlx5_data_direct_pci_table[] = {\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-52-\t{ PCI_VDEVICE(MELLANOX, 0x2100) }, /* ConnectX-8 Data Direct */\n--\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c=317=static void mlx5_data_direct_dev_unreg(struct mlx5_data_direct_dev *dev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-330-\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c:331:static int mlx5_data_direct_probe(struct pci_dev *pdev, const struct pci_device_id *id)\ndrivers/net/ethernet/mellanox/mlx5/core/data_direct.c-332-{\n--\ndrivers/net/ethernet/mellanox/mlx5/core/fw_reset.c=370=static int mlx5_check_hotplug_interrupt(struct mlx5_core_dev *dev,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/fw_reset.c-388-\ndrivers/net/ethernet/mellanox/mlx5/core/fw_reset.c:389:static const struct pci_device_id mgt_ifc_device_ids[] = {\ndrivers/net/ethernet/mellanox/mlx5/core/fw_reset.c-390-\t{ PCI_VDEVICE(MELLANOX, 0xc2d2) }, /* BlueField1 MGT interface device ID */\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=856=static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev,\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:857:\t\t\t const struct pci_device_id *id)\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-858-{\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=1914=void mlx5_mdev_uninit(struct mlx5_core_dev *dev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-1939-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:1940:static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-1941-{\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c=2221=static int mlx5_resume(struct pci_dev *pdev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2227-\ndrivers/net/ethernet/mellanox/mlx5/core/main.c:2228:static const struct pci_device_id mlx5_core_pci_table[] = {\ndrivers/net/ethernet/mellanox/mlx5/core/main.c-2229-\t{ PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) },\n"
} |
| 11/2 | 2026/11/08 18:51 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20370 output: 118 thoughts: 882 Thoughts: **Mellanox mlx5 Driver Analysis for Fuzzing Suitability** Okay, let's break this down. That table in `drivers/net/ethernet/mellanox/mlx5/core/main.c` clearly shows the target: Connect-IB, ConnectX-4, ConnectX-5, ConnectX-6, BlueField, all Mellanox PCIe devices. It's instantly recognizable as vendor-specific. Now, per section 2 of the guidance, we need to eliminate structurally unreachable hardware. It specifically flags vendor-specific PCIe switches, SmartNICs, or GPU drivers like `mlxsw`, `pds_core`, `qed`, `ionic`, and `amdgpu`. And there it is: Mellanox `mlx5` is the quintessential example of a vendor-specific SmartNIC/PCIe NIC driver, right in line with the examples they gave. No question. Now, let's confirm the code changes. I need to make *absolutely* sure. The changed files are all contained within `drivers/net/ethernet/mellanox/mlx5/` and the associated header `include/linux/mlx5/driver.h`. Okay, I've verified the list: - `drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c` - `drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h` - `drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c` - `drivers/net/ethernet/mellanox/mlx5/core/en_main.c` - `drivers/net/ethernet/mellanox/mlx5/core/en_tc.c` - `drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h` - `drivers/net/ethernet/mellanox/mlx5/core/eswitch.c` - `drivers/net/ethernet/mellanox/mlx5/core/eswitch.h` - `drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c` - `drivers/net/ethernet/mellanox/mlx5/core/main.c` - `include/linux/mlx5/driver.h` Every single file is part of the mlx5 driver. This confirms everything is self-contained within the vendor-specific driver. Therefore, since all modified code resides within a vendor-specific SmartNIC/PCIe driver (mlx5), and this driver *requires* physical Mellanox hardware that isn't emulated in standard QEMU or GCE environments, it's structurally unreachable in the fuzzing context. The instructions are clear: "REACHABILITY IS THE PRIMARY GATE." If code is structurally unreachable, it MUST NOT be fuzzed. Thus: `WorthFuzzing: false` `EnableConfigs: []` `FocusSymbols: []` `Reasoning: Changes confined to Mellanox mlx5 driver (IPsec offload and eswitch mode management), a vendor-specific SmartNIC/NIC driver requiring physical Mellanox hardware not emulated in standard QEMU/GCE syzkaller fuzzing environments.` I need to meticulously review this, but the conclusion is clear. Now I must call set-results. |
| 12/2 | 2026/11/08 18:51 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch modifies the Mellanox mlx5 network driver (specifically IPsec offload and eswitch mode locking logic). Mellanox ConnectX/BlueField devices are vendor-specific PCIe SmartNICs/adapters that require physical hardware and are not emulated in standard QEMU or GCE virtualized environments used by syzkaller. Because the code is structurally unreachable during fuzzing, it does not warrant fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch modifies the Mellanox mlx5 network driver (specifically IPsec offload and eswitch mode locking logic). Mellanox ConnectX/BlueField devices are vendor-specific PCIe SmartNICs/adapters that require physical hardware and are not emulated in standard QEMU or GCE virtualized environments used by syzkaller. Because the code is structurally unreachable during fuzzing, it does not warrant fuzzing.",
"WorthFuzzing": false
} |
| 13/1 | 2026/11/08 18:51 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|