From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AFB5C433B4 for ; Sun, 16 May 2021 11:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07A4561168 for ; Sun, 16 May 2021 11:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbhEPLYo (ORCPT ); Sun, 16 May 2021 07:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbhEPLYl (ORCPT ); Sun, 16 May 2021 07:24:41 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D180C061573 for ; Sun, 16 May 2021 04:23:27 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id k15so2727093pgb.10 for ; Sun, 16 May 2021 04:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lJG0zQvDeXMVv53Ck1aIxdEZ/keO24SJzKO0xIhMZeE=; b=DXnVL0pkjr1uBBJuNdlGYAMQdS05d4l6kYyV8u5Hx0ooeevWDgkeiKeQt3pSAGIvdt UIO2PQF4t4LhFGgyH/tW+sHN5I1iJv1VKtbw5wSOz8WjF1nDAzW0mkGCE6iBZBB2U11O YklXXQMHpnh+vcEhmmG8fLKpV6gy4EA9xxFHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lJG0zQvDeXMVv53Ck1aIxdEZ/keO24SJzKO0xIhMZeE=; b=VpdUqi/VyDkdYLyW7vYX5L8Q623Vh8yGKeAitmVbudnuRnW64jR0XT1pEAySWxVnqw saRco2dYlUR5dNeg8v2M6yRVCR1Ee8qW+yy8JSvqx8IkGJUB/e/SL+/btWzDkMUAmXLY KTYruIcoY/4mowZqfdo8e+uhFiQ+Hf+GiX3pcmt5ukEQ77nE9ma8WHoQWGXC7Z/o6q2I OdKS2UcWK4SysL2TI9GzPQ1piCIDXPbx1qFkWMSS7PIq0rabBI3Gm9i9WKnxBjv/ZnQq eB/kuNhqlELmeAzmlDgGlbYLaQ97f4Y+9ckLMTLboe1Mmuz6DElJMjPrYwv/BG0+ElJf zw6w== X-Gm-Message-State: AOAM530TEt8vD7S+VKcVszglqBU62AyMLXC0oONiPjuaEqqslB5tCtI7 p+C6M4ccvjwnYoLE0mJRI20d1g== X-Google-Smtp-Source: ABdhPJwxNb8d5ZlbARnU54AQKtx2pJJ/iterhcqiCFNnfTaHDGAeBoL/sepmaDiofgcZLc5RmD6tAA== X-Received: by 2002:a62:4c3:0:b029:27c:892f:8e22 with SMTP id 186-20020a6204c30000b029027c892f8e22mr54576846pfe.6.1621164207073; Sun, 16 May 2021 04:23:27 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:4596:acad:c782:2f52]) by smtp.gmail.com with ESMTPSA id x20sm8137652pjp.12.2021.05.16.04.23.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 04:23:26 -0700 (PDT) Date: Sun, 16 May 2021 20:23:21 +0900 From: Sergey Senozhatsky To: Takashi Iwai Cc: Sergey Senozhatsky , Jaroslav Kysela , Takashi Iwai , "Gustavo A. R. Silva" , Leon Romanovsky , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (21/05/16 11:49), Takashi Iwai wrote: > Subject: [PATCH] ALSA: intel8x0: Don't update period unless prepared > > The interrupt handler of intel8x0 calls snd_intel8x0_update() whenever > the hardware sets the corresponding status bit for each stream. This > works fine for most cases as long as the hardware behaves properly. > But when the hardware gives a wrong bit set, this leads to a NULL > dereference Oops, and reportedly, this seems what happened on a VM. VM, yes. I didn't see NULL derefs, my VMs crash because of div by zero in `% size`. > For fixing the crash, this patch adds a internal flag indicating that > the stream is ready to be updated, and check it (as well as the flag > being in suspended) to ignore such spurious update. I reproduced the "spurious IRQ" case, and the patch handled it correctly (VM did not crash). > Cc: > Reported-by: Sergey Senozhatsky > Signed-off-by: Takashi Iwai I'll keep running test, but seems that it works as intended Tested-by: Sergey Senozhatsky From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17BCFC433B4 for ; Sun, 16 May 2021 11:24:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6FFE61166 for ; Sun, 16 May 2021 11:24:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6FFE61166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7D025168D; Sun, 16 May 2021 13:23:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7D025168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621164267; bh=NsPuNqiIpFn+lUD7/3ywYIC/1HKhx1a5pdpTi0pb6EQ=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=o4AoGTRJaLMnB3rA3icDR/zxM6sMElcUfnmfXqy7ma4zmvK6rM+U3JB5RCDDI4p8E 6MM+0ILoiKLzZ8YrSjY7h7uDEvNb15qmjdpIwqt0yARRB3PSAN4Zr87zv/nLNA+2aj ZkcQGenuAOUSjmMdU7kpD6vufPNF8/l+UBXM6U6A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 094CEF801DB; Sun, 16 May 2021 13:23:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A2ABF80217; Sun, 16 May 2021 13:23:35 +0200 (CEST) Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 58E2AF8016E for ; Sun, 16 May 2021 13:23:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 58E2AF8016E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DXnVL0pk" Received: by mail-pf1-x433.google.com with SMTP id g18so1412962pfr.2 for ; Sun, 16 May 2021 04:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lJG0zQvDeXMVv53Ck1aIxdEZ/keO24SJzKO0xIhMZeE=; b=DXnVL0pkjr1uBBJuNdlGYAMQdS05d4l6kYyV8u5Hx0ooeevWDgkeiKeQt3pSAGIvdt UIO2PQF4t4LhFGgyH/tW+sHN5I1iJv1VKtbw5wSOz8WjF1nDAzW0mkGCE6iBZBB2U11O YklXXQMHpnh+vcEhmmG8fLKpV6gy4EA9xxFHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lJG0zQvDeXMVv53Ck1aIxdEZ/keO24SJzKO0xIhMZeE=; b=cxNfE9N8Rrq8w8feZPArZHn0fFjp5y6/ocuy5FH1PTBx2fn/5FieRZAwhHP8XBo2h/ yXkcP6fbTrb4YxJMd2ss2JWNSxQQizvChDi43M3wIPs39VvrmjDiPE5Bk7TObW1mco6k u2An8jcYkjWkgXvH6lT0Y2mHcxq0tLSRUWb+7Cf3kLiCqdmL8e5CjgXFyf4UDzT8LCIE cEJHfu0tVyvQTuO9k0rzmdD4mAisLv/xfcXOHJHZnhlBB99v3Iy5+WpJcJLibHBZ9TzC 32Qx593Ydw5UrjV6Ce4Q5w8ZRKtjd7PXONbWPLqFJViPJ3Nu/q6n96I41RHM5nAYCB4v HWxg== X-Gm-Message-State: AOAM5303M8ipkQawqB0yHUpuGQtdIy7X6HlUJt8uCYD/uyVeVrVLvIap GYojNutZSYrhltqhlEb1jixF3w== X-Google-Smtp-Source: ABdhPJwxNb8d5ZlbARnU54AQKtx2pJJ/iterhcqiCFNnfTaHDGAeBoL/sepmaDiofgcZLc5RmD6tAA== X-Received: by 2002:a62:4c3:0:b029:27c:892f:8e22 with SMTP id 186-20020a6204c30000b029027c892f8e22mr54576846pfe.6.1621164207073; Sun, 16 May 2021 04:23:27 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:4596:acad:c782:2f52]) by smtp.gmail.com with ESMTPSA id x20sm8137652pjp.12.2021.05.16.04.23.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 04:23:26 -0700 (PDT) Date: Sun, 16 May 2021 20:23:21 +0900 From: Sergey Senozhatsky To: Takashi Iwai Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: alsa-devel@alsa-project.org, Leon Romanovsky , linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , Takashi Iwai , Sergey Senozhatsky X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On (21/05/16 11:49), Takashi Iwai wrote: > Subject: [PATCH] ALSA: intel8x0: Don't update period unless prepared > > The interrupt handler of intel8x0 calls snd_intel8x0_update() whenever > the hardware sets the corresponding status bit for each stream. This > works fine for most cases as long as the hardware behaves properly. > But when the hardware gives a wrong bit set, this leads to a NULL > dereference Oops, and reportedly, this seems what happened on a VM. VM, yes. I didn't see NULL derefs, my VMs crash because of div by zero in `% size`. > For fixing the crash, this patch adds a internal flag indicating that > the stream is ready to be updated, and check it (as well as the flag > being in suspended) to ignore such spurious update. I reproduced the "spurious IRQ" case, and the patch handled it correctly (VM did not crash). > Cc: > Reported-by: Sergey Senozhatsky > Signed-off-by: Takashi Iwai I'll keep running test, but seems that it works as intended Tested-by: Sergey Senozhatsky