public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] afs: potential null dereference
@ 2010-03-20 11:19 Dan Carpenter
  2010-03-22 12:05 ` David Howells
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2010-03-20 11:19 UTC (permalink / raw)
  To: David Howells; +Cc: linux-afs, linux-kernel, kernel-janitors

It seems clear from the surrounding code that xpermits is allowed to be 
NULL here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/afs/security.c b/fs/afs/security.c
index 3ef5043..bb4ed14 100644
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -189,8 +189,9 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order)
 	if (!permits)
 		goto out_unlock;
 
-	memcpy(permits->permits, xpermits->permits,
-	       count * sizeof(struct afs_permit));
+	if (xpermits)
+		memcpy(permits->permits, xpermits->permits,
+			count * sizeof(struct afs_permit));
 
 	_debug("key %x access %x",
 	       key_serial(key), vnode->status.caller_access);

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] AFS: Potential null dereference
@ 2010-03-22 13:07 David Howells
  0 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2010-03-22 13:07 UTC (permalink / raw)
  To: torvalds, akpm
  Cc: kernel-janitors, linux-afs, linux-kernel, Dan Carpenter,
	David Howells

From: Dan Carpenter <error27@gmail.com>

It seems clear from the surrounding code that xpermits is allowed to be NULL
here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/security.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/afs/security.c b/fs/afs/security.c
index 3ef5043..bb4ed14 100644
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -189,8 +189,9 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order)
 	if (!permits)
 		goto out_unlock;
 
-	memcpy(permits->permits, xpermits->permits,
-	       count * sizeof(struct afs_permit));
+	if (xpermits)
+		memcpy(permits->permits, xpermits->permits,
+			count * sizeof(struct afs_permit));
 
 	_debug("key %x access %x",
 	       key_serial(key), vnode->status.caller_access);


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

end of thread, other threads:[~2010-03-22 13:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-20 11:19 [patch] afs: potential null dereference Dan Carpenter
2010-03-22 12:05 ` David Howells
2010-03-22 12:56   ` Dan Carpenter
2010-03-22 13:05     ` David Howells
  -- strict thread matches above, loose matches on Subject: below --
2010-03-22 13:07 [PATCH] AFS: Potential " David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox