]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: qla2xxx: Fix a dma_pool_free() call
authorBart Van Assche <bvanassche@acm.org>
Wed, 6 Nov 2019 04:42:26 +0000 (20:42 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 9 Nov 2019 02:21:31 +0000 (21:21 -0500)
This patch fixes the following kernel warning:

DMA-API: qla2xxx 0000:00:0a.0: device driver frees DMA memory with different size [device address=0x00000000c7b60000] [map size=4088 bytes] [unmap size=512 bytes]
WARNING: CPU: 3 PID: 1122 at kernel/dma/debug.c:1021 check_unmap+0x4d0/0xbd0
CPU: 3 PID: 1122 Comm: rmmod Tainted: G           O      5.4.0-rc1-dbg+ #1
RIP: 0010:check_unmap+0x4d0/0xbd0
Call Trace:
 debug_dma_free_coherent+0x123/0x173
 dma_free_attrs+0x76/0xe0
 qla2x00_mem_free+0x329/0xc40 [qla2xxx_scst]
 qla2x00_free_device+0x170/0x1c0 [qla2xxx_scst]
 qla2x00_remove_one+0x4f0/0x6d0 [qla2xxx_scst]
 pci_device_remove+0xd5/0x1f0
 device_release_driver_internal+0x159/0x280
 driver_detach+0x8b/0xf2
 bus_remove_driver+0x9a/0x15a
 driver_unregister+0x51/0x70
 pci_unregister_driver+0x2d/0x130
 qla2x00_module_exit+0x1c/0xbc [qla2xxx_scst]
 __x64_sys_delete_module+0x22a/0x300
 do_syscall_64+0x6f/0x2e0
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Fixes: 3f006ac342c0 ("scsi: qla2xxx: Secure flash update support for ISP28XX") # v5.2-rc1~130^2~270.
Cc: Michael Hernandez <mhernandez@marvell.com>
Cc: Himanshu Madhani <hmadhani@marvell.com>
Link: https://lore.kernel.org/r/20191106044226.5207-3-bvanassche@acm.org
Reviewed-by: Martin Wilck <mwilck@suse.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c

index f5c660b4a16cc31744dabe3a04e8248ce5612273..be33d61197d1e9f6bcd03d0fbd583425db0b7e8a 100644 (file)
@@ -4690,7 +4690,8 @@ qla2x00_mem_free(struct qla_hw_data *ha)
        ha->sfp_data = NULL;
 
        if (ha->flt)
-               dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE,
+               dma_free_coherent(&ha->pdev->dev,
+                   sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE,
                    ha->flt, ha->flt_dma);
        ha->flt = NULL;
        ha->flt_dma = 0;