]> git.hungrycats.org Git - linux/commit
libceph: fix preallocation check in get_reply()
authorIlya Dryomov <ilya.dryomov@inktank.com>
Thu, 9 Jan 2014 18:08:21 +0000 (20:08 +0200)
committerJiri Slaby <jslaby@suse.cz>
Mon, 31 Mar 2014 12:22:36 +0000 (14:22 +0200)
commit4c3280ca0ee91125e8f086d33d879065222d6daa
tree75d2be832c96e7abf000c4fac90be22d33eccd43
parented0d7f08ff8b76555525a9ee61d8eed2796594c2
libceph: fix preallocation check in get_reply()

commit f2be82b0058e90b5d9ac2cb896b4914276fb50ef upstream.

The check that makes sure that we have enough memory allocated to read
in the entire header of the message in question is currently busted.
It compares front_len of the incoming message with iov_len field of
ceph_msg::front structure, which is used primarily to indicate the
amount of data already read in, and not the size of the allocated
buffer.  Under certain conditions (e.g. a short read from a socket
followed by that socket's shutdown and owning ceph_connection reset)
this results in a warning similar to

[85688.975866] libceph: get_reply front 198 > preallocated 122 (4#0)

and, through another bug, leads to forever hung tasks and forced
reboots.  Fix this by comparing front_len with front_alloc_len field of
struct ceph_msg, which stores the actual size of the buffer.

Fixes: http://tracker.ceph.com/issues/5425
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/ceph/messenger.c
net/ceph/osd_client.c