Received: by 10.192.165.148 with SMTP id m20csp1854386imm; Thu, 3 May 2018 06:32:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoUuTYbcR+vnv65SS4jknAx1UM+YQ0mM6DhVQdMq6Stssdmk7DVx2F6pwHTXRDxORIncfyA X-Received: by 2002:a17:902:bc88:: with SMTP id bb8-v6mr12813599plb.175.1525354365391; Thu, 03 May 2018 06:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525354365; cv=none; d=google.com; s=arc-20160816; b=mI7IajeXMGjAk+KWvLupAn3ZB7bs3QaNF+IVb1/G4cECoBGHtm7/M359+mDyr0pPEI V0uaPYAx+FcKb769Q1bnXJ9kwlHerrjCTqbNsv725i3accbWb+NDoMd0WjG4eFEPeYEH AUkikqP2WgDsir/cvtUVKFiz/SSZeo3IquK2xRcBJvHzkXJ1Zh/Qcxiz+xlw7WQIwruE cfv4J357ju02yONsW/xhxT/Lvi7k3cxO48TjUfKs+cLqudBi2433MZwNwaAikPzXMyar pW6rES4lvjYmAwDAZTaGHfpjzG5yhzPlUMvP/k/UkKPp2101Kr2pOgESazyWbXnb+gIj Vmhw== 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=OashbK+PFhJ3p7u4tqfWztvy50hD5pSk2mE+eogKD9w=; b=LLXJrbGfa0Oiu/OHKRrI5qjVcgDk062JOCpaintIS0ipcf9n6UZbIpEj2+/GmHDBSY BRkAVdDVFaCOq9+qAo5sN66glmCUc1tj+aHau0bwpMmNJnikwNC92oKgeJadDFJ+xkV9 3CeftTsk+7SJ1tVLDVtc5qbgxItyS8EvmLO/szHYhTd7dXNCb7Nv2lye2p19rRKeHU8y on9n4IykKL6HPgY5dK50QdK0PUrGAczV7qcHtfn7sHeyz74q9H8Sxu/SG3ORHU6gmxrK 6JWWW1ww+S63Lm2BT4GmC8RJiUU5AFUNh9BgTNxBzALkDHTLIFGODwuCEkXvAqm6Ponx 0KSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=20160920 header.b=IY3gxtkC; 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 188-v6si11350383pgg.546.2018.05.03.06.32.30; Thu, 03 May 2018 06:32:45 -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=IY3gxtkC; 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 S1751417AbeECNcM (ORCPT + 99 others); Thu, 3 May 2018 09:32:12 -0400 Received: from mta-p4.oit.umn.edu ([134.84.196.204]:37302 "EHLO mta-p4.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbeECNcK (ORCPT ); Thu, 3 May 2018 09:32:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mta-p4.oit.umn.edu (Postfix) with ESMTP id 8664D586; Thu, 3 May 2018 13:32:09 +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=1525354329; x=1527168730; bh=r UKMM9ONSlk2sZeT16kxf5ye77/42ZLqTps+6pwl4IA=; b=IY3gxtkCxt4pvnWzu y53FS3u7V1uzALkwBiXcRtrWkANkm4iWWm0PRGhHI0MVRr9t9keivQh3c789fUOl /vic6eBULRURwr8MwlVOb2M2CS60TTkiYMrev1o3PQ52CVGPhVJy+aYiua8eDmvb J6R273CQocGdMi206MyXbka9jHSQWuVJytjBkCELwagpOWSQZzj+TwCngoKqeX7n G/heTui2i2tzSaCadhYSNzZa3hWf4i7dU6F4mIJZ/CtpIBM6UCPWrQEKtIc7yjDn ImvAHk8axKc9U5l66HQYn+UPa5+vp9Kf34zPExxfVWaCBLCveCGGfjC5zWnqvG5m 85GSQ== X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p4.oit.umn.edu ([127.0.0.1]) by localhost (mta-p4.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m5f4ljJybAav; Thu, 3 May 2018 08:32:09 -0500 (CDT) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: wang6495) by mta-p4.oit.umn.edu (Postfix) with ESMTPSA id 632C8565; Thu, 3 May 2018 08:32:09 -0500 (CDT) Received: by mail-io0-f176.google.com with SMTP id e78-v6so21656583iod.0; Thu, 03 May 2018 06:32:09 -0700 (PDT) X-Gm-Message-State: ALQs6tCkagvEBJdpZEJK4yoMdSNchwnui5fKDSL5nOYmoQZUPBEjn9Qy /SqY9IlO2kk+1583y9Oza2odLoZxvv6Q3A5Xuuc= X-Received: by 2002:a6b:200e:: with SMTP id g14-v6mr26869036iog.161.1525354329057; Thu, 03 May 2018 06:32:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:6f07:0:0:0:0:0 with HTTP; Thu, 3 May 2018 06:31:28 -0700 (PDT) In-Reply-To: <20180503124629.GM5105@localhost.localdomain> References: <1525310145-28102-1-git-send-email-wang6495@umn.edu> <20180503012402.GK5105@localhost.localdomain> <20180503014838.GL5105@localhost.localdomain> <20180503124629.GM5105@localhost.localdomain> From: Wenwen Wang Date: Thu, 3 May 2018 08:31:28 -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 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 Wenwen