Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3394034lkq; Mon, 23 Nov 2020 04:42:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWygpWEsPQ7ZrE9JXelaU+3lL82IfELJzjPjqHjhfXjRx6HRTyCa3FtBkk7oEDXyZKDbet X-Received: by 2002:a17:906:17d0:: with SMTP id u16mr12773697eje.452.1606135357576; Mon, 23 Nov 2020 04:42:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135357; cv=none; d=google.com; s=arc-20160816; b=JD0fCdIcPRfznHIsFFzmfb8BCVNkx2xzoKvI1SmFxXh8QhRBEk2aaI8qtKCPRTATla VLlhFXtOp8s5eMP85TXNV1f20YjsEr0xxvWew6rdjPcrfEu6/epCVy9H2mfH4V2OXpcg QLSMQMV519p4KFtfkJuOnAmDhmXpFpGj5wvi/Ob2AZ96sEQfqze5akuL/4IyoNo4rNLK 6nAwgXMYncxNj6S+9vSv8RQSxCFs0Jces/1S0kq0jlB6lpOKQ0xUwdsjyBWI8kPjgXEm MSMk5b1oxlDpXj25PBZNz/BqCYzHVonFKRQ02L/SJXzY/GGG0HbHvydbm4oFTL2J8FHe RESw== 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=zwr5PY2KKqqfrKcgb5uFj+37s/HFwc0K5k9O0NAt1Co=; b=hVkcm47YJMlNTtaNmITVLbq3oU17BcQ257BdtXxlY23Q2rF1Oh1+GFGn3TbCd9esQA R4KNxaFvdOvehr/MQS6Eabn0VcOqXvWgYjyLu/xBUBQrmQzHhSuv8YC0tOGxSTLFQL64 XY06AYDCjNQPtEAWhLT/drmdil6/w2pd/XUgXpwURAkyfsO3AlV5n3LVvW4znb9MOuuU aX4fCyJ6nPONE+WBHKVubpQmahhsOl32hxqa9ujv1gzHcKMCzlrY++w3y2qZS3C8JAn/ Y6kThD1R5/nP5U6kP8JIKbvHh1k3QpjvjFsiLav8hQlVMtw9rbC3calhHDo2T1qklYEp Rgng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AkGldUN4; 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 n17si6043687ejh.609.2020.11.23.04.42.13; Mon, 23 Nov 2020 04:42:37 -0800 (PST) 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=AkGldUN4; 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 S1731498AbgKWMjP (ORCPT + 99 others); Mon, 23 Nov 2020 07:39:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:51066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732108AbgKWMie (ORCPT ); Mon, 23 Nov 2020 07:38:34 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 243AD20857; Mon, 23 Nov 2020 12:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135114; bh=Lr8yG7a/h9lNCCfxshKz1kSJ4UUgtX6WFQHKFkf/oco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkGldUN4pYG6FKyNOIpYe2mIpZErgUkVATz2IsMkIei3kETqP2Ryyb0BHCw+SVJJk PmZ18nff5chkQ7ti6oJ2K5UaqFtobcepshSBRRg6HiNvqB2B/5n/XTd3qcB5gyTF6Y PQUWjpwjbEQU7ygSWyM2//QzdgJ+5CvL1ohwZzO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Borkman , John Fastabend , Jakub Sitnicki , Sasha Levin Subject: [PATCH 5.4 109/158] bpf, sockmap: Use truesize with sk_rmem_schedule() Date: Mon, 23 Nov 2020 13:22:17 +0100 Message-Id: <20201123121825.196763523@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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: John Fastabend [ Upstream commit 70796fb751f1d34cc650e640572a174faf009cd4 ] We use skb->size with sk_rmem_scheduled() which is not correct. Instead use truesize to align with socket and tcp stack usage of sk_rmem_schedule. Suggested-by: Daniel Borkman Signed-off-by: John Fastabend Signed-off-by: Daniel Borkmann Reviewed-by: Jakub Sitnicki Link: https://lore.kernel.org/bpf/160556570616.73229.17003722112077507863.stgit@john-XPS-13-9370 Signed-off-by: Sasha Levin --- net/core/skmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 4fad59ee3df0b..ddb1b7d94c998 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -411,7 +411,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC); if (unlikely(!msg)) return -EAGAIN; - if (!sk_rmem_schedule(sk, skb, skb->len)) { + if (!sk_rmem_schedule(sk, skb, skb->truesize)) { kfree(msg); return -EAGAIN; } -- 2.27.0