* [PATCH 1/2] autofs - Fix sparse warning: context imbalance in autofs4_d_automount() different lock contexts for basic block
@ 2013-03-01 11:46 Ian Kent
2013-03-01 11:46 ` [PATCH 2/2] autofs4 - autofs4_catatonic_mode(): remove redundant null check on kfree() Ian Kent
0 siblings, 1 reply; 2+ messages in thread
From: Ian Kent @ 2013-03-01 11:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-fsdevel, autofs mailing list, Kernel Mailing List
From: Peter Huewe <peterhuewe@gmx.de>
Sparse complains:
+ fs/autofs4/root.c:409:9: sparse: context imbalance in
'autofs4_d_automount' - different lock contexts for basic block
This was introduced by commit
f55fb0c243 autofs4 - dont clear DCACHE_NEED_AUTOMOUNT on rootless mount
The function autofs4_d_automount can be left with the (&sbi->fs_lock)
held if sbi->version <= 4 and simple_empty(dentry) == false so the warning seems valid.
--> Add an spin_unlock in this case before we jump to done
Unfortunately compile tested only.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ian Kent <raven@themaw.net>
---
fs/autofs4/root.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 230bd2a..9bd1625 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -383,8 +383,10 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
goto done;
}
} else {
- if (!simple_empty(dentry))
+ if (!simple_empty(dentry)) {
+ spin_unlock(&sbi->fs_lock);
goto done;
+ }
}
ino->flags |= AUTOFS_INF_PENDING;
spin_unlock(&sbi->fs_lock);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] autofs4 - autofs4_catatonic_mode(): remove redundant null check on kfree()
2013-03-01 11:46 [PATCH 1/2] autofs - Fix sparse warning: context imbalance in autofs4_d_automount() different lock contexts for basic block Ian Kent
@ 2013-03-01 11:46 ` Ian Kent
0 siblings, 0 replies; 2+ messages in thread
From: Ian Kent @ 2013-03-01 11:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-fsdevel, autofs mailing list, Kernel Mailing List
From: Tim Gardner <tim.gardner@canonical.com>
smatch analysis:
fs/autofs4/waitq.c:46 autofs4_catatonic_mode() info: redundant null
check on wq->name.name calling kfree()
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: autofs@vger.kernel.org
---
fs/autofs4/waitq.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 03bc1d3..3db70da 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
while (wq) {
nwq = wq->next;
wq->status = -ENOENT; /* Magic is gone - report failure */
- if (wq->name.name) {
- kfree(wq->name.name);
- wq->name.name = NULL;
- }
+ kfree(wq->name.name);
+ wq->name.name = NULL;
wq->wait_ctr--;
wake_up_interruptible(&wq->queue);
wq = nwq;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-01 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-01 11:46 [PATCH 1/2] autofs - Fix sparse warning: context imbalance in autofs4_d_automount() different lock contexts for basic block Ian Kent
2013-03-01 11:46 ` [PATCH 2/2] autofs4 - autofs4_catatonic_mode(): remove redundant null check on kfree() Ian Kent
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).