linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Baoquan He <bhe@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Matthew Wilcox <willy@infradead.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Subject: [PATCH 2/2] mm: vmalloc: Replace BUG_ON() by WARN_ON_ONCE()
Date: Tue, 20 Dec 2022 19:27:04 +0100	[thread overview]
Message-ID: <20221220182704.181657-2-urezki@gmail.com> (raw)
In-Reply-To: <20221220182704.181657-1-urezki@gmail.com>

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@gmail.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



  reply	other threads:[~2022-12-20 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 18:27 [PATCH 1/2] mm: vmalloc: Avoid a double lookup of freed VA in a tree Uladzislau Rezki (Sony)
2022-12-20 18:27 ` Uladzislau Rezki (Sony) [this message]
2022-12-20 18:45   ` [PATCH 2/2] mm: vmalloc: Replace BUG_ON() by WARN_ON_ONCE() Uladzislau Rezki
2022-12-20 18:53   ` Lorenzo Stoakes
2022-12-20 18:56     ` Lorenzo Stoakes
2022-12-21 11:39       ` Uladzislau Rezki
2022-12-20 18:45 ` [PATCH 1/2] mm: vmalloc: Avoid a double lookup of freed VA in a tree Uladzislau Rezki
2022-12-20 18:46   ` Uladzislau Rezki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221220182704.181657-2-urezki@gmail.com \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@gmail.com \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).