Skip to contentSkip to conversation

scsi_dh_alua: fix overflow in alua_rtpg port group id check

PATCH In review Mike Snitzer 2 participants 2 messages Jan 19, 2011 – Jan 20, 2011 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_dh_alua: fix overflow in alua_rtpg port group id check

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

---
 drivers/scsi/device_handler/scsi_dh_alua.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
index 6b72932..536df91 100644
@@ -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;
 
Signature · 1 line
1.7.3.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Mike Snitzer

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

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html