Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2405241rwi; Tue, 11 Oct 2022 08:23:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ly91sToiG76Vhak9eSppyHFigH+VKgjXm4Oq5nyYyV7CpdZoXpMLUx8A/V13oWq+VhCoV X-Received: by 2002:a17:90b:1648:b0:20b:f0ae:2169 with SMTP id il8-20020a17090b164800b0020bf0ae2169mr23170855pjb.173.1665501815609; Tue, 11 Oct 2022 08:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665501815; cv=none; d=google.com; s=arc-20160816; b=bDyvZ596KdWumdNqAjyl8pP/O7fRvQCO9HgFDhChszfxRsibwC6q0qGvI3urkVU3hM BGP/C3cniwkFa4eJrfh3appvjNDd8rKPj31Hdba9gQoGb/OcaqgpXud/2AparQ8uyIbL dnHuj48CVbudrE0uVG5DkLGmyzlKtUcl/HJJYJ8+HWuXcx0JLjGCt9+2BwauO+qXnb87 n50JZsvLxJj1eS7MlxAJGrlOpFnuwuMciy933C1trCCbRoHJonaLHJKAPuxuKXAREibX +cszbg8vmTaIa0xUh5AgUtJ56dvKaWW8nEdAkbFju+0DFf5DFrTnCHEpJqELyaupBlZF FKwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VPSVqJz387vGX+lndeFLaz7/WMZ4XtC2ycr+jawg9P8=; b=RUKMN7pHBW560dPEiEVDqq57DyPaWOVBVlh4vCX6+7ZFGWraJadWvepeXtaqijUk7k AiX7V44nQ4PiN9OoLr5go6VeFr2beHOQmVOKOgUFz/ubWlemlcYra1OucvuX0VfJsM69 m2Q64A17e03z2K9Ddajg7c6DtH2ERObifE7bfdM9j6PVaHwBh5xVP79FUayfTRWp6mz5 5w+NjxejhDaXTTlw/5rN2Cz9tMpfv9emc1o5aH2Hnh3tJGu+50C10Kgjgvn+G91g2Xm6 MzJtLd7aJP0vNteSWWRUXo82PDg95gin2g4fJ4OKjApZYuC1xO7NBMtI0fOSIlBxYmkQ RpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQnj4Mjl; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e80600b0017f9db0233fsi10079814plg.448.2022.10.11.08.23.23; Tue, 11 Oct 2022 08:23:35 -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=@linaro.org header.s=google header.b=mQnj4Mjl; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbiJKOlj (ORCPT + 99 others); Tue, 11 Oct 2022 10:41:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbiJKOlf (ORCPT ); Tue, 11 Oct 2022 10:41:35 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805D05141C for ; Tue, 11 Oct 2022 07:41:33 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id b2so13372374plc.7 for ; Tue, 11 Oct 2022 07:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VPSVqJz387vGX+lndeFLaz7/WMZ4XtC2ycr+jawg9P8=; b=mQnj4MjlGH8JCAAKVdx0ZM4mg4T+VBUJRL1PF6iiHzJBxFr7gaFI1MpVEsVgPsuw/P hkjU5CuHkatbpL/GBc7u4h2oboAuZ/HnHZOgB0SsRZdd4w+s8fidpVdRbpcdLfBajMGv MdeQkF2mLL055Eu+mvcH58OX4RUeW0WeqJwjGUVTUufON/NUkj2HIzXDve9c2A+3iXZE w93AH+to+qUjIxZ7+DszdS5Imwhd24yyIZsHl7qpm66gZ7KRn/sGzg/cuYiUc9IH7zY/ +WlPZ1rRezDZVP1y/gpY2mUALMUCzCYUd4/8JwnOQ5yBgcLfBv0Uo6qhXcp+7GKttqC3 LR/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VPSVqJz387vGX+lndeFLaz7/WMZ4XtC2ycr+jawg9P8=; b=ZkdNt3zXXOKNs+xszpXqX/P4/DjrXP0CpWNa6NaamrAwUZlBa2aGMb7n5iZXFNFnbY b0J4b0glQcotagVJtKu9rynmEpqx+BvUuOFQ9DnkD3LMHDFV+VLZHrDuMB9xtn3M36f7 EtSxp3xGOPu87kx3YGTeAOy5iu+gsUh4EueMyr++HYws4pB7pdiUkCljUgErbJG3XKVB zO0CuLIFfbxQKpmX0GfwuzOLUrJhMObeKosZzL8DO3/1/Q9cxpxUBjWtIA202lTvPfwQ 7/+seC6HTUxZbZ3L7O0OX5caGMXBGWf2yXBc4WAU5X2G59qITrR/QBXwoMOQaOJuCM0k +fsQ== X-Gm-Message-State: ACrzQf28wr6m7OR+LdlICVfP2u97r6jUjMEHbeJM4n7CHDYwmsFSCRbI OWbnLUTdrvlXrgbZWM8JD+LD38uApX0K/M3mbFTGTA== X-Received: by 2002:a17:902:d714:b0:17f:5813:1df4 with SMTP id w20-20020a170902d71400b0017f58131df4mr25485853ply.148.1665499292988; Tue, 11 Oct 2022 07:41:32 -0700 (PDT) MIME-Version: 1.0 References: <20220927020158.1218469-1-ouyangweizhao@zeku.com> In-Reply-To: <20220927020158.1218469-1-ouyangweizhao@zeku.com> From: Ulf Hansson Date: Tue, 11 Oct 2022 16:40:56 +0200 Message-ID: Subject: Re: [PATCH] mmc: sdio: fix kernel panic when remove non-standard SDIO card To: Weizhao Ouyang Cc: John Wang , Sergey Shtylyov , Matthew Ma , Pierre Ossman , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Tue, 27 Sept 2022 at 04:04, Weizhao Ouyang wrote: > > 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: 1a632f8cdc33 ("sdio: split up common and function CIS parsing") > Signed-off-by: Matthew Ma > Reviewed-by: Weizhao Ouyang > Reviewed-by: John Wang Apologize for the delay! Wow, that's a very old bug you fixed! However, it looks like the fixed commit should be changed to 6f51be3d37df ("sdio: allow non-standard SDIO cards"). I tried to apply the patch, but the patch format seems to be corrupt. Did you use git format-patch and did run ./scripts/checkpatch.pl on it? Kind regards Uffe > --- > 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 >