mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org, Boris Petkov <bp@suse.de>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Vikas Shivappa <vikas.shivappa@intel.com>
Subject: Re: [PATCH 2/5] x86/intel_rdt: Add diagnostics when writing the schemata file
Date: Mon, 25 Sep 2017 16:04:07 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1709251555080.15252@nanos> (raw)
In-Reply-To: <29bafcfe886a22c6b9b68868f021193e55e5bcf2.1505771973.git.tony.luck@intel.com>

On Mon, 18 Sep 2017, Luck, Tony wrote:
> @@ -208,14 +241,19 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
>  	char *tok, *resname;
>  	int closid, ret = 0;
>  
> +	seq_buf_clear(&last_cmd_status);
> +
>  	/* Valid input requires a trailing newline */
> -	if (nbytes == 0 || buf[nbytes - 1] != '\n')
> +	if (nbytes == 0 || buf[nbytes - 1] != '\n') {
> +		seq_buf_puts(&last_cmd_status, "no trailing newline\n");
>  		return -EINVAL;
> +	}
>  	buf[nbytes - 1] = '\0';

In all other instances you access last_cmd_status within the
rdtgroup_kn_lock_live() protected section, which also serializes the show()
function via rdtgroup_mutex. Here you do it outside for obvious reasons,
but that opens a can of evil worms ...

Can you please provide and use two helpers - last_cmd_buf_clear() and
last_cmd_buf_puts() - which both have a
lockdep_assert_held(&rdtgroup_mutex) inside to make sure that we don't end
up with unprotected access accidentally?

Thanks,

	tglx

  reply	other threads:[~2017-09-25 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 22:18 [RFC 0/5] x86/intel_rdt: Better diagnostics Luck, Tony
2017-09-18 22:18 ` [PATCH 1/5] x86/intel_rdt: Add framework for better RDT UI diagnostics Luck, Tony
2017-09-18 22:18 ` [PATCH 2/5] x86/intel_rdt: Add diagnostics when writing the schemata file Luck, Tony
2017-09-25 14:04   ` Thomas Gleixner [this message]
2017-09-25 21:38     ` Luck, Tony
2017-09-25 22:12       ` Thomas Gleixner
2017-09-25 22:18         ` Luck, Tony
2017-09-18 22:18 ` [PATCH 3/5] x86/intel_rdt: Add diagnostics when writing the tasks file Luck, Tony
2017-09-18 22:18 ` [PATCH 4/5] x86/intel_rdt: Add diagnostics when writing the cpus file Luck, Tony
2017-09-18 22:18 ` [PATCH 5/5] x86/intel_rdt: Add diagnostics when making directories Luck, Tony
2017-09-19  1:10 ` [RFC 0/5] x86/intel_rdt: Better diagnostics Steven Rostedt
2017-09-19 23:11 ` [PATCH 6/5] x86/intel_rdt: Add documentation for "info/last_cmd_status" Luck, Tony
2017-09-21 12:08 ` [RFC 0/5] x86/intel_rdt: Better diagnostics Borislav Petkov
2017-09-30  8:27   ` Borislav Petkov

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=alpine.DEB.2.20.1709251555080.15252@nanos \
    --to=tglx@linutronix.de \
    --cc=bp@suse.de \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tony.luck@intel.com \
    --cc=vikas.shivappa@intel.com \
    /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

all inboxes | Powered by JetHome®