diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 14fb42f98c9e..10e7717748a1 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2150,6 +2150,12 @@ static int fastrpc_init_process(struct fastrpc_file *fl, remote_arg_t ra[1]; int tgid = fl->tgid; + if (fl->dev_minor == MINOR_NUM_DEV) { + err = -ECONNREFUSED; + pr_err("adsprpc: %s: untrusted app trying to attach to privileged DSP PD\n", + __func__); + return err; + } ra[0].buf.pv = (void *)&tgid; ra[0].buf.len = sizeof(tgid); ioctl.inv.handle = FASTRPC_STATIC_HANDLE_PROCESS_GROUP; @@ -2274,6 +2280,13 @@ static int fastrpc_init_process(struct fastrpc_file *fl, unsigned int pageslen; } inbuf; + if (fl->dev_minor == MINOR_NUM_DEV) { + err = -ECONNREFUSED; + pr_err("adsprpc: %s: untrusted app trying to attach to audio PD\n", + __func__); + return err; + } + if (!init->filelen) goto bail;