Skip to content

Commit

Permalink
net: ncsi: fix a missing check for nla_nest_start
Browse files Browse the repository at this point in the history
nla_nest_start may fail and thus deserves a check.

The fix returns -EMSGSIZE in case it fails.

Signed-off-by: Kangjie Lu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
kengiter authored and davem330 committed Mar 16, 2019
1 parent 0fff9bd commit 07660ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/ncsi/ncsi-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07660ca

Please sign in to comment.