[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVDtAq1kSqt7C18U6G5L_EvetHjAGzUWt3toGve4BVo4Q@mail.gmail.com>
Date: Thu, 21 Mar 2019 11:05:21 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: John Hurley <john.hurley@...ronome.com>
Cc: Jiri Pirko <jiri@...lanox.com>, David Miller <davem@...emloft.net>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Vlad Buslov <vladbu@...lanox.com>, oss-drivers@...ronome.com
Subject: Re: [PATCH net 1/1] net: sched: fix cleanup NULL pointer exception in act_mirr
On Wed, Mar 20, 2019 at 11:12 AM John Hurley <john.hurley@...ronome.com> wrote:
>
> A new mirred action is created by the tcf_mirred_init function. This
> contains a list head struct which is inserted into a global list on
> successful creation of a new action. However, after a creation, it is
> still possible to error out if the egress device does not exist. This
> calls the act_mirr cleanup function via __tcf_idr_release and
> __tcf_action_put. This cleanup function tries to delete the list entry
> which is as yet uninitialised, leading to a NULL pointer exception.
Hmm, good catch but can this be just fixed by initializing it before
taking the netdevice refcnt? Like this:
@@ -163,6 +163,9 @@ static int tcf_mirred_init(struct net *net, struct
nlattr *nla,
m->tcf_action = parm->action;
m->tcfm_eaction = parm->eaction;
+ if (ret == ACT_P_CREATED)
+ INIT_LIST_HEAD(&m->tcfm_list);
+
if (parm->ifindex) {
dev = dev_get_by_index(net, parm->ifindex);
if (!dev) {
which is also much simpler.
Thanks.
Powered by blists - more mailing lists