* [Patch nf] xt_hashlimit: use s->file instead of s->private
@ 2018-09-05 18:41 Cong Wang
2018-09-05 18:49 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Cong Wang @ 2018-09-05 18:41 UTC (permalink / raw)
To: netdev
Cc: netfilter-devel, hvtaifwkbgefbaei, Cong Wang, Christoph Hellwig,
Pablo Neira Ayuso
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: 1cd671827290 ("netfilter/x_tables: switch to proc_create_seq_private")
Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/netfilter/xt_hashlimit.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9b16402f29af..3e7d259e5d8d 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -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)
__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;
spin_lock_bh(&htable->lock);
@@ -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)
{
- 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;
*pos = ++(*bucket);
@@ -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)
__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;
if (!IS_ERR(bucket))
@@ -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,
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);
/* recalculate to show accurate numbers */
@@ -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,
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);
/* recalculate to show accurate numbers */
@@ -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,
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);
/* recalculate to show accurate numbers */
@@ -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)
{
- 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;
struct dsthash_ent *ent;
@@ -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)
{
- 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;
struct dsthash_ent *ent;
@@ -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)
{
- 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;
struct dsthash_ent *ent;
--
2.14.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch nf] xt_hashlimit: use s->file instead of s->private
2018-09-05 18:41 [Patch nf] xt_hashlimit: use s->file instead of s->private Cong Wang
@ 2018-09-05 18:49 ` Christoph Hellwig
2018-09-05 19:52 ` Sami Farin
2018-09-10 23:33 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2018-09-05 18:49 UTC (permalink / raw)
To: Cong Wang
Cc: netdev, netfilter-devel, hvtaifwkbgefbaei, Christoph Hellwig,
Pablo Neira Ayuso
On Wed, Sep 05, 2018 at 11:41:31AM -0700, Cong Wang wrote:
> 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.
Thanks fixing this faster than I could even look into the issue:
Acked-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch nf] xt_hashlimit: use s->file instead of s->private
2018-09-05 18:41 [Patch nf] xt_hashlimit: use s->file instead of s->private Cong Wang
2018-09-05 18:49 ` Christoph Hellwig
@ 2018-09-05 19:52 ` Sami Farin
2018-09-10 23:33 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Sami Farin @ 2018-09-05 19:52 UTC (permalink / raw)
To: netdev, netfilter-devel, Pablo Neira Ayuso
Cc: Cong Wang, Christoph Hellwig, stable
Thanks for the quick fix! I tested the patch and it works perfectly.
I also included stable in Cc.
Tested-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
On Wed, Sep 05, 2018 at 11:41:31 -0700, Cong Wang wrote:
> 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: 1cd671827290 ("netfilter/x_tables: switch to proc_create_seq_private")
> Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> net/netfilter/xt_hashlimit.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> index 9b16402f29af..3e7d259e5d8d 100644
> --- a/net/netfilter/xt_hashlimit.c
> +++ b/net/netfilter/xt_hashlimit.c
> @@ -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)
> __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;
>
> spin_lock_bh(&htable->lock);
> @@ -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)
> {
> - 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;
>
> *pos = ++(*bucket);
> @@ -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)
> __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;
>
> if (!IS_ERR(bucket))
> @@ -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,
> 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);
> /* recalculate to show accurate numbers */
> @@ -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,
> 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);
> /* recalculate to show accurate numbers */
> @@ -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,
> 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);
> /* recalculate to show accurate numbers */
> @@ -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)
> {
> - 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;
> struct dsthash_ent *ent;
>
> @@ -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)
> {
> - 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;
> struct dsthash_ent *ent;
>
> @@ -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)
> {
> - 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;
> struct dsthash_ent *ent;
>
> --
> 2.14.4
>
--
Do what you love because life is too short for anything else.
https://samifar.in/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch nf] xt_hashlimit: use s->file instead of s->private
2018-09-05 18:41 [Patch nf] xt_hashlimit: use s->file instead of s->private Cong Wang
2018-09-05 18:49 ` Christoph Hellwig
2018-09-05 19:52 ` Sami Farin
@ 2018-09-10 23:33 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2018-09-10 23:33 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, netfilter-devel, hvtaifwkbgefbaei, Christoph Hellwig
On Wed, Sep 05, 2018 at 11:41:31AM -0700, Cong Wang wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-11 4:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 18:41 [Patch nf] xt_hashlimit: use s->file instead of s->private Cong Wang
2018-09-05 18:49 ` Christoph Hellwig
2018-09-05 19:52 ` Sami Farin
2018-09-10 23:33 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.