From: Eric Biggers <ebiggers3@gmail.com>
To: stable@vger.kernel.org
Cc: Eric Biggers <ebiggers@google.com>, David Howells <dhowells@redhat.com>
Subject: [PATCH] FS-Cache: fix dereference of NULL user_key_payload
Date: Tue, 24 Oct 2017 16:44:47 -0700 [thread overview]
Message-ID: <20171024234447.77995-1-ebiggers3@gmail.com> (raw)
From: Eric Biggers <ebiggers@google.com>
commit d124b2c53c7bee6569d2a2d0b18b4a1afde00134 upstream. Please apply
to stable for 4.3 and earlier.
When the file /proc/fs/fscache/objects (available with
CONFIG_FSCACHE_OBJECT_LIST=y) is opened, we request a user key with
description "fscache:objlist", then access its payload. However, a
revoked key has a NULL payload, and we failed to check for this.
request_key() *does* skip revoked keys, but there is still a window
where the key can be revoked before we access its payload.
Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.
Fixes: 4fbf4291aa15 ("FS-Cache: Allow the current state of all objects to be dumped")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Cc: <stable@vger.kernel.org> [v2.6.32+]
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/fscache/object-list.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index 51dde817e1f2..11cf71ac1cb5 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -330,6 +330,13 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
rcu_read_lock();
confkey = key->payload.data;
+ if (!confkey) {
+ /* key was revoked */
+ rcu_read_unlock();
+ key_put(key);
+ goto no_config;
+ }
+
buf = confkey->data;
for (len = confkey->datalen - 1; len >= 0; len--) {
--
2.15.0.rc0.271.g36b669edcc-goog
next reply other threads:[~2017-10-24 23:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 23:44 Eric Biggers [this message]
2017-10-25 9:46 ` [PATCH] FS-Cache: fix dereference of NULL user_key_payload Greg KH
-- strict thread matches above, loose matches on Subject: below --
2017-10-24 23:43 Eric Biggers
2017-10-25 9:46 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171024234447.77995-1-ebiggers3@gmail.com \
--to=ebiggers3@gmail.com \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.