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]
Date:	Sun, 4 Jul 2010 09:30:50 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Jens Axboe <axboe@...nel.dk>,
	Christoph Hellwig <hch@...radead.org>,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	John Kacur <jkacur@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	linux-scsi@...r.kernel.org
Subject: Re: [PATCH 1/6] block: push down BKL into .locked_ioctl

> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index 8a549db..1f70aec 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -57,6 +57,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/miscdevice.h>
>  #include <linux/freezer.h>
> +#include <linux/smp_lock.h>
>  #include <linux/mutex.h>
>  #include <linux/slab.h>
>  #include <scsi/scsi_cmnd.h>
> @@ -2762,10 +2763,12 @@ out_mem:
>  static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)
>  {
>  	struct pktcdvd_device *pd = bdev->bd_disk->private_data;
> +	int ret;
>  
>  	VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd,
>  		MAJOR(bdev->bd_dev), MINOR(bdev->bd_dev));
>  
> +	lock_kernel();
>  	switch (cmd) {
>  	case CDROMEJECT:
>  		/*
> @@ -2783,12 +2786,14 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
>  	case CDROM_LAST_WRITTEN:
>  	case CDROM_SEND_PACKET:
>  	case SCSI_IOCTL_SEND_COMMAND:
> -		return __blkdev_driver_ioctl(pd->bdev, mode, cmd, arg);
> +		ret = __blkdev_driver_ioctl(pd->bdev, mode, cmd, arg);
> +		break;
>  
>  	default:
>  		VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd);
> -		return -ENOTTY;
> +		ret = -ENOTTY;
>  	}
> +	unlock_kernel();
>  
>  	return 0;
>  }
You are loosing the return result here in the two error situations above.
Initialise ret to 0 and return ret seems the easy way to do it.

The rest looked ok - I only looked at the patches.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ