From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3648764CC0; Thu, 11 Apr 2024 10:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712831815; cv=none; b=bkPYRIjWAC3z/PngxblbGQk/UsyPgyJf4+xtmioTRZysbowT/XgmWzAedOl31tKFuuYJzq3AkNe9q8hhQIm+pgDusKizoSPyv+l46+7Cquq4tuqvW/aNUo90wJ1G7f5z5GD8GoTjvJrvhXYs7qsi6g2hxDwRu2LAyFghZlMSE3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712831815; c=relaxed/simple; bh=PQl48g+kN+m17vLHDhvT4JpVk+kOp1P6NCkxlMOImDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HCqtB7pktjjD2bUtPsUoFJqP9Le4HRbFv2gHE28tYU+WaJo1i0Vw1RTYBtpoQVMGm8xfbEbGZ7RMub+RVvCxTvivTV1mlDQkRN0m1Hs6Zb+JISb+AP16eTdnGmjRRxVcvK02cvUoc1Ah13BRTfo7fgJHZq1Qsr+AceeiUYZx0TY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qdzCpxMJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qdzCpxMJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61495C433C7; Thu, 11 Apr 2024 10:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712831814; bh=PQl48g+kN+m17vLHDhvT4JpVk+kOp1P6NCkxlMOImDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdzCpxMJv8PUNEa0u3CRy+VeEK5rM/3UYTeKpfqbMj3KX/eoNKPp94uw3p2JtyPDt G90HBa4C3p3d6uIxGaxe9YGq8RL7JD/5BNNhHzrO/UAKBd/BnWxbuPXSZHAxXe9+Hb yp95ehytFMBtll0qY8kqFVZfrEH30ijV/GQoKa4o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mikko Rapeli , Sumit Garg , Jens Wiklander Subject: [PATCH 5.10 134/294] tee: optee: Fix kernel panic caused by incorrect error handling Date: Thu, 11 Apr 2024 11:54:57 +0200 Message-ID: <20240411095439.691279649@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095435.633465671@linuxfoundation.org> References: <20240411095435.633465671@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sumit Garg commit 95915ba4b987cf2b222b0f251280228a1ff977ac upstream. The error path while failing to register devices on the TEE bus has a bug leading to kernel panic as follows: [ 15.398930] Unable to handle kernel paging request at virtual address ffff07ed00626d7c [ 15.406913] Mem abort info: [ 15.409722] ESR = 0x0000000096000005 [ 15.413490] EC = 0x25: DABT (current EL), IL = 32 bits [ 15.418814] SET = 0, FnV = 0 [ 15.421878] EA = 0, S1PTW = 0 [ 15.425031] FSC = 0x05: level 1 translation fault [ 15.429922] Data abort info: [ 15.432813] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 [ 15.438310] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 15.443372] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 15.448697] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000d9e3e000 [ 15.455413] [ffff07ed00626d7c] pgd=1800000bffdf9003, p4d=1800000bffdf9003, pud=0000000000000000 [ 15.464146] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Commit 7269cba53d90 ("tee: optee: Fix supplicant based device enumeration") lead to the introduction of this bug. So fix it appropriately. Reported-by: Mikko Rapeli Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218542 Fixes: 7269cba53d90 ("tee: optee: Fix supplicant based device enumeration") Cc: stable@vger.kernel.org Signed-off-by: Sumit Garg Signed-off-by: Jens Wiklander Signed-off-by: Greg Kroah-Hartman --- drivers/tee/optee/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/tee/optee/device.c +++ b/drivers/tee/optee/device.c @@ -90,13 +90,14 @@ static int optee_register_device(const u if (rc) { pr_err("device registration failed, err: %d\n", rc); put_device(&optee_device->dev); + return rc; } if (func == PTA_CMD_GET_DEVICES_SUPP) device_create_file(&optee_device->dev, &dev_attr_need_supplicant); - return rc; + return 0; } static int __optee_enumerate_devices(u32 func)