From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BED44242A; Fri, 20 Jan 2023 05:42:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E430642DCE; Fri, 20 Jan 2023 05:42:00 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 7D50642DAE for ; Fri, 20 Jan 2023 05:41:56 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 49DB3B81FB6; Fri, 20 Jan 2023 04:41:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D2B6C433EF; Fri, 20 Jan 2023 04:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674189715; bh=RigiKorR3dMZBI+SxDLNAndkSDREvu4zoNk+V8ONMkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mtIhrJwhMkVjhDiq6agdbl3TCZkMRCv8YIt11eu+Hl8ewl5xjlVi091S6BlHIkiXs UV97rQsuvqEiGgpVaIs+ySi5jGkhRccaXM37Rh+f9LbOlRW2YalSdhgmtUbblXT5Kr KuibAOsMOybS2ZBrEZgP/VYJ1r8HOaNfon/H8wz5PErGA4GSmED9v2a+qY5PtIuBjy DJfWrHg2rQmYQ1L2pOnSwPK8kYPhDb4FpwIcwHP0GZ4aGWrwF8CswnYyMuJLzNqCcI +pf/s0GjXeIPjA6E9sM6DNYTVDok4BfwRgdx+6Z8gbLPTkGUQIrY2ZFAdjObOG5kTb 7hODYkpV36cJw== From: okaya@kernel.org To: Anatoly Burakov Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v3 08/10] malloc: check result of malloc_elem_free Date: Thu, 19 Jan 2023 23:41:38 -0500 Message-Id: <20230120044140.95975-9-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230120044140.95975-1-okaya@kernel.org> References: <20230120044140.95975-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sinan Kaya In malloc_heap_free result of call to malloc_elem_free is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 88270ce4d2..6eb6fcda5e 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -892,6 +892,9 @@ malloc_heap_free(struct malloc_elem *elem) /* anything after this is a bonus */ ret = 0; + if (elem == NULL) + goto free_unlock; + /* ...of which we can't avail if we are in legacy mode, or if this is an * externally allocated segment. */ -- 2.25.1