From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6AA6A04B6 for ; Tue, 22 Sep 2020 14:42:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA0BF1DB1D; Tue, 22 Sep 2020 14:42:38 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 7180B1D6D6 for ; Tue, 22 Sep 2020 14:42:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600778556; 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: in-reply-to:in-reply-to:references:references; bh=cFKrsnbrBziwfDDL8NdBLoG1xAFiXnZr+gf9q5YhvXg=; b=LxbMWaeSaKLnsCtwu5Mn2t+IsdnSYrSjtlIiNxMpOMM1AaDswDgYoJso58jADDWH2ckbk3 zUqDneqG94q+obHq3BzGvB3wiHxcBn8pkYBjBuNykLg8NT0I0M+GpRMHjP3IY5DDgPhYI3 vJqwBZ60RTNU/brpF25QNb8c4MOrteU= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-5VDpJo98OVi-rM9jzjxfxA-1; Tue, 22 Sep 2020 08:42:32 -0400 X-MC-Unique: 5VDpJo98OVi-rM9jzjxfxA-1 Received: by mail-vk1-f200.google.com with SMTP id w126so2818860vkb.6 for ; Tue, 22 Sep 2020 05:42:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cFKrsnbrBziwfDDL8NdBLoG1xAFiXnZr+gf9q5YhvXg=; b=nVjo2ThcsmbDwon9j/SjIodrxIq4RdqnvK2OeU15MaGk9Ega9F8j3gSs/dy6JM2OW+ 4eig4RHWrI8/0HOipVq5siSCIyLA9dVal6QSFX1+Nn0eU5Fk7u6BQ0PNTw5f1+8Haxpl PlrBYrDYvlu6n7qEFAMNKanTHylhSReU6HynkajkIIY0MSC7uXnESjaB2hyZUnSesXRw ZTgLaDMNoYoPtxfBkymN2+GYchkpYUQM6Wn2JL0a0rT1uTXBo3YqfjbwwzLG3Sl+v9Ow P1em6SyNFqFF//J/W444UXB9fxVZQFn38HhtQeoIYx/mVzZafoA3IW9cXajI9sHR3zEU L46w== X-Gm-Message-State: AOAM531p/zXmZOjFSXxvX40BqV1qJhCY6ogcFukGOwd7KoJaTe1iFuNp 1vMOYOdOLeWHrMBHu8BZWJwwksiLYPqGRnUSbsyHnfe/kaRTCpbs0WqB0o9ajQdlYPWTC1RCViT wcgy2lbpBvq56loZdsbC4T2Y= X-Received: by 2002:a05:6102:10c2:: with SMTP id t2mr3001224vsr.10.1600778552324; Tue, 22 Sep 2020 05:42:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0WYQRVOX8thaTm4IDePBrJvVrcYJsd7xIzUXG0au8IGD8mebqg/9ErSWksCyi+aqyi60OvfbBpVyZXc25QTs= X-Received: by 2002:a05:6102:10c2:: with SMTP id t2mr3001208vsr.10.1600778552018; Tue, 22 Sep 2020 05:42:32 -0700 (PDT) MIME-Version: 1.0 References: <20200915193449.13310-1-l.wojciechow@partner.samsung.com> <20200915193449.13310-4-l.wojciechow@partner.samsung.com> In-Reply-To: <20200915193449.13310-4-l.wojciechow@partner.samsung.com> From: David Marchand Date: Tue, 22 Sep 2020 14:42:21 +0200 Message-ID: To: Lukasz Wojciechowski , David Hunt Cc: Bruce Richardson , dev , dpdk stable 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" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v1 3/6] app/test: fix freeing mbufs in distributor tests X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" Hello Lukasz, David, On Tue, Sep 15, 2020 at 9:35 PM Lukasz Wojciechowski wrote: > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c > index 0e49e3714..da13a9a3f 100644 > --- a/app/test/test_distributor.c > +++ b/app/test/test_distributor.c > @@ -277,24 +277,21 @@ handle_work_with_free_mbufs(void *arg) > struct rte_mbuf *buf[8] __rte_cache_aligned; > struct worker_params *wp = arg; > struct rte_distributor *d = wp->dist; > - unsigned int count = 0; > unsigned int i; > unsigned int num = 0; > unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); > > for (i = 0; i < 8; i++) > buf[i] = NULL; > - num = rte_distributor_get_pkt(d, id, buf, buf, num); > + num = rte_distributor_get_pkt(d, id, buf, buf, 0); For my understanding, we pass an array even if we return 0 packet. Is this necessary? > while (!quit) { > - count += num; > __atomic_fetch_add(&worker_stats[id].handled_packets, num, > __ATOMIC_ACQ_REL); > for (i = 0; i < num; i++) > rte_pktmbuf_free(buf[i]); > num = rte_distributor_get_pkt(d, > - id, buf, buf, num); > + id, buf, buf, 0); Here, it gives the impression we have some potential use-after-free on buf[] content. And trying to pass NULL, I can see the distributor library dereferences oldpkt[] without checking retcount != 0. -- David Marchand