From: Julia Lawall <julia.lawall@inria.fr>
To: zhouyanjie@wanyeetech.com
Cc: kbuild-all@lists.01.org, linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Subject: [crypto:master 164/167] drivers/char/hw_random/ingenic-rng.c:118:1-6: WARNING: invalid free of devm_ allocated data (fwd)
Date: Mon, 3 Aug 2020 15:26:04 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2008031525120.35132@hadrien> (raw)
[-- Attachment #1: Type: text/plain, Size: 4933 bytes --]
Hello,
priv can't be kfreed because it was allocated with a devm function.
julia
---------- Forwarded message ----------
Date: Mon, 3 Aug 2020 21:16:25 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: lkp@intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [crypto:master 164/167] drivers/char/hw_random/ingenic-rng.c:118:1-6:
WARNING: invalid free of devm_ allocated data
CC: kbuild-all@lists.01.org
CC: linux-crypto@vger.kernel.org
TO: "周琰杰 (Zhou Yanjie)" <zhouyanjie@wanyeetech.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git master
head: 3cbfe80737c18ac6e635421ab676716a393d3074
commit: 190873a0ea4500433ae818521cad20d37f9ee059 [164/167] crypto: ingenic - Add hardware RNG for Ingenic JZ4780 and X1000
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: mips-randconfig-c003-20200803 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/char/hw_random/ingenic-rng.c:118:1-6: WARNING: invalid free of devm_ allocated data
# https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git/commit/?id=190873a0ea4500433ae818521cad20d37f9ee059
git remote add crypto https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
git remote update crypto
git checkout 190873a0ea4500433ae818521cad20d37f9ee059
vim +118 drivers/char/hw_random/ingenic-rng.c
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 82)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 83) static int ingenic_rng_probe(struct platform_device *pdev)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 84) {
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 85) struct ingenic_rng *priv;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 86) int ret;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 87)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 88) priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 89) if (!priv)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 90) return -ENOMEM;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 91)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 92) priv->base = devm_platform_ioremap_resource(pdev, 0);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 93) if (IS_ERR(priv->base)) {
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 94) pr_err("%s: Failed to map RNG registers\n", __func__);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 95) ret = PTR_ERR(priv->base);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 96) goto err_free_rng;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 97) }
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 98)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 99) priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 100)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 101) priv->rng.name = pdev->name;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 102) priv->rng.init = ingenic_rng_init;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 103) priv->rng.cleanup = ingenic_rng_cleanup;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 104) priv->rng.read = ingenic_rng_read;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 105)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 106) ret = hwrng_register(&priv->rng);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 107) if (ret) {
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 108) dev_err(&pdev->dev, "Failed to register hwrng\n");
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 109) goto err_free_rng;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 110) }
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 111)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 112) platform_set_drvdata(pdev, priv);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 113)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 114) dev_info(&pdev->dev, "Ingenic RNG driver registered\n");
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 115) return 0;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 116)
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 117) err_free_rng:
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 @118) kfree(priv);
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 119) return ret;
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 120) }
190873a0ea4500 周琰杰 (Zhou Yanjie 2020-07-23 121)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: Type: application/gzip, Size: 21556 bytes --]
next reply other threads:[~2020-08-03 13:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 13:26 Julia Lawall [this message]
2020-08-07 16:26 ` [crypto:master 164/167] drivers/char/hw_random/ingenic-rng.c:118:1-6: WARNING: invalid free of devm_ allocated data (fwd) Zhou Yanjie
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=alpine.DEB.2.22.394.2008031525120.35132@hadrien \
--to=julia.lawall@inria.fr \
--cc=herbert@gondor.apana.org.au \
--cc=kbuild-all@lists.01.org \
--cc=linux-crypto@vger.kernel.org \
--cc=prasannatsmkumar@gmail.com \
--cc=zhouyanjie@wanyeetech.com \
/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;
as well as URLs for NNTP newsgroup(s).