Re: Error No -14 in Binding by server in Kernel module

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

 



On Thu, Sep 30, 2004 at 19:50:18 +0530, Rakesh Jagota wrote:
> Hello All,
> 
> I developed on kernel module which provides wrapper functions to all sys_*
> funtions related to sockets. With this i developed one application , and i
> could run TCP server which is communicating with TCP client on the other
> m/c.
> 
> Now  Developed one kernel module (instead of application in the earlier
> case)for TCP server (now Kernel module) . when the server is executing the
> bind function
> it has given Error No -14.
> 
> I know that It is accessing bad area.  Any suggestions.

First, errno 14 is Bad Address. In kernel, errno values are negative.

Now, I have two suggestions:

1) Don't use syscalls from kernel. Use the sock_* functions directly.

2) If you have to call a syscall, or any other function that does
   copy_to/from_user with data in kernel, do:

    mm_segment_t oldfs = get_fs();
    set_fs(KERNEL_DS);
    <do-the-call-here>
    set_fs(oldfs);

   In fact, even if you avoid calling syscalls, read and write (and send,
   recv etc...) file/socket methods will still need this, because they
   copy_to/from_user.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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