Received: by 10.192.165.148 with SMTP id m20csp838148imm; Fri, 27 Apr 2018 08:17:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZod1SfZQ2pvqxxPv8DTu6T7gI0PLZ0f9/SNHqnA9I/mo17ajZWcck6P/wx47dug3WmMEHo6 X-Received: by 2002:a65:4c4f:: with SMTP id l15-v6mr2489387pgr.61.1524842275617; Fri, 27 Apr 2018 08:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524842275; cv=none; d=google.com; s=arc-20160816; b=HadqqcyJRFoSinliZpmmd+Q4BZV5cTRNoMM/5Kx2dg9rqPVlmfPO02OyFvUhiTs8Wb /M6bjtHQYRqTTHn0/LHsGbWvjwb9QCUelnwZfQosGb+dwmid9QPrcsuos81eZCx2ogch glPQ2YzyYAcW/FekisKpBGMebhEWURCFamhsWjbh5BYqBfRhW43ruSGTSSTFOoDCSvaE mLwvigRo0CPAn6jxNvBP+H4Koms0fKPffc2gj9ZKhZaQvoy+11ITDNY8t6xg5GHNSGrS v+EEBydvtWz2GyMNKO4mYh84iGoUGLs50W9mNSp7hwk/g4b6Fbbualhjmo4L5TgFjXak hPGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=EFf20u+oJLp7fhIzgy77S/b6Vu2PP9ki365FnlyfW/s=; b=EyLqKjdR0ipQFoxve/XVdzwib9B9nGEAX7OH6PXP0emT7hOeOddNh3kU2IaZZUrgF+ Xu65geDpLnjiwlqI472IZWDwtmTLYnyZLVy8pZTibWqK0sOoWcQQCUkNNjk6jHPNQMw4 Z6ngDd0NNdHwVzUwFClO12ey0EIzwdKWdC4CNimzvS735Vzo55DrY6GbZ4xllxwBPmZl qxoUPxuEbVzM2cH7VJ6KKKbN49MLhvVwW+04fAmfGjs9IZhJSepQC4pEB0AKeKMhtqW4 uQQPKhsM7Kqf4fBTkLEfVbEH2XwFS6suiNCMVdsZ81A4TxY1KbrhFAKTTUcEb10bCSdi pIMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i64-v6si1367655pgc.323.2018.04.27.08.17.41; Fri, 27 Apr 2018 08:17:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933517AbeD0OD0 (ORCPT + 99 others); Fri, 27 Apr 2018 10:03:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:49970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932686AbeD0ODY (ORCPT ); Fri, 27 Apr 2018 10:03:24 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 32451218A5; Fri, 27 Apr 2018 14:03:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32451218A5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+70ce058e01259de7bb1d@syzkaller.appspotmail.com, Benjamin Beichler , Johannes Berg Subject: [PATCH 4.9 23/74] mac80211_hwsim: fix use-after-free bug in hwsim_exit_net Date: Fri, 27 Apr 2018 15:58:13 +0200 Message-Id: <20180427135710.854308792@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135709.899303463@linuxfoundation.org> References: <20180427135709.899303463@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Beichler commit 8cfd36a0b53aeb4ec21d81eb79706697b84dfc3d upstream. When destroying a net namespace, all hwsim interfaces, which are not created in default namespace are deleted. But the async deletion of the interfaces could last longer than the actual destruction of the namespace, which results to an use after free bug. Therefore use synchronous deletion in this case. Fixes: 100cb9ff40e0 ("mac80211_hwsim: Allow managing radios from non-initial namespaces") Reported-by: syzbot+70ce058e01259de7bb1d@syzkaller.appspotmail.com Signed-off-by: Benjamin Beichler Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3346,8 +3346,11 @@ static void __net_exit hwsim_exit_net(st continue; list_del(&data->list); - INIT_WORK(&data->destroy_work, destroy_radio); - schedule_work(&data->destroy_work); + spin_unlock_bh(&hwsim_radio_lock); + mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy), + NULL); + spin_lock_bh(&hwsim_radio_lock); + } spin_unlock_bh(&hwsim_radio_lock); }