Project

General

Profile

Actions

Bug #77836

closed
YS YS

librbd: use-after-free in trash purge when image open fails with a non-ENOENT error

Bug #77836: librbd: use-after-free in trash purge when image open fails with a non-ENOENT error

Added by Yuechi Sun 5 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Development
Backport:
squid,tentacle,umbrella
Regression:
Yes
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
rbd
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-606-g97128d4d3b
Released In:
Upkeep Timestamp:
2026-08-27T18:36:30+00:00

Description

When `ImageState::open()` fails with an error other than ENOENT, it
asynchronously deletes the ImageCtx before returning. The trash purge
loop only skipped the -ENOENT case and fell through on every other
error, dereferencing the already-freed ictx in `diff_iterate()` and
`state
>close()`. Add the missing `continue` so a failed open is skipped.

The fall-through dates back to 504f4e78, which split `if (r < 0)
continue` to log non-ENOENT errors but dropped the continue.


Related issues 3 (0 open — 3 closed)

Copied to rbd - Backport #77841: squid: librbd: use-after-free in trash purge when image open fails with a non-ENOENT errorResolvedIlya Dryomov

Actions
Copied to rbd - Backport #77842: umbrella: librbd: use-after-free in trash purge when image open fails with a non-ENOENT errorResolvedIlya Dryomov

Actions
Copied to rbd - Backport #77843: tentacle: librbd: use-after-free in trash purge when image open fails with a non-ENOENT errorResolvedIlya Dryomov

Actions

ID Updated by Ilya Dryomov 5 months ago Actions #1

  • Status changed from New to Fix Under Review
  • Backport set to squid,tentacle,umbrella

UB Updated by Upkeep Bot 5 months ago Actions #2

  • Status changed from Fix Under Review to Pending Backport
  • Merge Commit set to 97128d4d3b686687a24ad500e2d2097c2f132232
  • Fixed In set to v21.3.0-606-g97128d4d3b
  • Upkeep Timestamp set to 2026-06-30T19:36:16+00:00

UB Updated by Upkeep Bot 5 months ago Actions #3

  • Copied to Backport #77841: squid: librbd: use-after-free in trash purge when image open fails with a non-ENOENT error added

UB Updated by Upkeep Bot 5 months ago Actions #4

  • Copied to Backport #77842: umbrella: librbd: use-after-free in trash purge when image open fails with a non-ENOENT error added

ID Updated by Ilya Dryomov 5 months ago Actions #5

  • Project changed from Ceph to rbd

UB Updated by Upkeep Bot 5 months ago Actions #6

  • Copied to Backport #77843: tentacle: librbd: use-after-free in trash purge when image open fails with a non-ENOENT error added

UB Updated by Upkeep Bot 5 months ago Actions #7

  • Tags (freeform) set to backport_processed

ID Updated by Ilya Dryomov 5 months ago Actions #8

  • Assignee set to Yuechi Sun

UB Updated by Upkeep Bot 3 months ago Actions #9

  • Status changed from Pending Backport to Resolved
  • Tags (freeform) deleted (backport_processed)
  • Upkeep Timestamp changed from 2026-06-30T19:36:16+00:00 to 2026-08-27T18:36:30+00:00
Actions

Also available in: PDF Atom