sctp: do not mark sk dumped when inet_sctp_diag_fill returns err
authorXin Long <lucien.xin@gmail.com>
Fri, 15 Sep 2017 03:02:48 +0000 (11:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Sep 2017 21:51:15 +0000 (14:51 -0700)
sctp_diag would not actually dump out sk/asoc if inet_sctp_diag_fill
returns err, in which case it shouldn't mark sk dumped by setting
cb->args[3] as 1 in sctp_sock_dump().

Otherwise, it could cause some asocs to have no parent's sk dumped
in 'ss --sctp'.

So this patch is to not set cb->args[3] when inet_sctp_diag_fill()
returns err in sctp_sock_dump().

Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/sctp_diag.c

index 7008a992749bf62aa155c52a45e04609c43c1cac..22ed01a76b19cbd8af715f9a31f5c2d39312ce74 100644 (file)
@@ -309,7 +309,6 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
                                        cb->nlh->nlmsg_seq,
                                        NLM_F_MULTI, cb->nlh,
                                        commp->net_admin) < 0) {
-                       cb->args[3] = 1;
                        err = 1;
                        goto release;
                }