From: David Miller <davem@davemloft.net>
To: tonyb@cybernetics.com
Cc: jmorris@namei.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: fix kernel_accept() error path
Date: Thu, 04 Oct 2007 16:55:59 -0700 (PDT) [thread overview]
Message-ID: <20071004.165559.123919608.davem@davemloft.net> (raw)
In-Reply-To: <47056565.50803@cybernetics.com>
From: Tony Battersby <tonyb@cybernetics.com>
Date: Thu, 04 Oct 2007 18:12:53 -0400
> Here is an example of what I would consider "reasonable code" that would
> fail:
>
> int example()
> {
> struct socket *conn_socket = NULL;
> int err;
>
> ...
>
> if ((err = kernel_accept(sock, &conn_socket, 0)) < 0)
> goto out_cleanup;
>
> [do whatever with conn_socket]
>
> out_cleanup:
>
> if (conn_socket != NULL)
> sock_release(&conn_socket);
>
> return err;
> }
This is a grey area.
I'd say you shouldn't be trying to do cleanups on conn_socket unless
kernel_accept() gave you a success return.
However, kernel_accept() is guilty of leaving a stray pointer
in conn_socket, in fact a reference to freed memory. So
from that perspective we should put your patch in.
Please resubmit, at least to me under seperate cover,thanks.
prev parent reply other threads:[~2007-10-04 23:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-04 20:20 [PATCH] net: fix kernel_accept() error path Tony Battersby
2007-10-04 21:57 ` James Morris
2007-10-04 22:08 ` David Miller
2007-10-04 22:12 ` Tony Battersby
2007-10-04 23:55 ` David Miller [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=20071004.165559.123919608.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=netdev@vger.kernel.org \
--cc=tonyb@cybernetics.com \
/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;
as well as URLs for NNTP newsgroup(s).