Received: by 10.192.165.148 with SMTP id m20csp1804705imm; Thu, 3 May 2018 05:48:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp5i0tCM7GG4JVkOh/isu5DuXMW5nEKPCkB5fSRMERRc3A+AZ/tjBaZmnmxo+0jf7u7dkSw X-Received: by 2002:a17:902:9004:: with SMTP id a4-v6mr22574302plp.143.1525351708280; Thu, 03 May 2018 05:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525351708; cv=none; d=google.com; s=arc-20160816; b=Q+vbK/FTJgDQZyFLd9jvEg1Y/dF+aMvRsfkfPyvQhQaj/0zuHKqNdZoLi9ZNaA5vpF HXW2ET8bx0uANN/YIcjkNXFZMC8eMbhzVIaTjXwu3rVo3RQaciwgotJHAHA25sr2jU9L hbPkY69nrLvKvqDlrxVBFTQuGyfuJrhOCkIbLEnsLIL9StDJQYQCDfwaVn7qTDRIKZUN VzSVPmJR1zQEKMrDRCw9w/s/LjOaZpPvcWeS1gFlBGbGkCBeKDtGJOVUhG/iWUzPzGfc jjYFXCJIPT72JK9hXIsLMZ6Ap3Bfdz+ucU8SGZU3DhvRKw6XdkQAGTtcxy+tajAPQbBi +H4A== 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=CmfdaUjQ2Oi/SLvihK0nHhgq3rydY51anIOn+cE7P+I=; b=BMOfpE226uUoOylXwBH3/FYbYxbEk5cfFOpDfFBvZ+hGPJ8jjX5pWLwKwzybEFyMO7 EhGnl6WJI3HSJ0Ae1kybd++OoxByIF2UDIItz19pYj7O0IbPrIe9PRI8F2Mjw1C8b7sG QJJRjJWY881dMtJs/s8uvAFEQbqtIe0FnWgQhGtTrW6nL32UsgvIwaF9XxnIaff0/Cu9 TTf+pnn8YlmQwl/2v3MbfnU6GFSr0huyQCIPK1A6l6aOo9GhgCjNAhxlrxJ6ZgCZqXAV //Efg07RNwQF3oyP311VBE2vwHnjUpL+c/26NM0hw+EvmCnd0EuSKoKjiz1WOlLlUmVC JYrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Io214Ce7; 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 e1-v6si13448703pld.69.2018.05.03.05.48.14; Thu, 03 May 2018 05:48:28 -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=Io214Ce7; 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 S1752034AbeECMql (ORCPT + 99 others); Thu, 3 May 2018 08:46:41 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:33703 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811AbeECMqe (ORCPT ); Thu, 3 May 2018 08:46:34 -0400 Received: by mail-qt0-f194.google.com with SMTP id e8-v6so17747598qth.0; Thu, 03 May 2018 05:46:33 -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=CmfdaUjQ2Oi/SLvihK0nHhgq3rydY51anIOn+cE7P+I=; b=Io214Ce7NmrpNmfItC6M/R2Hp9LSTwmrD9lEfeNCECG6SnPGqbWT/fK0AxFRsa65K1 20wUzuBelNdMPHS/6ECYFb8sgIy4COgiBGDTtkBcLOvJkE8Yr3OzXm/2BXpMQXzKrwoL JU6xjoyLo7YTiEZMV5Xht01lkrd1J7z+KrvKYi+fMNoBOgXZCg7ogqjMXJ4qyJ4p3QBu e82i4fhwpRY1j+mNwm9lnq0XnurckWSnpvZuAn2X/HlzukuwDAq9xSFe29jhUiJNIu7K Z3YN2dTq6OJJnkMroq5IN1P75lEprtGr+uVlo7QKAxt/yV5lFc7LQhSWPO5gL+D4WZNL YZFg== 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=CmfdaUjQ2Oi/SLvihK0nHhgq3rydY51anIOn+cE7P+I=; b=RfG/471MforpPrbnM/U0zOlKlWIADCV0+CufrXcD/mpj0mFlhjR9Aghp22X68TaW3E KO1ihv4W6c/xnFUzV7exXGEXK/dUXu0Gd+A5C6FQU7I9ulKgpVWWXswg2XRXjlfwHTOP KruYL/hZMDq8seD2ReSsndUWgKalXc0WniFcvdGsqVzkjmxbRxzyroW6W4zJxSfcNP3O EVbZKJq1Gs/MjXc4kOhYn2aE0xaCiIsat7TdzFmUJoGU202IiWQZQUAFmqWb8dI3GXdC lF4yGvvjWIwRvvDyneyyCbG8pP+uXvgE5pUKiKlSA2TMBTMg65sWZfWsDk18WONs7y6l b6VQ== X-Gm-Message-State: ALQs6tCFzZduHe7xXLGC6BZxP0LBrhDjQI8RjpGiX+flubhBN9M0K8lw cWBqCGLy9miJLfdqFFXOI10= X-Received: by 2002:a0c:f086:: with SMTP id g6-v6mr3341306qvk.54.1525351593096; Thu, 03 May 2018 05:46:33 -0700 (PDT) Received: from localhost.localdomain ([177.10.56.95]) by smtp.gmail.com with ESMTPSA id e4sm10195341qkc.66.2018.05.03.05.46.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 05:46:32 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id ECADA180EED; Thu, 3 May 2018 09:46:29 -0300 (-03) Date: Thu, 3 May 2018 09:46:29 -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: <20180503124629.GM5105@localhost.localdomain> References: <1525310145-28102-1-git-send-email-wang6495@umn.edu> <20180503012402.GK5105@localhost.localdomain> <20180503014838.GL5105@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 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