* [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink
@ 2018-06-01 8:16 Prashant Bhole
2018-06-01 8:26 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Prashant Bhole @ 2018-06-01 8:16 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet
Cc: Prashant Bhole, Daniel Borkmann, Alexei Starovoitov,
Kirill Tkhai, Florian Westphal, netdev
In rtnl_newlink(), NULL check is performed on m_ops however member of
ops is accessed. Fixed by accessing member of m_ops instead of ops.
[ 345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
[ 345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
[ 345.432629]
[ 345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
[ 345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 345.432629] Call Trace:
[ 345.432629] dump_stack+0xc6/0x150
[ 345.432629] ? dump_stack_print_info.cold.0+0x1b/0x1b
[ 345.432629] ? kasan_report+0xb4/0x410
[ 345.432629] kasan_report.cold.4+0x8f/0x91
[ 345.432629] ? rtnl_newlink+0x400/0x1110
[ 345.432629] rtnl_newlink+0x400/0x1110
[...]
Fixes: ccf8dbcd062a ("rtnetlink: Remove VLA usage")
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
net/core/rtnetlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8ca49a0e13fb..9a1ba2015ad8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2936,7 +2936,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
}
if (m_ops) {
- if (ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
+ if (m_ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
return -EINVAL;
if (m_ops->slave_maxtype &&
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink
2018-06-01 8:16 [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink Prashant Bhole
@ 2018-06-01 8:26 ` Eric Dumazet
2018-06-01 22:13 ` Kees Cook
2018-06-01 13:03 ` Ido Schimmel
2018-06-01 14:39 ` David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2018-06-01 8:26 UTC (permalink / raw)
To: bhole_prashant_q7
Cc: David Miller, Daniel Borkmann, Alexei Starovoitov, Kirill Tkhai,
Florian Westphal, netdev, Kees Cook
On Fri, Jun 1, 2018 at 4:18 AM Prashant Bhole
<bhole_prashant_q7@lab.ntt.co.jp> wrote:
>
> In rtnl_newlink(), NULL check is performed on m_ops however member of
> ops is accessed. Fixed by accessing member of m_ops instead of ops.
>
> [ 345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
> [ 345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
> [ 345.432629]
> [ 345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
> [ 345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
> [ 345.432629] Call Trace:
> [ 345.432629] dump_stack+0xc6/0x150
> [ 345.432629] ? dump_stack_print_info.cold.0+0x1b/0x1b
> [ 345.432629] ? kasan_report+0xb4/0x410
> [ 345.432629] kasan_report.cold.4+0x8f/0x91
> [ 345.432629] ? rtnl_newlink+0x400/0x1110
> [ 345.432629] rtnl_newlink+0x400/0x1110
> [...]
>
> Fixes: ccf8dbcd062a ("rtnetlink: Remove VLA usage")
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> ---
> net/core/rtnetlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 8ca49a0e13fb..9a1ba2015ad8 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -2936,7 +2936,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> }
>
> if (m_ops) {
> - if (ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
> + if (m_ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
> return -EINVAL;
Oh nice
CC Kees Cook.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink
2018-06-01 8:16 [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink Prashant Bhole
2018-06-01 8:26 ` Eric Dumazet
@ 2018-06-01 13:03 ` Ido Schimmel
2018-06-01 14:39 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2018-06-01 13:03 UTC (permalink / raw)
To: Prashant Bhole
Cc: David S . Miller, Eric Dumazet, Daniel Borkmann,
Alexei Starovoitov, Kirill Tkhai, Florian Westphal, netdev
On Fri, Jun 01, 2018 at 05:16:58PM +0900, Prashant Bhole wrote:
> In rtnl_newlink(), NULL check is performed on m_ops however member of
> ops is accessed. Fixed by accessing member of m_ops instead of ops.
>
> [ 345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
> [ 345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
> [ 345.432629]
> [ 345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
> [ 345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
> [ 345.432629] Call Trace:
> [ 345.432629] dump_stack+0xc6/0x150
> [ 345.432629] ? dump_stack_print_info.cold.0+0x1b/0x1b
> [ 345.432629] ? kasan_report+0xb4/0x410
> [ 345.432629] kasan_report.cold.4+0x8f/0x91
> [ 345.432629] ? rtnl_newlink+0x400/0x1110
> [ 345.432629] rtnl_newlink+0x400/0x1110
> [...]
>
> Fixes: ccf8dbcd062a ("rtnetlink: Remove VLA usage")
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
My machine crashed while running regression tests. Thanks for fixing!
Tested-by: Ido Schimmel <idosch@mellanox.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink
2018-06-01 8:16 [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink Prashant Bhole
2018-06-01 8:26 ` Eric Dumazet
2018-06-01 13:03 ` Ido Schimmel
@ 2018-06-01 14:39 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-06-01 14:39 UTC (permalink / raw)
To: bhole_prashant_q7; +Cc: edumazet, daniel, ast, ktkhai, fw, netdev
From: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date: Fri, 1 Jun 2018 17:16:58 +0900
> In rtnl_newlink(), NULL check is performed on m_ops however member of
> ops is accessed. Fixed by accessing member of m_ops instead of ops.
>
> [ 345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
> [ 345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
> [ 345.432629]
> [ 345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
> [ 345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
> [ 345.432629] Call Trace:
> [ 345.432629] dump_stack+0xc6/0x150
> [ 345.432629] ? dump_stack_print_info.cold.0+0x1b/0x1b
> [ 345.432629] ? kasan_report+0xb4/0x410
> [ 345.432629] kasan_report.cold.4+0x8f/0x91
> [ 345.432629] ? rtnl_newlink+0x400/0x1110
> [ 345.432629] rtnl_newlink+0x400/0x1110
> [...]
>
> Fixes: ccf8dbcd062a ("rtnetlink: Remove VLA usage")
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink
2018-06-01 8:26 ` Eric Dumazet
@ 2018-06-01 22:13 ` Kees Cook
0 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2018-06-01 22:13 UTC (permalink / raw)
To: Eric Dumazet
Cc: bhole_prashant_q7, David Miller, Daniel Borkmann,
Alexei Starovoitov, Kirill Tkhai, Florian Westphal, netdev
On Fri, Jun 1, 2018 at 1:26 AM, Eric Dumazet <edumazet@google.com> wrote:
> On Fri, Jun 1, 2018 at 4:18 AM Prashant Bhole
> <bhole_prashant_q7@lab.ntt.co.jp> wrote:
>>
>> In rtnl_newlink(), NULL check is performed on m_ops however member of
>> ops is accessed. Fixed by accessing member of m_ops instead of ops.
>>
>> [ 345.432629] BUG: KASAN: null-ptr-deref in rtnl_newlink+0x400/0x1110
>> [ 345.432629] Read of size 4 at addr 0000000000000088 by task ip/986
>> [ 345.432629]
>> [ 345.432629] CPU: 1 PID: 986 Comm: ip Not tainted 4.17.0-rc6+ #9
>> [ 345.432629] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
>> [ 345.432629] Call Trace:
>> [ 345.432629] dump_stack+0xc6/0x150
>> [ 345.432629] ? dump_stack_print_info.cold.0+0x1b/0x1b
>> [ 345.432629] ? kasan_report+0xb4/0x410
>> [ 345.432629] kasan_report.cold.4+0x8f/0x91
>> [ 345.432629] ? rtnl_newlink+0x400/0x1110
>> [ 345.432629] rtnl_newlink+0x400/0x1110
>> [...]
>>
>> Fixes: ccf8dbcd062a ("rtnetlink: Remove VLA usage")
>> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
>> ---
>> net/core/rtnetlink.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>> index 8ca49a0e13fb..9a1ba2015ad8 100644
>> --- a/net/core/rtnetlink.c
>> +++ b/net/core/rtnetlink.c
>> @@ -2936,7 +2936,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
>> }
>>
>> if (m_ops) {
>> - if (ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
>> + if (m_ops->slave_maxtype > RTNL_SLAVE_MAX_TYPE)
>> return -EINVAL;
>
>
> Oh nice
>
> CC Kees Cook.
Argh. Thank you, yes.
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-01 22:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01 8:16 [PATCH net-next] rtnetlink: Fix null-ptr-deref in rtnl_newlink Prashant Bhole
2018-06-01 8:26 ` Eric Dumazet
2018-06-01 22:13 ` Kees Cook
2018-06-01 13:03 ` Ido Schimmel
2018-06-01 14:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).