Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp534077pxt; Fri, 6 Aug 2021 07:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4LMgQNMZ3m60QtlbcANBx5PARyH7wsE5wNAzasXQDRHCCfEzfa1cW6FnV8md3mIRVHb3t X-Received: by 2002:a92:d7c4:: with SMTP id g4mr773062ilq.24.1628261592097; Fri, 06 Aug 2021 07:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628261592; cv=none; d=google.com; s=arc-20160816; b=Bvo0QjiJkWGK7AG+BEm5DzUWmhFGa+mIUGL2jaf2MK73eYiMLkN7KPQGUV4FV9aqcD Rj244s5fE/lzi/NwEGD1GCvWmqDqnKkbCHufAIFLVMIzhUA7Hs7bzmj8lu2S9dRpsJyA 9sbx3MuFgbPhYNHpdj7kEcoJwfODtucxrpRYzivsMik0sTwc5u8QNeRDRqj04UpgV9jc uRT6zWQubLeDhkliWka/H1YhWrRwrReoEz9l6aCy+zn8g2oljem4vxIBjjISdpU4rA/P T2q+EMBVKnPwG95CUYh5hiYs3VyMRTrr5cIV0mF/7RDUc3E6xD99qyNr9mNiXH3CbqqE alGQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6sIp//OHjfOpuout40idATDvECLpRBoT/jiIHt2xLH8=; b=U8TWx4pZpzF4g3E0be+ReXV0G2r2Ud1kz6+bHGtrEmkLJHcrjx+tTO0NUNGhbTRz9l ug8+b7EPnz/vHcC6XNfWouKsuFm3EEOdoBUe4hBMHyh9oM9UjWowk0ldpTvz29VPpoZb vak3sH1hdvNRB68ra7co3WPafsATVETLT6RYMjKOaDsyUD0elObngwQgtVIJvNddItEb hkp+Tx32cD82bs+JBXV6MEbWK3VZ/STTaUQtWA8GKjJTGAZHD/GgvzWJlycHJvDs/D2l qDbadaKqxYs2Gyd8HnTGtvavyBgQTRfa8UXhOpzsek4QT1L8h5c20ze0brDbBuWoGpHR aIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieQucogL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n14si10786748ilk.78.2021.08.06.07.52.45; Fri, 06 Aug 2021 07:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieQucogL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243260AbhHFIY4 (ORCPT + 99 others); Fri, 6 Aug 2021 04:24:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:52206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243303AbhHFIV3 (ORCPT ); Fri, 6 Aug 2021 04:21:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFB0B61167; Fri, 6 Aug 2021 08:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628238062; bh=eEKZqAgjmEcThEttKHyKHo1qwFUoMaa+zEpU6hFzRxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ieQucogLeaNFMprxBWhmJ+ZLCr0uEgVI/kXdU1LOoUhvA1+OMoEgKPK1qHekOAFaE cm/4W1pzQVKvYMVXmm59SfMSfA00SwwpWH3z/6L1oakRCRUyP9zNcqx0yn0KKlW2hr z+tAQWmXf0oVt0DnOYGSIGsxTQDuNMFYB8m4m3+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cong Wang , Daniel Borkmann , John Fastabend , Jakub Sitnicki , Sasha Levin Subject: [PATCH 5.13 05/35] skmsg: Pass source psock to sk_psock_skb_redirect() Date: Fri, 6 Aug 2021 10:16:48 +0200 Message-Id: <20210806081113.890848812@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081113.718626745@linuxfoundation.org> References: <20210806081113.718626745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cong Wang [ Upstream commit 42830571f1fd9751b3fbf38084bbb253320e185f ] sk_psock_skb_redirect() only takes skb as a parameter, we will need to know where this skb is from, so just pass the source psock to this function as a new parameter. This patch prepares for the next one. Signed-off-by: Cong Wang Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Acked-by: Jakub Sitnicki Link: https://lore.kernel.org/bpf/20210615021342.7416-8-xiyou.wangcong@gmail.com Signed-off-by: Sasha Levin --- net/core/skmsg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index d428368a0d87..b088fe07fc00 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -859,7 +859,7 @@ int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock, } EXPORT_SYMBOL_GPL(sk_psock_msg_verdict); -static int sk_psock_skb_redirect(struct sk_buff *skb) +static int sk_psock_skb_redirect(struct sk_psock *from, struct sk_buff *skb) { struct sk_psock *psock_other; struct sock *sk_other; @@ -896,11 +896,12 @@ static int sk_psock_skb_redirect(struct sk_buff *skb) return 0; } -static void sk_psock_tls_verdict_apply(struct sk_buff *skb, struct sock *sk, int verdict) +static void sk_psock_tls_verdict_apply(struct sk_buff *skb, + struct sk_psock *from, int verdict) { switch (verdict) { case __SK_REDIRECT: - sk_psock_skb_redirect(skb); + sk_psock_skb_redirect(from, skb); break; case __SK_PASS: case __SK_DROP: @@ -924,7 +925,7 @@ int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb) ret = sk_psock_map_verd(ret, skb_bpf_redirect_fetch(skb)); skb->sk = NULL; } - sk_psock_tls_verdict_apply(skb, psock->sk, ret); + sk_psock_tls_verdict_apply(skb, psock, ret); rcu_read_unlock(); return ret; } @@ -971,7 +972,7 @@ static int sk_psock_verdict_apply(struct sk_psock *psock, struct sk_buff *skb, } break; case __SK_REDIRECT: - err = sk_psock_skb_redirect(skb); + err = sk_psock_skb_redirect(psock, skb); break; case __SK_DROP: default: -- 2.30.2