diff options
author | Bart Van Assche <[email protected]> | 2021-03-20 16:23:59 -0700 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2021-03-24 21:47:21 -0400 |
commit | e5406d8ad4a1659f4d4d1b39fe203855c4eaef2d (patch) | |
tree | 07680dd9599282246fee7619230f1ef2a6f9df24 | |
parent | a2b2cc660822cae08c351c7f6b452bfd1330a4f7 (diff) |
scsi: qla2xxx: Check kzalloc() return value
Instead of crashing if kzalloc() fails, make qla2x00_get_host_stats()
return -ENOMEM.
Link: https://lore.kernel.org/r/[email protected]
Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port")
Cc: Himanshu Madhani <[email protected]>
Cc: Saurav Kashyap <[email protected]>
Cc: Nilesh Javali <[email protected]>
Cc: Quinn Tran <[email protected]>
Cc: Mike Christie <[email protected]>
Cc: Daniel Wagner <[email protected]>
Cc: Lee Duncan <[email protected]>
Reviewed-by: Daniel Wagner <[email protected]>
Reviewed-by: Himanshu Madhani <[email protected]>
Acked-by: Saurav Kashyap <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index bee8cf9f8123..bc84b2f389f8 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -2583,6 +2583,10 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job) } data = kzalloc(response_len, GFP_KERNEL); + if (!data) { + kfree(req_data); + return -ENOMEM; + } ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, data, response_len); |