From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796544120; b=RbE3m5rGbCdG6UYcx1NmZLZpLRJuQJTMR2ibL26BOzleHTNJE0SDLKEV190VsCmS5fN0 YdMw+hiNo85rv5RjJrC+Bqn6qYuwbCknwxZfBMExObzt0V2GhFvKhX9ITi/ujdBtOJMPA 0atE4CZJpaT1cIaIFQnqIvPyHjWydAT4TxZqEfcoSssshMvYlS1AfY211p7FLKIwoBPwq xoTgHmrUUnE8eOvWjgPyK7XN39Uq8b/hlZzb+0JmU5RiZYoFlQpTBe3cmhfUJIfnwUMkj Cf+Q5KRwmJjkdJh2B/VXnc7v1svj2/pt2084ReFkd4fcYi2B8qOxSOVaEz4ow6gbcAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796544120; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=NuzQcjQpvgXrXhLoINptnPfmwZDF3449vXOo14ZxEyc=; b=QOb95nd6jUadTws95NDr4ZMH0eTD1WdPMuJ9l3dIMuWw/nP8whpgc8I/gjVVOiHRRQOb PJNokbb240hI5+RrC08oDYSkvXcLZnzXlJlKQnbojjMDxH7WxIXyBjcGrwXmX3wxM24PT aqyj3JX/7cSOgsjl34tPxl6W2Xd5bNWHbOUuemPyIuAMMgVq0LANqOfDvKkHIF+HmwGvQ /ZEqdLT2UpUo6dcwCno8QElhH+0CoQ63NZn73rjfVcBcz0kYTjQnCQAgQ45kyMOtlKxG/ dlTZ5pLaRCxdvx/I8R36uI7A09I8+5NT83pHXRWQmztsPAWbbjtTcOpV+As3oJ0Soyw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BY6ziIzn; arc=none smtp.remote-ip=74.125.82.175 Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE14606A322 for ; Sun, 6 Dec 2026 08:01:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DDE14606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BY6ziIzn Received: by mail-dy1-f175.google.com with SMTP id 5a478bee46e88-3874cf36e63so3467784eec.0 for ; Sun, 06 Dec 2026 00:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796544119; x=1797148919; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NuzQcjQpvgXrXhLoINptnPfmwZDF3449vXOo14ZxEyc=; b=BY6ziIzn55X1dkeQwj7H6Wt8fiOFynjHAeEOoxGNYV5kvC1hBvwfNMrSAE69FA4VGY k5zOljm2CZxjlOpipm6RVhodjwu0gRvoUS07gnTs+N6MN2S2BeoCQv8VfRTVuMFbgmnv GMFzod5zHB8bokBJE9BBBH823q4G/mxRATNgZV/lTLTXgOTqLFais1PzcRj3XnWG5ijY ez5pOOaKnszLNQBKy3PFe7utp5s/pypBonPNV7ESreo+88yJ1SclnUz4Akhat8e1rPne bN6wW1hWm/veRFdrJMJ+rRPK5UpL45F3Ek0YD77LjpUcifsq/SLT1u/44wSjG6xlueOY aHvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796544119; x=1797148919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NuzQcjQpvgXrXhLoINptnPfmwZDF3449vXOo14ZxEyc=; b=p/SZZGXdHuQKvya2/guE0rKvSqTC5v0vrvt1P9IkvPl46tNRlg8qZ7CoW8oJ5NhbXD Kj5kRSquiT7JtvpbxvdFDUaAKFXcbkcGnCcxgLMrW7Ay1CVmvshwEELO9CE2z8EABCGV hymTt67apUtIukCFgNQoQkT43eVoULwXCspttNtymTyUaIsUli9W36ifYJ4fix1B7MeE CAf7hM1yACZdGqAWvgKMfoIkioOvhoabGrjGT64wDfIh2G9g4J7nmuqwc/XXSHiJISHj uQy2cbSpOrUUi+bQp2EZ0ZKuGdTHduW+SxZGD2kbV1OoYenMCwuNeDY8YVXquopV+A06 K5UQ== X-Forwarded-Encrypted: i=1; AL+hErEdVLb6xB9uXCWw2fPPFYrV62R4KFVCaz3EtppynlbcTULYN7iT6EFI6TAuJF2VblkXCgY6lDk=@vger.kernel.org X-Gm-Message-State: AB4q+uFlC+RdvLZ2+DKcADIIX02pJyiRVPeahUDUGRDEO9BiacqVL+1h Ssd5FJRZW1ju5xbc7RXxZobYUbWBDjoyihpSZSy0HAmuegQYQYIhmLjq X-Gm-Gg: AZFdTZdQ9P+GT6UY5PzAkey/n9sBn3CTHSP5C30Rsdu4sj+Fp4sqFqeLU3RVW58UspH YmMg8gpoU8so6VBCtqsItv0ZkNn3dPHM76Vn+CpsCaqftgTDaltYNS+pN5os9dyLdeUe4E0vp8g CPZ6JzV8k1BtSeUg1Vo+LnMOGXPq/MMPZ8BWQnR5LYBhw24jI+DvmkS8NXrkBru765OQzD5znf+ NvAVfYZCBFMx+Vh1mgLvWyxiAeRHo2e/gcO/Ob+czXeUcOkfaAnI9TP5c5G/8npBo/0eORuuv13 URbUbUrJ9i/xkmT6tzq+1WTNmZq9zmX4S6V2bg5mMGNNlKWtt1tAnf2xwcLSz2PQj9GEkaxjwjX 8XJIiY1tnoAuIpJVGyRFsEzfGErF5vHFRyoRSXep9P7haJtHc9IaYASaIXrGsk2I9+h1kh0/DJ8 SQNMk2Ji6sv7BUtQYnSOI1lauR3HBYeWl9JzrTV/tr10ZsNbaWQQ9ksbpF40pixR+0WxD5Xm/kN KcXHzLrCEYkNqXs5rlYcrDNaBwuQw/h0estzw9jg79PQX25i5VAQhVarUedsx8AReRgaHJ/mYKp QaQm10f1c6lg/JJq4cI= X-Received: by 2002:a05:7300:d215:b0:386:bc40:1508 with SMTP id 5a478bee46e88-387520ee54emr7158300eec.14.1796544118821; Sun, 06 Dec 2026 00:01:58 -0800 (PST) Received: from fox.. ([43.242.224.196]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875218c602sm38935351eec.7.2026.12.06.00.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Dec 2026 00:01:58 -0800 (PST) From: Roshan Kumar To: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, Miquel Raynal Cc: Alexander Aring , Stefan Schmidt , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yousef Alhouseen , syzbot+4707bb8a43a42fca2b97@syzkaller.appspotmail.com, syzbot+8a8482d4c33cc58babb4@syzkaller.appspotmail.com Subject: [PATCH net v2 1/2] ieee802154: hwsim: free PIB after unregistering hardware Date: Sun, 6 Dec 2026 13:30:35 +0530 Message-ID: <20261206080036.2769662-2-roshaen09@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261206080036.2769662-1-roshaen09@gmail.com> References: <20261206080036.2769662-1-roshaen09@gmail.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Yousef Alhouseen hwsim_del() queues the currently published PIB for RCU freeing before unregistering the hardware. The unregister path can still invoke driver callbacks, including set_promiscuous_mode(), after that grace period has started. Depending on timing, a callback can consequently dereference the freed PIB or queue the same object for RCU freeing twice. Unregister the hardware first, then fetch and free the final PIB. This also handles a PIB replacement performed by a callback during unregister. Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb") Reported-by: syzbot+4707bb8a43a42fca2b97@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=4707bb8a43a42fca2b97 Reported-by: syzbot+8a8482d4c33cc58babb4@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=8a8482d4c33cc58babb4 Cc: stable@vger.kernel.org Signed-off-by: Yousef Alhouseen Signed-off-by: Roshan Kumar --- Changes in v2: - move the final PIB lookup and free after ieee802154_unregister_hw() - use rcu_access_pointer(), as requested by Miquel - correct the Fixes tag to f25da51fdc38 - rebase on wpan.git commit bc10f5da3e77 - preserve Yousef's authorship and existing sign-off while forwarding - complete 200 KASAN teardown race rounds after both patches, with no sanitizer findings - complete targeted W=1 allmodconfig and allyesconfig builds, with no hwsim diagnostics v1: https://lore.kernel.org/r/20260627235805.17310-1-alhouseenyousef@gmail.com/ drivers/net/ieee802154/mac802154_hwsim.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index a9bd1555d2dc..fc2b7415afec 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c @@ -1008,12 +1008,11 @@ static void hwsim_del(struct hwsim_phy *phy) list_del_rcu(&e->list); hwsim_free_edge(e); } - pib = rcu_dereference(phy->pib); rcu_read_unlock(); - kfree_rcu(pib, rcu); - ieee802154_unregister_hw(phy->hw); + pib = rcu_access_pointer(phy->pib); + kfree_rcu(pib, rcu); ieee802154_free_hw(phy->hw); }