Skip to contentSkip to conversation

scsi: lpfc: fix potential buffer overflow.

PATCH Applied Maurizio Lombardi 4 participants 4 messages Apr 18, 2017 – Apr 19, 2017

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

PATCH 1/1 scsi: lpfc: fix potential buffer overflow.

This patch fixes a potential buffer overflow in lpfc_nvme_info_show().

---
 drivers/scsi/lpfc/lpfc_attr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +2 -2
index 22819af..1ce252f 100644
@@ -181,7 +181,7 @@
 				wwn_to_u64(vport->fc_nodename.u.wwn),
 				phba->targetport->port_id);
 
-		len += snprintf(buf + len, PAGE_SIZE,
+		len += snprintf(buf + len, PAGE_SIZE - len,
 				"\nNVME Target: Statistics\n");
 		tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
 		len += snprintf(buf+len, PAGE_SIZE-len,
@@ -326,7 +326,7 @@
 	}
 	spin_unlock_irq(shost->host_lock);
 
-	len += snprintf(buf + len, PAGE_SIZE, "\nNVME Statistics\n");
+	len += snprintf(buf + len, PAGE_SIZE - len, "\nNVME Statistics\n");
 	len += snprintf(buf+len, PAGE_SIZE-len,
 			"LS: Xmt %016llx Cmpl %016llx\n",
 			phba->fc4NvmeLsRequests,
Signature · 1 line
Maurizio Lombardi
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Maurizio Lombardi

This patch fixes a potential buffer overflow in lpfc_nvme_info_show().

---
 drivers/scsi/lpfc/lpfc_attr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +1 -1
index 22819af..1ce252f 100644
@@ -181,7 +181,7 @@
 				wwn_to_u64(vport->fc_nodename.u.wwn),
 				phba->targetport->port_id);
 
-		len += snprintf(buf + len, PAGE_SIZE,
+		len += snprintf(buf + len, PAGE_SIZE - len,
 				"\nNVME Target: Statistics\n");
 		tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
 		len += snprintf(buf+len, PAGE_SIZE-len,

drivers/scsi/lpfc/lpfc_attr.c line 332

Quoted 8 lines
drivers/scsi/lpfc/lpfc_attr.c +1 -1
@@ -326,7 +326,7 @@
 	}
 	spin_unlock_irq(shost->host_lock);
 
-	len += snprintf(buf + len, PAGE_SIZE, "\nNVME Statistics\n");
+	len += snprintf(buf + len, PAGE_SIZE - len, "\nNVME Statistics\n");
 	len += snprintf(buf+len, PAGE_SIZE-len,
 			"LS: Xmt %016llx Cmpl %016llx\n",
 			phba->fc4NvmeLsRequests,
#3 lore raw
In reply to Maurizio Lombardi
Quoted 1 line · Maurizio Lombardi

This patch fixes a potential buffer overflow in lpfc_nvme_info_show().

Applied to 4.12/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering