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 354DF45EF0; Thu, 19 Dec 2024 23:53:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C383B402BB; Thu, 19 Dec 2024 23:53:06 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id 8682E40265 for ; Thu, 19 Dec 2024 23:53:04 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-725abf74334so1161448b3a.3 for ; Thu, 19 Dec 2024 14:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734648783; x=1735253583; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gAw2MeeXSMcnLAA03lGgyCsPeplU8xOKNPLJKoaUh70=; b=pDMewaseLo38FbqZs4sWMnU4YKLK1wjnw+j8PlZT8Lhgg2xezQkJqt/Os/Iu/VygZB 2rqp+/uWRLteQUlqHQBxiwtlSwQ0WoNmkSbaYAUzwz1tOX42F5laY6SW4e2OG5+VS2KI HYM8d9hnCu43N4FVlu4pLaQ/LKibZCQ6QbakwmL4UYYZGu7YlTnT7ZhasMVllsnAgekp tO+82Lnqt9L9TTzgAfN2KcTVQ3RZ+js7XBRhcOzemy4ZOnAWtgClzMrA7qKEwfioyNLM 5Ebj349Th5q5FWdd/VMiO7qms/JZ3ose0iAL7zPtb28Hkb3IQe6Ky1W/pUmxAAShbnOb jVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734648783; x=1735253583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gAw2MeeXSMcnLAA03lGgyCsPeplU8xOKNPLJKoaUh70=; b=ImGHG2Mvz/LERL2uevwFC891LLDe5rHN/Ojk2Y1COBtBzhXWbYF7QVxLZca8IjT81/ lI08qeidcH8c8+GgxV+v0ZDWMrqZexXqi5Zs5J3m7TqcjwmovwZ8+DmZ/lKw2yfsP0oj ULfLCf+g5R2C3UvdIp0Q5VaR7QSEo9XJphi5yVBxaGUpirRRUTImGBMGGW6jweKDXIgS OnIJbTlDyYk77Po2pSNsoSRMs482pI7gDhg6NPzFQLhISoilKUCpgKqVgbUn+h5FuqUY lNlUiPrFT16Zefwh/dszIBAYzfUELOg1h2yjEKfMX+VOdt7KG6J1HC5IkSQE4vy6Gb2+ ZDEg== X-Gm-Message-State: AOJu0Yw9TqNRo5jUyZEJfC+Vsxfannwl+5vkk26GLmTM11pt40drqwyv Aq3X6NzlNwOMIstETEG30dYgytP+ZRKYwb5JwTZU6LwA0BmVsq6YdvXXKdKwZAWm5qvuqcnlZZi 7vfI= X-Gm-Gg: ASbGncuWTUverTxlJ1DxmYUlberzJlo35ogpntE0Mx8xFc+L6EFtFs/xJ3EzkZVUGIQ yVdZPlLz1h1ZNNtyh5uSEnQpbNDI+2q8RWnXKmd1DVACby0bSbl8EBR9otuecDQRJAVs9z6jLvr cj7SRnJ6MUiDGNCrqKuKtJVeKf2NpkLOC+DJaVKX++tsOo99CADuEQGfxwVgHZUHrv0fqQWdmU7 xN4Iozw8fT3hZqZbWY4l04i2dWFMHB/Lvl5h+BqHpu5gqnXl1CReTyqwqRchz3SZGJfBQZ5ffDQ ISBtnqIqOzENwh9nGMAJxnrbcPcqC/OHuQ== X-Google-Smtp-Source: AGHT+IHZSHhWJ3A/Knez0lLH/YlAhHVk10UpD0zDFrVCSBXdlWblHofHeBTNI+5bVW1X0ZqWgcodQA== X-Received: by 2002:a17:90a:c884:b0:2ee:7698:e565 with SMTP id 98e67ed59e1d1-2f452dea33emr1214989a91.8.1734648783671; Thu, 19 Dec 2024 14:53:03 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ed62b30asm3901021a91.12.2024.12.19.14.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 14:53:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , shreyansh.jain@nxp.com, stable@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [PATCH v2 1/5] bus/fslmc: fix use after rte_free Date: Thu, 19 Dec 2024 14:49:51 -0800 Message-ID: <20241219225253.782792-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241219225253.782792-1-stephen@networkplumber.org> References: <20241218170530.140747-1-stephen@networkplumber.org> <20241219225253.782792-1-stephen@networkplumber.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 The cleanup loop would deference the dpio_dev after freeing. Use TAILQ_FOREACH_SAFE to fix that. Found by building with sanitizer undefined flag. Fixes: e55d0494ab98 ("bus/fslmc: support secondary process") Cc: shreyansh.jain@nxp.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 2dfcf7a498..fb7d1968d1 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -403,6 +403,7 @@ dpaa2_create_dpio_device(int vdev_fd, struct rte_dpaa2_device *obj) { struct dpaa2_dpio_dev *dpio_dev = NULL; + struct dpaa2_dpio_dev *dpio_tmp; struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)}; struct qbman_swp_desc p_des; struct dpio_attr attr; @@ -588,7 +589,7 @@ dpaa2_create_dpio_device(int vdev_fd, rte_free(dpio_dev); /* For each element in the list, cleanup */ - TAILQ_FOREACH(dpio_dev, &dpio_dev_list, next) { + RTE_TAILQ_FOREACH_SAFE(dpio_dev, &dpio_dev_list, next, dpio_tmp) { if (dpio_dev->dpio) { dpio_disable(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); -- 2.45.2