]> git.hungrycats.org Git - linux/commitdiff
[IPV6] Fix bug in /proc/net/ip6_flowlabel seq_file conversion
authorHideaki Yoshifuji <yoshfuji@linux-ipv6.org>
Tue, 1 Jul 2003 12:02:55 +0000 (22:02 +1000)
committerJames Morris <jmorris@kernel.bkbits.net>
Tue, 1 Jul 2003 12:02:55 +0000 (22:02 +1000)
net/ipv6/ip6_flowlabel.c

index 58920fcb5c60a88be97e12199d039639d67c0aa5..7211838a4546a2d7bdba4ad123b08f8239cf8afd 100644 (file)
@@ -657,7 +657,25 @@ static struct seq_operations ip6fl_seq_ops = {
 
 static int ip6fl_seq_open(struct inode *inode, struct file *file)
 {
-       return seq_open(file, &ip6fl_seq_ops);
+       struct seq_file *seq;
+       int rc = -ENOMEM;
+       struct ip6fl_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+
+       if (!s)
+               goto out;
+
+       rc = seq_open(file, &ip6fl_seq_ops);
+       if (rc)
+               goto out_kfree;
+
+       seq = file->private_data;
+       seq->private = s;
+       memset(s, 0, sizeof(*s));
+out:
+       return rc;
+out_kfree:
+       kfree(s);
+       goto out;
 }
 
 static struct file_operations ip6fl_seq_fops = {
@@ -665,7 +683,7 @@ static struct file_operations ip6fl_seq_fops = {
        .open           =       ip6fl_seq_open,
        .read           =       seq_read,
        .llseek         =       seq_lseek,
-       .release        =       seq_release,
+       .release        =       seq_release_private,
 };
 #endif