* [PATCH] um: vector: Avoid NULL ptr deference if transport is unset
@ 2020-02-16 21:36 Sjoerd Simons
2020-02-17 7:53 ` Anton Ivanov
0 siblings, 1 reply; 3+ messages in thread
From: Sjoerd Simons @ 2020-02-16 21:36 UTC (permalink / raw)
To: linux-um; +Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel
When the transport option of a vec isn't set strncmp ends up being
called on a NULL pointer. Better not do that.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
arch/um/drivers/vector_kern.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 0ff86391f77d..ca90666c0b61 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -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) {
--
2.25.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] um: vector: Avoid NULL ptr deference if transport is unset
2020-02-16 21:36 [PATCH] um: vector: Avoid NULL ptr deference if transport is unset Sjoerd Simons
@ 2020-02-17 7:53 ` Anton Ivanov
2020-03-29 21:55 ` Richard Weinberger
0 siblings, 1 reply; 3+ messages in thread
From: Anton Ivanov @ 2020-02-17 7:53 UTC (permalink / raw)
To: Sjoerd Simons, linux-um; +Cc: Jeff Dike, Richard Weinberger, linux-kernel
On 16/02/2020 21:36, Sjoerd Simons wrote:
> When the transport option of a vec isn't set strncmp ends up being
> called on a NULL pointer. Better not do that.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>
> ---
>
> arch/um/drivers/vector_kern.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index 0ff86391f77d..ca90666c0b61 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -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) {
>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] um: vector: Avoid NULL ptr deference if transport is unset
2020-02-17 7:53 ` Anton Ivanov
@ 2020-03-29 21:55 ` Richard Weinberger
0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-03-29 21:55 UTC (permalink / raw)
To: Anton Ivanov; +Cc: Sjoerd Simons, linux-um, Richard Weinberger, Jeff Dike, LKML
On Mon, Feb 17, 2020 at 8:54 AM Anton Ivanov
<anton.ivanov@cambridgegreys.com> wrote:
>
> On 16/02/2020 21:36, Sjoerd Simons wrote:
> > When the transport option of a vec isn't set strncmp ends up being
> > called on a NULL pointer. Better not do that.
> >
> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> >
> > ---
> >
> > arch/um/drivers/vector_kern.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> > index 0ff86391f77d..ca90666c0b61 100644
> > --- a/arch/um/drivers/vector_kern.c
> > +++ b/arch/um/drivers/vector_kern.c
> > @@ -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) {
> >
> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Applied, thanks!
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-29 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 21:36 [PATCH] um: vector: Avoid NULL ptr deference if transport is unset Sjoerd Simons
2020-02-17 7:53 ` Anton Ivanov
2020-03-29 21:55 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).