Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4859961imm; Mon, 14 May 2018 14:35:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpCJ+lgRkZKe7WWtpMmqB29iHDjzFe1eOHEDQJtvP+Daj9p92hGDwguWyTLIAG2yi22e6Bn X-Received: by 2002:a17:902:1004:: with SMTP id b4-v6mr9930540pla.82.1526333745944; Mon, 14 May 2018 14:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526333745; cv=none; d=google.com; s=arc-20160816; b=QnaiN2M0CMkj2dB6ELuegk0HUMxSvqjtNoiH7cGKRNkc9ptF295TV7SJ5wR6T+KMzi 35MrBi4I+qV2lXGxoxIhwXcOKjZAyR4z9FhQYkWlJkibz73bsh0ewrm0/CH8XA4N8Frb q6XKyy3VTrO4JjgYl5YJX48oc23FlCUWPmK0n8VmDdDbJn8RWMr7tE0kSkfrwJ94qfzz XMcOjpoRQDU/La2/5Bq+PSxVHYw47uu1UN45tRaC4Fbrh64TH45uCqo0wCy8TrOQNR8h bA7sI9b114k7ViK0eFoEDELa18S47DJw5gHhCwRNaHZwCC6cMgYMkBRcQ7sY8R9Qxzaj joUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vKeY3/AzXL+G/TBZKlrluP+CIdsouEotWnxhBYbK8b8=; b=oyvEyV3ksPlzLnfg5myhCRMQJJpofFYHBnXXPuKFWbyUCVJMNnStuGaSgtnH73uVUW pi/Sb23Ft3dDfZhAkx99rTzgcOATSbU+g6wLcuLdHxuzaiYGOZzCbSYyBII5bY5hVZvd hI13YazjoD+LCnealWwfWtNBOarfqXJbjDFrdgRWNmmuu1N+131E/LFhBWOXspnqrKfy l/i/mteE8Z99zNGG4TqvnrVCkcsFgK9Zd4bCH9YrzMPlbG6o8vrnjS4HAC4Jccshdh3t AMvxNSOU9Alkqq9DAsbu9C2cyAE2gHdo26ASjaAV0To/s5RyG5uZL8hf1zJh70GqYbMf fsqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14-v6si8258385pgs.178.2018.05.14.14.35.31; Mon, 14 May 2018 14:35:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752159AbeENVfX (ORCPT + 99 others); Mon, 14 May 2018 17:35:23 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:41307 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752009AbeENVfW (ORCPT ); Mon, 14 May 2018 17:35:22 -0400 Received: by mail-oi0-f65.google.com with SMTP id 11-v6so12072479ois.8 for ; Mon, 14 May 2018 14:35:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vKeY3/AzXL+G/TBZKlrluP+CIdsouEotWnxhBYbK8b8=; b=IO9N+k4+heVJejpHoojx1PXEmhlWmjkN79Plq+QMB9BmdQ5jMO4K9aEx2NTn7KT5I4 QrNwk+pltgylmlnxWSzCRr/m0QYHsL2eGgMYFWODModDVIrIGcxO4RqG8PDhRDlWoxC1 XjjxBdqwCfOSg+S5iC6kBVj1Cok+TeG9juuJ8mW0lzXh23wIsKHm4obQCd+v7gze07VV dsHfTwA7FzRt13rV/ThWiOcAQ1KmB8XT8FVuo8dApsmOgjq4dADZHHDlDVf4u/nDkcMk Z7Wbc770BTBznmmHSPRyHTKV2k6z2UppZU2XllPWlWfXGai2u+ISfrMsqg/DHUcxetsK vv0Q== X-Gm-Message-State: ALKqPwesrr2asRh7kDT5VXPrHn9XEo6vN0NWQaRSE6FxVGsLgcCqPVl4 mzd/vLp/G9IKxON1TjErt6TyEg== X-Received: by 2002:aca:538b:: with SMTP id h133-v6mr7867978oib.252.1526333721879; Mon, 14 May 2018 14:35:21 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::d2dd]) by smtp.gmail.com with ESMTPSA id 14-v6sm6282293oth.15.2018.05.14.14.35.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 14:35:20 -0700 (PDT) From: Laura Abbott To: Greg KH , Sumit Semwal Cc: Laura Abbott , devel@driverdev.osuosl.org, LKML , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen Subject: [PATCH] staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Date: Mon, 14 May 2018 14:35:09 -0700 Message-Id: <20180514213509.25171-1-labbott@redhat.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index e74db7902549..a68329411b29 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -114,8 +114,11 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, void ion_buffer_destroy(struct ion_buffer *buffer) { - if (WARN_ON(buffer->kmap_cnt > 0)) + if (buffer->kmap_cnt > 0) { + pr_warn_once("%s: buffer still mapped in the kernel\n", + __func__); buffer->heap->ops->unmap_kernel(buffer->heap, buffer); + } buffer->heap->ops->free(buffer); kfree(buffer); } -- 2.17.0