[Devel] [PATCH RHEL7 COMMIT] ms/drop_monitor: consider inserted data in genlmsg_end

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 28 22:28:43 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.66.1.vz7.188.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.66.1.vz7.188.6
------>
commit 9bc0f12b387b56775ff09a95526118e307264db8
Author: Reiter Wolfgang <wr0112358 at gmail.com>
Date:   Mon Jul 4 21:51:52 2022 +0300

    ms/drop_monitor: consider inserted data in genlmsg_end
    
    Final nlmsg_len field update must reflect inserted net_dm_drop_point
    data.
    
    This patch depends on previous patch:
    "drop_monitor: add missing call to genlmsg_end"
    
    Signed-off-by: Reiter Wolfgang <wr0112358 at gmail.com>
    Acked-by: Neil Horman <nhorman at tuxdriver.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    (cherry picked from commit 3b48ab2248e61408910e792fe84d6ec466084c1a)
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
    
    =================
    Patchset description:
    drop_monitor: Add packet alert mode
    
    Just port and adapt packet alert mode feature for RHEL7 kernel.
    
    https://jira.sw.ru/browse/PSBM-140937
    
    Ported-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 net/core/drop_monitor.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 1f4aa6fed5fe6..639b8692209e4 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -102,7 +102,6 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
 	}
 	msg = nla_data(nla);
 	memset(msg, 0, al);
-	genlmsg_end(skb, msg_header);
 	goto out;
 
 err:
@@ -112,6 +111,13 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
 	swap(data->skb, skb);
 	spin_unlock_irqrestore(&data->lock, flags);
 
+	if (skb) {
+		struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
+		struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
+
+		genlmsg_end(skb, genlmsg_data(gnlh));
+	}
+
 	return skb;
 }
 


More information about the Devel mailing list