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 D22ACA0C47 for ; Thu, 14 Oct 2021 14:40:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CAD2440E50; Thu, 14 Oct 2021 14:40:52 +0200 (CEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 183E040E50 for ; Thu, 14 Oct 2021 14:40:52 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id g184so5425746pgc.6 for ; Thu, 14 Oct 2021 05:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eBMUrTfjMREr+2luAj4E874LGJGLsXFowJV+LiN1C3E=; b=OY9Nj3CGp8d74QUjdzfkwEzZRAK04J9M3KJtEVOT68Rq60TJ+TJl/1NNZFnYx1oQ76 48waOv22jQBUsF30lwijiG37aYTDfSCw/VVwDZrmj8YbqE0sCtONQn1Ib5jMgALhpUKA vabyieI6K8/qw2ZOOi+KcQgoC9J1m7n9Au+aDcebp0RxwSznIfsYY2W6HL6mnTjwy3ul Wmur4plCHwxE5fCN12zORucj3I/YBdqoM2WNmAYoPOoc8zbETlBlKflzZ93o2uY1r64p hPSrEFETucoRTYcoF6pYl/g5MQSlSYqSdZxIIjA7DtJBTPxuc6udZ8oy9M1PkVzHm0mN qcaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eBMUrTfjMREr+2luAj4E874LGJGLsXFowJV+LiN1C3E=; b=JGHoKxqfaZ3fyGbtSOFj469zU8Bxo8x3TBkuWyC1ibggpccYPYkdFCgSFxvadu70J7 eicn4xG/sRHEx70UHbC9W748MHu4Tsm1q90mVw+ZlOLAMDyykSE2koC+YZQokYRiJZJ4 5xE5oSvQQDynZs8HIsBKLit+fFAcoSUQRDQgPXNVVB9BI9AGJtcXdsilKX3/slPNMQ8f 7Ywwu9KqlYFghoxn+g11QvIBHhlCLFioavQ8bdtaXtxT5RsPmNo/0Zjv6KG+C2bjm7Ne GoxeKyY5KnaIP6doyYYw8IO6Bj5VAQsPiBVaJrMp/EBz+bVd5L6IGd9UkpXmBZKzCRYA 5h/Q== X-Gm-Message-State: AOAM532MiYmYkcTQlimJN3DlR3m67wqDKRtt662OGDgdpKNgWy73q/cy TbQhcFX/RQLRI+p3lEcjKsmvsw== X-Google-Smtp-Source: ABdhPJy1oaK9Sb0Y9YCB7MoqvCuGIxh1OpHmjNYBljL1DJmJtsqifDd/YKJBjM2Knd+WFhWpAiSM8g== X-Received: by 2002:a62:ce01:0:b0:44c:569c:5c3e with SMTP id y1-20020a62ce01000000b0044c569c5c3emr5204500pfg.77.1634215251146; Thu, 14 Oct 2021 05:40:51 -0700 (PDT) Received: from 64-217.. ([103.97.201.33]) by smtp.gmail.com with ESMTPSA id c64sm2535093pga.40.2021.10.14.05.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 05:40:50 -0700 (PDT) From: Li Feng To: Maxime Coquelin , Chenbo Xia , Lin Li , Jin Yu , Yu Zhang , Xun Ni Cc: dev@dpdk.org, Li Feng , stable@dpdk.org Date: Thu, 14 Oct 2021 20:40:08 +0800 Message-Id: <20211014124008.3570044-1-fengli@smartx.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827051241.2448098-1-fengli@smartx.com> References: <20210827051241.2448098-1-fengli@smartx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] vhost: add sanity check when operating the split ring 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 Sender: "stable" The idx in rte_vhost_set_last_inflight_io_split is from the frontend driver, check if it's in the virtqueue range. Fixes: bb0c2de9602b ("vhost: add APIs to operate inflight ring") Cc: stable@dpdk.org Signed-off-by: Li Feng --- lib/vhost/vhost.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 9540522dac..3b674ac320 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1226,6 +1226,9 @@ rte_vhost_set_last_inflight_io_split(int vid, uint16_t vring_idx, if (unlikely(!vq->inflight_split)) return -1; + if (unlikely(idx >= vq->size)) + return -1; + vq->inflight_split->last_inflight_io = idx; return 0; } -- 2.31.1