linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Sven Eckelmann <sven@narfation.org>,
	Simon Wunderlich <sw@simonwunderlich.de>,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <a@unstable.cc>
Subject: [PATCH 4.4 53/67] batman-adv: Avoid recursive call_rcu for batadv_bla_claim
Date: Wed, 27 Jan 2016 10:12:47 -0800	[thread overview]
Message-ID: <20160127180913.033790017@linuxfoundation.org> (raw)
In-Reply-To: <20160127180907.419868641@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

[ Upstream commit 63b399272294e7a939cde41792dca38c549f0484 ]

The batadv_claim_free_ref function uses call_rcu to delay the free of the
batadv_bla_claim object until no (already started) rcu_read_lock is enabled
anymore. This makes sure that no context is still trying to access the
object which should be removed. But batadv_bla_claim also contains a
reference to backbone_gw which must be removed.

The reference drop of backbone_gw was done in the call_rcu function
batadv_claim_free_rcu but should actually be done in the
batadv_claim_release function to avoid nested call_rcus. This is important
because rcu_barrier (e.g. batadv_softif_free or batadv_exit) will not
detect the inner call_rcu as relevant for its execution. Otherwise this
barrier will most likely be inserted in the queue before the callback of
the first call_rcu was executed. The caller of rcu_barrier will therefore
continue to run before the inner call_rcu callback finished.

Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/batman-adv/bridge_loop_avoidance.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -127,21 +127,17 @@ batadv_backbone_gw_free_ref(struct batad
 }
 
 /* finally deinitialize the claim */
-static void batadv_claim_free_rcu(struct rcu_head *rcu)
+static void batadv_claim_release(struct batadv_bla_claim *claim)
 {
-	struct batadv_bla_claim *claim;
-
-	claim = container_of(rcu, struct batadv_bla_claim, rcu);
-
 	batadv_backbone_gw_free_ref(claim->backbone_gw);
-	kfree(claim);
+	kfree_rcu(claim, rcu);
 }
 
 /* free a claim, call claim_free_rcu if its the last reference */
 static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
 {
 	if (atomic_dec_and_test(&claim->refcount))
-		call_rcu(&claim->rcu, batadv_claim_free_rcu);
+		batadv_claim_release(claim);
 }
 
 /**

  parent reply	other threads:[~2016-01-27 20:32 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 18:11 [PATCH 4.4 00/67] 4.4.1-stable review Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 01/67] KEYS: Fix keyring ref leak in join_session_keyring() Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 02/67] x86/xen: dont reset vcpu_info on a cancelled suspend Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 03/67] KVM: x86: expose MSR_TSC_AUX to userspace Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 04/67] KVM: x86: correctly print #AC in traces Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 05/67] kvm: x86: Fix vmwrite to SECONDARY_VM_EXEC_CONTROL Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 06/67] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 07/67] x86/boot: Double BOOT_HEAP_SIZE to 64KB Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 08/67] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 09/67] x86/mm: Improve switch_mm() barrier comments Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 10/67] ALSA: usb: Add native DSD support for Oppo HA-1 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 11/67] ALSA: hda - Fixup inverted internal mic for Lenovo E50-80 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 12/67] ALSA: seq: Fix missing NULL check at remove_events ioctl Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 13/67] ALSA: usb-audio: Avoid calling usb_autopm_put_interface() at disconnect Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 14/67] ALSA: seq: Fix race at timer setup and close Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 15/67] ALSA: hda - Fix white noise on Dell Latitude E5550 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 16/67] ALSA: usb-audio: Fix mixer ctl regression of Native Instrument devices Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 17/67] ALSA: timer: Harden slave timer list handling Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 18/67] ALSA: hda - fix the headset mic detection problem for a Dell laptop Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 19/67] ALSA: timer: Fix race among timer ioctls Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 20/67] ALSA: timer: Fix double unlink of active_list Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 21/67] ALSA: hda - Add fixup for Dell Latitidue E6540 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 22/67] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 23/67] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 24/67] ALSA: hrtimer: Fix stall by hrtimer_cancel() Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 25/67] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 26/67] ALSA: hda - Fix bass pin fixup for ASUS N550JX Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 27/67] ALSA: hda - Fix missing module loading with model=generic option Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 28/67] ALSA: hda - Flush the pending probe work at remove Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 29/67] ALSA: timer: Handle disconnection more safely Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 30/67] ASoC: wm5110: Fix PGA clear when disabling DRE Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 31/67] ASoC: compress: Fix compress device direction check Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 32/67] rtlwifi: fix memory leak for USB device Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 33/67] USB: cp210x: add ID for ELV Marble Sound Board 1 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 34/67] usb: core: lpm: fix usb3_hardware_lpm sysfs node Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 35/67] xhci: refuse loading if nousb is used Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 36/67] unix: properly account for FDs passed over unix sockets Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 37/67] vxlan: fix test which detect duplicate vxlan iface Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 38/67] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 39/67] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 40/67] tcp_yeah: dont set ssthresh below 2 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 41/67] sched,cls_flower: set key address type when present Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 42/67] net: pktgen: fix null ptr deref in skb allocation Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 43/67] udp: disallow UFO for sockets with SO_NO_CHECK option Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 44/67] net: preserve IP control block during GSO segmentation Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 45/67] bonding: Prevent IPv6 link local address on enslaved devices Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 46/67] dwc_eth_qos: Fix dma address for multi-fragment skbs Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 47/67] phonet: properly unshare skbs in phonet_rcv() Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 48/67] net: bpf: reject invalid shifts Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 49/67] ipv6: update skb->csum when CE mark is propagated Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 50/67] bridge: fix lockdep addr_list_lock false positive splat Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 51/67] net/mlx5_core: Fix trimming down IRQ number Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 52/67] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Greg Kroah-Hartman
2016-01-27 18:12 ` Greg Kroah-Hartman [this message]
2016-01-27 18:12 ` [PATCH 4.4 54/67] batman-adv: Avoid recursive call_rcu for batadv_nc_node Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 55/67] batman-adv: Drop immediate batadv_orig_ifinfo free function Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 56/67] batman-adv: Drop immediate batadv_neigh_node " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 57/67] batman-adv: Drop immediate neigh_ifinfo " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 58/67] batman-adv: Drop immediate batadv_hard_iface " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 59/67] batman-adv: Drop immediate orig_node " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 60/67] powerpc/tm: Check for already reclaimed tasks Greg Kroah-Hartman
2016-05-03  6:32   ` Jiri Slaby
2016-05-03 11:04     ` Michael Neuling
2016-05-03 18:19       ` Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 61/67] powerpc: Make value-returning atomics fully ordered Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 62/67] powerpc: Make {cmp}xchg* and their atomic_ versions " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 63/67] scripts/recordmcount.pl: support data in text section on powerpc Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 64/67] powerpc/module: Handle R_PPC64_ENTRY relocations Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 65/67] arm64: Clear out any singlestep state on a ptrace detach operation Greg Kroah-Hartman
2016-01-27 18:13 ` [PATCH 4.4 66/67] arm64: mm: ensure that the zero page is visible to the page table walker Greg Kroah-Hartman
2016-01-27 18:13 ` [PATCH 4.4 67/67] arm64: kernel: enforce pmuserenr_el0 initialization and restore Greg Kroah-Hartman
2016-01-27 23:28 ` [PATCH 4.4 00/67] 4.4.1-stable review Shuah Khan
2016-01-28  2:23 ` Guenter Roeck
2016-01-28  3:21   ` Guenter Roeck
2016-01-31 19:17     ` Greg Kroah-Hartman
2016-02-01  2:41       ` Guenter Roeck

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=20160127180913.033790017@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=a@unstable.cc \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=stable@vger.kernel.org \
    --cc=sven@narfation.org \
    --cc=sw@simonwunderlich.de \
    /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;
as well as URLs for NNTP newsgroup(s).