2018-05-26 09:39:44

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] misc: ibmvmc: Use GFP_ATOMIC under spin lock

The function alloc_dma_buffer() is called from ibmvmc_add_buffer(),
in which a spin lock be held here, so we should use GFP_ATOMIC when
a lock is held.

Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/misc/ibmvmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
index fb83d13..8f82bb9 100644
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -273,7 +273,7 @@ static void *alloc_dma_buffer(struct vio_dev *vdev, size_t size,
dma_addr_t *dma_handle)
{
/* allocate memory */
- void *buffer = kzalloc(size, GFP_KERNEL);
+ void *buffer = kzalloc(size, GFP_ATOMIC);

if (!buffer) {
*dma_handle = 0;



2018-05-29 14:18:39

by Bryant G. Ly

[permalink] [raw]
Subject: Re: [PATCH -next] misc: ibmvmc: Use GFP_ATOMIC under spin lock



On 5/26/18 4:45 AM, Wei Yongjun wrote:

> The function alloc_dma_buffer() is called from ibmvmc_add_buffer(),
> in which a spin lock be held here, so we should use GFP_ATOMIC when
> a lock is held.
>
> Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/misc/ibmvmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
> index fb83d13..8f82bb9 100644
> --- a/drivers/misc/ibmvmc.c
> +++ b/drivers/misc/ibmvmc.c
> @@ -273,7 +273,7 @@ static void *alloc_dma_buffer(struct vio_dev *vdev, size_t size,
> dma_addr_t *dma_handle)
> {
> /* allocate memory */
> - void *buffer = kzalloc(size, GFP_KERNEL);
> + void *buffer = kzalloc(size, GFP_ATOMIC);
>
> if (!buffer) {
> *dma_handle = 0;
>
Reviewed-by: Bryant G. Ly <[email protected]>