From patchwork Fri Jul 19 19:23:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1962613 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 4WQfjC2Nstz20FV 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 1sUtCB-0003Dq-88; Fri, 19 Jul 2024 19:23:11 +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-0003Cp-5V 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 DDD58400E1 for ; Fri, 19 Jul 2024 19:23:07 +0000 (UTC) Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-375d2ddeffbso34778515ab.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=C7FEjIKg2WwyPUxDuRathxlYzvcJ3SC4yX+LtfZ786U=; b=j0WkyjkM03x/JAY5N3cBjGkhdx8zUQh461Pfu1X3yySHIm5A4Dr2IxyRzQEwciZ34m czsbrKmqoEOZI45iYWwBMjiHXJ6bKNURzgzDxvZKOzuDIHK8mKMLDmI7AaN+CaAzh0Kt dolKliHe/wS3UKIXKdAzlNYbMuHIW/S+TL5vbX4FQcYWvXQM2hDciQOyoRv1jxVCwaHD izUkq4+J1TjmqY4GaFOsnhh+4qAcV/RoRizhb0P8QS+qZK5dJcdTuKIi+cDlO89IMKxQ nvrt4WbUTTmrOHOa3ylqROqASrhDKV38eKhLUbBw7iKxlDf84a6avyCaFY8dxm1Lz7kT H+ww== X-Gm-Message-State: AOJu0YzXrecT9Ks1UxXTopiQVJsng+QnPSiNOqNSIZf5PdAeO4SruGgO 8lNufU2Q10NFinxJwSQtouZyzWE2wxB9VSr7lMqWtnvohhQQxcuztYSPOPfGpm1BJJZlGfZzH6s It/LtTB4U+O7QLFFLIFbHz3feSUHM6ZKl/CrYIXCihLLq4UmLAo0BBiiZ0Xyztk/vRmhdEiTOi0 1mL0a46HqizA== X-Received: by 2002:a05:6e02:154e:b0:374:ada1:296b with SMTP id e9e14a558f8ab-39555613f53mr114069805ab.8.1721416986722; Fri, 19 Jul 2024 12:23:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLiKIsuzmqHY2EpuMYK4md5wCxmgQS+9jt3WD1V9ytqBv0dQ7YTRFZtOgOuOjs4IIWwy1ZHA== X-Received: by 2002:a05:6e02:154e:b0:374:ada1:296b with SMTP id e9e14a558f8ab-39555613f53mr114069595ab.8.1721416986314; Fri, 19 Jul 2024 12:23:06 -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:06 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][J/F][PATCH 1/1] mmc: davinci: Don't strip remove function when driver is builtin Date: Fri, 19 Jul 2024 14:23:04 -0500 Message-Id: <20240719192304.21821-3-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 [ Upstream commit 55c421b364482b61c4c45313a535e61ed5ae4ea3 ] 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 Signed-off-by: Sasha Levin (cherry picked from commit 6ff7cfa02baabec907f6f29ea76634e6256d2ec4 linux-5.10.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 80de660027d89..374ec1a44fe5b 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c @@ -1347,7 +1347,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) return ret; } -static int __exit davinci_mmcsd_remove(struct platform_device *pdev) +static int davinci_mmcsd_remove(struct platform_device *pdev) { struct mmc_davinci_host *host = platform_get_drvdata(pdev); @@ -1404,7 +1404,7 @@ static struct platform_driver davinci_mmcsd_driver = { .of_match_table = davinci_mmc_dt_ids, }, .probe = davinci_mmcsd_probe, - .remove = __exit_p(davinci_mmcsd_remove), + .remove = davinci_mmcsd_remove, .id_table = davinci_mmc_devtype, };