4.19.164-rc1 review
Subsystems (4)
Re: [PATCH 4.19 154/346] crypto: omap-aes - Fix PM disable depth imbalance in omap_aes_probe
In reply to Greg Kroah-HartmanHi!
Quoted 7 lines
From: Zhang Qilong <[email protected]>
[ Upstream commit
ff8107200367f4abe0e5bce66a245e8d0f2d229e]The
pm_runtime_enablewill increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.
Oops, this is complex.
First, same bug exist in 4.4, but is not fixed there, and there is missing pm_runtime_put() there and elsewhere.
4.4 needs these two fixes + backport of ff81072003.
4.19 needs fixes similar to these, at three places.
mainline is okay, afaict.
Best regards,
Pavel
drivers/crypto/omap-aes.c +2 -0
@@ -801,6 +801,7 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm) err =pm_runtime_get_sync (dd->dev);if (err <0 ) { +pm_runtime_put_sync (dd->dev);dev_err (dd->dev,"%s: failed to get_sync(%d)\n" , __func__, err);return err;
@@ -1195,6 +1196,7 @@ static int omap_aes_probe(struct platform_device *pdev)pm_runtime_enable (dev); err =pm_runtime_get_sync (dev);if (err <0 ) { +pm_runtime_put_sync (dev);dev_err (dev,"%s: failed to get_sync(%d)\n" , __func__, err); goto err_res;
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 154/346] crypto: omap-aes - Fix PM disable depth imbalance in omap_aes_probe
Quoted 39 lines · Pavel Machek
Hi!
Quoted 7 lines
From: Zhang Qilong <[email protected]>
[ Upstream commit
ff8107200367f4abe0e5bce66a245e8d0f2d229e]The
pm_runtime_enablewill increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.Oops, this is complex.
First, same bug exist in 4.4, but is not fixed there, and there is missing
pm_runtime_put()there and elsewhere.4.4 needs these two fixes + backport of
ff81072003.4.19 needs fixes similar to these, at three places.
mainline is okay, afaict.
Best regards,
Paveldrivers/crypto/omap-aes.c +1
-0@@ -801,6 +801,7 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm) err =pm_runtime_get_sync (dd->dev);if (err <0 ) { +pm_runtime_put_sync (dd->dev);dev_err (dd->dev,"%s: failed to get_sync(%d)\n" , __func__, err);return err;
drivers/crypto/omap-aes.c static int omap_aes_probe(struct platform_device *pdev) · line 1202
Quoted 7 lines
drivers/crypto/omap-aes.c +1
-0@@ -1195,6 +1196,7 @@ static int omap_aes_probe(struct platform_device *pdev)pm_runtime_enable (dev); err =pm_runtime_get_sync (dev);if (err <0 ) { +pm_runtime_put_sync (dev);dev_err (dev,"%s: failed to get_sync(%d)\n" , __func__, err); goto err_res;
Can you submit all of this in a format that I can apply it in?
thanks,
greg k-h
Re: [PATCH 4.19 267/346] ALSA: hda/ca0132 - Change Input Source enum strings.
In reply to Greg Kroah-HartmanHi!
Quoted 9 lines
From: Connor McAdams <[email protected]>
commit
7079f785b50055a32b72eddcb7d9ba5688db24d0upstream.Change the Input Source enumerated control's strings to make it play nice with pulseaudio.
+++
b/sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_ca0132.c enum { · line 110
Quoted 6 lines
sound/pci/hda/patch_ca0132.c +1
-1@@ -106,7 +106,7 @@ enum { };/* Strings for Input Source Enum Control */ -static const char *const in_src_str[3 ] = {"Rear Mic" ,"Line" ,"Front Mic" }; +static const char *const in_src_str[3 ] = {"Microphone" ,"Line In" ,"Front Microphone" };#define IN_SRC_NUM_OF_INPUTS 3
If pulseaudio expects the strings to be from small set, should we have defines for them?
If pulseaudio can't understand short versions, do these need fixing, too?
hda_auto_parser.c: "Internal Mic", "Dock Mic", "Mic", "Rear Mic", "Front Mic"hda_auto_parser.c: return "Headset Mic";hda_auto_parser.c: return "Headphone Mic";hda_auto_parser.c: return "Mic";hda_auto_parser.c: return "Headphone Mic";hda_jack.c: cfg, "Headphone Mic");hda_jack.c: cfg, "Headphone Mic");hda_proc.c: "Line In", "Aux", "Mic", "Telephony",
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Re: [PATCH 4.19 287/346] crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
In reply to Greg Kroah-HartmanHi!
Quoted 8 lines
ecdh_set_secret()casts a void* pointer to a const u64* in order to feed it intoecc_is_key_valid(). This is not generally permitted by the C standard, and leads to actual misalignment faults on ARMv6 cores. In some cases, these are fixed up in software, but this still leads to performance hits that are entirely avoidable.So let's copy the key into the ctx buffer first, which we will do anyway in the common case, and which guarantees correct alignment.
Fair enough... but: params.key_size is validated in ecc_is_key_valid(), and that now happens _after_ memcpy.
How is it guaranteed that we don't overflow the buffer during memcpy?
Quoted 7 lines
+++
b/crypto/ecdh.ccrypto/ecdh.c +0
-2@@ -57,12 +57,13 @@ static int ecdh_set_secret(struct cryptoreturn ecc_gen_privkey (ctx->curve_id, ctx->ndigits, ctx->private_key); -if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, - (const u64 *)params.key, params.key_size) <0 )
crypto/ecdh.c static int ecdh_set_secret(struct crypto · line 67
Quoted 10 lines
crypto/ecdh.c +5
-2-return -EINVAL ; -memcpy (ctx->private_key, params.key, params.key_size); +if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, + ctx->private_key, params.key_size) <0 ) { +memzero_explicit (ctx->private_key, params.key_size); +return -EINVAL ; + }return 0 ;
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH 4.19 267/346] ALSA: hda/ca0132 - Change Input Source enum strings.
In reply to Pavel MachekQuoted 22 lines · Pavel Machek
Hi!
Quoted 9 lines
From: Connor McAdams <[email protected]>
commit
7079f785b50055a32b72eddcb7d9ba5688db24d0upstream.Change the Input Source enumerated control's strings to make it play nice with pulseaudio.
+++
b/sound/pci/hda/patch_ca0132.csound/pci/hda/patch_ca0132.c enum { · line 110
Quoted 6 lines
sound/pci/hda/patch_ca0132.c +1
-1@@ -106,7 +106,7 @@ enum { };/* Strings for Input Source Enum Control */ -static const char *const in_src_str[3 ] = {"Rear Mic" ,"Line" ,"Front Mic" }; +static const char *const in_src_str[3 ] = {"Microphone" ,"Line In" ,"Front Microphone" };#define IN_SRC_NUM_OF_INPUTS 3If pulseaudio expects the strings to be from small set, should we have defines for them?
Quoted 2 lines
If pulseaudio can't understand short versions, do these need fixing, too?
I don't believe so. Even if PA really doesn't understand, it's a problem of PA itself to be fixed there.
In this particular case, we changed the driver side since it's an easier path and very specific to the certain model. But if it's about the generic parser that is applied to all models, it's a different story.
thanks,
Takashi
Re: [PATCH 4.19 287/346] crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
In reply to Pavel MachekQuoted 9 lines · Pavel Machek
Hi!
Quoted 6 lines
ecdh_set_secret()casts a void* pointer to a const u64* in order to feed it intoecc_is_key_valid(). This is not generally permitted by the C standard, and leads to actual misalignment faults on ARMv6 cores. In some cases, these are fixed up in software, but this still leads to performance hits that are entirely avoidable.
Quoted 8 lines
Quoted 2 lines
So let's copy the key into the ctx buffer first, which we will do anyway in the common case, and which guarantees correct alignment.
Fair enough... but: params.key_size is validated in
ecc_is_key_valid(), and that now happens _after_ memcpy.How is it guaranteed that we don't overflow the buffer during memcpy?
It is not, thanks for pointing that out. There are some redundant checks being performed, so you won't trigger it easily with fuzzing, but afaict, an intentionally crafted invalid input could indeed overflow the buffer.
I'll send a fix shortly.
Quoted 23 lines
Quoted 7 lines
+++
b/crypto/ecdh.ccrypto/ecdh.c +0
-2@@ -57,12 +57,13 @@ static int ecdh_set_secret(struct cryptoreturn ecc_gen_privkey (ctx->curve_id, ctx->ndigits, ctx->private_key); -if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, - (const u64 *)params.key, params.key_size) <0 )crypto/ecdh.c static int ecdh_set_secret(struct crypto · line 67
Quoted 10 lines
crypto/ecdh.c +5
-2-return -EINVAL ; -memcpy (ctx->private_key, params.key, params.key_size); +if (ecc_is_key_valid (ctx->curve_id, ctx->ndigits, + ctx->private_key, params.key_size) <0 ) { +memzero_explicit (ctx->private_key, params.key_size); +return -EINVAL ; + }return 0 ;Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany