public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, Martin George <marting@netapp.com>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH] [SCSI] scsi_dh_alua: fix overflow in alua_rtpg port group id check
Date: Tue, 18 Jan 2011 20:11:51 -0500	[thread overview]
Message-ID: <1295399511-10894-1-git-send-email-snitzer@redhat.com> (raw)

For Target Portal Group IDs occupying the full 2 bytes in the RTPG
response, the following group_id check in alua_rtpg() always fails
because 'ucp' is only a signed char:
   if (h->group_id == (ucp[2] << 8) + ucp[3]) {

Fix this signed char overflow by changing 'ucp' to an unsigned char
pointer (same type used for 'buff' member of alua_dh_data structure).

Reported-by: Martin George <marting@netapp.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/scsi/device_handler/scsi_dh_alua.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 6b72932..536df91 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -545,7 +545,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
 {
 	struct scsi_sense_hdr sense_hdr;
 	int len, k, off, valid_states = 0;
-	char *ucp;
+	unsigned char *ucp;
 	unsigned err;
 	unsigned long expiry, interval = 10;
 
-- 
1.7.3.4


             reply	other threads:[~2011-01-19  1:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19  1:11 Mike Snitzer [this message]
2011-01-20  7:24 ` [PATCH] [SCSI] scsi_dh_alua: fix overflow in alua_rtpg port group id check Hannes Reinecke

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=1295399511-10894-1-git-send-email-snitzer@redhat.com \
    --to=snitzer@redhat.com \
    --cc=James.Bottomley@suse.de \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marting@netapp.com \
    /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