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>
ejectif(struct aoetgt *t, struct aoeif *ifp)
{
struct aoeif *e;
ejectif(struct aoetgt *t, struct aoeif *ifp)
{
struct aoeif *e;
e = t->ifs + NAOEIFS - 1;
n = (e - ifp) * sizeof *ifp;
memmove(ifp, ifp+1, n);
e->nd = NULL;
e = t->ifs + NAOEIFS - 1;
n = (e - ifp) * sizeof *ifp;
memmove(ifp, ifp+1, n);
e->nd = NULL;
pr_err("aoe: device setifbcnt failure; too many interfaces.\n");
return;
}
pr_err("aoe: device setifbcnt failure; too many interfaces.\n");
return;
}
p->nd = nd;
p->bcnt = bcnt;
}
p->nd = nd;
p->bcnt = bcnt;
}
{
struct frame *f;
struct list_head *pos, *nx, *head;
{
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) {
head = &t->ffree;
list_for_each_safe(pos, nx, head) {