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 6AAADA0093 for ; Tue, 19 May 2020 14:59:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 624741D62C; Tue, 19 May 2020 14:59:50 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 678BE1D62C for ; Tue, 19 May 2020 14:59:49 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id m12so2986769wmc.0 for ; Tue, 19 May 2020 05:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HieeJaFqNYc+5eqtQDXpkCm5jOdugyDacdI8bldn3DQ=; b=vFk9Zk2WDbr5BQSjgK5EDyszW9zpyhk5VUIkzF79lVW63C/VKbVvQtz7OKcuBCdnw7 gf/AuL9KXjK2dMT8LZ6CBVPACMyKqYsbDyfcoHyMPnNgH6W90czk59RY8mYeAGZQ/nPY mBElZMMviLKUcqDfOQ+cOgjGiSwXBMZL1GOkUNTQ8fyCYiMBJNFUl7WEygKXhkxendQY dhapyTELAXteI48JB1nhj5t+kvnPRWaVwx0QXHiY/nj1mTgspjGqFV8TNA94V5KgQJO8 E95M8zlB2zPI4PJcViMzZZR14EG/Ng6MIH1ryR3JwAa4/wMjvknR47HRUrJ4LMEkkx7O yHzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HieeJaFqNYc+5eqtQDXpkCm5jOdugyDacdI8bldn3DQ=; b=so76Q2GmbxlhhunnkTqbHiA/Em/k1Fb+DybZmBZYpJxLx1+6TO8npHFq5LwuqyJkK1 sQglaXP5EMYExXcjWlqA9x3LNjKrqVAAG/SO3/9wy8DdR8V+ohrJaX2dTzLjXsrLit85 X9JD2FjRKKoSGSKDohR6w5P/9um4skq0pJ1mL+qGY3THL8TNby0x4V/vmokUg0kWjsIb MokgIiYie8noSnq/tF1MkUZbwsUwZlzADvYgwXiely1pGy0tIcWKVuxRZEUn0o48gwLP 6vtaU3LmOQp5rKvjKQUfvi76q7vT9gt7yEQRU57RRH+067bt7AbPBcgbafV26REFT3r0 7iSQ== X-Gm-Message-State: AOAM532F0xaTTueKiVWQCOXuVq9hgZnz6HujGgRnvtrgGe0N86mj2xo9 13m7GxEr9+eeCdutlCoMCwlWg5QfkaaXGl3R X-Google-Smtp-Source: ABdhPJwLfIOWzmQOQgw/GMdjHw1W4TN3HQM0cdtaO481Hv/oDer/2/uVVp4fidUTtX+QyQPEISaRHg== X-Received: by 2002:a05:600c:22c9:: with SMTP id 9mr5329102wmg.162.1589893189097; Tue, 19 May 2020 05:59:49 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c140sm3959338wmd.18.2020.05.19.05.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:59:48 -0700 (PDT) From: luca.boccassi@gmail.com To: Jim Harris Cc: Bruce Richardson , dpdk stable Date: Tue, 19 May 2020 13:53:58 +0100 Message-Id: <20200519125804.104349-48-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'contigmem: cleanup properly when load fails' has been queued to stable release 19.11.3 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" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 47109048612843c94cb18cb51c221dcf559b33df Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 9 Mar 2020 03:00:25 -0700 Subject: [PATCH] contigmem: cleanup properly when load fails [ upstream commit 3df951337441cc6b7bb99996e0acf185d4aa52c5 ] If contigmem is not able to allocate all of the requested buffers, it frees whatever buffers were able to be allocated up until that point. But the pointers are not set to NULL in that case. After the load fails, the FreeBSD kernel will immediately call the contigmem unload handler, which tries to free the buffers again since the pointers were not set to NULL. It's not clear that we should just rely on the unload handler getting called after load failure. So let's keep the existing cleanup code in the load handler, but explicitly set the pointers to NULL after freeing them. Fixes: 5f51eca22489 ("contigmem: free allocated memory on error") Signed-off-by: Jim Harris Acked-by: Bruce Richardson --- kernel/freebsd/contigmem/contigmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/freebsd/contigmem/contigmem.c b/kernel/freebsd/contigmem/contigmem.c index 64e0a7fecd..abb76f241e 100644 --- a/kernel/freebsd/contigmem/contigmem.c +++ b/kernel/freebsd/contigmem/contigmem.c @@ -165,9 +165,11 @@ contigmem_load() error: for (i = 0; i < contigmem_num_buffers; i++) { - if (contigmem_buffers[i].addr != NULL) + if (contigmem_buffers[i].addr != NULL) { contigfree(contigmem_buffers[i].addr, contigmem_buffer_size, M_CONTIGMEM); + contigmem_buffers[i].addr = NULL; + } if (mtx_initialized(&contigmem_buffers[i].mtx)) mtx_destroy(&contigmem_buffers[i].mtx); } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 13:56:20.821496642 +0100 +++ 0048-contigmem-cleanup-properly-when-load-fails.patch 2020-05-19 13:56:18.279502899 +0100 @@ -1,8 +1,10 @@ -From 3df951337441cc6b7bb99996e0acf185d4aa52c5 Mon Sep 17 00:00:00 2001 +From 47109048612843c94cb18cb51c221dcf559b33df Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 9 Mar 2020 03:00:25 -0700 Subject: [PATCH] contigmem: cleanup properly when load fails +[ upstream commit 3df951337441cc6b7bb99996e0acf185d4aa52c5 ] + If contigmem is not able to allocate all of the requested buffers, it frees whatever buffers were able to be allocated up until that point. @@ -20,7 +22,6 @@ them. Fixes: 5f51eca22489 ("contigmem: free allocated memory on error") -Cc: stable@dpdk.org Signed-off-by: Jim Harris Acked-by: Bruce Richardson @@ -29,7 +30,7 @@ 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/freebsd/contigmem/contigmem.c b/kernel/freebsd/contigmem/contigmem.c -index 7ea0bc6177..bd72f4d620 100644 +index 64e0a7fecd..abb76f241e 100644 --- a/kernel/freebsd/contigmem/contigmem.c +++ b/kernel/freebsd/contigmem/contigmem.c @@ -165,9 +165,11 @@ contigmem_load()