# Re: \[PATCH\] block: do not copy data to user when bi\_status is error

- From: Christoph Hellwig \<hch@lst.de\>
- Date: 2021-03-18 12:57:20 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/03/6401407
- Thread: https://ratatoskr.run/linux-block/2021/03/6401404/t.md

```text
On Thu, Mar 18, 2021 at 08:26:21PM +0800, Jason Yan wrote:
> When the user submitted a request with unaligned buffer, we will
> allocate a new page and try to copy data to or from the new page.
> If it is a reading request, we always copy back the data to user's
> buffer, whether the result is good or error. So if the driver or
> hardware returns an error, garbage data is copied to the user space.
> This is a potential security issue which makes kernel info leaks.
> 
> So do not copy the uninitalized data to user's buffer if the
> bio->bi_status is not BLK_STS_OK in bio_copy_kern_endio_read().

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
```
