Skip to content

Commit 07660ca

Browse files
kengiterdavem330
authored andcommitted
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>
1 parent 0fff9bd commit 07660ca

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎net/ncsi/ncsi-netlink.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb,
251251
}
252252

253253
attr = nla_nest_start(skb, NCSI_ATTR_PACKAGE_LIST);
254+
if (!attr) {
255+
rc = -EMSGSIZE;
256+
goto err;
257+
}
254258
rc = ncsi_write_package_info(skb, ndp, package->id);
255259
if (rc) {
256260
nla_nest_cancel(skb, attr);

0 commit comments

Comments
 (0)