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 9EE80A00C3 for ; Tue, 29 Nov 2022 12:50:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77FD440691; Tue, 29 Nov 2022 12:50:47 +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 D21774067E for ; Tue, 29 Nov 2022 12:50:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669722645; 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=4G7aq+oVhkjlj0HQk4ViHJt/uJeWc5skHwSke9LsJ7U=; b=XJ/KrvVtMBQIGG+cGzzaJiSWtz18XsfjcV0CiUHKp4+PpDOPgmE2uk/9s2TkBVVq7oKqHx bpCo/XqPPynFyU/9GxJ3EgcfwkwtsE7vH3vxEStZIcFIE9ZLIDPZE/547L665XYi1T5iJw BHljZY8XW6cS9yQlfZ4CHCYeQCE0lTc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-624-q4ChH1sbP9aQie4JO3pvfA-1; Tue, 29 Nov 2022 06:50:43 -0500 X-MC-Unique: q4ChH1sbP9aQie4JO3pvfA-1 Received: by mail-wr1-f69.google.com with SMTP id r23-20020adfa157000000b00241bcae980cso2742835wrr.7 for ; Tue, 29 Nov 2022 03:50:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4G7aq+oVhkjlj0HQk4ViHJt/uJeWc5skHwSke9LsJ7U=; b=H1D29g3pVq/lXi4XEeLp1/+O9Kngpae7eRO9ULrpedaChkgqmRk5DaWIkmmNdOG7v3 H3e8oCK986YYFKqAvYqDAEfIpfJZCpSwDyMG0jgSvJm6vszUpuMP+G3Rn9pnNntzmrQt 2VZkc3S2GQmMt0CDf9AE9QXLsRc/eRxugLC0Uo4xnOnOQ19yE0qTQ7vG4a350BeQyNR2 wGciuFQAOYn3QC12ha15XVW3+hnSm22p/kxQG71CmSCcHCzn+SX1cJVlR6OEudm56+H8 Z+Mcby8vq3yJeP/xM52ggwLgWck8qPLbL+l9CpsG51GRIIO9kYxmfKRW1s2qXRw4QNVZ +a6A== X-Gm-Message-State: ANoB5pkGA4WO8ZwPsCikziUgDAjx2JnE43ysK5ArFasyA1VhukLVNMIi M6LBGCwtisloYWVLITxNrett97NFbjG93HFJ0fjZkenmn6nnLnF3F5cjpM5PU04HVwTJQQ5YJzC JVnwGaII= X-Received: by 2002:a5d:4e11:0:b0:242:b6e:1744 with SMTP id p17-20020a5d4e11000000b002420b6e1744mr10607506wrt.413.1669722642649; Tue, 29 Nov 2022 03:50:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4zd/TNldiCocrEoOEz6zWwZbe1OqQ+LiWinrZRUDMwiWiCBnk9tQdAvFVxySyTDbY6eDYQ5g== X-Received: by 2002:a5d:4e11:0:b0:242:b6e:1744 with SMTP id p17-20020a5d4e11000000b002420b6e1744mr10607499wrt.413.1669722642498; Tue, 29 Nov 2022 03:50:42 -0800 (PST) Received: from [192.168.0.36] ([78.19.108.40]) by smtp.gmail.com with ESMTPSA id y14-20020adff14e000000b00226dba960b4sm13690831wro.3.2022.11.29.03.50.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Nov 2022 03:50:42 -0800 (PST) Message-ID: Date: Tue, 29 Nov 2022 11:50:41 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 21.11 1/2] net/mlx5: fix race condition in counter pool resizing To: Michael Baum , stable@dpdk.org Cc: Matan Azrad , Viacheslav Ovsiienko References: <20221124075320.2026822-1-michaelba@nvidia.com> <20221124075320.2026822-2-michaelba@nvidia.com> From: Kevin Traynor In-Reply-To: <20221124075320.2026822-2-michaelba@nvidia.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 24/11/2022 07:53, Michael Baum wrote: > [ upstream commit a94e89e47b59ebaf84246bbb34c06e1a004cde8a ] > > Counter management structure has array of counter pools. This array is > invalid in management structure initialization and grows on demand. > > The resizing include: > 1. Allocate memory for the new size. > 2. Copy the existing data to the new memory. > 3. Move the pointer to the new memory. > 4. Free the old memory. > > The third step can be performed before for this function, and compiler > may do that, but another thread might read the pointer before coping and > read invalid data or even crash. > > This patch allocates memory for this array once in management structure > initialization and limit the counters number by 16M. > > Fixes: 3aa279157fa0 ("net/mlx5: synchronize flow counter pool creation") > > Signed-off-by: Michael Baum > Acked-by: Matan Azrad > --- Thanks for the backports. Applied both patches to 21.11 branch.