From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v1 10/13] common/sxe2: allow munmap during kernel reset
Date: Mon, 17 Aug 2026 10:53:36 +0800 [thread overview]
Message-ID: <20260817025339.2792682-11-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <20260817025339.2792682-1-liujie5@linkdatatechnology.com>
From: Jie Liu <liujie5@linkdatatechnology.com>
This patch improves error handling and resource management:
- Add NULL pointer protection in driver remove path:
* Check cdrv and cdrv->remove before calling remove function
* Prevent NULL pointer dereference in sxe2_classes_driver_remove
* Return SXE2_SUCCESS if no driver or remove handler exists
- Allow memory unmap during kernel reset:
* Remove kernel_reset restriction in sxe2_drv_dev_munmap
* Enable cleanup operations even when kernel has been reset
Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
---
drivers/common/sxe2/sxe2_common.c | 5 ++++-
drivers/common/sxe2/sxe2_ioctl_chnl.c | 8 +-------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/common/sxe2/sxe2_common.c b/drivers/common/sxe2/sxe2_common.c
index 5c5db85f29..3f60b2be11 100644
--- a/drivers/common/sxe2/sxe2_common.c
+++ b/drivers/common/sxe2/sxe2_common.c
@@ -465,8 +465,11 @@ static int32_t sxe2_classes_driver_probe(struct sxe2_common_device *cdev,
static int32_t sxe2_classes_driver_remove(struct sxe2_common_device *cdev)
{
struct sxe2_class_driver *cdrv = cdev->cdrv;
+ int32_t ret = 0;
- return cdrv->remove(cdev);
+ if (cdrv != NULL && cdrv->remove != NULL)
+ ret = cdrv->remove(cdev);
+ return ret;
}
static int32_t sxe2_kvargs_validate(struct sxe2_dev_kvargs_info *kv_info)
diff --git a/drivers/common/sxe2/sxe2_ioctl_chnl.c b/drivers/common/sxe2/sxe2_ioctl_chnl.c
index a233a78136..3e2fbf572f 100644
--- a/drivers/common/sxe2/sxe2_ioctl_chnl.c
+++ b/drivers/common/sxe2/sxe2_ioctl_chnl.c
@@ -367,16 +367,10 @@ void
RTE_EXPORT_INTERNAL_SYMBOL(sxe2_drv_dev_munmap)
int32_t
-sxe2_drv_dev_munmap(struct sxe2_common_device *cdev, void *virt, uint64_t len)
+sxe2_drv_dev_munmap(struct sxe2_common_device *cdev __rte_unused, void *virt, uint64_t len)
{
int32_t ret = 0;
- if (cdev->config.kernel_reset) {
- ret = -EPERM;
- PMD_LOG_WARN(COM, "kernel reset, need restart app.");
- goto l_end;
- }
-
PMD_LOG_DEBUG(COM, "Munmap virt=%p, len=0x%"PRIx64"",
virt, len);
--
2.52.0
next prev parent reply other threads:[~2026-08-17 2:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 2:53 [PATCH v1 00/13] fix bugs liujie5
2026-08-17 2:53 ` [PATCH v1 01/13] net/sxe2: add Rx queue buffer split fill support liujie5
2026-08-17 2:53 ` [PATCH v1 02/13] net/sxe2: update switchdev repr VSI ID display format liujie5
2026-08-17 2:53 ` [PATCH v1 03/13] net/sxe2: add ACL engine event statistics support liujie5
2026-08-17 2:53 ` [PATCH v1 04/13] net/sxe2: enhance device cap and res management liujie5
2026-08-17 2:53 ` [PATCH v1 05/13] net/sxe2: improve representor device initialization liujie5
2026-08-17 2:53 ` [PATCH v1 06/13] net/sxe2: refactor flow tunnel port handling liujie5
2026-08-17 2:53 ` [PATCH v1 07/13] net/sxe2: validate IPsec key length against maximum limit liujie5
2026-08-17 2:53 ` [PATCH v1 08/13] net/sxe2: enhance repr event handling and MP code liujie5
2026-08-17 2:53 ` [PATCH v1 09/13] net/sxe2: optimize vectorized Tx/Rx path liujie5
2026-08-17 2:53 ` liujie5 [this message]
2026-08-17 2:53 ` [PATCH v1 11/13] net/sxe2: clean up duplicate function declarations liujie5
2026-08-17 2:53 ` [PATCH v1 12/13] net/sxe2: clean up structure definitions liujie5
2026-08-17 2:53 ` [PATCH v1 13/13] doc/sxe2: add acl-stat-type parameter documentation liujie5
2026-08-18 2:09 ` [PATCH v1 00/13] fix bugs Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2026-08-18 2:15 [PATCH v1 00/13] net/sxe2: " liujie5
2026-08-18 2:15 ` [PATCH v1 10/13] common/sxe2: allow munmap during kernel reset liujie5
2026-08-14 12:21 [PATCH v1 00/13] net/sxe2: fix bugs liujie5
2026-08-14 12:22 ` [PATCH v1 10/13] common/sxe2: allow munmap during kernel reset liujie5
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260817025339.2792682-11-liujie5@linkdatatechnology.com \
--to=liujie5@linkdatatechnology.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.