Skip to content

Commit

Permalink
drbd: Fix module refcount leak in drbd_accept()
Browse files Browse the repository at this point in the history
drbd_accept was modelled after kernel_accept
with drbd commit 53eb779 in July 2008.

Only, kernel_accept was then broken, and only fixed later
with kernel commit 1b08534 in Dec 2008:
net: Fix module refcount leak in kernel_accept()

Impact: protocol families provided as modules, e.g. ipv6 or ib_sdp,
would soon have their reference count become negative, preventing
them from being unloaded (likely), or worse, hit zero without actually
being unused, allowing them to be unloaded while still in use (unlikely,
but if triggered, causing a kernel crash).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
  • Loading branch information
Philipp Reisner committed Nov 8, 2012
1 parent 93f5afe commit dd9b360
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ static int drbd_accept(const char **what, struct socket *sock, struct socket **n
goto out;
}
(*newsock)->ops = sock->ops;
__module_get((*newsock)->ops->owner);

out:
return err;
Expand Down

0 comments on commit dd9b360

Please sign in to comment.