From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rvWMy0LWpzDqQK for ; Wed, 20 Jul 2016 19:10:22 +1000 (AEST) In-Reply-To: <1468567236-5060-1-git-send-email-andrew.donnellan@au1.ibm.com> To: Andrew Donnellan , linuxppc-dev@lists.ozlabs.org, imunsie@au1.ibm.com, clombard@linux.vnet.ibm.com, fbarrat@linux.vnet.ibm.com From: Michael Ellerman Cc: dan.carpenter@oracle.com Subject: Re: cxl: fix potential NULL dereference in free_adapter() Message-Id: <3rvWMx6Pv2z9t17@ozlabs.org> Date: Wed, 20 Jul 2016 19:10:21 +1000 (AEST) List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 2016-15-07 at 07:20:36 UTC, Andrew Donnellan wrote: > If kzalloc() fails when allocating adapter->guest in > cxl_guest_init_adapter(), we call free_adapter() before erroring out. > free_adapter() in turn attempts to dereference adapter->guest, which in > this case is NULL. > > In free_adapter(), skip the adapter->guest cleanup if adapter->guest is > NULL. > > Fixes: 14baf4d9c739 ("cxl: Add guest-specific code") > Reported-by: Dan Carpenter > Signed-off-by: Andrew Donnellan Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/8fbaa51d43ef2c6a72849ec340 cheers