Received: by 10.192.165.148 with SMTP id m20csp1867638imm; Thu, 3 May 2018 06:45:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+F2B0DjEac4lR0xDNDqTWia0lgdH2AHoViy0Dakr1rCS4lhOYnacE9josif7JU/70E8PP X-Received: by 10.167.130.22 with SMTP id k22mr23212860pfi.73.1525355118035; Thu, 03 May 2018 06:45:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525355117; cv=none; d=google.com; s=arc-20160816; b=s8OkqohM/VIfOYSF29637+roQNz7DonAhkJ7+mXniGoKAYNrKVIxiC+S7iUvzGbcbh MnQ2QY+FwWg3uVNphAgUXssr24J8lmRg6qghHNpwwuEdcrHdABmt+Xzka1Qp0K7fz+zO eqxMnkS8vYDVXKfKH6AFMiL/leO2K1DPC7Pgrjxke177E8Qw8ddB7fWKPtxOQRVXMqeF M28LOQ/DoOLkL2BU9bk59oH2BjJaNscivw1FOJp6qk8nvxlnfOiUij3e59qfNipWbA95 uHjApoHirsffs05RhNPB6fs/btTERLzmn6KmL+gAza4BksdPL8CurOjC6yGOjZYRxLCr DRgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=GJ6YcrNCNZ9HvdOJEnqa3Lt58+e9WfCzrhqJSbRa8YM=; b=zLZV0wM18mS56hujb0QBqdWm6aB7gSylOGAYZEExQmNKylPvs7b5yGRDARGHjVRY8I r5rGLajGQiObFZ5Y5EEMHCD4KjDz3KUuM1f1s5AzErq25LAbggu2GsZ0yLFZJeozLVqY g/9PCr5yd1Pz3MvYfU/SZa3asApKtJXoNalq+6gWr6t0PH1dthiByCt/mKJnlV4smTw6 NWNVab9bYl4uYNqkWS02canXimZjCN17CUbZYXe9SL7JulVWLuydAktpkg6RJUukePZt NOORqbBaQjF+tp+5I2FTkIs7CnCmefzYgLtXszG3RjUitpiAMTCJ3kUK2TArcFuWLLs+ dhDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BUQN9f8S; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g92-v6si13616634plg.256.2018.05.03.06.44.33; Thu, 03 May 2018 06:45:17 -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=@gmail.com header.s=20161025 header.b=BUQN9f8S; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751718AbeECNj4 (ORCPT + 99 others); Thu, 3 May 2018 09:39:56 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:36020 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751652AbeECNju (ORCPT ); Thu, 3 May 2018 09:39:50 -0400 Received: by mail-qt0-f195.google.com with SMTP id q6-v6so22875452qtn.3; Thu, 03 May 2018 06:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GJ6YcrNCNZ9HvdOJEnqa3Lt58+e9WfCzrhqJSbRa8YM=; b=BUQN9f8S/JiqLVaD2cTcFgsQAe5Sgqq7t/5QSxIKoIQAgYgM+VPGR3rC3RybJmqTgN kdQpiLhnV+oag7hcVoyzXRkxEOeepN4IFuN9cR7AUJFQdS2Do/K7HF7vaIDjBNx2aQYB apUN9+kJkJzBhZAmguY50oL+HCz+agtsp8j0MBknxvdhsxpIP/WQc2nnIIzDdJfpRUYr EoMPYhqmDw+c0mrncIbFT0foZ3i8h2qzfG4vhNhNRbR0B2C7G6VzqUDZaFSpk7+KQTiv 0X/sdqQ/Et1HPt0nQY3o9kyTbXViMS5nimMlT7miJ7Tvr2urVre1vctCbddYJYc3NeP/ PA1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GJ6YcrNCNZ9HvdOJEnqa3Lt58+e9WfCzrhqJSbRa8YM=; b=siFO6/7ipNI5ivUgfY5DWTxZ0XfLIBFdNkGXhbDzF31nyxw5AFjYIs/+AAOQDbpWF9 gKptTE/sYDLvnAdW6Gx8wRrMN/LvGzLX1BrjuEnRF6SL92DcyrjjhHEKWhWk/T8KpEt3 gI4OQ47ds9oZnwgTHM6grqTVnioSyS8tCyZRmWITtVQojDIaaXmJNgPVl5aHrKWzIYkz nAzgbShzu8HnDkJ8EASEH7I+MAbdiagoRi8SB1gicdY4dNK8+dZedR4LI6mzdKd/Dp17 ZzORkUJLGLfR8uM03V2iD45rXvFl7oOIouE++0oOYo4EehJyOyutkNcZQhB0MvFsZp5A eFew== X-Gm-Message-State: ALQs6tCYBes4E+5JHFLt8aODgtojwDC+D6obscMGmnsmuhBxqhc5Tbjo POY8yrgo+itHYFK+RFj8TRY= X-Received: by 2002:aed:21d1:: with SMTP id m17-v6mr19450997qtc.351.1525354789406; Thu, 03 May 2018 06:39:49 -0700 (PDT) Received: from localhost.localdomain ([177.10.56.95]) by smtp.gmail.com with ESMTPSA id g199sm11357407qke.29.2018.05.03.06.39.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 06:39:48 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id D2133180EED; Thu, 3 May 2018 10:39:45 -0300 (-03) Date: Thu, 3 May 2018 10:39:45 -0300 From: Marcelo Ricardo Leitner To: Wenwen Wang Cc: Kangjie Lu , Vlad Yasevich , Neil Horman , "David S. Miller" , "open list:SCTP PROTOCOL" , "open list:NETWORKING [GENERAL]" , open list Subject: Re: [PATCH] sctp: fix a potential missing-check bug Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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