From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BEC0C43603 for ; Wed, 11 Dec 2019 15:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15B0B24671 for ; Wed, 11 Dec 2019 15:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077658; bh=PeYVoadsImi2LxPr0Kktv0Z4St0GaLqXgrkc7XGOcIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bPd1G2HXbbhhiFjnXXrHzttwY8j5lXSzpu1R6C/rZQp6gtDUv5Efl7JKY7lJXq4q+ thzreLhcaKZc0kV5Ia1IVK5MGVumEN6WoMfDPA+2X0+RwiRYQlSVC/MvNzlQLbOTqs GhicqZVZvHZCxEm7kWSAy933JBxgrncN+zqSTyOQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732389AbfLKPUy (ORCPT ); Wed, 11 Dec 2019 10:20:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:50500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732383AbfLKPUu (ORCPT ); Wed, 11 Dec 2019 10:20:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5E35B22B48; Wed, 11 Dec 2019 15:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077649; bh=PeYVoadsImi2LxPr0Kktv0Z4St0GaLqXgrkc7XGOcIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntG4J+v077pu4H7WnKYGw5XV6h+3eot8MA9h5il9t8pJirD9P3gYz0rn3jTbnc7Cz yZHOA1l6AqXZg5nQ2uhcTNmexlNnt3gKRAIhs10KCyW2Hltue2aj0IqTwODkM+2YBB LqD823ksRLF59qTuzTJv1EcaNCRs5Uk+XBhwXcg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Marcelo Ricardo Leitner , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 119/243] sctp: increase sk_wmem_alloc when head->truesize is increased Date: Wed, 11 Dec 2019 16:04:41 +0100 Message-Id: <20191211150347.164875650@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit 0d32f17717e65e76cbdb248374dd162acdfe2fff ] I changed to count sk_wmem_alloc by skb truesize instead of 1 to fix the sk_wmem_alloc leak caused by later truesize's change in xfrm in Commit 02968ccf0125 ("sctp: count sk_wmem_alloc by skb truesize in sctp_packet_transmit"). But I should have also increased sk_wmem_alloc when head->truesize is increased in sctp_packet_gso_append() as xfrm does. Otherwise, sctp gso packet will cause sk_wmem_alloc underflow. Fixes: 02968ccf0125 ("sctp: count sk_wmem_alloc by skb truesize in sctp_packet_transmit") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/output.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sctp/output.c b/net/sctp/output.c index b0e74a3e77ec5..025f48e14a91f 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb) head->truesize += skb->truesize; head->data_len += skb->len; head->len += skb->len; + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc); __skb_header_release(skb); } -- 2.20.1