All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Laurent Caumont <lcaumont2@gmail.com>, Sean Young <sean@mess.org>
Cc: linux-media@vger.kernel.org
Subject: Re: 'LITE-ON USB2.0 DVB-T Tune' driver crash with kernel 4.13 / ubuntu 17.10
Date: Tue, 7 Nov 2017 08:42:45 -0200	[thread overview]
Message-ID: <20171107084245.47dce306@vento.lan> (raw)
In-Reply-To: <CACG2urwdnXs2v8hv24R3+sNW6qOifh6Gtt+semez_c8QC58-gA@mail.gmail.com>

Hi Sean/Laurent,

Care sending me a final version of the patch?

Thanks!
Mauro

Em Mon, 30 Oct 2017 21:59:34 +0100
Laurent Caumont <lcaumont2@gmail.com> escreveu:

> Hi Sean,
> 
> I found the problem. The read buffer needs to be allocated with kmalloc too.
> 
> int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
> {
>           u8 *wbuf;
>           u8 *rbuf;
>           int rc;
> 
>           rbuf = kmalloc(1, GFP_KERNEL);
>           if (!rbuf)
>             return -ENOMEM;
> 
>           wbuf = kmalloc(1, GFP_KERNEL);
>           if (!wbuf)
>             return -ENOMEM;
> 
>          *wbuf = offs;
> 
>          rc = dibusb_i2c_msg(d, 0x50, wbuf, 1, rbuf, 1);
>          kfree(wbuf);
>          *val = *rbuf;
>          kfree(rbuf);
> 
>         return rc;
> }
> 
> It works now.
> Please update the code in the main branch for futur versions.
> Thanks.
> Regards,
> Laurent
> 
> 2017-10-29 20:31 GMT+01:00 Sean Young <sean@mess.org>:
> > On Sun, Oct 29, 2017 at 06:54:28PM +0100, Laurent Caumont wrote:  
> >> Hi Sean,
> >>
> >> I recompiled the modules by following the
> >> https://www.linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers
> >> page and applied the patch.
> >> But I still have problems (see below). It doesn't seem to be the same callstack.
> >> Is it the right way to get the fix ?  
> >
> > Yes, it's the right way to get the fix. However, you've hit a new problem
> > of a similar making. Please can you try with this patch as well:
> >
> > Thanks
> > Sean
> > ---
> > From 84efb0bf72ae5d9183f25d69d95fb9ad9b9bc644 Mon Sep 17 00:00:00 2001
> > From: Sean Young <sean@mess.org>
> > Date: Sun, 29 Oct 2017 19:28:32 +0000
> > Subject: [PATCH] media: dibusb: don't do DMA on stack
> >
> > The USB control messages require DMA to work. We cannot pass
> > a stack-allocated buffer, as it is not warranted that the
> > stack would be into a DMA enabled area.
> >
> > Signed-off-by: Sean Young <sean@mess.org>
> > ---
> >  drivers/media/usb/dvb-usb/dibusb-common.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
> > index 8207e6900656..18c6e454b1b7 100644
> > --- a/drivers/media/usb/dvb-usb/dibusb-common.c
> > +++ b/drivers/media/usb/dvb-usb/dibusb-common.c
> > @@ -223,8 +223,18 @@ EXPORT_SYMBOL(dibusb_i2c_algo);
> >
> >  int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
> >  {
> > -       u8 wbuf[1] = { offs };
> > -       return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1);
> > +       u8 *wbuf;
> > +       int rc;
> > +
> > +       wbuf = kmalloc(1, GFP_KERNEL);
> > +       if (!wbuf)
> > +               return -ENOMEM;
> > +
> > +       *wbuf = offs;
> > +       rc = dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1);
> > +       kfree(wbuf);
> > +
> > +       return rc;
> >  }
> >  EXPORT_SYMBOL(dibusb_read_eeprom_byte);
> >
> > --
> > 2.13.6
> >  



Thanks,
Mauro

  parent reply	other threads:[~2017-11-07 10:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 17:49 'LITE-ON USB2.0 DVB-T Tune' driver crash with kernel 4.13 / ubuntu 17.10 Laurent Caumont
2017-10-23  9:43 ` Sean Young
     [not found]   ` <CACG2urzPV2q63-bLP98cHDDqzP3a-oydDScPqG=tVKSCzxREBg@mail.gmail.com>
2017-10-23 18:57     ` Sean Young
2017-10-29 17:54       ` Laurent Caumont
2017-10-29 19:31         ` Sean Young
2017-10-30 20:59           ` Laurent Caumont
2017-11-07 10:15             ` Sean Young
2017-11-07 10:42             ` Mauro Carvalho Chehab [this message]
2017-11-10 20:33               ` Laurent Caumont
2017-11-11 10:56                 ` Sean Young
2017-11-11 17:53                   ` Laurent Caumont
2017-11-11 18:01                     ` Sean Young
2017-11-11 19:06                       ` Laurent Caumont
2017-11-11 20:55                         ` Sean Young
2017-11-12  8:38                           ` Laurent Caumont
2017-11-12 21:06                             ` Sean Young
2017-11-21 21:03                             ` Sean Young
2017-11-21 22:44                               ` Laurent Caumont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171107084245.47dce306@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=lcaumont2@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sean@mess.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.