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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 45464C4360F for ; Thu, 4 Apr 2019 21:55:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17E6E20663 for ; Thu, 4 Apr 2019 21:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730827AbfDDVzk convert rfc822-to-8bit (ORCPT ); Thu, 4 Apr 2019 17:55:40 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37298 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727108AbfDDVzk (ORCPT ); Thu, 4 Apr 2019 17:55:40 -0400 Received: by mail-ed1-f68.google.com with SMTP id v21so3679409edq.4 for ; Thu, 04 Apr 2019 14:55:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=o/AsyPSEHBhYxv/8jgpLRvg1kW+khQoaWJkppf+/ucA=; b=krycrhi2s25sDY7PzBTpoxM3Iusx8F5dyj6VmaoNTNJ1j5Mug2PoW1QYV4J6vncpEB xmf3BYC8qn3DLNytIpNAO8RF6C3AHUn757A1TIVFtZVmQCtqCYEvfIDuuLOfyoXlEqj4 60ToQC9JjjoFlVqZbFb2u8vn0D4sn90uQMNHEvYSg1scupz3ZIZ+C5tvz5sZPczieki5 a1Z3t9E4mL1YXWLx75Cv2cxBYuxcdfHp0NRxWKWFizvkGzy8UOJRL7O+Ff3KmPvka0fP w9MGC9/MuuJMUihDDl07pY6HiO6TwUnKE9eDpEHomPQ3cU5mdA331427reyDjuto+Jch 8tcQ== X-Gm-Message-State: APjAAAXmWIGdhKWKpsy2Yp5PT2GDO+JTxw/3EqES7qnNiVwF9vkpQk/y 9AA9Kon9rP4WmUuNaVM2tDy2kcLkI48= X-Google-Smtp-Source: APXvYqwOJ9xaLzTXnZci7k/bXvCtusOjGmfqcG7c+U1DYI7NHXqWREdW59kcbNnmHQnoWLYu4Qh9hw== X-Received: by 2002:aa7:cb57:: with SMTP id w23mr5485796edt.264.1554414939194; Thu, 04 Apr 2019 14:55:39 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id y4sm5872710edq.53.2019.04.04.14.55.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 14:55:38 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id DFE5B1804A5; Thu, 4 Apr 2019 23:55:37 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stephen Hemminger Cc: David Miller , netdev@vger.kernel.org, cake@lists.bufferbloat.net Subject: Re: [PATCH net 2/2] sch_cake: Make sure we can write the IP header before changing DSCP bits In-Reply-To: <20190404144007.7ac9bfe0@shemminger-XPS-13-9360> References: <155438289359.18760.18027832614176337074.stgit@alrua-x1> <155438289374.18760.4278774647362746152.stgit@alrua-x1> <20190404123536.3c966937@shemminger-XPS-13-9360> <87y34p1owe.fsf@toke.dk> <20190404144007.7ac9bfe0@shemminger-XPS-13-9360> X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 04 Apr 2019 23:55:37 +0200 Message-ID: <87v9zt1lly.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Stephen Hemminger writes: > On Thu, 04 Apr 2019 22:44:33 +0200 > Toke Høiland-Jørgensen wrote: > >> Stephen Hemminger writes: >> >> > On Thu, 04 Apr 2019 15:01:33 +0200 >> > Toke Høiland-Jørgensen wrote: >> > >> >> static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash) >> >> { >> >> + int wlen = skb_network_offset(skb); >> > >> > In theory this could be negative, you should handle that? >> > Rather than calling may_pull() with a huge unsigned value. >> >> Huh, that would imply that skb->network_header points to before >> skb->head; when does that happen? >> >> Also, pskb_may_pull() does check for len > skb->len, so I guess a >> follow-up question would be, "does it happen often enough to warrant >> handling at this level"? >> >> Also, I copied that bit from sch_dsmark, so if you really thing it needs >> to be fixed, I guess we should fix both... >> >> -Toke > > It should never happen just paranoid Ah, right. Well in that case I think any overflow is handled fine inside pskb_may_pull(): if (unlikely(len > skb->len)) return 0; -Toke