kernel-ark/net/ceph
Ilya Dryomov 5f740d7e15 libceph: set last_piece in ceph_msg_data_pages_cursor_init() correctly
Determining ->last_piece based on the value of ->page_offset + length
is incorrect because length here is the length of the entire message.
->last_piece set to false even if page array data item length is <=
PAGE_SIZE, which results in invalid length passed to
ceph_tcp_{send,recv}page() and causes various asserts to fire.

    # cat pages-cursor-init.sh
    #!/bin/bash
    rbd create --size 10 --image-format 2 foo
    FOO_DEV=$(rbd map foo)
    dd if=/dev/urandom of=$FOO_DEV bs=1M &>/dev/null
    rbd snap create foo@snap
    rbd snap protect foo@snap
    rbd clone foo@snap bar
    # rbd_resize calls librbd rbd_resize(), size is in bytes
    ./rbd_resize bar $(((4 << 20) + 512))
    rbd resize --size 10 bar
    BAR_DEV=$(rbd map bar)
    # trigger a 512-byte copyup -- 512-byte page array data item
    dd if=/dev/urandom of=$BAR_DEV bs=1M count=1 seek=5

The problem exists only in ceph_msg_data_pages_cursor_init(),
ceph_msg_data_pages_advance() does the right thing.  The size_t cast is
unnecessary.

Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2014-08-09 11:27:32 +04:00
..
crush crush: add SET_CHOOSELEAF_VARY_R step 2014-04-04 21:07:28 -07:00
armor.c libceph: Fix base64-decoding when input ends in newline. 2011-03-15 09:14:02 -07:00
auth_none.c libceph: Fix NULL pointer dereference in auth client code 2013-07-03 15:32:55 -07:00
auth_none.h net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
auth_x_protocol.h
auth_x.c libceph: wrap auth ops in wrapper functions 2013-05-01 21:17:14 -07:00
auth_x.h net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
auth.c libceph: wrap auth methods in a mutex 2013-05-01 21:17:15 -07:00
buffer.c libceph: add ceph_kv{malloc,free}() and switch to them 2014-01-26 12:34:23 +02:00
ceph_common.c libceph: mon_get_version request infrastructure 2014-06-06 09:29:57 +08:00
ceph_fs.c ceph: fix file mode calculation 2011-07-19 11:25:04 -07:00
ceph_hash.c net: cleanup unsigned to unsigned int 2012-04-15 12:44:40 -04:00
ceph_strings.c libceph: update ceph_osd_op_name() 2013-02-18 12:20:18 -06:00
crypto.c libceph: eliminate sparse warnings 2013-02-25 15:37:18 -06:00
crypto.h net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
debugfs.c libceph: mon_get_version request infrastructure 2014-06-06 09:29:57 +08:00
Kconfig net/ceph: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:39:33 -08:00
Makefile libceph: create source file "net/ceph/snapshot.c" 2013-05-01 21:20:08 -07:00
messenger.c libceph: set last_piece in ceph_msg_data_pages_cursor_init() correctly 2014-08-09 11:27:32 +04:00
mon_client.c libceph: add ceph_monc_wait_osdmap() 2014-06-06 09:29:57 +08:00
msgpool.c libceph: initialize msgpool message types 2012-07-30 09:29:50 -07:00
osd_client.c libceph: nuke ceph_osdc_unregister_linger_request() 2014-07-08 15:08:45 +04:00
osdmap.c crush: decode and initialize chooseleaf_vary_r 2014-05-16 21:29:55 +04:00
pagelist.c ceph: use list_move_tail instead of list_del/list_add_tail 2012-10-01 14:30:49 -05:00
pagevec.c ceph_sync_read: stop poking into iov_iter guts 2014-05-06 17:39:42 -04:00
snapshot.c libceph: create source file "net/ceph/snapshot.c" 2013-05-01 21:20:08 -07:00