Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755508AbcCBBZo (ORCPT ); Tue, 1 Mar 2016 20:25:44 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:34623 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753550AbcCAXzP (ORCPT ); Tue, 1 Mar 2016 18:55:15 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=JU+VSjifLYQBM0VjC2Bmx/PBHVdT0QhOBdepNCybQpC9Pq6m43ADq1XGx+FVZoWlXXuS0WaF/Myf aKZiiQ2a5iMDMjOC7kxDsq/lfyVZlK07Ehh49CBhl6Ppz7CbStGztievmAPxZpfPUJ8JoSFxzyzf x8l4Y4XucjQW9rjLJTA=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 046/342] unix_diag: fix incorrect sign extension in unix_lookup_by_ino X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , "Dmitry V. Levin" , Cong Wang , "David S. Miller" Message-Id: <20160301234529.455896376@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.ccf6f6659eed43e89ac4900120267e6f X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:53:58 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1213 Lines: 38 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Dmitry V. Levin" [ Upstream commit b5f0549231ffb025337be5a625b0ff9f52b016f0 ] The value passed by unix_diag_get_exact to unix_lookup_by_ino has type __u32, but unix_lookup_by_ino's argument ino has type int, which is not a problem yet. However, when ino is compared with sock_i_ino return value of type unsigned long, ino is sign extended to signed long, and this results to incorrect comparison on 64-bit architectures for inode numbers greater than INT_MAX. This bug was found by strace test suite. Fixes: 5d3cae8bc39d ("unix_diag: Dumping exact socket core") Signed-off-by: Dmitry V. Levin Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/unix/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/unix/diag.c +++ b/net/unix/diag.c @@ -220,7 +220,7 @@ done: return skb->len; } -static struct sock *unix_lookup_by_ino(int ino) +static struct sock *unix_lookup_by_ino(unsigned int ino) { int i; struct sock *sk;