[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1709251555080.15252@nanos>
Date: Mon, 25 Sep 2017 16:04:07 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Luck, Tony" <tony.luck@...el.com>
cc: linux-kernel@...r.kernel.org, Boris Petkov <bp@...e.de>,
Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Steven Rostedt <rostedt@...dmis.org>,
Vikas Shivappa <vikas.shivappa@...el.com>
Subject: Re: [PATCH 2/5] x86/intel_rdt: Add diagnostics when writing the
schemata file
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
Powered by blists - more mailing lists