Re: [PATCH v5 4/8] char: rpmb: provide a user space interface

2016-07-20 Thread Paul Gortmaker
[RE: [PATCH v5 4/8] char: rpmb: provide a user space interface] On 20/07/2016 
(Wed 09:02) Winkler, Tomas wrote:

> > 
> > On Mon, Jul 18, 2016 at 4:27 PM, Tomas Winkler 
> > wrote:
> > > The user space API is achieved via two synchronous IOCTL.
> > > Simplified one, RPMB_IOC_REQ_CMD, were read result cycles is
> > performed
> > > by the framework on behalf the user and second, RPMB_IOC_SEQ_CMD
> > where
> > > the whole RPMB sequence including RESULT_READ is supplied by the caller.
> > > The latter is intended for  easier adjusting  of the  applications
> > > that use MMC_IOC_MULTI_CMD ioctl.
> > >
> > > Signed-off-by: Tomas Winkler 
> > > ---
> > 
> > [...]
> > 
> > > diff --git a/drivers/char/rpmb/Kconfig b/drivers/char/rpmb/Kconfig
> > > index c5e6e909efce..6794be9fcc5e 100644
> > > --- a/drivers/char/rpmb/Kconfig
> > > +++ b/drivers/char/rpmb/Kconfig
> > > @@ -6,3 +6,10 @@ config RPMB
> > >   access RPMB partition.
> > >
> > >   If unsure, select N.
> > > +
> > > +config RPMB_INTF_DEV
> > > +   bool "RPMB character device interface /dev/rpmbN"
> > 
> > A bool Kconfig should ideally
> > 
> > > +   depends on RPMB
> > > +   help
> > > + Say yes here if you want to access RPMB from user space
> > > + via character device interface /dev/rpmb%d
> > > diff --git a/drivers/char/rpmb/Makefile b/drivers/char/rpmb/Makefile
> > > index 812b3ed264c0..b5dc087b1299 100644
> > > --- a/drivers/char/rpmb/Makefile
> > > +++ b/drivers/char/rpmb/Makefile
> > > @@ -1,4 +1,5 @@
> > >  obj-$(CONFIG_RPMB) += rpmb.o
> > >  rpmb-objs += core.o
> > > +rpmb-$(CONFIG_RPMB_INTF_DEV) += cdev.o
> 
> This is not a builtin, this is an optional part of the module 

Object files that are not stand-alone, but linked into a larger object
to create a module generally still don't need module.h if they
themselves specifically aren't registering the module or similar.

The exception is a module that doesn't actively do anything but export
symbols (i.e. a library).  Then somewhere in it there needs to be a
MODULE_LICENSE so that the kernel can audit GPL and taint etc.

> 
> > > +#include 
> > 
> > not use module.h or any MODULE_ macros from within it.
> 
> Can be dropped in this case as no macros are used, 
> but the pattern Kconfig bool -> no include module.h  you are following has 
> false positive cases.

Yes, of course there are other things, like the exception table
searches, and symbol_get / symbol_put, macros defining string
lengths, etc... and I try to watch for those via inspection and
build testing. 

However the majority bool->module.h are there for two reasons:

1) in core code we had to use module.h in the past when export.h
   did not exist.

2) in driver code that largely capitalizes on copying from other
   drivers without explicitly considering modularity.

...and it is worth our while to clean both up, I think.

If you can think of specific false positives that I might not be
aware of, please don't hesitate to call them out.

Thanks,
Paul.
--

> 
> Thanks
> Tomas
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 4/8] char: rpmb: provide a user space interface

2016-07-18 Thread Paul Gortmaker
On Mon, Jul 18, 2016 at 4:27 PM, Tomas Winkler  wrote:
> The user space API is achieved via two synchronous IOCTL.
> Simplified one, RPMB_IOC_REQ_CMD, were read result cycles is performed
> by the framework on behalf the user and second, RPMB_IOC_SEQ_CMD where
> the whole RPMB sequence including RESULT_READ is supplied by the caller.
> The latter is intended for  easier adjusting  of the  applications that
> use MMC_IOC_MULTI_CMD ioctl.
>
> Signed-off-by: Tomas Winkler 
> ---

[...]

> diff --git a/drivers/char/rpmb/Kconfig b/drivers/char/rpmb/Kconfig
> index c5e6e909efce..6794be9fcc5e 100644
> --- a/drivers/char/rpmb/Kconfig
> +++ b/drivers/char/rpmb/Kconfig
> @@ -6,3 +6,10 @@ config RPMB
>   access RPMB partition.
>
>   If unsure, select N.
> +
> +config RPMB_INTF_DEV
> +   bool "RPMB character device interface /dev/rpmbN"

A bool Kconfig should ideally

> +   depends on RPMB
> +   help
> + Say yes here if you want to access RPMB from user space
> + via character device interface /dev/rpmb%d
> diff --git a/drivers/char/rpmb/Makefile b/drivers/char/rpmb/Makefile
> index 812b3ed264c0..b5dc087b1299 100644
> --- a/drivers/char/rpmb/Makefile
> +++ b/drivers/char/rpmb/Makefile
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_RPMB) += rpmb.o
>  rpmb-objs += core.o
> +rpmb-$(CONFIG_RPMB_INTF_DEV) += cdev.o
>
>  ccflags-y += -D__CHECK_ENDIAN__
> diff --git a/drivers/char/rpmb/cdev.c b/drivers/char/rpmb/cdev.c
> new file mode 100644
> index ..f3ad3444f76d
> --- /dev/null
> +++ b/drivers/char/rpmb/cdev.c
> @@ -0,0 +1,269 @@
> +/*
> + * Copyright (C) 2015-2016 Intel Corp. All rights reserved
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include 

not use module.h or any MODULE_ macros from within it.

Thanks,
Paul.
--

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "rpmb-cdev.h"
> +
> +static dev_t rpmb_devt;
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] scsi: remove orphaned modular code from non-modular drivers

2016-03-28 Thread Paul Gortmaker
[Re: [PATCH 0/2] scsi: remove orphaned modular code from non-modular drivers] 
On 27/03/2016 (Sun 22:31) James Bottomley wrote:

> On Sun, 2016-03-27 at 13:00 -0400, Paul Gortmaker wrote:
> > In the ongoing audit/cleanup of non-modular code needlessly using 
> > modular infrastructure, the SCSI subsystem fortunately only contains 
> > two instances that I detected.  Both are for legacy drivers that 
> > predate the git epoch, so cleary there is no demand for converting 
> > these drivers to be tristate.
> > 
> > For anyone new to the underlying goal of this cleanup, we are trying 
> > to not use module support for code that isn't buildable as a module
> > since:
> > 
> >  (1) it is easy to accidentally write unused module_exit and remove
> > code
> >  (2) it can be misleading when reading the source, thinking it can be
> >  modular when the Makefile and/or Kconfig prohibit it
> >  (3) it requires the include of the module.h header file which in
> > turn
> >  includes nearly everything else, thus adding to CPP overhead.
> >  (4) it gets copied/replicated into other code and spreads like
> > weeds.
> 
> I don't really buy any of these as being credible issues for the
> ancient drivers, so there doesn't appear to be an real benefit to this
> conversion; however, besides the danger of touching old stuff, there
> are some down sides:

Thanks James for your review and always interesting/alternative
viewpoints.  You seem pretty clear in your conviction here, so I won't
bother making counter points ; best we just agree to disagree, and I
won't bother you with these patches again.

Paul.
--

> 
> > -MODULE_DESCRIPTION("Sun3x ESP SCSI driver");
> > -MODULE_AUTHOR("Thomas Bogendoerfer (tsbog...@alpha.franken.de)");
> > -MODULE_LICENSE("GPL");
> > -MODULE_VERSION(DRV_VERSION);
> 
> These tags are usefully greppable for drivers, regardless of whether
> they generate actual kernel side information.
> 
> > We explicitly disallow a driver unbind, since that doesn't have a
> > sensible use case anyway, and it allows us to drop the ".remove"
> > code for non-modular drivers.
> 
> That's bogus.  I use bind and unbind a lot for testing built in drivers
> but the usual user use case is for resetting the devices.
> 
> > Build tested for mips (jazz) and m68k (sun3x) on 4.6-rc1 to ensure no
> > silly typos crept in.
> 
> For trivial changes, build testing is not really sufficient: a
> significant fraction of them break something that isn't spotted by the
> reviewers.  For the older drivers, this isn't discovered for months to
> years and then someone has to go digging back through all the so called
> trivial changes to find which one it was.
> 
> James
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] drivers/scsi: make jazz_esp.c driver explicitly non-modular

2016-03-27 Thread Paul Gortmaker
The Kconfig for this driver is currently:

config JAZZ_ESP
bool "MIPS JAZZ FAS216 SCSI support

...meaning that it currently is not being built as a module by anyone,
and it has been this way since the beginning of git history (~2005).

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: "James E.J. Bottomley" 
Cc: Thomas Bogendoerfer 
Cc: linux-scsi@vger.kernel.org
Cc: linux-m...@linux-mips.org
Signed-off-by: Paul Gortmaker 
---
 drivers/scsi/jazz_esp.c | 43 ++-
 1 file changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 9aaa74e349cc..4260a0f7e154 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -1,12 +1,13 @@
 /* jazz_esp.c: ESP front-end for MIPS JAZZ systems.
  *
- * Copyright (C) 2007 Thomas Bogendörfer (tsbogend@alpha.frankende)
+ * Copyright (C) 2007 Thomas Bogendörfer (tsbog...@alpha.franken.de)
+ *
+ * License: GPL
  */
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -201,31 +202,11 @@ fail:
return err;
 }
 
-static int esp_jazz_remove(struct platform_device *dev)
-{
-   struct esp *esp = dev_get_drvdata(&dev->dev);
-   unsigned int irq = esp->host->irq;
-
-   scsi_esp_unregister(esp);
-
-   free_irq(irq, esp);
-   dma_free_coherent(esp->dev, 16,
- esp->command_block,
- esp->command_block_dma);
-
-   scsi_host_put(esp->host);
-
-   return 0;
-}
-
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:jazz_esp");
-
 static struct platform_driver esp_jazz_driver = {
.probe  = esp_jazz_probe,
-   .remove = esp_jazz_remove,
.driver = {
-   .name   = "jazz_esp",
+   .name   = "jazz_esp",
+   .suppress_bind_attrs= true,
},
 };
 
@@ -233,16 +214,4 @@ static int __init jazz_esp_init(void)
 {
return platform_driver_register(&esp_jazz_driver);
 }
-
-static void __exit jazz_esp_exit(void)
-{
-   platform_driver_unregister(&esp_jazz_driver);
-}
-
-MODULE_DESCRIPTION("JAZZ ESP SCSI driver");
-MODULE_AUTHOR("Thomas Bogendoerfer (tsbog...@alpha.franken.de)");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-
-module_init(jazz_esp_init);
-module_exit(jazz_esp_exit);
+device_initcall(jazz_esp_init);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] drivers/scsi: make sun3x_esp.c driver explicitly non-modular

2016-03-27 Thread Paul Gortmaker
The Kconfig for this driver is currently:

config SUN3X_ESP
bool "Sun3x ESP SCSI"

...meaning that it currently is not being built as a module by anyone,
and it has been this way since the beginning of git history (~2005).

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: "James E.J. Bottomley" 
Cc: Geert Uytterhoeven 
Cc: linux-scsi@vger.kernel.org
Cc: linux-m...@lists.linux-m68k.org
Signed-off-by: Paul Gortmaker 
---
 drivers/scsi/sun3x_esp.c | 44 +---
 1 file changed, 5 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index d50c5ed8f428..55a02f4331e5 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -1,13 +1,14 @@
 /* sun3x_esp.c: ESP front-end for Sun3x systems.
  *
  * Copyright (C) 2007,2008 Thomas Bogendoerfer (tsbog...@alpha.franken.de)
+ *
+ * License: GPL
  */
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -268,33 +269,11 @@ fail:
return err;
 }
 
-static int esp_sun3x_remove(struct platform_device *dev)
-{
-   struct esp *esp = dev_get_drvdata(&dev->dev);
-   unsigned int irq = esp->host->irq;
-   u32 val;
-
-   scsi_esp_unregister(esp);
-
-   /* Disable interrupts.  */
-   val = dma_read32(DMA_CSR);
-   dma_write32(val & ~DMA_INT_ENAB, DMA_CSR);
-
-   free_irq(irq, esp);
-   dma_free_coherent(esp->dev, 16,
- esp->command_block,
- esp->command_block_dma);
-
-   scsi_host_put(esp->host);
-
-   return 0;
-}
-
 static struct platform_driver esp_sun3x_driver = {
.probe  = esp_sun3x_probe,
-   .remove = esp_sun3x_remove,
.driver = {
-   .name   = "sun3x_esp",
+   .name   = "sun3x_esp",
+   .suppress_bind_attrs= true,
},
 };
 
@@ -302,17 +281,4 @@ static int __init sun3x_esp_init(void)
 {
return platform_driver_register(&esp_sun3x_driver);
 }
-
-static void __exit sun3x_esp_exit(void)
-{
-   platform_driver_unregister(&esp_sun3x_driver);
-}
-
-MODULE_DESCRIPTION("Sun3x ESP SCSI driver");
-MODULE_AUTHOR("Thomas Bogendoerfer (tsbog...@alpha.franken.de)");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-
-module_init(sun3x_esp_init);
-module_exit(sun3x_esp_exit);
-MODULE_ALIAS("platform:sun3x_esp");
+device_initcall(sun3x_esp_init);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] scsi: remove orphaned modular code from non-modular drivers

2016-03-27 Thread Paul Gortmaker
In the ongoing audit/cleanup of non-modular code needlessly using modular
infrastructure, the SCSI subsystem fortunately only contains two instances
that I detected.  Both are for legacy drivers that predate the git epoch,
so cleary there is no demand for converting these drivers to be tristate.

For anyone new to the underlying goal of this cleanup, we are trying to
not use module support for code that isn't buildable as a module since:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding to CPP overhead.
 (4) it gets copied/replicated into other code and spreads like weeds.

Build tested for mips (jazz) and m68k (sun3x) on 4.6-rc1 to ensure no
silly typos crept in.

---

Cc: Geert Uytterhoeven 
Cc: "James E.J. Bottomley" 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@lists.linux-m68k.org
Cc: linux-m...@linux-mips.org
Cc: linux-scsi@vger.kernel.org

Paul Gortmaker (2):
  drivers/scsi: make jazz_esp.c driver explicitly non-modular
  drivers/scsi: make sun3x_esp.c driver explicitly non-modular

 drivers/scsi/jazz_esp.c  | 43 ++-
 drivers/scsi/sun3x_esp.c | 44 +---
 2 files changed, 11 insertions(+), 76 deletions(-)

-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/11] drivers/scsi: include for modular ufshcd-pltfrm code

2015-05-01 Thread Paul Gortmaker
On 15-04-30 10:35 PM, James Bottomley wrote:
> On Thu, 2015-04-30 at 21:47 -0400, Paul Gortmaker wrote:
>> This file is built off of a tristate Kconfig option and also contains
>> modular function calls so it should explicitly include module.h to
>> avoid compile breakage during header shuffles done in the future.
> 
> I don't understand your logic.  The ufs code made a design choice to
> consolidate most headers for the hcd code in a local include (ufshcd.h),
> which includes module.h, so why would they explicitly need it here as
> well?  And if we follow your logic, why wouldn't they also need to
> duplicate everything else (like the scsi includes)?

In my original build testing this file failed to compile once the
modular code was moved from init.h to module.h as per the description
in the 0/11.

Perhaps since that testing something else has changed.  I will drop this
patch and retest and if it no longer fails, then great.

Paul.
--

> 
> James
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[v2.6.34-stable 011/213] block: fail SCSI passthrough ioctls on partition devices

2014-02-05 Thread Paul Gortmaker
From: Paolo Bonzini 

   ---
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
   ---

commit 0bfc96cb77224736dfa35c3c555d37b3646ef35e upstream.

Linux allows executing the SG_IO ioctl on a partition or LVM volume, and
will pass the command to the underlying block device.  This is
well-known, but it is also a large security problem when (via Unix
permissions, ACLs, SELinux or a combination thereof) a program or user
needs to be granted access only to part of the disk.

This patch lets partitions forward a small set of harmless ioctls;
others are logged with printk so that we can see which ioctls are
actually sent.  In my tests only CDROM_GET_CAPABILITY actually occurred.
Of course it was being sent to a (partition on a) hard disk, so it would
have failed with ENOTTY and the patch isn't changing anything in
practice.  Still, I'm treating it specially to avoid spamming the logs.

In principle, this restriction should include programs running with
CAP_SYS_RAWIO.  If for example I let a program access /dev/sda2 and
/dev/sdb, it still should not be able to read/write outside the
boundaries of /dev/sda2 independent of the capabilities.  However, for
now programs with CAP_SYS_RAWIO will still be allowed to send the
ioctls.  Their actions will still be logged.

This patch does not affect the non-libata IDE driver.  That driver
however already tests for bd != bd->bd_contains before issuing some
ioctl; it could be restricted further to forbid these ioctls even for
programs running with CAP_SYS_ADMIN/CAP_SYS_RAWIO.

Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe 
Cc: James Bottomley 
Signed-off-by: Paolo Bonzini 
[ Make it also print the command name when warning - Linus ]
Signed-off-by: Linus Torvalds 
Signed-off-by: Paul Gortmaker 
---
 block/scsi_ioctl.c | 45 +
 drivers/scsi/sd.c  | 11 +--
 include/linux/blkdev.h |  1 +
 3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 57ac93754841..b661f8940ef5 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -691,9 +692,53 @@ int scsi_cmd_ioctl(struct request_queue *q, struct gendisk 
*bd_disk, fmode_t mod
 }
 EXPORT_SYMBOL(scsi_cmd_ioctl);
 
+int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd)
+{
+   if (bd && bd == bd->bd_contains)
+   return 0;
+
+   /* Actually none of these is particularly useful on a partition,
+* but they are safe.
+*/
+   switch (cmd) {
+   case SCSI_IOCTL_GET_IDLUN:
+   case SCSI_IOCTL_GET_BUS_NUMBER:
+   case SCSI_IOCTL_GET_PCI:
+   case SCSI_IOCTL_PROBE_HOST:
+   case SG_GET_VERSION_NUM:
+   case SG_SET_TIMEOUT:
+   case SG_GET_TIMEOUT:
+   case SG_GET_RESERVED_SIZE:
+   case SG_SET_RESERVED_SIZE:
+   case SG_EMULATED_HOST:
+   return 0;
+   case CDROM_GET_CAPABILITY:
+   /* Keep this until we remove the printk below.  udev sends it
+* and we do not want to spam dmesg about it.   CD-ROMs do
+* not have partitions, so we get here only for disks.
+*/
+   return -ENOIOCTLCMD;
+   default:
+   break;
+   }
+
+   /* In particular, rule out all resets and host-specific ioctls.  */
+   printk_ratelimited(KERN_WARNING
+  "%s: sending ioctl %x to a partition!\n", 
current->comm, cmd);
+
+   return capable(CAP_SYS_RAWIO) ? 0 : -ENOIOCTLCMD;
+}
+EXPORT_SYMBOL(scsi_verify_blk_ioctl);
+
 int scsi_cmd_blk_ioctl(struct block_device *bd, fmode_t mode,
   unsigned int cmd, void __user *arg)
 {
+   int ret;
+
+   ret = scsi_verify_blk_ioctl(bd, cmd);
+   if (ret < 0)
+   return ret;
+
return scsi_cmd_ioctl(bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg);
 }
 EXPORT_SYMBOL(scsi_cmd_blk_ioctl);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 654e2674e7c3..1b543a229487 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -886,6 +886,10 @@ static int sd_ioctl(struct block_device *bdev, fmode_t 
mode,
SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n",
disk->disk_name, cmd));
 
+   error = scsi_verify_blk_ioctl(bdev, cmd);
+   if (error < 0)
+   return error;
+
/*
 * If we are in the middle of error recovery, don't let anyone
 * else try and use this device.  Also, if error recovery fails, it
@@ -1065,6 +1069,11 

[v2.6.34-stable 010/213] block: add and use scsi_blk_cmd_ioctl

2014-02-05 Thread Paul Gortmaker
From: Paolo Bonzini 

   ---
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
   ---

commit 577ebb374c78314ac4617242f509e2f5e7156649 upstream.

Introduce a wrapper around scsi_cmd_ioctl that takes a block device.

The function will then be enhanced to detect partition block devices
and, in that case, subject the ioctls to whitelisting.

Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe 
Cc: James Bottomley 
Signed-off-by: Paolo Bonzini 
Signed-off-by: Linus Torvalds 
Signed-off-by: Paul Gortmaker 
---
 block/scsi_ioctl.c | 7 +++
 drivers/block/cciss.c  | 6 +++---
 drivers/block/ub.c | 3 +--
 drivers/block/virtio_blk.c | 4 ++--
 drivers/cdrom/cdrom.c  | 3 +--
 drivers/ide/ide-floppy_ioctl.c | 3 +--
 drivers/scsi/sd.c  | 2 +-
 include/linux/blkdev.h | 2 ++
 8 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 4f4230b79bb6..57ac93754841 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -691,6 +691,13 @@ int scsi_cmd_ioctl(struct request_queue *q, struct gendisk 
*bd_disk, fmode_t mod
 }
 EXPORT_SYMBOL(scsi_cmd_ioctl);
 
+int scsi_cmd_blk_ioctl(struct block_device *bd, fmode_t mode,
+  unsigned int cmd, void __user *arg)
+{
+   return scsi_cmd_ioctl(bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg);
+}
+EXPORT_SYMBOL(scsi_cmd_blk_ioctl);
+
 static int __init blk_scsi_ioctl_init(void)
 {
blk_set_cmd_filter_defaults(&blk_default_cmd_filter);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index eb5ff0531cfb..54bad7584ea4 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1652,7 +1652,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t 
mode,
return status;
}
 
-   /* scsi_cmd_ioctl handles these, below, though some are not */
+   /* scsi_cmd_blk_ioctl handles these, below, though some are not */
/* very meaningful for cciss.  SG_IO is the main one people want. */
 
case SG_GET_VERSION_NUM:
@@ -1663,9 +1663,9 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t 
mode,
case SG_EMULATED_HOST:
case SG_IO:
case SCSI_IOCTL_SEND_COMMAND:
-   return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
+   return scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
 
-   /* scsi_cmd_ioctl would normally handle these, below, but */
+   /* scsi_cmd_blk_ioctl would normally handle these, below, but */
/* they aren't a good fit for cciss, as CD-ROMs are */
/* not supported, and we don't have any bus/target/lun */
/* which we present to the kernel. */
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 0536b5b29adc..1c1533a59c4d 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1727,10 +1727,9 @@ static int ub_bd_release(struct gendisk *disk, fmode_t 
mode)
 static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode,
 unsigned int cmd, unsigned long arg)
 {
-   struct gendisk *disk = bdev->bd_disk;
void __user *usermem = (void __user *) arg;
 
-   return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem);
+   return scsi_cmd_blk_ioctl(bdev, mode, cmd, usermem);
 }
 
 /*
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 2138a7ae050c..4abfa80fdcd6 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -201,8 +201,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t 
mode,
if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
return -ENOTTY;
 
-   return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
- (void __user *)data);
+   return scsi_cmd_blk_ioctl(bdev, mode, cmd,
+ (void __user *)data);
 }
 
 /* We provide getgeo only to please some old bootloader/partitioning tools */
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index e3749d0ba68b..5e7c72d3fe39 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2684,12 +2684,11 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct 
block_device *bdev,
 {
void __user *argp = (void __user *)arg;
int ret;
-   struct gendisk *disk = bdev->bd_disk;
 
/*
 * Try the generic SCSI command ioctl's first.
 */
-   ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
+   ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
if (ret != -ENOTTY)
return ret;
 
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 9c2288234dea..05f024caf4c9 100644
--- a/dri

[PATCH 43/73] scsi: delete non-required instances of include

2014-01-21 Thread Paul Gortmaker
None of these files are actually using any __init type directives
and hence don't need to include .  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Cc: "James E.J. Bottomley" 
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/scsi/aacraid/aachba.c   | 1 -
 drivers/scsi/aacraid/commctrl.c | 1 -
 drivers/scsi/aacraid/comminit.c | 1 -
 drivers/scsi/aacraid/commsup.c  | 1 -
 drivers/scsi/aacraid/dpcsup.c   | 1 -
 drivers/scsi/aacraid/rx.c   | 1 -
 drivers/scsi/aacraid/sa.c   | 1 -
 drivers/scsi/aacraid/src.c  | 1 -
 drivers/scsi/arcmsr/arcmsr_attr.c   | 1 -
 drivers/scsi/arm/msgqueue.c | 1 -
 drivers/scsi/arm/queue.c| 1 -
 drivers/scsi/bnx2fc/bnx2fc.h| 1 -
 drivers/scsi/csiostor/csio_attr.c   | 1 -
 drivers/scsi/fdomain.c  | 1 -
 drivers/scsi/fnic/fnic_scsi.c   | 1 -
 drivers/scsi/hosts.c| 1 -
 drivers/scsi/mpt2sas/mpt2sas_base.c | 1 -
 drivers/scsi/mpt2sas/mpt2sas_config.c   | 1 -
 drivers/scsi/mpt2sas/mpt2sas_ctl.c  | 1 -
 drivers/scsi/mpt2sas/mpt2sas_transport.c| 1 -
 drivers/scsi/mpt3sas/mpt3sas_base.c | 1 -
 drivers/scsi/mpt3sas/mpt3sas_config.c   | 1 -
 drivers/scsi/mpt3sas/mpt3sas_ctl.c  | 1 -
 drivers/scsi/mpt3sas/mpt3sas_transport.c| 1 -
 drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c | 1 -
 drivers/scsi/qla2xxx/qla_def.h  | 1 -
 drivers/scsi/qla4xxx/ql4_def.h  | 1 -
 drivers/scsi/scsi_scan.c| 1 -
 drivers/scsi/scsi_sysfs.c   | 1 -
 drivers/scsi/ufs/ufshcd.h   | 1 -
 drivers/scsi/wd33c93.c  | 1 -
 31 files changed, 31 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 681434e..c0e8b9e 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -25,7 +25,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index fbcd48d..abb98dc5 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -30,7 +30,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 177b094..bbe5077 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -31,7 +31,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index cab190a..e8ed86f 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -31,7 +31,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index d81b281..130939c 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -31,7 +31,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index dada38a..bdda9e8 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -30,7 +30,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 2244f31..585a855 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -30,7 +30,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 7e17107..7afb2b0 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -30,7 +30,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c 
b/drivers/scsi/arcmsr/arcmsr_attr.c
index acdae33..f3978f8 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -46,7 +46,6 @@
 */
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/arm/msgqueue.c b/drivers/scsi/arm/msgqueue.c
index 7c95c75..bcae7f0 100644
--- a/drivers/scsi/arm/msgqueue.c
+++ b/drivers/scsi/arm/msgqueue.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "msgqueue.h"
 
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index cb11cce..7ee1090 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "../scsi.h"
 
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 1ebf3fb..b753030 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -30,7 +30,6 @@
 #inclu

[GIT PULL] delete decade+ obsolete aic7xxx_old driver

2013-11-08 Thread Paul Gortmaker
Hi James,

We've got appropriate acks on this, and we've also established
that it doesn't appear to even be enabled in any of the common
distros, and nobody voiced any strong objections in the past
month+ since posting, so please pull this driver deletion.

Thanks,
Paul.
---

The following changes since commit 272b98c6455f00884f0350f775c5342358ebb73f:

  Linux 3.12-rc1 (2013-09-16 16:17:51 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git aic7xxx-delete

for you to fetch changes up to 1ef2840c7207c8f22d0065d9149bad7dc5e3dca1:

  scsi: delete decade+ obsolete aic7xxx_old driver (2013-09-19 16:07:44 -0400)

----
Paul Gortmaker (1):
  scsi: delete decade+ obsolete aic7xxx_old driver

 Documentation/scsi/00-INDEX | 2 -
 Documentation/scsi/aic7xxx_old.txt  |   511 --
 MAINTAINERS | 1 -
 drivers/scsi/Kconfig|41 -
 drivers/scsi/Makefile   | 1 -
 drivers/scsi/aic7xxx_old.c  | 11149 --
 drivers/scsi/aic7xxx_old/aic7xxx.h  |28 -
 drivers/scsi/aic7xxx_old/aic7xxx.reg|  1401 
 drivers/scsi/aic7xxx_old/aic7xxx.seq|  1539 -
 drivers/scsi/aic7xxx_old/aic7xxx_proc.c |   270 -
 drivers/scsi/aic7xxx_old/aic7xxx_reg.h  |   629 --
 drivers/scsi/aic7xxx_old/aic7xxx_seq.c  |   817 ---
 drivers/scsi/aic7xxx_old/scsi_message.h |49 -
 drivers/scsi/aic7xxx_old/sequencer.h|   135 -
 14 files changed, 16573 deletions(-)
 delete mode 100644 Documentation/scsi/aic7xxx_old.txt
 delete mode 100644 drivers/scsi/aic7xxx_old.c
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.h
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.reg
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.seq
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_proc.c
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_reg.h
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_seq.c
 delete mode 100644 drivers/scsi/aic7xxx_old/scsi_message.h
 delete mode 100644 drivers/scsi/aic7xxx_old/sequencer.h
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: delete decade+ obsolete aic7xxx_old driver

2013-09-17 Thread Paul Gortmaker
[Re: [PATCH] scsi: delete decade+ obsolete aic7xxx_old driver] On 17/09/2013 
(Tue 16:27) Doug Ledford wrote:

> On 09/17/13 16:10, James Bottomley wrote:
> 
> > OK, so do we have any real evidence that no-one uses this driver?  Does
> > any distro actually compile it, for instance?
> 
> Red Hat doesn't use it in any of their products (and it hasn't been the
> preferred driver since about the old Red Hat Linux 7.0 days).

The oldest ubuntu machine I could find was running a 2.6.32 kernel and
even back then, they weren't building/enabling this driver either.

Paul.
--

> 
> 
> -- 
> Doug Ledford 
>   GPG KeyID: 0E572FDD
> http://people.redhat.com/dledford
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: delete decade+ obsolete aic7xxx_old driver

2013-09-17 Thread Paul Gortmaker
On 13-09-17 10:29 AM, Hannes Reinecke wrote:
> On 09/17/2013 04:13 AM, Doug Ledford wrote:
>> Yes, this driver is well past ready to be removed.
>>
>> Acked-by: Doug Ledford 
>>
>> Sent from my ASUS Pad
>>
>> Paul Gortmaker  wrote:
>>
>>> After getting warnings in an allyesconfig build[1] from this
>>> driver, I decided to remind myself just how old it was, and
>>> whether it warranted fixing.  In the Kconfig help text, I found:
>>>
>>>  "This driver will eventually be phased out entirely"
>>>
>>> Going back to the history archive, I see the line was added[2]
>>> in Feb 2002, when we moved from v2.4.2.1 ---> v2.4.2.2
>>>
>>> So, with over a decade of notification, and multiple major releases
>>> since then, I think we can justify removing this.  Currently we have
>>> people wasting time building it during routine testing, and then
>>> wasting more time re-researching the known reported warnings, only to
>>> find that nobody really is willing to integrate the fixes[3] for it.
>>>
>>> A quick search didn't seem to indicate any active user base for it.
>>> If someone happens to have a quirky _old_ card that the eleven year
>>> old "new" driver doesn't work with, then it is entirely reasonable
>>> that they stick with a kernel version that predates this removal.
>>>
>>> [1] drivers/scsi/aic7xxx_old.c: In function ‘aic7xxx_register’:
>>>drivers/scsi/aic7xxx_old.c:7901:5: warning: case value ‘257’ not in 
>>> enumerated type ‘ahc_chip’ [-Wswitch]
>>>drivers/scsi/aic7xxx_old.c:7898:5: warning: case value ‘513’ not in 
>>> enumerated type ‘ahc_chip’ [-Wswitch]
>>>drivers/scsi/aic7xxx_old.c: In function ‘aic7xxx_load_seeprom’:
>>>drivers/scsi/aic7xxx_old.c:8517:5: warning: case value ‘257’ not in 
>>> enumerated type ‘ahc_chip’ [-Wswitch]
>>>drivers/scsi/aic7xxx_old.c:8510:5: warning: case value ‘513’ not in 
>>> enumerated type ‘ahc_chip’ [-Wswitch]
>>>
>>> [2] http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git commit 
>>> 44e8778c
>>>
>>> [3] https://lkml.org/lkml/2012/10/29/215
>>>
>>> Cc: Hannes Reinecke 
>>> Cc: Doug Ledford 
>>> Cc: "James E.J. Bottomley" 
>>> Signed-off-by: Paul Gortmaker 
> 
> However, if we do this we're removing support for any non-PCI based
> adapters. I personally doubt that there are any installations left
> running on (E)ISA or VLB. But we should be clear on this.

Is the Kconfig text for the "new" driver wrong then?  It says:

 -
config SCSI_AIC7XXX
tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
depends on (PCI || EISA) && SCSI
select SCSI_SPI_ATTRS
---help---
This driver supports all of Adaptec's Fast through Ultra 160 PCI
based SCSI controllers as well as the aic7770 based EISA and VLB
SCSI controllers (the 274x and 284x series).
 -

So, as long as you'd enabled either of PCI or EISA, a VLB card should
work too.  (Of course you are correct in doubting that anyone is genuinely
using a 486 VLB system with ~16MB RAM, so it is largely a moot point.)

[I probably could delete that "(New Driver)" text as part of this commit too].

Thanks,
Paul.
--

> 
> In general I'm in favour removing obsolete drivers, so
> 
> Acked-by: Hannes Reinecke 
> 
> Cheers,
> 
> Hannes
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: delete decade+ obsolete aic7xxx_old driver

2013-09-16 Thread Paul Gortmaker
After getting warnings in an allyesconfig build[1] from this
driver, I decided to remind myself just how old it was, and
whether it warranted fixing.  In the Kconfig help text, I found:

  "This driver will eventually be phased out entirely"

Going back to the history archive, I see the line was added[2]
in Feb 2002, when we moved from v2.4.2.1 ---> v2.4.2.2

So, with over a decade of notification, and multiple major releases
since then, I think we can justify removing this.  Currently we have
people wasting time building it during routine testing, and then
wasting more time re-researching the known reported warnings, only to
find that nobody really is willing to integrate the fixes[3] for it.

A quick search didn't seem to indicate any active user base for it.
If someone happens to have a quirky _old_ card that the eleven year
old "new" driver doesn't work with, then it is entirely reasonable
that they stick with a kernel version that predates this removal.

[1] drivers/scsi/aic7xxx_old.c: In function ‘aic7xxx_register’:
drivers/scsi/aic7xxx_old.c:7901:5: warning: case value ‘257’ not in 
enumerated type ‘ahc_chip’ [-Wswitch]
drivers/scsi/aic7xxx_old.c:7898:5: warning: case value ‘513’ not in 
enumerated type ‘ahc_chip’ [-Wswitch]
drivers/scsi/aic7xxx_old.c: In function ‘aic7xxx_load_seeprom’:
drivers/scsi/aic7xxx_old.c:8517:5: warning: case value ‘257’ not in 
enumerated type ‘ahc_chip’ [-Wswitch]
drivers/scsi/aic7xxx_old.c:8510:5: warning: case value ‘513’ not in 
enumerated type ‘ahc_chip’ [-Wswitch]

[2] http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git commit 44e8778c

[3] https://lkml.org/lkml/2012/10/29/215

Cc: Hannes Reinecke 
Cc: Doug Ledford 
Cc: "James E.J. Bottomley" 
Signed-off-by: Paul Gortmaker 
---

[This is an "--irreversible-delete" pseudo-patch which doesn't show all
the file content that was deleted wholesale.  The full commit is at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git aic7xxx-delete ]

 Documentation/scsi/00-INDEX | 2 -
 Documentation/scsi/aic7xxx_old.txt  |   511 --
 MAINTAINERS | 1 -
 drivers/scsi/Kconfig|41 -
 drivers/scsi/Makefile   | 1 -
 drivers/scsi/aic7xxx_old.c  | 11149 --
 drivers/scsi/aic7xxx_old/aic7xxx.h  |28 -
 drivers/scsi/aic7xxx_old/aic7xxx.reg|  1401 
 drivers/scsi/aic7xxx_old/aic7xxx.seq|  1539 -
 drivers/scsi/aic7xxx_old/aic7xxx_proc.c |   270 -
 drivers/scsi/aic7xxx_old/aic7xxx_reg.h  |   629 --
 drivers/scsi/aic7xxx_old/aic7xxx_seq.c  |   817 ---
 drivers/scsi/aic7xxx_old/scsi_message.h |49 -
 drivers/scsi/aic7xxx_old/sequencer.h|   135 -
 14 files changed, 16573 deletions(-)
 delete mode 100644 Documentation/scsi/aic7xxx_old.txt
 delete mode 100644 drivers/scsi/aic7xxx_old.c
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.h
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.reg
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx.seq
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_proc.c
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_reg.h
 delete mode 100644 drivers/scsi/aic7xxx_old/aic7xxx_seq.c
 delete mode 100644 drivers/scsi/aic7xxx_old/scsi_message.h
 delete mode 100644 drivers/scsi/aic7xxx_old/sequencer.h

diff --git a/Documentation/scsi/00-INDEX b/Documentation/scsi/00-INDEX
index 9b0787f..2044be5 100644
--- a/Documentation/scsi/00-INDEX
+++ b/Documentation/scsi/00-INDEX
@@ -42,8 +42,6 @@ aic79xx.txt
- Adaptec Ultra320 SCSI host adapters
 aic7xxx.txt
- info on driver for Adaptec controllers
-aic7xxx_old.txt
-   - info on driver for Adaptec controllers, old generation
 arcmsr_spec.txt
- ARECA FIRMWARE SPEC (for IOP331 adapter)
 dc395x.txt
diff --git a/Documentation/scsi/aic7xxx_old.txt 
b/Documentation/scsi/aic7xxx_old.txt
deleted file mode 100644
index ecfc474..000
diff --git a/MAINTAINERS b/MAINTAINERS
index e61c2e8..c79be42 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -470,7 +470,6 @@ M:  Hannes Reinecke 
 L: linux-scsi@vger.kernel.org
 S: Maintained
 F: drivers/scsi/aic7xxx/
-F: drivers/scsi/aic7xxx_old/
 
 AIMSLAB FM RADIO RECEIVER DRIVER
 M: Hans Verkuil 
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index fe25677..1f02003 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -499,47 +499,6 @@ config SCSI_AACRAID
 
 
 source "drivers/scsi/aic7xxx/Kconfig.aic7xxx"
-
-config SCSI_AIC7XXX_OLD
-   tristate "Adaptec AIC7xxx support (old driver)"
-   depends on (ISA || EISA || PCI ) && SCSI
-   help
- WARNING This driver is an older aic7xxx driver and is no longer
- under active development.  Adaptec, Inc. is writing a new driver to
- take the place of this one, and it is recommended that whenever
- possible,

Re: [PATCH 0/8] csiostor: Chelsio FCoE offload driver submission

2012-08-24 Thread Paul Gortmaker
On Thu, Aug 23, 2012 at 6:27 PM, Naresh Kumar Inna  wrote:
> This is the initial submission of the Chelsio FCoE offload driver (csiostor)
> to the upstream kernel. This driver currently supports FCoE offload
> functionality over Chelsio T4-based 10Gb Converged Network Adapters.
>
> The following patches contain the driver sources for csiostor driver and
> updates to firmware/hardware header files shared between csiostor and
> cxgb4 (Chelsio T4-based NIC driver). The csiostor driver is dependent on these
> header updates. These patches have been generated against scsi 'misc' branch.
>
> csiostor is a low level SCSI driver that interfaces with PCI, SCSI midlayer 
> and
> FC transport subsystems. This driver claims the FCoE PCIe function on the
> Chelsio Converged Network Adapter. It relies on firmware events for slow path
> operations like discovery, thereby offloading session management. The driver
> programs firmware via Work Request interfaces for fast path I/O offload
> features.
>
> Here is the brief description of patches:
> [PATCH 1/8]: Hardware interface, Makefile and Kconfig changes.
> [PATCH 2/8]: Driver initialization and Work Request services.
> [PATCH 3/8]: FC transport interfaces and mailbox services.
> [PATCH 4/8]: Local and remote port state tracking functionality.
> [PATCH 5/8]: Interrupt handling and fast path I/O functionality.
> [PATCH 6/8]: Header files part 1.
> [PATCH 7/8]: Header files part 2.

Based on the above two, I'm guessing nothing will build and work
on any of steps one through six?  Yet you expose the Kconfig
and Makefile linkage into the tree in patch #1?   So your patches
as presented are non bisectable.

You need to rethink your breakup in the presentation.  Factoring
things just by files alone is not the right approach.  You need to
ask yourself whether each commit is a stand-alone entity that does
something independently on its own -- since they generally should.

> [PATCH 8/8]: Updates to header files shared between cxgb4 and csiostor.
>
> Naresh Kumar Inna (8):
>   csiostor: Chelsio FCoE offload driver submission (sources part 1).
>   csiostor: Chelsio FCoE offload driver submission (sources part 2).
>   csiostor: Chelsio FCoE offload driver submission (sources part 3).
>   csiostor: Chelsio FCoE offload driver submission (sources part 4).
>   csiostor: Chelsio FCoE offload driver submission (sources part 5).
>   csiostor: Chelsio FCoE offload driver submission (headers part 1).
>   csiostor: Chelsio FCoE offload driver submission (headers part 2).
>   cxgb4: Chelsio FCoE offload driver submission (cxgb4 common header
> updates).

Something is wrong here.   You offer up semi-informational shortlogs
in your 1st list, but this shows the shortlogs you've used in the actual
commits are largely content-free.

The above are just what I'd happened to notice in reading the 0/8
since I was curious what it was for.  I've not looked at the individual
driver code itself.  It might be worthwhile to go over some of the
suggestions in Documentation/Submit* files though.

Paul.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] panic in scsi_free/sr_scatter_pad

2001-05-28 Thread Paul Gortmaker

I think I recall seeing something reported like this on the list(?):

  sr: ran out of mem for scatter pad
  Kernel panic: scsi_free: bad offset

Regardless, I've seen this on 2.4.5, aha1542, 40MB, mount /dev/scd0 after 
a fresh reboot and spark, pop, fizz, plop...

Seems there is a bug in sr_scatter_pad() associated with ENOMEM handling. 
AFAICT it goes something like this:

- sr_scatter_pad increases use_sg (and sglist_len) 
- scsi_malloc(sglist_len) returns NULL (hence message 1)
- sr_scatter_pad bails out but leaves increased values
- scsi_release_buffers loops on use_sg, calls scsi_free each time. 
- scsi_free gets called with random garbage - hence message 2.  8-)

Restoring the old info back into SCpnt fixes the panic - patch 
follows.  I'll have to read some more to determine why scsi_malloc is
having trouble in handing out ISA DMA mem and causing the 1st message...

Paul.

--- drivers/scsi/sr.c~  Sun May 27 03:53:26 2001
+++ drivers/scsi/sr.c   Tue May 29 01:46:29 2001
@@ -31,6 +31,8 @@
  *  Modified by Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
  *  check resource allocation in sr_init and some cleanups
  *
+ *  Restore SCpnt state if scsi_malloc fails in sr_scatter_pad - Paul G.
+ *
  */
 
 #include 
@@ -263,10 +265,13 @@
 {
struct scatterlist *sg, *old_sg = NULL;
int i, fsize, bsize, sg_ent;
+   unsigned short old_sglist_len;
char *front, *back;
 
back = front = NULL;
sg_ent = SCpnt->use_sg;
+   old_sglist_len = SCpnt->sglist_len;
+   SCpnt->old_use_sg = SCpnt->use_sg;
bsize = 0; /* gcc... */
 
/*
@@ -332,6 +337,8 @@
 
 no_mem:
printk("sr: ran out of mem for scatter pad\n");
+   SCpnt->use_sg = SCpnt->old_use_sg;
+   SCpnt->sglist_len = old_sglist_len;
if (front)
scsi_free(front, fsize);
if (back)


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]