1
0
Fork 0

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>
hifive-unleashed-5.1
Kangjie Lu 2019-03-15 01:14:33 -05:00 committed by David S. Miller
parent 0fff9bd47e
commit 07660ca679
1 changed files with 4 additions and 0 deletions

View File

@ -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);