]> Git Repo - linux.git/commitdiff
Merge branch 'ieee802154-for-davem-2019-08-24' of git://git.kernel.org/pub/scm/linux...
authorDavid S. Miller <[email protected]>
Sat, 24 Aug 2019 20:46:57 +0000 (13:46 -0700)
committerDavid S. Miller <[email protected]>
Sat, 24 Aug 2019 20:46:57 +0000 (13:46 -0700)
Stefan Schmidt says:

====================
pull-request: ieee802154 for net 2019-08-24

An update from ieee802154 for your *net* tree.

Yue Haibing fixed two bugs discovered by KASAN in the hwsim driver for
ieee802154 and Colin Ian King cleaned up a redundant variable assignment.
====================

Signed-off-by: David S. Miller <[email protected]>
1  2 
drivers/net/ieee802154/mac802154_hwsim.c
net/ieee802154/socket.c

index b41696e16bdc835ff1ec8f516c8ed4c711501ad6,3d9ffd2188f9382169991b2abee1943ab8efac1a..c20e7ef18bc955984f58dd9f8cba38e1bedcb663
@@@ -1,10 -1,18 +1,10 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * HWSIM IEEE 802.15.4 interface
   *
   * (C) 2018 Mojatau, Alexander Aring <[email protected]>
   * Copyright 2007-2012 Siemens AG
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2
 - * as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope that it will be useful,
 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - * GNU General Public License for more details.
 - *
   * Based on fakelb, original Written by:
   * Sergey Lapin <[email protected]>
   * Dmitry Eremin-Solenikov <[email protected]>
@@@ -219,16 -227,14 +219,16 @@@ static int append_radio_msg(struct sk_b
                return 0;
        }
  
 -      nl_edges = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGES);
 +      nl_edges = nla_nest_start_noflag(skb,
 +                                       MAC802154_HWSIM_ATTR_RADIO_EDGES);
        if (!nl_edges) {
                rcu_read_unlock();
                return -ENOBUFS;
        }
  
        list_for_each_entry_rcu(e, &phy->edges, list) {
 -              nl_edge = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGE);
 +              nl_edge = nla_nest_start_noflag(skb,
 +                                              MAC802154_HWSIM_ATTR_RADIO_EDGE);
                if (!nl_edge) {
                        rcu_read_unlock();
                        nla_nest_cancel(skb, nl_edges);
@@@ -422,7 -428,9 +422,7 @@@ static int hwsim_new_edge_nl(struct sk_
            !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
                return -EINVAL;
  
 -      if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
 -                           info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
 -                           hwsim_edge_policy, NULL))
 +      if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL))
                return -EINVAL;
  
        if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID])
@@@ -484,7 -492,9 +484,7 @@@ static int hwsim_del_edge_nl(struct sk_
            !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
                return -EINVAL;
  
 -      if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
 -                           info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
 -                           hwsim_edge_policy, NULL))
 +      if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL))
                return -EINVAL;
  
        if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID])
@@@ -532,7 -542,9 +532,7 @@@ static int hwsim_set_edge_lqi(struct sk
            !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
                return -EINVAL;
  
 -      if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
 -                           info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
 -                           hwsim_edge_policy, NULL))
 +      if (nla_parse_nested_deprecated(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX, info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE], hwsim_edge_policy, NULL))
                return -EINVAL;
  
        if (!edge_attrs[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] &&
@@@ -586,37 -598,37 +586,37 @@@ static const struct nla_policy hwsim_ge
  static const struct genl_ops hwsim_nl_ops[] = {
        {
                .cmd = MAC802154_HWSIM_CMD_NEW_RADIO,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_new_radio_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = MAC802154_HWSIM_CMD_DEL_RADIO,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_del_radio_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = MAC802154_HWSIM_CMD_GET_RADIO,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_get_radio_nl,
                .dumpit = hwsim_dump_radio_nl,
        },
        {
                .cmd = MAC802154_HWSIM_CMD_NEW_EDGE,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_new_edge_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = MAC802154_HWSIM_CMD_DEL_EDGE,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_del_edge_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = MAC802154_HWSIM_CMD_SET_EDGE,
 -              .policy = hwsim_genl_policy,
 +              .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = hwsim_set_edge_lqi,
                .flags = GENL_UNS_ADMIN_PERM,
        },
@@@ -626,7 -638,6 +626,7 @@@ static struct genl_family hwsim_genl_fa
        .name = "MAC802154_HWSIM",
        .version = 1,
        .maxattr = MAC802154_HWSIM_ATTR_MAX,
 +      .policy = hwsim_genl_policy,
        .module = THIS_MODULE,
        .ops = hwsim_nl_ops,
        .n_ops = ARRAY_SIZE(hwsim_nl_ops),
@@@ -802,7 -813,7 +802,7 @@@ static int hwsim_add_one(struct genl_in
                err = hwsim_subscribe_all_others(phy);
                if (err < 0) {
                        mutex_unlock(&hwsim_phys_lock);
-                       goto err_reg;
+                       goto err_subscribe;
                }
        }
        list_add_tail(&phy->list, &hwsim_phys);
  
        return idx;
  
+ err_subscribe:
+       ieee802154_unregister_hw(phy->hw);
  err_reg:
        kfree(pib);
  err_pib:
@@@ -901,9 -914,9 +903,9 @@@ static __init int hwsim_init_module(voi
        return 0;
  
  platform_drv:
-       genl_unregister_family(&hwsim_genl_family);
- platform_dev:
        platform_device_unregister(mac802154hwsim_dev);
+ platform_dev:
+       genl_unregister_family(&hwsim_genl_family);
        return rc;
  }
  
diff --combined net/ieee802154/socket.c
index dacbd58e1799225b389afddca14e5923164202de,1e9876813392e09f13f9e2c97ea5e8d661919017..badc5cfe4dc63e1660696443e7f01e5707e81206
@@@ -1,9 -1,17 +1,9 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * IEEE802154.4 socket interface
   *
   * Copyright 2007, 2008 Siemens AG
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2
 - * as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope that it will be useful,
 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - * GNU General Public License for more details.
 - *
   * Written by:
   * Sergey Lapin <[email protected]>
   * Maxim Gorbachyov <[email protected]>
@@@ -156,6 -164,10 +156,6 @@@ static int ieee802154_sock_ioctl(struc
        struct sock *sk = sock->sk;
  
        switch (cmd) {
 -      case SIOCGSTAMP:
 -              return sock_get_timestamp(sk, (struct timeval __user *)arg);
 -      case SIOCGSTAMPNS:
 -              return sock_get_timestampns(sk, (struct timespec __user *)arg);
        case SIOCGIFADDR:
        case SIOCSIFADDR:
                return ieee802154_dev_ioctl(sk, (struct ifreq __user *)arg,
@@@ -414,7 -426,6 +414,7 @@@ static const struct proto_ops ieee80215
        .getname           = sock_no_getname,
        .poll              = datagram_poll,
        .ioctl             = ieee802154_sock_ioctl,
 +      .gettstamp         = sock_gettstamp,
        .listen            = sock_no_listen,
        .shutdown          = sock_no_shutdown,
        .setsockopt        = sock_common_setsockopt,
@@@ -977,7 -988,6 +977,7 @@@ static const struct proto_ops ieee80215
        .getname           = sock_no_getname,
        .poll              = datagram_poll,
        .ioctl             = ieee802154_sock_ioctl,
 +      .gettstamp         = sock_gettstamp,
        .listen            = sock_no_listen,
        .shutdown          = sock_no_shutdown,
        .setsockopt        = sock_common_setsockopt,
@@@ -1092,7 -1102,7 +1092,7 @@@ static struct packet_type ieee802154_pa
  
  static int __init af_ieee802154_init(void)
  {
-       int rc = -EINVAL;
+       int rc;
  
        rc = proto_register(&ieee802154_raw_prot, 1);
        if (rc)
This page took 0.074287 seconds and 4 git commands to generate.