Re: [patch] NFS: using freed variable in debug code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oops, good catch!

Actually, we can leave the kfree() where it is.  Using ds->ds_remotestr in the dprintk is a typo - It should be tmp_ds->ds_remotestr.

-dros

On Jun 8, 2011, at 2:43 AM, Dan Carpenter wrote:

> "ds" gets dereferenced after a kfree in the debug output.  I just
> moved the free down a line.
> 
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> 
> diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
> index 77c171e..c63bbce 100644
> --- a/fs/nfs/nfs4filelayoutdev.c
> +++ b/fs/nfs/nfs4filelayoutdev.c
> @@ -362,11 +362,11 @@ nfs4_pnfs_ds_add(struct list_head *dsaddrs, gfp_t gfp_flags)
> 				__func__, tmp_ds->ds_remotestr, remotestr);
> 		}
> 		kfree(remotestr);
> -		kfree(ds);
> 		atomic_inc(&tmp_ds->ds_count);
> 		dprintk("%s data server %s found, inc'ed ds_count to %d\n",
> 			__func__, ds->ds_remotestr,
> 			atomic_read(&tmp_ds->ds_count));
> +		kfree(ds);
> 		ds = tmp_ds;
> 	}
> 	spin_unlock(&nfs4_ds_cache_lock);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux