Skip to contentSkip to conversation

um: vector: Avoid NULL ptr deference if transport is unset

PATCH Applied Sjoerd Simons 3 participants 3 messages Feb 16, 2020 – Mar 29, 2020 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: vector: Avoid NULL ptr deference if transport is unset

When the transport option of a vec isn't set strncmp ends up being called on a NULL pointer. Better not do that.

---

 arch/um/drivers/vector_kern.c | 3 +++
 1 file changed, 3 insertions(+)
arch/um/drivers/vector_kern.c +3 -0
index 0ff86391f77d..ca90666c0b61 100644
@@ -198,6 +198,9 @@ static int get_transport_options(struct arglist *def)
 	long parsed;
 	int result = 0;
 
+	if (transport == NULL)
+		return -EINVAL;
+
 	if (vector != NULL) {
 		if (kstrtoul(vector, 10, &parsed) == 0) {
 			if (parsed == 0) {
Signature · 7 lines
2.25.0


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Sjoerd Simons

When the transport option of a vec isn't set strncmp ends up being called on a NULL pointer. Better not do that.

---

  arch/um/drivers/vector_kern.c | 3 +++
  1 file changed, 3 insertions(+)
arch/um/drivers/vector_kern.c +0 -0
index 0ff86391f77d..ca90666c0b61 100644

arch/um/drivers/vector_kern.c static int get_transport_options(struct arglist *def) · line 206

Quoted 9 lines
arch/um/drivers/vector_kern.c +3 -0
@@ -198,6 +198,9 @@ static int get_transport_options(struct arglist *def)
  	long parsed;
  	int result = 0;
 
+	if (transport == NULL)
+		return -EINVAL;
+
  	if (vector != NULL) {
  		if (kstrtoul(vector, 10, &parsed) == 0) {
  			if (parsed == 0) {
Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
#2 lore raw
Quoted 20 lines · Anton Ivanov
Quoted 18 lines · Sjoerd Simons

When the transport option of a vec isn't set strncmp ends up being called on a NULL pointer. Better not do that.

---

  arch/um/drivers/vector_kern.c | 3 +++
  1 file changed, 3 insertions(+)
arch/um/drivers/vector_kern.c +0 -0
index 0ff86391f77d..ca90666c0b61 100644
@@ -198,6 +198,9 @@ static int get_transport_options(struct arglist *def)
      long parsed;
      int result = 0;
 
Quoted 8 lines

arch/um/drivers/vector_kern.c static int get_transport_options(struct arglist *def) · line 206

Quoted 7 lines
arch/um/drivers/vector_kern.c +3 -0
+     if (transport == NULL)
+             return -EINVAL;
+
      if (vector != NULL) {
              if (kstrtoul(vector, 10, &parsed) == 0) {
                      if (parsed == 0) {

Applied, thanks!

Signature · 7 lines
Thanks,
//richard

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