Przeglądaj źródła

libceph: avoid a use-after-free during map check

Sending map check after complete_request() was called is not only
useless, but can lead to a use-after-free as req->r_kref decrement in
__complete_request() races with map check code.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Ilya Dryomov 7 lat temu
rodzic
commit
6001567c14
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      net/ceph/osd_client.c

+ 1 - 1
net/ceph/osd_client.c

@@ -2266,7 +2266,7 @@ again:
 		complete_request(req, err);
 	mutex_unlock(&osd->lock);
 
-	if (ct_res == CALC_TARGET_POOL_DNE)
+	if (!err && ct_res == CALC_TARGET_POOL_DNE)
 		send_map_check(req);
 
 	if (promoted)