Skip to content

Commit

Permalink
qla2x00t-32gbit: Fix double free of the ha->vp_map pointer
Browse files Browse the repository at this point in the history
Coverity scan reported potential risk of double free of the pointer
ha->vp_map.  ha->vp_map was freed in qla2x00_mem_alloc(), and again freed
in function qla2x00_mem_free(ha).

Assign NULL to vp_map and kfree take care of NULL.

Cc: stable@vger.kernel.org
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20240227164127.36465-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit e288285d4778 upstream ]
  • Loading branch information
lnocturno committed May 3, 2024
1 parent 5a325ea commit b0dd719
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions qla2x00t-32gbit/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -4673,6 +4673,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
ha->init_cb_dma = 0;
fail_free_vp_map:
kfree(ha->vp_map);
ha->vp_map = NULL;
fail:
ql_log(ql_log_fatal, NULL, 0x0030,
"Memory allocation failure.\n");
Expand Down

0 comments on commit b0dd719

Please sign in to comment.