From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA537A0093 for ; Thu, 10 Mar 2022 14:01:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B535C4113F; Thu, 10 Mar 2022 14:01:00 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D98A24113F for ; Thu, 10 Mar 2022 14:00:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646917258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lfa07pNgPMR1hu34LyJEucMAKmJq+124pNq732hEL+0=; b=eXlBbAyNNZVbU3HOL9zNUyYY2TBcpWvhNr+iO+NfxTV2O3GUtLv4wAtuXzMkjHkqlMwYq1 rRLedwmtm0qO38gEdJ6tFk+sJ2MtVg3JW/0hHxp+v4oKWlNdgkgaNzXz3Wd3i3/+SGhik6 j4BrHRbOONbP47XS79N6PRcYlfck8qc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-Yv2GCAecO2qGvNb2cFCHqA-1; Thu, 10 Mar 2022 08:00:57 -0500 X-MC-Unique: Yv2GCAecO2qGvNb2cFCHqA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31B2C800D55; Thu, 10 Mar 2022 13:00:56 +0000 (UTC) Received: from [10.39.208.21] (unknown [10.39.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D835F83287; Thu, 10 Mar 2022 13:00:06 +0000 (UTC) Message-ID: <5339b9a8-581d-3428-5ec5-7edae9734960@redhat.com> Date: Thu, 10 Mar 2022 14:00:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 1/2] vhost: fix queue number check when setting inflight FD To: David Marchand , dev@dpdk.org Cc: chenbo.xia@intel.com, stable@dpdk.org, Wenxiang Qian References: <20220310125059.30562-1-david.marchand@redhat.com> From: Maxime Coquelin In-Reply-To: <20220310125059.30562-1-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 3/10/22 13:50, David Marchand wrote: > From: Chenbo Xia > > In function vhost_user_set_inflight_fd, queue number in inflight > message is used to access virtqueue. However, queue number could > be larger than VHOST_MAX_VRING and cause write OOB as this number > will be used to write inflight info in virtqueue structure. This > patch checks the queue number to avoid the issue and also make > sure virtqueues are allocated before setting inflight information. > > Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information") > Cc: stable@dpdk.org > > Reported-by: Wenxiang Qian > Signed-off-by: Chenbo Xia > --- > lib/vhost/vhost_user.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > index 589b950458..1ec4357bee 100644 > --- a/lib/vhost/vhost_user.c > +++ b/lib/vhost/vhost_user.c > @@ -2883,6 +2883,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, > case VHOST_USER_SET_VRING_ADDR: > vring_idx = ctx->msg.payload.addr.index; > break; > + case VHOST_USER_SET_INFLIGHT_FD: > + vring_idx = ctx->msg.payload.inflight.num_queues - 1; > + break; > default: > return 0; > } Reviewed-by: Maxime Coquelin Thanks, Maxime