Re: Handling ioctl() argp memory

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

 



leslie.polzer@xxxxxxx wrote:

>   I'm passing an array to a ioctl.
>   ioctl(2) says it needs to point at memory, so I'm allocating it.
>   Do I need to, or rather, am I allowed to free the memory afterwards?

Yes. The kernel never retains pointers to user-space memory; it either
copies the data, or finishes using it before the system call returns.

>   It seems I'm getting segfaults when I free the memory...

You're probably overwriting the beginning of the allocated block.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux