From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbcAWOq5 (ORCPT ); Sat, 23 Jan 2016 09:46:57 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:27482 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbcAWOqg (ORCPT ); Sat, 23 Jan 2016 09:46:36 -0500 Message-Id: <20160123141222.540115137@1wt.eu> User-Agent: quilt/0.63-1 Date: Sat, 23 Jan 2016 15:12:34 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xin Long , Marcelo Ricardo Leitner , Neil Horman , Vlad Yasevich , "David S. Miller" , Ben Hutchings , Willy Tarreau Subject: [PATCH 2.6.32 13/42] sctp: translate host order to network order when setting a hmacid MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.32-longterm review patch. If anyone has any objections, please let me know. ------------------ From: lucien commit ed5a377d87dc4c87fb3e1f7f698cba38cd893103 upstream. now sctp auth cannot work well when setting a hmacid manually, which is caused by that we didn't use the network order for hmacid, so fix it by adding the transformation in sctp_auth_ep_set_hmacs. even we set hmacid with the network order in userspace, it still can't work, because of this condition in sctp_auth_ep_set_hmacs(): if (id > SCTP_AUTH_HMAC_ID_MAX) return -EOPNOTSUPP; so this wasn't working before and thus it won't break compatibility. Fixes: 65b07e5d0d09 ("[SCTP]: API updates to suport SCTP-AUTH extensions.") Signed-off-by: Xin Long Signed-off-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Acked-by: Vlad Yasevich Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings (cherry picked from commit 98d37e7fed9568f37d4a4a150a3773cfafef91ed) Signed-off-by: Willy Tarreau --- net/sctp/auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 133ce49..b4ce70a 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -803,8 +803,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, if (!has_sha1) return -EINVAL; - memcpy(ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0], - hmacs->shmac_num_idents * sizeof(__u16)); + for (i = 0; i < hmacs->shmac_num_idents; i++) + ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]); ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) + hmacs->shmac_num_idents * sizeof(__u16)); return 0; -- 1.7.12.2.21.g234cd45.dirty