From: "Maxin B. John" <maxin.john@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Catherine Zhang <cxzhang@watson.ibm.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: scm: moving dereference after NULL check
Date: Sun, 23 Sep 2012 13:03:30 -0400 [thread overview]
Message-ID: <20120923170330.GA5038@linux-3ix0.site> (raw)
scm_destroy_cred() dereferences 'scm' before null check
Signed-off-by: Maxin B. John <maxin.john@gmail.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,
next reply other threads:[~2012-09-23 17:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-23 17:03 Maxin B. John [this message]
2012-09-24 19:51 ` [PATCH] net: scm: moving dereference after NULL check David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120923170330.GA5038@linux-3ix0.site \
--to=maxin.john@gmail.com \
--cc=cxzhang@watson.ibm.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.