]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dont access rgw_http_req_data::client of canceled request 24414/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 7 Sep 2018 21:01:25 +0000 (17:01 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 3 Oct 2018 21:49:49 +0000 (23:49 +0200)
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>
(cherry picked from commit cdc876a3c5e3e8874c633b9355dfea51c1ee3bdf)

src/rgw/rgw_http_client.cc

index 969b5cd8c725ee2f004e189be43cf84a554d1609..09570d74ca694233b9ae297da6ad4626b49ef554 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;