* [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
@ 2022-05-09 19:49 ` Charan Teja Kalla
0 siblings, 0 replies; 8+ messages in thread
From: Charan Teja Kalla @ 2022-05-09 19:49 UTC (permalink / raw)
To: sumit.semwal, christian.koenig, hridya, daniel.vetter, gregkh
Cc: linux-media, dri-devel, linaro-mm-sig, linux-kernel, tjmercier,
Charan Teja Reddy
From: Charan Teja Reddy <quic_charante@quicinc.com>
When dma_buf_stats_setup() fails, it closes the dmabuf file which
results into the calling of dma_buf_file_release() where it does
list_del(&dmabuf->list_node) with out first adding it to the proper
list. This is resulting into panic in the below path:
__list_del_entry_valid+0x38/0xac
dma_buf_file_release+0x74/0x158
__fput+0xf4/0x428
____fput+0x14/0x24
task_work_run+0x178/0x24c
do_notify_resume+0x194/0x264
work_pending+0xc/0x5f0
Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
list.
Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
---
drivers/dma-buf/dma-buf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 602b12d..a6fc96e 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -543,10 +543,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
file->f_mode |= FMODE_LSEEK;
dmabuf->file = file;
- ret = dma_buf_stats_setup(dmabuf);
- if (ret)
- goto err_sysfs;
-
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
@@ -554,6 +550,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
list_add(&dmabuf->list_node, &db_list.head);
mutex_unlock(&db_list.lock);
+ ret = dma_buf_stats_setup(dmabuf);
+ if (ret)
+ goto err_sysfs;
+
return dmabuf;
err_sysfs:
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
@ 2022-05-09 19:49 ` Charan Teja Kalla
0 siblings, 0 replies; 8+ messages in thread
From: Charan Teja Kalla @ 2022-05-09 19:49 UTC (permalink / raw)
To: sumit.semwal, christian.koenig, hridya, daniel.vetter, gregkh
Cc: linux-kernel, dri-devel, linaro-mm-sig, Charan Teja Reddy,
tjmercier, linux-media
From: Charan Teja Reddy <quic_charante@quicinc.com>
When dma_buf_stats_setup() fails, it closes the dmabuf file which
results into the calling of dma_buf_file_release() where it does
list_del(&dmabuf->list_node) with out first adding it to the proper
list. This is resulting into panic in the below path:
__list_del_entry_valid+0x38/0xac
dma_buf_file_release+0x74/0x158
__fput+0xf4/0x428
____fput+0x14/0x24
task_work_run+0x178/0x24c
do_notify_resume+0x194/0x264
work_pending+0xc/0x5f0
Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
list.
Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
---
drivers/dma-buf/dma-buf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 602b12d..a6fc96e 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -543,10 +543,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
file->f_mode |= FMODE_LSEEK;
dmabuf->file = file;
- ret = dma_buf_stats_setup(dmabuf);
- if (ret)
- goto err_sysfs;
-
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
@@ -554,6 +550,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
list_add(&dmabuf->list_node, &db_list.head);
mutex_unlock(&db_list.lock);
+ ret = dma_buf_stats_setup(dmabuf);
+ if (ret)
+ goto err_sysfs;
+
return dmabuf;
err_sysfs:
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
2022-05-09 19:49 ` Charan Teja Kalla
@ 2022-05-09 21:49 ` T.J. Mercier
-1 siblings, 0 replies; 8+ messages in thread
From: T.J. Mercier @ 2022-05-09 21:49 UTC (permalink / raw)
To: Charan Teja Kalla
Cc: daniel.vetter, linux-kernel, dri-devel, Christian König,
linaro-mm-sig, Greg Kroah-Hartman, Hridya Valsaraju,
Sumit Semwal, linux-media
On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
<quic_charante@quicinc.com> wrote:
>
> From: Charan Teja Reddy <quic_charante@quicinc.com>
>
> When dma_buf_stats_setup() fails, it closes the dmabuf file which
> results into the calling of dma_buf_file_release() where it does
> list_del(&dmabuf->list_node) with out first adding it to the proper
> list. This is resulting into panic in the below path:
> __list_del_entry_valid+0x38/0xac
> dma_buf_file_release+0x74/0x158
> __fput+0xf4/0x428
> ____fput+0x14/0x24
> task_work_run+0x178/0x24c
> do_notify_resume+0x194/0x264
> work_pending+0xc/0x5f0
>
> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
> list.
>
> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
Tested-by: T.J. Mercier <tjmercier@google.com>
Acked-by: T.J. Mercier <tjmercier@google.com>
> ---
> drivers/dma-buf/dma-buf.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 602b12d..a6fc96e 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -543,10 +543,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
> file->f_mode |= FMODE_LSEEK;
> dmabuf->file = file;
>
> - ret = dma_buf_stats_setup(dmabuf);
> - if (ret)
> - goto err_sysfs;
> -
> mutex_init(&dmabuf->lock);
> INIT_LIST_HEAD(&dmabuf->attachments);
>
> @@ -554,6 +550,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
> list_add(&dmabuf->list_node, &db_list.head);
> mutex_unlock(&db_list.lock);
>
> + ret = dma_buf_stats_setup(dmabuf);
> + if (ret)
> + goto err_sysfs;
> +
> return dmabuf;
>
> err_sysfs:
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
@ 2022-05-09 21:49 ` T.J. Mercier
0 siblings, 0 replies; 8+ messages in thread
From: T.J. Mercier @ 2022-05-09 21:49 UTC (permalink / raw)
To: Charan Teja Kalla
Cc: Sumit Semwal, Christian König, Hridya Valsaraju,
daniel.vetter, Greg Kroah-Hartman, linux-media, dri-devel,
linaro-mm-sig, linux-kernel
On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
<quic_charante@quicinc.com> wrote:
>
> From: Charan Teja Reddy <quic_charante@quicinc.com>
>
> When dma_buf_stats_setup() fails, it closes the dmabuf file which
> results into the calling of dma_buf_file_release() where it does
> list_del(&dmabuf->list_node) with out first adding it to the proper
> list. This is resulting into panic in the below path:
> __list_del_entry_valid+0x38/0xac
> dma_buf_file_release+0x74/0x158
> __fput+0xf4/0x428
> ____fput+0x14/0x24
> task_work_run+0x178/0x24c
> do_notify_resume+0x194/0x264
> work_pending+0xc/0x5f0
>
> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
> list.
>
> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
Tested-by: T.J. Mercier <tjmercier@google.com>
Acked-by: T.J. Mercier <tjmercier@google.com>
> ---
> drivers/dma-buf/dma-buf.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 602b12d..a6fc96e 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -543,10 +543,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
> file->f_mode |= FMODE_LSEEK;
> dmabuf->file = file;
>
> - ret = dma_buf_stats_setup(dmabuf);
> - if (ret)
> - goto err_sysfs;
> -
> mutex_init(&dmabuf->lock);
> INIT_LIST_HEAD(&dmabuf->attachments);
>
> @@ -554,6 +550,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
> list_add(&dmabuf->list_node, &db_list.head);
> mutex_unlock(&db_list.lock);
>
> + ret = dma_buf_stats_setup(dmabuf);
> + if (ret)
> + goto err_sysfs;
> +
> return dmabuf;
>
> err_sysfs:
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
2022-05-09 21:49 ` T.J. Mercier
@ 2022-05-10 2:43 ` Charan Teja Kalla
-1 siblings, 0 replies; 8+ messages in thread
From: Charan Teja Kalla @ 2022-05-10 2:43 UTC (permalink / raw)
To: T.J. Mercier
Cc: Sumit Semwal, Christian König, Hridya Valsaraju,
daniel.vetter, Greg Kroah-Hartman, linux-media, dri-devel,
linaro-mm-sig, linux-kernel
Hello Mercier,
On 5/10/2022 3:19 AM, T.J. Mercier wrote:
> On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
> <quic_charante@quicinc.com> wrote:
>> From: Charan Teja Reddy <quic_charante@quicinc.com>
>>
>> When dma_buf_stats_setup() fails, it closes the dmabuf file which
>> results into the calling of dma_buf_file_release() where it does
>> list_del(&dmabuf->list_node) with out first adding it to the proper
>> list. This is resulting into panic in the below path:
>> __list_del_entry_valid+0x38/0xac
>> dma_buf_file_release+0x74/0x158
>> __fput+0xf4/0x428
>> ____fput+0x14/0x24
>> task_work_run+0x178/0x24c
>> do_notify_resume+0x194/0x264
>> work_pending+0xc/0x5f0
>>
>> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
>> list.
>>
>> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
>> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
> Tested-by: T.J. Mercier <tjmercier@google.com>
> Acked-by: T.J. Mercier <tjmercier@google.com>
>
Thanks for the Ack. Also Realized that it should have:
Cc: <stable@vger.kernel.org> # 5.15.x+
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
@ 2022-05-10 2:43 ` Charan Teja Kalla
0 siblings, 0 replies; 8+ messages in thread
From: Charan Teja Kalla @ 2022-05-10 2:43 UTC (permalink / raw)
To: T.J. Mercier
Cc: daniel.vetter, linux-kernel, dri-devel, Christian König,
linaro-mm-sig, Greg Kroah-Hartman, Hridya Valsaraju,
Sumit Semwal, linux-media
Hello Mercier,
On 5/10/2022 3:19 AM, T.J. Mercier wrote:
> On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
> <quic_charante@quicinc.com> wrote:
>> From: Charan Teja Reddy <quic_charante@quicinc.com>
>>
>> When dma_buf_stats_setup() fails, it closes the dmabuf file which
>> results into the calling of dma_buf_file_release() where it does
>> list_del(&dmabuf->list_node) with out first adding it to the proper
>> list. This is resulting into panic in the below path:
>> __list_del_entry_valid+0x38/0xac
>> dma_buf_file_release+0x74/0x158
>> __fput+0xf4/0x428
>> ____fput+0x14/0x24
>> task_work_run+0x178/0x24c
>> do_notify_resume+0x194/0x264
>> work_pending+0xc/0x5f0
>>
>> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
>> list.
>>
>> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
>> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
> Tested-by: T.J. Mercier <tjmercier@google.com>
> Acked-by: T.J. Mercier <tjmercier@google.com>
>
Thanks for the Ack. Also Realized that it should have:
Cc: <stable@vger.kernel.org> # 5.15.x+
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
2022-05-10 2:43 ` Charan Teja Kalla
@ 2022-05-10 9:31 ` Christian König
-1 siblings, 0 replies; 8+ messages in thread
From: Christian König @ 2022-05-10 9:31 UTC (permalink / raw)
To: Charan Teja Kalla, T.J. Mercier
Cc: Sumit Semwal, Hridya Valsaraju, daniel.vetter,
Greg Kroah-Hartman, linux-media, dri-devel, linaro-mm-sig,
linux-kernel
Am 10.05.22 um 04:43 schrieb Charan Teja Kalla:
> Hello Mercier,
>
> On 5/10/2022 3:19 AM, T.J. Mercier wrote:
>> On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
>> <quic_charante@quicinc.com> wrote:
>>> From: Charan Teja Reddy <quic_charante@quicinc.com>
>>>
>>> When dma_buf_stats_setup() fails, it closes the dmabuf file which
>>> results into the calling of dma_buf_file_release() where it does
>>> list_del(&dmabuf->list_node) with out first adding it to the proper
>>> list. This is resulting into panic in the below path:
>>> __list_del_entry_valid+0x38/0xac
>>> dma_buf_file_release+0x74/0x158
>>> __fput+0xf4/0x428
>>> ____fput+0x14/0x24
>>> task_work_run+0x178/0x24c
>>> do_notify_resume+0x194/0x264
>>> work_pending+0xc/0x5f0
>>>
>>> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
>>> list.
>>>
>>> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
>>> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
>> Tested-by: T.J. Mercier <tjmercier@google.com>
>> Acked-by: T.J. Mercier <tjmercier@google.com>
>>
> Thanks for the Ack. Also Realized that it should have:
> Cc: <stable@vger.kernel.org> # 5.15.x+
Reviewed and pushed to drm-misc-fixes.
Thanks,
Christian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list
@ 2022-05-10 9:31 ` Christian König
0 siblings, 0 replies; 8+ messages in thread
From: Christian König @ 2022-05-10 9:31 UTC (permalink / raw)
To: Charan Teja Kalla, T.J. Mercier
Cc: daniel.vetter, linux-kernel, dri-devel, linaro-mm-sig,
Greg Kroah-Hartman, Hridya Valsaraju, Sumit Semwal, linux-media
Am 10.05.22 um 04:43 schrieb Charan Teja Kalla:
> Hello Mercier,
>
> On 5/10/2022 3:19 AM, T.J. Mercier wrote:
>> On Mon, May 9, 2022 at 12:50 PM Charan Teja Kalla
>> <quic_charante@quicinc.com> wrote:
>>> From: Charan Teja Reddy <quic_charante@quicinc.com>
>>>
>>> When dma_buf_stats_setup() fails, it closes the dmabuf file which
>>> results into the calling of dma_buf_file_release() where it does
>>> list_del(&dmabuf->list_node) with out first adding it to the proper
>>> list. This is resulting into panic in the below path:
>>> __list_del_entry_valid+0x38/0xac
>>> dma_buf_file_release+0x74/0x158
>>> __fput+0xf4/0x428
>>> ____fput+0x14/0x24
>>> task_work_run+0x178/0x24c
>>> do_notify_resume+0x194/0x264
>>> work_pending+0xc/0x5f0
>>>
>>> Fix it by moving the dma_buf_stats_setup() after dmabuf is added to the
>>> list.
>>>
>>> Fixes: bdb8d06dfefd ("dmabuf: Add the capability to expose DMA-BUF stats in sysfs")
>>> Signed-off-by: Charan Teja Reddy <quic_charante@quicinc.com>
>> Tested-by: T.J. Mercier <tjmercier@google.com>
>> Acked-by: T.J. Mercier <tjmercier@google.com>
>>
> Thanks for the Ack. Also Realized that it should have:
> Cc: <stable@vger.kernel.org> # 5.15.x+
Reviewed and pushed to drm-misc-fixes.
Thanks,
Christian.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-05-10 9:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 19:49 [PATCH] dma-buf: call dma_buf_stats_setup after dmabuf is in valid list Charan Teja Kalla
2022-05-09 19:49 ` Charan Teja Kalla
2022-05-09 21:49 ` T.J. Mercier
2022-05-09 21:49 ` T.J. Mercier
2022-05-10 2:43 ` Charan Teja Kalla
2022-05-10 2:43 ` Charan Teja Kalla
2022-05-10 9:31 ` Christian König
2022-05-10 9:31 ` Christian König
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.