Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp694110pxb; Tue, 5 Apr 2022 19:04:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7xImEc1m9XMqQmlqtZ+OFv898q3sa4WeD6egJF2MnbEnZ99tUE3eJaUDGzhQ0TinixXQw X-Received: by 2002:a17:902:bcc2:b0:14f:23c6:c8c5 with SMTP id o2-20020a170902bcc200b0014f23c6c8c5mr6157173pls.131.1649210590170; Tue, 05 Apr 2022 19:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210590; cv=none; d=google.com; s=arc-20160816; b=EokKWqqJbix4+fPa1csN4Tz/CgBNAfNwh2sGYYkCZSejXRZDIrLKL9xyNV326NY9Jv hPwQGPzPjLeWS7hgrGfTv4nvb5k7vU0vUgQKWgonBxzm8CNObX3N4SWVQB8CgP1rL2tV KiLLjacT6CiOvIpWtAXdr75UBUuudLataAPEycJegz7QNbQ9xdQ7ewb4ePF8OdkLiwt0 CVLoWBsOW+UVl3iomFdiPP35CxD/nznNaWyr7CI5hgu+uwXvcUhhnp67ML3qGqN54+I7 /i+94G5g8h/zcZlnl6B+w5C8geTq9pdqhogzncAIvGadnISDulvQqe1M0Qeg/nbatP/K Lh5g== 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=bhGgp9sgK6tm3PIi0nojhFK8c+t9SpZMKuxfiKevtj4=; b=C1nT9jB5Ae4qjsUMVHE/7LbZRt54x9Uf0QMrt8sINYqO+Ya9qxbn/v7N4gjI3516Gt CFY2/u48/CHrcRav4X4xI+fftbrafdIkjP03vQA65kVCZHVahWQJpP+G9GAdBk9iUHeC BeGlzqwk0diJgbtt/cLn7oZHTwIO/zXBLzY93f2+5cg4jNUXaZOV6WcfVRqi9P+8Hpe3 T45MNhEhYHDNc51MByAtd3yN2RmwAWwp2ThZ+JB4fIw8FOZsJhxo7qHlfZmHr0XWT/Oi eDzF8zM6C9RVbr/em+Oc8wHjyciqWdgoH234rWJg7hMTHJ7aEEQjOdEOjl0cnEWhhFU0 8ijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QUFi1WuC; 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 q2-20020a635042000000b0039919e96afdsi8202284pgl.455.2022.04.05.19.02.52; Tue, 05 Apr 2022 19:03:10 -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=QUFi1WuC; 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 S242375AbiDEIhj (ORCPT + 99 others); Tue, 5 Apr 2022 04:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235738AbiDEIAP (ORCPT ); Tue, 5 Apr 2022 04:00:15 -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 2EFE82ED73; Tue, 5 Apr 2022 00:58:17 -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 C203E615CD; Tue, 5 Apr 2022 07:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2017C340EE; Tue, 5 Apr 2022 07:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145496; bh=2oZ6o3YYR84xrbyRZvsWvVcONdqA2nZyWHB3WsSIGY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUFi1WuCmNV3bCMiwKRiOUB9lMJpY1xVbK3fNzirCvD8Ap6vkPStzeVWZ0WsXToue z4a0g1csa5twODMS/lb8fb3fypXgkRnNTbhq+WGpsAerlvDilxnY7wYYFC4pj7Btfw Z6rBaCeNNOndh+nr1LVUrpqjuSOlEl/zOfWz+SGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai , Sasha Levin Subject: [PATCH 5.17 0388/1126] ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction Date: Tue, 5 Apr 2022 09:18:55 +0200 Message-Id: <20220405070419.016041587@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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=-7.1 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: Takashi Sakamoto [ Upstream commit bf0cd60b7e33cf221fbe1114e4acb2c828b0af0d ] AV/C deferred transaction was supported at a commit 00a7bb81c20f ("ALSA: firewire-lib: Add support for deferred transaction") while 'deferrable' flag can be uninitialized for non-control/notify AV/C transactions. UBSAN reports it: kernel: ================================================================================ kernel: UBSAN: invalid-load in /build/linux-aa0B4d/linux-5.15.0/sound/firewire/fcp.c:363:9 kernel: load of value 158 is not a valid value for type '_Bool' kernel: CPU: 3 PID: 182227 Comm: irq/35-firewire Tainted: P OE 5.15.0-18-generic #18-Ubuntu kernel: Hardware name: Gigabyte Technology Co., Ltd. AX370-Gaming 5/AX370-Gaming 5, BIOS F42b 08/01/2019 kernel: Call Trace: kernel: kernel: show_stack+0x52/0x58 kernel: dump_stack_lvl+0x4a/0x5f kernel: dump_stack+0x10/0x12 kernel: ubsan_epilogue+0x9/0x45 kernel: __ubsan_handle_load_invalid_value.cold+0x44/0x49 kernel: fcp_response.part.0.cold+0x1a/0x2b [snd_firewire_lib] kernel: fcp_response+0x28/0x30 [snd_firewire_lib] kernel: fw_core_handle_request+0x230/0x3d0 [firewire_core] kernel: handle_ar_packet+0x1d9/0x200 [firewire_ohci] kernel: ? handle_ar_packet+0x1d9/0x200 [firewire_ohci] kernel: ? transmit_complete_callback+0x9f/0x120 [firewire_core] kernel: ar_context_tasklet+0xa8/0x2e0 [firewire_ohci] kernel: tasklet_action_common.constprop.0+0xea/0xf0 kernel: tasklet_action+0x22/0x30 kernel: __do_softirq+0xd9/0x2e3 kernel: ? irq_finalize_oneshot.part.0+0xf0/0xf0 kernel: do_softirq+0x75/0xa0 kernel: kernel: kernel: __local_bh_enable_ip+0x50/0x60 kernel: irq_forced_thread_fn+0x7e/0x90 kernel: irq_thread+0xba/0x190 kernel: ? irq_thread_fn+0x60/0x60 kernel: kthread+0x11e/0x140 kernel: ? irq_thread_check_affinity+0xf0/0xf0 kernel: ? set_kthread_struct+0x50/0x50 kernel: ret_from_fork+0x22/0x30 kernel: kernel: ================================================================================ This commit fixes the bug. The bug has no disadvantage for the non- control/notify AV/C transactions since the flag has an effect for AV/C response with INTERIM (0x0f) status which is not used for the transactions in AV/C general specification. Fixes: 00a7bb81c20f ("ALSA: firewire-lib: Add support for deferred transaction") Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20220304125647.78430-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/firewire/fcp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c index bbfbebf4affb..df44dd5dc4b2 100644 --- a/sound/firewire/fcp.c +++ b/sound/firewire/fcp.c @@ -240,9 +240,7 @@ int fcp_avc_transaction(struct fw_unit *unit, t.response_match_bytes = response_match_bytes; t.state = STATE_PENDING; init_waitqueue_head(&t.wait); - - if (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03) - t.deferrable = true; + t.deferrable = (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03); spin_lock_irq(&transactions_lock); list_add_tail(&t.list, &transactions); -- 2.34.1