Revision 9c55ad1c214d9f8c4594ac2c3fa392c1c32431a7 authored by Ilya Dryomov on 24 April 2018, 17:10:55 UTC, committed by Ilya Dryomov on 26 April 2018, 15:39:08 UTC
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>
1 parent 7b4c443
History
File Mode Size
Build -rw-r--r-- 188 bytes
Makefile -rw-r--r-- 1.4 KB
exec-cmd.c -rw-r--r-- 4.1 KB
exec-cmd.h -rw-r--r-- 673 bytes
help.c -rw-r--r-- 5.6 KB
help.h -rw-r--r-- 988 bytes
pager.c -rw-r--r-- 2.3 KB
pager.h -rw-r--r-- 267 bytes
parse-options.c -rw-r--r-- 23.0 KB
parse-options.h -rw-r--r-- 9.7 KB
run-command.c -rw-r--r-- 4.4 KB
run-command.h -rw-r--r-- 1.9 KB
sigchain.c -rw-r--r-- 1.0 KB
sigchain.h -rw-r--r-- 237 bytes
subcmd-config.c -rw-r--r-- 286 bytes
subcmd-config.h -rw-r--r-- 330 bytes
subcmd-util.h -rw-r--r-- 1.8 KB

back to top