From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 93D44A034F
	for <public@inbox.dpdk.org>; Mon, 11 Oct 2021 10:26:02 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 85C37410EE;
	Mon, 11 Oct 2021 10:26:02 +0200 (CEST)
Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com
 [209.85.167.50])
 by mails.dpdk.org (Postfix) with ESMTP id 460ED40E0F;
 Mon, 11 Oct 2021 10:26:00 +0200 (CEST)
Received: by mail-lf1-f50.google.com with SMTP id z11so61827001lfj.4;
 Mon, 11 Oct 2021 01:26:00 -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=Dudz+bNU6OvQuq3l7H1+cpQ7VxHnWIU5Ji5ej8OgXRg=;
 b=DzD7TQTXDGV7eJrbZkNQZE58+IHZerRCfoPdZjY+PpCQcNjGVucLmxAdPhlAdMPCJm
 zFIVypJylo6AbIJJ///wMuD5yJClMTpLTPqkn3r9eRvuzIAHOz3sJPPoCAdJpvPA8aL1
 iJoCiiTBUZF94kwTfQC6z/gq0Oax3SN206JblGU0Ys15wbgbybDc5ze/c7MbcXXHIPR5
 y54HCyPkS9LsQScEiXcd8Ijl0GVDkGPZymKF42XLIBIOdVQU4iiqD3dPBqojyx0UrzFq
 fJbSCpRIu8UxbrJU9lKOXDHe2SumPf3UzZQ7zanEdAL3JQlymCp3NqMCxScFSb+UWPn1
 eq0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=Dudz+bNU6OvQuq3l7H1+cpQ7VxHnWIU5Ji5ej8OgXRg=;
 b=CCNpLVvWND6JcNshMx3qN+1qAjrSeqtJovOLWX6gSdrZJPQE0PWjL0mQtPEl7p+8I5
 hJsATtWDCivG1nZpnjCqtO3W8U1J4UNLu9kVOjxPE6y1hxs43HHIYkU7sP3mftsbpk0L
 oGjPFujgoIPzoGwYX5nzZVW5OvUdFBdnmPoPRNC0W2OOKNr4oNpjOH2p3YOA64CBDwO0
 znjuNIPrwRGDBS6/qWEl10PHgIb3qip3zt/TcW+zrSLt9h410wsyG+ecWvcDIIpWaNGU
 fkh6MuHF/y5Iybph1Ubg72td4/wIeN2es3tiBTFcz1dyOTQm7tJFN0RJI4SeQ5i9vlCA
 xH1Q==
X-Gm-Message-State: AOAM533JCOCxVQUKqKlbfaTzWbCi3OTcIa1c4O5auPpDEm/iN3j4c6uT
 y6c2/QWg6GEQNBma7rcGyc7/rZD1OYk=
X-Google-Smtp-Source: ABdhPJzVDxCBwVDJHWmIHmtjujyLtnb0c2P6MPgcuhkKWvDzRfBgKxtIzSa2RFZbLs4ueUNv3+PdMw==
X-Received: by 2002:a2e:7f09:: with SMTP id a9mr21249602ljd.254.1633940759541; 
 Mon, 11 Oct 2021 01:25:59 -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 h25sm669179lfm.148.2021.10.11.01.25.59
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Oct 2021 01:25:59 -0700 (PDT)
Date: Mon, 11 Oct 2021 11:25:58 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: zhihongx.peng@intel.com
Cc: olivier.matz@6wind.com, dev@dpdk.org, stable@dpdk.org
Message-ID: <20211011112558.21c68bfa@sovereign>
In-Reply-To: <20211008064131.369133-1-zhihongx.peng@intel.com>
References: <20210917021502.502560-2-zhihongx.peng@intel.com>
 <20211008064131.369133-1-zhihongx.peng@intel.com>
X-Mailer: Claws Mail 3.18.0 (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-stable] [PATCH v3 1/2] lib/cmdline: release cl when
 cmdline exit
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

2021-10-08 06:41 (UTC+0000), zhihongx.peng@intel.com:
> From: Zhihong Peng <zhihongx.peng@intel.com>
> 
> 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

As I have explained before, backporting this will introduce a double-free bug
in user apps unless their code are fixed, so it must not be done.

> 
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
>  doc/guides/rel_notes/release_21_11.rst | 5 +++++
>  lib/cmdline/cmdline_socket.c           | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
> index efeffe37a0..be24925d16 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -191,6 +191,11 @@ API Changes
>    the crypto/security operation. This field will be used to communicate
>    events such as soft expiry with IPsec in lookaside mode.
>  
> +* cmdline: The API cmdline_stdin_exit has added cmdline_free function.
> +  Malloc cl in the cmdline_stdin_new function, so release in the
> +  cmdline_stdin_exit function is logical. The application code
> +  that calls cmdline_free needs to be deleted.
> +

There's probably no need to go into such details, suggestion:

* cmdline: ``cmdline_stdin_exit()`` now frees the ``cmdline`` structure.
  Calls to ``cmdline_free()`` after it need to be deleted from applications.

>  
>  ABI Changes
>  -----------
> 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);
>  }