From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: target-devel <target-devel@vger.kernel.org>,
linux-rdma <linux-rdma@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Roland Dreier <roland@kernel.org>,
Or Gerlitz <ogerlitz@mellanox.com>,
Alexander Nezhinsky <alexandern@mellanox.com>
Subject: Re: [RFC-v4 7/9] iscsi-target: Refactor TX queue logic + export response PDU creation
Date: Fri, 03 May 2013 16:40:56 -0700 [thread overview]
Message-ID: <1367624456.21785.2.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <CAMuHMdWVpF9G2v5oSYL642mpWdQCMGBhSQYa=Zw0s9DyoNJLjQ@mail.gmail.com>
On Fri, 2013-05-03 at 23:04 +0200, Geert Uytterhoeven wrote:
> Hi Nicholas,
>
> On Fri, Apr 12, 2013 at 10:52 PM, Nicholas A. Bellinger
> <nab@linux-iscsi.org> wrote:
> > --- a/drivers/target/iscsi/iscsi_target.c
> > +++ b/drivers/target/iscsi/iscsi_target.c
>
> > static int iscsit_send_reject(
> > struct iscsi_cmd *cmd,
> > struct iscsi_conn *conn)
> > @@ -3505,18 +3548,9 @@ static int iscsit_send_reject(
> > struct iscsi_reject *hdr;
> > struct kvec *iov;
> >
> > - hdr = (struct iscsi_reject *) cmd->pdu;
>
> Woops, and now hdr is no longer initialized:
>
> drivers/target/iscsi/iscsi_target.c: In function ‘iscsit_send_reject’:
> drivers/target/iscsi/iscsi_target.c:3577: warning: ‘hdr’ is used
> uninitialized in this function
>
> > - hdr->opcode = ISCSI_OP_REJECT;
> > - hdr->flags |= ISCSI_FLAG_CMD_FINAL;
> > - hton24(hdr->dlength, ISCSI_HDR_LEN);
> > - hdr->ffffffff = cpu_to_be32(0xffffffff);
> > - cmd->stat_sn = conn->stat_sn++;
> > - hdr->statsn = cpu_to_be32(cmd->stat_sn);
> > - hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn);
> > - hdr->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn);
> > + iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]);
>
> Hence it will crash later:
>
> iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> (unsigned char *)hdr, ISCSI_HDR_LEN,
> 0, NULL, (u8 *)header_digest);
>
> and
>
> pr_debug("Built Reject PDU StatSN: 0x%08x, Reason: 0x%02x,"
> " CID: %hu\n", ntohl(hdr->statsn), hdr->reason, conn->cid);
>
Whoops. Applying the following patch to fix this up now, and including
in the next PULL request.
Thanks alot for catching this!
--nab
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index ffbc6a9..c230eac 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3557,11 +3557,11 @@ static int iscsit_send_reject(
struct iscsi_cmd *cmd,
struct iscsi_conn *conn)
{
- u32 iov_count = 0, tx_size = 0;
- struct iscsi_reject *hdr;
+ struct iscsi_reject *hdr = (struct iscsi_reject *)&cmd->pdu[0];
struct kvec *iov;
+ u32 iov_count = 0, tx_size;
- iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]);
+ iscsit_build_reject(cmd, conn, hdr);
iov = &cmd->iov_misc[0];
iov[iov_count].iov_base = cmd->pdu;
next prev parent reply other threads:[~2013-05-03 23:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-12 20:52 [RFC-v4 0/9] Add support for iSCSI Extensions for RDMA (ISER) target mode Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 1/9] target: Add export of target_get_sess_cmd symbol Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 2/9] iscsi-target: Add iscsit_transport API template Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 3/9] iscsi-target: Initial traditional TCP conversion to iscsit_transport Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 4/9] iscsi-target: Add iser-target parameter keys + setup during login Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 5/9] iscsi-target: Add per transport iscsi_cmd alloc/free Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 6/9] iscsi-target: Refactor RX PDU logic + export request PDU handling Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 7/9] iscsi-target: Refactor TX queue logic + export response PDU creation Nicholas A. Bellinger
2013-05-03 21:04 ` Geert Uytterhoeven
2013-05-03 23:40 ` Nicholas A. Bellinger [this message]
2013-04-12 20:52 ` [RFC-v4 8/9] iscsi-target: Add iser network portal attribute Nicholas A. Bellinger
2013-04-12 20:52 ` [RFC-v4 9/9] iser-target: Add iSCSI Extensions for RDMA (iSER) target driver Nicholas A. Bellinger
2013-04-21 14:13 ` Or Gerlitz
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=1367624456.21785.2.camel@haakon3.risingtidesystems.com \
--to=nab@linux-iscsi.org \
--cc=alexandern@mellanox.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=roland@kernel.org \
--cc=target-devel@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
all inboxes | Powered by JetHome®