提交 07660ca6 编写于 作者: K Kangjie Lu 提交者: David S. Miller

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: NKangjie Lu <kjlu@umn.edu>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0fff9bd4
...@@ -251,6 +251,10 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, ...@@ -251,6 +251,10 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb,
} }
attr = nla_nest_start(skb, NCSI_ATTR_PACKAGE_LIST); attr = nla_nest_start(skb, NCSI_ATTR_PACKAGE_LIST);
if (!attr) {
rc = -EMSGSIZE;
goto err;
}
rc = ncsi_write_package_info(skb, ndp, package->id); rc = ncsi_write_package_info(skb, ndp, package->id);
if (rc) { if (rc) {
nla_nest_cancel(skb, attr); nla_nest_cancel(skb, attr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册