linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: michaelc@cs.wisc.edu
To: linux-kernel@vger.kernel.org
Cc: Mike Christie <michaelc@cs.wisc.edu>,
	Shyam Kumar Iyer <shyam_iyer@dell.com>,
	Konrad Rzeszutek <konrad@virtualiron.com>
Subject: [PATCH 1/1] ibft: fix target info parsing in ibft module
Date: Mon, 18 Aug 2008 12:58:48 -0500	[thread overview]
Message-ID: <1219082328-11010-1-git-send-email-michaelc@cs.wisc.edu> (raw)

From: Mike Christie <michaelc@cs.wisc.edu>

I got this patch through Red Hat's bugzilla from the bug
submitter and patch creator. I have just fixed it up so it applies without
fuzz to upstream kernels.

Original patch and description from Shyam kumar Iyer:

The issue [ibft module not displaying targets with short names]
is because of an offset calculatation error in the iscsi_ibft.c
code.  Due to this error directory structure for the target
in /sys/firmware/ibft does not get created and so the initiator is unable to
connect to the target.

Note that this bug surfaced only with an name that had a short section at the
end.
eg: "iqn.1984-05.com.dell:dell".
It did not surface when the iqn's had a longer section at the end.
eg: "iqn.2001-04.com.example:storage.disk2.sys1.xyz"

So, the eot_offset was calculated such that an extra 48 bytes i.e. the size of
the ibft_header which has already been accounted was subtracted twice.

This was not evident with longer iqn names because they would overshoot the
total ibft length more than 48 bytes and thus would escape the bug.

Signed-off-by: Shyam Kumar Iyer <shyam_iyer@dell.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Konrad Rzeszutek <konrad@virtualiron.com>


---
 drivers/firmware/iscsi_ibft.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 8024e3b..b91ef63 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -669,8 +669,7 @@ static int __init ibft_register_kobjects(struct ibft_table_header *header,
 
 	control = (void *)header + sizeof(*header);
 	end = (void *)control + control->hdr.length;
-	eot_offset = (void *)header + header->length -
-		     (void *)control - sizeof(*header);
+	eot_offset = (void *)header + header->length - (void *)control;
 	rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control,
 			     sizeof(*control));
 
-- 
1.5.4.1


                 reply	other threads:[~2008-08-18 17:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1219082328-11010-1-git-send-email-michaelc@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=konrad@virtualiron.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shyam_iyer@dell.com \
    --subject='Re: [PATCH 1/1] ibft: fix target info parsing in ibft module' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox