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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 ECD49CA9EA0 for ; Fri, 25 Oct 2019 09:00:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C616521929 for ; Fri, 25 Oct 2019 09:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408636AbfJYJAu convert rfc822-to-8bit (ORCPT ); Fri, 25 Oct 2019 05:00:50 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:45628 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404999AbfJYJAu (ORCPT ); Fri, 25 Oct 2019 05:00:50 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-33-3ZvEoFwjNpyTSMbcjLQ4AQ-1; Fri, 25 Oct 2019 10:00:46 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 25 Oct 2019 10:00:45 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 25 Oct 2019 10:00:45 +0100 From: David Laight To: 'Marcelo Ricardo Leitner' , Xin Long CC: network dev , "linux-sctp@vger.kernel.org" , Neil Horman , "davem@davemloft.net" Subject: RE: [PATCHv3 net-next 2/5] sctp: add pf_expose per netns and sock and asoc Thread-Topic: [PATCHv3 net-next 2/5] sctp: add pf_expose per netns and sock and asoc Thread-Index: AQHViuObUMLYfsY4SkimZzbsfLzKtKdrDrFA Date: Fri, 25 Oct 2019 09:00:45 +0000 Message-ID: <995e44322af74c41bbff2c77338f83bf@AcuMS.aculab.com> References: <20191025032337.GC4326@localhost.localdomain> In-Reply-To: <20191025032337.GC4326@localhost.localdomain> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: 3ZvEoFwjNpyTSMbcjLQ4AQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Marcelo Ricardo Leitner > Sent: 25 October 2019 04:24 ... > > @@ -5521,8 +5522,16 @@ static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len, > > > > transport = sctp_addr_id2transport(sk, &pinfo.spinfo_address, > > pinfo.spinfo_assoc_id); > > - if (!transport) > > - return -EINVAL; > > + if (!transport) { > > + retval = -EINVAL; > > + goto out; > > + } > > + > > + if (transport->state == SCTP_PF && > > + transport->asoc->pf_expose == SCTP_PF_EXPOSE_DISABLE) { > > + retval = -EACCES; > > + goto out; > > + } > > As is on v3, this is NOT an UAPI violation. The user has to explicitly > set the system or the socket into the disabled state in order to > trigger this new check. Only because the default isn't to be backwards compatible with the old kernel and old applications. An old application running on a system that has the protocol parts of PF enabled mustn't see any PF events, states or obscure error returns. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)