Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347509

[PATCH 4.4 024/342] sctp: translate network order to host order when users get a hmacid

Path csiph.com!news.freedyn.net!aioe.org!bofh.it!news.nic.it!robomod
From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 024/342] sctp: translate network order to host order when users get a hmacid
Date Wed, 02 Mar 2016 02:40:03 +0100
Message-ID <r83VF-sE-37@gated-at.bofh.it> (permalink)
References <r82mS-7Ml-9@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; s=mandrill; d=linuxfoundation.org; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=gregkh@linuxfoundation.org; bh=7HfsYPlK0e5+nLsa0ncGdTX+fcQ=; b=qqukwjtGzcHVyumoNZX6q720gY8S5BkpvWbm95eABUzbutiaD9zE3N6LfPx67dG6cuezJZ0fadEC QwBMYRvvzX9v73Hvj+G/49EtjTmgdoSvoITG/+BnBg8Sblp3HCSldJJTkmu4AOoLASVYzRQtBjpN XMyZ1/bZ2EHVNj68T1M=
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1456876432; h=From : Subject : To : Cc : Message-Id : In-Reply-To : References : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=2og53/rZS9Nyd3u89h9h5I+ND4/Ok/+T6pshvRxRh4w=; b=RNdzLpMWwIsC2G+uqJIjVrhc85n3hNmqEWB/0ETBgvaHuTN1f8JrvtPuzX6PdxoZ5t6kPp 5P8uehIe+WOCjGZLeb3fdpNOgW2EiMj3xTzPzPRoGKSFsmwyFS/RmPoCh4HJP6yHifS2Qveg O2yZ1QQJCTR0xcWmJU1zeZEg4bwxI=
X-Mailer git-send-email 2.7.2
X-Report-Abuse Please forward a copy of this message, including all headers, to abuse@mandrill.com
X-Report-Abuse You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.7420ec2716424b6b90cd568974f84d60
X-Mandrill-User md_30481620
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 48
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <stable@vger.kernel.org>, Xin Long <lucien.xin@gmail.com>, Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>, "David S. Miller" <davem@davemloft.net>
X-Original-Date Tue, 01 Mar 2016 23:53:52 +0000
X-Original-Message-ID <20160301234528.765232758@linuxfoundation.org>
X-Original-References <20160301234527.990448862@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1347509

Show key headers only | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Xin Long <lucien.xin@gmail.com>

[ 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 <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sctp/socket.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5542,6 +5542,7 @@ static int sctp_getsockopt_hmac_ident(st
 	struct sctp_hmac_algo_param *hmacs;
 	__u16 data_len = 0;
 	u32 num_idents;
+	int i;
 
 	if (!ep->auth_enable)
 		return -EACCES;
@@ -5559,8 +5560,12 @@ static int sctp_getsockopt_hmac_ident(st
 		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;
 }

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 4.4 024/342] sctp: translate network order to host order when users get a hmacid Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 02:40 +0100

csiph-web