[SRU,Trusty,3/3] VSOCK: Detach QP check should filter out non matching QPs.

Message ID 20180731135000.6114-4-eric.desrochers@canonical.com
State New
Headers show
Series
  • BUG: scheduling while atomic on VMware 6.0 and late.
Related show

Commit Message

Eric Desrochers July 31, 2018, 1:50 p.m.
BugLink: https://bugs.launchpad.net/bugs/1780470

The check in vmci_transport_peer_detach_cb should only allow a
detach when the qp handle of the transport matches the one in
the detach message.

Testing: Before this change, a detach from a peer on a different
socket would cause an active stream socket to register a detach.

Reviewed-by: George Zhang <georgezhang@vmware.com>
Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from 8ab18d71de8b07d2c4d6f984b718418c09ea45c5)
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
---
 net/vmw_vsock/vmci_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kleber Souza Aug. 21, 2018, 12:50 p.m. | #1
On 07/31/18 15:50, Eric Desrochers wrote:
> BugLink: https://bugs.launchpad.net/bugs/1780470
> 
> The check in vmci_transport_peer_detach_cb should only allow a
> detach when the qp handle of the transport matches the one in
> the detach message.
> 
> Testing: Before this change, a detach from a peer on a different
> socket would cause an active stream socket to register a detach.
> 
> Reviewed-by: George Zhang <georgezhang@vmware.com>
> Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from 8ab18d71de8b07d2c4d6f984b718418c09ea45c5)
> Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
> ---
>  net/vmw_vsock/vmci_transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
> index 0d1fa05cc8ed..e0436a962789 100644
> --- a/net/vmw_vsock/vmci_transport.c
> +++ b/net/vmw_vsock/vmci_transport.c
> @@ -844,7 +844,7 @@ static void vmci_transport_peer_detach_cb(u32 sub_id,
>  	 * qp_handle.
>  	 */
>  	if (vmci_handle_is_invalid(e_payload->handle) ||
> -	    vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
> +	    !vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
>  		return;
>  
>  	/* We don't ask for delayed CBs when we subscribe to this event (we
> 

Any reason why the following part of the patch has been left out?

@@ -2154,7 +2154,7 @@ module_exit(vmci_transport_exit);

 MODULE_AUTHOR("VMware, Inc.");
 MODULE_DESCRIPTION("VMCI transport for Virtual Sockets");
-MODULE_VERSION("1.0.2.0-k");
+MODULE_VERSION("1.0.3.0-k");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("vmware_vsock");
 MODULE_ALIAS_NETPROTO(PF_VSOCK);


If that change was on purpose it needs to be documented (changing
"cherry picked from" to "backported from" and adding a backport note).


Thanks,
Kleber
Eric Desrochers Aug. 21, 2018, 12:55 p.m. | #2
I didn't want to introduce a new MODULE_VERSION inside an SRU on purpose.
Yes, it's supposed to be a backport.

Thanks,
Eric

On Tue, Aug 21, 2018 at 8:50 AM, Kleber Souza <kleber.souza@canonical.com>
wrote:

> On 07/31/18 15:50, Eric Desrochers wrote:
> > BugLink: https://bugs.launchpad.net/bugs/1780470
> >
> > The check in vmci_transport_peer_detach_cb should only allow a
> > detach when the qp handle of the transport matches the one in
> > the detach message.
> >
> > Testing: Before this change, a detach from a peer on a different
> > socket would cause an active stream socket to register a detach.
> >
> > Reviewed-by: George Zhang <georgezhang@vmware.com>
> > Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > (cherry picked from 8ab18d71de8b07d2c4d6f984b718418c09ea45c5)
> > Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
> > ---
> >  net/vmw_vsock/vmci_transport.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_
> transport.c
> > index 0d1fa05cc8ed..e0436a962789 100644
> > --- a/net/vmw_vsock/vmci_transport.c
> > +++ b/net/vmw_vsock/vmci_transport.c
> > @@ -844,7 +844,7 @@ static void vmci_transport_peer_detach_cb(u32
> sub_id,
> >        * qp_handle.
> >        */
> >       if (vmci_handle_is_invalid(e_payload->handle) ||
> > -         vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
> > +         !vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
> >               return;
> >
> >       /* We don't ask for delayed CBs when we subscribe to this event (we
> >
>
> Any reason why the following part of the patch has been left out?
>
> @@ -2154,7 +2154,7 @@ module_exit(vmci_transport_exit);
>
>  MODULE_AUTHOR("VMware, Inc.");
>  MODULE_DESCRIPTION("VMCI transport for Virtual Sockets");
> -MODULE_VERSION("1.0.2.0-k");
> +MODULE_VERSION("1.0.3.0-k");
>  MODULE_LICENSE("GPL v2");
>  MODULE_ALIAS("vmware_vsock");
>  MODULE_ALIAS_NETPROTO(PF_VSOCK);
>
>
> If that change was on purpose it needs to be documented (changing
> "cherry picked from" to "backported from" and adding a backport note).
>
>
> Thanks,
> Kleber
>
<div dir="ltr">I didn&#39;t want to introduce a new MODULE_VERSION inside an SRU on purpose.<div>Yes, it&#39;s supposed to be a backport.</div><div><br></div><div>Thanks,</div><div>Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 21, 2018 at 8:50 AM, Kleber Souza <span dir="ltr">&lt;<a href="mailto:kleber.souza@canonical.com" target="_blank">kleber.souza@canonical.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 07/31/18 15:50, Eric Desrochers wrote:<br>
&gt; BugLink: <a href="https://bugs.launchpad.net/bugs/1780470" rel="noreferrer" target="_blank">https://bugs.launchpad.net/<wbr>bugs/1780470</a><br>
&gt; <br>
&gt; The check in vmci_transport_peer_detach_cb should only allow a<br>
&gt; detach when the qp handle of the transport matches the one in<br>
&gt; the detach message.<br>
&gt; <br>
&gt; Testing: Before this change, a detach from a peer on a different<br>
&gt; socket would cause an active stream socket to register a detach.<br>
&gt; <br>
&gt; Reviewed-by: George Zhang &lt;<a href="mailto:georgezhang@vmware.com">georgezhang@vmware.com</a>&gt;<br>
&gt; Signed-off-by: Jorgen Hansen &lt;<a href="mailto:jhansen@vmware.com">jhansen@vmware.com</a>&gt;<br>
&gt; Signed-off-by: David S. Miller &lt;<a href="mailto:davem@davemloft.net">davem@davemloft.net</a>&gt;<br>
&gt; (cherry picked from 8ab18d71de8b07d2c4d6f984b71841<wbr>8c09ea45c5)<br>
&gt; Signed-off-by: Eric Desrochers &lt;<a href="mailto:eric.desrochers@canonical.com">eric.desrochers@canonical.com</a><wbr>&gt;<br>
&gt; ---<br>
&gt;  net/vmw_vsock/vmci_transport.c | 2 +-<br>
&gt;  1 file changed, 1 insertion(+), 1 deletion(-)<br>
&gt; <br>
&gt; diff --git a/net/vmw_vsock/vmci_<wbr>transport.c b/net/vmw_vsock/vmci_<wbr>transport.c<br>
&gt; index 0d1fa05cc8ed..e0436a962789 100644<br>
&gt; --- a/net/vmw_vsock/vmci_<wbr>transport.c<br>
&gt; +++ b/net/vmw_vsock/vmci_<wbr>transport.c<br>
&gt; @@ -844,7 +844,7 @@ static void vmci_transport_peer_detach_cb(<wbr>u32 sub_id,<br>
&gt;        * qp_handle.<br>
&gt;        */<br>
&gt;       if (vmci_handle_is_invalid(e_<wbr>payload-&gt;handle) ||<br>
&gt; -         vmci_handle_is_equal(trans-&gt;<wbr>qp_handle, e_payload-&gt;handle))<br>
&gt; +         !vmci_handle_is_equal(trans-&gt;<wbr>qp_handle, e_payload-&gt;handle))<br>
&gt;               return;<br>
&gt;  <br>
&gt;       /* We don&#39;t ask for delayed CBs when we subscribe to this event (we<br>
&gt; <br>
<br>
</div></div>Any reason why the following part of the patch has been left out?<br>
<br>
@@ -2154,7 +2154,7 @@ module_exit(vmci_transport_<wbr>exit);<br>
<br>
 MODULE_AUTHOR(&quot;VMware, Inc.&quot;);<br>
 MODULE_DESCRIPTION(&quot;VMCI transport for Virtual Sockets&quot;);<br>
-MODULE_VERSION(&quot;1.0.2.0-k&quot;);<br>
+MODULE_VERSION(&quot;1.0.3.0-k&quot;);<br>
 MODULE_LICENSE(&quot;GPL v2&quot;);<br>
 MODULE_ALIAS(&quot;vmware_vsock&quot;);<br>
 MODULE_ALIAS_NETPROTO(PF_<wbr>VSOCK);<br>
<br>
<br>
If that change was on purpose it needs to be documented (changing<br>
&quot;cherry picked from&quot; to &quot;backported from&quot; and adding a backport note).<br>
<br>
<br>
Thanks,<br>
Kleber<br>
</blockquote></div><br></div>
Kleber Souza Aug. 24, 2018, 9:57 a.m. | #3
On 07/31/18 15:50, Eric Desrochers wrote:

There's no "From ..." at the beginning of the body, so the authorship of
the patch is wrongly assigned when applying it. I'll fix it.


> BugLink: https://bugs.launchpad.net/bugs/1780470
> 
> The check in vmci_transport_peer_detach_cb should only allow a
> detach when the qp handle of the transport matches the one in
> the detach message.
> 
> Testing: Before this change, a detach from a peer on a different
> socket would cause an active stream socket to register a detach.
> 
> Reviewed-by: George Zhang <georgezhang@vmware.com>
> Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from 8ab18d71de8b07d2c4d6f984b718418c09ea45c5)
> Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
> ---
>  net/vmw_vsock/vmci_transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
> index 0d1fa05cc8ed..e0436a962789 100644
> --- a/net/vmw_vsock/vmci_transport.c
> +++ b/net/vmw_vsock/vmci_transport.c
> @@ -844,7 +844,7 @@ static void vmci_transport_peer_detach_cb(u32 sub_id,
>  	 * qp_handle.
>  	 */
>  	if (vmci_handle_is_invalid(e_payload->handle) ||
> -	    vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
> +	    !vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
>  		return;
>  
>  	/* We don't ask for delayed CBs when we subscribe to this event (we
>

Patch

diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 0d1fa05cc8ed..e0436a962789 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -844,7 +844,7 @@  static void vmci_transport_peer_detach_cb(u32 sub_id,
 	 * qp_handle.
 	 */
 	if (vmci_handle_is_invalid(e_payload->handle) ||
-	    vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
+	    !vmci_handle_is_equal(trans->qp_handle, e_payload->handle))
 		return;
 
 	/* We don't ask for delayed CBs when we subscribe to this event (we