On Mon, Sep 22, 2014 at 03:40:55AM -0700, Yifan Zhang wrote: > You can tell it is a bug when pwq = get_work_pwq() return NULL, and > cpu_intensive = pwq->wq->flags use it w/o check.
A bug somewhere else. > Normally get_work_pwq doesn't return NULL, but we had a bug in code > which makes INIT_WORK(&work, do_work) is called in multi-thread. In > some cases, work_struct is re-init just before get_work_pwq is > called, it makes work_struct->data is invalid and thus causes the > problem. It is indeed a bug of ourselves, and after fix it there is > no such issue. But I wonder we still a NULL check before dereference > pwq here anyway, since get_work_pwq may return NULL in some cases. Do you realize how timing dependent that particular pattern of breakage is? If you're doing INIT_WORK() in racy way, there are many places which can break in workqueue. It's not that different from random memory corruption. It doesn't make any sense at all to add a special case code for that in one particular place where this specific incidence happens to trigger. In general, don't do things like this anywhere in the kernel. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

