Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp887747rwi; Fri, 14 Oct 2022 09:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U6zFeM43RL26M5cRCvjsZr6QQxt/0SPucE+lIgaxZndLXGAPVC2ObaSK6It28gh0MbGaE X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr4203423ejc.156.1665766196325; Fri, 14 Oct 2022 09:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665766196; cv=none; d=google.com; s=arc-20160816; b=CQWq5PfIVxdeUTzcYXILUQdC8opoILXm9lBbNOKt0KRLUvlRYzOpa8spE+kOO1kA3X m5lGm6FGFiz8J9wCQ4EV6vC073y68RgojpjdEPJYxSiyT2PHqAAH0/wmdWkjpi+yrYqO hSB+VZ2aK0QRbNQLRvbX2qfEzgJlA2rmGuYTk8nwpMGipsGZN1C3wRaFDf8r2x8Xewpv LsPgZKbM0j4lkmbM3Qggt6Hv/LA+tg20aO1+VdoLJ95qzoMFjb+CFnFXcj95TwDHpS3A MBwAFrxufQb9XCPdxWeiEwpxv0IyAiQtLcC+be61AlTD0+K5xCqwMwzOcPey2fLCFMUK /2JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=H8fJfHvYAQbBybgPIV/n4kd8GOI783ZQEyi/eOMq5GY=; b=TPx83TtudnRw+AjaRZpePKgGTfIgVXWxCAdlK9c+bwe3AGxjjaIDzJKwDPK+t6qJ0X yOPqMDmDNp0jUVkJl2T/rNJaCzdbv66OvXSc8X5z2MSNdQ98mtIkFSXZJHRi9fQuCxwN 7trZ7EwGJLtr1+ihgw5ifz94C9dXZt2hjpyVgAg0NVEx/ZkKQFexHtO1C5A32nYCTBtb sbFVhC+o26/zudMzg8hGTkHay3lhJKxq2NU8tiFeNLAnshBFegq2mnXuxUxZlNQVbpuL JvEzQwlwGSdF1WisAU3cS97EtHa5MlVp+d/ecm0HZ3X7mLWU2/dv60W0pG7sQy2RquBs uHlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Zcz9IhwC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b00782ece08669si2639403ejc.13.2022.10.14.09.49.29; Fri, 14 Oct 2022 09:49:56 -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=@gmail.com header.s=20210112 header.b=Zcz9IhwC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbiJNQCr (ORCPT + 99 others); Fri, 14 Oct 2022 12:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiJNQCo (ORCPT ); Fri, 14 Oct 2022 12:02:44 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 051E7170DCE; Fri, 14 Oct 2022 09:02:41 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id r18so4648119pgr.12; Fri, 14 Oct 2022 09:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=H8fJfHvYAQbBybgPIV/n4kd8GOI783ZQEyi/eOMq5GY=; b=Zcz9IhwCnYwdA+qIaz0MjYOe34M7oylCuv6vnSYNBVxtbBGxGlLV1Mjs6OdmulZS3S pcXlxBzedaLWaKCYX7W3xXTRvya26NxPKm6SWlQa7pgvZjOVoSKymdDXLqJSlTKCOLry 1BF7u7TOymECGb0YNNNavAjNZU8+iQkk95Vn9rj1WXVql7MMv4QEBprGB//0wJP3CzuF BghP2X41ss1rzMHb6yXiveaTXSMBFyjO799dWJeZE3lmGuWd+T2H/ujf/BVuRMV3Oox6 bNEqTGaG1xlqtOg3qI7pxn1/QkzY1JmSjxIdWfcfJld+0jjo8lTW0hY8qUzvQ6zRP+EC zDQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H8fJfHvYAQbBybgPIV/n4kd8GOI783ZQEyi/eOMq5GY=; b=NKCOL3A4i075S3N6un37XBuDoElD31MGsrnuhqUbTqXiAlVzRG6KtR2x1E1OaF6AA+ 5Xe2r1a61gitlLPsMyrj8ikd0HwSDcytrFFfYLKdiClCBVPIyGhiw0Y8BF2p+N/W+Z9t aHlhqcIAgagUfpZ70etlIsP5Hlsv3mzHTt2Xu/IqdfBFEIGKhm31RlVJ1aWzhBjPSapv QAC3YO2f1ChFlg+at7PfaJPs2KdHTkILtaYu/R/BvOUb0mmYA+jPSheIZG1SGxl6MM3o D+hzrGBPzUH5VvP1ZN0ijhDJphk/3wEKS59X/OZ3C4UEyinNtm6GigjEhdkJyQey0NgT JQpQ== X-Gm-Message-State: ACrzQf0wtamY3j5lsJxrKfMB+0BIYVDDLLZcjCHYvZHX7RN01FhHlWJH ZxAnj6hJt7u72tgBeH3MoOHGSWLs594oZY5kcmE= X-Received: by 2002:a05:6a00:80e:b0:563:4ad2:9d39 with SMTP id m14-20020a056a00080e00b005634ad29d39mr5870781pfk.66.1665763360653; Fri, 14 Oct 2022 09:02:40 -0700 (PDT) Received: from 192.168.0.102 ([2400:9ce0:1267:8cd7:7f1f:f80c:3b70:1976]) by smtp.gmail.com with ESMTPSA id y68-20020a626447000000b005624b4bd738sm1886144pfb.156.2022.10.14.09.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Oct 2022 09:02:40 -0700 (PDT) Subject: Re: [PATCH v2] mmc: sdio: fix kernel panic when remove non-standard SDIO card To: Ulf Hansson , Weizhao Ouyang Cc: Matthew Ma , Sergey Shtylyov , John Wang , Andrew Morton , Grazvydas Ignotas , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221014034951.2300386-1-ouyangweizhao@zeku.com> From: Weizhao Ouyang Message-ID: <1bdf5762-4761-7441-0145-8179bb917781@gmail.com> Date: Sat, 15 Oct 2022 00:02:35 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On 10/14/22 22:07, Ulf Hansson wrote: > On Fri, 14 Oct 2022 at 05:50, Weizhao Ouyang wrote: >> From: Weizhao Ouyang >> >> From: Matthew Ma >> >> SDIO tuple is only allocated for standard SDIO card, especially it >> causes memory corruption issues when the non-standard SDIO card has >> removed since the card device's reference counter does not increase for >> it at sdio_init_func(), but all SDIO card device reference counter has >> decreased at sdio_release_func(). >> >> Fixes: 6f51be3d37df ("sdio: allow non-standard SDIO cards") >> Signed-off-by: Matthew Ma >> Reviewed-by: Weizhao Ouyang >> Reviewed-by: John Wang > If I understand correctly, Matthew Ma should be > the author of the patch? > > Assuming I am correct, I have amended the patch and changed that, > please tell me if I should change that. Yeah you are correct, thanks for the reply! > So, I applied this for fixes and by adding a stable tag, thanks! > > Kind regards > Uffe > > >> --- >> Changes in v2: >> -- update Fixes tag >> >> drivers/mmc/core/sdio_bus.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c >> index c6268c38c69e..babf21a0adeb 100644 >> --- a/drivers/mmc/core/sdio_bus.c >> +++ b/drivers/mmc/core/sdio_bus.c >> @@ -291,7 +291,8 @@ static void sdio_release_func(struct device *dev) >> { >> struct sdio_func *func = dev_to_sdio_func(dev); >> >> - sdio_free_func_cis(func); >> + if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO)) >> + sdio_free_func_cis(func); >> >> kfree(func->info); >> kfree(func->tmpbuf); >> -- >> 2.25.1 >>