aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2010-02-10 17:51:44 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-17 14:40:07 -0500
commit9010b94636312c7fb12b591ef09e915f8f80bbd5 (patch)
treed84995617c8d9b1ac9b5dba2576c28a2429cc58f /drivers/scsi/cxgb3i/cxgb3i_iscsi.c
parentd9573e7af16de0e3aa55db1703dbe544faf391de (diff)
[SCSI] cxgb3i: check for setup netdev
If the netdev has not been setup when the host is, we will oops when the iscsi layer calls into the driver and a it tries to reference the netdev in hba->ndev. This can happen if the iscsi driver is loaded before ifup is done. This patch just adds a check, so we can gracefully fail the operation. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/cxgb3i/cxgb3i_iscsi.c')
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_iscsi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 1fd89b229c87..412853c65372 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -708,6 +708,12 @@ static int cxgb3i_host_set_param(struct Scsi_Host *shost,
708{ 708{
709 struct cxgb3i_hba *hba = iscsi_host_priv(shost); 709 struct cxgb3i_hba *hba = iscsi_host_priv(shost);
710 710
711 if (!hba->ndev) {
712 shost_printk(KERN_ERR, shost, "Could not set host param. "
713 "Netdev for host not set.\n");
714 return -ENODEV;
715 }
716
711 cxgb3i_api_debug("param %d, buf %s.\n", param, buf); 717 cxgb3i_api_debug("param %d, buf %s.\n", param, buf);
712 718
713 switch (param) { 719 switch (param) {
@@ -738,6 +744,12 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
738 struct cxgb3i_hba *hba = iscsi_host_priv(shost); 744 struct cxgb3i_hba *hba = iscsi_host_priv(shost);
739 int len = 0; 745 int len = 0;
740 746
747 if (!hba->ndev) {
748 shost_printk(KERN_ERR, shost, "Could not set host param. "
749 "Netdev for host not set.\n");
750 return -ENODEV;
751 }
752
741 cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param); 753 cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param);
742 754
743 switch (param) { 755 switch (param) {