netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pull request for net: batman-adv 2019-08-08
@ 2019-08-08 13:02 Simon Wunderlich
  2019-08-08 13:02 ` [PATCH 1/2] batman-adv: Fix netlink dumping of all mcast_flags buckets Simon Wunderlich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Simon Wunderlich @ 2019-08-08 13:02 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Simon Wunderlich

Hi David,

here are some bugfixes which we would like to have integrated into net.

Please pull or let me know of any problem!

Thank you,
      Simon

The following changes since commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b:

  Linus 5.3-rc1 (2019-07-21 14:05:38 -0700)

are available in the Git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20190808

for you to fetch changes up to f7af86ccf1882084293b11077deec049fd01da63:

  batman-adv: Fix deletion of RTR(4|6) mcast list entries (2019-07-22 21:34:58 +0200)

----------------------------------------------------------------
Here are some batman-adv bugfixes:

 - Fix netlink dumping of all mcast_flags buckets, by Sven Eckelmann

 - Fix deletion of RTR(4|6) mcast list entries, by Sven Eckelmann

----------------------------------------------------------------
Sven Eckelmann (2):
      batman-adv: Fix netlink dumping of all mcast_flags buckets
      batman-adv: Fix deletion of RTR(4|6) mcast list entries

 net/batman-adv/multicast.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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

* [PATCH 1/2] batman-adv: Fix netlink dumping of all mcast_flags buckets
  2019-08-08 13:02 [PATCH 0/2] pull request for net: batman-adv 2019-08-08 Simon Wunderlich
@ 2019-08-08 13:02 ` Simon Wunderlich
  2019-08-08 13:02 ` [PATCH 2/2] batman-adv: Fix deletion of RTR(4|6) mcast list entries Simon Wunderlich
  2019-08-08 18:26 ` [PATCH 0/2] pull request for net: batman-adv 2019-08-08 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wunderlich @ 2019-08-08 13:02 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

The bucket variable is only updated outside the loop over the mcast_flags
buckets. It will only be updated during a dumping run when the dumping has
to be interrupted and a new message has to be started.

This could result in repeated or missing entries when the multicast flags
are dumped to userspace.

Fixes: d2d489b7d851 ("batman-adv: Add inconsistent multicast netlink dump detection")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/multicast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index 67d7f83009ae..a3488cfb3d1e 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -2303,7 +2303,7 @@ __batadv_mcast_flags_dump(struct sk_buff *msg, u32 portid,
 
 	while (bucket_tmp < hash->size) {
 		if (batadv_mcast_flags_dump_bucket(msg, portid, cb, hash,
-						   *bucket, &idx_tmp))
+						   bucket_tmp, &idx_tmp))
 			break;
 
 		bucket_tmp++;
-- 
2.20.1


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

* [PATCH 2/2] batman-adv: Fix deletion of RTR(4|6) mcast list entries
  2019-08-08 13:02 [PATCH 0/2] pull request for net: batman-adv 2019-08-08 Simon Wunderlich
  2019-08-08 13:02 ` [PATCH 1/2] batman-adv: Fix netlink dumping of all mcast_flags buckets Simon Wunderlich
@ 2019-08-08 13:02 ` Simon Wunderlich
  2019-08-08 18:26 ` [PATCH 0/2] pull request for net: batman-adv 2019-08-08 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wunderlich @ 2019-08-08 13:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Linus Lüssing,
	Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

The multicast code uses the lists bat_priv->mcast.want_all_rtr*_list to
store all all originator nodes which don't have the flag no-RTR4 or no-RTR6
set. When an originator is purged, it has to be removed from these lists.

Since all entries without the BATADV_MCAST_WANT_NO_RTR4/6 are stored in
these lists, they have to be handled like entries which have these flags
set to force the update routines to remove them from the lists when purging
the originator.

Not doing so will leave a pointer to a freed memory region inside the list.
Trying to operate on these lists will then cause an use-after-free error:

  BUG: KASAN: use-after-free in batadv_mcast_want_rtr4_update+0x335/0x3a0 [batman_adv]
  Write of size 8 at addr ffff888007b41a38 by task swapper/0/0

Fixes: 61caf3d109f5 ("batman-adv: mcast: detect, distribute and maintain multicast router presence")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/multicast.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index a3488cfb3d1e..1d5bdf3a4b65 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -2420,8 +2420,10 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
 	batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
 	batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
 	batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);
-	batadv_mcast_want_rtr4_update(bat_priv, orig, BATADV_NO_FLAGS);
-	batadv_mcast_want_rtr6_update(bat_priv, orig, BATADV_NO_FLAGS);
+	batadv_mcast_want_rtr4_update(bat_priv, orig,
+				      BATADV_MCAST_WANT_NO_RTR4);
+	batadv_mcast_want_rtr6_update(bat_priv, orig,
+				      BATADV_MCAST_WANT_NO_RTR6);
 
 	spin_unlock_bh(&orig->mcast_handler_lock);
 }
-- 
2.20.1


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

* Re: [PATCH 0/2] pull request for net: batman-adv 2019-08-08
  2019-08-08 13:02 [PATCH 0/2] pull request for net: batman-adv 2019-08-08 Simon Wunderlich
  2019-08-08 13:02 ` [PATCH 1/2] batman-adv: Fix netlink dumping of all mcast_flags buckets Simon Wunderlich
  2019-08-08 13:02 ` [PATCH 2/2] batman-adv: Fix deletion of RTR(4|6) mcast list entries Simon Wunderlich
@ 2019-08-08 18:26 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-08-08 18:26 UTC (permalink / raw)
  To: sw; +Cc: netdev, b.a.t.m.a.n

From: Simon Wunderlich <sw@simonwunderlich.de>
Date: Thu,  8 Aug 2019 15:02:06 +0200

> here are some bugfixes which we would like to have integrated into net.
> 
> Please pull or let me know of any problem!

Pulled.

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

end of thread, other threads:[~2019-08-08 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-08 13:02 [PATCH 0/2] pull request for net: batman-adv 2019-08-08 Simon Wunderlich
2019-08-08 13:02 ` [PATCH 1/2] batman-adv: Fix netlink dumping of all mcast_flags buckets Simon Wunderlich
2019-08-08 13:02 ` [PATCH 2/2] batman-adv: Fix deletion of RTR(4|6) mcast list entries Simon Wunderlich
2019-08-08 18:26 ` [PATCH 0/2] pull request for net: batman-adv 2019-08-08 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).