lkml.org 
[lkml]   [2005]   [Mar]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 2 Mar 2005 13:22:06 +0800
FromMingJie Chang <>
SubjectRe: question about sockfd_lookup( )
I can't use sockfd_put(sock)  directly.
I trace its code, the code is

extern __inline__ void sockfd_put(struct socket *sock)
{
        fput(sock->file);
}
so I use fput(sock->file)

but it has problems too

1) execute "ls" in the ftp is also block
2) kernel prints "socki_lookup: socket file changed!"
3) execute "ftp localhost" after rmmod, it will crash

and why the sockfd_put is needed after sockfd_lookup

Thanak again

MingChieh Chang
Taiwan
===============================================
- Hide quoted text -
On Tue, 01 Mar 2005 08:56:19 +0100, Eric Dumazet <dada1@cosmosbay.com> wrote:
> Hi
>
> Try adding sockfd_put(sock) ;
>
> MingJie Chang wrote:
> > Dear all,
> >
> > I want to get socket information by the sockfd while accetping,
> >
> > so I write a module to test sockfd_lookup(),
> >
> > but I got some problems when I test it.
> >
> > I hope someone can help me...
> >
> > Thank you
> >
> > following text is my code and error message
> > ===========================================
> > === code ===
> >
> > int my_socketcall(int call,unsigned long *args)
> > {
> >    int ret,err;
> >    struct socket * sock;
> >
> >    ret = run_org_socket_call(call,args);   //orignal sys_sockcall()
> >
> >    if(call==SYS_ACCEPT&&ret>=0)
> >    {
> >           sock=sockfd_lookup(ret,&err);
> >           printk("lookup done\n");
>
>         if (sock) sockfd_put(sock) ;
>
> >    }
> >    return ret;
> > }
>
> Eric Dumazet
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2008