I get this periodically (seemingly random - but usually once it starts happening it sticks around for a while, then disappears only to return later) when I'm using LSI's MegaCli64 utility. When the kernel logs the error the MegaCli64 command doesn't return any data either.
Ex:
ro...@deb015.pod02:~# MegaCli64 -PDList -aALL
Exit Code: 0x00
Which is paired with a kernel message:
Nov 20 20:29:50 deb015 kernel: [797020.797811] megasas: Failed to alloc kernel SGL buffer for IOCTL
Other times that same command (or other MegaCli64 commands) will succeed and return the associated data. When this happens, there is no megasas kernel message.
-T
> From 4c41818461c2604f859d2fecda2657827071f0d4 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <
bj...@mork.no>
> Date: Tue, 20 Nov 2012 18:17:48 +0100
> Subject: [PATCH] megaraid_sas: fix memory leak if SGL has 0 length entries
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> commit 98cb7e44 ([SCSI] megaraid_sas: Sanity check user
> supplied length before passing it to dma_alloc_coherent())
> introduced a memory leak. Memory allocated for entries
> following zero length SGL entries will not be freed.
>
> Signed-off-by: Bjørn Mork <
bj...@mork.no>
> ---
> drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 7c471eb..f013432 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -4886,8 +4886,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
> sense, sense_handle);
> }
>
> - for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
> - dma_free_coherent(&instance->pdev->dev,
> + for (i = 0; i < ioc->sge_count; i++) {
> + if (kbuff_arr[i])
> + dma_free_coherent(&instance->pdev->dev,
> kern_sge32[i].length,
> kbuff_arr[i], kern_sge32[i].phys_addr);
> }
> --
> 1.7.10.4