[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20071004.165559.123919608.davem@davemloft.net>
Date: Thu, 04 Oct 2007 16:55:59 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: tonyb@...ernetics.com
Cc: jmorris@...ei.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: fix kernel_accept() error path
From: Tony Battersby <tonyb@...ernetics.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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists