Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp964233pxb; Wed, 6 Apr 2022 05:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweJGmKk6oc4RN8valOnZEjhi6ZmO1gMHKJFaJTnmNDLaGW/1znixeH4hCtkvmK09r1T9VS X-Received: by 2002:a63:5a55:0:b0:399:28c:6af9 with SMTP id k21-20020a635a55000000b00399028c6af9mr6909087pgm.111.1649248127975; Wed, 06 Apr 2022 05:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649248127; cv=none; d=google.com; s=arc-20160816; b=aroIaM1kBnzIOOOWQslNRbcYikx5y0tJ6g6axmLp9viQuAFx6iNs38Vpg6jS4EDUPJ jrZ8aos6OtENSbfx5wMiGsrDPdU336JW6lKDNxsxl2bZtH6tRt/bbw3FKgZPIQFPZA2n xj4DDavZTsbvd9wqyir1PtCeiaM3huA3v8ckH3nzU9zSU3n3Iprm6Mf1keyVy2jiIuDc ysrA9uKclCtdwB3y9L5OZfL8q5uXVogNOpT4eTAd+N5aJfzJA11o2jEDbRYyercVDRiF Wb7ECmdu5zg6et7jGzcaMnnlJz5R2M2J66yEqWO6eYynhqHaGh54pkaCGUPKDL/hkUI5 BLNw== 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=tUuhfImMQ8xEA/x639YvroiFjvYNgV81TWMmAzXLNDc=; b=o22Yhg2sewoA5oDrNLWD0+AQ5+G5osajrsDhuMQIqSVpLetCEitRo6qCEMsgD/FtgP DmZc7xAhKlrCdn1o3yva7stVFzVys2EYpAjnzphWDsGO4pMWqLSj5MFGOK72OAeNjxu2 kHtP4sph4VnEQrtkIWN5mCkYv8wwYx4GQfpdWxSK3+j23uqPMsXTSTFThwzFwkjRd4Ke GJe/bdQbHJhqHiqSTyJq1+wIbHmgNpjzQAX3qds9INxF9m7DCnmcXOtXIzErzC2N4Wms 7ir50yFNERlwMM9btuAttzcaeIsccPZ4P1Jvy43VKIeg5DytD450NaLIR2Wh6hL/c4iC DO4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C9dB5U/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s5-20020a170903200500b00153b2d16654si9311689pla.604.2022.04.06.05.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C9dB5U/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A05A36F86E8; Wed, 6 Apr 2022 04:39:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344820AbiDEXgN (ORCPT + 99 others); Tue, 5 Apr 2022 19:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348899AbiDEJsp (ORCPT ); Tue, 5 Apr 2022 05:48:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11363EACB7; Tue, 5 Apr 2022 02:36:57 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A4146615E5; Tue, 5 Apr 2022 09:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B67B9C385A0; Tue, 5 Apr 2022 09:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151416; bh=6teVxoPhBawGeWELxNYk1AiLJDt6H6dR+P6fL/PEkA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C9dB5U/x47ZPaagWDX6tgXCzE6KgCwJ1Vlbp1a/591Sd3v74NTn7rLAwoNq+Gc1ma EvGe+2FwX/OkYIbyqRdlKTbFC/aMaViv3hK/+0HI274mN27qd4UuMFRhKsW32cy/lE EaEu4GiQQffz/il83P73+9fZ3fCkcdp63LaOpZ1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f83a1df1ed4f67e8d8ad@syzkaller.appspotmail.com, Pavel Skripkin , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 406/913] ath9k_htc: fix uninit value bugs Date: Tue, 5 Apr 2022 09:24:28 +0200 Message-Id: <20220405070352.017118926@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Pavel Skripkin [ Upstream commit d1e0df1c57bd30871dd1c855742a7c346dbca853 ] Syzbot reported 2 KMSAN bugs in ath9k. All of them are caused by missing field initialization. In htc_connect_service() svc_meta_len and pad are not initialized. Based on code it looks like in current skb there is no service data, so simply initialize svc_meta_len to 0. htc_issue_send() does not initialize htc_frame_hdr::control array. Based on firmware code, it will initialize it by itself, so simply zero whole array to make KMSAN happy Fail logs: BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275 ... Uninit was created at: slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258 ... Bytes 4-7 of 18 are uninitialized Memory access of size 18 starts at ffff888027377e00 BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275 ... Uninit was created at: slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258 ... Bytes 16-17 of 18 are uninitialized Memory access of size 18 starts at ffff888027377e00 Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.") Reported-by: syzbot+f83a1df1ed4f67e8d8ad@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220115122733.11160-1-paskripkin@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_hst.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 510e61e97dbc..994ec48b2f66 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -30,6 +30,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, hdr->endpoint_id = epid; hdr->flags = flags; hdr->payload_len = cpu_to_be16(len); + memset(hdr->control, 0, sizeof(hdr->control)); status = target->hif->send(target->hif_dev, endpoint->ul_pipeid, skb); @@ -272,6 +273,10 @@ int htc_connect_service(struct htc_target *target, conn_msg->dl_pipeid = endpoint->dl_pipeid; conn_msg->ul_pipeid = endpoint->ul_pipeid; + /* To prevent infoleak */ + conn_msg->svc_meta_len = 0; + conn_msg->pad = 0; + ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); if (ret) goto err; -- 2.34.1