Skip to content

Commit

Permalink
drop_monitor: consider inserted data in genlmsg_end
Browse files Browse the repository at this point in the history
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@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
wr0112358 authored and davem330 committed Jan 3, 2017
1 parent 096de2f commit 3b48ab2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/core/drop_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
}

Expand Down

0 comments on commit 3b48ab2

Please sign in to comment.