Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2309282pxv; Sat, 26 Jun 2021 16:34:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt33BWcHBRinknJdAr3KpVn065Cf8vYgaSiNJYSCqDCdqw3NnnT/a1Rxo6N9cxFAx2M0E8 X-Received: by 2002:a92:7305:: with SMTP id o5mr12306212ilc.198.1624750463617; Sat, 26 Jun 2021 16:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624750463; cv=none; d=google.com; s=arc-20160816; b=KSH9EPNt0tI5dcD26KrE6q+AlZ9IOBEXzwYJOXK+gVOpgBcsufN2H/SbDsOURZsl55 zxRfvLDC5GgdeB7Hc7ikhkfedfq7cjC0zMW6P+mYCcnN/Mjz3eGmA5v8vA/6RU87JI/o yqxLG3PXTHUgVxF86pOMfU3A/ymIjglfq0XZayTnj6pl9wMAlFsAQ3QDBY9uShThvpho ikv2poSx6UnhaXHqldDT9qzngt8zjEFghuu4Z4yHbUvWqCQRRd2JswotFLTUWd0PBnVK tZU3D3HBKBNlOgOtWVkbTJntIFdwqs49bPHn0KHCsHGHk4iWn6odlCqufKAW0qqJXh22 hUpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Rtn33VQDE4Ukyrbun70EEk1Pb5ycc0BGserXsHp2LhU=; b=Fx+s0puC43b412l0FFgF0CN68oXnyYqIarKolIF4QT6NetPLumOgxzJZoBZElz6nQC 1LJZAmBIKl+pVHG6VdrhdJdntMeh6gE04ajT/9N/k64MQiYHVKWWx/8hEYz2QxPrzgbL nEGOd5+veBj6JXJZ0GT6JNyeZCcZDY9+Q9QzZwlLYxnbOPR80Z1OzGf7GyV8uK7O40YZ UqY1v4pV/Lzdt+jus0lPBPSCZR6ejqUzO1FyQ53Bnxh8XorPhdqWyT8sPwXsN34EFtHl AJqgQ4JbLxC1RnLGHSPx3fB994WtHPJpQoX+3gb4qQI3tz5+fqhqw+xzBP6sEK6G8rmL wivQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si10919732iom.21.2021.06.26.16.34.11; Sat, 26 Jun 2021 16:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbhFZXc4 (ORCPT + 99 others); Sat, 26 Jun 2021 19:32:56 -0400 Received: from fgw20-4.mail.saunalahti.fi ([62.142.5.107]:13793 "EHLO fgw20-4.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbhFZXcz (ORCPT ); Sat, 26 Jun 2021 19:32:55 -0400 Received: from macbook.musicnaut.iki.fi (85-76-11-157-nat.elisa-mobile.fi [85.76.11.157]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id 3ec9cd77-d6d4-11eb-ba24-005056bd6ce9; Sun, 27 Jun 2021 02:14:25 +0300 (EEST) Date: Sun, 27 Jun 2021 02:14:23 +0300 From: Aaro Koskinen To: Pavel Skripkin Cc: gustavoars@kernel.org, sam@ravnborg.org, tomi.valkeinen@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH] OMAP: DSS2: OMAPFB: fix potential GPF Message-ID: <20210626231423.GA38365@macbook.musicnaut.iki.fi> References: <20210625223323.13930-1-paskripkin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210625223323.13930-1-paskripkin@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, Jun 26, 2021 at 01:33:23AM +0300, Pavel Skripkin wrote: > In case of allocation failures, all code paths was jumping > to this code: > > err: > kfree(fbi); > kfree(var); > kfree(fbops); > > return r; > > Since all 3 pointers placed on stack and don't initialized, they > will be filled with some random values, which leads to > deferencing random pointers in kfree(). Fix it by rewriting > error handling path. They are initialized before the first goto: [...] fbi = NULL; var = NULL; fbops = NULL; fbi = kzalloc(sizeof(*fbi), GFP_KERNEL); if (fbi == NULL) { r = -ENOMEM; goto err; } [...] A.