linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kolga@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [bug report] NFSD introduce async copy feature
Date: Wed, 4 Dec 2019 11:00:21 +0300	[thread overview]
Message-ID: <20191204080021.fihx325kpaun5b2a@kili.mountain> (raw)

Hello Olga Kornievskaia,

This is a semi-automatic email about new static checker warnings.

The patch e0639dc5805a: "NFSD introduce async copy feature" from Jul 
20, 2018, leads to the following Smatch complaint:

    fs/nfsd/nfs4proc.c:1555 nfsd4_copy()
     error: we previously assumed 'async_copy' could be null (see line 1529)

fs/nfsd/nfs4proc.c
  1528			async_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL);
  1529			if (!async_copy)
  1530				goto out_err;
                                ^^^^^^^^^^^^
There are a couple error paths where async_copy is NULL.

  1531			if (!nfs4_init_copy_state(nn, copy))
  1532				goto out_err;
  1533			refcount_set(&async_copy->refcount, 1);
  1534			memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
  1535				sizeof(copy->cp_stateid));
  1536			status = dup_copy_fields(copy, async_copy);
  1537			if (status)
  1538				goto out_err;
  1539			async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
  1540					async_copy, "%s", "copy thread");
  1541			if (IS_ERR(async_copy->copy_task))
  1542				goto out_err;
  1543			spin_lock(&async_copy->cp_clp->async_lock);
  1544			list_add(&async_copy->copies,
  1545					&async_copy->cp_clp->async_copies);
  1546			spin_unlock(&async_copy->cp_clp->async_lock);
  1547			wake_up_process(async_copy->copy_task);
  1548			status = nfs_ok;
  1549		} else {
  1550			status = nfsd4_do_copy(copy, 1);
  1551		}
  1552	out:
  1553		return status;
  1554	out_err:
  1555		cleanup_async_copy(async_copy);
                                   ^^^^^^^^^^
Dereferenced inside the function.

  1556		status = nfserrno(-ENOMEM);
  1557		if (!copy->cp_intra)

regards,
dan carpenter

             reply	other threads:[~2019-12-04  8:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  8:00 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-30  9:30 [bug report] NFSD introduce async copy feature Dan Carpenter
2019-12-04  8:00 Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191204080021.fihx325kpaun5b2a@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kolga@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).