* [PATCH] Bluetooth: L2CAP: Fix not initializing sk_peer_pid
@ 2021-10-07 20:26 Luiz Augusto von Dentz
2021-10-07 21:05 ` bluez.test.bot
2021-10-12 15:39 ` [PATCH] " Marcel Holtmann
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2021-10-07 20:26 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In order to group sockets being connected using L2CAP_MODE_EXT_FLOWCTL
the pid is used but sk_peer_pid was not being initialized as it is
currently only done for af_unix.
Fixes: b48596d1dc25 "Bluetooth: L2CAP: Add get_peer_pid callback"
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/l2cap_sock.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 160c016a5dfb..4574c5cb1b59 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -172,6 +172,21 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
return err;
}
+static void l2cap_sock_init_pid(struct sock *sk)
+{
+ struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+
+ /* Only L2CAP_MODE_EXT_FLOWCTL ever need to access the PID in order to
+ * group the channels being requested.
+ */
+ if (chan->mode != L2CAP_MODE_EXT_FLOWCTL)
+ return;
+
+ spin_lock(&sk->sk_peer_lock);
+ sk->sk_peer_pid = get_pid(task_tgid(current));
+ spin_unlock(&sk->sk_peer_lock);
+}
+
static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
int alen, int flags)
{
@@ -243,6 +258,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
if (chan->psm && bdaddr_type_is_le(chan->src_type) && !chan->mode)
chan->mode = L2CAP_MODE_LE_FLOWCTL;
+ l2cap_sock_init_pid(sk);
+
err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
&la.l2_bdaddr, la.l2_bdaddr_type);
if (err)
@@ -298,6 +315,8 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
goto done;
}
+ l2cap_sock_init_pid(sk);
+
sk->sk_max_ack_backlog = backlog;
sk->sk_ack_backlog = 0;
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: L2CAP: Fix not initializing sk_peer_pid
2021-10-07 20:26 [PATCH] Bluetooth: L2CAP: Fix not initializing sk_peer_pid Luiz Augusto von Dentz
@ 2021-10-07 21:05 ` bluez.test.bot
2021-10-12 15:39 ` [PATCH] " Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-10-07 21:05 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 935 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=559443
---Test result---
Test Summary:
CheckPatch PASS 1.76 seconds
GitLint PASS 0.94 seconds
BuildKernel PASS 593.46 seconds
TestRunner: Setup PASS 436.74 seconds
TestRunner: l2cap-tester PASS 9.80 seconds
TestRunner: bnep-tester PASS 5.12 seconds
TestRunner: mgmt-tester PASS 83.76 seconds
TestRunner: rfcomm-tester PASS 6.40 seconds
TestRunner: sco-tester PASS 6.65 seconds
TestRunner: smp-tester PASS 6.41 seconds
TestRunner: userchan-tester PASS 5.60 seconds
---
Regards,
Linux Bluetooth
[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44356 bytes --]
[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3563 bytes --]
[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 637809 bytes --]
[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11683 bytes --]
[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 13923 bytes --]
[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11829 bytes --]
[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 6371 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: L2CAP: Fix not initializing sk_peer_pid
2021-10-07 20:26 [PATCH] Bluetooth: L2CAP: Fix not initializing sk_peer_pid Luiz Augusto von Dentz
2021-10-07 21:05 ` bluez.test.bot
@ 2021-10-12 15:39 ` Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2021-10-12 15:39 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
> In order to group sockets being connected using L2CAP_MODE_EXT_FLOWCTL
> the pid is used but sk_peer_pid was not being initialized as it is
> currently only done for af_unix.
>
> Fixes: b48596d1dc25 "Bluetooth: L2CAP: Add get_peer_pid callback"
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> net/bluetooth/l2cap_sock.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-12 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 20:26 [PATCH] Bluetooth: L2CAP: Fix not initializing sk_peer_pid Luiz Augusto von Dentz
2021-10-07 21:05 ` bluez.test.bot
2021-10-12 15:39 ` [PATCH] " Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.