vdev: free reply.msgs memory for secondary process

Message ID 20180921162557.48249-1-paul.e.luse@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series vdev: free reply.msgs memory for secondary process |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Luse, Paul E Sept. 21, 2018, 4:25 p.m. UTC
  From: paul luse <paul.e.luse@intel.com>

This patch fixes an issue caught with ASAN where a vdev_scan()
to a secondary bus was failing to free some memory.

Signed-off-by: paul luse <paul.e.luse@intel.com>
---
 drivers/bus/vdev/vdev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Ferruh Yigit Sept. 21, 2018, 4:53 p.m. UTC | #1
On 9/21/2018 5:25 PM, Paul Luse wrote:
> From: paul luse <paul.e.luse@intel.com>
> 
> This patch fixes an issue caught with ASAN where a vdev_scan()
> to a secondary bus was failing to free some memory.
> 
> Signed-off-by: paul luse <paul.e.luse@intel.com>

Hi Paul,

Is this different from below patch, which seems already acked:
https://patches.dpdk.org/patch/45079/


> ---
>  drivers/bus/vdev/vdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index 69dee89a8..2566d6c0d 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -423,6 +423,7 @@ vdev_scan(void)
>  			mp_rep = &mp_reply.msgs[0];
>  			resp = (struct vdev_param *)mp_rep->param;
>  			VDEV_LOG(INFO, "Received %d vdevs", resp->num);
> +			free(mp_reply.msgs);
>  		} else
>  			VDEV_LOG(ERR, "Failed to request vdev from primary");
>  
>
  
Ferruh Yigit Sept. 27, 2018, 1:28 p.m. UTC | #2
On 9/21/2018 5:25 PM, Paul Luse wrote:
> From: paul luse <paul.e.luse@intel.com>
> 
> This patch fixes an issue caught with ASAN where a vdev_scan()
> to a secondary bus was failing to free some memory.
> 
> Signed-off-by: paul luse <paul.e.luse@intel.com>

(carry from Anatoly's ack from other thread)
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>


@Anatoly, what do you think about:
 diff --git a/lib/librte_eal/common/include/rte_eal.h
b/lib/librte_eal/common/include/rte_eal.h
 index e114dcbdc..e1a554f5a 100644
 --- a/lib/librte_eal/common/include/rte_eal.h
 +++ b/lib/librte_eal/common/include/rte_eal.h
 @@ -309,7 +309,7 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
   * This function sends a request message to the peer process, and will
   * block until receiving reply message from the peer process.
   *
 - * @note The caller is responsible to free reply->replies.
 + * @note The caller is responsible to free reply->msgs.
   *
   * @param req
   *   The req argument contains the customized request message.
  
Thomas Monjalon Oct. 25, 2018, 7:28 a.m. UTC | #3
27/09/2018 15:28, Ferruh Yigit:
> On 9/21/2018 5:25 PM, Paul Luse wrote:
> > From: paul luse <paul.e.luse@intel.com>
> > 
> > This patch fixes an issue caught with ASAN where a vdev_scan()
> > to a secondary bus was failing to free some memory.
> > 
> > Signed-off-by: paul luse <paul.e.luse@intel.com>
> 
> (carry from Anatoly's ack from other thread)
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Adding Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
Cc: stable@dpdk.org

> @Anatoly, what do you think about:
>  diff --git a/lib/librte_eal/common/include/rte_eal.h
> b/lib/librte_eal/common/include/rte_eal.h
>  index e114dcbdc..e1a554f5a 100644
>  --- a/lib/librte_eal/common/include/rte_eal.h
>  +++ b/lib/librte_eal/common/include/rte_eal.h
>  @@ -309,7 +309,7 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
>    * This function sends a request message to the peer process, and will
>    * block until receiving reply message from the peer process.
>    *
>  - * @note The caller is responsible to free reply->replies.
>  + * @note The caller is responsible to free reply->msgs.
>    *
>    * @param req
>    *   The req argument contains the customized request message.

Adding this change to the commit.

Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")

All applied, thanks
  

Patch

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 69dee89a8..2566d6c0d 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -423,6 +423,7 @@  vdev_scan(void)
 			mp_rep = &mp_reply.msgs[0];
 			resp = (struct vdev_param *)mp_rep->param;
 			VDEV_LOG(INFO, "Received %d vdevs", resp->num);
+			free(mp_reply.msgs);
 		} else
 			VDEV_LOG(ERR, "Failed to request vdev from primary");