All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Alexander Shishkin
	<alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mathieu.poirier-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	peter.lachner-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	norbert.schulz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	keven.boell-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	yann.fouassier-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	laurent.fert-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 01/11] stm class: Introduce an abstraction for System Trace Module devices
Date: Sat, 5 Dec 2015 22:40:10 -0500	[thread overview]
Message-ID: <5663AE1A.2080808@oracle.com> (raw)
In-Reply-To: <1442926040-15150-2-git-send-email-alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

On 09/22/2015 08:47 AM, Alexander Shishkin wrote:
> +static ssize_t stm_char_write(struct file *file, const char __user *buf,
> +			      size_t count, loff_t *ppos)
> +{
> +	struct stm_file *stmf = file->private_data;
> +	struct stm_device *stm = stmf->stm;
> +	char *kbuf;
> +	int err;
> +
> +	/*
> +	 * if no m/c have been assigned to this writer up to this
> +	 * point, use "default" policy entry
> +	 */
> +	if (!stmf->output.nr_chans) {
> +		err = stm_file_assign(stmf, "default", 1);
> +		/*
> +		 * EBUSY means that somebody else just assigned this
> +		 * output, which is just fine for write()
> +		 */
> +		if (err && err != -EBUSY)
> +			return err;
> +	}
> +
> +	kbuf = kmalloc(count + 1, GFP_KERNEL);

This bit allows for user-controllable kmalloc() allocation lengths, including
a possible overflow.


Thanks,
Sasha

WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sasha.levin@oracle.com>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org,
	peter.lachner@intel.com, norbert.schulz@intel.com,
	keven.boell@intel.com, yann.fouassier@intel.com,
	laurent.fert@intel.com, linux-api@vger.kernel.org
Subject: Re: [PATCH v4 01/11] stm class: Introduce an abstraction for System Trace Module devices
Date: Sat, 5 Dec 2015 22:40:10 -0500	[thread overview]
Message-ID: <5663AE1A.2080808@oracle.com> (raw)
In-Reply-To: <1442926040-15150-2-git-send-email-alexander.shishkin@linux.intel.com>

On 09/22/2015 08:47 AM, Alexander Shishkin wrote:
> +static ssize_t stm_char_write(struct file *file, const char __user *buf,
> +			      size_t count, loff_t *ppos)
> +{
> +	struct stm_file *stmf = file->private_data;
> +	struct stm_device *stm = stmf->stm;
> +	char *kbuf;
> +	int err;
> +
> +	/*
> +	 * if no m/c have been assigned to this writer up to this
> +	 * point, use "default" policy entry
> +	 */
> +	if (!stmf->output.nr_chans) {
> +		err = stm_file_assign(stmf, "default", 1);
> +		/*
> +		 * EBUSY means that somebody else just assigned this
> +		 * output, which is just fine for write()
> +		 */
> +		if (err && err != -EBUSY)
> +			return err;
> +	}
> +
> +	kbuf = kmalloc(count + 1, GFP_KERNEL);

This bit allows for user-controllable kmalloc() allocation lengths, including
a possible overflow.


Thanks,
Sasha

  parent reply	other threads:[~2015-12-06  3:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 12:47 [PATCH v4 00/11] Introduce Intel Trace Hub support Alexander Shishkin
     [not found] ` <1442926040-15150-1-git-send-email-alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-09-22 12:47   ` [PATCH v4 01/11] stm class: Introduce an abstraction for System Trace Module devices Alexander Shishkin
2015-09-22 12:47     ` Alexander Shishkin
     [not found]     ` <1442926040-15150-2-git-send-email-alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-12-06  3:40       ` Sasha Levin [this message]
2015-12-06  3:40         ` Sasha Levin
2015-09-22 12:47 ` [PATCH v4 02/11] MAINTAINERS: add an entry for System Trace Module device class Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 03/11] stm class: dummy_stm: Add dummy driver for testing stm class Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 04/11] stm class: stm_console: Add kernel-console-over-stm driver Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 05/11] intel_th: Add driver infrastructure for Intel(R) Trace Hub devices Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 06/11] intel_th: Add pci glue layer for Intel(R) Trace Hub Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 07/11] intel_th: Add Global Trace Hub driver Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 08/11] intel_th: Add Software " Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 09/11] intel_th: Add Memory Storage Unit driver Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 10/11] intel_th: Add PTI output driver Alexander Shishkin
2015-09-22 12:47 ` [PATCH v4 11/11] MAINTAINERS: add an entry for Intel(R) Trace Hub Alexander Shishkin

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=5663AE1A.2080808@oracle.com \
    --to=sasha.levin-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=keven.boell-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=laurent.fert-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mathieu.poirier-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=norbert.schulz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=peter.lachner-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=yann.fouassier-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 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.