Skip to content

Commit d71ffeb

Browse files
David WoodhouseDavid Woodhouse
authored andcommitted
br2684: fix module_put() race
The br2684 code used module_put() during unassignment from vcc with hope that we have BKL. This assumption is no longer true. Now owner field in atmvcc is used to move this module_put() to vcc_destroy_socket(). Signed-off-by: David Woodhouse <[email protected]> Acked-by: Krzysztof Mazur <[email protected]>
1 parent 0e56d99 commit d71ffeb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/atm/br2684.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct br2684_vcc {
6969
void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb);
7070
void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb);
7171
void (*old_release_cb)(struct atm_vcc *vcc);
72+
struct module *old_owner;
7273
enum br2684_encaps encaps;
7374
struct list_head brvccs;
7475
#ifdef CONFIG_ATM_BR2684_IPFILTER
@@ -414,8 +415,8 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc)
414415
brvcc->atmvcc->user_back = NULL; /* what about vcc->recvq ??? */
415416
brvcc->atmvcc->release_cb = brvcc->old_release_cb;
416417
brvcc->old_push(brvcc->atmvcc, NULL); /* pass on the bad news */
418+
module_put(brvcc->old_owner);
417419
kfree(brvcc);
418-
module_put(THIS_MODULE);
419420
}
420421

421422
/* when AAL5 PDU comes in: */
@@ -590,10 +591,12 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
590591
brvcc->old_push = atmvcc->push;
591592
brvcc->old_pop = atmvcc->pop;
592593
brvcc->old_release_cb = atmvcc->release_cb;
594+
brvcc->old_owner = atmvcc->owner;
593595
barrier();
594596
atmvcc->push = br2684_push;
595597
atmvcc->pop = br2684_pop;
596598
atmvcc->release_cb = br2684_release_cb;
599+
atmvcc->owner = THIS_MODULE;
597600

598601
/* initialize netdev carrier state */
599602
if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)

0 commit comments

Comments
 (0)