aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_nl.c
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2013-03-27 09:08:43 -0400
committerJens Axboe <axboe@kernel.dk>2013-03-28 12:10:25 -0400
commita3f8f7dc7ad652cd84c12cb5efa0f7722dff4786 (patch)
tree76bdcd59708d7441ce7fbc3906d030e34349093e /drivers/block/drbd/drbd_nl.c
parent94ad0a101415978be04945b2787be1e8e8a874db (diff)
drbd: validate resync_after dependency on attach already
We validated resync_after dependencies, if changed via disk-options. But we did not validate them when first created via attach. We also did not check or cleanup dependencies that used to be correct, but now point to meanwhile removed minor devices. If the drbd_resync_after_valid() validation in disk-options tried to follow a dependency chain in this way, this could lead to NULL pointer dereference. Validate resync_after settings in drbd_adm_attach() already, as well as in drbd_adm_disk_opts(), and and only reject dependency loops. Depending on non-existing disks is allowed and equivalent to no dependency. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r--drivers/block/drbd/drbd_nl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 39e9a91a8f31..9e3f441e7e84 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1381,6 +1381,12 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1381 goto fail; 1381 goto fail;
1382 } 1382 }
1383 1383
1384 write_lock_irq(&global_state_lock);
1385 retcode = drbd_resync_after_valid(mdev, new_disk_conf->resync_after);
1386 write_unlock_irq(&global_state_lock);
1387 if (retcode != NO_ERROR)
1388 goto fail;
1389
1384 rcu_read_lock(); 1390 rcu_read_lock();
1385 nc = rcu_dereference(mdev->tconn->net_conf); 1391 nc = rcu_dereference(mdev->tconn->net_conf);
1386 if (nc) { 1392 if (nc) {