Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <davem@davemloft.net>

+16 -11
+2 -2
drivers/net/ieee802154/mrf24j40.c
··· 8 8 9 9 #include <linux/spi/spi.h> 10 10 #include <linux/interrupt.h> 11 + #include <linux/mod_devicetable.h> 11 12 #include <linux/module.h> 12 - #include <linux/of.h> 13 13 #include <linux/regmap.h> 14 14 #include <linux/ieee802154.h> 15 15 #include <linux/irq.h> ··· 1388 1388 1389 1389 static struct spi_driver mrf24j40_driver = { 1390 1390 .driver = { 1391 - .of_match_table = of_match_ptr(mrf24j40_of_match), 1391 + .of_match_table = mrf24j40_of_match, 1392 1392 .name = "mrf24j40", 1393 1393 }, 1394 1394 .id_table = mrf24j40_ids,
+6 -4
net/ieee802154/nl-mac.c
··· 680 680 nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) || 681 681 nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER, 682 682 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; 684 685 goto out_free; 686 + } 685 687 686 688 dev_put(dev); 687 689 ··· 1186 1184 { 1187 1185 struct ieee802154_llsec_device *dpos; 1188 1186 struct ieee802154_llsec_device_key *kpos; 1189 - int rc = 0, idx = 0, idx2; 1187 + int idx = 0, idx2; 1190 1188 1191 1189 list_for_each_entry(dpos, &data->table->devices, list) { 1192 1190 if (idx++ < data->s_idx) ··· 1202 1200 data->nlmsg_seq, 1203 1201 dpos->hwaddr, kpos, 1204 1202 data->dev)) { 1205 - return rc = -EMSGSIZE; 1203 + return -EMSGSIZE; 1206 1204 } 1207 1205 1208 1206 data->s_idx2++; ··· 1211 1209 data->s_idx++; 1212 1210 } 1213 1211 1214 - return rc; 1212 + return 0; 1215 1213 } 1216 1214 1217 1215 int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,
+3 -1
net/ieee802154/nl-phy.c
··· 241 241 } 242 242 243 243 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; 245 246 goto nla_put_failure; 247 + } 246 248 dev_put(dev); 247 249 248 250 wpan_phy_put(phy);
+5 -4
net/ieee802154/nl802154.c
··· 1298 1298 if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL)) 1299 1299 return -EINVAL; 1300 1300 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]) 1305 1302 return -EINVAL; 1306 1303 1307 1304 addr->pan_id = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_PAN_ID]); 1308 1305 addr->mode = nla_get_u32(attrs[NL802154_DEV_ADDR_ATTR_MODE]); 1309 1306 switch (addr->mode) { 1310 1307 case NL802154_DEV_ADDR_SHORT: 1308 + if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT]) 1309 + return -EINVAL; 1311 1310 addr->short_addr = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_SHORT]); 1312 1311 break; 1313 1312 case NL802154_DEV_ADDR_EXTENDED: 1313 + if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]) 1314 + return -EINVAL; 1314 1315 addr->extended_addr = nla_get_le64(attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]); 1315 1316 break; 1316 1317 default: