Local port leak on nl_socket_alloc/nl_socket_set_local_port(, 0)
Thomas Graf
tgraf at infradead.org
Tue Aug 30 03:56:18 EDT 2011
On Tue, Aug 30, 2011 at 09:27:37AM +0400, Andrew Rybchenko wrote:
> Hi,
>
> I've found a bug in the following scenario (fragment of code):
>
> while (1) {
> struct nl_sock *sk = nl_socket_alloc();
>
> if (sk == NULL) {
> fprintf(stderr, "Failed to allocate nl socket\n");
> break;
> }
> nl_socket_set_local_port(sk, 0);
> nl_socket_free(sk);
> }
>
> The problem is that nl_socket_set_local_port(, 0) does not
> release local port if it is allocated before.
>
> The following patch fixes the problem:
Applied, thanks Andrew!
More information about the libnl
mailing list