Skip to content

Commit 1bc8c83

Browse files
committed
Merge tag 'lsm-pr-20250527' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Pull lsm update from Paul Moore: "One minor LSM framework patch to move the selinux_netlink_send() hook under the CONFIG_SECURITY_NETWORK Kconfig knob" * tag 'lsm-pr-20250527' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm: lsm: Move security_netlink_send to under CONFIG_SECURITY_NETWORK
2 parents 7af6e3f + 74e5b13 commit 1bc8c83

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

include/linux/security.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ int security_setselfattr(unsigned int attr, struct lsm_ctx __user *ctx,
563563
int security_getprocattr(struct task_struct *p, int lsmid, const char *name,
564564
char **value);
565565
int security_setprocattr(int lsmid, const char *name, void *value, size_t size);
566-
int security_netlink_send(struct sock *sk, struct sk_buff *skb);
567566
int security_ismaclabel(const char *name);
568567
int security_secid_to_secctx(u32 secid, struct lsm_context *cp);
569568
int security_lsmprop_to_secctx(struct lsm_prop *prop, struct lsm_context *cp);
@@ -1527,11 +1526,6 @@ static inline int security_setprocattr(int lsmid, char *name, void *value,
15271526
return -EINVAL;
15281527
}
15291528

1530-
static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
1531-
{
1532-
return 0;
1533-
}
1534-
15351529
static inline int security_ismaclabel(const char *name)
15361530
{
15371531
return 0;
@@ -1629,6 +1623,7 @@ static inline int security_watch_key(struct key *key)
16291623

16301624
#ifdef CONFIG_SECURITY_NETWORK
16311625

1626+
int security_netlink_send(struct sock *sk, struct sk_buff *skb);
16321627
int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
16331628
int security_unix_may_send(struct socket *sock, struct socket *other);
16341629
int security_socket_create(int family, int type, int protocol, int kern);
@@ -1684,6 +1679,11 @@ int security_sctp_assoc_established(struct sctp_association *asoc,
16841679
int security_mptcp_add_subflow(struct sock *sk, struct sock *ssk);
16851680

16861681
#else /* CONFIG_SECURITY_NETWORK */
1682+
static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
1683+
{
1684+
return 0;
1685+
}
1686+
16871687
static inline int security_unix_stream_connect(struct sock *sock,
16881688
struct sock *other,
16891689
struct sock *newsk)

security/security.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4276,24 +4276,6 @@ int security_setprocattr(int lsmid, const char *name, void *value, size_t size)
42764276
return LSM_RET_DEFAULT(setprocattr);
42774277
}
42784278

4279-
/**
4280-
* security_netlink_send() - Save info and check if netlink sending is allowed
4281-
* @sk: sending socket
4282-
* @skb: netlink message
4283-
*
4284-
* Save security information for a netlink message so that permission checking
4285-
* can be performed when the message is processed. The security information
4286-
* can be saved using the eff_cap field of the netlink_skb_parms structure.
4287-
* Also may be used to provide fine grained control over message transmission.
4288-
*
4289-
* Return: Returns 0 if the information was successfully saved and message is
4290-
* allowed to be transmitted.
4291-
*/
4292-
int security_netlink_send(struct sock *sk, struct sk_buff *skb)
4293-
{
4294-
return call_int_hook(netlink_send, sk, skb);
4295-
}
4296-
42974279
/**
42984280
* security_ismaclabel() - Check if the named attribute is a MAC label
42994281
* @name: full extended attribute name
@@ -4483,6 +4465,24 @@ int security_watch_key(struct key *key)
44834465
#endif /* CONFIG_KEY_NOTIFICATIONS */
44844466

44854467
#ifdef CONFIG_SECURITY_NETWORK
4468+
/**
4469+
* security_netlink_send() - Save info and check if netlink sending is allowed
4470+
* @sk: sending socket
4471+
* @skb: netlink message
4472+
*
4473+
* Save security information for a netlink message so that permission checking
4474+
* can be performed when the message is processed. The security information
4475+
* can be saved using the eff_cap field of the netlink_skb_parms structure.
4476+
* Also may be used to provide fine grained control over message transmission.
4477+
*
4478+
* Return: Returns 0 if the information was successfully saved and message is
4479+
* allowed to be transmitted.
4480+
*/
4481+
int security_netlink_send(struct sock *sk, struct sk_buff *skb)
4482+
{
4483+
return call_int_hook(netlink_send, sk, skb);
4484+
}
4485+
44864486
/**
44874487
* security_unix_stream_connect() - Check if a AF_UNIX stream is allowed
44884488
* @sock: originating sock

0 commit comments

Comments
 (0)