Skip to contentSkip to conversation

um: Do not unlock mutex that is not hold.

PATCH In review Daniel Walter 2 participants 2 messages Apr 2, 2019 – Apr 5, 2019 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: Do not unlock mutex that is not hold.

Return error instead of trying to unlock a mutex that is not hold.

---
 arch/um/drivers/ubd_kern.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +2 -2
index aca09be2373e..33c1cd6a12ac 100644
@@ -276,14 +276,14 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
 		str++;
 		if(!strcmp(str, "sync")){
 			global_openflags = of_sync(global_openflags);
-			goto out1;
+			return err;
 		}
 
 		err = -EINVAL;
 		major = simple_strtoul(str, &end, 0);
 		if((*end != '\0') || (end == str)){
 			*error_out = "Didn't parse major number";
-			goto out1;
+			return err;
 		}
 
 		mutex_lock(&ubd_lock);
Signature · 7 lines
2.21.0.392.gf8f6787159e-goog


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Reviewed-by Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Daniel Walter

Return error instead of trying to unlock a mutex that is not hold.

---
  arch/um/drivers/ubd_kern.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +1 -1
index aca09be2373e..33c1cd6a12ac 100644
@@ -276,14 +276,14 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
  		str++;
  		if(!strcmp(str, "sync")){
  			global_openflags = of_sync(global_openflags);
-			goto out1;
+			return err;
  		}

arch/um/drivers/ubd_kern.c static int ubd_setup_common(char *str, int *index_out, char **error_out) · line 289

Quoted 10 lines
arch/um/drivers/ubd_kern.c +1 -1
 
  		err = -EINVAL;
  		major = simple_strtoul(str, &end, 0);
  		if((*end != '\0') || (end == str)){
  			*error_out = "Didn't parse major number";
-			goto out1;
+			return err;
  		}
 
  		mutex_lock(&ubd_lock);
Signature · 7 lines
Anton R. Ivanov
https://www.kot-begemot.co.uk/

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um