All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: fix potential use-after-free in cifs_oplock_break_put
@ 2010-11-10 15:19 Jeff Layton
       [not found] ` <1289402350-14218-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2010-11-10 15:19 UTC (permalink / raw)
  To: smfrench-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

cfile may very well be freed after the cifsFileInfo_put. Make sure we
have a valid pointer to the superblock for cifs_sb_deactive.

Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 06c3e83..b857ce5 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2271,8 +2271,10 @@ void cifs_oplock_break_get(struct cifsFileInfo *cfile)
 
 void cifs_oplock_break_put(struct cifsFileInfo *cfile)
 {
+	struct super_block *sb = cfile->dentry->d_sb;
+
 	cifsFileInfo_put(cfile);
-	cifs_sb_deactive(cfile->dentry->d_sb);
+	cifs_sb_deactive(sb);
 }
 
 const struct address_space_operations cifs_addr_ops = {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: fix potential use-after-free in cifs_oplock_break_put
       [not found] ` <1289402350-14218-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-11-11  8:38   ` Suresh Jayaraman
  0 siblings, 0 replies; 2+ messages in thread
From: Suresh Jayaraman @ 2010-11-11  8:38 UTC (permalink / raw)
  To: Jeff Layton
  Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA

On 11/10/2010 08:49 PM, Jeff Layton wrote:
> cfile may very well be freed after the cifsFileInfo_put. Make sure we
> have a valid pointer to the superblock for cifs_sb_deactive.
> 
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/file.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 06c3e83..b857ce5 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2271,8 +2271,10 @@ void cifs_oplock_break_get(struct cifsFileInfo *cfile)
>  
>  void cifs_oplock_break_put(struct cifsFileInfo *cfile)
>  {
> +	struct super_block *sb = cfile->dentry->d_sb;
> +
>  	cifsFileInfo_put(cfile);
> -	cifs_sb_deactive(cfile->dentry->d_sb);
> +	cifs_sb_deactive(sb);
>  }
>  

Looks correct to me.

Reviewed-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-11  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-10 15:19 [PATCH] cifs: fix potential use-after-free in cifs_oplock_break_put Jeff Layton
     [not found] ` <1289402350-14218-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-11-11  8:38   ` Suresh Jayaraman

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.