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 6F7C7303C97; Mon, 17 Aug 2026 14:10:47 +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=1786975848; cv=none; b=a8fpT6gmA/0j2BWIzC5z+9eQyObVhhmtt8C7YdBIWtvERf5Dh86J3wvy5ZSYD6ESHbw5YjS/s0WbW2y1avAJldicn2m+TNo/5vakxMF8IqCjb4rso6WnprGlZvRMmQU7lMPGnYutXL3anclsS+00IzgjM0tGXUFgRBUqWuLlfAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975848; c=relaxed/simple; bh=T4NEz0vjusVF2TIDf4mRGgPGPm8YJGPIF7BmCjPDWyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ozpH2S4Eoz5Er8AiHR4SvlLQWJTKiJ8pePkL7PRuKiWzik/x/D9vE3QyDoNDoe5PNoSLk3hojaa5rFDRlZ51KSZ5OSSMOtmxP4y3kA3Q37Aj/pofFn0r+OOEEy5LSeAVa0SZmVYXB2UohaH/8fgdRXBBOWH0GnMoTD1sMPVMRyM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LbJZmyrx; 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="LbJZmyrx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9AD91F000E9; Mon, 17 Aug 2026 14:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786975847; bh=P9hMcrw5X3VnmzhOn+TDUajuJoKfHfX2yvts8Cg2jTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LbJZmyrxKsVrTGYJx+AgQtGuQR8ne4cm7qDvsHU4/4QmmpWIRJWUB6qIYv5J92Zfd Nj13zzy9Jxj9f8g3gmrtf3enPZOn/jxfJb5kk8Ef/FaIhe+I7RoZQOWpg8K+trs6Dw Giimc687LhCCcwKiF+pGRb4L5WRmvA5TwpDPrpxY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Breno Leitao , Jakub Kicinski Subject: [PATCH 5.10 169/389] phonet: pep: fix use-after-free in pep_get_sb() Date: Mon, 17 Aug 2026 15:30:08 +0200 Message-ID: <20260817132545.768485452@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132538.796021292@linuxfoundation.org> References: <20260817132538.796021292@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 5.10-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;