Messages in this thread | | | Subject | Re: [PATCH] iscsi_tcp: fix the NULL pointer dereference | From | michael.christie@oracle ... | Date | Sun, 10 Oct 2021 11:05:07 -0500 |
| |
On 10/10/21 2:19 AM, Li Feng wrote: > drivers/scsi/iscsi_tcp.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c > index 1bc37593c88f..2ec1405d272d 100644 > --- a/drivers/scsi/iscsi_tcp.c > +++ b/drivers/scsi/iscsi_tcp.c > @@ -724,6 +724,8 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn, > break; > case ISCSI_PARAM_DATADGST_EN: > iscsi_set_param(cls_conn, param, buf, buflen); > + if (!tcp_sw_conn || !tcp_sw_conn->sock) > + return -ENOTCONN; > tcp_sw_conn->sendpage = conn->datadgst_en ? > sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; > break; >
Hi,
Thanks for the patch. This was supposed to be fixed in:
commit 9e67600ed6b8565da4b85698ec659b5879a6c1c6 Author: Gulam Mohamed <gulam.mohamed@oracle.com> Date: Thu Mar 25 09:32:48 2021 +0000
scsi: iscsi: Fix race condition between login and sync thread
because it was not supposed to allow set_param to be called on an unbound connection. However, it looks like there was a mistake in the patch:
err = transport->set_param(conn, ev->u.set_param.param, data, ev->u.set_param.len); + if ((conn->state == ISCSI_CONN_BOUND) || + (conn->state == ISCSI_CONN_UP)) { + err = transport->set_param(conn, ev->u.set_param.param, + data, ev->u.set_param.len); + } else { + return -ENOTCONN; + }
and that first set_param call was supposed to be deleted and replaced with the one that was added in the conn->state check.
We should just need a patch to remove that first set_param call.
| |