From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754825AbbIHNfJ (ORCPT ); Tue, 8 Sep 2015 09:35:09 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36358 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754553AbbIHNfG (ORCPT ); Tue, 8 Sep 2015 09:35:06 -0400 Date: Tue, 8 Sep 2015 22:35:49 +0900 From: Minchan Kim To: Luis Henriques Cc: Nitin Gupta , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH v3] zram: fix possible use after free in zcomp_create() Message-ID: <20150908133548.GB2174@bbox> References: <20150908013429.GC19776@bbox> <1441705168-14682-1-git-send-email-luis.henriques@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441705168-14682-1-git-send-email-luis.henriques@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2015 at 10:39:28AM +0100, Luis Henriques wrote: > zcomp_create() verifies the success of zcomp_strm_{multi,siggle}_create() > through comp->stream, which can potentially be pointing to memory that was > freed if these functions returned an error. > > While at it, replace a 'ERR_PTR(-ENOMEM)' by a more generic > 'ERR_PTR(error)' as in the future zcomp_strm_{multi,siggle}_create() could > return other error codes. Function documentation updated accordingly. > > Fixes: beca3ec71fe5 ("zram: add multi stream functionality") > Cc: stable@vger.kernel.org > Cc: Sergey Senozhatsky > Cc: Minchan Kim > Signed-off-by: Luis Henriques Acked-by: Minchan Kim Thanks for the fix!