From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7B59025E805; Tue, 11 Mar 2025 15:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706967; cv=none; b=dF/4ZhnZNv8rAmzifNdwpy0p7AiZ4Z/fJU+x3GaANiE3b1viu3ojSlB5C2Ks4sYOkLWnKEBjZIixv/+8rNQbBl159NY9Fv1F+d8wS7pY+xJYxCtJpdBTODO48hNOw9MDV2knTKefOcuhFN/sNgsGZUtGGTHqXvl7DwWoHqw/4rU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706967; c=relaxed/simple; bh=ED0qwcR7OnJprToxTBaU01qh/5A0IKt/645y6013/LQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WgcSMOa0WJ/pIKaveQXyFe7CmrIO4uBNI0C5hB9HGZvyaRLJ8ti80hZjPI45zz6g3uCNprf2zgDAeaAI9vL6Sn4B8YlhlfLyFnvbe/HlYWq9SVM9cr6HU9MOuxv9bHZllikWnRK/US+bhXxrNqj0NmXABpeaKvrwX7/V4lT4QPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NEE3ZccT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NEE3ZccT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01C50C4CEEA; Tue, 11 Mar 2025 15:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741706967; bh=ED0qwcR7OnJprToxTBaU01qh/5A0IKt/645y6013/LQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEE3ZccTpPqXTIotAzHMmi3xMgShAb/Dm61E3V/KnfkizP6/UtnhhGRMZSX2UVolO MEoq+pwQDXpcleIPhpGFP1x05K/hjasJwtIFfU6E3sKwqPs4odZEojHk6/RSSFRPnd ilU47ynqc2IvDtElCjf1XElheN0bbpSoXrIfX6h8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , David Ahern , Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 229/462] vrf: use RCU protection in l3mdev_l3_out() Date: Tue, 11 Mar 2025 15:58:15 +0100 Message-ID: <20250311145807.410404255@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311145758.343076290@linuxfoundation.org> References: <20250311145758.343076290@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 6d0ce46a93135d96b7fa075a94a88fe0da8e8773 ] l3mdev_l3_out() can be called without RCU being held: raw_sendmsg() ip_push_pending_frames() ip_send_skb() ip_local_out() __ip_local_out() l3mdev_ip_out() Add rcu_read_lock() / rcu_read_unlock() pair to avoid a potential UAF. Fixes: a8e3e1a9f020 ("net: l3mdev: Add hook to output path") Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20250207135841.1948589-7-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/net/l3mdev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h index 031c661aa14df..bdfa9d414360c 100644 --- a/include/net/l3mdev.h +++ b/include/net/l3mdev.h @@ -198,10 +198,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto) if (netif_is_l3_slave(dev)) { struct net_device *master; + rcu_read_lock(); master = netdev_master_upper_dev_get_rcu(dev); if (master && master->l3mdev_ops->l3mdev_l3_out) skb = master->l3mdev_ops->l3mdev_l3_out(master, sk, skb, proto); + rcu_read_unlock(); } return skb; -- 2.39.5