diff mbox series

hiomap: free ipmi message in callback

Message ID 20181026045412.32338-1-stewart@linux.ibm.com
State Accepted
Headers show
Series hiomap: free ipmi message in callback | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/make_check success Test make_check on branch master

Commit Message

Stewart Smith Oct. 26, 2018, 4:54 a.m. UTC
Otherwise we'd slowly leak memory on each hiomap operation.

Fixes: 529bdca0bc546a7ae3ecbd2c3134b7260072d8b0
Tested-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
---
 libflash/ipmi-hiomap.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrew Jeffery Oct. 26, 2018, 4:58 a.m. UTC | #1
On Fri, 26 Oct 2018, at 15:24, Stewart Smith wrote:
> Otherwise we'd slowly leak memory on each hiomap operation.

Yep, that was a bit of a brain fart. Thanks for the fix.

> 
> Fixes: 529bdca0bc546a7ae3ecbd2c3134b7260072d8b0
> Tested-by: Andrew Jeffery <andrew@aj.id.au>
> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
> ---
>  libflash/ipmi-hiomap.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
> index d36c5f12edde..5300daefa9d2 100644
> --- a/libflash/ipmi-hiomap.c
> +++ b/libflash/ipmi-hiomap.c
> @@ -117,6 +117,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
>  	if (msg->resp_size < 2) {
>  		prerror("Illegal response size: %u\n", msg->resp_size);
>  		res->cc = IPMI_ERR_UNSPECIFIED;
> +		ipmi_free_msg(msg);
>  		return;
>  	}
>  
> @@ -124,6 +125,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
>  		prerror("Unmatched sequence number: wanted %u got %u\n",
>  			ctx->seq, msg->data[1]);
>  		res->cc = IPMI_ERR_UNSPECIFIED;
> +		ipmi_free_msg(msg);
>  		return;
>  	}
>  
> @@ -210,6 +212,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
>  		      msg->data[0]);
>  		break;
>  	};
> +	ipmi_free_msg(msg);
>  }
>  
>  static bool hiomap_get_info(struct ipmi_hiomap *ctx)
> -- 
> 2.17.2
>
Stewart Smith Nov. 1, 2018, 3:40 a.m. UTC | #2
Andrew Jeffery <andrew@aj.id.au> writes:
> On Fri, 26 Oct 2018, at 15:24, Stewart Smith wrote:
>> Otherwise we'd slowly leak memory on each hiomap operation.
>
> Yep, that was a bit of a brain fart. Thanks for the fix.

FYI merged to master as of b6de35b6896a7d21a72be79e720eeae2dc620fa2 and
6.0.x as of 4e607093833e5f4c8a9bb1581b887ff6c4d77f6d, and it was in
6.0.10, I just missed sending mail
diff mbox series

Patch

diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index d36c5f12edde..5300daefa9d2 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -117,6 +117,7 @@  static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 	if (msg->resp_size < 2) {
 		prerror("Illegal response size: %u\n", msg->resp_size);
 		res->cc = IPMI_ERR_UNSPECIFIED;
+		ipmi_free_msg(msg);
 		return;
 	}
 
@@ -124,6 +125,7 @@  static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 		prerror("Unmatched sequence number: wanted %u got %u\n",
 			ctx->seq, msg->data[1]);
 		res->cc = IPMI_ERR_UNSPECIFIED;
+		ipmi_free_msg(msg);
 		return;
 	}
 
@@ -210,6 +212,7 @@  static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 		      msg->data[0]);
 		break;
 	};
+	ipmi_free_msg(msg);
 }
 
 static bool hiomap_get_info(struct ipmi_hiomap *ctx)