From: Sabrina Dubroca <sd@queasysnail.net>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, edumazet@google.com,
nikolay@cumulusnetworks.com, yuvalm@mellanox.com,
ivecera@redhat.com
Subject: Re: [PATCH net] ipmr: fix error path when mr_table_alloc fails
Date: Tue, 5 Jun 2018 12:17:16 +0200 [thread overview]
Message-ID: <20180605101716.GA17412@bistromath.localdomain> (raw)
In-Reply-To: <20180604.172514.1940145189918116408.davem@davemloft.net>
2018-06-04, 17:25:14 -0400, David Miller wrote:
> From: Sabrina Dubroca <sd@queasysnail.net>
> Date: Mon, 4 Jun 2018 13:55:54 +0200
>
> > commit 0bbbf0e7d0e7 ("ipmr, ip6mr: Unite creation of new mr_table")
> > refactored ipmr_new_table, so that it now returns NULL when
> > mr_table_alloc fails. Unfortunately, all callers of ipmr_new_table
> > expect an ERR_PTR. commit 66fb33254f45 ("ipmr: properly check
> > rhltable_init() return value") followed suit.
> >
> > This can result in NULL deref, when ipmr_rules_exit calls
> > ipmr_free_table with NULL net->ipv4.mrt in the
> > !CONFIG_IP_MROUTE_MULTIPLE_TABLES version.
> >
> > This patch makes mr_table_alloc return errors, and changes
> > ip6mr_new_table and its callers to return/expect error pointers as
> > well. It also removes the version of mr_table_alloc defined under
> > !CONFIG_IP_MROUTE_COMMON, since it is never used.
> >
> > Fixes: 0bbbf0e7d0e7 ("ipmr, ip6mr: Unite creation of new mr_table")
> > Fixes: 66fb33254f45 ("ipmr: properly check rhltable_init() return value")
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
>
> This adds a new warning with gcc-8.1.1 on Fedora 28
>
> CC [M] net/ipv6/ip6mr.o
> In file included from ./arch/x86/include/asm/current.h:5,
> from ./include/linux/sched.h:12,
> from ./include/linux/uaccess.h:5,
> from net/ipv6/ip6mr.c:19:
> net/ipv6/ip6mr.c: In function ‘ip6_mroute_setsockopt’:
> ./include/linux/compiler.h:177:26: warning: ‘mrt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
> ^
> net/ipv6/ip6mr.c:1752:20: note: ‘mrt’ was declared here
> struct mr_table *mrt;
> ^~~
grmbl, CONFIG_UBSAN disables -Wmaybe-uninitialized. I'll prepare a v2,
sorry.
--
Sabrina
next prev parent reply other threads:[~2018-06-05 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 11:55 [PATCH net] ipmr: fix error path when mr_table_alloc fails Sabrina Dubroca
2018-06-04 21:25 ` David Miller
2018-06-05 10:17 ` Sabrina Dubroca [this message]
2018-06-05 7:29 ` kbuild test robot
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=20180605101716.GA17412@bistromath.localdomain \
--to=sd@queasysnail.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ivecera@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=yuvalm@mellanox.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