Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp51886imu; Thu, 8 Nov 2018 14:37:04 -0800 (PST) X-Google-Smtp-Source: AJdET5flj/hehznID0oLtKXiOEklCfkBjnaBwaWNh54kl2Ap0rHBPKdM4yhR23dZwp/AveYJMSt/ X-Received: by 2002:a63:e302:: with SMTP id f2mr5399857pgh.320.1541716624400; Thu, 08 Nov 2018 14:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716624; cv=none; d=google.com; s=arc-20160816; b=lpEO09ueLLdINp9qoQP7OZF7oY54LsEf9Qq6MlXnoll/nIhyKMhhlhM48n8qSsbeKK n+4z0pk4chD7ppRlqpGgpmC8IX7+Z6lff0FIgj1N8LoJFEZt0UzjqOJdX/G3K0XkvAr5 LBP4lMzLrXP+R1cf//CSD5ehdyD3WFQDPFZ82VcUfRdExOum1+AJ29OYlpJkbmmsQNqf 1VMgsnMIyWLvm7MlPl6MuMsOZTj/guKF2eDcDScsgg6X5PwLvy9JoHU+1zo4jxatmXUC 0swyvu3c8OPaPDnqWy+s1U6Fn+nKPlASj0j5iYdhvQJ2fbr+aqXB8KpkvCQ2S4BVUjh9 14dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G3I6jn13RuKhTqIWsbsq7Fa84wvrc93D3x2+SS0D3zo=; b=iYFmtKdj4ttHovxaPmo4liAjpBAcdbTWAlKm2OvQrFfJxF5fLVo39ynl2gvZUlPWvb Sn6xoniyovWvF9t884gCMQF5YgQe9ZLVM5t1OKBA7+9ybAeUsyUVfk7UW60EOLT5i6ke kjuOr39OZbLeFzMi47ix6+MLms5gEffRcWJ3+kh+SiUnjyNBzjjAwnozSahrupupBt1S udyUbiaIeDB52KfKHDSPDOBUSu/HLHCDU14Dm5WVGxEB1aIImBSqXNJtli9YYp/4J6uG octaZmmF6/WSYTo4WElPahi9PaJ/Habsj6gPiRGuFUUTHdXwdYVFWqsJfGhdPplMEicc ZDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QAd1CUKE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si5223023plp.128.2018.11.08.14.36.48; Thu, 08 Nov 2018 14:37:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QAd1CUKE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbeKIIOK (ORCPT + 99 others); Fri, 9 Nov 2018 03:14:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:53792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728106AbeKIHgX (ORCPT ); Fri, 9 Nov 2018 02:36:23 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E20F20818; Thu, 8 Nov 2018 21:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714335; bh=sAmQb4Hjf7tVzNcLxj5TkzxW72LiGbhxx5odDLUXbp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QAd1CUKEYy4VPrLYrFF0QAuz4h3sfFS4EKFC6Ydo0tOdUZMgUpf8zp7Akqx9+GSLl NoKt4KIsifCpjz1asCC9dTx9NG9A2zluUrt6Q2LV5qTTp7OTAJrr6uS7g7tHGeTa5l iUZ7HF7tb30N4wCoMz60Na/9djXNRtKFSGWaXgAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Herrmann , Hannes Frederic Sowa , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 021/114] net: drop write-only stack variable Date: Thu, 8 Nov 2018 13:50:36 -0800 Message-Id: <20181108215101.046481417@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 3575dbf2cbbc8e598f17ec441aed526dbea0e1bd ] Remove a write-only stack variable from unix_attach_fds(). This is a left-over from the security fix in: commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 Author: willy tarreau Date: Sun Jan 10 07:54:56 2016 +0100 unix: properly account for FDs passed over unix sockets Signed-off-by: David Herrmann Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/unix/af_unix.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e05ec54ac53f..c6b1eec94911 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1531,7 +1531,6 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) { int i; unsigned char max_level = 0; - int unix_sock_count = 0; if (too_many_unix_fds(current)) return -ETOOMANYREFS; @@ -1539,11 +1538,9 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) for (i = scm->fp->count - 1; i >= 0; i--) { struct sock *sk = unix_get_socket(scm->fp->fp[i]); - if (sk) { - unix_sock_count++; + if (sk) max_level = max(max_level, unix_sk(sk)->recursion_level); - } } if (unlikely(max_level > MAX_RECURSION_LEVEL)) return -ETOOMANYREFS; -- 2.17.1