提交 d8d022cb 编写于 作者: E Eric Farman 提交者: Wang ShaoBo

vfio-ccw: Reset FSM state to IDLE inside FSM

stable inclusion
from stable-v5.10.44
commit cad3dc73c0645d00adfe96cebc8d950897cc1227
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=453
CVE: NA

-------------------------------------------------

[ Upstream commit 6c02ac4c ]

When an I/O request is made, the fsm_io_request() routine
moves the FSM state from IDLE to CP_PROCESSING, and then
fsm_io_helper() moves it to CP_PENDING if the START SUBCHANNEL
received a cc0. Yet, the error case to go from CP_PROCESSING
back to IDLE is done after the FSM call returns.

Let's move this up into the FSM proper, to provide some
better symmetry when unwinding in this case.
Signed-off-by: NEric Farman <farman@linux.ibm.com>
Reviewed-by: NCornelia Huck <cohuck@redhat.com>
Acked-by: NMatthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <20210511195631.3995081-3-farman@linux.ibm.com>
Signed-off-by: NCornelia Huck <cohuck@redhat.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYuanHuiQ <3552253686@qq.com>
Reviewed-by: Jian Cheng <cj.chengjian(a)huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 f891051d
...@@ -318,6 +318,7 @@ static void fsm_io_request(struct vfio_ccw_private *private, ...@@ -318,6 +318,7 @@ static void fsm_io_request(struct vfio_ccw_private *private,
} }
err_out: err_out:
private->state = VFIO_CCW_STATE_IDLE;
trace_vfio_ccw_fsm_io_request(scsw->cmd.fctl, schid, trace_vfio_ccw_fsm_io_request(scsw->cmd.fctl, schid,
io_region->ret_code, errstr); io_region->ret_code, errstr);
} }
......
...@@ -276,8 +276,6 @@ static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, ...@@ -276,8 +276,6 @@ static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private,
} }
vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ); vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ);
if (region->ret_code != 0)
private->state = VFIO_CCW_STATE_IDLE;
ret = (region->ret_code != 0) ? region->ret_code : count; ret = (region->ret_code != 0) ? region->ret_code : count;
out_unlock: out_unlock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册