From: Leon Romanovsky <leon@kernel.org>
To: Bernard Metzler <bmt@zurich.ibm.com>
Cc: linux-rdma@vger.kernel.org, yi.zhang@redhat.com,
kamalheib1@gmail.com, linux-nvme@lists.infradead.org,
jgg@nvidia.com
Subject: Re: [PATCH] RDMA/siw: Fix handling of zero-sized Read and Receive Queues.
Date: Wed, 16 Dec 2020 07:33:20 +0200 [thread overview]
Message-ID: <20201216053320.GO5005@unreal> (raw)
In-Reply-To: <20201215122306.3886-1-bmt@zurich.ibm.com>
On Tue, Dec 15, 2020 at 01:23:06PM +0100, Bernard Metzler wrote:
> During connection setup, the application may choose to zero-size
> inbound and outbound READ queues, as well as the Receive queue.
> This patch fixes handling of zero-sized queues.
>
> Reported-by: Kamal Heib <kamalheib1@gmail.com>
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
> drivers/infiniband/sw/siw/siw.h | 2 +-
> drivers/infiniband/sw/siw/siw_qp.c | 54 ++++++++++++++++-----------
> drivers/infiniband/sw/siw/siw_qp_rx.c | 26 +++++++++----
> drivers/infiniband/sw/siw/siw_qp_tx.c | 4 +-
> drivers/infiniband/sw/siw/siw_verbs.c | 18 +++++++--
> 5 files changed, 68 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
> index e9753831ac3f..6f17392f975a 100644
> --- a/drivers/infiniband/sw/siw/siw.h
> +++ b/drivers/infiniband/sw/siw/siw.h
> @@ -654,7 +654,7 @@ static inline struct siw_sqe *orq_get_free(struct siw_qp *qp)
> {
> struct siw_sqe *orq_e = orq_get_tail(qp);
>
> - if (orq_e && READ_ONCE(orq_e->flags) == 0)
> + if (READ_ONCE(orq_e->flags) == 0)
> return orq_e;
>
> return NULL;
> diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
> index 875d36d4b1c6..b686a09a75ae 100644
> --- a/drivers/infiniband/sw/siw/siw_qp.c
> +++ b/drivers/infiniband/sw/siw/siw_qp.c
> @@ -199,26 +199,28 @@ void siw_qp_llp_write_space(struct sock *sk)
>
> static int siw_qp_readq_init(struct siw_qp *qp, int irq_size, int orq_size)
> {
> - irq_size = roundup_pow_of_two(irq_size);
> - orq_size = roundup_pow_of_two(orq_size);
> -
> - qp->attrs.irq_size = irq_size;
> - qp->attrs.orq_size = orq_size;
> -
> - qp->irq = vzalloc(irq_size * sizeof(struct siw_sqe));
> - if (!qp->irq) {
> - siw_dbg_qp(qp, "irq malloc for %d failed\n", irq_size);
> - qp->attrs.irq_size = 0;
> - return -ENOMEM;
> + if (irq_size) {
> + irq_size = roundup_pow_of_two(irq_size);
> + qp->irq = vzalloc(irq_size * sizeof(struct siw_sqe));
> + if (!qp->irq) {
> + siw_dbg_qp(qp, "irq malloc for %d failed\n", irq_size);
Please don't copy prints after kernel allocators. You won't miss failure
in allocations.
Thanks
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-12-16 5:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-15 12:23 [PATCH] RDMA/siw: Fix handling of zero-sized Read and Receive Queues Bernard Metzler
2020-12-15 15:33 ` kernel test robot
2020-12-15 17:47 ` Jason Gunthorpe
2020-12-15 19:35 ` Bernard Metzler
2020-12-16 5:33 ` Leon Romanovsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-12-15 12:16 Bernard Metzler
2020-12-15 12:22 ` Bernard Metzler
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=20201216053320.GO5005@unreal \
--to=leon@kernel.org \
--cc=bmt@zurich.ibm.com \
--cc=jgg@nvidia.com \
--cc=kamalheib1@gmail.com \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-rdma@vger.kernel.org \
--cc=yi.zhang@redhat.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 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).