Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

This reverts commit c608966f3f9c2dca596967501d00753282b395fc.

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

+5 -11
+5 -11
drivers/char/ipmi/ipmi_kcs_sm.c
··· 122 122 unsigned long error0_timeout; 123 123 }; 124 124 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) 127 127 { 128 - kcs->state = state; 128 + kcs->state = KCS_IDLE; 129 129 kcs->io = io; 130 130 kcs->write_pos = 0; 131 131 kcs->write_count = 0; ··· 138 138 139 139 /* Reserve 2 I/O bytes. */ 140 140 return 2; 141 - } 142 - 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 141 } 148 142 149 143 static inline unsigned char read_status(struct si_sm_data *kcs) ··· 270 276 if (size > MAX_KCS_WRITE_SIZE) 271 277 return IPMI_REQ_LEN_EXCEEDED_ERR; 272 278 273 - if (kcs->state != KCS_IDLE) { 279 + if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) { 274 280 dev_warn(kcs->io->dev, "KCS in invalid state %d\n", kcs->state); 275 281 return IPMI_NOT_IN_MY_STATE_ERR; 276 282 } ··· 495 501 } 496 502 497 503 if (kcs->state == KCS_HOSED) { 498 - init_kcs_data_with_state(kcs, kcs->io, KCS_ERROR0); 504 + init_kcs_data(kcs, kcs->io); 499 505 return SI_SM_HOSED; 500 506 } 501 507