Commit 9010b946 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[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: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent d9573e7a
...@@ -708,6 +708,12 @@ static int cxgb3i_host_set_param(struct Scsi_Host *shost, ...@@ -708,6 +708,12 @@ static int cxgb3i_host_set_param(struct Scsi_Host *shost,
{ {
struct cxgb3i_hba *hba = iscsi_host_priv(shost); struct cxgb3i_hba *hba = iscsi_host_priv(shost);
if (!hba->ndev) {
shost_printk(KERN_ERR, shost, "Could not set host param. "
"Netdev for host not set.\n");
return -ENODEV;
}
cxgb3i_api_debug("param %d, buf %s.\n", param, buf); cxgb3i_api_debug("param %d, buf %s.\n", param, buf);
switch (param) { switch (param) {
...@@ -738,6 +744,12 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost, ...@@ -738,6 +744,12 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
struct cxgb3i_hba *hba = iscsi_host_priv(shost); struct cxgb3i_hba *hba = iscsi_host_priv(shost);
int len = 0; int len = 0;
if (!hba->ndev) {
shost_printk(KERN_ERR, shost, "Could not set host param. "
"Netdev for host not set.\n");
return -ENODEV;
}
cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param); cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param);
switch (param) { switch (param) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment