]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dont access rgw_http_req_data::client of canceled request 23988/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 7 Sep 2018 21:01:25 +0000 (17:01 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 7 Sep 2018 21:01:28 +0000 (17:01 -0400)
if a request has been canceled with RGWHTTPClient::cancel(), the client
may have been destroyed. check req_data->registered before reading
from req_data->client->receive_pause_skip

Fixes: http://tracker.ceph.com/issues/35851
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_http_client.cc

index 0002e5054548ee5d2c07808e0fe6d4671272c536..b2adae8d1c574d586f7234e7ce18cf3a014559f9 100644 (file)
@@ -292,13 +292,6 @@ size_t RGWHTTPClient::receive_http_data(void * const ptr,
 
   bool pause = false;
 
-  size_t& skip_bytes = req_data->client->receive_pause_skip;
-
-  if (skip_bytes >= len) {
-    skip_bytes -= len;
-    return len;
-  }
-
   RGWHTTPClient *client;
 
   {
@@ -310,6 +303,13 @@ size_t RGWHTTPClient::receive_http_data(void * const ptr,
     client = req_data->client;
   }
 
+  size_t& skip_bytes = client->receive_pause_skip;
+
+  if (skip_bytes >= len) {
+    skip_bytes -= len;
+    return len;
+  }
+
   int ret = client->receive_data((char *)ptr + skip_bytes, len - skip_bytes, &pause);
   if (ret < 0) {
     dout(0) << "WARNING: client->receive_data() returned ret=" << ret << dendl;