Commit 3d0371b3 authored by Samuel Mendoza-Jonas's avatar Samuel Mendoza-Jonas Committed by David S. Miller

net/ncsi: Fixup .dumpit message flags and ID check in Netlink handler

The ncsi_pkg_info_all_nl() .dumpit handler is missing the NLM_F_MULTI
flag, causing additional package information after the first to be lost.
Also fixup a sanity check in ncsi_write_package_info() to reject out of
range package IDs.
Signed-off-by: default avatarSamuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 00e1cae7
...@@ -100,7 +100,7 @@ static int ncsi_write_package_info(struct sk_buff *skb, ...@@ -100,7 +100,7 @@ static int ncsi_write_package_info(struct sk_buff *skb,
bool found; bool found;
int rc; int rc;
if (id > ndp->package_num) { if (id > ndp->package_num - 1) {
netdev_info(ndp->ndev.dev, "NCSI: No package with id %u\n", id); netdev_info(ndp->ndev.dev, "NCSI: No package with id %u\n", id);
return -ENODEV; return -ENODEV;
} }
...@@ -240,7 +240,7 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, ...@@ -240,7 +240,7 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb,
return 0; /* done */ return 0; /* done */
hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
&ncsi_genl_family, 0, NCSI_CMD_PKG_INFO); &ncsi_genl_family, NLM_F_MULTI, NCSI_CMD_PKG_INFO);
if (!hdr) { if (!hdr) {
rc = -EMSGSIZE; rc = -EMSGSIZE;
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment