On 14/12/17 07:03, Liu, Changcheng wrote: > function: mmc_ext_csd_open > { > +-- 33 lines: struct mmc_card *card = inode->i_private;-- > if (n != EXT_CSD_STR_LEN) { > err = -EINVAL; > goto out_free; //==>should free ext_csd firstly. > } > +-- 2 lines: filp->private_data = buf;------------------ > kfree(ext_csd); > return 0; > > out_free: > kfree(buf); > return err; > } > > Signed-off-by: Liu Changcheng <changcheng.liu@xxxxxxxxx> Well I don't really follow the commit message, but the patch is OK. How about this: mmc: block: fix logical error to avoid memory leak If the MMC_DRV_OP_GET_EXT_CSD request completes successfully, then ext_csd must be freed, but in one case it was not. Fix that. Otherwise: Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index ccfa98a..b737a95 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -2623,6 +2623,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) > > if (n != EXT_CSD_STR_LEN) { > err = -EINVAL; > + kfree(ext_csd); > goto out_free; > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html