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: <OF5B1E9925.8182C1D5-ONC1257B02.004C182F-C1257B02.0053F88F@de.ibm.com>
Date:	Tue, 29 Jan 2013 16:17:01 +0100
From:	Stefan Weinhuber <WEIN@...ibm.com>
To:	Hannes Reinecke <hare@...e.de>
Cc:	Hannes Reinecke <hare@...e.de>, linux-kernel@...r.kernel.org,
	mschwid2@...ux.vnet.ibm.com
Subject: Re: [PATCH 8/9] dasd: Add 'timeout' attribute

Hannes Reinecke <hare@...e.de> wrote on 2013-01-29 08:12:00:
[..]
> +static ssize_t
> +dasd_timeout_store(struct device *dev, struct device_attribute *attr,
> +         const char *buf, size_t count)
> +{
> +   struct dasd_device *device;
> +   struct request_queue *q;
> +   unsigned long val, flags;
> +
> +   device = dasd_device_from_cdev(to_ccwdev(dev));
> +   if (IS_ERR(device))
> +      return -ENODEV;
> +
> +   if ((strict_strtoul(buf, 10, &val) != 0) ||
> +       val > ULONG_MAX / HZ) {
> +      dasd_put_device(device);
> +      return -EINVAL;
> +   }
> +   q = device->block->request_queue;

You need to check device->block before using it.
For alias devices the device->block pointer is NULL, as an alias device
has no fixed association with a block device.

> +   if (!q) {
> +      dasd_put_device(device);
> +      return -ENODEV;
> +   }
> +   spin_lock_irqsave(&device->block->request_queue_lock, flags);
> +   if (!val)
> +      blk_queue_rq_timed_out(q, NULL);
> +   else
> +      blk_queue_rq_timed_out(q, dasd_times_out);
> +
> +   device->blk_timeout = val;
> +
> +   blk_queue_rq_timeout(q, device->blk_timeout * HZ);
> +   spin_unlock_irqrestore(&device->block->request_queue_lock, flags);
> +
> +   dasd_put_device(device);
> +   return count;
> +}
> +
[..]

Mit freundlichen Grüßen / Kind regards
 
Stefan Weinhuber

-- 
Linux for zSeries kernel development
IBM Systems &Technology Group, Systems Software Development / SW Linux für 
zSeries Entwicklung

IBM Deutschland
Schoenaicher Str. 220
71032 Boeblingen
Phone: +49-7031-16-4018
E-Mail: wein@...ibm.com

IBM Deutschland Research & Development GmbH / Vorsitzender des 
Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, 
HRB 243294

--
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