Skip to contentSkip to conversation

scm: Only support SCM_RIGHTS on unix domain sockets.

PATCH Applied Eric W. Biederman 2 participants 2 messages Feb 28, 2010 – Mar 1, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scm: Only support SCM_RIGHTS on unix domain sockets.

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.

---
 net/core/scm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/core/scm.c +2 -0
index b7ba91b..9b26463 100644
@@ -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;
Signature · 1 line
1.6.5.2.143.g8cc62
maintainer Applied
#1 lore raw

From: [email protected] (Eric W. Biederman)
Date: Sun, 28 Feb 2010 03:20:36 -0800

Quoted 8 lines

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.

Applied, thanks for fixing this Eric.