On Wed, Sep 20, 2017 at 09:28:34PM +0300, Rakesh Pandit wrote:
> Hi Javier,
> 
> one small issue I found for error path while going through changes:
> 
> On Mon, Jun 26, 2017 at 11:57:17AM +0200, Javier González wrote:
> ..
> > +static int pblk_lines_alloc_metadata(struct pblk *pblk)
> > +{
[..]
> > +           if (!l_mg->sline_meta[i])
> > +                   goto fail_free_smeta;
> 
> For this error path the the goto label at end doesn't free up
> resources correctly.  It needs a
> 
> while (--index >= 0)...
> 
> logic with appropriate adjustment.
> 
> > +   }
[..]
> > +   if (!l_mg->vsc_list)
> > +           goto fail_free_emeta;
> > +
> > +   for (i = 0; i < l_mg->nr_lines; i++)
> > +           l_mg->vsc_list[i] = cpu_to_le32(EMPTY_ENTRY);
> > +
> > +   return 0;
> > +
> > +fail_free_emeta:
> > +   while (--i >= 0) {
> > +           vfree(l_mg->eline_meta[i]->buf);
> 
> This would need l_mg->emeta_alloc_type check to decide whether
> allocation was done with kmalloc or vmalloc.
> 
> > +           kfree(&l_mg->eline_meta[i]);
> > +   }
> > +
> > +fail_free_smeta:
> > +   for (i = 0; i < PBLK_DATA_LINES; i++)
> > +           pblk_mfree(&l_mg->sline_meta[i], l_mg->smeta_alloc_type);
> > +
> > +   return -ENOMEM;
> > +}
> > +
> 
> Thanks,

I failed to see earlier that it has been merged already.  Will post a
patch in a while.

Thanks,

Reply via email to