From 1b86fda9adf1b691a76f8ceddfc59d0c8386257c Mon Sep 17 00:00:00 2001 From: Ed Cashin Date: Thu, 4 Oct 2012 17:16:34 -0700 Subject: aoe: increase net_device reference count while using it This change eliminates the danger that the user could rmmod the driver for a network interface that is being used for AoE by the aoe driver. Signed-off-by: Ed Cashin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/aoe/aoedev.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/block/aoe/aoedev.c') diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index 3968fe6c0077..6be7b3858340 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c @@ -295,6 +295,13 @@ freetgt(struct aoedev *d, struct aoetgt *t) { struct frame *f; struct list_head *pos, *nx, *head; + struct aoeif *ifp; + + for (ifp = t->ifs; ifp < &t->ifs[NAOEIFS]; ++ifp) { + if (!ifp->nd) + break; + dev_put(ifp->nd); + } head = &t->ffree; list_for_each_safe(pos, nx, head) { -- cgit v1.2.3-59-g8ed1b