]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ipmi: Fix __scan_channels() failing to rescan channels
authorJinhui Guo <guojinhui.liam@bytedance.com>
Tue, 30 Sep 2025 07:42:38 +0000 (15:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:11:45 +0000 (13:11 +0100)
[ Upstream commit 6bd30d8fc523fb880b4be548e8501bc0fe8f42d4 ]

channel_handler() sets intf->channels_ready to true but never
clears it, so __scan_channels() skips any rescan. When the BMC
firmware changes a rescan is required. Allow it by clearing
the flag before starting a new scan.

Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
Message-ID: <20250930074239.2353-3-guojinhui.liam@bytedance.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/ipmi/ipmi_msghandler.c

index 117454a5603b89af704e8ea13248d6bfde52f3a8..a72cd57dd8a5f39ae820bc7f0b14f2dd4610f6f1 100644 (file)
@@ -605,7 +605,8 @@ static void __ipmi_bmc_unregister(struct ipmi_smi *intf);
 static int __ipmi_bmc_register(struct ipmi_smi *intf,
                               struct ipmi_device_id *id,
                               bool guid_set, guid_t *guid, int intf_num);
-static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id);
+static int __scan_channels(struct ipmi_smi *intf,
+                               struct ipmi_device_id *id, bool rescan);
 
 
 /**
@@ -2556,7 +2557,7 @@ retry_bmc_lock:
                if (__ipmi_bmc_register(intf, &id, guid_set, &guid, intf_num))
                        need_waiter(intf); /* Retry later on an error. */
                else
-                       __scan_channels(intf, &id);
+                       __scan_channels(intf, &id, false);
 
 
                if (!intf_set) {
@@ -2576,7 +2577,7 @@ retry_bmc_lock:
                goto out_noprocessing;
        } else if (memcmp(&bmc->fetch_id, &bmc->id, sizeof(bmc->id)))
                /* Version info changes, scan the channels again. */
-               __scan_channels(intf, &bmc->fetch_id);
+               __scan_channels(intf, &bmc->fetch_id, true);
 
        bmc->dyn_id_expiry = jiffies + IPMI_DYN_DEV_ID_EXPIRY;
 
@@ -3326,10 +3327,17 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
 /*
  * Must be holding intf->bmc_reg_mutex to call this.
  */
-static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id)
+static int __scan_channels(struct ipmi_smi *intf,
+                               struct ipmi_device_id *id,
+                               bool rescan)
 {
        int rv;
 
+       if (rescan) {
+               /* Clear channels_ready to force channels rescan. */
+               intf->channels_ready = false;
+       }
+
        if (ipmi_version_major(id) > 1
                        || (ipmi_version_major(id) == 1
                            && ipmi_version_minor(id) >= 5)) {
@@ -3501,7 +3509,7 @@ int ipmi_add_smi(struct module         *owner,
        }
 
        mutex_lock(&intf->bmc_reg_mutex);
-       rv = __scan_channels(intf, &id);
+       rv = __scan_channels(intf, &id, false);
        mutex_unlock(&intf->bmc_reg_mutex);
        if (rv)
                goto out_err_bmc_reg;