[Devel] [PATCH RHEL9 COMMIT] net: dm: check the boundary of skb drop reasons
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jan 16 20:56:54 MSK 2023
The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.vz9.18.2
------>
commit 47c850b045a17e9231277fe50e44a49b356fe25d
Author: Menglong Dong <imagedong at tencent.com>
Date: Tue Jan 3 17:39:41 2023 +0200
net: dm: check the boundary of skb drop reasons
The 'reason' will be set to 'SKB_DROP_REASON_NOT_SPECIFIED' if it not
small that SKB_DROP_REASON_MAX in net_dm_packet_trace_kfree_skb_hit(),
but it can't avoid it to be 0, which is invalid and can cause NULL
pointer in drop_reasons.
Therefore, reset it to SKB_DROP_REASON_NOT_SPECIFIED when 'reason <= 0'.
Reviewed-by: Jiang Biao <benbjiang at tencent.com>
Reviewed-by: Hao Peng <flyingpeng at tencent.com>
Signed-off-by: Menglong Dong <imagedong at tencent.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Acked-by: Nikolay Borisov <nborisov at suse.com>
Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
======
Patchset description:
ms/net: Annotate skb free sites with reason
This series backports most of the patches that add a reason to skb free sites.
https://jira.sw.ru/browse/PSBM-143302
Feature: net: improve verbosity of dropped packets reporting
---
net/core/drop_monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index d7d177f75d43..ebc229156fb0 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -527,7 +527,7 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore,
if (!nskb)
return;
- if ((unsigned int)reason >= SKB_DROP_REASON_MAX)
+ if (unlikely(reason >= SKB_DROP_REASON_MAX || reason <= 0))
reason = SKB_DROP_REASON_NOT_SPECIFIED;
cb = NET_DM_SKB_CB(nskb);
cb->reason = reason;
More information about the Devel
mailing list