public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/4] IB/isert: properly type the login buffer
Date: Tue, 16 Feb 2016 19:19:19 +0200	[thread overview]
Message-ID: <56C35A17.6050305@mellanox.com> (raw)
In-Reply-To: <1455567060-18381-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

Hi Christoph,
I have noticed that we are allocating login_req_buf sized 
ISCSI_DEF_MAX_RECV_SEG_LEN but the sge.lenth we post_recv is 
ISER_RX_LOGIN_SIZE, thus the rx_buflen in the recv completion is also 
ISER_RX_LOGIN_SIZE in case we are in login stage.
I think we might crash here in case the initiator send request bigger 
than ISCSI_DEF_MAX_RECV_SEG_LEN, won't we ?


>   static int
> @@ -609,50 +611,48 @@ isert_alloc_login_buf(struct isert_conn *isert_conn,
>   {
>   	int ret;
>
> -	isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN +
> -					ISER_RX_LOGIN_SIZE, GFP_KERNEL);
> -	if (!isert_conn->login_buf) {
> -		isert_err("Unable to allocate isert_conn->login_buf\n");
> +	isert_conn->login_req_buf =
> +		kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN, GFP_KERNEL);
> +	if (!isert_conn->login_req_buf) {
> +		isert_err("Unable to allocate isert_conn->login_req_buf\n");
>   		return -ENOMEM;
>   	}
>
> -	isert_conn->login_req_buf = isert_conn->login_buf;
> -	isert_conn->login_rsp_buf = isert_conn->login_buf +
> -				    ISCSI_DEF_MAX_RECV_SEG_LEN;
> -
> -	isert_dbg("Set login_buf: %p login_req_buf: %p login_rsp_buf: %p\n",
> -		 isert_conn->login_buf, isert_conn->login_req_buf,
> -		 isert_conn->login_rsp_buf);
> -
>   	isert_conn->login_req_dma = ib_dma_map_single(ib_dev,
> -				(void *)isert_conn->login_req_buf,
> +				isert_conn->login_req_buf,
>   				ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_FROM_DEVICE);
> -
>



>
> -	if ((char *)desc == isert_conn->login_req_buf) {
> +	if (desc == isert_conn->login_req_buf) {
>   		rx_dma = isert_conn->login_req_dma;
>   		rx_buflen = ISER_RX_LOGIN_SIZE;
>   		isert_dbg("login_buf: Using rx_dma: 0x%llx, rx_buflen: %d\n",
> @@ -1615,7 +1615,7 @@ isert_rcv_completion(struct iser_rx_desc *desc,
>   		 hdr->opcode, hdr->itt, hdr->flags,
>   		 (int)(xfer_len - ISER_HEADERS_LEN));
>


Max.

--
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

  parent reply	other threads:[~2016-02-16 17:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 20:10 isert: convert to the new CQ API and a few random cleanups Christoph Hellwig
2016-02-15 20:10 ` [PATCH 1/4] IB/isert: properly type the login buffer Christoph Hellwig
     [not found]   ` <1455567060-18381-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-16  4:40     ` Leon Romanovsky
     [not found]       ` <20160216044058.GA27580-2ukJVAZIZ/Y@public.gmane.org>
2016-02-17 10:29         ` Christoph Hellwig
2016-02-16 17:19     ` Max Gurtovoy [this message]
2016-02-17 10:33       ` Christoph Hellwig
2016-02-16  6:47   ` Or Gerlitz
2016-02-15 20:10 ` [PATCH 2/4] IB/isert: convert to new CQ API Christoph Hellwig
2016-02-16 18:04   ` Max Gurtovoy
2016-02-17 14:18     ` Christoph Hellwig
2016-02-18 12:32       ` Max Gurtovoy
     [not found] ` <1455567060-18381-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-15 20:10   ` [PATCH 3/4] IB/isert: kill struct isert_rdma_wr Christoph Hellwig
     [not found]     ` <1455567060-18381-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-02-17  9:03       ` Max Gurtovoy
2016-02-15 20:11   ` [PATCH 4/4] IB/isert: the kill ->isert_cmd back pointer in the struct iser_tx_desc Christoph Hellwig
2016-02-17  9:31     ` Max Gurtovoy
2016-02-17 14:19       ` Christoph Hellwig
2016-02-16 10:53 ` isert: convert to the new CQ API and a few random cleanups Sagi Grimberg

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=56C35A17.6050305@mellanox.com \
    --to=maxg-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=target-devel-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