* [PATCH] um: ubd: Fix crash from option parsing
@ 2021-01-19 18:19 ` Paul Lawrence
0 siblings, 0 replies; 8+ messages in thread
From: Paul Lawrence @ 2021-01-19 18:19 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov,
Gabriel Krisman Bertazi, Christopher Obbard, Paul Lawrence
Cc: linux-um, linux-kernel
Below patch will cause NULL ptr dereferences if the optional filenames
are not present.
Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
Signed-off-by: Paul Lawrence <paullawrence@google.com>
---
arch/um/drivers/ubd_kern.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 13b1fe694b90..704989088f28 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
break_loop:
file = strsep(&str, ",:");
- if (*file == '\0')
+ if (file && *file == '\0')
file = NULL;
backing_file = strsep(&str, ",:");
- if (*backing_file == '\0')
+ if (backing_file && *backing_file == '\0')
backing_file = NULL;
serial = strsep(&str, ",:");
- if (*serial == '\0')
+ if (serial && *serial == '\0')
serial = NULL;
if (backing_file && ubd_dev->no_cow) {
--
2.30.0.284.gd98b1dd5eaa7-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] um: ubd: Fix crash from option parsing
@ 2021-01-19 18:19 ` Paul Lawrence
0 siblings, 0 replies; 8+ messages in thread
From: Paul Lawrence @ 2021-01-19 18:19 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov,
Gabriel Krisman Bertazi, Christopher Obbard, Paul Lawrence
Cc: linux-um, linux-kernel
Below patch will cause NULL ptr dereferences if the optional filenames
are not present.
Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
Signed-off-by: Paul Lawrence <paullawrence@google.com>
---
arch/um/drivers/ubd_kern.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 13b1fe694b90..704989088f28 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
break_loop:
file = strsep(&str, ",:");
- if (*file == '\0')
+ if (file && *file == '\0')
file = NULL;
backing_file = strsep(&str, ",:");
- if (*backing_file == '\0')
+ if (backing_file && *backing_file == '\0')
backing_file = NULL;
serial = strsep(&str, ",:");
- if (*serial == '\0')
+ if (serial && *serial == '\0')
serial = NULL;
if (backing_file && ubd_dev->no_cow) {
--
2.30.0.284.gd98b1dd5eaa7-goog
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
2021-01-19 18:19 ` Paul Lawrence
@ 2021-01-19 18:35 ` Gabriel Krisman Bertazi
-1 siblings, 0 replies; 8+ messages in thread
From: Gabriel Krisman Bertazi @ 2021-01-19 18:35 UTC (permalink / raw)
To: Paul Lawrence
Cc: Jeff Dike, Richard Weinberger, Anton Ivanov, Christopher Obbard,
linux-um, linux-kernel
Paul Lawrence <paullawrence@google.com> writes:
> Below patch will cause NULL ptr dereferences if the optional filenames
> are not present.
>
> Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
> Signed-off-by: Paul Lawrence <paullawrence@google.com>
Looks good.
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Totally unrelated, but it seems the original patch writes a "(null)"
string to the sysfs attribute, if no serial is defined. I think we
should have a default serial UBDX in case the user didn't provide any.
Thanks,
> ---
> arch/um/drivers/ubd_kern.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index 13b1fe694b90..704989088f28 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
>
> break_loop:
> file = strsep(&str, ",:");
> - if (*file == '\0')
> + if (file && *file == '\0')
> file = NULL;
>
> backing_file = strsep(&str, ",:");
> - if (*backing_file == '\0')
> + if (backing_file && *backing_file == '\0')
> backing_file = NULL;
>
> serial = strsep(&str, ",:");
> - if (*serial == '\0')
> + if (serial && *serial == '\0')
> serial = NULL;
>
> if (backing_file && ubd_dev->no_cow) {
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
@ 2021-01-19 18:35 ` Gabriel Krisman Bertazi
0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Krisman Bertazi @ 2021-01-19 18:35 UTC (permalink / raw)
To: Paul Lawrence
Cc: Richard Weinberger, Jeff Dike, linux-um, linux-kernel,
Christopher Obbard, Anton Ivanov
Paul Lawrence <paullawrence@google.com> writes:
> Below patch will cause NULL ptr dereferences if the optional filenames
> are not present.
>
> Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
> Signed-off-by: Paul Lawrence <paullawrence@google.com>
Looks good.
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Totally unrelated, but it seems the original patch writes a "(null)"
string to the sysfs attribute, if no serial is defined. I think we
should have a default serial UBDX in case the user didn't provide any.
Thanks,
> ---
> arch/um/drivers/ubd_kern.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index 13b1fe694b90..704989088f28 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out)
>
> break_loop:
> file = strsep(&str, ",:");
> - if (*file == '\0')
> + if (file && *file == '\0')
> file = NULL;
>
> backing_file = strsep(&str, ",:");
> - if (*backing_file == '\0')
> + if (backing_file && *backing_file == '\0')
> backing_file = NULL;
>
> serial = strsep(&str, ",:");
> - if (*serial == '\0')
> + if (serial && *serial == '\0')
> serial = NULL;
>
> if (backing_file && ubd_dev->no_cow) {
--
Gabriel Krisman Bertazi
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
2021-01-19 18:19 ` Paul Lawrence
@ 2021-01-22 0:41 ` Hajime Tazaki
-1 siblings, 0 replies; 8+ messages in thread
From: Hajime Tazaki @ 2021-01-22 0:41 UTC (permalink / raw)
To: paullawrence
Cc: jdike, richard, anton.ivanov, krisman, chris.obbard, linux-um,
linux-kernel
Hello,
On Wed, 20 Jan 2021 03:19:45 +0900,
Paul Lawrence wrote:
>
> Below patch will cause NULL ptr dereferences if the optional filenames
> are not present.
>
> Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
> Signed-off-by: Paul Lawrence <paullawrence@google.com>
This was addressed/fixed by the below patch, though that one doesn't
the first "file" variable check.
http://lists.infradead.org/pipermail/linux-um/2020-December/000983.html
There was another attempt to fix (with the same diff), btw.
http://lists.infradead.org/pipermail/linux-um/2021-January/000998.html
It seems that the patch is already queued but not upstreamed yet.
-- Hajime
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
@ 2021-01-22 0:41 ` Hajime Tazaki
0 siblings, 0 replies; 8+ messages in thread
From: Hajime Tazaki @ 2021-01-22 0:41 UTC (permalink / raw)
To: paullawrence
Cc: richard, jdike, linux-um, linux-kernel, krisman, chris.obbard,
anton.ivanov
Hello,
On Wed, 20 Jan 2021 03:19:45 +0900,
Paul Lawrence wrote:
>
> Below patch will cause NULL ptr dereferences if the optional filenames
> are not present.
>
> Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline)
> Signed-off-by: Paul Lawrence <paullawrence@google.com>
This was addressed/fixed by the below patch, though that one doesn't
the first "file" variable check.
http://lists.infradead.org/pipermail/linux-um/2020-December/000983.html
There was another attempt to fix (with the same diff), btw.
http://lists.infradead.org/pipermail/linux-um/2021-January/000998.html
It seems that the patch is already queued but not upstreamed yet.
-- Hajime
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
2021-01-22 0:41 ` Hajime Tazaki
@ 2021-01-22 14:44 ` Paul Lawrence
-1 siblings, 0 replies; 8+ messages in thread
From: Paul Lawrence @ 2021-01-22 14:44 UTC (permalink / raw)
To: Hajime Tazaki
Cc: jdike, richard, anton.ivanov, krisman, chris.obbard, linux-um,
Linux kernel
> This was addressed/fixed by the below patch, though that one doesn't
> the first "file" variable check.
I don't believe the first file variable can in fact be NULL, so my check was
unnecessary. Pleased to see this has been fixed, we can abandon my patch now.
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] um: ubd: Fix crash from option parsing
@ 2021-01-22 14:44 ` Paul Lawrence
0 siblings, 0 replies; 8+ messages in thread
From: Paul Lawrence @ 2021-01-22 14:44 UTC (permalink / raw)
To: Hajime Tazaki
Cc: richard, jdike, linux-um, Linux kernel, krisman, chris.obbard,
anton.ivanov
> This was addressed/fixed by the below patch, though that one doesn't
> the first "file" variable check.
I don't believe the first file variable can in fact be NULL, so my check was
unnecessary. Pleased to see this has been fixed, we can abandon my patch now.
Paul
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-01-22 14:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 18:19 [PATCH] um: ubd: Fix crash from option parsing Paul Lawrence
2021-01-19 18:19 ` Paul Lawrence
2021-01-19 18:35 ` Gabriel Krisman Bertazi
2021-01-19 18:35 ` Gabriel Krisman Bertazi
2021-01-22 0:41 ` Hajime Tazaki
2021-01-22 0:41 ` Hajime Tazaki
2021-01-22 14:44 ` Paul Lawrence
2021-01-22 14:44 ` Paul Lawrence
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.