From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756864AbdEDTpW (ORCPT ); Thu, 4 May 2017 15:45:22 -0400 Received: from gateway36.websitewelcome.com ([192.185.188.18]:38160 "EHLO gateway36.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbdEDTpV (ORCPT ); Thu, 4 May 2017 15:45:21 -0400 X-Greylist: delayed 1498 seconds by postgrey-1.27 at vger.kernel.org; Thu, 04 May 2017 15:45:21 EDT Date: Thu, 04 May 2017 14:00:15 -0500 Message-ID: <20170504140015.Horde.iqqsROVYuFdJnC6P1dMPyBa@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Joe Perches Cc: David Miller , kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [net-ipv4] question about arguments position References: <20170504110755.Horde.9md-X4baf8TwOEKjGrXkelZ@gator4166.hostgator.com> <20170504.124600.627647229351638856.davem@davemloft.net> <1493920071.22125.37.camel@perches.com> In-Reply-To: <1493920071.22125.37.camel@perches.com> User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Exim-ID: 1d6Lz5-000C6t-PV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:56783 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 1 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joe, Quoting Joe Perches : > On Thu, 2017-05-04 at 12:46 -0400, David Miller wrote: >> From: "Gustavo A. R. Silva" >> Date: Thu, 04 May 2017 11:07:54 -0500 >> >> > While looking into Coverity ID 1357474 I ran into the following piece >> > of code at net/ipv4/inet_diag.c:392: >> >> Because it's been this way since at least 2005, it doesn't matter if >> the order is correct or not.  What's there is the locked in behavior >> exposed to userspace and changing it will break things for people. > > Adding a few comments around the code about why > it is this way will help avoid future questions. In the case of Coverity, I already triaged and documented this issue. So people can ignore it in the future. Regarding the code comments, what about the following patch: diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 3828b3a..7a56641 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -389,6 +389,12 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, nlmsg_flags, unlh, net_admin); } +/* + * Ignore the position of the arguments req->id.idiag_dport and + * req->id.idiag_sport in both calls to inet_lookup() and inet6_lookup() + * functions, once this is a locked in behavior exposed to user space. + * Changing this will break things for people. + */ struct sock *inet_diag_find_one_icsk(struct net *net, struct inet_hashinfo *hashinfo, const struct inet_diag_req_v2 *req) Thanks -- Gustavo A. R. Silva