[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1471996381.142265.1624346654994.JavaMail.zimbra@nod.at>
Date: Tue, 22 Jun 2021 09:24:15 +0200 (CEST)
From: Richard Weinberger <richard@....at>
To: chengzhihao1 <chengzhihao1@...wei.com>
Cc: Colin Ian King <colin.king@...onical.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
linux-mtd <linux-mtd@...ts.infradead.org>,
kernel-janitors <kernel-janitors@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ubifs: Remove a redundant null check on pointer lp
----- Ursprüngliche Mail -----
> I just found out about it today thanks to your patch. Commit
> c770cd5190ba ("ubifs: fix an IS_ERR() vs NULL check") did import a new
> problem that ubifs_gc_start_commit() may return -ENOMEM while syncing fs.
> I guess ubifs_fast_find_frdi_idx() return NULL pointer is the
> termination condition in while-loop, which means we cannot get a
> freeable index LEB in ubifs_gc_start_commit().
Good catch! :-)
>> - if (!lp)
>> - break;
>> idx_gc = kmalloc(sizeof(struct ubifs_gced_idx_leb), GFP_NOFS);
>> if (!idx_gc) {
>> err = -ENOMEM;
>>
> BTW, the following modifications may be what you want?
> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
> index 7cc22d7317ea..b1f276599b04 100644
> --- a/fs/ubifs/gc.c
> +++ b/fs/ubifs/gc.c
> @@ -895,10 +895,6 @@ int ubifs_gc_start_commit(struct ubifs_info *c)
> /* Record index freeable LEBs for unmapping after commit */
> while (1) {
> lp = ubifs_fast_find_frdi_idx(c);
> - if (!lp) {
> - err = -ENOMEM;
> - goto out;
> - }
> if (!lp)
> break;
> idx_gc = kmalloc(sizeof(struct ubifs_gced_idx_leb),
> GFP_NOFS);
I'll drop Dan's patch from -next. Do you want to send a followup patch which removes the
in vain check?
Thanks,
//richard
Powered by blists - more mailing lists