Skip to content

Commit 4a995d3

Browse files
WeiFang-NXPkuba-moo
authored andcommitted
net: enetc: add ratelimiting to VF mailbox error messages
Sashiko reported that a buggy or malicious guest VM can flood the host kernel log by repeatedly sending VF-to-PF messages at a high rate, degrading host performance and hiding important system logs [1]. Fix by replacing dev_err()/dev_warn() with dev_err_ratelimited(), limiting output to the default kernel ratelimit. This ensures errors are still logged for debugging while preventing log flooding attacks. Link: https://sashiko.dev/#/patchset/20260511080805.2052495-1-wei.fang%40nxp.com #1 Fixes: beb74ac ("enetc: Add vf to pf messaging support") Signed-off-by: Wei Fang <wei.fang@nxp.com> Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com> Link: https://patch.msgid.link/20260520064421.91569-4-wei.fang@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 5027266 commit 4a995d3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/net/ethernet/freescale/enetc/enetc_pf.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,9 @@ static u16 enetc_msg_pf_set_vf_primary_mac_addr(struct enetc_pf *pf,
494494

495495
addr = cmd->mac.sa_data;
496496
if (vf_state->flags & ENETC_VF_FLAG_PF_SET_MAC) {
497-
dev_warn(dev, "Attempt to override PF set mac addr for VF%d\n",
498-
vf_id);
497+
dev_err_ratelimited(dev,
498+
"VF%d attempted to override PF set MAC\n",
499+
vf_id);
499500
return ENETC_MSG_CMD_STATUS_FAIL;
500501
}
501502

@@ -520,8 +521,9 @@ void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int vf_id, u16 *status)
520521
break;
521522
default:
522523
*status = ENETC_MSG_CMD_STATUS_FAIL;
523-
dev_err(dev, "command not supported (cmd_type: 0x%x)\n",
524-
cmd_type);
524+
dev_err_ratelimited(dev,
525+
"command not supported (cmd_type: 0x%x)\n",
526+
cmd_type);
525527
}
526528
}
527529

0 commit comments

Comments
 (0)