Re: [RFC PATCH v4 11/14] selinux: Cache NetLabel secattrs in the socket's security struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Sep 2008, Paul Moore wrote:

>  /**
> + * selinux_netlbl_sock_genattr - Generate the NetLabel socket secattr
> + * @sk: the socket
> + * @sid: the socket's SID
> + *
> + * Description:
> + * Generate the NetLabel security attributes for a socket, making full use of
> + * the socket's attribute cache.  Returns a pointer to the security attributes
> + * on success, negative values on failure.

Don't you mean NULL on failure?

> + *
> + */
> +static struct netlbl_lsm_secattr *selinux_netlbl_sock_genattr(struct sock *sk,
> +							      u32 sid)
> +{
> +	int rc;
> +	struct sk_security_struct *sksec = sk->sk_security;
> +	struct netlbl_lsm_secattr *secattr;
> +
> +	if (sksec->nlbl_secattr != NULL)
> +		return sksec->nlbl_secattr;
> +
> +	secattr = netlbl_secattr_alloc(GFP_ATOMIC);
> +	if (secattr == NULL)
> +		return NULL;
> +	rc = security_netlbl_sid_to_secattr(sid, secattr);
> +	if (rc != 0) {
> +		netlbl_secattr_free(secattr);
> +		return NULL;
> +	}
> +	sksec->nlbl_secattr = secattr;
> +
> +	return secattr;
> +}
> +

Acked-by: James Morris <jmorris@xxxxxxxxx>


-- 
James Morris
<jmorris@xxxxxxxxx>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux