Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B261D320A for ; Mon, 8 May 2023 03:10:36 +0000 (UTC) Received: from 167-179-156-38.a7b39c.syd.nbn.aussiebb.net (167-179-156-38.a7b39c.syd.nbn.aussiebb.net [167.179.156.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54DF37EC8 for ; Sun, 7 May 2023 20:10:30 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1pvrGN-006K04-9S; Mon, 08 May 2023 11:10:13 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Mon, 08 May 2023 11:10:12 +0800 Date: Mon, 8 May 2023 11:10:12 +0800 From: Herbert Xu To: Tobias Brunner Cc: Steffen Klassert , netdev@vger.kernel.org, "David S . Miller" Subject: Re: [PATCH ipsec] af_key: Reject optional tunnel/BEET mode templates in outbound policies Message-ID: References: <6dcb6a58-2699-9cde-3e34-57c142dbcf14@strongswan.org> <8b8dbbc4-f956-8cbf-3700-1da366357a6f@strongswan.org> <5d5bf4d9-5b63-ae0d-2f65-770e911ea7d6@strongswan.org> <46fcb205-989e-4ea7-463d-e72b85db9e71@strongswan.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46fcb205-989e-4ea7-463d-e72b85db9e71@strongswan.org> X-Spam-Status: No, score=2.7 required=5.0 tests=BAYES_00,HELO_DYNAMIC_IPADDR2, PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS,TVD_RCVD_IP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Fri, May 05, 2023 at 01:36:15PM +0200, Tobias Brunner wrote: > xfrm_state_find() uses `encap_family` of the current template with > the passed local and remote addresses to find a matching state. > If an optional tunnel or BEET mode template is skipped in a mixed-family > scenario, there could be a mismatch causing an out-of-bounds read as > the addresses were not replaced to match the family of the next template. > > While there are theoretical use cases for optional templates in outbound > policies, the only practical one is to skip IPComp states in inbound > policies if uncompressed packets are received that are handled by an > implicitly created IPIP state instead. > > Signed-off-by: Tobias Brunner > --- > net/key/af_key.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) Acked-by: Herbert Xu Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt