diff options
| author | Johannes Thumshirn <[email protected]> | 2020-04-28 19:45:55 +0900 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2020-04-29 22:04:24 -0400 |
| commit | 20a66f2bf280277ab5bb22e27445153b4eb0ac88 (patch) | |
| tree | 5d8f106088b12fbbefee9d742196f7fc02324318 /tools/perf/scripts/python/bin | |
| parent | ea941016abf7e6f81b130f8eb792e9ad0971237a (diff) | |
scsi: core: free sgtables in case command setup fails
In case scsi_setup_fs_cmnd() fails we're not freeing the sgtables allocated
by scsi_init_io(), thus we leak the allocated memory.
Free the sgtables allocated by scsi_init_io() in case scsi_setup_fs_cmnd()
fails.
Technically scsi_setup_scsi_cmnd() does not suffer from this problem as it
can only fail if scsi_init_io() fails, so it does not have sgtables
allocated. But to maintain symmetry and as a measure of defensive
programming, free the sgtables on scsi_setup_scsi_cmnd() failure as well.
scsi_mq_free_sgtables() has safeguards against double-freeing of memory so
this is safe to do.
While we're at it, rename scsi_mq_free_sgtables() to scsi_free_sgtables().
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205595
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Daniel Wagner <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions