lkml.org 
[lkml]   [2021]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] misc: fastrpc: Add secure device node support
On Thu, Nov 25, 2021 at 07:45:41PM +0530, Jeya R wrote:
> Register and deregister secure device node. Check for device name during
> device open get proper channel context.
>
> Signed-off-by: Jeya R <jeyr@codeaurora.org>
> ---
> drivers/misc/fastrpc.c | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 39aca77..0775554e 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -79,6 +79,7 @@
> #define SENSORS_PD (2)
>
> #define miscdev_to_cctx(d) container_of(d, struct fastrpc_channel_ctx, miscdev)
> +#define securedev_to_cctx(d) container_of(d, struct fastrpc_channel_ctx, securedev)
>
> static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp",
> "sdsp", "cdsp"};
> @@ -213,6 +214,7 @@ struct fastrpc_channel_ctx {
> struct idr ctx_idr;
> struct list_head users;
> struct miscdevice miscdev;
> + struct miscdevice securedev;
> struct kref refcount;

Wow, you now have 3 structures with reference counts all trying to
manage the same structure. That's 2 more than you need.

This is not ok, please do not do that.

greg k-h

\
 
 \ /
  Last update: 2021-11-25 16:48    [W:1.629 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site