Commit 67aadcaa authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by David S. Miller

[IPV4]: IPMR fixes.

- pim_protocol warning fix

- ipmr_vif_open() and ipmr_mfc_open() allocates the memory, so it
  should use seq_release_private().

- ipmr_mfc_seq_xxx is using it->cache, in order to control whether
  unlock should be do or not, but it->cache was not initialized in
  ipmr_mfc_seq_start(). So it can point the previous state if user
  did seek(). This become to the cause of twice unlock.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent e4538a34
...@@ -109,7 +109,9 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local ...@@ -109,7 +109,9 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert); static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert);
static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm); static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);
#ifdef CONFIG_IP_PIMSM_V2
static struct net_protocol pim_protocol; static struct net_protocol pim_protocol;
#endif
static struct timer_list ipmr_expire_timer; static struct timer_list ipmr_expire_timer;
...@@ -1702,7 +1704,7 @@ static struct file_operations ipmr_vif_fops = { ...@@ -1702,7 +1704,7 @@ static struct file_operations ipmr_vif_fops = {
.open = ipmr_vif_open, .open = ipmr_vif_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release, .release = seq_release_private,
}; };
struct ipmr_mfc_iter { struct ipmr_mfc_iter {
...@@ -1737,6 +1739,9 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos) ...@@ -1737,6 +1739,9 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct ipmr_mfc_iter *it = seq->private;
it->cache = NULL;
it->ct = 0;
return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
: SEQ_START_TOKEN; : SEQ_START_TOKEN;
} }
...@@ -1846,7 +1851,6 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file) ...@@ -1846,7 +1851,6 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
if (rc) if (rc)
goto out_kfree; goto out_kfree;
memset(s, 0, sizeof(*s));
seq = file->private_data; seq = file->private_data;
seq->private = s; seq->private = s;
out: out:
...@@ -1862,7 +1866,7 @@ static struct file_operations ipmr_mfc_fops = { ...@@ -1862,7 +1866,7 @@ static struct file_operations ipmr_mfc_fops = {
.open = ipmr_mfc_open, .open = ipmr_mfc_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