Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753391AbcLNATY (ORCPT ); Tue, 13 Dec 2016 19:19:24 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:33141 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbcLNATX (ORCPT ); Tue, 13 Dec 2016 19:19:23 -0500 MIME-Version: 1.0 In-Reply-To: <61c37ca790bc11bc023aea8f9b70ab3098aa30f5.1481626466.git.rgb@redhat.com> References: <20161212100215.GA1305@madcap2.tricolour.ca> <61c37ca790bc11bc023aea8f9b70ab3098aa30f5.1481626466.git.rgb@redhat.com> From: Cong Wang Date: Tue, 13 Dec 2016 16:19:01 -0800 Message-ID: Subject: Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock To: Richard Guy Briggs Cc: Linux Kernel Network Developers , LKML , linux-audit@redhat.com, Dmitry Vyukov , Eric Dumazet , Eric Paris , Paul Moore , sgrubb@redhat.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 564 Lines: 15 On Tue, Dec 13, 2016 at 7:03 AM, Richard Guy Briggs wrote: > @@ -1283,8 +1299,10 @@ static void __net_exit audit_net_exit(struct net *net) > { > struct audit_net *aunet = net_generic(net, audit_net_id); > struct sock *sock = aunet->nlsk; > + mutex_lock(&audit_cmd_mutex); > if (sock == audit_sock) > auditd_reset(); > + mutex_unlock(&audit_cmd_mutex); This still doesn't look correct to me, b/c here we release the audit_sock refcnt twice: 1) inside audit_reset() 2) netlink_kernel_release()