)]}'
{
  "commit": "7c13d5d5afb4ba2e8634fe5aa0a9f2bca235cb4b",
  "tree": "3130a71c34d9765c30b06d3bbd42243ac9ea23f0",
  "parents": [
    "0f48b1d42710f417bfb005f776423cd740ca86b5"
  ],
  "author": {
    "name": "Dominik Maier",
    "email": "dmnk@google.com",
    "time": "Tue Nov 24 18:06:00 2026 +0000"
  },
  "committer": {
    "name": "Paolo Abeni",
    "email": "pabeni@redhat.com",
    "time": "Wed Dec 02 13:42:39 2026 +0100"
  },
  "message": "inet: release newly acquired port on inet_csk_listen_start() hash error\n\nWhen inet_csk_listen_start() is called on a socket that has not been\nexplicitly bound, sk-\u003esk_prot-\u003eget_port() allocates an ephemeral port\nand links the socket into bhash and bhash2 without setting\nSOCK_BINDPORT_LOCK. If sk-\u003esk_prot-\u003ehash() then fails (for example, when\na prior failed connect() left icsk-\u003eunhashed_state set to TCP_SYN_SENT\nso inet_hash() returns -EINVAL), inet_csk_listen_start() resets sk_state\nto TCP_CLOSE and returns the error without releasing the newly acquired\nport.\n\nBecause inet-\u003einet_num remains non-zero while SOCK_BINDPORT_LOCK is\nunset, a subsequent Fast Open connect on a dual-stack AF_INET6 socket\ncan update sk_v6_rcv_saddr via tcp_v4_connect() without rehashing the\nbhash2 entry. Disconnecting with AF_UNSPEC then invokes\n__inet_put_port(), which locks the new address\u0027s bhash2 bucket while\nunlinking and freeing tb2 from the original bhash2 bucket without\nholding its spinlock.\n\nRecord whether icsk-\u003eicsk_bind_hash was already populated before\nget_port(). If sk-\u003esk_prot-\u003ehash() fails on a newly bound socket, call\ninet_put_port(sk) and clear inet-\u003einet_sport before transitioning back\nto TCP_CLOSE. Explicitly bound sockets retain their port.\n\nFixes: 28044fc1d495 (\"net: Add a bhash2 table hashed by port and address\")\nCc: stable@vger.kernel.org\nSigned-off-by: Dominik Maier \u003cdmnk@google.com\u003e\nReviewed-by: Jiayuan Chen \u003cjiayuan.chen@linux.dev\u003e\nReviewed-by: Kuniyuki Iwashima \u003ckuniyu@google.com\u003e\nLink: https://patch.msgid.link/20261124180600.71138-1-dmnk@google.com\nSigned-off-by: Paolo Abeni \u003cpabeni@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b219aa8fbb6bcc0c6e7143e0065e061c8a57cd13",
      "old_mode": 33188,
      "old_path": "net/ipv4/inet_connection_sock.c",
      "new_id": "1b4cd5a968a7062e0bddec3556b43e1fa9cc5000",
      "new_mode": 33188,
      "new_path": "net/ipv4/inet_connection_sock.c"
    }
  ]
}
