[net-next] ipv4: frags: precedence bug in ip_expire()
diff mbox series

Message ID 20180806191735.c5miffnrhl2w2ljh@kili.mountain
State Accepted, archived
Delegated to: David Miller
Headers show
Series
  • [net-next] ipv4: frags: precedence bug in ip_expire()
Related show

Commit Message

Dan Carpenter Aug. 6, 2018, 7:17 p.m. UTC
We accidentally removed the parentheses here, but they are required
because '!' has higher precedence than '&'.

Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Peter Oskolkov Aug. 6, 2018, 7:29 p.m. UTC | #1
Ack. Thanks, Dan!
On Mon, Aug 6, 2018 at 12:17 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> We accidentally removed the parentheses here, but they are required
> because '!' has higher precedence than '&'.
>
> Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
> index 0e8f8de77e71..7cb7ed761d8c 100644
> --- a/net/ipv4/ip_fragment.c
> +++ b/net/ipv4/ip_fragment.c
> @@ -154,7 +154,7 @@ static void ip_expire(struct timer_list *t)
>         __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
>         __IP_INC_STATS(net, IPSTATS_MIB_REASMTIMEOUT);
>
> -       if (!qp->q.flags & INET_FRAG_FIRST_IN)
> +       if (!(qp->q.flags & INET_FRAG_FIRST_IN))
>                 goto out;
>
>         /* sk_buff::dev and sk_buff::rbnode are unionized. So we
David Miller Aug. 6, 2018, 8:15 p.m. UTC | #2
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 6 Aug 2018 22:17:35 +0300

> We accidentally removed the parentheses here, but they are required
> because '!' has higher precedence than '&'.
> 
> Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Ugh, good catch, applied, thanks!

Patch
diff mbox series

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 0e8f8de77e71..7cb7ed761d8c 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -154,7 +154,7 @@  static void ip_expire(struct timer_list *t)
 	__IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
 	__IP_INC_STATS(net, IPSTATS_MIB_REASMTIMEOUT);
 
-	if (!qp->q.flags & INET_FRAG_FIRST_IN)
+	if (!(qp->q.flags & INET_FRAG_FIRST_IN))
 		goto out;
 
 	/* sk_buff::dev and sk_buff::rbnode are unionized. So we