Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1729962

Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks)

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks)
Date 2017-09-10 13:40 +0200
Message-ID <uo8KK-33V-3@gated-at.bofh.it> (permalink)
References <uo8hH-2QD-5@gated-at.bofh.it> <uo8B4-309-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Florian,

On Sun, Sep 10, 2017 at 1:21 PM, Florian Westphal <fw@strlen.de> wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> >                 srchash = hash_by_src(net,
>> >                                       &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
>> > -               spin_lock_bh(&nf_nat_lock);
>> > +               lock = &nf_nat_locks[srchash % ARRAY_SIZE(nf_nat_locks)];
>> > +               spin_lock_bh(lock);
>>
>> If no spinlock debugging options (CONFIG_GENERIC_LOCKBREAK,
>> CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_LOCK_ALLOC) are enabled on a UP platform
>> (e.g. m68k defconfig), arch_spinlock_t is an empty struct, and thus
>> ARRAY_SIZE(nf_nat_locks)] is zero, leading to:
>>
>>     net/netfilter/nf_nat_core.c: In function ‘nf_nat_setup_info’:
>>     net/netfilter/nf_nat_core.c:432: warning: division by zero
>
> Gah. Sorry.  This is the 2nd time I add such a bug :(
>
> Can you send a patch?  It should be enough to use CONNTRACK_LOCKS
> instead of ARRAY_SIZE(nf_nat_locks) to avoid this problem.
>
> Otherwise I will take care of this next thing monday morning.

Thanks for the suggestion, will send a patch RSN.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Division by zero on UP (was: Re: netfilter: nat: use keyed locks) Geert Uytterhoeven <geert@linux-m68k.org> - 2017-09-10 13:10 +0200
  Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks) Florian Westphal <fw@strlen.de> - 2017-09-10 13:30 +0200
    Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks) Geert Uytterhoeven <geert@linux-m68k.org> - 2017-09-10 13:40 +0200

csiph-web