Message ID | 20150308094622.25074.27035.stgit@localhost.localdomain |
---|---|
State | Superseded |
Headers | show |
On 03/08/2015 03:16 PM, Vasant Hegde wrote: > free fsp_msg if fsp_queue_msg fails. > > Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> > --- > hw/occ.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/hw/occ.c b/hw/occ.c > index 657f2ad..b523a42 100644 > --- a/hw/occ.c > +++ b/hw/occ.c > @@ -409,6 +409,7 @@ static void __occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id) > if (rc) { > log_simple_error(&e_info(OPAL_RC_OCC_LOAD), > "OCC: Error %d queueing FSP OCC LOAD STATUS msg", rc); > + free(stat); fsp_freemsg() should be used instead, to avoid leaking 'msg->resp' Same at the other places below. Neelesh. > } > } > > @@ -446,6 +447,7 @@ static void occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id) > if (rc) { > log_simple_error(&e_info(OPAL_RC_OCC_LOAD), > "OCC: Error %d queueing FSP OCC LOAD reply\n", rc); > + free(rsp); > return; > } > > @@ -481,6 +483,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) > if (rsp) > rc = fsp_queue_msg(rsp, fsp_freemsg); > if (rc) { > + free(rsp); > log_simple_error(&e_info(OPAL_RC_OCC_RESET), > "OCC: Error %d queueing FSP OCC RESET reply\n", rc); > return; > @@ -509,6 +512,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) > if (stat) > rc = fsp_queue_msg(stat, fsp_freemsg); > if (rc) { > + free(stat); > log_simple_error(&e_info(OPAL_RC_OCC_RESET), > "OCC: Error %d queueing FSP OCC RESET" > " STATUS message\n", rc); > @@ -528,6 +532,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) > if (stat) > rc = fsp_queue_msg(stat, fsp_freemsg); > if (rc) { > + free(stat); > log_simple_error(&e_info(OPAL_RC_OCC_RESET), > "OCC: Error %d queueing FSP OCC RESET" > " STATUS message\n", rc); > > _______________________________________________ > Skiboot mailing list > Skiboot@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/skiboot
On 03/08/2015 09:11 PM, Neelesh Gupta wrote: > > On 03/08/2015 03:16 PM, Vasant Hegde wrote: >> free fsp_msg if fsp_queue_msg fails. >> >> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> >> --- >> hw/occ.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/hw/occ.c b/hw/occ.c >> index 657f2ad..b523a42 100644 >> --- a/hw/occ.c >> +++ b/hw/occ.c >> @@ -409,6 +409,7 @@ static void __occ_do_load(u8 scope, u32 dbob_id __unused, >> u32 seq_id) >> if (rc) { >> log_simple_error(&e_info(OPAL_RC_OCC_LOAD), >> "OCC: Error %d queueing FSP OCC LOAD STATUS msg", rc); >> + free(stat); > > fsp_freemsg() should be used instead, to avoid leaking 'msg->resp' > Same at the other places below. Yep.. You are right.. Fixed in v2. -Vasant
diff --git a/hw/occ.c b/hw/occ.c index 657f2ad..b523a42 100644 --- a/hw/occ.c +++ b/hw/occ.c @@ -409,6 +409,7 @@ static void __occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id) if (rc) { log_simple_error(&e_info(OPAL_RC_OCC_LOAD), "OCC: Error %d queueing FSP OCC LOAD STATUS msg", rc); + free(stat); } } @@ -446,6 +447,7 @@ static void occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id) if (rc) { log_simple_error(&e_info(OPAL_RC_OCC_LOAD), "OCC: Error %d queueing FSP OCC LOAD reply\n", rc); + free(rsp); return; } @@ -481,6 +483,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) if (rsp) rc = fsp_queue_msg(rsp, fsp_freemsg); if (rc) { + free(rsp); log_simple_error(&e_info(OPAL_RC_OCC_RESET), "OCC: Error %d queueing FSP OCC RESET reply\n", rc); return; @@ -509,6 +512,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) if (stat) rc = fsp_queue_msg(stat, fsp_freemsg); if (rc) { + free(stat); log_simple_error(&e_info(OPAL_RC_OCC_RESET), "OCC: Error %d queueing FSP OCC RESET" " STATUS message\n", rc); @@ -528,6 +532,7 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id) if (stat) rc = fsp_queue_msg(stat, fsp_freemsg); if (rc) { + free(stat); log_simple_error(&e_info(OPAL_RC_OCC_RESET), "OCC: Error %d queueing FSP OCC RESET" " STATUS message\n", rc);
free fsp_msg if fsp_queue_msg fails. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> --- hw/occ.c | 5 +++++ 1 file changed, 5 insertions(+)