public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@osdl.org
Cc: kambarov@berkeley.edu, neilb@cse.unsw.edu.au,
	trond.myklebust@fys.uio.no, zkambarov@coverity.com,
	linux-kernel@vger.kernel.org
Subject: Re: coverity-sunrpc-xprt-task-null-check.patch added to -mm tree
Date: Sat, 2 Jul 2005 16:00:25 +0400	[thread overview]
Message-ID: <200507021600.25546.adobriyan@gmail.com> (raw)
In-Reply-To: <200507010616.j616GHFJ023637@shell0.pdx.osdl.net>

On Friday 01 July 2005 10:15, akpm@osdl.org wrote:
> --- devel/net/sunrpc/xprt.c~coverity-sunrpc-xprt-task-null-check
> +++ devel-akpm/net/sunrpc/xprt.c
> @@ -140,7 +140,10 @@ xprt_from_sock(struct sock *sk)
>  static int
>  __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task)
>  {
> -	struct rpc_rqst *req = task->tk_rqstp;
> +        struct rpc_rqst *req = NULL;
> +
> +	if (task)
> +                req = task->tk_rqstp;

2 callers of __xprt_lock_write():
----------------------------------------------------------------------------
static inline int xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task)
{
        int retval;

        spin_lock_bh(&xprt->sock_lock);
===>    retval = __xprt_lock_write(xprt, task);	<===
        spin_unlock_bh(&xprt->sock_lock);
        return retval;
}
----+-----------------------------------------------------------------------
    |1 caller for xprt_lock_write():
    |
    |void xprt_connect(struct rpc_task *task)
    |{
    |===>    struct rpc_xprt *xprt = task->tk_xprt;	<===
    |
    |        dprintk("RPC: %4d xprt_connect xprt %p %s connected\n", task->tk_pid,
    |                        xprt, (xprt_connected(xprt) ? "is" : "is not"));
    |
    |        if (xprt->shutdown) {
    |                task->tk_status = -EIO;
    |                return;
    |        }
    |        if (!xprt->addr.sin_port) {
    |                task->tk_status = -EIO;
    |                return;
    |        }
    |        if (!xprt_lock_write(xprt, task))
    |
    |task was already dereferenced.
----+-----------------------------------------------------------------------
int xprt_prepare_transmit(struct rpc_task *task)
{
===>    struct rpc_rqst *req = task->tk_rqstp;	<===
        struct rpc_xprt *xprt = req->rq_xprt;
        int err = 0;

        dprintk("RPC: %4d xprt_prepare_transmit\n", task->tk_pid);

        if (xprt->shutdown)
                return -EIO;

        spin_lock_bh(&xprt->sock_lock);
        if (req->rq_received && !req->rq_bytes_sent) {
                err = req->rq_received;
                goto out_unlock;
        }
        if (!__xprt_lock_write(xprt, task)) {

task was already dereferenced.
----------------------------------------------------------------------------

           reply	other threads:[~2005-07-02 11:54 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <200507010616.j616GHFJ023637@shell0.pdx.osdl.net>]

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=200507021600.25546.adobriyan@gmail.com \
    --to=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=kambarov@berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=trond.myklebust@fys.uio.no \
    --cc=zkambarov@coverity.com \
    /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