All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: gaurav singh <gaurav1086@gmail.com>
Cc: tytso@mit.edu, arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] char_driver_warn_unseeded_randomness: Add null check
Date: Thu, 4 Jun 2020 08:30:13 +0200	[thread overview]
Message-ID: <20200604063013.GA322507@kroah.com> (raw)
In-Reply-To: <CAFAFadBsL6OKW7e76OvFQuiih_o6iUjoj6QB=RW40gPsEZ17HA@mail.gmail.com>

On Wed, Jun 03, 2020 at 10:29:07PM -0400, gaurav singh wrote:
> File: drivers/char/random.c
> Function: _warn_unseeded_randomness
> 
> There is a check for previous(ptr) before dereferencing:
> 
>     if (print_once ||
>         crng_ready() ||
>         (previous && (caller == READ_ONCE(*previous))))
>         return;
> 
> However, after this, it is dereferenced without checking:
> WRITE_ONCE(*previous, caller);
> 
> To fix this, add a null check
> 
> Please find the patch below. Let me know if there's any issue.
> 
> Thanks,
> Gaurav.
> 
> 
> >From 5e53cbce018c4d57753a6740c22d826bae0aab3f Mon Sep 17 00:00:00 2001
> From: Gaurav Singh <gaurav1086@gmail.com>
> Date: Wed, 3 Jun 2020 22:23:47 -0400
> Subject: [PATCH] char_driver_warn_unseeded_randomness: Add null check for
>  previous
> 
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
>  drivers/char/random.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 0d10e31fd342..4f1975e7f201 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1526,7 +1526,9 @@ static void _warn_unseeded_randomness(const char
> *func_name, void *caller,
>      crng_ready() ||
>      (previous && (caller == READ_ONCE(*previous))))
>   return;
> - WRITE_ONCE(*previous, caller);
> +
> + if (previous)
> + WRITE_ONCE(*previous, caller);
>  #ifndef CONFIG_WARN_ALL_UNSEEDED_RANDOM
>   print_once = true;
>  #endif
> -- 
> 2.17.1


Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch is malformed (tabs converted to spaces, linewrapped, etc.)
  and can not be applied.  Please read the file,
  Documentation/email-clients.txt in order to fix this.

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what is needed in order to
  properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
  and everyone else, to know what this patch is all about.  Please read
  the section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what a proper Subject: line should
  look like.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

           reply	other threads:[~2020-06-04  6:30 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAFAFadBsL6OKW7e76OvFQuiih_o6iUjoj6QB=RW40gPsEZ17HA@mail.gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604063013.GA322507@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=gaurav1086@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.