Message ID | 20181030113545.30999-2-anders.roxell@linaro.org |
---|---|
State | Accepted |
Commit | 347a28b586802d09604a149c1a1f6de5dccbe6fa |
Headers | show |
Series | [v2,1/2] serial: set suppress_bind_attrs flag only if builtin | expand |
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 9a6bc0951cfa..c31157135598 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -258,6 +258,14 @@ static inline void wb_get(struct bdi_writeback *wb) */ static inline void wb_put(struct bdi_writeback *wb) { + if (WARN_ON_ONCE(!wb->bdi)) { + /* + * A driver bug might cause a file to be removed before bdi was + * initialized. + */ + return; + } + if (wb != &wb->bdi->wb) percpu_ref_put(&wb->refcnt); }