• Bart Van Assche's avatar
    scsi: Avoid that toggling use_blk_mq triggers a memory leak · 8d58881b
    Bart Van Assche authored
    This patch avoids that the following memory leak is triggered if
    use_blk_mq is disabled after a SCSI host has been allocated by the
    ib_srp driver and before the same SCSI host is freed:
    
    unreferenced object 0xffff8803a168c568 (size 256):
      backtrace:
        [<ffffffff81620c95>] kmemleak_alloc+0x45/0xa0
        [<ffffffff811bb104>] __kmalloc_node+0x1e4/0x400
        [<ffffffff81309fe4>] blk_mq_alloc_tag_set+0xb4/0x230
        [<ffffffff814731b7>] scsi_mq_setup_tags+0xc7/0xd0
        [<ffffffff81469c26>] scsi_add_host_with_dma+0x216/0x2d0
        [<ffffffffa064bef5>] srp_create_target+0xe55/0x13d0 [ib_srp]
        [<ffffffff8143ce23>] dev_attr_store+0x13/0x20
        [<ffffffff8125f030>] sysfs_kf_write+0x40/0x50
        [<ffffffff8125e397>] kernfs_fop_write+0x137/0x1c0
        [<ffffffff811d8c13>] __vfs_write+0x23/0x140
        [<ffffffff811d92e0>] vfs_write+0xb0/0x190
        [<ffffffff811da5b4>] SyS_write+0x44/0xa0
        [<ffffffff8162c8a5>] entry_SYSCALL_64_fastpath+0x18/0xa8
    
    Fixes: 9aa9cc42 ("scsi: remove the disable_blk_mq host flag")
    Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: <stable@vger.kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    8d58881b
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...