diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-08-22 00:57:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-23 00:39:08 -0400 |
commit | 3d0371b313b84ba7c16ebf2526a7a34f1c57b19e (patch) | |
tree | 9bc07854f920ac90f56189fd91a9f3bee6494745 | |
parent | 00e1cae78120ee19462e7f96135cd1cc59a086e7 (diff) |
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: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ncsi/ncsi-netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c index 82e6edf9c5d9..45f33d6dedf7 100644 --- a/net/ncsi/ncsi-netlink.c +++ b/net/ncsi/ncsi-netlink.c | |||
@@ -100,7 +100,7 @@ static int ncsi_write_package_info(struct sk_buff *skb, | |||
100 | bool found; | 100 | bool found; |
101 | int rc; | 101 | int rc; |
102 | 102 | ||
103 | if (id > ndp->package_num) { | 103 | if (id > ndp->package_num - 1) { |
104 | netdev_info(ndp->ndev.dev, "NCSI: No package with id %u\n", id); | 104 | netdev_info(ndp->ndev.dev, "NCSI: No package with id %u\n", id); |
105 | return -ENODEV; | 105 | return -ENODEV; |
106 | } | 106 | } |
@@ -240,7 +240,7 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb, | |||
240 | return 0; /* done */ | 240 | return 0; /* done */ |
241 | 241 | ||
242 | hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, | 242 | hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, |
243 | &ncsi_genl_family, 0, NCSI_CMD_PKG_INFO); | 243 | &ncsi_genl_family, NLM_F_MULTI, NCSI_CMD_PKG_INFO); |
244 | if (!hdr) { | 244 | if (!hdr) { |
245 | rc = -EMSGSIZE; | 245 | rc = -EMSGSIZE; |
246 | goto err; | 246 | goto err; |