From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, Denis Kirjanov <kda@linux-powerpc.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Jason Yan" <yanaijie@huawei.com>,
"Sumit Saxena" <sumit.saxena@broadcom.com>
Subject: [PATCH 3.16 04/10] scsi: megaraid_sas: return error when create DMA pool failed
Date: Tue, 18 Jun 2019 15:28:02 +0100 [thread overview]
Message-ID: <lsq.1560868082.882723914@decadent.org.uk> (raw)
In-Reply-To: <lsq.1560868079.359853905@decadent.org.uk>
3.16.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <yanaijie@huawei.com>
commit bcf3b67d16a4c8ffae0aa79de5853435e683945c upstream.
when create DMA pool for cmd frames failed, we should return -ENOMEM,
instead of 0.
In some case in:
megasas_init_adapter_fusion()
-->megasas_alloc_cmds()
-->megasas_create_frame_pool
create DMA pool failed,
--> megasas_free_cmds() [1]
-->megasas_alloc_cmds_fusion()
failed, then goto fail_alloc_cmds.
-->megasas_free_cmds() [2]
we will call megasas_free_cmds twice, [1] will kfree cmd_list,
[2] will use cmd_list.it will cause a problem:
Unable to handle kernel NULL pointer dereference at virtual address
00000000
pgd = ffffffc000f70000
[00000000] *pgd=0000001fbf893003, *pud=0000001fbf893003,
*pmd=0000001fbf894003, *pte=006000006d000707
Internal error: Oops: 96000005 [#1] SMP
Modules linked in:
CPU: 18 PID: 1 Comm: swapper/0 Not tainted
task: ffffffdfb9290000 ti: ffffffdfb923c000 task.ti: ffffffdfb923c000
PC is at megasas_free_cmds+0x30/0x70
LR is at megasas_free_cmds+0x24/0x70
...
Call trace:
[<ffffffc0005b779c>] megasas_free_cmds+0x30/0x70
[<ffffffc0005bca74>] megasas_init_adapter_fusion+0x2f4/0x4d8
[<ffffffc0005b926c>] megasas_init_fw+0x2dc/0x760
[<ffffffc0005b9ab0>] megasas_probe_one+0x3c0/0xcd8
[<ffffffc0004a5abc>] local_pci_probe+0x4c/0xb4
[<ffffffc0004a5c40>] pci_device_probe+0x11c/0x14c
[<ffffffc00053a5e4>] driver_probe_device+0x1ec/0x430
[<ffffffc00053a92c>] __driver_attach+0xa8/0xb0
[<ffffffc000538178>] bus_for_each_dev+0x74/0xc8
[<ffffffc000539e88>] driver_attach+0x28/0x34
[<ffffffc000539a18>] bus_add_driver+0x16c/0x248
[<ffffffc00053b234>] driver_register+0x6c/0x138
[<ffffffc0004a5350>] __pci_register_driver+0x5c/0x6c
[<ffffffc000ce3868>] megasas_init+0xc0/0x1a8
[<ffffffc000082a58>] do_one_initcall+0xe8/0x1ec
[<ffffffc000ca7be8>] kernel_init_freeable+0x1c8/0x284
[<ffffffc0008d90b8>] kernel_init+0x1c/0xe4
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/scsi/megaraid/megaraid_sas_base.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3489,6 +3489,7 @@ int megasas_alloc_cmds(struct megasas_in
if (megasas_create_frame_pool(instance)) {
printk(KERN_DEBUG "megasas: Error creating frame DMA pool\n");
megasas_free_cmds(instance);
+ return -ENOMEM;
}
return 0;
next prev parent reply other threads:[~2019-06-18 14:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 14:27 [PATCH 3.16 00/10] 3.16.69-rc1 review Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 09/10] tcp: add tcp_min_snd_mss sysctl Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 01/10] mm: introduce vma_is_anonymous(vma) helper Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 06/10] Bluetooth: hidp: fix buffer overflow Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 03/10] drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 02/10] mm/mincore.c: make mincore() more conservative Ben Hutchings
2019-06-18 14:28 ` Ben Hutchings [this message]
2019-06-18 14:28 ` [PATCH 3.16 08/10] tcp: tcp_fragment() should apply sane memory limits Ben Hutchings
2019-07-02 2:51 ` Florian Fainelli
2019-07-05 14:54 ` Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 05/10] ext4: zero out the unused memory region in the extent tree block Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 07/10] tcp: limit payload size of sacked skbs Ben Hutchings
2019-06-18 14:28 ` [PATCH 3.16 10/10] tcp: enforce tcp_min_snd_mss in tcp_mtu_probing() Ben Hutchings
2019-06-19 21:58 ` [PATCH 3.16 00/10] 3.16.69-rc1 review Guenter Roeck
2019-06-19 22:02 ` 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.1560868082.882723914@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=kda@linux-powerpc.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
--cc=sumit.saxena@broadcom.com \
--cc=yanaijie@huawei.com \
/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