[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6IC49WT1Zz+wyWK@pc636>
Date: Tue, 20 Dec 2022 19:45:55 +0100
From: Uladzislau Rezki <urezki@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>, Baoquan He <bhe@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
Nicholas Piggin <npiggin@...il.com>,
Oleksiy Avramchenko <oleksiy.avramchenko@...y.com>
Subject: Re: [PATCH 2/2] mm: vmalloc: Replace BUG_ON() by WARN_ON_ONCE()
On Tue, Dec 20, 2022 at 07:27:04PM +0100, Uladzislau Rezki (Sony) wrote:
> Currently a vm_unmap_ram() functions triggers a BUG() if an area
> is not found. Replace it by the WARN_ON_ONCE() error message and
> keep machine alive instead of stopping it.
>
> The worst case is a memory leaking.
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
> ---
> mm/vmalloc.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 0fc38c36e0df..e05a0dc79ac5 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2255,10 +2255,12 @@ void vm_unmap_ram(const void *mem, unsigned int count)
> }
>
> va = find_unlink_vmap_area(addr);
> - BUG_ON(!va);
> - debug_check_no_locks_freed((void *)va->va_start,
> - (va->va_end - va->va_start));
> - free_unmap_vmap_area(va);
> +
> + if (!WARN_ON_ONCE(!va)) {
> + debug_check_no_locks_freed((void *)va->va_start,
> + (va->va_end - va->va_start));
> + free_unmap_vmap_area(va);
> + }
> }
> EXPORT_SYMBOL(vm_unmap_ram);
>
> --
> 2.30.2
>
Will send a v2.
--
Uladzislau Rezki
Powered by blists - more mailing lists