From patchwork Thu Jun 2 04:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoang Huu Le X-Patchwork-Id: 12867509 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E338DC433EF for ; Thu, 2 Jun 2022 04:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbiFBE6V (ORCPT ); Thu, 2 Jun 2022 00:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiFBE6T (ORCPT ); Thu, 2 Jun 2022 00:58:19 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2132.outbound.protection.outlook.com [40.107.21.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196805BE49 for ; Wed, 1 Jun 2022 21:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hoh/VaylkJsYWhTbWFepoB55g9+2Ohyyo5nUbaOS1pkVH3CBdRpQhOX9ias/T//rf/st+rI2uOta2nJqXB6P2ujnLyPuBWC1tR7Ec8UmphFQ0HkR+N+2yki4ELF2MaVc8+8oDSQIypLbwLf6tUjxa9ezkGtkXxPwtxgwTJjirVpXN0Kfh5ySv6hVHaMOgYDkpUygeVgdGTXnI5NYuAxeu6OBNueeTh7gQerQWYEhLmYpL8yq9p8WB5zKvk6y//BrY7MS5TUODXmyEUC/zQaaMe4OjO1DoXdgBrECi6J9WVhx7KneLj4Fe9baCzPvX8Ho7Vt7zF3I0O+W5qMnwDsgfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fmej1GbGMURoy/JjCZLGNeoZpATdgjpPLkN112735g0=; b=eAfgwFP3ZBteLYtSWF9VrKsyodvs/tg/fj2bkSDtFxfSUfNgVI5bIXDDANmLL9HpOMMyzWF9kIUI0U5PsqiofaScOR+Y/RSmvIZUTxGpGvgCtWf0PXzyf8j04KShmTjmJeFJ26Oc3NaZfYaBnz7N39e074OSaoivTz6LG2CJMa745VwNgt43pV6pcpe91etVajrzK3cGZP9Wd+u0yAviAWWUc3MZICu2LbWUktvOyJC1yWzxovJ/GHNQ6Iyw5UQk69/YDh9ZiBkwoJWv4hfHCHwV+sOLDGb2DZA95wGWN94yXnBLGvUJl9a6wZv6kkNRN0ZEbfIrCFE8Z+ecIW7XMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dektech.com.au; dmarc=pass action=none header.from=dektech.com.au; dkim=pass header.d=dektech.com.au; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dektech.com.au; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fmej1GbGMURoy/JjCZLGNeoZpATdgjpPLkN112735g0=; b=toW6NS/Ve6sWZBwHLtAB+Ql6Rm8csyIPWsX+UYmddRDK1kA25cb8qBpuWtQj0dn7Ky0JFD9BMT6mhKoEeiptkH2pYr9WkEMJDqnRB0Q4FMK3fFqXI0HjhQLDt/SO5Mk9ql9FXzN8d3+7aM6G0KLdp6iaqooLaSQjx0yKdjutaGc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=dektech.com.au; Received: from DB9PR05MB7641.eurprd05.prod.outlook.com (2603:10a6:10:21f::6) by VI1PR05MB7039.eurprd05.prod.outlook.com (2603:10a6:800:186::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Thu, 2 Jun 2022 04:58:12 +0000 Received: from DB9PR05MB7641.eurprd05.prod.outlook.com ([fe80::84e0:5f1b:9fe2:34f8]) by DB9PR05MB7641.eurprd05.prod.outlook.com ([fe80::84e0:5f1b:9fe2:34f8%2]) with mapi id 15.20.5314.013; Thu, 2 Jun 2022 04:58:12 +0000 From: Hoang Le To: jmaloy@redhat.com, maloy@donjonn.com, ying.xue@windriver.com, tung.q.nguyen@dektech.com.au, kuba@kernel.org, netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net Cc: syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com Subject: [net v3] tipc: check attribute length for bearer name Date: Thu, 2 Jun 2022 11:57:57 +0700 Message-Id: <20220602045757.3943-1-hoang.h.le@dektech.com.au> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: HK2PR06CA0017.apcprd06.prod.outlook.com (2603:1096:202:2e::29) To DB9PR05MB7641.eurprd05.prod.outlook.com (2603:10a6:10:21f::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5ac16d9-d083-48ab-72a5-08da44547e85 X-MS-TrafficTypeDiagnostic: VI1PR05MB7039:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BvDDmoqnhoU3v3CIvuGgwb2Eq54BlLr4MFhoblyG826qnKqGUCOIh41h/YdqGRwHbqZLjNzOnJ+bw7BXWjl+ZChkiO+y/rwkFg3PKJPJIAmUpvnOdfPqf+ceb8N963USEbSCL35WoLqUw2qFQQsNRdA+3JLwdNflLkEHN9r6vLW2M7zXhcgfazJtfRYSNZSXpJwm/wCGvgLkzw0oytGdSDEn3iwJGQ+pd/+jWB61Ur8K0bA/Ea86sRk1be3llU72YlI63uJRf1PXOCMv7fjd8qC1OQmjKgKc+Y7uFRI8wKB1QPJzlPlKY6yutBgo3+IDH89gZiQHQ+o4Y04Ujx0WHgMAd3c6fIntGdJMDUKZ/1bHHcRGcVSCkoLpuMQuqx0N/GEDjKQsrf8D8vhuhU1suSQkQ6VGM9Yrc/dBZ9MamDT20eOpj7HKCY6rgk3d2OOY/ZQt5KEIi+Af5Oqz88XgZmfRjng2v36f5XQubVm201Rm1Xmo2dvOCZ/7GDaFr5ccLUGH2Vz91Bfw6/VQThkcL+VSkUOYEghOlif3sjcm8c33zmx3Q4HgRuQq0rfKUja0sY7/XO0op28KhQIscaB3p79i1mCakOiC1aOe8F6YgYb7TBzxgr6Hd4GTW0XcJ0dZ9JvPct0xwZ5Q86ZUAYpbHJj9piKQqBBki7k8VeMuGpK9qbn59iG4N41pbdaIYiNf4Wq5OzWLgoBA7fZj6OyL8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR05MB7641.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(346002)(376002)(39840400004)(366004)(136003)(41300700001)(1076003)(508600001)(86362001)(2616005)(316002)(186003)(66476007)(66556008)(66946007)(38100700002)(5660300002)(4326008)(83380400001)(8676002)(2906002)(8936002)(38350700002)(6666004)(6486002)(36756003)(26005)(6506007)(55236004)(6512007)(103116003)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RN11UWxfAcr30g2eRvcY4xfKbRzD1AR+jWerJMOHE6qr8zv9n0jRhnUawy4Tg6kfj1BfLd1gpJQG/xNg2cCZGA5wYsmHCPa186Zeb3uzJGJLTqQIs9+tfrm/kOyqE6G/sFTioPnOzZuCFrthS36bIp1Gsniv6ksCoZWq1dkhoymoNb+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lYcYNoNjnAXO2DWXiwrAVwfPoTb6LF7avUnc20RB6orOX2xCPksmckGgjCv9YncDmsdRVwuZaoZjazaJthgvFWuQVFp2LewoR2Xbt3ngTP+FROJjCFb1ezIM0QdXhIamg0orxgdbkYbhawH5xBMj7MiU1icHeJDm0hbxDjGY+iZpLYmAbYfN51Pn9I7ARljbCX/CFNT96hQlTriTWZA/sLiEoQc/xRQwJb8ROIT9FPHbxXyUZlSMFp6oyLUyXhlK/wt0IMxvolkY0U3XXtYKrX6/r5+DbJqZiAB5mG/7Emjpdf6a8xmcJUO//4FcAF6OQBGTGjQ/d21xbzRMgxC9MC3toS1kbEpcA0ndqp7jr8+m7KOyjre1Wi0/Q6/Wg8/RTVxdIb5oDTaSAuJmiQk2FtHf3EYNjraufGZhKbh9uGWf5dZwSpOPzhkw1g2Vfo1t5hQoQRz/CXmifskThJXUVypzrGTIqaAdT7HLxUws2LPUggVmtZUaJekJq6zWIFU/uIE= X-OriginatorOrg: dektech.com.au X-MS-Exchange-CrossTenant-Network-Message-Id: c5ac16d9-d083-48ab-72a5-08da44547e85 X-MS-Exchange-CrossTenant-AuthSource: DB9PR05MB7641.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 04:58:12.0399 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1957ea50-0dd8-4360-8db0-c9530df996b2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4SVy+AhIdeWXqJei7UVPbf08SrnqRRewfRxvFjh/mWdoEX99S9Pk3Cb4INV34ouCQ5YEQdJUIS8o3S45ZUY4vsb/xenCpok/YbRmtq9V5dg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB7039 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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. v3: add Fixes tag in commit message. v2: remove unnecessary sanity check as Jakub's comment. Reported-by: syzbot+e820fdc8ce362f2dea51@syzkaller.appspotmail.com Fixes: cb30a63384bc ("tipc: refactor function tipc_enable_bearer()") Acked-by: Jon Maloy Signed-off-by: Hoang Le --- 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 6d39ca05f249..932c87b98eca 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -259,9 +259,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) {