diff options
author | Yi Zou <yi.zou@intel.com> | 2011-04-01 19:06:25 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-05-01 11:20:45 -0400 |
commit | a01a5a5789287113cd6bb25c79cf2a826874c918 (patch) | |
tree | f113104d04d3df77041c866942aa304319ec0d72 /drivers/scsi/fcoe/fcoe_transport.c | |
parent | 69922fcd534cfc82e2d44374fa219e7c3b27c492 (diff) |
[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/fcoe/fcoe_transport.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe_transport.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index ec0f395263c5..538f29923ab4 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) | |||
385 | i = j = sprintf(buffer, "Attached FCoE transports:"); | 385 | i = j = sprintf(buffer, "Attached FCoE transports:"); |
386 | mutex_lock(&ft_mutex); | 386 | mutex_lock(&ft_mutex); |
387 | list_for_each_entry(ft, &fcoe_transports, list) { | 387 | list_for_each_entry(ft, &fcoe_transports, list) { |
388 | i += snprintf(&buffer[i], IFNAMSIZ, "%s ", ft->name); | 388 | if (i >= PAGE_SIZE - IFNAMSIZ) |
389 | if (i >= PAGE_SIZE) | ||
390 | break; | 389 | break; |
390 | i += snprintf(&buffer[i], IFNAMSIZ, "%s ", ft->name); | ||
391 | } | 391 | } |
392 | mutex_unlock(&ft_mutex); | 392 | mutex_unlock(&ft_mutex); |
393 | if (i == j) | 393 | if (i == j) |