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 2828645EDE; Wed, 18 Dec 2024 18:05:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4997140F1A; Wed, 18 Dec 2024 18:05:42 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 4087040DF5 for ; Wed, 18 Dec 2024 18:05:41 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21670dce0a7so75247655ad.1 for ; Wed, 18 Dec 2024 09:05:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734541540; x=1735146340; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KYNxiqOOpG2ziCrENqcIcwanehjqgVlaZGbtd/b3qbE=; b=xKtKZ/pAQ+gmWfsZc1Sf01tAshr2N+nfFXShCaS/LdwvAloW86cpeEKFhW17xztcPJ qfsYbg17jVrPEJ7IsjXadoNR9gXgdROozDiPqkSXf3XbpAQ7nPVEO5syoUMOsC4D+YHa 5UtxU/mO1x+ntFrm/TZ8ik+AmTn4PLTaPnHVhjRhok3Xz+H/ZvPgLNN4sjErd+zD3NGt w3xeDGJ2PSZBZo22krZ31Nubr1ElMOCLZnYK3Th948pddn/kNAm1C1sZnushjnkqDHxI P7/yGvoZNo/owqoAMKSijrtX9vv+4KukZxyhq44Q/8al4+DAEVJ0aYSocyceGoRx6l6R JM5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734541540; x=1735146340; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KYNxiqOOpG2ziCrENqcIcwanehjqgVlaZGbtd/b3qbE=; b=NC+TenyzaZcRDVzBdM6sfFZda8PtEBjCQcs59dWfBlJhRrJqi7tmhn8cWdtNf8lnYq f1ehrsVNy0WxB7hfCvQm+YxlO8sPHeelsaH6EFpQ9H6vzFX4qIDSM59/oiL6zYN6Ru9y jpw0kk2FRuy52GQBbNKEqOJqub8lUqhROsUfMNkngbTB16yqqH1x5rI9S4GU+TYIPcTw ijVtKcWA7gWhEkFMGZd+HmLrG6Gsav+unPH6HkS2CGCwGkAv7OmTrgPWvUmbEBxhZmJP +XrBFIvpRXmJdz0BBuPd2/T2HviHJX9HzfYGcL5u3o2h5TCtFF7teQ1c6ghNaUeB0vaf awmw== X-Gm-Message-State: AOJu0YzZcSPafJkSmVmXDnyc/wUNniCO2C2S8BmxbWiU+biueiUEDr29 BoYvU98x4lJbKldUE3yw08jTV+/hWeuQkxbTmwcIvwFgf7qIzQOzPqAInxSgmLh8wyswsscbzNT f X-Gm-Gg: ASbGncsCkYF5WgD6WuTApz/phu9GILeD4d3cB4xbOd0FWVUSU7M6hdx1FBMn+0QoaTU WNeFqHMHwxGG7DKw9LoYD2fThoO0XZodvcIvNa04xRPfAs4vWYrdOkQ4M2eUhuqaYvf0ZZvX/4p xZNG53VgBa9zv/XMBAwyOeamPRe4YOranIyvXa4v7ycMVx6095anVykVLi0YiddsRPR2bij5SuG N/bZ0j7KQ4anTnW2Yk5Mo5I1t00Dd/SLFm5y5o8O0CGxu0z1mhlQoyYrbdltHk1lNEzmThYJgfO gHWrRDc2XBpSSrafnd8bgO4o0HuQ++SBmQ== X-Google-Smtp-Source: AGHT+IERQKMYk4BzahvzVz6tgF32yCCE2Utc/o0Y9k76H4o2TTgRBqBGuVUDmHe1bZ8Py7lW3Pr1Og== X-Received: by 2002:a17:903:2304:b0:216:2477:e4d3 with SMTP id d9443c01a7336-219d96ff321mr3869935ad.51.1734541540239; Wed, 18 Dec 2024 09:05:40 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e50bd2sm78702615ad.157.2024.12.18.09.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 09:05:39 -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] bus/fslmc: fix use after rte_free Date: Wed, 18 Dec 2024 09:05:30 -0800 Message-ID: <20241218170530.140747-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 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 derefence 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