android_kernel_xiaomi_sm8350/net/dccp
Gerrit Renker 82709531a8 [DCCP]: Fix Oops in DCCPv6
I think I got the cause for the Oops observed in
http://www.mail-archive.com/dccp@vger.kernel.org/msg00578.html

The problem is always with applications listening on PF_INET6 sockets. Apart
from the mentioned oops, I observed another one one, triggered at irregular
intervals via timer interrupt:

    run_timer_softirq -> dccp_keepalive_timer
                      -> inet_csk_reqsk_queue_prune
                      -> reqsk_free
                      -> dccp_v6_reqsk_destructor

The latter function is the problem and is also the last function to be called
in said kernel panic.

In any case, there is a real problem with allocating the right request_sock
which is what this patch tackles.

It fixes the following problem:
 - application listens on PF_INET6
 - DCCPv4 packet comes in, is handed over to dccp_v4_do_rcv, from there
   to dccp_v4_conn_request

Now: socket is PF_INET6, packet is IPv4. The following code then furnishes the
connection with IPv6 - request_sock operations:

   req = reqsk_alloc(sk->sk_prot->rsk_prot);

The first problem is that all further incoming packets will get a Reset since
the connection can not be looked up.

The second problem is worse:
 --> reqsk_alloc is called instead of inet6_reqsk_alloc
 --> consequently inet6_rsk_offset is never set (dangling pointer)
 --> the request_sock_ops are nevertheless still dccp6_request_ops
 --> destructor is called via reqsk_free
 --> dccp_v6_reqsk_destructor tries to free random memory location (inet6_rsk_offset not set)
 --> panic

I have tested this for a while, DCCP sockets are now handled correctly in all
three scenarios (v4/v6 only/v4-mapped).

Commiter note: I've added the dccp_request_sock_ops forward declaration to keep
               the tree building and to reduce the size of the patch for 2.6.19,
               later I'll move the functions to the top of the affected source
               code to match what we have in the TCP counterpart, where this
               problem hasn't existed in the first place, dumb me not to have
               done the same thing on DCCP land 8)

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2006-10-21 19:55:20 -07:00
..
ccids [DCCP]: Use constants for CCIDs 2006-09-24 18:03:41 -03:00
ackvec.c [DCCP] ackvec: Remove unused variables 2006-09-22 15:19:09 -07:00
ackvec.h [DCCP] ackvec: Remove unused variables 2006-09-22 15:19:09 -07:00
ccid.c [DCCP] CCID: Improve CCID infrastructure 2006-03-20 19:21:44 -08:00
ccid.h [DCCP] options: Make dccp_insert_options & friends yell on error 2006-03-20 22:32:06 -08:00
dccp.h [DCCP]: Introduce tx buffering 2006-09-22 15:18:17 -07:00
diag.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
feat.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
feat.h [DCCP]: Shift sysctls into feat.h 2006-09-22 15:18:16 -07:00
input.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ipv4.c [DCCP]: Fix Oops in DCCPv6 2006-10-21 19:55:20 -07:00
ipv6.c [DCCP]: Fix Oops in DCCPv6 2006-10-21 19:55:20 -07:00
ipv6.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
Kconfig [DCCP]: Introduce dccp_probe 2006-09-24 18:08:17 -03:00
Makefile [DCCP]: Introduce dccp_probe 2006-09-24 18:08:17 -03:00
minisocks.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
options.c [DCCP]: Update contact details and copyright 2006-08-26 19:01:30 -07:00
output.c [DCCP]: Introduce tx buffering 2006-09-22 15:18:17 -07:00
probe.c [DCCP]: Introduce dccp_probe 2006-09-24 18:08:17 -03:00
proto.c [DCCP]: Allow default/fallback service code. 2006-09-24 17:49:26 -03:00
sysctl.c [DCCP]: Shift sysctls into feat.h 2006-09-22 15:18:16 -07:00
timer.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00