Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7680744ybi; Thu, 1 Aug 2019 12:01:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3c9++qv4ymm+7YorW9apBjmZiQrCs20iKp5691aIFhieG+996nYKtteKy1Oic7Y6x0+39 X-Received: by 2002:a63:b904:: with SMTP id z4mr118203053pge.388.1564686101484; Thu, 01 Aug 2019 12:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564686101; cv=none; d=google.com; s=arc-20160816; b=yL6nX/iCUd4puMyxQbPkClIQOIjuI/RuRh2mxzbyyQrunnUDJZ6EDJulqtSZKsM0xS seQM3SD0ojaz69Z9n+U8MuHuV9srpeVMTG0dTKQlMWqEN6SmfMasiBnjzFWh1IKL0JIn zp+Qt+NcUi79khVZrYf81nymCKpH0S2jINhCQ9kRISGoh6RqmA27E3E6lzeQzFY32lYB AtfbywgDB8l/FsOXoxbpJhyCYDPk48Cysq274g/MsSdmULBWRWcUj2x8eMN3FTxxE1C6 1QHCBbhhUMfdYvEF+HcnuaUIkfSv/2z7IkUNE/ahATV7Bg9rxFJycvFIXucdZCK9O+P+ /Y5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XLDUQPAarNvEYMITiXzpnSJXfvDRcc50bI5EKnKqsKE=; b=bLa3OZJyARrjgMWSkszusSf6Se0yWeLmhxtjIHNR+tUouh6j7OUxgZq0LCvz3XPV8D CAosfrw+7e3yXCmFUUd6xhC+RGLXWRpEg9jHoMd5jc6XKWxfq9TeSexXxACbTEUSbvB8 kgzzRZsjXhtzYbI0zP2wOYQIi/fu7OKCznCUd0HWntGnNHTWjUa1FOwZayY/7TUQpgXa 3Gl9YRDKfA9RzkU3CEN/MPOjrMpRfzZBdDrsVti9HRD5gl4fWBFldE7B+jAZev51z8kH BnvcUYbD+IchIr0llrUjEsR0qoSEQm/eiWOBOUzIXOK+RWgO2ALNNsI6OL8PCOtRnB3r RG0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XsPY4rhI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n184si8314342pgn.399.2019.08.01.12.01.25; Thu, 01 Aug 2019 12:01:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XsPY4rhI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388005AbfHASzz (ORCPT + 99 others); Thu, 1 Aug 2019 14:55:55 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35725 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfHASzz (ORCPT ); Thu, 1 Aug 2019 14:55:55 -0400 Received: by mail-wr1-f68.google.com with SMTP id y4so74699270wrm.2 for ; Thu, 01 Aug 2019 11:55:54 -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=XLDUQPAarNvEYMITiXzpnSJXfvDRcc50bI5EKnKqsKE=; b=XsPY4rhIKCMCCnMcZl4ZRgfWcK6xBMvhuMPwKm52SbUJaJ2LapPlJ4rLIiow9EBzA5 +3JRFt03n5pxTjmeQ7VITCykdIyRhoUS7bp/kdfGgaetzICsmM5lbYXxH1+NWh0SaxF6 Bneth6+76bmNSliwf12qh1/YBzn6Lt9lGX17tq5SBbAz/vmpgYnAcDBb75LbXUQrHipv d7p/LGOwG4Fh0lXI+sGZXsEeuWqn/iCPqnTwYjn88wCEWxG48WOImtGggUDYRzm9gE+j qFCvzrKIKuloglZC5gCNj5SgUJPX9Lkm2mLHdDf34oX8wC9ulAO8tWc/eu/6xiG6Ph+L vwow== 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=XLDUQPAarNvEYMITiXzpnSJXfvDRcc50bI5EKnKqsKE=; b=nh38pqy5Reu9jJ2xOSPIT3lRYmMli3a6a8s55V9lyM6y6fuFs5H9xNCtCOXTIrkgL5 +pQm9L/yVNKG7DxDjcdXOUoC9itIyncFwVZEQH3xZSBqWAVnnPClNL08BYRlXFCrf5by JKMONHePN42WhbI0Yt48hfOwhUiM7Dq4twewAl2orUE1GuakSaQvfbXCG0LMQ4Ob4UVv zEv7WiSd55zHF/Van2Yqjdz9rLWvsNHMZGULsiM0OgH/iREX5vQiburqPc8f/z5lPHjT FwOYdgerOPj/asceoQ/N/9ctb1YsTkLvb9kbkjNd4Ip1En5zjksAavWTMX/ej9cuq71H /liQ== X-Gm-Message-State: APjAAAXdRVqabJHwi1ipH4soo10cChdthhnjeqywTaUJvynNLgoHk4gG pf8kEgIzaPPIn500+5bendIbEITLHSc5XSE9zg0= X-Received: by 2002:adf:a299:: with SMTP id s25mr134452086wra.74.1564685753415; Thu, 01 Aug 2019 11:55:53 -0700 (PDT) MIME-Version: 1.0 References: <20190729083644.29160-1-baijiaju1990@gmail.com> In-Reply-To: <20190729083644.29160-1-baijiaju1990@gmail.com> From: Alex Deucher Date: Thu, 1 Aug 2019 14:55:42 -0400 Message-ID: Subject: Re: [PATCH] gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property() To: Jia-Ju Bai Cc: "Deucher, Alexander" , Christian Koenig , Chunming Zhou , Dave Airlie , Daniel Vetter , Maling list - DRI developers , amd-gfx list , LKML 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 Mon, Jul 29, 2019 at 11:08 AM Jia-Ju Bai wrote: > > In radeon_connector_set_property(), there is an if statement on line 743 > to check whether connector->encoder is NULL: > if (connector->encoder) > > When connector->encoder is NULL, it is used on line 755: > if (connector->encoder->crtc) > > Thus, a possible null-pointer dereference may occur. > > To fix this bug, connector->encoder is checked before being used. > > This bug is found by a static analysis tool STCheck written by us. I believe we always have an encoder for every connector, but never hurts to be safe. Thanks. Applied. Alex > > Signed-off-by: Jia-Ju Bai > --- > drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c > index c60d1a44d22a..b684cd719612 100644 > --- a/drivers/gpu/drm/radeon/radeon_connectors.c > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c > @@ -752,7 +752,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct > > radeon_encoder->output_csc = val; > > - if (connector->encoder->crtc) { > + if (connector->encoder && connector->encoder->crtc) { > struct drm_crtc *crtc = connector->encoder->crtc; > struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); > > -- > 2.17.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx