]> git.baikalelectronics.ru Git - kernel.git/commit
net: add sock_init_data_uid()
authorPietro Borrello <borrello@diag.uniroma1.it>
Sat, 4 Feb 2023 17:39:20 +0000 (17:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:40 +0000 (16:43 +0100)
commit5a5d1a751b75e4c79bb3c2d45f935378667363b7
tree03560171c8ebd5a5ed2f027a1d5bb6efe7b343ae
parenta32a49b1bc4151eb454ba6171237006ade33f11c
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: dde05766deb1 ("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>
include/net/sock.h
net/core/sock.c