From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Quinn Tran <quinn.tran@cavium.com>,
Himanshu Madhani <himanshu.madhani@cavium.com>,
Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@sandisk.com>
Subject: [PATCH 4.4 23/42] qla2xxx: Fix crash due to null pointer access
Date: Tue, 24 Jan 2017 08:55:33 +0100 [thread overview]
Message-ID: <20170124075510.292573220@linuxfoundation.org> (raw)
In-Reply-To: <20170124075509.299412838@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <quinn.tran@cavium.com>
commit fc1ffd6cb38a1c1af625b9833c41928039e733f5 upstream.
During code inspection, while investigating following stack trace
seen on one of the test setup, we found out there was possibility
of memory leak becuase driver was not unwinding the stack properly.
This issue has not been reproduced in a test environment or on a
customer setup.
Here's stack trace that was seen.
[1469877.797315] Call Trace:
[1469877.799940] [<ffffffffa03ab6e9>] qla2x00_mem_alloc+0xb09/0x10c0 [qla2xxx]
[1469877.806980] [<ffffffffa03ac50a>] qla2x00_probe_one+0x86a/0x1b50 [qla2xxx]
[1469877.814013] [<ffffffff813b6d01>] ? __pm_runtime_resume+0x51/0xa0
[1469877.820265] [<ffffffff8157c1f5>] ? _raw_spin_lock_irqsave+0x25/0x90
[1469877.826776] [<ffffffff8157cd2d>] ? _raw_spin_unlock_irqrestore+0x6d/0x80
[1469877.833720] [<ffffffff810741d1>] ? preempt_count_sub+0xb1/0x100
[1469877.839885] [<ffffffff8157cd0c>] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[1469877.846830] [<ffffffff81319b9c>] local_pci_probe+0x4c/0xb0
[1469877.852562] [<ffffffff810741d1>] ? preempt_count_sub+0xb1/0x100
[1469877.858727] [<ffffffff81319c89>] pci_call_probe+0x89/0xb0
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[ bvanassche: Fixed spelling in patch description ]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_os.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3365,7 +3365,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
sizeof(struct ct6_dsd), 0,
SLAB_HWCACHE_ALIGN, NULL);
if (!ctx_cachep)
- goto fail_free_gid_list;
+ goto fail_free_srb_mempool;
}
ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ,
ctx_cachep);
@@ -3518,7 +3518,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long),
GFP_KERNEL);
if (!ha->loop_id_map)
- goto fail_async_pd;
+ goto fail_loop_id_map;
else {
qla2x00_set_reserved_loop_ids(ha);
ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123,
@@ -3527,6 +3527,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
return 0;
+fail_loop_id_map:
+ dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
fail_async_pd:
dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
fail_ex_init_cb:
@@ -3554,6 +3556,10 @@ fail_free_ms_iocb:
dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
ha->ms_iocb = NULL;
ha->ms_iocb_dma = 0;
+
+ if (ha->sns_cmd)
+ dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt),
+ ha->sns_cmd, ha->sns_cmd_dma);
fail_dma_pool:
if (IS_QLA82XX(ha) || ql2xenabledif) {
dma_pool_destroy(ha->fcp_cmnd_dma_pool);
@@ -3571,10 +3577,12 @@ fail_free_nvram:
kfree(ha->nvram);
ha->nvram = NULL;
fail_free_ctx_mempool:
- mempool_destroy(ha->ctx_mempool);
+ if (ha->ctx_mempool)
+ mempool_destroy(ha->ctx_mempool);
ha->ctx_mempool = NULL;
fail_free_srb_mempool:
- mempool_destroy(ha->srb_mempool);
+ if (ha->srb_mempool)
+ mempool_destroy(ha->srb_mempool);
ha->srb_mempool = NULL;
fail_free_gid_list:
dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
next prev parent reply other threads:[~2017-01-24 7:56 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170124075830epcas1p296b07d21649bc2441732496425ef6977@epcas1p2.samsung.com>
2017-01-24 7:55 ` [PATCH 4.4 00/42] 4.4.45-stable review Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 01/42] ftrace/x86: Set ftrace_stub to weak to prevent gcc from using short jumps to it Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 02/42] IB/mlx5: Wait for all async command completions to complete Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 03/42] IB/mlx4: Set traffic class in AH Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 04/42] IB/mlx4: Fix out-of-range array index in destroy qp flow Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 05/42] IB/mlx4: Fix port query for 56Gb Ethernet links Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 06/42] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 07/42] IB/IPoIB: Remove cant use GFP_NOIO warning Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 08/42] perf scripting: Avoid leaking the scripting_context variable Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 09/42] ARM: dts: imx31: fix clock control module interrupts description Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 11/42] ARM: dts: imx31: fix AVIC base address Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 12/42] tmpfs: clear S_ISGID when setting posix ACLs Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 13/42] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 14/42] svcrpc: dont leak contexts on PROC_DESTROY Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 15/42] fuse: clear FR_PENDING flag when moving requests out of pending queue Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 16/42] PCI: Enumerate switches below PCI-to-PCIe bridges Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 17/42] HID: corsair: fix DMA buffers on stack Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 18/42] HID: corsair: fix control-transfer error handling Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 19/42] mmc: mxs-mmc: Fix additional cycles after transmission stop Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 20/42] ieee802154: atusb: do not use the stack for buffers to make them DMA able Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 21/42] mtd: nand: xway: disable module support Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 22/42] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-01-24 7:55 ` Greg Kroah-Hartman [this message]
2017-01-24 7:55 ` [PATCH 4.4 24/42] ubifs: Fix journal replay wrt. xattr nodes Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 25/42] clocksource/exynos_mct: Clear interrupt when cpu is shut down Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 26/42] svcrdma: avoid duplicate dma unmapping during error recovery Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 27/42] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 28/42] ceph: fix bad endianness handling in parse_reply_info_extra Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 29/42] ARM: dts: da850-evm: fix read access to SPI flash Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 30/42] arm64/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 31/42] arm64/ptrace: Preserve previous registers for short regset write - 2 Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 32/42] arm64/ptrace: Preserve previous registers for short regset write - 3 Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 33/42] arm64/ptrace: Avoid uninitialised struct padding in fpr_set() Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 34/42] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 35/42] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 36/42] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 37/42] ARM: 8613/1: Fix the uaccess crash on PB11MPCore Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 38/42] [media] blackfin: check devm_pinctrl_get() for errors Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 39/42] [media] ite-cir: initialize use_demodulator before using it Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 40/42] dmaengine: pl330: Fix runtime PM support for terminated transfers Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 41/42] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test Greg Kroah-Hartman
2017-01-24 7:55 ` [PATCH 4.4 42/42] arm64: avoid returning from bad_mode Greg Kroah-Hartman
2017-01-24 18:26 ` [PATCH 4.4 00/42] 4.4.45-stable review Shuah Khan
2017-01-24 19:08 ` 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=20170124075510.292573220@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=bart.vanassche@sandisk.com \
--cc=hch@lst.de \
--cc=himanshu.madhani@cavium.com \
--cc=linux-kernel@vger.kernel.org \
--cc=quinn.tran@cavium.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).