Message ID | 20240301143731.3494455-1-sumit.garg@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp1121798dyb; Fri, 1 Mar 2024 06:37:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbcT1BMX4uuU730NqxIS9pqMfvHXnw57D2upJrozrgbVgYULwcFI29eNn8PRrWcryZUZbriZuTLHyDlfd8o8QY3+0hkA== X-Google-Smtp-Source: AGHT+IGiDkEn6GLEWvTK1n3PqMR9AcxUmajnJ2EQxcmNaWRQ89IRAmx1qeJI3grBO3jmekQ3rhXj X-Received: by 2002:a9d:638d:0:b0:6e2:f4a8:799 with SMTP id w13-20020a9d638d000000b006e2f4a80799mr2075143otk.16.1709303879769; Fri, 01 Mar 2024 06:37:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709303879; cv=pass; d=google.com; s=arc-20160816; b=cTIYcFiWvDCMFYimDtCBnlFi8q8EOGfaQM9g4qWTVCbPy7XcuPqIEJduH2TjFJp9jt XAWHIKBla2Z+m+IQ56+p/Ls7HslSz6gI5PhAI/3uyT6JaZASPiGgXLKC/aFruY0DwuSF KenXUsvw09UA5K+Bc1bv0KZuvl+dMpsukslbSMlRBo5D5LX1JwcJdlxO+tsl3+syVTix gIk824Vwz5xQ8c8R/pdfit/eu7e0xMRUHobCqDxcTDZu0SD7FbSoUJKmGxS0OUSot/65 ImX78dQMSG0z1xdK5tDq1FWYP1HthCAw9MhDkb1j+3IgqN6mOybbLzS9oaNmRuZ87cRO axeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=oVtdCDkncAEjYp5VDfB0TkA+iNPQzbJhtZQ9XlyWAes=; fh=oQUNVBzmQy9vIVATUz8R8AjMRoh0cGsw0ocxa8qbpuk=; b=h1YS16aUpBYtVcm9LcG2xPKP+G/z7CsifFAZLk/mLKuUcDj4zDDgYWs9OD1K0Hvjag 9cHicsgl9LaTG3UAXi75To1LJmxOd/DezZYVRvPO9TFIkByab6jG9aj5inNZTked9K1U sOrIezDVlhcspYw+5k9tgok/OCwtzZw1NGF5v0/MG6kvIKceErHZ2VsT/4SP+HSr1OMZ 5m7xWlPBjdm7xAkHobGg8WCHJeLok6GBJfEgyGm7pPEWOY9xtANYjaXYehcWesK8IHZR R2YJXWlXNhNgxfU74MGn42LKlRwRBKIiTZfQDMQdbdu8pBBiHoXDYW6sjcYl7qUO3zjA q+HQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TV4qXrW6; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m19-20020a634c53000000b005dc6d22d2b6si3635406pgl.794.2024.03.01.06.37.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 06:37:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TV4qXrW6; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88557-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 880492837CA for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 14:37:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 760552B9D5; Fri, 1 Mar 2024 14:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TV4qXrW6" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FE081FA0 for <linux-kernel@vger.kernel.org>; Fri, 1 Mar 2024 14:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709303864; cv=none; b=PT3lOxe3JeLUXbnNwog8L1BF6OjzmJua+MecYIF7FWikUd9VBPlLx5YY9dz8KlhvlQs0ayhUoAVC07GJUcTZ9pCpfsX5NCCVv9iIvn3f4GCFulQX7uQr4Xu9zpp3uUrJlziMihfPbBDRZ15WY572g4V/PXArLRzbXwpe6y41YzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709303864; c=relaxed/simple; bh=Tu1IhSm5ytRoCYM2NUIGoUQfc9tPBjeGnKpUrWBIzS4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eeBm8RKZKPtI4mU/6WHrjpmyBzTwWJ10utvu8nnr2tFSuGoc38GH3sXvbKoZcBD0/CdTmRkubYma98qYmBC9/apDH5RTbgqQfAKX01QSZQ1beX2x5+GvI2LspD1kVzP2FYDHsyG4vcM4TsNk7bsSkrorauw6qeG1g7u4aZHVjFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TV4qXrW6; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1dbae7b8ff2so6097815ad.3 for <linux-kernel@vger.kernel.org>; Fri, 01 Mar 2024 06:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709303862; x=1709908662; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oVtdCDkncAEjYp5VDfB0TkA+iNPQzbJhtZQ9XlyWAes=; b=TV4qXrW63j5bHEgVYRDL5i5MnfUy4QudFtwBnXK5JBFifgyAyzNscdLpFUhh40SdYO QsEqUAU9WT4kPyHqgZMsSrkAIBj/7EUdVcujrgssNMabe9khIAb5TleYStqMC6mMFXY2 +ovfR4q1D5pWeZGSTz+e+tExb6CzLLrS+4C0MO6pMMoVDz08WrtMVSYtRLhQ4TI7kQb9 EiZk9vv+mss9H61A0HrOp2jf5pg7edESrxqqcPc+48+jq8Gx88Z4kZwJ4AT3n+Y+w23y tts8axSVuIH9A648mO3cZzEZFLRYCG8jqyE2CAiGjIGAerPwkFXCdPdvkcsCRnJP71Gp lBEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709303862; x=1709908662; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oVtdCDkncAEjYp5VDfB0TkA+iNPQzbJhtZQ9XlyWAes=; b=e0O9czIPHQ3Dwhq1AhNdzZoFJARSbMzTWV7gQ3QnezBCfA5GPTflGhXHuoygUxnmza uUWPrXogGmeTcnt1yrkui/6OmPx6PrZJ/z38HB2DW/cvilI7gQHx1cgCkEznnN/Fzv9L q7yV6HdZ6Qo1Xmdxe9cN2jXltOongABXSkLZorc62cSXKqq4fEckc1bQuu2ycty6nEpC IBVbERmimbt0dl77uksTZ4g0w5Z7UEyCTvDa5c2XyWg4vF9kiHfWgi91rdZ2/wMlOoth NKncrrar3+rJ021TdXFXbI7Eb1gcjNIBCbq0xYsPMGmDkFDDgIjYaKS62XAdWaMPr0Oa 144Q== X-Forwarded-Encrypted: i=1; AJvYcCXYQjn+3pYZxi2I87t38LZ29vVCuzitXp3yz2Uvi0OqCmnZem1WNxnR6HTUpAMlgS+EZ8JPQo2kio+AhZl8HVhssK4kFHSMMrK2FNAu X-Gm-Message-State: AOJu0YzMb4LlaCtjYJ4UrURi9B48/OijQgHnvgWvsZWpMgpkzcl74Frx hQgxN1cFYwbdpilKdfRig00MtVShGqxj2GWjnCrFXp/7ZONDoVZoSCDN/QcLHbQ= X-Received: by 2002:a17:902:d3c4:b0:1dc:5d9d:6eb3 with SMTP id w4-20020a170902d3c400b001dc5d9d6eb3mr1641483plb.21.1709303862445; Fri, 01 Mar 2024 06:37:42 -0800 (PST) Received: from sumit-X1.. ([223.178.213.98]) by smtp.gmail.com with ESMTPSA id c3-20020a170902d90300b001db94bead0asm3497899plz.193.2024.03.01.06.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 06:37:42 -0800 (PST) From: Sumit Garg <sumit.garg@linaro.org> To: op-tee@lists.trustedfirmware.org Cc: jens.wiklander@linaro.org, ilias.apalodimas@linaro.org, jerome.forissier@linaro.org, linux-kernel@vger.kernel.org, mikko.rapeli@linaro.org, Sumit Garg <sumit.garg@linaro.org>, stable@vger.kernel.org Subject: [PATCH] tee: optee: Fix kernel panic caused by incorrect error handling Date: Fri, 1 Mar 2024 20:07:31 +0530 Message-Id: <20240301143731.3494455-1-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792335025028946558 X-GMAIL-MSGID: 1792335025028946558 |
Series |
tee: optee: Fix kernel panic caused by incorrect error handling
|
|
Commit Message
Sumit Garg
March 1, 2024, 2:37 p.m. UTC
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 <mikko.rapeli@linaro.org>
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 <sumit.garg@linaro.org>
---
drivers/tee/optee/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
+ Arnd On Fri, 1 Mar 2024 at 20:07, Sumit Garg <sumit.garg@linaro.org> wrote: > > 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 <mikko.rapeli@linaro.org> > 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 <sumit.garg@linaro.org> > --- > drivers/tee/optee/device.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Jens, Arnd, Is there any chance for this fix to make it into v6.8 release? -Sumit > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c > index 9d2afac96acc..d296c70ddfdc 100644 > --- a/drivers/tee/optee/device.c > +++ b/drivers/tee/optee/device.c > @@ -90,13 +90,14 @@ static int optee_register_device(const uuid_t *device_uuid, u32 func) > 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) > -- > 2.34.1 >
Hi, On Mon, Mar 4, 2024 at 6:45 AM Sumit Garg <sumit.garg@linaro.org> wrote: > > + Arnd > > On Fri, 1 Mar 2024 at 20:07, Sumit Garg <sumit.garg@linaro.org> wrote: > > > > 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 <mikko.rapeli@linaro.org> > > 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 <sumit.garg@linaro.org> > > --- > > drivers/tee/optee/device.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > Jens, Arnd, > > Is there any chance for this fix to make it into v6.8 release? I'm picking up this and have also just sent it in a pull request for v6.8. If it makes it into v6.8 remains to be seen. Thanks, Jens > > -Sumit > > > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c > > index 9d2afac96acc..d296c70ddfdc 100644 > > --- a/drivers/tee/optee/device.c > > +++ b/drivers/tee/optee/device.c > > @@ -90,13 +90,14 @@ static int optee_register_device(const uuid_t *device_uuid, u32 func) > > 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) > > -- > > 2.34.1 > >
On Mon, Mar 4, 2024, at 06:45, Sumit Garg wrote: > + Arnd > > On Fri, 1 Mar 2024 at 20:07, Sumit Garg <sumit.garg@linaro.org> wrote: >> >> 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 <mikko.rapeli@linaro.org> >> 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 <sumit.garg@linaro.org> >> --- >> drivers/tee/optee/device.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> > > Jens, Arnd, > > Is there any chance for this fix to make it into v6.8 release? I merged the pull request into my arm/fixes branch now, will send the branch on once it passes CI. Arnd
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c index 9d2afac96acc..d296c70ddfdc 100644 --- a/drivers/tee/optee/device.c +++ b/drivers/tee/optee/device.c @@ -90,13 +90,14 @@ static int optee_register_device(const uuid_t *device_uuid, u32 func) 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)