From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net v2] udp6: set dst cache for a connected sk before udp_v6_send_skb Date: Mon, 26 Mar 2018 07:48:42 -0700 Message-ID: <9ea39eab-639b-f1cd-8fab-82341ca7b015@gmail.com> References: <1522075727-19860-1-git-send-email-alexey.kodanev@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Eric Dumazet , Martin KaFai Lau , David Miller To: Alexey Kodanev , netdev@vger.kernel.org Return-path: Received: from mail-pg0-f48.google.com ([74.125.83.48]:34541 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbeCZOsr (ORCPT ); Mon, 26 Mar 2018 10:48:47 -0400 Received: by mail-pg0-f48.google.com with SMTP id m15so7360733pgc.1 for ; Mon, 26 Mar 2018 07:48:47 -0700 (PDT) In-Reply-To: <1522075727-19860-1-git-send-email-alexey.kodanev@oracle.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 03/26/2018 07:48 AM, Alexey Kodanev wrote: > After commit 33c162a980fe ("ipv6: datagram: Update dst cache of a > connected datagram sk during pmtu update"), when the error occurs on > sending datagram in udpv6_sendmsg() due to ICMPV6_PKT_TOOBIG type, > error handler can trigger the following path and call ip6_dst_store(): > > udpv6_err() > ip6_sk_update_pmtu() > ip6_datagram_dst_update() > ip6_dst_lookup_flow(), can create a RTF_CACHE clone > ... > ip6_dst_store() > > It can happen before a connected UDP socket invokes ip6_dst_store() > in the end of udpv6_sendmsg(), on destination release, as a result, > the last one changes dst to the old one, preventing getting updated > dst cache on the next udpv6_sendmsg() call. > > This patch moves ip6_dst_store() in udpv6_sendmsg(), so that it is > invoked after ip6_sk_dst_lookup_flow() and before udp_v6_send_skb(). > > Also, increase refcnt for dst, when passing it to ip6_dst_store() > because after that the dst cache can be released by other calls > to ip6_dst_store() with the same socket. > > Fixes: 33c162a980fe ("ipv6: datagram: Update dst cache of a connected datagram sk during pmtu update") > Signed-off-by: Alexey Kodanev > --- > Reviewed-by: Eric Dumazet Thanks Alexey.