Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp16233imu; Thu, 8 Nov 2018 13:59:36 -0800 (PST) X-Google-Smtp-Source: AJdET5fFqcIpYuEDpH34/8X7VILYj+O737PtMXNxh94c2AFhib4YH6KTJSZttisJD6GGVttLiEyI X-Received: by 2002:a62:f541:: with SMTP id n62-v6mr6269827pfh.59.1541714376586; Thu, 08 Nov 2018 13:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541714376; cv=none; d=google.com; s=arc-20160816; b=AUwewdMNfKqurrkjnXJBe9YPwQuiuiQ7dASnu+jacqRL9TK6dVxYyiyB2Y17TYbaYt KeSwrQLgXlw0phqRkjWrLgRRoTGt8SjfV6I/8eeonhDeeNwTmMO/mhqojtgwu1tm4Qwy jaH60jNnPCQ/FgzY1NYawzst0UAGYa0Pjifr4cMKCUcVzzhkPyX+hk/4JHSzUENGlMVr NcJOdEzlNKzA1n3z4gb8Y3B+YBg7R/FDEn+7pst1DNvXCxKEUm4z+MK3kuR1FPFkVH/K ci8Njo4ksSnrVMMFgiHo8Wb21egYVwI66ta+HYATfuX6nmPWqMDov+a93XGRDe4QoIJC djkw== 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=PUhCatG+JbLleZv1DAyaE2F9c0mn9kayrhRdJjTbYTA=; b=XujNMm+nYwwtuVNHeeYCpYbkIj3tscaMkYwwp5pAkFJn/YvqyWYljaF7Lsv3SnCSvD N49CQWUfxSqcna2pfRemo1PPxu8/big/ILApk7kYonHdz0kS4tMRnufcLWdtSan+6BKg OrVoXh6/fVtqCPqIUSP8hktjwSyU7zmEZ9rc13TmQJUWPX7PB9WJlQ9OshbaUG+RID12 Q/SHNqjvBz6rfejrvFGFM0GT3a4/I9ZFhroZbmWba271EyF2zlxHbDrWwnsZWpcaOuqN QKKYnY/UIwQYEuy8oFUjXLlBDwlbS5zseUqkZO6SrofDyZtXTWUvt/q+0KQsPd9Hyms3 fNUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sf+C+gzy; 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 o12-v6si5849280pfh.9.2018.11.08.13.59.21; Thu, 08 Nov 2018 13:59:36 -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=sf+C+gzy; 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 S1729292AbeKIHeO (ORCPT + 99 others); Fri, 9 Nov 2018 02:34:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:50738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727590AbeKIHeO (ORCPT ); Fri, 9 Nov 2018 02:34:14 -0500 Received: from localhost (unknown [208.72.13.198]) (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 59AE4208E3; Thu, 8 Nov 2018 21:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714206; bh=oE9ykIj7bq9CjfPaS0P3Ugq6Y3jHj8HmoxOmwYY4iVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sf+C+gzytlQ0iBSquKKvZsCLHpKXiWhjAfQlyjsbPOYmE4LJ23H0u4q5HCiliRNqZ nYqYYYRQY/X96JsK5wBIS/NsfEffi+AwEs0Ct8/KjVVKFCRazALdgWHlYgnc4JPCAg //1BDpv8A+2nWO+9+LxViL7YAQtXC/7PMuTr708A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Marcelo Ricardo Leitner , "David S. Miller" , Sasha Levin Subject: [PATCH 3.18 118/144] sctp: translate network order to host order when users get a hmacid Date: Thu, 8 Nov 2018 13:51:29 -0800 Message-Id: <20181108215106.555350281@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 7a84bd46647ff181eb2659fdc99590e6f16e501d ] Commit ed5a377d87dc ("sctp: translate host order to network order when setting a hmacid") corrected the hmacid byte-order when setting a hmacid. but the same issue also exists on getting a hmacid. We fix it by changing hmacids to host order when users get them with getsockopt. Fixes: Commit ed5a377d87dc ("sctp: translate host order to network order when setting a hmacid") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 13693d0adeaf..5c16d0e13987 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -5607,6 +5607,7 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, struct sctp_hmac_algo_param *hmacs; __u16 data_len = 0; u32 num_idents; + int i; if (!ep->auth_enable) return -EACCES; @@ -5624,8 +5625,12 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, return -EFAULT; if (put_user(num_idents, &p->shmac_num_idents)) return -EFAULT; - if (copy_to_user(p->shmac_idents, hmacs->hmac_ids, data_len)) - return -EFAULT; + for (i = 0; i < num_idents; i++) { + __u16 hmacid = ntohs(hmacs->hmac_ids[i]); + + if (copy_to_user(&p->shmac_idents[i], &hmacid, sizeof(__u16))) + return -EFAULT; + } return 0; } -- 2.17.1