android_kernel_oneplus_msm8998/net/ceph
Ilya Dryomov 0c6679b05b libceph: validate con->state at the top of try_write()
commit 9c55ad1c214d9f8c4594ac2c3fa392c1c32431a7 upstream.

ceph_con_workfn() validates con->state before calling try_read() and
then try_write().  However, try_read() temporarily releases con->mutex,
notably in process_message() and ceph_con_in_msg_alloc(), opening the
window for ceph_con_close() to sneak in, close the connection and
release con->sock.  When try_write() is called on the assumption that
con->state is still valid (i.e. not STANDBY or CLOSED), a NULL sock
gets passed to the networking stack:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
  IP: selinux_socket_sendmsg+0x5/0x20

Make sure con->state is valid at the top of try_write() and add an
explicit BUG_ON for this, similar to try_read().

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/23706
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-02 07:53:42 -07:00
..
crush crush: sync up with userspace 2015-06-25 11:49:31 +03:00
armor.c
auth.c
auth_none.c
auth_none.h
auth_x.c libceph: add nocephx_sign_messages option 2015-11-02 23:37:46 +01:00
auth_x.h
auth_x_protocol.h
buffer.c
ceph_common.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2015-11-13 09:24:40 -08:00
ceph_fs.c
ceph_hash.c
ceph_strings.c
crypto.c KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
crypto.h libceph: introduce ceph_x_authorizer_cleanup() 2015-11-02 23:36:48 +01:00
debugfs.c libceph: expose client options through debugfs 2015-04-20 18:55:39 +03:00
Kconfig
Makefile
messenger.c libceph: validate con->state at the top of try_write() 2018-05-02 07:53:42 -07:00
mon_client.c libceph: use keepalive2 to verify the mon session is alive 2015-09-08 23:14:30 +03:00
msgpool.c
osd_client.c libceph: don't spam dmesg with stray reply warnings 2016-03-03 15:07:26 -08:00
osdmap.c libceph: NULL deref on crush_decode() error path 2018-04-13 19:50:10 +02:00
pagelist.c
pagevec.c libceph: use kvfree() instead of open-coding it 2015-06-25 11:49:28 +03:00
snapshot.c