public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: MingJie Chang <mingjie.tw@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: question about sockfd_lookup( )
Date: Wed, 2 Mar 2005 13:22:06 +0800	[thread overview]
Message-ID: <8b46b8f1050301212265a30ec@mail.gmail.com> (raw)
In-Reply-To: <42242023.9070101@cosmosbay.com>

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
>
>

      parent reply	other threads:[~2005-03-02  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01  6:02 question about sockfd_lookup( ) MingJie Chang
2005-03-01  7:56 ` Eric Dumazet
2005-03-01 10:08   ` MingJie Chang
2005-03-02  5:22   ` MingJie Chang [this message]

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=8b46b8f1050301212265a30ec@mail.gmail.com \
    --to=mingjie.tw@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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