diff options
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/clip.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c index 741742f00797..47fbdc0c5f72 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -949,6 +949,11 @@ static int arp_seq_open(struct inode *inode, struct file *file) | |||
949 | 949 | ||
950 | seq = file->private_data; | 950 | seq = file->private_data; |
951 | seq->private = state; | 951 | seq->private = state; |
952 | state->ns.net = get_proc_net(inode); | ||
953 | if (!state->ns.net) { | ||
954 | seq_release_private(inode, file); | ||
955 | rc = -ENXIO; | ||
956 | } | ||
952 | out: | 957 | out: |
953 | return rc; | 958 | return rc; |
954 | 959 | ||
@@ -957,11 +962,19 @@ out_kfree: | |||
957 | goto out; | 962 | goto out; |
958 | } | 963 | } |
959 | 964 | ||
965 | static int arp_seq_release(struct inode *inode, struct file *file) | ||
966 | { | ||
967 | struct seq_file *seq = file->private_data; | ||
968 | struct clip_seq_state *state = seq->private; | ||
969 | put_net(state->ns.net); | ||
970 | return seq_release_private(inode, file); | ||
971 | } | ||
972 | |||
960 | static const struct file_operations arp_seq_fops = { | 973 | static const struct file_operations arp_seq_fops = { |
961 | .open = arp_seq_open, | 974 | .open = arp_seq_open, |
962 | .read = seq_read, | 975 | .read = seq_read, |
963 | .llseek = seq_lseek, | 976 | .llseek = seq_lseek, |
964 | .release = seq_release_private, | 977 | .release = arp_seq_release, |
965 | .owner = THIS_MODULE | 978 | .owner = THIS_MODULE |
966 | }; | 979 | }; |
967 | #endif | 980 | #endif |