net: fix vlan_get_size to include vlan_flags size
Subsystems (2)
PATCH 1/3 net: fix vlan_get_size to include vlan_flags size
From: John Fastabend <[email protected]>
Fix vlan_get_size to include vlan->flags. Currently, the size of the vlan flags is not included in the nlmsg size.
---
net/8021q/vlan_netlink.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/8021q/vlan_netlink.c +1 -0
@@ -169,6 +169,7 @@ static size_t vlan_get_size(const struct net_device *dev)struct vlan_dev_info *vlan =vlan_dev_info (dev);return nla_total_size (2 ) +/* IFLA_VLAN_ID */ +sizeof (struct ifla_vlan_flags ) +/* IFLA_VLAN_FLAGS */ vlan_qos_map_size (vlan->nr_ingress_mappings) +vlan_qos_map_size (vlan->nr_egress_mappings); }
PATCH 2/3 net: fix nlmsg len size for skb when error bit is set.
From: John Fastabend <[email protected]>
Currently, the nlmsg->len field is not set correctly in netlink_ack() for ack messages that include the nlmsg of the error frame. This corrects the length field passed to __nlmsg_put to use the correct payload size.
---
net/netlink/af_netlink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netlink/af_netlink.c +1 -1
@@ -1788,7 +1788,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) } rep =__nlmsg_put (skb,NETLINK_CB (in_skb).pid, nlh->nlmsg_seq, -NLMSG_ERROR ,sizeof (struct nlmsgerr ),0 ); +NLMSG_ERROR , payload,0 ); errmsg =nlmsg_data (rep); errmsg->error = err;memcpy (&errmsg->msg, nlh, err ? nlh->nlmsg_len :sizeof (*nlh));
PATCH 3/3 net: fix double skb free in dcbnl
In reply to Jeff KirsherFrom: John Fastabend <[email protected]>
netlink_unicast() calls kfree_skb even in the error case.
dcbnl calls netlink_unicast() which when it fails free's the skb and returns an error value. dcbnl is free'ing the skb again when this error occurs. This patch removes the double free.
---
net/dcb/dcbnl.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
net/dcb/dcbnl.c +7 -8
@@ -194,7 +194,7 @@ static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid,nlmsg_end (dcbnl_skb, nlh); ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; +return -EINVAL ;return 0 ; nlmsg_failure:
@@ -275,7 +275,7 @@ static int dcbnl_getpfccfg(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; + goto err_out;return 0 ; nlmsg_failure:
@@ -316,12 +316,11 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; + goto err_out;return 0 ; nlmsg_failure: -err:kfree_skb (dcbnl_skb); err_out:return -EINVAL ;
@@ -383,7 +382,7 @@ static int dcbnl_getcap(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; + goto err_out;return 0 ; nlmsg_failure:
@@ -460,7 +459,7 @@ static int dcbnl_getnumtcs(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) { ret = -EINVAL ; - goto err; + goto err_out; }return 0 ;
@@ -799,7 +798,7 @@ static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; + goto err_out;return 0 ;
@@ -1063,7 +1062,7 @@ static int dcbnl_bcn_getcfg(struct net_device *netdev, struct nlattr **tb, ret =rtnl_unicast (dcbnl_skb, &init_net, pid);if (ret) - goto err; + goto err_out;return 0 ;
David Miller
maintainerAll 3 patches applied, thanks!