diff options
| author | Pietro Borrello <borrello@diag.uniroma1.it> | 2023-02-04 17:39:20 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 16:43:40 +0100 |
| commit | 11c9c7227273875422d32f052757ffc24b36e997 (patch) | |
| tree | 03560171c8ebd5a5ed2f027a1d5bb6efe7b343ae /include | |
| parent | 276ccbc15febe57c6582f541ad81fd129759d551 (diff) | |
| download | linux-11c9c7227273875422d32f052757ffc24b36e997.tar.gz linux-11c9c7227273875422d32f052757ffc24b36e997.tar.bz2 linux-11c9c7227273875422d32f052757ffc24b36e997.zip | |
net: add sock_init_data_uid()
[ Upstream commit 584f3742890e966d2f0a1f3c418c9ead70b2d99e ]
Add sock_init_data_uid() to explicitly initialize the socket uid.
To initialise the socket uid, sock_init_data() assumes a the struct
socket* sock is always embedded in a struct socket_alloc, used to
access the corresponding inode uid. This may not be true.
Examples are sockets created in tun_chr_open() and tap_open().
Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.")
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/sock.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index c65baac40548..26dd07e47a7c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1706,7 +1706,12 @@ void sk_common_release(struct sock *sk); * Default socket callbacks and setup code */ -/* Initialise core socket variables */ +/* Initialise core socket variables using an explicit uid. */ +void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid); + +/* Initialise core socket variables. + * Assumes struct socket *sock is embedded in a struct socket_alloc. + */ void sock_init_data(struct socket *sock, struct sock *sk); /* |
