Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b37ee1b9 authored by Ilya Dryomov's avatar Ilya Dryomov
Browse files

libceph: move schedule_delayed_work() in ceph_osdc_init()



ceph_osdc_stop() isn't called if ceph_osdc_init() fails, so we end up
with handle_osds_timeout() running on invalid memory if any one of the
allocations fails.  Call schedule_delayed_work() after everything is
setup, just before returning.

Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent fe5da05e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2729,9 +2729,6 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
	osdc->event_tree = RB_ROOT;
	osdc->event_count = 0;

	schedule_delayed_work(&osdc->osds_timeout_work,
	    round_jiffies_relative(osdc->client->options->osd_idle_ttl));

	err = -ENOMEM;
	osdc->req_mempool = mempool_create_slab_pool(10,
						     ceph_osd_request_cache);
@@ -2752,6 +2749,9 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
	if (!osdc->notify_wq)
		goto out_msgpool_reply;

	schedule_delayed_work(&osdc->osds_timeout_work,
	    round_jiffies_relative(osdc->client->options->osd_idle_ttl));

	return 0;

out_msgpool_reply: