From patchwork Fri Jun 14 11:30:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aydin Arik X-Patchwork-Id: 251382 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6124B2C0084 for ; Fri, 14 Jun 2013 21:31:23 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752459Ab3FNLan (ORCPT ); Fri, 14 Jun 2013 07:30:43 -0400 Received: from gate.alliedtelesyn.co.nz ([202.49.72.33]:41630 "HELO gate.alliedtelesyn.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752300Ab3FNLal (ORCPT ); Fri, 14 Jun 2013 07:30:41 -0400 Received: (qmail 16136 invoked from network); 14 Jun 2013 11:30:40 -0000 Received: from mmarshal3.atlnz.lc (10.32.18.43) by gate-int.alliedtelesyn.co.nz with SMTP; 14 Jun 2013 11:30:40 -0000 Received: from alliedtelesyn.co.nz (Not Verified[10.32.16.32]) by mmarshal3.atlnz.lc with MailMarshal (v7, 1, 0, 4874) id ; Fri, 14 Jun 2013 23:30:39 +1200 Received: from MAIL/SpoolDir by alliedtelesyn.co.nz (Mercury 1.48); 14 Jun 13 23:35:19 +1200 Received: from SpoolDir by MAIL (Mercury 1.48); 14 Jun 13 23:35:19 +1200 Received: from aydina-dl.ws.atlnz.lc (10.33.21.11) by alliedtelesyn.co.nz (Mercury 1.48) with ESMTP; 14 Jun 13 23:35:11 +1200 Received: by aydina-dl.ws.atlnz.lc (Postfix, from userid 1643) id BC6FB80CFA; Fri, 14 Jun 2013 23:30:30 +1200 (NZST) From: Aydin Arik Cc: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Aydin Arik Subject: [PATCH 1/1] [PATCH v2] tcp: Fixed MD5 key lookups when adding/removing MD5. Date: Fri, 14 Jun 2013 23:30:03 +1200 Message-Id: <1371209403-28275-1-git-send-email-aydin.arik@alliedtelesis.co.nz> X-Mailer: git-send-email 1.7.9.5 To: unlisted-recipients:; (no To-header on input) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org MD5 key lookups on a given TCP socket were being performed incorrectly. This fix alters parameter inputs to the MD5 lookup function tcp_md5_do_lookup, which is called by functions tcp_md5_do_add and tcp_md5_do_del. Specifically, the change now inputs the correct address and address family required to make a proper lookup. Commit a915da9b69273815527ccb3789421cb7027b545b ("tcp: md5: rcu conversion") is the source of the regression. Signed-off-by: Aydin Arik Acked-by: Eric Dumazet --- net/ipv4/tcp_ipv4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d09203c..da84cdb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1005,7 +1005,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, struct tcp_sock *tp = tcp_sk(sk); struct tcp_md5sig_info *md5sig; - key = tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&addr, AF_INET); + key = tcp_md5_do_lookup(sk, addr, family); if (key) { /* Pre-existing entry - just update that one. */ memcpy(key->key, newkey, newkeylen); @@ -1050,7 +1050,7 @@ int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family) struct tcp_md5sig_key *key; struct tcp_md5sig_info *md5sig; - key = tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&addr, AF_INET); + key = tcp_md5_do_lookup(sk, addr, family); if (!key) return -ENOENT; hlist_del_rcu(&key->node);