From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED62EC433E1 for ; Sun, 26 Jul 2020 08:57:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCF8F2065C for ; Sun, 26 Jul 2020 08:57:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KKEnX2zy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726846AbgGZI5S (ORCPT ); Sun, 26 Jul 2020 04:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbgGZI5R (ORCPT ); Sun, 26 Jul 2020 04:57:17 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6242C0619D2; Sun, 26 Jul 2020 01:57:16 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id c6so940341pje.1; Sun, 26 Jul 2020 01:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZP6JsF3L+gDvWgHfD54eIIL78/CR3lRmnvV/akntuxo=; b=KKEnX2zyJ6WkI8ZbudaqCNi0gmqCxgGR74WNSBQn1L5ax2cCLiA4yIxbco/HI8MUEe /PWnKwGDsY2c4uH3zi7/nNB2V3aKPytCWS3gguyLYHNVQT1thhG25x7sp1KJBmraHmWh r2sGLen+0xjKZxb2J9K7oQ7IQTnWzz/b9jq+n5oVOF4ZUSMy7sb+cvXakBzJiyN9vdHk 95zej/S8i0suWDfeg2ZLV5uLS4Jra1N01tVcu5BP/zccUYoirpfeAzo0J+39lI9zaKge bTvoPhu6kDIHbJ0suV41LNBb51EIHmjXorPfaKxRbwIbXMp03ES7a/6jD50ayrnFh81h Kerg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZP6JsF3L+gDvWgHfD54eIIL78/CR3lRmnvV/akntuxo=; b=gEW1R0TJyTFrFpqlFeeBAD6okNbiYD39qi8R3du10Eq4dVXyZxDhqKTEFMMtY4qGgg lqFyAwNrUcteg964ky1dUnmU+bkoMtI7nv2B4SzxUovg6g+XW6hLBAmr3W9hqhddL1/9 NAR63ehD+5GaR5IH/WaYzW8SgPYJs2MsPevvEkAJaDhFFYkOWXB7j8bn2FkeaNUkZhNy C/aFzEu13kcl4Lrvn/TssRAdegKNJ5L/AKmJHnffloYPAhOg+bWY1gg8DCdksTxVhyzQ gNyp8hD9uLi2yeMV/+hYPSUQzwyKPNVxZasl2E7xBGFVYpssgbuyDHOujlmTsYkSYibu KueQ== X-Gm-Message-State: AOAM530B7yLRRwVVCRxQpN0J55+qKGhEraSO/ty4QrQzPg0sJ0VMgTME 9g3mQhBTJ++BKagZLhojGVqglMCwd4VfPoCqwW4R43R6 X-Google-Smtp-Source: ABdhPJz/011v164prAx72VNLA4uAtxCJ1iLFgTJpcujNZYr5oVQ2I6rVwrYZrx3eEti8ZKJeynfcAEuaKvMiXDR5oRA= X-Received: by 2002:a17:90a:498b:: with SMTP id d11mr14007458pjh.129.1595753836222; Sun, 26 Jul 2020 01:57:16 -0700 (PDT) MIME-Version: 1.0 References: <20200726052047.9856-1-gaurav1086@gmail.com> In-Reply-To: <20200726052047.9856-1-gaurav1086@gmail.com> From: Andy Shevchenko Date: Sun, 26 Jul 2020 11:57:00 +0300 Message-ID: Subject: Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference To: Gaurav Singh Cc: Bartlomiej Zolnierkiewicz , Arnd Bergmann , Daniel Vetter , Jani Nikula , "open list:FRAMEBUFFER LAYER" , "open list:FRAMEBUFFER LAYER" , open list 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 On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh wrote: > > Function mbxfb_debugfs_remove() accesses fbi->par without NULL check, > hence do the NULL check in the caller mbxfb_remove(). ... > @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev) > > write_reg_dly(SYSRST_RST, SYSRST); > > - mbxfb_debugfs_remove(fbi); > - > if (fbi) { Can you explain how this is NULL on ->remove()? I bet this check is simply redundant. But you have to check and update commit message accordingly. > struct mbxfb_info *mfbi = fbi->par; > > + mbxfb_debugfs_remove(fbi); > unregister_framebuffer(fbi); > if (mfbi) { > if (mfbi->platform_remove) -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Date: Sun, 26 Jul 2020 08:57:00 +0000 Subject: Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference Message-Id: List-Id: References: <20200726052047.9856-1-gaurav1086@gmail.com> In-Reply-To: <20200726052047.9856-1-gaurav1086@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Gaurav Singh Cc: "open list:FRAMEBUFFER LAYER" , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Jani Nikula , Daniel Vetter , open list , "open list:FRAMEBUFFER LAYER" On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh wrote: > > Function mbxfb_debugfs_remove() accesses fbi->par without NULL check, > hence do the NULL check in the caller mbxfb_remove(). ... > @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev) > > write_reg_dly(SYSRST_RST, SYSRST); > > - mbxfb_debugfs_remove(fbi); > - > if (fbi) { Can you explain how this is NULL on ->remove()? I bet this check is simply redundant. But you have to check and update commit message accordingly. > struct mbxfb_info *mfbi = fbi->par; > > + mbxfb_debugfs_remove(fbi); > unregister_framebuffer(fbi); > if (mfbi) { > if (mfbi->platform_remove) -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26A1DC433E4 for ; Sun, 26 Jul 2020 08:57:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C89EA2065C for ; Sun, 26 Jul 2020 08:57:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KKEnX2zy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C89EA2065C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 026776E0EC; Sun, 26 Jul 2020 08:57:18 +0000 (UTC) Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 942596E0EC for ; Sun, 26 Jul 2020 08:57:16 +0000 (UTC) Received: by mail-pl1-x642.google.com with SMTP id m16so6598572pls.5 for ; Sun, 26 Jul 2020 01:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZP6JsF3L+gDvWgHfD54eIIL78/CR3lRmnvV/akntuxo=; b=KKEnX2zyJ6WkI8ZbudaqCNi0gmqCxgGR74WNSBQn1L5ax2cCLiA4yIxbco/HI8MUEe /PWnKwGDsY2c4uH3zi7/nNB2V3aKPytCWS3gguyLYHNVQT1thhG25x7sp1KJBmraHmWh r2sGLen+0xjKZxb2J9K7oQ7IQTnWzz/b9jq+n5oVOF4ZUSMy7sb+cvXakBzJiyN9vdHk 95zej/S8i0suWDfeg2ZLV5uLS4Jra1N01tVcu5BP/zccUYoirpfeAzo0J+39lI9zaKge bTvoPhu6kDIHbJ0suV41LNBb51EIHmjXorPfaKxRbwIbXMp03ES7a/6jD50ayrnFh81h Kerg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZP6JsF3L+gDvWgHfD54eIIL78/CR3lRmnvV/akntuxo=; b=SzYMFTemWmmIZ0unVnGifkwvXWezMDfdf8gfWZQWrwzcXwZPS9fj6a13Tc3mVa94vR yIRA8XzkuVTgAn1ObPhbhwlPrlSA1h8w+cIQdusHhgHCwhPz/JZrOVNA9tIO1JpLoaG3 2o6rjDii0BPsy//d5kQvRceFBb8wQNiO6d0p833KY7q3MyHznEekKVBCW+roX984HSXf 2RAtEyQQim2Jod5IGCgX6Z/5CN99GB8zM3hL+Ebz6Z4+xLMvaGVR23rcHnX9syyEtLz3 lBb3YYihSMEeDNOsE93RYmPfASFBJVVePXRMAfGENhUGe0ZioMJ9RFxbpU2RimNYm+Ho UoMg== X-Gm-Message-State: AOAM533Cj5JiXxmINU1SxDsay4+QfIuUfFDvbrzE1D+x/WQerExh/P0X ue5tmHiNFMlC5tHF2StkIJl3JmkKhtkceoy34nE= X-Google-Smtp-Source: ABdhPJz/011v164prAx72VNLA4uAtxCJ1iLFgTJpcujNZYr5oVQ2I6rVwrYZrx3eEti8ZKJeynfcAEuaKvMiXDR5oRA= X-Received: by 2002:a17:90a:498b:: with SMTP id d11mr14007458pjh.129.1595753836222; Sun, 26 Jul 2020 01:57:16 -0700 (PDT) MIME-Version: 1.0 References: <20200726052047.9856-1-gaurav1086@gmail.com> In-Reply-To: <20200726052047.9856-1-gaurav1086@gmail.com> From: Andy Shevchenko Date: Sun, 26 Jul 2020 11:57:00 +0300 Message-ID: Subject: Re: [PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference To: Gaurav Singh X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:FRAMEBUFFER LAYER" , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Jani Nikula , Daniel Vetter , open list , "open list:FRAMEBUFFER LAYER" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sun, Jul 26, 2020 at 8:26 AM Gaurav Singh wrote: > > Function mbxfb_debugfs_remove() accesses fbi->par without NULL check, > hence do the NULL check in the caller mbxfb_remove(). ... > @@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev) > > write_reg_dly(SYSRST_RST, SYSRST); > > - mbxfb_debugfs_remove(fbi); > - > if (fbi) { Can you explain how this is NULL on ->remove()? I bet this check is simply redundant. But you have to check and update commit message accordingly. > struct mbxfb_info *mfbi = fbi->par; > > + mbxfb_debugfs_remove(fbi); > unregister_framebuffer(fbi); > if (mfbi) { > if (mfbi->platform_remove) -- With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel