Skip to content

Commit fbdb919

Browse files
committed
libceph: fix null dereference when unregistering linger requests
We should only clear r_osd if we are neither registered as a linger or a regular request. We may unregister as a linger while still registered as a regular request (e.g., in reset_osd). Incorrectly clearing r_osd there leads to a null pointer dereference in __send_request. Also simplify the parallel check in __unregister_request() where we just removed r_osd_item and know it's empty. Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 234af26 commit fbdb919

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎net/ceph/osd_client.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
837837
dout("moving osd to %p lru\n", req->r_osd);
838838
__move_osd_to_lru(osdc, req->r_osd);
839839
}
840-
if (list_empty(&req->r_osd_item) &&
841-
list_empty(&req->r_linger_item))
840+
if (list_empty(&req->r_linger_item))
842841
req->r_osd = NULL;
843842
}
844843

@@ -883,7 +882,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
883882
dout("moving osd to %p lru\n", req->r_osd);
884883
__move_osd_to_lru(osdc, req->r_osd);
885884
}
886-
req->r_osd = NULL;
885+
if (list_empty(&req->r_osd_item))
886+
req->r_osd = NULL;
887887
}
888888
}
889889

0 commit comments

Comments
 (0)