All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13  2:51 ` Jiasheng Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiasheng Jiang @ 2022-12-13  2:51 UTC (permalink / raw)
  To: neal_liu, gregkh, joel, andrew, sumit.semwal, christian.koenig
  Cc: linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig, Jiasheng Jiang

Add the check for the return value of dma_alloc_coherent
in order to avoid NULL pointer dereference.

Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 01968e2167f9..6cf46562bb25 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
 					  AST_UDC_EP_DMA_SIZE *
 					  AST_UDC_NUM_ENDPOINTS,
 					  &udc->ep0_buf_dma, GFP_KERNEL);
+	if (!udc->ep0_buf)
+		return -ENOMEM;
 
 	udc->gadget.speed = USB_SPEED_UNKNOWN;
 	udc->gadget.max_speed = USB_SPEED_HIGH;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13  2:51 ` Jiasheng Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiasheng Jiang @ 2022-12-13  2:51 UTC (permalink / raw)
  To: neal_liu, gregkh, joel, andrew, sumit.semwal, christian.koenig
  Cc: Jiasheng Jiang, linux-aspeed, linux-usb, linux-kernel, dri-devel,
	linaro-mm-sig, linux-arm-kernel, linux-media

Add the check for the return value of dma_alloc_coherent
in order to avoid NULL pointer dereference.

Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 01968e2167f9..6cf46562bb25 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
 					  AST_UDC_EP_DMA_SIZE *
 					  AST_UDC_NUM_ENDPOINTS,
 					  &udc->ep0_buf_dma, GFP_KERNEL);
+	if (!udc->ep0_buf)
+		return -ENOMEM;
 
 	udc->gadget.speed = USB_SPEED_UNKNOWN;
 	udc->gadget.max_speed = USB_SPEED_HIGH;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13  2:51 ` Jiasheng Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiasheng Jiang @ 2022-12-13  2:51 UTC (permalink / raw)
  To: neal_liu, gregkh, joel, andrew, sumit.semwal, christian.koenig
  Cc: linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig, Jiasheng Jiang

Add the check for the return value of dma_alloc_coherent
in order to avoid NULL pointer dereference.

Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 01968e2167f9..6cf46562bb25 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
 					  AST_UDC_EP_DMA_SIZE *
 					  AST_UDC_NUM_ENDPOINTS,
 					  &udc->ep0_buf_dma, GFP_KERNEL);
+	if (!udc->ep0_buf)
+		return -ENOMEM;
 
 	udc->gadget.speed = USB_SPEED_UNKNOWN;
 	udc->gadget.max_speed = USB_SPEED_HIGH;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
  2022-12-13  2:51 ` Jiasheng Jiang
  (?)
@ 2022-12-13  6:14   ` Greg KH
  -1 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13  6:14 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: neal_liu, joel, andrew, sumit.semwal, christian.koenig,
	linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig

On Tue, Dec 13, 2022 at 10:51:19AM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of dma_alloc_coherent
> in order to avoid NULL pointer dereference.
> 
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
> index 01968e2167f9..6cf46562bb25 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
>  					  AST_UDC_EP_DMA_SIZE *
>  					  AST_UDC_NUM_ENDPOINTS,
>  					  &udc->ep0_buf_dma, GFP_KERNEL);
> +	if (!udc->ep0_buf)
> +		return -ENOMEM;

How did you test this?  I ask as it is obviously not correct.  Please
always test your patches before submitting them as adding new bugs when
claiming that you are fixing a problem is not good.

And how did you find this potential problem?  What tool did you use and
why did you not follow the documentation for properly describing the
tool?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13  6:14   ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13  6:14 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: linux-aspeed, andrew, neal_liu, linux-usb, linux-kernel,
	dri-devel, sumit.semwal, linaro-mm-sig, joel, christian.koenig,
	linux-arm-kernel, linux-media

On Tue, Dec 13, 2022 at 10:51:19AM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of dma_alloc_coherent
> in order to avoid NULL pointer dereference.
> 
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
> index 01968e2167f9..6cf46562bb25 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
>  					  AST_UDC_EP_DMA_SIZE *
>  					  AST_UDC_NUM_ENDPOINTS,
>  					  &udc->ep0_buf_dma, GFP_KERNEL);
> +	if (!udc->ep0_buf)
> +		return -ENOMEM;

How did you test this?  I ask as it is obviously not correct.  Please
always test your patches before submitting them as adding new bugs when
claiming that you are fixing a problem is not good.

And how did you find this potential problem?  What tool did you use and
why did you not follow the documentation for properly describing the
tool?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13  6:14   ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13  6:14 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: neal_liu, joel, andrew, sumit.semwal, christian.koenig,
	linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig

On Tue, Dec 13, 2022 at 10:51:19AM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of dma_alloc_coherent
> in order to avoid NULL pointer dereference.
> 
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
> index 01968e2167f9..6cf46562bb25 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
>  					  AST_UDC_EP_DMA_SIZE *
>  					  AST_UDC_NUM_ENDPOINTS,
>  					  &udc->ep0_buf_dma, GFP_KERNEL);
> +	if (!udc->ep0_buf)
> +		return -ENOMEM;

How did you test this?  I ask as it is obviously not correct.  Please
always test your patches before submitting them as adding new bugs when
claiming that you are fixing a problem is not good.

And how did you find this potential problem?  What tool did you use and
why did you not follow the documentation for properly describing the
tool?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
  2022-12-13 12:15 ` Jiasheng Jiang
  (?)
@ 2022-12-13 14:31   ` Greg KH
  -1 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13 14:31 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: linux-aspeed, andrew, neal_liu, linux-usb, linux-kernel,
	dri-devel, sumit.semwal, linaro-mm-sig, joel, christian.koenig,
	linux-arm-kernel, linux-media

On Tue, Dec 13, 2022 at 08:15:20PM +0800, Jiasheng Jiang wrote:
> Thanks, I found my mistake and I will submit a v2.
> 
> > And how did you find this potential problem?  What tool did you use and
> > why did you not follow the documentation for properly describing the
> > tool?
> 
> I used a tool I wrote myself to find it, which is unpublished.
> Therefore, I think it is okay to submit patches without description of the
> tools.

Nope!  Please read:
	Documentation/process/researcher-guidelines.rst
for what you must do.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13 14:31   ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13 14:31 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: neal_liu, joel, andrew, sumit.semwal, christian.koenig,
	linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig

On Tue, Dec 13, 2022 at 08:15:20PM +0800, Jiasheng Jiang wrote:
> Thanks, I found my mistake and I will submit a v2.
> 
> > And how did you find this potential problem?  What tool did you use and
> > why did you not follow the documentation for properly describing the
> > tool?
> 
> I used a tool I wrote myself to find it, which is unpublished.
> Therefore, I think it is okay to submit patches without description of the
> tools.

Nope!  Please read:
	Documentation/process/researcher-guidelines.rst
for what you must do.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13 14:31   ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-12-13 14:31 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: neal_liu, joel, andrew, sumit.semwal, christian.koenig,
	linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig

On Tue, Dec 13, 2022 at 08:15:20PM +0800, Jiasheng Jiang wrote:
> Thanks, I found my mistake and I will submit a v2.
> 
> > And how did you find this potential problem?  What tool did you use and
> > why did you not follow the documentation for properly describing the
> > tool?
> 
> I used a tool I wrote myself to find it, which is unpublished.
> Therefore, I think it is okay to submit patches without description of the
> tools.

Nope!  Please read:
	Documentation/process/researcher-guidelines.rst
for what you must do.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13 12:15 ` Jiasheng Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiasheng Jiang @ 2022-12-13 12:15 UTC (permalink / raw)
  To: gregkh
  Cc: Jiasheng Jiang, linux-aspeed, andrew, neal_liu, linux-usb,
	linux-kernel, dri-devel, sumit.semwal, linaro-mm-sig, joel,
	christian.koenig, linux-arm-kernel, linux-media

Thanks, I found my mistake and I will submit a v2.

> And how did you find this potential problem?  What tool did you use and
> why did you not follow the documentation for properly describing the
> tool?

I used a tool I wrote myself to find it, which is unpublished.
Therefore, I think it is okay to submit patches without description of the
tools.

Thanks,
Jiang


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
@ 2022-12-13 12:15 ` Jiasheng Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiasheng Jiang @ 2022-12-13 12:15 UTC (permalink / raw)
  To: gregkh
  Cc: neal_liu, joel, andrew, sumit.semwal, christian.koenig,
	linux-aspeed, linux-usb, linux-arm-kernel, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig, Jiasheng Jiang

Thanks, I found my mistake and I will submit a v2.

> And how did you find this potential problem?  What tool did you use and
> why did you not follow the documentation for properly describing the
> tool?

I used a tool I wrote myself to find it, which is unpublished.
Therefore, I think it is okay to submit patches without description of the
tools.

Thanks,
Jiang


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-12-13 14:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13  2:51 [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent Jiasheng Jiang
2022-12-13  2:51 ` Jiasheng Jiang
2022-12-13  2:51 ` Jiasheng Jiang
2022-12-13  6:14 ` Greg KH
2022-12-13  6:14   ` Greg KH
2022-12-13  6:14   ` Greg KH
2022-12-13 12:15 Jiasheng Jiang
2022-12-13 12:15 ` Jiasheng Jiang
2022-12-13 14:31 ` Greg KH
2022-12-13 14:31   ` Greg KH
2022-12-13 14:31   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.