Commit 0dc54bd4 authored by Dominique Martinet's avatar Dominique Martinet
Browse files

fscache_cookie_enabled: check cookie is valid before accessing it



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: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarDominique Martinet <asmadeus@codewreck.org>
parent 4cd82a5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
}

/*