* [PATCH v3 2/5] arcmsr: fixes not release allocated resource
@ 2015-11-25 11:41 Ching Huang
2015-11-25 12:00 ` Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ching Huang @ 2015-11-25 11:41 UTC (permalink / raw)
To: hch, thenzl, jbottomley, dan.carpenter, agordeev, linux-scsi,
linux-kernel, hare, jthumshirn
Cc: hch
From: Ching Huang <ching2048@areca.com.tw>
Releasing allocated resource if get configuration data failed.
Signed-of-by: Ching Huang <ching2048@areca.com.tw>
---
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000 +0800
@@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
miscellaneous data' timeout \n", acb->host->host_no);
- return false;
+ goto err_free_dma;
}
count = 8;
while (count){
@@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
acb->firm_cfg_version = readl(®->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
/*firm_ide_channels,4,16-19*/
return true;
+err_free_dma:
+ dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
+ acb->dma_coherent2, acb->dma_coherent_handle2);
+ return false;
}
static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
2015-11-25 11:41 [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang
@ 2015-11-25 12:00 ` Johannes Thumshirn
2015-11-25 12:05 ` Hannes Reinecke
2015-11-25 13:55 ` Tomas Henzl
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2015-11-25 12:00 UTC (permalink / raw)
To: Ching Huang
Cc: hch, hch, thenzl, jbottomley, dan.carpenter, agordeev, linux-scsi,
linux-kernel, hare
On Wed, 2015-11-25 at 19:41 +0800, Ching Huang wrote:
> From: Ching Huang <ching2048@areca.com.tw>
>
> Releasing allocated resource if get configuration data failed.
>
> Signed-of-by: Ching Huang <ching2048@areca.com.tw>
>
> ---
>
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c
> b/drivers/scsi/arcmsr/arcmsr_hba.c
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000
> +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000
> +0800
> @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
> if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
> printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
> miscellaneous data' timeout \n", acb->host-
> >host_no);
> - return false;
> + goto err_free_dma;
> }
> count = 8;
> while (count){
> @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
> acb->firm_cfg_version = readl(®-
> >message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
> /*firm_ide_channels,4,16-19*/
> return true;
> +err_free_dma:
> + dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
> + acb->dma_coherent2, acb->dma_coherent_handle2);
> + return false;
> }
>
> static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
>
>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
2015-11-25 11:41 [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang
2015-11-25 12:00 ` Johannes Thumshirn
@ 2015-11-25 12:05 ` Hannes Reinecke
2015-11-25 13:55 ` Tomas Henzl
2 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2015-11-25 12:05 UTC (permalink / raw)
To: Ching Huang, hch, thenzl, jbottomley, dan.carpenter, agordeev,
linux-scsi, linux-kernel, jthumshirn
Cc: hch
On 11/25/2015 12:41 PM, Ching Huang wrote:
> From: Ching Huang <ching2048@areca.com.tw>
>
> Releasing allocated resource if get configuration data failed.
>
> Signed-of-by: Ching Huang <ching2048@areca.com.tw>
>
> ---
>
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000 +0800
> @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
> if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
> printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
> miscellaneous data' timeout \n", acb->host->host_no);
> - return false;
> + goto err_free_dma;
> }
> count = 8;
> while (count){
> @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
> acb->firm_cfg_version = readl(®->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
> /*firm_ide_channels,4,16-19*/
> return true;
> +err_free_dma:
> + dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
> + acb->dma_coherent2, acb->dma_coherent_handle2);
> + return false;
> }
>
> static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
>
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
2015-11-25 11:41 [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang
2015-11-25 12:00 ` Johannes Thumshirn
2015-11-25 12:05 ` Hannes Reinecke
@ 2015-11-25 13:55 ` Tomas Henzl
2015-11-26 7:32 ` Ching Huang
2 siblings, 1 reply; 6+ messages in thread
From: Tomas Henzl @ 2015-11-25 13:55 UTC (permalink / raw)
To: Ching Huang, hch, jbottomley, dan.carpenter, agordeev, linux-scsi,
linux-kernel, hare, jthumshirn
Cc: hch
On 25.11.2015 12:41, Ching Huang wrote:
> From: Ching Huang <ching2048@areca.com.tw>
>
> Releasing allocated resource if get configuration data failed.
>
> Signed-of-by: Ching Huang <ching2048@areca.com.tw>
>
> ---
>
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000 +0800
> @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
> if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
> printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
> miscellaneous data' timeout \n", acb->host->host_no);
> - return false;
> + goto err_free_dma;
> }
> count = 8;
> while (count){
> @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
> acb->firm_cfg_version = readl(®->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
> /*firm_ide_channels,4,16-19*/
> return true;
> +err_free_dma:
> + dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
> + acb->dma_coherent2, acb->dma_coherent_handle2);
> + return false;
> }
>
The resource should be released here, that is okay.
How works the resource management when the eh_bus_reset_handler
is called ? It looks to me that you allocate a new
acb->dma_coherent2 without releasing it before.
Btw. is it needed in that handler to re-read the firmware-spec?
Tomas
> static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
2015-11-25 13:55 ` Tomas Henzl
@ 2015-11-26 7:32 ` Ching Huang
2015-11-26 13:08 ` Tomas Henzl
0 siblings, 1 reply; 6+ messages in thread
From: Ching Huang @ 2015-11-26 7:32 UTC (permalink / raw)
To: Tomas Henzl
Cc: hch, jbottomley, dan.carpenter, agordeev, linux-scsi,
linux-kernel, hare, jthumshirn, hch
On Wed, 2015-11-25 at 14:55 +0100, Tomas Henzl wrote:
> On 25.11.2015 12:41, Ching Huang wrote:
> > From: Ching Huang <ching2048@areca.com.tw>
> >
> > Releasing allocated resource if get configuration data failed.
> >
> > Signed-of-by: Ching Huang <ching2048@areca.com.tw>
> >
> > ---
> >
> > diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> > --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000 +0800
> > +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000 +0800
> > @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
> > if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
> > printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
> > miscellaneous data' timeout \n", acb->host->host_no);
> > - return false;
> > + goto err_free_dma;
> > }
> > count = 8;
> > while (count){
> > @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
> > acb->firm_cfg_version = readl(®->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
> > /*firm_ide_channels,4,16-19*/
> > return true;
> > +err_free_dma:
> > + dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
> > + acb->dma_coherent2, acb->dma_coherent_handle2);
> > + return false;
> > }
> >
>
> The resource should be released here, that is okay.
>
> How works the resource management when the eh_bus_reset_handler
> is called ? It looks to me that you allocate a new
> acb->dma_coherent2 without releasing it before.
> Btw. is it needed in that handler to re-read the firmware-spec?
>
> Tomas
>
You are right. In eh_bus_reset_handler, there may re-allocate a new dma resource if call get_config again.
I will initiate a new patches for this bug after current 5 patches.
Thanks Tomas.
> > static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
2015-11-26 7:32 ` Ching Huang
@ 2015-11-26 13:08 ` Tomas Henzl
0 siblings, 0 replies; 6+ messages in thread
From: Tomas Henzl @ 2015-11-26 13:08 UTC (permalink / raw)
To: Ching Huang
Cc: hch, jbottomley, dan.carpenter, agordeev, linux-scsi,
linux-kernel, hare, jthumshirn, hch
On 26.11.2015 08:32, Ching Huang wrote:
> On Wed, 2015-11-25 at 14:55 +0100, Tomas Henzl wrote:
>> On 25.11.2015 12:41, Ching Huang wrote:
>>> From: Ching Huang <ching2048@areca.com.tw>
>>>
>>> Releasing allocated resource if get configuration data failed.
>>>
>>> Signed-of-by: Ching Huang <ching2048@areca.com.tw>
>>>
>>> ---
>>>
>>> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
>>> --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-24 11:35:26.000000000 +0800
>>> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2015-11-25 19:04:44.590970000 +0800
>>> @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
>>> if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
>>> printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
>>> miscellaneous data' timeout \n", acb->host->host_no);
>>> - return false;
>>> + goto err_free_dma;
>>> }
>>> count = 8;
>>> while (count){
>>> @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
>>> acb->firm_cfg_version = readl(®->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
>>> /*firm_ide_channels,4,16-19*/
>>> return true;
>>> +err_free_dma:
>>> + dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
>>> + acb->dma_coherent2, acb->dma_coherent_handle2);
>>> + return false;
>>> }
>>>
>> The resource should be released here, that is okay.
>>
>> How works the resource management when the eh_bus_reset_handler
>> is called ? It looks to me that you allocate a new
>> acb->dma_coherent2 without releasing it before.
>> Btw. is it needed in that handler to re-read the firmware-spec?
>>
>> Tomas
>>
> You are right. In eh_bus_reset_handler, there may re-allocate a new dma resource if call get_config again.
> I will initiate a new patches for this bug after current 5 patches.
> Thanks Tomas.
ok, so for this patch -
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Tomas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-26 13:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 11:41 [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang
2015-11-25 12:00 ` Johannes Thumshirn
2015-11-25 12:05 ` Hannes Reinecke
2015-11-25 13:55 ` Tomas Henzl
2015-11-26 7:32 ` Ching Huang
2015-11-26 13:08 ` Tomas Henzl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).