From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A59AE46A61A for ; Fri, 16 Oct 2026 09:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792143168; cv=none; b=A9ztEKnq3iGhXm8xZpJtpsYKYLM/wVQqYNOqr54b4B61ewgMRs+Qft7llmTeFM8GoQkqyOvg78zdUWA+r8CBIxNzk+dD/GIe5DhtnEOka7EhEQ0k5UM45w2+NgaPB4vZnovXS8vV9vW+vUpc+cMk+x/avfzXS3PWRAMhUDjdHVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792143168; c=relaxed/simple; bh=Z9Mwbxdb/e66pqI6wraTgavodNtN8iMAFiUVb6k+BFQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sfmAzZPxInwHd4D6lFL+/6pYJTjFQSXtcbUtD+K92YjdSkOsgTbyHKErZ6zx0crRqEAyLaJVah6QfzCAB24xM8xVmpwaH4hqZJYrbHtO4s63M767Ozdipmo5tOZISmqBwmGCRIR+tFmqmvJeAzCqfdWpooqETJZUQVtWSrCiDuA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bHERSdA9; arc=none smtp.client-ip=74.125.82.175 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.b="bHERSdA9" Received: by mail-dy1-f175.google.com with SMTP id 5a478bee46e88-35f036b17easo2163175eec.1 for ; Fri, 16 Oct 2026 02:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792143165; x=1792747965; 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=XHmkv6BikJoFrn087jxAAKsWlqagsvtugyCffrxtj2U=; b=bHERSdA9g4cxrnlEyUlZpv50EfUtdP2CgtywULH7Y86PJg1PkvgbAYKt/r5Akzd5tF xJ0u0rCEoKruYyh4Gjg84HFbYdmPD8VJ02AMCONA/B3DLbI3NrhXC5A2Bx/EKvVEi/ZC v08zwYv1oGveh7VXBAsSl7fBQroVMwetkP1LCx9RfI/r9AMxC0/g7qpIbKp2tSFLeghq tnLm0YTh+06dsOt+Nuru3F22cxusAGVZUqVV5xxX68n5CGpTnKpCIA173KoDijwo4SWr k/A8wq8PGZFlKwLzifwbCWX2FmyWDeKUwsCQNvd5MOaVuXFOGm7ufaJEUettfoYRGz4D watw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792143165; x=1792747965; 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=XHmkv6BikJoFrn087jxAAKsWlqagsvtugyCffrxtj2U=; b=ZvhKMGTzdzA7Xs78pDZw1U+6TUkEobLPQvEsycMNmMJoZUHQL2WEakykQJh7EhU/q7 T2/otXCiZvjY8xlt6itjQIXgfiNxC+BCCeS9BCRziuhSjwhQFNXmrchS//fUh2c90q23 0K2uFHpPY6pJuOuJIyQ1YwXr1HjOIDCtQEblMFWazG2rpw14RJB3o6Kj2IPthhRBu14H p12/buLDseSjbjhAwpDwC9PrBuBkAx+e12iTzWyBMur2PdjRKVgvsskNHMYdTFW6oLRW 9fZTSAUg22BdNYdU5fLnDnFYZafYIeRz6lpLe0NpBHgFyxkps2TQEVyypnd4ydqgqASQ 84FQ== X-Forwarded-Encrypted: i=1; AKwUvBwGeWMgZ9iP453UVQL94yX93oFjPaZKp9LnAVFuqs4BaaKMPe6+zxyupLSRNPuhlCJbAIXHL/ZzGj9IF/I=@vger.kernel.org X-Gm-Message-State: AFq9FYKYufYsVSX93wPr0HOnGwQJZRM9sc+zQG8U36/GJCFKnpVfmHO4 E5Qq7uTeoK+m+tyTgNdH2zzjdUJbKD5bnVtVfUspRL33dj7O8uXX3I6c X-Gm-Gg: AYBFou3RL8F/gMdmib2gezrLhQLGL1YHUj3xSZou6iQagEwvxQkfw6C8icuk4ZcB4DS 7ytH8keBHypGUk5bmXvDFKKpSWQBNYAy9LO/xbW1+pE/5X9Jq0MtNAkfXgcp5V+WLKP+QaMtkEi ziKInXbaCBnTJYW0aqFMZyx1bbRsBbVlafWvwONT0xJCJla2963kFs50r7Qs75lux2MhVgWU7Xj 74/8SNCAn08ylseDmvzfFYJ8zKIedMWDrmWo9wq6YxLC8N/PLAtm9n8OpcR2x0BoaHmcVcFd3eL 81bxHD8h026FwnBFCUUscFpjqeUIdeado9husz/ornufwMt8DRncWtyH8ccxACjTfYqYWVfm+wW eofd3wbFLqZvDeYKRNVscGp0mg3p628qFaMenOt5i6cRL2A7qVZsqcHpleOmRkjGf+Taldz5aXZ YzDKl4AA4dlnjYXVdvyOg10ZlHFXvJHihzurrsDBVAwu7adgIyH/aLlmsA1yN8M+fX544TrKsl5 hWidxA71xrnwPaK/x1h8JY0m1KcoH2MRjXV+Ct+JX4SadBHLXgcnpvmZUcCTbPJAZ2oYcc7jTbH 1cDzWhgutIEvLzOF9v92v3/nBPCzndWJdrEQ66rwURk= X-Received: by 2002:a05:693c:401c:b0:35f:2349:a574 with SMTP id 5a478bee46e88-35f2349e961mr6538038eec.40.1792143164540; Fri, 16 Oct 2026 02:32:44 -0700 (PDT) Received: from ramen-dev-security-2.asia-south1-c.c.ramen-dev-345017.internal (90.156.200.35.bc.googleusercontent.com. [35.200.156.90]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-360820a79c7sm5157172eec.18.2026.10.16.02.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2026 02:32:44 -0700 (PDT) From: Anil Kaushik To: Pablo Neira Ayuso , Harald Welte , Donald Hunter , Jakub Kicinski Cc: "David S . Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Andrew Lunn , Shuah Khan , Stanislav Fomichev , Nicolas Dichtel , osmocom-net-gprs@lists.osmocom.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anil Kaushik Subject: [PATCH net-next v7 2/4] gtp: hold RCU for the device lookup when adding a PDP context Date: Fri, 16 Oct 2026 09:32:23 +0000 Message-Id: <20261016093225.1036375-3-anilkaushikwireless@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20261016093225.1036375-1-anilkaushikwireless@gmail.com> References: <20261016093225.1036375-1-anilkaushikwireless@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit gtp_genl_new_pdp() calls gtp_find_dev(), which looks the device up with dev_get_by_index_rcu(). Since commit e2d1baca2b33 ("gtp: remove useless rcu_read_lock()"), this only runs under the rtnl lock, and kernels with CONFIG_PROVE_RCU_LIST warn: WARNING: suspicious RCU usage net/core/dev.c:1047 RCU-list traversed in non-reader section!! ... dev_get_by_index_rcu gtp_find_dev gtp_genl_new_pdp Hold the RCU read lock around the lookup only: gtp_pdp_add() allocates with GFP_KERNEL, and the rtnl lock keeps the device alive afterwards. Found with the gtp selftest on a debug kernel. Fixes: e2d1baca2b33 ("gtp: remove useless rcu_read_lock()") Signed-off-by: Anil Kaushik --- drivers/net/gtp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 99836b773e5c..15b5d845fc3b 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -2050,7 +2050,10 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info) rtnl_lock(); + /* the rtnl lock keeps the device alive once found */ + rcu_read_lock(); gtp = gtp_find_dev(sock_net(skb->sk), info->attrs); + rcu_read_unlock(); if (!gtp) { err = -ENODEV; goto out_unlock; -- 2.25.1