lkml.org 
[lkml]   [2013]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH linux-next] autofs4: autofs4_catatonic_mode(): remove redundant null check on kfree()
From
Date
On Tue, 2013-02-12 at 10:12 -0700, Tim Gardner wrote:
> smatch analysis:
>
> fs/autofs4/waitq.c:46 autofs4_catatonic_mode() info: redundant null
> check on wq->name.name calling kfree()

I'm not sure about this change.

autofs4_catatonic_mode() could be called when there are remaining
entries in the wait queue, which is nulled, so autofs4_wait_release()
won't see the the discarded waits if it is called.

>
> Cc: Ian Kent <raven@themaw.net>
> Cc: autofs@vger.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
> 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;




\
 
 \ /
  Last update: 2013-02-13 09:01    [W:0.045 / U:1.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site