All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
@ 2016-08-22 16:57 ` James Simmons
  0 siblings, 0 replies; 4+ messages in thread
From: James Simmons @ 2016-08-22 16:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

The function mdc_adjust_dirpages is only called on platforms which
don't have pages 4K in size which is why kbuild only reported this
for platforms like the Alpha. The problem was a typo in ordering of
variables in the beginning of a while loop. We were accessing the
dp pointer before it was kmapped.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 88848d8..7a182be 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1133,9 +1133,9 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs)
 	int i;
 
 	for (i = 0; i < cfs_pgs; i++) {
+		struct lu_dirpage *dp = kmap(pages[i]);
 		__u64 hash_end = le64_to_cpu(dp->ldp_hash_end);
 		__u32 flags = le32_to_cpu(dp->ldp_flags);
-		struct lu_dirpage *dp = kmap(pages[i]);
 		struct lu_dirpage *first = dp;
 		struct lu_dirent *end_dirent = NULL;
 		struct lu_dirent *ent;
-- 
1.7.1

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

* [lustre-devel] [PATCH] staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
@ 2016-08-22 16:57 ` James Simmons
  0 siblings, 0 replies; 4+ messages in thread
From: James Simmons @ 2016-08-22 16:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

The function mdc_adjust_dirpages is only called on platforms which
don't have pages 4K in size which is why kbuild only reported this
for platforms like the Alpha. The problem was a typo in ordering of
variables in the beginning of a while loop. We were accessing the
dp pointer before it was kmapped.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 88848d8..7a182be 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1133,9 +1133,9 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs)
 	int i;
 
 	for (i = 0; i < cfs_pgs; i++) {
+		struct lu_dirpage *dp = kmap(pages[i]);
 		__u64 hash_end = le64_to_cpu(dp->ldp_hash_end);
 		__u32 flags = le32_to_cpu(dp->ldp_flags);
-		struct lu_dirpage *dp = kmap(pages[i]);
 		struct lu_dirpage *first = dp;
 		struct lu_dirent *end_dirent = NULL;
 		struct lu_dirent *ent;
-- 
1.7.1

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

* Re: [lustre-devel] [PATCH] staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
  2016-08-22 16:57 ` [lustre-devel] " James Simmons
@ 2016-08-22 17:04   ` Dilger, Andreas
  -1 siblings, 0 replies; 4+ messages in thread
From: Dilger, Andreas @ 2016-08-22 17:04 UTC (permalink / raw)
  To: James Simmons
  Cc: Greg Kroah-Hartman, devel, Drokin, Oleg,
	Linux Kernel Mailing List, Lustre Development List

On Aug 22, 2016, at 10:57, James Simmons <jsimmons@infradead.org> wrote:
> 
> The function mdc_adjust_dirpages is only called on platforms which
> don't have pages 4K in size which is why kbuild only reported this
> for platforms like the Alpha. The problem was a typo in ordering of
> variables in the beginning of a while loop. We were accessing the
> dp pointer before it was kmapped.
> 
> Signed-off-by: James Simmons <jsimmons@infradead.org>

Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>

> ---
> drivers/staging/lustre/lustre/mdc/mdc_request.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
> index 88848d8..7a182be 100644
> --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
> +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
> @@ -1133,9 +1133,9 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs)
> 	int i;
> 
> 	for (i = 0; i < cfs_pgs; i++) {
> +		struct lu_dirpage *dp = kmap(pages[i]);
> 		__u64 hash_end = le64_to_cpu(dp->ldp_hash_end);
> 		__u32 flags = le32_to_cpu(dp->ldp_flags);
> -		struct lu_dirpage *dp = kmap(pages[i]);
> 		struct lu_dirpage *first = dp;
> 		struct lu_dirent *end_dirent = NULL;
> 		struct lu_dirent *ent;
> -- 
> 1.7.1
> 
> _______________________________________________
> lustre-devel mailing list
> lustre-devel@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

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

* [lustre-devel] [PATCH] staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
@ 2016-08-22 17:04   ` Dilger, Andreas
  0 siblings, 0 replies; 4+ messages in thread
From: Dilger, Andreas @ 2016-08-22 17:04 UTC (permalink / raw)
  To: James Simmons
  Cc: Greg Kroah-Hartman, devel, Drokin, Oleg,
	Linux Kernel Mailing List, Lustre Development List

On Aug 22, 2016, at 10:57, James Simmons <jsimmons@infradead.org> wrote:
> 
> The function mdc_adjust_dirpages is only called on platforms which
> don't have pages 4K in size which is why kbuild only reported this
> for platforms like the Alpha. The problem was a typo in ordering of
> variables in the beginning of a while loop. We were accessing the
> dp pointer before it was kmapped.
> 
> Signed-off-by: James Simmons <jsimmons@infradead.org>

Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>

> ---
> drivers/staging/lustre/lustre/mdc/mdc_request.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
> index 88848d8..7a182be 100644
> --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
> +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
> @@ -1133,9 +1133,9 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs)
> 	int i;
> 
> 	for (i = 0; i < cfs_pgs; i++) {
> +		struct lu_dirpage *dp = kmap(pages[i]);
> 		__u64 hash_end = le64_to_cpu(dp->ldp_hash_end);
> 		__u32 flags = le32_to_cpu(dp->ldp_flags);
> -		struct lu_dirpage *dp = kmap(pages[i]);
> 		struct lu_dirpage *first = dp;
> 		struct lu_dirent *end_dirent = NULL;
> 		struct lu_dirent *ent;
> -- 
> 1.7.1
> 
> _______________________________________________
> lustre-devel mailing list
> lustre-devel at lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

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

end of thread, other threads:[~2016-08-22 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 16:57 [PATCH] staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages James Simmons
2016-08-22 16:57 ` [lustre-devel] " James Simmons
2016-08-22 17:04 ` Dilger, Andreas
2016-08-22 17:04   ` Dilger, Andreas

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.