Skip to content

Commit cd63204

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull SELinux fixes from James Morris. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: SELinux: Fix kernel BUG on empty security contexts. selinux: add SOCK_DIAG_BY_FAMILY to the list of netlink message types
2 parents f94aa7c + f743166 commit cd63204

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

security/selinux/nlmsgtab.c

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/inet_diag.h>
1818
#include <linux/xfrm.h>
1919
#include <linux/audit.h>
20+
#include <linux/sock_diag.h>
2021

2122
#include "flask.h"
2223
#include "av_permissions.h"
@@ -78,6 +79,7 @@ static struct nlmsg_perm nlmsg_tcpdiag_perms[] =
7879
{
7980
{ TCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ },
8081
{ DCCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ },
82+
{ SOCK_DIAG_BY_FAMILY, NETLINK_TCPDIAG_SOCKET__NLMSG_READ },
8183
};
8284

8385
static struct nlmsg_perm nlmsg_xfrm_perms[] =

security/selinux/ss/services.c

+4
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,10 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
12321232
struct context context;
12331233
int rc = 0;
12341234

1235+
/* An empty security context is never valid. */
1236+
if (!scontext_len)
1237+
return -EINVAL;
1238+
12351239
if (!ss_initialized) {
12361240
int i;
12371241

0 commit comments

Comments
 (0)