Skip to content

Commit b9cc715

Browse files
cminyardgregkh
authored andcommitted
Revert "ipmi: fix msg stack when IPMI is disconnected"
commit 5d09ee1 upstream. This reverts commit c608966. 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>
1 parent d9457e6 commit b9cc715

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/char/ipmi/ipmi_kcs_sm.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ struct si_sm_data {
122122
unsigned long error0_timeout;
123123
};
124124

125-
static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
126-
struct si_sm_io *io, enum kcs_states state)
125+
static unsigned int init_kcs_data(struct si_sm_data *kcs,
126+
struct si_sm_io *io)
127127
{
128-
kcs->state = state;
128+
kcs->state = KCS_IDLE;
129129
kcs->io = io;
130130
kcs->write_pos = 0;
131131
kcs->write_count = 0;
@@ -140,12 +140,6 @@ static unsigned int init_kcs_data_with_state(struct si_sm_data *kcs,
140140
return 2;
141141
}
142142

143-
static unsigned int init_kcs_data(struct si_sm_data *kcs,
144-
struct si_sm_io *io)
145-
{
146-
return init_kcs_data_with_state(kcs, io, KCS_IDLE);
147-
}
148-
149143
static inline unsigned char read_status(struct si_sm_data *kcs)
150144
{
151145
return kcs->io->inputb(kcs->io, 1);
@@ -276,7 +270,7 @@ static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data,
276270
if (size > MAX_KCS_WRITE_SIZE)
277271
return IPMI_REQ_LEN_EXCEEDED_ERR;
278272

279-
if (kcs->state != KCS_IDLE) {
273+
if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) {
280274
dev_warn(kcs->io->dev, "KCS in invalid state %d\n", kcs->state);
281275
return IPMI_NOT_IN_MY_STATE_ERR;
282276
}
@@ -501,7 +495,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
501495
}
502496

503497
if (kcs->state == KCS_HOSED) {
504-
init_kcs_data_with_state(kcs, kcs->io, KCS_ERROR0);
498+
init_kcs_data(kcs, kcs->io);
505499
return SI_SM_HOSED;
506500
}
507501

0 commit comments

Comments
 (0)