Commit 5139d00b authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by James Morris

[IPV6] Fix bug in /proc/net/ip6_flowlabel seq_file conversion

parent 51c158bd
...@@ -657,7 +657,25 @@ static struct seq_operations ip6fl_seq_ops = { ...@@ -657,7 +657,25 @@ static struct seq_operations ip6fl_seq_ops = {
static int ip6fl_seq_open(struct inode *inode, struct file *file) 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 = { static struct file_operations ip6fl_seq_fops = {
...@@ -665,7 +683,7 @@ static struct file_operations ip6fl_seq_fops = { ...@@ -665,7 +683,7 @@ static struct file_operations ip6fl_seq_fops = {
.open = ip6fl_seq_open, .open = ip6fl_seq_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release, .release = seq_release_private,
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment