[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120923170330.GA5038@linux-3ix0.site>
Date: Sun, 23 Sep 2012 13:03:30 -0400
From: "Maxin B. John" <maxin.john@...il.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: Catherine Zhang <cxzhang@...son.ibm.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: scm: moving dereference after NULL check
scm_destroy_cred() dereferences 'scm' before null check
Signed-off-by: Maxin B. John <maxin.john@...il.com>
---
diff --git a/include/net/scm.h b/include/net/scm.h
index 7dc0854..ed25aa1 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -64,9 +64,11 @@ static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
static __inline__ void scm_destroy(struct scm_cookie *scm)
{
- scm_destroy_cred(scm);
- if (scm && scm->fp)
- __scm_destroy(scm);
+ if (scm) {
+ scm_destroy_cred(scm);
+ if (scm->fp)
+ __scm_destroy(scm);
+ }
}
static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists