Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1472392rwj; Sun, 18 Dec 2022 08:51:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CjfvuDk0B6wq8s/Pu3doaq9Ea9Ajr91pBOkMftURvvqVbvVBsqXyjGIK1G3i31X6H8KYY X-Received: by 2002:a17:906:f214:b0:7c0:f459:d09c with SMTP id gt20-20020a170906f21400b007c0f459d09cmr32263572ejb.16.1671382289925; Sun, 18 Dec 2022 08:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671382289; cv=none; d=google.com; s=arc-20160816; b=WN/BFzCe2cXEg4MR0Gn/IPhNG1FHZf1mZS321lTEiC5hP7wzA2Ygi5WqZ75kLMgzJG TyvaG8K7JGjwpm+BAx3En5HM3tEMudGY/z6+DNjlCmj9Ui9EGbwPtxKkPdwm+pshNICr rQ0Wg4lHSptNm/5LwKOjbSn+mL+BV7a03FpUmtd8+BjkABqvdX8K/y7TWjlR4xAHBgp0 8XD7r9m+0iaoo0BYF6hSG+JqIazDMLQ6OOJHUcz3rdB0/BGw+nd7njCdF6jTyNq+2mjb fPqX3KZ/thgDOawbcxbCjQNg9rV03nofrXXtfFGldzOuEaS5zhGNN9kEopoaBlqcRAfJ HCUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+fAsoGTAKBjyzI8Dd0cQvyjSOT1q8toKnEKaS58Ic/8=; b=w7EO+e2RqNaZ+vNrfrkbIuAJc35+Zoz4r2YO3aBj24QUIF8ERoN41Bt+VyiejxtU8h 6HdXs4/px/5qSTBiAV+o6dUT/TW/bCLfyqzodY9dki4CHYchfIFMGDRzY1KJDzz7sBB4 ygaoxxCfHdi1tSdm+T+PA6/4AXxccZCsla2kHmyftdVOvNAjMbZ247AYXHCuMGknRw6z BJguDvuuWqL29sOadVczt/Y2kIBC9T8pk79REbdU1I7nPTTzoTjkaWzJ3I/Xw5cg4KPM H5/XUGLJHO+M2eYlxMUxQ9Mi3X1rqW4Dt+5V70WfkElknbAVplnZOAS2+G/gZLHYg6Gz BtYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KTi9dNvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa16-20020a170907869000b007c500a2f33asi8012758ejc.208.2022.12.18.08.51.13; Sun, 18 Dec 2022 08:51:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KTi9dNvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiLRQmw (ORCPT + 70 others); Sun, 18 Dec 2022 11:42:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbiLRQlV (ORCPT ); Sun, 18 Dec 2022 11:41:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB889F018; Sun, 18 Dec 2022 08:14:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77A2960DCC; Sun, 18 Dec 2022 16:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90A1BC433D2; Sun, 18 Dec 2022 16:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671380091; bh=xFDclNvplgYnbL3uJh3dyEBsxCIi4aefQA4vqwNoo4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KTi9dNvhNJJEMdhaWVXcEOhu8fEj5DnuO/LQ7YsO/z4q7FZL5AUtQTwNagWiL4/IQ l6OY4olN1kClbdd0ckV3L1xWnRQoYkQAJ5Yvjg0biAaUubCToc89Z6Qsz5OFGN06/o lsNMy08Ry/+K+3/TRI9HPhgxwuXx3yGrYVJC2XqUuPUwcHbew1/C9Z2G+rdb8EmoUZ pl3PTMI6iNy0dgPxLnJHsYM7OZIQ0T7fV5NeL4jH+KoMdFUdrFIMhBZfYNK6pfHg28 ujYVR091UDrXcb0K79SyFU3LEd5oRPVs2KocGEusniKFfpxzRDH37inNa5FKe56dA5 FytxAh2CvM6Qw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stanislav Fomichev , Paul Mackerras , linux-ppp@vger.kernel.org, syzbot+41cab52ab62ee99ed24a@syzkaller.appspotmail.com, "David S . Miller" , Sasha Levin , edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 31/46] ppp: associate skb with a device at tx Date: Sun, 18 Dec 2022 11:12:29 -0500 Message-Id: <20221218161244.930785-31-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221218161244.930785-1-sashal@kernel.org> References: <20221218161244.930785-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Fomichev [ Upstream commit 9f225444467b98579cf28d94f4ad053460dfdb84 ] Syzkaller triggered flow dissector warning with the following: r0 = openat$ppp(0xffffffffffffff9c, &(0x7f0000000000), 0xc0802, 0x0) ioctl$PPPIOCNEWUNIT(r0, 0xc004743e, &(0x7f00000000c0)) ioctl$PPPIOCSACTIVE(r0, 0x40107446, &(0x7f0000000240)={0x2, &(0x7f0000000180)=[{0x20, 0x0, 0x0, 0xfffff034}, {0x6}]}) pwritev(r0, &(0x7f0000000040)=[{&(0x7f0000000140)='\x00!', 0x2}], 0x1, 0x0, 0x0) [ 9.485814] WARNING: CPU: 3 PID: 329 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0x1ee0/0x1fa0 [ 9.485929] skb_get_poff+0x53/0xa0 [ 9.485937] bpf_skb_get_pay_offset+0xe/0x20 [ 9.485944] ? ppp_send_frame+0xc2/0x5b0 [ 9.485949] ? _raw_spin_unlock_irqrestore+0x40/0x60 [ 9.485958] ? __ppp_xmit_process+0x7a/0xe0 [ 9.485968] ? ppp_xmit_process+0x5b/0xb0 [ 9.485974] ? ppp_write+0x12a/0x190 [ 9.485981] ? do_iter_write+0x18e/0x2d0 [ 9.485987] ? __import_iovec+0x30/0x130 [ 9.485997] ? do_pwritev+0x1b6/0x240 [ 9.486016] ? trace_hardirqs_on+0x47/0x50 [ 9.486023] ? __x64_sys_pwritev+0x24/0x30 [ 9.486026] ? do_syscall_64+0x3d/0x80 [ 9.486031] ? entry_SYSCALL_64_after_hwframe+0x63/0xcd Flow dissector tries to find skb net namespace either via device or via socket. Neigher is set in ppp_send_frame, so let's manually use ppp->dev. Cc: Paul Mackerras Cc: linux-ppp@vger.kernel.org Reported-by: syzbot+41cab52ab62ee99ed24a@syzkaller.appspotmail.com Signed-off-by: Stanislav Fomichev Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ppp/ppp_generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 829d6ada1704..c1f11d1df4cd 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1742,6 +1742,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) int len; unsigned char *cp; + skb->dev = ppp->dev; + if (proto < 0x8000) { #ifdef CONFIG_PPP_FILTER /* check if we should pass this packet */ -- 2.35.1