]> git.baikalelectronics.ru Git - kernel.git/commit
dccp: fix freeing skb too early for IPV6_RECVPKTINFO
authorAndrey Konovalov <andreyknvl@google.com>
Thu, 16 Feb 2017 16:22:46 +0000 (17:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Feb 2017 18:36:25 +0000 (13:36 -0500)
commit48ca53bb9bfecac95b87cf6817a6ac9d7714fa65
tree6472d92163649ed669f5814120ecf500765a0548
parent9da4123ead51b3ae3fda9489b80378d7e58aa56e
dccp: fix freeing skb too early for IPV6_RECVPKTINFO

In the current DCCP implementation an skb for a DCCP_PKT_REQUEST packet
is forcibly freed via __kfree_skb in dccp_rcv_state_process if
dccp_v6_conn_request successfully returns.

However, if IPV6_RECVPKTINFO is set on a socket, the address of the skb
is saved to ireq->pktopts and the ref count for skb is incremented in
dccp_v6_conn_request, so skb is still in use. Nevertheless, it gets freed
in dccp_rcv_state_process.

Fix by calling consume_skb instead of doing goto discard and therefore
calling __kfree_skb.

Similar fixes for TCP:

a6359d7545b7b8c79e7a76deeb7419e872924efe [TCP]: skb is unexpectedly freed.
934fcb69630acc4738f69c0a5453e488ec3900af tcp: SYN packets are now
simply consumed

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/input.c