lkml.org 
[lkml]   [2013]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [char-misc-next 2/8] mei: hbm: validate client index is not exceeding allocated array size
Date


> > ---
> > drivers/misc/mei/hbm.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
> > index 9b3a0fb..0f5e8ca 100644
> > --- a/drivers/misc/mei/hbm.c
> > +++ b/drivers/misc/mei/hbm.c
> > @@ -228,8 +228,6 @@ static int mei_hbm_prop_req(struct mei_device *dev)
> > unsigned long client_num;
> >
> >
> > - client_num = dev->me_client_presentation_num;
> > -
> > next_client_index = find_next_bit(dev->me_clients_map,
> MEI_CLIENTS_MAX,
> > dev->me_client_index);
> >
> > @@ -241,6 +239,10 @@ static int mei_hbm_prop_req(struct mei_device *dev)
> > return 0;
> > }
> >
> > + client_num = dev->me_client_presentation_num;
> > + if (WARN_ON(dev->me_clients_num <= client_num))
> > + return -EIO;
>
> How can this happen? Why is spitting out a huge warning in the syslog
> going to help anything? If a user can do this, then great, now you can
> DoS your syslog :(
>
> If a user can't do this, then why tell them, it's your driver's bug that
> you should just fix.

This somehow should guard buffer overflow allocated of size dev->me_clients_num
In theory this can happen only if something go wrong in hardware initialization or there is some other security hole that can change client_num.

After this happen you probably won't be able to use the driver anyhow so I do not expect DoS on the syslog, but we can drop the WARN_ON
but I would stick with the check

Thanks
Tomas





\
 
 \ /
  Last update: 2013-10-30 09:01    [W:0.080 / U:4.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site