diff mbox series

[net] sched: act: count in the size of action flags bitfield

Message ID 20200225125412.9603-1-jiri@resnulli.us
State Accepted
Delegated to: David Miller
Headers show
Series [net] sched: act: count in the size of action flags bitfield | expand

Commit Message

Jiri Pirko Feb. 25, 2020, 12:54 p.m. UTC
From: Jiri Pirko <jiri@mellanox.com>

The put of the flags was added by the commit referenced in fixes tag,
however the size of the message was not extended accordingly.

Fix this by adding size of the flags bitfield to the message size.

Fixes: e38226786022 ("net: sched: update action implementations to support flags")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/act_api.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller Feb. 27, 2020, 1:11 a.m. UTC | #1
From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 25 Feb 2020 13:54:12 +0100

> From: Jiri Pirko <jiri@mellanox.com>
> 
> The put of the flags was added by the commit referenced in fixes tag,
> however the size of the message was not extended accordingly.
> 
> Fix this by adding size of the flags bitfield to the message size.
> 
> Fixes: e38226786022 ("net: sched: update action implementations to support flags")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Applied and queued up for v5.5 -stable, thanks Jiri.

This is a common mistake which is made when adding new attributes, so it would
be nice if there were a programmatic way to make sure these adjustments never
get forgotten.
diff mbox series

Patch

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 90a31b15585f..8c466a712cda 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -186,6 +186,7 @@  static size_t tcf_action_shared_attrs_size(const struct tc_action *act)
 		+ nla_total_size(IFNAMSIZ) /* TCA_ACT_KIND */
 		+ cookie_len /* TCA_ACT_COOKIE */
 		+ nla_total_size(0) /* TCA_ACT_STATS nested */
+		+ nla_total_size(sizeof(struct nla_bitfield32)) /* TCA_ACT_FLAGS */
 		/* TCA_STATS_BASIC */
 		+ nla_total_size_64bit(sizeof(struct gnet_stats_basic))
 		/* TCA_STATS_PKT64 */