]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: idxd: Fix crash when the event log is disabled
authorVinicius Costa Gomes <vinicius.gomes@intel.com>
Wed, 21 Jan 2026 18:34:28 +0000 (10:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 11:25:53 +0000 (13:25 +0200)
[ Upstream commit 52d2edea0d63c935e82631e4b9e4a94eccf97b5b ]

If reporting errors to the event log is not supported by the hardware,
and an error that causes Function Level Reset (FLR) is received, the
driver will try to restore the event log even if it was not allocated.

Also, only try to free the event log if it was properly allocated.

Fixes: 6078a315aec1 ("dmaengine: idxd: Add idxd_device_config_save() and idxd_device_config_restore() helpers")
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Link: https://patch.msgid.link/20260121-idxd-fix-flr-on-kernel-queues-v3-v3-2-7ed70658a9d1@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/idxd/device.c
drivers/dma/idxd/init.c

index c2cdf41b6e5764577c300c97be84477a1efb56b9..f9e49c5545f65ded1752a0de35731059e6cdf9b1 100644 (file)
@@ -830,6 +830,9 @@ static void idxd_device_evl_free(struct idxd_device *idxd)
        struct device *dev = &idxd->pdev->dev;
        struct idxd_evl *evl = idxd->evl;
 
+       if (!evl)
+               return;
+
        gencfg.bits = ioread32(idxd->reg_base + IDXD_GENCFG_OFFSET);
        if (!gencfg.evl_en)
                return;
index 2acc34b3daff8e5b4ff04ead1905a0cdfb0fa95a..449424242631d4aeee47e15c986f5ae17b35d14c 100644 (file)
@@ -962,7 +962,8 @@ static void idxd_device_config_restore(struct idxd_device *idxd,
 
        idxd->rdbuf_limit = idxd_saved->saved_idxd.rdbuf_limit;
 
-       idxd->evl->size = saved_evl->size;
+       if (idxd->evl)
+               idxd->evl->size = saved_evl->size;
 
        for (i = 0; i < idxd->max_groups; i++) {
                struct idxd_group *saved_group, *group;