Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2875230pxu; Sat, 19 Dec 2020 05:02:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXwcz/IYGcXfmQbuJ/s2PgWmekck/nIMoE/TQUSfB2Ev3tXuVepQBPdgiZ+/LKggLe8lDY X-Received: by 2002:a17:906:9345:: with SMTP id p5mr8231905ejw.40.1608382946859; Sat, 19 Dec 2020 05:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382946; cv=none; d=google.com; s=arc-20160816; b=cyUMQxhGZ8o5cCVsPg83tFZLD9N1yGSWsAo9iS2oyrfNX1MBAx0Y+25onn+YA7aMsP XZfnv8J624GH1HxQC6Uqzy1ofDf8Up+IyHyMf+cDgTAcA+aXizmoaA7FaI3/lv2tifYm 2mGvh6gg2TazNBeUUg4YII2VvSagkWfL+LTB0z/5DChIuIq/kNAGTsjHITjv7L9db8II p4vpyvv2zqabxnPTB5lrhQb/bYgZEWvEMlObaklPDpTNLmnm89E8buHKsf5yO/NqYnAR rM0pg7gYZLE6em2i0GmUMnBOBdJYIMIBwx85rNXbddZh3qV8IH4omMqv5/iX+9QrFjba nxPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0CJm7nM6cpZ+ZAoBspIzQPRnXZpI1PFLlWDWlunWlzA=; b=z2C/pnc8ghGw3qigyhsumJbnxtUZbCquRYgits8p0nHfLt8lnP2qHcfDUFTsWInfEU 1ljmzl2WFrE72JhhfEdF/WL6vMdD0en0oukMBud1VBBfgPaliiJQTmodO+YqCaMM8dg4 ZUwK6FPDthXPNYEabfwO8txM8BJrb9BIhDeDLxoNsblSDGQO779hLWrwrMgh567hLc4I 6MPgD18Bkdpo9mqtQZ1Nik5oSoYoMjhomddf2VwLtwYQQNewO+n+/i6zWQ00w84et6hP /ekBsNJuRFqprDkuabdqwww2NvxnNk9DSjGYkjwPeqluAl09nz94UqZPaBUXypsiD59x a0zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df21si7561951edb.207.2020.12.19.05.02.04; Sat, 19 Dec 2020 05:02:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbgLSNAk (ORCPT + 99 others); Sat, 19 Dec 2020 08:00:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:47228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbgLSM76 (ORCPT ); Sat, 19 Dec 2020 07:59:58 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cengiz Can , "David S. Miller" Subject: [PATCH 5.9 32/49] net: tipc: prevent possible null deref of link Date: Sat, 19 Dec 2020 13:58:36 +0100 Message-Id: <20201219125346.242208399@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125344.671832095@linuxfoundation.org> References: <20201219125344.671832095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cengiz Can [ Upstream commit 0398ba9e5a4b5675aa571e0445689d3c2e499c2d ] `tipc_node_apply_property` does a null check on a `tipc_link_entry` pointer but also accesses the same pointer out of the null check block. This triggers a warning on Coverity Static Analyzer because we're implying that `e->link` can BE null. Move "Update MTU for node link entry" line into if block to make sure that we're not in a state that `e->link` is null. Signed-off-by: Cengiz Can Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -2170,9 +2170,11 @@ void tipc_node_apply_property(struct net &xmitq); else if (prop == TIPC_NLA_PROP_MTU) tipc_link_set_mtu(e->link, b->mtu); + + /* Update MTU for node link entry */ + e->mtu = tipc_link_mss(e->link); } - /* Update MTU for node link entry */ - e->mtu = tipc_link_mss(e->link); + tipc_node_write_unlock(n); tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr, NULL); }