From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v2] misc: fastrpc: fix context leak and hang on signal-interrupted invoke
Date: Fri, 3 Jul 2026 10:39:19 +0800 [thread overview]
Message-ID: <202607031058.69A6d6WW-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260701-master-v2-1-566bf8b7bd16@oss.qualcomm.com>
References: <20260701-master-v2-1-566bf8b7bd16@oss.qualcomm.com>
TO: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
TO: Srinivas Kandagatla <srini@kernel.org>
TO: Amol Maheshwari <amahesh@qti.qualcomm.com>
TO: Arnd Bergmann <arnd@arndb.de>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: "Jorge Ramirez-Ortiz" <jorge.ramirez@oss.qualcomm.com>
CC: linux-arm-msm@vger.kernel.org
CC: dri-devel@lists.freedesktop.org
CC: linux-kernel@vger.kernel.org
CC: stable@kernel.org
CC: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
Hi Anandu,
kernel test robot noticed the following build warnings:
[auto build test WARNING on dc59e4fea9d83f03bad6bddf3fa2e52491777482]
url: https://github.com/intel-lab-lkp/linux/commits/Anandu-Krishnan-E/misc-fastrpc-fix-context-leak-and-hang-on-signal-interrupted-invoke/20260701-161349
base: dc59e4fea9d83f03bad6bddf3fa2e52491777482
patch link: https://lore.kernel.org/r/20260701-master-v2-1-566bf8b7bd16%40oss.qualcomm.com
patch subject: [PATCH v2] misc: fastrpc: fix context leak and hang on signal-interrupted invoke
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: sparc-randconfig-r071-20260702 (https://download.01.org/0day-ci/archive/20260703/202607031058.69A6d6WW-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.4.0
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202607031058.69A6d6WW-lkp@intel.com/
New smatch warnings:
drivers/misc/fastrpc.c:1340 fastrpc_internal_invoke() warn: 'ctx' can also be NULL
Old smatch warnings:
drivers/misc/fastrpc.c:1356 fastrpc_internal_invoke() warn: 'ctx' can also be NULL
drivers/misc/fastrpc.c:1440 fastrpc_init_create_static_process() error: we previously assumed 'fl->cctx->remote_heap' could be null (see line 1430)
vim +/ctx +1340 drivers/misc/fastrpc.c
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1287
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1288 static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1289 u32 handle, u32 sc,
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1290 struct fastrpc_invoke_args *args)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1291 {
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1292 struct fastrpc_invoke_ctx *ctx = NULL;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1293 int err = 0;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1294
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1295 if (!fl->sctx)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1296 return -EINVAL;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1297
2e369878bd4399 Bjorn Andersson 2019-08-29 1298 if (!fl->cctx->rpdev)
2e369878bd4399 Bjorn Andersson 2019-08-29 1299 return -EPIPE;
2e369878bd4399 Bjorn Andersson 2019-08-29 1300
20c40794eb85ea Dmitry Baryshkov 2021-02-12 1301 if (handle == FASTRPC_INIT_HANDLE && !kernel) {
20c40794eb85ea Dmitry Baryshkov 2021-02-12 1302 dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle);
20c40794eb85ea Dmitry Baryshkov 2021-02-12 1303 return -EPERM;
20c40794eb85ea Dmitry Baryshkov 2021-02-12 1304 }
20c40794eb85ea Dmitry Baryshkov 2021-02-12 1305
d79842457e9cbe Anandu Krishnan E 2026-07-01 1306 if (!kernel) {
d79842457e9cbe Anandu Krishnan E 2026-07-01 1307 ctx = fastrpc_context_restore_interrupted(fl, sc);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1308 if (IS_ERR(ctx))
d79842457e9cbe Anandu Krishnan E 2026-07-01 1309 return PTR_ERR(ctx);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1310 if (ctx)
d79842457e9cbe Anandu Krishnan E 2026-07-01 1311 goto wait;
d79842457e9cbe Anandu Krishnan E 2026-07-01 1312 }
d79842457e9cbe Anandu Krishnan E 2026-07-01 1313
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1314 ctx = fastrpc_context_alloc(fl, kernel, sc, args);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1315 if (IS_ERR(ctx))
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1316 return PTR_ERR(ctx);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1317
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1318 err = fastrpc_get_args(kernel, ctx);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1319 if (err)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1320 goto bail;
415a0729bd1225 Srinivas Kandagatla 2019-03-07 1321
415a0729bd1225 Srinivas Kandagatla 2019-03-07 1322 /* make sure that all CPU memory writes are seen by DSP */
415a0729bd1225 Srinivas Kandagatla 2019-03-07 1323 dma_wmb();
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1324 /* Send invoke buffer to remote dsp */
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1325 err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1326 if (err)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1327 goto bail;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1328
d79842457e9cbe Anandu Krishnan E 2026-07-01 1329 wait:
55bcda35584c99 Jorge Ramirez-Ortiz 2019-10-09 1330 if (kernel) {
d79842457e9cbe Anandu Krishnan E 2026-07-01 1331 if (!wait_for_completion_timeout(&ctx->work, 10 * HZ)) {
55bcda35584c99 Jorge Ramirez-Ortiz 2019-10-09 1332 err = -ETIMEDOUT;
d79842457e9cbe Anandu Krishnan E 2026-07-01 1333 dev_warn(fl->sctx->dev,
d79842457e9cbe Anandu Krishnan E 2026-07-01 1334 "fastrpc_invoke: TIMEOUT ctxid=0x%llx handle=0x%x nscalars=%d\n",
d79842457e9cbe Anandu Krishnan E 2026-07-01 1335 ctx->ctxid, handle, ctx->nscalars);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1336 }
55bcda35584c99 Jorge Ramirez-Ortiz 2019-10-09 1337 } else {
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1338 err = wait_for_completion_interruptible(&ctx->work);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1339 if (err == -ERESTARTSYS)
d79842457e9cbe Anandu Krishnan E 2026-07-01 @1340 dev_warn(fl->sctx->dev,
d79842457e9cbe Anandu Krishnan E 2026-07-01 1341 "fastrpc_invoke: INTERRUPTED ctxid=0x%llx handle=0x%x nscalars=%d\n",
d79842457e9cbe Anandu Krishnan E 2026-07-01 1342 ctx->ctxid, handle, ctx->nscalars);
55bcda35584c99 Jorge Ramirez-Ortiz 2019-10-09 1343 }
55bcda35584c99 Jorge Ramirez-Ortiz 2019-10-09 1344
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1345 if (err)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1346 goto bail;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1347
415a0729bd1225 Srinivas Kandagatla 2019-03-07 1348 /* make sure that all memory writes by DSP are seen by CPU */
415a0729bd1225 Srinivas Kandagatla 2019-03-07 1349 dma_rmb();
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1350 /* populate all the output buffers with results */
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1351 err = fastrpc_put_args(ctx, kernel);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1352 if (err)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1353 goto bail;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1354
1c8093591d1e37 Ekansh Gupta 2023-10-13 1355 /* Check the response from remote dsp */
1c8093591d1e37 Ekansh Gupta 2023-10-13 1356 err = ctx->retval;
1c8093591d1e37 Ekansh Gupta 2023-10-13 1357 if (err)
1c8093591d1e37 Ekansh Gupta 2023-10-13 1358 goto bail;
1c8093591d1e37 Ekansh Gupta 2023-10-13 1359
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1360 bail:
d79842457e9cbe Anandu Krishnan E 2026-07-01 1361 if (ctx && err == -ERESTARTSYS) {
d79842457e9cbe Anandu Krishnan E 2026-07-01 1362 fastrpc_context_save_interrupted(ctx);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1363 } else if (ctx) {
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1364 spin_lock(&fl->lock);
d79842457e9cbe Anandu Krishnan E 2026-07-01 1365 list_del_init(&ctx->node);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1366 spin_unlock(&fl->lock);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1367 fastrpc_context_put(ctx);
387f625585d1a5 Jorge Ramirez-Ortiz 2019-10-09 1368 }
0871561055e666 Abel Vesa 2022-11-25 1369
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1370 if (err)
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1371 dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err);
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1372
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1373 return err;
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1374 }
c68cfb718c8f97 Srinivas Kandagatla 2019-02-08 1375
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-07-03 2:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202607031058.69A6d6WW-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox