From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
"Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>,
Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.4 50/67] scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path
Date: Fri, 2 Feb 2018 17:58:19 +0100 [thread overview]
Message-ID: <20180202140820.869816404@linuxfoundation.org> (raw)
In-Reply-To: <20180202140815.091718203@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
[ Upstream commit e4717292ddebcfe231651b5aff9fa19ca158d178 ]
As part of the scsi EH path, aacraid performs a reinitialization of the
adapter, which encompass freeing resources and IRQs, NULLifying lots of
pointers, and then initialize it all over again. We've identified a
problem during the free IRQ portion of this path if CONFIG_DEBUG_SHIRQ
is enabled on kernel config file.
Happens that, in case this flag was set, right after free_irq()
effectively clears the interrupt, it checks if it was requested as
IRQF_SHARED. In positive case, it performs another call to the IRQ
handler on driver. Problem is: since aacraid currently free some
resources *before* freeing the IRQ, once free_irq() path calls the
handler again (due to CONFIG_DEBUG_SHIRQ), aacraid crashes due to NULL
pointer dereference with the following trace:
aac_src_intr_message+0xf8/0x740 [aacraid]
__free_irq+0x33c/0x4a0
free_irq+0x78/0xb0
aac_free_irq+0x13c/0x150 [aacraid]
aac_reset_adapter+0x2e8/0x970 [aacraid]
aac_eh_reset+0x3a8/0x5d0 [aacraid]
scsi_try_host_reset+0x74/0x180
scsi_eh_ready_devs+0xc70/0x1510
scsi_error_handler+0x624/0xa20
This patch prevents the crash by changing the order of the
deinitialization in this path of aacraid: first we clear the IRQ, then
we free other resources. No functional change intended.
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/aacraid/commsup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1363,13 +1363,13 @@ static int _aac_reset_adapter(struct aac
* will ensure that i/o is queisced and the card is flushed in that
* case.
*/
+ aac_free_irq(aac);
aac_fib_map_free(aac);
pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
aac->comm_addr = NULL;
aac->comm_phys = 0;
kfree(aac->queues);
aac->queues = NULL;
- aac_free_irq(aac);
kfree(aac->fsa_dev);
aac->fsa_dev = NULL;
quirks = aac_get_driver_ident(index)->quirks;
next prev parent reply other threads:[~2018-02-02 17:01 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 16:57 [PATCH 4.4 00/67] 4.4.115-stable review Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 02/67] bpf: fix branch pruning logic Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 03/67] x86: bpf_jit: small optimization in emit_bpf_tail_call() Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 04/67] bpf: fix bpf_tail_call() x64 JIT Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 05/67] bpf: introduce BPF_JIT_ALWAYS_ON config Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 06/67] bpf: arsh is not supported in 32 bit alu thus reject it Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 07/67] bpf: avoid false sharing of map refcount with max_entries Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 08/67] bpf: fix divides by zero Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 09/67] bpf: fix 32-bit divide " Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 10/67] bpf: reject stores into ctx via st and xadd Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 11/67] x86/pti: Make unpoison of pgd for trusted boot work for real Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 13/67] ALSA: seq: Make ioctls race-free Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 14/67] crypto: aesni - handle zero length dst buffer Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 15/67] crypto: af_alg - whitelist mask and type Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 16/67] power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 17/67] gpio: iop: " Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 18/67] gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 19/67] mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 20/67] igb: Free IRQs when device is hotplugged Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 27/67] ACPI / bus: Leave modalias empty for devices which are not present Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 28/67] cpufreq: Add Loongson machine dependencies Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 29/67] bcache: check return value of register_shrinker Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 30/67] drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 31/67] drm/amdkfd: Fix SDMA ring buffer size calculation Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 32/67] drm/amdkfd: Fix SDMA oversubsription handling Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 33/67] openvswitch: fix the incorrect flow action alloc size Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 34/67] mac80211: fix the update of path metric for RANN frame Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 35/67] btrfs: fix deadlock when writing out space cache Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 37/67] xen-netfront: remove warning when unloading module Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 38/67] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 39/67] nfsd: Ensure we check stateid validity in the seqid operation checks Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 40/67] grace: replace BUG_ON by WARN_ONCE in exit_net hook Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 41/67] nfsd: check for use of the closed special stateid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 42/67] lockd: fix "list_add double add" caused by legacy signal interface Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 43/67] hwmon: (pmbus) Use 64bit math for DIRECT format values Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 44/67] net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 45/67] quota: Check for register_shrinker() failure Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 46/67] SUNRPC: Allow connect to return EHOSTUNREACH Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 47/67] kmemleak: add scheduling point to kmemleak_scan() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 48/67] drm/omap: Fix error handling path in omap_dmm_probe() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 49/67] xfs: ubsan fixes Greg Kroah-Hartman
2018-02-02 16:58 ` Greg Kroah-Hartman [this message]
2018-02-02 16:58 ` [PATCH 4.4 51/67] scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 52/67] media: usbtv: add a new usbid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 53/67] usb: gadget: dont dereference g until after it has been null checked Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 54/67] staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 55/67] usb: option: Add support for FS040U modem Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 57/67] USB: cdc-acm: Do not log urb submission errors on disconnect Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 58/67] CDC-ACM: apply quirk for card reader Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 59/67] USB: serial: io_edgeport: fix possible sleep-in-atomic Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 60/67] usbip: prevent bind loops on devices attached to vhci_hcd Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 61/67] usbip: list: dont list " Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 62/67] USB: serial: simple: add Motorola Tetra driver Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 63/67] usb: f_fs: Prevent gadget unbind if it is already unbound Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 64/67] usb: uas: unconditionally bring back host after reset Greg Kroah-Hartman
2018-03-03 0:19 ` Ben Hutchings
2018-03-03 9:14 ` Hans de Goede
2018-02-02 16:58 ` [PATCH 4.4 65/67] selinux: general protection fault in sock_has_perm Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 66/67] serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 67/67] spi: imx: do not access registers while clocks disabled Greg Kroah-Hartman
2018-02-02 18:40 ` [PATCH 4.4 00/67] 4.4.115-stable review Nathan Chancellor
2018-02-03 5:18 ` Greg Kroah-Hartman
2018-02-02 22:20 ` Shuah Khan
2018-02-02 22:33 ` Dan Rue
2018-02-03 15:28 ` Guenter Roeck
2018-02-03 15:44 ` Greg Kroah-Hartman
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=20180202140820.869816404@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=RaghavaAditya.Renukunta@microsemi.com \
--cc=alexander.levin@microsoft.com \
--cc=gpiccoli@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).