summaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoecmd.c
diff options
context:
space:
mode:
authorEd Cashin <ecashin@coraid.com>2012-10-05 02:16:34 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-05 20:05:27 +0200
commit1b86fda9adf1b691a76f8ceddfc59d0c8386257c (patch)
treeda4fcaa9696231ff7bd84b0614706aefca7d7d6c /drivers/block/aoe/aoecmd.c
parentaoe: associate frames with the AoE storage target (diff)
downloadlinux-1b86fda9adf1b691a76f8ceddfc59d0c8386257c.tar.xz
linux-1b86fda9adf1b691a76f8ceddfc59d0c8386257c.zip
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 <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/aoe/aoecmd.c')
-rw-r--r--drivers/block/aoe/aoecmd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index cc692fee7ce1..2f19b9bba913 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -494,12 +494,15 @@ static void
ejectif(struct aoetgt *t, struct aoeif *ifp)
{
struct aoeif *e;
+ struct net_device *nd;
ulong n;
+ nd = ifp->nd;
e = t->ifs + NAOEIFS - 1;
n = (e - ifp) * sizeof *ifp;
memmove(ifp, ifp+1, n);
e->nd = NULL;
+ dev_put(nd);
}
static int
@@ -1317,6 +1320,7 @@ setifbcnt(struct aoetgt *t, struct net_device *nd, int bcnt)
pr_err("aoe: device setifbcnt failure; too many interfaces.\n");
return;
}
+ dev_hold(nd);
p->nd = nd;
p->bcnt = bcnt;
}