From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
"Sunilkumar Nadumuttlu" <sjn@datera.io>,
"Nicholas Bellinger" <nab@linux-iscsi.org>
Subject: [PATCH 3.2 104/110] iscsi-target: Fix use-after-free during TPG session shutdown
Date: Mon, 10 Aug 2015 12:12:31 +0200 [thread overview]
Message-ID: <lsq.1439201551.87764827@decadent.org.uk> (raw)
In-Reply-To: <lsq.1439201550.905387334@decadent.org.uk>
3.2.71-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <nab@linux-iscsi.org>
commit 417c20a9bdd1e876384127cf096d8ae8b559066c upstream.
This patch fixes a use-after-free bug in iscsit_release_sessions_for_tpg()
where se_portal_group->session_lock was incorrectly released/re-acquired
while walking the active se_portal_group->tpg_sess_list.
The can result in a NULL pointer dereference when iscsit_close_session()
shutdown happens in the normal path asynchronously to this code, causing
a bogus dereference of an already freed list entry to occur.
To address this bug, walk the session list checking for the same state
as before, but move entries to a local list to avoid dropping the lock
while walking the active list.
As before, signal using iscsi_session->session_restatement=1 for those
list entries to be released locally by iscsit_free_session() code.
Reported-by: Sunilkumar Nadumuttlu <sjn@datera.io>
Cc: Sunilkumar Nadumuttlu <sjn@datera.io>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/target/iscsi/iscsi_target.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4509,6 +4509,7 @@ int iscsit_release_sessions_for_tpg(stru
struct iscsi_session *sess;
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
struct se_session *se_sess, *se_sess_tmp;
+ LIST_HEAD(free_list);
int session_count = 0;
spin_lock_bh(&se_tpg->session_lock);
@@ -4530,14 +4531,17 @@ int iscsit_release_sessions_for_tpg(stru
}
atomic_set(&sess->session_reinstatement, 1);
spin_unlock(&sess->conn_lock);
- spin_unlock_bh(&se_tpg->session_lock);
- iscsit_free_session(sess);
- spin_lock_bh(&se_tpg->session_lock);
+ list_move_tail(&se_sess->sess_list, &free_list);
+ }
+ spin_unlock_bh(&se_tpg->session_lock);
+ list_for_each_entry_safe(se_sess, se_sess_tmp, &free_list, sess_list) {
+ sess = (struct iscsi_session *)se_sess->fabric_sess_ptr;
+
+ iscsit_free_session(sess);
session_count++;
}
- spin_unlock_bh(&se_tpg->session_lock);
pr_debug("Released %d iSCSI Session(s) from Target Portal"
" Group: %hu\n", session_count, tpg->tpgt);
next prev parent reply other threads:[~2015-08-10 10:37 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 10:12 [PATCH 3.2 000/110] 3.2.71-rc1 review Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 010/110] tty/serial: at91: RS485 mode: 0 is valid for delay_rts_after_send Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 029/110] ext4: fix race between truncate and __ext4_journalled_writepage() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 009/110] pktgen: adjust spacing in proc file interface output Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 027/110] dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 012/110] usb: dwc3: gadget: return error if command sent to DEPCMD register fails Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 018/110] fixing infinite OPEN loop in 4.0 stateid recovery Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 017/110] staging: vt6655: device_rx_srv check sk_buff is NULL Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 016/110] usb: core: Fix USB 3.0 devices lost in NOTATTACHED state after a hub port reset Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 006/110] ASoC: wm8737: Fixup setting VMID Impedance control register Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 007/110] ASoC: wm8903: Fix define for WM8903_VMID_RES_250K Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 008/110] ASoC: wm8955: Fix setting wrong register for WM8955_K_8_0_MASK bits Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 013/110] rcu: Correctly handle non-empty Tiny RCU callback list with none ready Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 011/110] drm/radeon: take the mode_config mutex when dealing with hpds (v2) Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 023/110] ath3k: add support of 13d3:3474 AR3012 device Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 022/110] ath3k: Add support of 0489:e076 " Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 002/110] [media] s5h1420: fix a buffer overflow when checking userspace params Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 028/110] ASoC: wm8960: the enum of "DAC Polarity" should be wm8960_enum[1] Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 025/110] cdc-acm: Add support of ATOL FPrint fiscal printers Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 020/110] SUNRPC: Fix a memory leak in the backchannel code Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 019/110] NFS: Fix size of NFSACL SETACL operations Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 004/110] mtd: fix: avoid race condition when accessing mtd->usecount Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 021/110] ipr: Increase default adapter init stage change timeout Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 024/110] ath9k: fix DMA stop sequence for AR9003+ Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 005/110] crypto: talitos - avoid memleak in talitos_alg_alloc() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 014/110] mtd: dc21285: use raw spinlock functions for nw_gpio_lock Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 003/110] [media] cx24116: fix a buffer overflow when checking userspace params Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 015/110] staging: rtl8712: prevent buffer overrun in recvbuf2recvframe Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 001/110] hrtimer: Allow concurrent hrtimer_start() for self restarting timers Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 026/110] regulator: core: fix constraints output buffer Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 059/110] ACPICA: Tables: Fix an issue that FACS initialization is performed twice Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 061/110] bufferhead: Add _gfp version for sb_getblk() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 053/110] agp/intel: Fix typo in needs_ilk_vtd_wa() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 099/110] xhci: do not report PLC when link is in internal resume state Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 072/110] s390/sclp: clear upper register halves in _sclp_print_early Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 032/110] jbd2: issue cache flush after checkpointing even with internal journal Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 074/110] drm: add a check for x/y in drm_mode_setcrtc Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 076/110] mm: avoid setting up anonymous pages into file mapping Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 046/110] fs: Fix S_NOSEC handling Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 094/110] usb: dwc3: Reset the transfer resource index on SET_INTERFACE Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 105/110] niu: don't count tx error twice in case of headroom realloc fails Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 097/110] xhci: Calculate old endpoints correctly on device reset Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 087/110] libata: increase the timeout when setting transfer mode Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 098/110] xhci: report U3 when link is in resume state Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 082/110] rds: rds_ib_device.refcount overflow Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 103/110] md/raid1: fix test for 'was read error from last working device' Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 030/110] Disable write buffering on Toshiba ToPIC95 Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 089/110] net: Clone skb before setting peeked flag Ben Hutchings
2015-08-10 11:37 ` Konstantin Khlebnikov
2015-08-10 18:15 ` David Miller
2015-08-11 18:24 ` Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 095/110] netfilter: nf_conntrack: Support expectations in different zones Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 055/110] Btrfs: fix race between caching kthread and returning inode to inode cache Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 033/110] jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 108/110] drm/radeon/combios: add some validation of lvds values Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 038/110] Bluetooth: ath3k: add support of 04ca:300f AR3012 device Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 066/110] 9p: forgetting to cancel request on interrupted zero-copy RPC Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 109/110] x86/xen: Probe target addresses in set_aliased_prot() before the hypercall Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 071/110] dm btree: silence lockdep lock inversion in dm_btree_del() Ben Hutchings
2015-08-10 10:12 ` Ben Hutchings [this message]
2015-08-10 10:12 ` [PATCH 3.2 052/110] __bitmap_parselist: fix bug in empty string handling Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 091/110] drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 035/110] ideapad: fix software rfkill setting Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 080/110] s390/process: fix sfpc inline assembly Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 063/110] netfilter: bridge: don't leak skb in error paths Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 096/110] usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 077/110] net: do not process device backlog during unregistration Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 036/110] mmc: card: Fixup request missing in mmc_blk_issue_rw_rq Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 037/110] nfs: increase size of EXCHANGE_ID name string buffer Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 058/110] ALSA: usb-audio: Add MIDI support for Steinberg MI2/MI4 Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 085/110] libata: add ATA_HORKAGE_NOTRIM Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 057/110] fuse: initialize fc->release before calling it Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 065/110] KVM: x86: properly restore LVT0 Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 081/110] Btrfs: fix file corruption after cloning inline extents Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 047/110] stmmac: troubleshoot unexpected bits in des0 & des1 Ben Hutchings
2015-08-10 10:23 ` Alexey Brodkin
2015-08-11 20:19 ` Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 092/110] mac80211: clear subdir_stations when removing debugfs Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 034/110] jbd2: fix ocfs2 corrupt when updating journal superblock fails Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 070/110] USB: cp210x: add ID for Aruba Networks controllers Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 102/110] Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 106/110] vhost: actually track log eventfd file Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 079/110] 9p: don't leave a half-initialized inode sitting around Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 088/110] datagram: Factor out sk queue referencing Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 075/110] rtnetlink: verify IFLA_VF_INFO attributes before passing them to driver Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 083/110] ata: pmp: add quirk for Marvell 4140 SATA PMP Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 031/110] jbd2: split updating of journal superblock and marking journal empty Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 060/110] fs/buffer.c: support buffer cache allocations with gfp modifiers Ben Hutchings
2015-08-27 13:57 ` Luis Henriques
2015-08-10 10:12 ` [PATCH 3.2 093/110] inet: frags: fix defragmented packet's IP header for af_packet Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 051/110] tracing/filter: Do not allow infix to exceed end of string Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 067/110] ext4: replace open coded nofail allocation in ext4_free_blocks() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 041/110] iio: DAC: ad5624r_spi: fix bit shift of output data value Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 048/110] mm: kmemleak: allow safe memory scanning during kmemleak disabling Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 064/110] KVM: x86: make vapics_in_nmi_mode atomic Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 100/110] usb-storage: ignore ZTE MF 823 card reader in mode 0x1225 Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 073/110] drm: Check crtc x and y coordinates Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 045/110] bridge: multicast: restore router configuration on port link down/up Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 050/110] tracing/filter: Do not WARN on operand count going below zero Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 086/110] libata: force disable trim for SuperSSpeed S238 Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 110/110] x86/ldt: Make modify_ldt synchronous Ben Hutchings
2015-08-10 16:47 ` Andy Lutomirski
2015-08-11 18:23 ` Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 078/110] net: call rcu_read_lock early in process_backlog Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 062/110] ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 084/110] libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 040/110] ext4: call sync_blockdev() before invalidate_bdev() in put_super() Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 044/110] NET: ROSE: Don't dereference NULL neighbour pointer Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 054/110] Btrfs: use kmem_cache_free when freeing entry in inode cache Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 042/110] ext4: don't retry file block mapping on bigalloc fs with non-extent file Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 039/110] Bluetooth: ath3k: Add support of 04ca:300d AR3012 device Ben Hutchings
2015-08-10 22:01 ` Dmitry Tunin
2015-08-10 10:12 ` [PATCH 3.2 049/110] dell-laptop: Fix allocating & freeing SMI buffer page Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 090/110] NET: AX.25: Stop heartbeat timer on disconnect Ben Hutchings
2015-08-10 11:52 ` Richard Stearn
2015-08-11 20:13 ` Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 043/110] watchdog: omap: assert the counter being stopped before reprogramming Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 056/110] crush: fix a bug in tree bucket decode Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 101/110] tile: use free_bootmem_late() for initrd Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 107/110] ALSA: usb-audio: add dB range mapping for some devices Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 069/110] dm thin: allocate the cell_sort_array dynamically Ben Hutchings
2015-08-10 10:12 ` [PATCH 3.2 068/110] dm btree remove: fix bug in redistribute3 Ben Hutchings
2015-08-10 16:10 ` [PATCH 3.2 000/110] 3.2.71-rc1 review Guenter Roeck
2015-08-11 20:34 ` Ben Hutchings
2015-08-11 19:21 ` Jonathan Toppins
2015-08-11 19:29 ` Ben Hutchings
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=lsq.1439201551.87764827@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=sjn@datera.io \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®