netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request (net): ipsec 2018-10-18
@ 2018-10-18 10:25 Steffen Klassert
  2018-10-18 10:25 ` [PATCH 1/4] xfrm: fix gro_cells leak when remove virtual xfrm interfaces Steffen Klassert
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-10-18 10:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

1) Free the xfrm interface gro_cells when deleting the
   interface, otherwise we leak it. From Li RongQing.

2) net/core/flow.c does not exist anymore, so remove it
   from the MAINTAINERS file.

3) Fix a slab-out-of-bounds in _decode_session6.
   From Alexei Starovoitov.

4) Fix RCU protection when policies inserted into
   thei bydst lists. From Florian Westphal.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit 92d7c74b6f72a8a7d04970d5dcfb99673daaf91d:

  Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth (2018-10-01 22:40:39 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master

for you to fetch changes up to 9dffff200fd178f11dd50eb1fd8ccd0650c9284e:

  xfrm: policy: use hlist rcu variants on insert (2018-10-11 13:24:46 +0200)

----------------------------------------------------------------
Alexei Starovoitov (1):
      net/xfrm: fix out-of-bounds packet access

Florian Westphal (1):
      xfrm: policy: use hlist rcu variants on insert

Li RongQing (1):
      xfrm: fix gro_cells leak when remove virtual xfrm interfaces

Steffen Klassert (1):
      MAINTAINERS: Remove net/core/flow.c

 MAINTAINERS               | 1 -
 net/ipv6/xfrm6_policy.c   | 4 ++--
 net/xfrm/xfrm_interface.c | 3 +++
 net/xfrm/xfrm_policy.c    | 8 ++++----
 4 files changed, 9 insertions(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] xfrm: fix gro_cells leak when remove virtual xfrm interfaces
  2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
@ 2018-10-18 10:25 ` Steffen Klassert
  2018-10-18 10:25 ` [PATCH 2/4] MAINTAINERS: Remove net/core/flow.c Steffen Klassert
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-10-18 10:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Li RongQing <lirongqing@baidu.com>

The device gro_cells has been initialized, it should be freed,
otherwise it will be leaked

Fixes: f203b76d78092faf2 ("xfrm: Add virtual xfrm interfaces")
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_interface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 31acc6f33d98..6f05e831a73e 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -116,6 +116,9 @@ static void xfrmi_unlink(struct xfrmi_net *xfrmn, struct xfrm_if *xi)
 
 static void xfrmi_dev_free(struct net_device *dev)
 {
+	struct xfrm_if *xi = netdev_priv(dev);
+
+	gro_cells_destroy(&xi->gro_cells);
 	free_percpu(dev->tstats);
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] MAINTAINERS: Remove net/core/flow.c
  2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
  2018-10-18 10:25 ` [PATCH 1/4] xfrm: fix gro_cells leak when remove virtual xfrm interfaces Steffen Klassert
@ 2018-10-18 10:25 ` Steffen Klassert
  2018-10-18 10:25 ` [PATCH 3/4] net/xfrm: fix out-of-bounds packet access Steffen Klassert
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-10-18 10:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

net/core/flow.c does not exist anymore, so remove it
from the IPSEC NETWORKING section of the MAINTAINERS
file.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index dcb0191c4f54..4ff21dac9b45 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10130,7 +10130,6 @@ L:	netdev@vger.kernel.org
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
 S:	Maintained
-F:	net/core/flow.c
 F:	net/xfrm/
 F:	net/key/
 F:	net/ipv4/xfrm*
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] net/xfrm: fix out-of-bounds packet access
  2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
  2018-10-18 10:25 ` [PATCH 1/4] xfrm: fix gro_cells leak when remove virtual xfrm interfaces Steffen Klassert
  2018-10-18 10:25 ` [PATCH 2/4] MAINTAINERS: Remove net/core/flow.c Steffen Klassert
@ 2018-10-18 10:25 ` Steffen Klassert
  2018-10-18 10:25 ` [PATCH 4/4] xfrm: policy: use hlist rcu variants on insert Steffen Klassert
  2018-10-18 16:56 ` pull request (net): ipsec 2018-10-18 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-10-18 10:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Alexei Starovoitov <ast@kernel.org>

BUG: KASAN: slab-out-of-bounds in _decode_session6+0x1331/0x14e0
net/ipv6/xfrm6_policy.c:161
Read of size 1 at addr ffff8801d882eec7 by task syz-executor1/6667
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
  print_address_description+0x6c/0x20b mm/kasan/report.c:256
  kasan_report_error mm/kasan/report.c:354 [inline]
  kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
  __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
  _decode_session6+0x1331/0x14e0 net/ipv6/xfrm6_policy.c:161
  __xfrm_decode_session+0x71/0x140 net/xfrm/xfrm_policy.c:2299
  xfrm_decode_session include/net/xfrm.h:1232 [inline]
  vti6_tnl_xmit+0x3c3/0x1bc1 net/ipv6/ip6_vti.c:542
  __netdev_start_xmit include/linux/netdevice.h:4313 [inline]
  netdev_start_xmit include/linux/netdevice.h:4322 [inline]
  xmit_one net/core/dev.c:3217 [inline]
  dev_hard_start_xmit+0x272/0xc10 net/core/dev.c:3233
  __dev_queue_xmit+0x2ab2/0x3870 net/core/dev.c:3803
  dev_queue_xmit+0x17/0x20 net/core/dev.c:3836

Reported-by: syzbot+acffccec848dc13fe459@syzkaller.appspotmail.com
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv6/xfrm6_policy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index ef3defaf43b9..d35bcf92969c 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -146,8 +146,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
 	fl6->daddr = reverse ? hdr->saddr : hdr->daddr;
 	fl6->saddr = reverse ? hdr->daddr : hdr->saddr;
 
-	while (nh + offset + 1 < skb->data ||
-	       pskb_may_pull(skb, nh + offset + 1 - skb->data)) {
+	while (nh + offset + sizeof(*exthdr) < skb->data ||
+	       pskb_may_pull(skb, nh + offset + sizeof(*exthdr) - skb->data)) {
 		nh = skb_network_header(skb);
 		exthdr = (struct ipv6_opt_hdr *)(nh + offset);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] xfrm: policy: use hlist rcu variants on insert
  2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
                   ` (2 preceding siblings ...)
  2018-10-18 10:25 ` [PATCH 3/4] net/xfrm: fix out-of-bounds packet access Steffen Klassert
@ 2018-10-18 10:25 ` Steffen Klassert
  2018-10-18 16:56 ` pull request (net): ipsec 2018-10-18 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-10-18 10:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Florian Westphal <fw@strlen.de>

bydst table/list lookups use rcu, so insertions must use rcu versions.

Fixes: a7c44247f704e ("xfrm: policy: make xfrm_policy_lookup_bytype lockless")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_policy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index f094d4b3520d..119a427d9b2b 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -632,9 +632,9 @@ static void xfrm_hash_rebuild(struct work_struct *work)
 				break;
 		}
 		if (newpos)
-			hlist_add_behind(&policy->bydst, newpos);
+			hlist_add_behind_rcu(&policy->bydst, newpos);
 		else
-			hlist_add_head(&policy->bydst, chain);
+			hlist_add_head_rcu(&policy->bydst, chain);
 	}
 
 	spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
@@ -774,9 +774,9 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
 			break;
 	}
 	if (newpos)
-		hlist_add_behind(&policy->bydst, newpos);
+		hlist_add_behind_rcu(&policy->bydst, newpos);
 	else
-		hlist_add_head(&policy->bydst, chain);
+		hlist_add_head_rcu(&policy->bydst, chain);
 	__xfrm_policy_link(policy, dir);
 
 	/* After previous checking, family can either be AF_INET or AF_INET6 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: pull request (net): ipsec 2018-10-18
  2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
                   ` (3 preceding siblings ...)
  2018-10-18 10:25 ` [PATCH 4/4] xfrm: policy: use hlist rcu variants on insert Steffen Klassert
@ 2018-10-18 16:56 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-10-18 16:56 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 18 Oct 2018 12:25:17 +0200

> 1) Free the xfrm interface gro_cells when deleting the
>    interface, otherwise we leak it. From Li RongQing.
> 
> 2) net/core/flow.c does not exist anymore, so remove it
>    from the MAINTAINERS file.
> 
> 3) Fix a slab-out-of-bounds in _decode_session6.
>    From Alexei Starovoitov.
> 
> 4) Fix RCU protection when policies inserted into
>    thei bydst lists. From Florian Westphal.
> 
> Please pull or let me know if there are problems.

Pulled, thank you!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-19  0:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 10:25 pull request (net): ipsec 2018-10-18 Steffen Klassert
2018-10-18 10:25 ` [PATCH 1/4] xfrm: fix gro_cells leak when remove virtual xfrm interfaces Steffen Klassert
2018-10-18 10:25 ` [PATCH 2/4] MAINTAINERS: Remove net/core/flow.c Steffen Klassert
2018-10-18 10:25 ` [PATCH 3/4] net/xfrm: fix out-of-bounds packet access Steffen Klassert
2018-10-18 10:25 ` [PATCH 4/4] xfrm: policy: use hlist rcu variants on insert Steffen Klassert
2018-10-18 16:56 ` pull request (net): ipsec 2018-10-18 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).