devcoredump.c (10a03c36b7dd7759788ebc613091d313b60f93e0) | devcoredump.c (75a2d4226b53710380d1017b3f4c88f937ddba78) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(c) 2014 Intel Mobile Communications GmbH 4 * Copyright(c) 2015 Intel Deutschland GmbH 5 * 6 * Author: Johannes Berg <johannes@sipsolutions.net> 7 */ 8#include <linux/module.h> --- 153 unchanged lines hidden (view full) --- 162 if (!devcd->delete_work) 163 devcd->delete_work = true; 164 165 flush_delayed_work(&devcd->del_wk); 166 mutex_unlock(&devcd->mutex); 167 return 0; 168} 169 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(c) 2014 Intel Mobile Communications GmbH 4 * Copyright(c) 2015 Intel Deutschland GmbH 5 * 6 * Author: Johannes Berg <johannes@sipsolutions.net> 7 */ 8#include <linux/module.h> --- 153 unchanged lines hidden (view full) --- 162 if (!devcd->delete_work) 163 devcd->delete_work = true; 164 165 flush_delayed_work(&devcd->del_wk); 166 mutex_unlock(&devcd->mutex); 167 return 0; 168} 169 |
170static ssize_t disabled_show(struct class *class, struct class_attribute *attr, | 170static ssize_t disabled_show(const struct class *class, const struct class_attribute *attr, |
171 char *buf) 172{ 173 return sysfs_emit(buf, "%d\n", devcd_disabled); 174} 175 176/* 177 * 178 * disabled_store() worker() --- 13 unchanged lines hidden (view full) --- 192 * In the above diagram, It looks like disabled_store() would be racing with parallely 193 * running devcd_del() and result in memory abort while acquiring devcd->mutex which 194 * is called after kfree of devcd memory after dropping its last reference with 195 * put_device(). However, this will not happens as fn(dev, data) runs 196 * with its own reference to device via klist_node so it is not its last reference. 197 * so, above situation would not occur. 198 */ 199 | 171 char *buf) 172{ 173 return sysfs_emit(buf, "%d\n", devcd_disabled); 174} 175 176/* 177 * 178 * disabled_store() worker() --- 13 unchanged lines hidden (view full) --- 192 * In the above diagram, It looks like disabled_store() would be racing with parallely 193 * running devcd_del() and result in memory abort while acquiring devcd->mutex which 194 * is called after kfree of devcd memory after dropping its last reference with 195 * put_device(). However, this will not happens as fn(dev, data) runs 196 * with its own reference to device via klist_node so it is not its last reference. 197 * so, above situation would not occur. 198 */ 199 |
200static ssize_t disabled_store(struct class *class, struct class_attribute *attr, | 200static ssize_t disabled_store(const struct class *class, const struct class_attribute *attr, |
201 const char *buf, size_t count) 202{ 203 long tmp = simple_strtol(buf, NULL, 10); 204 205 /* 206 * This essentially makes the attribute write-once, since you can't 207 * go back to not having it disabled. This is intentional, it serves 208 * as a system lockdown feature. --- 217 unchanged lines hidden --- | 201 const char *buf, size_t count) 202{ 203 long tmp = simple_strtol(buf, NULL, 10); 204 205 /* 206 * This essentially makes the attribute write-once, since you can't 207 * go back to not having it disabled. This is intentional, it serves 208 * as a system lockdown feature. --- 217 unchanged lines hidden --- |