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 A840E45EF1 for ; Thu, 19 Dec 2024 23:53:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D361402B1; Thu, 19 Dec 2024 23:53:06 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 7DF024025F for ; Thu, 19 Dec 2024 23:53:04 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2ef748105deso941893a91.1 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=vPzdhMS9Ql4jx3uPMtbb/TIsqKGpJsEpNcD1RLq+Zq5CyZybNmV8/ODJ8oGVsflouk AOM/9j/4n7/Qfs/B+8Quzsi1HU/+inuVljMfV2ZPgU6z9S7U3Wr55X94AuFwIgO+ptf5 6vvlc4y7F9Zr1Izy4nC3RZyMDgdsfruM8DuIfUYBS6tX2Nh6bY5WihswA2c8j8urBMws kM7ZP+v9sHShsqnpbaSgKWp5oKxf+X8HoDPe2Gxyx9Wt6COObT/eLEDhQW8/fMRJ5ish VE9Uh8yixDp1hU8dO2H8lBAozEpzHGBjzmu2/9HNsnAfrliDYm5lN+uYiXy4FUhiZfJ4 YqVg== X-Forwarded-Encrypted: i=1; AJvYcCUNUYNG4veMiDGRDl9rqVHu/StDp1IAtOlE4BsXqjXGS3hcgF/aE2o/1jO9+axGNy4U8KJD/7A=@dpdk.org X-Gm-Message-State: AOJu0YxZc0jvEBPX0kwzdqnJ6Vcsd1k2FcMelCj6vTJlVyTpqJ6b3Cl7 MWQACF0tcbURxUSSA0IvHXAVHBIT7PmeToL2uYC/DPBBbH7IXSs27zTB2ayea8c= X-Gm-Gg: ASbGncs0M/22TGHt9JIcAAyrGyu7LSQlR2wAIimLFdpY8s9JG4vb4RpB8SiU0upUNJ/ 15sQcjDQIoNezl9zDTdLdh9r0KdX0G6o7kNMeYC/BsKfLjOD7/hpCjAtcYVkWQdjtf+8eEPb/dv VKex3oJoq5EBBUL9f/PA3O7CcyJbAtAHEVR5SsYorPR6gfd0IlyZJ5a0Hvi3ddluFr9f+CDMx9c sLXOMr3nqHFh984SmLXfTiqWsES/5684uZfGLuMWwKPwchL24p/wkIA4RvjJhlLD/jaaONesQyF sxmrZGmAPjxig1CkD4ALdFoIUERm9zmToA== 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: 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 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