Commit e31d57ca authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'ieee802154-for-davem-2021-06-03' of...

Merge tag 'ieee802154-for-davem-2021-06-03' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan



Stefan Schmidt says:

====================
An update from ieee802154 for your *net* tree.

This time we have fixes for the ieee802154 netlink code, as well as a driver
fix. Zhen Lei, Wei Yongjun and Yang Li each had  a patch to cleanup some return
code handling ensuring we actually get a real error code when things fails.

Dan Robertson fixed a potential null dereference in our netlink handling.

Andy Shevchenko removed of_match_ptr()usage in the mrf24j40 driver.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 821bbf79 373e864c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@

#include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/ieee802154.h>
#include <linux/irq.h>
@@ -1388,7 +1388,7 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids);

static struct spi_driver mrf24j40_driver = {
	.driver = {
		.of_match_table = of_match_ptr(mrf24j40_of_match),
		.of_match_table = mrf24j40_of_match,
		.name = "mrf24j40",
	},
	.id_table = mrf24j40_ids,
+6 −4
Original line number Diff line number Diff line
@@ -680,8 +680,10 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info)
	    nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) ||
	    nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
			be32_to_cpu(params.frame_counter)) ||
	    ieee802154_llsec_fill_key_id(msg, &params.out_key))
	    ieee802154_llsec_fill_key_id(msg, &params.out_key)) {
		rc = -ENOBUFS;
		goto out_free;
	}

	dev_put(dev);

@@ -1184,7 +1186,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
{
	struct ieee802154_llsec_device *dpos;
	struct ieee802154_llsec_device_key *kpos;
	int rc = 0, idx = 0, idx2;
	int idx = 0, idx2;

	list_for_each_entry(dpos, &data->table->devices, list) {
		if (idx++ < data->s_idx)
@@ -1200,7 +1202,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
						      data->nlmsg_seq,
						      dpos->hwaddr, kpos,
						      data->dev)) {
				return rc = -EMSGSIZE;
				return -EMSGSIZE;
			}

			data->s_idx2++;
@@ -1209,7 +1211,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
		data->s_idx++;
	}

	return rc;
	return 0;
}

int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,
+3 −1
Original line number Diff line number Diff line
@@ -241,8 +241,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
	}

	if (nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) ||
	    nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name))
	    nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) {
		rc = -EMSGSIZE;
		goto nla_put_failure;
	}
	dev_put(dev);

	wpan_phy_put(phy);
+5 −4
Original line number Diff line number Diff line
@@ -1298,19 +1298,20 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
	if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL))
		return -EINVAL;

	if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
	    !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
	    !(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
	      attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
	if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || !attrs[NL802154_DEV_ADDR_ATTR_MODE])
		return -EINVAL;

	addr->pan_id = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_PAN_ID]);
	addr->mode = nla_get_u32(attrs[NL802154_DEV_ADDR_ATTR_MODE]);
	switch (addr->mode) {
	case NL802154_DEV_ADDR_SHORT:
		if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT])
			return -EINVAL;
		addr->short_addr = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_SHORT]);
		break;
	case NL802154_DEV_ADDR_EXTENDED:
		if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED])
			return -EINVAL;
		addr->extended_addr = nla_get_le64(attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]);
		break;
	default: