linux/fs/fscache
Eric Biggers 48a69df6da FS-Cache: fix dereference of NULL user_key_payload
commit d124b2c53c upstream.

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: 4fbf4291aa ("FS-Cache: Allow the current state of all objects to be dumped")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-01-01 20:51:52 +00:00
..
cache.c fs/fscache: convert printk to pr_foo() 2014-06-04 16:53:51 -07:00
cookie.c fs/fscache: convert printk to pr_foo() 2014-06-04 16:53:51 -07:00
fsdef.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
histogram.c fs/fscache: replace seq_printf by seq_puts 2014-06-04 16:53:52 -07:00
internal.h fs/fscache: convert printk to pr_foo() 2014-06-04 16:53:51 -07:00
Kconfig fscache: drop references to slow-work 2010-07-22 22:58:58 +02:00
main.c fscache: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
Makefile FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
netfs.c FS-Cache: Don't override netfs's primary_index if registering failed 2015-12-13 17:49:24 +00:00
object-list.c FS-Cache: fix dereference of NULL user_key_payload 2018-01-01 20:51:52 +00:00
object.c FS-Cache: Handle removal of unadded object to the fscache_object_list rb tree 2014-02-17 13:47:35 -08:00
operation.c fs/fscache: convert printk to pr_foo() 2014-06-04 16:53:51 -07:00
page.c FS-Cache: Handle a write to the page immediately beyond the EOF marker 2015-12-13 17:49:53 +00:00
proc.c FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
stats.c fs/fscache/stats.c: fix memory leak 2013-04-29 15:54:27 -07:00