]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Fix mapping from vmalloc-ed buffer to scatter list
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Mon, 17 Nov 2014 09:14:31 +0000 (09:14 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 17 Nov 2014 10:40:10 +0000 (10:40 +0000)
commitacd65480cd6b5f9baf2f706d71742c5a01841bcb
tree81ff5f55ef559d5b2402fcd17b94ba06b4c80b8b
parentcf707b7b48540e4559958bc7587fb506b5c80cc1
spi: Fix mapping from vmalloc-ed buffer to scatter list

We can only use page_address on memory that has been mapped using kmap,
when the buffer passed to the SPI has been allocated by vmalloc the page
has not necessarily been mapped through kmap. This means sometimes
page_address will return NULL causing the pointer we pass to sg_set_buf
to be invalid.

As we only call page_address so that we can pass a virtual address to
sg_set_buf which will then immediately call virt_to_page on it, fix this
by calling sg_set_page directly rather then relying on the sg_set_buf
helper.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
drivers/spi/spi.c