Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5591119imm; Tue, 12 Jun 2018 10:04:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPZTcI6UO4Q4xy84L/Xvub0KYDRHh5tK90jFz1UanwTPgs4CeV4wL4deT9QiIJ+9T36rCM X-Received: by 2002:a65:53cc:: with SMTP id z12-v6mr1051951pgr.350.1528823084352; Tue, 12 Jun 2018 10:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528823084; cv=none; d=google.com; s=arc-20160816; b=gb0noFF1tATFK+nZHzDfowLTrTYnG6ReyEIqc/RnbLCEcM4tFYVC0kpvisdTZ/Po7D FOUSN5ifkbZK2YqzSvYZwaBzjdayw295tu0v0CjOjIAlokOHESGwKBnlEOXjN+6GDZN/ 7O9lxaD5ESsZyct5Nzowb8z8nJ6Oyweq2aj3hjSz35LTOy1xdBEzCJvQjMPipnXa9GkD CPQVp9gNltIzQnCZvLnmuseiMoBvvEraQAZKvAvHNTM2uCEYmd0H7P/a7wfhd8rggWSl TMhvZ7NWa2okoHwYkg0aSVs3QKiNtWk1itAqCseHeeaDkw4GrhCwpd5LcVVpo1z6fE25 gQ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ITQEyeGMeqnjPtmWCQ8locHuNyeE7vuIUUD+A8/oN3o=; b=R2CkGYUvcoblox0r4Lb9EilHzwh6Zvsg6CPg1aHLPVmWYeYDMilrySzyhNoa23yiCw 4HPdtyTQqTPI1Z7E4hlS7xLQLRvQWmWM3w6FS6FcEB2p5olkHFIiKm7LzxKXkr4rNcis jhFrKCF7SC1fXQdLAqPF0XVIdnj7EItC1iViD2Bq5N6vj6DCa2njA4Lmkpx9VuE8QuYm K1uajpR1pvRST35hvlwbjbg1i3/tn2KtDfMRMhuoyDTh9aIWlExgggpZVM2jy9V6GeOL LX1WVMAZCUQv/j0rTDNYlpT0CMhhFGWo6mc8dX2AEAr0+9QwolufqMxS2+JPYwmSJIcK Dg9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZO9lg6Mx; 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 t13-v6si438489pgo.640.2018.06.12.10.04.29; Tue, 12 Jun 2018 10:04:44 -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=ZO9lg6Mx; 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 S935073AbeFLQwv (ORCPT + 99 others); Tue, 12 Jun 2018 12:52:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:48772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934968AbeFLQws (ORCPT ); Tue, 12 Jun 2018 12:52:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 05E5C208B4; Tue, 12 Jun 2018 16:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528822367; bh=r87PFb0bx4Gd283S1V03+FAqiuxt9TYUdldeb4YLTj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZO9lg6MxExW1anz9lTjSVnSHzA6JGN7ubf3DWg+vaEF+LzvLQvF0cZgaptIjxHICj pboIdWVldkZUeV13sMJxTQyAPpxqija0mWvjIR2mdvg/3ttJyfG4x8saK7b30FhBvM c3A/U/uT3Rvri/iR/OYQzQ4fq+62zWPXjV/kNsRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , "David S. Miller" Subject: [PATCH 4.4 12/24] ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds Date: Tue, 12 Jun 2018 18:51:56 +0200 Message-Id: <20180612164817.181262749@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612164816.587001852@linuxfoundation.org> References: <20180612164816.587001852@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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. ------------------ From: Sabrina Dubroca [ Upstream commit 848235edb5c93ed086700584c8ff64f6d7fc778d ] Currently, raw6_sk(sk)->ip6mr_table is set unconditionally during ip6_mroute_setsockopt(MRT6_TABLE). A subsequent attempt at the same setsockopt will fail with -ENOENT, since we haven't actually created that table. A similar fix for ipv4 was included in commit 5e1859fbcc3c ("ipv4: ipmr: various fixes and cleanups"). Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") Signed-off-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6mr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1787,7 +1787,8 @@ int ip6_mroute_setsockopt(struct sock *s ret = 0; if (!ip6mr_new_table(net, v)) ret = -ENOMEM; - raw6_sk(sk)->ip6mr_table = v; + else + raw6_sk(sk)->ip6mr_table = v; rtnl_unlock(); return ret; }