Re: [PATCH v4 00/12] pstore: mtd: support crash log to block and mtd device

From: Kees Cook
Date: Sat May 09 2020 - 15:10:51 EST


On Sat, May 09, 2020 at 06:32:28PM +0800, WeiXiong Liao wrote:
> The following diff is to fix "rmmod" bug.
>
> @@ -1273,8 +1273,8 @@ static void psz_free_zones(struct pstore_zone
> ***pszones, unsigned int *cnt)
> return;
>
> while (*cnt > 0) {
> - psz_free_zone(&zones[*cnt]);
> (*cnt)--;
> + psz_free_zone(&zones[*cnt]);
> }
> kfree(zones);
> *pszones = NULL;

Ah-ha! Thanks; I'd almost found that. I got confused because I wasn't
see NULL free()s, and I finally noticed that the zones had left over
ERR_PTRs:

if (IS_ERR(cxt->fpszs)) {
err = PTR_ERR(cxt->fpszs);
+ cxt->fpszs = NULL;
goto free_out;
}

I'll fix those and your v5 and my lastest tree merged.

--
Kees Cook