From: Matthew Wilcox <willy@infradead.org>
To: David Miller <davem@davemloft.net>
Cc: xiyou.wangcong@gmail.com, netdev@vger.kernel.org,
dcaratti@redhat.com, chrism@mellanox.com
Subject: Re: [Patch net 0/3] idr: fix overflow cases on 32-bit CPU
Date: Mon, 1 Jul 2019 19:37:30 -0700 [thread overview]
Message-ID: <20190702023730.GA1729@bombadil.infradead.org> (raw)
In-Reply-To: <20190701.191600.1570499492484804858.davem@davemloft.net>
On Mon, Jul 01, 2019 at 07:16:00PM -0700, David Miller wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
> Date: Fri, 28 Jun 2019 11:03:40 -0700
>
> > idr_get_next_ul() is problematic by design, it can't handle
> > the following overflow case well on 32-bit CPU:
> >
> > u32 id = UINT_MAX;
> > idr_alloc_u32(&id);
> > while (idr_get_next_ul(&id) != NULL)
> > id++;
> >
> > when 'id' overflows and becomes 0 after UINT_MAX, the loop
> > goes infinite.
> >
> > Fix this by eliminating external users of idr_get_next_ul()
> > and migrating them to idr_for_each_entry_continue_ul(). And
> > add an additional parameter for these iteration macros to detect
> > overflow properly.
> >
> > Please merge this through networking tree, as all the users
> > are in networking subsystem.
>
> Series applied, thanks Cong.
Ugh, I don't even get the weekend to reply?
I think this is just a bad idea. It'd be better to apply the conversion
patches to use XArray than fix up this crappy interface. I didn't
reply before because I wanted to check those patches still apply and
post them as part of the response. Now they're definitely broken and
need to be redone.
next prev parent reply other threads:[~2019-07-02 2:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 18:03 [Patch net 0/3] idr: fix overflow cases on 32-bit CPU Cong Wang
2019-06-28 18:03 ` [Patch net 1/3] idr: fix overflow case for idr_for_each_entry_ul() Cong Wang
2019-06-28 18:03 ` [Patch net 2/3] idr: introduce idr_for_each_entry_continue_ul() Cong Wang
2019-06-28 21:14 ` Davide Caratti
2019-06-28 18:03 ` [Patch net 3/3] selftests: add a test case for cls_lower handle overflow Cong Wang
2019-07-02 2:16 ` [Patch net 0/3] idr: fix overflow cases on 32-bit CPU David Miller
2019-07-02 2:37 ` Matthew Wilcox [this message]
2019-07-02 2:39 ` David Miller
2019-07-02 3:12 ` Cong Wang
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=20190702023730.GA1729@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=chrism@mellanox.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox