Netlink calls may access TCP global vars (i.e. when attaching a TCP socket), therefore we need to make sure the latters are initialized beforehand. For this reason move the global TCP initialization at the top of the module init function.
Unified · Split
| @@ -260,8 +260,11 @@ static struct rtnl_link_ops ovpn_link_ops = { · 259 unmodified lines | ||
| 260 | 260 | |
| 261 | 261 | static int __init ovpn_init(void) |
| 262 | 262 | { |
| 263 | − int err = rtnl_link_register(&ovpn_link_ops); | |
| 263 | + int err; | |
| 264 | 264 | |
| 265 | + ovpn_tcp_init(); | |
| 266 | + | |
| 267 | + err = rtnl_link_register(&ovpn_link_ops); | |
| 265 | 268 | if (err) { |
| 266 | 269 | pr_err("ovpn: can't register rtnl link ops: %d\n", err); |
| 267 | 270 | return err; |
| @@ -273,8 +276,6 @@ static int __init ovpn_init(void) · 5 unmodified lines | ||
| 273 | 276 | goto unreg_rtnl; |
| 274 | 277 | } |
| 275 | 278 | |
| 276 | − ovpn_tcp_init(); | |
| 277 | − | |
| 278 | 279 | return 0; |
| 279 | 280 | |
| 280 | 281 | unreg_rtnl: |