From: Andrey Ryabinin Subject: Re: [PATCH] net/dccp: fix use after free in tw_timer_handler() Date: Wed, 22 Feb 2017 11:59:03 +0300 Message-ID: <6b21534b-060d-9eac-53f1-7fb3ec448358@virtuozzo.com> References: <20170221112740.661-1-aryabinin@virtuozzo.com> <20170221134332.GA5052@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Cc: "Eric W. Biederman" , Gerrit Renker , "David S. Miller" , , Dmitry Vyukov , Eric Dumazet , Cong Wang , Alexey Kuznetsov , Hideaki YOSHIFUJI , Patrick McHardy , , , To: Arnaldo Carvalho de Melo Return-path: Received: from mail-eopbgr40106.outbound.protection.outlook.com ([40.107.4.106]:47104 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754496AbdBVI6J (ORCPT ); Wed, 22 Feb 2017 03:58:09 -0500 In-Reply-To: <20170221134332.GA5052@kernel.org> Sender: netdev-owner@vger.kernel.org List-ID: On 02/21/2017 04:43 PM, Arnaldo Carvalho de Melo wrote: > Em Tue, Feb 21, 2017 at 02:27:40PM +0300, Andrey Ryabinin escreveu: >> DCCP doesn't purge timewait sockets on network namespace shutdown. >> So, after net namespace destroyed we could still have an active timer >> which will trigger use after free in tw_timer_handler(): >> >> >> Add .exit_batch hook to dccp_v4_ops()/dccp_v6_ops() which will purge >> timewait sockets on net namespace destruction and prevent above issue. > > Please add this, to help stable kernels to pick this up > > Fixes: b099ce2602d8 ("net: Batch inet_twsk_purge") > Cc: Eric W. Biederman > Fixes tag should blame commit f2bf415cfed7 ("mib: add net to NET_ADD_STATS_BH"). It introduced use of net namespace in the timer callback.