struct bt_skb_cb holds the sender's struct scm_creds for HCI sockets,
which no longer fits into skb->cb now that kuid_t and kgid_t can hold
UUIDs and GUIDs. Like netlink, keep them as struct scm_creds_classic:
classic ids as before, the overflow id for UUID and GUID senders.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jan Koester <[email protected]>
---
 include/net/bluetooth/bluetooth.h | 2 +-
 net/bluetooth/hci_sock.c          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net/bluetooth/bluetooth.h 
b/include/net/bluetooth/bluetooth.h
index b624da5026..2c8fe50f4d 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -497,7 +497,7 @@ struct bt_skb_cb {
                struct l2cap_ctrl l2cap;
                struct hci_ctrl hci;
                struct mgmt_ctrl mgmt;
-               struct scm_creds creds;
+               struct scm_creds_classic creds;
        };
 };
 #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 81068b5857..9f422ae5fd 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -276,7 +276,7 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff 
*skb)
 
 static void hci_sock_copy_creds(struct sock *sk, struct sk_buff *skb)
 {
-       struct scm_creds *creds;
+       struct scm_creds_classic *creds;
 
        if (!sk || WARN_ON(!skb))
                return;
@@ -300,8 +300,8 @@ static void hci_sock_copy_creds(struct sock *sk, struct 
sk_buff *skb)
 
        creds->pid = pid_vnr(sk->sk_peer_pid);
        if (sk->sk_peer_cred) {
-               creds->uid = sk->sk_peer_cred->uid;
-               creds->gid = sk->sk_peer_cred->gid;
+               creds->uid = __kuid_val(sk->sk_peer_cred->uid);
+               creds->gid = __kgid_val(sk->sk_peer_cred->gid);
        }
 }
 
@@ -1615,7 +1615,7 @@ static int hci_sock_recvmsg(struct socket *sock, struct 
msghdr *msg,
        }
 
        memset(&scm, 0, sizeof(scm));
-       scm.creds = bt_cb(skb)->creds;
+       scm_creds_from_classic(&scm.creds, &bt_cb(skb)->creds);
 
        skb_free_datagram(sk, skb);
 
-- 
2.56.0


Reply via email to