lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ed52141.211c9.18abb0d3396.Coremail.dinghao.liu@zju.edu.cn>
Date:   Fri, 22 Sep 2023 12:01:59 +0800 (GMT+08:00)
From:   dinghao.liu@....edu.cn
To:     "Benjamin Block" <bblock@...ux.ibm.com>
Cc:     "Steffen Maier" <maier@...ux.ibm.com>,
        "Heiko Carstens" <hca@...ux.ibm.com>,
        "Vasily Gorbik" <gor@...ux.ibm.com>,
        "Alexander Gordeev" <agordeev@...ux.ibm.com>,
        "Christian Borntraeger" <borntraeger@...ux.ibm.com>,
        "Sven Schnelle" <svens@...ux.ibm.com>,
        "James Bottomley" <James.Bottomley@...e.de>,
        "Swen Schillig" <swen@...t.ibm.com>, linux-s390@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Mailing List linux-scsi" <linux-scsi@...r.kernel.org>
Subject: Re: Re: [PATCH] scsi: zfcp: Fix a potential double free in
 zfcp_port_enqueue

> On Thu, Sep 21, 2023 at 12:21:02PM +0200, Benjamin Block wrote:
> > Hello Liu Dinghao,
> > 
> > good find.
> 
> Oh, also, please put linux-scsi on the CC list. Patches to zfcp go via
> linux-scsi, not linux-s390.
> 
> > 
> > On Thu, Sep 21, 2023 at 02:39:15PM +0800, Dinghao Liu wrote:
> > > When device_register() fails, zfcp_port_release() will be called
> > > after put_device(). As a result, the zfcp_ccw_adapter_put() after
> > > err_out is redundant because it will be called in the call-back
> > > function zfcp_port_release(). Remove it from this error path.
> > 
> > So the reference on the adapter object is doubly put, which may
> > lead to a premature free of the adapter object itself. Please mention that
> > either in the subject, or description; it makes it easier to see what exactly
> > breaks at a glance.
> > 
> > > 
> > > Fixes: f3450c7b9172 ("[SCSI] zfcp: Replace local reference counting with common kref")
> > > Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
> > > ---
> > >  drivers/s390/scsi/zfcp_aux.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
> > > index df782646e856..489e6239dedf 100644
> > > --- a/drivers/s390/scsi/zfcp_aux.c
> > > +++ b/drivers/s390/scsi/zfcp_aux.c
> > > @@ -552,7 +552,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
> > >  
> > >  	if (device_register(&port->dev)) {
> > >  		put_device(&port->dev);
> > > -		goto err_out;
> > > +		return ERR_PTR(retval);
> > 
> > I'd rather have a new label at the bottom, in front of the return that is
> > already there, and jump to that, instead of a different function exit point.
> > 
> > >  	}
> > >  
> > >  	write_lock_irq(&adapter->port_list_lock);
> > > -- 
> > > 2.17.1
> > > 

Thank you for your advice! I will resend a new patch soon.

Regards,
Dinghao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ