All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks)
Date: Sun, 10 Sep 2017 13:21:26 +0200	[thread overview]
Message-ID: <20170910112126.GB25977@breakpoint.cc> (raw)
In-Reply-To: <CAMuHMdVwp1njkMYo-y8FZHWNWW6wtN2LYVC=9-mbcF-omDaztw@mail.gmail.com>

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.

  reply	other threads:[~2017-09-10 11:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10 11:08 Division by zero on UP (was: Re: netfilter: nat: use keyed locks) Geert Uytterhoeven
2017-09-10 11:08 ` Geert Uytterhoeven
2017-09-10 11:21 ` Florian Westphal [this message]
2017-09-10 11:34   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170910112126.GB25977@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.