diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2020-02-26 16:37:55 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-03-30 12:42:41 +0200 |
commit | 4d8b8fb4940a46f8d64bf1f9d116e1d2ae32b01c (patch) | |
tree | a3724b3b6ad42300c0780b00b941ac01d6aa4b39 /net | |
parent | ceph: return ETIMEDOUT errno to userland when request timed out (diff) | |
download | linux-4d8b8fb4940a46f8d64bf1f9d116e1d2ae32b01c.tar.xz linux-4d8b8fb4940a46f8d64bf1f9d116e1d2ae32b01c.zip |
libceph: simplify ceph_monc_handle_map()
ceph_monc_handle_map() confuses static checkers which report a
false use-after-free on monc->monmap, missing that monc->monmap and
client->monc.monmap is the same pointer.
Use monc->monmap consistently and get rid of "old", which is redundant.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/mon_client.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 9d9e4e4ea600..3d8c8015e976 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -467,7 +467,7 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc, struct ceph_msg *msg) { struct ceph_client *client = monc->client; - struct ceph_monmap *monmap = NULL, *old = monc->monmap; + struct ceph_monmap *monmap; void *p, *end; mutex_lock(&monc->mutex); @@ -484,13 +484,13 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc, goto out; } - if (ceph_check_fsid(monc->client, &monmap->fsid) < 0) { + if (ceph_check_fsid(client, &monmap->fsid) < 0) { kfree(monmap); goto out; } - client->monc.monmap = monmap; - kfree(old); + kfree(monc->monmap); + monc->monmap = monmap; __ceph_monc_got_map(monc, CEPH_SUB_MONMAP, monc->monmap->epoch); client->have_fsid = true; |