From owner-svn-src-all@freebsd.org Sun Jan 20 14:02:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FF0A1490E4C; Sun, 20 Jan 2019 14:02:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC75097809; Sun, 20 Jan 2019 14:02:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id A3847165FB; Sun, 20 Jan 2019 14:02:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 52D878D4A142; Sun, 20 Jan 2019 14:02:12 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 61A05D211B6; Sun, 20 Jan 2019 14:02:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 4fJ27fBLmUuv; Sun, 20 Jan 2019 14:02:09 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:2ef0:eeff:fe03:ee34]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6D10CD1F85E; Sun, 20 Jan 2019 14:02:09 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Andriy Voskoboinyk" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r343213 - in head/sys: net80211 sys Date: Sun, 20 Jan 2019 14:02:08 +0000 X-Mailer: MailMate (2.0BETAr6134) Message-ID: <64B0B511-D3A0-4034-B602-2C3956669D58@FreeBSD.org> In-Reply-To: <201901201339.x0KDdICk003155@repo.freebsd.org> References: <201901201339.x0KDdICk003155@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DC75097809 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2019 14:02:15 -0000 On 20 Jan 2019, at 13:39, Andriy Voskoboinyk wrote: > Author: avos > Date: Sun Jan 20 13:39:18 2019 > New Revision: 343213 > URL: https://svnweb.freebsd.org/changeset/base/343213 > > Log: > net80211: resolve ioctl <-> detach race for ieee80211com structure > > Since r287197 ieee80211com is a part of drivers softc; as a result, > after detach all pointers to it (iv_ic, ni_ic) are invalid. Most > possible users (tasks, interrupt handlers) are blocked / removed > when device is stopped; however, ioctl handlers were not tracked > and may crash if ieee80211com structure is accessed. > > Since ieee80211com pointer access from ieee80211vap structure is not > protected by lock (constant after interface creation) and used in > many other places just use reference counting for ioctl handlers; > on detach set 'detached' flag and wait until reference counter goes > to 0. So how do any cloned interfaces do this (wifi or non-wifi)? Is this a more general problem or are some wifi drivers just not exactly careful with the order they take things down? On another note, why would refcount(9) not be sufficient? I didn’t really like the MC() macros and the hand crafted state machine for a refcount when scrolling through. /bz