Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp137imu; Wed, 21 Nov 2018 14:14:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7juz1O6CYcNA6DSphmXqsk3dwpAMk9Vja5qXgbdNbj2tP5uIFyQqMR9wNMba0+X8700Fk X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr8459362pll.33.1542838453874; Wed, 21 Nov 2018 14:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542838453; cv=none; d=google.com; s=arc-20160816; b=elwJ+YYjGi3Bkrc10kCYzreHOtd0BNBZpw3GuLE7qVSo3aZ7YNiDErpUw6fyasuo3j 68cv+MBJ3IXVmLlZ8vdj4CRDkxAwXPdGKrfrMx6MeDIL3E6dKKlIiM3RLF9iYI10SLsy QPJgQfqniwvjlgecRtIePKPKDTV8b4fDYS2oC+aGYBzGRJ9Miqy6qm2zT9Ye0E+Y95DE NOvn6Py6AXEmQ1V1wMHFtEF6be7XykX6DxJWoOQCBbCwXSjTWwzLrj2Fp9Qhao2S2Z6A hXDBLnEpEEnteP0f0Z/wy0gHmPM0PN36VMi/uz5sQX/u/EobJ8HBXaIRKHCiCrgwXMvT lheQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JjMPc8Kjw5WBFFiEms6e++KA98re3vf7HXVrl/IwdVY=; b=qyvWcn1AaNzjHTHcZz1/iocmS97aEltjgJqWdpQuFmf3p8oX+FaSkohS6xWyh1WB5x Y7g1Q1bbEn9QrIq0/5KNxNPNzqjAuLVrSbFmUqqg/s2QZJLyejDX3A233VHSwbeTcimK ZgIls9C9/kj4vOWV1xB1BOpSMbphnJ5DJ++Fh9d9QH22ULisacSiluBLFOU/+TUp8Lld UUzhepCxbTsNTpvkZnYBrHaxX6L3uTvtN560PmDW9wkwKNIzg6pITagYVHrf+muf41R4 d+3XGx7colhgopvFKsambPM2y1nou0Ykkfa7mcW7SIpr5N2adrppHqxIxZSrpBUn/PGa ZxNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wP6UyVV3; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si37686818pgi.152.2018.11.21.14.13.58; Wed, 21 Nov 2018 14:14:13 -0800 (PST) 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=@kernel.org header.s=default header.b=wP6UyVV3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387781AbeKVFmv (ORCPT + 99 others); Thu, 22 Nov 2018 00:42:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:37400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387769AbeKVFmu (ORCPT ); Thu, 22 Nov 2018 00:42:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0C2A206BB; Wed, 21 Nov 2018 19:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827237; bh=vwsY/INc2uAMNcXcmRGFPyUWzCUrIoxiiYfh2k/2MV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wP6UyVV3bvCv7D9lRXkggzJnfb8JmkzwYy2VVCSznTY5LcJuVoF2y26RImvNrp50v W2lAHUghkS6uD+WzJMcBffdQjQx1d+xFr0B7k2x5j0jhuqao+R/9N7dn4rul5jl9J5 3DBiJP54F8OgkU+COojubiDIc8DDT3RBjroSDYDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ying Xu , Xin Long , "David S. Miller" Subject: [PATCH 4.19 08/42] sctp: not allow to set asoc prsctp_enable by sockopt Date: Wed, 21 Nov 2018 20:05:44 +0100 Message-Id: <20181121183148.331053310@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183147.869199006@linuxfoundation.org> References: <20181121183147.869199006@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit cc3ccf26f0649089b3a34a2781977755ea36e72c ] As rfc7496#section4.5 says about SCTP_PR_SUPPORTED: This socket option allows the enabling or disabling of the negotiation of PR-SCTP support for future associations. For existing associations, it allows one to query whether or not PR-SCTP support was negotiated on a particular association. It means only sctp sock's prsctp_enable can be set. Note that for the limitation of SCTP_{CURRENT|ALL}_ASSOC, we will add it when introducing SCTP_{FUTURE|CURRENT|ALL}_ASSOC for linux sctp in another patchset. v1->v2: - drop the params.assoc_id check as Neil suggested. Fixes: 28aa4c26fce2 ("sctp: add SCTP_PR_SUPPORTED on sctp sockopt") Reported-by: Ying Xu Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/socket.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3958,32 +3958,16 @@ static int sctp_setsockopt_pr_supported( unsigned int optlen) { struct sctp_assoc_value params; - struct sctp_association *asoc; - int retval = -EINVAL; if (optlen != sizeof(params)) - goto out; + return -EINVAL; - if (copy_from_user(¶ms, optval, optlen)) { - retval = -EFAULT; - goto out; - } + if (copy_from_user(¶ms, optval, optlen)) + return -EFAULT; - asoc = sctp_id2assoc(sk, params.assoc_id); - if (asoc) { - asoc->prsctp_enable = !!params.assoc_value; - } else if (!params.assoc_id) { - struct sctp_sock *sp = sctp_sk(sk); + sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value; - sp->ep->prsctp_enable = !!params.assoc_value; - } else { - goto out; - } - - retval = 0; - -out: - return retval; + return 0; } static int sctp_setsockopt_default_prinfo(struct sock *sk,