From patchwork Thu Jun 10 06:47:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1490201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=f/dUepcd; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G0vgX4Nkyz9sWQ; Thu, 10 Jun 2021 16:48:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lrEU1-0002Te-Nu; Thu, 10 Jun 2021 06:48:05 +0000 Received: from mail-pj1-f50.google.com ([209.85.216.50]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lrETz-0002Sb-Lt for kernel-team@lists.ubuntu.com; Thu, 10 Jun 2021 06:48:03 +0000 Received: by mail-pj1-f50.google.com with SMTP id k5so3064980pjj.1 for ; Wed, 09 Jun 2021 23:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2zOtjEvc03pg/ifSGEJfRtATvWixeGqJMJWiRxpXNCA=; b=f/dUepcdpVRlbxdnokB1GelkpWXK9kEtMywDf0dBcDnYzAhWzT8VimMOnZBfTWjSFn gw9Z8CmvAJ0pY9aed1RlOivTqXCokuivG08qsuSRi6Sby5xOtn2ArwSHRsbWM3b9vT0W Pab3Z1RMPbi//VwjIHr+b5Fkc53BJtQczI0HDeLdkVTICM/UBEk9Dsg20IKPyGeoW9K2 G9N6OBvvT8G/k2PcG9MB7phpAolM6YwRXamDiOOyfKLpkmK2ORZivg4kTdLuMKQ63Voo cxcPqSV7D4dI/yTpezOVQXGHkpB1q2IL1fUre+MbpVRHivf+anSkx9WFYv+Z6SqNPFUg hbxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2zOtjEvc03pg/ifSGEJfRtATvWixeGqJMJWiRxpXNCA=; b=bFIrE60sEgV0QEnk3yBeHtckAvrkboiN197rm0vi4PFOx/Kil/UBHT3bWqGOg2uMJv RXaFGU5TbSGoyQ9b60qDSLjDS7HafkGAtjbp6ImpW0vr3DnVCQ57Qpo23cxqwp8BjuhO SC1heiL7BIYwm4hHDp2A7k9Pf4DZEv/mPPdRKLz16094QcAXJ6kqXw7V04FqpXq2XqzK 3IU5V9FEkXpF0vk25/ILEpg/rkrOxDnvRIJToJScLy5XuNFEDO+hPpvOBB2YaCOMJqe5 O8WcGHycyW5u4iyAh27sQdi4J6yykWhQChWfbmbm978rX0MV0WcmgyJyHC29eRjtuAHU dzVQ== X-Gm-Message-State: AOAM530lfPCMyoyeBciyZqSCg54YuruwJ9eivg9oY8WkgLR66FGrz7mq 5cAYmGKllu+u1kvQ+AnHE4jcpmV5UR4GaYjl X-Google-Smtp-Source: ABdhPJyZLFMP8E764fpy8DA9HZie332SlS4vHqjISPvsxDxYft+TxudLi5cgA89iOn3hw097VzDYCQ== X-Received: by 2002:a17:90b:190a:: with SMTP id mp10mr1822046pjb.145.1623307680945; Wed, 09 Jun 2021 23:48:00 -0700 (PDT) Received: from localhost (220-135-95-34.HINET-IP.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id v6sm1801083pgk.33.2021.06.09.23.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 23:48:00 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/7][SRU][OEM-5.10] platform/x86: dell-wmi-sysman: Fix crash caused by calling kset_unregister twice Date: Thu, 10 Jun 2021 14:47:48 +0800 Message-Id: <20210610064754.1061717-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210610064754.1061717-1-acelan.kao@canonical.com> References: <20210610064754.1061717-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.50; envelope-from=acelan@gmail.com; helo=mail-pj1-f50.google.com 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: Hans de Goede BugLink: https://bugs.launchpad.net/bugs/1931509 On some system the WMI GUIDs used by dell-wmi-sysman are present but there are no enum type attributes, this causes init_bios_attributes() to return -ENODEV, after which sysman_init() does a "goto fail_create_group" and then calls release_attributes_data(). release_attributes_data() calls kset_unregister(wmi_priv.main_dir_kset); but before this commit it was missing a "wmi_priv.main_dir_kset = NULL;" statement; and after calling release_attributes_data() the sysman_init() error handling does this: if (wmi_priv.main_dir_kset) { kset_unregister(wmi_priv.main_dir_kset); wmi_priv.main_dir_kset = NULL; } Which causes a second kset_unregister(wmi_priv.main_dir_kset), leading to a double-free, which causes a crash. Add the missing "wmi_priv.main_dir_kset = NULL;" statement to release_attributes_data() to fix this double-free crash. Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems") Cc: Divya Bharathi Cc: Mario Limonciello Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20210321115901.35072-2-hdegoede@redhat.com (cherry picked from commit bdda39673fdef32631448dcb75df79aed9643b31) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c index cb81010ba1a21..c1997db74cca5 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -388,6 +388,7 @@ static void release_attributes_data(void) if (wmi_priv.main_dir_kset) { destroy_attribute_objs(wmi_priv.main_dir_kset); kset_unregister(wmi_priv.main_dir_kset); + wmi_priv.main_dir_kset = NULL; } mutex_unlock(&wmi_priv.mutex);