diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/route.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ac4428371432..cd82b6db35ff 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2390,10 +2390,18 @@ static int ipv6_route_show(struct seq_file *m, void *v) | |||
2390 | 2390 | ||
2391 | static int ipv6_route_open(struct inode *inode, struct file *file) | 2391 | static int ipv6_route_open(struct inode *inode, struct file *file) |
2392 | { | 2392 | { |
2393 | int err; | ||
2393 | struct net *net = get_proc_net(inode); | 2394 | struct net *net = get_proc_net(inode); |
2394 | if (!net) | 2395 | if (!net) |
2395 | return -ENXIO; | 2396 | return -ENXIO; |
2396 | return single_open(file, ipv6_route_show, net); | 2397 | |
2398 | err = single_open(file, ipv6_route_show, net); | ||
2399 | if (err < 0) { | ||
2400 | put_net(net); | ||
2401 | return err; | ||
2402 | } | ||
2403 | |||
2404 | return 0; | ||
2397 | } | 2405 | } |
2398 | 2406 | ||
2399 | static int ipv6_route_release(struct inode *inode, struct file *file) | 2407 | static int ipv6_route_release(struct inode *inode, struct file *file) |
@@ -2429,8 +2437,18 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v) | |||
2429 | 2437 | ||
2430 | static int rt6_stats_seq_open(struct inode *inode, struct file *file) | 2438 | static int rt6_stats_seq_open(struct inode *inode, struct file *file) |
2431 | { | 2439 | { |
2440 | int err; | ||
2432 | struct net *net = get_proc_net(inode); | 2441 | struct net *net = get_proc_net(inode); |
2433 | return single_open(file, rt6_stats_seq_show, net); | 2442 | if (!net) |
2443 | return -ENXIO; | ||
2444 | |||
2445 | err = single_open(file, rt6_stats_seq_show, net); | ||
2446 | if (err < 0) { | ||
2447 | put_net(net); | ||
2448 | return err; | ||
2449 | } | ||
2450 | |||
2451 | return 0; | ||
2434 | } | 2452 | } |
2435 | 2453 | ||
2436 | static int rt6_stats_seq_release(struct inode *inode, struct file *file) | 2454 | static int rt6_stats_seq_release(struct inode *inode, struct file *file) |