netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scm: Only support SCM_RIGHTS on unix domain sockets.
@ 2010-02-28 11:20 Eric W. Biederman
  2010-03-01  2:49 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric W. Biederman @ 2010-02-28 11:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev


We use scm_send and scm_recv on both unix domain and
netlink sockets, but only unix domain sockets support
everything required for file descriptor passing,
so error if someone attempts to pass file descriptors
over netlink sockets.

Cc: stable@kernel.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 net/core/scm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/core/scm.c b/net/core/scm.c
index b7ba91b..9b26463 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -156,6 +156,8 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
 		switch (cmsg->cmsg_type)
 		{
 		case SCM_RIGHTS:
+			if (!sock->ops || sock->ops->family != PF_UNIX)
+				goto error;
 			err=scm_fp_copy(cmsg, &p->fp);
 			if (err<0)
 				goto error;
-- 
1.6.5.2.143.g8cc62


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

* Re: [PATCH] scm: Only support SCM_RIGHTS on unix domain sockets.
  2010-02-28 11:20 [PATCH] scm: Only support SCM_RIGHTS on unix domain sockets Eric W. Biederman
@ 2010-03-01  2:49 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-03-01  2:49 UTC (permalink / raw)
  To: ebiederm; +Cc: netdev

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Sun, 28 Feb 2010 03:20:36 -0800

> We use scm_send and scm_recv on both unix domain and
> netlink sockets, but only unix domain sockets support
> everything required for file descriptor passing,
> so error if someone attempts to pass file descriptors
> over netlink sockets.
> 
> Cc: stable@kernel.org
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Applied, thanks for fixing this Eric.

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

end of thread, other threads:[~2010-03-01  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-28 11:20 [PATCH] scm: Only support SCM_RIGHTS on unix domain sockets Eric W. Biederman
2010-03-01  2:49 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).