Message ID | 1501085686-12916-1-git-send-email-mustafa.ismail@intel.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On Wed, Jul 26, 2017 at 11:14:46AM -0500, Mustafa Ismail wrote: > The port number is only valid if IB_QP_PORT is set in the mask. > So only check port number if it is valid to prevent modify_qp > from failing due to an invalid port number. > > Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds") > Cc: <stable@vger.kernel.org> # v4.2-v4.9 > Cc: <security@kernel.org> > Cc: Doug Ledford <dledford@redhat.com> > Cc: Steve Wise <swise@opengridcomputing.com> > Cc: Mike Marciniszyn <mike.marciniszyn@intel.com> > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > > Upstream commit 5a7a88f1b488("Fix the check for port number") > Modified from upstream commit: helper function rdma_is_port_valid does not > exist in these kernel versions. Note, you sent this 3 times for some reason, why? Also, it was hard to figure out what to do with it, I think it was ment for me to apply to the 4.4 and 4.9-stable trees, right? If so, I've done that, if not, please let me know. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Subject: Re: [PATCH] RDMA/uverbs: Fix the check for port number > > On Wed, Jul 26, 2017 at 11:14:46AM -0500, Mustafa Ismail wrote: > > The port number is only valid if IB_QP_PORT is set in the mask. > > So only check port number if it is valid to prevent modify_qp from > > failing due to an invalid port number. > > > > Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds") > > Cc: <stable@vger.kernel.org> # v4.2-v4.9 > > Cc: <security@kernel.org> > > Cc: Doug Ledford <dledford@redhat.com> > > Cc: Steve Wise <swise@opengridcomputing.com> > > Cc: Mike Marciniszyn <mike.marciniszyn@intel.com> > > > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > > > > Upstream commit 5a7a88f1b488("Fix the check for port number") Modified > > from upstream commit: helper function rdma_is_port_valid does not > > exist in these kernel versions. > > Note, you sent this 3 times for some reason, why? > > Also, it was hard to figure out what to do with it, I think it was ment for me to apply > to the 4.4 and 4.9-stable trees, right? If so, I've done that, if not, please let me > know. > Hi Greg - Mustafa is on vacation. Yes. The patch is meant for 4.4 and 4.9 stable tree. Shiraz -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jul 26, 2017 at 11:14:46AM -0500, Mustafa Ismail wrote: > The port number is only valid if IB_QP_PORT is set in the mask. > So only check port number if it is valid to prevent modify_qp > from failing due to an invalid port number. > > Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds") > Cc: <stable@vger.kernel.org> # v4.2-v4.9 > Cc: <security@kernel.org> > Cc: Doug Ledford <dledford@redhat.com> > Cc: Steve Wise <swise@opengridcomputing.com> > Cc: Mike Marciniszyn <mike.marciniszyn@intel.com> > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > > Upstream commit 5a7a88f1b488("Fix the check for port number") > Modified from upstream commit: helper function rdma_is_port_valid does not > exist in these kernel versions. > --- > drivers/infiniband/core/uverbs_cmd.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c > index 01e3a37..d118ffe 100644 > --- a/drivers/infiniband/core/uverbs_cmd.c > +++ b/drivers/infiniband/core/uverbs_cmd.c > @@ -2342,8 +2342,9 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, > if (copy_from_user(&cmd, buf, sizeof cmd)) > return -EFAULT; > > - if (cmd.port_num < rdma_start_port(ib_dev) || > - cmd.port_num > rdma_end_port(ib_dev)) > + if ((cmd.attr_mask & IB_QP_PORT) && > + (cmd.port_num < rdma_start_port(ib_dev) || > + cmd.port_num > rdma_end_port(ib_dev))) Please use rdma_is_port_valid > return -EINVAL; > > INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Aug 07, 2017 at 02:03:08PM +0300, Yuval Shaia wrote: > On Wed, Jul 26, 2017 at 11:14:46AM -0500, Mustafa Ismail wrote: > > The port number is only valid if IB_QP_PORT is set in the mask. > > So only check port number if it is valid to prevent modify_qp > > from failing due to an invalid port number. > > > > Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds") > > Cc: <stable@vger.kernel.org> # v4.2-v4.9 > > Cc: <security@kernel.org> > > Cc: Doug Ledford <dledford@redhat.com> > > Cc: Steve Wise <swise@opengridcomputing.com> > > Cc: Mike Marciniszyn <mike.marciniszyn@intel.com> > > > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > > > > Upstream commit 5a7a88f1b488("Fix the check for port number") > > Modified from upstream commit: helper function rdma_is_port_valid does not > > exist in these kernel versions. > > --- > > drivers/infiniband/core/uverbs_cmd.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c > > index 01e3a37..d118ffe 100644 > > --- a/drivers/infiniband/core/uverbs_cmd.c > > +++ b/drivers/infiniband/core/uverbs_cmd.c > > @@ -2342,8 +2342,9 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, > > if (copy_from_user(&cmd, buf, sizeof cmd)) > > return -EFAULT; > > > > - if (cmd.port_num < rdma_start_port(ib_dev) || > > - cmd.port_num > rdma_end_port(ib_dev)) > > + if ((cmd.attr_mask & IB_QP_PORT) && > > + (cmd.port_num < rdma_start_port(ib_dev) || > > + cmd.port_num > rdma_end_port(ib_dev))) > > Please use rdma_is_port_valid Yuval, This patch is meant for Stable v4.2-v4.9 which does not have rdma_is_port_valid. The patch upstream is using rdma_is_port_valid. Here is a link to it: https://patchwork.kernel.org/patch/9841243/ Chien -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 01e3a37..d118ffe 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -2342,8 +2342,9 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - if (cmd.port_num < rdma_start_port(ib_dev) || - cmd.port_num > rdma_end_port(ib_dev)) + if ((cmd.attr_mask & IB_QP_PORT) && + (cmd.port_num < rdma_start_port(ib_dev) || + cmd.port_num > rdma_end_port(ib_dev))) return -EINVAL; INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
The port number is only valid if IB_QP_PORT is set in the mask. So only check port number if it is valid to prevent modify_qp from failing due to an invalid port number. Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds") Cc: <stable@vger.kernel.org> # v4.2-v4.9 Cc: <security@kernel.org> Cc: Doug Ledford <dledford@redhat.com> Cc: Steve Wise <swise@opengridcomputing.com> Cc: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Upstream commit 5a7a88f1b488("Fix the check for port number") Modified from upstream commit: helper function rdma_is_port_valid does not exist in these kernel versions. --- drivers/infiniband/core/uverbs_cmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)