Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue()
@ 2020-05-19 18:14 Manivannan Sadhasivam
  2020-05-19 23:10 ` Bjorn Andersson
  2020-05-22  0:05 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-19 18:14 UTC (permalink / raw)
  To: davem, kuba
  Cc: bjorn.andersson, netdev, linux-kernel, linux-arm-msm,
	Manivannan Sadhasivam

Once the traversal of the list is completed with list_for_each_entry(),
the iterator (node) will point to an invalid object. So passing this to
qrtr_local_enqueue() which is outside of the iterator block is erroneous
eventhough the object is not used.

So fix this by passing NULL to qrtr_local_enqueue().

Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 net/qrtr/qrtr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 7ed31b5e77e4..2d8d6131bc5f 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -854,7 +854,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 	}
 	mutex_unlock(&qrtr_node_lock);
 
-	qrtr_local_enqueue(node, skb, type, from, to);
+	qrtr_local_enqueue(NULL, skb, type, from, to);
 
 	return 0;
 }
-- 
2.17.1


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

* Re: [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue()
  2020-05-19 18:14 [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue() Manivannan Sadhasivam
@ 2020-05-19 23:10 ` Bjorn Andersson
  2020-05-22  0:05 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2020-05-19 23:10 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: davem, kuba, netdev, linux-kernel, linux-arm-msm

On Tue 19 May 11:14 PDT 2020, Manivannan Sadhasivam wrote:

> Once the traversal of the list is completed with list_for_each_entry(),
> the iterator (node) will point to an invalid object. So passing this to
> qrtr_local_enqueue() which is outside of the iterator block is erroneous
> eventhough the object is not used.
> 
> So fix this by passing NULL to qrtr_local_enqueue().
> 
> Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  net/qrtr/qrtr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 7ed31b5e77e4..2d8d6131bc5f 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -854,7 +854,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>  	}
>  	mutex_unlock(&qrtr_node_lock);
>  
> -	qrtr_local_enqueue(node, skb, type, from, to);
> +	qrtr_local_enqueue(NULL, skb, type, from, to);
>  
>  	return 0;
>  }
> -- 
> 2.17.1
> 

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

* Re: [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue()
  2020-05-19 18:14 [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue() Manivannan Sadhasivam
  2020-05-19 23:10 ` Bjorn Andersson
@ 2020-05-22  0:05 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-05-22  0:05 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: kuba, bjorn.andersson, netdev, linux-kernel, linux-arm-msm

From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date: Tue, 19 May 2020 23:44:16 +0530

> Once the traversal of the list is completed with list_for_each_entry(),
> the iterator (node) will point to an invalid object. So passing this to
> qrtr_local_enqueue() which is outside of the iterator block is erroneous
> eventhough the object is not used.
> 
> So fix this by passing NULL to qrtr_local_enqueue().
> 
> Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Applied and queued up for -stable, thanks.

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 18:14 [PATCH] net: qrtr: Fix passing invalid reference to qrtr_local_enqueue() Manivannan Sadhasivam
2020-05-19 23:10 ` Bjorn Andersson
2020-05-22  0:05 ` David Miller

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git