Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2871964yba; Mon, 8 Apr 2019 06:34:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfVMxD5shTFaQJIkHECmPj+Iop43iLB5ES7BbGd0Uf6z7ABn6aBCB/0HrlwM0S6WGxOzCK X-Received: by 2002:aa7:943b:: with SMTP id y27mr6297373pfo.59.1554730464613; Mon, 08 Apr 2019 06:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554730464; cv=none; d=google.com; s=arc-20160816; b=PxdMrW0eQN2HZusp9VpTFHAxQt07Il/WMQ0BSi0I33MkUhxyiLzbaH3qUCTrkLD5c3 Gq749Uj7bB+6IkRrUsycAaXA9yoE/JZp60MEG8pJpXCNfthv08X4PS70EtZOXJQxgM2h zS8GKRzSUb1t5ZK4Sgm+8FI7mmT0GVfxEcI8pSZk3Dl3oVV85eo2Uyu1szeu5qcGgdFj WJKkNx+qhBns6A8IdDhWoAIk9jn0v2sd8owIjXHrQIXvclJ3zTx57zRQrCVQ2bfZ13mZ Xzv9Q6W1FQlWX3XPoI9B7mFwdIaqOC/tq8jPM63VfUDwFkzDnrStQ+E2Ah9kFEmOXAHc e15g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZsSG3EuVj65tuE3A34j3iuTPijsXIBE0IvawdBDvyNU=; b=Xdm6PQBWhkOTT2SSbwx4GkSx5XBObviFT4zcNoiJ/vxC2BP4Aw34USEGKlZ30zk+hI 4djF9AnkDZfY/uOJj02c4plvbGT9yj30wngQc3mEd/KiE6TXGnNELUzMl2N75wYEKdWo xOIyQHm814uQ5OkhUnz2aOzoXb4mOwvJ8IIuEjja5sEYp2MgXzv5S5ylWwTEj0vrUuiH g3ODA8vV4qSkn2zoewq9ZbvDuPBwKIq09hxQYB092rjYu+3U9L2qUS9UgQZPWe5xEvXJ Bm2RuWGju5ZhGWyVOeB/hPFtRaeXU8pM0y1d2fSvErUjl0HrATXuqZR2rYrbbuMDGd5d p8Jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i33si25877919pgb.99.2019.04.08.06.34.08; Mon, 08 Apr 2019 06:34:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfDHNcm (ORCPT + 99 others); Mon, 8 Apr 2019 09:32:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26972 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfDHNcm (ORCPT ); Mon, 8 Apr 2019 09:32:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BB29301D680; Mon, 8 Apr 2019 13:32:42 +0000 (UTC) Received: from localhost (dhcp-192-206.str.redhat.com [10.33.192.206]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F20D61001DC7; Mon, 8 Apr 2019 13:32:39 +0000 (UTC) Date: Mon, 8 Apr 2019 15:32:38 +0200 From: Jens Freimann To: Cornelia Huck Cc: "Michael S . Tsirkin" , Jason Wang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, virtualization@lists.linux-foundation.org, Halil Pasic Subject: Re: [PATCH] virtio: Honour 'may_reduce_num' in vring_create_virtqueue Message-ID: <20190408133238.2ahk6u3k7mv7nd5g@jenstp.localdomain> References: <20190408123322.24086-1-cohuck@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190408123322.24086-1-cohuck@redhat.com> User-Agent: NeoMutt/20180716-1376-5d6ed1 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 08 Apr 2019 13:32:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 08, 2019 at 02:33:22PM +0200, Cornelia Huck wrote: >vring_create_virtqueue() allows the caller to specify via the >may_reduce_num parameter whether the vring code is allowed to >allocate a smaller ring than specified. > >However, the split ring allocation code tries to allocate a >smaller ring on allocation failure regardless of what the >caller specified. This may cause trouble for e.g. virtio-pci >in legacy mode, which does not support ring resizing. (The >packed ring code does not resize in any case.) > >Let's fix this by bailing out immediately in the split ring code >if the requested size cannot be allocated and may_reduce_num has >not been specified. > >While at it, fix a typo in the usage instructions. > >Fixes: 2a2d1382fe9d ("virtio: Add improved queue allocation API") >Cc: stable@vger.kernel.org # v4.6+ >Signed-off-by: Cornelia Huck >--- > drivers/virtio/virtio_ring.c | 2 ++ > include/linux/virtio_ring.h | 2 +- > 2 files changed, 3 insertions(+), 1 deletion(-) > Reviewed-by: Jens Freimann