Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2646075rdd; Fri, 12 Jan 2024 17:22:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVkt4ai59BTXu76vzMG5hrtOu2A9NNVlq+bckZd9FCZPy5CYBMznOWluUkaBb54NJz9eII X-Received: by 2002:a05:6214:1315:b0:681:23e0:5320 with SMTP id pn21-20020a056214131500b0068123e05320mr2047522qvb.31.1705108952160; Fri, 12 Jan 2024 17:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705108952; cv=none; d=google.com; s=arc-20160816; b=Tk44JsFMz/8P9Wk4AFOujtDXMP7fdyorHGpJJ4obcXQ55vs7RSBW1gLkzEXYs4e0eV mDBkFTmJjprDCqS2J1fHdQHen4KJNiudzyT4jzxAps+nzNUzFnHSRkyDtpszy/TOvX4F KK9L5KNICfzsSdzlEZNWeZwlg0v9yV23ls+Bpy5iZm0ajoBxLk1lYXCbNXWfVO2n72W0 eE6MxPdVsUaTWiQQYFjk5NQnMFqbVOtKHxORhJcmnJHMVC2fGNtQi8Yf155wdF309ma5 7k2dGrRvs/yu1mzSoHoh3QhDLu8bWijIPduh8bUQT9oRrWxl07VUSGV00CwptMaeKwqm WbYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=0Ctx+/zmCcVG6P4rZ04GNVj1+tQXzo6XO+o7DACNcLo=; fh=XwLEJ0qdoxBRTcTu3fetdunu0G7wpnFq1jUPX55ozZ4=; b=n3jAlmVaenN7yiSM110OcQ08U1JanST2I40nsLb+SSXVyVHUg/2RriBBAixT3zA9Bx KFgrjf/eFQIGQ/ed3uD7BMMc1O/zwepD9hNDrBLPsCUWwXo+XQjIU1VP304u6nD57An4 fQYwCHroWUO7rUvkbL3BVeQm6gRN/OjKKB6nmv9AL1zpNzlb+YnY5Y+v4jh9mdkzXFXp XXHxS8gGboosR9ej1wt95AxKIz0uSzU23VPQXwth/pzQpO2RMh3UhHZxGpNkSITdjZ+T fuOkHtgzu3HgDRhNzRglPCqzOiorCG+aNT0gtyx17fhhlpYySWRg2b0Gacd1KwSX+fdA rCzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pappasbrent.com header.s=default header.b="QcbN3/tm"; spf=pass (google.com: domain of linux-wireless+bounces-1854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1854-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d19-20020a05620a205300b0078322a5d4a0si3971414qka.473.2024.01.12.17.22.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 17:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@pappasbrent.com header.s=default header.b="QcbN3/tm"; spf=pass (google.com: domain of linux-wireless+bounces-1854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1854-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8BA211C22AA6 for ; Sat, 13 Jan 2024 01:22:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B30E911196; Sat, 13 Jan 2024 01:22:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pappasbrent.com header.i=@pappasbrent.com header.b="QcbN3/tm" X-Original-To: linux-wireless@vger.kernel.org Received: from h5.fbrelay.privateemail.com (h5.fbrelay.privateemail.com [162.0.218.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98D41134C2; Sat, 13 Jan 2024 01:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pappasbrent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pappasbrent.com Received: from MTA-10-4.privateemail.com (mta-10.privateemail.com [198.54.118.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by h5.fbrelay.privateemail.com (Postfix) with ESMTPSA id B138B60562; Sat, 13 Jan 2024 01:14:49 +0000 (UTC) Received: from mta-10.privateemail.com (localhost [127.0.0.1]) by mta-10.privateemail.com (Postfix) with ESMTP id E443E180020E; Fri, 12 Jan 2024 20:14:40 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pappasbrent.com; s=default; t=1705108481; bh=5tLeUjD4Wuj2pnMpbrqMQhIri6Cryus27QrLloXWnoE=; h=From:To:Cc:Subject:Date:From; b=QcbN3/tm2Mzp1wE86PFCzJsLp8ocsCOFrvclQrhYXpGSYMFuMcvh5Hcl7VqAZ7Cc+ aAel++fm523ubqNQ3B13GH33fzD4tydNS3woLkLuvXHjYQZOMyzdhxXuIUKUPncqhV jEz4pHOSNjWR5LYlJOIXMmDTz6bCNOkDdmNXm6L6UoD41wC0BB7xbs4KHFgJDtUXBX BrizwHfnjtfM3m7rD3k+WrsSWsf7q4R62lOGrWaKZfCt/FLidHWkdme37WDtGhhQea QtH7sXMOlNVFfbOCFD/KmB/t9CPXKKF5HkVv3RBlafVAfH9/2Ev3m+LGItkigT2Rv6 tSCasZnAe62EQ== Received: from bpappas-XPS-13-9310.cfl.rr.com (050-088-208-203.res.spectrum.com [50.88.208.203]) by mta-10.privateemail.com (Postfix) with ESMTPA; Fri, 12 Jan 2024 20:14:30 -0500 (EST) From: Brent Pappas To: Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Brent Pappas , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] wifi: mac80211: tx: Add __must_hold() annotation Date: Fri, 12 Jan 2024 20:11:45 -0500 Message-ID: <20240113011145.10888-2-bpappas@pappasbrent.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Annotates ieee80211_set_beacon_cntdwn() with a __must_hold() annotation to make it clear that ieee80211_set_beacon_cntdwn() is only intended to be called when the caller has a lock on the argument "link." Signed-off-by: Brent Pappas --- Currently, ieee80211_set_beacon_cntdwn() calls rcu_dereference(), but without calling rcu_read_lock() beforehand and rcu_read_unlock() afterward. At first I thought this was a bug, since (if I understand the RCU API correctly) rcu_dereference() should only be called in RCU read-side critical sections. However, upon closer inspection of the code, I realized that ieee80211_set_beacon_cntdwn() is only ever called inside critical sections. Therefore it seems appropriate to me to annotate ieee80211_set_beacon_cntdwn() with a __must_hold() annotation to make this apparent precondition explicit. This is my first time submitting an RCU-related patch so please tell me if I am misunderstanding the RCU API. net/mac80211/tx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 314998fdb1a5..7245f2e641ba 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -10,6 +10,7 @@ * Transmit and frame generation functions. */ +#include "linux/compiler_types.h" #include #include #include @@ -4974,6 +4975,7 @@ static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, struct beacon_data *beacon, struct ieee80211_link_data *link) + __must_hold(link) { u8 *beacon_data, count, max_count = 1; struct probe_resp *resp; -- 2.43.0