mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stelian Pop <stelian@popies.net>
To: Nelson Castillo <nelsoneci@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 1/1] support for user-space buffers in kfifo
Date: Tue, 12 Jun 2007 15:43:01 +0200	[thread overview]
Message-ID: <1181655781.4620.77.camel@localhost.localdomain> (raw)
In-Reply-To: <20070611212614.GB21025@emqbit.com>

Le lundi 11 juin 2007 à 16:26 -0500, Nelson Castillo a écrit :
> Hi.
> 
> I just added support for user space buffers in kfifo. I found useful
> __kfifo_get_user to copy data to a user buffer in a read call. I didn't
> like the idea of having an extra buffer.
> 
> * Is it ok to add this support?

I suppose it is, however:

> +	spin_lock_irqsave(fifo->lock, flags);
> +
> +	ret = __kfifo_put_user(fifo, buffer, len);
> +
> +	spin_unlock_irqrestore(fifo->lock, flags);
[...]

> +int __kfifo_put_user(struct kfifo *fifo, const unsigned char __user *buffer,
> +	        unsigned int len)
[...]

> +	if(copy_from_user(fifo->buffer + (fifo->in & (fifo->size - 1)),
> +			  buffer, l))
> +		return  -EFAULT;
[...]

accessing userspace memory with a spinlock taken (moreover an irqsave()
one) is bad bad bad.

Stelian.
-- 
Stelian Pop <stelian@popies.net>


  reply	other threads:[~2007-06-12 14:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-11 21:26 Nelson Castillo
2007-06-12 13:43 ` Stelian Pop [this message]
2007-06-12 14:55   ` Nelson Castillo
2007-06-12 16:24 Nelson Castillo
2007-06-12 22:12 ` Stelian Pop
2007-06-13  2:21 Nelson Castillo
2007-06-13  6:00 ` Stelian Pop

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=1181655781.4620.77.camel@localhost.localdomain \
    --to=stelian@popies.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nelsoneci@gmail.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®