Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034473AbdD0Pzw (ORCPT ); Thu, 27 Apr 2017 11:55:52 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:42394 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034144AbdD0Pyz (ORCPT ); Thu, 27 Apr 2017 11:54:55 -0400 Date: Thu, 27 Apr 2017 11:54:46 -0400 (EDT) Message-Id: <20170427.115446.621009535763048376.davem@davemloft.net> To: Jason@zx2c4.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David.Laight@aculab.com, kernel-hardening@lists.openwall.com Subject: Re: [PATCH v6 1/5] skbuff: return -EMSGSIZE in skb_to_sgvec to prevent overflow From: David Miller In-Reply-To: References: <20170425155215.4835-1-Jason@zx2c4.com> <20170425184734.26563-1-Jason@zx2c4.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 27 Apr 2017 08:13:23 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1019 Lines: 20 From: "Jason A. Donenfeld" Date: Thu, 27 Apr 2017 11:21:51 +0200 > Hey Dave, > > David Laight and I have been discussing offlist. It occurred to both > of us that this could just be turned into a loop because perhaps this > is actually just tail-recursive. Upon further inspection, however, the > way the current algorithm works, it's possible that each of the > fraglist skbs has its own fraglist, which would make this into tree > recursion, which is why in the first place I wanted to place that > limit on it. If that's the case, then the patch I proposed above is > the best way forward. However, perhaps there's the chance that > fraglist skbs having separate fraglists are actually forbidden? Is > this the case? Are there other parts of the API that enforce this > contract? Is it something we could safely rely on here? If you say > yes, I'll send a v7 that makes this into a non-recursive loop. As Sabrina showed, it can happen. There are no such restrictions on the geometry of an SKB.