alistair23-linux/net/9p
Tomas Bortoli 728356dede 9p: Add refcount to p9_req_t
To avoid use-after-free(s), use a refcount to keep track of the
usable references to any instantiated struct p9_req_t.

This commit adds p9_req_put(), p9_req_get() and p9_req_try_get() as
wrappers to kref_put(), kref_get() and kref_get_unless_zero().
These are used by the client and the transports to keep track of
valid requests' references.

p9_free_req() is added back and used as callback by kref_put().

Add SLAB_TYPESAFE_BY_RCU as it ensures that the memory freed by
kmem_cache_free() will not be reused for another type until the rcu
synchronisation period is over, so an address gotten under rcu read
lock is safe to inc_ref() without corrupting random memory while
the lock is held.

Link: http://lkml.kernel.org/r/1535626341-20693-1-git-send-email-asmadeus@codewreck.org
Co-developed-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+467050c1ce275af2a5b8@syzkaller.appspotmail.com
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
2018-09-08 01:39:47 +09:00
..
client.c 9p: Add refcount to p9_req_t 2018-09-08 01:39:47 +09:00
error.c
Kconfig IB: Revert "remove redundant INFINIBAND kconfig dependencies" 2018-05-28 10:40:16 -06:00
Makefile 9p: Remove p9_idpool 2018-08-29 13:39:57 +09:00
mod.c 9p: Use a slab for allocating requests 2018-08-29 13:39:57 +09:00
protocol.c 9p: clear dangling pointers in p9stat_free 2018-08-29 13:39:57 +09:00
protocol.h
trans_common.c net/9p: correct some comment errors in 9p file system code 2018-05-10 08:21:53 -04:00
trans_common.h net/9p: remove (now-)unused helpers 2015-04-11 22:28:29 -04:00
trans_fd.c 9p: Add refcount to p9_req_t 2018-09-08 01:39:47 +09:00
trans_rdma.c 9p: Add refcount to p9_req_t 2018-09-08 01:39:47 +09:00
trans_virtio.c 9p: Add refcount to p9_req_t 2018-09-08 01:39:47 +09:00
trans_xen.c 9p: Add refcount to p9_req_t 2018-09-08 01:39:47 +09:00