linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jim Foraker <foraker1-i2BcT+NCU+M@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Dennis Dalessandro
	<dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] IB/rdmavt: Only put mmap_info ref if it exists
Date: Wed, 2 Nov 2016 17:40:54 +0200	[thread overview]
Message-ID: <20161102154054.GG3617@leon.nu> (raw)
In-Reply-To: <1478033052-147252-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

On Tue, Nov 01, 2016 at 01:44:12PM -0700, Jim Foraker wrote:
> rvt_create_qp() creates qp->ip only when a qp creation request comes from
> userspace (udata is not NULL).  If we exceed the number of available
> queue pairs however, the error path always attempts to put a kref to this
> structure.  If the requestor is inside the kernel, this leads to a crash.

It will be great to have a crash report if you have one.

>
> We fix this by checking that qp->ip is not NULL before caling kref_put().
>

Please add Fixes line which refers to the commit you are fixing.
It will ensure automatic pickup to various stable trees.

Thanks

> Signed-off-by: Jim Foraker <foraker1-i2BcT+NCU+M@public.gmane.org>
> ---
>  drivers/infiniband/sw/rdmavt/qp.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
> index 6500c3b..0004e8b 100644
> --- a/drivers/infiniband/sw/rdmavt/qp.c
> +++ b/drivers/infiniband/sw/rdmavt/qp.c
> @@ -884,7 +884,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
>  	return ret;
>
>  bail_ip:
> -	kref_put(&qp->ip->ref, rvt_release_mmap_info);
> +	if (qp->ip)
> +		kref_put(&qp->ip->ref, rvt_release_mmap_info);
>
>  bail_qpn:
>  	free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-11-02 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 20:44 [PATCH] IB/rdmavt: Only put mmap_info ref if it exists Jim Foraker
     [not found] ` <1478033052-147252-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2016-11-02 15:17   ` Dalessandro, Dennis
2016-11-02 15:40   ` Leon Romanovsky [this message]
2016-11-04 17:33   ` Jonathan Toppins
     [not found]     ` <b67230ae-baf0-c932-4acd-b414a33c158f-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-12-01 13:29       ` Estrin, Alex
2016-12-14 16:51   ` Doug Ledford

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=20161102154054.GG3617@leon.nu \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=foraker1-i2BcT+NCU+M@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).