ALSA: control: fix a error handling exist in snd_ctl_elem_add
RFC v2 1/1 ALSA: control: fix a error handling exist in snd_ctl_elem_add
CVE-2020-11725 report that 'count = info->owner' may result a SIZE_OVERFLOW. 'info->owner' represent a pid, and actually, we should use info->count.
--- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
v1->v2: reword the patch head
sound/core/control.c +1 -1
@@ -1431,7 +1431,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,return -ENOMEM ;/* Check the number of elements for this userspace control. */ - count = info->owner; + count = info->count;if (count ==0 ) count =1 ;
Signature · 1 line
2.21.1
Quoted 6 lines · yangerkun
CVE-2020-11725 report that 'count =
info->owner' may result aSIZE_OVERFLOW. 'info->owner' represent a pid, and actually, we should useinfo->count.Signed-off-by yangerkun <[email protected]>
The CVE report is simply wrong. info->owner is used intentionally for this specific API to add a user-space control. For the normal kernel kctls, the field is used indeed for storing the pid, but but the user-space kctl addition API usage is an exception.
You can see the another use of info->count of field in the very same function at a later point and find it has a different meaning.
The CVE should be disputed.
thanks,
Takashi
Quoted 22 lines
--- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
v1->v2: reword the patch headsound/core/control.c +1
-1@@ -1431,7 +1431,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,return -ENOMEM ;/* Check the number of elements for this userspace control. */ - count = info->owner; + count = info->count;if (count ==0 ) count =1 ;Signature · 1 line
2.21.1
Quoted 14 lines · Takashi Iwai
Quoted 6 lines · yangerkun
CVE-2020-11725 report that 'count =
info->owner' may result aSIZE_OVERFLOW. 'info->owner' represent a pid, and actually, we should useinfo->count.Signed-off-by yangerkun <[email protected]>The CVE report is simply wrong.
info->owneris used intentionally for this specific API to add a user-space control. For the normal kernel kctls, the field is used indeed for storing the pid, but but the user-space kctl addition API usage is an exception.
Quoted 4 lines
You can see the another use of
info->countof field in the very same function at a later point and find it has a different meaning.The CVE should be disputed.
Got it! Thanks for your reply.
Quoted 31 lines
thanks,
Takashi
Quoted 22 lines
--- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
v1->v2: reword the patch headsound/core/control.c +1
-1@@ -1431,7 +1431,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,return -ENOMEM ;/* Check the number of elements for this userspace control. */ - count = info->owner; + count = info->count;if (count ==0 ) count =1 ;Signature · 1 line
2.21.1.