From mboxrd@z Thu Jan 1 00:00:00 1970 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 5C424448D15; Thu, 30 Jul 2026 16:10:57 +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=1785427858; cv=none; b=sa/10hl5nThUDI18IAtbr2Gl9yG/g4D9RkmjCpCxP6a3BsbYsZjGlX8iVJCMnm9Orjc6DHEj6mPqMgW4IF0iUBWAMU3bMtbuKU0BPSrruHfCW9HQVm7Td/D2co+0QN1X++AvF5M5JtATkSp344FKGq2SZKcPMcbMSbWFe/dGQZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785427858; c=relaxed/simple; bh=pXfdkJfYxgHnApj73MHtmtDv4C+hJ09TsJFKSzcvWts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TEISO5qSV9OdZ4Nwb22576f1qwjZ13+DRJ6xcaFxlkG2KDHXwRcsPrb/C8LvYGWcOe5c5Y7RoCClTSzLYP8Bd+OdwbHlusyiFNDGOPj/Hi5nO7OoOzOW0riGnPQ71a0icAVndhhPXcUi9rmxq11L+sQKmwMEmmH9LKtz5IQ6lgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ShhfpRq7; 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="ShhfpRq7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B24861F000E9; Thu, 30 Jul 2026 16:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785427857; bh=ezFNRdEadql6VxmjLrrhOsqNO1T87ChBBmk11wk5bNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ShhfpRq74LQZuQ9/IqonUgQzuj2JQC5IX0V7WjjlMeltM080vDBB3KnRTtawgHQkq 9nyGegWflegM8PSAqjhrht9sfnhMFGp7+lU4nqluWVTnWt1/1ExYI/yEJMAr6q+nIL 0HgtRCAPJ7lchycl7rtq+nphc62/gLTYZPfGPDDM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Breno Leitao , Jakub Kicinski Subject: [PATCH 6.6 316/484] phonet: pep: fix use-after-free in pep_get_sb() Date: Thu, 30 Jul 2026 16:13:33 +0200 Message-ID: <20260730141430.352784531@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141423.392222816@linuxfoundation.org> References: <20260730141423.392222816@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Breno Leitao commit 0f71f852a96af9685858ce59fda34ecbf85c283d upstream. pep_get_sb() doesn't consider that pskb_may_pull() might have relocated the skb data, and continue to access the older pointer, causing UAF. Reproduced under KASAN: BUG: KASAN: slab-use-after-free in pep_get_sb+0x234/0x3b0 Read of size 1 at addr ff11000105510f50 by task repro/157 pep_get_sb+0x234/0x3b0 pipe_handler_do_rcv+0x5f7/0xa10 pep_do_rcv+0x203/0x410 __sk_receive_skb+0x471/0x4a0 phonet_rcv+0x5b3/0x6c0 __netif_receive_skb+0xcc/0x1d0 Refetch the header with skb_header_pointer() after pskb_may_pull(), so the possibly stale pointer is no longer dereferenced. There are better ways to solve this, but, this is the less instrusive one. Fixes: 9641458d3ec4 ("Phonet: Pipe End Point for Phonet Pipes protocol") Cc: stable@vger.kernel.org Signed-off-by: Breno Leitao Link: https://patch.msgid.link/20260721-phonet_get_sb_uaf-v1-1-95fd7881cc4e@debian.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/phonet/pep.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -55,6 +55,8 @@ static unsigned char *pep_get_sb(struct ph = skb_header_pointer(skb, 0, 2, &h); if (ph == NULL || ph->sb_len < 2 || !pskb_may_pull(skb, ph->sb_len)) return NULL; + /* pskb_may_pull() may have reallocated the head; refetch ph. */ + ph = skb_header_pointer(skb, 0, 2, &h); ph->sb_len -= 2; *ptype = ph->sb_type; *plen = ph->sb_len;