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 9DE95A0547 for ; Thu, 21 Oct 2021 11:18:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C4C040142; Thu, 21 Oct 2021 11:18:21 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 12A2940142 for ; Thu, 21 Oct 2021 11:18:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634807899; 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=NDHEg1RmKS2z2051iKJNm+UxEod3cRX0l35h5hmZNMA=; b=ci0Kcj263k9WqohtYao25Ts+wElRAW+JJZC/LMuSOnGZUHxOIFEJYQp3OZVUAtnlvkoNnc cz+gsr/0v3b8xo7DH1nxkXp40PPOCHH+nzBUCEindWZ02qcZfquBp3Aj3H8cmM5+vgUQlH OKUMj7TrDQi1LeDGi1XEpLK9MizwHaQ= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-VeVPIHiSPgOgi6VqPyk_eA-1; Thu, 21 Oct 2021 05:18:18 -0400 X-MC-Unique: VeVPIHiSPgOgi6VqPyk_eA-1 Received: by mail-lf1-f69.google.com with SMTP id g10-20020a05651222ca00b003fda3f05c17so4389360lfu.11 for ; Thu, 21 Oct 2021 02:18:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NDHEg1RmKS2z2051iKJNm+UxEod3cRX0l35h5hmZNMA=; b=o1sPf4m7cUg8/URzVyUrjTVRI+0j8mnDM9zmVbd0MuReuPI8ggbhAueulbGKpJ45j0 3GecJTX7KZzC6qIGhEhvG3o+eXoEqCYVyq/qoDc0XNlx5u4XIMDEta1S3nq18Ncxabco RfsL7kkgWfwvzSuofZ9Tp4QX89H0NE3jzP8gR259VdmcNuA4x6mCssY5ERFUFHsHp5ZR PLZV5P450HKq1IeTuMDCaypYUTgD1R4Ls8FOfDyes4Nw4Np8nCYCHxuziuh6jEdHYXuU UgaC/N/GggEYZtZwY9tYFSk8V4MuQ+FmO+GbbHri6mdyb9EtsrDoKSqacMC/6oxUoxVl axhw== X-Gm-Message-State: AOAM530XI3u3A1oapTYrN32LMNW4AVmy7AvDyrbjXUsXzWWOt8nbjRiI 4xDylXkbJbSJVmuNvF054UV1cUmylinamVVXVLsnoJKxIFGO0illDqHu/nq3nGV+QHqFTHPPlMa eJ+Yqhrci1cC1i73GkWlGW1Q= X-Received: by 2002:ac2:4bc1:: with SMTP id o1mr4211160lfq.553.1634807896846; Thu, 21 Oct 2021 02:18:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLEDS1s+bFBc1PY7Cspv4fhcyytpPzRrdz65cKHVBFIa6dRZVOHpEEFywGxiskxualkx1w7NLWQ+au2qGoceg= X-Received: by 2002:ac2:4bc1:: with SMTP id o1mr4211046lfq.553.1634807895206; Thu, 21 Oct 2021 02:18:15 -0700 (PDT) MIME-Version: 1.0 References: <20210113132734.1636-1-olivier.matz@6wind.com> <20210929213707.17727-1-olivier.matz@6wind.com> In-Reply-To: <20210929213707.17727-1-olivier.matz@6wind.com> From: David Marchand Date: Thu, 21 Oct 2021 11:18:03 +0200 Message-ID: To: Olivier Matz Cc: dev , Ajit Khaparde , ajitkhaparde@gmail.com, Ali Alnubani , Andrew Rybchenko , "Ananyev, Konstantin" , =?UTF-8?Q?Morten_Br=C3=B8rup?= , dpdk stable , Slava Ovsiienko Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v5] mbuf: fix reset on mbuf free 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" On Wed, Sep 29, 2021 at 11:37 PM Olivier Matz wrot= e: > > m->nb_seg must be reset on mbuf free whatever the value of m->next, > because it can happen that m->nb_seg is !=3D 1. For instance in this > case: > > m1 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m1, 500); > m2 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m2, 500); > rte_pktmbuf_chain(m1, m2); > m0 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m0, 500); > rte_pktmbuf_chain(m0, m1); > > As rte_pktmbuf_chain() does not reset nb_seg in the initial m1 > segment (this is not required), after this code the mbuf chain > have 3 segments: > - m0: next=3Dm1, nb_seg=3D3 > - m1: next=3Dm2, nb_seg=3D2 > - m2: next=3DNULL, nb_seg=3D1 > > Then split this chain between m1 and m2, it would result in 2 packets: > - first packet > - m0: next=3Dm1, nb_seg=3D2 > - m1: next=3DNULL, nb_seg=3D2 > - second packet > - m2: next=3DNULL, nb_seg=3D1 > > Freeing the first packet will not restore nb_seg=3D1 in the second > segment. This is an issue because it is expected that mbufs stored > in pool have their nb_seg field set to 1. > > Fixes: 8f094a9ac5d7 ("mbuf: set mbuf fields while in pool") > Cc: stable@dpdk.org > > Signed-off-by: Olivier Matz > Acked-by: Morten Br=C3=B8rup > Acked-by: Ajit Khaparde > Acked-by: Konstantin Ananyev Tested-by: Ali Alnubani Applied, thanks. --=20 David Marchand