Skip to content

Commit 8da07ee

Browse files
labbottgregkh
authored andcommitted
staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy
commit 45ad559 upstream. Syzbot reported yet another warning with Ion: WARNING: CPU: 0 PID: 1467 at drivers/staging/android/ion/ion.c:122 ion_buffer_destroy+0xd4/0x190 drivers/staging/android/ion/ion.c:122 Kernel panic - not syncing: panic_on_warn set ... This is catching that a buffer was freed with an existing kernel mapping still present. This can be easily be triggered from userspace by calling DMA_BUF_SYNC_START without calling DMA_BUF_SYNC_END. Switch to a single pr_warn_once to indicate the error without being disruptive. Reported-by: syzbot+cd8bcd40cb049efa2770@syzkaller.appspotmail.com Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Laura Abbott <labbott@redhat.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 838b0e9 commit 8da07ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/staging/android/ion

drivers/staging/android/ion/ion.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
192192

193193
void ion_buffer_destroy(struct ion_buffer *buffer)
194194
{
195-
if (WARN_ON(buffer->kmap_cnt > 0))
195+
if (buffer->kmap_cnt > 0) {
196+
pr_warn_once("%s: buffer still mapped in the kernel\n",
197+
__func__);
196198
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
199+
}
197200
buffer->heap->ops->free(buffer);
198201
vfree(buffer->pages);
199202
kfree(buffer);

0 commit comments

Comments
 (0)