All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] xfrm: policy: Fix doulbe free in xfrm_policy_timer
Date: Fri, 20 Mar 2020 15:37:39 +0300	[thread overview]
Message-ID: <20200320123739.GE4650@kadam> (raw)
In-Reply-To: <20200318034839.57996-1-yuehaibing@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 2228 bytes --]

Hi YueHaibing,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/YueHaibing/xfrm-policy-Fix-doulbe-free-in-xfrm_policy_timer/20200318-130228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/xfrm/xfrm_policy.c:449 xfrm_policy_kill() error: double locked 'policy->lock' (orig line 437)

# https://github.com/0day-ci/linux/commit/c5e76419bf56de53360e5d79e2708fd0eed0cf38
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout c5e76419bf56de53360e5d79e2708fd0eed0cf38
vim +449 net/xfrm/xfrm_policy.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  435  static void xfrm_policy_kill(struct xfrm_policy *policy)
^1da177e4c3f41 Linus Torvalds     2005-04-16  436  {
c5e76419bf56de YueHaibing         2020-03-18 @437  	write_lock_bh(&policy->lock);
12a169e7d8f4b1 Herbert Xu         2008-10-01  438  	policy->walk.dead = 1;
^1da177e4c3f41 Linus Torvalds     2005-04-16  439  
285ead175c5dd5 Timo Teräs         2010-04-07  440  	atomic_inc(&policy->genid);
^1da177e4c3f41 Linus Torvalds     2005-04-16  441  
e7d8f6cb2f8735 Steffen Klassert   2013-10-08  442  	if (del_timer(&policy->polq.hold_timer))
e7d8f6cb2f8735 Steffen Klassert   2013-10-08  443  		xfrm_pol_put(policy);
1ee5e6676bccbf Li RongQing        2015-04-22  444  	skb_queue_purge(&policy->polq.hold_queue);
a0073fe18e718a Steffen Klassert   2013-02-05  445  
285ead175c5dd5 Timo Teräs         2010-04-07  446  	if (del_timer(&policy->timer))
285ead175c5dd5 Timo Teräs         2010-04-07  447  		xfrm_pol_put(policy);
285ead175c5dd5 Timo Teräs         2010-04-07  448  
c5e76419bf56de YueHaibing         2020-03-18 @449  	write_lock_bh(&policy->lock);

s/lock/unlock/

285ead175c5dd5 Timo Teräs         2010-04-07  450  	xfrm_pol_put(policy);
^1da177e4c3f41 Linus Torvalds     2005-04-16  451  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] xfrm: policy: Fix doulbe free in xfrm_policy_timer
Date: Fri, 20 Mar 2020 15:37:39 +0300	[thread overview]
Message-ID: <20200320123739.GE4650@kadam> (raw)
In-Reply-To: <20200318034839.57996-1-yuehaibing@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 2228 bytes --]

Hi YueHaibing,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/YueHaibing/xfrm-policy-Fix-doulbe-free-in-xfrm_policy_timer/20200318-130228
base:   https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/xfrm/xfrm_policy.c:449 xfrm_policy_kill() error: double locked 'policy->lock' (orig line 437)

# https://github.com/0day-ci/linux/commit/c5e76419bf56de53360e5d79e2708fd0eed0cf38
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout c5e76419bf56de53360e5d79e2708fd0eed0cf38
vim +449 net/xfrm/xfrm_policy.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  435  static void xfrm_policy_kill(struct xfrm_policy *policy)
^1da177e4c3f41 Linus Torvalds     2005-04-16  436  {
c5e76419bf56de YueHaibing         2020-03-18 @437  	write_lock_bh(&policy->lock);
12a169e7d8f4b1 Herbert Xu         2008-10-01  438  	policy->walk.dead = 1;
^1da177e4c3f41 Linus Torvalds     2005-04-16  439  
285ead175c5dd5 Timo Teräs         2010-04-07  440  	atomic_inc(&policy->genid);
^1da177e4c3f41 Linus Torvalds     2005-04-16  441  
e7d8f6cb2f8735 Steffen Klassert   2013-10-08  442  	if (del_timer(&policy->polq.hold_timer))
e7d8f6cb2f8735 Steffen Klassert   2013-10-08  443  		xfrm_pol_put(policy);
1ee5e6676bccbf Li RongQing        2015-04-22  444  	skb_queue_purge(&policy->polq.hold_queue);
a0073fe18e718a Steffen Klassert   2013-02-05  445  
285ead175c5dd5 Timo Teräs         2010-04-07  446  	if (del_timer(&policy->timer))
285ead175c5dd5 Timo Teräs         2010-04-07  447  		xfrm_pol_put(policy);
285ead175c5dd5 Timo Teräs         2010-04-07  448  
c5e76419bf56de YueHaibing         2020-03-18 @449  	write_lock_bh(&policy->lock);

s/lock/unlock/

285ead175c5dd5 Timo Teräs         2010-04-07  450  	xfrm_pol_put(policy);
^1da177e4c3f41 Linus Torvalds     2005-04-16  451  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

  reply	other threads:[~2020-03-20 12:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18  3:48 [PATCH] xfrm: policy: Fix doulbe free in xfrm_policy_timer YueHaibing
2020-03-20 12:37 ` Dan Carpenter [this message]
2020-03-20 12:37   ` Dan Carpenter
2020-03-23  1:41 ` [PATCH v2] " YueHaibing
2020-03-23  6:29   ` Herbert Xu
2020-03-23  7:04     ` Yuehaibing
2020-03-23  6:53   ` Timo Teras
2020-03-23  7:21     ` Yuehaibing
2020-03-23  7:56       ` Timo Teras
2020-03-23  7:32 ` [PATCH v3] " YueHaibing
2020-03-23  8:00   ` Timo Teras
2020-03-23 21:44   ` Herbert Xu
2020-03-25 12:53   ` Steffen Klassert

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=20200320123739.GE4650@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.