Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: George Rurikov <grurikov@gmail.com>, Christoph Hellwig <hch@lst.de>
Cc: MrRurikov <grurikov@gmal.com>, Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Keith Busch <kbusch@kernel.org>,
	Israel Rukshin <israelr@mellanox.com>,
	Max Gurtovoy <maxg@mellanox.com>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	George Rurikov <g.ryurikov@securitycode.ru>
Subject: Re: [PATCH] nvme: rdma: Add check for queue in nvmet_rdma_cm_handler()
Date: Thu, 31 Oct 2024 11:41:08 -0600	[thread overview]
Message-ID: <780facb8-b308-4e11-a7e7-7c258545e9e1@kernel.dk> (raw)
In-Reply-To: <20241031173327.663-1-grurikov@gmail.com>

> diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
> index 1b6264fa5803..becebc95f349 100644
> --- a/drivers/nvme/target/rdma.c
> +++ b/drivers/nvme/target/rdma.c
> @@ -1770,8 +1770,10 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
>  		ret = nvmet_rdma_queue_connect(cm_id, event);
>  		break;
>  	case RDMA_CM_EVENT_ESTABLISHED:
> -		nvmet_rdma_queue_established(queue);
> -		break;
> +		if (!queue) {
> +			nvmet_rdma_queue_established(queue);
> +			break;
> +		}

This, and the other hunks, just look like nonsense. Why on earth verify
that the queue is NULL, then not use NULL after that. Let alone that
whatever you pass it into happily dereference it, and now you've also
got fallthrough errors all over the place.

This needs to go back to the drawing board. I'd worry a lot more about
bad code than "potentially malicious hardware", to be honest.

-- 
Jens Axboe

  reply	other threads:[~2024-10-31 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 17:33 [PATCH] nvme: rdma: Add check for queue in nvmet_rdma_cm_handler() George Rurikov
2024-10-31 17:41 ` Jens Axboe [this message]
2024-11-01 14:02 ` kernel test robot
2024-11-01 15:14 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-09-24 11:49 George Rurikov

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=780facb8-b308-4e11-a7e7-7c258545e9e1@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=g.ryurikov@securitycode.ru \
    --cc=grurikov@gmail.com \
    --cc=grurikov@gmal.com \
    --cc=hch@lst.de \
    --cc=israelr@mellanox.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.me \
    --cc=stable@vger.kernel.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