[Devel] [PATCH 04/10] ploop: Prohibit discard ioctls
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Mar 26 18:18:57 MSK 2019
Prohibit maintaince mode related ioctls.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/dev.c | 10 ++++++++++
drivers/block/ploop/discard.c | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index f8b9b0bcba78..11bc864a5679 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4522,6 +4522,8 @@ static int ploop_freeblks_ioc(struct ploop_device *plo, unsigned long arg)
int i;
int rc = 0;
+ return -EINVAL;
+
if (list_empty(&plo->map.delta_list))
return -ENOENT;
@@ -4605,6 +4607,8 @@ static int ploop_fbget_ioc(struct ploop_device *plo, unsigned long arg)
struct ploop_freeblks_ctl ctl;
int rc = 0;
+ return -EINVAL;
+
if (list_empty(&plo->map.delta_list))
return -ENOENT;
@@ -4629,6 +4633,8 @@ static int ploop_fbfilter_ioc(struct ploop_device *plo, unsigned long arg)
{
int rc = 0;
+ return -EINVAL;
+
if (plo->maintenance_type != PLOOP_MNTN_DISCARD ||
!test_bit(PLOOP_S_DISCARD_LOADED, &plo->state))
return -EINVAL;
@@ -4716,6 +4722,8 @@ static void ploop_discard_restart(struct ploop_device *plo, int err)
static int ploop_fbdrop_ioc(struct ploop_device *plo)
{
+ return -EINVAL;
+
if (list_empty(&plo->map.delta_list))
return -ENOENT;
@@ -4742,6 +4750,8 @@ static int ploop_relocblks_ioc(struct ploop_device *plo, unsigned long arg)
int err = 0;
int n_free;
+ return -EINVAL;
+
if (list_empty(&plo->map.delta_list))
return -ENOENT;
diff --git a/drivers/block/ploop/discard.c b/drivers/block/ploop/discard.c
index 33122497b9c5..1920ab05e20b 100644
--- a/drivers/block/ploop/discard.c
+++ b/drivers/block/ploop/discard.c
@@ -17,6 +17,8 @@ int ploop_discard_init_ioc(struct ploop_device *plo)
struct ploop_freeblks_desc *fbd;
struct ploop_delta *delta = ploop_top_delta(plo);
+ return -EINVAL;
+
if (delta == NULL)
return -EINVAL;
@@ -52,6 +54,8 @@ int ploop_discard_fini_ioc(struct ploop_device *plo)
struct ploop_request *preq, *tmp;
LIST_HEAD(drop_list);
+ return -EINVAL;
+
if (!test_and_clear_bit(PLOOP_S_DISCARD, &plo->state))
return 0;
@@ -90,6 +94,8 @@ int ploop_discard_wait_ioc(struct ploop_device *plo)
{
int err;
+ return -EINVAL;
+
if (!test_bit(PLOOP_S_DISCARD, &plo->state))
return 0;
More information about the Devel
mailing list