[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGxU2F4n7arHPJ3SpbpJzk1qoT1rQ57Ki3ZjeHquew+_SpRd_A@mail.gmail.com>
Date: Tue, 26 Oct 2021 13:16:47 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Marc-André Lureau <marcandre.lureau@...hat.com>
Cc: netdev <netdev@...r.kernel.org>,
kernel list <linux-kernel@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jorgen Hansen <jhansen@...are.com>
Subject: Re: [PATCH 03/10] vsock: owner field is specific to VMCI
CCing Jorgen.
On Thu, Oct 21, 2021 at 04:37:07PM +0400, Marc-André Lureau wrote:
>This field isn't used by other transports.
If the field is used only in the VMCI transport, maybe it's better to
move the field and the code in that transport.
Thanks,
Stefano
>
>Signed-off-by: Marc-André Lureau <marcandre.lureau@...hat.com>
>---
> include/net/af_vsock.h | 2 ++
> net/vmw_vsock/af_vsock.c | 6 ++++++
> 2 files changed, 8 insertions(+)
>
>diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
>index ab207677e0a8..e626d9484bc5 100644
>--- a/include/net/af_vsock.h
>+++ b/include/net/af_vsock.h
>@@ -41,7 +41,9 @@ struct vsock_sock {
> * cached peer?
> */
> u32 cached_peer; /* Context ID of last dgram destination check. */
>+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS)
> const struct cred *owner;
>+#endif
> /* Rest are SOCK_STREAM only. */
> long connect_timeout;
> /* Listening socket that this came from. */
>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>index e2c0cfb334d2..1925682a942a 100644
>--- a/net/vmw_vsock/af_vsock.c
>+++ b/net/vmw_vsock/af_vsock.c
>@@ -761,7 +761,9 @@ static struct sock *__vsock_create(struct net *net,
> psk = parent ? vsock_sk(parent) : NULL;
> if (parent) {
> vsk->trusted = psk->trusted;
>+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS)
> vsk->owner = get_cred(psk->owner);
>+#endif
> vsk->connect_timeout = psk->connect_timeout;
> vsk->buffer_size = psk->buffer_size;
> vsk->buffer_min_size = psk->buffer_min_size;
>@@ -769,7 +771,9 @@ static struct sock *__vsock_create(struct net *net,
> security_sk_clone(parent, sk);
> } else {
> vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN);
>+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS)
> vsk->owner = get_current_cred();
>+#endif
> vsk->connect_timeout = VSOCK_DEFAULT_CONNECT_TIMEOUT;
> vsk->buffer_size = VSOCK_DEFAULT_BUFFER_SIZE;
> vsk->buffer_min_size = VSOCK_DEFAULT_BUFFER_MIN_SIZE;
>@@ -833,7 +837,9 @@ static void vsock_sk_destruct(struct sock *sk)
> vsock_addr_init(&vsk->local_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY);
> vsock_addr_init(&vsk->remote_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY);
>
>+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS)
> put_cred(vsk->owner);
>+#endif
> }
>
> static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
>--
>2.33.0.721.g106298f7f9
>
Powered by blists - more mailing lists