All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed.
@ 2017-11-21 12:04 Tetsuo Handa
  2017-11-21 14:56 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2017-11-21 12:04 UTC (permalink / raw)
  To: linux-mm, akpm; +Cc: Tetsuo Handa

There are users calling unregister_shrinker() when register_shrinker()
failed. Add sanity check to unregister_shrinker().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 mm/vmscan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c02c850..9e100cc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -297,6 +297,8 @@ int register_shrinker(struct shrinker *shrinker)
  */
 void unregister_shrinker(struct shrinker *shrinker)
 {
+	if (!shrinker->nr_deferred)
+		return;
 	down_write(&shrinker_rwsem);
 	list_del(&shrinker->list);
 	up_write(&shrinker_rwsem);
-- 
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-21 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 12:04 [PATCH] mm,vmscan: Make unregister_shrinker() no-op if register_shrinker() failed Tetsuo Handa
2017-11-21 14:56 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.