Re: [PATCH v3] fuse: return -ECONNABORTED on /dev/fuse read after abort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Szymon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fuse/for-next]
[also build test WARNING on v4.14-rc8 next-20171109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Szymon-Lukasz/fuse-return-ECONNABORTED-on-dev-fuse-read-after-abort/20171110-013308
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)


vim +409 fs/fuse/cuse.c

151060ac1 Tejun Heo      2009-04-14  299  
151060ac1 Tejun Heo      2009-04-14  300  /**
151060ac1 Tejun Heo      2009-04-14  301   * cuse_process_init_reply - finish initializing CUSE channel
151060ac1 Tejun Heo      2009-04-14  302   *
151060ac1 Tejun Heo      2009-04-14  303   * This function creates the character device and sets up all the
151060ac1 Tejun Heo      2009-04-14  304   * required data structures for it.  Please read the comment at the
151060ac1 Tejun Heo      2009-04-14  305   * top of this file for high level overview.
151060ac1 Tejun Heo      2009-04-14  306   */
151060ac1 Tejun Heo      2009-04-14  307  static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
151060ac1 Tejun Heo      2009-04-14  308  {
30783587b David Herrmann 2012-11-17  309  	struct cuse_conn *cc = fc_to_cc(fc), *pos;
07d5f69b4 Miklos Szeredi 2011-03-21  310  	struct cuse_init_out *arg = req->out.args[0].value;
151060ac1 Tejun Heo      2009-04-14  311  	struct page *page = req->pages[0];
151060ac1 Tejun Heo      2009-04-14  312  	struct cuse_devinfo devinfo = { };
151060ac1 Tejun Heo      2009-04-14  313  	struct device *dev;
151060ac1 Tejun Heo      2009-04-14  314  	struct cdev *cdev;
151060ac1 Tejun Heo      2009-04-14  315  	dev_t devt;
30783587b David Herrmann 2012-11-17  316  	int rc, i;
151060ac1 Tejun Heo      2009-04-14  317  
151060ac1 Tejun Heo      2009-04-14  318  	if (req->out.h.error ||
151060ac1 Tejun Heo      2009-04-14  319  	    arg->major != FUSE_KERNEL_VERSION || arg->minor < 11) {
151060ac1 Tejun Heo      2009-04-14  320  		goto err;
151060ac1 Tejun Heo      2009-04-14  321  	}
151060ac1 Tejun Heo      2009-04-14  322  
151060ac1 Tejun Heo      2009-04-14  323  	fc->minor = arg->minor;
151060ac1 Tejun Heo      2009-04-14  324  	fc->max_read = max_t(unsigned, arg->max_read, 4096);
151060ac1 Tejun Heo      2009-04-14  325  	fc->max_write = max_t(unsigned, arg->max_write, 4096);
151060ac1 Tejun Heo      2009-04-14  326  
151060ac1 Tejun Heo      2009-04-14  327  	/* parse init reply */
151060ac1 Tejun Heo      2009-04-14  328  	cc->unrestricted_ioctl = arg->flags & CUSE_UNRESTRICTED_IOCTL;
151060ac1 Tejun Heo      2009-04-14  329  
151060ac1 Tejun Heo      2009-04-14  330  	rc = cuse_parse_devinfo(page_address(page), req->out.args[1].size,
151060ac1 Tejun Heo      2009-04-14  331  				&devinfo);
151060ac1 Tejun Heo      2009-04-14  332  	if (rc)
151060ac1 Tejun Heo      2009-04-14  333  		goto err;
151060ac1 Tejun Heo      2009-04-14  334  
151060ac1 Tejun Heo      2009-04-14  335  	/* determine and reserve devt */
151060ac1 Tejun Heo      2009-04-14  336  	devt = MKDEV(arg->dev_major, arg->dev_minor);
151060ac1 Tejun Heo      2009-04-14  337  	if (!MAJOR(devt))
151060ac1 Tejun Heo      2009-04-14  338  		rc = alloc_chrdev_region(&devt, MINOR(devt), 1, devinfo.name);
151060ac1 Tejun Heo      2009-04-14  339  	else
151060ac1 Tejun Heo      2009-04-14  340  		rc = register_chrdev_region(devt, 1, devinfo.name);
151060ac1 Tejun Heo      2009-04-14  341  	if (rc) {
151060ac1 Tejun Heo      2009-04-14  342  		printk(KERN_ERR "CUSE: failed to register chrdev region\n");
151060ac1 Tejun Heo      2009-04-14  343  		goto err;
151060ac1 Tejun Heo      2009-04-14  344  	}
151060ac1 Tejun Heo      2009-04-14  345  
151060ac1 Tejun Heo      2009-04-14  346  	/* devt determined, create device */
151060ac1 Tejun Heo      2009-04-14  347  	rc = -ENOMEM;
151060ac1 Tejun Heo      2009-04-14  348  	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
151060ac1 Tejun Heo      2009-04-14  349  	if (!dev)
151060ac1 Tejun Heo      2009-04-14  350  		goto err_region;
151060ac1 Tejun Heo      2009-04-14  351  
151060ac1 Tejun Heo      2009-04-14  352  	device_initialize(dev);
151060ac1 Tejun Heo      2009-04-14  353  	dev_set_uevent_suppress(dev, 1);
151060ac1 Tejun Heo      2009-04-14  354  	dev->class = cuse_class;
151060ac1 Tejun Heo      2009-04-14  355  	dev->devt = devt;
151060ac1 Tejun Heo      2009-04-14  356  	dev->release = cuse_gendev_release;
151060ac1 Tejun Heo      2009-04-14  357  	dev_set_drvdata(dev, cc);
151060ac1 Tejun Heo      2009-04-14  358  	dev_set_name(dev, "%s", devinfo.name);
151060ac1 Tejun Heo      2009-04-14  359  
30783587b David Herrmann 2012-11-17  360  	mutex_lock(&cuse_lock);
30783587b David Herrmann 2012-11-17  361  
30783587b David Herrmann 2012-11-17  362  	/* make sure the device-name is unique */
30783587b David Herrmann 2012-11-17  363  	for (i = 0; i < CUSE_CONNTBL_LEN; ++i) {
30783587b David Herrmann 2012-11-17  364  		list_for_each_entry(pos, &cuse_conntbl[i], list)
30783587b David Herrmann 2012-11-17  365  			if (!strcmp(dev_name(pos->dev), dev_name(dev)))
30783587b David Herrmann 2012-11-17  366  				goto err_unlock;
30783587b David Herrmann 2012-11-17  367  	}
30783587b David Herrmann 2012-11-17  368  
151060ac1 Tejun Heo      2009-04-14  369  	rc = device_add(dev);
151060ac1 Tejun Heo      2009-04-14  370  	if (rc)
30783587b David Herrmann 2012-11-17  371  		goto err_unlock;
151060ac1 Tejun Heo      2009-04-14  372  
151060ac1 Tejun Heo      2009-04-14  373  	/* register cdev */
151060ac1 Tejun Heo      2009-04-14  374  	rc = -ENOMEM;
151060ac1 Tejun Heo      2009-04-14  375  	cdev = cdev_alloc();
151060ac1 Tejun Heo      2009-04-14  376  	if (!cdev)
30783587b David Herrmann 2012-11-17  377  		goto err_unlock;
151060ac1 Tejun Heo      2009-04-14  378  
151060ac1 Tejun Heo      2009-04-14  379  	cdev->owner = THIS_MODULE;
151060ac1 Tejun Heo      2009-04-14  380  	cdev->ops = &cuse_frontend_fops;
151060ac1 Tejun Heo      2009-04-14  381  
151060ac1 Tejun Heo      2009-04-14  382  	rc = cdev_add(cdev, devt, 1);
151060ac1 Tejun Heo      2009-04-14  383  	if (rc)
151060ac1 Tejun Heo      2009-04-14  384  		goto err_cdev;
151060ac1 Tejun Heo      2009-04-14  385  
151060ac1 Tejun Heo      2009-04-14  386  	cc->dev = dev;
151060ac1 Tejun Heo      2009-04-14  387  	cc->cdev = cdev;
151060ac1 Tejun Heo      2009-04-14  388  
151060ac1 Tejun Heo      2009-04-14  389  	/* make the device available */
151060ac1 Tejun Heo      2009-04-14  390  	list_add(&cc->list, cuse_conntbl_head(devt));
8ce03fd76 David Herrmann 2012-11-17  391  	mutex_unlock(&cuse_lock);
151060ac1 Tejun Heo      2009-04-14  392  
151060ac1 Tejun Heo      2009-04-14  393  	/* announce device availability */
151060ac1 Tejun Heo      2009-04-14  394  	dev_set_uevent_suppress(dev, 0);
151060ac1 Tejun Heo      2009-04-14  395  	kobject_uevent(&dev->kobj, KOBJ_ADD);
151060ac1 Tejun Heo      2009-04-14  396  out:
07d5f69b4 Miklos Szeredi 2011-03-21  397  	kfree(arg);
151060ac1 Tejun Heo      2009-04-14  398  	__free_page(page);
151060ac1 Tejun Heo      2009-04-14  399  	return;
151060ac1 Tejun Heo      2009-04-14  400  
151060ac1 Tejun Heo      2009-04-14  401  err_cdev:
151060ac1 Tejun Heo      2009-04-14  402  	cdev_del(cdev);
30783587b David Herrmann 2012-11-17  403  err_unlock:
30783587b David Herrmann 2012-11-17  404  	mutex_unlock(&cuse_lock);
151060ac1 Tejun Heo      2009-04-14  405  	put_device(dev);
151060ac1 Tejun Heo      2009-04-14  406  err_region:
151060ac1 Tejun Heo      2009-04-14  407  	unregister_chrdev_region(devt, 1);
151060ac1 Tejun Heo      2009-04-14  408  err:
580640ba5 Miklos Szeredi 2014-12-12 @409  	fuse_abort_conn(fc);
151060ac1 Tejun Heo      2009-04-14  410  	goto out;
151060ac1 Tejun Heo      2009-04-14  411  }
151060ac1 Tejun Heo      2009-04-14  412  

:::::: The code at line 409 was first introduced by commit
:::::: 580640ba5d331eb5631a5de46941c98f5ed90886 fuse: flush requests on umount

:::::: TO: Miklos Szeredi <mszeredi@xxxxxxx>
:::::: CC: Miklos Szeredi <mszeredi@xxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux