diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-15 07:14:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-16 19:44:33 +0100 |
commit | 07660ca679da3007d3231938e2dfb415d3440716 (patch) | |
tree | a4699c20fd4ba7acb3bc4d7d55f66b4a839fd6b8 /net/ncsi/ncsi-netlink.c | |
parent | net: openvswitch: fix missing checks for nla_nest_start (diff) | |
download | linux-07660ca679da3007d3231938e2dfb415d3440716.tar.xz linux-07660ca679da3007d3231938e2dfb415d3440716.zip |
net: ncsi: fix a missing check for nla_nest_start
nla_nest_start may fail and thus deserves a check.
The fix returns -EMSGSIZE in case it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ncsi/ncsi-netlink.c')
-rw-r--r-- | net/ncsi/ncsi-netlink.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c index 5d782445d2fc..bad17bba8ba7 100644 --- a/net/ncsi/ncsi-netlink.c +++ b/net/ncsi/ncsi-netlink.c @@ -251,6 +251,10 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, } attr = nla_nest_start(skb, NCSI_ATTR_PACKAGE_LIST); + if (!attr) { + rc = -EMSGSIZE; + goto err; + } rc = ncsi_write_package_info(skb, ndp, package->id); if (rc) { nla_nest_cancel(skb, attr); |