Re: [PATCH 01/12] iscsi_sysfs: Fix NULL pointer deference in iscsi_sysfs_read_iface

2020-12-11 Thread 'Lee Duncan' via open-iscsi
On 12/6/20 5:53 PM, Wenchao Hao wrote:
> Check if t is valid before accessing it.
> 
> Signed-off-by: Wenchao Hao 
> Signed-off-by: Zhiqiang Liu 
> Signed-off-by: Wu Bo 
> ---
>  usr/iscsi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
> index 540adfd..abefde2 100644
> --- a/usr/iscsi_sysfs.c
> +++ b/usr/iscsi_sysfs.c
> @@ -856,7 +856,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
> *iface, int host_no,
>   }
>   }
>  
> - if (session && t->template->use_boot_info)
> + if (session && t && t->template->use_boot_info)
>   iscsi_sysfs_read_boot(iface, session);
>  
>   if (!iface_kern_id)
> 

Reviewed-by: Lee Duncan 

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/10d940f4-7526-275d-4f9f-4d05cfcdd0f1%40suse.com.


[PATCH 01/12] iscsi_sysfs: Fix NULL pointer deference in iscsi_sysfs_read_iface

2020-12-06 Thread Wenchao Hao
Check if t is valid before accessing it.

Signed-off-by: Wenchao Hao 
Signed-off-by: Zhiqiang Liu 
Signed-off-by: Wu Bo 
---
 usr/iscsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 540adfd..abefde2 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -856,7 +856,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
}
}
 
-   if (session && t->template->use_boot_info)
+   if (session && t && t->template->use_boot_info)
iscsi_sysfs_read_boot(iface, session);
 
if (!iface_kern_id)
-- 
2.27.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/20201207015410.48488-2-haowenchao%40huawei.com.


Re: iscsi_sysfs_read_iface

2011-08-01 Thread Mike Christie
On 07/26/2011 01:38 AM, Hannes Reinecke wrote:
 diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
 index e82fe80..145816d 100644
 --- a/usr/iscsi_sysfs.c
 +++ b/usr/iscsi_sysfs.c
 @@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec
 *iface, int host_no,
 if (ret) {
 ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, initiatorname,
 iface-iname, sizeof(iface-iname));
 -   if (ret)
 +   if (ret) {
 /*
  * default iname is picked up later from
  * initiatorname.iscsi if software/partial-offload.
 @@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct iface_rec
 *iface, int host_no,
  */
 log_debug(7, Could not read initiatorname for 
   host%d\n, host_no);
 +   ret = 0;
 +   }
 }
 

Added in commit 4cc22470d5a1391108f329842f63ff3c31ccd288. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: iscsi_sysfs_read_iface

2011-07-27 Thread Hannes Reinecke

On 07/26/2011 09:44 PM, Mike Christie wrote:

On 07/26/2011 01:38 AM, Hannes Reinecke wrote:

Hi Eddie,

you beat me to it ...

On 07/26/2011 02:28 AM, Eddie Wai wrote:

Hello Mike,

The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
commit is preventing bnx2i from being able to offload when connecting
through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
session argument == NULL.  The initiatorname sysfs inquiry failed but
this is expected since it does not exist in the iscsi_host for bnx2i.

Perhaps the error return code should only be propagated upward when
session != NULL specifically for hbas like qla4xxx?

Thanks,
Eddie

- 8   - 8   -
@@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
iface_str(iface));
  }
  }
-   return ret;
+   if (ret)
+   return ISCSI_ERR_SYSFS_LOOKUP;
+   else
+   return 0;
   }
- 8   - 8   -

Actually, this is the patch I have:

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index e82fe80..145816d 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
 if (ret) {
 ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, initiatorname,
 iface-iname, sizeof(iface-iname));
-   if (ret)
+   if (ret) {
 /*
  * default iname is picked up later from
  * initiatorname.iscsi if software/partial-offload.
@@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
  */
 log_debug(7, Could not read initiatorname for 
   host%d\n, host_no);
+   ret = 0;
+   }
 }

 /*

(Well, of course it got line-wrapped, but should get you the idea).

I'll be sending the proper patch to the mailing-list shortly.
But yes, that is a real issue.


Yeah, this is right. That is the behavior we had before. I can just fix
this up and merge it if there were no other changes needed.

Not in this area, no.

I've got some minor patches to the SUSE init script but they still 
need further testing.


And actually I'm working on an 'iscsi_offload' scripts which 
configures the interface definitions for the various offload 
engines. If there is enough interest maybe we should include it in 
the open-iscsi tarball.


Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: iscsi_sysfs_read_iface

2011-07-27 Thread Ravi Anand
On Jul 26, 2011, at 11:34 PM, Hannes Reinecke wrote:
 On 07/26/2011 09:44 PM, Mike Christie wrote:
 On 07/26/2011 01:38 AM, Hannes Reinecke wrote:
 Hi Eddie,

 you beat me to it ...

 On 07/26/2011 02:28 AM, Eddie Wai wrote:
 Hello Mike,

 The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
 commit is preventing bnx2i from being able to offload when connecting
 through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
 session argument == NULL.  The initiatorname sysfs inquiry failed but
 this is expected since it does not exist in the iscsi_host for bnx2i.

 Perhaps the error return code should only be propagated upward when
 session != NULL specifically for hbas like qla4xxx?

 Thanks,
 Eddie

 - 8   - 8   -
 @@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
 *iface, int host_no,
iface_str(iface));
  }
  }
 -   return ret;
 +   if (ret)
 +   return ISCSI_ERR_SYSFS_LOOKUP;
 +   else
 +   return 0;
   }
 - 8   - 8   -
 Actually, this is the patch I have:

 diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
 index e82fe80..145816d 100644
 --- a/usr/iscsi_sysfs.c
 +++ b/usr/iscsi_sysfs.c
 @@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec
 *iface, int host_no,
 if (ret) {
 ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, initiatorname,
 iface-iname, sizeof(iface-iname));
 -   if (ret)
 +   if (ret) {
 /*
  * default iname is picked up later from
  * initiatorname.iscsi if software/partial-offload.
 @@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct iface_rec
 *iface, int host_no,
  */
 log_debug(7, Could not read initiatorname for 
   host%d\n, host_no);
 +   ret = 0;
 +   }
 }

 /*

 (Well, of course it got line-wrapped, but should get you the idea).

 I'll be sending the proper patch to the mailing-list shortly.
 But yes, that is a real issue.

 Yeah, this is right. That is the behavior we had before. I can just fix
 this up and merge it if there were no other changes needed.
 Not in this area, no.

 I've got some minor patches to the SUSE init script but they still
 need further testing.

 And actually I'm working on an 'iscsi_offload' scripts which
 configures the interface definitions for the various offload
 engines. If there is enough interest maybe we should include it in
 the open-iscsi tarball.

I think this is a good idea.

Ravi



This message and any attached documents contain information from QLogic 
Corporation or its wholly-owned subsidiaries that may be confidential. If you 
are not the intended recipient, you may not read, copy, distribute, or use this 
information. If you have received this transmission in error, please notify the 
sender immediately by reply e-mail and then delete this message.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: iscsi_sysfs_read_iface

2011-07-27 Thread Mike Christie
On 07/27/2011 01:34 AM, Hannes Reinecke wrote:
 And actually I'm working on an 'iscsi_offload' scripts which configures
 the interface definitions for the various offload engines. If there is
 enough interest maybe we should include it in the open-iscsi tarball.
 

Ok my me.

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: iscsi_sysfs_read_iface

2011-07-26 Thread Hannes Reinecke

Hi Eddie,

you beat me to it ...

On 07/26/2011 02:28 AM, Eddie Wai wrote:

Hello Mike,

The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
commit is preventing bnx2i from being able to offload when connecting
through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
session argument == NULL.  The initiatorname sysfs inquiry failed but
this is expected since it does not exist in the iscsi_host for bnx2i.

Perhaps the error return code should only be propagated upward when
session != NULL specifically for hbas like qla4xxx?

Thanks,
Eddie

- 8  - 8  -
@@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
   iface_str(iface));
 }
 }
-   return ret;
+   if (ret)
+   return ISCSI_ERR_SYSFS_LOOKUP;
+   else
+   return 0;
  }
- 8  - 8  -

Actually, this is the patch I have:

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index e82fe80..145816d 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct 
iface_rec *iface, int host_no,

if (ret) {
ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, 
initiatorname,
iface-iname, 
sizeof(iface-iname));

-   if (ret)
+   if (ret) {
/*
 * default iname is picked up later from
 * initiatorname.iscsi if 
software/partial-offload.
@@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct 
iface_rec *iface, int host_no,

 */
log_debug(7, Could not read initiatorname 
for 

  host%d\n, host_no);
+   ret = 0;
+   }
}

/*

(Well, of course it got line-wrapped, but should get you the idea).

I'll be sending the proper patch to the mailing-list shortly.
But yes, that is a real issue.
Independent on any bnx2i; any offloading engine _not_ listing the 
initiatorname as a host attribute will fail.

Not nice.

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



iscsi_sysfs_read_iface

2011-07-25 Thread Eddie Wai
Hello Mike,

The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
commit is preventing bnx2i from being able to offload when connecting
through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
session argument == NULL.  The initiatorname sysfs inquiry failed but
this is expected since it does not exist in the iscsi_host for bnx2i.

Perhaps the error return code should only be propagated upward when
session != NULL specifically for hbas like qla4xxx?

Thanks,
Eddie

- 8 - 8 -
@@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
  iface_str(iface));
}
}
-   return ret;
+   if (ret)
+   return ISCSI_ERR_SYSFS_LOOKUP;
+   else
+   return 0;
 }
- 8 - 8 -


Author: Mike Christie micha...@cs.wisc.edu
Date:   Sun Jan 30 22:49:56 2011 -0600

iscsi tools: fix iscsiadm exit codes

iscsiadm/iscsistart return a mix of type of returns codes.
Sometimes -1 and sometimes a EXYZ type of error code. This
patch has them return a ISCSI_ERR value.

See iscsiadm man page EXIT STATUS section for error
code definitions.

commit 39d4ceb04f051c208ae7509d268a3871ffa194c5



-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.