Revert "ipmi: fix msg stack when IPMI is disconnected"

commit 5d09ee1bec upstream.

This reverts commit c608966f3f.

This patch has a subtle bug that can cause the IPMI driver to go into an
infinite loop if the BMC misbehaves in a certain way.  Apparently
certain BMCs do misbehave this way because several reports have come in
recently about this.

Signed-off-by: Corey Minyard <corey@minyard.net>
Tested-by: Eric Hagberg <ehagberg@janestreet.com>
Cc: <stable@vger.kernel.org> # 6.2
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Corey Minyard
2025-08-20 11:03:13 -05:00
committed by Greg Kroah-Hartman
parent d9457e6258
commit b9cc7155e6

View File

@@ -122,10 +122,10 @@ struct si_sm_data {
unsigned long error0_timeout; unsigned long error0_timeout;
}; };
static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs, static unsigned int init_kcs_data(struct si_sm_data *kcs,
struct si_sm_io *io, enum kcs_states state) struct si_sm_io *io)
{ {
kcs->state = state; kcs->state = KCS_IDLE;
kcs->io = io; kcs->io = io;
kcs->write_pos = 0; kcs->write_pos = 0;
kcs->write_count = 0; kcs->write_count = 0;
@@ -140,12 +140,6 @@ static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
return 2; return 2;
} }
static unsigned int init_kcs_data(struct si_sm_data *kcs,
struct si_sm_io *io)
{
return init_kcs_data_with_state(kcs, io, KCS_IDLE);
}
static inline unsigned char read_status(struct si_sm_data *kcs) static inline unsigned char read_status(struct si_sm_data *kcs)
{ {
return kcs->io->inputb(kcs->io, 1); return kcs->io->inputb(kcs->io, 1);
@@ -276,7 +270,7 @@ static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data,
if (size > MAX_KCS_WRITE_SIZE) if (size > MAX_KCS_WRITE_SIZE)
return IPMI_REQ_LEN_EXCEEDED_ERR; return IPMI_REQ_LEN_EXCEEDED_ERR;
if (kcs->state != KCS_IDLE) { if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) {
dev_warn(kcs->io->dev, "KCS in invalid state %d\n", kcs->state); dev_warn(kcs->io->dev, "KCS in invalid state %d\n", kcs->state);
return IPMI_NOT_IN_MY_STATE_ERR; return IPMI_NOT_IN_MY_STATE_ERR;
} }
@@ -501,7 +495,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
} }
if (kcs->state == KCS_HOSED) { if (kcs->state == KCS_HOSED) {
init_kcs_data_with_state(kcs, kcs->io, KCS_ERROR0); init_kcs_data(kcs, kcs->io);
return SI_SM_HOSED; return SI_SM_HOSED;
} }