From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: scsi <linux-scsi@vger.kernel.org>,
target-devel <target-devel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const void *
Date: Fri, 03 May 2013 17:16:45 -0700 [thread overview]
Message-ID: <1367626605.21785.10.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <CAMuHMdUOXbPkJf0Y1hupmmeotO6teFL1xJubRY0nBsTVu7=hBw@mail.gmail.com>
On Fri, 2013-05-03 at 23:22 +0200, Geert Uytterhoeven wrote:
> On Fri, May 3, 2013 at 11:15 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > --- a/drivers/target/iscsi/iscsi_target.c
> > +++ b/drivers/target/iscsi/iscsi_target.c
>
> > @@ -3585,9 +3575,8 @@ static int iscsit_send_reject(
> > }
> >
> > if (conn->conn_ops->DataDigest) {
> > - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> > - (unsigned char *)cmd->buf_ptr, ISCSI_HDR_LEN,
> > - 0, NULL, (u8 *)&cmd->data_crc);
> > + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->buf_ptr,
> > + ISCSI_HDR_LEN, 0, NULL, (u8 *)&cmd->data_crc);
>
> BTW, there are serious issues with casting pointers to u32s to pointers to u8s
> for the last two output parameters of iscsit_do_crypto_hash_buf() (pad_bytes
> and data_crc):
> 1. It's not endian-safe,
> 2. In many cases, the original u32 was not initialized at all, so the other 24
> bits contain garbage. This will cause 32-bit comparisons like
>
> if (checksum != data_crc)
>
> to fail in unpredictable ways.
>
Ugh, I can see how that would be problematic for BE..
Changing these to use u8 data_crc[ISCSI_DIGEST_SIZE] and
pad_bytes[ISCSI_PAD_LEN] now, and will post a patch soon.
Thanks again,
--nab
next prev parent reply other threads:[~2013-05-04 0:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 21:15 Geert Uytterhoeven
2013-05-03 21:22 ` Geert Uytterhoeven
2013-05-04 0:16 ` Nicholas A. Bellinger [this message]
2013-05-05 9:35 ` Geert Uytterhoeven
2013-05-03 23:54 ` Nicholas A. Bellinger
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=1367626605.21785.10.camel@haakon3.risingtidesystems.com \
--to=nab@linux-iscsi.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.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®