diff options
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/af_can.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 5b52762b9f20..094fc5332d42 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -115,7 +115,7 @@ static void can_sock_destruct(struct sock *sk) | |||
115 | skb_queue_purge(&sk->sk_receive_queue); | 115 | skb_queue_purge(&sk->sk_receive_queue); |
116 | } | 116 | } |
117 | 117 | ||
118 | static const struct can_proto *can_try_module_get(int protocol) | 118 | static const struct can_proto *can_get_proto(int protocol) |
119 | { | 119 | { |
120 | const struct can_proto *cp; | 120 | const struct can_proto *cp; |
121 | 121 | ||
@@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol) | |||
128 | return cp; | 128 | return cp; |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline void can_put_proto(const struct can_proto *cp) | ||
132 | { | ||
133 | module_put(cp->prot->owner); | ||
134 | } | ||
135 | |||
131 | static int can_create(struct net *net, struct socket *sock, int protocol, | 136 | static int can_create(struct net *net, struct socket *sock, int protocol, |
132 | int kern) | 137 | int kern) |
133 | { | 138 | { |
@@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, | |||
143 | if (!net_eq(net, &init_net)) | 148 | if (!net_eq(net, &init_net)) |
144 | return -EAFNOSUPPORT; | 149 | return -EAFNOSUPPORT; |
145 | 150 | ||
146 | cp = can_try_module_get(protocol); | 151 | cp = can_get_proto(protocol); |
147 | 152 | ||
148 | #ifdef CONFIG_MODULES | 153 | #ifdef CONFIG_MODULES |
149 | if (!cp) { | 154 | if (!cp) { |
@@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, | |||
160 | printk(KERN_ERR "can: request_module " | 165 | printk(KERN_ERR "can: request_module " |
161 | "(can-proto-%d) failed.\n", protocol); | 166 | "(can-proto-%d) failed.\n", protocol); |
162 | 167 | ||
163 | cp = can_try_module_get(protocol); | 168 | cp = can_get_proto(protocol); |
164 | } | 169 | } |
165 | #endif | 170 | #endif |
166 | 171 | ||
@@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, | |||
195 | } | 200 | } |
196 | 201 | ||
197 | errout: | 202 | errout: |
198 | module_put(cp->prot->owner); | 203 | can_put_proto(cp); |
199 | return err; | 204 | return err; |
200 | } | 205 | } |
201 | 206 | ||