Skip to content

Commit 6bd30d8

Browse files
guojinhui-liamcminyard
authored andcommitted
ipmi: Fix __scan_channels() failing to rescan channels
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>
1 parent 936750f commit 6bd30d8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ static void __ipmi_bmc_unregister(struct ipmi_smi *intf);
599599
static int __ipmi_bmc_register(struct ipmi_smi *intf,
600600
struct ipmi_device_id *id,
601601
bool guid_set, guid_t *guid, int intf_num);
602-
static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id);
602+
static int __scan_channels(struct ipmi_smi *intf,
603+
struct ipmi_device_id *id, bool rescan);
603604

604605
static void free_ipmi_user(struct kref *ref)
605606
{
@@ -2668,7 +2669,7 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
26682669
if (__ipmi_bmc_register(intf, &id, guid_set, &guid, intf_num))
26692670
need_waiter(intf); /* Retry later on an error. */
26702671
else
2671-
__scan_channels(intf, &id);
2672+
__scan_channels(intf, &id, false);
26722673

26732674

26742675
if (!intf_set) {
@@ -2688,7 +2689,7 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
26882689
goto out_noprocessing;
26892690
} else if (memcmp(&bmc->fetch_id, &bmc->id, sizeof(bmc->id)))
26902691
/* Version info changes, scan the channels again. */
2691-
__scan_channels(intf, &bmc->fetch_id);
2692+
__scan_channels(intf, &bmc->fetch_id, true);
26922693

26932694
bmc->dyn_id_expiry = jiffies + IPMI_DYN_DEV_ID_EXPIRY;
26942695

@@ -3438,10 +3439,17 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
34383439
/*
34393440
* Must be holding intf->bmc_reg_mutex to call this.
34403441
*/
3441-
static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id)
3442+
static int __scan_channels(struct ipmi_smi *intf,
3443+
struct ipmi_device_id *id,
3444+
bool rescan)
34423445
{
34433446
int rv;
34443447

3448+
if (rescan) {
3449+
/* Clear channels_ready to force channels rescan. */
3450+
intf->channels_ready = false;
3451+
}
3452+
34453453
if (ipmi_version_major(id) > 1
34463454
|| (ipmi_version_major(id) == 1
34473455
&& ipmi_version_minor(id) >= 5)) {
@@ -3656,7 +3664,7 @@ int ipmi_add_smi(struct module *owner,
36563664
}
36573665

36583666
mutex_lock(&intf->bmc_reg_mutex);
3659-
rv = __scan_channels(intf, &id);
3667+
rv = __scan_channels(intf, &id, false);
36603668
mutex_unlock(&intf->bmc_reg_mutex);
36613669
if (rv)
36623670
goto out_err_bmc_reg;

0 commit comments

Comments
 (0)