On Fri, Mar 25, 2016 at 07:00:14PM +0800, Guoqing Jiang wrote: > If bitmap_create returns an error, bitmap_destroy must be > called to do clean up. > > Signed-off-by: Guoqing Jiang <gqjiang@xxxxxxxx> > --- > drivers/md/bitmap.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c > index 7df6b4f..ba908e7 100644 > --- a/drivers/md/bitmap.c > +++ b/drivers/md/bitmap.c > @@ -1865,8 +1865,10 @@ int bitmap_copy_from_slot(struct mddev *mddev, int slot, > struct bitmap_counts *counts; > struct bitmap *bitmap = bitmap_create(mddev, slot); > > - if (IS_ERR(bitmap)) > + if (IS_ERR(bitmap)) { > + bitmap_destroy(mddev); > return PTR_ERR(bitmap); > + } bitmap_create doesn't set mddev->bitmap, so bitmap_destroy will do nothing. is this because of reference leak of sysfs_can_clear? can we move sysfs_put(bitmap->sysfs_can_clear); to bitmap_free? Thanks, Shaohua -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html