[PATCH 041/118] drbd: Do not access tconn after it was freed

From: Philipp Reisner
Date: Thu Aug 25 2011 - 11:24:59 EST


Signed-off-by: Philipp Reisner <philipp.reisner@xxxxxxxxxx>
Signed-off-by: Lars Ellenberg <lars.ellenberg@xxxxxxxxxx>
---
drivers/block/drbd/drbd_main.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index f464cfa..a9dea6d 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3260,10 +3260,6 @@ static void drbd_delete_device(unsigned int minor)
kfree(mdev->p_uuid);
/* mdev->p_uuid = NULL; */

- kfree(mdev->tconn->int_dig_out);
- kfree(mdev->tconn->int_dig_in);
- kfree(mdev->tconn->int_dig_vv);
-
/* cleanup the rest that has been
* allocated from drbd_new_device
* and actually free the mdev itself */
@@ -3377,6 +3373,9 @@ void drbd_free_tconn(struct drbd_tconn *tconn)
write_unlock_irq(&global_state_lock);

kfree(tconn->name);
+ kfree(tconn->int_dig_out);
+ kfree(tconn->int_dig_in);
+ kfree(tconn->int_dig_vv);
kfree(tconn);
}

--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/