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] [thread-next>] [day] [month] [year] [list]
Message-ID: <7493b7a289729ebdf20c50c181676e62780dff63.camel@linux.ibm.com>
Date: Wed, 26 Jun 2024 16:26:35 +0200
From: Niklas Schnelle <schnelle@...ux.ibm.com>
To: Gerd Bayer <gbayer@...ux.ibm.com>, Ma Ke <make24@...as.ac.cn>,
        wintera@...ux.ibm.com, twinkler@...ux.ibm.com,
        Wenjia Zhang
 <wenjia@...ux.ibm.com>
Cc: linux-s390@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, hca@...ux.ibm.com, gor@...ux.ibm.com,
        agordeev@...ux.ibm.com, borntraeger@...ux.ibm.com, svens@...ux.ibm.com,
        davem@...emloft.net, Stefan Raspl <raspl@...ux.ibm.com>
Subject: Re: [PATCH] s390/ism: Add check for dma_set_max_seg_size in
 ism_probe()

On Wed, 2024-06-26 at 14:48 +0200, Gerd Bayer wrote:
> Hi Ma Ke,
> 
> On Wed, 2024-06-26 at 16:12 +0800, Ma Ke wrote:
> > As the possible failure of the dma_set_max_seg_size(), we should
> > better check the return value of the dma_set_max_seg_size().
> 
> I think formally you're correct. dma_set_max_seg_size() could return an
> error if dev->dma_parms was not present.
> 
> However, since ISM devices are PCI attached (and will remain PCI
> attached I believe) we can take the existance of dev->dma_parms for
> granted since pci_device_add() (in drivers/pci/probe.c) will make that
> point to the pci_dev's dma_parms for every PCI device.
> 
> So I'm not sure how important this fix is.

I agree this doesn't look like an issue we're likely to encounter. That
said if for some reason dma_set_max_seg_size() or common PCI code is
changed and it starts failing it's good to have it handled.

This  line has also only been dma_set_max_seg_size() since commit
b0da3498c587 ("PCI: Remove pci_set_dma_max_seg_size()"). Since this
patch won't apply for anything older I would prefer to cite that as the
fixed commit.

> 
> > Fixes: 684b89bc39ce ("s390/ism: add device driver for internal shared
> > memory")
> > Signed-off-by: Ma Ke <make24@...as.ac.cn>
> > ---
> >  drivers/s390/net/ism_drv.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> > index e36e3ea165d3..9ddd093a0368 100644
> > --- a/drivers/s390/net/ism_drv.c
> > +++ b/drivers/s390/net/ism_drv.c
> > @@ -620,7 +620,9 @@ static int ism_probe(struct pci_dev *pdev, const
> > struct pci_device_id *id)
> >  		goto err_resource;
                ^ see here

> >  
> >  	dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
> > -	dma_set_max_seg_size(&pdev->dev, SZ_1M);
> > +	ret = dma_set_max_seg_size(&pdev->dev, SZ_1M);
> > +	if (ret)
> > +		return ret;

Simply returning here would leak the resources. Just like the error
condition I marked above this would need to be goto err_resource.

> >  	pci_set_master(pdev);
> >  
> >  	ret = ism_dev_init(ism);
> 
> BTW, I've dropped ubraun@...ux.ibm.com and sebott@...ux.ibm.com as
> their emails won't work any longer, anyhow. Instead I've added Niklas
> Schnelle, Wenjia Zhang and Stefan Raspl.
> 
> Thanks, Gerd
> 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ