linux/net/ceph
Ilya Dryomov 9c55ad1c21 libceph: validate con->state at the top of try_write()
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>
2018-04-26 17:39:08 +02:00
..
crush
Kconfig
Makefile libceph: striping framework implementation 2018-04-02 10:12:42 +02:00
armor.c
auth.c
auth_none.c
auth_none.h
auth_x.c
auth_x.h
auth_x_protocol.h
buffer.c
ceph_common.c The big ticket items are: 2018-04-10 12:25:30 -07:00
ceph_fs.c
ceph_hash.c
ceph_strings.c
cls_lock_client.c
crypto.c libceph, ceph: add __init attribution to init funcitons 2018-04-02 10:12:48 +02:00
crypto.h
debugfs.c libceph, ceph: add __init attribution to init funcitons 2018-04-02 10:12:48 +02:00
messenger.c libceph: validate con->state at the top of try_write() 2018-04-26 17:39:08 +02:00
mon_client.c libceph: reschedule a tick in finish_hunting() 2018-04-24 10:40:21 +02:00
msgpool.c
osd_client.c libceph, ceph: add __init attribution to init funcitons 2018-04-02 10:12:48 +02:00
osdmap.c libceph, ceph: move ceph_calc_file_object_mapping() to striper.c 2018-04-02 10:12:43 +02:00
pagelist.c
pagevec.c
snapshot.c
string_table.c
striper.c libceph, ceph: move ceph_calc_file_object_mapping() to striper.c 2018-04-02 10:12:43 +02:00