Skip to content

Commit

Permalink
synclink_gt fix module reference
Browse files Browse the repository at this point in the history
Get module reference on open() by generic HDLC to prevent module from
unloading while interface is active.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Paul Fulghum authored and Linus Torvalds committed Aug 23, 2007
1 parent 1807a1a commit d4c63b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/synclink_gt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,9 @@ static int hdlcdev_open(struct net_device *dev)
int rc;
unsigned long flags;

if (!try_module_get(THIS_MODULE))
return -EBUSY;

DBGINFO(("%s hdlcdev_open\n", dev->name));

/* generic HDLC layer open processing */
Expand Down Expand Up @@ -1634,6 +1637,7 @@ static int hdlcdev_close(struct net_device *dev)
info->netcount=0;
spin_unlock_irqrestore(&info->netlock, flags);

module_put(THIS_MODULE);
return 0;
}

Expand Down

0 comments on commit d4c63b7

Please sign in to comment.