* Re: [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it
2025-07-01 12:22 [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it Greg Kroah-Hartman
@ 2025-07-01 12:42 ` Stefano Garzarella
2025-07-01 12:56 ` Greg Kroah-Hartman
2025-07-03 10:51 ` Stefano Garzarella
2025-07-03 11:00 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Stefano Garzarella @ 2025-07-01 12:42 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: netdev, linux-kernel, HarshaVardhana S A, Bryan Tan, Vishnu Dasa,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, virtualization, stable
On Tue, Jul 01, 2025 at 02:22:54PM +0200, Greg Kroah-Hartman wrote:
>From: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>
>In vmci_transport_packet_init memset the vmci_transport_packet before
>populating the fields to avoid any uninitialised data being left in the
>structure.
Usually I would suggest inserting a Fixes tag, but if you didn't put it,
there's probably a reason :-)
If we are going to add it, I think it should be:
Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
>
>Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
>Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
>Cc: Broadcom internal kernel review list
>Cc: Stefano Garzarella <sgarzare@redhat.com>
>Cc: "David S. Miller" <davem@davemloft.net>
>Cc: Eric Dumazet <edumazet@google.com>
>Cc: Jakub Kicinski <kuba@kernel.org>
>Cc: Paolo Abeni <pabeni@redhat.com>
>Cc: Simon Horman <horms@kernel.org>
>Cc: virtualization@lists.linux.dev
>Cc: netdev@vger.kernel.org
>Cc: stable <stable@kernel.org>
>Signed-off-by: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>---
>Tweaked from original version by rewording the text and adding a blank
>line and correctly sending it to the proper people for inclusion in net.
>
> net/vmw_vsock/vmci_transport.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
>index b370070194fa..7eccd6708d66 100644
>--- a/net/vmw_vsock/vmci_transport.c
>+++ b/net/vmw_vsock/vmci_transport.c
>@@ -119,6 +119,8 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
> u16 proto,
> struct vmci_handle handle)
> {
>+ memset(pkt, 0, sizeof(*pkt));
>+
> /* We register the stream control handler as an any cid handle so we
> * must always send from a source address of VMADDR_CID_ANY
> */
>@@ -131,8 +133,6 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
> pkt->type = type;
> pkt->src_port = src->svm_port;
> pkt->dst_port = dst->svm_port;
>- memset(&pkt->proto, 0, sizeof(pkt->proto));
>- memset(&pkt->_reserved2, 0, sizeof(pkt->_reserved2));
Should we also remove some `case`s in the following switch?
I mean something like this:
diff --git a/net/vmw_vsock/vmci_transport.c
b/net/vmw_vsock/vmci_transport.c
index b370070194fa..d821ddcc62d8 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -135,10 +135,6 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
memset(&pkt->_reserved2, 0, sizeof(pkt->_reserved2));
switch (pkt->type) {
- case VMCI_TRANSPORT_PACKET_TYPE_INVALID:
- pkt->u.size = 0;
- break;
-
case VMCI_TRANSPORT_PACKET_TYPE_REQUEST:
case VMCI_TRANSPORT_PACKET_TYPE_NEGOTIATE:
pkt->u.size = size;
@@ -149,12 +145,6 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
pkt->u.handle = handle;
break;
- case VMCI_TRANSPORT_PACKET_TYPE_WROTE:
- case VMCI_TRANSPORT_PACKET_TYPE_READ:
- case VMCI_TRANSPORT_PACKET_TYPE_RST:
- pkt->u.size = 0;
- break;
-
case VMCI_TRANSPORT_PACKET_TYPE_SHUTDOWN:
pkt->u.mode = mode;
break;
Thanks,
Stefano
>
> switch (pkt->type) {
> case VMCI_TRANSPORT_PACKET_TYPE_INVALID:
>--
>2.50.0
>
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it
2025-07-01 12:42 ` Stefano Garzarella
@ 2025-07-01 12:56 ` Greg Kroah-Hartman
2025-07-03 10:50 ` Stefano Garzarella
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-01 12:56 UTC (permalink / raw)
To: Stefano Garzarella
Cc: netdev, linux-kernel, HarshaVardhana S A, Bryan Tan, Vishnu Dasa,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, virtualization, stable
On Tue, Jul 01, 2025 at 02:42:10PM +0200, Stefano Garzarella wrote:
> On Tue, Jul 01, 2025 at 02:22:54PM +0200, Greg Kroah-Hartman wrote:
> > From: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
> >
> > In vmci_transport_packet_init memset the vmci_transport_packet before
> > populating the fields to avoid any uninitialised data being left in the
> > structure.
>
> Usually I would suggest inserting a Fixes tag, but if you didn't put it,
> there's probably a reason :-)
>
> If we are going to add it, I think it should be:
>
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Yeah, I didn't think it was needed as this is obviously a "ever since
this file has been there" type of thing, so it will be backported
everywhere once it hits Linus's tree.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it
2025-07-01 12:56 ` Greg Kroah-Hartman
@ 2025-07-03 10:50 ` Stefano Garzarella
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2025-07-03 10:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: netdev, linux-kernel, HarshaVardhana S A, Bryan Tan, Vishnu Dasa,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, virtualization, stable
On Tue, Jul 01, 2025 at 02:56:14PM +0200, Greg Kroah-Hartman wrote:
>On Tue, Jul 01, 2025 at 02:42:10PM +0200, Stefano Garzarella wrote:
>> On Tue, Jul 01, 2025 at 02:22:54PM +0200, Greg Kroah-Hartman wrote:
>> > From: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>> >
>> > In vmci_transport_packet_init memset the vmci_transport_packet before
>> > populating the fields to avoid any uninitialised data being left in the
>> > structure.
>>
>> Usually I would suggest inserting a Fixes tag, but if you didn't put it,
>> there's probably a reason :-)
>>
>> If we are going to add it, I think it should be:
>>
>> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
>
>Yeah, I didn't think it was needed as this is obviously a "ever since
>this file has been there" type of thing, so it will be backported
>everywhere once it hits Linus's tree.
I see, thanks!
Stefano
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it
2025-07-01 12:22 [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it Greg Kroah-Hartman
2025-07-01 12:42 ` Stefano Garzarella
@ 2025-07-03 10:51 ` Stefano Garzarella
2025-07-03 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2025-07-03 10:51 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: netdev, linux-kernel, HarshaVardhana S A, Bryan Tan, Vishnu Dasa,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, virtualization, stable
On Tue, Jul 01, 2025 at 02:22:54PM +0200, Greg Kroah-Hartman wrote:
>From: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>
>In vmci_transport_packet_init memset the vmci_transport_packet before
>populating the fields to avoid any uninitialised data being left in the
>structure.
>
>Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
>Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
>Cc: Broadcom internal kernel review list
>Cc: Stefano Garzarella <sgarzare@redhat.com>
>Cc: "David S. Miller" <davem@davemloft.net>
>Cc: Eric Dumazet <edumazet@google.com>
>Cc: Jakub Kicinski <kuba@kernel.org>
>Cc: Paolo Abeni <pabeni@redhat.com>
>Cc: Simon Horman <horms@kernel.org>
>Cc: virtualization@lists.linux.dev
>Cc: netdev@vger.kernel.org
>Cc: stable <stable@kernel.org>
>Signed-off-by: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>---
>Tweaked from original version by rewording the text and adding a blank
>line and correctly sending it to the proper people for inclusion in net.
>
> net/vmw_vsock/vmci_transport.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Patch LGTM, we can fix the switch later.
Stefano
>
>diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
>index b370070194fa..7eccd6708d66 100644
>--- a/net/vmw_vsock/vmci_transport.c
>+++ b/net/vmw_vsock/vmci_transport.c
>@@ -119,6 +119,8 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
> u16 proto,
> struct vmci_handle handle)
> {
>+ memset(pkt, 0, sizeof(*pkt));
>+
> /* We register the stream control handler as an any cid handle so we
> * must always send from a source address of VMADDR_CID_ANY
> */
>@@ -131,8 +133,6 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
> pkt->type = type;
> pkt->src_port = src->svm_port;
> pkt->dst_port = dst->svm_port;
>- memset(&pkt->proto, 0, sizeof(pkt->proto));
>- memset(&pkt->_reserved2, 0, sizeof(pkt->_reserved2));
>
> switch (pkt->type) {
> case VMCI_TRANSPORT_PACKET_TYPE_INVALID:
>--
>2.50.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it
2025-07-01 12:22 [PATCH net] vsock/vmci: Clear the vmci transport packet properly when initializing it Greg Kroah-Hartman
2025-07-01 12:42 ` Stefano Garzarella
2025-07-03 10:51 ` Stefano Garzarella
@ 2025-07-03 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-03 11:00 UTC (permalink / raw)
To: Greg KH
Cc: netdev, linux-kernel, harshavardhana.sa, bryan-bt.tan,
vishnu.dasa, sgarzare, davem, edumazet, kuba, pabeni, horms,
virtualization, stable
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 1 Jul 2025 14:22:54 +0200 you wrote:
> From: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
>
> In vmci_transport_packet_init memset the vmci_transport_packet before
> populating the fields to avoid any uninitialised data being left in the
> structure.
>
> Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
> Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
> Cc: Broadcom internal kernel review list
> Cc: Stefano Garzarella <sgarzare@redhat.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Simon Horman <horms@kernel.org>
> Cc: virtualization@lists.linux.dev
> Cc: netdev@vger.kernel.org
> Cc: stable <stable@kernel.org>
> Signed-off-by: HarshaVardhana S A <harshavardhana.sa@broadcom.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> [...]
Here is the summary with links:
- [net] vsock/vmci: Clear the vmci transport packet properly when initializing it
https://git.kernel.org/netdev/net/c/223e2288f4b8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread