Re: [PATCH RFC] brd: Add miscdevice to control creation and deletion of ramdisks
From: Hannes Frederic Sowa
Date: Sat Oct 13 2012 - 23:38:27 EST
On Sun, Oct 14, 2012 at 04:48:36AM +0200, Hannes Frederic Sowa wrote:
> + case BRD_CTL_DEL:
> + error = get_user(val, (int __user *)param);
> + if (error < 0)
> + break;
> + if ((val & max_part) != 0) {
> + error = -EINVAL;
> + break;
> + }
> + val >>= part_shift;
> + brd2 = NULL;
> + list_for_each_entry(brd, &brd_devices, brd_list) {
> + if (brd->brd_number == val) {
> + brd2 = brd;
> + break;
> + }
> + }
> + if (brd2 == NULL) {
> + error = -ENODEV;
> + break;
> + }
> + brd_del_one(brd2);
> + break;
Sorry, first bug spotted. I should check the bd_openers before destroying the
device. Will be fixed in a follow-up patch, if needed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/