diff mbox series

ceph: fix NULL pointer deref when debugging is enabled

Message ID 20190423183213.16003-1-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series ceph: fix NULL pointer deref when debugging is enabled | expand

Commit Message

Jeff Layton April 23, 2019, 6:32 p.m. UTC
snapc can be NULL here.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yan, Zheng April 25, 2019, 1:40 a.m. UTC | #1
On 4/24/19 2:32 AM, Jeff Layton wrote:
> snapc can be NULL here.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/ceph/file.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 0e505a5e09fe..ccc054794542 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -928,7 +928,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
>   
>   	dout("sync_direct_%s on file %p %lld~%u snapc %p seq %lld\n",
>   	     (write ? "write" : "read"), file, pos, (unsigned)count,
> -	     snapc, snapc->seq);
> +	     snapc, snapc ? snapc->seq : 0);
>   
>   	ret = filemap_write_and_wait_range(inode->i_mapping,
>   					   pos, pos + count - 1);
> 

Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
diff mbox series

Patch

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 0e505a5e09fe..ccc054794542 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -928,7 +928,7 @@  ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 
 	dout("sync_direct_%s on file %p %lld~%u snapc %p seq %lld\n",
 	     (write ? "write" : "read"), file, pos, (unsigned)count,
-	     snapc, snapc->seq);
+	     snapc, snapc ? snapc->seq : 0);
 
 	ret = filemap_write_and_wait_range(inode->i_mapping,
 					   pos, pos + count - 1);