Re: [PATCH net-next 2/2] inet: Fix get port to handle zero port number with soreuseport set
From: Craig Gallek <hidden>
Date: 2016-12-15 15:58:33
From: Craig Gallek <hidden>
Date: 2016-12-15 15:58:33
On Wed, Dec 14, 2016 at 7:54 PM, Tom Herbert [off-list ref] wrote:
A user may call listen with binding an explicit port with the intent that the kernel will assign an available port to the socket. In this case inet_csk_get_port does a port scan. For such sockets, the user may also set soreuseport with the intent a creating more sockets for the port that is selected. The problem is that the initial socket being opened could inadvertently choose an existing and unreleated port number that was already created with soreuseport.
Good catch! I think this problem may also exist in the UDP path? (udp_lib_get_port -> udp_lib_lport_inuse[2])