Commit 6bc18876 authored by Sage Weil's avatar Sage Weil

ceph: avoid null deref in osd request error path

If we interrupt an osd request, we call __cancel_request, but it wasn't
verifying that req->r_osd was non-NULL before dereferencing it.  This could
cause a crash if osds were flapping and we aborted a request on said osd.
Reported-by: default avatarHenry C Chang <henry_c_chang@tcloudcomputing.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 936aeb5c
...@@ -549,7 +549,7 @@ static void __unregister_request(struct ceph_osd_client *osdc, ...@@ -549,7 +549,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
*/ */
static void __cancel_request(struct ceph_osd_request *req) static void __cancel_request(struct ceph_osd_request *req)
{ {
if (req->r_sent) { if (req->r_sent && req->r_osd) {
ceph_con_revoke(&req->r_osd->o_con, req->r_request); ceph_con_revoke(&req->r_osd->o_con, req->r_request);
req->r_sent = 0; req->r_sent = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment