diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2017-08-14 12:04:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-15 01:17:05 -0400 |
commit | 539a06baedd06127389b254f6b9f016ca072da13 (patch) | |
tree | 0ad4648c157cf03a6f00c4a55c159a1a766eb972 /net/ipv4/tcp_ulp.c | |
parent | bae514a688881bb8ea15e836cad6df95e4b94190 (diff) |
tcp: ulp: avoid module refcnt leak in tcp_set_ulp
__tcp_ulp_find_autoload returns tcp_ulp_ops after taking a reference on
the module. Then, if ->init fails, tcp_set_ulp propagates the error but
nothing releases that reference.
Fixes: 734942cc4ea6 ("tcp: ULP infrastructure")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ulp.c')
-rw-r--r-- | net/ipv4/tcp_ulp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c index 2417f55374c5..6bb9e14c710a 100644 --- a/net/ipv4/tcp_ulp.c +++ b/net/ipv4/tcp_ulp.c | |||
@@ -122,14 +122,14 @@ int tcp_set_ulp(struct sock *sk, const char *name) | |||
122 | 122 | ||
123 | ulp_ops = __tcp_ulp_find_autoload(name); | 123 | ulp_ops = __tcp_ulp_find_autoload(name); |
124 | if (!ulp_ops) | 124 | if (!ulp_ops) |
125 | err = -ENOENT; | 125 | return -ENOENT; |
126 | else | ||
127 | err = ulp_ops->init(sk); | ||
128 | 126 | ||
129 | if (err) | 127 | err = ulp_ops->init(sk); |
130 | goto out; | 128 | if (err) { |
129 | module_put(ulp_ops->owner); | ||
130 | return err; | ||
131 | } | ||
131 | 132 | ||
132 | icsk->icsk_ulp_ops = ulp_ops; | 133 | icsk->icsk_ulp_ops = ulp_ops; |
133 | out: | 134 | return 0; |
134 | return err; | ||
135 | } | 135 | } |