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

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
......@@ -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);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment