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 72F8DA034D for ; Mon, 17 Aug 2020 11:42:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3DF3F1C124; Mon, 17 Aug 2020 11:42:23 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 64B0F1C124 for ; Mon, 17 Aug 2020 11:42:22 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id p20so14301520wrf.0 for ; Mon, 17 Aug 2020 02:42:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=VgzyconbuKveUz/O70TRdxZ2oIQ1rFEpOk5AvaeMScU=; b=hMCKAx25mdC+XlZbfDJWExJk+0AvpRHoG3o6pbkSOOHM1foQhN0adW5KY2zRNVAfbC xjYBKT0eimqt4nHSofTMdJ2quKcWXQHrA2c76cBNsMbav33WLtssF7deaEvuagTPvqwN JIWORY/1sEaIti8xm2uhBrMbcMvvmMYcHcmF8w6Sgk2lZ/IoJ57Fork3//2aDr9cQhjI 5moil6VdWrNL72QaH6yF1DYHCW93ROKw0o0xDuU883e4QPgbL6MMWlj8+OD0FYNYxgeg lfPLTb5JsxYMhLaucXJqyMYOIAN9suAIIweH+hpSTUsRODplD85EY/DDxXNDJVZ+bKrG r3pQ== X-Gm-Message-State: AOAM530P0+JkrSfJl84gGYPzVSb6pmWlVlozwDnhLxo/FwENcynkbkvX obY7vlWkqDsbKkk3eU6kNgI= X-Google-Smtp-Source: ABdhPJzC23+9V/qrCymcZ154/At+naO2f0QgVrsrmmEYiTPD0647HsEYMYaJq3psHDVR+V5Zhjo/Eg== X-Received: by 2002:a5d:4a41:: with SMTP id v1mr15701349wrs.371.1597657341939; Mon, 17 Aug 2020 02:42:21 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 33sm31864359wri.16.2020.08.17.02.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 02:42:21 -0700 (PDT) Message-ID: From: Luca Boccassi To: Michael Baum , stable@dpdk.org Cc: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Date: Mon, 17 Aug 2020 10:42:20 +0100 In-Reply-To: <1597579615-8044-2-git-send-email-michaelba@mellanox.com> References: <1597579615-8044-1-git-send-email-michaelba@mellanox.com> <1597579615-8044-2-git-send-email-michaelba@mellanox.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH 19.11 2/2] net/mlx5: fix hairpin Rx queue creation error flow 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" On Sun, 2020-08-16 at 12:06 +0000, Michael Baum wrote: > [ upstream commit ebed623f621bbe9cf050a9eb7725f4d81cb95d4f ] >=20 > The mlx5_rxq_obj_hairpin_new function defines a pointer named tmpl and > allocates memory for it using the rte_zmalloc_socket function. > Later, this function allocates memory to a variable inside tmpl using > the mlx5_devx_cmd_create_rq function. >=20 > In both cases, if the allocation fails, the code jumps to the error > label and frees allocated resources. However, in the first jump there > are still no resources to free and the jump only for the line return > NULL is unnecessary. Even worse, when it jumps to error label with > invalid tmpl it actually does dereference to a null pointer. > In contrast, the second jump needs to free the tmpl variable but the > function instead of freeing, tries to free the variable that it just > failed to allocate. > In addition, for another error, the function returns NULL without > freeing the tmpl variable before, causing a memory leak. >=20 > Delete the error label and replace each jump with local return NULL and > free tmpl variable if needed. >=20 > Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues") >=20 > Signed-off-by: Michael Baum > Acked-by: Matan Azrad Thanks, applied and pushed both. --=20 Kind regards, Luca Boccassi