Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp396627yba; Sat, 4 May 2019 04:49:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZXQoWk3FoM28fq09Yu7eTBeWgIUhMlFc5VlT03mOIArc/w0L9LODOx/URLJQfq2kzsY1X X-Received: by 2002:a17:902:6b02:: with SMTP id o2mr17912744plk.24.1556970547824; Sat, 04 May 2019 04:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556970547; cv=none; d=google.com; s=arc-20160816; b=WStViFQkrnaGRu91t9jugHCg1ETSRPy+eyoSyFrlB8JM/fr2uRp1tc1kJxT5WQsV3b cDedBD/msE3FCnTb/oWBGSPnEDGjvgyz0tKAoVWiOLfR5RaxU6WoAore3mzSZmGI7Jw/ 4cR9kdN9CwKVX89WRk8uDIEXZinCk0G6c8n4VlxkwGyb+vWG4J3TyxjW3DfZzCH4ycoj Vb2GbqshwmGjSBDYDInFJFyoy7ESR73wB+fS692iPOjcsqRxxLs5Rn2c5wAGDjOX0qgD uKiP/Dds9xmp2FrkmnbsfzTMTxTpV2KPtlr8WnsrTRkVAgMbsT5b+Cvejd/mNq71/lxE gV+w== 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=InLlAE6fR8MSW8AWf6V8wSQV/j/Hi6LfU9NP//MvY3Y=; b=c7KRl6rPZPLVRxu+bxZP8/w0iFYXfCG2mBgweU7V7MJJiHTu8qyyXoZn6dWFa0HLG2 otf0lVAQACZCGu5F3FzSjqvmIC1RG/KPyvPCkiQAaWJeKbypURWO9p/qZFFmT5wtdnDJ 8rddFuixxrlyJl3rjTJU4qkeOWwInDKDtqwn5jxSOYkloayzwMZIb4x6yNbyJc+Z8oi8 DgEmwoG3xvitETlZnyYxLzWC2CrigGqqUmUmcf4FxO45jS7PMOVKV0Ul7S+SWF5NEUts Xq2Ciyx2Vw05Nal19zBqgJzpaEBWtctSv9fEfwVfporvoL+jW1y5TZ6PExVAp5HKQfds y74A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bXIRrpkm; 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 o16si7537000pli.389.2019.05.04.04.48.39; Sat, 04 May 2019 04:49:07 -0700 (PDT) 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=bXIRrpkm; 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 S1728324AbfEDK1v (ORCPT + 99 others); Sat, 4 May 2019 06:27:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727592AbfEDK1t (ORCPT ); Sat, 4 May 2019 06:27:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B2238206BB; Sat, 4 May 2019 10:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556965669; bh=WxviFEhBUVUEYscPUv8ZVWpQNTSHav4t3Z4Ag8TB/i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXIRrpkmOPte8nRlLUZ9Rh5el7KTewWeXhwrRnCrpOo1Ge1CbK0HqljcwWRSCx/iy VVinkSq1NGh9Ad6Vft06a8XjMFQ9++pyJhQgRPBCbE4DK0RMMPboywgErPQRwHAzWL EpMlnMccCN3vdkM5UzedtzUELWZVAcH5gjj0taks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.19 05/23] ipv6: invert flowlabel sharing check in process and user mode Date: Sat, 4 May 2019 12:25:07 +0200 Message-Id: <20190504102451.747750335@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190504102451.512405835@linuxfoundation.org> References: <20190504102451.512405835@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Willem de Bruijn [ Upstream commit 95c169251bf734aa555a1e8043e4d88ec97a04ec ] A request for a flowlabel fails in process or user exclusive mode must fail if the caller pid or uid does not match. Invert the test. Previously, the test was unsafe wrt PID recycling, but indeed tested for inequality: fl1->owner != fl->owner Fixes: 4f82f45730c68 ("net ip6 flowlabel: Make owner a union of struct pid* and kuid_t") Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_flowlabel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -639,9 +639,9 @@ recheck: if (fl1->share == IPV6_FL_S_EXCL || fl1->share != fl->share || ((fl1->share == IPV6_FL_S_PROCESS) && - (fl1->owner.pid == fl->owner.pid)) || + (fl1->owner.pid != fl->owner.pid)) || ((fl1->share == IPV6_FL_S_USER) && - uid_eq(fl1->owner.uid, fl->owner.uid))) + !uid_eq(fl1->owner.uid, fl->owner.uid))) goto release; err = -ENOMEM;