vdev: free reply.msgs memory for secondary process

Message ID 20180920232930.68311-1-peluse@cox.net (mailing list archive)
State Superseded, 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

paul luse Sept. 20, 2018, 11:29 p.m. UTC
  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 <peluse@cox.net>
---
 drivers/bus/vdev/vdev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Anatoly Burakov Sept. 21, 2018, 11:07 a.m. UTC | #1
On 21-Sep-18 12:29 AM, paul luse wrote:
> 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 <peluse@cox.net>
> ---
>   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");
>   
> 
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  

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");