Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2621178lqp; Mon, 25 Mar 2024 04:50:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXns4lwcnllRZac+i2b0NDE2DOLHQ2hr3hnYBhlqpYCjIdbp1TiA3xvhCGhFwhgsMAq0n8MRHkpFA74pIIiMmjjqNpEyB57izENveG13A== X-Google-Smtp-Source: AGHT+IEMMuFLUN2Os2tE4dqxBQYzY2sMjlEi1nDCSB0yYIvfNGbIoD4iEQYq3llg1VPxPkR3BS6W X-Received: by 2002:a05:6a00:2401:b0:6ea:17ff:4dc0 with SMTP id z1-20020a056a00240100b006ea17ff4dc0mr8825672pfh.4.1711367455829; Mon, 25 Mar 2024 04:50:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367455; cv=pass; d=google.com; s=arc-20160816; b=jlAiAHqvxHlbGJ9jmZh2TzGpucZZt/EtULCO+kvG7NnZ/lsTwFM8Duj8y8i+oxD9S7 JNUqUqJ9gyz/WV24d53O87BDd0/xpRRrmbjpGon17ZQC7zifq0SnJJFHPAIsrW4kUUQ8 o2n9Q70wyZ4SxjISoGNX1mMqVanL7NMJIMJ7qnyR8Q7dS9Cw5IcH8xY5DaSM6qLbE5AM sncdF61t5dUvq0X1TZhpCIyRgJkveVMrUf2fJZBPZWJiKkHao/2KZLeud4Nxv76m1Bb5 x+7PJ+JnhU+MgcpT3b/nR5qwts6ULBnw27oMbiD55Fe5WZ7qqYbFxsK5fInvNAlJHeeK 2a0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Rix0sdevz2oexqWn+e+R1acA+QQ8ykjis9b5nKVXCl0=; fh=aHR/WvO2DE+dCkGMia6VRmOk0Pr/a3XZv2UvdX7K98g=; b=hxrXVs5SEQK2xghQde0jcRaEnfPn+gJH1x6QUKu/UZOtJ83UqmcSxQEZRDzbgvL4Zf NMRyy2E4DLcjlFinOXM3aSmdMnlw4j/rnGQccOk+wgfuMt9QgKUj1HXDUYeAYatf+KyB MsPcJW+CgHBgdlmOkyZUYRnfM1YjkxqvmfVw+x0v6w1FYU6UKZUEWWm44rGMuONF/Emy Y+rRTQkxBEppI269E0EeN4mqOI0/Brjiu/p7CYclHV42o/wtxfrOWpqS4RDcfaL53m3c iEMMIIgNRB4Dc/qXTaePGYPH0/jtJ/exxhiX5WLC/s99HzTo4V01TgmAXye7a0+cxVMD v9wA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FpvolXkl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a4-20020a656544000000b005dc5dc82729si4013200pgw.541.2024.03.25.04.50.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FpvolXkl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 301C12A75CD for ; Mon, 25 Mar 2024 11:42:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19DA8388953; Mon, 25 Mar 2024 03:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FpvolXkl" 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 D6F001474CE; Sun, 24 Mar 2024 23:14:57 +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=1711322097; cv=none; b=Fq+F2S9BV5gUsVMWtHmVcN1deoTLZ47hQ+o5++dkl8UYG4jGV2WHiv/H+CDSjPatBvYB5N4HxxRwW4Ek1GDIVJUi/HzKSxlZLPsZXNSzGOgnjL1zhyaIY1LzKFnvogV9hio3nSvnLVy/w/gSZrrYzuVFFJWFCVsT+vxrZgIGJlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322097; c=relaxed/simple; bh=L8+OyzxkHOvk3tcBoqBAuAXpIEzLwMUIv9/BEeN180I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aq4J9RzgkWmhEMBETg6CnNpXFlFDbCUbtDXsYIHVZC5FbkPBpVyXnI99syt/uY9PdzkL88BAinpPlEZzKj6tNVymWq85F7sVYnxJaNR4q3+xiXzPYCE/uKhkil+VCzQ2ewiDVosQVs8TiVA3SPcfoLr/atFyE5jKCN3t9mtxR5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FpvolXkl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0589DC43394; Sun, 24 Mar 2024 23:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322097; bh=L8+OyzxkHOvk3tcBoqBAuAXpIEzLwMUIv9/BEeN180I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpvolXklESfNLxMOFDPO0JSbjy5nK27Tl/iGcyjP6MkenQzesTxaLB4JoCgdDmmb5 k4GKLgNmyJ05DUijS9EoMw1xE67ecT4QF9k1sUVpFRrMHNdaIXquBn+O5vRjXd26/F l14bK8X1ZN8eHdFEo7Q6gpaIEuXb/hEYMjV0DCjVUOZZ2Fr4AKEMzj6u6xxMX2aQ0a AWYdSPU6bhQ+CX3qLGX8C9bCnCxN70s+e2evyVKdrpy5iK98/Zm7QCLqCjBY7ZOOE/ 3Bfz78iBAYg7GqjK6TECIBBuhNIfRV4gMczQhVt8+UGcOS/MgP2HrG9oCWFL0HWiYL 6ywKE25cB8sOg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jeremy Kerr , Jian Zhang , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 172/451] net: mctp: copy skb ext data when fragmenting Date: Sun, 24 Mar 2024 19:07:28 -0400 Message-ID: <20240324231207.1351418-173-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jeremy Kerr [ Upstream commit 1394c1dec1c619a46867ed32791a29695372bff8 ] If we're fragmenting on local output, the original packet may contain ext data for the MCTP flows. We'll want this in the resulting fragment skbs too. So, do a skb_ext_copy() in the fragmentation path, and implement the MCTP-specific parts of an ext copy operation. Fixes: 67737c457281 ("mctp: Pass flow data & flow release events to drivers") Reported-by: Jian Zhang Signed-off-by: Jeremy Kerr Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/core/skbuff.c | 8 ++++++++ net/mctp/route.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d4bd10f8723df..e38a4c7449f62 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -6500,6 +6500,14 @@ static struct skb_ext *skb_ext_maybe_cow(struct skb_ext *old, for (i = 0; i < sp->len; i++) xfrm_state_hold(sp->xvec[i]); } +#endif +#ifdef CONFIG_MCTP_FLOWS + if (old_active & (1 << SKB_EXT_MCTP)) { + struct mctp_flow *flow = skb_ext_get_ptr(old, SKB_EXT_MCTP); + + if (flow->key) + refcount_inc(&flow->key->refs); + } #endif __skb_ext_put(old); return new; diff --git a/net/mctp/route.c b/net/mctp/route.c index 0144d8ebdaefb..05ab4fddc82e9 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -843,6 +843,9 @@ static int mctp_do_fragment_route(struct mctp_route *rt, struct sk_buff *skb, /* copy message payload */ skb_copy_bits(skb, pos, skb_transport_header(skb2), size); + /* we need to copy the extensions, for MCTP flow data */ + skb_ext_copy(skb2, skb); + /* do route */ rc = rt->output(rt, skb2); if (rc) -- 2.43.0