[Devel] [PATCH 05/10] ploop: Prohibit PLOOP_IOC_UPDATE_INDEX on singular list

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 26 18:19:02 MSK 2019


Add debug check to not miss a moment userspace
decides to change its behavior.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 11bc864a5679..57920a93129a 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4277,7 +4277,14 @@ static int ploop_index_update_ioc(struct ploop_device *plo, unsigned long arg)
 	struct reloc_map *map;
 	int i;
 
-	if (list_empty(&plo->map.delta_list))
+	/*
+	 * Currently this is used by userspace for relocation
+	 * of start blocks before expanding BAT of !top delta.
+	 * In case of someone wants to do that on a singular
+	 * list, he should expand holes bitmap too.
+	 */
+	if (list_empty(&plo->map.delta_list) ||
+	    list_is_singular(&plo->map.delta_list))
 		return -ENOENT;
 
 	if (copy_from_user(&ctl, (void*)arg,



More information about the Devel mailing list