Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp561468iog; Mon, 13 Jun 2022 08:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg5AppRthReNPt4J9P1mLbEdmhiphdW+50QEORB/+QqFtf9ueCMh34Kisne6iudfuIIVqF X-Received: by 2002:a17:90a:2f84:b0:1dd:940:50e7 with SMTP id t4-20020a17090a2f8400b001dd094050e7mr16258066pjd.210.1655133035212; Mon, 13 Jun 2022 08:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655133035; cv=none; d=google.com; s=arc-20160816; b=L2ZZhQ4mf+MLs6cgNIkavLFRRywSacfK4bshOV2ZJP+zIerFElA/XIjTXekRacZL1m wEeuc29Ht2n8q9BwxUY7h07Wf0zFTK+5KruHiaLyIgEShMpevKgfn20hM4sVJ7yW7A7y 6obsxQ6dJJ9Toe9G8b2zpNUzb4OlgexTeFA7ZLPTEcHuKNpMQK6gVFkWlEEVbpy4qRG4 zUjOsiqEjvdN70rhkVEBwZODlaHMPygY44a5ZY/g6/aLE7spJkrv8Meuv2KbP6asGPvG CC1sw0BkFZ08GofzI2GUXwPT20UQ4zwFUeAtgKlBRz1Rntt3odWT8k5zhkb0UMMUj2xt nevQ== 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:dkim-signature; bh=OHFqAagOGaUyl6PnFTn+wqe1uWBvKwSiJN2itQTkShU=; b=RfHTxfAuTIw/odwYJa0H3ysL5ziImn4FgKM8VtAoFXGY5+KpMfvCJ1hY/8C+QiC8Po vIVYDiVhQ8rGbVLKmu09a4KiY/CcFDKupjevH45rAiMnWjWimlwkXl760nQT4nwN/0gs rmnzlBasdPnlGDe1dDIpOJrEW1zH/Od++24vTYdp0jKIls9nTdAjkrHo61QUM400glVc It/S6AFoHJphvgAA8WBlB2hVo4Crqzd4eisr3lKvyVYCQi2dz7+c5K14GbMU5f0vwN9/ 1bLXaWxEqxHlOBslpChrAuSICH7TuPhwPuLZ6vOFqE2xuJdT7RPBOfvvyza8W3us0B3T 5eJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="MrtJCdE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d126-20020a621d84000000b0051b85fb65b9si8099053pfd.244.2022.06.13.08.10.23; Mon, 13 Jun 2022 08:10:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="MrtJCdE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355789AbiFMLlo (ORCPT + 99 others); Mon, 13 Jun 2022 07:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354885AbiFMLeN (ORCPT ); Mon, 13 Jun 2022 07:34:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0244242A34; Mon, 13 Jun 2022 03:47:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 27853B80D3F; Mon, 13 Jun 2022 10:47:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54601C3411F; Mon, 13 Jun 2022 10:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117256; bh=F0EYgoPzitgp8Y9vT+TpnbuD2i0rrUHXv1A1VLg05qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrtJCdE/TIzGwMQEsuLdPp4NKWjK81RULXDZCvyc1PNdsXAn+hk8ymjB9E6CcwCj0 yjKea39WClxQ+zqekkcwqV6MR1EOvCFirJNvVCZyRMEyHfP4UY6ist62w0NhuW/NI5 BLVum0H0PSiaunBfzvgnMyQIcyTPWifjPiMHYbyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com, Jon Maloy , Hoang Le , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 335/411] tipc: check attribute length for bearer name Date: Mon, 13 Jun 2022 12:10:08 +0200 Message-Id: <20220613094938.765432242@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hoang Le [ Upstream commit 7f36f798f89bf32c0164049cb0e3fd1af613d0bb ] syzbot reported uninit-value: ===================================================== BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:644 [inline] BUG: KMSAN: uninit-value in string+0x4f9/0x6f0 lib/vsprintf.c:725 string_nocheck lib/vsprintf.c:644 [inline] string+0x4f9/0x6f0 lib/vsprintf.c:725 vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806 vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158 vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256 vprintk_default+0x86/0xa0 kernel/printk/printk.c:2283 vprintk+0x15f/0x180 kernel/printk/printk_safe.c:50 _printk+0x18d/0x1cf kernel/printk/printk.c:2293 tipc_enable_bearer net/tipc/bearer.c:371 [inline] __tipc_nl_bearer_enable+0x2022/0x22a0 net/tipc/bearer.c:1033 tipc_nl_bearer_enable+0x6c/0xb0 net/tipc/bearer.c:1042 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] - Do sanity check the attribute length for TIPC_NLA_BEARER_NAME. - Do not use 'illegal name' in printing message. Reported-by: syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com Fixes: cb30a63384bc ("tipc: refactor function tipc_enable_bearer()") Acked-by: Jon Maloy Signed-off-by: Hoang Le Link: https://lore.kernel.org/r/20220602063053.5892-1-hoang.h.le@dektech.com.au Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/tipc/bearer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 8bd2454cc89d..577f71dd63fb 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -248,9 +248,8 @@ static int tipc_enable_bearer(struct net *net, const char *name, u32 i; if (!bearer_name_validate(name, &b_names)) { - errstr = "illegal name"; NL_SET_ERR_MSG(extack, "Illegal name"); - goto rejected; + return res; } if (prio > TIPC_MAX_LINK_PRI && prio != TIPC_MEDIA_LINK_PRI) { -- 2.35.1