linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] bluetooth: don't write directly to netdev->dev_addr
@ 2021-10-22 17:42 Jakub Kicinski
  2021-10-22 17:42 ` [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
  2021-10-22 17:42 ` [PATCH net-next 2/2] bluetooth: use dev_addr_set() Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 17:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-bluetooth, marcel, Jakub Kicinski

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.

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(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set()
  2021-10-22 17:42 [PATCH net-next 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
@ 2021-10-22 17:42 ` Jakub Kicinski
  2021-10-22 18:11   ` bluetooth: don't write directly to netdev->dev_addr bluez.test.bot
  2021-10-22 17:42 ` [PATCH net-next 2/2] bluetooth: use dev_addr_set() Jakub Kicinski
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 17:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-bluetooth, marcel, Jakub Kicinski

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 got 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)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/bnep/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 72f47b372705..c9add7753b9f 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -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;
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] bluetooth: use dev_addr_set()
  2021-10-22 17:42 [PATCH net-next 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
  2021-10-22 17:42 ` [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
@ 2021-10-22 17:42 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 17:42 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-bluetooth, marcel, Jakub Kicinski, johan.hedberg,
	luiz.dentz

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 got through appropriate helpers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
CC: marcel@holtmann.org
CC: johan.hedberg@gmail.com
CC: luiz.dentz@gmail.com
CC: linux-bluetooth@vger.kernel.org
---
 net/bluetooth/6lowpan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index fd164a248569..133d7ea063fb 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -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);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: bluetooth: don't write directly to netdev->dev_addr
  2021-10-22 17:42 ` [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
@ 2021-10-22 18:11   ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-10-22 18:11 UTC (permalink / raw)
  To: linux-bluetooth, kuba

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=568737

---Test result---

Test Summary:
CheckPatch                    PASS      1.38 seconds
GitLint                       PASS      0.72 seconds
BuildKernel                   FAIL      533.55 seconds
TestRunner: Setup             PASS      424.84 seconds
TestRunner: l2cap-tester      PASS      8.46 seconds
TestRunner: bnep-tester       PASS      4.73 seconds
TestRunner: mgmt-tester       PASS      43.03 seconds
TestRunner: rfcomm-tester     PASS      5.60 seconds
TestRunner: sco-tester        PASS      6.05 seconds
TestRunner: smp-tester        PASS      5.72 seconds
TestRunner: userchan-tester   PASS      4.91 seconds

Details
##############################
Test: BuildKernel - FAIL - 533.55 seconds
Build Kernel with minimal configuration supports Bluetooth
net/bluetooth/6lowpan.c: In function ‘setup_netdev’:
net/bluetooth/6lowpan.c:677:25: error: passing argument 2 of ‘__dev_addr_set’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  677 |  __dev_addr_set(netdev, &addr, sizeof(addr));
      |                         ^~~~~
      |                         |
      |                         bdaddr_t * {aka struct <anonymous> *}
In file included from ./include/uapi/linux/if_arp.h:27,
                 from ./include/linux/if_arp.h:23,
                 from net/bluetooth/6lowpan.c:7:
./include/linux/netdevice.h:4645:50: note: expected ‘const u8 *’ {aka ‘const unsigned char *’} but argument is of type ‘bdaddr_t *’ {aka ‘struct <anonymous> *’}
 4645 | __dev_addr_set(struct net_device *dev, const u8 *addr, size_t len)
      |                                        ~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:277: net/bluetooth/6lowpan.o] Error 1
make[1]: *** [scripts/Makefile.build:540: net/bluetooth] Error 2
make: *** [Makefile:1868: net] Error 2




---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44357 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3564 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 353167 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11684 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 13924 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11830 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 6372 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-22 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 17:42 [PATCH net-next 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
2021-10-22 17:42 ` [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
2021-10-22 18:11   ` bluetooth: don't write directly to netdev->dev_addr bluez.test.bot
2021-10-22 17:42 ` [PATCH net-next 2/2] bluetooth: use dev_addr_set() Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).