rtnetlink: Add return value check

This patch add return value checking for both of the nla_put_u32() and
nla_put_u8() in rtnl_xdp_fill().

Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Signed-off-by: Aravindhan Gunasekaran <aravindhan.gunasekaran@intel.com>
This commit is contained in:
Muhammad Husaini Zulkifli 2021-08-03 08:49:34 +08:00 committed by Aravindhan Gunasekaran
parent 74eb52ddc6
commit 31679da96f
1 changed files with 6 additions and 2 deletions

View File

@ -1531,8 +1531,12 @@ static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev)
if (!md_btf_id)
goto err_cancel;
nla_put_u32(skb, IFLA_XDP_MD_BTF_ID, md_btf_id);
nla_put_u8(skb, IFLA_XDP_MD_BTF_STATE, md_btf_enabled);
err = nla_put_u32(skb, IFLA_XDP_MD_BTF_ID, md_btf_id);
if (err)
goto err_cancel;
err = nla_put_u8(skb, IFLA_XDP_MD_BTF_STATE, md_btf_enabled);
if (err)
goto err_cancel;
nla_nest_end(skb, xdp);
return 0;