sgi-xpc: Remove NULL pointer dereference.
authorRobin Holt <holt@sgi.com>
Thu, 29 Jan 2009 22:25:07 +0000 (14:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Jan 2009 02:04:43 +0000 (18:04 -0800)
If the bte copy fails, the attempt to retrieve payloads merely returns a
null pointer deref and not NULL as was expected.

Signed-off-by: Robin Holt <holt@sgi.com>
Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/misc/sgi-xp/xpc_sn2.c

index 7aafb8a91945fcc5d45a14e0c92a102d826c5715..7d05fb5f4fee5748a9016c8567fa26211d3090fd 100644 (file)
@@ -1957,11 +1957,13 @@ xpc_get_deliverable_payload_sn2(struct xpc_channel *ch)
 
                        msg = xpc_pull_remote_msg_sn2(ch, get);
 
-                       DBUG_ON(msg != NULL && msg->number != get);
-                       DBUG_ON(msg != NULL && (msg->flags & XPC_M_SN2_DONE));
-                       DBUG_ON(msg != NULL && !(msg->flags & XPC_M_SN2_READY));
+                       if (msg != NULL) {
+                               DBUG_ON(msg->number != get);
+                               DBUG_ON(msg->flags & XPC_M_SN2_DONE);
+                               DBUG_ON(!(msg->flags & XPC_M_SN2_READY));
 
-                       payload = &msg->payload;
+                               payload = &msg->payload;
+                       }
                        break;
                }