- patches.apparmor/remove_suid_new_case_in_2.6.22.diff: Merge fix.
[linux-flexiantxendom0-3.2.10.git] / drivers / infiniband / hw / ipath / ipath_ud.c
index 9a3e546..a518f7c 100644 (file)
@@ -308,6 +308,11 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
                goto bail;
        }
 
+       if (wr->wr.ud.ah->pd != qp->ibqp.pd) {
+               ret = -EPERM;
+               goto bail;
+       }
+
        /* IB spec says that num_sge == 0 is OK. */
        if (wr->num_sge > qp->s_max_sge) {
                ret = -EINVAL;
@@ -467,7 +472,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
 
 done:
        /* Queue the completion status entry. */
-       if (!test_bit(IPATH_S_SIGNAL_REQ_WR, &qp->s_flags) ||
+       if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) ||
            (wr->send_flags & IB_SEND_SIGNALED)) {
                wc.wr_id = wr->wr_id;
                wc.status = IB_WC_SUCCESS;
@@ -647,6 +652,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
                ipath_skip_sge(&qp->r_sge, sizeof(struct ib_grh));
        ipath_copy_sge(&qp->r_sge, data,
                       wc.byte_len - sizeof(struct ib_grh));
+       qp->r_wrid_valid = 0;
        wc.wr_id = qp->r_wr_id;
        wc.status = IB_WC_SUCCESS;
        wc.opcode = IB_WC_RECV;