Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3311659imu; Sun, 11 Nov 2018 12:07:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dPWY2meS9YwVbKnbroRAY9Vxd5GFlRBvEjZoQZ9ntqqv3ZANiYO1H+Ji0k63sQPyMneLKT X-Received: by 2002:a62:3406:: with SMTP id b6-v6mr17513090pfa.50.1541966871347; Sun, 11 Nov 2018 12:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966871; cv=none; d=google.com; s=arc-20160816; b=RJBdCoo8oKOwyjzopQ8wdImY7g/kk9jY26qU6hHDY1+g0O1oKXjQ9odHS9mzqksbGL iODtdlu4eUJ+tnJDnyQiNvHo5cK2pLinttag86BENVafVOsMiEqJp+SRR5KclSKNgqo9 jqTOfyYga43YX7iJRPkwnGEVWYvTPVL8R8i7NqG3AY6pFAvW9/XsqXA+c1BSBpmdWv3b kZQQ7rbm6JIB9w5zMyBCA98iTJl8Veker/jcvQRJ+QfseClwHb391ksSIU1mMWxBJxEH rr6LubNVHViMs4XtR1/BbOjU2AYPilO1DtiNfQ1kwxWXdDOKDjEycqM8xlaMsR6vCKKi smnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=i6WXWCV2K4wC/QX9OLoMFeDQgtqceo9OhF/KUwra0jw=; b=p0XxiCfltKn9Ui+8gYeTA5MhtQyhcqYeaTJe3PeWTil1JUI/po3tKUzDpyQsis1zf8 mcBl/SodgjX6Zh3QZVvu4jC99t9ui7tCe7nIASdAxDbpwNgZSIFa4ggYFZwWLfR5pROE +a94PErtblhRd1y4KuAxXszzuC9OUQtkkolDKSynDY7FuxWZuRFIS+o4yM0kkZpvkbbB S2FaFou2tB1yBnJWZqDPgKITMuk/W+Q6QJguag7uBAo+q9flMRRCdB/gUEyCg4Jk9Sh/ i0Mw6vfDZtkgFQf3EohyUqcEWLep89kCFaTtxADraUBhUeMIvWfTvB7J8L7XwSB/UGqI OXag== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e33-v6si15713681pld.314.2018.11.11.12.07.36; Sun, 11 Nov 2018 12:07:51 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731438AbeKLF4i (ORCPT + 99 others); Mon, 12 Nov 2018 00:56:38 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52080 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbeKLF4i (ORCPT ); Mon, 12 Nov 2018 00:56:38 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvtB-0000l9-3S; Sun, 11 Nov 2018 19:59:21 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsP-0001QN-3M; Sun, 11 Nov 2018 19:58:33 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, syzbot+cd8bcd40cb049efa2770@syzkaller.appspotmail.com, "Laura Abbott" , "syzbot" , "Greg Kroah-Hartman" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 054/366] staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Laura Abbott commit 45ad559a29629cb1c64ee636563c69b71524f077 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 Signed-off-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/staging/android/ion/ion.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -272,8 +272,11 @@ err2: 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->unmap_dma(buffer->heap, buffer); buffer->heap->ops->free(buffer); if (buffer->pages)