From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [net 1/1] tipc: fix skb truesize/datasize ratio control Date: Thu, 08 Feb 2018 15:31:15 -0500 (EST) Message-ID: <20180208.153115.260191898373353330.davem@davemloft.net> References: <1518106585-11064-1-git-send-email-jon.maloy@ericsson.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, hoang.h.le@dektech.com.au, mohan.krishna.ghanta.krishnamurthy@ericsson.com To: jon.maloy@ericsson.com Return-path: In-Reply-To: <1518106585-11064-1-git-send-email-jon.maloy@ericsson.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tipc-discussion-bounces@lists.sourceforge.net List-Id: netdev.vger.kernel.org From: Jon Maloy Date: Thu, 8 Feb 2018 17:16:25 +0100 > From: Hoang Le > > In commit d618d09a68e4 ("tipc: enforce valid ratio between skb truesize > and contents") we introduced a test for ensuring that the condition > truesize/datasize <= 4 is true for a received buffer. Unfortunately this > test has two problems. > > - Because of the integer arithmetics the test > if (skb->truesize / buf_roundup_len(skb) > 4) will miss all > ratios [4 < ratio < 5], which was not the intention. > - The buffer returned by skb_copy() inherits skb->truesize of the > original buffer, which doesn't help the situation at all. > > In this commit, we change the ratio condition and replace skb_copy() > with a call to skb_copy_expand() to finally get this right. > > Acked-by: Jon Maloy > Signed-off-by: Jon Maloy Applied, thanks Jon. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot