[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 50/50] block/amend: Keep strong reference to BDS
From: |
Kevin Wolf |
Subject: |
[PULL 50/50] block/amend: Keep strong reference to BDS |
Date: |
Fri, 4 Mar 2022 17:47:11 +0100 |
From: Hanna Reitz <hreitz@redhat.com>
Otherwise, the BDS might be freed while the job is running, which would
cause a use-after-free.
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220304153729.711387-5-hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/amend.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/amend.c b/block/amend.c
index 553890ded9..f696a006e3 100644
--- a/block/amend.c
+++ b/block/amend.c
@@ -69,6 +69,8 @@ static void blockdev_amend_free(Job *job)
if (s->bs->drv->bdrv_amend_clean) {
s->bs->drv->bdrv_amend_clean(s->bs);
}
+
+ bdrv_unref(s->bs);
}
static const JobDriver blockdev_amend_job_driver = {
@@ -129,6 +131,7 @@ void qmp_x_blockdev_amend(const char *job_id,
return;
}
+ bdrv_ref(bs);
s->bs = bs,
s->opts = QAPI_CLONE(BlockdevAmendOptions, options),
s->force = has_force ? force : false;
--
2.35.1
- [PULL 38/50] block_int-common.h: split function pointers in BlockDriver, (continued)
- [PULL 38/50] block_int-common.h: split function pointers in BlockDriver, Kevin Wolf, 2022/03/04
- [PULL 39/50] block_int-common.h: assertions in the callers of BlockDriver function pointers, Kevin Wolf, 2022/03/04
- [PULL 41/50] block_int-common.h: assertions in the callers of BdrvChildClass function pointers, Kevin Wolf, 2022/03/04
- [PULL 42/50] block-backend-common.h: split function pointers in BlockDevOps, Kevin Wolf, 2022/03/04
- [PULL 44/50] job.h: assertions in the callers of JobDriver function pointers, Kevin Wolf, 2022/03/04
- [PULL 40/50] block_int-common.h: split function pointers in BdrvChildClass, Kevin Wolf, 2022/03/04
- [PULL 43/50] job.h: split function pointers in JobDriver, Kevin Wolf, 2022/03/04
- [PULL 45/50] block: Make bdrv_refresh_limits() non-recursive, Kevin Wolf, 2022/03/04
- [PULL 47/50] iotests/graph-changes-while-io: New test, Kevin Wolf, 2022/03/04
- [PULL 46/50] iotests: Allow using QMP with the QSD, Kevin Wolf, 2022/03/04
- [PULL 50/50] block/amend: Keep strong reference to BDS,
Kevin Wolf <=
- [PULL 49/50] block/amend: Always call .bdrv_amend_clean(), Kevin Wolf, 2022/03/04
- [PULL 48/50] tests/qemu-iotests: Rework the checks and spots using GNU sed, Kevin Wolf, 2022/03/04
- Re: [PULL 00/50] Block layer patches, Peter Maydell, 2022/03/05