Skip to contentSkip to conversation

hpsa: A few more miscellaneous patches for Jan. 2011

PATCH New Stephen M. Cameron 1 participant 4 messages Jan 7, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover hpsa: A few more miscellaneous patches for Jan. 2011

The following series contains a few old fixes that I somehow failed to send along previously.

---

Stephen M. Cameron (2):
hpsa: fix use of uninitialized variable in hpsa_add_msa2xxx_enclosure_device()
hpsa: Fix problem that CMD_UNABORTABLE command status was treated as unknown

Vasiliy Kulikov (1):
hpsa: avoid leaking stack contents to userland

 drivers/scsi/hpsa.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
-- steve
#1 lore raw

PATCH 1/3 hpsa: fix use of uninitialized variable in hpsa_add_msa2xxx_enclosure_device()

From: Stephen M. Cameron <[email protected]>

hpsa: fix use of uninitialized variable in hpsa_add_msa2xxx_enclosure_device()

Thanks to Scott Teel for noticing this.

---
 drivers/scsi/hpsa.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/hpsa.c +2 -2
index c255f46..c6c13b0 100644
@@ -1617,6 +1617,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
 	if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */
 		return 0;
 
+	memset(scsi3addr, 0, 8);
+	scsi3addr[3] = target;
 	if (is_hba_lunid(scsi3addr))
 		return 0; /* Don't add the RAID controller here. */
 
@@ -1631,8 +1633,6 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
 		return 0;
 	}
 
-	memset(scsi3addr, 0, 8);
-	scsi3addr[3] = target;
 	if (hpsa_update_device_info(h, scsi3addr, this_device))
 		return 0;
 	(*nmsa2xxx_enclosures)++;
#2 lore raw

PATCH 2/3 hpsa: Fix problem that CMD_UNABORTABLE command status was treated as unknown

In reply to Stephen M. Cameron

From: Stephen M. Cameron <StephenM.Cameron>

---
 drivers/scsi/hpsa.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +7 -0
index c6c13b0..5828bcb 100644
@@ -1152,6 +1152,10 @@ static void complete_scsi_command(struct CommandList *cp,
 		cmd->result = DID_TIME_OUT << 16;
 		dev_warn(&h->pdev->dev, "cp %p timedout\n", cp);
 		break;
+	case CMD_UNABORTABLE:
+		cmd->result = DID_ERROR << 16;
+		dev_warn(&h->pdev->dev, "Command unabortable\n");
+		break;
 	default:
 		cmd->result = DID_ERROR << 16;
 		dev_warn(&h->pdev->dev, "cp %p returned unknown status %x\n",
@@ -1317,6 +1321,9 @@ static void hpsa_scsi_interpret_error(struct CommandList *cp)
 	case CMD_TIMEOUT:
 		dev_warn(d, "cp %p timed out\n", cp);
 		break;
+	case CMD_UNABORTABLE:
+		dev_warn(d, "Command unabortable\n");
+		break;
 	default:
 		dev_warn(d, "cp %p returned unknown status %x\n", cp,
 				ei->CommandStatus);
#3 lore raw

PATCH 3/3 hpsa: avoid leaking stack contents to userland

In reply to Stephen M. Cameron

From: Vasiliy Kulikov <[email protected]>

memset arg64 to zero in the passthrough ioctls to avoid leaking contents of kernel stack memory to userland via uninitialized padding fields inserted by the compiler for alignment reasons.

---
 drivers/scsi/hpsa.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +2 -0
index 5828bcb..959eeb2 100644
@@ -2310,6 +2310,7 @@ static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg)
 	int err;
 	u32 cp;
 
+	memset(&arg64, 0, sizeof(arg64));
 	err = 0;
 	err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
 			   sizeof(arg64.LUN_info));
@@ -2346,6 +2347,7 @@ static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
 	int err;
 	u32 cp;
 
+	memset(&arg64, 0, sizeof(arg64));
 	err = 0;
 	err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
 			   sizeof(arg64.LUN_info));