Skip to content

Commit 6b95cf9

Browse files
committed
Merge tag 'ceph-for-5.4-rc4' of git://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "A future-proofing decoding fix from Jeff intended for stable and a patch for a mostly benign race from Dongsheng" * tag 'ceph-for-5.4-rc4' of git://github.com/ceph/ceph-client: rbd: cancel lock_dwork if the wait is interrupted ceph: just skip unrecognized info in ceph_reply_info_extra
2 parents fb8527e + 25e6be2 commit 6b95cf9

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

drivers/block/rbd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6639,10 +6639,13 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev)
66396639
queue_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, 0);
66406640
ret = wait_for_completion_killable_timeout(&rbd_dev->acquire_wait,
66416641
ceph_timeout_jiffies(rbd_dev->opts->lock_timeout));
6642-
if (ret > 0)
6642+
if (ret > 0) {
66436643
ret = rbd_dev->acquire_err;
6644-
else if (!ret)
6645-
ret = -ETIMEDOUT;
6644+
} else {
6645+
cancel_delayed_work_sync(&rbd_dev->lock_dwork);
6646+
if (!ret)
6647+
ret = -ETIMEDOUT;
6648+
}
66466649

66476650
if (ret) {
66486651
rbd_warn(rbd_dev, "failed to acquire exclusive lock: %ld", ret);

fs/ceph/mds_client.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ static int parse_reply_info_readdir(void **p, void *end,
384384
}
385385

386386
done:
387-
if (*p != end)
388-
goto bad;
387+
/* Skip over any unrecognized fields */
388+
*p = end;
389389
return 0;
390390

391391
bad:
@@ -406,12 +406,10 @@ static int parse_reply_info_filelock(void **p, void *end,
406406
goto bad;
407407

408408
info->filelock_reply = *p;
409-
*p += sizeof(*info->filelock_reply);
410409

411-
if (unlikely(*p != end))
412-
goto bad;
410+
/* Skip over any unrecognized fields */
411+
*p = end;
413412
return 0;
414-
415413
bad:
416414
return -EIO;
417415
}
@@ -425,18 +423,21 @@ static int parse_reply_info_create(void **p, void *end,
425423
{
426424
if (features == (u64)-1 ||
427425
(features & CEPH_FEATURE_REPLY_CREATE_INODE)) {
426+
/* Malformed reply? */
428427
if (*p == end) {
429428
info->has_create_ino = false;
430429
} else {
431430
info->has_create_ino = true;
432-
info->ino = ceph_decode_64(p);
431+
ceph_decode_64_safe(p, end, info->ino, bad);
433432
}
433+
} else {
434+
if (*p != end)
435+
goto bad;
434436
}
435437

436-
if (unlikely(*p != end))
437-
goto bad;
438+
/* Skip over any unrecognized fields */
439+
*p = end;
438440
return 0;
439-
440441
bad:
441442
return -EIO;
442443
}

0 commit comments

Comments
 (0)