From: Philipp Reisner Date: Thu, 23 Feb 2012 11:52:31 +0000 (+0100) Subject: drbd: Fix module refcount leak in drbd_accept() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dd9b360475655838ff8719d8eedecdf4c4cf80d1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drbd: Fix module refcount leak in drbd_accept() 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 1b08534e 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 Signed-off-by: Lars Ellenberg --- diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 9b83f88c0e82..caf3c3cd2d2a 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -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;