* [PATCH net-next] nfnetlink: do not ack malformed messages
@ 2013-11-07 18:59 Jiri Benc
2013-11-07 23:03 ` Sergei Shtylyov
2013-11-08 20:12 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Jiri Benc @ 2013-11-07 18:59 UTC (permalink / raw)
To: netdev; +Cc: Pablo Neira Ayuso, Petr Matousek
Commit 0628b123c96d ("netfilter: nfnetlink: add batch support and use it
from nf_tables") introduced a bug leading to various crashes in netlink_ack
when netlink message with invalid nlmsg_len was sent by an unprivileged
user.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
net/netfilter/nfnetlink.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 027f16a..046aa13 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -363,13 +363,15 @@ static void nfnetlink_rcv(struct sk_buff *skb)
struct net *net = sock_net(skb->sk);
int msglen;
- if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
- return netlink_ack(skb, nlh, -EPERM);
-
if (nlh->nlmsg_len < NLMSG_HDRLEN ||
skb->len < nlh->nlmsg_len)
return;
+ if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) {
+ netlink_ack(skb, nlh, -EPERM);
+ return;
+ }
+
if (nlh->nlmsg_type == NFNL_MSG_BATCH_BEGIN) {
struct nfgenmsg *nfgenmsg;
--
1.7.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] nfnetlink: do not ack malformed messages
2013-11-07 18:59 [PATCH net-next] nfnetlink: do not ack malformed messages Jiri Benc
@ 2013-11-07 23:03 ` Sergei Shtylyov
2013-11-10 1:46 ` Cong Wang
2013-11-08 20:12 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2013-11-07 23:03 UTC (permalink / raw)
To: Jiri Benc, netdev; +Cc: Pablo Neira Ayuso, Petr Matousek
Hello.
On 11/07/2013 09:59 PM, Jiri Benc wrote:
> Commit 0628b123c96d ("netfilter: nfnetlink: add batch support and use it
> from nf_tables") introduced a bug leading to various crashes in netlink_ack
> when netlink message with invalid nlmsg_len was sent by an unprivileged
> user.
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
> ---
> net/netfilter/nfnetlink.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
> diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
> index 027f16a..046aa13 100644
> --- a/net/netfilter/nfnetlink.c
> +++ b/net/netfilter/nfnetlink.c
> @@ -363,13 +363,15 @@ static void nfnetlink_rcv(struct sk_buff *skb)
> struct net *net = sock_net(skb->sk);
> int msglen;
>
> - if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
> - return netlink_ack(skb, nlh, -EPERM);
> -
Hm, how it even compiled before your patch?
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] nfnetlink: do not ack malformed messages
2013-11-07 18:59 [PATCH net-next] nfnetlink: do not ack malformed messages Jiri Benc
2013-11-07 23:03 ` Sergei Shtylyov
@ 2013-11-08 20:12 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-11-08 20:12 UTC (permalink / raw)
To: jbenc; +Cc: netdev, pablo, pmatouse
From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 7 Nov 2013 19:59:19 +0100
> Commit 0628b123c96d ("netfilter: nfnetlink: add batch support and use it
> from nf_tables") introduced a bug leading to various crashes in netlink_ack
> when netlink message with invalid nlmsg_len was sent by an unprivileged
> user.
>
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
This is obvious enough that I'm going to apply it directly, I hope Pablo
does not mind.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] nfnetlink: do not ack malformed messages
2013-11-07 23:03 ` Sergei Shtylyov
@ 2013-11-10 1:46 ` Cong Wang
0 siblings, 0 replies; 4+ messages in thread
From: Cong Wang @ 2013-11-10 1:46 UTC (permalink / raw)
To: netdev
On Thu, 07 Nov 2013 at 23:03 GMT, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>> --- a/net/netfilter/nfnetlink.c
>> +++ b/net/netfilter/nfnetlink.c
>> @@ -363,13 +363,15 @@ static void nfnetlink_rcv(struct sk_buff *skb)
>> struct net *net = sock_net(skb->sk);
>> int msglen;
>>
>> - if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
>> - return netlink_ack(skb, nlh, -EPERM);
>> -
>
> Hm, how it even compiled before your patch?
>
You can return void inside a void function.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-10 1:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 18:59 [PATCH net-next] nfnetlink: do not ack malformed messages Jiri Benc
2013-11-07 23:03 ` Sergei Shtylyov
2013-11-10 1:46 ` Cong Wang
2013-11-08 20:12 ` David Miller
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.