]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/ksm: add missing IS_ERR_OR_NULL check for stable_tree_search()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Thu, 24 Oct 2024 03:23:00 +0000 (11:23 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:28:55 +0000 (21:28 -0700)
commit7b835854a95663680686d0c0150a6bca813981cf
treef6e5182f8494bc592d6fac12d72cd5732bb4132d
parent44ab1b78f5386a715f0ed6fcf0faccafd01d7863
mm/ksm: add missing IS_ERR_OR_NULL check for stable_tree_search()

The stable_tree_search() maybe return -EBUSY if the stable node's page is
being migrated or nullptr, we need to check kfolio with IS_ERR_OR_NULL()
before dereference it.

To mitigate this, add IS_ERR_OR_NULL check for stable_tree_search().

Link: https://lkml.kernel.org/r/20241024032300.2501949-1-cuigaosheng1@huawei.com
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c