mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Patrick Boettcher <pb@linuxtv.org>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<syzbot+c88fc0ebe0d5935c70da@syzkaller.appspotmail.com>,
	<n.zhandarovich@fintech.ru>
Subject: Re: [PATCH] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg
Date: Mon, 26 Aug 2024 03:39:35 -0700	[thread overview]
Message-ID: <2417bf98-424b-4d37-ae36-8f5affaffb24@fintech.ru> (raw)
In-Reply-To: <20240517155800.9881-1-n.zhandarovich@fintech.ru>

Hi,

On 5/17/24 08:58, Nikita Zhandarovich wrote:
> Syzbot reports [1] an uninitialized value issue found by KMSAN in
> dib3000_read_reg().
> 
> Local u8 rb[2] is used in i2c_transfer() as a read buffer; in case
> that call fails, the buffer may end up with some undefined values.
> 
> Since no elaborate error handling is expected in dib3000_write_reg(),
> simply zero out rb buffer to mitigate the problem.
> 
> [1] Syzkaller report
> dvb-usb: bulk message failed: -22 (6/0)
> =====================================================
> BUG: KMSAN: uninit-value in dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
>  dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
>  dibusb_dib3000mb_frontend_attach+0x155/0x2f0 drivers/media/usb/dvb-usb/dibusb-mb.c:31
>  dvb_usb_adapter_frontend_init+0xed/0x9a0 drivers/media/usb/dvb-usb/dvb-usb-dvb.c:290
>  dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:90 [inline]
>  dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:186 [inline]
>  dvb_usb_device_init+0x25a8/0x3760 drivers/media/usb/dvb-usb/dvb-usb-init.c:310
>  dibusb_probe+0x46/0x250 drivers/media/usb/dvb-usb/dibusb-mb.c:110
> ...
> Local variable rb created at:
>  dib3000_read_reg+0x86/0x4e0 drivers/media/dvb-frontends/dib3000mb.c:54
>  dib3000mb_attach+0x123/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
> ...
> 
> Fixes: 74340b0a8bc6 ("V4L/DVB (4457): Remove dib3000-common-module")
> Reported-by: syzbot+c88fc0ebe0d5935c70da@syzkaller.appspotmail.com
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
> ---
>  drivers/media/dvb-frontends/dib3000mb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/dib3000mb.c b/drivers/media/dvb-frontends/dib3000mb.c
> index c598b2a63325..7c452ddd9e40 100644
> --- a/drivers/media/dvb-frontends/dib3000mb.c
> +++ b/drivers/media/dvb-frontends/dib3000mb.c
> @@ -51,7 +51,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-a
>  static int dib3000_read_reg(struct dib3000_state *state, u16 reg)
>  {
>  	u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff };
> -	u8 rb[2];
> +	u8 rb[2] = {};
>  	struct i2c_msg msg[] = {
>  		{ .addr = state->config.demod_address, .flags = 0,        .buf = wb, .len = 2 },
>  		{ .addr = state->config.demod_address, .flags = I2C_M_RD, .buf = rb, .len = 2 },


Gentle ping...

Regards,
Nikita

      reply	other threads:[~2024-08-26 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 15:58 Nikita Zhandarovich
2024-08-26 10:39 ` Nikita Zhandarovich [this message]

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=2417bf98-424b-4d37-ae36-8f5affaffb24@fintech.ru \
    --to=n.zhandarovich@fintech.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=pb@linuxtv.org \
    --cc=syzbot+c88fc0ebe0d5935c70da@syzkaller.appspotmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®