Re: 2.6.5-rc1 SCSI + st regressions (was: Linux 2.6.5-rc1)

From: Greg KH
Date: Wed Mar 17 2004 - 17:57:11 EST


On Thu, Mar 18, 2004 at 12:25:08AM +0200, Kai Makisara wrote:
> On Wed, 17 Mar 2004, Mike Anderson wrote:
>
> > Kai Makisara [Kai.Makisara@xxxxxxxxxxx] wrote:
> > > if (!st_class_member) {
> > > printk(KERN_WARNING "st%d: class_simple_device_add failed\n",
> > > dev_num);
> >
> > Could you change the if check to use IS_ERR(st_class_member) so in the
> > future if do_create_class_files return -E* we will not get a oops.
> >
> A revised patch is at the end of this message. Thanks for pointing out
> this bug.

Yeah, this is a much better fix. Sorry to cause all of this trouble, I
should have checked to see if anyone used the kobject's name of the cdev
structure anywhere before taking that assignement out.

Andrew, this is a better fix than the one that you and Jon came up with
earlier today.

thanks,

greg k-h

> --------------------------------8<----------------------------------------------
> --- linux-2.6.5-rc1-bk2/drivers/scsi/st.c 2004-03-17 22:37:11.000000000 +0200
> +++ linux-2.6.5-rc1-bk2-k1/drivers/scsi/st.c 2004-03-18 00:09:07.000000000 +0200
> @@ -17,7 +17,7 @@
> Last modified: 18-JAN-1998 Richard Gooch <rgooch@xxxxxxxxxxxxx> Devfs support
> */
>
> -static char *verstr = "20040226";
> +static char *verstr = "20040318";
>
> #include <linux/module.h>
>
> @@ -4193,20 +4193,25 @@
>
> static void do_create_class_files(Scsi_Tape *STp, int dev_num, int mode)
> {
> - int rew, error;
> + int i, rew, error;
> + char name[10];
> struct class_device *st_class_member;
>
> if (!st_sysfs_class)
> return;
>
> for (rew=0; rew < 2; rew++) {
> + /* Make sure that the minor numbers corresponding to the four
> + first modes always get the same names */
> + i = mode << (4 - ST_NBR_MODE_BITS);
> + snprintf(name, 10, "%s%s%s", rew ? "n" : "",
> + STp->disk->disk_name, st_formats[i]);
> st_class_member =
> class_simple_device_add(st_sysfs_class,
> MKDEV(SCSI_TAPE_MAJOR,
> TAPE_MINOR(dev_num, mode, rew)),
> - &STp->device->sdev_gendev, "%s",
> - STp->modes[mode].cdevs[rew]->kobj.name);
> - if (!st_class_member) {
> + &STp->device->sdev_gendev, "%s", name);
> + if (IS_ERR(st_class_member)) {
> printk(KERN_WARNING "st%d: class_simple_device_add failed\n",
> dev_num);
> goto out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/