Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3F9BC433EF for ; Thu, 23 Dec 2021 04:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346286AbhLWEDb (ORCPT ); Wed, 22 Dec 2021 23:03:31 -0500 Received: from mout.gmx.net ([212.227.17.21]:34501 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238699AbhLWED3 (ORCPT ); Wed, 22 Dec 2021 23:03:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1640232199; bh=4ILo/VJm8wgroPorTTpv5tAKucJx98LcPaR7SD+bkw8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=hrf0cYhm4HEHji31aXKDeXveSfpishJEHt0cTeypZ1L0ZVeK+rKflKdvzgutBCaca winCaQv6CFuGUAhzE8wQHgGdrcnb8CmBV9ofdlbZbWI+feBq/sUtSLE+rdE21J7xjq MQfMiAUEMX01uIrjc9cCkAVE0MPs9lNLgKbE7rWQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.119.124]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N1fii-1mKDZ039ei-011zLn; Thu, 23 Dec 2021 05:03:18 +0100 From: Lino Sanfilippo To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: p.rosenberger@kunbus.com, stefanb@linux.ibm.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Lino Sanfilippo , stable@vger.kernel.org Subject: [PATCH v3] tpm: fix potential NULL pointer access in tpm_del_char_device Date: Thu, 23 Dec 2021 05:02:46 +0100 Message-Id: <20211223040246.6575-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:2kDWMu0wWMr7HLmwOpt7VP3fzse20/ciSnJzNIltI1yar+OtMxB 6XrkoGlLhABtmA+RWtFcAwJr8tXhG8It642u3/HFEOHbK7LyNQCl7Wn4PdwYgcj3SujBfVk FKDKHRTllKA6kUlZcbisqn6PgsT8WBdDgxtlbGiu9QhnxKvk2zk6WjG0ZYq8FFkwVOqXyeJ QJMSvilLhUxGxh5Pedh4Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:g85bodK0EJ8=:RR6KOWkI1oIuahrmq37tih 3qeasUJCSto5uPGPyYK+OZAP4MoMOupg8Sh4OTfDNqYpkXg0TRLiodBGjNQN6YMVmBHVujrQH F+AMp0X/MPE58fIBII5SEZeysswyI73FxAMTtASQTJ8vhcWeBZFVCDrdbmUPL5d1FHdEupelh x5L9QbW/OSv76T59XTMv9/DJ27hxLbTsfkR8utrpTO24eGwSZHY+oFJ/xg9ROVKo0QhAX3GmX 4mT7zRNEAtC/16e1njXD9D7CRgwWTEScCtCN0l7Lks0/zeq1mHVjz9M8xc0qoScAc9K0YgPtH SrB214JkLSJl0eCU1qrJUL9CsYCyDZ1ex3BZRzK559PuueOkFrYJy2gbz8TD2UxHgzX1iO51n /ydFMq8xW54sDYuFS5a30bwDzPwSJS8KlVNm1oN/KT0D98a7dzNb1OZ8gpKcfO8Hw3Rdo1rc/ eUIgsBdNr9dQv3OS7VwXHaDmz12Mo88rA2A67Yq2fe4+c3aKWG4rX/tEZJu3c5Sk2yLfjU9F8 bg1K0iLiY/GyKt+Ek6NjfBDV4H1sW5Ct9ZRyWYpPPtnXRa3Go9qsu4wdlAm8ZFom/BkpFX2dy EYdm2NoUwIh7Z3pRDE025q+xIrN/JCSVTI7lDVld+ReAS1/0zBXnxrIoD4m59YkFNG4VuKAzN QT6yE4I2eVNuIBCoJuW9frxc3lyi/NcyT679G+qd9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