From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Qiuyu Zhang <qiuyu.zhang@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: strange about copy_from_user
Date: Fri, 9 Jul 2004 17:57:57 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.53.0407091752360.2731@chaos> (raw)
In-Reply-To: <c26fd828040709143843b3143f@mail.gmail.com>
On Fri, 9 Jul 2004, Qiuyu Zhang wrote:
> Hi all,
> I am working on writing a module driver.
>
> I am trying to use API copy_from_user to copy a bunch of memory from
> user space to kernel space. I write a ioctl function to register the
> pointer of the memory to kernel. And in the ioctl function I can use
> copy_from_user to get the correct data, but the strange thing is that
> when I use copy_from_user in other kernel function such as
> dev_hard_xmit function , I cannot
> get the correct result. I don't konw what the reason is . Thx.
> -
Without looking at the code it's hard to figure out what you
may be doing. However, copy_from_user() and copy_to_user() may
not ever be executed with a spin-lock held. Generally, if
you need to put user data into kernel "things", you need
to buffer it, i.e., copy_from_user() into a kmalloc(ed) buffer,
then work with it in kernel space.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.
next prev parent reply other threads:[~2004-07-09 21:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-09 21:38 Qiuyu Zhang
2004-07-09 21:57 ` Richard B. Johnson [this message]
2004-07-09 23:11 ` Qiuyu Zhang
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=Pine.LNX.4.53.0407091752360.2731@chaos \
--to=root@chaos.analogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=qiuyu.zhang@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®