Commit 1286df26 authored by Cong Wang's avatar Cong Wang Committed by Pablo Neira Ayuso

netfilter: xt_hashlimit: use s->file instead of s->private

After switching to the new procfs API, it is supposed to
retrieve the private pointer from PDE_DATA(file_inode(s->file)),
s->private is no longer referred.

Fixes: 1cd67182 ("netfilter/x_tables: switch to proc_create_seq_private")
Reported-by: default avatarSami Farin <hvtaifwkbgefbaei@gmail.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarSami Farin <hvtaifwkbgefbaei@gmail.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent ad18d7bf
...@@ -1057,7 +1057,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = { ...@@ -1057,7 +1057,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
static void *dl_seq_start(struct seq_file *s, loff_t *pos) static void *dl_seq_start(struct seq_file *s, loff_t *pos)
__acquires(htable->lock) __acquires(htable->lock)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket; unsigned int *bucket;
spin_lock_bh(&htable->lock); spin_lock_bh(&htable->lock);
...@@ -1074,7 +1074,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos) ...@@ -1074,7 +1074,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos)
static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket = v; unsigned int *bucket = v;
*pos = ++(*bucket); *pos = ++(*bucket);
...@@ -1088,7 +1088,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) ...@@ -1088,7 +1088,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos)
static void dl_seq_stop(struct seq_file *s, void *v) static void dl_seq_stop(struct seq_file *s, void *v)
__releases(htable->lock) __releases(htable->lock)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket = v; unsigned int *bucket = v;
if (!IS_ERR(bucket)) if (!IS_ERR(bucket))
...@@ -1130,7 +1130,7 @@ static void dl_seq_print(struct dsthash_ent *ent, u_int8_t family, ...@@ -1130,7 +1130,7 @@ static void dl_seq_print(struct dsthash_ent *ent, u_int8_t family,
static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family,
struct seq_file *s) struct seq_file *s)
{ {
struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->file));
spin_lock(&ent->lock); spin_lock(&ent->lock);
/* recalculate to show accurate numbers */ /* recalculate to show accurate numbers */
...@@ -1145,7 +1145,7 @@ static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, ...@@ -1145,7 +1145,7 @@ static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family,
static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family, static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family,
struct seq_file *s) struct seq_file *s)
{ {
struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->file));
spin_lock(&ent->lock); spin_lock(&ent->lock);
/* recalculate to show accurate numbers */ /* recalculate to show accurate numbers */
...@@ -1160,7 +1160,7 @@ static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family, ...@@ -1160,7 +1160,7 @@ static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family,
static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
struct seq_file *s) struct seq_file *s)
{ {
struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->file));
spin_lock(&ent->lock); spin_lock(&ent->lock);
/* recalculate to show accurate numbers */ /* recalculate to show accurate numbers */
...@@ -1174,7 +1174,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, ...@@ -1174,7 +1174,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
static int dl_seq_show_v2(struct seq_file *s, void *v) static int dl_seq_show_v2(struct seq_file *s, void *v)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket = (unsigned int *)v; unsigned int *bucket = (unsigned int *)v;
struct dsthash_ent *ent; struct dsthash_ent *ent;
...@@ -1188,7 +1188,7 @@ static int dl_seq_show_v2(struct seq_file *s, void *v) ...@@ -1188,7 +1188,7 @@ static int dl_seq_show_v2(struct seq_file *s, void *v)
static int dl_seq_show_v1(struct seq_file *s, void *v) static int dl_seq_show_v1(struct seq_file *s, void *v)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket = v; unsigned int *bucket = v;
struct dsthash_ent *ent; struct dsthash_ent *ent;
...@@ -1202,7 +1202,7 @@ static int dl_seq_show_v1(struct seq_file *s, void *v) ...@@ -1202,7 +1202,7 @@ static int dl_seq_show_v1(struct seq_file *s, void *v)
static int dl_seq_show(struct seq_file *s, void *v) static int dl_seq_show(struct seq_file *s, void *v)
{ {
struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->file));
unsigned int *bucket = v; unsigned int *bucket = v;
struct dsthash_ent *ent; struct dsthash_ent *ent;
......
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