Skip to content

Commit

Permalink
crimson/osd/osd: fix sigsegv caused by reusing the moved objcect
Browse files Browse the repository at this point in the history
In some case, `m` will be moved and setted nullptr before
`m->get_spg()` be called, causing a segmentation fault.

Signed-off-by: luo rixin <[email protected]>
  • Loading branch information
rosinL committed Jul 22, 2022
1 parent aea6200 commit 0a80c68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crimson/osd/osd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,9 @@ seastar::future<> OSD::handle_rep_op(crimson::net::ConnectionRef conn,
seastar::future<> OSD::handle_rep_op_reply(crimson::net::ConnectionRef conn,
Ref<MOSDRepOpReply> m)
{
spg_t pgid = m->get_spg();
return pg_shard_manager.with_pg(
m->get_spg(),
pgid,
[conn=std::move(conn), m=std::move(m)](auto &&pg) {
if (pg) {
m->finish_decode();
Expand Down

0 comments on commit 0a80c68

Please sign in to comment.