Linux Security Modules development
 help / color / mirror / Atom feed
* [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
@ 2025-08-06 21:25 Paul Moore
  2025-08-06 21:35 ` Casey Schaufler
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Moore @ 2025-08-06 21:25 UTC (permalink / raw)
  To: linux-security-module

Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
like all of the other LSM security blob allocators.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 security/security.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/security/security.c b/security/security.c
index ad163f06bf7a..a88ebfca3224 100644
--- a/security/security.c
+++ b/security/security.c
@@ -823,16 +823,8 @@ static int lsm_msg_msg_alloc(struct msg_msg *mp)
  */
 static int lsm_bdev_alloc(struct block_device *bdev)
 {
-	if (blob_sizes.lbs_bdev == 0) {
-		bdev->bd_security = NULL;
-		return 0;
-	}
-
-	bdev->bd_security = kzalloc(blob_sizes.lbs_bdev, GFP_KERNEL);
-	if (!bdev->bd_security)
-		return -ENOMEM;
-
-	return 0;
+	return lsm_blob_alloc(&bdev->bd_security, blob_sizes.lbs_bdev,
+			      GFP_KERNEL);
 }
 
 /**
-- 
2.50.1


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

* Re: [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
  2025-08-06 21:25 [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc() Paul Moore
@ 2025-08-06 21:35 ` Casey Schaufler
  2025-08-07  1:13 ` Serge E. Hallyn
  2025-08-07  1:49 ` Paul Moore
  2 siblings, 0 replies; 5+ messages in thread
From: Casey Schaufler @ 2025-08-06 21:35 UTC (permalink / raw)
  To: Paul Moore, linux-security-module

On 8/6/2025 2:25 PM, Paul Moore wrote:
> Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
> like all of the other LSM security blob allocators.
>
> Signed-off-by: Paul Moore <paul@paul-moore.com>

Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>

> ---
>  security/security.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/security/security.c b/security/security.c
> index ad163f06bf7a..a88ebfca3224 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -823,16 +823,8 @@ static int lsm_msg_msg_alloc(struct msg_msg *mp)
>   */
>  static int lsm_bdev_alloc(struct block_device *bdev)
>  {
> -	if (blob_sizes.lbs_bdev == 0) {
> -		bdev->bd_security = NULL;
> -		return 0;
> -	}
> -
> -	bdev->bd_security = kzalloc(blob_sizes.lbs_bdev, GFP_KERNEL);
> -	if (!bdev->bd_security)
> -		return -ENOMEM;
> -
> -	return 0;
> +	return lsm_blob_alloc(&bdev->bd_security, blob_sizes.lbs_bdev,
> +			      GFP_KERNEL);
>  }
>  
>  /**

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

* Re: [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
  2025-08-06 21:25 [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc() Paul Moore
  2025-08-06 21:35 ` Casey Schaufler
@ 2025-08-07  1:13 ` Serge E. Hallyn
  2025-08-07  1:49 ` Paul Moore
  2 siblings, 0 replies; 5+ messages in thread
From: Serge E. Hallyn @ 2025-08-07  1:13 UTC (permalink / raw)
  To: Paul Moore; +Cc: linux-security-module

On Wed, Aug 06, 2025 at 05:25:53PM -0400, Paul Moore wrote:
> Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
> like all of the other LSM security blob allocators.
> 
> Signed-off-by: Paul Moore <paul@paul-moore.com>

Acked-by: Serge Hallyn <serge@hallyn.com>

> ---
>  security/security.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/security/security.c b/security/security.c
> index ad163f06bf7a..a88ebfca3224 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -823,16 +823,8 @@ static int lsm_msg_msg_alloc(struct msg_msg *mp)
>   */
>  static int lsm_bdev_alloc(struct block_device *bdev)
>  {
> -	if (blob_sizes.lbs_bdev == 0) {
> -		bdev->bd_security = NULL;
> -		return 0;
> -	}
> -
> -	bdev->bd_security = kzalloc(blob_sizes.lbs_bdev, GFP_KERNEL);
> -	if (!bdev->bd_security)
> -		return -ENOMEM;
> -
> -	return 0;
> +	return lsm_blob_alloc(&bdev->bd_security, blob_sizes.lbs_bdev,
> +			      GFP_KERNEL);
>  }
>  
>  /**
> -- 
> 2.50.1
> 

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

* Re: [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
  2025-08-06 21:25 [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc() Paul Moore
  2025-08-06 21:35 ` Casey Schaufler
  2025-08-07  1:13 ` Serge E. Hallyn
@ 2025-08-07  1:49 ` Paul Moore
  2025-08-11 22:16   ` Paul Moore
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Moore @ 2025-08-07  1:49 UTC (permalink / raw)
  To: linux-security-module

On Wed, Aug 6, 2025 at 5:26 PM Paul Moore <paul@paul-moore.com> wrote:
>
> Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
> like all of the other LSM security blob allocators.
>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
> ---
>  security/security.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)

Normally I might let this sit a bit longer on the mailing list, but
considering how trivial this is along with a Reviewed-by and an ACK
I'm going to go ahead and merge this into lsm/dev-staging for testing
and lsm/dev once the merge window closes.

-- 
paul-moore.com

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

* Re: [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
  2025-08-07  1:49 ` Paul Moore
@ 2025-08-11 22:16   ` Paul Moore
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Moore @ 2025-08-11 22:16 UTC (permalink / raw)
  To: linux-security-module

On Wed, Aug 6, 2025 at 9:49 PM Paul Moore <paul@paul-moore.com> wrote:
> On Wed, Aug 6, 2025 at 5:26 PM Paul Moore <paul@paul-moore.com> wrote:
> >
> > Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
> > like all of the other LSM security blob allocators.
> >
> > Signed-off-by: Paul Moore <paul@paul-moore.com>
> > ---
> >  security/security.c | 12 ++----------
> >  1 file changed, 2 insertions(+), 10 deletions(-)
>
> Normally I might let this sit a bit longer on the mailing list, but
> considering how trivial this is along with a Reviewed-by and an ACK
> I'm going to go ahead and merge this into lsm/dev-staging for testing
> and lsm/dev once the merge window closes.

This is now in lsm/dev, thanks all.

-- 
paul-moore.com

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

end of thread, other threads:[~2025-08-11 22:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 21:25 [PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc() Paul Moore
2025-08-06 21:35 ` Casey Schaufler
2025-08-07  1:13 ` Serge E. Hallyn
2025-08-07  1:49 ` Paul Moore
2025-08-11 22:16   ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox