libceph: don't clear bio_iter in prepare_write_message()
PATCH 1/1 libceph: don't clear bio_iter in prepare_write_message()
This patch is available in the branch "review/wip-msgr-refactor" (prior to 6 other patches) in the ceph-client git repository. That branch is based on branch "review/wip-abstract-2".
-Alex
At one time it was necessary to clear a message's bio_iter field to avoid a bad pointer dereference in write_partial_msg_pages().
That no longer seems to be the case. Here's why.
The message's bio fields represent (in this case) outgoing data. Between where the bio_iter is made NULL in prepare_write_message() and the call in that function to prepare_message_data(), the bio fields are never used.
In prepare_message_data(), init-bio_iter() is called, and the result of that overwrites the value in the message's bio_iter field.
Because it gets overwritten anyway, there is no need to set it to NULL. So don't do it.
This resolves:
http://tracker.ceph.com/issues/4402
--- net/ceph/messenger.c | 4 ---- 1 file changed, 4 deletions(-)
net/ceph/messenger.c +0 -0
@@ -804,10 +804,6 @@ static void prepare_write_message(struct
ceph_connection *con)
m->hdr.seq = cpu_to_le64(++con->out_seq); m->needs_out_seq = false;
}
-#ifdef CONFIG_BLOCK
- else
- m->bio_iter = NULL;
-#endif
dout("prepare_write_message %p seq %lld type %d len %d+%d+%d (%zd)\n",
m, con->out_seq, le16_to_cpu(m->hdr.type),
Signature · 1 line
1.7.9.5
Quoted 47 lines · Alex Elder
This patch is available in the branch "review/wip-msgr-refactor" (prior to 6 other patches) in the ceph-client git repository. That branch is based on branch "review/wip-abstract-2".
-Alex
At one time it was necessary to clear a message's
bio_iterfield to avoid a bad pointer dereference inwrite_partial_msg_pages().That no longer seems to be the case. Here's why.
The message's bio fields represent (in this case) outgoing data. Between where the
bio_iteris made NULL inprepare_write_message()and the call in that function toprepare_message_data(), the bio fields are never used.In
prepare_message_data(), init-bio_iter() is called, and the result of that overwrites the value in the message'sbio_iterfield.Because it gets overwritten anyway, there is no need to set it to NULL. So don't do it.
This resolves:
http://tracker.ceph.com/issues/4402Signed-off-by Alex Elder <[email protected]>--- net/ceph/messenger.c | 4 ---- 1 file changed, 4 deletions(-)net/ceph/messenger.c +0
-4@@ -804,10 +804,6 @@ static void prepare_write_message(struct ceph_connection *con) m->hdr.seq = cpu_to_le64(++con->out_seq); m->needs_out_seq = false; } -#ifdef CONFIG_BLOCK - else - m->bio_iter = NULL; -#endif dout("prepare_write_message %p seq %lld type %d len %d+%d+%d (%zd)\n",m,
con->out_seq,le16_to_cpu(m->hdr.type),