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 2BA0845EDE for ; Wed, 18 Dec 2024 18:05:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18C9F40DDE; Wed, 18 Dec 2024 18:05:42 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 25F7440DDE for ; Wed, 18 Dec 2024 18:05:41 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-21670dce0a7so75247645ad.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=eCx2epBFQAswwsv8yv2YzuZ/fD9mouObp3MIiU5SyvHVPWaDL1C09qnKGaHqR7ekjo 7FLCddOEYaUNaoiUTtbBApMXVH0sCke2x70Cj8B2ZJaj+Fu3ansxcqGKO2Jf2jcej7Gr fyKYOSWYNe4o4gvgjw/x14OdHpH/yiqqDJgjF48l2AWYOZRERjfDCdiMXgQo0uUUOpvA uvcYDCJhlcOwSYeOFVCEUHqrL827bd3L2fyojneCiwWB5ZAQnGvmL3Zi+1ePxYz+g/IF pD/MsgdG8V1TOU9wJoNxcE+9VItLqYr19WW4Vt3xhVQjPlUc2D1H4r089sORNJ8iauHe hr2w== X-Forwarded-Encrypted: i=1; AJvYcCUV9B0qqNLClkNHB+CnUSVaSh6aRw3dPOYiAzuAo6UHm0a8q7UZplCIOqt0ZGARbBuh/7OiLi4=@dpdk.org X-Gm-Message-State: AOJu0Ywao5jXlwrRmhAn3S/hL954lW04wRR/LIazA4X1ZDzBxbs+T/dz eNMsWsSYfCuEQl/Sr341RtN9p+8glIzHY4n/LTCi06q3k8qNmQGn8t8RUFu4ILQ= X-Gm-Gg: ASbGncuSVtbiJrrw563GKksjJg0si79oNGkFwi1oj85mKfkgmbLcJAfnDAK280LjCnU pXLtsPZ0LMVVPxgxnw/Vt5b+zb5pTArE0Wz1EyGU9z6U+fcsILrFPoKFGUtjc4lsl5VQu+DNDU4 b+9JUV5lYzHcq0jTmbzF1FTYDemrp18liygeSISIAhYtD1nDRRMl8HqXzTDdVSCFHe5V5WJoZ/D JzxF7gMp+mg87nux/+rRygxOg5rxQrHvW7hH2ZO3oSgb3QMD9TjDF57yc4+q8IBDvq+xL93CmQI cNfyao0Uztn57WXe+sjKgYw1pUIavEgVQQ== 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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