From patchwork Fri Jul 19 19:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1962611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WQfjC2DH5z20FP for ; Sat, 20 Jul 2024 05:23:26 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sUtC9-0003Dc-SY; Fri, 19 Jul 2024 19:23:09 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sUtC8-0003Co-7i for kernel-team@lists.ubuntu.com; Fri, 19 Jul 2024 19:23:08 +0000 Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id C1FD33F0DE for ; Fri, 19 Jul 2024 19:23:07 +0000 (UTC) Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3987dace329so8809685ab.0 for ; Fri, 19 Jul 2024 12:23:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721416986; x=1722021786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hRbYx3VpzgyZKj9Oe3BEXt0iZUuzdJps/QrSWJPG+sc=; b=QZA++KRkMBqMnQv1RDBD+1dTGpAUj0nYq4dHkBXWlnLVXTaOwSioe0CPGwJwh2ANvO 1EmN0Y+8jPeCboc0WqF3sRRdkkOiV25ghsuDnBe7fsAK1Uvreq0LXULpq1mPnkVY1o49 8buvR2kBn7sihWJhGjwVcdVY7xoTjldbCnuVDEpRx8H50igkYRfPRXHCNL4p4HfiHiHH EUW1KV99sC0YOBmnHltJUF/effz+T/n0HIXNL+kkMbM4ztHKa4U6To1W+i1LqXfHc6ci gZSZMxcFEnZjwXgrB+psixDOMoXMjkkLwQAO+udj4r70mtawWM/ksY0LjrGJFUskNn2S z/4w== X-Gm-Message-State: AOJu0YxCiENgEnyQo664WFvOzAB0m5XNveF4Dge3MtI3hnFnZ+nG0dn2 V25AMJIhSYFrvfZAV2UAuOOMhj9t5DZlg5xcnBNr0qg+UZGWOaYJiKege5w+5wQc/2fzY72Xaty tyxclJzPW6G63W/oQuh5S/5J8FAaz7kmWGSTLqtd3Wn7CZ9yjNzH3cgPV2sG0zHH4x2BMR1kLNW /1svY3gcwVeg== X-Received: by 2002:a92:cd89:0:b0:382:f728:6ce5 with SMTP id e9e14a558f8ab-39557519ecemr110502655ab.27.1721416986155; Fri, 19 Jul 2024 12:23:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEetRzemZD7+QObwViuga7jjOOrkqIAv3eEz4oH3pzrki20ggyY0s7ZQ6fq4huz139sU3u3Lg== X-Received: by 2002:a92:cd89:0:b0:382:f728:6ce5 with SMTP id e9e14a558f8ab-39557519ecemr110502495ab.27.1721416985766; Fri, 19 Jul 2024 12:23:05 -0700 (PDT) Received: from smtp.gmail.com (167-248-51-36.oa02.lnk04.ne.dynamic.allophone.net. [167.248.51.36]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-397f584b687sm6085685ab.30.2024.07.19.12.23.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 12:23:05 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 1/1] mmc: davinci: Don't strip remove function when driver is builtin Date: Fri, 19 Jul 2024 14:23:03 -0500 Message-Id: <20240719192304.21821-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240719192304.21821-1-bethany.jamison@canonical.com> References: <20240719192304.21821-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Uwe Kleine-König Using __exit for the remove function results in the remove callback being discarded with CONFIG_MMC_DAVINCI=y. When such a device gets unbound (e.g. using sysfs or hotplug), the driver is just removed without the cleanup being performed. This results in resource leaks. Fix it by compiling in the remove callback unconditionally. This also fixes a W=1 modpost warning: WARNING: modpost: drivers/mmc/host/davinci_mmc: section mismatch in reference: davinci_mmcsd_driver+0x10 (section: .data) -> davinci_mmcsd_remove (section: .exit.text) Fixes: b4cff4549b7a ("DaVinci: MMC: MMC/SD controller driver for DaVinci family") Signed-off-by: Uwe Kleine-König Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240324114017.231936-2-u.kleine-koenig@pengutronix.de Signed-off-by: Ulf Hansson (cherry picked from commit 55c421b364482b61c4c45313a535e61ed5ae4ea3 linux-6.9.y) CVE-2024-39484 Signed-off-by: Bethany Jamison --- drivers/mmc/host/davinci_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c index ee3b1a4e08485..8fa6796787f4b 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c @@ -1344,7 +1344,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) return ret; } -static void __exit davinci_mmcsd_remove(struct platform_device *pdev) +static void davinci_mmcsd_remove(struct platform_device *pdev) { struct mmc_davinci_host *host = platform_get_drvdata(pdev); @@ -1399,7 +1399,7 @@ static struct platform_driver davinci_mmcsd_driver = { .of_match_table = davinci_mmc_dt_ids, }, .probe = davinci_mmcsd_probe, - .remove_new = __exit_p(davinci_mmcsd_remove), + .remove_new = davinci_mmcsd_remove, .id_table = davinci_mmc_devtype, };