diff mbox series

[1/2] KEYS: trusted: fix DCP blob payload length assignment

Message ID 20240703125353.46115-1-david@sigma-star.at (mailing list archive)
State New
Headers show
Series [1/2] KEYS: trusted: fix DCP blob payload length assignment | expand

Commit Message

David Gstir July 3, 2024, 12:53 p.m. UTC
The DCP trusted key type uses the wrong helper function to store
the blob's payload length which can lead to the wrong byte order
being used in case this would ever run on big endian architectures.

Fix by using correct helper function.

Signed-off-by: David Gstir <david@sigma-star.at>
Suggested-by: Richard Weinberger <richard@nod.at>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
---
 security/keys/trusted-keys/trusted_dcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Sakkinen July 17, 2024, 10:07 a.m. UTC | #1
On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
> The DCP trusted key type uses the wrong helper function to store
> the blob's payload length which can lead to the wrong byte order
> being used in case this would ever run on big endian architectures.
>
> Fix by using correct helper function.
>
> Signed-off-by: David Gstir <david@sigma-star.at>
> Suggested-by: Richard Weinberger <richard@nod.at>

You cannot suggest a change that you author yourself.

> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
> Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")

Tags are in wrong order. For next round:

Cc: stable@vger.kernel.org # v6.10+
Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>


BR, Jarkko
Richard Weinberger July 17, 2024, 10:19 a.m. UTC | #2
Am Mittwoch, 17. Juli 2024, 12:07:58 CEST schrieb Jarkko Sakkinen:
> On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
> > The DCP trusted key type uses the wrong helper function to store
> > the blob's payload length which can lead to the wrong byte order
> > being used in case this would ever run on big endian architectures.
> >
> > Fix by using correct helper function.
> >
> > Signed-off-by: David Gstir <david@sigma-star.at>
> > Suggested-by: Richard Weinberger <richard@nod.at>
> 
> You cannot suggest a change that you author yourself.

Well, I suggested the change, not David.
So, I think you're implying that David's s-o-b cannot be before
the Suggested-by tag but after?
 
Thanks,
//richard
David Gstir July 17, 2024, 11:03 a.m. UTC | #3
Jarkko,

> On 17.07.2024, at 12:07, Jarkko Sakkinen <jarkko@kernel.org> wrote:
> 
> On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
>> The DCP trusted key type uses the wrong helper function to store
>> the blob's payload length which can lead to the wrong byte order
>> being used in case this would ever run on big endian architectures.
>> 
>> Fix by using correct helper function.
>> 
>> Signed-off-by: David Gstir <david@sigma-star.at>
>> Suggested-by: Richard Weinberger <richard@nod.at>
> 
> You cannot suggest a change that you author yourself.
> 
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
>> Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
> 
> Tags are in wrong order. For next round:

here’s me relying on checkpatch.pl to tell me this, but it did not. :-/
Anyways, thanks for reviewing! I’ll fix the tags and send v2.

BR, David
Jarkko Sakkinen July 17, 2024, 11:26 a.m. UTC | #4
On Wed Jul 17, 2024 at 1:19 PM EEST, Richard Weinberger wrote:
> Am Mittwoch, 17. Juli 2024, 12:07:58 CEST schrieb Jarkko Sakkinen:
> > On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
> > > The DCP trusted key type uses the wrong helper function to store
> > > the blob's payload length which can lead to the wrong byte order
> > > being used in case this would ever run on big endian architectures.
> > >
> > > Fix by using correct helper function.
> > >
> > > Signed-off-by: David Gstir <david@sigma-star.at>
> > > Suggested-by: Richard Weinberger <richard@nod.at>
> > 
> > You cannot suggest a change that you author yourself.
>
> Well, I suggested the change, not David.
> So, I think you're implying that David's s-o-b cannot be before
> the Suggested-by tag but after?

I have dyslexia, I actually read it incorrectly so thanks
for pointing this ;-)

So keeping the tag is fine just reorder the tags, and the fix
will be fine.

Don't expect fast response, I'm on holiday still this and next
week. Just shuffling through inbox weekly basis.

BR, Jarkko
Jarkko Sakkinen July 17, 2024, 11:27 a.m. UTC | #5
On Wed Jul 17, 2024 at 2:03 PM EEST, David Gstir wrote:
> Jarkko,
>
> > On 17.07.2024, at 12:07, Jarkko Sakkinen <jarkko@kernel.org> wrote:
> > 
> > On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
> >> The DCP trusted key type uses the wrong helper function to store
> >> the blob's payload length which can lead to the wrong byte order
> >> being used in case this would ever run on big endian architectures.
> >> 
> >> Fix by using correct helper function.
> >> 
> >> Signed-off-by: David Gstir <david@sigma-star.at>
> >> Suggested-by: Richard Weinberger <richard@nod.at>
> > 
> > You cannot suggest a change that you author yourself.
> > 
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
> >> Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
> > 
> > Tags are in wrong order. For next round:
>
> here’s me relying on checkpatch.pl to tell me this, but it did not. :-/
> Anyways, thanks for reviewing! I’ll fix the tags and send v2.

Cool, might take over a week before response from my side but I'm sure
we get this to some rc of 6.11. I've purposely kept my 6.11 PR feature
free because the merge window was right in the middle of my holiday
:-)

BR, Jarkko
diff mbox series

Patch

diff --git a/security/keys/trusted-keys/trusted_dcp.c b/security/keys/trusted-keys/trusted_dcp.c
index b5f81a05be36..b0947f072a98 100644
--- a/security/keys/trusted-keys/trusted_dcp.c
+++ b/security/keys/trusted-keys/trusted_dcp.c
@@ -222,7 +222,7 @@  static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
 		return ret;
 	}
 
-	b->payload_len = get_unaligned_le32(&p->key_len);
+	put_unaligned_le32(p->key_len, &b->payload_len);
 	p->blob_len = blen;
 	return 0;
 }