summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2011-04-01 16:06:25 -0700
committerJames Bottomley <James.Bottomley@suse.de>2011-05-01 10:20:45 -0500
commita01a5a5789287113cd6bb25c79cf2a826874c918 (patch)
treef113104d04d3df77041c866942aa304319ec0d72 /drivers/scsi
parent69922fcd534cfc82e2d44374fa219e7c3b27c492 (diff)
downloadop-kernel-dev-a01a5a5789287113cd6bb25c79cf2a826874c918.zip
op-kernel-dev-a01a5a5789287113cd6bb25c79cf2a826874c918.tar.gz
[SCSI] libfcoe: fix possible buffer overflow in fcoe_transport_show
possible buffer overflow in fcoe_transport_show when reaching the end of buffer and crossing PAGE_SIZE boundary. Signed-off-by: Yi Zou <yi.zou@intel.com> Signed-off-by: Tomas Henzl <thenzl@redhat.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/fcoe/fcoe_transport.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index ec0f395..538f299 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -385,9 +385,9 @@ static int fcoe_transport_show(char *buffer, const struct kernel_param *kp)
i = j = sprintf(buffer, "Attached FCoE transports:");
mutex_lock(&ft_mutex);
list_for_each_entry(ft, &fcoe_transports, list) {
- i += snprintf(&buffer[i], IFNAMSIZ, "%s ", ft->name);
- if (i >= PAGE_SIZE)
+ if (i >= PAGE_SIZE - IFNAMSIZ)
break;
+ i += snprintf(&buffer[i], IFNAMSIZ, "%s ", ft->name);
}
mutex_unlock(&ft_mutex);
if (i == j)
OpenPOWER on IntegriCloud