From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568C0C43331 for ; Mon, 30 Mar 2020 05:02:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2996520786 for ; Mon, 30 Mar 2020 05:02:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728433AbgC3FCn (ORCPT ); Mon, 30 Mar 2020 01:02:43 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:33230 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgC3FCn (ORCPT ); Mon, 30 Mar 2020 01:02:43 -0400 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id E41D015C5C89D; Sun, 29 Mar 2020 22:02:42 -0700 (PDT) Date: Sun, 29 Mar 2020 22:02:42 -0700 (PDT) Message-Id: <20200329.220242.1383520985415551854.davem@davemloft.net> To: marcelo.leitner@gmail.com Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, nhorman@tuxdriver.com, lucien.xin@gmail.com, meng.a.jin@nokia-sbell.com Subject: Re: [PATCH net] sctp: fix possibly using a bad saddr with a given dst From: David Miller In-Reply-To: References: X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 29 Mar 2020 22:02:43 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Marcelo Ricardo Leitner Date: Thu, 26 Mar 2020 20:47:46 -0300 > Under certain circumstances, depending on the order of addresses on the > interfaces, it could be that sctp_v[46]_get_dst() would return a dst > with a mismatched struct flowi. > > For example, if when walking through the bind addresses and the first > one is not a match, it saves the dst as a fallback (added in > 410f03831c07), but not the flowi. Then if the next one is also not a > match, the previous dst will be returned but with the flowi information > for the 2nd address, which is wrong. > > The fix is to use a locally stored flowi that can be used for such > attempts, and copy it to the parameter only in case it is a possible > match, together with the corresponding dst entry. > > The patch updates IPv6 code mostly just to be in sync. Even though the issue > is also present there, it fallback is not expected to work with IPv6. > > Fixes: 410f03831c07 ("sctp: add routing output fallback") > Reported-by: Jin Meng > Signed-off-by: Marcelo Ricardo Leitner Applied and queued up for -stable. From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Date: Mon, 30 Mar 2020 05:02:42 +0000 Subject: Re: [PATCH net] sctp: fix possibly using a bad saddr with a given dst Message-Id: <20200329.220242.1383520985415551854.davem@davemloft.net> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: marcelo.leitner@gmail.com Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, nhorman@tuxdriver.com, lucien.xin@gmail.com, meng.a.jin@nokia-sbell.com From: Marcelo Ricardo Leitner Date: Thu, 26 Mar 2020 20:47:46 -0300 > Under certain circumstances, depending on the order of addresses on the > interfaces, it could be that sctp_v[46]_get_dst() would return a dst > with a mismatched struct flowi. > > For example, if when walking through the bind addresses and the first > one is not a match, it saves the dst as a fallback (added in > 410f03831c07), but not the flowi. Then if the next one is also not a > match, the previous dst will be returned but with the flowi information > for the 2nd address, which is wrong. > > The fix is to use a locally stored flowi that can be used for such > attempts, and copy it to the parameter only in case it is a possible > match, together with the corresponding dst entry. > > The patch updates IPv6 code mostly just to be in sync. Even though the issue > is also present there, it fallback is not expected to work with IPv6. > > Fixes: 410f03831c07 ("sctp: add routing output fallback") > Reported-by: Jin Meng > Signed-off-by: Marcelo Ricardo Leitner Applied and queued up for -stable.