linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Cc: Kees Cook <keescook@chromium.org>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	Guenter Roeck <groeck@chromium.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	Vivek Gautam <vivek.gautam@codeaurora.org>,
	Sibi Sankar <sibis@codeaurora.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Doug Anderson <dianders@chromium.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] pstore/ram: Fix console ramoops to show the previous boot logs
Date: Thu, 17 Jan 2019 10:18:33 -0500	[thread overview]
Message-ID: <20190117151833.GA51139@google.com> (raw)
In-Reply-To: <20190117062620.23908-1-saiprakash.ranjan@codeaurora.org>

On Thu, Jan 17, 2019 at 11:56:20AM +0530, Sai Prakash Ranjan wrote:
> commit b05c950698fe ("pstore/ram: Simplify ramoops_get_next_prz()
> arguments") changed update assignment in getting next persistent
> ram zone by adding a check for record type. But the check always
> returns true since the record type is assigned 0. And this breaks
> console ramoops by showing current console log instead of previous
> log on warm reset and hard reset (actually hard reset should not
> be showing any logs).
> 
> Fix this by having persistent ram zone type check instead of record
> type check. Tested this on SDM845 MTP and dragonboard 410c.
> 
> Reproducing this issue is simple as below:
> 
> 1. Trigger hard reset and mount pstore. Will see console-ramoops
>    record in the mounted location which is the current log.
> 
> 2. Trigger warm reset and mount pstore. Will see the current
>    console-ramoops record instead of previous record.
> 
> Fixes: b05c950698fe ("pstore/ram: Simplify ramoops_get_next_prz() arguments")
> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>


Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks!

 - Joel

> 
> ---
> 
> I guess commit msg can be improved.
> ---
>  fs/pstore/ram.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 96f7d32cd184..441a44215456 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -128,7 +128,7 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
>  		     struct pstore_record *record)
>  {
>  	struct persistent_ram_zone *prz;
> -	bool update = (record->type == PSTORE_TYPE_DMESG);
> +	bool update;
>  
>  	/* Give up if we never existed or have hit the end. */
>  	if (!przs)
> @@ -138,6 +138,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], int id,
>  	if (!prz)
>  		return NULL;
>  
> +	update = (prz->type == PSTORE_TYPE_DMESG);
> +
>  	/* Update old/shadowed buffer. */
>  	if (update)
>  		persistent_ram_save_old(prz);
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> 

  reply	other threads:[~2019-01-17 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17  6:26 [PATCH] pstore/ram: Fix console ramoops to show the previous boot logs Sai Prakash Ranjan
2019-01-17 15:18 ` Joel Fernandes [this message]
2019-01-17 15:28   ` Sai Prakash Ranjan
2019-01-17 17:11 ` Kees Cook

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=20190117151833.GA51139@google.com \
    --to=joel@joelfernandes.org \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=dianders@chromium.org \
    --cc=groeck@chromium.org \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rnayak@codeaurora.org \
    --cc=saiprakash.ranjan@codeaurora.org \
    --cc=sboyd@kernel.org \
    --cc=sibis@codeaurora.org \
    --cc=tony.luck@intel.com \
    --cc=vivek.gautam@codeaurora.org \
    /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 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).