bluetooth: don't write directly to netdev->dev_addr
Subsystems (4)
Jakub Kicinski
maintainerv2 cover bluetooth: don't write directly to netdev->dev_addr
The usual conversions.
These are intended to be merged to net-next directly, because bluetooth tree is missing one of the pre-req changes at the moment.
v2: s/got/go/
Jakub Kicinski (2):
bluetooth: use eth_hw_addr_set()
bluetooth: use dev_addr_set()
net/bluetooth/6lowpan.c | 4 +++- net/bluetooth/bnep/core.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH v2 1/2 bluetooth: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.
Convert bluetooth from memcpy(... ETH_ADDR) to eth_hw_addr_set():
@@
expression dev, np;
@@
- memcpy(dev->dev_addr, np, ETH_ALEN)
+ eth_hw_addr_set(dev, np)
--- net/bluetooth/bnep/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/bnep/core.c +1 -1
@@ -594,7 +594,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)* ie. eh.h_dest is our local address. */ memcpy (s->eh.h_dest, &src,ETH_ALEN );memcpy (s->eh.h_source, &dst,ETH_ALEN ); -memcpy (dev->dev_addr, s->eh.h_dest,ETH_ALEN ); +eth_hw_addr_set (dev, s->eh.h_dest); s->dev = dev; s->sock = sock;
Signature · 1 line
2.31.1
Jakub Kicinski
maintainerPATCH v2 2/2 bluetooth: use dev_addr_set()
In reply to Jakub KicinskiCommit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- net/bluetooth/6lowpan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/6lowpan.c +3 -1
@@ -663,6 +663,7 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan,static int setup_netdev (struct l2cap_chan *chan,struct lowpan_btle_dev **dev) {struct net_device *netdev; +bdaddr_t addr;int err; netdev = alloc_netdev(LOWPAN_PRIV_SIZE(sizeof(struct lowpan_btle_dev)),
@@ -672,7 +673,8 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_btle_dev **dev)return -ENOMEM ; netdev->addr_assign_type =NET_ADDR_PERM ; -baswap ((void *)netdev->dev_addr, &chan->src); +baswap (&addr, &chan->src); +__dev_addr_set (netdev, &addr,sizeof (addr)); netdev->netdev_ops = &netdev_ops;SET_NETDEV_DEV (netdev, &chan->conn->hcon->hdev->dev);
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 22 Oct 2021 16:18:32 -0700 you wrote:
The usual conversions.
These are intended to be merged to net-next directly, because bluetooth tree is missing one of the pre-req changes at the moment.
v2: s/got/go/
[...]
Here is the summary with links:
- [net-next,v2,1/2] bluetooth: use eth_hw_addr_set()
https://git.kernel.org/netdev/net-next/c/08c181f052ed - [net-next,v2,2/2] bluetooth: use dev_addr_set() https://git.kernel.org/netdev/net-next/c/a1916d34462f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html