* [dpdk-dev] [PATCH v3 2/2] app/test: delete cmdline free function
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit zhihongx.peng
@ 2021-10-08 6:41 ` zhihongx.peng
2021-10-11 8:26 ` Dmitry Kozlyuk
2021-10-11 5:20 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit Peng, ZhihongX
` (2 subsequent siblings)
3 siblings, 1 reply; 29+ messages in thread
From: zhihongx.peng @ 2021-10-08 6:41 UTC (permalink / raw)
To: olivier.matz, dmitry.kozliuk; +Cc: dev, Zhihong Peng, stable
From: Zhihong Peng <zhihongx.peng@intel.com>
Cmdline will be released in cmdline_stdin_exit function,
so it does not need to be released here.
Fixes: acdabc450ea0 (test: fix terminal settings on exit)
Cc: stable@dpdk.org
Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
---
app/test/test.c | 1 -
app/test/test_cmdline_lib.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/app/test/test.c b/app/test/test.c
index 173d202e47..5194131026 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -233,7 +233,6 @@ main(int argc, char **argv)
cmdline_interact(cl);
cmdline_stdin_exit(cl);
- cmdline_free(cl);
}
#endif
ret = 0;
diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
index d5a09b4541..6bcfa6511e 100644
--- a/app/test/test_cmdline_lib.c
+++ b/app/test/test_cmdline_lib.c
@@ -174,7 +174,6 @@ test_cmdline_socket_fns(void)
/* void functions */
cmdline_stdin_exit(NULL);
- cmdline_free(cl);
return 0;
error:
printf("Error: function accepted null parameter!\n");
--
2.25.1
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/2] app/test: delete cmdline free function
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 2/2] app/test: delete cmdline free function zhihongx.peng
@ 2021-10-11 8:26 ` Dmitry Kozlyuk
0 siblings, 0 replies; 29+ messages in thread
From: Dmitry Kozlyuk @ 2021-10-11 8:26 UTC (permalink / raw)
To: zhihongx.peng; +Cc: olivier.matz, dev, stable
2021-10-08 06:41 (UTC+0000), zhihongx.peng@intel.com:
> From: Zhihong Peng <zhihongx.peng@intel.com>
>
> Cmdline will be released in cmdline_stdin_exit function,
> so it does not need to be released here.
>
> Fixes: acdabc450ea0 (test: fix terminal settings on exit)
> Cc: stable@dpdk.org
>
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
Except for backporting (see patch 1/2 comments),
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
> app/test/test.c | 1 -
> app/test/test_cmdline_lib.c | 1 -
> 2 files changed, 2 deletions(-)
>
> diff --git a/app/test/test.c b/app/test/test.c
> index 173d202e47..5194131026 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -233,7 +233,6 @@ main(int argc, char **argv)
>
> cmdline_interact(cl);
> cmdline_stdin_exit(cl);
> - cmdline_free(cl);
> }
> #endif
> ret = 0;
> diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
> index d5a09b4541..6bcfa6511e 100644
> --- a/app/test/test_cmdline_lib.c
> +++ b/app/test/test_cmdline_lib.c
> @@ -174,7 +174,6 @@ test_cmdline_socket_fns(void)
> /* void functions */
> cmdline_stdin_exit(NULL);
>
> - cmdline_free(cl);
> return 0;
> error:
> printf("Error: function accepted null parameter!\n");
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit zhihongx.peng
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 2/2] app/test: delete cmdline free function zhihongx.peng
@ 2021-10-11 5:20 ` Peng, ZhihongX
2021-10-11 8:25 ` Dmitry Kozlyuk
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 " zhihongx.peng
3 siblings, 0 replies; 29+ messages in thread
From: Peng, ZhihongX @ 2021-10-11 5:20 UTC (permalink / raw)
To: dmitry.kozliuk; +Cc: dev, stable, olivier.matz
> -----Original Message-----
> From: Peng, ZhihongX <zhihongx.peng@intel.com>
> Sent: Friday, October 8, 2021 2:42 PM
> To: olivier.matz@6wind.com; dmitry.kozliuk@gmail.com
> Cc: dev@dpdk.org; Peng, ZhihongX <zhihongx.peng@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
>
> 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
>
> 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.
> +
>
> 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);
> }
> --
> 2.25.1
Hi, kozliuk
Can you give me an ack, I have submitted v3, I have added the release notes.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit zhihongx.peng
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 2/2] app/test: delete cmdline free function zhihongx.peng
2021-10-11 5:20 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit Peng, ZhihongX
@ 2021-10-11 8:25 ` Dmitry Kozlyuk
2021-10-13 1:53 ` Peng, ZhihongX
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 " zhihongx.peng
3 siblings, 1 reply; 29+ messages in thread
From: Dmitry Kozlyuk @ 2021-10-11 8:25 UTC (permalink / raw)
To: zhihongx.peng; +Cc: olivier.matz, dev, stable
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);
> }
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
2021-10-11 8:25 ` Dmitry Kozlyuk
@ 2021-10-13 1:53 ` Peng, ZhihongX
2021-10-13 2:36 ` Dmitry Kozlyuk
0 siblings, 1 reply; 29+ messages in thread
From: Peng, ZhihongX @ 2021-10-13 1:53 UTC (permalink / raw)
To: Dmitry Kozlyuk; +Cc: olivier.matz, dev, stable
> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Monday, October 11, 2021 4:26 PM
> To: Peng, ZhihongX <zhihongx.peng@intel.com>
> Cc: olivier.matz@6wind.com; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
>
> 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.
The release notes have stated that this is the only thing we can do,
and this unreasonable design should be resolved as soon as possible.
And the user apps change is very small.
> >
> > 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.
v4 version will be fixed.
> >
> > 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);
> > }
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
2021-10-13 1:53 ` Peng, ZhihongX
@ 2021-10-13 2:36 ` Dmitry Kozlyuk
2021-10-13 3:12 ` Peng, ZhihongX
0 siblings, 1 reply; 29+ messages in thread
From: Dmitry Kozlyuk @ 2021-10-13 2:36 UTC (permalink / raw)
To: Peng, ZhihongX; +Cc: olivier.matz, dev, stable
2021-10-13 01:53 (UTC+0000), Peng, ZhihongX:
> > -----Original Message-----
> > From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > Sent: Monday, October 11, 2021 4:26 PM
> > To: Peng, ZhihongX <zhihongx.peng@intel.com>
> > Cc: olivier.matz@6wind.com; dev@dpdk.org; stable@dpdk.org
> > Subject: Re: [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
> >
> > 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.
>
> The release notes have stated that this is the only thing we can do,
> and this unreasonable design should be resolved as soon as possible.
> And the user apps change is very small.
Stable release means stable ABI, which means that a compiled binary can use
the next minor version of DPDK without recompilation. No code change is
possible in this scenario. If the behavior changes such that cmdline_exit() +
cmdline_free() worked before and now cmdline_free() cause double-free, this
is an ABI breakage. Simply put, DPDK .so are replaced, the app restarts and
crashes. Users can do nothing about that.
Release notes are for developers updating their application code for the next
DPDK version.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
2021-10-13 2:36 ` Dmitry Kozlyuk
@ 2021-10-13 3:12 ` Peng, ZhihongX
0 siblings, 0 replies; 29+ messages in thread
From: Peng, ZhihongX @ 2021-10-13 3:12 UTC (permalink / raw)
To: Dmitry Kozlyuk; +Cc: olivier.matz, dev, stable
> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Wednesday, October 13, 2021 10:36 AM
> To: Peng, ZhihongX <zhihongx.peng@intel.com>
> Cc: olivier.matz@6wind.com; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit
>
> 2021-10-13 01:53 (UTC+0000), Peng, ZhihongX:
> > > -----Original Message-----
> > > From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > > Sent: Monday, October 11, 2021 4:26 PM
> > > To: Peng, ZhihongX <zhihongx.peng@intel.com>
> > > Cc: olivier.matz@6wind.com; dev@dpdk.org; stable@dpdk.org
> > > Subject: Re: [PATCH v3 1/2] lib/cmdline: release cl when cmdline
> > > exit
> > >
> > > 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.
> >
> > The release notes have stated that this is the only thing we can do,
> > and this unreasonable design should be resolved as soon as possible.
> > And the user apps change is very small.
>
> Stable release means stable ABI, which means that a compiled binary can use
> the next minor version of DPDK without recompilation. No code change is
> possible in this scenario. If the behavior changes such that cmdline_exit() +
> cmdline_free() worked before and now cmdline_free() cause double-free,
> this is an ABI breakage. Simply put, DPDK .so are replaced, the app restarts
> and crashes. Users can do nothing about that.
>
> Release notes are for developers updating their application code for the next
> DPDK version.
I may not understand what you mean. I want to know whether this code
can be merged, and if it can be merged, what work do I need to do.
^ permalink raw reply [flat|nested] 29+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] lib/cmdline: release cl when cmdline exit
2021-10-08 6:41 ` [dpdk-dev] [PATCH v3 1/2] lib/cmdline: release cl when cmdline exit zhihongx.peng
` (2 preceding siblings ...)
2021-10-11 8:25 ` Dmitry Kozlyuk
@ 2021-10-13 1:52 ` zhihongx.peng
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 2/2] app/test: delete cmdline free function zhihongx.peng
2021-10-15 12:58 ` [dpdk-dev] [PATCH v4 1/2] " Olivier Matz
3 siblings, 2 replies; 29+ messages in thread
From: zhihongx.peng @ 2021-10-13 1:52 UTC (permalink / raw)
To: olivier.matz, dmitry.kozliuk; +Cc: dev, Zhihong Peng, stable
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
Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
---
doc/guides/rel_notes/release_21_11.rst | 3 +++
lib/cmdline/cmdline_socket.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index f643a61f44..2f59077709 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -226,6 +226,9 @@ API Changes
the crypto/security operation. This field will be used to communicate
events such as soft expiry with IPsec in lookaside mode.
+* 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);
}
--
2.25.1
^ permalink raw reply [flat|nested] 29+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] app/test: delete cmdline free function
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 " zhihongx.peng
@ 2021-10-13 1:52 ` zhihongx.peng
2021-10-18 13:58 ` [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit zhihongx.peng
2021-10-15 12:58 ` [dpdk-dev] [PATCH v4 1/2] " Olivier Matz
1 sibling, 1 reply; 29+ messages in thread
From: zhihongx.peng @ 2021-10-13 1:52 UTC (permalink / raw)
To: olivier.matz, dmitry.kozliuk; +Cc: dev, Zhihong Peng, stable
From: Zhihong Peng <zhihongx.peng@intel.com>
Cmdline will be released in cmdline_stdin_exit function,
so it does not need to be released here.
Fixes: acdabc450ea0 ("test: fix terminal settings on exit")
Cc: stable@dpdk.org
Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
---
app/test/test.c | 1 -
app/test/test_cmdline_lib.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/app/test/test.c b/app/test/test.c
index 173d202e47..5194131026 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -233,7 +233,6 @@ main(int argc, char **argv)
cmdline_interact(cl);
cmdline_stdin_exit(cl);
- cmdline_free(cl);
}
#endif
ret = 0;
diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
index d5a09b4541..6bcfa6511e 100644
--- a/app/test/test_cmdline_lib.c
+++ b/app/test/test_cmdline_lib.c
@@ -174,7 +174,6 @@ test_cmdline_socket_fns(void)
/* void functions */
cmdline_stdin_exit(NULL);
- cmdline_free(cl);
return 0;
error:
printf("Error: function accepted null parameter!\n");
--
2.25.1
^ permalink raw reply [flat|nested] 29+ messages in thread
* [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 2/2] app/test: delete cmdline free function zhihongx.peng
@ 2021-10-18 13:58 ` zhihongx.peng
2021-10-18 14:29 ` Dmitry Kozlyuk
2021-10-20 9:22 ` Peng, ZhihongX
0 siblings, 2 replies; 29+ messages in thread
From: zhihongx.peng @ 2021-10-18 13:58 UTC (permalink / raw)
To: olivier.matz, dmitry.kozliuk; +Cc: dev, Zhihong Peng
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: intel.com
Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
---
app/test/test.c | 1 -
app/test/test_cmdline_lib.c | 1 -
doc/guides/rel_notes/release_21_11.rst | 3 +++
lib/cmdline/cmdline_socket.c | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/test/test.c b/app/test/test.c
index 173d202e47..5194131026 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -233,7 +233,6 @@ main(int argc, char **argv)
cmdline_interact(cl);
cmdline_stdin_exit(cl);
- cmdline_free(cl);
}
#endif
ret = 0;
diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
index d5a09b4541..6bcfa6511e 100644
--- a/app/test/test_cmdline_lib.c
+++ b/app/test/test_cmdline_lib.c
@@ -174,7 +174,6 @@ test_cmdline_socket_fns(void)
/* void functions */
cmdline_stdin_exit(NULL);
- cmdline_free(cl);
return 0;
error:
printf("Error: function accepted null parameter!\n");
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index d5435a64aa..6aa98d1e34 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -237,6 +237,9 @@ API Changes
the crypto/security operation. This field will be used to communicate
events such as soft expiry with IPsec in lookaside mode.
+* 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);
}
--
2.25.1
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
2021-10-18 13:58 ` [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit zhihongx.peng
@ 2021-10-18 14:29 ` Dmitry Kozlyuk
2021-10-20 7:03 ` Olivier Matz
2021-10-20 9:22 ` Peng, ZhihongX
1 sibling, 1 reply; 29+ messages in thread
From: Dmitry Kozlyuk @ 2021-10-18 14:29 UTC (permalink / raw)
To: zhihongx.peng; +Cc: olivier.matz, dev
2021-10-18 21:58 (UTC+0800), 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: intel.com
>
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
2021-10-18 14:29 ` Dmitry Kozlyuk
@ 2021-10-20 7:03 ` Olivier Matz
2021-10-22 21:33 ` Thomas Monjalon
0 siblings, 1 reply; 29+ messages in thread
From: Olivier Matz @ 2021-10-20 7:03 UTC (permalink / raw)
To: Dmitry Kozlyuk; +Cc: zhihongx.peng, dev
On Mon, Oct 18, 2021 at 05:29:35PM +0300, Dmitry Kozlyuk wrote:
> 2021-10-18 21:58 (UTC+0800), 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: intel.com
> >
> > Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
>
> Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
2021-10-20 7:03 ` Olivier Matz
@ 2021-10-22 21:33 ` Thomas Monjalon
0 siblings, 0 replies; 29+ messages in thread
From: Thomas Monjalon @ 2021-10-22 21:33 UTC (permalink / raw)
To: zhihongx.peng; +Cc: Dmitry Kozlyuk, dev, dev, Olivier Matz
20/10/2021 09:03, Olivier Matz:
> On Mon, Oct 18, 2021 at 05:29:35PM +0300, Dmitry Kozlyuk wrote:
> > 2021-10-18 21:58 (UTC+0800), 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: intel.com
> > >
> > > Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> >
> > Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit
2021-10-18 13:58 ` [dpdk-dev] [PATCH v5] lib/cmdline: release cl when cmdline exit zhihongx.peng
2021-10-18 14:29 ` Dmitry Kozlyuk
@ 2021-10-20 9:22 ` Peng, ZhihongX
1 sibling, 0 replies; 29+ messages in thread
From: Peng, ZhihongX @ 2021-10-20 9:22 UTC (permalink / raw)
To: olivier.matz, dmitry.kozliuk; +Cc: dev
> -----Original Message-----
> From: Peng, ZhihongX <zhihongx.peng@intel.com>
> Sent: Monday, October 18, 2021 9:59 PM
> To: olivier.matz@6wind.com; dmitry.kozliuk@gmail.com
> Cc: dev@dpdk.org; Peng, ZhihongX <zhihongx.peng@intel.com>
> Subject: [PATCH v5] lib/cmdline: release cl when cmdline exit
>
> 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: intel.com
>
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
> app/test/test.c | 1 -
> app/test/test_cmdline_lib.c | 1 -
> doc/guides/rel_notes/release_21_11.rst | 3 +++
> lib/cmdline/cmdline_socket.c | 1 +
> 4 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test.c b/app/test/test.c index 173d202e47..5194131026
> 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -233,7 +233,6 @@ main(int argc, char **argv)
>
> cmdline_interact(cl);
> cmdline_stdin_exit(cl);
> - cmdline_free(cl);
> }
> #endif
> ret = 0;
> diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c index
> d5a09b4541..6bcfa6511e 100644
> --- a/app/test/test_cmdline_lib.c
> +++ b/app/test/test_cmdline_lib.c
> @@ -174,7 +174,6 @@ test_cmdline_socket_fns(void)
> /* void functions */
> cmdline_stdin_exit(NULL);
>
> - cmdline_free(cl);
> return 0;
> error:
> printf("Error: function accepted null parameter!\n"); diff --git
> a/doc/guides/rel_notes/release_21_11.rst
> b/doc/guides/rel_notes/release_21_11.rst
> index d5435a64aa..6aa98d1e34 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -237,6 +237,9 @@ API Changes
> the crypto/security operation. This field will be used to communicate
> events such as soft expiry with IPsec in lookaside mode.
>
> +* 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);
> }
> --
> 2.25.1
Tested-by: Zhihong Peng <zhihongx.peng@intel.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] lib/cmdline: release cl when cmdline exit
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 " zhihongx.peng
2021-10-13 1:52 ` [dpdk-dev] [PATCH v4 2/2] app/test: delete cmdline free function zhihongx.peng
@ 2021-10-15 12:58 ` Olivier Matz
2021-10-18 5:16 ` Peng, ZhihongX
1 sibling, 1 reply; 29+ messages in thread
From: Olivier Matz @ 2021-10-15 12:58 UTC (permalink / raw)
To: zhihongx.peng; +Cc: dmitry.kozliuk, dev, stable
On Wed, Oct 13, 2021 at 01:52:22AM +0000, zhihongx.peng@intel.com wrote:
> 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 said by Dmitry, we should not backport this fix to avoid breaking
external apps.
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
I suggest to merge the 2 patches in one, because the second is mandatory
when the first one is applied.
Thanks Zhihong, and thanks Dmitry for the previous review.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] lib/cmdline: release cl when cmdline exit
2021-10-15 12:58 ` [dpdk-dev] [PATCH v4 1/2] " Olivier Matz
@ 2021-10-18 5:16 ` Peng, ZhihongX
0 siblings, 0 replies; 29+ messages in thread
From: Peng, ZhihongX @ 2021-10-18 5:16 UTC (permalink / raw)
To: Olivier Matz; +Cc: dmitry.kozliuk, dev, stable
> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Friday, October 15, 2021 8:58 PM
> To: Peng, ZhihongX <zhihongx.peng@intel.com>
> Cc: dmitry.kozliuk@gmail.com; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH v4 1/2] lib/cmdline: release cl when cmdline exit
>
> On Wed, Oct 13, 2021 at 01:52:22AM +0000, zhihongx.peng@intel.com wrote:
> > 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 said by Dmitry, we should not backport this fix to avoid breaking external
> apps.
The v5 version will be fixed.
> > Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
>
> I suggest to merge the 2 patches in one, because the second is mandatory
> when the first one is applied.
The v5 version will be fixed
> Thanks Zhihong, and thanks Dmitry for the previous review.
^ permalink raw reply [flat|nested] 29+ messages in thread