[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <270931e3-c859-a0fd-67f5-35d83ef6e5e9@kernel.org>
Date: Tue, 12 Nov 2019 02:41:08 -0700
From: shuah <shuah@...nel.org>
To: Suwan Kim <suwan.kim027@...il.com>, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
dan.carpenter@...cle.com, valentina.manea.m@...il.com,
kbuild test robot <lkp@...el.com>, shuah <shuah@...nel.org>
Subject: Re: [PATCH] usbip: Fix uninitialized symbol 'nents' in
stub_recv_cmd_submit()
On 11/11/19 7:10 AM, Suwan Kim wrote:
> Smatch reported that nents is not initialized and used in
> stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc()
> and used to allocate multiple URBs when host controller doesn't
> support scatter-gather DMA. The use of uninitialized nents means that
> buf_len is zero and use_sg is true. But buffer length should not be
> zero when an URB uses scatter-gather DMA.
>
> To prevent this situation, add the conditional that checks buf_len
> and use_sg. And move the use of nents right after the sgl_alloc() to
> avoid the use of uninitialized nents.
>
> If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv
> will be released by stub event handler and connection will be shut
> down.
>
> Fixes: ea44d190764b ("usbip: Implement SG support to vhci-hcd and stub driver")
> Reported-by: kbuild test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Suwan Kim <suwan.kim027@...il.com>
> ---
Looks good.
Acked-by: Shuah Khan <skhan@...uxfoundation.org>
thanks,
-- Shuah
Powered by blists - more mailing lists