Received: by 10.213.65.68 with SMTP id h4csp240694imn; Fri, 23 Mar 2018 03:41:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELuOpD9dwMyz9+pWlDJfcUp5ysDhShssuWJWADvJ/BtRdUw3C8dbqAyZlM4zjvP3UYFcEvG1 X-Received: by 10.99.96.19 with SMTP id u19mr20089962pgb.261.1521801707847; Fri, 23 Mar 2018 03:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521801707; cv=none; d=google.com; s=arc-20160816; b=a+RQYon14rw6sObBMmHeeeFV1qc9GvwkqoTd84ZEcB+tRXv8swerYpM/RRRdnKSgfV k+9aNo0ykMFu63u2qWZmqpTt7ryEXgMypjWieXPaQwNxdzW23XLkbmKP3POdhD/mtQfx lhktpsaYY2NMWIcJ3Q5OQi/OrNkuxuVNi54zfLZuJLLUx/pXpgcy+3HG0EwErRRPVfat cR9OblIYr6y2HjY/CJ3CqJOQQpdKwYw0GKmjjhOkMP8fsG4CgFDPvpxTW1HGphhrH96U HbyLpINrqFiXxR3P0EUE049vB6bDXBCGGbXiX5KUCMbnYZtA+jto06v3JwQ8WRSQ51c3 Jf8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+MmaYh1t6E6UbQvLfCMRqr6gnAs7AfcxDzIPzS8u080=; b=gpVrKrLnrgwgkMaX/YqhemNDvd7xKBzhAg8k+FFFyH+TbXa8hII7oryLDGFMpR4vO1 i13B1bQt/LyYGh6gCbtLBulJBUa54Kabof2N8alSIoyJ0izILT4QKpM4cbu+rcLJPg4Z q2RrkRqQGF5Hgo9H5oFYvNK9Nso/UX/gynbssQt7iAwpSOBfzPA/upfk185qLBj9go1o duXa94xA6lWfDqrgWAV7C6toXG68t6VYJZp2iNXaAiWt4xLV73DaRkDYBMNrq4cFPlyX MRz7mPqht9mEU+Fw1SNiNFSng+xbfBW7+CugLQUOgQ9SBN49JKCXFhO/QDYZXoywK67e Rexw== 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 s18si5823253pgv.779.2018.03.23.03.41.33; Fri, 23 Mar 2018 03:41:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756417AbeCWKko (ORCPT + 99 others); Fri, 23 Mar 2018 06:40:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46774 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933672AbeCWKQi (ORCPT ); Fri, 23 Mar 2018 06:16:38 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 06773CE1; Fri, 23 Mar 2018 10:16:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Tomi Valkeinen , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH 4.4 67/97] sm501fb: dont return zero on failure path in sm501fb_start() Date: Fri, 23 Mar 2018 10:54:54 +0100 Message-Id: <20180323094201.386632950@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Khoroshilov [ Upstream commit dc85e9a87420613b3129d5cc5ecd79c58351c546 ] If fbmem iomemory mapping failed, sm501fb_start() breaks off initialization, deallocates resources, but returns zero. As a result, double deallocation can happen in sm501fb_stop(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Cc: Tomi Valkeinen Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/sm501fb.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -1600,6 +1600,7 @@ static int sm501fb_start(struct sm501fb_ info->fbmem = ioremap(res->start, resource_size(res)); if (info->fbmem == NULL) { dev_err(dev, "cannot remap framebuffer\n"); + ret = -ENXIO; goto err_mem_res; }