Commit 5d09ee1b authored by Corey Minyard's avatar Corey Minyard
Browse files

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



This reverts commit c608966f.

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: default avatarCorey Minyard <corey@minyard.net>
Tested-by: default avatarEric Hagberg <ehagberg@janestreet.com>
Cc: <stable@vger.kernel.org> # 6.2
parent 8fd8ea28
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -122,10 +122,10 @@ struct si_sm_data {
	unsigned long  error0_timeout;
};

static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
				  struct si_sm_io *io, enum kcs_states state)
static unsigned int init_kcs_data(struct si_sm_data *kcs,
				  struct si_sm_io *io)
{
	kcs->state = state;
	kcs->state = KCS_IDLE;
	kcs->io = io;
	kcs->write_pos = 0;
	kcs->write_count = 0;
@@ -140,12 +140,6 @@ static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
	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)
{
	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)
		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);
		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) {
		init_kcs_data_with_state(kcs, kcs->io, KCS_ERROR0);
		init_kcs_data(kcs, kcs->io);
		return SI_SM_HOSED;
	}