]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: fix potential mdsc use-after-free crash
authorXiubo Li <xiubli@redhat.com>
Wed, 1 Jul 2020 05:52:48 +0000 (01:52 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 3 Aug 2020 09:05:21 +0000 (11:05 +0200)
commit15913b049582ff80ff15d1adc32b2ad04a6b40e5
treed2a14f96f81667795bbafdd02e7ad4bd162412b9
parentb26dcac5506cba14f305040c4a4f56f75010ec03
ceph: fix potential mdsc use-after-free crash

Make sure the delayed work stopped before releasing the resources.

cancel_delayed_work_sync() will only guarantee that the work finishes
executing if the work is already in the ->worklist.  That means after
the cancel_delayed_work_sync() returns, it will leave the work requeued
if it was rearmed at the end. That can lead to a use after free once the
work struct is freed.

Fix it by flushing the delayed work instead of trying to cancel it, and
ensure that the work doesn't rearm if the mdsc is stopping.

URL: https://tracker.ceph.com/issues/46293
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c