Received: by 10.192.165.148 with SMTP id m20csp1866553imm; Thu, 3 May 2018 06:44:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZmN/u10Sr41K3+M2HJjv2hR1upxu/d43Ulfkg+HwxauTQ9abqbOPzWnWKkZ5BS8aV3Txb X-Received: by 2002:a17:902:6ac3:: with SMTP id i3-v6mr13748138plt.378.1525355053628; Thu, 03 May 2018 06:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525355053; cv=none; d=google.com; s=arc-20160816; b=pYXFOypQo3ZW0ZPeUwjOdbQ8GN5E+TEfkDcevYx+EB7AAva6rFx8ddotsJ/pKpyQSg LOaa6HRukSsf2WGq2Td1V7nggaZbRQsPSUwut6b4J9d/Dt2YLOyofdwoUu7NJ8/UKgG+ /1Yq1lSUXKdV5uaho2yvekoAdUReQbHr7jOwP4g5weNd61Qa+LRqCVDZCbklnUnIlAcA q7fEKouoE95vOwBpFm3RdsT4qekrlwqrLFfh0B7BKvlb9+22aHQFHlTe4l+ds5DqNvyO klZGgxNukkr/w403wA3FUeIW7nPLSbV4KwqcwKvlFLXpxfymBU9Xt/ernIZwXGnm2dvU TFrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=g1Z/Yxr7TAl8TS3yLeCORaorbQlacuKuhCp3Pm8q/hc=; b=d+grh6etPwikjfRTODEhTZxqVGl/Qmh190WN95MnxtVKoKAQ+jdydkvUi9ErYNwX9V 6T3sN+LHMGlmtg/CSDwowQLVJ1labghZo/RJVdjkwByhZpLO3sPWULEfEcjdB5O2QS2h 7Ggub+rqj7wDa79uWU6H6X3F7iyS/hx1kSVawF/sRPGFowsK85GX8KDfua38UmZSqBDv xQyzVD4VmmLDNu/i2Ic/QngdtsJ5KuZjYAJxKebrT6rDzF9Jv9xzwygO5ATAywFn2KIT pUNN7V8pwyVJ5gdMdgPoJjVeMag6NxQv/Qq1V/dmgnpQgGMIuZYFSYv7Pr69LnpG0JoJ TIgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=20160920 header.b=lVPMGoRB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a68-v6si13966880pli.158.2018.05.03.06.43.59; Thu, 03 May 2018 06:44:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@umn.edu header.s=20160920 header.b=lVPMGoRB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbeECNns (ORCPT + 99 others); Thu, 3 May 2018 09:43:48 -0400 Received: from mta-p3.oit.umn.edu ([134.84.196.203]:47144 "EHLO mta-p3.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbeECNnp (ORCPT ); Thu, 3 May 2018 09:43:45 -0400 Received: from localhost (localhost [127.0.0.1]) by mta-p3.oit.umn.edu (Postfix) with ESMTP id 4BEA6570; Thu, 3 May 2018 13:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=umn.edu; h= content-type:content-type:subject:subject:message-id:date:date :from:from:references:in-reply-to:received:mime-version:received :received:received; s=20160920; t=1525355024; x=1527169425; bh=3 uisW4sgFQWvHkTYlZW7nBeOAU9ICADcISWLO2hAKrY=; b=lVPMGoRBHUksuaF8d ZQ2kpuY1SyJ8KgJtvPlx5VbFQvG1nfS4pX1SQX6jo76RmdXgCodt+2WhuahGaS1k KJKdEavz09h42nL92kOkmT81lgC2uUyHoJwMgln2q8hYEW8PoXLfJkVEiXeMM/dm LwrE7HHRxX/dC8l8LSxnJoMn8rMzCnmUCkOnZ1w1pgwXufOcEq7DxQMYiAmKdV1C EFUxKk2w5Qc27F1OFxPYNQc4BDk6ar2Rscv6DC6M7gy/S9Ph9zH8YeJ3CC0yxanD YbyX56LMEyhs6lFtDb/oT/KfxJ7/8u3qi1DuAWJyftadELMrtgIPc5zWjgd8/Pia xSycQ== X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p3.oit.umn.edu ([127.0.0.1]) by localhost (mta-p3.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KixMTKBxvZDA; Thu, 3 May 2018 08:43:44 -0500 (CDT) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: wang6495) by mta-p3.oit.umn.edu (Postfix) with ESMTPSA id 1EFBD526; Thu, 3 May 2018 08:43:44 -0500 (CDT) Received: by mail-it0-f45.google.com with SMTP id t7-v6so2097696itf.0; Thu, 03 May 2018 06:43:44 -0700 (PDT) X-Gm-Message-State: ALQs6tDzAuTwQ6/TK3vg/OF0Tb1/aa7rPSaVtcVGVKnZEgP3dtTerxyP yP/0T45cgNGq36cyBI6QEbeMoHY1Hc9LnfUk2FA= X-Received: by 2002:a24:36c6:: with SMTP id l189-v6mr18360006itl.6.1525355023876; Thu, 03 May 2018 06:43:43 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:6f07:0:0:0:0:0 with HTTP; Thu, 3 May 2018 06:43:03 -0700 (PDT) In-Reply-To: <20180503133945.GN5105@localhost.localdomain> References: <1525310145-28102-1-git-send-email-wang6495@umn.edu> <20180503012402.GK5105@localhost.localdomain> <20180503014838.GL5105@localhost.localdomain> <20180503124629.GM5105@localhost.localdomain> <20180503133945.GN5105@localhost.localdomain> From: Wenwen Wang Date: Thu, 3 May 2018 08:43:03 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sctp: fix a potential missing-check bug To: Marcelo Ricardo Leitner Cc: Kangjie Lu , Vlad Yasevich , Neil Horman , "David S. Miller" , "open list:SCTP PROTOCOL" , "open list:NETWORKING [GENERAL]" , open list , Wenwen Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 3, 2018 at 8:39 AM, Marcelo Ricardo Leitner wrote: > On Thu, May 03, 2018 at 08:31:28AM -0500, Wenwen Wang wrote: >> On Thu, May 3, 2018 at 7:46 AM, Marcelo Ricardo Leitner >> wrote: >> > On Thu, May 03, 2018 at 07:01:51AM -0500, Wenwen Wang wrote: >> >> On Wed, May 2, 2018 at 8:48 PM, Marcelo Ricardo Leitner >> >> wrote: >> >> > On Wed, May 02, 2018 at 08:27:05PM -0500, Wenwen Wang wrote: >> >> >> On Wed, May 2, 2018 at 8:24 PM, Marcelo Ricardo Leitner >> >> >> wrote: >> >> >> > On Wed, May 02, 2018 at 08:15:45PM -0500, Wenwen Wang wrote: >> >> >> >> In sctp_setsockopt_maxseg(), the integer 'val' is compared against min_len >> >> >> >> and max_len to check whether it is in the appropriate range. If it is not, >> >> >> >> an error code -EINVAL will be returned. This is enforced by a security >> >> >> >> check. But, this check is only executed when 'val' is not 0. In fact, if >> >> >> >> 'val' is 0, it will be assigned with a new value (if the return value of >> >> >> >> the function sctp_id2assoc() is not 0) in the following execution. However, >> >> >> >> this new value of 'val' is not checked before it is used to assigned to >> >> >> >> asoc->user_frag. That means it is possible that the new value of 'val' >> >> >> >> could be out of the expected range. This can cause security issues >> >> >> >> such as buffer overflows, e.g., the new value of 'val' is used as an index >> >> >> >> to access a buffer. >> >> >> >> >> >> >> >> This patch inserts a check for the new value of 'val' to see if it is in >> >> >> >> the expected range. If it is not, an error code -EINVAL will be returned. >> >> >> >> >> >> >> >> Signed-off-by: Wenwen Wang >> >> >> >> --- >> >> >> >> net/sctp/socket.c | 22 +++++++++++----------- >> >> >> >> 1 file changed, 11 insertions(+), 11 deletions(-) >> >> >> > >> >> >> > ? >> >> >> > This patch is the same as previous one. git send-email >> >> >> > maybe? >> >> >> > >> >> >> > Marcelo >> >> >> >> >> >> Thanks for your suggestion, Marcelo. I can send the old file. But, I >> >> >> have added a line of comment in this patch. >> >> > >> >> > I meant if you had sent the old patch again by accident, because you >> >> > said you worked on an old version of the tree, but then posted a patch >> >> > that also doesn't use the new MTU function I mentioned. >> >> > >> >> > Marcelo >> >> >> >> I worked on the latest kernel. But, I didn't find the MTU function >> >> sctp_mtu_payload(). >> > >> > Which tree are you using? >> > [a] git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git >> > or >> > [b] git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git >> > ? >> > >> > The function isn't on [a] yet, but it is on [b]. >> > >> > Marcelo >> >> Many thanks for your patience, Marcelo :) >> >> The tree I am working on is: >> git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > Ahh! That explains the discrepancy :) > For networking patches, please refer to > Documentation/networking/netdev-FAQ.txt > It describes what the 2 trees I pointed out are and how they should be > used. > In short, both net and net-next are always newer than the one you're > using for networking subsystem. > > Regards, > Marcelo I see now. Will work on the new networking trees. Thanks! Wenwen