Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4812328yba; Tue, 30 Apr 2019 04:56:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1gHHbx1xEtjwoIvsO5PzXp/oJPMutND75Kx3LK8my8TenxB17moncgMKc+8iCEPyddyIz X-Received: by 2002:aa7:810e:: with SMTP id b14mr26746599pfi.112.1556625368063; Tue, 30 Apr 2019 04:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625368; cv=none; d=google.com; s=arc-20160816; b=NFzw2FwQeSSc0kwPQVE4oI00geQeLJh9I8MbIL/V92PxmHCqKAP4HB2BprfxUJJ5OP 7c4k8rOvT3KkoZgzBBSMia/brDUYXaEJrf/o8vzHrcv770cEOOH2Pe6vRqOI8JwEPu7c v+a1VwXZMX5emQpb/i7xGg3kP+loRQLZYXIORizE/reunfP2alfyKblBchgCANYNhLrW 7rDOMTl7KnCO5ztQI00YcbGdSh3Dpr6JAglGYCka1SkFwdhahDl2ayJka3+zZPIafqFX YtvQT5/hygJbav8249uUy5w3/8PXiI1408WaEsJzvBVIp/o1ql51IFFD4I2GuCvq/ohL LQog== 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=Pn8uYlps7TkFO2xpqKfAN0V3VwbmSq5RqN+h2EzYHmk=; b=SEgmdRg/8Q8LBYbSUtwred+AFNovMVAAcSvAdF2pYGxZSZizVfQrD3lrEdvxmbilhn xW43nmwa8knJJNJzWcy/tHdvhq78g0r0BcZeTaGu8Y7DNGJYM9X6If0EMQCFOl0xAd6V Uzpcm5/CXbH8vnmtfaQOJMxWbYeFIBlI0HPHWOD8dr/aE/i9nVVe2AVzjMeWDuj5Xrm2 FIsSl+zk+bPlcUQrK5TGnPQaw0Bm7i4plnESkv+8qJzmPYSBWd3OGyldTL1wNA2JN7c4 FvA0p6QdhWDNhW6Y6f3qcykRw3YvtGI3nTc5PzKrMg19W3B8CRMYeO6+2N/EzCwFZTSX dCVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jpsWQKf7; 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 h24si34359808pgg.226.2019.04.30.04.55.52; Tue, 30 Apr 2019 04:56:08 -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=jpsWQKf7; 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 S1731143AbfD3LyR (ORCPT + 99 others); Tue, 30 Apr 2019 07:54:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731171AbfD3LuR (ORCPT ); Tue, 30 Apr 2019 07:50:17 -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 D37272054F; Tue, 30 Apr 2019 11:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625017; bh=sSz3YWg6ZqSDJ7IxTSRpTLrK3Rw0qZCXM/y7vDBgX5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpsWQKf7F58Zl+03V7UEi0XwRql2moih51uhV6m3AgRiOvVVv4/TqFTZrQdOxVyaK ClSTwGxWr+zBi4J7e9FLCtu0OSh0bUV+5MM1Z3PklXnPXZeV3t0DKESe6Fqzu+iDL7 9wiZ31o6Hn1TW9geGLBuEMnHeIOy1wtnvSBwev6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+de00a87b8644a582ae79@syzkaller.appspotmail.com, Xin Long , "David S. Miller" Subject: [PATCH 5.0 60/89] tipc: check link name with right length in tipc_nl_compat_link_set Date: Tue, 30 Apr 2019 13:38:51 +0200 Message-Id: <20190430113612.502268974@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@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: Xin Long commit 8c63bf9ab4be8b83bd8c34aacfd2f1d2c8901c8a upstream. A similar issue as fixed by Patch "tipc: check bearer name with right length in tipc_nl_compat_bearer_enable" was also found by syzbot in tipc_nl_compat_link_set(). The length to check with should be 'TLV_GET_DATA_LEN(msg->req) - offsetof(struct tipc_link_config, name)'. Reported-by: syzbot+de00a87b8644a582ae79@syzkaller.appspotmail.com Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/netlink_compat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -777,7 +777,12 @@ static int tipc_nl_compat_link_set(struc lc = (struct tipc_link_config *)TLV_DATA(msg->req); - len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); + len = TLV_GET_DATA_LEN(msg->req); + len -= offsetof(struct tipc_link_config, name); + if (len <= 0) + return -EINVAL; + + len = min_t(int, len, TIPC_MAX_LINK_NAME); if (!string_is_valid(lc->name, len)) return -EINVAL;