[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220110071821.549570773@linuxfoundation.org>
Date: Mon, 10 Jan 2022 08:22:38 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, David Howells <dhowells@...hat.com>,
Dominique Martinet <asmadeus@...ewreck.org>,
Jeffrey E Altman <jaltman@...istor.com>
Subject: [PATCH 5.15 01/72] fscache_cookie_enabled: check cookie is valid before accessing it
From: Dominique Martinet <asmadeus@...ewreck.org>
commit 0dc54bd4d6e03be1f0b678c4297170b79f1a44ab upstream.
fscache_cookie_enabled() could be called on NULL cookies and cause a
null pointer dereference when accessing cookie flags: just make sure
the cookie is valid first
Suggested-by: David Howells <dhowells@...hat.com>
Acked-by: David Howells <dhowells@...hat.com>
Signed-off-by: Dominique Martinet <asmadeus@...ewreck.org>
Cc: Jeffrey E Altman <jaltman@...istor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
include/linux/fscache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -167,7 +167,7 @@ struct fscache_cookie {
static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie)
{
- return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
+ return fscache_cookie_valid(cookie) && test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
}
/*
Powered by blists - more mailing lists