From patchwork Mon Jan 25 14:29:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 8109071 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B8BDB9F1CC for ; Mon, 25 Jan 2016 14:30:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2915F202B8 for ; Mon, 25 Jan 2016 14:30:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2FB520272 for ; Mon, 25 Jan 2016 14:30:55 +0000 (UTC) Received: from localhost ([::1]:38931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAR-00076h-9U for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Jan 2016 09:30:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAE-00076H-Ve for qemu-devel@nongnu.org; Mon, 25 Jan 2016 09:30:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNiAA-0003rv-VR for qemu-devel@nongnu.org; Mon, 25 Jan 2016 09:30:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAA-0003rp-PZ for qemu-devel@nongnu.org; Mon, 25 Jan 2016 09:30:38 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id B1D836365B; Mon, 25 Jan 2016 14:30:37 +0000 (UTC) Received: from javelin.localdomain (vpn-226-71.phx2.redhat.com [10.3.226.71]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0PEUVZ0029930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Jan 2016 09:30:34 -0500 From: P J P To: QEMU Developers Date: Mon, 25 Jan 2016 19:59:50 +0530 Message-Id: <1453732190-13416-1-git-send-email-ppandit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Paolo Bonzini , Prasad J Pandit , Donghai Zdh Subject: [Qemu-devel] [PATCH for v2.4.1] exec: fix a glitch in checking dma r/w access X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prasad J Pandit While checking r/w access in 'memory_access_is_direct' routine a glitch in the expression leads to segmentation fault while performing dma read operation. Reported-by: Donghai Zdh Signed-off-by: Prasad J Pandit --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 0a4a0c5..98d97d3 100644 --- a/exec.c +++ b/exec.c @@ -375,7 +375,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write) { if (memory_region_is_ram(mr)) { - return !(is_write && mr->readonly); + return (is_write && !mr->readonly); } if (memory_region_is_romd(mr)) { return !is_write;