lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160804123044.GL14185@stefanha-x1.localdomain>
Date:	Thu, 4 Aug 2016 13:30:44 +0100
From:	Stefan Hajnoczi <stefanha@...hat.com>
To:	ggarcia@...a.uab.cat
Cc:	netdev@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>
Subject: Re: [PATCH v3 1/1] Add timer to handle OOM situations

On Tue, Aug 02, 2016 at 07:23:26PM +0200, ggarcia@...a.uab.cat wrote:
> From: Gerard Garcia <ggarcia@...c.uab.cat>

Missing commit description.  From your cover letter:

  Once the guest puts a packet in the virtqueue it is guaranteed
  that it will be delivered.

  This patch addresses the problem of packets being discarded when
  there is not available memory in the host.

> 
> v3:
>  * Avoid race condition when freeing timer.
> 
> v2:
> * Use of ERR_PTR/PTR_ERR/IS_ERR
> * Timer cleaned on device release.
> * Do not process more packets on error.
> 
> Signed-off-by: Gerard Garcia <ggarcia@...c.uab.cat>
> ---
>  drivers/vhost/vsock.c | 52 +++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 42 insertions(+), 10 deletions(-)

The changelog must be below the '---' to prevent it from being included
in git log.  (The changelog isn't useful once the patch has been
merged.)

> 
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index 028ca16..8d4fb13 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -15,11 +15,13 @@
>  #include <net/sock.h>
>  #include <linux/virtio_vsock.h>
>  #include <linux/vhost.h>
> +#include <linux/timer.h>
>  
>  #include <net/af_vsock.h>
>  #include "vhost.h"
>  
>  #define VHOST_VSOCK_DEFAULT_HOST_CID	2
> +#define OOM_RETRY_MS	100
>  
>  enum {
>  	VHOST_VSOCK_FEATURES = VHOST_FEATURES,
> @@ -43,6 +45,8 @@ struct vhost_vsock {
>  	atomic_t queued_replies;
>  
>  	u32 guest_cid;
> +
> +	struct timer_list tx_kick;
>  };
>  
>  static u32 vhost_transport_get_local_cid(void)
> @@ -229,12 +233,13 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq,
>  
>  	if (in != 0) {
>  		vq_err(vq, "Expected 0 input buffers, got %u\n", in);
> -		return NULL;
> +		return ERR_PTR(-EINVAL);
>  	}
>  
>  	pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
> -	if (!pkt)
> -		return NULL;
> +	if (!pkt){
> +		return ERR_PTR(-ENOMEM);
> +	}

Kernel coding style omits the curly braces in a single-line if
statement.

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ