Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2527455imm; Thu, 7 Jun 2018 12:09:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKUtexDklIrluBxSnKQhqtmMjqStTgJxAc7fWvcUKJTAHmhPPsorCI+c7WqbGk6cV2XWAbk X-Received: by 2002:a63:6807:: with SMTP id d7-v6mr2498676pgc.7.1528398568844; Thu, 07 Jun 2018 12:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398568; cv=none; d=google.com; s=arc-20160816; b=Wwku01VyrWGu7QEn2AoaapILaZcF1UwECF52v3bHGiOGZ1IuszbPsTXxVGvknrCRm2 00RVykZuFB5Yl74WcTYJ/zvNBZPUAyJEJbhjH7l1OfZbPf1p9sGtSkvnixAhitVo/xLe 3XVgfgCf20U6nP1yGGOgLuIIKfDZjY/eq2VfD+hfo9+CTbJAI7LQ1+wtH7J7OS/BDjmJ 9g9E+XwMlCtR3w2N1/m2XB7B8rbF0L/zfd1e0dsL9ymSe7MnSpwC97bongfmhvAWesQM bodigByvCEvgbOhFFYzXkIxlEjU0SEqKqQ+Ox5QZo9zksQs9TpP6tC9Nh3/Xds7Ibelz n8eQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=w/p8xIslYkmwMMIw1DYoEtNNJaXuAktmTVezFtX1zqM=; b=L3UvAYtzPJPJdwKChKuozwq4VR3zWWMHtijBCSb22+qlqZ4bri+9+Ih2GFUkw18dfV tO4Xqr1P6oIXikjQNmYog/cMLsGxVy+rElG+2fxhWsMMixc7DZMhPMUbRlGhWWl3ljR5 zeEJHsttSilZq6fTDEMOkp5fUlQHav9eaQs4SvXLjDC7RPHyMNkzKT0Gg7o1sFVejOid hk4aAN8WB1uFLVcTUfXK2j7uoAeW3c0FzPIAJw2s/sHx1um9aVRzP+DY+OtB3DYrZU1V G9RYRobh1jKCw/AhG5Xmlin9l8bG4MZD8ZFmYg1UWPUqO1egyFEQKacN4cFeoytByQMK wFsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TXvzYUG1; 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 a3-v6si32139526pll.412.2018.06.07.12.09.14; Thu, 07 Jun 2018 12:09: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=TXvzYUG1; 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 S935490AbeFGSVz (ORCPT + 99 others); Thu, 7 Jun 2018 14:21:55 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:38862 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933152AbeFGSVv (ORCPT ); Thu, 7 Jun 2018 14:21:51 -0400 Received: by mail-qk0-f195.google.com with SMTP id y4-v6so7165428qka.5; Thu, 07 Jun 2018 11:21:51 -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:content-transfer-encoding:in-reply-to :user-agent; bh=w/p8xIslYkmwMMIw1DYoEtNNJaXuAktmTVezFtX1zqM=; b=TXvzYUG1qZeT4xglclHaUc5VKKjWwp7L3pWuYyIRJSQtiqtr045YGT4w0QTH9wFB68 85kAd7857QiqTbvU6vFh507OL1DDKkEwOoVNdvvy3D5WC/RVkWJ8WSUQUK1hURBZHHoh Py+z4n6nLVG96FgaQEp3czIBAkR5Okfjr0i6FDbX0St16Y98K557WjOp8nHjFRHJ0FR4 qoix3hc0aEAeyxOSVPZXugDApblUWOhbnQegTF1Lb+cElDfPbKdcgkp1LcSemejjYgKz SkTX0AWsDmjogJuV7GMKitLlP+WVvETlKVKI+iaJ5sCFxzx9eskMMC/kfFtaWcAY7CaD ivSQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=w/p8xIslYkmwMMIw1DYoEtNNJaXuAktmTVezFtX1zqM=; b=poicCI+lRb4bDHd5Y9LoZ+FYvWMzvUeKrvwY7jC+cI/mpvtx1PgoWUvgdfNzMGzzK4 SO+JbD1DteWxOSBUa+iSN3R+JXyl8cIsaJPPr4HgXsb5v4PZ2cCtJJ98E1MquW62NSb9 rQbNgSHAY9X6S9OTdKpqacbbL2wthP9uJHSis0TIW5kVQ94/3NiqKe6ibj3vF1gBVmu8 ewdIB9iQMhVbLyfsJfB4mI2LlWFAh4ILFlqBIEpDQ+Wq5b1iCPGIztUih23bmkmaQr9r +GveqPnnUcHPJSWVGgVxzHujx3UAqvxxLQpRNXoU4xYk9jt15MGe+DZPJj/T8iPrtDhI N9XA== X-Gm-Message-State: APt69E3ZmV+NmXAMxIbb8uST3ddPlz+6dtM/xJupgzef6KWg0X4NeVTr BAWPaE3ergyNVVh/NCQh5dQ= X-Received: by 2002:a37:2ac7:: with SMTP id q68-v6mr2474198qkq.77.1528395710583; Thu, 07 Jun 2018 11:21:50 -0700 (PDT) Received: from localhost.localdomain ([138.204.24.99]) by smtp.gmail.com with ESMTPSA id s12-v6sm32428767qkl.65.2018.06.07.11.21.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Jun 2018 11:21:49 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 15503180C41; Thu, 7 Jun 2018 15:21:47 -0300 (-03) Date: Thu, 7 Jun 2018 15:21:47 -0300 From: Marcelo Ricardo Leitner To: Ben Hutchings Cc: Xin Long , Neil Horman , stable@vger.kernel.org, "David S. Miller" , Greg Kroah-Hartman , LKML Subject: Re: [PATCH 4.4 19/92] sctp: delay the authentication for the duplicated cookie-echo chunk Message-ID: <20180607182147.GD31423@localhost.localdomain> References: <20180524093159.286472249@linuxfoundation.org> <20180524093200.931521036@linuxfoundation.org> <1528324307.2289.61.camel@codethink.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1528324307.2289.61.camel@codethink.co.uk> 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 Wed, Jun 06, 2018 at 11:31:47PM +0100, Ben Hutchings wrote: > On Thu, 2018-05-24 at 11:37 +0200, Greg Kroah-Hartman wrote: > > 4.4-stable review patch.??If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Xin Long > > > > [ Upstream commit 59d8d4434f429b4fa8a346fd889058bda427a837 ] > > > > Now sctp only delays the authentication for the normal cookie-echo > > chunk by setting chunk->auth_chunk in sctp_endpoint_bh_rcv(). But > > for the duplicated one with auth, in sctp_assoc_bh_rcv(), it does > > authentication first based on the old asoc, which will definitely > > fail due to the different auth info in the old asoc. > [...] > > --- a/net/sctp/associola.c > > +++ b/net/sctp/associola.c > > @@ -1000,9 +1000,10 @@ static void sctp_assoc_bh_rcv(struct wor > > ? struct sctp_endpoint *ep; > > ? struct sctp_chunk *chunk; > > ? struct sctp_inq *inqueue; > > - int state; > > ? sctp_subtype_t subtype; > > + int first_time = 1; /* is this the first time through the loop */ > > ? int error = 0; > > + int state; > > ? > > ? /* The association should be held so we should be safe. */ > > ? ep = asoc->ep; > > @@ -1013,6 +1014,30 @@ static void sctp_assoc_bh_rcv(struct wor > > ? state = asoc->state; > > ? subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type); > > ? > > + /* If the first chunk in the packet is AUTH, do special > > + ?* processing specified in Section 6.3 of SCTP-AUTH spec > > + ?*/ > > + if (first_time && subtype.chunk == SCTP_CID_AUTH) { > > + struct sctp_chunkhdr *next_hdr; > > + > > + next_hdr = sctp_inq_peek(inqueue); > > + if (!next_hdr) > > + goto normal; > > + > > + /* If the next chunk is COOKIE-ECHO, skip the AUTH > > + ?* chunk while saving a pointer to it so we can do > > + ?* Authentication later (during cookie-echo > > + ?* processing). > > + ?*/ > > + if (next_hdr->type == SCTP_CID_COOKIE_ECHO) { > > + chunk->auth_chunk = skb_clone(chunk->skb, > > + ??????GFP_ATOMIC); > > + chunk->auth = 1; > > Doesn't the first_time flag need to be cleared here (and before the > other continue statement in this loop)? Seems the description is not matching the code closely. As is, first_time is about the first time an AUTH chunk is handled followed by a COOKIE-ECHO chunk (which is what we wanted, in the end), and not strictly enforcing 'first chunk in the packet', as the description says. We should rename this first_time into a chunk counter instead. It may even help with debugging on crashes. Thanks for reviewing this, btw. Marcelo > > Ben. > > > + continue; > > + } > > + } > > + > > +normal: > [...] > > -- > Ben Hutchings, Software Developer ? Codethink Ltd > https://www.codethink.co.uk/ Dale House, 35 Dale Street > Manchester, M1 2HF, United Kingdom