Skip to content

Commit e31d57c

Browse files
committed
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: David S. Miller <[email protected]>
2 parents 821bbf7 + 373e864 commit e31d57c

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

drivers/net/ieee802154/mrf24j40.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <linux/spi/spi.h>
1010
#include <linux/interrupt.h>
11+
#include <linux/mod_devicetable.h>
1112
#include <linux/module.h>
12-
#include <linux/of.h>
1313
#include <linux/regmap.h>
1414
#include <linux/ieee802154.h>
1515
#include <linux/irq.h>
@@ -1388,7 +1388,7 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids);
13881388

13891389
static struct spi_driver mrf24j40_driver = {
13901390
.driver = {
1391-
.of_match_table = of_match_ptr(mrf24j40_of_match),
1391+
.of_match_table = mrf24j40_of_match,
13921392
.name = "mrf24j40",
13931393
},
13941394
.id_table = mrf24j40_ids,

net/ieee802154/nl-mac.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,10 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info)
680680
nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) ||
681681
nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
682682
be32_to_cpu(params.frame_counter)) ||
683-
ieee802154_llsec_fill_key_id(msg, &params.out_key))
683+
ieee802154_llsec_fill_key_id(msg, &params.out_key)) {
684+
rc = -ENOBUFS;
684685
goto out_free;
686+
}
685687

686688
dev_put(dev);
687689

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

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

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

1212-
return rc;
1214+
return 0;
12131215
}
12141216

12151217
int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,

net/ieee802154/nl-phy.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
241241
}
242242

243243
if (nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) ||
244-
nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name))
244+
nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) {
245+
rc = -EMSGSIZE;
245246
goto nla_put_failure;
247+
}
246248
dev_put(dev);
247249

248250
wpan_phy_put(phy);

net/ieee802154/nl802154.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,19 +1298,20 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
12981298
if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL))
12991299
return -EINVAL;
13001300

1301-
if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
1302-
!attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
1303-
!(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
1304-
attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
1301+
if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || !attrs[NL802154_DEV_ADDR_ATTR_MODE])
13051302
return -EINVAL;
13061303

13071304
addr->pan_id = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_PAN_ID]);
13081305
addr->mode = nla_get_u32(attrs[NL802154_DEV_ADDR_ATTR_MODE]);
13091306
switch (addr->mode) {
13101307
case NL802154_DEV_ADDR_SHORT:
1308+
if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT])
1309+
return -EINVAL;
13111310
addr->short_addr = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_SHORT]);
13121311
break;
13131312
case NL802154_DEV_ADDR_EXTENDED:
1313+
if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED])
1314+
return -EINVAL;
13141315
addr->extended_addr = nla_get_le64(attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]);
13151316
break;
13161317
default:

0 commit comments

Comments
 (0)