netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeongjun Park <aha310510@gmail.com>
To: devnull+manas18244.iiitd.ac.in@kernel.org
Cc: alibuda@linux.alibaba.com, anupnewsmail@gmail.com,
	davem@davemloft.net, edumazet@google.com,
	guwen@linux.alibaba.com, horms@kernel.org, jaka@linux.ibm.com,
	kuba@kernel.org, linux-kernel@vger.kernel.org,
	linux-s390@vger.kernel.org, manas18244@iiitd.ac.in,
	netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org,
	tonylu@linux.alibaba.com, wenjia@linux.ibm.com
Subject: Re: [PATCH] Remove unused function parameter in __smc_diag_dump
Date: Mon, 11 Nov 2024 22:04:39 +0900	[thread overview]
Message-ID: <20241111130439.7536-1-aha310510@gmail.com> (raw)
In-Reply-To: <20241109-fix-oops-__smc_diag_dump-v1-1-1c55a3e54ad4@iiitd.ac.in>

Manas <devnull+manas18244.iiitd.ac.in@kernel.org> wrote:
> The last parameter in __smc_diag_dump (struct nlattr *bc) is unused.
> There is only one instance of this function being called and its passed
> with a NULL value in place of bc.
> 
> Signed-off-by: Manas <manas18244@iiitd.ac.in>
> ---
> The last parameter in __smc_diag_dump (struct nlattr *bc) is unused.
> There is only one instance of this function being called and its passed
> with a NULL value in place of bc.
> 
> Though, the compiler (gcc) optimizes it. Looking at the object dump of
> vmlinux (via `objdump -D vmlinux`), a new function clone
> (__smc_diag_dump.constprop.0) is added which removes this parameter from
> calling convention altogether.
> 
> ffffffff8a701770 <__smc_diag_dump.constprop.0>:
> ffffffff8a701770:       41 57                   push   %r15
> ffffffff8a701772:       41 56                   push   %r14
> ffffffff8a701774:       41 55                   push   %r13
> ffffffff8a701776:       41 54                   push   %r12
> 
> There are 5 parameters in original function, but in the cloned function
> only 4.
> 
> I believe this patch also fixes this oops bug[1], which arises in the
> same function __smc_diag_dump. But I couldn't verify it further. Can
> someone please test this?
> 
> [1] https://syzkaller.appspot.com/bug?extid=271fed3ed6f24600c364

Unfortunately, I tested it myself and this bug is still triggering. Basically,
this bug is not triggered in normal situations, but triggered when a race
condition occurs, so I think the root cause is somewhere else.

Regards,

Jeongjun Park

> ---
>  net/smc/smc_diag.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c
> index 6fdb2d96777ad704c394709ec845f9ddef5e599a..8f7bd40f475945171a0afa5a2cce12d9aa2b1eb4 100644
> --- a/net/smc/smc_diag.c
> +++ b/net/smc/smc_diag.c
> @@ -71,8 +71,7 @@ static int smc_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
>  
>  static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,
>  			   struct netlink_callback *cb,
> -			   const struct smc_diag_req *req,
> -			   struct nlattr *bc)
> +			   const struct smc_diag_req *req)
>  {
>  	struct smc_sock *smc = smc_sk(sk);
>  	struct smc_diag_fallback fallback;
> @@ -199,7 +198,6 @@ static int smc_diag_dump_proto(struct proto *prot, struct sk_buff *skb,
>  	struct smc_diag_dump_ctx *cb_ctx = smc_dump_context(cb);
>  	struct net *net = sock_net(skb->sk);
>  	int snum = cb_ctx->pos[p_type];
> -	struct nlattr *bc = NULL;
>  	struct hlist_head *head;
>  	int rc = 0, num = 0;
>  	struct sock *sk;
> @@ -214,7 +212,7 @@ static int smc_diag_dump_proto(struct proto *prot, struct sk_buff *skb,
>  			continue;
>  		if (num < snum)
>  			goto next;
> -		rc = __smc_diag_dump(sk, skb, cb, nlmsg_data(cb->nlh), bc);
> +		rc = __smc_diag_dump(sk, skb, cb, nlmsg_data(cb->nlh));
>  		if (rc < 0)
>  			goto out;
>  next:
> 
> ---
> base-commit: 59b723cd2adbac2a34fc8e12c74ae26ae45bf230
> change-id: 20241109-fix-oops-__smc_diag_dump-06ab3e9d39f4
> 
> Best regards,
> -- 
> Manas <manas18244@iiitd.ac.in>

  reply	other threads:[~2024-11-11 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09  6:28 [PATCH] Remove unused function parameter in __smc_diag_dump Manas via B4 Relay
2024-11-11 13:04 ` Jeongjun Park [this message]
2024-11-11 15:06   ` Manas
2024-11-11 14:11 ` Wenjia Zhang
2024-11-11 15:10   ` Manas
2024-11-12  7:36     ` Wenjia Zhang
2024-11-12 18:22       ` Simon Horman

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=20241111130439.7536-1-aha310510@gmail.com \
    --to=aha310510@gmail.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=anupnewsmail@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devnull+manas18244.iiitd.ac.in@kernel.org \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=jaka@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=manas18244@iiitd.ac.in \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).