* [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM
2020-06-24 19:23 [PATCH net-next 0/5] Data plane support for IOAM Pre-allocated Trace with IPv6 Justin Iurman
@ 2020-06-24 19:23 ` Justin Iurman
2020-06-25 10:52 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Justin Iurman @ 2020-06-24 19:23 UTC (permalink / raw)
To: netdev; +Cc: davem, justin.iurman
Add Generic Netlink commands to allow userspace to configure IOAM
namespaces and schemas. The target is iproute2 and the patch is ready.
It will be posted as soon as this patchset is merged. Here is a taste:
$ sudo ip ioam
Usage: ip ioam { namespace | schema } { show | del ID }
schema add ID DATA
namespace add ID [ DATA ] [ POP ]
namespace set ID schema { ID | none }
POP := { true | false }
Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
---
include/linux/ioam6.h | 7 +
include/uapi/linux/ioam6.h | 43 +++
net/ipv6/ioam6.c | 519 ++++++++++++++++++++++++++++++++++++-
3 files changed, 566 insertions(+), 3 deletions(-)
create mode 100644 include/linux/ioam6.h
create mode 100644 include/uapi/linux/ioam6.h
diff --git a/include/linux/ioam6.h b/include/linux/ioam6.h
new file mode 100644
index 000000000000..156223095e57
--- /dev/null
+++ b/include/linux/ioam6.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_IOAM6_H
+#define _LINUX_IOAM6_H
+
+#include <uapi/linux/ioam6.h>
+
+#endif
diff --git a/include/uapi/linux/ioam6.h b/include/uapi/linux/ioam6.h
new file mode 100644
index 000000000000..d2be5f820dc5
--- /dev/null
+++ b/include/uapi/linux/ioam6.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_IOAM6_H
+#define _UAPI_LINUX_IOAM6_H
+
+#define IOAM6_GENL_NAME "IOAM6"
+#define IOAM6_GENL_VERSION 0x1
+
+enum {
+ IOAM6_ATTR_UNSPEC,
+
+ IOAM6_ATTR_NS_ID, /* u16 */
+ IOAM6_ATTR_NS_DATA, /* u64 */
+ IOAM6_ATTR_NS_POP, /* Flag */
+
+#define IOAM6_MAX_SCHEMA_DATA_LEN (255 * 4)
+ IOAM6_ATTR_SC_ID, /* u32 */
+ IOAM6_ATTR_SC_DATA, /* Binary */
+ IOAM6_ATTR_SC_NONE, /* Flag */
+
+ IOAM6_ATTR_PAD,
+
+ __IOAM6_ATTR_MAX,
+};
+#define IOAM6_ATTR_MAX (__IOAM6_ATTR_MAX - 1)
+
+enum {
+ IOAM6_CMD_UNSPEC,
+
+ IOAM6_CMD_ADD_NAMESPACE,
+ IOAM6_CMD_DEL_NAMESPACE,
+ IOAM6_CMD_DUMP_NAMESPACES,
+
+ IOAM6_CMD_ADD_SCHEMA,
+ IOAM6_CMD_DEL_SCHEMA,
+ IOAM6_CMD_DUMP_SCHEMAS,
+
+ IOAM6_CMD_NS_SET_SCHEMA,
+
+ __IOAM6_CMD_MAX,
+};
+#define IOAM6_CMD_MAX (__IOAM6_CMD_MAX - 1)
+
+#endif
diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c
index 406aa78eb504..e414e915bf1e 100644
--- a/net/ipv6/ioam6.c
+++ b/net/ipv6/ioam6.c
@@ -11,8 +11,10 @@
#include <linux/kernel.h>
#include <linux/net.h>
#include <linux/rhashtable.h>
+#include <linux/ioam6.h>
#include <net/addrconf.h>
+#include <net/genetlink.h>
#include <net/ioam6.h>
static inline void ioam6_ns_release(struct ioam6_namespace *ns)
@@ -71,6 +73,507 @@ static const struct rhashtable_params rht_sc_params = {
.obj_cmpfn = ioam6_sc_cmpfn,
};
+static struct genl_family ioam6_genl_family;
+
+static const struct nla_policy ioam6_genl_policy[IOAM6_ATTR_MAX + 1] = {
+ [IOAM6_ATTR_NS_ID] = { .type = NLA_U16 },
+ [IOAM6_ATTR_NS_DATA] = { .type = NLA_U64 },
+ [IOAM6_ATTR_NS_POP] = { .type = NLA_FLAG },
+ [IOAM6_ATTR_SC_ID] = { .type = NLA_U32 },
+ [IOAM6_ATTR_SC_DATA] = { .type = NLA_BINARY,
+ .len = IOAM6_MAX_SCHEMA_DATA_LEN },
+ [IOAM6_ATTR_SC_NONE] = { .type = NLA_FLAG },
+};
+
+static int ioam6_genl_addns(struct sk_buff *skb, struct genl_info *info)
+{
+ struct net *net = genl_info_net(info);
+ struct ioam6_pernet_data *nsdata;
+ struct ioam6_namespace *ns;
+ __be16 ns_id;
+ int err;
+
+ if (!info->attrs[IOAM6_ATTR_NS_ID])
+ return -EINVAL;
+
+ ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
+ nsdata = ioam6_pernet(net);
+
+ mutex_lock(&nsdata->lock);
+
+ ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
+ if (ns) {
+ err = -EEXIST;
+ goto out_unlock;
+ }
+
+ ns = kzalloc(sizeof(*ns), GFP_KERNEL);
+ if (!ns) {
+ err = -ENOMEM;
+ goto out_unlock;
+ }
+
+ ns->id = ns_id;
+ ns->remove_tlv = info->attrs[IOAM6_ATTR_NS_POP] ? true : false;
+
+ if (!info->attrs[IOAM6_ATTR_NS_DATA]) {
+ ns->data = cpu_to_be64(IOAM6_EMPTY_FIELD_u64);
+ } else {
+ ns->data = cpu_to_be64(
+ nla_get_u64(info->attrs[IOAM6_ATTR_NS_DATA]));
+ }
+
+ err = rhashtable_lookup_insert_fast(&nsdata->namespaces, &ns->head,
+ rht_ns_params);
+ if (err)
+ kfree(ns);
+
+out_unlock:
+ mutex_unlock(&nsdata->lock);
+ return err;
+}
+
+static int ioam6_genl_delns(struct sk_buff *skb, struct genl_info *info)
+{
+ struct net *net = genl_info_net(info);
+ struct ioam6_pernet_data *nsdata;
+ struct ioam6_namespace *ns;
+ __be16 ns_id;
+ int err;
+
+ if (!info->attrs[IOAM6_ATTR_NS_ID])
+ return -EINVAL;
+
+ ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
+ nsdata = ioam6_pernet(net);
+
+ mutex_lock(&nsdata->lock);
+
+ ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
+ if (!ns) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+
+ if (ns->schema)
+ ns->schema->ns = NULL;
+
+ err = rhashtable_remove_fast(&nsdata->namespaces, &ns->head,
+ rht_ns_params);
+ if (err) {
+ ns->schema->ns = ns;
+ goto out_unlock;
+ }
+
+ ioam6_ns_release(ns);
+
+out_unlock:
+ mutex_unlock(&nsdata->lock);
+ return err;
+}
+
+static int __ioam6_genl_dumpns_element(struct ioam6_namespace *ns,
+ u32 portid, u32 seq, u32 flags,
+ struct sk_buff *skb, u8 cmd)
+{
+ void *hdr;
+ u64 data;
+
+ hdr = genlmsg_put(skb, portid, seq, &ioam6_genl_family, flags, cmd);
+ if (!hdr)
+ return -ENOMEM;
+
+ data = be64_to_cpu(ns->data);
+
+ if (nla_put_u16(skb, IOAM6_ATTR_NS_ID, be16_to_cpu(ns->id)) ||
+ (data != IOAM6_EMPTY_FIELD_u64 &&
+ nla_put_u64_64bit(skb, IOAM6_ATTR_NS_DATA, data, IOAM6_ATTR_PAD)) ||
+ (ns->remove_tlv && nla_put_flag(skb, IOAM6_ATTR_NS_POP)) ||
+ (ns->schema && nla_put_u32(skb, IOAM6_ATTR_SC_ID, ns->schema->id)))
+ goto nla_put_failure;
+
+ genlmsg_end(skb, hdr);
+ return 0;
+
+nla_put_failure:
+ genlmsg_cancel(skb, hdr);
+ return -EMSGSIZE;
+}
+
+static int ioam6_genl_dumpns_start(struct netlink_callback *cb)
+{
+ struct net *net = sock_net(cb->skb->sk);
+ struct ioam6_pernet_data *nsdata;
+ struct rhashtable_iter *iter;
+
+ nsdata = ioam6_pernet(net);
+ iter = (struct rhashtable_iter *)cb->args[0];
+
+ if (!iter) {
+ iter = kmalloc(sizeof(*iter), GFP_KERNEL);
+ if (!iter)
+ return -ENOMEM;
+
+ cb->args[0] = (long)iter;
+ }
+
+ rhashtable_walk_enter(&nsdata->namespaces, iter);
+
+ return 0;
+}
+
+static int ioam6_genl_dumpns_done(struct netlink_callback *cb)
+{
+ struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
+
+ rhashtable_walk_exit(iter);
+ kfree(iter);
+
+ return 0;
+}
+
+static int ioam6_genl_dumpns(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
+ struct ioam6_namespace *ns;
+ int err;
+
+ rhashtable_walk_start(iter);
+
+ for (;;) {
+ ns = rhashtable_walk_next(iter);
+
+ if (IS_ERR(ns)) {
+ if (PTR_ERR(ns) == -EAGAIN)
+ continue;
+ err = PTR_ERR(ns);
+ goto done;
+ } else if (!ns) {
+ break;
+ }
+
+ err = __ioam6_genl_dumpns_element(ns,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ NLM_F_MULTI,
+ skb,
+ IOAM6_CMD_DUMP_NAMESPACES);
+ if (err)
+ goto done;
+ }
+
+ err = skb->len;
+
+done:
+ rhashtable_walk_stop(iter);
+ return err;
+}
+
+static int ioam6_genl_addsc(struct sk_buff *skb, struct genl_info *info)
+{
+ struct net *net = genl_info_net(info);
+ struct ioam6_pernet_data *nsdata;
+ struct ioam6_schema *sc;
+ int len, pad, err;
+ u32 sc_id;
+
+ if (!info->attrs[IOAM6_ATTR_SC_ID] || !info->attrs[IOAM6_ATTR_SC_DATA])
+ return -EINVAL;
+
+ sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
+ nsdata = ioam6_pernet(net);
+
+ mutex_lock(&nsdata->lock);
+
+ sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
+ if (sc) {
+ err = -EEXIST;
+ goto out_unlock;
+ }
+
+ sc = kzalloc(sizeof(*sc), GFP_KERNEL);
+ if (!sc) {
+ err = -ENOMEM;
+ goto out_unlock;
+ }
+
+ len = nla_len(info->attrs[IOAM6_ATTR_SC_DATA]);
+ pad = (4 - (len % 4)) % 4;
+
+ sc->data = kzalloc(len + pad, GFP_KERNEL);
+ if (!sc->data) {
+ err = -ENOMEM;
+ goto free_sc;
+ }
+
+ sc->id = sc_id;
+ sc->len = len + pad;
+ sc->hdr = cpu_to_be32(sc->id | ((u8)(sc->len / 4) << 24));
+
+ nla_memcpy(sc->data, info->attrs[IOAM6_ATTR_SC_DATA], len);
+
+ err = rhashtable_lookup_insert_fast(&nsdata->schemas, &sc->head,
+ rht_sc_params);
+ if (err)
+ goto free_data;
+
+out_unlock:
+ mutex_unlock(&nsdata->lock);
+ return err;
+free_data:
+ kfree(sc->data);
+free_sc:
+ kfree(sc);
+ goto out_unlock;
+}
+
+static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
+{
+ struct net *net = genl_info_net(info);
+ struct ioam6_pernet_data *nsdata;
+ struct ioam6_schema *sc;
+ u32 sc_id;
+ int err;
+
+ if (!info->attrs[IOAM6_ATTR_SC_ID])
+ return -EINVAL;
+
+ sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
+ nsdata = ioam6_pernet(net);
+
+ mutex_lock(&nsdata->lock);
+
+ sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
+ if (!sc) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+
+ if (sc->ns)
+ sc->ns->schema = NULL;
+
+ err = rhashtable_remove_fast(&nsdata->schemas, &sc->head,
+ rht_sc_params);
+ if (err) {
+ sc->ns->schema = sc;
+ goto out_unlock;
+ }
+
+ ioam6_sc_release(sc);
+
+out_unlock:
+ mutex_unlock(&nsdata->lock);
+ return err;
+}
+
+static int __ioam6_genl_dumpsc_element(struct ioam6_schema *sc,
+ u32 portid, u32 seq, u32 flags,
+ struct sk_buff *skb, u8 cmd)
+{
+ void *hdr;
+
+ hdr = genlmsg_put(skb, portid, seq, &ioam6_genl_family, flags, cmd);
+ if (!hdr)
+ return -ENOMEM;
+
+ if (nla_put_u32(skb, IOAM6_ATTR_SC_ID, sc->id) ||
+ nla_put(skb, IOAM6_ATTR_SC_DATA, sc->len, sc->data) ||
+ (sc->ns && nla_put_u16(skb, IOAM6_ATTR_NS_ID,
+ be16_to_cpu(sc->ns->id))))
+ goto nla_put_failure;
+
+ genlmsg_end(skb, hdr);
+ return 0;
+
+nla_put_failure:
+ genlmsg_cancel(skb, hdr);
+ return -EMSGSIZE;
+}
+
+static int ioam6_genl_dumpsc_start(struct netlink_callback *cb)
+{
+ struct net *net = sock_net(cb->skb->sk);
+ struct ioam6_pernet_data *nsdata;
+ struct rhashtable_iter *iter;
+
+ nsdata = ioam6_pernet(net);
+ iter = (struct rhashtable_iter *)cb->args[0];
+
+ if (!iter) {
+ iter = kmalloc(sizeof(*iter), GFP_KERNEL);
+ if (!iter)
+ return -ENOMEM;
+
+ cb->args[0] = (long)iter;
+ }
+
+ rhashtable_walk_enter(&nsdata->schemas, iter);
+
+ return 0;
+}
+
+static int ioam6_genl_dumpsc_done(struct netlink_callback *cb)
+{
+ struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
+
+ rhashtable_walk_exit(iter);
+ kfree(iter);
+
+ return 0;
+}
+
+static int ioam6_genl_dumpsc(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
+ struct ioam6_schema *sc;
+ int err;
+
+ rhashtable_walk_start(iter);
+
+ for (;;) {
+ sc = rhashtable_walk_next(iter);
+
+ if (IS_ERR(sc)) {
+ if (PTR_ERR(sc) == -EAGAIN)
+ continue;
+ err = PTR_ERR(sc);
+ goto done;
+ } else if (!sc) {
+ break;
+ }
+
+ err = __ioam6_genl_dumpsc_element(sc,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ NLM_F_MULTI,
+ skb,
+ IOAM6_CMD_DUMP_SCHEMAS);
+ if (err)
+ goto done;
+ }
+
+ err = skb->len;
+
+done:
+ rhashtable_walk_stop(iter);
+ return err;
+}
+
+static int ioam6_genl_ns_set_schema(struct sk_buff *skb, struct genl_info *info)
+{
+ struct net *net = genl_info_net(info);
+ struct ioam6_pernet_data *nsdata;
+ struct ioam6_namespace *ns;
+ struct ioam6_schema *sc;
+ __be16 ns_id;
+ int err = 0;
+ u32 sc_id;
+
+ if (!info->attrs[IOAM6_ATTR_NS_ID] ||
+ (!info->attrs[IOAM6_ATTR_SC_ID] &&
+ !info->attrs[IOAM6_ATTR_SC_NONE]))
+ return -EINVAL;
+
+ ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
+ nsdata = ioam6_pernet(net);
+
+ mutex_lock(&nsdata->lock);
+
+ ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
+ if (!ns) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+
+ if (info->attrs[IOAM6_ATTR_SC_NONE]) {
+ sc = NULL;
+ } else {
+ sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
+ sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id,
+ rht_sc_params);
+ if (!sc) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+ }
+
+ if (ns->schema)
+ ns->schema->ns = NULL;
+ ns->schema = sc;
+
+ if (sc) {
+ if (sc->ns)
+ sc->ns->schema = NULL;
+ sc->ns = ns;
+ }
+
+out_unlock:
+ mutex_unlock(&nsdata->lock);
+ return err;
+}
+
+static const struct genl_ops ioam6_genl_ops[] = {
+ {
+ .cmd = IOAM6_CMD_ADD_NAMESPACE,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = ioam6_genl_addns,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_DEL_NAMESPACE,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = ioam6_genl_delns,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_DUMP_NAMESPACES,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .start = ioam6_genl_dumpns_start,
+ .dumpit = ioam6_genl_dumpns,
+ .done = ioam6_genl_dumpns_done,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_ADD_SCHEMA,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = ioam6_genl_addsc,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_DEL_SCHEMA,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = ioam6_genl_delsc,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_DUMP_SCHEMAS,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .start = ioam6_genl_dumpsc_start,
+ .dumpit = ioam6_genl_dumpsc,
+ .done = ioam6_genl_dumpsc_done,
+ .flags = GENL_ADMIN_PERM,
+ },
+ {
+ .cmd = IOAM6_CMD_NS_SET_SCHEMA,
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+ .doit = ioam6_genl_ns_set_schema,
+ .flags = GENL_ADMIN_PERM,
+ },
+};
+
+static struct genl_family ioam6_genl_family __ro_after_init = {
+ .hdrsize = 0,
+ .name = IOAM6_GENL_NAME,
+ .version = IOAM6_GENL_VERSION,
+ .maxattr = IOAM6_ATTR_MAX,
+ .policy = ioam6_genl_policy,
+ .netnsok = true,
+ .parallel_ops = true,
+ .ops = ioam6_genl_ops,
+ .n_ops = ARRAY_SIZE(ioam6_genl_ops),
+ .module = THIS_MODULE,
+};
+
struct ioam6_namespace *ioam6_namespace(struct net *net, __be16 id)
{
struct ioam6_pernet_data *nsdata = ioam6_pernet(net);
@@ -311,16 +814,26 @@ static struct pernet_operations ioam6_net_ops = {
int __init ioam6_init(void)
{
- int err = register_pernet_subsys(&ioam6_net_ops);
+ int err = genl_register_family(&ioam6_genl_family);
+
+ if (err)
+ goto out;
+ err = register_pernet_subsys(&ioam6_net_ops);
if (err)
- return err;
+ goto out_unregister_genl;
pr_info("In-situ OAM (IOAM) with IPv6\n");
- return 0;
+
+out:
+ return err;
+out_unregister_genl:
+ genl_unregister_family(&ioam6_genl_family);
+ goto out;
}
void ioam6_exit(void)
{
unregister_pernet_subsys(&ioam6_net_ops);
+ genl_unregister_family(&ioam6_genl_family);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM
@ 2020-06-25 0:02 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-06-25 0:02 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 17578 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200624192310.16923-5-justin.iurman@uliege.be>
References: <20200624192310.16923-5-justin.iurman@uliege.be>
TO: Justin Iurman <justin.iurman@uliege.be>
TO: netdev(a)vger.kernel.org
CC: davem(a)davemloft.net
CC: justin.iurman(a)uliege.be
Hi Justin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Justin-Iurman/Data-plane-support-for-IOAM-Pre-allocated-Trace-with-IPv6/20200625-033536
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0558c396040734bc1d361919566a581fd41aa539
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: microblaze-randconfig-m031-20200624 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv6/ioam6.c:164 ioam6_genl_delns() error: we previously assumed 'ns->schema' could be null (see line 158)
net/ipv6/ioam6.c:358 ioam6_genl_delsc() error: we previously assumed 'sc->ns' could be null (see line 352)
Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:91 current_thread_info() error: uninitialized symbol 'sp'.
# https://github.com/0day-ci/linux/commit/ce303f2d7c40f84739505f1daa7dac53daa6c4c5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout ce303f2d7c40f84739505f1daa7dac53daa6c4c5
vim +164 net/ipv6/ioam6.c
ce303f2d7c40f8 Justin Iurman 2020-06-24 135
ce303f2d7c40f8 Justin Iurman 2020-06-24 136 static int ioam6_genl_delns(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 137 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 138 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 139 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 140 struct ioam6_namespace *ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 141 __be16 ns_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 142 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 143
ce303f2d7c40f8 Justin Iurman 2020-06-24 144 if (!info->attrs[IOAM6_ATTR_NS_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 145 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 146
ce303f2d7c40f8 Justin Iurman 2020-06-24 147 ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
ce303f2d7c40f8 Justin Iurman 2020-06-24 148 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 149
ce303f2d7c40f8 Justin Iurman 2020-06-24 150 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 151
ce303f2d7c40f8 Justin Iurman 2020-06-24 152 ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 153 if (!ns) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 154 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 155 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 156 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 157
ce303f2d7c40f8 Justin Iurman 2020-06-24 @158 if (ns->schema)
ce303f2d7c40f8 Justin Iurman 2020-06-24 159 ns->schema->ns = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 160
ce303f2d7c40f8 Justin Iurman 2020-06-24 161 err = rhashtable_remove_fast(&nsdata->namespaces, &ns->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 162 rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 163 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @164 ns->schema->ns = ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 165 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 166 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 167
ce303f2d7c40f8 Justin Iurman 2020-06-24 168 ioam6_ns_release(ns);
ce303f2d7c40f8 Justin Iurman 2020-06-24 169
ce303f2d7c40f8 Justin Iurman 2020-06-24 170 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 171 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 172 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 173 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 174
ce303f2d7c40f8 Justin Iurman 2020-06-24 175 static int __ioam6_genl_dumpns_element(struct ioam6_namespace *ns,
ce303f2d7c40f8 Justin Iurman 2020-06-24 176 u32 portid, u32 seq, u32 flags,
ce303f2d7c40f8 Justin Iurman 2020-06-24 177 struct sk_buff *skb, u8 cmd)
ce303f2d7c40f8 Justin Iurman 2020-06-24 178 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 179 void *hdr;
ce303f2d7c40f8 Justin Iurman 2020-06-24 180 u64 data;
ce303f2d7c40f8 Justin Iurman 2020-06-24 181
ce303f2d7c40f8 Justin Iurman 2020-06-24 182 hdr = genlmsg_put(skb, portid, seq, &ioam6_genl_family, flags, cmd);
ce303f2d7c40f8 Justin Iurman 2020-06-24 183 if (!hdr)
ce303f2d7c40f8 Justin Iurman 2020-06-24 184 return -ENOMEM;
ce303f2d7c40f8 Justin Iurman 2020-06-24 185
ce303f2d7c40f8 Justin Iurman 2020-06-24 186 data = be64_to_cpu(ns->data);
ce303f2d7c40f8 Justin Iurman 2020-06-24 187
ce303f2d7c40f8 Justin Iurman 2020-06-24 188 if (nla_put_u16(skb, IOAM6_ATTR_NS_ID, be16_to_cpu(ns->id)) ||
ce303f2d7c40f8 Justin Iurman 2020-06-24 189 (data != IOAM6_EMPTY_FIELD_u64 &&
ce303f2d7c40f8 Justin Iurman 2020-06-24 190 nla_put_u64_64bit(skb, IOAM6_ATTR_NS_DATA, data, IOAM6_ATTR_PAD)) ||
ce303f2d7c40f8 Justin Iurman 2020-06-24 191 (ns->remove_tlv && nla_put_flag(skb, IOAM6_ATTR_NS_POP)) ||
ce303f2d7c40f8 Justin Iurman 2020-06-24 192 (ns->schema && nla_put_u32(skb, IOAM6_ATTR_SC_ID, ns->schema->id)))
ce303f2d7c40f8 Justin Iurman 2020-06-24 193 goto nla_put_failure;
ce303f2d7c40f8 Justin Iurman 2020-06-24 194
ce303f2d7c40f8 Justin Iurman 2020-06-24 195 genlmsg_end(skb, hdr);
ce303f2d7c40f8 Justin Iurman 2020-06-24 196 return 0;
ce303f2d7c40f8 Justin Iurman 2020-06-24 197
ce303f2d7c40f8 Justin Iurman 2020-06-24 198 nla_put_failure:
ce303f2d7c40f8 Justin Iurman 2020-06-24 199 genlmsg_cancel(skb, hdr);
ce303f2d7c40f8 Justin Iurman 2020-06-24 200 return -EMSGSIZE;
ce303f2d7c40f8 Justin Iurman 2020-06-24 201 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 202
ce303f2d7c40f8 Justin Iurman 2020-06-24 203 static int ioam6_genl_dumpns_start(struct netlink_callback *cb)
ce303f2d7c40f8 Justin Iurman 2020-06-24 204 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 205 struct net *net = sock_net(cb->skb->sk);
ce303f2d7c40f8 Justin Iurman 2020-06-24 206 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 207 struct rhashtable_iter *iter;
ce303f2d7c40f8 Justin Iurman 2020-06-24 208
ce303f2d7c40f8 Justin Iurman 2020-06-24 209 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 210 iter = (struct rhashtable_iter *)cb->args[0];
ce303f2d7c40f8 Justin Iurman 2020-06-24 211
ce303f2d7c40f8 Justin Iurman 2020-06-24 212 if (!iter) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 213 iter = kmalloc(sizeof(*iter), GFP_KERNEL);
ce303f2d7c40f8 Justin Iurman 2020-06-24 214 if (!iter)
ce303f2d7c40f8 Justin Iurman 2020-06-24 215 return -ENOMEM;
ce303f2d7c40f8 Justin Iurman 2020-06-24 216
ce303f2d7c40f8 Justin Iurman 2020-06-24 217 cb->args[0] = (long)iter;
ce303f2d7c40f8 Justin Iurman 2020-06-24 218 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 219
ce303f2d7c40f8 Justin Iurman 2020-06-24 220 rhashtable_walk_enter(&nsdata->namespaces, iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 221
ce303f2d7c40f8 Justin Iurman 2020-06-24 222 return 0;
ce303f2d7c40f8 Justin Iurman 2020-06-24 223 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 224
ce303f2d7c40f8 Justin Iurman 2020-06-24 225 static int ioam6_genl_dumpns_done(struct netlink_callback *cb)
ce303f2d7c40f8 Justin Iurman 2020-06-24 226 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 227 struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
ce303f2d7c40f8 Justin Iurman 2020-06-24 228
ce303f2d7c40f8 Justin Iurman 2020-06-24 229 rhashtable_walk_exit(iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 230 kfree(iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 231
ce303f2d7c40f8 Justin Iurman 2020-06-24 232 return 0;
ce303f2d7c40f8 Justin Iurman 2020-06-24 233 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 234
ce303f2d7c40f8 Justin Iurman 2020-06-24 235 static int ioam6_genl_dumpns(struct sk_buff *skb, struct netlink_callback *cb)
ce303f2d7c40f8 Justin Iurman 2020-06-24 236 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 237 struct rhashtable_iter *iter = (struct rhashtable_iter *)cb->args[0];
ce303f2d7c40f8 Justin Iurman 2020-06-24 238 struct ioam6_namespace *ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 239 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 240
ce303f2d7c40f8 Justin Iurman 2020-06-24 241 rhashtable_walk_start(iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 242
ce303f2d7c40f8 Justin Iurman 2020-06-24 243 for (;;) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 244 ns = rhashtable_walk_next(iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 245
ce303f2d7c40f8 Justin Iurman 2020-06-24 246 if (IS_ERR(ns)) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 247 if (PTR_ERR(ns) == -EAGAIN)
ce303f2d7c40f8 Justin Iurman 2020-06-24 248 continue;
ce303f2d7c40f8 Justin Iurman 2020-06-24 249 err = PTR_ERR(ns);
ce303f2d7c40f8 Justin Iurman 2020-06-24 250 goto done;
ce303f2d7c40f8 Justin Iurman 2020-06-24 251 } else if (!ns) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 252 break;
ce303f2d7c40f8 Justin Iurman 2020-06-24 253 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 254
ce303f2d7c40f8 Justin Iurman 2020-06-24 255 err = __ioam6_genl_dumpns_element(ns,
ce303f2d7c40f8 Justin Iurman 2020-06-24 256 NETLINK_CB(cb->skb).portid,
ce303f2d7c40f8 Justin Iurman 2020-06-24 257 cb->nlh->nlmsg_seq,
ce303f2d7c40f8 Justin Iurman 2020-06-24 258 NLM_F_MULTI,
ce303f2d7c40f8 Justin Iurman 2020-06-24 259 skb,
ce303f2d7c40f8 Justin Iurman 2020-06-24 260 IOAM6_CMD_DUMP_NAMESPACES);
ce303f2d7c40f8 Justin Iurman 2020-06-24 261 if (err)
ce303f2d7c40f8 Justin Iurman 2020-06-24 262 goto done;
ce303f2d7c40f8 Justin Iurman 2020-06-24 263 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 264
ce303f2d7c40f8 Justin Iurman 2020-06-24 265 err = skb->len;
ce303f2d7c40f8 Justin Iurman 2020-06-24 266
ce303f2d7c40f8 Justin Iurman 2020-06-24 267 done:
ce303f2d7c40f8 Justin Iurman 2020-06-24 268 rhashtable_walk_stop(iter);
ce303f2d7c40f8 Justin Iurman 2020-06-24 269 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 270 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 271
ce303f2d7c40f8 Justin Iurman 2020-06-24 272 static int ioam6_genl_addsc(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 273 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 274 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 275 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 276 struct ioam6_schema *sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 277 int len, pad, err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 278 u32 sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 279
ce303f2d7c40f8 Justin Iurman 2020-06-24 280 if (!info->attrs[IOAM6_ATTR_SC_ID] || !info->attrs[IOAM6_ATTR_SC_DATA])
ce303f2d7c40f8 Justin Iurman 2020-06-24 281 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 282
ce303f2d7c40f8 Justin Iurman 2020-06-24 283 sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 284 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 285
ce303f2d7c40f8 Justin Iurman 2020-06-24 286 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 287
ce303f2d7c40f8 Justin Iurman 2020-06-24 288 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 289 if (sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 290 err = -EEXIST;
ce303f2d7c40f8 Justin Iurman 2020-06-24 291 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 292 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 293
ce303f2d7c40f8 Justin Iurman 2020-06-24 294 sc = kzalloc(sizeof(*sc), GFP_KERNEL);
ce303f2d7c40f8 Justin Iurman 2020-06-24 295 if (!sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 296 err = -ENOMEM;
ce303f2d7c40f8 Justin Iurman 2020-06-24 297 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 298 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 299
ce303f2d7c40f8 Justin Iurman 2020-06-24 300 len = nla_len(info->attrs[IOAM6_ATTR_SC_DATA]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 301 pad = (4 - (len % 4)) % 4;
ce303f2d7c40f8 Justin Iurman 2020-06-24 302
ce303f2d7c40f8 Justin Iurman 2020-06-24 303 sc->data = kzalloc(len + pad, GFP_KERNEL);
ce303f2d7c40f8 Justin Iurman 2020-06-24 304 if (!sc->data) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 305 err = -ENOMEM;
ce303f2d7c40f8 Justin Iurman 2020-06-24 306 goto free_sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 307 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 308
ce303f2d7c40f8 Justin Iurman 2020-06-24 309 sc->id = sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 310 sc->len = len + pad;
ce303f2d7c40f8 Justin Iurman 2020-06-24 311 sc->hdr = cpu_to_be32(sc->id | ((u8)(sc->len / 4) << 24));
ce303f2d7c40f8 Justin Iurman 2020-06-24 312
ce303f2d7c40f8 Justin Iurman 2020-06-24 313 nla_memcpy(sc->data, info->attrs[IOAM6_ATTR_SC_DATA], len);
ce303f2d7c40f8 Justin Iurman 2020-06-24 314
ce303f2d7c40f8 Justin Iurman 2020-06-24 315 err = rhashtable_lookup_insert_fast(&nsdata->schemas, &sc->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 316 rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 317 if (err)
ce303f2d7c40f8 Justin Iurman 2020-06-24 318 goto free_data;
ce303f2d7c40f8 Justin Iurman 2020-06-24 319
ce303f2d7c40f8 Justin Iurman 2020-06-24 320 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 321 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 322 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 323 free_data:
ce303f2d7c40f8 Justin Iurman 2020-06-24 324 kfree(sc->data);
ce303f2d7c40f8 Justin Iurman 2020-06-24 325 free_sc:
ce303f2d7c40f8 Justin Iurman 2020-06-24 326 kfree(sc);
ce303f2d7c40f8 Justin Iurman 2020-06-24 327 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 328 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 329
ce303f2d7c40f8 Justin Iurman 2020-06-24 330 static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 331 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 332 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 333 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 334 struct ioam6_schema *sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 335 u32 sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 336 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 337
ce303f2d7c40f8 Justin Iurman 2020-06-24 338 if (!info->attrs[IOAM6_ATTR_SC_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 339 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 340
ce303f2d7c40f8 Justin Iurman 2020-06-24 341 sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 342 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 343
ce303f2d7c40f8 Justin Iurman 2020-06-24 344 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 345
ce303f2d7c40f8 Justin Iurman 2020-06-24 346 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 347 if (!sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 348 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 349 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 350 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 351
ce303f2d7c40f8 Justin Iurman 2020-06-24 @352 if (sc->ns)
ce303f2d7c40f8 Justin Iurman 2020-06-24 353 sc->ns->schema = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 354
ce303f2d7c40f8 Justin Iurman 2020-06-24 355 err = rhashtable_remove_fast(&nsdata->schemas, &sc->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 356 rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 357 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @358 sc->ns->schema = sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 359 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 360 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 361
ce303f2d7c40f8 Justin Iurman 2020-06-24 362 ioam6_sc_release(sc);
ce303f2d7c40f8 Justin Iurman 2020-06-24 363
ce303f2d7c40f8 Justin Iurman 2020-06-24 364 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 365 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 366 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 367 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 368
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26285 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM
2020-06-24 19:23 ` [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM Justin Iurman
2020-06-25 10:52 ` Dan Carpenter
@ 2020-06-25 10:52 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-06-25 10:52 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6698 bytes --]
Hi Justin,
url: https://github.com/0day-ci/linux/commits/Justin-Iurman/Data-plane-support-for-IOAM-Pre-allocated-Trace-with-IPv6/20200625-033536
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0558c396040734bc1d361919566a581fd41aa539
config: microblaze-randconfig-m031-20200624 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv6/ioam6.c:164 ioam6_genl_delns() error: we previously assumed 'ns->schema' could be null (see line 158)
net/ipv6/ioam6.c:358 ioam6_genl_delsc() error: we previously assumed 'sc->ns' could be null (see line 352)
# https://github.com/0day-ci/linux/commit/ce303f2d7c40f84739505f1daa7dac53daa6c4c5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout ce303f2d7c40f84739505f1daa7dac53daa6c4c5
vim +164 net/ipv6/ioam6.c
ce303f2d7c40f8 Justin Iurman 2020-06-24 135
ce303f2d7c40f8 Justin Iurman 2020-06-24 136 static int ioam6_genl_delns(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 137 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 138 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 139 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 140 struct ioam6_namespace *ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 141 __be16 ns_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 142 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 143
ce303f2d7c40f8 Justin Iurman 2020-06-24 144 if (!info->attrs[IOAM6_ATTR_NS_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 145 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 146
ce303f2d7c40f8 Justin Iurman 2020-06-24 147 ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
ce303f2d7c40f8 Justin Iurman 2020-06-24 148 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 149
ce303f2d7c40f8 Justin Iurman 2020-06-24 150 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 151
ce303f2d7c40f8 Justin Iurman 2020-06-24 152 ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 153 if (!ns) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 154 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 155 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 156 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 157
ce303f2d7c40f8 Justin Iurman 2020-06-24 @158 if (ns->schema)
^^^^^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 159 ns->schema->ns = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 160
ce303f2d7c40f8 Justin Iurman 2020-06-24 161 err = rhashtable_remove_fast(&nsdata->namespaces, &ns->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 162 rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 163 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @164 ns->schema->ns = ns;
^^^^^^^^^^^^^^
Unchecked dereference.
ce303f2d7c40f8 Justin Iurman 2020-06-24 165 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 166 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 167
ce303f2d7c40f8 Justin Iurman 2020-06-24 168 ioam6_ns_release(ns);
ce303f2d7c40f8 Justin Iurman 2020-06-24 169
ce303f2d7c40f8 Justin Iurman 2020-06-24 170 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 171 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 172 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 173 }
[ snip ]
ce303f2d7c40f8 Justin Iurman 2020-06-24 330 static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 331 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 332 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 333 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 334 struct ioam6_schema *sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 335 u32 sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 336 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 337
ce303f2d7c40f8 Justin Iurman 2020-06-24 338 if (!info->attrs[IOAM6_ATTR_SC_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 339 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 340
ce303f2d7c40f8 Justin Iurman 2020-06-24 341 sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 342 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 343
ce303f2d7c40f8 Justin Iurman 2020-06-24 344 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 345
ce303f2d7c40f8 Justin Iurman 2020-06-24 346 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 347 if (!sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 348 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 349 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 350 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 351
ce303f2d7c40f8 Justin Iurman 2020-06-24 @352 if (sc->ns)
^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 353 sc->ns->schema = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 354
ce303f2d7c40f8 Justin Iurman 2020-06-24 355 err = rhashtable_remove_fast(&nsdata->schemas, &sc->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 356 rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 357 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @358 sc->ns->schema = sc;
^^^^^^^^^^^^^^
Unchecked dereference
ce303f2d7c40f8 Justin Iurman 2020-06-24 359 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 360 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 361
ce303f2d7c40f8 Justin Iurman 2020-06-24 362 ioam6_sc_release(sc);
ce303f2d7c40f8 Justin Iurman 2020-06-24 363
ce303f2d7c40f8 Justin Iurman 2020-06-24 364 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 365 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 366 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 367 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26285 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM
@ 2020-06-25 10:52 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-06-25 10:52 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6698 bytes --]
Hi Justin,
url: https://github.com/0day-ci/linux/commits/Justin-Iurman/Data-plane-support-for-IOAM-Pre-allocated-Trace-with-IPv6/20200625-033536
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0558c396040734bc1d361919566a581fd41aa539
config: microblaze-randconfig-m031-20200624 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv6/ioam6.c:164 ioam6_genl_delns() error: we previously assumed 'ns->schema' could be null (see line 158)
net/ipv6/ioam6.c:358 ioam6_genl_delsc() error: we previously assumed 'sc->ns' could be null (see line 352)
# https://github.com/0day-ci/linux/commit/ce303f2d7c40f84739505f1daa7dac53daa6c4c5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout ce303f2d7c40f84739505f1daa7dac53daa6c4c5
vim +164 net/ipv6/ioam6.c
ce303f2d7c40f8 Justin Iurman 2020-06-24 135
ce303f2d7c40f8 Justin Iurman 2020-06-24 136 static int ioam6_genl_delns(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 137 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 138 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 139 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 140 struct ioam6_namespace *ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 141 __be16 ns_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 142 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 143
ce303f2d7c40f8 Justin Iurman 2020-06-24 144 if (!info->attrs[IOAM6_ATTR_NS_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 145 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 146
ce303f2d7c40f8 Justin Iurman 2020-06-24 147 ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
ce303f2d7c40f8 Justin Iurman 2020-06-24 148 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 149
ce303f2d7c40f8 Justin Iurman 2020-06-24 150 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 151
ce303f2d7c40f8 Justin Iurman 2020-06-24 152 ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 153 if (!ns) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 154 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 155 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 156 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 157
ce303f2d7c40f8 Justin Iurman 2020-06-24 @158 if (ns->schema)
^^^^^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 159 ns->schema->ns = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 160
ce303f2d7c40f8 Justin Iurman 2020-06-24 161 err = rhashtable_remove_fast(&nsdata->namespaces, &ns->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 162 rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 163 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @164 ns->schema->ns = ns;
^^^^^^^^^^^^^^
Unchecked dereference.
ce303f2d7c40f8 Justin Iurman 2020-06-24 165 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 166 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 167
ce303f2d7c40f8 Justin Iurman 2020-06-24 168 ioam6_ns_release(ns);
ce303f2d7c40f8 Justin Iurman 2020-06-24 169
ce303f2d7c40f8 Justin Iurman 2020-06-24 170 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 171 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 172 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 173 }
[ snip ]
ce303f2d7c40f8 Justin Iurman 2020-06-24 330 static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 331 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 332 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 333 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 334 struct ioam6_schema *sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 335 u32 sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 336 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 337
ce303f2d7c40f8 Justin Iurman 2020-06-24 338 if (!info->attrs[IOAM6_ATTR_SC_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 339 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 340
ce303f2d7c40f8 Justin Iurman 2020-06-24 341 sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 342 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 343
ce303f2d7c40f8 Justin Iurman 2020-06-24 344 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 345
ce303f2d7c40f8 Justin Iurman 2020-06-24 346 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 347 if (!sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 348 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 349 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 350 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 351
ce303f2d7c40f8 Justin Iurman 2020-06-24 @352 if (sc->ns)
^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 353 sc->ns->schema = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 354
ce303f2d7c40f8 Justin Iurman 2020-06-24 355 err = rhashtable_remove_fast(&nsdata->schemas, &sc->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 356 rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 357 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @358 sc->ns->schema = sc;
^^^^^^^^^^^^^^
Unchecked dereference
ce303f2d7c40f8 Justin Iurman 2020-06-24 359 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 360 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 361
ce303f2d7c40f8 Justin Iurman 2020-06-24 362 ioam6_sc_release(sc);
ce303f2d7c40f8 Justin Iurman 2020-06-24 363
ce303f2d7c40f8 Justin Iurman 2020-06-24 364 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 365 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 366 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 367 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26285 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM
@ 2020-06-25 10:52 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-06-25 10:52 UTC (permalink / raw)
To: kbuild, Justin Iurman, netdev; +Cc: lkp, kbuild-all, davem, justin.iurman
[-- Attachment #1: Type: text/plain, Size: 6579 bytes --]
Hi Justin,
url: https://github.com/0day-ci/linux/commits/Justin-Iurman/Data-plane-support-for-IOAM-Pre-allocated-Trace-with-IPv6/20200625-033536
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0558c396040734bc1d361919566a581fd41aa539
config: microblaze-randconfig-m031-20200624 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv6/ioam6.c:164 ioam6_genl_delns() error: we previously assumed 'ns->schema' could be null (see line 158)
net/ipv6/ioam6.c:358 ioam6_genl_delsc() error: we previously assumed 'sc->ns' could be null (see line 352)
# https://github.com/0day-ci/linux/commit/ce303f2d7c40f84739505f1daa7dac53daa6c4c5
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout ce303f2d7c40f84739505f1daa7dac53daa6c4c5
vim +164 net/ipv6/ioam6.c
ce303f2d7c40f8 Justin Iurman 2020-06-24 135
ce303f2d7c40f8 Justin Iurman 2020-06-24 136 static int ioam6_genl_delns(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 137 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 138 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 139 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 140 struct ioam6_namespace *ns;
ce303f2d7c40f8 Justin Iurman 2020-06-24 141 __be16 ns_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 142 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 143
ce303f2d7c40f8 Justin Iurman 2020-06-24 144 if (!info->attrs[IOAM6_ATTR_NS_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 145 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 146
ce303f2d7c40f8 Justin Iurman 2020-06-24 147 ns_id = cpu_to_be16(nla_get_u16(info->attrs[IOAM6_ATTR_NS_ID]));
ce303f2d7c40f8 Justin Iurman 2020-06-24 148 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 149
ce303f2d7c40f8 Justin Iurman 2020-06-24 150 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 151
ce303f2d7c40f8 Justin Iurman 2020-06-24 152 ns = rhashtable_lookup_fast(&nsdata->namespaces, &ns_id, rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 153 if (!ns) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 154 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 155 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 156 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 157
ce303f2d7c40f8 Justin Iurman 2020-06-24 @158 if (ns->schema)
^^^^^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 159 ns->schema->ns = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 160
ce303f2d7c40f8 Justin Iurman 2020-06-24 161 err = rhashtable_remove_fast(&nsdata->namespaces, &ns->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 162 rht_ns_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 163 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @164 ns->schema->ns = ns;
^^^^^^^^^^^^^^
Unchecked dereference.
ce303f2d7c40f8 Justin Iurman 2020-06-24 165 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 166 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 167
ce303f2d7c40f8 Justin Iurman 2020-06-24 168 ioam6_ns_release(ns);
ce303f2d7c40f8 Justin Iurman 2020-06-24 169
ce303f2d7c40f8 Justin Iurman 2020-06-24 170 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 171 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 172 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 173 }
[ snip ]
ce303f2d7c40f8 Justin Iurman 2020-06-24 330 static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
ce303f2d7c40f8 Justin Iurman 2020-06-24 331 {
ce303f2d7c40f8 Justin Iurman 2020-06-24 332 struct net *net = genl_info_net(info);
ce303f2d7c40f8 Justin Iurman 2020-06-24 333 struct ioam6_pernet_data *nsdata;
ce303f2d7c40f8 Justin Iurman 2020-06-24 334 struct ioam6_schema *sc;
ce303f2d7c40f8 Justin Iurman 2020-06-24 335 u32 sc_id;
ce303f2d7c40f8 Justin Iurman 2020-06-24 336 int err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 337
ce303f2d7c40f8 Justin Iurman 2020-06-24 338 if (!info->attrs[IOAM6_ATTR_SC_ID])
ce303f2d7c40f8 Justin Iurman 2020-06-24 339 return -EINVAL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 340
ce303f2d7c40f8 Justin Iurman 2020-06-24 341 sc_id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
ce303f2d7c40f8 Justin Iurman 2020-06-24 342 nsdata = ioam6_pernet(net);
ce303f2d7c40f8 Justin Iurman 2020-06-24 343
ce303f2d7c40f8 Justin Iurman 2020-06-24 344 mutex_lock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 345
ce303f2d7c40f8 Justin Iurman 2020-06-24 346 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 347 if (!sc) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 348 err = -ENOENT;
ce303f2d7c40f8 Justin Iurman 2020-06-24 349 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 350 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 351
ce303f2d7c40f8 Justin Iurman 2020-06-24 @352 if (sc->ns)
^^^^^^
Check for NULL
ce303f2d7c40f8 Justin Iurman 2020-06-24 353 sc->ns->schema = NULL;
ce303f2d7c40f8 Justin Iurman 2020-06-24 354
ce303f2d7c40f8 Justin Iurman 2020-06-24 355 err = rhashtable_remove_fast(&nsdata->schemas, &sc->head,
ce303f2d7c40f8 Justin Iurman 2020-06-24 356 rht_sc_params);
ce303f2d7c40f8 Justin Iurman 2020-06-24 357 if (err) {
ce303f2d7c40f8 Justin Iurman 2020-06-24 @358 sc->ns->schema = sc;
^^^^^^^^^^^^^^
Unchecked dereference
ce303f2d7c40f8 Justin Iurman 2020-06-24 359 goto out_unlock;
ce303f2d7c40f8 Justin Iurman 2020-06-24 360 }
ce303f2d7c40f8 Justin Iurman 2020-06-24 361
ce303f2d7c40f8 Justin Iurman 2020-06-24 362 ioam6_sc_release(sc);
ce303f2d7c40f8 Justin Iurman 2020-06-24 363
ce303f2d7c40f8 Justin Iurman 2020-06-24 364 out_unlock:
ce303f2d7c40f8 Justin Iurman 2020-06-24 365 mutex_unlock(&nsdata->lock);
ce303f2d7c40f8 Justin Iurman 2020-06-24 366 return err;
ce303f2d7c40f8 Justin Iurman 2020-06-24 367 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26285 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-25 10:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-25 0:02 [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-06-24 19:23 [PATCH net-next 0/5] Data plane support for IOAM Pre-allocated Trace with IPv6 Justin Iurman
2020-06-24 19:23 ` [PATCH net-next 4/5] ipv6: ioam: Generic Netlink to configure IOAM Justin Iurman
2020-06-25 10:52 ` Dan Carpenter
2020-06-25 10:52 ` Dan Carpenter
2020-06-25 10:52 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.