From: "Nelson Castillo" <nelsoneci@gmail.com>
To: "Stelian Pop" <stelian@popies.net>
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 09:55:17 -0500 [thread overview]
Message-ID: <2accc2ff0706120755sf0176e6yc55e65ec0502da5b@mail.gmail.com> (raw)
In-Reply-To: <1181655781.4620.77.camel@localhost.localdomain>
On 6/12/07, Stelian Pop <stelian@popies.net> wrote:
> 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.
Yes.
Perhaps then only the functions __kfifo_put_user and __kfifo_get_user should
be allowed. Those are the ones I'm using now , anyway.
I added the others for completeness but adding them is probably a mistake.
Regards,
Nelson.-
--
http://arhuaco.org
http://emQbit.com
next prev parent reply other threads:[~2007-06-12 14:55 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
2007-06-12 14:55 ` Nelson Castillo [this message]
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=2accc2ff0706120755sf0176e6yc55e65ec0502da5b@mail.gmail.com \
--to=nelsoneci@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stelian@popies.net \
/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®