aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorJames.Smart@Emulex.Com <James.Smart@Emulex.Com>2005-08-10 15:03:01 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-08-12 13:08:48 -0400
commitf888ba3ce77c66bece3d804caf7d559838209a4a (patch)
tree7bdd2439b758199b84eee084f6e5b184dfc28b75 /drivers/scsi/lpfc/lpfc_attr.c
parent69859dc47744430ecda16522b0791b6d17e3fa93 (diff)
[SCSI] lpfc driver 8.0.30 : fix get_stats panic
Fix panic in lpfc_get_stats() Symptoms: Panic on sysfs stats access Cause: In lpfc_get_stats() we are writing to memory that we do not own. Fix: Fix our stats structure allocation. Embed phba->link_stats in struct lpfc_hba and stop treating it like rogue structure. Note: Embedding midlayer/transport structure in our structure caused need for more files to include midlayer/transport headers. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 3cea92883019..f37b7642c59d 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -988,8 +988,7 @@ lpfc_get_stats(struct Scsi_Host *shost)
988{ 988{
989 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; 989 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
990 struct lpfc_sli *psli = &phba->sli; 990 struct lpfc_sli *psli = &phba->sli;
991 struct fc_host_statistics *hs = 991 struct fc_host_statistics *hs = &phba->link_stats;
992 (struct fc_host_statistics *)phba->link_stats;
993 LPFC_MBOXQ_t *pmboxq; 992 LPFC_MBOXQ_t *pmboxq;
994 MAILBOX_t *pmb; 993 MAILBOX_t *pmb;
995 int rc=0; 994 int rc=0;
@@ -1020,6 +1019,8 @@ lpfc_get_stats(struct Scsi_Host *shost)
1020 return NULL; 1019 return NULL;
1021 } 1020 }
1022 1021
1022 memset(hs, 0, sizeof (struct fc_host_statistics));
1023
1023 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; 1024 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt;
1024 hs->tx_words = (pmb->un.varRdStatus.xmitByteCnt * 256); 1025 hs->tx_words = (pmb->un.varRdStatus.xmitByteCnt * 256);
1025 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; 1026 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt;