Potential NULL pointer dereference in drivers/infiniband/core
A message that is not in the archive (sent off-list or not yet received): [email protected]
Steve,
Can you look at the iWarp code flow described below?
Quoted 7 lines
My name is Shaobo He and I am a graduate student at University of Utah. I am applying a static analysis tool to the Linux device drivers and got an error trace of null pointer dereference in
drivers/infiniband/corestarting from functionucma_accept: it callsrdma_acceptwith the second argument being NULL. Inrdma_accept,cma_accept_iwis called with the second argument also being NULL. Then incma_accept_iw,cma_modify_qp_rtrcan return 0 if `id_priv-
Quoted 5 lines
Quoted 1 line
id.qp` is NULL, which can be suggested by an if statement in
rdma_accept. Finally, the second argumentconn_paramofcma_accept_iwgets dereferenced. As you can see, the error trace is only plausible since it depends on certain conditions. Therefore, I was wondering if you could confirm it.
Based on a quick look, this looks like it's at least a problem in how conn_param is verified. IB allows conn_param to be optional, whereas iWarp requires it. Since this is coming from user space, we can crash.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373AB0E99BB-P5GAC/[email protected]
Quoted 4 lines
Steve,
Can you look at the iWarp code flow described below?
sure:
Quoted 8 lines
Quoted 8 lines
My name is Shaobo He and I am a graduate student at University of Utah. I am applying a static analysis tool to the Linux device drivers and got an error trace of null pointer dereference in
drivers/infiniband/corestarting from functionucma_accept: it callsrdma_acceptwith the second argument being NULL. Inrdma_accept,cma_accept_iwis called with the second argument also being NULL. Then incma_accept_iw,cma_modify_qp_rtrcan return 0 if `id_priv-
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
id.qp` is NULL, which can be suggested by an if statement in
rdma_accept. Finally, the second argumentconn_paramofcma_accept_iwgets dereferenced. As you can see, the error trace is only plausible since it depends on certain conditions. Therefore, I was wondering if you could confirm it.Based on a quick look, this looks like it's at least a problem in how
conn_param is
Quoted 1 line
verified. IB allows
conn_paramto be optional, whereas iWarp requires it.
Since
Quoted 2 lines
this is coming from user space, we can crash.
Agreed. cma_accept_iw() needs to either fail the accept for a NULL conn_param, or generate values for the iw_param struct if conn_param is NULL. I suggest the former. Something like:
drivers/infiniband/core/cma.c +3 -0
@@ -3583,6 +3583,9 @@ static int cma_accept_iw(struct rdma_id_private *id_priv,struct iw_cm_conn_param iw_param;int ret; +if (!conn_param) +return -EINVAL ; + ret =cma_modify_qp_rtr (id_priv, conn_param);if (ret)return ret;
---
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines
drivers/infiniband/core/cma.c +3
-0@@ -3583,6 +3583,9 @@ static int cma_accept_iw(struct rdma_id_private *id_priv, struct iw_cm_conn_param iw_param;int ret; +if (!conn_param) +return -EINVAL ; + ret =cma_modify_qp_rtr (id_priv, conn_param);if (ret)
Quoted 1 line
return ret;
Can you re-submit as a formal patch? Feel free to include Acked-by: Sean Hefty <[email protected]>
This should go into stable. Thanks! And thanks Shaobo!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373AB0E99ED-P5GAC/[email protected]
Quoted 2 lines
Can you re-submit as a formal patch? Feel free to include Acked-by: Sean
Hefty
Quoted 3 lines
This should go into stable. Thanks! And thanks Shaobo!
Will do.
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html