From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZBxA-00030x-E5 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 01:32:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZBx7-0006cb-77 for qemu-devel@nongnu.org; Fri, 26 Feb 2016 01:32:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZBx7-0006cX-0o for qemu-devel@nongnu.org; Fri, 26 Feb 2016 01:32:37 -0500 References: <1456310674-3237-1-git-send-email-i.maximets@samsung.com> From: Jason Wang Message-ID: <56CFF17C.4020905@redhat.com> Date: Fri, 26 Feb 2016 14:32:28 +0800 MIME-Version: 1.0 In-Reply-To: <1456310674-3237-1-git-send-email-i.maximets@samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhost-user: verify that number of queues is less than MAX_QUEUE_NUM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ilya Maximets , qemu-devel@nongnu.org Cc: Dyasly Sergey , "Michael S. Tsirkin" On 02/24/2016 06:44 PM, Ilya Maximets wrote: > Fix QEMU crash when -netdev vhost-user,queues=n is passed with number > of queues greater than MAX_QUEUE_NUM. > > Signed-off-by: Ilya Maximets > --- > net/vhost-user.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/net/vhost-user.c b/net/vhost-user.c > index 451dbbf..b753b3d 100644 > --- a/net/vhost-user.c > +++ b/net/vhost-user.c > @@ -317,9 +317,10 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name, > } > > queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1; > - if (queues < 1) { > + if (queues < 1 || queues > MAX_QUEUE_NUM) { > error_setg(errp, > - "vhost-user number of queues must be bigger than zero"); > + "vhost-user number of queues must be in range [1, %d]", > + MAX_QUEUE_NUM); > return -1; > } > Acked-by: Jason Wang