[PATCH] Fix possible segfault on logicalunit update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When updating logicalunit with tgtdadm without any params
tgtd will segfault when calling strncmp on NULL.
The call to strsep later is ok and will return NULL.

To reproduce create a target with a lun and run:
tgtadm -m logicalunit -o update --tid 1 --lun 1

Signed-off-by: Roi Dayan <roid@xxxxxxxxxxxx>
---
 usr/spc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr/spc.c b/usr/spc.c
index 15077ca..00e0dd7 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -1921,7 +1921,7 @@ tgtadm_err lu_config(struct scsi_lu *lu, char *params, match_fn_t *fn)
 	attrs = &lu->attrs;
 	lu_vpd = attrs->lu_vpd;
 
-	if (!strncmp("targetOps", params, 9))
+	if (params && !strncmp("targetOps", params, 9))
 		params = params + 10;
 
 	while ((p = strsep(&params, ",")) != NULL) {
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux