]> git.hungrycats.org Git - linux/commit
lib/mpi: kunmap after finishing accessing buffer
authorStephan Mueller <smueller@chronox.de>
Thu, 10 Aug 2017 06:06:18 +0000 (08:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Sep 2017 06:37:16 +0000 (08:37 +0200)
commit6cc6f45db016886f6a4e91b249a923a61cebb996
tree7a894b0a66171db511044fcc645a9086122f3fec
parenta3deff1d3285f9516b2335644588fb09eaa291a2
lib/mpi: kunmap after finishing accessing buffer

commit dea3eb8b452e36cf2dd572b0a797915ccf452ae6 upstream.

Using sg_miter_start and sg_miter_next, the buffer of an SG is kmap'ed
to *buff. The current code calls sg_miter_stop (and thus kunmap) on the
SG entry before the last access of *buff.

The patch moves the sg_miter_stop call after the last access to *buff to
ensure that the memory pointed to by *buff is still mapped.

Fixes: 4816c9406430 ("lib/mpi: Fix SG miter leak")
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/mpi/mpicoder.c