Skip to content

Commit 1bc46a0

Browse files
VigneshwaranSaravanaigaw
authored andcommitted
plugins/ocp: fix UAF when printing telemetry log
Take care the below failures for "telemetry-string-log". Resolved the Segmentation Fault issue while printing. Signed-off-by: Vigneshwaran Saravanan/Vigneshwaran Saravanan <s.vignesh@samsung.com> Reviewed-by: Karthik Balan <karthik.b82@samsung.com> Reviewed-by: Arunpandian J <arun.j@samsung.com>
1 parent 9e137f0 commit 1bc46a0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

plugins/ocp/ocp-nvme.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ static int eol_plp_failure_mode(int argc, char **argv, struct command *cmd,
902902
/// Telemetry Log
903903
//global buffers
904904
static __le64 total_log_page_sz;
905+
static __u8 *header_data;
905906
static struct telemetry_str_log_format *log_data;
906907

907908
__u8 *ptelemetry_buffer;
@@ -1588,8 +1589,6 @@ static int get_telemetry_log_page_data(struct nvme_dev *dev, int tele_type)
15881589
static int get_c9_log_page_data(struct nvme_dev *dev, int print_data, int save_bin)
15891590
{
15901591
int ret = 0, fd;
1591-
__u8 *header_data;
1592-
struct telemetry_str_log_format *log_data;
15931592
__le64 stat_id_str_table_ofst = 0;
15941593
__le64 event_str_table_ofst = 0;
15951594
__le64 vu_event_str_table_ofst = 0;
@@ -1663,7 +1662,6 @@ static int get_c9_log_page_data(struct nvme_dev *dev, int print_data, int save_b
16631662
}
16641663

16651664
exit_status:
1666-
free(header_data);
16671665
return 0;
16681666
}
16691667

@@ -3621,7 +3619,7 @@ static int get_c9_log_page(struct nvme_dev *dev, char *format)
36213619
}
36223620
} else
36233621
fprintf(stderr, "ERROR : OCP : Unable to read C9 data from buffer\n");
3624-
3622+
free(header_data);
36253623
return ret;
36263624
}
36273625

0 commit comments

Comments
 (0)