[Devel] [PATCH rh7] cbt: fix panic in blk_cbt_map_copy_once()
Maxim Patlasov
mpatlasov at virtuozzo.com
Mon May 23 13:35:38 PDT 2016
Avoid panic if userspace erroneously calls ioctl(PLOOP_IOC_PUSH_BACKUP_INIT)
while CBT is off (i.e. q->cbt == NULL).
https://jira.sw.ru/browse/PSBM-47416
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
block/blk-cbt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 8cdf1d6..8ba52fb 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -290,7 +290,11 @@ int blk_cbt_map_copy_once(struct request_queue *q, __u8 *uuid,
mutex_lock(&cbt_mutex);
cbt = q->cbt;
- BUG_ON(!cbt);
+ if (!cbt) {
+ mutex_unlock(&cbt_mutex);
+ return -ENOENT;
+ }
+
BUG_ON(!cbt->map);
BUG_ON(!cbt->block_max);
More information about the Devel
mailing list