From patchwork Thu May 30 13:52:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Singh Tomar X-Patchwork-Id: 1941724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=UYkWksGn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vqnkk5Z6Vz20Pc for ; Thu, 30 May 2024 23:52:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=UYkWksGn; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Vqnkj282mz3cYl for ; Thu, 30 May 2024 23:52:45 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=UYkWksGn; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=abhishek@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Vqnkb6BdGz3cWR for ; Thu, 30 May 2024 23:52:39 +1000 (AEST) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44UDlu2a029895 for ; Thu, 30 May 2024 13:52:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : message-id : mime-version : subject : to; s=pp1; bh=xVqgTDXu+8GrP9yRenb11fhkJFCNuxH+6I/wCuVrSH8=; b=UYkWksGniSOlHL6bdRGfiupOsjyqKamxhKbeekopS9sGIQWdEdf+kddHGRUJ6pWrIseT rno68rI2SfLNTQSHhHIj3q7MtO8yRAkmdv/VuFdibpvr9SChnbBX7iRoX7V4bpaWSjKV 2tOGVOOK/sg9k9/AKGBATH7LwQ/UgJp4EuwFDyBldhCJeNulpRIwJmy5VR0rsKXnDQTp FTwm5ReSwquqlGmjs6Bn87kpiMg5nT4m8yZlo7Dd3B2XCBHpI5xiZ8xpQinaRAPDhuGJ MhoYKqEuPt8RWHOiauUwPetJsZJ5wEKgYy2WSQAejQZnAMkNYQQ7EjiVbDd24RN3qLxt xw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yetn5r0d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 May 2024 13:52:36 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44UC0ClJ009860 for ; Thu, 30 May 2024 13:52:35 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpbbt5p7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 May 2024 13:52:35 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44UDqTsf34144800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2024 13:52:31 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF36B2004E; Thu, 30 May 2024 13:52:29 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2ECD20040; Thu, 30 May 2024 13:52:28 +0000 (GMT) Received: from li-22421c4c-355e-11b2-a85c-fdc6c782cba9.in.ibm.com (unknown [9.109.222.204]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 May 2024 13:52:28 +0000 (GMT) From: Abhishek Singh Tomar To: skiboot@lists.ozlabs.org Date: Thu, 30 May 2024 19:22:18 +0530 Message-ID: <20240530135219.67528-1-abhishek@linux.ibm.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: TtpUDzgNy1Rj7Md_qglcqJminp1LYcxt X-Proofpoint-GUID: TtpUDzgNy1Rj7Md_qglcqJminp1LYcxt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_09,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 bulkscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 clxscore=1011 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405300105 Subject: [Skiboot] [PATCH 1/2] core/pldm: Fix dangling point issue X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abhishek Singh Tomar , mahesh@linux.vnet.ibm.com Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When calling pldm_platform_init() and the GET_PDR PLDM request fails, the 'pdrs_repo' global variable is freed but becomes a dangling pointer. Subsequent calls to pldm_platform_init will lead to an invalid read. ==28652== Invalid read of size 8 ==28652== at 0x40A4C8: pldm_pdr_destroy (pdr.c:130) ==28652== by 0x424BA3: pdr_init_complete (pldm-platform-requests.c:42) ==28652== by 0x4274DA: pldm_platform_load_pdrs (pldm-platform-requests.c:1170) ==28652== by 0x42759C: pdrs_init (pldm-platform-requests.c:1190) ==28652== by 0x427703: pldm_platform_init (pldm-platform-requests.c:1221) Signed-off-by: Abhishek Singh Tomar --- core/pldm/pldm-platform-requests.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c index cb0ff9443..21ec43a47 100644 --- a/core/pldm/pldm-platform-requests.c +++ b/core/pldm/pldm-platform-requests.c @@ -38,8 +38,10 @@ static void pdr_init_complete(bool success) if (!success) { pdr_ready = false; - if (pdrs_repo) + if (pdrs_repo) { pldm_pdr_destroy(pdrs_repo); + pdrs_repo = NULL; + } return; } From patchwork Thu May 30 13:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Singh Tomar X-Patchwork-Id: 1941725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=JL7VOvFb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqnrN2DXvz20Pb for ; Thu, 30 May 2024 23:57:40 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=JL7VOvFb; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VqnrM3RnZz3cYl for ; Thu, 30 May 2024 23:57:39 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=JL7VOvFb; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=abhishek@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VqnrJ3km9z3cWv for ; Thu, 30 May 2024 23:57:36 +1000 (AEST) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44UDJKJF004030 for ; Thu, 30 May 2024 13:57:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=Y9GsgFqb9GvQuBdcaeQLxpxtXU/VieiSEcivM6weydY=; b=JL7VOvFb34I4HFO5m1ll1rY9uyO2243Y103FsyjoKA10VK1IvZ5hyrfc1MEoyhCE/wfZ Wfy8zsHI4LjzTkudk9jSExuTxPRnaJ5d7cB8DMceJiMoh9YP6mG0OF2cJlhbg7TVRMoA dIBiE0NED8hu1QRDngqxwP1EoAcpEfTAoMQgVhbujKKIJKVJXGawyCInCISoeXgnEO/n p/YZjtEKKjdnA/s28vPQ5LY7DnSnSmDy41AXi0sGdKT8F5ZW2J/1oki9KwBZaoJBHN6q GHMby2sesrHiSYNWApa9IlOkDatUUu5LpfEq+ZpEIrMGsXuHUHeFzJ9kS3LozWg1fm0W MQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yet7g04c0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 May 2024 13:57:32 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44UC2HAI024727 for ; Thu, 30 May 2024 13:54:24 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ydphqt43d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 May 2024 13:54:24 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44UDsIGE53936556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2024 13:54:20 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 765C02004E; Thu, 30 May 2024 13:54:18 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88ADB20043; Thu, 30 May 2024 13:54:17 +0000 (GMT) Received: from li-22421c4c-355e-11b2-a85c-fdc6c782cba9.in.ibm.com (unknown [9.109.222.204]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 May 2024 13:54:17 +0000 (GMT) From: Abhishek Singh Tomar To: skiboot@lists.ozlabs.org Date: Thu, 30 May 2024 19:22:19 +0530 Message-ID: <20240530135219.67528-2-abhishek@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240530135219.67528-1-abhishek@linux.ibm.com> References: <20240530135219.67528-1-abhishek@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lY25c9qNAtBzaBT_xh2ZT5shvsD8gjdH X-Proofpoint-ORIG-GUID: lY25c9qNAtBzaBT_xh2ZT5shvsD8gjdH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_09,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxlogscore=995 impostorscore=0 priorityscore=1501 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405300105 Subject: [Skiboot] [PATCH 2/2] core/pldm: Fix Use of uninitialised value X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abhishek Singh Tomar , mahesh@linux.vnet.ibm.com Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" In decode_platform_event_message_resp() when response.completion_code is not PLDM_SUCCESS then response.platform_event_status remain uninitialized this end up triggering following warning ==48024== Use of uninitialised value of size 8 ==48024== at 0x48D12CB: _itoa_word (_itoa.c:183) ==48024== by 0x48DBFA1: __printf_buffer (vfprintf-process-arg.c:155) ==48024== by 0x48DE072: __vfprintf_internal (vfprintf-internal.c:1559) ==48024== by 0x42DD97: vprintf (stdio.h:41) ==48024== by 0x42DD97: _prlog (stubs.c:27) ==48024== by 0x426C92: send_repository_changed_event (pldm-platform-requests.c:929) ==48024== by 0x426E7D: add_hosted_pdrs (pldm-platform-requests.c:973) ==48024== by 0x427752: pldm_platform_init (pldm-platform-requests.c:1226) Fix issue by intializing struct response with 0. Signed-off-by: Abhishek Singh Tomar --- core/pldm/pldm-platform-requests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c index 21ec43a47..e129b3a37 100644 --- a/core/pldm/pldm-platform-requests.c +++ b/core/pldm/pldm-platform-requests.c @@ -834,7 +834,7 @@ static int send_repository_changed_event(uint32_t num_changed_pdrs, .event_class = PLDM_PDR_REPOSITORY_CHG_EVENT, }; - struct pldm_platform_event_message_resp response; + struct pldm_platform_event_message_resp response = {0}; prlog(PR_DEBUG, "%s - num_changed_pdrs: %d\n", __func__, num_changed_pdrs);