tree 9deaabe380491885f7a312648e222f266cdf064f
parent c3cd4f6b275da0f594797b73f721a4185335478f
author Alasdair G Kergon <[EMAIL PROTECTED]> Wed, 13 Jul 2005 05:53:05 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Wed, 13 Jul 2005 06:19:11 -0700

[PATCH] device-mapper: Fix dm_swap_table error cases

Fix dm_swap_table() __bind error cases: a missing unlock, and EINVAL
preferable to EPERM.

Signed-off-by: Alasdair G Kergon <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/md/dm.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -966,23 +966,20 @@ static void __flush_deferred_io(struct m
  */
 int dm_swap_table(struct mapped_device *md, struct dm_table *table)
 {
-       int r;
+       int r = -EINVAL;
 
        down_write(&md->lock);
 
        /* device must be suspended */
-       if (!test_bit(DMF_SUSPENDED, &md->flags)) {
-               up_write(&md->lock);
-               return -EPERM;
-       }
+       if (!test_bit(DMF_SUSPENDED, &md->flags))
+               goto out;
 
        __unbind(md);
        r = __bind(md, table);
-       if (r)
-               return r;
 
+out:
        up_write(&md->lock);
-       return 0;
+       return r;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to