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 E5837A0C4D; Mon, 6 Sep 2021 09:33:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D176340E32; Mon, 6 Sep 2021 09:33:36 +0200 (CEST) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mails.dpdk.org (Postfix) with ESMTP id 3327040C35; Mon, 6 Sep 2021 09:33:35 +0200 (CEST) Received: by mail-lj1-f172.google.com with SMTP id h1so9813544ljl.9; Mon, 06 Sep 2021 00:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KONSGJcWCKnvDwUk+aqpiayJUuTIICajakjJQtL6w7A=; b=AEz9aSiPqxSbagIg5OiJRx7GHXQTKWs8/0/N5D78nW8Z78RgqCWO0n3P8nMFB4b9kZ r+AOIa5Yd7lBrl50RQn2MxObJDf8wSPVf309p2XbomEhcM2D9XUNQqx3u5a6b57BsUs8 TxxTBwdfX5JDi4RZ/mgywzemBxdJHTkGM4YiMc4pchL8NaQRlkm55vpJIcPA2Wz+HR2r Kcr3evzhNU84Vvff02qyKQOr/7WpV6hVNCvrk0Y28qd6VYV04pZCoNgD0KOa677rm7o+ AVuMDFIWUOFmDnT3jUR3qAKweIyh8cqK6BtW42XNRyM3UZ1uHpCD8vQ0lnRgDO2/5Uef yQmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KONSGJcWCKnvDwUk+aqpiayJUuTIICajakjJQtL6w7A=; b=a2vtzoLVmHYA+gf0lXq9Vqo/kqAMiEJyTcQvqfa66F/loTfDfbrmGQbr+4W3KCo5HP 4QSrE6n/Og/4um+GP33DKYZL1B8XknfVvVW4fYg1In27QRcL8G7qYiDwDMYKs0rH+7Y4 9Zmw9vc/E28WaKYOd6JU9K4hNoC16I05bg3Sf8Dp6ERrB5BWYJHFvNYb8jkG2Aw1JM74 60XOY5wib9f3yOVEXTKK6utRd6S7sbPAgRYXnT+6MEM0gqDeG+NzNAX4HXj4CWGvY9M/ 4iIILIUlY5ragQM3dX4x2YLK9k6cvI3y36hlPo57CAA2YSUm1Wn5phZSaR25dDFReQDn h4Aw== X-Gm-Message-State: AOAM5334CDX3DinywEjbNbFnPd9dcow6jdO/ErlRM00oMcGPV16W23WK p5D+b/P30ec8zNcgaKNQ6mE= X-Google-Smtp-Source: ABdhPJw4BXfe0k4QcCb/PhUvXtFa3ZNmCSsKAicFYrtzNsfpbumKvPkyAGB+oYA1XS/vW65hNt/FZw== X-Received: by 2002:a2e:a4ca:: with SMTP id p10mr9652660ljm.415.1630913614765; Mon, 06 Sep 2021 00:33:34 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id v5sm1018653ljg.117.2021.09.06.00.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 00:33:34 -0700 (PDT) Date: Mon, 6 Sep 2021 10:33:33 +0300 From: Dmitry Kozlyuk To: "Peng, ZhihongX" Cc: "olivier.matz@6wind.com" , "dev@dpdk.org" , "stable@dpdk.org" Message-ID: <20210906103333.13ce4760@sovereign> In-Reply-To: References: <20210831022844.18057-1-zhihongx.peng@intel.com> <20210831205224.14ddb447@sovereign> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] lib/cmdline: release cl when cmdline exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2021-09-06 05:51 (UTC+0000), Peng, ZhihongX: > > -----Original Message----- > > From: Dmitry Kozlyuk > > Sent: Wednesday, September 1, 2021 1:52 AM > > To: Peng, ZhihongX > > Cc: olivier.matz@6wind.com; dev@dpdk.org; stable@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] lib/cmdline: release cl when cmdline exit > > > > 2021-08-31 10:28 (UTC+0800), zhihongx.peng@intel.com: > > > From: Zhihong Peng > > > > > > Malloc cl in the cmdline_stdin_new function, so release in the > > > cmdline_stdin_exit function is logical, so that cl will not be > > > released alone. > > > > > > Fixes: af75078fece3 (first public release) > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Zhihong Peng > > > --- > > > lib/cmdline/cmdline_socket.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/lib/cmdline/cmdline_socket.c > > > b/lib/cmdline/cmdline_socket.c index 998e8ade25..ebd5343754 100644 > > > --- a/lib/cmdline/cmdline_socket.c > > > +++ b/lib/cmdline/cmdline_socket.c > > > @@ -53,4 +53,5 @@ cmdline_stdin_exit(struct cmdline *cl) > > > return; > > > > > > terminal_restore(cl); > > > + cmdline_free(cl); > > > } > > > > Now cmdline_free() may not be called after cmdline_stdin_exit(). > > User code that does so needs to be changed to avoid double-free. > > This behavior change must be documented in the release notes. > > I'm not sure it should be backported because of the above. > Using the asan tool, I found that many dpdk apps did not call cmdline_free, only one app called. I mean external programs that use DPDK, not DPDK bundled apps only. If some of them use a stable DPDK branch and the change is backported, a double-free will be introduced by upgrading DPDK to a minor version. Users of current DPDK version that call cmdline_free() after cmdline_stdin_exit() will have to upgrade their code, release notes are the place to inform them about this need. The patch itself is good and now it is the right time for it.