From: "Bryan O'Sullivan" <bos@pathscale.com>
To: rdreier@cisco.com
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH 2 of 10] ipath - don't modify QP if changes fail
Date: Tue, 23 May 2006 11:32:30 -0700 [thread overview]
Message-ID: <bb640dcf4d9dc18cf02e.1148409150@eng-12.pathscale.com> (raw)
In-Reply-To: <patchbomb.1148409148@eng-12.pathscale.com>
Make sure modify_qp won't modify the QP if any of the changes failed.
Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
diff -r bc968dacc860 -r bb640dcf4d9d drivers/infiniband/hw/ipath/ipath_qp.c
--- a/drivers/infiniband/hw/ipath/ipath_qp.c Tue May 23 11:29:15 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c Tue May 23 11:29:15 2006 -0700
@@ -427,6 +427,7 @@ int ipath_modify_qp(struct ib_qp *ibqp,
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
int attr_mask)
{
+ struct ipath_ibdev *dev = to_idev(ibqp->device);
struct ipath_qp *qp = to_iqp(ibqp);
enum ib_qp_state cur_state, new_state;
unsigned long flags;
@@ -443,6 +444,19 @@ int ipath_modify_qp(struct ib_qp *ibqp,
attr_mask))
goto inval;
+ if (attr_mask & IB_QP_AV)
+ if (attr->ah_attr.dlid == 0 ||
+ attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE)
+ goto inval;
+
+ if (attr_mask & IB_QP_PKEY_INDEX)
+ if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd))
+ goto inval;
+
+ if (attr_mask & IB_QP_MIN_RNR_TIMER)
+ if (attr->min_rnr_timer > 31)
+ goto inval;
+
switch (new_state) {
case IB_QPS_RESET:
ipath_reset_qp(qp);
@@ -457,13 +471,8 @@ int ipath_modify_qp(struct ib_qp *ibqp,
}
- if (attr_mask & IB_QP_PKEY_INDEX) {
- struct ipath_ibdev *dev = to_idev(ibqp->device);
-
- if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd))
- goto inval;
+ if (attr_mask & IB_QP_PKEY_INDEX)
qp->s_pkey_index = attr->pkey_index;
- }
if (attr_mask & IB_QP_DEST_QPN)
qp->remote_qpn = attr->dest_qp_num;
@@ -479,12 +488,8 @@ int ipath_modify_qp(struct ib_qp *ibqp,
if (attr_mask & IB_QP_ACCESS_FLAGS)
qp->qp_access_flags = attr->qp_access_flags;
- if (attr_mask & IB_QP_AV) {
- if (attr->ah_attr.dlid == 0 ||
- attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE)
- goto inval;
+ if (attr_mask & IB_QP_AV)
qp->remote_ah_attr = attr->ah_attr;
- }
if (attr_mask & IB_QP_PATH_MTU)
qp->path_mtu = attr->path_mtu;
@@ -499,11 +504,8 @@ int ipath_modify_qp(struct ib_qp *ibqp,
qp->s_rnr_retry_cnt = qp->s_rnr_retry;
}
- if (attr_mask & IB_QP_MIN_RNR_TIMER) {
- if (attr->min_rnr_timer > 31)
- goto inval;
+ if (attr_mask & IB_QP_MIN_RNR_TIMER)
qp->s_min_rnr_timer = attr->min_rnr_timer;
- }
if (attr_mask & IB_QP_QKEY)
qp->qkey = attr->qkey;
next prev parent reply other threads:[~2006-05-23 18:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-23 18:32 [PATCH 0 of 10] ipath patches for 2.6.17 Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 1 of 10] ipath - fix spinlock recursion bug Bryan O'Sullivan
2006-05-23 21:09 ` Roland Dreier
2006-05-23 21:26 ` Bryan O'Sullivan
2006-05-23 21:31 ` Roland Dreier
2006-05-24 14:45 ` Bryan O'Sullivan
2006-05-23 18:32 ` Bryan O'Sullivan [this message]
2006-05-23 18:32 ` [PATCH 3 of 10] ipath - fix reporting of driver version to userspace Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 4 of 10] ipath - replace uses of LIST_POISON Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 5 of 10] ipath - fix NULL dereference during cleanup Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 6 of 10] ipath - enable GPIO interrupt on HT-460 Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 7 of 10] ipath - enable PE800 receive interrupts on user ports Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 8 of 10] ipath - register as IB device owner Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 9 of 10] ipath - fix null deref during rdma ops Bryan O'Sullivan
2006-05-23 18:32 ` [PATCH 10 of 10] ipath - deref correct pointer when using kernel SMA Bryan O'Sullivan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb640dcf4d9dc18cf02e.1148409150@eng-12.pathscale.com \
--to=bos@pathscale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=rdreier@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.