IB/ipath: Check reserved memory keys
Don't let userspace use the direct-physical-map L_key or R_key. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
f0810daf74
commit
253fb39020
@ -133,6 +133,12 @@ int ipath_lkey_ok(struct ipath_qp *qp, struct ipath_sge *isge,
|
|||||||
* being reversible by calling bus_to_virt().
|
* being reversible by calling bus_to_virt().
|
||||||
*/
|
*/
|
||||||
if (sge->lkey == 0) {
|
if (sge->lkey == 0) {
|
||||||
|
struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
|
||||||
|
|
||||||
|
if (pd->user) {
|
||||||
|
ret = 0;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
isge->mr = NULL;
|
isge->mr = NULL;
|
||||||
isge->vaddr = (void *) sge->addr;
|
isge->vaddr = (void *) sge->addr;
|
||||||
isge->length = sge->length;
|
isge->length = sge->length;
|
||||||
@ -206,6 +212,12 @@ int ipath_rkey_ok(struct ipath_qp *qp, struct ipath_sge_state *ss,
|
|||||||
* (see ipath_get_dma_mr and ipath_dma.c).
|
* (see ipath_get_dma_mr and ipath_dma.c).
|
||||||
*/
|
*/
|
||||||
if (rkey == 0) {
|
if (rkey == 0) {
|
||||||
|
struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
|
||||||
|
|
||||||
|
if (pd->user) {
|
||||||
|
ret = 0;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
sge->mr = NULL;
|
sge->mr = NULL;
|
||||||
sge->vaddr = (void *) vaddr;
|
sge->vaddr = (void *) vaddr;
|
||||||
sge->length = len;
|
sge->length = len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user