Re: memcpy_fromiovec problems....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 7 Jan 2002, Jonathan Khoo wrote:

> I need some help with memcpy_fromiovec. I am trying to send a skb with
> iovec with the codes below:
> However, I keep getting an error at memcpy_fromiovec. I have traced it
> to copy_from_user which uses memcpy_fromfs.
> Does anyone know where the error lies?

Maybe you should not use the memcpy_fromiovec() function, as you're not
actually copying your data from the user memory to kernel memory,
that is the call to copy_from_user().

All that you will get is a -EFAULT (bad address) return value, in
your call to memcpy_fromiovec() as a result from a failing access_ok()
macro (x86 running linux-2.4.6).

You should either use a system-call taking a pointer to your data as
parameter or avoid using memcpy_fromiovec().

> struct msg {
> 	int number;
> };
>
> {
   ...

/* this is data in kernel memory */
> 	struct msg m;

/* this function calls copy_from_user() and access_ok() */
> 	if ((error=memcpy_fromiovec(skb_put(skb, size), iov, len))!=0) {
> 		kfree_skb(skb);
> 		goto errmsg;
> 	}
 ...

regards
stefan


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux