Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6BFF639A7FD; Tue, 21 Jul 2026 18:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658575; cv=none; b=ZjfoY+kVxEnijp0tQSf0X6kcv1HFxwjdamt9XmR5boqJYH3OTrGBYGkXUsZfKV4Hwj3FrJh4IHCzMx6OkPr4GJg8d2l87A5hYr30sVehN+9A41d/IXgWtZlFstMs2dCa1uC2B4ttDqDlvw1SnXYajjMSE+TgHU78q2TGaKBUtn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658575; c=relaxed/simple; bh=z2nSxu1R9M4FFqYNVriY4Gl5WxZ1Gn0lnrdxeeTPnBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XrQHDT50HppJ1rb0bjEhObGs+vZkEcPHtohLF9VyhJ43+9C7ZY6iT6Fakn6Xpuq72yO+135SWgjBhFK6h30B1sxV4v09ehsUx89LI+dbXEjIVYT8MvpDf4qh6nib3Xume55lW74xIhx20SRhdvFolM+Dh9YjPXQPjyoZ82pMDQE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=li1Euj4n; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="li1Euj4n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2D6C1F000E9; Tue, 21 Jul 2026 18:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658574; bh=e3LjRqtlZAguVKiC442dXvdTAQH29bZjPNnxYTxNiq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=li1Euj4n/bupOQlHywnRp8TS0S4yDZdN0m8q5aYjCUxrY6xWdUnQQnXP6/uQRUUIN 5icB+osJZL4SDBqN8I55OJybdfr98AN2RLl6wC+P+j77hq3pfAJ6NOV2X7cBbooKfD wUG7c9+HLpgeNjH03D9I5scu/1a7jTaIdUM2A48s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sven Eckelmann Subject: [PATCH 6.18 1194/1611] batman-adv: gw: acquire ethernet header only after skb realloc Date: Tue, 21 Jul 2026 17:21:50 +0200 Message-ID: <20260721152542.288407492@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 77880a3be88d378d60cc1e8f8ec70430e2ed0518 upstream. The pskb_may_pull() called by batadv_get_vid() could reallocate the buffer behind the skb. Variables which were pointing to the old buffer need to be reassigned to avoid an use-after-free. Cc: stable@vger.kernel.org Fixes: 6c413b1c22a2 ("batman-adv: send every DHCP packet as bat-unicast") Signed-off-by: Sven Eckelmann Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/gateway_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c @@ -683,12 +683,13 @@ bool batadv_gw_out_of_range(struct batad struct batadv_gw_node *gw_node = NULL; struct batadv_gw_node *curr_gw = NULL; struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo; - struct ethhdr *ethhdr = (struct ethhdr *)skb->data; + struct ethhdr *ethhdr; bool out_of_range = false; u8 curr_tq_avg; unsigned short vid; vid = batadv_get_vid(skb, 0); + ethhdr = (struct ethhdr *)skb->data; if (is_multicast_ether_addr(ethhdr->h_dest)) goto out;